GroupSopController.java 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. package com.persagy.fm.sop.controller;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  4. import com.persagy.common.exception.BusinessException;
  5. import com.persagy.fm.common.old.utils.StringUtil;
  6. import com.persagy.fm.common.old.utils.ToolsUtil;
  7. import com.persagy.fm.common.validator.Insert;
  8. import com.persagy.fm.common.validator.Update;
  9. import com.persagy.fm.sop.model.dto.RefedSopBean;
  10. import com.persagy.fm.sop.model.dto.SopBean;
  11. import com.persagy.fm.sop.model.vo.*;
  12. import com.persagy.fm.sop.service.IGroupSopService;
  13. import com.persagy.fm.sop.utils.OldResponseResult;
  14. import com.persagy.fm.sop.utils.OldResponseResultUtil;
  15. import com.persagy.fm.sop.service.IObjectService;
  16. import io.swagger.annotations.Api;
  17. import io.swagger.annotations.ApiOperation;
  18. import lombok.RequiredArgsConstructor;
  19. import lombok.extern.slf4j.Slf4j;
  20. import org.springframework.transaction.annotation.Transactional;
  21. import org.springframework.validation.annotation.Validated;
  22. import org.springframework.web.bind.annotation.PostMapping;
  23. import org.springframework.web.bind.annotation.RequestBody;
  24. import org.springframework.web.bind.annotation.RequestMapping;
  25. import org.springframework.web.bind.annotation.RestController;
  26. import java.util.ArrayList;
  27. /**
  28. * 集团SOP业务
  29. * @author lijie
  30. * @since 2021-03-31 18:08:21
  31. */
  32. @Slf4j
  33. @RequiredArgsConstructor
  34. @RestController
  35. @RequestMapping("/restGroupSopService/")
  36. @Api("集团SOP业务")
  37. public class GroupSopController {
  38. private final IGroupSopService groupSopService;
  39. private final IObjectService objectService;
  40. /**
  41. * Description: 集团sop-新增页-添加发布状态sop
  42. * @param saveSopVo : 请求参数
  43. * @return : java.lang.String
  44. * @author : lijie
  45. * @date :2021/3/31 20:46
  46. * Update By lijie 2021/3/31 20:46
  47. */
  48. @ApiOperation("集团sop-新增页-添加发布状态sop")
  49. @PostMapping("addPublishedSop")
  50. @Transactional(rollbackFor = BusinessException.class)
  51. public OldResponseResult<Void> addPublishedSop(@RequestBody @Validated(Insert.class) SaveSopVo saveSopVo) throws Exception {
  52. groupSopService.addPublishedSop(saveSopVo);
  53. return OldResponseResultUtil.successResult(new ArrayList<>());
  54. }
  55. /***
  56. * Description: 集团sop-编辑页-编辑sop时验证sop名称
  57. * @param queryVerifySopNameBaseVo : 请求参数
  58. * @return : java.lang.String
  59. * @author : lijie
  60. * @date :2021/4/2 11:51
  61. * Update By lijie 2021/4/2 11:51
  62. */
  63. @ApiOperation("集团sop-编辑页-编辑sop时验证sop名称")
  64. @PostMapping("verifySopNameForUpdate")
  65. public OldResponseResult<VerifySopNameVo> verifySopNameForUpdate(
  66. @RequestBody @Validated(Update.class) QueryVerifySopNameBaseVo queryVerifySopNameBaseVo) throws Exception{
  67. return OldResponseResultUtil.successResult(groupSopService.verifySopNameForUpdate(queryVerifySopNameBaseVo));
  68. }
  69. /***
  70. * Description: 新增页:查询可供选择的sop,复制、引用时用
  71. * @param queryVerifySopNameBaseVo : 请求参数
  72. * @return : java.lang.String
  73. * @author : lijie
  74. * @date :2021/4/2 14:13
  75. * Update By lijie 2021/4/2 14:13
  76. */
  77. @ApiOperation("新增页:查询可供选择的sop,复制、引用时用")
  78. @PostMapping("verifySopNameForAdd")
  79. public OldResponseResult<VerifySopNameVo> verifySopNameForAdd(
  80. @RequestBody @Validated(Insert.class) QueryVerifySopNameBaseVo queryVerifySopNameBaseVo) throws Exception{
  81. return OldResponseResultUtil.successResult(groupSopService.verifySopNameForAdd(queryVerifySopNameBaseVo));
  82. }
  83. /***
  84. * Description: 集团sop-新增页-添加草稿状态sop
  85. * @param saveSopVo : 保存SOP的参数
  86. * @return : com.persagy.fm.sop.utils.OldResponseResult<com.persagy.fm.sop.model.vo.QuerySopVo>
  87. * @author : lijie
  88. * @date :2021/4/2 14:30
  89. * Update By lijie 2021/4/2 14:30
  90. */
  91. @ApiOperation("集团sop-新增页-添加草稿状态sop")
  92. @PostMapping("/addDraftSop")
  93. @Transactional(rollbackFor = BusinessException.class)
  94. public OldResponseResult<QuerySopVo> addDraftSop(@RequestBody @Validated SaveSopVo saveSopVo) throws Exception{
  95. return OldResponseResultUtil.successResult(groupSopService.addDraftSop(saveSopVo));
  96. }
  97. /***
  98. * Description: 集团sop-编辑页-发布sop
  99. * @param saveSopVo : 更新的SOP的参数
  100. * @return : com.persagy.fm.sop.utils.OldResponseResult<com.persagy.fm.sop.model.vo.QuerySopVo>
  101. * @author : lijie
  102. * @date :2021/4/8 14:05
  103. * Update By lijie 2021/4/8 14:05
  104. */
  105. @ApiOperation("集团sop-编辑页-发布sop")
  106. @Transactional(rollbackFor = BusinessException.class)
  107. @PostMapping("/publishSop")
  108. public OldResponseResult<QuerySopVo> publishSop(@RequestBody @Validated(Update.class) SaveSopVo saveSopVo) throws Exception {
  109. return OldResponseResultUtil.successResult(groupSopService.publishSop(saveSopVo));
  110. }
  111. /***
  112. * Description: 集团sop-编辑页-保存草稿状态sop
  113. * @param saveSopVo : 保存SOP的参数
  114. * @return : com.persagy.fm.sop.utils.OldResponseResult<com.persagy.fm.sop.model.vo.QuerySopVo>
  115. * @author : lijie
  116. * @date :2021/4/8 17:24
  117. * Update By lijie 2021/4/8 17:24
  118. */
  119. @ApiOperation("集团sop-编辑页-保存草稿状态sop")
  120. @Transactional
  121. @PostMapping("/saveDraftSop")
  122. public OldResponseResult<QuerySopVo> saveDraftSop(@RequestBody @Validated SaveSopVo saveSopVo) throws Exception {
  123. return OldResponseResultUtil.successResult(groupSopService.saveDraftSop(saveSopVo));
  124. }
  125. /***
  126. * Description: 集团sop-新增页-验证sop
  127. * @param saveSopVo : 请求参数
  128. * @return : java.lang.String
  129. * @author : lijie
  130. * @date :2021/4/2 15:28
  131. * Update By lijie 2021/4/2 15:28
  132. */
  133. @ApiOperation("集团sop-新增页-验证sop")
  134. @PostMapping("/verifySopBeforePublish")
  135. public OldResponseResult<String> verifySopBeforePublish(@RequestBody @Validated SaveSopVo saveSopVo) throws Exception{
  136. return OldResponseResultUtil.successResult(groupSopService.verifySopBeforePublish(saveSopVo));
  137. }
  138. /***
  139. * Description: 集团sop-列表页:查询已发布的sop列表
  140. * @param queryPublishedListVo : 请求参数
  141. * @return : java.lang.String
  142. * @author : lijie
  143. * @date :2021/4/10 15:56
  144. * Update By lijie 2021/4/10 15:56
  145. */
  146. @ApiOperation("集团sop-查询已发布的sop列表 ")
  147. @PostMapping("/queryPublishedSopList")
  148. public OldResponseResult<PublishedListVo> queryPublishedSopList(@RequestBody @Validated QueryPublishedListVo queryPublishedListVo) throws Exception {
  149. return OldResponseResultUtil.successResult(groupSopService.queryPublishedSopList(queryPublishedListVo));
  150. }
  151. /***
  152. * Description: 集团sop-列表页 查询编辑中的sop列表
  153. * @param queryPublishedListBaseVo : 请求参数
  154. * @return : java.lang.String
  155. * @author : lijie
  156. * @date :2021/4/10 18:22
  157. * Update By lijie 2021/4/10 18:22
  158. */
  159. @ApiOperation("集团sop-列表页 查询编辑中的sop列表")
  160. @PostMapping("/queryEditingSopList")
  161. @JsonIgnoreProperties({"project_id", "extend_field", "operator_id",
  162. "operator_name", "sop_type","no_obj",
  163. "related_data", "sop_status", "publish_status",
  164. "version_count", "version_explain", "create_time",
  165. "valid", "domains", "order_type", "tools",
  166. "fit_objs", "equip_model_ids", "labels",
  167. "steps", "step_count", "stauts_explain"})
  168. public OldResponseResult<SopBean> queryEditingSopList(@RequestBody @Validated QueryPublishedListBaseVo queryPublishedListBaseVo) throws Exception {
  169. return OldResponseResultUtil.successResult(groupSopService.queryEditingSopList(queryPublishedListBaseVo));
  170. }
  171. /***
  172. * Description: 集团sop-列表页 查询已作废中的sop列表
  173. * @param queryPublishedListBaseVo : 请求参数
  174. * @return : java.lang.String
  175. * @author : lijie
  176. * @date :2021/4/10 18:37
  177. * Update By lijie 2021/4/10 18:37
  178. */
  179. @PostMapping("/queryDestroyedSopList")
  180. @JsonIgnoreProperties({"project_id", "extend_field", "operator_id",
  181. "operator_name", "sop_type","no_obj",
  182. "related_data", "sop_status", "publish_status",
  183. "version_count", "version_explain", "create_time",
  184. "valid", "domains", "order_type", "tools",
  185. "fit_objs", "equip_model_ids", "labels",
  186. "steps", "step_count", "stauts_explain"})
  187. public OldResponseResult<SopBean> queryDestroyedSopList(@RequestBody @Validated QueryPublishedListBaseVo queryPublishedListBaseVo) throws Exception {
  188. return OldResponseResultUtil.successResult(groupSopService.queryDestroyedSopList(queryPublishedListBaseVo));
  189. }
  190. /***
  191. * Description: 新增页:查询可供选择的sop,复制、引用时用
  192. * @param queryPublishedSelVo : 请求参数
  193. * @return : java.lang.String
  194. * @author : lijie
  195. * @date :2021/4/14 12:23
  196. * Update By lijie 2021/4/14 12:23
  197. */
  198. @ApiOperation("新增页:查询可供选择的sop,复制、引用时用")
  199. @PostMapping("/querySopListForSel")
  200. public OldResponseResult<PublishedListVo> querySopListForSel(@RequestBody @Validated QueryPublishedSelVo queryPublishedSelVo) throws Exception {
  201. return OldResponseResultUtil.successResult(groupSopService.querySopListForSel(queryPublishedSelVo));
  202. }
  203. /***
  204. * Description: 详细页-查询当前sop被引用的sop列表
  205. * @param queryReferencedSopVo : 请求参数
  206. * @return : java.lang.String
  207. * @author : lijie
  208. * @date :2021/4/19 10:46
  209. * Update By lijie 2021/4/19 10:46
  210. */
  211. @PostMapping("/queryReferencedSopListById")
  212. public OldResponseResult<RefedSopBean> queryReferencedSopListById(@RequestBody @Validated QueryReferencedSopVo queryReferencedSopVo) throws Exception {
  213. return OldResponseResultUtil.successResult(groupSopService.queryReferencedSopListById(queryReferencedSopVo));
  214. }
  215. /***
  216. * Description: 集团sop-新增页-对象选择:搜索物理世界对象大类
  217. * @param jsonObject : 请求参数
  218. * @return : java.lang.String
  219. * @author : lijie
  220. * @date :2021/4/19 11:54
  221. * Update By lijie 2021/4/19 11:54
  222. */
  223. @PostMapping("/searchObjectClass")
  224. public String searchObjectClass(@RequestBody JSONObject jsonObject) throws Exception {
  225. if(StringUtil.isNull(jsonObject, "user_id") ){
  226. return ToolsUtil.return_error_json;
  227. }
  228. return objectService.searchObjectClass(jsonObject.toJSONString());
  229. }
  230. /***
  231. * Description: 集团sop-新增页-信息点选择:搜索对象大类信息点
  232. * @param jsonObject : 请求参数
  233. * @return : java.lang.String
  234. * @author : lijie
  235. * @date :2021/4/19 12:00
  236. * Update By lijie 2021/4/19 12:00
  237. */
  238. @PostMapping("/searchClassInfoPoint")
  239. public String searchClassInfoPoint(@RequestBody JSONObject jsonObject) throws Exception {
  240. if(StringUtil.isNull(jsonObject, "user_id") ){
  241. return ToolsUtil.return_error_json;
  242. }
  243. return objectService.searchClassInfoPoint(jsonObject.toJSONString());
  244. }
  245. }