From 056ceaa4676def759dab434ba8b8d43dc6fa961e Mon Sep 17 00:00:00 2001 From: shijie <648688341@qq.com> Date: Fri, 26 Mar 2021 15:42:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E8=B5=84=E6=BA=90=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CrmsCompanyPersonalController.java | 45 +++++++++++-------- .../service/impl/CustomerServiceImpl.java | 7 ++- 2 files changed, 32 insertions(+), 20 deletions(-) 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()