客户资源后台

master
river 4 years ago
parent addbb1f33b
commit 9b53881b40
  1. 35
      .gitignore
  2. 2
      dq-financial-api/src/main/java/com/daqing/financial/crms/CustomerControllerApi.java
  3. 2
      dq-financial-crms-auth/src/main/java/com/daqing/financial/crauth/service/impl/CustomerLoginServiceImpl.java
  4. 6
      dq-financial-crms-auth/src/main/resources/bootstrap.properties
  5. 2
      dq-financial-crms-auth/src/main/resources/mapper/crmsauth/CustomerLoginMapper.xml
  6. 19
      dq-financial-crms-auth/target/classes/bootstrap.properties
  7. BIN
      dq-financial-crms-auth/target/classes/com/daqing/financial/crauth/DqFinancialCrmsAuthApplication.class
  8. BIN
      dq-financial-crms-auth/target/classes/com/daqing/financial/crauth/config/AuthorizationServer.class
  9. BIN
      dq-financial-crms-auth/target/classes/com/daqing/financial/crauth/config/SecurityConfig.class
  10. BIN
      dq-financial-crms-auth/target/classes/com/daqing/financial/crauth/config/TokenConfig.class
  11. BIN
      dq-financial-crms-auth/target/classes/com/daqing/financial/crauth/controller/CustomerLoginController.class
  12. BIN
      dq-financial-crms-auth/target/classes/com/daqing/financial/crauth/dao/CustomerLoginDao.class
  13. BIN
      dq-financial-crms-auth/target/classes/com/daqing/financial/crauth/service/CustomerLoginService.class
  14. BIN
      dq-financial-crms-auth/target/classes/com/daqing/financial/crauth/service/impl/CustomerLoginServiceImpl.class
  15. 47
      dq-financial-crms-auth/target/classes/logback-spring.xml
  16. 10
      dq-financial-crms-auth/target/classes/mapper/crmsauth/CustomerLoginMapper.xml
  17. BIN
      dq-financial-crms-auth/target/test-classes/com/daqing/financial/crauth/DqFinancialCrmsAuthApplicationTests.class
  18. 33
      dq-financial-crms/src/main/java/com/daqing/financial/crms/config/CorsConfig.java
  19. 33
      dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerController.java
  20. 2
      dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerDao.java
  21. 55
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java
  22. 4
      dq-financial-crms/src/main/resources/mapper/crms/CompanyCustomerDao.xml
  23. 6
      dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml
  24. 4
      dq-financial-crms/src/main/resources/mapper/crms/PersonalCustomerDao.xml
  25. BIN
      dq-financial-crms/target/classes/META-INF/dq-financial-crms.kotlin_module
  26. BIN
      dq-financial-crms/target/classes/com/daqing/financial/crms/DqFinancialCrmsApplication.class
  27. BIN
      dq-financial-crms/target/classes/com/daqing/financial/crms/config/CorsConfig.class
  28. BIN
      dq-financial-crms/target/classes/com/daqing/financial/crms/config/IPageConfig.class
  29. BIN
      dq-financial-crms/target/classes/com/daqing/financial/crms/controller/CustomerController.class
  30. BIN
      dq-financial-crms/target/classes/com/daqing/financial/crms/dao/CompanyCustomerDao.class
  31. BIN
      dq-financial-crms/target/classes/com/daqing/financial/crms/dao/CustomerDao.class
  32. BIN
      dq-financial-crms/target/classes/com/daqing/financial/crms/dao/PersonalCustomerDao.class
  33. BIN
      dq-financial-crms/target/classes/com/daqing/financial/crms/feign/HrmsFeignService.class
  34. BIN
      dq-financial-crms/target/classes/com/daqing/financial/crms/service/CustomerService.class
  35. BIN
      dq-financial-crms/target/classes/com/daqing/financial/crms/service/impl/CustomerServiceImpl.class
  36. 4
      dq-financial-crms/target/classes/mapper/crms/CompanyCustomerDao.xml
  37. 6
      dq-financial-crms/target/classes/mapper/crms/CustomerDao.xml
  38. 4
      dq-financial-crms/target/classes/mapper/crms/PersonalCustomerDao.xml
  39. BIN
      dq-financial-crms/target/test-classes/com/daqing/financial/crms/DqFinancialCrmsApplicationTests.class
  40. 33
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/config/CorsConfig.java
  41. 2
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/DeptService.java
  42. 6
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/DeptServiceImpl.java
  43. BIN
      dq-financial-hrms/target/classes/com/daqing/financial/hrms/config/CorsConfig.class
  44. BIN
      dq-financial-hrms/target/classes/com/daqing/financial/hrms/controller/EmployeeController.class
  45. 4
      dq-framework-common/src/main/java/com/daqing/framework/model/response/CommonCode.java
  46. 32
      dq-framework-common/src/main/java/com/daqing/framework/model/response/PromptSuccess.java
  47. 4
      dq-framework-common/src/main/java/com/daqing/framework/model/response/ResponseResult.java
  48. BIN
      dq-framework-common/target/classes/com/daqing/framework/model/response/CommonCode.class
  49. BIN
      dq-framework-common/target/classes/com/daqing/framework/model/response/PromptSuccess.class
  50. BIN
      dq-framework-common/target/classes/com/daqing/framework/model/response/ResponseResult.class
  51. 6
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/PersonalCustomerEntity.java
  52. 1
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerCompanyTO.java
  53. 6
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerPersonalVO.java
  54. 2
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerTO.java
  55. 6
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/request/CustomerRequest.java
  56. 2
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeVO.java
  57. BIN
      dq-framework-model/target/classes/com/daqing/framework/domain/crms/PersonalCustomerEntity.class
  58. BIN
      dq-framework-model/target/classes/com/daqing/framework/domain/crms/ext/CustomerCompanyTO.class
  59. BIN
      dq-framework-model/target/classes/com/daqing/framework/domain/crms/ext/CustomerPersonalVO.class
  60. BIN
      dq-framework-model/target/classes/com/daqing/framework/domain/crms/ext/CustomerTO.class
  61. BIN
      dq-framework-model/target/classes/com/daqing/framework/domain/crms/ext/ManagerName.class
  62. BIN
      dq-framework-model/target/classes/com/daqing/framework/domain/crms/request/CustomerRequest.class
  63. BIN
      dq-framework-model/target/classes/com/daqing/framework/domain/crms/response/CrmsCode.class
  64. BIN
      dq-framework-model/target/classes/com/daqing/framework/domain/hrms/ext/EmployeeVO.class
  65. BIN
      dq-framework-utils/target/classes/com/daqing/framework/utils/PageUtils.class
  66. BIN
      dq-framework-utils/target/classes/com/daqing/framework/utils/Query.class
  67. 17
      dq-govern-gateway/src/main/resources/application.yml
  68. BIN
      dq-govern-gateway/target/classes/META-INF/dq-govern-gateway.kotlin_module
  69. 34
      dq-govern-gateway/target/classes/application.yml
  70. 9
      dq-govern-gateway/target/classes/bootstrap.properties
  71. 1
      dq-govern-gateway/target/classes/jwt.properties

35
.gitignore vendored

@ -1,35 +0,0 @@
target/
logs/
.mvn/
mvnw
mvnw.cmd
!**/src/main/**
!**/src/test/**
src/main/resources/docs/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/

@ -10,8 +10,6 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* @Author: gongsj.

@ -32,7 +32,7 @@ public class CustomerLoginServiceImpl implements CustomerLoginService, UserDetai
List<SimpleGrantedAuthority> authorities = new ArrayList<>();
authorities.add(new SimpleGrantedAuthority("ROLE_ADMIN"));
System.out.println(customer);
UserDetails userDetails = new User(customer.getCode(),new BCryptPasswordEncoder().encode(customer.getPassword()),authorities);
UserDetails userDetails = new User(customer.getPhone(),new BCryptPasswordEncoder().encode(customer.getPassword()),authorities);
return userDetails;
}

@ -1,7 +1,7 @@
#服务名称
spring.application.name=dq-financial-crms
#配置中心地址
#<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
spring.application.name=dq-financial-crms-auth
#<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>ַ
spring.cloud.nacos.config.server-addr=192.168.31.142:8848
spring.cloud.nacos.config.namespace=37d72d30-3178-4173-8b5e-269a23355ed9
#spring.cloud.nacos.config.group=prod

@ -4,7 +4,7 @@
<mapper namespace="com.daqing.financial.crauth.dao.CustomerLoginDao">
<select id="getCustomer" parameterType="string" resultType="com.daqing.framework.domain.crms.CustomerEntity">
SELECT code,password FROM crms_customer WHERE code = #{code}
SELECT phone,password FROM crms_customer WHERE phone = #{phone}
</select>
</mapper>

@ -0,0 +1,19 @@
#·þÎñÃû³Æ
spring.application.name=dq-financial-crms
#ÅäÖÃÖÐÐĵØÖ·
spring.cloud.nacos.config.server-addr=192.168.31.142:8848
spring.cloud.nacos.config.namespace=37d72d30-3178-4173-8b5e-269a23355ed9
#spring.cloud.nacos.config.group=prod
spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml
spring.cloud.nacos.config.ext-config[0].group=dev
spring.cloud.nacos.config.ext-config[0].refresh=true
spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml
spring.cloud.nacos.config.ext-config[1].group=dev
spring.cloud.nacos.config.ext-config[1].refresh=true
spring.cloud.nacos.config.ext-config[2].data-id=other.yml
spring.cloud.nacos.config.ext-config[2].group=dev
spring.cloud.nacos.config.ext-config[2].refresh=true

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--定义日志文件的存储地址,使用绝对路径-->
<property name="LOG_HOME" value="d:/logs/daqing/crms_auth"/>
<!-- Console 输出设置 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<fileNamePattern>${LOG_HOME}/crms_auth.%d{yyyy-MM-dd}.log</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- 异步输出 -->
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>512</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="FILE"/>
</appender>
<logger name="org.apache.ibatis.cache.decorators.LoggingCache" level="DEBUG" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.boot" level="DEBUG"/>
<root level="info">
<!--<appender-ref ref="ASYNC"/>-->
<appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/>
</root>
</configuration>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.daqing.financial.crauth.dao.CustomerLoginDao">
<select id="getCustomer" parameterType="string" resultType="com.daqing.framework.domain.crms.CustomerEntity">
SELECT phone,password FROM crms_customer WHERE phone = #{phone}
</select>
</mapper>

@ -0,0 +1,33 @@
package com.daqing.financial.crms.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
/**
* 实现基本的跨域请求
*
* @auther River
* @date 2020/9/25 15:09
*/
@Configuration
public class CorsConfig {
@Bean
public CorsFilter corsFilter() {
final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
final CorsConfiguration corsConfiguration = new CorsConfiguration();
/*是否允许请求带有验证信息*/
corsConfiguration.setAllowCredentials(true);
/*允许访问的客户端域名*/
corsConfiguration.addAllowedOrigin("*");
/*允许服务端访问的客户端请求头*/
corsConfiguration.addAllowedHeader("*");
/*允许访问的方法名,GET POST等*/
corsConfiguration.addAllowedMethod("*");
urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
return new CorsFilter(urlBasedCorsConfigurationSource);
}
}

@ -5,14 +5,18 @@ import com.daqing.financial.crms.service.CustomerService;
import com.daqing.framework.domain.crms.ext.CustomerCompanyTO;
import com.daqing.framework.domain.crms.ext.CustomerPersonalTO;
import com.daqing.framework.domain.crms.request.CustomerRequest;
import com.daqing.framework.model.response.CommonCode;
import com.daqing.framework.model.response.PromptSuccess;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.utils.PageUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Objects;
/**
@ -63,57 +67,62 @@ public class CustomerController implements CustomerControllerApi {
/**
* 根据客户id删除所选客户
*/
@Override
@DeleteMapping("/deleteCustomer")
public ResponseResult deleteCustomer(@RequestBody Long[] ids){
List<String> list = customerService.updateCustomerById(ids);
if (list == null){
return new ResponseResult(CommonCode.INVALID_PARAM);
}else if (Objects.equals(list.get(0),PromptSuccess.getDeleteSuccess())){
return ResponseResult.SUCCESS();
}else if (Objects.equals(list.get(0),PromptSuccess.getDeleteFail())){
return new ResponseResult(CommonCode.DELETE_FAIL);
}
else {
return new ResponseResult<List<String>>().SUCCESS_DATA(list);
}
return new ResponseResult<List<String>>().SUCCESS(customerService.updateCustomerById(ids));
}
/**
* 保存个人类型客户信息
*/
@PostMapping("/savePersonal")
@Override
public ResponseResult savePersonal(@RequestBody CustomerPersonalTO customerPersonalTO) {
boolean result = customerService.saveCustomerPersonal(customerPersonalTO.getCustomerEntity(), customerPersonalTO.getPersonalCustomerEntity());
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
return result ? ResponseResult.SUCCESS() : new ResponseResult(CommonCode.SAVE_FAIL);
}
/**
* 保存企业类型客户信息
*/
@PostMapping("/saveCompany")
@Override
@ApiOperation(value = "保存企业类型客户信息", response = CustomerCompanyTO.class)
public ResponseResult saveCompany(@RequestBody CustomerCompanyTO customerCompanyTO) {
boolean result = customerService.saveCustomerCompany(customerCompanyTO.getCustomerEntity(), customerCompanyTO.getCompanyCustomerEntity());
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
return result ? ResponseResult.SUCCESS() : new ResponseResult(CommonCode.SAVE_FAIL);
}
/**
* 更新个人类型客户信息
*/
@PostMapping("/updatePersonal")
@Override
public ResponseResult updatePersonal(@RequestBody CustomerPersonalTO customerPersonalTO) {
boolean result = customerService.updateCustomerPersonal(customerPersonalTO.getCustomerEntity(), customerPersonalTO.getPersonalCustomerEntity());
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
return result ? ResponseResult.SUCCESS() : new ResponseResult(CommonCode.UPDATE_FAIL);
}
/**
* 更新企业类型客户信息
*/
@PostMapping("/updateCompany")
@Override
public ResponseResult updateCompany(@RequestBody CustomerCompanyTO customerCompanyTO) {
boolean result = customerService.updateCustomerCompany(customerCompanyTO.getCustomerEntity(), customerCompanyTO.getCompanyCustomerEntity());
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
return result ? ResponseResult.SUCCESS() : new ResponseResult(CommonCode.UPDATE_FAIL);
}
/**
* 导出数据到excel
*/
@Override
@GetMapping("/excelExport")
public void excelExportCustomer(HttpServletResponse response){
@ -123,7 +132,6 @@ public class CustomerController implements CustomerControllerApi {
/**
* 导出excel模板
*/
@Override
@GetMapping("/excelTemplate")
public void excelTemplate(HttpServletResponse response){
@ -134,7 +142,6 @@ public class CustomerController implements CustomerControllerApi {
* 导入excel数据
*/
@PostMapping("/excelImport")
@Override
public void excelImportCustomer(MultipartFile file){
customerService.excelImportCustomer(file);

@ -25,7 +25,7 @@ public interface CustomerDao extends BaseMapper<CustomerEntity> {
CustomerEntity queryCustomerById(Long id);
void updateCustomerById(@Param("ids") List<Long> ids);
boolean updateCustomerById(@Param("ids") List<Long> ids);
List<String> queryCustomerNameById(@Param("ids") List<Long> ids);

@ -15,13 +15,14 @@ import com.daqing.framework.domain.crms.PersonalCustomerEntity;
import com.daqing.framework.domain.crms.ext.*;
import com.daqing.framework.domain.crms.request.CustomerRequest;
import com.daqing.framework.domain.crms.response.CrmsCode;
import com.daqing.framework.domain.hrms.EmployeeEntity;
import com.daqing.framework.domain.hrms.ext.EmployeeTO;
import com.daqing.framework.domain.hrms.ext.EmployeeVO;
import com.daqing.framework.domain.hrms.response.HrmsCode;
import com.daqing.framework.exception.ExceptionCast;
import com.daqing.framework.model.response.CommonCode;
import com.daqing.framework.model.response.PromptSuccess;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.utils.SnowflakeIdUtils;
import com.daqing.framework.utils.excel.ExcelUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -71,7 +72,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
// 获取所有的客户基本信息
List<CustomerEntity> customers = customerEntityIPage.getRecords();
// 获取所有的客户经理id
Long[] ids = customers.stream().map(CustomerEntity::getId).toArray(Long[]::new);
Long[] ids = customers.stream().map(CustomerEntity::getManager).toArray(Long[]::new);
if (ids != null && ids.length != 0) {
//TODO 远程调用查询客户经理信息的接口
@ -100,13 +101,22 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
@Override
public ResponseResult queryCustomerById(Long id) {
if (id == null){
return new ResponseResult(CommonCode.INVALID_PARAM);
}
// 员工基本信息
CustomerEntity customer = customerDao.queryCustomerById(id);
if (customer == null) {
return new ResponseResult<CustomerEntity>().SUCCESS(null);
return new ResponseResult(CommonCode.INEXISTENCE);
}
String name = PromptSuccess.getNoBeing();
if (customer.getManager() != null){
ResponseResult<EmployeeEntity> employee = hrmsFeignService.getEmployeeById(customer.getManager());
if (employee.getData() != null){
// 客户经理姓名
String name = hrmsFeignService.getEmployeeById(customer.getManager()).getData().getName();
name = hrmsFeignService.getEmployeeById(customer.getManager()).getData().getName();
}
}
// 判断该客户的类型
if (Objects.equals(customer.getType(), CrmsConstant.CustomerType.PERSONAL_CUSTOMER.getType())) {
PersonalCustomerEntity personalCustomerEntity = personalCustomerDao.queryPersonalCustomerById(id);
@ -129,12 +139,18 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
*/
@Override
public List<String> updateCustomerById(Long[] ids) {
if (ids == null || ids.length == 0){
return null;
}
//TODO 远程调用审批模块判断所选客户是否在审批,返回正在审批的客户的id集合Long[] idArray
List<Long> idArray = new ArrayList<>();// 假设为返回的正在审批的客户id集合
if (idArray.size() == 0 || idArray == null) {
customerDao.updateCustomerById(Arrays.asList(ids));
return new ArrayList<>();
boolean customer = customerDao.updateCustomerById(Arrays.asList(ids));
List<String> success = new ArrayList<>();
success.add(PromptSuccess.getDeleteSuccess());
List<String> fail = new ArrayList<>();
fail.add(PromptSuccess.getDeleteFail());
return customer ? success : fail;
} else {
return customerDao.queryCustomerNameById(idArray);
}
@ -149,14 +165,14 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
@Transactional
@Override
public boolean saveCustomerPersonal(CustomerEntity customerEntity, PersonalCustomerEntity personalCustomerEntity) {
customerEntity.setId(SnowflakeIdUtils.getRandomid());
//TODO 设置客户编号
customerEntity.setCode(((int)(Math.random()*100+1))+"");
customerEntity.setCreateTime(new Date());
customerEntity.setMotifyTime(new Date());
personalCustomerEntity.setId(SnowflakeIdUtils.getRandomid());
boolean customer = customerDao.saveCustomer(customerEntity);
personalCustomerEntity.setCustomerId(customerEntity.getId());
return customerDao.saveCustomer(customerEntity) && personalCustomerDao.savePersonalCustomer(personalCustomerEntity);
boolean personal = personalCustomerDao.savePersonalCustomer(personalCustomerEntity);
return customer && personal;
}
/**
@ -168,14 +184,14 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
@Transactional
@Override
public boolean saveCustomerCompany(CustomerEntity customerEntity, CompanyCustomerEntity companyCustomerEntity) {
customerEntity.setId(SnowflakeIdUtils.getRandomid());
//TODO 设置客户编号
customerEntity.setCode(((int)(Math.random()*100+1))+"");
customerEntity.setCreateTime(new Date());
customerEntity.setMotifyTime(new Date());
companyCustomerEntity.setId(SnowflakeIdUtils.getRandomid());
boolean customer = customerDao.saveCustomer(customerEntity);
companyCustomerEntity.setCustomerId(customerEntity.getId());
return customerDao.saveCustomer(customerEntity) && companyCustomerDao.saveCompanyCustomer(companyCustomerEntity);
boolean company = companyCustomerDao.saveCompanyCustomer(companyCustomerEntity);
return customer && company;
}
/**
@ -188,8 +204,10 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
@Override
public boolean updateCustomerPersonal(CustomerEntity customerEntity, PersonalCustomerEntity personalCustomerEntity) {
customerEntity.setMotifyTime(new Date());
boolean customer = customerDao.updateCustomer(customerEntity);
personalCustomerEntity.setCustomerId(customerEntity.getId());
return customerDao.updateCustomer(customerEntity) && personalCustomerDao.updatePersonalCustomer(personalCustomerEntity);
boolean personal = personalCustomerDao.updatePersonalCustomer(personalCustomerEntity);
return customer && personal;
}
/**
@ -202,8 +220,10 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
@Override
public boolean updateCustomerCompany(CustomerEntity customerEntity, CompanyCustomerEntity companyCustomerEntity) {
customerEntity.setMotifyTime(new Date());
boolean customer = customerDao.updateCustomer(customerEntity);
companyCustomerEntity.setCustomerId(customerEntity.getId());
return customerDao.updateCustomer(customerEntity) && companyCustomerDao.updateCompanyCustomer(companyCustomerEntity);
boolean company = companyCustomerDao.updateCompanyCustomer(companyCustomerEntity);
return customer && company;
}
/**
@ -348,7 +368,8 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
* @param size 每页条数
*/
private Page<Object> pageCheckout(Integer page, Integer size) {
Integer count = this.count(new QueryWrapper<CustomerEntity>().eq("del_or_not", CrmsConstant.NOT_DELETE));//查询客户有效总条数
// 查询客户有效总条数
Integer count = this.count(new QueryWrapper<CustomerEntity>().eq("del_or_not", CrmsConstant.NOT_DELETE));
if (size == null || size < 1) {
size = 10;
}

@ -28,8 +28,8 @@
<!-- 插入企业类型客户信息 -->
<insert id="saveCompanyCustomer" parameterType="com.daqing.framework.domain.crms.CompanyCustomerEntity">
INSERT INTO crms_company_customer
(id,registered_capital,industry,years,region,shareholder,affiliated_company,emp_num,linkman,business_source,customer_id)
values (#{id},#{registeredCapital},#{industry},#{years},#{region},#{shareholder},#{affiliatedCompany},#{empNum},#{linkman},
(registered_capital,industry,years,region,shareholder,affiliated_company,emp_num,linkman,business_source,customer_id)
values (#{registeredCapital},#{industry},#{years},#{region},#{shareholder},#{affiliatedCompany},#{empNum},#{linkman},
#{businessSource},#{customerId});
</insert>

@ -70,10 +70,10 @@
</select>
<!-- 插入客户基本信息 -->
<insert id="saveCustomer" parameterType="com.daqing.framework.domain.crms.CustomerEntity">
<insert id="saveCustomer" keyProperty="id" useGeneratedKeys="true" parameterType="com.daqing.framework.domain.crms.CustomerEntity">
INSERT INTO crms_customer
(id,code,type,manager,name,addr,phone,del_or_not,status,create_time,motify_time)
VALUES (#{id},#{code},#{type},#{manager},#{name},#{addr},#{phone},0,0,#{createTime},#{motifyTime})
(code,type,manager,name,addr,phone,del_or_not,status,create_time,motify_time)
VALUES (#{code},#{type},#{manager},#{name},#{addr},#{phone},0,0,#{createTime},#{motifyTime})
</insert>
<!-- 更新客户基本信息 -->

@ -36,9 +36,9 @@
<!-- 插入个人类型的客户信息 -->
<insert id="savePersonalCustomer" parameterType="com.daqing.framework.domain.crms.PersonalCustomerEntity">
INSERT INTO crms_personal_customer
(id,customer_id,id_card,age,gender,marital_status,education,employer,position,working_years,social_security_num,living_situation
(customer_id,id_card,age,gender,marital_status,education,employer,position,working_years,social_security_num,living_situation
,residence_addr,business_source,emergency_linkman,emergency_linkman_relationship,emergency_linkman_phone)
VALUES (#{id},#{customerId},#{idCard},#{age},#{gender},#{maritalStatus},#{education},#{employer},#{position},#{workingYears},
VALUES (#{customerId},#{idCard},#{age},#{gender},#{maritalStatus},#{education},#{employer},#{position},#{workingYears},
#{socialSecurityNum},#{livingSituation},#{residenceAddr},#{businessSource},#{emergencyLinkman},#{emergencyLinkmanRelationship},
#{emergencyLinkmanPhone});
</insert>

@ -28,8 +28,8 @@
<!-- 插入企业类型客户信息 -->
<insert id="saveCompanyCustomer" parameterType="com.daqing.framework.domain.crms.CompanyCustomerEntity">
INSERT INTO crms_company_customer
(id,registered_capital,industry,years,region,shareholder,affiliated_company,emp_num,linkman,business_source,customer_id)
values (#{id},#{registeredCapital},#{industry},#{years},#{region},#{shareholder},#{affiliatedCompany},#{empNum},#{linkman},
(registered_capital,industry,years,region,shareholder,affiliated_company,emp_num,linkman,business_source,customer_id)
values (#{registeredCapital},#{industry},#{years},#{region},#{shareholder},#{affiliatedCompany},#{empNum},#{linkman},
#{businessSource},#{customerId});
</insert>

@ -70,10 +70,10 @@
</select>
<!-- 插入客户基本信息 -->
<insert id="saveCustomer" parameterType="com.daqing.framework.domain.crms.CustomerEntity">
<insert id="saveCustomer" keyProperty="id" useGeneratedKeys="true" parameterType="com.daqing.framework.domain.crms.CustomerEntity">
INSERT INTO crms_customer
(id,code,type,manager,name,addr,phone,del_or_not,status,create_time,motify_time)
VALUES (#{id},#{code},#{type},#{manager},#{name},#{addr},#{phone},0,0,#{createTime},#{motifyTime})
(code,type,manager,name,addr,phone,del_or_not,status,create_time,motify_time)
VALUES (#{code},#{type},#{manager},#{name},#{addr},#{phone},0,0,#{createTime},#{motifyTime})
</insert>
<!-- 更新客户基本信息 -->

@ -36,9 +36,9 @@
<!-- 插入个人类型的客户信息 -->
<insert id="savePersonalCustomer" parameterType="com.daqing.framework.domain.crms.PersonalCustomerEntity">
INSERT INTO crms_personal_customer
(id,customer_id,id_card,age,gender,marital_status,education,employer,position,working_years,social_security_num,living_situation
(customer_id,id_card,age,gender,marital_status,education,employer,position,working_years,social_security_num,living_situation
,residence_addr,business_source,emergency_linkman,emergency_linkman_relationship,emergency_linkman_phone)
VALUES (#{id},#{customerId},#{idCard},#{age},#{gender},#{maritalStatus},#{education},#{employer},#{position},#{workingYears},
VALUES (#{customerId},#{idCard},#{age},#{gender},#{maritalStatus},#{education},#{employer},#{position},#{workingYears},
#{socialSecurityNum},#{livingSituation},#{residenceAddr},#{businessSource},#{emergencyLinkman},#{emergencyLinkmanRelationship},
#{emergencyLinkmanPhone});
</insert>

@ -0,0 +1,33 @@
package com.daqing.financial.hrms.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
/**
* 实现基本的跨域请求
*
* @auther River
* @date 2020/9/25 15:09
*/
@Configuration
public class CorsConfig {
@Bean
public CorsFilter corsFilter() {
final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
final CorsConfiguration corsConfiguration = new CorsConfiguration();
/*是否允许请求带有验证信息*/
corsConfiguration.setAllowCredentials(true);
/*允许访问的客户端域名*/
corsConfiguration.addAllowedOrigin("*");
/*允许服务端访问的客户端请求头*/
corsConfiguration.addAllowedHeader("*");
/*允许访问的方法名,GET POST等*/
corsConfiguration.addAllowedMethod("*");
urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
return new CorsFilter(urlBasedCorsConfigurationSource);
}
}

@ -25,5 +25,7 @@ public interface DeptService extends IService<DeptEntity> {
boolean deleteByIds(Long[] ids);
List<DepartmentVO> listDepartmentAndEmployeeTree();
List<DepartmentVO> getDepartmentAndEmployee(Long id);
}

@ -158,7 +158,6 @@ public class DeptServiceImpl extends ServiceImpl<DeptDao, DeptEntity> implements
public List<DepartmentVO> listDepartmentAndEmployeeTree() {
return this.getListDepartmentAndEmployeeTree(deptDao.listDepartment(), 0L);
}
private List<DepartmentVO> getListDepartmentAndEmployeeTree(List<DepartmentVO> list, Long parentId){
return list.stream()
.filter(dept -> parentId.equals(dept.getParentId())) // 过滤出部门id为所选id的部门信息(也为递归的结果条件,找不到所对应的部门id)
@ -169,4 +168,9 @@ public class DeptServiceImpl extends ServiceImpl<DeptDao, DeptEntity> implements
.sorted(Comparator.comparingInt(menu -> (menu.getSort() == null ? 0 : menu.getSort()))) // 根据所选排序信息进行排序
.collect(Collectors.toList());
}
@Override
public List<DepartmentVO> getDepartmentAndEmployee(Long id) {
return null;
}
}

@ -16,6 +16,10 @@ public enum CommonCode implements ResultCode {
SUCCESS(true, 10000, "操作成功!"),
FAIL(false, 11111, "操作失败!"),
INEXISTENCE(false,10004,"抱歉,当前客户信息已不存在!"),
UPDATE_FAIL(false,10005,"更新信息失败!"),
SAVE_FAIL(false,10006,"新增信息失败!"),
DELETE_FAIL(false,10007,"删除失败!"),
UNAUTHENTICATED(false, 10001, "此操作需要登陆系统!"),
UNAUTHORISE(false, 10002, "权限不足,无权操作!"),
INVALID_PARAM(false, 10003, "非法参数!"),

@ -0,0 +1,32 @@
package com.daqing.framework.model.response;
/**
* 提示信息
*
* @auther River
* @date 2020/9/27 11:56
*/
public class PromptSuccess {
private static final String DELETE_SUCCESS = "删除成功!";
private static final String DELETE_FAIL = "删除失败!";
private static final String NO_BEING = "该员工已不存在";
public static String getDeleteSuccess(){
return PromptSuccess.DELETE_SUCCESS;
}
public static String getDeleteFail(){
return PromptSuccess.DELETE_FAIL;
}
public static String getNoBeing(){
return PromptSuccess.NO_BEING;
}
}

@ -56,6 +56,10 @@ public class ResponseResult<T> {
return new ResponseResult<>(true, 10000, t, "操作成功!");
}
public ResponseResult SUCCESS_DATA(T t){
return new ResponseResult<>(false,20000,t,"操作失败!");
}
public static ResponseResult FAIL() {
return new ResponseResult(CommonCode.FAIL);
}

@ -44,13 +44,13 @@ public class PersonalCustomerEntity implements Serializable {
*/
private Integer gender;
/**
* 婚姻状况1已婚0
* 婚姻状况,0:未婚,1:已婚,2:离异,3:
*/
private Integer maritalStatus;
/**
* 学历
* 学历,0:本科,1:大专,2:高职,3:中专,4:其他
*/
private String education;
private Integer education;
/**
* 工作单位
*/

@ -18,6 +18,7 @@ public class CustomerCompanyTO implements Serializable {
/**
* 客户基本信息
*/
private CustomerEntity customerEntity;
/**
* 企业类型信息

@ -65,13 +65,13 @@ public class CustomerPersonalVO extends BaseRowModel implements Serializable {
/**
* 婚姻状况1已婚0未婚
*/
@ExcelProperty(value = "婚姻状况(1:已婚,0:未婚)",index = 9)
@ExcelProperty(value = "婚姻状况(0:未婚,1:已婚,2:离异,3:再婚)",index = 9)
private Integer maritalStatus;
/**
* 学历
*/
@ExcelProperty(value = "学历",index = 10)
private String education;
@ExcelProperty(value = "学历(0:本科,1:大专,2:高职,3:中专,4:其他)",index = 10)
private Integer education;
/**
* 工作单位
*/

@ -1,7 +1,5 @@
package com.daqing.framework.domain.crms.ext;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel;
import lombok.Data;
import lombok.ToString;

@ -1,10 +1,13 @@
package com.daqing.framework.domain.crms.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import lombok.ToString;
import javax.validation.constraints.NotNull;
/**
* 记录客户基本信息
@ -20,6 +23,9 @@ public class CustomerRequest implements Serializable {
/**
* 客户编号或者名称
*/
@ApiModelProperty(value = "订单名")
@NotNull(message = "啊啊啊不能为空")
private String codeOrName;
/**
* 客户类型

@ -1,7 +1,5 @@
package com.daqing.framework.domain.hrms.ext;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel;
import lombok.Data;
import lombok.ToString;

@ -13,8 +13,23 @@ spring:
# - Query=url,qq
#
- id: hrms_route
uri: lb://dq-financial-hrms
#uri: lb://dq-financial-hrms
uri: http://dq-financial-hrms
predicates:
- Path=/api/**
filters:
- RewritePath=/api/(?<segment>.*),/ $\{segment}
# - id: crms_auth
# uri: lb://dq-financial-crms
# predicates:
# - Path=/crms/**
# filters:
# - RewritePath=/crms/(?<segment>.*),/ $\{segment}
redis:
host:
port:
password:
database: 1
timeout: 60s

@ -0,0 +1,34 @@
spring:
cloud:
gateway:
routes:
# - id: test_route
# uri: https://www.baidu.com
# predicates:
# - Query=url,baidu
#
# - id: qq_route
# uri: https://www.qq.com
# predicates:
# - Query=url,qq
#
- id: hrms_route
uri: lb://dq-financial-hrms
predicates:
- Path=/api/hrms/**
filters:
- RewritePath=/api/(?<segment>.*),/ $\{segment}
-
- id: crms_auth
uri: lb://dq-financial-crms
predicates:
- Path=/crms/**
filters:
- RewritePath=/crms/(?<segment>.*),/ $\{segment}
redis:
host:
port:
password:
database: 1
timeout: 60s

@ -0,0 +1,9 @@
#服务名称
spring.application.name=dq-govern-gateway
#配置中心地址
spring.cloud.nacos.config.server-addr=192.168.31.142:8848
spring.cloud.nacos.config.namespace=772e2607-b929-4246-9671-ee5a36d74d25
spring.cloud.nacos.config.ext-config[0].data-id=dq-govern-gateway.yml
spring.cloud.nacos.config.ext-config[0].group=dev
spring.cloud.nacos.config.ext-config[0].refresh=true

@ -0,0 +1 @@
jwt.ignoreUrlList=/route-api/login,/route-api/refresh
Loading…
Cancel
Save