AdminCustomerApiController.java 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632
  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(String uid,Integer province,Integer city,Integer area,String businessScope,String intendedProject,String introduction
  1397. ,Integer channelType,String orgCode){
  1398. Result res = new Result();
  1399. if (orgCode!=null){
  1400. orgCode=orgCode.trim();
  1401. if (customerService.checkOrgCode(orgCode)){
  1402. res.getError().add(buildError("","统一信用代码已存在"));
  1403. return res;
  1404. }
  1405. }
  1406. res.data(customerService.updateUserDate(uid, province, city, area, businessScope, intendedProject,introduction,channelType,orgCode));
  1407. return res;
  1408. }
  1409. /** 客户名称列表 **/
  1410. @RequestMapping(value = "/listUserName", method = RequestMethod.GET)
  1411. public Result listUserName(String uid){
  1412. Result res = new Result();
  1413. if(StringUtils.isBlank(uid) || StringUtils.isBlank(uid)){
  1414. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"uid","uid"));
  1415. return res;
  1416. }
  1417. res.data(customerService.listUserName(uid));
  1418. return res;
  1419. }
  1420. /**
  1421. * 客户主营产品列表
  1422. * @return
  1423. */
  1424. @RequestMapping(value = "/mainProductsList", method = RequestMethod.GET)
  1425. public Result mainProductsList(InputMainProductsList in){
  1426. Result res = new Result();
  1427. res.data(customerService.mainProductsList(in));
  1428. return res;
  1429. }
  1430. /**
  1431. * 用户信息日志
  1432. * @param uid
  1433. * @return
  1434. */
  1435. @RequestMapping(value = "/userDateLogList",method = RequestMethod.GET)
  1436. public Result userDateLogList(String uid){
  1437. Result res =new Result();
  1438. res.data(customerService.userDateLogList(uid));
  1439. return res;
  1440. }
  1441. /**
  1442. * 修改用户主营产品
  1443. * @param id
  1444. * @param businessScope
  1445. * @return
  1446. */
  1447. @RequestMapping(value = "/updateUserBusinessScope",method = RequestMethod.POST)
  1448. public Result updateUserBusinessScope(String id,String businessScope){
  1449. Result res=new Result();
  1450. if (id==null||businessScope==null){
  1451. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"参数","参数"));
  1452. return res;
  1453. }
  1454. res.data(customerService.updateuserBusinessScope(id,businessScope));
  1455. return res;
  1456. }
  1457. @RequestMapping(value = "/queryUserMax",method = RequestMethod.GET)
  1458. public Result queryUserMax(){
  1459. Result res =new Result();
  1460. res.setData(customerService.queryUserMax());
  1461. return res;
  1462. }
  1463. /**
  1464. * 客户最后跟进列表
  1465. * @param in
  1466. * @return
  1467. */
  1468. @RequestMapping(value = "/selectUserLastSign",method = RequestMethod.GET)
  1469. public Result selectUserLastSign (InputSelectUserLastSignBo in){
  1470. Result res =new Result();
  1471. res.setData(customerService.selectUserLastSign(in));
  1472. return res;
  1473. }
  1474. /**
  1475. * 客户最后跟进列表导出
  1476. * @param in
  1477. * @return
  1478. */
  1479. @RequestMapping(value = "/selectUserLastSign/export",method = RequestMethod.GET)
  1480. public Result selectUserLastSignExport (InputSelectUserLastSignBo in){
  1481. return customerService.selectUserLastSignExport(in);
  1482. }
  1483. /**
  1484. * Excel批量导入
  1485. *
  1486. * @return
  1487. */
  1488. @RequestMapping(value = "/importExcel" , method = RequestMethod.POST)
  1489. public Result importExcel(@RequestParam(value = "file", required = false) MultipartFile file) {
  1490. Result res=new Result();
  1491. //判断文件是否存在
  1492. if(null == file){
  1493. res.getError().add(buildError("文件不存在!","文件不存在!"));
  1494. return res;
  1495. }
  1496. String fileName = file.getOriginalFilename();
  1497. if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
  1498. res.getError().add(buildError("格式不正确","格式不正确"));
  1499. return res;
  1500. }
  1501. // res.data(rdService.batchList(file));
  1502. return customerService.importExcel(file);
  1503. }
  1504. /**
  1505. * 客户公出情况
  1506. */
  1507. @GetMapping("/getPublicReleaseList")
  1508. public Result<List<PublicReleaseListBo>> getPublicReleaseList(String uid) {
  1509. Result res = new Result();
  1510. res.setData(customerService.getPublicReleaseList(uid));
  1511. return res;
  1512. }
  1513. }