PmPurchaseExecutionController.java 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. package com.ozs.web.controller.pm;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.baomidou.mybatisplus.core.metadata.IPage;
  4. import com.ozs.base.domain.BaseAgency;
  5. import com.ozs.base.domain.BaseExpert;
  6. import com.ozs.base.service.BaseAgencyService;
  7. import com.ozs.base.service.BaseExpertService;
  8. import com.ozs.common.annotation.Log;
  9. import com.ozs.common.constant.ModularConstans;
  10. import com.ozs.common.core.controller.BaseController;
  11. import com.ozs.common.core.domain.AjaxResult;
  12. import com.ozs.common.enums.BusinessType;
  13. import com.ozs.common.enums.NameListType;
  14. import com.ozs.common.enums.PmProjectStatus;
  15. import com.ozs.common.enums.SysFileRefEnum;
  16. import com.ozs.common.utils.RandomUtil;
  17. import com.ozs.common.utils.StringUtils;
  18. import com.ozs.pm.doman.PmBidOpening;
  19. import com.ozs.pm.doman.PmBidWinning;
  20. import com.ozs.pm.doman.PmDemand;
  21. import com.ozs.pm.doman.PmDemandExpertRef;
  22. import com.ozs.pm.doman.vo.requestVo.*;
  23. import com.ozs.pm.doman.vo.responseVo.PmDemandResVo;
  24. import com.ozs.pm.service.IPmDemandService;
  25. import com.ozs.pm.service.PmBidOpeningService;
  26. import com.ozs.pm.service.PmBidWinningService;
  27. import com.ozs.pm.service.PmDemandExpertRefService;
  28. import com.ozs.system.domain.SysFileRef;
  29. import io.swagger.annotations.Api;
  30. import io.swagger.annotations.ApiOperation;
  31. import org.springframework.security.access.prepost.PreAuthorize;
  32. import org.springframework.util.ObjectUtils;
  33. import org.springframework.beans.factory.annotation.Autowired;
  34. import org.springframework.web.bind.annotation.*;
  35. import javax.validation.constraints.NotEmpty;
  36. import java.util.*;
  37. /**
  38. * 采购执行Controller
  39. *
  40. * @author ruoyi
  41. * @date 2023-01-16
  42. */
  43. @Api(tags = "采购执行")
  44. @RestController
  45. @RequestMapping("/pm/purchaseExecution")
  46. public class PmPurchaseExecutionController extends BaseController {
  47. @Autowired
  48. private IPmDemandService pmDemandService;
  49. @Autowired
  50. private BaseAgencyService baseAgencyService;
  51. @Autowired
  52. private BaseExpertService baseExpertService;
  53. @Autowired
  54. private PmDemandExpertRefService pmDemandExpertRefService;
  55. @Autowired
  56. private PmBidOpeningService pmBidOpeningService;
  57. /**
  58. * 采购执行查询列表
  59. */
  60. @ApiOperation(value = "采购执行查询列表", notes = "参数非必传")
  61. @PostMapping("/list")
  62. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:list')")
  63. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  64. public AjaxResult list(@RequestBody PmDemandReqVo pmDemandReqVo) {
  65. IPage<PmDemandResVo> page = pmDemandService.selectPmDemandList(pmDemandReqVo,3);
  66. return success(page);
  67. }
  68. /**
  69. * 查询代理机构列表
  70. */
  71. @ApiOperation(value = "查询代理机构列表", notes = "采购需求ID必传")
  72. @GetMapping("/getAgencyList")
  73. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getAgencyList')")
  74. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  75. public AjaxResult getAgencyList(@NotEmpty(message = "采购需求ID不能为空")
  76. @RequestParam(value = "demandId", required = true) Long demandId) {
  77. PmDemand pmDemand = pmDemandService.getById(demandId);
  78. if(ObjectUtils.isEmpty(pmDemand)){
  79. return error("参数错误");
  80. }
  81. LambdaQueryWrapper<BaseAgency> lw = new LambdaQueryWrapper<>();
  82. lw.eq(BaseAgency::getCompanyType,pmDemand.getProjectType());
  83. lw.eq(BaseAgency::getStatus,0);//白名单
  84. List<BaseAgency> agencyList = baseAgencyService.list(lw);
  85. return success(agencyList);
  86. }
  87. /**
  88. * 选取代理-选择填写招标代理机构信息
  89. */
  90. @ApiOperation(value = "选取代理-选择填写招标代理机构信息",notes = "采购需求ID和代理机构ID必传")
  91. @GetMapping("/selectAgency")
  92. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:selectAgency')")
  93. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.UPDATE)
  94. public AjaxResult selectAgency(@NotEmpty(message = "采购需求ID不能为空")
  95. @RequestParam(value = "demandId", required = true) Long demandId,
  96. @NotEmpty(message = "代理机构ID不能为空")
  97. @RequestParam(value = "agencyId", required = true) Long agencyId) {
  98. PmDemand pmDemand = pmDemandService.getById(demandId);
  99. if(ObjectUtils.isEmpty(pmDemand)){
  100. return error("参数错误");
  101. }
  102. BaseAgency baseAgency = baseAgencyService.getById(agencyId);
  103. if(ObjectUtils.isEmpty(baseAgency)){
  104. return error("参数错误");
  105. }
  106. PmDemand pmDemandUpdate = new PmDemand();
  107. pmDemandUpdate.setDemandId(demandId);
  108. pmDemandUpdate.setProjectStatus(PmProjectStatus.WAIT_UPLOAD_BID_FILE.getCode());
  109. pmDemandUpdate.setAgencyId(agencyId);
  110. pmDemandUpdate.setExtractAgencyTime(new Date());
  111. pmDemandUpdate.setUpdateTime(pmDemandUpdate.getExtractAgencyTime());
  112. pmDemandUpdate.setUpdateBy(getUserId().toString());
  113. return success(pmDemandService.updateById(pmDemandUpdate));
  114. }
  115. /**
  116. * 选取代理-抽取招标代理机构信息
  117. */
  118. @ApiOperation(value = "选取代理-抽取招标代理机构信息",notes = "采购需求ID必传")
  119. @GetMapping("/extractAgency")
  120. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:extractAgency')")
  121. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.UPDATE)
  122. public AjaxResult extractAgency(@NotEmpty(message = "采购需求id不能为空")
  123. @RequestParam(value = "demandId", required = true) Long demandId) {
  124. PmDemand pmDemand = pmDemandService.getById(demandId);
  125. if(ObjectUtils.isEmpty(pmDemand)){
  126. return error("参数错误");
  127. }
  128. LambdaQueryWrapper<BaseAgency> lw = new LambdaQueryWrapper<>();
  129. lw.eq(BaseAgency::getCompanyType,pmDemand.getProjectType());
  130. lw.eq(BaseAgency::getStatus,0); //白名单
  131. List<BaseAgency> baseAgencyList = baseAgencyService.list(lw);
  132. if (ObjectUtils.isEmpty(baseAgencyList)){
  133. return error("没有符合的招标代理机构,抽取失败!");
  134. }
  135. BaseAgency any = (BaseAgency)(RandomUtil.getRandomList(baseAgencyList,1).get(0));
  136. PmDemand pmDemandUpdate = new PmDemand();
  137. pmDemandUpdate.setDemandId(demandId);
  138. pmDemandUpdate.setProjectStatus(PmProjectStatus.WAIT_UPLOAD_BID_FILE.getCode());
  139. pmDemandUpdate.setAgencyId(any.getId());
  140. pmDemandUpdate.setExtractAgencyTime(new Date());
  141. pmDemandUpdate.setUpdateTime(pmDemandUpdate.getExtractAgencyTime());
  142. pmDemandUpdate.setUpdateBy(getUserId().toString());
  143. return success(pmDemandService.updateById(pmDemandUpdate));
  144. }
  145. @ApiOperation(value = "上传招标文件",notes = "采购需求ID和上传附件必传")
  146. @PostMapping("/uploadBidFile")
  147. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:uploadBidFile')")
  148. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.IMPORT)
  149. public AjaxResult uploadBidFile(@NotEmpty(message = "数据为空") @RequestBody PmPurchaseExecutionReqVo pmPurchaseExecutionReqVo) {
  150. Long demandId = pmPurchaseExecutionReqVo.getDemandId();
  151. if(ObjectUtils.isEmpty(demandId)){
  152. return error("参数错误");
  153. }
  154. PmDemand pmDemand = pmDemandService.getById(demandId);
  155. if(ObjectUtils.isEmpty(pmDemand)){
  156. return error("参数错误");
  157. }
  158. List<SysFileRef> sysFileRefs = pmPurchaseExecutionReqVo.getSysFileRefs();
  159. if(ObjectUtils.isEmpty(sysFileRefs)){
  160. return error("参数错误");
  161. }
  162. if (pmDemandService.uploadFile(demandId, SysFileRefEnum.PM_BID_FILE.getType(),sysFileRefs,getUserId().toString())) {
  163. PmDemand pmDemandUpdate = new PmDemand();
  164. pmDemandUpdate.setDemandId(demandId);
  165. pmDemandUpdate.setProjectStatus(PmProjectStatus.WAIT_ANNOUNCEMENT.getCode());
  166. pmDemandUpdate.setUpdateTime(new Date());
  167. pmDemandUpdate.setUpdateBy(getUserId().toString());
  168. return success(pmDemandService.updateById(pmDemandUpdate));
  169. } else {
  170. return error("保存上传附件失败");
  171. }
  172. }
  173. @ApiOperation(value = "发布公告")
  174. @PostMapping("/insertPmReleaseAnnouncement")
  175. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:insertPmReleaseAnnouncement')")
  176. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.INSERT)
  177. public AjaxResult insertPmReleaseAnnouncement(@NotEmpty(message = "数据为空")
  178. @RequestBody PmReleaseAnnouncementReqVo pmReleaseAnnouncementReqVo) {
  179. try {
  180. Long demandId = pmReleaseAnnouncementReqVo.getDemandId();
  181. if(ObjectUtils.isEmpty(demandId)){
  182. return error("参数错误");
  183. }
  184. pmReleaseAnnouncementReqVo.setCreateBy(getUserId().toString());
  185. pmReleaseAnnouncementReqVo.setCreateTime(new Date());
  186. pmReleaseAnnouncementReqVo.setUpdateBy(pmReleaseAnnouncementReqVo.getCreateBy());
  187. pmReleaseAnnouncementReqVo.setUpdateTime(pmReleaseAnnouncementReqVo.getCreateTime());
  188. return toAjax(pmDemandService.insertPmReleaseAnnouncement(pmReleaseAnnouncementReqVo));
  189. } catch (Exception e) {
  190. return error(e.getMessage());
  191. }
  192. }
  193. @ApiOperation(value = "获取专家身份证号列表")
  194. @GetMapping("/getExpertIdNumberList")
  195. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getExpertIdNumberList')")
  196. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  197. public AjaxResult getExpertIdNumberList(@NotEmpty(message = "采购需求id不能为空")
  198. @RequestParam(value = "demandId", required = true) Long demandId) {
  199. PmDemand pmDemand = pmDemandService.getById(demandId);
  200. if(ObjectUtils.isEmpty(pmDemand)){
  201. return error("参数错误");
  202. }
  203. LambdaQueryWrapper<BaseExpert> lw = new LambdaQueryWrapper<BaseExpert>();
  204. lw.eq(BaseExpert::getVarietyPurchase,pmDemand.getProjectType())
  205. .eq(BaseExpert::getStatus,NameListType.WHITE.getCode());
  206. List<BaseExpert> baseExpertList = baseExpertService.list(lw);
  207. List<String> idNumberList = new ArrayList<>();
  208. if (!ObjectUtils.isEmpty(baseExpertList)) {
  209. for(BaseExpert baseExpert :baseExpertList ){
  210. idNumberList.add(baseExpert.getIdNumber());
  211. }
  212. }
  213. return success(idNumberList);
  214. }
  215. @ApiOperation(value = "根据身份证号查询专家", notes = "必传 查询条件:身份证号")
  216. @GetMapping("/findExpertWithIdNumber")
  217. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:findExpertWithIdNumber')")
  218. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  219. public AjaxResult findExpertWithIdNumber(@NotEmpty(message = "采购需求id不能为空")
  220. @RequestParam(value = "demandId", required = true) Long demandId,
  221. @NotEmpty(message = "身份证号不能为空")
  222. @RequestParam(value = "idNumber", required = true) String idNumber) {
  223. PmDemand pmDemand = pmDemandService.getById(demandId);
  224. if(ObjectUtils.isEmpty(pmDemand)){
  225. return error("参数错误");
  226. }
  227. LambdaQueryWrapper<BaseExpert> lw = new LambdaQueryWrapper<>();
  228. lw.eq(BaseExpert::getIdNumber,idNumber);
  229. BaseExpert baseExpert = baseExpertService.getOne(lw);
  230. if(baseExpert != null){
  231. if(NameListType.BLACK.getCode().equals(baseExpert.getStatus())){
  232. return error("该专家属于黑名单");
  233. }
  234. if(!ObjectUtils.isEmpty(pmDemand.getProjectType()) && !pmDemand.getProjectType().equals(baseExpert.getVarietyPurchase())){
  235. return error("该专家所属采购品种和项目类型不匹配");
  236. }
  237. }
  238. return success(baseExpert);
  239. }
  240. @ApiOperation(value = "填写专家信息批量提交", notes = "必传 采购需求ID和专家信息列表,注意:若该专家已经在库里存在,需要传专家对象BaseExpert的ID")
  241. @PostMapping("/insertExpertBatch")
  242. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:insertExpertBatch')")
  243. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.INSERT)
  244. public AjaxResult insertExpertBatch(@NotEmpty(message = "参数不能为空") @RequestBody PmBaseExpertFillReqVo pmBaseExpertFillReqVo) {
  245. try {
  246. if (ObjectUtils.isEmpty(pmBaseExpertFillReqVo)
  247. || ObjectUtils.isEmpty(pmBaseExpertFillReqVo.getDemandId())
  248. || ObjectUtils.isEmpty(pmBaseExpertFillReqVo.getAccessTime())
  249. || ObjectUtils.isEmpty(pmBaseExpertFillReqVo.getBaseExpertList())) {
  250. return error("参数错误");
  251. }
  252. pmBaseExpertFillReqVo.setCreateBy(getUserId().toString());
  253. pmBaseExpertFillReqVo.setUpdateBy(pmBaseExpertFillReqVo.getCreateBy());
  254. return toAjax(pmDemandService.insertExpertBatch(pmBaseExpertFillReqVo));
  255. } catch (Exception e) {
  256. return error(e.getMessage());
  257. }
  258. }
  259. @ApiOperation(value = "获取回避单位下拉列表")
  260. @GetMapping("/getExpertUnitList")
  261. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getExpertUnitList')")
  262. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  263. public AjaxResult getExpertUnitList() {
  264. List<BaseExpert> baseExperts = baseExpertService.list();
  265. if(ObjectUtils.isEmpty(baseExperts)){
  266. return error("专家列表是空的");
  267. }
  268. Set<String> set = new HashSet<>();
  269. for(BaseExpert baseExpert : baseExperts) {
  270. set.add(baseExpert.getUnitInformation());
  271. }
  272. return success(set);
  273. }
  274. /**
  275. * 抽取专家
  276. */
  277. @ApiOperation(value = "抽取专家",notes = "采购需求ID必传")
  278. @PostMapping("/extractExpertBatch")
  279. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:extractExpertBatch')")
  280. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.UPDATE)
  281. public AjaxResult extractExpertBatch(@NotEmpty(message = "参数不能为空")
  282. @RequestBody PmBaseExpertExtractReqVo pmBaseExpertExtractReqVo) {
  283. try {
  284. if (ObjectUtils.isEmpty(pmBaseExpertExtractReqVo)
  285. || ObjectUtils.isEmpty(pmBaseExpertExtractReqVo.getDemandId())
  286. || ObjectUtils.isEmpty(pmBaseExpertExtractReqVo.getAccessTime())) {
  287. return error("参数错误");
  288. }
  289. return toAjax(pmDemandService.extractExpertBatch(pmBaseExpertExtractReqVo));
  290. } catch (Exception e) {
  291. return error(e.getMessage());
  292. }
  293. }
  294. @ApiOperation(value = "填写开标信息",notes = "采购需求ID必传")
  295. @PostMapping("/insertBidOpeningBatch")
  296. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:insertBidOpeningBatch')")
  297. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.INSERT)
  298. public AjaxResult insertBidOpeningBatch(@NotEmpty(message = "数据为空")
  299. @RequestBody PmBidOpeningFillReqVo pmBidOpeningFillReqVo) {
  300. try {
  301. if (ObjectUtils.isEmpty(pmBidOpeningFillReqVo)
  302. || ObjectUtils.isEmpty(pmBidOpeningFillReqVo.getDemandId())
  303. || ObjectUtils.isEmpty(pmBidOpeningFillReqVo.getPmBidOpeningList())) {
  304. return error("参数错误");
  305. }
  306. pmBidOpeningFillReqVo.setCreateBy(getUserId().toString());
  307. pmBidOpeningFillReqVo.setUpdateBy(getUserId().toString());
  308. return toAjax(pmDemandService.insertBidOpeningBatch(pmBidOpeningFillReqVo));
  309. } catch (Exception e) {
  310. return error(e.getMessage());
  311. }
  312. }
  313. /**
  314. * 中标基本情况填制-开标信息下拉列表
  315. */
  316. @ApiOperation(value = "中标基本情况填制-开标信息下拉列表", notes = "必传选需求ID")
  317. @GetMapping("/getPullDownBidOpeningList")
  318. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getPullDownBidOpeningList')")
  319. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  320. public AjaxResult getPullDownBidOpeningList(@NotEmpty(message = "需求ID不能为空")
  321. @RequestParam(value = "demandId", required = true) Long demandId) {
  322. LambdaQueryWrapper<PmBidOpening> pmBidOpeningLambdaQueryWrapper = new LambdaQueryWrapper<>();
  323. pmBidOpeningLambdaQueryWrapper.eq(PmBidOpening::getDemandId,demandId)
  324. .orderByDesc(PmBidOpening::getScore)
  325. ;
  326. List<PmBidOpening> pmBidOpeningList = pmBidOpeningService.list(pmBidOpeningLambdaQueryWrapper);
  327. return success(pmBidOpeningList);
  328. }
  329. @ApiOperation(value = "中标基本情况填制-中标情况填制提交",notes = "采购需求ID必传")
  330. @PostMapping("/insertPmBidWinning")
  331. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:insertPmBidWinning')")
  332. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.INSERT)
  333. public AjaxResult insertPmBidWinning(@NotEmpty(message = "数据为空")
  334. @RequestBody PmBidWinningReqVo pmBidWinningReqVo) {
  335. try {
  336. Long demandId = pmBidWinningReqVo.getDemandId();
  337. if(ObjectUtils.isEmpty(demandId)){
  338. return error("采购需求ID不能为空");
  339. }
  340. pmBidWinningReqVo.setCreateBy(getUserId().toString());
  341. pmBidWinningReqVo.setCreateTime(new Date());
  342. pmBidWinningReqVo.setUpdateBy(pmBidWinningReqVo.getCreateBy());
  343. pmBidWinningReqVo.setUpdateTime(pmBidWinningReqVo.getCreateTime());
  344. return toAjax(pmDemandService.insertPmBidWinning(pmBidWinningReqVo));
  345. } catch (Exception e) {
  346. return error(e.getMessage());
  347. }
  348. }
  349. @ApiOperation(value = "中标基本情况填制-更换中标人提交",notes = "采购需求ID必传")
  350. @PostMapping("/updatePmBidWinning")
  351. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:updatePmBidWinning')")
  352. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.UPDATE)
  353. public AjaxResult updatePmBidWinning(@NotEmpty(message = "数据为空")
  354. @RequestBody PmBidWinningReqVo pmBidWinningReqVo) {
  355. try {
  356. Long demandId = pmBidWinningReqVo.getDemandId();
  357. if(ObjectUtils.isEmpty(demandId)){
  358. return error("采购需求ID不能为空");
  359. }
  360. pmBidWinningReqVo.setUpdateBy(getUserId().toString());
  361. pmBidWinningReqVo.setUpdateTime(new Date());
  362. return toAjax(pmDemandService.updatePmBidWinning(pmBidWinningReqVo));
  363. } catch (Exception e) {
  364. return error(e.getMessage());
  365. }
  366. }
  367. @ApiOperation(value = "流标情况填制",notes = "采购需求ID必传")
  368. @PostMapping("/insertPmBidFailure")
  369. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:insertPmBidFailure')")
  370. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.INSERT)
  371. public AjaxResult insertPmBidFailure(@NotEmpty(message = "数据为空")
  372. @RequestBody PmBidFailureReqVo pmBidFailureReqVo) {
  373. try {
  374. Long demandId = pmBidFailureReqVo.getDemandId();
  375. if(ObjectUtils.isEmpty(demandId)){
  376. return error("参数错误");
  377. }
  378. pmBidFailureReqVo.setCreateBy(getUserId().toString());
  379. pmBidFailureReqVo.setCreateTime(new Date());
  380. pmBidFailureReqVo.setUpdateBy(pmBidFailureReqVo.getCreateBy());
  381. pmBidFailureReqVo.setUpdateTime(pmBidFailureReqVo.getCreateTime());
  382. return toAjax(pmDemandService.insertPmBidFailure(pmBidFailureReqVo));
  383. } catch (Exception e) {
  384. return error(e.getMessage());
  385. }
  386. }
  387. @ApiOperation(value = "质疑处理",notes = "采购需求ID必传")
  388. @PostMapping("/handleCallQuestion")
  389. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:handleCallQuestion')")
  390. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.UPDATE)
  391. public AjaxResult handleCallQuestion(@NotEmpty(message = "数据为空")
  392. @RequestBody PmCallQuestionReqVo pmCallQuestionReqVo) {
  393. try {
  394. Long demandId = pmCallQuestionReqVo.getDemandId();
  395. if(ObjectUtils.isEmpty(demandId)){
  396. return error("参数错误");
  397. }
  398. PmDemand pmDemand = pmDemandService.getById(demandId);
  399. if(ObjectUtils.isEmpty(pmDemand)){
  400. return error("参数错误");
  401. }
  402. List<SysFileRef> sysFileRefs = pmCallQuestionReqVo.getSysFileRefs();
  403. pmDemandService.uploadFile(demandId, SysFileRefEnum.PM_BID_CALL_QEUSTION_FILE.getType(),sysFileRefs,getUserId().toString());
  404. pmDemand.setCallQuestion(pmCallQuestionReqVo.getCallQuestion());
  405. pmDemand.setUpdateBy(getUserId().toString());
  406. pmDemand.setUpdateTime(new Date());
  407. return toAjax(pmDemandService.updateById(pmDemand));
  408. } catch (Exception e) {
  409. return error(e.getMessage());
  410. }
  411. }
  412. @ApiOperation(value = "上传中标通知书",notes = "采购需求ID和上传附件必传")
  413. @PostMapping("/uploadBidWinningNotification")
  414. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:uploadBidWinningNotification')")
  415. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.IMPORT)
  416. public AjaxResult uploadBidWinningNotification(@NotEmpty(message = "数据为空") @RequestBody PmPurchaseExecutionReqVo pmPurchaseExecutionReqVo) {
  417. Long demandId = pmPurchaseExecutionReqVo.getDemandId();
  418. if(ObjectUtils.isEmpty(demandId)){
  419. return error("参数错误");
  420. }
  421. PmDemand pmDemand = pmDemandService.getById(demandId);
  422. if(ObjectUtils.isEmpty(pmDemand)){
  423. return error("参数错误");
  424. }
  425. List<SysFileRef> sysFileRefs = pmPurchaseExecutionReqVo.getSysFileRefs();
  426. if(ObjectUtils.isEmpty(sysFileRefs)){
  427. return error("参数错误");
  428. }
  429. if (pmDemandService.uploadFile(demandId, SysFileRefEnum.PM_BID_WINNING_NOTIFICATION.getType(),sysFileRefs,getUserId().toString())) {
  430. PmDemand pmDemandUpdate = new PmDemand();
  431. pmDemandUpdate.setDemandId(demandId);
  432. pmDemandUpdate.setProjectStatus(PmProjectStatus.CONTRACT_WAIT_FILL.getCode());
  433. pmDemandUpdate.setUpdateTime(new Date());
  434. pmDemandUpdate.setUpdateBy(getUserId().toString());
  435. return success(pmDemandService.updateById(pmDemandUpdate));
  436. } else {
  437. return error("保存上传附件失败");
  438. }
  439. }
  440. /**
  441. * 查看详情
  442. */
  443. @ApiOperation(value = "查看详情", notes = "必传demandId和详情类型(1项目计划,2需求建档,3任务下达,4中标信息,5合同信息,6建设情况),其他字段不传")
  444. @PostMapping("/view")
  445. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:view')")
  446. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  447. public AjaxResult view(@RequestBody PmDemandReqVo pmDemandReqVo) {
  448. if(pmDemandReqVo.getDemandId() == null){
  449. return AjaxResult.error("demandId不能为空");
  450. }
  451. if(StringUtils.isEmpty(pmDemandReqVo.getDetailType())){
  452. return AjaxResult.error("详情的类型不能为空");
  453. }
  454. return success(pmDemandService.selectPmDemandByDemandId(pmDemandReqVo.getDemandId(),pmDemandReqVo.getDetailType()));
  455. }
  456. /**
  457. * 专家信息查看详情列表
  458. */
  459. @ApiOperation(value = "专家信息查看详情列表", notes = "必传需求ID和选取时间(yyyy-MM-dd)")
  460. @GetMapping("/getBaseExpertList")
  461. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getBaseExpertList')")
  462. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  463. public AjaxResult getBaseExpertList(@NotEmpty(message = "需求ID不能为空")
  464. @RequestParam(value = "demandId", required = true) Long demandId,
  465. @NotEmpty(message = "选取时间不能为空")
  466. @RequestParam(value = "accessTime", required = true) String accessTime) {
  467. LambdaQueryWrapper<PmDemandExpertRef> pmDemandExpertRefLambdaQueryWrapper = new LambdaQueryWrapper<>();
  468. pmDemandExpertRefLambdaQueryWrapper.eq(PmDemandExpertRef::getDemandId,demandId);
  469. pmDemandExpertRefLambdaQueryWrapper.eq(PmDemandExpertRef::getAccessTime,accessTime);
  470. List<PmDemandExpertRef> pmDemandExpertRefList = pmDemandExpertRefService.list(pmDemandExpertRefLambdaQueryWrapper);
  471. List<BaseExpert> list = new ArrayList<>();
  472. if(!ObjectUtils.isEmpty(pmDemandExpertRefList)) {
  473. for(PmDemandExpertRef pmDemandExpertRef : pmDemandExpertRefList) {
  474. BaseExpert baseExpert = baseExpertService.getById(pmDemandExpertRef.getExpertId());
  475. if(baseExpert != null){
  476. list.add(baseExpert);
  477. }
  478. }
  479. }
  480. return success(list);
  481. }
  482. /**
  483. * 开标信息查看详情列表
  484. */
  485. @ApiOperation(value = "开标信息查看详情列表", notes = "必传选需求ID和开标时间(yyyy-MM-dd)")
  486. @GetMapping("/getBidOpeningList")
  487. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getBidOpeningList')")
  488. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  489. public AjaxResult getBidOpeningList(@NotEmpty(message = "需求ID不能为空")
  490. @RequestParam(value = "demandId", required = true) Long demandId,
  491. @NotEmpty(message = "开标时间不能为空")
  492. @RequestParam(value = "openBidTime", required = true) String openBidTime) {
  493. LambdaQueryWrapper<PmBidOpening> pmBidOpeningLambdaQueryWrapper = new LambdaQueryWrapper<>();
  494. pmBidOpeningLambdaQueryWrapper.eq(PmBidOpening::getDemandId,demandId)
  495. .eq(PmBidOpening::getOpenBidTime,openBidTime).orderByDesc(PmBidOpening::getScore)
  496. ;
  497. List<PmBidOpening> pmBidOpeningList = pmBidOpeningService.list(pmBidOpeningLambdaQueryWrapper);
  498. return success(pmBidOpeningList);
  499. }
  500. }