|
|
@@ -3,6 +3,7 @@ package com.goafanti.customer.controller;
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
@@ -23,6 +24,7 @@ import com.goafanti.customer.service.CustomerService;
|
|
|
import com.goafanti.customer.service.CustomerUserService;
|
|
|
import com.goafanti.customer.service.FollowUpService;
|
|
|
import com.goafanti.admin.service.AdminService;
|
|
|
+import com.goafanti.common.bo.Error;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.controller.BaseController;
|
|
|
@@ -64,14 +66,14 @@ public class AdminCustomerApiController extends BaseController {
|
|
|
String followId=UUID.randomUUID().toString();//跟进记录ID
|
|
|
Customer c = new Customer();
|
|
|
cusIn.setFollowId(followId);
|
|
|
- cusIn.setId(customerId);
|
|
|
-
|
|
|
+ cusIn.setId(customerId);
|
|
|
cui.setId(customerUsrId);
|
|
|
cui.setCid(customerId);//客户联系人表中的cid
|
|
|
|
|
|
coi.setId(UUID.randomUUID().toString());//客户公司ID
|
|
|
coi.setCid(customerId);//客户公司表中的cid
|
|
|
-
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDD);
|
|
|
+ fur.setFollowDate(format.parse(cusIn.getFollowDates()));
|
|
|
fur.setId(followId);//跟进记录的ID
|
|
|
fur.setCid(customerId);//跟进记录表中的cid
|
|
|
fur.setCuid(customerUsrId);//跟进记录表中的联系人id
|
|
|
@@ -179,15 +181,13 @@ public class AdminCustomerApiController extends BaseController {
|
|
|
* @throws IllegalAccessException
|
|
|
*/
|
|
|
@RequestMapping(value = "/addContacter", method = RequestMethod.POST)
|
|
|
- public Result addContacter (CustomerIn cusIn) throws IllegalAccessException, InvocationTargetException {
|
|
|
+ public Result addContacter (CustomerUserInfo cui) throws IllegalAccessException, InvocationTargetException {
|
|
|
Result res =new Result();
|
|
|
- CustomerUserInfo cui =new CustomerUserInfo();
|
|
|
- BeanUtils.copyProperties(cui, cusIn);
|
|
|
cui.setId(UUID.randomUUID().toString());
|
|
|
if(cui.getPrimaryFlg()==0) {//0:主要联系人,1-非主要联系人
|
|
|
- String primaryId = customerUserService.selectPrimaryFlgByCid(cusIn.getId());
|
|
|
+ String primaryId = customerUserService.selectPrimaryFlgByCid(cui.getCid());
|
|
|
if(StringUtils.isNoneBlank(primaryId)) {
|
|
|
- customerUserService.updPrimaryFlg(cusIn.getId());//把主要联系人状态给去掉
|
|
|
+ customerUserService.updatePrimaryFlg(primaryId);//把主要联系人状态给去掉
|
|
|
}
|
|
|
customerUserService.addCustomerUserInfo(cui);//再添加联系人
|
|
|
}else {
|
|
|
@@ -242,12 +242,12 @@ public class AdminCustomerApiController extends BaseController {
|
|
|
* 查询单个联系人信息
|
|
|
* @return
|
|
|
*/
|
|
|
- /*@RequestMapping(value = "/transferCsutomer", method = RequestMethod.POST)
|
|
|
- public Result findContractById (String id) {
|
|
|
+ @RequestMapping(value = "/findContactDetail", method = RequestMethod.POST)
|
|
|
+ public Result findContactDetail (String id) {
|
|
|
Result res=new Result();
|
|
|
res.setData(customerUserService.findContractById(id));
|
|
|
return res;
|
|
|
- }*/
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 修改单个联系人信息
|
|
|
@@ -266,10 +266,10 @@ public class AdminCustomerApiController extends BaseController {
|
|
|
* @throws ParseException
|
|
|
*/
|
|
|
@RequestMapping(value = "/addFollow", method = RequestMethod.POST)
|
|
|
- public Result addFollowUpRecord(FollowUpRecord fur, CustomerIn cusIn ,String followDate) throws ParseException{
|
|
|
+ public Result addFollowUpRecord(FollowUpRecord fur, CustomerIn cusIn) throws ParseException{
|
|
|
Result res = new Result();
|
|
|
SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
|
|
|
- if(StringUtils.isNotBlank(followDate)) fur.setFollowDate(format.parse(followDate));
|
|
|
+ if(StringUtils.isNotBlank(cusIn.getFollowDates())) fur.setFollowDate(format.parse(cusIn.getFollowDates()));
|
|
|
String followId = UUID.randomUUID().toString();
|
|
|
fur.setId(followId);
|
|
|
cusIn.setFollowId(followId);
|
|
|
@@ -314,4 +314,22 @@ public class AdminCustomerApiController extends BaseController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除联系人
|
|
|
+ * @param customerId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/delContract" , method = RequestMethod.GET)
|
|
|
+ public Result delContract(String id){
|
|
|
+ Result res= new Result();
|
|
|
+ CustomerUserInfo customerUserInfo = customerUserService.findContractById(id);
|
|
|
+
|
|
|
+ if(customerUserInfo.getPrimaryFlg()==0) {
|
|
|
+ res.getError().add(new Error("该联系人为主要联系人,不能进行删除操作!"));
|
|
|
+ }else {
|
|
|
+ customerUserService.deleteContractById(id);
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
}
|