CustomerApi.java 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. package com.caimei365.manager.controller.caimei.user;
  2. import com.caimei365.manager.config.security.ConstantKey;
  3. import com.caimei365.manager.config.security.JwtService;
  4. import com.caimei365.manager.entity.PaginationVo;
  5. import com.caimei365.manager.entity.ResponseJson;
  6. import com.caimei365.manager.entity.caimei.CmShop;
  7. import com.caimei365.manager.entity.caimei.cmUser.*;
  8. import com.caimei365.manager.service.caimei.user.CustomerService;
  9. import lombok.extern.slf4j.Slf4j;
  10. import org.apache.commons.lang3.StringUtils;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.stereotype.Controller;
  13. import org.springframework.web.bind.annotation.*;
  14. import javax.annotation.Resource;
  15. import javax.servlet.http.HttpServletRequest;
  16. /**
  17. * Description
  18. *
  19. * @author : Charles
  20. * @date : 2023/9/5
  21. */
  22. @Slf4j
  23. @RestController
  24. @RequestMapping("/user/customer")
  25. public class CustomerApi {
  26. @Autowired private CustomerService customerService;
  27. @Resource private JwtService jwtService;
  28. /**
  29. * 潜客收集供应商列表
  30. * @param cmShopStatistics
  31. * @return
  32. */
  33. @GetMapping("/getCustomerShopList")
  34. public ResponseJson<PaginationVo<CmShopStatistics>> getCustomerShopList(CmShopStatistics cmShopStatistics,
  35. @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
  36. @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
  37. return customerService.getCustomerShopList(cmShopStatistics, pageNum, pageSize);
  38. }
  39. /**
  40. * 供应商列表
  41. * @param shopName
  42. * @param pageNum
  43. * @param pageSize
  44. * @return
  45. */
  46. @GetMapping("/getShopList")
  47. public ResponseJson<PaginationVo<CmShop>> getShopList(String shopName,
  48. @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
  49. @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
  50. return customerService.getShopLiat(shopName, pageNum, pageSize);
  51. }
  52. /**
  53. * 添加统计供应商
  54. * @param shopIds
  55. * @return
  56. */
  57. @GetMapping("/saveCustomerShop")
  58. public ResponseJson saveCustomerShop(String shopIds) {
  59. if (null == shopIds) {
  60. return ResponseJson.error(-1, "添加的供应商不能为空", null);
  61. }
  62. return customerService.saveCustomerShop(shopIds);
  63. }
  64. /**
  65. * 设置统计状态
  66. * @param id
  67. * @param status
  68. * @return
  69. */
  70. @GetMapping("/renewCustomerShop")
  71. public ResponseJson renewCustomerShop(Integer id, Integer status) {
  72. if (null == id) {
  73. return ResponseJson.error(-1, "id不能为空", null);
  74. }
  75. if (null == status) {
  76. return ResponseJson.error(-1, "状态不能为空", null);
  77. }
  78. return customerService.renewCustomerShop(id, status);
  79. }
  80. /**
  81. * 游客统计
  82. * @param cmRoosInformation
  83. * @param pageNum
  84. * @param pageSize
  85. * @return
  86. */
  87. @GetMapping("/getCmInformationList")
  88. public ResponseJson<PaginationVo<CmRoosInformation>> getCmInformationList(CmRoosInformation cmRoosInformation,
  89. @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
  90. @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
  91. if (null == cmRoosInformation.getShopId()) {
  92. return ResponseJson.error(-1, "供应商Id不能为空", null);
  93. }
  94. return customerService.getCmInformationList(cmRoosInformation, pageNum, pageSize);
  95. }
  96. /**
  97. * 设置跟进状态
  98. * @param id
  99. * @param followUpStatus
  100. * @param serviceProviderId
  101. * @return
  102. */
  103. @GetMapping("/renewFollowUpStatus")
  104. public ResponseJson renewFollowUpStatus(Integer id, Integer followUpStatus, Integer serviceProviderId) {
  105. if (null == id) {
  106. return ResponseJson.error(-1, "id不能为空", null);
  107. }
  108. if (null == followUpStatus) {
  109. return ResponseJson.error(-1, "状态不能为空", null);
  110. }
  111. return customerService.renewFollowUpStatus(id, followUpStatus, serviceProviderId);
  112. }
  113. /**
  114. * 添加游客备注
  115. * @param request
  116. * @param cmInformationNotes
  117. * @return
  118. */
  119. @PostMapping("/saveInformation")
  120. public ResponseJson saveInformationNotes(HttpServletRequest request,@RequestBody CmInformationNotes cmInformationNotes) {
  121. log.info("cmInformationNotes====="+cmInformationNotes);
  122. if (null == cmInformationNotes.getInformationId()) {
  123. return ResponseJson.error(-1, "游客Id不能为空", null);
  124. }
  125. String token = request.getHeader(ConstantKey.TOKEN_NAME);
  126. String username = jwtService.getUsername(token);
  127. cmInformationNotes.setNoteUser(username);
  128. return customerService.saveInformationNotes(cmInformationNotes);
  129. }
  130. /**
  131. * 获取游客备注信息
  132. * @param informationId
  133. * @param pageNum
  134. * @param pageSize
  135. * @return
  136. */
  137. @GetMapping("/getInformationNoteList")
  138. public ResponseJson<PaginationVo<CmInformationNotes>> getInformationNotes(Integer informationId,
  139. @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
  140. @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
  141. if (null == informationId) {
  142. return ResponseJson.error(-1, "游客Id不能为空", null);
  143. }
  144. return customerService.getInformationNotes(informationId, pageNum, pageSize);
  145. }
  146. /**
  147. * 相关文章列表
  148. * @param cmShopInfo
  149. * @param pageNum
  150. * @param pageSize
  151. * @return
  152. */
  153. @GetMapping("/getShopInfoList")
  154. public ResponseJson<PaginationVo<CmShopInfo>> getShopInfoList(CmShopInfo cmShopInfo,
  155. @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
  156. @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
  157. if (null == cmShopInfo.getShopId()) {
  158. return ResponseJson.error(-1, "供应商Id不能为空", null);
  159. }
  160. return customerService.getShopInfoList(cmShopInfo, pageNum, pageSize);
  161. }
  162. /**
  163. * 选择文章
  164. * @param id
  165. * @param title
  166. * @param pageNum
  167. * @param pageSize
  168. * @return
  169. */
  170. @GetMapping("/getInfoList")
  171. public ResponseJson<PaginationVo<Info>> getInfoList(Integer id, String title,
  172. @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
  173. @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
  174. return customerService.getInfoList(id, title, pageNum, pageSize);
  175. }
  176. /**
  177. * 添加文章统计
  178. * @param shopId
  179. * @param infoIds
  180. * @return
  181. */
  182. @GetMapping("/saveShopInfo")
  183. public ResponseJson saveShopInfo(Integer shopId, String infoIds){
  184. if (null == shopId) {
  185. return ResponseJson.error(-1, "供应商Id不能为空", null);
  186. }
  187. if (null == infoIds) {
  188. return ResponseJson.error(-1, "选择文章不能为空", null);
  189. }
  190. return customerService.saveShopInfo(shopId, infoIds);
  191. }
  192. /**
  193. * 设置统计状态
  194. * @param id
  195. * @param status
  196. * @return
  197. */
  198. @GetMapping("/renewShopInfo")
  199. public ResponseJson renewShopInfo(Integer id, Integer status) {
  200. if (null == id) {
  201. return ResponseJson.error(-1, "id不能为空", null);
  202. }
  203. if (null == status) {
  204. return ResponseJson.error(-1, "状态不能为空", null);
  205. }
  206. return customerService.renewShopInfo(id, status);
  207. }
  208. /**
  209. * 删除统计文章
  210. * @param id
  211. * @return
  212. */
  213. @GetMapping("/delShopInfo/{id}")
  214. public ResponseJson delShopInfo(@PathVariable("id") Integer id) {
  215. if (null == id) {
  216. return ResponseJson.error(-1, "id不能为空", null);
  217. }
  218. return customerService.delShopInfo(id);
  219. }
  220. /**
  221. * 相关搜索词统计列表
  222. * @param cmShopKeyword
  223. * @param pageNum
  224. * @param pageSize
  225. * @return
  226. */
  227. @GetMapping("/getShopKeywordList")
  228. public ResponseJson<PaginationVo<CmShopKeyword>> getShopKeywordList(CmShopKeyword cmShopKeyword,
  229. @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
  230. @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
  231. if (null == cmShopKeyword.getShopId()) {
  232. return ResponseJson.error(-1, "供应商Id不能为空", null);
  233. }
  234. return customerService.getShopKeywordList(cmShopKeyword, pageNum, pageSize);
  235. }
  236. /**
  237. * 选择搜索词
  238. * @param keyword
  239. * @param pageNum
  240. * @param pageSize
  241. * @return
  242. */
  243. @GetMapping("/getSearchFrequencyList")
  244. public ResponseJson<PaginationVo<CmUserSearchFrequency>> getSearchFrequencyList(String keyword,
  245. @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
  246. @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
  247. return customerService.getSearchFrequencyList(keyword, pageNum, pageSize);
  248. }
  249. /**
  250. * 添加搜索词统计
  251. * @param shopId
  252. * @param keyWordIds
  253. * @return
  254. */
  255. @GetMapping("/saveShopKeyword")
  256. public ResponseJson saveShopKeyword(Integer shopId, String keyWordIds){
  257. if (null == shopId) {
  258. return ResponseJson.error(-1, "供应商Id不能为空", null);
  259. }
  260. if (null == keyWordIds) {
  261. return ResponseJson.error(-1, "选择搜索词不能为空", null);
  262. }
  263. return customerService.saveShopKeyword(shopId, keyWordIds);
  264. }
  265. /**
  266. * 设置统计状态
  267. * @param id
  268. * @param status
  269. * @return
  270. */
  271. @GetMapping("/renewShopKeyword")
  272. public ResponseJson renewShopKeyword(Integer id, Integer status) {
  273. if (null == id) {
  274. return ResponseJson.error(-1, "id不能为空", null);
  275. }
  276. if (null == status) {
  277. return ResponseJson.error(-1, "状态不能为空", null);
  278. }
  279. return customerService.renewShopKeyword(id, status);
  280. }
  281. /**
  282. * 删除统计搜索词
  283. * @param id
  284. * @return
  285. */
  286. @GetMapping("/delShopKeyword/{id}")
  287. public ResponseJson delShopKeyword(@PathVariable("id") Integer id) {
  288. if (null == id) {
  289. return ResponseJson.error(-1, "id不能为空", null);
  290. }
  291. return customerService.delShopKeyword(id);
  292. }
  293. /**
  294. * 弹框信息回显
  295. * @param shopId
  296. * @return
  297. */
  298. @GetMapping("/getShopPopUp")
  299. public ResponseJson<CmShopPopUp> getShopPopUp(Integer shopId) {
  300. if (null == shopId) {
  301. return ResponseJson.error(-1, "供应商Id不能为空", null);
  302. }
  303. return customerService.getShopPopUp(shopId);
  304. }
  305. /**
  306. * 弹框信息保存
  307. * @param cmShopPopUp
  308. * @return
  309. */
  310. @PostMapping("/saveShopPopUp")
  311. public ResponseJson saveShopPopUp(@RequestBody CmShopPopUp cmShopPopUp) {
  312. if (null == cmShopPopUp.getShopId()) {
  313. return ResponseJson.error(-1, "供应商Id不能为空", null);
  314. }
  315. if (null == cmShopPopUp.getImage()) {
  316. return ResponseJson.error(-1, "显示图不能为空", null);
  317. }
  318. if (null == cmShopPopUp.getGuidingOne()) {
  319. return ResponseJson.error(-1, "引导语不能为空", null);
  320. }
  321. if (null == cmShopPopUp.getGuidingTwo()) {
  322. return ResponseJson.error(-1, "引导语不能为空", null);
  323. }
  324. return customerService.saveShopPopUp(cmShopPopUp);
  325. }
  326. /**
  327. * 供应商广告列表
  328. * @param cmShopAdvertisingImage
  329. * @param pageNum
  330. * @param pageSize
  331. * @return
  332. */
  333. @GetMapping("/getShopAdvertisingImage")
  334. public ResponseJson<PaginationVo<CmShopAdvertisingImage>> getShopAdvertisingImage(CmShopAdvertisingImage cmShopAdvertisingImage,
  335. @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
  336. @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
  337. return customerService.getShopAdvertisingImage(cmShopAdvertisingImage, pageNum, pageSize);
  338. }
  339. /**
  340. * 供应商广告信息回显
  341. * @param id
  342. * @return
  343. */
  344. @GetMapping("/getShopAdvertisingImageById/{id}")
  345. public ResponseJson<CmShopAdvertisingImage> getShopAdvertisingImageById(@PathVariable("id") Integer id) {
  346. if (null == id) {
  347. return ResponseJson.error(-1, "Id不能为空", null);
  348. }
  349. return customerService.getShopAdvertisingImageById(id);
  350. }
  351. /**
  352. * 保存供应商广告信息
  353. * @param cmShopAdvertisingImage
  354. * @return
  355. */
  356. @PostMapping("/saveShopAdvertisingImage")
  357. public ResponseJson saveShopAdvertisingImage(@RequestBody CmShopAdvertisingImage cmShopAdvertisingImage) {
  358. return customerService.saveShopAdvertisingImage(cmShopAdvertisingImage);
  359. }
  360. /**
  361. * 一键排序
  362. * @param id
  363. * @param sort
  364. * @return
  365. */
  366. @GetMapping("/renewShopAdvertisingImageSort")
  367. public ResponseJson renewShopAdvertisingImageSort(Integer id, Integer sort) {
  368. if (null == id) {
  369. return ResponseJson.error(-1, "排序数据id不能为空", null);
  370. }
  371. if (null == sort) {
  372. return ResponseJson.error(-1, "排序指不能为空", null);
  373. }
  374. return customerService.renewShopAdvertisingImageSort(id, sort);
  375. }
  376. /**
  377. * 修改上下架状态
  378. * @param id
  379. * @param status
  380. * @return
  381. */
  382. @GetMapping("/renewShopAdvertisingImageStatus")
  383. public ResponseJson renewShopAdvertisingImageStatus(Integer id, Integer status) {
  384. if (null == id) {
  385. return ResponseJson.error(-1, "id不能为空", null);
  386. }
  387. if (null == status) {
  388. return ResponseJson.error(-1, "状态不能为空", null);
  389. }
  390. return customerService.renewShopAdvertisingImageStatus(id, status);
  391. }
  392. /**
  393. * 删除广告
  394. * @param id
  395. * @return
  396. */
  397. @GetMapping("/delShopAdvertisingImage/{id}")
  398. public ResponseJson delShopAdvertisingImage(@PathVariable("id") Integer id) {
  399. if (null == id) {
  400. return ResponseJson.error(-1, "id不能为空", null);
  401. }
  402. return customerService.delShopAdvertisingImage(id);
  403. }
  404. /**
  405. * 供应商主页统计
  406. * @param shopId
  407. * @param startTime
  408. * @param endTime
  409. * @return
  410. */
  411. @GetMapping("/getPageShop")
  412. ResponseJson<PaginationVo<CmPageShop>> getPageShop(Integer shopId, String startTime, String endTime,
  413. @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
  414. @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
  415. if (null == shopId) {
  416. return ResponseJson.error(-1, "供应商Id不能为空", null);
  417. }
  418. return customerService.getPageShop(shopId, startTime, endTime, pageNum, pageSize);
  419. }
  420. /**
  421. * 供应商商品统计
  422. * @param shopId
  423. * @return
  424. */
  425. @GetMapping("/getPageShopProduct")
  426. public ResponseJson<PaginationVo<CmPageShopProduct>> getPageShopProduct(Integer shopId, String startTime, String endTime,
  427. @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
  428. @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
  429. if (null == shopId) {
  430. return ResponseJson.error(-1, "供应商Id不能为空", null);
  431. }
  432. return customerService.getPageShopProduct(shopId, startTime, endTime, pageNum, pageSize);
  433. }
  434. /**
  435. * 供应商文章统计
  436. * @param shopId
  437. * @return
  438. */
  439. @GetMapping("/getPageShopInfo")
  440. public ResponseJson<PaginationVo<CmPageShopInfo>> getPageShopInfo(Integer shopId, String startTime, String endTime,
  441. @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
  442. @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
  443. if (null == shopId) {
  444. return ResponseJson.error(-1, "供应商Id不能为空", null);
  445. }
  446. return customerService.getPageShopInfo(shopId, startTime, endTime, pageNum, pageSize);
  447. }
  448. /**
  449. * 供应商搜索词统计
  450. * @param shopId
  451. * @return
  452. */
  453. @GetMapping("/getPageShopKeyword")
  454. public ResponseJson<PaginationVo<CmPageShopKeyword>> getPageShopKeyword(Integer shopId, String startTime, String endTime,
  455. @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
  456. @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
  457. if (null == shopId) {
  458. return ResponseJson.error(-1, "供应商Id不能为空", null);
  459. }
  460. return customerService.getPageShopKeyword(shopId, startTime, endTime, pageNum, pageSize);
  461. }
  462. }