客户资源管理修改

master
shijie 4 years ago
parent d309b73c16
commit 056ceaa467
  1. 13
      dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCompanyPersonalController.java
  2. 7
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java

@ -61,6 +61,8 @@ public class CrmsCompanyPersonalController {
@PostMapping("/insertCompanyPersonal")
@ApiOperation(value = "新增个人/企业关联人")
public ResponseResult insertCompanyPersonal(@RequestBody @Valid CrmsCompanyPersonalReq personal) {
CrmsCompanyPersonal crmsCompanyPersonal = new CrmsCompanyPersonal();
if(personal.getRegisteredTime() !=null){
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
Date parse = null;
try {
@ -68,9 +70,12 @@ public class CrmsCompanyPersonalController {
} catch (ParseException e) {
e.printStackTrace();
}
CrmsCompanyPersonal crmsCompanyPersonal = new CrmsCompanyPersonal();
BeanUtils.copyProperties(personal,crmsCompanyPersonal);
crmsCompanyPersonal.setRegisteredTime(parse);
}else{
BeanUtils.copyProperties(personal,crmsCompanyPersonal);
}
boolean result = crmsCompanyPersonalService.save(crmsCompanyPersonal);
CrmsCustomerRelated crmsCustomerRelated = new CrmsCustomerRelated();
crmsCustomerRelated.setRelatedId(crmsCompanyPersonal.getId().intValue());//关联人Id
@ -96,6 +101,8 @@ public class CrmsCompanyPersonalController {
@PostMapping("/updateCompanyPersonal")
@ApiOperation(value = "编辑个人/企业关联人")
public ResponseResult updateCompanyPersonal(@RequestBody CrmsCompanyPersonalReq personal){
CrmsCompanyPersonal crmsCompanyPersonal = new CrmsCompanyPersonal();
if(personal.getRegisteredTime() !=null){
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
Date parse = null;
try {
@ -103,9 +110,11 @@ public class CrmsCompanyPersonalController {
} catch (ParseException e) {
e.printStackTrace();
}
CrmsCompanyPersonal crmsCompanyPersonal = new CrmsCompanyPersonal();
BeanUtils.copyProperties(personal,crmsCompanyPersonal);
crmsCompanyPersonal.setRegisteredTime(parse);
}else{
BeanUtils.copyProperties(personal,crmsCompanyPersonal);
}
boolean result = crmsCompanyPersonalService.updateById(crmsCompanyPersonal);
return result ? ResponseResult.SUCCESS(crmsCompanyPersonal) : ResponseResult.FAIL();
}

@ -666,12 +666,15 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
customerEntity.setMotifyTime(new Date());
customerEntity.setManager(companyCustomerReq.getManager());
boolean customer = customerDao.updateCustomer(customerEntity);
companyCustomerEntity.setCustomerId(customerEntity.getId());
int company = companyCustomerDao.update(companyCustomerEntity, new QueryWrapper<CompanyCustomerEntity>()
.eq("customer_id", companyCustomerEntity.getCustomerId()));
//根据id查询crms_company_customer表里面的customerId
CompanyCustomerEntity entity = companyCustomerDao.selectOne(new QueryWrapper<CompanyCustomerEntity>()
.eq("customer_id", customerEntity.getId()));
companyCustomerEntity.setCustomerId(entity.getId());
int company = companyCustomerDao.update(companyCustomerEntity, new QueryWrapper<CompanyCustomerEntity>()
.eq("customer_id", companyCustomerEntity.getCustomerId()));
//根据企业id删除关联关系
crmsCustomerRelatedMapper.delete(new QueryWrapper<CrmsCustomerRelated>().eq("customer_id",entity.getId()));//companyCustomerEntity.getId()

Loading…
Cancel
Save