|
|
@@ -2,6 +2,7 @@ package com.goafanti.customer.controller;
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import com.goafanti.customer.bo.AdminOut;
|
|
|
import com.goafanti.customer.bo.CustomerIn;
|
|
|
import com.goafanti.customer.bo.CustomerOut;
|
|
|
import com.goafanti.customer.service.CustomerOrganizationService;
|
|
|
@@ -24,13 +26,11 @@ import com.goafanti.admin.service.AdminService;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.controller.BaseController;
|
|
|
-import com.goafanti.common.model.Admin;
|
|
|
import com.goafanti.common.model.Customer;
|
|
|
import com.goafanti.common.model.CustomerOrganizationInfo;
|
|
|
import com.goafanti.common.model.CustomerUserInfo;
|
|
|
import com.goafanti.common.model.FollowUpRecord;
|
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
|
-import com.goafanti.core.shiro.token.TokenManager;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping(value = "/api/admin/customer")
|
|
|
@@ -73,8 +73,7 @@ public class AdminCustomerApiController extends BaseController {
|
|
|
|
|
|
fur.setId(followId);//跟进记录的ID
|
|
|
fur.setCid(customerId);//跟进记录表中的cid
|
|
|
- fur.setCuid(customerUsrId);//跟进记录表中的联系人id
|
|
|
- fur.setAid(TokenManager.getUserId());
|
|
|
+ fur.setCuid(customerUsrId);//跟进记录表中的联系人id
|
|
|
/*if(StringUtils.isNotBlank(cusIn.getAid())) fur.setAid(cusIn.getAid());*//*暂时注释*/
|
|
|
|
|
|
BeanUtils.copyProperties(c, cusIn);
|
|
|
@@ -114,13 +113,22 @@ public class AdminCustomerApiController extends BaseController {
|
|
|
* 查询操作员信息
|
|
|
*
|
|
|
* @return
|
|
|
+ * @throws InvocationTargetException
|
|
|
+ * @throws IllegalAccessException
|
|
|
* @throws ParseException
|
|
|
*/
|
|
|
@RequestMapping(value = "/findAdmin", method = RequestMethod.POST)
|
|
|
- public Result selectAllAdmin() throws ParseException {
|
|
|
+ public Result selectAllAdmin(CustomerIn cusIn) throws IllegalAccessException, InvocationTargetException {
|
|
|
Result res = new Result();
|
|
|
- List<Admin> selectAllAdmin = adminService.selectAllAdmin();
|
|
|
- res.setData(selectAllAdmin);
|
|
|
+ List<AdminOut> adminList = adminService.selectAdmin();
|
|
|
+ for (int i = 0; i < adminList.size(); i++) {
|
|
|
+ adminList.get(i).setBeforeAdminName(cusIn.getBeforeAdminName());
|
|
|
+ adminList.get(i).setBeforeCompanyIntention(cusIn.getBeforeCompanyIntention());
|
|
|
+ adminList.get(i).setBeforeCustomerStatus(cusIn.getBeforeCustomerStatus());
|
|
|
+ adminList.get(i).setBeforeFollowSituation(cusIn.getBeforeFollowSituation());
|
|
|
+ adminList.get(i).setCid(cusIn.getId());
|
|
|
+ }
|
|
|
+ res.setData(adminList);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@@ -217,8 +225,8 @@ public class AdminCustomerApiController extends BaseController {
|
|
|
* @throws InvocationTargetException
|
|
|
* @throws IllegalAccessException
|
|
|
*/
|
|
|
- @RequestMapping(value = "/transferCsutomer", method = RequestMethod.POST)
|
|
|
- public Result transferCsutomer (CustomerIn cusIn) throws IllegalAccessException, InvocationTargetException {
|
|
|
+ @RequestMapping(value = "/transferCustomer", method = RequestMethod.POST)
|
|
|
+ public Result transferCustomer (CustomerIn cusIn) throws IllegalAccessException, InvocationTargetException {
|
|
|
Result res=new Result();
|
|
|
Customer c =new Customer();
|
|
|
BeanUtils.copyProperties(c, cusIn);
|
|
|
@@ -229,4 +237,55 @@ public class AdminCustomerApiController extends BaseController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询单个联系人信息
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ /*@RequestMapping(value = "/transferCsutomer", method = RequestMethod.POST)
|
|
|
+ public Result findContractById (String id) {
|
|
|
+ Result res=new Result();
|
|
|
+ res.setData(customerUserService.findContractById(id));
|
|
|
+ return res;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改单个联系人信息
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ /*@RequestMapping(value = "/transferCsutomer", method = RequestMethod.POST)
|
|
|
+ public Result updContractById (String id) {
|
|
|
+ Result res=new Result();
|
|
|
+ return res;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加跟进记录
|
|
|
+ * @param fur
|
|
|
+ * @return
|
|
|
+ * @throws ParseException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "addFollow", method = RequestMethod.POST)
|
|
|
+ public Result addFollowUpRecord(FollowUpRecord fur, CustomerIn cusIn ,String followDate) throws ParseException{
|
|
|
+ Result res = new Result();
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
|
|
|
+ if(StringUtils.isNotBlank(followDate)) fur.setFollowDate(format.parse(followDate));
|
|
|
+ String followId = UUID.randomUUID().toString();
|
|
|
+ fur.setId(followId);
|
|
|
+ cusIn.setFollowId(followId);
|
|
|
+ followUpService.addFollowUp(fur, cusIn);
|
|
|
+ Customer cus = new Customer();
|
|
|
+ try {
|
|
|
+ BeanUtils.copyProperties(cus, cusIn);
|
|
|
+ if(StringUtils.isNotBlank(cusIn.getFollowSituation()))
|
|
|
+ cus.setFollowSituation(Integer.parseInt(cusIn.getFollowSituation()));
|
|
|
+ if(StringUtils.isNotBlank(cusIn.getCustomerStatus()))
|
|
|
+ cus.setCustomerStatus(Integer.parseInt(cusIn.getCustomerStatus()));
|
|
|
+ } catch (IllegalAccessException | InvocationTargetException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ customerService.updateCustomer(cus);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|