diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCompanyPersonalController.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCompanyPersonalController.java index f3bb7c6b..dcd76ad4 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCompanyPersonalController.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCompanyPersonalController.java @@ -61,16 +61,21 @@ public class CrmsCompanyPersonalController { @PostMapping("/insertCompanyPersonal") @ApiOperation(value = "新增个人/企业关联人") public ResponseResult insertCompanyPersonal(@RequestBody @Valid CrmsCompanyPersonalReq personal) { - SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd"); - Date parse = null; - try { - parse = sdf.parse(personal.getRegisteredTime()); - } catch (ParseException e) { - e.printStackTrace(); - } CrmsCompanyPersonal crmsCompanyPersonal = new CrmsCompanyPersonal(); - BeanUtils.copyProperties(personal,crmsCompanyPersonal); - crmsCompanyPersonal.setRegisteredTime(parse); + if(personal.getRegisteredTime() !=null){ + SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd"); + Date parse = null; + try { + parse = sdf.parse(personal.getRegisteredTime()); + } catch (ParseException e) { + e.printStackTrace(); + } + 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,16 +101,20 @@ public class CrmsCompanyPersonalController { @PostMapping("/updateCompanyPersonal") @ApiOperation(value = "编辑个人/企业关联人") public ResponseResult updateCompanyPersonal(@RequestBody CrmsCompanyPersonalReq personal){ - SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd"); - Date parse = null; - try { - parse = sdf.parse(personal.getRegisteredTime()); - } catch (ParseException e) { - e.printStackTrace(); - } CrmsCompanyPersonal crmsCompanyPersonal = new CrmsCompanyPersonal(); - BeanUtils.copyProperties(personal,crmsCompanyPersonal); - crmsCompanyPersonal.setRegisteredTime(parse); + if(personal.getRegisteredTime() !=null){ + SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd"); + Date parse = null; + try { + parse = sdf.parse(personal.getRegisteredTime()); + } catch (ParseException e) { + e.printStackTrace(); + } + BeanUtils.copyProperties(personal,crmsCompanyPersonal); + crmsCompanyPersonal.setRegisteredTime(parse); + }else{ + BeanUtils.copyProperties(personal,crmsCompanyPersonal); + } boolean result = crmsCompanyPersonalService.updateById(crmsCompanyPersonal); return result ? ResponseResult.SUCCESS(crmsCompanyPersonal) : ResponseResult.FAIL(); } diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java index 227cb424..4d1178f3 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java @@ -666,12 +666,15 @@ public class CustomerServiceImpl extends ServiceImpl() + .eq("customer_id", companyCustomerEntity.getCustomerId())); + //根据id查询crms_company_customer表里面的customerId CompanyCustomerEntity entity = companyCustomerDao.selectOne(new QueryWrapper() .eq("customer_id", customerEntity.getId())); companyCustomerEntity.setCustomerId(entity.getId()); - int company = companyCustomerDao.update(companyCustomerEntity, new QueryWrapper() - .eq("customer_id", companyCustomerEntity.getCustomerId())); //根据企业id删除关联关系 crmsCustomerRelatedMapper.delete(new QueryWrapper().eq("customer_id",entity.getId()));//companyCustomerEntity.getId()