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