DilNoticeController.java 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.feign.ESFeign;
  3. import com.steerinfo.dil.mapper.SaleLogMapper;
  4. import com.steerinfo.dil.model.DilNotice;
  5. import com.steerinfo.dil.service.IDilNoticeService;
  6. import com.steerinfo.dil.util.BaseRESTfulController;
  7. import com.steerinfo.dil.util.ColumnDataUtil;
  8. import com.steerinfo.dil.util.PageListAdd;
  9. import com.steerinfo.dil.util.SaleLogUtil;
  10. import com.steerinfo.framework.controller.RESTfulResult;
  11. import com.steerinfo.framework.service.pagehelper.PageHelper;
  12. import io.swagger.annotations.ApiImplicitParam;
  13. import io.swagger.annotations.ApiImplicitParams;
  14. import io.swagger.annotations.ApiOperation;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.web.bind.annotation.*;
  17. import java.math.BigDecimal;
  18. import java.util.HashMap;
  19. import java.util.List;
  20. import java.util.Map;
  21. /**
  22. * DilNotice RESTful接口:
  23. * @author generator
  24. * @version 1.0-SNAPSHORT 2021-12-08 02:21
  25. * 类描述
  26. * 修订历史:
  27. * 日期:2021-12-08
  28. * 作者:generator
  29. * 参考:
  30. * 描述:DilNotice RESTful接口
  31. * @see null
  32. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  33. */
  34. @RestController
  35. @RequestMapping("/${api.version}/dilnotices")
  36. public class DilNoticeController extends BaseRESTfulController {
  37. @Autowired
  38. IDilNoticeService dilNoticeService;
  39. @Autowired
  40. ColumnDataUtil columnDataUtil;
  41. @Autowired
  42. ESFeign esFeign;
  43. @Autowired
  44. SaleLogUtil saleLogUtil;
  45. @Autowired
  46. SaleLogMapper saleLogMapper;
  47. /**
  48. * 展示公告信息
  49. * @param mapVal
  50. * @param pageNum
  51. * @param pageSize
  52. * @param apiId
  53. * @return
  54. */
  55. @ApiOperation(value="获取列表", notes="分页查询")
  56. @ApiImplicitParams({
  57. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  58. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  59. @ApiImplicitParam(name = "apiId", value = "359", required = false, dataType = "BigDecimal"),
  60. })
  61. //获取整个的通知日期,标题,发布人
  62. @PostMapping(value = "/getNoticeList")
  63. public RESTfulResult getNoticeList(@RequestBody(required = false) Map<String,Object> mapVal,
  64. Integer pageNum,
  65. Integer pageSize,
  66. Integer apiId){
  67. PageHelper.startPage(pageNum, pageSize);
  68. //分页查询数据
  69. List<Map<String, Object>> columnList = dilNoticeService.getNoticeList(mapVal);
  70. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
  71. return success(data);
  72. }
  73. @ApiOperation(value="获取销售公司通知列表", notes="分页查询")
  74. @ApiImplicitParams({
  75. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  76. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  77. @ApiImplicitParam(name = "apiId", value = "414", required = false, dataType = "BigDecimal"),
  78. })
  79. //获取整个的通知日期,标题,发布人
  80. @PostMapping(value = "/getMarketingNoticeList")
  81. public RESTfulResult getMarketingNoticeList(@RequestBody(required = false) Map<String,Object> mapVal,
  82. Integer pageNum,
  83. Integer pageSize,
  84. Integer apiId,String con){
  85. PageHelper.startPage(pageNum, pageSize);
  86. //分页查询数据
  87. if (con!=null&&!(con.equals("undefined"))){
  88. mapVal.put("con", "%" + con + "%");
  89. }
  90. List<Map<String, Object>> columnList = dilNoticeService.getMarketingNoticeList(mapVal);
  91. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
  92. return success(data);
  93. }
  94. @ApiOperation(value="获取承运商通知列表", notes="分页查询")
  95. @ApiImplicitParams({
  96. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  97. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  98. @ApiImplicitParam(name = "apiId", value = "414", required = false, dataType = "BigDecimal"),
  99. })
  100. //获取整个的通知日期,标题,发布人
  101. @PostMapping(value = "/getCarrierNoticeList")
  102. public RESTfulResult getCarrierNoticeList(@RequestBody(required = false) Map<String,Object> mapVal,
  103. Integer pageNum,
  104. Integer pageSize,
  105. Integer apiId,
  106. String con){
  107. PageHelper.startPage(pageNum, pageSize);
  108. //分页查询数据
  109. if (con!=null&&!(con.equals("undefined"))){
  110. mapVal.put("con", "%" + con + "%");
  111. }
  112. List<Map<String, Object>> columnList = dilNoticeService.getCarrierNoticeList(mapVal);
  113. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
  114. return success(data);
  115. }
  116. @ApiOperation(value="获取收获客户通知列表", notes="分页查询")
  117. @ApiImplicitParams({
  118. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  119. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  120. @ApiImplicitParam(name = "apiId", value = "414", required = false, dataType = "BigDecimal"),
  121. })
  122. //获取整个的通知日期,标题,发布人
  123. @PostMapping(value = "/getClientNoticeList")
  124. public RESTfulResult getClientNoticeList(@RequestBody(required = false) Map<String,Object> mapVal,
  125. Integer pageNum,
  126. Integer pageSize,
  127. Integer apiId,
  128. String con){
  129. PageHelper.startPage(pageNum, pageSize);
  130. //分页查询数据
  131. if (con!=null&&!(con.equals("undefined"))){
  132. mapVal.put("con", "%" + con + "%");
  133. }
  134. List<Map<String, Object>> columnList = dilNoticeService.getClientNoticeList(mapVal);
  135. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
  136. return success(data);
  137. }
  138. /**
  139. * 创建通知信息
  140. * @param dilNotice
  141. * @return
  142. */
  143. @ApiOperation(value="创建", notes="根据DilNotice对象创建")
  144. @ApiImplicitParam(name = "dilNotice", value = "详细实体dilNotice", required = true, dataType = "DilNotice")
  145. @PostMapping(value = "/insertNotice")
  146. public RESTfulResult insertNotice(@RequestBody DilNotice dilNotice){
  147. int result = dilNoticeService.insertNotice(dilNotice);
  148. return success(result);
  149. }
  150. /**
  151. * @author:zyf
  152. * @version:1.0
  153. * @Date:2022-09-26
  154. * @Description:发布通知
  155. */
  156. @ApiOperation(value="发布通知", notes="根据DilNotice对象发布通知")
  157. @ApiImplicitParam(name = "dilNotice", value = "详细实体dilNotice", required = true, dataType = "DilNotice")
  158. @PostMapping(value = "/releaseNotice")
  159. public RESTfulResult releaseNotice(@RequestBody DilNotice dilNotice){
  160. int result = dilNoticeService.releaseNotice(dilNotice);
  161. if (result==0){
  162. return failed("失败");
  163. }
  164. return success(result);
  165. }
  166. /**
  167. * 根据id更新通知信息
  168. * @param dilNotice
  169. * @return
  170. */
  171. @ApiOperation(value="更新通知信息", notes="根据url的id来指定更新对象,并根据传过来的dilNotice信息来更新详细信息")
  172. @ApiImplicitParams({
  173. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short"),
  174. @ApiImplicitParam(name = "dilNotice", value = "详细实体dilNotice", required = true, dataType = "DilNotice")
  175. })
  176. @PostMapping(value = "/updateNotice", produces = "application/json;charset=UTF-8")
  177. public RESTfulResult updateNotice( @RequestBody DilNotice dilNotice){
  178. int result = dilNoticeService.updateNotice(dilNotice);
  179. return success(result);
  180. }
  181. @PostMapping(value = "/updateNoticeStatus")
  182. public RESTfulResult updateNoticeStatus(@RequestBody(required = false) Map<String, Object> map){
  183. String userId = (String) map.get("userId");
  184. int noticeId= (int) map.get("noticeId");
  185. int result = dilNoticeService.updateNoticeStatus(userId,noticeId);
  186. return success(result);
  187. }
  188. @PostMapping(value = "/readAll")
  189. public RESTfulResult readAll(@RequestBody(required = false) Map<String, Object> map){
  190. int result = dilNoticeService.readAll(map);
  191. return success(result);
  192. }
  193. /**
  194. * 根据id删除通知信息
  195. * @param id
  196. * @return
  197. */
  198. @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
  199. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short")
  200. @PostMapping(value = "/deleteNotice/{id}")
  201. public RESTfulResult deleteNotice(@PathVariable("id") BigDecimal id){
  202. return success(dilNoticeService.deleteNotice(id));
  203. }
  204. /**
  205. * 根据userId获取用户名字
  206. * @param userId
  207. * @return
  208. */
  209. @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
  210. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short")
  211. @PostMapping(value = "/queryName/{userId}")
  212. public RESTfulResult queryName(@PathVariable("userId") String userId){
  213. return success(dilNoticeService.queryName(userId));
  214. }
  215. /**
  216. * 根据id获取通知信息
  217. * @param id
  218. * @return
  219. */
  220. @ApiOperation(value="获取通知详细信息", notes="根据url的id来获取详细信息")
  221. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  222. @PostMapping(value = "/getNoticeById/{id}")
  223. public RESTfulResult getNoticeById(@PathVariable("id") BigDecimal id){
  224. List<Map<String,Object>> list= dilNoticeService.getNoticeById(id);
  225. return success(list);
  226. }
  227. /**
  228. * 根据permissions获取最新通知信息
  229. * @param permissions
  230. * @return
  231. */
  232. @ApiOperation(value="获取通知详细信息", notes="根据url的id来获取详细信息")
  233. @ApiImplicitParam(paramType = "path", name = "permission", value = "permission", required = true, dataType = "String")
  234. @PostMapping(value = "/getNewNoticeByPermission/{permissions}")
  235. public RESTfulResult getNewNoticeByPermission(@PathVariable("permissions")String permissions){
  236. BigDecimal permission=new BigDecimal(permissions);
  237. List<Map<String,Object>> list= dilNoticeService.getNewNoticeByPermission(permission);
  238. return success(list);
  239. }
  240. @ApiOperation(value = "模糊查询通知信息", notes = "分页查询")
  241. @ApiImplicitParams({
  242. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  243. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  244. @ApiImplicitParam(name = "apiId", value = "196", required = false, dataType = "BigDecimal"),
  245. })
  246. @PostMapping(value = "/getNoticeResultList")
  247. public RESTfulResult getNoticeResultList(@RequestBody(required = false) Map<String, Object> mapValue,
  248. Integer apiId,
  249. Integer pageNum,
  250. Integer pageSize,
  251. String con) {
  252. if (mapValue==null){
  253. mapValue=new HashMap<>();
  254. }
  255. PageHelper.startPage(pageNum, pageSize);
  256. //分页查询数据
  257. List<Map<String, Object>> columnList = dilNoticeService.getNoticeList(mapValue);
  258. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
  259. return success(data);
  260. }
  261. /**
  262. * @author:zyf
  263. * @version:2.0
  264. * @Date:2022-10-14
  265. * @Description:获取通知数据
  266. */
  267. @ApiOperation(value = "查询通知信息", notes = "根据传过来的orgcode查询")
  268. @PostMapping(value = "/getNotice")
  269. public RESTfulResult getNotice(@RequestBody(required = false) Map<String, Object> mapValue){
  270. //String orgcode= (String) mapValue.get("orgcodezs");
  271. String userId="";
  272. if (mapValue!=null){
  273. userId=(String) mapValue.get("userId");
  274. }
  275. if ("".equals(userId)){
  276. return failed();
  277. }
  278. List<Map<String, Object>> noticeData = dilNoticeService.getNoticeData(userId);
  279. return success(noticeData);
  280. //return null;
  281. }
  282. /**
  283. * @author:zyf
  284. * @version:2.0
  285. * @Date:2022-10-14
  286. * @Description:获取通知数据
  287. */
  288. @ApiOperation(value = "查询通知信息", notes = "根据传过来的orgcode查询")
  289. @PostMapping(value = "/getNoticeAll")
  290. public RESTfulResult getNoticeAll(@RequestBody(required = false) Map<String, Object> mapValue){
  291. if (mapValue==null ||mapValue.get("userId")==null){
  292. return failed();
  293. }
  294. List<Map<String, Object>> noticeData = dilNoticeService.getNoticeAll(mapValue);
  295. return success(noticeData);
  296. }
  297. @ApiOperation(value = "模糊查询通知信息", notes = "分页查询")
  298. @ApiImplicitParams({
  299. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  300. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  301. @ApiImplicitParam(name = "apiId", value = "196", required = false, dataType = "BigDecimal"),
  302. })
  303. @PostMapping(value = "/getNoticeUser")
  304. public RESTfulResult getNoticeUser(@RequestBody(required = false) Map<String, Object> mapValue,
  305. @RequestParam("pageNum") Integer pageNum,
  306. @RequestParam("pageSize") Integer pageSize,
  307. @RequestParam("apiId") Integer apiId) {
  308. if (mapValue==null){
  309. mapValue=new HashMap<>();
  310. }
  311. PageHelper.startPage(pageNum, pageSize);
  312. //分页查询数据
  313. List<Map<String, Object>> columnList = dilNoticeService.getNoticeUser(mapValue);
  314. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
  315. return success(data);
  316. }
  317. /**
  318. * 查询所有日志
  319. * @param mapValue
  320. * @param pageNum
  321. * @param pageSize
  322. * @param apiId=522
  323. * @return
  324. */
  325. @PostMapping(value = "/selectAllLog")
  326. public RESTfulResult test(@RequestBody(required = false) Map<String, Object> mapValue,
  327. @RequestParam("pageNum") Integer pageNum,
  328. @RequestParam("pageSize") Integer pageSize,
  329. @RequestParam("apiId") Integer apiId) {
  330. PageHelper.startPage(pageNum, pageSize);
  331. List<Map<String, Object>> list = saleLogMapper.selectAllLog(mapValue);
  332. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, list);
  333. return success(data);
  334. }
  335. /**
  336. * TEST ADD LOG
  337. * @param mapValue
  338. * @return
  339. */
  340. @PostMapping(value = "/addSaleLog")
  341. public void test(@RequestBody(required = false) Map<String, Object> mapValue) {
  342. saleLogUtil.logOrder(new BigDecimal(1),"测试",mapValue,SaleLogUtil.INSERT);
  343. }
  344. }