AdminCustomerApiController.java 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655
  1. package com.goafanti.customer.controller;
  2. import com.alibaba.fastjson.JSON;
  3. import com.alibaba.fastjson.JSONArray;
  4. import com.goafanti.admin.service.AdminService;
  5. import com.goafanti.admin.service.AttachmentService;
  6. import com.goafanti.common.bo.Error;
  7. import com.goafanti.common.bo.Result;
  8. import com.goafanti.common.constant.AFTConstants;
  9. import com.goafanti.common.constant.ErrorConstants;
  10. import com.goafanti.common.controller.BaseApiController;
  11. import com.goafanti.common.enums.AttachmentType;
  12. import com.goafanti.common.error.BusinessException;
  13. import com.goafanti.common.model.Attachment;
  14. import com.goafanti.common.model.OrganizationContactBook;
  15. import com.goafanti.common.model.User;
  16. import com.goafanti.common.utils.*;
  17. import com.goafanti.core.mybatis.page.Pagination;
  18. import com.goafanti.core.shiro.token.TokenManager;
  19. import com.goafanti.customer.bo.*;
  20. import com.goafanti.customer.service.CustomerService;
  21. import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  22. import org.springframework.beans.factory.annotation.Value;
  23. import org.springframework.validation.BindingResult;
  24. import org.springframework.validation.annotation.Validated;
  25. import org.springframework.web.bind.annotation.*;
  26. import org.springframework.web.multipart.MultipartFile;
  27. import javax.annotation.Resource;
  28. import javax.servlet.http.HttpServletRequest;
  29. import javax.servlet.http.HttpServletResponse;
  30. import java.io.IOException;
  31. import java.io.OutputStream;
  32. import java.lang.reflect.InvocationTargetException;
  33. import java.nio.charset.StandardCharsets;
  34. import java.text.DateFormat;
  35. import java.text.ParseException;
  36. import java.text.SimpleDateFormat;
  37. import java.util.*;
  38. @RestController
  39. @RequestMapping("/api/admin/customer")
  40. public class AdminCustomerApiController extends BaseApiController{
  41. @Resource
  42. private CustomerService customerService;
  43. @Resource
  44. private AttachmentService aftFileService;
  45. @Value(value = "${upload.private.path}")
  46. private String uploadPrivatePath = null;
  47. @Value(value = "${user.receive.max}")
  48. private Integer USER_RECEIVE_MAX = null;
  49. @Resource
  50. private AdminService adminService;
  51. @Value(value = "${aesSecretKey}")
  52. private String secretKey = null;
  53. /** 私有个人客户列表 **/
  54. @RequestMapping(value = "/listPrivatePersonalCustomer" , method = RequestMethod.POST)
  55. public Result listPrivatePersonalCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  56. Result res = new Result();
  57. res.setData(customerService.listPrivatePersonalCustomer(cli, pageNo, pageSize));
  58. return res;
  59. }
  60. /** 公共个人客户列表 **/
  61. @RequestMapping(value = "/listPublicPersonalCustomer" , method = RequestMethod.POST)
  62. public Result listPublicPersonalCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  63. Result res = new Result();
  64. res.setData(customerService.listPublicPersonalCustomer(cli, pageNo, pageSize));
  65. return res;
  66. }
  67. /** 个人客户查询 **/
  68. @RequestMapping(value = "/listAllPersonalCustomer" , method = RequestMethod.POST)
  69. public Result listAllPersonalCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  70. Result res = new Result();
  71. res.setData(customerService.listAllPersonalCustomer(cli, pageNo, pageSize));
  72. return res;
  73. }
  74. /** 签单的个人客户 **/
  75. @RequestMapping(value = "/listSignPersonalCustomer", method = RequestMethod.POST)
  76. public Result listSignPersonalCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  77. Result res = new Result();
  78. res.setData(customerService.listSignPersonalCustomer(cli, pageNo, pageSize));
  79. return res;
  80. }
  81. /** 管理个人客户查询 **/
  82. @RequestMapping(value = "/listAllManagePersonalCustomer" , method = RequestMethod.POST)
  83. public Result listAllManagePersonalCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  84. Result res = new Result();
  85. if (!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)){
  86. cli.setAid(TokenManager.getAdminId());
  87. }
  88. res.setData(customerService.listAllManagePersonalCustomer(cli, pageNo, pageSize));
  89. return res;
  90. }
  91. /** 专家查询 **/
  92. @RequestMapping(value = "/listExpertCustomer" , method = RequestMethod.POST)
  93. public Result listExpertCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  94. Result res = new Result();
  95. res.setData(customerService.listAllManagePersonalCustomer(cli, pageNo, pageSize));
  96. return res;
  97. }
  98. /** 个人客户详情信息 **/
  99. @RequestMapping(value = "/findPersonalCustomerDetail" ,method = RequestMethod.GET)
  100. public Result findPersonalCustomerDetail(String uid){
  101. Result res = new Result();
  102. res.setData(customerService.findPersonalCustomerDetail(uid));
  103. return res;
  104. }
  105. /**
  106. * 私有单位客户列表
  107. * 私有客户列表
  108. **/
  109. @RequestMapping(value = "/listPrivateOrganizationCustomer" , method = RequestMethod.POST)
  110. public Result listPrivateOrganizationCustomer(CustomerListIn cli ,Integer sort,Integer sortType,Integer pageNo, Integer pageSize){
  111. Result res = new Result();
  112. //
  113. res.setData(customerService.listPrivateOrganizationCustomer(cli, sort, sortType, 0, pageNo, pageSize));
  114. return res;
  115. }
  116. /**
  117. * 私有渠道客户列表
  118. *
  119. **/
  120. @RequestMapping(value = "/channelUserList" , method = RequestMethod.GET)
  121. public Result channelUserList(InputChannelListBo in ){
  122. Result res = new Result();
  123. in.setNewChannel(1);
  124. in.setShareType(0);
  125. res.setData(customerService.channelUserList(in));
  126. return res;
  127. }
  128. /**
  129. * 公共渠道客户列表
  130. *
  131. **/
  132. @RequestMapping(value = "/publicChannelUserList" , method = RequestMethod.GET)
  133. public Result publicChannelUserList(InputChannelListBo in ){
  134. Result res = new Result();
  135. in.setNewChannel(1);
  136. //获取公共
  137. in.setShareType(1);
  138. res.setData(customerService.channelUserList(in));
  139. return res;
  140. }
  141. /**
  142. * 渠道客户查询
  143. *
  144. **/
  145. @RequestMapping(value = "/selectChannelUserList" , method = RequestMethod.GET)
  146. public Result selectChannelUserList(InputChannelListBo in ){
  147. Result res = new Result();
  148. in.setNewChannel(1);
  149. if (in.getName()==null||in.getName().length()<2){
  150. res.getError().add(buildError("搜索名字必须大于2个字符"));
  151. return res;
  152. }
  153. res.setData(customerService.selectChannelUserList(in));
  154. return res;
  155. }
  156. /** 跟进管理列表
  157. * 跟进列表
  158. **/
  159. @RequestMapping(value = "/listFollowManagement" , method = RequestMethod.GET)
  160. public Result listFollowManagement(CustomerListIn cli ,Integer sort,Integer sortType,Integer pageNo, Integer pageSize){
  161. Result res = new Result();
  162. res.setData(customerService.listPrivateOrganizationCustomer(cli, sort, sortType, 1, pageNo, pageSize));
  163. return res;
  164. }
  165. /**
  166. * 私有单位客户导出xls
  167. * @throws IOException
  168. */
  169. @RequestMapping(value = "/privateUnitCustomerOutXls" , method = RequestMethod.GET)
  170. public Result privateUnitCustomerOutXls(CustomerListIn cli ,Integer sort,Integer sortType,Integer pageNo, Integer pageSize,HttpServletResponse response) throws IOException{
  171. Result res = new Result();
  172. XSSFWorkbook wb = customerService.privateUnitCustomerOutXls(cli, sort, sortType, pageNo, pageSize);
  173. String fileName = "我的客户列表 " + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + ".xls";
  174. OutputStream out = null;
  175. try {
  176. out = response.getOutputStream();
  177. } catch (IOException e) {
  178. e.printStackTrace();
  179. }
  180. response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes(), StandardCharsets.ISO_8859_1));
  181. response.setContentType("application/octet-stream;charset=utf-8");
  182. try {
  183. // 返回数据流
  184. wb.write(out);
  185. if (out != null) {
  186. out.flush();
  187. out.close();
  188. }
  189. } finally {
  190. if (out != null) {
  191. out.flush();
  192. out.close();
  193. }
  194. }
  195. return res;
  196. }
  197. /** 公共单位客户列表 **/
  198. @RequestMapping(value = "/listPublicOrganizationCustomer" , method = RequestMethod.POST)
  199. public Result listPublicOrganizationCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  200. Result res = new Result();
  201. res.setData(customerService.listPublicOrganizationCustomer(cli, pageNo, pageSize));
  202. return res;
  203. }
  204. /** 单位客户查询 **/
  205. @RequestMapping(value = "/listAllOrganizationCustomer" , method = RequestMethod.POST)
  206. public Result listAllOrganizationCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  207. Result res = new Result();
  208. if (StringUtils.isBlank(cli.getName())){
  209. res.setData( new Pagination<>());
  210. return res;
  211. }
  212. res.setData(customerService.listAllOrganizationCustomer(cli, pageNo, pageSize));
  213. return res;
  214. }
  215. /** 管理单位客户查询 **/
  216. @RequestMapping(value = "/listAllManageOrganizationCustomer" , method = RequestMethod.POST)
  217. public Result listAllManageOrganizationCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  218. Result res = new Result();
  219. res.setData(customerService.listAllManageOrganizationCustomer(cli, pageNo, pageSize));
  220. return res;
  221. }
  222. /** 签单的单位客户 **/
  223. @RequestMapping(value = "/listSignOrganizationCustomer", method = RequestMethod.POST)
  224. public Result listSignOrganizationCustomer(CustomerListIn cli,Integer pageNo, Integer pageSize){
  225. Result res = new Result();
  226. res.setData(customerService.listSignOrganizationCustomer(cli, pageNo, pageSize));
  227. return res;
  228. }
  229. /** 签单客户转交 **/
  230. @RequestMapping(value = "/customerHandOver", method = RequestMethod.POST)
  231. public Result listSignPersonalCustomer(String userIds ,String receiveId){
  232. Result res = new Result();
  233. res.setData(customerService.customerHandOver( userIds , receiveId));
  234. return res;
  235. }
  236. /** 客户即时检索 **/
  237. @RequestMapping(value = "/findCustomerByName",method = RequestMethod.GET)
  238. public Result findCustomerByName(String name){
  239. Result res = new Result();
  240. res.setData(customerService.findCustomerByName(name));
  241. return res;
  242. }
  243. /** 客户即时检索(可签单客户) **/
  244. @RequestMapping(value = "/getCustomerByName",method = RequestMethod.GET)
  245. public Result getCustomerByName(String name,Integer type){
  246. Result res = new Result();
  247. if(type == null){
  248. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  249. return res;
  250. }
  251. if(name.length()<2) return res;
  252. if(type == 0) res.setData(customerService.getPrivateCustomerByName(name));
  253. if(type == 1) res.setData(customerService.getSignedCustomerByName(name));
  254. if(type == 2) res.setData(customerService.getChannelCustomerByName(name));
  255. if(type == 3) res.setData(customerService.getRestrictCustomerByName(name));
  256. return res;
  257. }
  258. /** 客户查询 **/
  259. @RequestMapping(value = "/getUserByName",method = RequestMethod.GET)
  260. public Result getUserByName(String name){
  261. Result res = new Result();
  262. if(StringUtils.isEmpty(name)){
  263. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "名称","名称"));
  264. return res;
  265. }
  266. if(name.length()<2) return res;
  267. res.data(customerService.getUserByName(name));
  268. return res;
  269. }
  270. /**
  271. * 客户查询
  272. * @param name 查询名称
  273. * @param type 分类 0默认 1小程序App
  274. * @param pageNo
  275. * @param pageSize
  276. * @return
  277. */
  278. @RequestMapping(value = "/getUserByNames",method = RequestMethod.GET)
  279. public Result getUserByName(String name,Integer type,Integer pageNo,Integer pageSize){
  280. Result res = new Result();
  281. if(StringUtils.isEmpty(name)){
  282. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "名称","名称"));
  283. return res;
  284. }
  285. if(name.length()<2) return res;
  286. res.data(customerService.getUserByNames(name,type,pageNo,pageSize));
  287. return res;
  288. }
  289. /** 添加客户基本信息
  290. * @throws Exception
  291. * @throws NumberFormatException **/
  292. @RequestMapping(value = "/addCustomer", method = RequestMethod.POST)
  293. public Result addCustomer(InputAddCustomer in) {
  294. Result res = new Result();
  295. if(StringUtils.isBlank(in.getName()) || StringUtils.isBlank(in.getContacts())
  296. || StringUtils.isBlank(in.getContactMobile()) ||null==in.getProvince()||null==in.getCity()||null==in.getArea()
  297. || StringUtils.isBlank(in.getBusinessScope())||null==in.getOrgCode()
  298. || StringUtils.isBlank(in.getIntendedProject())){
  299. res.getError().add(buildError("","创建客户参数不全"));
  300. return res;
  301. }
  302. if (!customerService.checkAid(TokenManager.getAdminId(),Integer.valueOf(AFTConstants.CUSTOMER_SERVICE_SALESMAN))){
  303. if (customerService.checkMax(null,TokenManager.getAdminId())) {
  304. res.getError().add(buildError("","私有客户已达最大限制"));
  305. return res;
  306. }
  307. }
  308. if (customerService.checkOrgCode(in.getOrgCode())){
  309. res.getError().add(buildError("","统一信用代码已存在"));
  310. return res;
  311. }
  312. //新增为私有客户
  313. in.setShareType(0);
  314. //将新增客户的空格去除
  315. res.data(customerService.addCustomer(in));
  316. return res;
  317. }
  318. @RequestMapping(value = "/addChannel", method = RequestMethod.POST)
  319. public Result addChannel(@Validated InputAddCustomer in, BindingResult bindingResult) {
  320. Result res = new Result();
  321. if (bindingResult.hasErrors()) {
  322. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  323. ParamUtils.getParamName(in,bindingResult.getFieldError().getField())));
  324. return res;
  325. }
  326. if (customerService.checkUserName(null,in.getName())){
  327. res.getError().add(buildError("客户名称已存在"));
  328. return res;
  329. }
  330. in.setType(1);
  331. //新增为私有客户
  332. in.setShareType(0);
  333. in.setNewChannel(1);
  334. //将新增客户的空格去除
  335. res.data(customerService.addCustomer(in));
  336. return res;
  337. }
  338. /** 单位客户详情信息 **/
  339. @RequestMapping(value = "/findOrganizationCustomerDetail", method = RequestMethod.GET)
  340. public Result findOrganizationCustomerDetail(String uid){
  341. Result res = new Result();
  342. res.setData(customerService.findOrganizationCustomerDetail(uid));
  343. return res;
  344. }
  345. /** 修改单位客户信息 **/
  346. @RequestMapping(value = "/updateOrganizationCustomer", method = RequestMethod.POST)
  347. public Result updateOrganizationCustomer(CustomerOrganizationDetailBo bo){
  348. Result res = new Result();
  349. if(StringUtils.isBlank(bo.getId()) || StringUtils.isBlank(bo.getUid())){
  350. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
  351. return res;
  352. }
  353. customerService.updateOrganizationCustomer(bo);
  354. return res;
  355. }
  356. /** 修改个人客户信息 **/
  357. @RequestMapping(value = "/updatePersonalCustomer", method = RequestMethod.POST)
  358. public Result updatePersonalCustomer(CustomerPersonalDetailBo bo){
  359. Result res = new Result();
  360. if(StringUtils.isBlank(bo.getUid()) || StringUtils.isBlank(bo.getId())){
  361. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
  362. return res;
  363. }
  364. customerService.updatePersonalCustomer(bo);
  365. return res;
  366. }
  367. /** 查看跟进记录 **/
  368. @RequestMapping(value = "/listFollowHistory", method = RequestMethod.GET)
  369. public Result listFollowHistory(Integer pageNo, Integer pageSize,String uid,String businessProjectId,Integer type){
  370. Result res = new Result();
  371. res.setData(customerService.listFollowHistory(pageNo,pageSize,uid,businessProjectId,type));
  372. return res;
  373. }
  374. /** 指导已读 **/
  375. @RequestMapping(value = "/pushGuidance", method = RequestMethod.POST)
  376. public Result pushGuidance(String uid){
  377. Result res = new Result();
  378. if (StringUtils.isBlank(uid)) {
  379. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"用户编号"));
  380. return res;
  381. }
  382. res.setData(customerService.pushGuidance(uid));
  383. return res;
  384. }
  385. /** 新增指导意见 **/
  386. @RequestMapping(value = "/addGuidance", method = RequestMethod.POST)
  387. public Result addGuidance(String followId,String guidance){
  388. Result res = new Result();
  389. if (StringUtils.isBlank(followId)||StringUtils.isBlank(guidance)) {
  390. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"编号、指导意见","编号、指导意见"));
  391. return res;
  392. }
  393. res.setData(customerService.addGuidance( followId, guidance));
  394. return res;
  395. }
  396. /** 查看客户账户信息 **/
  397. @RequestMapping(value = "/findUserAccountDetail", method = RequestMethod.GET)
  398. public Result findUserAcountDetail(String uid){
  399. Result res = new Result();
  400. UserDetailBo bo = new UserDetailBo();
  401. User user = customerService.findUserAccountDetail(uid);
  402. try {
  403. BeanUtilsExt.copyProperties(bo, user);
  404. } catch (InvocationTargetException | IllegalAccessException e) {
  405. e.printStackTrace();
  406. }
  407. SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
  408. bo.setCreateTimes(format.format(user.getCreateTime()));
  409. res.setData(bo);
  410. return res;
  411. }
  412. /** 修改客户账户信息 **/
  413. @RequestMapping(value = "/updateUserAccount", method = RequestMethod.POST)
  414. public Result updateUserAccount(User user){
  415. Result res = new Result();
  416. customerService.updateUserAccount(user);
  417. return res;
  418. }
  419. /** 查看客户联系人列表 **/
  420. @RequestMapping(value = "/findCustomerContacts", method = RequestMethod.GET)
  421. public Result findCustomerContacts(String uid){
  422. Result res = new Result();
  423. res.setData(customerService.findCustomerContacts(uid));
  424. return res;
  425. }
  426. /** 针对已作拜访的业务作跟进 **/
  427. @RequestMapping(value = "/toAddFollowOnHistory", method = RequestMethod.GET)
  428. public Result toAddFollowOnHistory(String uid){
  429. Result res = new Result();
  430. if(StringUtils.isBlank(uid)){
  431. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  432. return res;
  433. }
  434. User user = customerService.findUserAccountDetail(uid);
  435. FollowBusinessBo fbb = new FollowBusinessBo();
  436. SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
  437. fbb.setFollowTime(format.format(new Date()));
  438. fbb.setIdentifyName(user.getIdentifyName());
  439. fbb.setUid(uid);
  440. fbb.setUserBusinessList(customerService.findBusinessByUAid(uid, TokenManager.getAdminId()));
  441. res.setData(fbb);
  442. return res;
  443. }
  444. /** 针对已锁定的业务作跟进 **/
  445. @RequestMapping(value = "/toAddFollowOnLock", method = RequestMethod.GET)
  446. public Result toAddFollowOnLock(String uid){
  447. Result res = new Result();
  448. if(StringUtils.isBlank(uid)){
  449. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  450. return res;
  451. }
  452. User user = customerService.findUserAccountDetail(uid);
  453. FollowBusinessBo fbb = new FollowBusinessBo();
  454. SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
  455. fbb.setFollowTime(format.format(new Date()));
  456. fbb.setIdentifyName(user.getIdentifyName());
  457. fbb.setUid(uid);
  458. fbb.setUserBusinessList(customerService.findLockedBusinessByUAid(uid, TokenManager.getAdminId()));
  459. res.setData(fbb);
  460. return res;
  461. }
  462. /** 添加拜访记录、客户跟进
  463. * @param type 0=客户拜访,2=限定项目拜访
  464. * **/
  465. @RequestMapping(value = "/addFollow", method = RequestMethod.POST)
  466. public Result addFollow(String userBusinessList,String uid,String ocbId,String contactType,
  467. String result,String followTime,Integer type,String pid) throws BusinessException{
  468. Result res = res();
  469. if(StringUtils.isBlank(uid) || StringUtils.isBlank(ocbId)){
  470. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  471. return res;
  472. }
  473. JSONArray ja = (JSONArray) JSON.parse(userBusinessList);
  474. List<BusinessListBo> list = new ArrayList<BusinessListBo>();
  475. if (ja != null && !ja.isEmpty()) {
  476. BusinessListBo userBusiness = null;
  477. for (int idx = 0; idx < ja.size(); idx++) {
  478. userBusiness = ja.getJSONObject(idx).toJavaObject(BusinessListBo.class);
  479. for(BusinessListBo ub:list){
  480. if(ub.getBusinessProjectId() == userBusiness.getBusinessProjectId()){
  481. res.getError().add(new com.goafanti.common.bo.Error("业务类型重复,请检查后重新提交!"));
  482. return res;
  483. }
  484. }
  485. list.add(userBusiness);
  486. }
  487. }
  488. if (type==null)type=0;
  489. FollowBusinessBo fbb = new FollowBusinessBo();
  490. fbb.setOcbId(ocbId);
  491. fbb.setUid(uid);
  492. fbb.setContactType(contactType);
  493. fbb.setResult(result);
  494. fbb.setFollowTime(followTime);
  495. fbb.setUserBusinessList(list);
  496. customerService.addFollow(fbb,null,1,type,pid);
  497. return res.data(1);
  498. }
  499. /** 进入修改拜访记录 **/
  500. @RequestMapping(value = "/toUpdateFollow", method = RequestMethod.GET)
  501. public Result toUpdateFollow(String followId){
  502. Result res = new Result();
  503. FollowBusinessBo fbb = customerService.findFollowById(followId);
  504. fbb.setUserBusinessList(customerService.findBusinessByFollowId(followId));
  505. res.setData(fbb);
  506. return res;
  507. }
  508. /** 修改拜访记录
  509. * @throws ParseException
  510. * @throws BusinessException
  511. */
  512. @RequestMapping(value = "/updateFollow", method = RequestMethod.POST)
  513. public Result updateFollow(String userBusinessList,String followId,String followTime,String uid,String contactType,String result) throws BusinessException{
  514. Result res = new Result();
  515. if(StringUtils.isBlank(uid) || StringUtils.isBlank(followId)){
  516. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  517. return res;
  518. }
  519. JSONArray ja = (JSONArray) JSON.parse(userBusinessList);
  520. List<BusinessListBo> list = new ArrayList<BusinessListBo>();
  521. if (ja != null && !ja.isEmpty()) {
  522. BusinessListBo userBusiness = null;
  523. for (int idx = 0; idx < ja.size(); idx++) {
  524. userBusiness = ja.getJSONObject(idx).toJavaObject(BusinessListBo.class);
  525. for(BusinessListBo ub:list){
  526. if(ub.getBusinessProjectId() == userBusiness.getBusinessProjectId()){
  527. res.getError().add(new com.goafanti.common.bo.Error("业务类型重复,请检查后重新提交!"));
  528. return res;
  529. }
  530. }
  531. list.add(userBusiness);
  532. }
  533. }
  534. FollowBusinessBo fbb = new FollowBusinessBo();
  535. fbb.setFollowTime(followTime);
  536. fbb.setUid(uid);
  537. fbb.setContactType(contactType);
  538. fbb.setResult(result);
  539. fbb.setUserBusinessList(list);
  540. fbb.setFollowId(followId);
  541. customerService.updateFollow(fbb);
  542. return res;
  543. }
  544. /** 删除跟进记录 **/
  545. @RequestMapping(value = "/deleteFollow", method = RequestMethod.GET)
  546. public Result deleteFollow(String followId){
  547. Result res = new Result();
  548. if(StringUtils.isBlank(followId)){
  549. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  550. return res;
  551. }
  552. customerService.deleteFollow(followId);
  553. return res;
  554. }
  555. /** 查询客户的所有联系人 **/
  556. @RequestMapping(value = "/findAllContacts", method = RequestMethod.GET)
  557. public Result findAllContacts(String uid){
  558. Result res = new Result();
  559. res.setData(customerService.findAllContacts(uid));
  560. return res;
  561. }
  562. /** 修改企业联系人 **/
  563. @RequestMapping(value = "/updateCustomerContacts", method = RequestMethod.POST)
  564. public Result updateCustomerContacts(String contactList,String uid){
  565. Result res = new Result();
  566. if(StringUtils.isBlank(uid)){
  567. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  568. return res;
  569. }
  570. JSONArray ja = (JSONArray) JSON.parse(contactList);
  571. List<OrganizationContactBook> ocbList = new ArrayList<OrganizationContactBook>();
  572. OrganizationContactBook ocb = null;
  573. if(ja != null & !ja.isEmpty()){
  574. for (int idx = 0; idx < ja.size(); idx++) {
  575. ocb = ja.getJSONObject(idx).toJavaObject(OrganizationContactBook.class);
  576. if(StringUtils.isBlank(ocb.getMobile()) || StringUtils.isBlank(ocb.getName())){
  577. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户名和手机号码为必填"));
  578. return res;
  579. }
  580. if(StringUtils.isBlank(ocb.getUid())) ocb.setUid(uid);
  581. ocbList.add(ocb);
  582. }
  583. }
  584. customerService.updateCustomerContacts(ocbList,uid);
  585. return res;
  586. }
  587. /**
  588. * 领取客户
  589. * @param uid 客户编号
  590. * @param oldAid 原来的客户归属人
  591. * @return
  592. */
  593. @RequestMapping(value = "/receiveCustomer", method = RequestMethod.GET)
  594. public Result receiveCustomer(String uid, String oldAid) {
  595. Result res = new Result();
  596. if (StringUtils.isBlank(uid) || StringUtils.isBlank("oldAid")) {
  597. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  598. return res;
  599. }
  600. Integer check =customerService.receiveEveryDay(uid);
  601. if (check!=0){
  602. if (check==-1){
  603. res.getError().add(buildError(ErrorConstants.CUSTOMER_ALREADY_RECEIVE));
  604. return res;
  605. }else if (check==-2){
  606. res.getError().add(buildError(ErrorConstants.CUSTOM_EREXCESS, USER_RECEIVE_MAX.toString(),USER_RECEIVE_MAX.toString()));
  607. return res;
  608. }else if (check==-3){
  609. //客服营销员不限制上线
  610. if (!TokenManager.hasRole(AFTConstants.CUSTOMER_SERVICE_SALESMAN)){
  611. res.getError().add(buildError("", "领取失败!您的“私有客户/私有限定项目”总计已超出最大限制,请移出相关数据后,再来领取!"));
  612. return res;
  613. }
  614. }else if (check==-4){
  615. res.getError().add(buildError("", "外联客户丢失后不可再领取"));
  616. return res;
  617. }else {
  618. res.getError().add(buildError("领取参数异常,请联系管理员"));
  619. return res;
  620. }
  621. }
  622. customerService.updateByOperatorType(uid, null, oldAid, AFTConstants.USER_RECEIVE, null);
  623. return res;
  624. }
  625. /**
  626. * 领取为渠道
  627. * @param uid
  628. * @return
  629. */
  630. @RequestMapping(value = "/receiveAsChannel",method=RequestMethod.POST)
  631. public Result receiveAsChannel(String uid){
  632. Result res = new Result();
  633. if (uid ==null ){
  634. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"客户"));
  635. return res;
  636. }
  637. res.data(customerService.pushReceiveAsChannel(uid));
  638. return res;
  639. }
  640. /**
  641. * 上传excel文档
  642. * @param req
  643. * @return
  644. */
  645. @RequestMapping(value = "/uploadExcel",method = RequestMethod.POST)
  646. public Result uploadExcel(HttpServletRequest req){
  647. Result res = new Result();
  648. String excelPath = handleFile(res, "/customer_sys_file/", true, req, "");
  649. ExcelUtils utils = new ExcelUtils();
  650. Set<CustomerExcelBo> boSet;
  651. try {
  652. boSet = utils.parseExcel(uploadPrivatePath + excelPath);
  653. String errorMessage = "";
  654. if(boSet.size()>100) errorMessage += "导入数据不能超过一百条;";
  655. errorMessage += utils.getVacantRows();
  656. if(StringUtils.isNotBlank(errorMessage)) {
  657. res.getError().add(new Error(errorMessage));
  658. return res;
  659. }
  660. Set<Integer> existRows = new TreeSet<Integer>(); //数据库已存在
  661. Set<Integer> filterRows = new TreeSet<Integer>(); //过滤提示
  662. customerService.checkCustomer(boSet,existRows,filterRows);
  663. if(existRows.size()>0){
  664. errorMessage = StringUtils.join(existRows.toArray(),",")+ " 行客户业务已存在;";
  665. res.getError().add(new Error(errorMessage));
  666. return res;
  667. }
  668. if(filterRows.size()>0){
  669. errorMessage = StringUtils.join(filterRows.toArray(),",")+ " 行已经被系统过滤;";
  670. res.getError().add(new Error(errorMessage));
  671. return res;
  672. }
  673. customerService.saveUploadData(boSet);
  674. } catch (IOException e) {
  675. e.printStackTrace();
  676. }
  677. return res;
  678. }
  679. /**
  680. * 下载科技成果批量导入Excel模板
  681. */
  682. @RequestMapping(value = "/downloadTemplate", method = RequestMethod.GET)
  683. public Result downloadTemplateFile(HttpServletResponse response,String type) {
  684. Result res = new Result();
  685. if(AFTConstants.USER_TYPE_ORGANIZATION.equals(type)){
  686. Attachment af = aftFileService.selectAftFileBySign("organization_customer_template");
  687. if (null == af) {
  688. res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "", "找不到文件!"));
  689. } else {
  690. String path = af.getFilePath();
  691. String suffix = path.substring(path.lastIndexOf("."));
  692. String fileName = af.getFileName() + suffix;
  693. downloadFile(response, fileName, path);
  694. }
  695. }else if(AFTConstants.USER_TYPE_PERSONAL.equals(type)){
  696. Attachment af = aftFileService.selectAftFileBySign("personal_customer_template");
  697. if (null == af) {
  698. res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "", "找不到文件!"));
  699. } else {
  700. String path = af.getFilePath();
  701. String suffix = path.substring(path.lastIndexOf("."));
  702. String fileName = af.getFileName() + suffix;
  703. downloadFile(response, fileName, path);
  704. }
  705. }
  706. return res;
  707. }
  708. /**
  709. * 转为公共客户 释放客户
  710. * @param uid
  711. * @param aid
  712. * @return
  713. */
  714. @RequestMapping(value = "/transferToPublic", method = RequestMethod.GET)
  715. public Result transferToPublic(String uid,String aid){
  716. Result res = new Result();
  717. if(StringUtils.isBlank(uid) || StringUtils.isBlank("aid")){
  718. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  719. }
  720. customerService.updateByOperatorType(uid, aid,null, AFTConstants.USER_TRANSFER_TO_PUBLIC,null);
  721. return res;
  722. }
  723. /** 图片上传 **/
  724. @RequestMapping(value = "/uploadCustomerImg", method = RequestMethod.POST)
  725. public Result uploadCustomerImg(HttpServletRequest req,String sign){
  726. Result res = new Result();
  727. res.setData(handleFile(res, "/customer_sys_file/", false, req, sign));
  728. return res;
  729. }
  730. /**
  731. *
  732. * @param startDate 开始日期
  733. * @param endDate 结束日期
  734. * @param timeSpan 时间差
  735. * @param depNo 部门编号
  736. * @param pageNo 页码
  737. * @param pageSize 页数
  738. * @return
  739. * @throws ParseException
  740. */
  741. @RequestMapping(value = "/customerStatistics",method = RequestMethod.GET)
  742. public Result customerStatistics(String startDate,String endDate,String timeSpan,String depNo,String businessGlossoryId,Integer pageNo, Integer pageSize) throws ParseException{
  743. Result res = new Result();
  744. Date sDate = null;
  745. Date eDate = null;
  746. DateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDD);
  747. if(StringUtils.isNotBlank(startDate)) sDate = format.parse(startDate);
  748. if(StringUtils.isNotBlank(endDate)) eDate = format.parse(endDate);
  749. if(StringUtils.isBlank(startDate)&&StringUtils.isBlank(endDate)){
  750. Date date = new Date();
  751. if(timeSpan.equals(DateUtils.DAY_SPAN)){
  752. sDate = DateUtils.getYesterday();
  753. }else if(timeSpan.equals(DateUtils.WEEK_SPAN)){
  754. sDate = DateUtils.getLastDayOfLastWeek(date);
  755. }else if(timeSpan.equals(DateUtils.MONTH_SPAN)){
  756. sDate = DateUtils.getLastDayOfLastMonth(date);
  757. }else if(timeSpan.equals(DateUtils.QUARTER_SPAN)){
  758. sDate = DateUtils.getLastDayOfLastQuarter(date);
  759. }else if(timeSpan.equals(DateUtils.YEAR_SPAN)){
  760. sDate = DateUtils.getLastDayOfLastYear(date);
  761. }
  762. }
  763. res.setData(customerService.customerStatistics(sDate,eDate,depNo,businessGlossoryId,pageNo,pageSize));
  764. return res;
  765. }
  766. /**
  767. *
  768. * @param startDate 开始日期
  769. * @param endDate 结束日期
  770. * @param timeSpan 时间差
  771. * @param depNo 部门编号
  772. * @param businessGlossoryId 业务编号
  773. * @param pageNo 页码
  774. * @param pageSize 页数
  775. * @return
  776. * @throws ParseException
  777. */
  778. @RequestMapping(value = "/businessStatistic", method = RequestMethod.GET)
  779. public Result businessStatistic(String startDate,String endDate,String timeSpan,String depNo,String businessGlossoryId,Integer pageNo, Integer pageSize) throws ParseException{
  780. Result res = new Result();
  781. Date sDate = null;
  782. Date eDate = null;
  783. DateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDD);
  784. if(StringUtils.isNotBlank(startDate)) sDate = format.parse(startDate);
  785. if(StringUtils.isNotBlank(endDate)) eDate = format.parse(endDate);
  786. if(StringUtils.isBlank(startDate)&&StringUtils.isBlank(endDate)){
  787. Date date = new Date();
  788. if(timeSpan.equals(DateUtils.DAY_SPAN)){
  789. sDate = DateUtils.getYesterday();
  790. }else if(timeSpan.equals(DateUtils.WEEK_SPAN)){
  791. sDate = DateUtils.getLastDayOfLastWeek(date);
  792. }else if(timeSpan.equals(DateUtils.MONTH_SPAN)){
  793. sDate = DateUtils.getLastDayOfLastMonth(date);
  794. }else if(timeSpan.equals(DateUtils.QUARTER_SPAN)){
  795. sDate = DateUtils.getLastDayOfLastQuarter(date);
  796. }else if(timeSpan.equals(DateUtils.YEAR_SPAN)){
  797. sDate = DateUtils.getLastDayOfLastYear(date);
  798. }
  799. }
  800. res.setData(customerService.businessStatistic(sDate,eDate,depNo,businessGlossoryId,pageNo,pageSize));
  801. return res;
  802. }
  803. /**
  804. *
  805. * @param startDate 开始日期
  806. * @param endDate 结束日期
  807. * @param timeSpan 时间差
  808. * @param depNo 部门编号
  809. * @param pageNo 页码
  810. * @param pageSize 页数
  811. * @return
  812. * @throws ParseException
  813. */
  814. @RequestMapping(value = "/followStatistic",method = RequestMethod.GET)
  815. public Result followStatistic(String startDate,String endDate,String timeSpan,String depNo,Integer pageNo, Integer pageSize) throws ParseException{
  816. Result res = new Result();
  817. Date sDate = null;
  818. Date eDate = null;
  819. DateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDD);
  820. if(StringUtils.isNotBlank(startDate)) sDate = format.parse(startDate);
  821. if(StringUtils.isNotBlank(endDate)) eDate = format.parse(endDate);
  822. if(StringUtils.isBlank(startDate)&&StringUtils.isBlank(endDate)){
  823. Date date = new Date();
  824. if(timeSpan.equals(DateUtils.DAY_SPAN)){
  825. sDate = DateUtils.getYesterday();
  826. }else if(timeSpan.equals(DateUtils.WEEK_SPAN)){
  827. sDate = DateUtils.getLastDayOfLastWeek(date);
  828. }else if(timeSpan.equals(DateUtils.MONTH_SPAN)){
  829. sDate = DateUtils.getLastDayOfLastMonth(date);
  830. }else if(timeSpan.equals(DateUtils.QUARTER_SPAN)){
  831. sDate = DateUtils.getLastDayOfLastQuarter(date);
  832. }else if(timeSpan.equals(DateUtils.YEAR_SPAN)){
  833. sDate = DateUtils.getLastDayOfLastYear(date);
  834. }
  835. }
  836. res.setData(customerService.followStatistic(sDate, eDate, depNo, pageNo, pageSize));
  837. return res;
  838. }
  839. /**
  840. * 管理员列表
  841. * @param adminName 名称
  842. * @param status 0 正常 1锁定 2全部
  843. * @return
  844. */
  845. @RequestMapping(value = "/listAdminByName",method = RequestMethod.GET)
  846. public Result listAdminByName(String adminName,Integer status){
  847. Result res = new Result();
  848. adminName=adminName.trim();
  849. if(StringUtils.isNotBlank(adminName))res.setData(adminService.listAdminByName(adminName,status));
  850. return res;
  851. }
  852. /**
  853. * 客户转交 私有客户转交,签单客户转交
  854. * @param uid 用户编号
  855. * @param aid
  856. * @param operatorType 3私有 4签单
  857. * @param oldAid
  858. * @param data 资料同步转移 0无 1资料转交 2订单转交 3全部转交
  859. * @return
  860. */
  861. @RequestMapping(value = "/transferToOther", method = RequestMethod.GET)
  862. public Result transferToOther(String uid,String aid,Integer operatorType,Integer data,String oldAid){
  863. Result res = new Result();
  864. if(StringUtils.isBlank(uid) || StringUtils.isBlank(aid)){
  865. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "客户编号或管理员编号"));
  866. return res;
  867. }
  868. //默认为私有转交,4为签单转交
  869. if (operatorType==null) operatorType=AFTConstants.USER_TRANSFER_TO_OTHER;
  870. //转交,对方不是客服营销员才需要判断最大限制
  871. if (operatorType ==AFTConstants.USER_TRANSFER_TO_OTHER&&(!customerService.checkAid(aid,Integer.valueOf(AFTConstants.CUSTOMER_SERVICE_SALESMAN)))){
  872. if (customerService.checkMax(uid,aid)){
  873. res.getError().add(buildError("","对方私有客户已达最大限制"));
  874. return res;
  875. }
  876. }
  877. if(data==null)data=0;
  878. res.setData(customerService.updateByOperatorType(uid, aid, oldAid, operatorType, data));
  879. return res;
  880. }
  881. /**
  882. * 客户转交记录
  883. * @param uid 客户编号
  884. * @return
  885. */
  886. @RequestMapping(value = "/transferList", method = RequestMethod.GET)
  887. public Result transferList(String uid){
  888. Result res = new Result();
  889. if(StringUtils.isBlank(uid) ){
  890. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"客户编号", "客户编号"));
  891. return res;
  892. }
  893. res.data(customerService.transferList( uid));
  894. return res;
  895. }
  896. /** 查询我的业务列表 **/
  897. @RequestMapping(value = "/listBusiness", method = RequestMethod.POST)
  898. public Result listBusiness(BusinessListBo blo,Integer pageNo, Integer pageSize){
  899. Result res = new Result();
  900. res.setData(customerService.listBusiness(blo, pageNo, pageSize));
  901. return res;
  902. }
  903. /** 查询所有的业务列表 **/
  904. @RequestMapping(value = "/listAllBusiness", method = RequestMethod.POST)
  905. public Result listAllBusiness(BusinessListBo blo,Integer pageNo, Integer pageSize){
  906. Result res = new Result();
  907. res.setData(customerService.listAllBusiness(blo, pageNo, pageSize));
  908. return res;
  909. }
  910. /** 业务管理列表 **/
  911. @RequestMapping(value = "/listManageBusiness", method = RequestMethod.POST)
  912. public Result listManageBusiness(BusinessListBo blo,Integer pageNo, Integer pageSize){
  913. Result res = new Result();
  914. res.setData(customerService.listManageBusiness(blo, pageNo, pageSize));
  915. return res;
  916. }
  917. /** 查询业务字典 **/
  918. @RequestMapping(value = "/findBusinessGlossory",method = RequestMethod.GET)
  919. public Result findBusinessGlossory(){
  920. Result res = new Result();
  921. res.setData(customerService.findBusinessGlossory());
  922. return res;
  923. }
  924. /** 新增客户意向 **/
  925. @RequestMapping(value = "/addBusinessAndFollow", method = RequestMethod.POST)
  926. public Result addBusinessAndFollow(BussinessFollowBo bfb){
  927. Result res = new Result();
  928. if(StringUtils.isBlank(bfb.getBusinessProjectId()) || StringUtils.isBlank(bfb.getUid())){
  929. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  930. return res;
  931. }
  932. if(customerService.judgeBusiness(bfb.getUid(), bfb.getBusinessProjectId())>0){
  933. res.getError().add(new Error("该项业务已经被跟进"));
  934. return res;
  935. }
  936. try {
  937. customerService.addBusinessAndFollow(bfb);
  938. } catch (ParseException e) {
  939. e.printStackTrace();
  940. }
  941. return res;
  942. }
  943. /** 进入新增意向服务 **/
  944. @RequestMapping(value = "/toAddBusinessAndFollow", method = RequestMethod.GET)
  945. public Result toAddBusinessAndFollow(){
  946. Result res = new Result();
  947. BussinessFollowBo bo = new BussinessFollowBo();
  948. bo.setAdminName(TokenManager.getAdminToken().getName());
  949. SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
  950. bo.setCreateTime(format.format(new Date()));
  951. bo.setFollowTime(bo.getCreateTime());
  952. res.setData(bo);
  953. return res;
  954. }
  955. /** 进入修改业务意向 **/
  956. @RequestMapping(value = "/toUpdateBusiness", method = RequestMethod.GET)
  957. public Result toUpdateBusiness(String businessId){
  958. Result res = new Result();
  959. res.setData(customerService.findBusinessDetail(businessId));
  960. return res;
  961. }
  962. /** 修改业务意向 **/
  963. @RequestMapping(value = "/updateBusiness", method = RequestMethod.POST)
  964. public Result updateBusiness(BussinessFollowBo bfb){
  965. Result res = new Result();
  966. customerService.updateBusiness(bfb);
  967. return res;
  968. }
  969. /** 进入跟进单个客户意向 **/
  970. @RequestMapping(value = "/toAddFollowOneBusiness", method = RequestMethod.GET)
  971. public Result toAddFollowOneBusiness(String businessId){
  972. Result res = new Result();
  973. BussinessFollowBo bo = customerService.findBusinessDetail(businessId);
  974. SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
  975. bo.setFollowTime(format.format(new Date()));
  976. res.setData(bo);
  977. return res;
  978. }
  979. /** 跟进单个客户意向 **/
  980. @RequestMapping(value = "/addFollowOneBusiness", method = RequestMethod.POST)
  981. public Result addFollowOneBusiness(BussinessFollowBo bfb){
  982. Result res = new Result();
  983. if(StringUtils.isBlank(bfb.getBusinessId()) ||
  984. StringUtils.isBlank(bfb.getUid()) || StringUtils.isBlank(bfb.getOcbId())){
  985. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
  986. return res;
  987. }
  988. try {
  989. customerService.addFollowOneBusiness(bfb);
  990. } catch (ParseException e) {
  991. e.printStackTrace();
  992. }
  993. return res;
  994. }
  995. /** 进入修改某个客户一个业务的当次拜访 **/
  996. @RequestMapping(value = "/toUpdateFollowOneBusiness", method = RequestMethod.GET)
  997. public Result toUpdateFollowOneBusiness(String ufbId){
  998. Result res = new Result();
  999. if(StringUtils.isBlank(ufbId)) {
  1000. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  1001. return res;
  1002. }
  1003. res.setData(customerService.findFollowOneBusiness(ufbId));
  1004. return res;
  1005. }
  1006. /** 修改某个客户一个业务的当次拜访 **/
  1007. @RequestMapping(value = "/updateFollowOneBusiness", method = RequestMethod.POST)
  1008. public Result updateFollowOneBusiness(BussinessFollowBo bfb){
  1009. Result res = new Result();
  1010. if(StringUtils.isBlank(bfb.getFollowId()) || StringUtils.isBlank(bfb.getUfbId())){
  1011. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  1012. return res;
  1013. }
  1014. customerService.updateFollowOneBusiness(bfb);
  1015. return res;
  1016. }
  1017. /** 删除某个客户一个业务的当次拜访 **/
  1018. @RequestMapping(value = "/deleteFollowOneBusiness", method = RequestMethod.GET)
  1019. public Result deleteFollowOneBusiness(String ufbId){
  1020. Result res = new Result();
  1021. if(StringUtils.isBlank(ufbId)){
  1022. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  1023. return res;
  1024. }
  1025. customerService.deleteFollowOneBusiness(ufbId);
  1026. return res;
  1027. }
  1028. /** 添加单个联系人 **/
  1029. @RequestMapping(value = "/addOneContact", method = RequestMethod.POST)
  1030. public Result addOneContact(OrganizationContactBook ocb){
  1031. Result res = new Result();
  1032. if(StringUtils.isBlank(ocb.getUid())){
  1033. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  1034. return res;
  1035. }
  1036. if(StringUtils.isBlank(ocb.getName()) || StringUtils.isBlank(ocb.getMobile())){
  1037. res.getError().add(buildError("联系人号码和联系人姓名不能为空"));
  1038. return res;
  1039. }
  1040. customerService.addOneContact(ocb);
  1041. return res;
  1042. }
  1043. /** 删除单个联系人 **/
  1044. @RequestMapping(value = "/deleteOneContact", method = RequestMethod.GET)
  1045. public Result deleteOneContact(String ocbId){
  1046. Result res = new Result();
  1047. if(StringUtils.isBlank(ocbId)){
  1048. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  1049. return res;
  1050. }
  1051. customerService.deleteOneContact(ocbId);
  1052. return res;
  1053. }
  1054. /** 修改主要联系人 **/
  1055. @RequestMapping(value = "/updateMainContact", method = RequestMethod.GET)
  1056. public Result updateMainContact(String ocbId,String uid){
  1057. Result res = new Result();
  1058. if(StringUtils.isBlank(uid) || StringUtils.isBlank(ocbId)){
  1059. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  1060. return res;
  1061. }
  1062. customerService.updateMainContact(ocbId,uid);
  1063. return res;
  1064. }
  1065. /** 删除 业务 **/
  1066. @RequestMapping(value = "/deleteBusiness", method =RequestMethod.GET)
  1067. public Result deleteBusiness(String businessId){
  1068. Result res = new Result();
  1069. if(StringUtils.isBlank(businessId)){
  1070. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  1071. return res;
  1072. }
  1073. customerService.deleteBusiness(businessId);
  1074. return res;
  1075. }
  1076. /** 停止业务 **/
  1077. @RequestMapping(value = "/stopBusiness", method = RequestMethod.GET)
  1078. public Result stopBusiness(String businessId){
  1079. Result res = new Result();
  1080. if(StringUtils.isBlank(businessId)){
  1081. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,""));
  1082. return res;
  1083. }
  1084. customerService.updateBusinessToStop(businessId);
  1085. return res;
  1086. }
  1087. /** 客户分配查询(本部门) **/
  1088. @RequestMapping(value = "/findAdminName" , method = RequestMethod.POST)
  1089. public Result findAdminName(){
  1090. Result res = new Result();
  1091. res.setData(customerService.findAdminName());
  1092. return res;
  1093. }
  1094. /** 分配个人客户 **/
  1095. @RequestMapping(value = "/updatePersonalCustomerz", method = RequestMethod.POST)
  1096. public Result updatePersonalCustomerz(CustomerPersonalDetailBo bo){
  1097. Result res = new Result();
  1098. if(StringUtils.isBlank(bo.getUid()) || StringUtils.isBlank(bo.getId())){
  1099. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
  1100. return res;
  1101. }
  1102. customerService.updatePersonalCustomerz(bo);
  1103. return res;
  1104. }
  1105. /** 客户录入审核 **/
  1106. @RequestMapping(value = "/findEnteringAudit" , method = RequestMethod.POST)
  1107. public Result findEnteringAudit(CustomerListOut clo,Integer pageNo, Integer pageSize){
  1108. Result res = new Result();
  1109. res.setData(customerService.findEnteringAudit(clo, pageNo, pageSize));
  1110. return res;
  1111. }
  1112. /** 修改客户录入审核状态 **/
  1113. @RequestMapping(value = "/updateEnteringAudit", method = RequestMethod.POST)
  1114. public Result updateEnteringAudit(User bo){
  1115. Result res = new Result();
  1116. if(StringUtils.isBlank(bo.getId())){
  1117. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
  1118. return res;
  1119. }
  1120. res.data(customerService.updateEnteringAudit(bo));
  1121. return res;
  1122. }
  1123. /** 审核拒绝客户查询 **/
  1124. @RequestMapping(value = "/findEnteringAuditIsNo" , method = RequestMethod.POST)
  1125. public Result findEnteringAuditIsNo(CustomerListOut clo,Integer pageNo, Integer pageSize){
  1126. Result res = new Result();
  1127. res.setData(customerService.findEnteringAuditIsNo(clo, pageNo, pageSize));
  1128. return res;
  1129. }
  1130. /** 修改拒绝客户信息 **/
  1131. @RequestMapping(value = "/updateRefusedCustomer", method = RequestMethod.POST)
  1132. public Result updateRefusedCustomer(String id,String nickname,String mobile,String societyTag){
  1133. Result res = new Result();
  1134. if(StringUtils.isBlank(nickname)){
  1135. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"名称"));
  1136. return res;
  1137. }
  1138. if(StringUtils.isBlank(mobile)){
  1139. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"电话"));
  1140. return res;
  1141. }
  1142. if(StringUtils.isBlank(societyTag)){
  1143. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"社会性质"));
  1144. return res;
  1145. }
  1146. customerService.updateRefusedCustomer(id, nickname, mobile, societyTag);
  1147. return res;
  1148. }
  1149. /** 查询客户的锁定业务 **/
  1150. @RequestMapping(value = "/getLockedProject", method = RequestMethod.GET)
  1151. public Result getLockedProject(String uid){
  1152. Result res = new Result();
  1153. if(StringUtils.isBlank(uid)){
  1154. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"用户ID"));
  1155. return res;
  1156. }
  1157. res.setData(customerService.selectLockedProject(uid));
  1158. return res;
  1159. }
  1160. /** 客户二次签项目业务 **/
  1161. @RequestMapping(value = "/againProjectTask", method = RequestMethod.GET)
  1162. public Result againProjectTask(String uid,String projectId,String aid){
  1163. Result res = new Result();
  1164. if(StringUtils.isBlank(uid)||StringUtils.isBlank(projectId)){
  1165. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"参数"));
  1166. return res;
  1167. }
  1168. res.setData(customerService.updateAgainProjectTask(uid,projectId,aid));
  1169. return res;
  1170. }
  1171. /** 客户资料转交 **/
  1172. @RequestMapping(value = "/updateInformationMaintainerr", method = RequestMethod.POST)
  1173. public Result updateInformationMaintainerr(String id,String aid){
  1174. Result res = new Result();
  1175. if(StringUtils.isBlank(id) || StringUtils.isBlank(aid)){
  1176. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
  1177. return res;
  1178. }
  1179. res.data(customerService.updateInformationMaintainerr(id,aid));
  1180. return res;
  1181. }
  1182. /** 个人单位客户信息列表 **/
  1183. @RequestMapping(value = "/listCustomerInformation", method = RequestMethod.POST)
  1184. public Result listCustomerInformation(CustomerListIn cli,Integer pageNo, Integer pageSize){
  1185. Result res = new Result();
  1186. res.data(customerService.listCustomerInformation(cli,pageNo,pageSize));
  1187. return res;
  1188. }
  1189. /** 部门单位客户信息列表 **/
  1190. @RequestMapping(value = "/listDepCustomerInformation", method = RequestMethod.POST)
  1191. public Result listDepCustomerInformation(CustomerListIn cli,Integer pageNo, Integer pageSize){
  1192. Result res = new Result();
  1193. res.data(customerService.listDepCustomerInformation(cli,pageNo,pageSize));
  1194. return res;
  1195. }
  1196. /** 修改客户等级 **/
  1197. @RequestMapping(value = "/updateUserLevel", method = RequestMethod.GET)
  1198. public Result updateUserLevel(User u){
  1199. Result res = new Result();
  1200. if(StringUtils.isBlank(u.getId())){
  1201. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"用户ID错误","用户ID"));
  1202. return res;
  1203. }
  1204. if(null==u.getLevel()){
  1205. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"用户等级错误","用户等级"));
  1206. return res;
  1207. }
  1208. res.data(customerService.updateUserLevel(u));
  1209. return res;
  1210. }
  1211. /** 释放客户 **/
  1212. @RequestMapping(value = "/pushReleaseUser", method = RequestMethod.GET)
  1213. public Result pushReleaseUser(String id){
  1214. Result res = new Result();
  1215. if(StringUtils.isBlank(id)){
  1216. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"用户ID错误","用户ID"));
  1217. return res;
  1218. }
  1219. res.data(customerService.pushReleaseUser(id));
  1220. return res;
  1221. }
  1222. /**
  1223. * 企业项目申报材料上传
  1224. *
  1225. * @param req
  1226. * @param uid
  1227. * @return
  1228. */
  1229. @RequestMapping(value = "/upload", method = RequestMethod.POST)
  1230. public Result cognizanceFile(HttpServletRequest req, String uid, String id, String sign) {
  1231. Result res = new Result();
  1232. AttachmentType attachmentType = AttachmentType.getField(sign);
  1233. if (attachmentType == AttachmentType.ORGANIZATION_APPLICATION) {
  1234. res.setData(handleFiles(res, "/orgApplication/", true, req, sign, uid));
  1235. } else {
  1236. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1237. }
  1238. return res;
  1239. }
  1240. /**
  1241. * 企业项目申报材料预览授权
  1242. *
  1243. * @param id
  1244. * @param sign
  1245. * @return
  1246. */
  1247. @RequestMapping(value = "/techProject", method = RequestMethod.GET)
  1248. public Result previewTechProject(String id, String sign) {
  1249. Result res = new Result();
  1250. if (StringUtils.isEmpty(id)) {
  1251. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业项目申报材料ID"));
  1252. return res;
  1253. }
  1254. AttachmentType attachmentType = AttachmentType.getField(sign);
  1255. if (attachmentType == AttachmentType.ORGANIZATION_APPLICATION) {
  1256. String time = String.valueOf(Calendar.getInstance().getTime().getTime());
  1257. String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
  1258. res.setData("sign=" + sign + "&token2=" + id + "&auth=" + auth + "&temp=" + time);
  1259. } else {
  1260. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1261. }
  1262. return res;
  1263. }
  1264. /**
  1265. * 查看营销员客户统计
  1266. * @param depId
  1267. * @param startTime
  1268. * @param endTime
  1269. * @param pageSize
  1270. * @param pageNo
  1271. * @return
  1272. */
  1273. @RequestMapping(value = "/selectAdminCustomerStatistics", method = RequestMethod.GET)
  1274. public Result selectAdminCustomerstatistics(String depId, String startTime,String endTime, Integer pageSize, Integer pageNo) {
  1275. Result res = new Result();
  1276. res.data(adminService.selectAdminCustomerStatistics( depId, startTime, endTime, pageSize, pageNo));
  1277. return res;
  1278. }
  1279. /**
  1280. * 查看客户统计
  1281. * @param depId 部门编号
  1282. * @param startTime 开始时间
  1283. * @param endTime 结束时间
  1284. * @return
  1285. */
  1286. @RequestMapping(value = "/selectAllUser", method = RequestMethod.GET)
  1287. public Result selectAllUser(String depId, String startTime,String endTime,String aName ) {
  1288. Result res = new Result();
  1289. res.data(adminService.selectAllUser( depId, startTime, endTime, aName));
  1290. return res;
  1291. }
  1292. /**
  1293. * 查看客户日期内新增客户
  1294. * @param type 0私有 1渠道 2签单 3私有新增 4渠道新增 5私有面谈 6渠道面谈 7私有领取 8 私有转交
  1295. */
  1296. @RequestMapping(value = "/selectAdminCustomerList", method = RequestMethod.GET)
  1297. public Result selectAdminCustomerList(String aid, String startTime,String endTime,Integer type, Integer pageSize, Integer pageNo) {
  1298. Result res = new Result();
  1299. res.data(adminService.selectAdminCustomerList( aid, startTime, endTime, type, pageSize, pageNo));
  1300. return res;
  1301. }
  1302. /**
  1303. *
  1304. * @param inputId 业务转移客户id(接收者)
  1305. * @param uid 被转移的客户
  1306. * @param pid 呗转移的业务
  1307. * @return
  1308. */
  1309. @RequestMapping(value = "/privateBusinessTransfer", method = RequestMethod.POST)
  1310. public Result privateBusinessTransfer(String inputId,String uid,String pid ) {
  1311. Result res = new Result();
  1312. if (StringUtils.isBlank(inputId)) {
  1313. res.getError().add(buildError("请确认正确的接收者。","请确认正确的接收者。"));
  1314. return res;
  1315. }
  1316. int i= customerService.updatePrivateBusinessTransfer( inputId, uid, pid );
  1317. if (i<1) {
  1318. res.getError().add(buildError("请确认客户与业务归属是否正确。","请确认客户与业务归属是否正确。"));
  1319. return res;
  1320. }
  1321. res.data(i);
  1322. return res;
  1323. }
  1324. /**
  1325. * 渠道客户列表
  1326. **/
  1327. @RequestMapping(value = "/listChannelCustomer" , method = RequestMethod.POST)
  1328. public Result listChannelCustomer(InputListChannel in){
  1329. Result res = new Result();
  1330. res.setData(customerService.listChannelCustomer(in));
  1331. return res;
  1332. }
  1333. /**
  1334. * 渠道客户统计列表
  1335. **/
  1336. @RequestMapping(value = "/listChannelCounts" , method = RequestMethod.GET)
  1337. public Result listChannelCounts(InputChannelCounts in){
  1338. Result res = new Result();
  1339. res.setData(customerService.listChannelCounts(in));
  1340. return res;
  1341. }
  1342. /**
  1343. * 渠道客户转交
  1344. * @param userIds 用户编号集
  1345. * @param receiveId 接受者
  1346. * @param remarks 备注
  1347. * @param type 0 分配 1转交 2回退
  1348. * @return
  1349. */
  1350. @RequestMapping(value = "/channelCustomerDeliver", method = RequestMethod.POST)
  1351. public Result channelCustomerDeliver(String userIds ,String receiveId,String remarks,Integer type){
  1352. Result res = new Result();
  1353. if (StringUtils.isBlank(userIds)) {
  1354. res.getError().add(buildError("","用户编号不存在"));
  1355. return res;
  1356. }
  1357. String [] str=userIds.split(",");
  1358. List<String> uids=Arrays.asList(str);
  1359. if (type==1&&customerService.checkChannel(uids)) {
  1360. res.getError().add(buildError("","已跟进,禁止分配!"));
  1361. return res;
  1362. }
  1363. if (type==2&&customerService.checkRecovery(uids)) {
  1364. res.getError().add(buildError("","不允许二次回退"));
  1365. return res;
  1366. }
  1367. res.setData(customerService.pushChannelDeliver( uids , receiveId,remarks,type));
  1368. return res;
  1369. }
  1370. /** 修改客户名称 **/
  1371. @RequestMapping(value = "/updateUserName", method = RequestMethod.POST)
  1372. public Result updateUserName(String uid,String userName){
  1373. Result res = new Result();
  1374. if(StringUtils.isBlank(uid) || StringUtils.isBlank(userName)){
  1375. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,null,"uid或者名称"));
  1376. return res;
  1377. }
  1378. if (userName!=null){
  1379. userName=userName.trim();
  1380. }
  1381. if(customerService.checkUserName(uid,userName)){
  1382. res.getError().add(buildError(ErrorConstants.CUSTOMER_ALREADY_EXIST,null,"["+userName+"]"));
  1383. return res;
  1384. }
  1385. res.data(customerService.updateUserName(uid,userName));
  1386. return res;
  1387. }
  1388. @RequestMapping(value = "/checkUserName",method = RequestMethod.GET)
  1389. public Result checkUserName(String userName){
  1390. Result res =new Result();
  1391. res.data(customerService.checkUserName(null,userName));
  1392. return res;
  1393. }
  1394. /** 修改客户关键资料 **/
  1395. @RequestMapping(value = "/updateUserDate", method = RequestMethod.POST)
  1396. public Result updateUserDate(InputUserData in ){
  1397. Result res = new Result();
  1398. if (in.getOrgCode()!=null){
  1399. in.setOrgCode(in.getOrgCode().trim());
  1400. if (customerService.checkOrgCode(in.getOrgCode())){
  1401. res.getError().add(buildError("","统一信用代码已存在"));
  1402. return res;
  1403. }
  1404. }
  1405. res.data(customerService.updateUserDate(in));
  1406. return res;
  1407. }
  1408. /** 客户名称列表 **/
  1409. @RequestMapping(value = "/listUserName", method = RequestMethod.GET)
  1410. public Result listUserName(String uid){
  1411. Result res = new Result();
  1412. if(StringUtils.isBlank(uid) || StringUtils.isBlank(uid)){
  1413. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"uid","uid"));
  1414. return res;
  1415. }
  1416. res.data(customerService.listUserName(uid));
  1417. return res;
  1418. }
  1419. /**
  1420. * 客户主营产品列表
  1421. * @return
  1422. */
  1423. @RequestMapping(value = "/mainProductsList", method = RequestMethod.GET)
  1424. public Result mainProductsList(InputMainProductsList in){
  1425. Result res = new Result();
  1426. res.data(customerService.mainProductsList(in));
  1427. return res;
  1428. }
  1429. /**
  1430. * 用户信息日志
  1431. * @param uid
  1432. * @return
  1433. */
  1434. @RequestMapping(value = "/userDateLogList",method = RequestMethod.GET)
  1435. public Result userDateLogList(String uid){
  1436. Result res =new Result();
  1437. res.data(customerService.userDateLogList(uid));
  1438. return res;
  1439. }
  1440. /**
  1441. * 修改用户主营产品
  1442. * @param id
  1443. * @param businessScope
  1444. * @return
  1445. */
  1446. @RequestMapping(value = "/updateUserBusinessScope",method = RequestMethod.POST)
  1447. public Result updateUserBusinessScope(String id,String businessScope){
  1448. Result res=new Result();
  1449. if (id==null||businessScope==null){
  1450. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"参数","参数"));
  1451. return res;
  1452. }
  1453. res.data(customerService.updateuserBusinessScope(id,businessScope));
  1454. return res;
  1455. }
  1456. @RequestMapping(value = "/queryUserMax",method = RequestMethod.GET)
  1457. public Result queryUserMax(){
  1458. Result res =new Result();
  1459. res.setData(customerService.queryUserMax());
  1460. return res;
  1461. }
  1462. /**
  1463. * 客户最后跟进列表
  1464. * @param in
  1465. * @return
  1466. */
  1467. @RequestMapping(value = "/selectUserLastSign",method = RequestMethod.GET)
  1468. public Result selectUserLastSign (InputSelectUserLastSignBo in){
  1469. Result res =new Result();
  1470. res.setData(customerService.selectUserLastSign(in));
  1471. return res;
  1472. }
  1473. /**
  1474. * 客户最后跟进列表导出
  1475. * @param in
  1476. * @return
  1477. */
  1478. @RequestMapping(value = "/selectUserLastSign/export",method = RequestMethod.GET)
  1479. public Result selectUserLastSignExport (InputSelectUserLastSignBo in){
  1480. return customerService.selectUserLastSignExport(in);
  1481. }
  1482. /**
  1483. * Excel批量导入
  1484. *
  1485. * @return
  1486. */
  1487. @RequestMapping(value = "/importExcel" , method = RequestMethod.POST)
  1488. public Result importExcel(@RequestParam(value = "file", required = false) MultipartFile file) {
  1489. Result res=new Result();
  1490. //判断文件是否存在
  1491. if(null == file){
  1492. res.getError().add(buildError("文件不存在!","文件不存在!"));
  1493. return res;
  1494. }
  1495. String fileName = file.getOriginalFilename();
  1496. if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
  1497. res.getError().add(buildError("格式不正确","格式不正确"));
  1498. return res;
  1499. }
  1500. // res.data(rdService.batchList(file));
  1501. return customerService.importExcel(file);
  1502. }
  1503. /**
  1504. * 获取我的客户列表
  1505. * @param in
  1506. * @return
  1507. */
  1508. @GetMapping("/selectMyUser")
  1509. public Result<Pagination<SelectMyUserOut>> selectMyUser(SelectMyUserBo in ){
  1510. Result res = new Result();
  1511. res.data(customerService.selectMyUser(in));
  1512. return res;
  1513. }
  1514. /**
  1515. * 获取我的客户信息
  1516. * @param id
  1517. * @return
  1518. */
  1519. @GetMapping("/selectMyUserDetails")
  1520. public Result<Pagination<SelectMyUserOut>> selectMyUserDetails(String id ){
  1521. Result res = new Result();
  1522. res.data(customerService.selectMyUserDetails(id));
  1523. return res;
  1524. }
  1525. /**
  1526. * 客户公出情况
  1527. */
  1528. @GetMapping("/getPublicReleaseList")
  1529. public Result<List<PublicReleaseListBo>> getPublicReleaseList(String id) {
  1530. Result res = new Result();
  1531. res.setData(customerService.getPublicReleaseList(id));
  1532. return res;
  1533. }
  1534. }