DilNoticeController.java 13 KB

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