add delete customer
This commit is contained in:
parent
aebbfa65ce
commit
bf25b7489f
@ -17,7 +17,7 @@
|
||||
|
||||
<properties>
|
||||
<project.build.finalName>ambition-crm</project.build.finalName>
|
||||
<start-class>com.pudonghot.ambition.crm.AmbitionCRM</start-class>
|
||||
<spring-boot.run.main-class>com.pudonghot.ambition.crm.AmbitionCRM</spring-boot.run.main-class>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -99,6 +99,10 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>false</skip>
|
||||
<fork>true</fork>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -11,6 +11,7 @@ import javax.validation.constraints.Min;
|
||||
import me.chyxion.tigon.model.ListResult;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import me.chyxion.tigon.webmvc.ResourceModel;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.pudonghot.ambition.crm.model.User;
|
||||
@ -20,6 +21,7 @@ import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.pudonghot.ambition.crm.model.CustomerProperty;
|
||||
import com.pudonghot.ambition.crm.service.CustomerService;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -163,6 +165,12 @@ public class CustomerController
|
||||
"text/csv; charset=gbk", null);
|
||||
}
|
||||
|
||||
@RequiresRoles(User.ROLE_ADMIN)
|
||||
@PostMapping("/delete")
|
||||
public void delete(@NotBlank @RequestParam("id") String id) {
|
||||
((CustomerService) queryService).delete(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@ package com.pudonghot.ambition.crm.service.support;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import lombok.val;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.springframework.util.Assert;
|
||||
@ -9,7 +10,6 @@ import me.chyxion.tigon.mybatis.Search;
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import org.apache.commons.csv.CSVRecord;
|
||||
import org.apache.commons.csv.CSVFormat;
|
||||
import org.apache.commons.csv.CSVPrinter;
|
||||
import com.pudonghot.ambition.crm.model.*;
|
||||
import me.chyxion.tigon.model.ListResult;
|
||||
import com.pudonghot.ambition.crm.mapper.*;
|
||||
@ -82,20 +82,21 @@ public class CustomerServiceSupport
|
||||
|
||||
/**
|
||||
* override find by id with find by search
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ViewModel<Customer> findViewModel(final String id) {
|
||||
final Customer customer = mapper.findForShow(id);
|
||||
val customer = mapper.findForShow(id);
|
||||
ViewModel<Customer> viewModel = null;
|
||||
if (customer != null) {
|
||||
viewModel = toViewModel(customer);
|
||||
|
||||
// accounts
|
||||
final List<CustomerPermission> permissions = customerPermissionMapper.list(
|
||||
val permissions = customerPermissionMapper.list(
|
||||
new Search(CustomerPermission.CUSTOMER_ID, id)
|
||||
.eq(CustomerPermission.ENABLED, true));
|
||||
final List<String> accounts = new ArrayList<>(permissions.size());
|
||||
val accounts = new ArrayList<>(permissions.size());
|
||||
for (CustomerPermission permission : permissions) {
|
||||
accounts.add(permission.getUserAccount());
|
||||
}
|
||||
@ -113,6 +114,7 @@ public class CustomerServiceSupport
|
||||
applicationMapper.list(new Search().asc(Application.NAME)));
|
||||
|
||||
}
|
||||
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
@ -122,7 +124,7 @@ public class CustomerServiceSupport
|
||||
@Override
|
||||
public ListResult<ViewModel<Customer>> listViewModelsPage(Search search) {
|
||||
final String account = search.getAttr(User.ACCOUNT);
|
||||
final ListResult<ViewModel<Customer>> result =
|
||||
val result =
|
||||
new ListResult<>(toViewModel(
|
||||
mapper.listForShow(search, account)),
|
||||
mapper.countForShow(search, account));
|
||||
@ -136,12 +138,12 @@ public class CustomerServiceSupport
|
||||
result.setAttr("cityList", mapper.listCity());
|
||||
result.setAttr("salespersonList", mapper.listSalesperson());
|
||||
|
||||
final List<CustomerProperty> statusList =
|
||||
val statusList =
|
||||
customerPropertyMapper.list(
|
||||
new Search(CustomerProperty.TYPE,
|
||||
CustomerProperty.Type.STATUS)
|
||||
.asc(CustomerProperty.SORT));
|
||||
final CustomerProperty noneStatus = new CustomerProperty();
|
||||
val noneStatus = new CustomerProperty();
|
||||
noneStatus.setId("null");
|
||||
noneStatus.setName("None");
|
||||
noneStatus.setEnabled(true);
|
||||
@ -161,26 +163,25 @@ public class CustomerServiceSupport
|
||||
*/
|
||||
@Override
|
||||
public ViewModel<Customer> update(final CustomerFormForUpdate form) {
|
||||
final String customerId = form.getId();
|
||||
val customerId = form.getId();
|
||||
customerApplicationMapper.delete(
|
||||
new Search(CustomerApplication.CUSTOMER_ID, customerId));
|
||||
customerPermissionMapper.delete(
|
||||
new Search(CustomerPermission.CUSTOMER_ID, customerId)
|
||||
.eq(CustomerPermission.TYPE, CustomerPermission.Type.APPLICATION));
|
||||
|
||||
final String[] applications = form.getApplications();
|
||||
val applications = form.getApplications();
|
||||
if (applications != null && applications.length > 0) {
|
||||
final String operator = form.getUpdatedBy();
|
||||
final Date now = new Date();
|
||||
for (final String applicationId : applications) {
|
||||
final Application application =
|
||||
applicationMapper.find(applicationId);
|
||||
val operator = form.getUpdatedBy();
|
||||
val now = new Date();
|
||||
for (val applicationId : applications) {
|
||||
val application = applicationMapper.find(applicationId);
|
||||
Assert.state(application != null,
|
||||
"No application [" + applicationId + "] found");
|
||||
Assert.state(application.isEnabled(),
|
||||
"Application [" + application.getName() + "] is disabled");
|
||||
|
||||
final CustomerApplication customerApplication = new CustomerApplication();
|
||||
val customerApplication = new CustomerApplication();
|
||||
customerApplication.setId(idSeq.get());
|
||||
customerApplication.setEnabled(true);
|
||||
customerApplication.setCustomerId(customerId);
|
||||
@ -189,7 +190,7 @@ public class CustomerServiceSupport
|
||||
customerApplication.setDateCreated(now);
|
||||
customerApplicationMapper.insert(customerApplication);
|
||||
|
||||
final String applicationOwner = application.getOwner();
|
||||
val applicationOwner = application.getOwner();
|
||||
if (StringUtils.isNotBlank(applicationOwner)) {
|
||||
log.info("Add application owner [{}] customer [{}] permission.",
|
||||
applicationOwner, customerId);
|
||||
@ -210,15 +211,15 @@ public class CustomerServiceSupport
|
||||
|
||||
List<Map<String, Object>> ytdSales = null;
|
||||
|
||||
final String strYears = model.getYears();
|
||||
final String strYtdSales = model.getYtdSales();
|
||||
val strYears = model.getYears();
|
||||
val strYtdSales = model.getYtdSales();
|
||||
|
||||
String[] years = null;
|
||||
if (StringUtils.isNotBlank(strYears) &&
|
||||
StringUtils.isNotBlank(strYtdSales)) {
|
||||
years = strYears.split(SPLITTER);
|
||||
|
||||
final String[] sales = strYtdSales.split(SPLITTER);
|
||||
val sales = strYtdSales.split(SPLITTER);
|
||||
ytdSales = new ArrayList<>(years.length);
|
||||
int i = 0;
|
||||
for (final String year : years) {
|
||||
@ -233,26 +234,15 @@ public class CustomerServiceSupport
|
||||
viewModel.setAttr("ytdSales", ytdSales != null ?
|
||||
ytdSales : Collections.emptyList());
|
||||
|
||||
// recent 3 issues
|
||||
// final List<ViewModel<CustomerIssue>> recentIssues =
|
||||
// customerIssueService.listRecent(model.getId(), 3);
|
||||
|
||||
final String lastIssue = model.getLastIssue();
|
||||
val lastIssue = model.getLastIssue();
|
||||
if (StringUtils.isNotBlank(lastIssue)) {
|
||||
final String[] issueParts = lastIssue.split(SPLITTER);
|
||||
val issueParts = lastIssue.split(SPLITTER);
|
||||
CustomerIssue issue = new CustomerIssue();
|
||||
issue.setId(issueParts[0]);
|
||||
issue.setIssue(issueParts[1]);
|
||||
issue.setDateCreated(new Date(Long.parseLong(issueParts[2])));
|
||||
viewModel.setAttr("issue1", issue);
|
||||
}
|
||||
// if (!recentIssues.isEmpty()) {
|
||||
// int i = 0;
|
||||
// final Iterator<ViewModel<CustomerIssue>> it = recentIssues.iterator();
|
||||
// while (it.hasNext()) {
|
||||
// viewModel.setAttr("issue" + (++i), it.next());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@ -262,9 +252,8 @@ public class CustomerServiceSupport
|
||||
@Override
|
||||
public void importCSV(final String operator, final InputStream csvIn) {
|
||||
|
||||
final Date now = new Date();
|
||||
|
||||
final ImportRecord importRecord = new ImportRecord();
|
||||
val now = new Date();
|
||||
val importRecord = new ImportRecord();
|
||||
importRecord.setId(idSeq.get());
|
||||
importRecord.setType(ImportRecord.TYPE_CUSTOMER);
|
||||
importRecord.setCompleted(false);
|
||||
@ -279,6 +268,32 @@ public class CustomerServiceSupport
|
||||
private final User user = new User();
|
||||
private final CustomerPermission permission = new CustomerPermission();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void read(final CSVRecord record) {
|
||||
val customerId = record.get(0).trim();
|
||||
if (StringUtils.isBlank(customerId)) {
|
||||
log.info("Blank customer id found, ignore.");
|
||||
return;
|
||||
}
|
||||
customer.setId(customerId);
|
||||
customer.setName(record.get(1).trim());
|
||||
customer.setCountryCode(record.get(2).trim());
|
||||
customer.setState(record.get(3).trim());
|
||||
customer.setCity(record.get(4).trim());
|
||||
customer.setMs(record.get(5).trim());
|
||||
customer.setRegion(record.get(6).trim());
|
||||
val employeeId = StringUtils.defaultIfBlank(record.get(7).trim(), null);
|
||||
customer.setSalesperson(employeeId);
|
||||
log.info("Customer [{}] read.", customer);
|
||||
|
||||
createUserIfNotExist(operator, employeeId, now);
|
||||
createOrUpdateCustomer(operator, customer, now);
|
||||
createOrUpdateCustomerPermissions(operator, customerId, record.get(8), now);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -298,32 +313,6 @@ public class CustomerServiceSupport
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void read(final CSVRecord record) {
|
||||
final String customerId = record.get(0).trim();
|
||||
if (StringUtils.isBlank(customerId)) {
|
||||
log.info("Blank customer id found, ignore.");
|
||||
return;
|
||||
}
|
||||
customer.setId(customerId);
|
||||
customer.setName(record.get(1).trim());
|
||||
customer.setCountryCode(record.get(2).trim());
|
||||
customer.setState(record.get(3).trim());
|
||||
customer.setCity(record.get(4).trim());
|
||||
customer.setMs(record.get(5).trim());
|
||||
customer.setRegion(record.get(6).trim());
|
||||
final String employeeId = StringUtils.defaultIfBlank(record.get(7).trim(), null);
|
||||
customer.setSalesperson(employeeId);
|
||||
log.info("Customer [{}] read.", customer);
|
||||
|
||||
createUserIfNotExist(operator, employeeId, now);
|
||||
createOrUpdateCustomer(operator, customer, now);
|
||||
createOrUpdateCustomerPermissions(operator, customerId, record.get(8), now);
|
||||
}
|
||||
|
||||
// --
|
||||
// private methods
|
||||
|
||||
@ -336,7 +325,7 @@ public class CustomerServiceSupport
|
||||
user.setAccount(employeeId);
|
||||
user.setEmployeeId(employeeId);
|
||||
|
||||
final String password = idSeq.get();
|
||||
val password = idSeq.get();
|
||||
user.setPassword(password);
|
||||
user.setGender(Constants.GENDER_MALE);
|
||||
user.setEnabled(true);
|
||||
@ -351,10 +340,10 @@ public class CustomerServiceSupport
|
||||
|
||||
private void createOrUpdateCustomer(final String operator, final Customer customer, final Date date) {
|
||||
log.info("User [{}] create or update customer [{}].", operator, customer);
|
||||
final String customerId = customer.getId();
|
||||
final String ms = customer.getMs();
|
||||
val customerId = customer.getId();
|
||||
val ms = customer.getMs();
|
||||
|
||||
final Customer customerExisted = mapper.find(customerId);
|
||||
val customerExisted = mapper.find(customerId);
|
||||
if (customerExisted != null) {
|
||||
log.info("Customer existed [{}] found, update.", customerExisted);
|
||||
// basic props
|
||||
@ -386,7 +375,7 @@ public class CustomerServiceSupport
|
||||
if (customerIssueMapper.count(
|
||||
new Search(CustomerIssue.CUSTOMER_ID, customerId)
|
||||
.eq(CustomerIssue.ENABLED, true)) < 1) {
|
||||
final CustomerIssue ci = new CustomerIssue();
|
||||
val ci = new CustomerIssue();
|
||||
ci.setId(idSeq.get());
|
||||
ci.setArtificial(false);
|
||||
ci.setCustomerId(customerId);
|
||||
@ -404,11 +393,11 @@ public class CustomerServiceSupport
|
||||
log.info("User [{}] create or update customer [{}] permissions [{}].", operator, customerId, strAccounts);
|
||||
|
||||
if (StringUtils.isNotBlank(strAccounts)) {
|
||||
for (final String account : new HashSet<>(
|
||||
for (val account : new HashSet<>(
|
||||
Arrays.asList(strAccounts.trim().split("\\s*,\\s*")))) {
|
||||
|
||||
if (StringUtils.isNotBlank(account)) {
|
||||
final CustomerPermission permOld = customerPermissionMapper.find(
|
||||
val permOld = customerPermissionMapper.find(
|
||||
new Search(CustomerPermission.CUSTOMER_ID, customerId)
|
||||
.eq(CustomerPermission.USER_ACCOUNT, account));
|
||||
if (permOld != null) {
|
||||
@ -458,12 +447,12 @@ public class CustomerServiceSupport
|
||||
*/
|
||||
@Override
|
||||
public File exportCSV(final String operator) {
|
||||
final File file = new File(FileUtils.getTempDirectory(),
|
||||
val file = new File(FileUtils.getTempDirectory(),
|
||||
"Customers_" + DateFormatUtils.format(System.currentTimeMillis(),
|
||||
"yyyy-MM-dd_HHmmss") + ".csv");
|
||||
try (final OutputStreamWriter fileWriter =
|
||||
try (val fileWriter =
|
||||
new OutputStreamWriter(new FileOutputStream(file), CSVUtils.GBK);
|
||||
final CSVPrinter printer = EXPORT_FORMAT.print(fileWriter)) {
|
||||
val printer = EXPORT_FORMAT.print(fileWriter)) {
|
||||
|
||||
scan(512, new Search()
|
||||
// .setAttr("APPLICATION_NOT_NULL", true)
|
||||
@ -545,12 +534,12 @@ public class CustomerServiceSupport
|
||||
private String joinYtdSales(final String strYears, final String strYtdSales) {
|
||||
if (StringUtils.isNotBlank(strYears) &&
|
||||
StringUtils.isNotBlank(strYtdSales)) {
|
||||
final String[] years = strYears.split(SPLITTER);
|
||||
final String[] sales = strYtdSales.split(SPLITTER);
|
||||
final List<String> ytdSales = new ArrayList<>(years.length);
|
||||
val years = strYears.split(SPLITTER);
|
||||
val sales = strYtdSales.split(SPLITTER);
|
||||
val ytdSales = new ArrayList<>(years.length);
|
||||
|
||||
int i = 0;
|
||||
for (final String year : years) {
|
||||
for (val year : years) {
|
||||
ytdSales.add(year + ": " + sales[i++]);
|
||||
}
|
||||
return StringUtils.join(ytdSales, "\n");
|
||||
@ -561,4 +550,24 @@ public class CustomerServiceSupport
|
||||
private String dateFormat(Date date, String pattern) {
|
||||
return date != null ? DateFormatUtils.format(date, pattern) : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Customer delete(final String id) {
|
||||
val customer = super.delete(id);
|
||||
Assert.state(customer != null,
|
||||
"No customer [" + id + "] found");
|
||||
customerPermissionMapper.delete(
|
||||
new Search(CustomerPermission.CUSTOMER_ID, id));
|
||||
customerIssueMapper.delete(
|
||||
new Search(CustomerIssue.CUSTOMER_ID, id));
|
||||
customerYearToDateSaleMapper.delete(
|
||||
new Search(CustomerYearToDateSale.CUSTOMER_ID, id));
|
||||
customerApplicationMapper.delete(
|
||||
new Search(CustomerApplication.CUSTOMER_ID, id));
|
||||
|
||||
return customer;
|
||||
}
|
||||
}
|
||||
|
28
server/launch.sh
Executable file
28
server/launch.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# get real path of softlink
|
||||
get_real_path() {
|
||||
local f="$1"
|
||||
while [ -h "$f" ]; do
|
||||
ls=`ls -ld "$f"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
f="$link"
|
||||
else
|
||||
f=`dirname "$f"`/"$link"
|
||||
fi
|
||||
done
|
||||
echo "$f"
|
||||
}
|
||||
|
||||
prg_path=$(get_real_path "$0")
|
||||
echo "Script path [$prg_path]"
|
||||
|
||||
# Service Home
|
||||
pushd $(dirname "$prg_path")
|
||||
WORK_DIR=$(pwd)
|
||||
echo "Work dir [$WORK_DIR]"
|
||||
|
||||
mvn -T 4C clean -pl crm -am -DskipTests \
|
||||
spring-boot:run
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 7a0c14ba3f821049872595609dbf278cf410cbd5
|
||||
Subproject commit 40acef80b8af560cbf19a0a841748c0d63406dde
|
@ -10,7 +10,7 @@
|
||||
|
||||
<properties>
|
||||
<packaging>jar</packaging>
|
||||
<tigon.webmvc.scrope>provided</tigon.webmvc.scrope>
|
||||
<tigon.webmvc.scope>provided</tigon.webmvc.scope>
|
||||
</properties>
|
||||
|
||||
<parent>
|
||||
@ -36,7 +36,7 @@
|
||||
<dependency>
|
||||
<groupId>me.chyxion.tigon</groupId>
|
||||
<artifactId>tigon-web</artifactId>
|
||||
<scope>${tigon.webmvc.scrope}</scope>
|
||||
<scope>${tigon.webmvc.scope}</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
@ -67,7 +67,7 @@
|
||||
</activation>
|
||||
<properties>
|
||||
<packaging>war</packaging>
|
||||
<tigon.webmvc.scrope>compile</tigon.webmvc.scrope>
|
||||
<tigon.webmvc.scope>compile</tigon.webmvc.scope>
|
||||
<maven.tomcat.port>8088</maven.tomcat.port>
|
||||
<log.level>DEBUG</log.level>
|
||||
<log.dir>${project.basedir}/.logs</log.dir>
|
||||
|
@ -4,6 +4,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
import me.chyxion.tigon.mybatis.UseGeneratedKeys;
|
||||
|
||||
/**
|
||||
@ -15,17 +16,11 @@ import me.chyxion.tigon.mybatis.UseGeneratedKeys;
|
||||
@Getter
|
||||
@Setter
|
||||
@UseGeneratedKeys
|
||||
@FieldNameConstants(prefix = "")
|
||||
@Table("crm_auth_failed_log")
|
||||
public class AuthFailedLog extends M3<String, Long> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String LOGIN_ID = "login_id";
|
||||
public static final String PASSWORD = "password";
|
||||
public static final String IP = "ip";
|
||||
public static final String USER_AGENT = "user_agent";
|
||||
public static final String EXT = "ext";
|
||||
|
||||
// Properties
|
||||
private String loginId;
|
||||
private String password;
|
||||
|
@ -4,6 +4,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
import me.chyxion.tigon.mybatis.UseGeneratedKeys;
|
||||
|
||||
/**
|
||||
@ -16,19 +17,13 @@ import me.chyxion.tigon.mybatis.UseGeneratedKeys;
|
||||
@Setter
|
||||
@UseGeneratedKeys
|
||||
@Table("crm_auth_log")
|
||||
@FieldNameConstants(prefix = "")
|
||||
public class AuthLog extends M3<String, Long> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String USER_ID = "user_id";
|
||||
public static final String USER_AGENT = "user_agent";
|
||||
public static final String IP = "ip";
|
||||
public static final String EXT = "ext";
|
||||
|
||||
// Properties
|
||||
private String userId;
|
||||
private String userAgent;
|
||||
private String ip;
|
||||
private String ext;
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package com.pudonghot.ambition.crm.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.util.Date;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
@ -16,22 +18,10 @@ import me.chyxion.tigon.mybatis.Transient;
|
||||
@Getter
|
||||
@Setter
|
||||
@Table("crm_customer")
|
||||
@FieldNameConstants(prefix = "")
|
||||
public class Customer extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String SALESPERSON = "salesperson";
|
||||
public static final String DATE_ADDED = "date_added";
|
||||
public static final String NAME = "name";
|
||||
public static final String COUNTRY_CODE = "country_code";
|
||||
public static final String STATE = "state";
|
||||
public static final String CITY = "city";
|
||||
public static final String MS = "ms";
|
||||
public static final String REGION = "region";
|
||||
public static final String STATUS = "status";
|
||||
public static final String SUM_YTD_SALES = "sum_ytd_sales";
|
||||
public static final String COUNT_YTD_SALES = "count_ytd_sales";
|
||||
|
||||
// Properties
|
||||
private String salesperson;
|
||||
private Date dateAdded;
|
||||
|
@ -2,8 +2,9 @@ package com.pudonghot.ambition.crm.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
@ -13,14 +14,11 @@ import me.chyxion.tigon.model.M3;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@FieldNameConstants(prefix = "")
|
||||
@Table("crm_customer_application")
|
||||
public class CustomerApplication extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String CUSTOMER_ID = "customer_id";
|
||||
public static final String APPLICATION_ID = "application_id";
|
||||
|
||||
// Properties
|
||||
private String customerId;
|
||||
private String applicationId;
|
||||
|
@ -4,6 +4,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
@ -13,15 +14,11 @@ import me.chyxion.tigon.mybatis.Table;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@FieldNameConstants(prefix = "")
|
||||
@Table("crm_customer_issue")
|
||||
public class CustomerIssue extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String CUSTOMER_ID = "customer_id";
|
||||
public static final String ISSUE = "issue";
|
||||
public static final String ARTIFICIAL = "artificial";
|
||||
|
||||
// Properties
|
||||
private String customerId;
|
||||
private String issue;
|
||||
|
@ -4,6 +4,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
@ -13,15 +14,11 @@ import me.chyxion.tigon.mybatis.Table;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@FieldNameConstants(prefix = "")
|
||||
@Table("crm_customer_permission")
|
||||
public class CustomerPermission extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String USER_ACCOUNT = "user_account";
|
||||
public static final String CUSTOMER_ID = "customer_id";
|
||||
public static final String TYPE = "type";
|
||||
|
||||
public enum Type {
|
||||
SYSTEM,
|
||||
APPLICATION
|
||||
|
@ -5,6 +5,7 @@ import lombok.Setter;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.mybatis.NotUpdate;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
import me.chyxion.tigon.mybatis.NotUpdateWhenNull;
|
||||
|
||||
/**
|
||||
@ -15,6 +16,7 @@ import me.chyxion.tigon.mybatis.NotUpdateWhenNull;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@FieldNameConstants(prefix = "")
|
||||
@Table("crm_customer_property")
|
||||
public class CustomerProperty extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -24,8 +26,7 @@ public class CustomerProperty extends M3<String, String> {
|
||||
*/
|
||||
// public static final String TYPE_STATUS = "STATUS";
|
||||
public enum Type {
|
||||
STATUS,
|
||||
// APPLICATION,
|
||||
STATUS
|
||||
}
|
||||
|
||||
// system status
|
||||
@ -38,11 +39,6 @@ public class CustomerProperty extends M3<String, String> {
|
||||
public static final String STATUS_NA_ID = "STATUS_NA";
|
||||
public static final String STATUS_NA_NAME = "NA";
|
||||
|
||||
// Column Names
|
||||
public static final String TYPE = "type";
|
||||
public static final String NAME = "name";
|
||||
public static final String SORT = "sort";
|
||||
|
||||
// Properties
|
||||
@NotUpdate
|
||||
private Type type;
|
||||
|
@ -4,6 +4,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
@ -13,15 +14,11 @@ import me.chyxion.tigon.mybatis.Table;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@FieldNameConstants(prefix = "")
|
||||
@Table("crm_customer_year_to_date_sale")
|
||||
public class CustomerYearToDateSale extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String CUSTOMER_ID = "customer_id";
|
||||
public static final String YEAR = "year";
|
||||
public static final String YTD_SALE = "ytd_sale";
|
||||
|
||||
// Properties
|
||||
private String customerId;
|
||||
private String year;
|
||||
|
@ -5,6 +5,7 @@ import lombok.Setter;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.mybatis.Transient;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
@ -16,17 +17,10 @@ import me.chyxion.tigon.mybatis.Transient;
|
||||
@Getter
|
||||
@Setter
|
||||
@Table("crm_file_info")
|
||||
@FieldNameConstants(prefix = "")
|
||||
public class FileInfo extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String NAME = "name";
|
||||
public static final String FILE_PATH = "file_path";
|
||||
public static final String FORMAT = "format";
|
||||
public static final String DOWNLOAD_NAME = "download_name";
|
||||
public static final String CONTENT_LENGTH = "content_length";
|
||||
public static final String CONTENT_TYPE = "content_type";
|
||||
|
||||
// Properties
|
||||
private String name;
|
||||
private String filePath;
|
||||
|
@ -4,6 +4,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
@ -14,14 +15,10 @@ import me.chyxion.tigon.mybatis.Table;
|
||||
@Getter
|
||||
@Setter
|
||||
@Table("crm_home_page")
|
||||
@FieldNameConstants(prefix = "")
|
||||
public class HomePage extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String NAME = "name";
|
||||
public static final String CONTENT = "content";
|
||||
public static final String APPLYING = "applying";
|
||||
|
||||
// Properties
|
||||
private String name;
|
||||
private String content;
|
||||
|
@ -6,6 +6,7 @@ import me.chyxion.tigon.model.M3;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.mybatis.NotUpdate;
|
||||
import me.chyxion.tigon.mybatis.Transient;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
/**
|
||||
* @author Shaun Chyxion <br>
|
||||
@ -15,6 +16,7 @@ import me.chyxion.tigon.mybatis.Transient;
|
||||
@Getter
|
||||
@Setter
|
||||
@Table("crm_import_record")
|
||||
@FieldNameConstants(prefix = "")
|
||||
public class ImportRecord extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -22,11 +24,6 @@ public class ImportRecord extends M3<String, String> {
|
||||
public static final String TYPE_CUSTOMER = "CUSTOMER";
|
||||
public static final String TYPE_YTD_SALES = "YTD_SALES";
|
||||
|
||||
// Column Names
|
||||
public static final String TYPE = "type";
|
||||
public static final String COMPLETED = "completed";
|
||||
public static final String SUCCESS = "success";
|
||||
|
||||
// Properties
|
||||
@NotUpdate
|
||||
private String type;
|
||||
|
@ -5,6 +5,7 @@ import lombok.Setter;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.mybatis.NotUpdate;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import me.chyxion.tigon.mybatis.NotUpdateWhenNull;
|
||||
|
||||
@ -17,6 +18,7 @@ import me.chyxion.tigon.mybatis.NotUpdateWhenNull;
|
||||
@Getter
|
||||
@Setter
|
||||
@Table("crm_user")
|
||||
@FieldNameConstants(prefix = "")
|
||||
public class User extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -25,17 +27,6 @@ public class User extends M3<String, String> {
|
||||
public static final String ROLE_LELI = "leli";
|
||||
public static final String ROLE_CHYXION = "chyxion";
|
||||
|
||||
// Column Names
|
||||
public static final String ACCOUNT = "account";
|
||||
public static final String EMPLOYEE_ID = "employee_id";
|
||||
public static final String PASSWORD = "password";
|
||||
public static final String MOBILE = "mobile";
|
||||
public static final String EMAIL = "email";
|
||||
public static final String NAME = "name";
|
||||
public static final String EN_NAME = "en_name";
|
||||
public static final String GENDER = "gender";
|
||||
public static final String ADMIN = "admin";
|
||||
|
||||
// Properties
|
||||
private String account;
|
||||
@NotUpdate
|
||||
|
@ -2,6 +2,8 @@ package com.pudonghot.ambition.crm.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.util.Date;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
@ -16,20 +18,10 @@ import me.chyxion.tigon.mybatis.Transient;
|
||||
@Getter
|
||||
@Setter
|
||||
@Table("crm_week_goal")
|
||||
@FieldNameConstants(prefix = "")
|
||||
public class WeekGoal extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String USER_ID = "user_id";
|
||||
public static final String YEAR = "year";
|
||||
public static final String QUARTER = "quarter";
|
||||
public static final String DATE_START = "date_start";
|
||||
public static final String DATE_END = "date_end";
|
||||
public static final String MONTH_START = "month_start";
|
||||
public static final String MONTH_END = "month_end";
|
||||
public static final String GOAL = "goal";
|
||||
public static final String DONE = "done";
|
||||
|
||||
// Properties
|
||||
@NotUpdate
|
||||
private String userId;
|
||||
|
@ -16,8 +16,10 @@
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
|
||||
<start-class></start-class>
|
||||
<tigon.version>0.0.1-SNAPSHOT</tigon.version>
|
||||
<!--<jackson.version>2.9.9.20190807</jackson.version>-->
|
||||
<!--<spring.version>5.2.5.RELEASE</spring.version>-->
|
||||
<!--<spring-boot.version>2.2.6.RELEASE</spring-boot.version>-->
|
||||
<spring-boot.version>2.0.3.RELEASE</spring-boot.version>
|
||||
<aspectj.version>1.8.10</aspectj.version>
|
||||
</properties>
|
||||
@ -54,6 +56,11 @@
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pudonghot.ambition</groupId>
|
||||
<artifactId>crm-model</artifactId>
|
||||
@ -170,6 +177,13 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
@ -179,8 +193,14 @@
|
||||
<version>${spring-boot.version}</version>
|
||||
<configuration>
|
||||
<addResources>true</addResources>
|
||||
<mainClass>${start-class}</mainClass>
|
||||
<layout>ZIP</layout>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -1 +1 @@
|
||||
<i class="{{get this 'icon-size-class'}} ace-icon fa fa-trash-o"></i>
|
||||
<i class="{{get this 'icon-size-class'}} ace-icon fa fa-trash-o red"></i>
|
@ -1,7 +1,7 @@
|
||||
<label class="{{get this 'label-class'}} control-label no-padding-right">{{label}}</label>
|
||||
<div class="{{get this 'input-class'}} no-padding-right">
|
||||
<div class="row col-xs-12 no-padding">
|
||||
<div class="col-xs-{{get this 'col-width'}} no-padding-right">
|
||||
<div class="col-xs-{{col-width}} no-padding-right">
|
||||
<select multiple={{multiple}}
|
||||
data-placeholder={{if placeholder placeholder label}}
|
||||
class="select2"
|
||||
|
@ -16,6 +16,7 @@
|
||||
options=model.applicationList
|
||||
value-field='id'
|
||||
text-field='name'
|
||||
col-width=12
|
||||
}}
|
||||
|
||||
{{form-input-select2
|
||||
|
@ -141,7 +141,7 @@
|
||||
{{th-filter name='salesperson' text='Slspsn' label='Salesperson Filter' options=model.salespersonList}}
|
||||
{{/sortable-th}}
|
||||
{{/if}}
|
||||
<th>
|
||||
<th style="min-width: 106px;">
|
||||
<i class="ace-icon fa fa-cogs bigger-110 hidden-480"></i>
|
||||
Settings
|
||||
</th>
|
||||
@ -299,6 +299,10 @@
|
||||
{{#link-to 'customer.edit' it.id class='btn btn-xs btn-info' data-rel='tooltip' title='Edit Customer'}}
|
||||
<i class="ace-icon fa fa-pencil bigger-120"></i>
|
||||
{{/link-to}}
|
||||
|
||||
{{#if ajax.user.admin}}
|
||||
{{delete-btn model=it}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="hidden-md hidden-lg">
|
||||
<div class="inline pos-rel">
|
||||
@ -322,6 +326,11 @@
|
||||
</span>
|
||||
{{/link-to}}
|
||||
</li>
|
||||
{{#if ajax.user.admin}}
|
||||
<li>
|
||||
{{delete-btn model=it icon-only=true}}
|
||||
</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -32,7 +32,7 @@
|
||||
<i class="ace-icon fa fa-exchange bigger-110"></i>
|
||||
Status
|
||||
</th>
|
||||
<th>
|
||||
<th style="min-width: 106px;">
|
||||
<i class="ace-icon fa fa-cogs bigger-110"></i>
|
||||
Settings
|
||||
</th>
|
||||
|
@ -8,7 +8,7 @@
|
||||
"license": "MIT",
|
||||
"homepage": "",
|
||||
"dependencies": {
|
||||
"bootstrap": "~3.3.5",
|
||||
"bootstrap": "3.4.1",
|
||||
"bootbox": "~4.4.0",
|
||||
"moment": ">= 2.8.0",
|
||||
"moment-timezone": ">= 0.1.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user