|
|
@@ -3,7 +3,9 @@ package com.goafanti.customer.controller;
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
@@ -11,11 +13,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.BaseController;
|
|
|
import com.goafanti.common.model.User;
|
|
|
+import com.goafanti.common.model.UserBusiness;
|
|
|
import com.goafanti.common.utils.BeanUtilsExt;
|
|
|
import com.goafanti.common.utils.StringUtils;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
@@ -184,8 +189,25 @@ public class CustomerApiController extends BaseController{
|
|
|
|
|
|
/** 添加拜访记录 **/
|
|
|
@RequestMapping(value = "/addFollow", method = RequestMethod.POST)
|
|
|
- public Result addFollow(FollowBusinessBo fbb){
|
|
|
- Result res = new Result();
|
|
|
+ public Result addFollow(String userBusinessList,String uid,String ocbId,String contactType,String result,String followTime){
|
|
|
+ Result res = new Result();
|
|
|
+ if(StringUtils.isBlank(uid) || StringUtils.isBlank(ocbId)){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
|
|
|
+ }
|
|
|
+ JSONArray ja = (JSONArray) JSON.parse(userBusinessList);
|
|
|
+ List<UserBusiness> list = new ArrayList<UserBusiness>();
|
|
|
+ if (ja != null && !ja.isEmpty()) {
|
|
|
+ for (int idx = 0; idx < ja.size(); idx++) {
|
|
|
+ list.add(ja.getJSONObject(idx).toJavaObject(UserBusiness.class));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ FollowBusinessBo fbb = new FollowBusinessBo();
|
|
|
+ fbb.setOcbId(ocbId);
|
|
|
+ fbb.setUid(uid);
|
|
|
+ fbb.setContactType(contactType);
|
|
|
+ fbb.setResult(result);
|
|
|
+ fbb.setFollowTime(followTime);
|
|
|
+ fbb.setUserBusinessList(list);
|
|
|
try {
|
|
|
customerService.addFollow(fbb);
|
|
|
} catch (ParseException e) {
|
|
|
@@ -206,8 +228,24 @@ public class CustomerApiController extends BaseController{
|
|
|
|
|
|
/** 修改拜访记录 **/
|
|
|
@RequestMapping(value = "/updateFollow", method = RequestMethod.POST)
|
|
|
- public Result updateFollow(FollowBusinessBo fbb){
|
|
|
+ public Result updateFollow(String userBusinessList,String followId,String followTime,String uid,String contactType,String result){
|
|
|
Result res = new Result();
|
|
|
+ if(StringUtils.isBlank(uid) || StringUtils.isBlank(followId)){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
|
|
|
+ }
|
|
|
+ JSONArray ja = (JSONArray) JSON.parse(userBusinessList);
|
|
|
+ List<UserBusiness> list = new ArrayList<UserBusiness>();
|
|
|
+ if (ja != null && !ja.isEmpty()) {
|
|
|
+ for (int idx = 0; idx < ja.size(); idx++) {
|
|
|
+ list.add(ja.getJSONObject(idx).toJavaObject(UserBusiness.class));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ FollowBusinessBo fbb = new FollowBusinessBo();
|
|
|
+ fbb.setFollowTime(followTime);
|
|
|
+ fbb.setUid(uid);
|
|
|
+ fbb.setContactType(contactType);
|
|
|
+ fbb.setResult(result);
|
|
|
+ fbb.setUserBusinessList(list);
|
|
|
try {
|
|
|
customerService.updateFollow(fbb);
|
|
|
} catch (ParseException e) {
|