DisplaceController.java 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. package com.demo.wjj.controller;
  2. import com.demo.wjj.bo.DisplaceDetailBo;
  3. import com.demo.wjj.bo.DisplaceListBo;
  4. import com.demo.wjj.bo.ImgListBo;
  5. import com.demo.wjj.bo.SaveDisplaceBo;
  6. import com.demo.wjj.converter.SaveDisplaceConverter;
  7. import com.demo.wjj.po.DisplaceAudit;
  8. import com.demo.wjj.po.TbImgItem;
  9. import com.demo.wjj.qo.SaveDisplaceQo;
  10. import com.demo.wjj.service.*;
  11. import com.demo.wjj.utils.ApiResult;
  12. import com.demo.wjj.utils.ExecuteResult;
  13. import com.demo.wjj.utils.PageBean;
  14. import com.demo.wjj.utils.Result;
  15. import com.demo.wjj.validator.SaveDisplaceQoValidator;
  16. import com.github.pagehelper.PageInfo;
  17. import com.qiniu.processing.OperationStatus;
  18. import org.apache.commons.collections4.CollectionUtils;
  19. import org.apache.commons.lang3.ArrayUtils;
  20. import org.apache.commons.lang3.StringUtils;
  21. import org.slf4j.Logger;
  22. import org.slf4j.LoggerFactory;
  23. import org.springframework.beans.factory.annotation.Autowired;
  24. import org.springframework.beans.factory.annotation.Value;
  25. import org.springframework.validation.BindingResult;
  26. import org.springframework.web.bind.WebDataBinder;
  27. import org.springframework.web.bind.annotation.*;
  28. import javax.servlet.http.HttpServletRequest;
  29. import javax.servlet.http.HttpServletResponse;
  30. import javax.validation.Valid;
  31. import java.util.*;
  32. /**
  33. * 置换
  34. *
  35. * @author wangqing
  36. * @date 2018.11.13
  37. */
  38. @RequestMapping("/displace")
  39. @RestController
  40. public class DisplaceController {
  41. private final Logger LOG = LoggerFactory.getLogger(getClass());
  42. @Autowired
  43. private SaveDisplaceQoValidator saveDisplaceQoValidator;
  44. @Autowired
  45. private SaveDisplaceConverter saveDisplaceConverter;
  46. @Autowired
  47. private DisplaceManage displaceManage;
  48. @Autowired
  49. private DisplaceAuditService displaceAuditService;
  50. @Autowired
  51. private TbImgItemService tbImgItemService;
  52. @Autowired
  53. private TbImgListService tbImgListService;
  54. @Autowired
  55. QiNiuService qiNiuService;
  56. /**
  57. * 精品机账号
  58. */
  59. @Value("ZHXTCS")
  60. private String excellentAccount;
  61. @InitBinder
  62. protected void initBinder(WebDataBinder binder) {
  63. Object target = binder.getTarget();
  64. if (target == null) {
  65. return;
  66. }
  67. if (saveDisplaceQoValidator.supports(target.getClass())) {
  68. binder.addValidators(saveDisplaceQoValidator);
  69. }
  70. }
  71. /**
  72. * 保存置换
  73. *
  74. * @param saveDisplaceQo 置换参数
  75. * private String is_good;//1-普通2-精品
  76. * private String storage;//1-完成;2-暂存
  77. * @return apiResult
  78. */
  79. @PostMapping("/save")
  80. public ApiResult save(@Valid SaveDisplaceQo saveDisplaceQo, BindingResult bindingResult) {
  81. LOG.info("调用保存置换(/displace/save)接口, saveDisplaceQo:{}", saveDisplaceQo);
  82. if(saveDisplaceQo.getAgentId().equals(excellentAccount)){
  83. saveDisplaceQo.setIs_good("2");
  84. }else{
  85. saveDisplaceQo.setIs_good("1");
  86. }
  87. if(StringUtils.isBlank(saveDisplaceQo.getStorage())){
  88. saveDisplaceQo.setStorage("1");
  89. }
  90. if (CollectionUtils.isNotEmpty(bindingResult.getAllErrors())) {
  91. LOG.warn("请求参数错误");
  92. return ApiResult.createFailure();
  93. }
  94. final String[] pictureSubfixs = {".BMP", ".JPG", ".JPEG", ".PNG", ".GIF", ".bmp", ".jpg", ".jpeg", ".png", ".gif"};
  95. try {
  96. SaveDisplaceBo convert = saveDisplaceConverter.convert(saveDisplaceQo);
  97. //获取图片列表
  98. List<SaveDisplaceBo.DisplaceImageList> displaceImageLists = convert.getPicture();
  99. //便利图片数组 给予分类存储
  100. for (SaveDisplaceBo.DisplaceImageList displaceImage : displaceImageLists) {
  101. List<String> picList = new ArrayList<>();
  102. //转码
  103. for(String key:displaceImage.getPic()){
  104. String keyModel=key;
  105. String subfix = key.substring(key.lastIndexOf("."));
  106. if (!ArrayUtils.contains(pictureSubfixs, subfix)){
  107. OperationStatus operationStatus=qiNiuService.persisted(key);
  108. LOG.info("operationStatus======"+operationStatus);
  109. LOG.info("operationStatus======"+operationStatus.inputKey);
  110. keyModel="weigongcheng_"+key;
  111. LOG.info("keyModel======"+keyModel);
  112. }
  113. picList.add(keyModel);
  114. LOG.info("picList======"+picList);
  115. }
  116. displaceImage.setPic(null);
  117. displaceImage.setPic(picList);
  118. //获取细节分类id
  119. Integer detailId = displaceImage.getDetailId();
  120. //detail袭击目录不等于空
  121. if (detailId != null) {
  122. //通过细节分类id查询二级分类
  123. TbImgItem tbImgItem = tbImgItemService.findOne(detailId);
  124. //查询二级目录
  125. List<ImgListBo> imgListBos = tbImgListService.findAll();
  126. //细节分类
  127. if (tbImgItem != null) {
  128. //从数据库中获取二级分类id
  129. Integer imgBqId = tbImgItem.getImgBqId();
  130. //组装二级识别码
  131. String imgBqIdStr = "IMG_"+imgBqId;
  132. //遍历每个二级分类 查询当前图片分类是否有匹配的
  133. for (ImgListBo imgListBo : imgListBos) {
  134. //查看图片分类是否属于二级分类
  135. if (imgListBo.getListCode().equals(imgBqIdStr)) {
  136. displaceImage.setCode(imgListBo.getListCode());
  137. }
  138. }
  139. /* switch (imgBqId){
  140. case 1 : displaceImage.setCode("IMG_1"); break;
  141. case 2 : displaceImage.setCode("IMG_2"); break;
  142. case 3 : displaceImage.setCode("IMG_3"); break;
  143. case 4 : displaceImage.setCode("IMG_4"); break;
  144. case 5 : displaceImage.setCode("IMG_5"); break;
  145. case 6 : displaceImage.setCode("IMG_6"); break;
  146. case 7 : displaceImage.setCode("IMG_7"); break;
  147. default: displaceImage.setCode(""); break;
  148. }*/
  149. }
  150. }
  151. }
  152. LOG.info("gg组装的图片集合 displaceImageLists{}",displaceImageLists);
  153. //把修改好的图片放入集合中
  154. convert.setPicture(displaceImageLists);
  155. ExecuteResult<Boolean> executeResult = displaceManage.save(convert);
  156. ApiResult apiResult;
  157. if (executeResult.isExecuteResult()) {
  158. apiResult = executeResult.getData() ? ApiResult.createSuccess(null) : ApiResult.createFailure();
  159. } else {
  160. Result result = executeResult.getResult();
  161. if (result != null) {
  162. apiResult = new ApiResult(result);
  163. } else {
  164. apiResult = ApiResult.createFailure();
  165. }
  166. }
  167. LOG.info("调用保存置换(/displaceManage/save)接口成功, apiResult:{}", apiResult);
  168. return apiResult;
  169. } catch (Exception e) {
  170. LOG.error("调用保存置换(/displaceManage/save)接口异常", e);
  171. return ApiResult.createFailure();
  172. }
  173. }
  174. /**
  175. * 获取未审核置换列表
  176. *
  177. * @param agentId 商家id
  178. * @param openId 微信openId
  179. * @param request request
  180. * @return apiResult
  181. */
  182. @GetMapping("/queryUndoList")
  183. public ApiResult queryUndoList(@RequestParam(required = false) String agentId, @RequestParam(required = false) String openId, HttpServletRequest request) {
  184. LOG.info("调用获取未审核置换列表(/displace/queryUndoList)接口, agentId:{}, openId:{}", agentId, openId);
  185. String is_good="1";
  186. if(agentId.equals(excellentAccount)){
  187. is_good="2";
  188. }
  189. if (StringUtils.isBlank(agentId)) {
  190. LOG.info("agentId为空");
  191. return ApiResult.createFailure();
  192. }
  193. if (StringUtils.isBlank(openId)) {
  194. LOG.info("微信openId为空");
  195. return ApiResult.createFailure();
  196. }
  197. try {
  198. PageInfo<DisplaceListBo> pageInfo = displaceAuditService.queryUndoDisplaceList(agentId, openId, PageBean.create(request),is_good);
  199. ApiResult<PageInfo<DisplaceListBo>> apiResult = ApiResult.createSuccess(pageInfo);
  200. LOG.info("调用获取未审核置换列表(/displace/queryUndoList)接口成功");
  201. LOG.debug("未审核置换列表, apiResult:{}", apiResult);
  202. return apiResult;
  203. } catch (Exception e) {
  204. LOG.error("调用获取未审核置换列表(/displace/queryUndoList)接口异常", e);
  205. return ApiResult.createFailure();
  206. }
  207. }
  208. /**
  209. * 获取已审核置换列表
  210. *
  211. * @param agentId 商家id
  212. * @param openId 微信openId
  213. * @param request request
  214. * @return apiResult
  215. */
  216. @GetMapping("/queryDoneList")
  217. public ApiResult queryDoneList(@RequestParam(required = false) String agentId, @RequestParam(required = false) String openId, HttpServletRequest request) {
  218. LOG.info("调用获取已审核置换列表(/displace/queryDoneList)接口, agentId:{}, openId:{}", agentId, openId);
  219. if (StringUtils.isBlank(agentId)) {
  220. LOG.info("agentId为空");
  221. return ApiResult.createFailure();
  222. }
  223. if (StringUtils.isBlank(openId)) {
  224. LOG.info("微信openId为空");
  225. return ApiResult.createFailure();
  226. }
  227. String is_good="1";
  228. if(agentId.equals(excellentAccount)){
  229. is_good="2";
  230. }
  231. try {
  232. PageInfo<DisplaceListBo> pageInfo = displaceAuditService.queryDoneDisplaceList(agentId, openId, PageBean.create(request),is_good);
  233. ApiResult<PageInfo<DisplaceListBo>> apiResult = ApiResult.createSuccess(pageInfo);
  234. LOG.info("调用获取已审核置换列表(/displace/queryDoneList)接口成功");
  235. LOG.debug("未审核置换列表, apiResult:{}", apiResult);
  236. return apiResult;
  237. } catch (Exception e) {
  238. LOG.error("调用获取已审核置换列表(/displace/queryDoneList)接口异常", e);
  239. return ApiResult.createFailure();
  240. }
  241. }
  242. /**
  243. * 查询被驳回的置换设备数量
  244. *
  245. * @param agentId
  246. * @param openId
  247. * @return
  248. */
  249. @GetMapping("/queryRejectedCount")
  250. public ApiResult queryRejectedCount(@RequestParam(required = false) String agentId, @RequestParam(required = false) String openId) {
  251. LOG.info("调用查询被驳回的置换设备数量(/displace/queryRejectedCount)接口, agentId:{}, openId:{}", agentId, openId);
  252. if (StringUtils.isBlank(agentId)) {
  253. LOG.info("agentId为空");
  254. return ApiResult.createFailure();
  255. }
  256. if (StringUtils.isBlank(openId)) {
  257. LOG.info("openId为空");
  258. return ApiResult.createFailure();
  259. }
  260. try {
  261. final int rejectedDisplaceCount = displaceAuditService.getRejectedDisplaceCount(agentId, openId);
  262. Map<String, Integer> data = new HashMap<>();
  263. data.put("count", rejectedDisplaceCount);
  264. final ApiResult<Map<String, Integer>> apiResult = ApiResult.createSuccess(data);
  265. LOG.info("调用查询被驳回的置换设备数量(/displace/queryRejectedCount)接口成功, apiResult:{}", apiResult);
  266. return apiResult;
  267. } catch (Exception e) {
  268. LOG.error("调用查询被驳回的置换设备数量(/displace/queryRejectedCount)接口异常", e);
  269. return ApiResult.createFailure();
  270. }
  271. }
  272. /**
  273. * 获取置换详情
  274. *
  275. * @param id 置换id
  276. * @return apiResult
  277. */
  278. @GetMapping("/getDetails")
  279. public ApiResult getDetails(@RequestParam(required = false) String id) {
  280. LOG.info("调用获取置换详情(/displace/getDetails)接口, id:{}", id);
  281. if (StringUtils.isBlank(id)) {
  282. LOG.info("id为空");
  283. return ApiResult.createFailure();
  284. }
  285. try {
  286. DisplaceDetailBo displaceDetail = displaceAuditService.getDisplaceDetail(id);
  287. ApiResult<DisplaceDetailBo> apiResult = ApiResult.createSuccess(displaceDetail);
  288. LOG.info("调用获取置换详情(/displace/getDetails)接口成功, apiResult:{}", apiResult);
  289. return apiResult;
  290. } catch (Exception e) {
  291. LOG.error("调用获取置换详情(/displace/getDetails)接口异常", e);
  292. return ApiResult.createFailure();
  293. }
  294. }
  295. /**
  296. * 根据类型查询精品设备
  297. *
  298. * @param type 1-在售设备”、“2停售设备”、“3成交设备”、“4我的秒杀
  299. * @return apiResult
  300. */
  301. @GetMapping("/getDisplaceGoodBuyList")
  302. public ApiResult getDisplaceGoodBuyList(@RequestParam(required = false) String type,@RequestParam(required = false) String agentId, @RequestParam(required = false) String openId, HttpServletRequest request){
  303. LOG.info("根据类型查询设备列表(/displace/getDisplaceList)接口, agentId:{}, openId:{}, type:{}", agentId, openId, type);
  304. if (StringUtils.isBlank(agentId)) {
  305. LOG.info("agentId为空");
  306. return ApiResult.createFailure();
  307. }
  308. if (StringUtils.isBlank(openId)) {
  309. LOG.info("微信openId为空");
  310. return ApiResult.createFailure();
  311. }
  312. try {
  313. PageInfo<DisplaceListBo> pageInfo = displaceAuditService.queryTypeDisplaceList(agentId, openId, type, PageBean.create(request));
  314. ApiResult<PageInfo<DisplaceListBo>> apiResult = ApiResult.createSuccess(pageInfo);
  315. LOG.info("根据类型查询设备列表(/displace/getDisplaceList)接口成功");
  316. LOG.debug("置换列表, apiResult:{}", apiResult);
  317. return apiResult;
  318. } catch (Exception e) {
  319. LOG.error("根据类型查询设备列表(/displace/getDisplaceList)接口异常", e);
  320. return ApiResult.createFailure();
  321. }
  322. }
  323. /**
  324. * 根据类型查询我要卖精品设备
  325. *
  326. *
  327. * @return apiResult
  328. */
  329. @GetMapping("/getDisplaceGoodSaleList")
  330. public ApiResult getDisplaceGoodSaleList(@RequestParam(required = false) String agentId,
  331. @RequestParam(required = false) String openId,
  332. HttpServletRequest request){
  333. LOG.info("根据类型查询设备列表(/displace/getDisplaceList)接口, agentId:{}, openId:{}", agentId, openId);
  334. if (StringUtils.isBlank(agentId)) {
  335. LOG.info("agentId为空");
  336. return ApiResult.createFailure();
  337. }
  338. if (StringUtils.isBlank(openId)) {
  339. LOG.info("微信openId为空");
  340. return ApiResult.createFailure();
  341. }
  342. try {
  343. PageInfo<DisplaceListBo> pageInfo = displaceAuditService.getDisplaceGoodSaleList(agentId, openId, PageBean.create(request));
  344. ApiResult<PageInfo<DisplaceListBo>> apiResult = ApiResult.createSuccess(pageInfo);
  345. LOG.info("根据类型查询设备列表(/displace/getDisplaceList)接口成功");
  346. LOG.debug("置换列表, apiResult:{}", apiResult);
  347. return apiResult;
  348. } catch (Exception e) {
  349. LOG.error("根据类型查询设备列表(/displace/getDisplaceList)接口异常", e);
  350. return ApiResult.createFailure();
  351. }
  352. }
  353. /**
  354. * 用户报价与保留价比较
  355. */
  356. @GetMapping("/judge")
  357. public ApiResult judge(@RequestParam(required = false) String displaceId){
  358. if (StringUtils.isBlank(displaceId)) {
  359. LOG.info("displaceId为空");
  360. return ApiResult.createFailure();
  361. }
  362. try {
  363. DisplaceAudit displaceAudit = displaceAuditService.getDisplaceAudit(displaceId);
  364. ApiResult<DisplaceAudit> apiResult = ApiResult.createSuccess(displaceAudit);
  365. LOG.info("根据置换id用户报价与保留价比较(/displace/judge)接口成功");
  366. LOG.debug("置换列表, apiResult:{}", apiResult);
  367. return apiResult;
  368. } catch (Exception e) {
  369. LOG.error("根据置换id用户报价与保留价比较(/displace/judge)接口异常", e);
  370. return ApiResult.createFailure();
  371. }
  372. }
  373. /**
  374. * 查询暂存列表
  375. *
  376. *
  377. * @return apiResult
  378. */
  379. @GetMapping("/getDisplaceStorageList")
  380. public ApiResult getDisplaceStorageList(@RequestParam(required = false) String storageStatus,
  381. @RequestParam(required = false) String agentId,
  382. @RequestParam(required = false) String openId,
  383. HttpServletRequest request){
  384. LOG.info("查询暂存列表(/displace/getDisplaceStorageList)接口, agentId:{}, openId:{}", agentId, openId);
  385. if (StringUtils.isBlank(agentId)) {
  386. LOG.info("agentId为空");
  387. return ApiResult.createFailure();
  388. }
  389. if (StringUtils.isBlank(openId)) {
  390. LOG.info("微信openId为空");
  391. return ApiResult.createFailure();
  392. }
  393. try {
  394. PageInfo<DisplaceListBo> pageInfo = displaceAuditService.getDisplaceStorageList(agentId, openId,storageStatus, PageBean.create(request));
  395. ApiResult<PageInfo<DisplaceListBo>> apiResult = ApiResult.createSuccess(pageInfo);
  396. LOG.info("查询暂存列表(/displace/getDisplaceStorageList)接口成功");
  397. LOG.debug("置换列表, apiResult:{}", apiResult);
  398. return apiResult;
  399. } catch (Exception e) {
  400. LOG.error("查询暂存列表(/displace/getDisplaceStorageList)接口异常", e);
  401. return ApiResult.createFailure();
  402. }
  403. }
  404. /**
  405. * 查询待确认置换列表
  406. *
  407. */
  408. @GetMapping("/getDisplaceConfirmList")
  409. public ApiResult getDisplaceConfirmList(@RequestParam(required = false) String agentId,
  410. @RequestParam(required = false) String openId,
  411. HttpServletRequest request){
  412. LOG.info("查询暂存列表(/displace/getDisplaceStorageList)接口, agentId:{}, openId:{}", agentId, openId);
  413. if (StringUtils.isBlank(agentId)) {
  414. LOG.info("agentId为空");
  415. return ApiResult.createFailure();
  416. }
  417. if (StringUtils.isBlank(openId)) {
  418. LOG.info("微信openId为空");
  419. return ApiResult.createFailure();
  420. }
  421. try {
  422. PageInfo<DisplaceListBo> pageInfo = displaceAuditService.getDisplaceConfirmList(agentId, openId, PageBean.create(request));
  423. ApiResult<PageInfo<DisplaceListBo>> apiResult = ApiResult.createSuccess(pageInfo);
  424. LOG.info("查询暂存列表(/displace/getDisplaceStorageList)接口成功");
  425. LOG.debug("置换列表, apiResult:{}", apiResult);
  426. return apiResult;
  427. } catch (Exception e) {
  428. LOG.error("查询暂存列表(/displace/getDisplaceStorageList)接口异常", e);
  429. return ApiResult.createFailure();
  430. }
  431. }
  432. // @RequestMapping("/appAddInfo2")
  433. // public void appAddInfo2(String displaceId){
  434. //
  435. // try {
  436. // //获取置换信息
  437. // DisplaceAudit displaceAuditBean=displaceAuditService.selectDisplaceAuditByDisplaceId(displaceId);
  438. //
  439. // LOG.info("更新为已审核待上架");
  440. //
  441. // // 记录id
  442. // String id = displaceAuditBean.getId();
  443. // // 车商ID
  444. // String ids = displaceAuditBean.getIds();
  445. // if(StringUtils.isEmpty(ids)) {
  446. // LOG.info("addInfo error!=没有推送车商信息");
  447. // return;
  448. // }
  449. //
  450. // // 销售员ID
  451. // String saleId = displaceAuditBean.getSaleId();
  452. // //取出带过来的置换ID
  453. // DisplaceAuditBean displace = displaceAuditService.queryAuditPageByDisplaceId(displaceId);
  454. // //设备名称
  455. // String sbmc = displace.getAttrContent().get("sbpp") + " " + displace.getAttrContent().get("sbxh") + " " + displace.getAttrContent().get("sblx");
  456. // // 发布时间
  457. // String pubTimeStr = "";
  458. // Date pubTime = displaceAuditBean.getPubTime();
  459. // try {
  460. // pubTimeStr = DateUtil.format(pubTime, "yyyy年MM月dd日 HH:mm");
  461. // } catch (Exception e) {
  462. // pubTimeStr = "";
  463. // }
  464. //
  465. // //存储被推送人 ids
  466. // displaceAuditBean.setIds(ids);
  467. // PushRecordBean pushRecord = null;
  468. // List<PushRecordBean> list = new ArrayList<PushRecordBean>();
  469. // String agentId=displaceAuditBean.getAgentId();
  470. // AgentBean agentBean = agentBeanService.getAgentBeanByAgentId(agentId);
  471. // if(agentBean == null) {
  472. // resultBean = new PageResultBean(PageResultBean.FAIL_CODE, "未查询到代理商信息!");
  473. // return;
  474. // }
  475. // String agentName = agentBean.getAgentName();
  476. // String appId =agentBean.getPubAppId();
  477. // String appSecret = agentBean.getPubAppSecret();
  478. // Date startTime = displaceAuditBean.getStartTime();
  479. // Date endTime = displaceAuditBean.getEndTime();
  480. //
  481. // // 反馈内容
  482. // // String diggerUrl = TemplateConstants.ZHSH_DIGGER_URL + "?agentId=" + agentId + "&id=" + id;
  483. // String diggerUrl = "https://www.weigongcheng.net/wjj-api/index.html#/join" + "?agentId=" + agentId + "&displaceId=" + displaceId + "&status=" + displaceAuditBean.getAuditStatus() + "&id=" + id;
  484. // String sms = TemplateConstants.ZHSH_DIGGER_UP_SMS;
  485. // sms = sms.replaceAll("agentName", agentName);
  486. // sms = sms.replaceAll("displaceId", displaceId);
  487. // sms = sms.replaceAll("sbmc", sbmc);
  488. //
  489. // String wxsms = TemplateConstants.ZHSH_DIGGER_TEMPLATE_CONTENT;
  490. // wxsms = wxsms.replaceAll("first", "有一台设备正在寻找买家");
  491. // wxsms = wxsms.replaceAll("keyword1", sbmc + "");
  492. // if ("3".equals(displaceAuditBean.getUpType())) {
  493. // wxsms = wxsms.replaceAll("keyword2", "最低价:" + displaceAuditBean.getMinPrice() + "万元-最高价:" + displaceAuditBean.getMaxPrice() + "万元");
  494. // } else {
  495. // wxsms = wxsms.replaceAll("keyword2", displaceAuditBean.getMinMoney() + "万元");
  496. // }
  497. // wxsms = wxsms.replaceAll("keyword3", displaceAuditBean.getMoneyRange() + "万元");
  498. // wxsms = wxsms.replaceAll("keyword4", DateUtil.format(startTime, "yyyy年MM月dd日 HH:mm"));
  499. // wxsms = wxsms.replaceAll("keyword5", displaceAuditBean.getBail() + "万元");
  500. // wxsms = wxsms.replaceAll("remark", "点击【详情】前往查看!");
  501. //
  502. // // 发送车商信息
  503. // String[] diggers = ids.substring(0, ids.lastIndexOf(",")).split(",");
  504. // for (int i = 0; i < diggers.length; i++) {
  505. // //获取车商bean,并获取车商微信openid和其他信息
  506. // DiggerBean digger = diggerBeanService.queryDiggerByID(diggers[i]);
  507. // if (digger == null) {
  508. // continue;
  509. // }
  510. // String openId = digger.getWxOpenID();
  511. // String wxnc = digger.getDaWxnc();
  512. // String wxh = digger.getDaWxh();
  513. // String name = digger.getDaName();
  514. // String phone = digger.getDaPhone();
  515. //
  516. // // 组装车商微信内容
  517. // Map<String, TemplateData> param1 = new HashMap<String, TemplateData>();
  518. // param1.put("first", new TemplateData("有一台设备正在寻找买家", "#696969"));
  519. // param1.put("keyword1", new TemplateData(sbmc + "", "#696969"));
  520. // if ("3".equals(displaceAuditBean.getUpType())) {
  521. // param1.put("keyword2", new TemplateData("最低价:" + displaceAuditBean.getMinPrice() + "万元-最高价:" + displaceAuditBean.getMaxPrice() + "万元", "#696969"));
  522. // } else {
  523. // param1.put("keyword2", new TemplateData(displaceAuditBean.getMinMoney() + "万元", "#696969"));
  524. // }
  525. // param1.put("keyword3", new TemplateData(displaceAuditBean.getMoneyRange() + "万元", "#696969"));
  526. // param1.put("keyword4", new TemplateData(DateUtil.format(startTime, "yyyy年MM月dd日 HH:mm"), "#696969"));
  527. // param1.put("keyword5", new TemplateData(displaceAuditBean.getBail() + "万元", "#696969"));
  528. // param1.put("remark", new TemplateData("点击【详情】前往查看!", "#696969"));
  529. //
  530. // wxsms = wxsms.replaceAll("keyword1", wxnc);
  531. // /* pushRecord = displaceAuditService.pushSms(displaceId, id, sbmc, ConfigConstants.CDMC_ZHSH, agentId, agentName, openId, wxnc, wxh, name, phone, "2",ConfigConstants.XXLB_SBSJ,
  532. // appId, appSecret, sms, wxsms, param1, diggerUrl, "拍品上架通知");
  533. // list.add(pushRecord);*/
  534. // pushRecord = displaceAuditService.pushSms(displaceId, id, sbmc, ConfigConstants.CDMC_ZHSH, agentId, agentName, openId, wxnc, wxh, name, phone, "1", ConfigConstants.XXLB_SBSJ,
  535. // appId, appSecret, sms, wxsms, param1, diggerUrl, "拍品上架通知");
  536. // list.add(pushRecord);
  537. // }
  538. //
  539. // // 发送销售员信息
  540. // if (StringUtils.isNotBlank(saleId)) {
  541. // SalesBean salesBean = saleBeanService.getSaleBeanBySaleId(saleId);
  542. // if (salesBean != null) {
  543. // String openId = salesBean.getWxOpenid();
  544. // String wxnc = salesBean.getSaleWxnc();
  545. // String wxh = salesBean.getSaleWxh();
  546. // String name = salesBean.getSaleName();
  547. // String phone = salesBean.getSalePhone();
  548. // String xqurl = "https://www.xxinjiyuan.com/wjj-api/index.html#/join?agentId=GZZSNJ&displaceId=GZZSNJ-ZH0044&status=finished&id=5c8adc199c7f44a8ac398d9edbcd4914";
  549. // // String saleUrl = TemplateConstants.ZHSH_SALE_URL + "?agentId=" + agentId + "&id=" + id;
  550. // String saleUrl = "https://www.weigongcheng.net/wjj-api/index.html#/join" + "?agentId=" + agentId + "&displaceId=" + displaceId + "&status=" + displaceAuditBean + "&id=" + id;
  551. // // 组装销售员微信内容
  552. // Map<String, TemplateData> param2 = new HashMap<String, TemplateData>();
  553. // param2.put("first", new TemplateData("您上传的设备已上架成功,等待买家出价", "#696969"));
  554. // param2.put("keyword1", new TemplateData(wxnc, "#696969"));
  555. // param2.put("keyword2", new TemplateData(sbmc, "#696969"));
  556. // param2.put("keyword3", new TemplateData(pubTimeStr, "#696969"));
  557. // param2.put("keyword4", new TemplateData("上架成功", "#696969"));
  558. //
  559. // String upsms = TemplateConstants.ZHSH_SALE_UP_SMS;
  560. // upsms = upsms.replace("sbmc", sbmc);
  561. //
  562. // String wxsms1 = TemplateConstants.ZHSH_SALE_TEMPLATE_CONTENT;
  563. // wxsms1 = wxsms1.replaceAll("first", "您上传的设备已上架成功,等待买家出价");
  564. // wxsms1 = wxsms1.replaceAll("keyword1", wxnc);
  565. // wxsms1 = wxsms1.replaceAll("keyword2", sbmc);
  566. // wxsms1 = wxsms1.replaceAll("keyword3", pubTimeStr);
  567. // wxsms1 = wxsms1.replaceAll("keyword4", "上架成功");
  568. // wxsms1 = wxsms1.replaceAll("remark", "赶快点击“详情”分享给大家吧!");
  569. //
  570. // /*pushRecord = displaceAuditService.pushSms(displaceId, id, sbmc, ConfigConstants.CDMC_ZHSH, agentId, agentName, openId, wxnc, wxh, name, phone, "2",ConfigConstants.XXLB_SBSJ,
  571. // appId, appSecret, upsms, wxsms1, param2, saleUrl, "审核结果通知");
  572. // list.add(pushRecord);*/
  573. // pushRecord = displaceAuditService.pushSms(displaceId, id, sbmc, ConfigConstants.CDMC_ZHSH, agentId, agentName, openId, wxnc, wxh, name, phone, "1", ConfigConstants.XXLB_SBSJ,
  574. // appId, appSecret, upsms, wxsms1, param2, saleUrl, "审核结果通知");
  575. // list.add(pushRecord);
  576. // }
  577. // }
  578. //
  579. // // 保存推送消息
  580. // pushRecordBeanService.saveRecords(list);
  581. // } catch (Exception e) {
  582. // resultBean= new PageResultBean(PageResultBean.FAIL_CODE,"系统繁忙,请稍后再来!");
  583. // log.error("addInfo error!",e);
  584. // }finally{
  585. //
  586. // }
  587. //
  588. // }
  589. }