AdminCustomerApiController.java 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028
  1. package com.goafanti.customer.controller;
  2. import java.io.IOException;
  3. import java.lang.reflect.InvocationTargetException;
  4. import java.text.DateFormat;
  5. import java.text.ParseException;
  6. import java.text.SimpleDateFormat;
  7. import java.util.ArrayList;
  8. import java.util.Date;
  9. import java.util.List;
  10. import java.util.Set;
  11. import java.util.TreeSet;
  12. import javax.annotation.Resource;
  13. import javax.servlet.http.HttpServletRequest;
  14. import javax.servlet.http.HttpServletResponse;
  15. import org.springframework.beans.factory.annotation.Value;
  16. import org.springframework.web.bind.annotation.RequestMapping;
  17. import org.springframework.web.bind.annotation.RequestMethod;
  18. import org.springframework.web.bind.annotation.RestController;
  19. import com.alibaba.fastjson.JSON;
  20. import com.alibaba.fastjson.JSONArray;
  21. import com.goafanti.admin.service.AdminService;
  22. import com.goafanti.admin.service.AftFileService;
  23. import com.goafanti.common.bo.Error;
  24. import com.goafanti.common.bo.Result;
  25. import com.goafanti.common.constant.AFTConstants;
  26. import com.goafanti.common.constant.ErrorConstants;
  27. import com.goafanti.common.controller.BaseApiController;
  28. import com.goafanti.common.error.BusinessException;
  29. import com.goafanti.common.model.AftFile;
  30. import com.goafanti.common.model.OrganizationContactBook;
  31. import com.goafanti.common.model.User;
  32. import com.goafanti.common.utils.BeanUtilsExt;
  33. import com.goafanti.common.utils.DateUtils;
  34. import com.goafanti.common.utils.ExcelUtils;
  35. import com.goafanti.common.utils.StringUtils;
  36. import com.goafanti.core.shiro.token.TokenManager;
  37. import com.goafanti.customer.bo.BusinessListBo;
  38. import com.goafanti.customer.bo.BussinessFollowBo;
  39. import com.goafanti.customer.bo.CustomerExcelBo;
  40. import com.goafanti.customer.bo.CustomerListIn;
  41. import com.goafanti.customer.bo.CustomerListOut;
  42. import com.goafanti.customer.bo.CustomerOrganizationDetailBo;
  43. import com.goafanti.customer.bo.CustomerPersonalDetailBo;
  44. import com.goafanti.customer.bo.FollowBusinessBo;
  45. import com.goafanti.customer.bo.UserDetailBo;
  46. import com.goafanti.customer.service.CustomerService;
  47. @RestController
  48. @RequestMapping("/open/api/admin/customer")
  49. public class AdminCustomerApiController extends BaseApiController{
  50. @Resource
  51. private CustomerService customerService;
  52. @Resource
  53. private AftFileService aftFileService;
  54. @Value(value = "${upload.private.path}")
  55. private String uploadPrivatePath = null;
  56. @Resource
  57. private AdminService adminService;
  58. /** 私有个人客户列表 **/
  59. @RequestMapping(value = "/listPrivatePersonalCustomer" , method = RequestMethod.POST)
  60. public Result listPrivatePersonalCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  61. Result res = new Result();
  62. res.setData(customerService.listPrivatePersonalCustomer(cli, pageNo, pageSize));
  63. return res;
  64. }
  65. /** 公共个人客户列表 **/
  66. @RequestMapping(value = "/listPublicPersonalCustomer" , method = RequestMethod.POST)
  67. public Result listPublicPersonalCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  68. Result res = new Result();
  69. res.setData(customerService.listPublicPersonalCustomer(cli, pageNo, pageSize));
  70. return res;
  71. }
  72. /** 个人客户查询 **/
  73. @RequestMapping(value = "/listAllPersonalCustomer" , method = RequestMethod.POST)
  74. public Result listAllPersonalCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  75. Result res = new Result();
  76. res.setData(customerService.listAllPersonalCustomer(cli, pageNo, pageSize));
  77. return res;
  78. }
  79. /** 管理个人客户查询 **/
  80. @RequestMapping(value = "/listAllManagePersonalCustomer" , method = RequestMethod.POST)
  81. public Result listAllManagePersonalCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  82. Result res = new Result();
  83. if (!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)){
  84. cli.setAid(TokenManager.getAdminId());
  85. }
  86. res.setData(customerService.listAllManagePersonalCustomer(cli, pageNo, pageSize));
  87. return res;
  88. }
  89. /** 专家查询 **/
  90. @RequestMapping(value = "/listExpertCustomer" , method = RequestMethod.POST)
  91. public Result listExpertCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  92. Result res = new Result();
  93. res.setData(customerService.listAllManagePersonalCustomer(cli, pageNo, pageSize));
  94. return res;
  95. }
  96. /** 私有单位客户列表 **/
  97. @RequestMapping(value = "/listPrivateOrganizationCustomer" , method = RequestMethod.POST)
  98. public Result listPrivateOrganizationCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  99. Result res = new Result();
  100. res.setData(customerService.listPrivateOrganizationCustomer(cli, pageNo, pageSize));
  101. return res;
  102. }
  103. /** 公共单位客户列表 **/
  104. @RequestMapping(value = "/listPublicOrganizationCustomer" , method = RequestMethod.POST)
  105. public Result listPublicOrganizationCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  106. Result res = new Result();
  107. res.setData(customerService.listPublicOrganizationCustomer(cli, pageNo, pageSize));
  108. return res;
  109. }
  110. /** 单位客户查询 **/
  111. @RequestMapping(value = "/listAllOrganizationCustomer" , method = RequestMethod.POST)
  112. public Result listAllOrganizationCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  113. Result res = new Result();
  114. res.setData(customerService.listAllOrganizationCustomer(cli, pageNo, pageSize));
  115. return res;
  116. }
  117. /** 管理单位客户查询 **/
  118. @RequestMapping(value = "/listAllManageOrganizationCustomer" , method = RequestMethod.POST)
  119. public Result listAllManageOrganizationCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  120. Result res = new Result();
  121. res.setData(customerService.listAllManageOrganizationCustomer(cli, pageNo, pageSize));
  122. return res;
  123. }
  124. /** 签单的单位客户 **/
  125. @RequestMapping(value = "/listSignOrganizationCustomer", method = RequestMethod.POST)
  126. public Result listSignOrganizationCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  127. Result res = new Result();
  128. res.setData(customerService.listSignOrganizationCustomer(cli, pageNo, pageSize));
  129. return res;
  130. }
  131. /** 签单的个人客户 **/
  132. @RequestMapping(value = "/listSignPersonalCustomer", method = RequestMethod.POST)
  133. public Result listSignPersonalCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  134. Result res = new Result();
  135. res.setData(customerService.listSignPersonalCustomer(cli, pageNo, pageSize));
  136. return res;
  137. }
  138. /** 客户即时检索 **/
  139. @RequestMapping(value = "/findCustomerByName",method = RequestMethod.GET)
  140. public Result findCustomerByName(String name){
  141. Result res = new Result();
  142. res.setData(customerService.findCustomerByName(name));
  143. return res;
  144. }
  145. /** 客户即时检索(可签单客户) **/
  146. @RequestMapping(value = "/getCustomerByName",method = RequestMethod.GET)
  147. public Result getCustomerByName(String name,Integer type){
  148. Result res = new Result();
  149. if(type == null){
  150. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  151. return res;
  152. }
  153. if(name.length()<2) return res;
  154. if(type == 0) res.setData(customerService.getPrivateCustomerByName(name));
  155. if(type == 1) res.setData(customerService.getSignedCustomerByName(name));
  156. return res;
  157. }
  158. /** 添加客户基本信息
  159. * @throws Exception
  160. * @throws NumberFormatException **/
  161. @RequestMapping(value = "/addCustomer", method = RequestMethod.POST)
  162. public Result addCustomer(String name,String contacts,String contactMobile,Integer type,
  163. Integer province ,Integer city, Integer area,Integer source,String societyTag) throws Exception{
  164. Result res = new Result();
  165. if(StringUtils.isBlank(name) || StringUtils.isBlank(contacts)
  166. || StringUtils.isBlank(contactMobile) || StringUtils.isBlank(societyTag)||null==province||null==city||null==area){
  167. res.getError().add(buildError("","客户名称、联系人、联系电话、社会性质、地址不能为空"));
  168. return res;
  169. }
  170. customerService.addCustomer(name, contacts, contactMobile,type,source,societyTag,province,city,area);
  171. return res;
  172. }
  173. /** 个人客户详情信息 **/
  174. @RequestMapping(value = "/findPersonalCustomerDetail" ,method = RequestMethod.GET)
  175. public Result findPersonalCustomerDetail(String uid){
  176. Result res = new Result();
  177. res.setData(customerService.findPersonalCustomerDetail(uid));
  178. return res;
  179. }
  180. /** 单位客户详情信息 **/
  181. @RequestMapping(value = "/findOrganizationCustomerDetail", method = RequestMethod.GET)
  182. public Result findOrganizationCustomerDetail(String uid){
  183. Result res = new Result();
  184. res.setData(customerService.findOrganizationCustomerDetail(uid));
  185. return res;
  186. }
  187. /** 修改单位客户信息 **/
  188. @RequestMapping(value = "/updateOrganizationCustomer", method = RequestMethod.POST)
  189. public Result updateOrganizationCustomer(CustomerOrganizationDetailBo bo){
  190. Result res = new Result();
  191. if(StringUtils.isBlank(bo.getId()) || StringUtils.isBlank(bo.getUid())){
  192. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
  193. return res;
  194. }
  195. customerService.updateOrganizationCustomer(bo);
  196. return res;
  197. }
  198. /** 修改个人客户信息 **/
  199. @RequestMapping(value = "/updatePersonalCustomer", method = RequestMethod.POST)
  200. public Result updatePersonalCustomer(CustomerPersonalDetailBo bo){
  201. Result res = new Result();
  202. if(StringUtils.isBlank(bo.getUid()) || StringUtils.isBlank(bo.getId())){
  203. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
  204. return res;
  205. }
  206. customerService.updatePersonalCustomer(bo);
  207. return res;
  208. }
  209. /** 查看跟进记录 **/
  210. @RequestMapping(value = "/listFollowHistory", method = RequestMethod.GET)
  211. public Result listFollowHistory(Integer pageNo, Integer pageSize,String uid,String businessProjectId){
  212. Result res = new Result();
  213. res.setData(customerService.listFollowHistory(pageNo,pageSize,uid,businessProjectId));
  214. return res;
  215. }
  216. /** 查看客户账户信息 **/
  217. @RequestMapping(value = "/findUserAccountDetail", method = RequestMethod.GET)
  218. public Result findUserAcountDetail(String uid){
  219. Result res = new Result();
  220. UserDetailBo bo = new UserDetailBo();
  221. User user = customerService.findUserAccountDetail(uid);
  222. try {
  223. BeanUtilsExt.copyProperties(bo, user);
  224. } catch (InvocationTargetException | IllegalAccessException e) {
  225. e.printStackTrace();
  226. }
  227. SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
  228. bo.setCreateTimes(format.format(user.getCreateTime()));
  229. res.setData(bo);
  230. return res;
  231. }
  232. /** 修改客户账户信息 **/
  233. @RequestMapping(value = "/updateUserAccount", method = RequestMethod.POST)
  234. public Result updateUserAccount(User user){
  235. Result res = new Result();
  236. customerService.updateUserAccount(user);
  237. return res;
  238. }
  239. /** 查看客户联系人列表 **/
  240. @RequestMapping(value = "/findCustomerContacts", method = RequestMethod.GET)
  241. public Result findCustomerContacts(String uid){
  242. Result res = new Result();
  243. res.setData(customerService.findCustomerContacts(uid));
  244. return res;
  245. }
  246. /** 针对已作拜访的业务作跟进 **/
  247. @RequestMapping(value = "/toAddFollowOnHistory", method = RequestMethod.GET)
  248. public Result toAddFollowOnHistory(String uid){
  249. Result res = new Result();
  250. if(StringUtils.isBlank(uid)){
  251. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  252. return res;
  253. }
  254. User user = customerService.findUserAccountDetail(uid);
  255. FollowBusinessBo fbb = new FollowBusinessBo();
  256. SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
  257. fbb.setFollowTime(format.format(new Date()));
  258. fbb.setIdentifyName(user.getIdentifyName());
  259. fbb.setUid(uid);
  260. fbb.setUserBusinessList(customerService.findBusinessByUAid(uid, TokenManager.getAdminId()));
  261. res.setData(fbb);
  262. return res;
  263. }
  264. /** 针对已锁定的业务作跟进 **/
  265. @RequestMapping(value = "/toAddFollowOnLock", method = RequestMethod.GET)
  266. public Result toAddFollowOnLock(String uid){
  267. Result res = new Result();
  268. if(StringUtils.isBlank(uid)){
  269. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  270. return res;
  271. }
  272. User user = customerService.findUserAccountDetail(uid);
  273. FollowBusinessBo fbb = new FollowBusinessBo();
  274. SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
  275. fbb.setFollowTime(format.format(new Date()));
  276. fbb.setIdentifyName(user.getIdentifyName());
  277. fbb.setUid(uid);
  278. fbb.setUserBusinessList(customerService.findLockedBusinessByUAid(uid, TokenManager.getAdminId()));
  279. res.setData(fbb);
  280. return res;
  281. }
  282. /** 添加拜访记录
  283. * @throws ParseException
  284. * @throws Exception **/
  285. @RequestMapping(value = "/addFollow", method = RequestMethod.POST)
  286. public Result addFollow(String userBusinessList,String uid,String ocbId,String contactType,String result,String followTime) throws BusinessException{
  287. Result res = new Result();
  288. if(StringUtils.isBlank(uid) || StringUtils.isBlank(ocbId)){
  289. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  290. return res;
  291. }
  292. JSONArray ja = (JSONArray) JSON.parse(userBusinessList);
  293. List<BusinessListBo> list = new ArrayList<BusinessListBo>();
  294. if (ja != null && !ja.isEmpty()) {
  295. BusinessListBo userBusiness = null;
  296. for (int idx = 0; idx < ja.size(); idx++) {
  297. userBusiness = ja.getJSONObject(idx).toJavaObject(BusinessListBo.class);
  298. for(BusinessListBo ub:list){
  299. if(ub.getBusinessProjectId() == userBusiness.getBusinessProjectId()){
  300. res.getError().add(new com.goafanti.common.bo.Error("业务类型重复,请检查后重新提交!"));
  301. return res;
  302. }
  303. }
  304. list.add(userBusiness);
  305. }
  306. }
  307. FollowBusinessBo fbb = new FollowBusinessBo();
  308. fbb.setOcbId(ocbId);
  309. fbb.setUid(uid);
  310. fbb.setContactType(contactType);
  311. fbb.setResult(result);
  312. fbb.setFollowTime(followTime);
  313. fbb.setUserBusinessList(list);
  314. customerService.addFollow(fbb);
  315. return res;
  316. }
  317. /** 进入修改拜访记录 **/
  318. @RequestMapping(value = "/toUpdateFollow", method = RequestMethod.GET)
  319. public Result toUpdateFollow(String followId){
  320. Result res = new Result();
  321. FollowBusinessBo fbb = customerService.findFollowById(followId);
  322. fbb.setUserBusinessList(customerService.findBusinessByFollowId(followId));
  323. res.setData(fbb);
  324. return res;
  325. }
  326. /** 修改拜访记录
  327. * @throws ParseException
  328. * @throws BusinessException
  329. */
  330. @RequestMapping(value = "/updateFollow", method = RequestMethod.POST)
  331. public Result updateFollow(String userBusinessList,String followId,String followTime,String uid,String contactType,String result) throws BusinessException{
  332. Result res = new Result();
  333. if(StringUtils.isBlank(uid) || StringUtils.isBlank(followId)){
  334. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  335. return res;
  336. }
  337. JSONArray ja = (JSONArray) JSON.parse(userBusinessList);
  338. List<BusinessListBo> list = new ArrayList<BusinessListBo>();
  339. if (ja != null && !ja.isEmpty()) {
  340. BusinessListBo userBusiness = null;
  341. for (int idx = 0; idx < ja.size(); idx++) {
  342. userBusiness = ja.getJSONObject(idx).toJavaObject(BusinessListBo.class);
  343. for(BusinessListBo ub:list){
  344. if(ub.getBusinessProjectId() == userBusiness.getBusinessProjectId()){
  345. res.getError().add(new com.goafanti.common.bo.Error("业务类型重复,请检查后重新提交!"));
  346. return res;
  347. }
  348. }
  349. list.add(userBusiness);
  350. }
  351. }
  352. FollowBusinessBo fbb = new FollowBusinessBo();
  353. fbb.setFollowTime(followTime);
  354. fbb.setUid(uid);
  355. fbb.setContactType(contactType);
  356. fbb.setResult(result);
  357. fbb.setUserBusinessList(list);
  358. fbb.setFollowId(followId);
  359. customerService.updateFollow(fbb);
  360. return res;
  361. }
  362. /** 删除跟进记录 **/
  363. @RequestMapping(value = "/deleteFollow", method = RequestMethod.GET)
  364. public Result deleteFollow(String followId){
  365. Result res = new Result();
  366. if(StringUtils.isBlank(followId)){
  367. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  368. return res;
  369. }
  370. customerService.deleteFollow(followId);
  371. return res;
  372. }
  373. /** 查询客户的所有联系人 **/
  374. @RequestMapping(value = "/findAllContacts", method = RequestMethod.GET)
  375. public Result findAllContacts(String uid){
  376. Result res = new Result();
  377. res.setData(customerService.findAllContacts(uid));
  378. return res;
  379. }
  380. /** 修改企业联系人 **/
  381. @RequestMapping(value = "/updateCustomerContacts", method = RequestMethod.POST)
  382. public Result updateCustomerContacts(String contactList,String uid){
  383. Result res = new Result();
  384. if(StringUtils.isBlank(uid)){
  385. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  386. return res;
  387. }
  388. JSONArray ja = (JSONArray) JSON.parse(contactList);
  389. List<OrganizationContactBook> ocbList = new ArrayList<OrganizationContactBook>();
  390. OrganizationContactBook ocb = null;
  391. if(ja != null & !ja.isEmpty()){
  392. for (int idx = 0; idx < ja.size(); idx++) {
  393. ocb = ja.getJSONObject(idx).toJavaObject(OrganizationContactBook.class);
  394. if(StringUtils.isBlank(ocb.getMobile()) || StringUtils.isBlank(ocb.getName())){
  395. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户名和手机号码为必填"));
  396. return res;
  397. }
  398. if(StringUtils.isBlank(ocb.getUid())) ocb.setUid(uid);
  399. ocbList.add(ocb);
  400. }
  401. }
  402. customerService.updateCustomerContacts(ocbList,uid);
  403. return res;
  404. }
  405. /** 领取客户 **/
  406. @RequestMapping(value = "/receiveCustomer", method = RequestMethod.GET)
  407. public Result receiveCustomer(String uid,String oldAid){
  408. Result res = new Result();
  409. if(StringUtils.isBlank(uid) || StringUtils.isBlank("oldAid")){
  410. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  411. return res;
  412. }
  413. customerService.updateByOperatorType(uid, oldAid,AFTConstants.USER_RECEIVE);
  414. return res;
  415. }
  416. /** 删除客户 **/
  417. @RequestMapping(value = "/deleteCustomer", method = RequestMethod.GET)
  418. public Result deleteCustomer(String uid,String oldAid){
  419. Result res = new Result();
  420. if(StringUtils.isBlank(uid) || StringUtils.isBlank("aid")){
  421. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  422. return res;
  423. }
  424. customerService.updateByOperatorType(uid, oldAid,AFTConstants.USER_DELETE);
  425. return res;
  426. }
  427. /**
  428. * 上传excel文档
  429. * @param req
  430. * @return
  431. */
  432. @RequestMapping(value = "/uploadExcel",method = RequestMethod.POST)
  433. public Result uploadExcel(HttpServletRequest req){
  434. Result res = new Result();
  435. String excelPath = handleFile(res, "/customer_sys_file/", true, req, "");
  436. ExcelUtils utils = new ExcelUtils();
  437. Set<CustomerExcelBo> boSet;
  438. try {
  439. boSet = utils.parseExcel(uploadPrivatePath + excelPath);
  440. String errorMessage = "";
  441. if(boSet.size()>100) errorMessage += "导入数据不能超过一百条;";
  442. errorMessage += utils.getVacantRows();
  443. if(StringUtils.isNotBlank(errorMessage)) {
  444. res.getError().add(new Error(errorMessage));
  445. return res;
  446. }
  447. Set<Integer> existRows = new TreeSet<Integer>(); //数据库已存在
  448. Set<Integer> filterRows = new TreeSet<Integer>(); //过滤提示
  449. customerService.checkCustomer(boSet,existRows,filterRows);
  450. if(existRows.size()>0){
  451. errorMessage = StringUtils.join(existRows.toArray(),",")+ " 行客户业务已存在;";
  452. res.getError().add(new Error(errorMessage));
  453. return res;
  454. }
  455. if(filterRows.size()>0){
  456. errorMessage = StringUtils.join(filterRows.toArray(),",")+ " 行已经被系统过滤;";
  457. res.getError().add(new Error(errorMessage));
  458. return res;
  459. }
  460. customerService.saveUploadData(boSet);
  461. } catch (IOException e) {
  462. e.printStackTrace();
  463. }
  464. return res;
  465. }
  466. /**
  467. * 下载科技成果批量导入Excel模板
  468. */
  469. @RequestMapping(value = "/downloadTemplate", method = RequestMethod.GET)
  470. public Result downloadTemplateFile(HttpServletResponse response,String type) {
  471. Result res = new Result();
  472. if(AFTConstants.USER_TYPE_ORGANIZATION.equals(type)){
  473. AftFile af = aftFileService.selectAftFileBySign("organization_customer_template");
  474. if (null == af) {
  475. res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "", "找不到文件!"));
  476. } else {
  477. String path = af.getFilePath();
  478. String suffix = path.substring(path.lastIndexOf("."));
  479. String fileName = af.getFileName() + suffix;
  480. downloadFile(response, fileName, path);
  481. }
  482. }else if(AFTConstants.USER_TYPE_PERSONAL.equals(type)){
  483. AftFile af = aftFileService.selectAftFileBySign("personal_customer_template");
  484. if (null == af) {
  485. res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "", "找不到文件!"));
  486. } else {
  487. String path = af.getFilePath();
  488. String suffix = path.substring(path.lastIndexOf("."));
  489. String fileName = af.getFileName() + suffix;
  490. downloadFile(response, fileName, path);
  491. }
  492. }
  493. return res;
  494. }
  495. /** 转为公共客户 **/
  496. @RequestMapping(value = "/transferToPublic", method = RequestMethod.GET)
  497. public Result transferToPublic(String uid,String aid){
  498. Result res = new Result();
  499. if(StringUtils.isBlank(uid) || StringUtils.isBlank("aid")){
  500. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  501. }
  502. customerService.updateByOperatorType(uid, aid, AFTConstants.USER_TRANSFER_TO_PUBLIC);
  503. return res;
  504. }
  505. /** 图片上传 **/
  506. @RequestMapping(value = "/uploadCustomerImg", method = RequestMethod.POST)
  507. public Result uploadCustomerImg(HttpServletRequest req,String sign){
  508. Result res = new Result();
  509. res.setData(handleFile(res, "/customer_sys_file/", false, req, sign));
  510. return res;
  511. }
  512. /**
  513. *
  514. * @param startDate 开始日期
  515. * @param endDate 结束日期
  516. * @param timeSpan 时间差
  517. * @param depId 部门编号
  518. * @param pageNo 页码
  519. * @param pageSize 页数
  520. * @return
  521. * @throws ParseException
  522. */
  523. @RequestMapping(value = "/customerStatistics",method = RequestMethod.GET)
  524. public Result customerStatistics(String startDate,String endDate,String timeSpan,String depNo,String businessGlossoryId,Integer pageNo, Integer pageSize) throws ParseException{
  525. Result res = new Result();
  526. Date sDate = null;
  527. Date eDate = null;
  528. DateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDD);
  529. if(StringUtils.isNotBlank(startDate)) sDate = format.parse(startDate);
  530. if(StringUtils.isNotBlank(endDate)) eDate = format.parse(endDate);
  531. if(StringUtils.isBlank(startDate)&&StringUtils.isBlank(endDate)){
  532. Date date = new Date();
  533. if(timeSpan.equals(DateUtils.DAY_SPAN)){
  534. sDate = DateUtils.getYesterday();
  535. }else if(timeSpan.equals(DateUtils.WEEK_SPAN)){
  536. sDate = DateUtils.getLastDayOfLastWeek(date);
  537. }else if(timeSpan.equals(DateUtils.MONTH_SPAN)){
  538. sDate = DateUtils.getLastDayOfLastMonth(date);
  539. }else if(timeSpan.equals(DateUtils.QUARTER_SPAN)){
  540. sDate = DateUtils.getLastDayOfLastQuarter(date);
  541. }else if(timeSpan.equals(DateUtils.YEAR_SPAN)){
  542. sDate = DateUtils.getLastDayOfLastYear(date);
  543. }
  544. }
  545. res.setData(customerService.customerStatistics(sDate,eDate,depNo,businessGlossoryId,pageNo,pageSize));
  546. return res;
  547. }
  548. /**
  549. *
  550. * @param startDate 开始日期
  551. * @param endDate 结束日期
  552. * @param timeSpan 时间差
  553. * @param depId 部门编号
  554. * @param businessGlossoryId 业务编号
  555. * @param pageNo 页码
  556. * @param pageSiz 页数
  557. * @return
  558. * @throws ParseException
  559. */
  560. @RequestMapping(value = "/businessStatistic", method = RequestMethod.GET)
  561. public Result businessStatistic(String startDate,String endDate,String timeSpan,String depNo,String businessGlossoryId,Integer pageNo, Integer pageSize) throws ParseException{
  562. Result res = new Result();
  563. Date sDate = null;
  564. Date eDate = null;
  565. DateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDD);
  566. if(StringUtils.isNotBlank(startDate)) sDate = format.parse(startDate);
  567. if(StringUtils.isNotBlank(endDate)) eDate = format.parse(endDate);
  568. if(StringUtils.isBlank(startDate)&&StringUtils.isBlank(endDate)){
  569. Date date = new Date();
  570. if(timeSpan.equals(DateUtils.DAY_SPAN)){
  571. sDate = DateUtils.getYesterday();
  572. }else if(timeSpan.equals(DateUtils.WEEK_SPAN)){
  573. sDate = DateUtils.getLastDayOfLastWeek(date);
  574. }else if(timeSpan.equals(DateUtils.MONTH_SPAN)){
  575. sDate = DateUtils.getLastDayOfLastMonth(date);
  576. }else if(timeSpan.equals(DateUtils.QUARTER_SPAN)){
  577. sDate = DateUtils.getLastDayOfLastQuarter(date);
  578. }else if(timeSpan.equals(DateUtils.YEAR_SPAN)){
  579. sDate = DateUtils.getLastDayOfLastYear(date);
  580. }
  581. }
  582. res.setData(customerService.businessStatistic(sDate,eDate,depNo,businessGlossoryId,pageNo,pageSize));
  583. return res;
  584. }
  585. /**
  586. *
  587. * @param startDate 开始日期
  588. * @param endDate 结束日期
  589. * @param timeSpan 时间差
  590. * @param depId 部门编号
  591. * @param businessGlossoryId 业务编号
  592. * @param pageNo 页码
  593. * @param pageSiz 页数
  594. * @return
  595. * @throws ParseException
  596. */
  597. @RequestMapping(value = "/followStatistic",method = RequestMethod.GET)
  598. public Result followStatistic(String startDate,String endDate,String timeSpan,String depNo,Integer pageNo, Integer pageSize) throws ParseException{
  599. Result res = new Result();
  600. Date sDate = null;
  601. Date eDate = null;
  602. DateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDD);
  603. if(StringUtils.isNotBlank(startDate)) sDate = format.parse(startDate);
  604. if(StringUtils.isNotBlank(endDate)) eDate = format.parse(endDate);
  605. if(StringUtils.isBlank(startDate)&&StringUtils.isBlank(endDate)){
  606. Date date = new Date();
  607. if(timeSpan.equals(DateUtils.DAY_SPAN)){
  608. sDate = DateUtils.getYesterday();
  609. }else if(timeSpan.equals(DateUtils.WEEK_SPAN)){
  610. sDate = DateUtils.getLastDayOfLastWeek(date);
  611. }else if(timeSpan.equals(DateUtils.MONTH_SPAN)){
  612. sDate = DateUtils.getLastDayOfLastMonth(date);
  613. }else if(timeSpan.equals(DateUtils.QUARTER_SPAN)){
  614. sDate = DateUtils.getLastDayOfLastQuarter(date);
  615. }else if(timeSpan.equals(DateUtils.YEAR_SPAN)){
  616. sDate = DateUtils.getLastDayOfLastYear(date);
  617. }
  618. }
  619. res.setData(customerService.followStatistic(sDate, eDate, depNo, pageNo, pageSize));
  620. return res;
  621. }
  622. /** 管理员列表 **/
  623. @RequestMapping(value = "/listAdminByName",method = RequestMethod.GET)
  624. public Result listAdminByName(String adminName){
  625. Result res = new Result();
  626. if(StringUtils.isNotBlank(adminName))res.setData(adminService.listAdminByName(adminName));
  627. return res;
  628. }
  629. /** 转交客户到制定人 **/
  630. @RequestMapping(value = "/transferToOther", method = RequestMethod.GET)
  631. public Result transferToOther(String uid,String aid,String oldAid){
  632. Result res = new Result();
  633. if(StringUtils.isBlank(uid) || StringUtils.isBlank(aid)){
  634. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "客户编号或管理员编号"));
  635. return res;
  636. }
  637. customerService.updateByOperatorType(uid,oldAid,AFTConstants.USER_TRANSFER_TO_OTHER, aid);
  638. return res;
  639. }
  640. /** 查询我的业务列表 **/
  641. @RequestMapping(value = "/listBusiness", method = RequestMethod.POST)
  642. public Result listBusiness(BusinessListBo blo,Integer pageNo, Integer pageSize){
  643. Result res = new Result();
  644. res.setData(customerService.listBusiness(blo, pageNo, pageSize));
  645. return res;
  646. }
  647. /** 查询所有的业务列表 **/
  648. @RequestMapping(value = "/listAllBusiness", method = RequestMethod.POST)
  649. public Result listAllBusiness(BusinessListBo blo,Integer pageNo, Integer pageSize){
  650. Result res = new Result();
  651. res.setData(customerService.listAllBusiness(blo, pageNo, pageSize));
  652. return res;
  653. }
  654. /** 业务管理列表 **/
  655. @RequestMapping(value = "/listManageBusiness", method = RequestMethod.POST)
  656. public Result listManageBusiness(BusinessListBo blo,Integer pageNo, Integer pageSize){
  657. Result res = new Result();
  658. res.setData(customerService.listManageBusiness(blo, pageNo, pageSize));
  659. return res;
  660. }
  661. /** 查询业务字典 **/
  662. @RequestMapping(value = "/findBusinessGlossory",method = RequestMethod.GET)
  663. public Result findBusinessGlossory(){
  664. Result res = new Result();
  665. res.setData(customerService.findBusinessGlossory());
  666. return res;
  667. }
  668. /** 新增客户意向 **/
  669. @RequestMapping(value = "/addBusinessAndFollow", method = RequestMethod.POST)
  670. public Result addBusinessAndFollow(BussinessFollowBo bfb){
  671. Result res = new Result();
  672. if(StringUtils.isBlank(bfb.getBusinessProjectId()) || StringUtils.isBlank(bfb.getUid())){
  673. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  674. return res;
  675. }
  676. if(customerService.judgeBusiness(bfb.getUid(), bfb.getBusinessProjectId())>0){
  677. res.getError().add(new Error("该项业务已经被跟进"));
  678. return res;
  679. }
  680. try {
  681. customerService.addBusinessAndFollow(bfb);
  682. } catch (ParseException e) {
  683. e.printStackTrace();
  684. }
  685. return res;
  686. }
  687. /** 进入新增意向服务 **/
  688. @RequestMapping(value = "/toAddBusinessAndFollow", method = RequestMethod.GET)
  689. public Result toAddBusinessAndFollow(){
  690. Result res = new Result();
  691. BussinessFollowBo bo = new BussinessFollowBo();
  692. bo.setAdminName(TokenManager.getAdminToken().getName());
  693. SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
  694. bo.setCreateTime(format.format(new Date()));
  695. bo.setFollowTime(bo.getCreateTime());
  696. res.setData(bo);
  697. return res;
  698. }
  699. /** 进入修改业务意向 **/
  700. @RequestMapping(value = "/toUpdateBusiness", method = RequestMethod.GET)
  701. public Result toUpdateBusiness(String businessId){
  702. Result res = new Result();
  703. res.setData(customerService.findBusinessDetail(businessId));
  704. return res;
  705. }
  706. /** 修改业务意向 **/
  707. @RequestMapping(value = "/updateBusiness", method = RequestMethod.POST)
  708. public Result updateBusiness(BussinessFollowBo bfb){
  709. Result res = new Result();
  710. customerService.updateBusiness(bfb);
  711. return res;
  712. }
  713. /** 进入跟进单个客户意向 **/
  714. @RequestMapping(value = "/toAddFollowOneBusiness", method = RequestMethod.GET)
  715. public Result toAddFollowOneBusiness(String businessId){
  716. Result res = new Result();
  717. BussinessFollowBo bo = customerService.findBusinessDetail(businessId);
  718. SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
  719. bo.setFollowTime(format.format(new Date()));
  720. res.setData(bo);
  721. return res;
  722. }
  723. /** 跟进单个客户意向 **/
  724. @RequestMapping(value = "/addFollowOneBusiness", method = RequestMethod.POST)
  725. public Result addFollowOneBusiness(BussinessFollowBo bfb){
  726. Result res = new Result();
  727. if(StringUtils.isBlank(bfb.getBusinessId()) ||
  728. StringUtils.isBlank(bfb.getUid()) || StringUtils.isBlank(bfb.getOcbId())){
  729. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  730. return res;
  731. }
  732. try {
  733. customerService.addFollowOneBusiness(bfb);
  734. } catch (ParseException e) {
  735. e.printStackTrace();
  736. }
  737. return res;
  738. }
  739. /** 进入修改某个客户一个业务的当次拜访 **/
  740. @RequestMapping(value = "/toUpdateFollowOneBusiness", method = RequestMethod.GET)
  741. public Result toUpdateFollowOneBusiness(String ufbId){
  742. Result res = new Result();
  743. if(StringUtils.isBlank(ufbId)) {
  744. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  745. return res;
  746. }
  747. res.setData(customerService.findFollowOneBusiness(ufbId));
  748. return res;
  749. }
  750. /** 修改某个客户一个业务的当次拜访 **/
  751. @RequestMapping(value = "/updateFollowOneBusiness", method = RequestMethod.POST)
  752. public Result updateFollowOneBusiness(BussinessFollowBo bfb){
  753. Result res = new Result();
  754. if(StringUtils.isBlank(bfb.getFollowId()) || StringUtils.isBlank(bfb.getUfbId())){
  755. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  756. return res;
  757. }
  758. customerService.updateFollowOneBusiness(bfb);
  759. return res;
  760. }
  761. /** 删除某个客户一个业务的当次拜访 **/
  762. @RequestMapping(value = "/deleteFollowOneBusiness", method = RequestMethod.GET)
  763. public Result deleteFollowOneBusiness(String ufbId){
  764. Result res = new Result();
  765. if(StringUtils.isBlank(ufbId)){
  766. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  767. return res;
  768. }
  769. customerService.deleteFollowOneBusiness(ufbId);
  770. return res;
  771. }
  772. /** 添加单个联系人 **/
  773. @RequestMapping(value = "/addOneContact", method = RequestMethod.POST)
  774. public Result addOneContact(OrganizationContactBook ocb){
  775. Result res = new Result();
  776. if(StringUtils.isBlank(ocb.getUid())){
  777. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  778. return res;
  779. }
  780. if(StringUtils.isBlank(ocb.getName()) || StringUtils.isBlank(ocb.getMobile())){
  781. res.getError().add(buildError("联系人号码和联系人姓名不能为空"));
  782. return res;
  783. }
  784. customerService.addOneContact(ocb);
  785. return res;
  786. }
  787. /** 删除单个联系人 **/
  788. @RequestMapping(value = "/deleteOneContact", method = RequestMethod.GET)
  789. public Result deleteOneContact(String ocbId){
  790. Result res = new Result();
  791. if(StringUtils.isBlank(ocbId)){
  792. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  793. return res;
  794. }
  795. customerService.deleteOneContact(ocbId);
  796. return res;
  797. }
  798. /** 修改主要联系人 **/
  799. @RequestMapping(value = "/updateMainContact", method = RequestMethod.GET)
  800. public Result updateMainContact(String ocbId,String uid){
  801. Result res = new Result();
  802. if(StringUtils.isBlank(uid) || StringUtils.isBlank(ocbId)){
  803. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  804. return res;
  805. }
  806. customerService.updateMainContact(ocbId,uid);
  807. return res;
  808. }
  809. /** 删除 业务 **/
  810. @RequestMapping(value = "/deleteBusiness", method =RequestMethod.GET)
  811. public Result deleteBusiness(String businessId){
  812. Result res = new Result();
  813. if(StringUtils.isBlank(businessId)){
  814. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  815. return res;
  816. }
  817. customerService.deleteBusiness(businessId);
  818. return res;
  819. }
  820. /** 停止业务 **/
  821. @RequestMapping(value = "/stopBusiness", method = RequestMethod.GET)
  822. public Result stopBusiness(String businessId){
  823. Result res = new Result();
  824. if(StringUtils.isBlank(businessId)){
  825. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  826. return res;
  827. }
  828. customerService.updateBusinessToStop(businessId);
  829. return res;
  830. }
  831. /** 客户分配查询(本部门) **/
  832. @RequestMapping(value = "/findAdminName" , method = RequestMethod.POST)
  833. public Result findAdminName(){
  834. Result res = new Result();
  835. res.setData(customerService.findAdminName());
  836. return res;
  837. }
  838. /** 分配个人客户 **/
  839. @RequestMapping(value = "/updatePersonalCustomerz", method = RequestMethod.POST)
  840. public Result updatePersonalCustomerz(CustomerPersonalDetailBo bo){
  841. Result res = new Result();
  842. if(StringUtils.isBlank(bo.getUid()) || StringUtils.isBlank(bo.getId())){
  843. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
  844. return res;
  845. }
  846. customerService.updatePersonalCustomerz(bo);
  847. return res;
  848. }
  849. /** 客户录入审核 **/
  850. @RequestMapping(value = "/findEnteringAudit" , method = RequestMethod.POST)
  851. public Result findEnteringAudit(CustomerListOut clo,Integer pageNo, Integer pageSize){
  852. Result res = new Result();
  853. res.setData(customerService.findEnteringAudit(clo, pageNo, pageSize));
  854. return res;
  855. }
  856. /** 修改客户录入审核状态 **/
  857. @RequestMapping(value = "/updateEnteringAudit", method = RequestMethod.POST)
  858. public Result updateEnteringAudit(User bo){
  859. Result res = new Result();
  860. if(StringUtils.isBlank(bo.getId())){
  861. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
  862. return res;
  863. }
  864. res.data(customerService.updateEnteringAudit(bo));
  865. return res;
  866. }
  867. /** 审核拒绝客户查询 **/
  868. @RequestMapping(value = "/findEnteringAuditIsNo" , method = RequestMethod.POST)
  869. public Result findEnteringAuditIsNo(CustomerListOut clo,Integer pageNo, Integer pageSize){
  870. Result res = new Result();
  871. res.setData(customerService.findEnteringAuditIsNo(clo, pageNo, pageSize));
  872. return res;
  873. }
  874. /** 修改拒绝客户信息 **/
  875. @RequestMapping(value = "/updateRefusedCustomer", method = RequestMethod.POST)
  876. public Result updateRefusedCustomer(String id,String nickname,String mobile,String societyTag){
  877. Result res = new Result();
  878. if(StringUtils.isBlank(nickname)){
  879. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"名称"));
  880. return res;
  881. }
  882. if(StringUtils.isBlank(mobile)){
  883. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"电话"));
  884. return res;
  885. }
  886. if(StringUtils.isBlank(societyTag)){
  887. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"社会性质"));
  888. return res;
  889. }
  890. customerService.updateRefusedCustomer(id, nickname, mobile, societyTag);
  891. return res;
  892. }
  893. /** 查询客户的锁定业务 **/
  894. @RequestMapping(value = "/getLockedProject", method = RequestMethod.GET)
  895. public Result getLockedProject(String uid){
  896. Result res = new Result();
  897. if(StringUtils.isBlank(uid)){
  898. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"用户ID"));
  899. return res;
  900. }
  901. res.setData(customerService.selectLockedProject(uid));
  902. return res;
  903. }
  904. /** 客户二次签项目业务 **/
  905. @RequestMapping(value = "/againProjectTask", method = RequestMethod.GET)
  906. public Result againProjectTask(String uid,String projectId,String aid){
  907. Result res = new Result();
  908. if(StringUtils.isBlank(uid)||StringUtils.isBlank(projectId)){
  909. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"参数"));
  910. return res;
  911. }
  912. res.setData(customerService.updateAgainProjectTask(uid,projectId,aid));
  913. return res;
  914. }
  915. /** 客户资料转交 **/
  916. @RequestMapping(value = "/updateInformationMaintainerr", method = RequestMethod.POST)
  917. public Result updateInformationMaintainerr(String id,String aid){
  918. Result res = new Result();
  919. if(StringUtils.isBlank(id) || StringUtils.isBlank(aid)){
  920. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
  921. return res;
  922. }
  923. res.data(customerService.updateInformationMaintainerr(id,aid));
  924. return res;
  925. }
  926. /** 个人单位客户信息列表 **/
  927. @RequestMapping(value = "/listCustomerInformation", method = RequestMethod.POST)
  928. public Result listCustomerInformation(CustomerListIn cli,Integer pageNo, Integer pageSize){
  929. Result res = new Result();
  930. res.data(customerService.listCustomerInformation(cli,pageNo,pageSize));
  931. return res;
  932. }
  933. /** 部门单位客户信息列表 **/
  934. @RequestMapping(value = "/listDepCustomerInformation", method = RequestMethod.POST)
  935. public Result listDepCustomerInformation(CustomerListIn cli,Integer pageNo, Integer pageSize){
  936. Result res = new Result();
  937. res.data(customerService.listDepCustomerInformation(cli,pageNo,pageSize));
  938. return res;
  939. }
  940. /** 修改客户等级 **/
  941. @RequestMapping(value = "/updateUserLevel", method = RequestMethod.GET)
  942. public Result updateUserLevel(User u){
  943. Result res = new Result();
  944. if(StringUtils.isBlank(u.getId())){
  945. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"用户ID错误","用户ID"));
  946. return res;
  947. }
  948. if(null==u.getLevel()){
  949. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"用户等级错误","用户等级"));
  950. return res;
  951. }
  952. res.data(customerService.updateUserLevel(u));
  953. return res;
  954. }
  955. }