PmPurchaseExecutionController.java 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941
  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.domain.BaseProfessional;
  7. import com.ozs.base.domain.BaseUnitInformation;
  8. import com.ozs.base.domain.vo.BaseExpertVo;
  9. import com.ozs.base.domain.vo.BaseProfessionalVo;
  10. import com.ozs.base.service.BaseAgencyService;
  11. import com.ozs.base.service.BaseExpertService;
  12. import com.ozs.base.service.BaseProfessionalService;
  13. import com.ozs.common.annotation.Log;
  14. import com.ozs.common.constant.ModularConstans;
  15. import com.ozs.common.core.controller.BaseController;
  16. import com.ozs.common.core.domain.AjaxResult;
  17. import com.ozs.common.core.domain.entity.SysUser;
  18. import com.ozs.common.enums.*;
  19. import com.ozs.common.utils.RandomUtil;
  20. import com.ozs.common.utils.StringUtils;
  21. import com.ozs.pm.doman.*;
  22. import com.ozs.pm.doman.vo.requestVo.*;
  23. import com.ozs.pm.doman.vo.responseVo.PmDemandResVo;
  24. import com.ozs.pm.service.*;
  25. import com.ozs.system.domain.SysFileRef;
  26. import io.swagger.annotations.Api;
  27. import io.swagger.annotations.ApiOperation;
  28. import org.springframework.beans.BeanUtils;
  29. import org.springframework.security.access.prepost.PreAuthorize;
  30. import org.springframework.util.ObjectUtils;
  31. import org.springframework.beans.factory.annotation.Autowired;
  32. import org.springframework.web.bind.annotation.*;
  33. import javax.validation.constraints.NotEmpty;
  34. import java.util.*;
  35. /**
  36. * 采购执行Controller
  37. *
  38. * @author ruoyi
  39. * @date 2023-01-16
  40. */
  41. @Api(tags = "采购执行")
  42. @RestController
  43. @RequestMapping("/pm/purchaseExecution")
  44. public class PmPurchaseExecutionController extends BaseController {
  45. @Autowired
  46. private IPmDemandService pmDemandService;
  47. @Autowired
  48. private PmDemandHisService pmDemandHisService;
  49. @Autowired
  50. private BaseAgencyService baseAgencyService;
  51. @Autowired
  52. private BaseExpertService baseExpertService;
  53. @Autowired
  54. private PmDemandExpertRefService pmDemandExpertRefService;
  55. @Autowired
  56. private PmDemandExpertRefHisService pmDemandExpertRefHisService;
  57. @Autowired
  58. private PmBidOpeningService pmBidOpeningService;
  59. @Autowired
  60. private PmBidOpeningHisService pmBidOpeningHisService;
  61. @Autowired
  62. private PmBidWinningOpeningRefService pmBidWinningOpeningRefService;
  63. @Autowired
  64. private PmBidWinningOpeningRefHisService pmBidWinningOpeningRefHisService;
  65. @Autowired
  66. private BaseProfessionalService baseProfessionalService;
  67. @Autowired
  68. private PmExpertFeedbackService pmExpertFeedbackService;
  69. @Autowired
  70. private PmProcurementDocumentsReviewService pmProcurementDocumentsReviewService;
  71. @Autowired
  72. private PmBidFailureService pmBidFailureService;
  73. @Autowired
  74. private PmCallQuestionService pmCallQuestionService;
  75. /**
  76. * 采购执行查询列表
  77. */
  78. @ApiOperation(value = "采购执行查询列表", notes = "参数非必传")
  79. @PostMapping("/list")
  80. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:list')")
  81. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  82. public AjaxResult list(@RequestBody PmDemandReqVo pmDemandReqVo) {
  83. pmDemandReqVo.setIsAdmin(SysUser.isAdmin(getUserId()));
  84. pmDemandReqVo.setDeptId(getDeptId());
  85. pmDemandReqVo.setUserId(getUserId());
  86. IPage<PmDemandResVo> page = pmDemandService.selectPmDemandList(pmDemandReqVo, 3);
  87. return success(page);
  88. }
  89. /**
  90. * 查询代理机构列表
  91. */
  92. @ApiOperation(value = "查询代理机构列表", notes = "采购需求ID必传")
  93. @GetMapping("/getAgencyList")
  94. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getAgencyList')")
  95. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  96. public AjaxResult getAgencyList(@NotEmpty(message = "采购需求ID不能为空")
  97. @RequestParam(value = "demandId", required = true) Long demandId) {
  98. PmDemand pmDemand = pmDemandService.getById(demandId);
  99. if(ObjectUtils.isEmpty(pmDemand)){
  100. return error("参数错误");
  101. }
  102. LambdaQueryWrapper<BaseAgency> lw = new LambdaQueryWrapper<>();
  103. lw.eq(BaseAgency::getCompanyType,pmDemand.getProjectType());
  104. lw.eq(BaseAgency::getStatus,NameListType.WHITE.getCode());//白名单
  105. List<BaseAgency> agencyList = baseAgencyService.list(lw);
  106. return success(agencyList);
  107. }
  108. /**
  109. * 选取代理-选择填写招标代理机构信息
  110. */
  111. @ApiOperation(value = "选取代理-选择填写招标代理机构信息",notes = "采购需求ID和代理机构ID必传")
  112. @GetMapping("/selectAgency")
  113. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:selectAgency')")
  114. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.UPDATE)
  115. public AjaxResult selectAgency(@NotEmpty(message = "采购需求ID不能为空")
  116. @RequestParam(value = "demandId", required = true) Long demandId,
  117. @NotEmpty(message = "代理机构ID不能为空")
  118. @RequestParam(value = "agencyId", required = true) Long agencyId,
  119. @RequestParam(value = "purchaseTaskDocumentNumber", required = false) String purchaseTaskDocumentNumber) {
  120. PmDemand pmDemand = pmDemandService.getById(demandId);
  121. if(ObjectUtils.isEmpty(pmDemand)){
  122. return error("参数错误");
  123. }
  124. BaseAgency baseAgency = baseAgencyService.getById(agencyId);
  125. if(ObjectUtils.isEmpty(baseAgency)){
  126. return error("参数错误");
  127. }
  128. PmDemand pmDemandUpdate = new PmDemand();
  129. pmDemandUpdate.setDemandId(demandId);
  130. pmDemandUpdate.setProjectStatus(PmProjectStatus.EXPERT_FEEDBACK.getCode());
  131. pmDemandUpdate.setAgencyId(agencyId);
  132. pmDemandUpdate.setPurchaseTaskDocumentNumber(purchaseTaskDocumentNumber);
  133. pmDemandUpdate.setExtractAgencyTime(new Date());
  134. pmDemandUpdate.setUpdateTime(pmDemandUpdate.getExtractAgencyTime());
  135. pmDemandUpdate.setUpdateBy(getUserId().toString());
  136. return success(pmDemandService.updateById(pmDemandUpdate));
  137. }
  138. /**
  139. * 选取代理-抽取招标代理机构信息
  140. */
  141. @ApiOperation(value = "选取代理-抽取招标代理机构信息",notes = "采购需求ID必传")
  142. @GetMapping("/extractAgency")
  143. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:extractAgency')")
  144. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.UPDATE)
  145. public AjaxResult extractAgency(@NotEmpty(message = "采购需求id不能为空")
  146. @RequestParam(value = "demandId", required = true) Long demandId,
  147. @RequestParam(value = "purchaseTaskDocumentNumber", required = false) String purchaseTaskDocumentNumber) {
  148. PmDemand pmDemand = pmDemandService.getById(demandId);
  149. if(ObjectUtils.isEmpty(pmDemand)){
  150. return error("参数错误");
  151. }
  152. LambdaQueryWrapper<BaseAgency> lw = new LambdaQueryWrapper<>();
  153. lw.eq(BaseAgency::getCompanyType,pmDemand.getProjectType());
  154. lw.eq(BaseAgency::getStatus,NameListType.WHITE.getCode()); //白名单
  155. List<BaseAgency> baseAgencyList = baseAgencyService.list(lw);
  156. if (ObjectUtils.isEmpty(baseAgencyList)){
  157. return error("没有符合的招标代理机构,抽取失败!");
  158. }
  159. BaseAgency any = (BaseAgency)(RandomUtil.getRandomList(baseAgencyList,1).get(0));
  160. PmDemand pmDemandUpdate = new PmDemand();
  161. pmDemandUpdate.setDemandId(demandId);
  162. pmDemandUpdate.setProjectStatus(PmProjectStatus.EXPERT_FEEDBACK.getCode());
  163. pmDemandUpdate.setAgencyId(any.getId());
  164. pmDemandUpdate.setPurchaseTaskDocumentNumber(purchaseTaskDocumentNumber);
  165. pmDemandUpdate.setExtractAgencyTime(new Date());
  166. pmDemandUpdate.setUpdateTime(pmDemandUpdate.getExtractAgencyTime());
  167. pmDemandUpdate.setUpdateBy(getUserId().toString());
  168. return success(pmDemandService.updateById(pmDemandUpdate));
  169. }
  170. @ApiOperation(value = "1-2专家意见反馈",notes = "采购需求ID和上传附件必传")
  171. @PostMapping("/expertFeedback")
  172. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:expertFeedback')")
  173. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.IMPORT)
  174. public AjaxResult expertFeedback(@NotEmpty(message = "数据为空") @RequestBody PmExpertFeedbackReqVo pmExpertFeedbackReqVo) {
  175. Long demandId = pmExpertFeedbackReqVo.getDemandId();
  176. if(ObjectUtils.isEmpty(demandId)){
  177. return error("参数错误");
  178. }
  179. PmDemand pmDemand = pmDemandService.getById(demandId);
  180. if(ObjectUtils.isEmpty(pmDemand)){
  181. return error("参数错误");
  182. }
  183. List<SysFileRef> sysFileRefs = pmExpertFeedbackReqVo.getSysFileRefs();
  184. if(ObjectUtils.isEmpty(sysFileRefs)){
  185. return error("上传附件不能为空");
  186. }
  187. PmExpertFeedback pmExpertFeedback = new PmExpertFeedback();
  188. BeanUtils.copyProperties(pmExpertFeedbackReqVo,pmExpertFeedback);
  189. if(pmExpertFeedbackService.save(pmExpertFeedback)){
  190. pmDemandService.uploadFile(pmExpertFeedback.getId(), SysFileRefEnum.PM_EXPERT_FEEDBACK.getType(),sysFileRefs,getUserId().toString());
  191. PmDemand pmDemandUpdate = new PmDemand();
  192. pmDemandUpdate.setDemandId(demandId);
  193. pmDemandUpdate.setProjectStatus(PmProjectStatus.PROCUREMENT_DOCUMENTS_REVIEW.getCode());
  194. pmDemandUpdate.setUpdateTime(new Date());
  195. pmDemandUpdate.setUpdateBy(getUserId().toString());
  196. return success(pmDemandService.updateById(pmDemandUpdate));
  197. } else {
  198. return error("保存失败");
  199. }
  200. }
  201. @ApiOperation(value = "1-3采购文件编制审核",notes = "采购需求ID和上传附件必传")
  202. @PostMapping("/uploadBidFile")
  203. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:uploadBidFile')")
  204. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.IMPORT)
  205. public AjaxResult uploadBidFile(@NotEmpty(message = "数据为空") @RequestBody PmProcurementDocumentsReviewReqVo pmProcurementDocumentsReviewReqVo) {
  206. Long demandId = pmProcurementDocumentsReviewReqVo.getDemandId();
  207. if(ObjectUtils.isEmpty(demandId)){
  208. return error("参数错误");
  209. }
  210. PmDemand pmDemand = pmDemandService.getById(demandId);
  211. if(ObjectUtils.isEmpty(pmDemand)){
  212. return error("参数错误");
  213. }
  214. List<SysFileRef> sysFileRefs = pmProcurementDocumentsReviewReqVo.getSysFileRefs();
  215. if(ObjectUtils.isEmpty(sysFileRefs)){
  216. return error("上传附件不能为空");
  217. }
  218. PmProcurementDocumentsReview pmProcurementDocumentsReview = new PmProcurementDocumentsReview();
  219. BeanUtils.copyProperties(pmProcurementDocumentsReviewReqVo,pmProcurementDocumentsReview);
  220. if(this.pmProcurementDocumentsReviewService.save(pmProcurementDocumentsReview)){
  221. pmDemandService.uploadFile(pmProcurementDocumentsReview.getId(), SysFileRefEnum.PM_BID_FILE.getType(),sysFileRefs,getUserId().toString());
  222. PmDemand pmDemandUpdate = new PmDemand();
  223. pmDemandUpdate.setDemandId(demandId);
  224. pmDemandUpdate.setProjectStatus(PmProjectStatus.PROCUREMENT_ANNOUNCEMENT.getCode());
  225. pmDemandUpdate.setUpdateTime(new Date());
  226. pmDemandUpdate.setUpdateBy(getUserId().toString());
  227. return success(pmDemandService.updateById(pmDemandUpdate));
  228. } else {
  229. return error("保存失败");
  230. }
  231. }
  232. @ApiOperation(value = "发布公告")
  233. @PostMapping("/insertPmReleaseAnnouncement")
  234. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:insertPmReleaseAnnouncement')")
  235. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.INSERT)
  236. public AjaxResult insertPmReleaseAnnouncement(@NotEmpty(message = "数据为空")
  237. @RequestBody PmReleaseAnnouncementReqVo pmReleaseAnnouncementReqVo) {
  238. try {
  239. Long demandId = pmReleaseAnnouncementReqVo.getDemandId();
  240. if(ObjectUtils.isEmpty(demandId)){
  241. return error("参数错误");
  242. }
  243. pmReleaseAnnouncementReqVo.setCreateBy(getUserId().toString());
  244. pmReleaseAnnouncementReqVo.setCreateTime(new Date());
  245. pmReleaseAnnouncementReqVo.setUpdateBy(pmReleaseAnnouncementReqVo.getCreateBy());
  246. pmReleaseAnnouncementReqVo.setUpdateTime(pmReleaseAnnouncementReqVo.getCreateTime());
  247. return toAjax(pmDemandService.insertPmReleaseAnnouncement(pmReleaseAnnouncementReqVo));
  248. } catch (Exception e) {
  249. return error(e.getMessage());
  250. }
  251. }
  252. @ApiOperation(value = "1-5标前质疑投诉",notes = "采购需求ID必传")
  253. @PostMapping("/handlePreCallQuestion")
  254. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:handlePreCallQuestion')")
  255. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.UPDATE)
  256. public AjaxResult handlePreCallQuestion(@NotEmpty(message = "数据为空")
  257. @RequestBody PmCallQuestionReqVo pmCallQuestionReqVo) {
  258. try {
  259. Long demandId = pmCallQuestionReqVo.getDemandId();
  260. if(ObjectUtils.isEmpty(demandId)){
  261. return error("参数错误");
  262. }
  263. PmDemand pmDemand = pmDemandService.getById(demandId);
  264. if(ObjectUtils.isEmpty(pmDemand)){
  265. return error("参数错误");
  266. }
  267. if("1".equals(pmCallQuestionReqVo.getCallQuestion())) { //有质疑
  268. if (ObjectUtils.isEmpty(pmCallQuestionReqVo.getCallQuestionTime())) {
  269. return error("质疑时间不能为空");
  270. }
  271. }
  272. PmCallQuestion pmCallQuestion = new PmCallQuestion();
  273. BeanUtils.copyProperties(pmCallQuestionReqVo,pmCallQuestion);
  274. pmCallQuestion.setType("0");
  275. if(pmCallQuestionService.save(pmCallQuestion)) {
  276. if("1".equals(pmCallQuestion.getCallQuestion())) { //有质疑
  277. List<SysFileRef> sysFileRefs = pmCallQuestionReqVo.getSysFileRefs();
  278. pmDemandService.uploadFile(pmCallQuestion.getId(), SysFileRefEnum.PM_PRE_BID_CALL_QUESTION.getType(),sysFileRefs,getUserId().toString());
  279. }
  280. }
  281. pmDemand.setProjectStatus(PmProjectStatus.WAIT_OPEN_BID.getCode());
  282. pmDemand.setUpdateBy(getUserId().toString());
  283. pmDemand.setUpdateTime(new Date());
  284. return toAjax(pmDemandService.updateById(pmDemand));
  285. } catch (Exception e) {
  286. return error(e.getMessage());
  287. }
  288. }
  289. @ApiOperation(value = "获取专家身份证号列表")
  290. @GetMapping("/getExpertIdNumberList")
  291. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getExpertIdNumberList')")
  292. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  293. public AjaxResult getExpertIdNumberList(@NotEmpty(message = "采购需求id不能为空")
  294. @RequestParam(value = "demandId", required = true) Long demandId) {
  295. PmDemand pmDemand = pmDemandService.getById(demandId);
  296. if(ObjectUtils.isEmpty(pmDemand)){
  297. return error("参数错误");
  298. }
  299. LambdaQueryWrapper<BaseExpert> lw = new LambdaQueryWrapper<BaseExpert>();
  300. lw.eq(BaseExpert::getVarietyPurchase,pmDemand.getProjectType())
  301. .eq(BaseExpert::getStatus,NameListType.WHITE.getCode());
  302. List<BaseExpert> baseExpertList = baseExpertService.list(lw);
  303. List<String> idNumberList = new ArrayList<>();
  304. if (!ObjectUtils.isEmpty(baseExpertList)) {
  305. for(BaseExpert baseExpert :baseExpertList ){
  306. idNumberList.add(baseExpert.getIdNumber());
  307. }
  308. }
  309. return success(idNumberList);
  310. }
  311. @ApiOperation(value = "根据身份证号查询专家", notes = "必传 查询条件:身份证号")
  312. @GetMapping("/findExpertWithIdNumber")
  313. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:findExpertWithIdNumber')")
  314. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  315. public AjaxResult findExpertWithIdNumber(@NotEmpty(message = "采购需求id不能为空")
  316. @RequestParam(value = "demandId", required = true) Long demandId,
  317. @NotEmpty(message = "身份证号不能为空")
  318. @RequestParam(value = "idNumber", required = true) String idNumber) {
  319. PmDemand pmDemand = pmDemandService.getById(demandId);
  320. if(ObjectUtils.isEmpty(pmDemand)){
  321. return error("参数错误");
  322. }
  323. LambdaQueryWrapper<BaseExpert> lw = new LambdaQueryWrapper<>();
  324. lw.eq(BaseExpert::getIdNumber,idNumber);
  325. BaseExpert baseExpert = baseExpertService.getOne(lw);
  326. if(baseExpert != null){
  327. if(NameListType.BLACK.getCode().equals(baseExpert.getStatus())){
  328. return error("该专家属于黑名单");
  329. }
  330. if(!ObjectUtils.isEmpty(pmDemand.getProjectType()) && !pmDemand.getProjectType().equals(baseExpert.getVarietyPurchase())){
  331. return error("该专家所属采购品种和项目类型不匹配");
  332. }
  333. }
  334. return success(baseExpert);
  335. }
  336. @ApiOperation(value = "查询专业库树结构", notes = "非必传 查询条件:品目名称")
  337. @PostMapping("/selectBaseProfessional")
  338. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:selectBaseProfessional')")
  339. @Log(title = ModularConstans.professional, businessType = BusinessType.QUERY)
  340. public AjaxResult selectBaseProfessional(@RequestBody BaseProfessionalVo baseProfessionalVo) {
  341. List<BaseProfessionalVo> baseSupplierList = baseProfessionalService.selectBaseProfessionalVo(baseProfessionalVo);
  342. return success(baseSupplierList);
  343. }
  344. @ApiOperation(value = "填写专家信息批量提交", notes = "必传 采购需求ID和专家信息列表,注意:若该专家已经在库里存在,需要传专家对象BaseExpert的ID")
  345. @PostMapping("/insertExpertBatch")
  346. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:insertExpertBatch')")
  347. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.INSERT)
  348. public AjaxResult insertExpertBatch(@NotEmpty(message = "参数不能为空") @RequestBody PmBaseExpertFillReqVo pmBaseExpertFillReqVo) {
  349. try {
  350. if (ObjectUtils.isEmpty(pmBaseExpertFillReqVo)
  351. || ObjectUtils.isEmpty(pmBaseExpertFillReqVo.getDemandId())
  352. || ObjectUtils.isEmpty(pmBaseExpertFillReqVo.getAccessTime())
  353. || ObjectUtils.isEmpty(pmBaseExpertFillReqVo.getBaseExpertList())) {
  354. return error("参数错误");
  355. }
  356. pmBaseExpertFillReqVo.setCreateBy(getUserId().toString());
  357. pmBaseExpertFillReqVo.setUpdateBy(pmBaseExpertFillReqVo.getCreateBy());
  358. return toAjax(pmDemandService.insertExpertBatch(pmBaseExpertFillReqVo));
  359. } catch (Exception e) {
  360. return error(e.getMessage());
  361. }
  362. }
  363. @ApiOperation(value = "获取回避单位下拉列表")
  364. @GetMapping("/getExpertUnitList")
  365. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getExpertUnitList')")
  366. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  367. public AjaxResult getExpertUnitList() {
  368. List<BaseUnitInformation> baseUnitInformationList = baseExpertService.getBaseUnitInformationList();
  369. if(ObjectUtils.isEmpty(baseUnitInformationList)){
  370. return error("专家单位列表是空的");
  371. }
  372. Set<String> set = new HashSet<>();
  373. for(BaseUnitInformation baseUnitInformation : baseUnitInformationList) {
  374. set.add(baseUnitInformation.getUnitName());
  375. }
  376. return success(set);
  377. }
  378. /**
  379. * 抽取专家
  380. */
  381. @ApiOperation(value = "抽取专家",notes = "采购需求ID必传")
  382. @PostMapping("/extractExpertBatch")
  383. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:extractExpertBatch')")
  384. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.UPDATE)
  385. public AjaxResult extractExpertBatch(@NotEmpty(message = "参数不能为空")
  386. @RequestBody PmBaseExpertExtractReqVo pmBaseExpertExtractReqVo) {
  387. try {
  388. if (ObjectUtils.isEmpty(pmBaseExpertExtractReqVo)
  389. || ObjectUtils.isEmpty(pmBaseExpertExtractReqVo.getDemandId())
  390. || ObjectUtils.isEmpty(pmBaseExpertExtractReqVo.getAccessTime())) {
  391. return error("参数错误");
  392. }
  393. return toAjax(pmDemandService.extractExpertBatch(pmBaseExpertExtractReqVo));
  394. } catch (Exception e) {
  395. return error(e.getMessage());
  396. }
  397. }
  398. @ApiOperation(value = "填写开标信息",notes = "采购需求ID必传")
  399. @PostMapping("/insertBidOpeningBatch")
  400. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:insertBidOpeningBatch')")
  401. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.INSERT)
  402. public AjaxResult insertBidOpeningBatch(@NotEmpty(message = "数据为空")
  403. @RequestBody PmBidOpeningFillReqVo pmBidOpeningFillReqVo) {
  404. try {
  405. if (ObjectUtils.isEmpty(pmBidOpeningFillReqVo)
  406. || ObjectUtils.isEmpty(pmBidOpeningFillReqVo.getDemandId())
  407. || ObjectUtils.isEmpty(pmBidOpeningFillReqVo.getPmBidOpeningList())) {
  408. return error("参数错误");
  409. }
  410. pmBidOpeningFillReqVo.setCreateBy(getUserId().toString());
  411. pmBidOpeningFillReqVo.setUpdateBy(getUserId().toString());
  412. return toAjax(pmDemandService.insertBidOpeningBatch(pmBidOpeningFillReqVo));
  413. } catch (Exception e) {
  414. return error(e.getMessage());
  415. }
  416. }
  417. /**
  418. * 中标基本情况填制-开标信息下拉列表
  419. */
  420. @ApiOperation(value = "中标基本情况填制-开标信息下拉列表", notes = "必传选需求ID")
  421. @GetMapping("/getPullDownBidOpeningList")
  422. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getPullDownBidOpeningList')")
  423. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  424. public AjaxResult getPullDownBidOpeningList(@NotEmpty(message = "需求ID不能为空")
  425. @RequestParam(value = "demandId", required = true) Long demandId) {
  426. LambdaQueryWrapper<PmBidOpening> pmBidOpeningLambdaQueryWrapper = new LambdaQueryWrapper<>();
  427. pmBidOpeningLambdaQueryWrapper.eq(PmBidOpening::getDemandId,demandId)
  428. .orderByDesc(PmBidOpening::getScore)
  429. ;
  430. List<PmBidOpening> pmBidOpeningList = pmBidOpeningService.list(pmBidOpeningLambdaQueryWrapper);
  431. return success(pmBidOpeningList);
  432. }
  433. @ApiOperation(value = "中标基本情况填制-中标情况填制提交(评标结果公告)",notes = "采购需求ID必传")
  434. @PostMapping("/insertPmBidWinning")
  435. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:insertPmBidWinning')")
  436. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.INSERT)
  437. public AjaxResult insertPmBidWinning(@NotEmpty(message = "数据为空")
  438. @RequestBody PmBidWinningReqVo pmBidWinningReqVo) {
  439. try {
  440. Long demandId = pmBidWinningReqVo.getDemandId();
  441. if(ObjectUtils.isEmpty(demandId)){
  442. return error("采购需求ID不能为空");
  443. }
  444. pmBidWinningReqVo.setCreateBy(getUserId().toString());
  445. pmBidWinningReqVo.setCreateTime(new Date());
  446. pmBidWinningReqVo.setUpdateBy(pmBidWinningReqVo.getCreateBy());
  447. pmBidWinningReqVo.setUpdateTime(pmBidWinningReqVo.getCreateTime());
  448. return toAjax(pmDemandService.insertPmBidWinning(pmBidWinningReqVo));
  449. } catch (Exception e) {
  450. return error(e.getMessage());
  451. }
  452. }
  453. @ApiOperation(value = "中标基本情况填制-更换中标人提交",notes = "采购需求ID必传")
  454. @PostMapping("/updatePmBidWinning")
  455. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:updatePmBidWinning')")
  456. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.UPDATE)
  457. public AjaxResult updatePmBidWinning(@NotEmpty(message = "数据为空")
  458. @RequestBody PmBidWinningReqVo pmBidWinningReqVo) {
  459. try {
  460. Long demandId = pmBidWinningReqVo.getDemandId();
  461. if(ObjectUtils.isEmpty(demandId)){
  462. return error("采购需求ID不能为空");
  463. }
  464. pmBidWinningReqVo.setUpdateBy(getUserId().toString());
  465. pmBidWinningReqVo.setUpdateTime(new Date());
  466. return toAjax(pmDemandService.updatePmBidWinning(pmBidWinningReqVo));
  467. } catch (Exception e) {
  468. return error(e.getMessage());
  469. }
  470. }
  471. @ApiOperation(value = "流标情况填制",notes = "采购需求ID必传")
  472. @PostMapping("/insertPmBidFailure")
  473. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:insertPmBidFailure')")
  474. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.INSERT)
  475. public AjaxResult insertPmBidFailure(@NotEmpty(message = "数据为空")
  476. @RequestBody PmBidFailureReqVo pmBidFailureReqVo) {
  477. try {
  478. Long demandId = pmBidFailureReqVo.getDemandId();
  479. if(ObjectUtils.isEmpty(demandId)){
  480. return error("参数错误");
  481. }
  482. pmBidFailureReqVo.setCreateBy(getUserId().toString());
  483. pmBidFailureReqVo.setCreateTime(new Date());
  484. pmBidFailureReqVo.setUpdateBy(pmBidFailureReqVo.getCreateBy());
  485. pmBidFailureReqVo.setUpdateTime(pmBidFailureReqVo.getCreateTime());
  486. return toAjax(pmDemandService.insertPmBidFailure(pmBidFailureReqVo));
  487. } catch (Exception e) {
  488. return error(e.getMessage());
  489. }
  490. }
  491. @ApiOperation(value = "流废标处置-质疑处理",notes = "采购需求ID必传")
  492. @PostMapping("/handleBidFailureCallQuestion")
  493. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:handleBidFailureCallQuestion')")
  494. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.UPDATE)
  495. public AjaxResult handleBidFailureCallQuestion(@NotEmpty(message = "数据为空")
  496. @RequestBody PmCallQuestionReqVo pmCallQuestionReqVo) {
  497. try {
  498. Long demandId = pmCallQuestionReqVo.getDemandId();
  499. if(ObjectUtils.isEmpty(demandId)){
  500. return error("参数错误");
  501. }
  502. PmDemand pmDemand = pmDemandService.getById(demandId);
  503. if(ObjectUtils.isEmpty(pmDemand)){
  504. return error("参数错误");
  505. }
  506. if("1".equals(pmCallQuestionReqVo.getCallQuestion())) { //有质疑
  507. if (ObjectUtils.isEmpty(pmCallQuestionReqVo.getCallQuestionTime())) {
  508. return error("质疑时间不能为空");
  509. }
  510. }
  511. LambdaQueryWrapper<PmBidFailure> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  512. lambdaQueryWrapper.eq(PmBidFailure::getDemandId,pmDemand.getDemandId())
  513. .orderByDesc(PmBidFailure::getBidFailureTime)
  514. .last(" limit 1");
  515. PmBidFailure bidFailure = this.pmBidFailureService.getOne(lambdaQueryWrapper);
  516. if (ObjectUtils.isEmpty(bidFailure)) {
  517. return error("没有流标信息");
  518. }
  519. PmBidFailure bidFailureUpdate = new PmBidFailure();
  520. bidFailureUpdate.setId(bidFailure.getId());
  521. bidFailureUpdate.setCallQuestion(pmCallQuestionReqVo.getCallQuestion());
  522. bidFailureUpdate.setCallQuestionTime(pmCallQuestionReqVo.getCallQuestionTime());
  523. if("1".equals(bidFailureUpdate.getCallQuestion())){ //有质疑
  524. List<SysFileRef> sysFileRefs = pmCallQuestionReqVo.getSysFileRefs();
  525. pmDemandService.uploadFile(bidFailureUpdate.getId(), SysFileRefEnum.PM_BID_FAILURE_CALL_QUESTION.getType(),sysFileRefs,getUserId().toString());
  526. }
  527. bidFailureUpdate.setUpdateBy(getUserId().toString());
  528. bidFailureUpdate.setUpdateTime(new Date());
  529. return toAjax(pmBidFailureService.updateById(bidFailureUpdate));
  530. } catch (Exception e) {
  531. return error(e.getMessage());
  532. }
  533. }
  534. @ApiOperation(value = "流废标退回",notes = "采购需求ID必传")
  535. @GetMapping("/returnBidFailure")
  536. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:returnBidFailure')")
  537. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.UPDATE)
  538. public AjaxResult returnBidFailure(@NotEmpty(message = "采购需求id不能为空")
  539. @RequestParam(value = "demandId", required = true) Long demandId) {
  540. try {
  541. return toAjax(pmDemandHisService.returnBidFailure(demandId, getUserId().toString()));
  542. } catch (Exception e) {
  543. return error(e.getMessage());
  544. }
  545. }
  546. @ApiOperation(value = "标后质疑",notes = "采购需求ID必传")
  547. @PostMapping("/handleCallQuestion")
  548. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:handleCallQuestion')")
  549. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.UPDATE)
  550. public AjaxResult handleCallQuestion(@NotEmpty(message = "数据为空")
  551. @RequestBody PmCallQuestionReqVo pmCallQuestionReqVo) {
  552. try {
  553. Long demandId = pmCallQuestionReqVo.getDemandId();
  554. if(ObjectUtils.isEmpty(demandId)){
  555. return error("参数错误");
  556. }
  557. PmDemand pmDemand = pmDemandService.getById(demandId);
  558. if(ObjectUtils.isEmpty(pmDemand)){
  559. return error("参数错误");
  560. }
  561. if("1".equals(pmCallQuestionReqVo.getCallQuestion())) { //有质疑
  562. if (ObjectUtils.isEmpty(pmCallQuestionReqVo.getCallQuestionTime())) {
  563. return error("质疑时间不能为空");
  564. }
  565. }
  566. PmCallQuestion pmCallQuestion = new PmCallQuestion();
  567. BeanUtils.copyProperties(pmCallQuestionReqVo,pmCallQuestion);
  568. pmCallQuestion.setType("1");
  569. if(pmCallQuestionService.save(pmCallQuestion)) {
  570. if("1".equals(pmCallQuestion.getCallQuestion())) { //有质疑
  571. List<SysFileRef> sysFileRefs = pmCallQuestionReqVo.getSysFileRefs();
  572. pmDemandService.uploadFile(pmCallQuestion.getId(), SysFileRefEnum.PM_BID_CALL_QEUSTION_FILE.getType(), sysFileRefs, getUserId().toString());
  573. }
  574. }
  575. pmDemand.setUpdateBy(getUserId().toString());
  576. pmDemand.setUpdateTime(new Date());
  577. return toAjax(pmDemandService.updateById(pmDemand));
  578. } catch (Exception e) {
  579. return error(e.getMessage());
  580. }
  581. }
  582. @ApiOperation(value = "上传中标通知书",notes = "采购需求ID和上传附件必传")
  583. @PostMapping("/uploadBidWinningNotification")
  584. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:uploadBidWinningNotification')")
  585. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.IMPORT)
  586. public AjaxResult uploadBidWinningNotification(@NotEmpty(message = "数据为空") @RequestBody PmPurchaseExecutionReqVo pmPurchaseExecutionReqVo) {
  587. Long demandId = pmPurchaseExecutionReqVo.getDemandId();
  588. if(ObjectUtils.isEmpty(demandId)){
  589. return error("参数错误");
  590. }
  591. PmDemand pmDemand = pmDemandService.getById(demandId);
  592. if(ObjectUtils.isEmpty(pmDemand)){
  593. return error("参数错误");
  594. }
  595. List<SysFileRef> sysFileRefs = pmPurchaseExecutionReqVo.getSysFileRefs();
  596. if(ObjectUtils.isEmpty(sysFileRefs)){
  597. return error("上传附件不能为空");
  598. }
  599. if (pmDemandService.uploadFile(demandId, SysFileRefEnum.PM_BID_WINNING_NOTIFICATION.getType(),sysFileRefs,getUserId().toString())) {
  600. PmDemand pmDemandUpdate = new PmDemand();
  601. pmDemandUpdate.setDemandId(demandId);
  602. pmDemandUpdate.setProjectStatus(PmProjectStatus.CONTRACT_WAIT_FILL.getCode());
  603. pmDemandUpdate.setRealPurchaseFinishTime(new Date());
  604. pmDemandUpdate.setWarnStatus(WarnStatus.NORMAL.getCode());
  605. pmDemandUpdate.setUpdateTime(new Date());
  606. pmDemandUpdate.setUpdateBy(getUserId().toString());
  607. return success(pmDemandService.updateById(pmDemandUpdate));
  608. } else {
  609. return error("保存上传附件失败");
  610. }
  611. }
  612. /**
  613. * 查看详情
  614. */
  615. @ApiOperation(value = "查看详情", notes = "必传demandId和详情类型(1项目计划,2需求建档,3任务下达,4中标信息,5合同信息,6建设情况),其他字段不传")
  616. @PostMapping("/view")
  617. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:view')")
  618. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  619. public AjaxResult view(@RequestBody PmDemandReqVo pmDemandReqVo) {
  620. if(pmDemandReqVo.getDemandId() == null){
  621. return AjaxResult.error("demandId不能为空");
  622. }
  623. if(StringUtils.isEmpty(pmDemandReqVo.getDetailType())){
  624. return AjaxResult.error("详情的类型不能为空");
  625. }
  626. return success(pmDemandService.selectPmDemandByDemandId(pmDemandReqVo.getDemandId(),pmDemandReqVo.getDetailType()));
  627. }
  628. /**
  629. * 获取回退下拉列表
  630. */
  631. @ApiOperation(value = "获取回退下拉列表", notes = "必传demandId")
  632. @GetMapping("/getReturnList")
  633. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getReturnList')")
  634. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  635. public AjaxResult getReturnList(@NotEmpty(message = "需求ID不能为空")
  636. @RequestParam(value = "demandId", required = true) Long demandId) {
  637. List< Map<String,Integer>> list = new ArrayList<>();
  638. LambdaQueryWrapper<PmDemandHis> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  639. lambdaQueryWrapper.eq(PmDemandHis::getDemandId,demandId).orderByAsc(PmDemandHis::getReturnOrderNumber);
  640. List<PmDemandHis> pmDemandHisList = this.pmDemandHisService.list(lambdaQueryWrapper);
  641. if(!ObjectUtils.isEmpty(pmDemandHisList)){
  642. Map<String,Integer> map = new HashMap<>();
  643. map.put("当前信息",0);
  644. list.add(map);
  645. for (PmDemandHis pmDemandHis : pmDemandHisList) {
  646. Map<String,Integer> map2 = new HashMap<>();
  647. map2.put("第" + pmDemandHis.getReturnOrderNumber() + "回退",pmDemandHis.getReturnOrderNumber());
  648. list.add(map2);
  649. }
  650. }
  651. return success(list);
  652. }
  653. /**
  654. * 查看历史详情
  655. */
  656. @ApiOperation(value = "查看历史详情", notes = "必传demandId和详情类型(1项目计划,2需求建档,3任务下达,4中标信息,5合同信息,6建设情况),必传returnOrderNumber(回退序号,0当前/1第一次回退/2第二次回退...),其他字段不传")
  657. @PostMapping("/viewHis")
  658. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:viewHis')")
  659. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  660. public AjaxResult viewHis(@RequestBody PmDemandReqVo pmDemandReqVo) {
  661. if(pmDemandReqVo.getDemandId() == null){
  662. return AjaxResult.error("demandId不能为空");
  663. }
  664. if(ObjectUtils.isEmpty(pmDemandReqVo.getDetailType())){
  665. return AjaxResult.error("详情的类型不能为空");
  666. }
  667. if(ObjectUtils.isEmpty(pmDemandReqVo.getReturnOrderNumber())){
  668. return AjaxResult.error("回退序号不能为空");
  669. }
  670. if(0 == pmDemandReqVo.getReturnOrderNumber()){
  671. return success(pmDemandService.selectPmDemandByDemandId(pmDemandReqVo.getDemandId(),pmDemandReqVo.getDetailType()));
  672. } else {
  673. return success(pmDemandHisService.selectPmDemandHisByDemandId(pmDemandReqVo.getDemandId(),pmDemandReqVo.getDetailType(),pmDemandReqVo.getReturnOrderNumber()));
  674. }
  675. }
  676. /**
  677. * 专家信息查看详情列表
  678. */
  679. @ApiOperation(value = "专家信息查看详情列表", notes = "必传需求ID和选取时间(yyyy-MM-dd)")
  680. @GetMapping("/getBaseExpertList")
  681. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getBaseExpertList')")
  682. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  683. public AjaxResult getBaseExpertList(@NotEmpty(message = "需求ID不能为空")
  684. @RequestParam(value = "demandId", required = true) Long demandId,
  685. @NotEmpty(message = "选取时间不能为空")
  686. @RequestParam(value = "accessTime", required = true) String accessTime) {
  687. LambdaQueryWrapper<PmDemandExpertRef> pmDemandExpertRefLambdaQueryWrapper = new LambdaQueryWrapper<>();
  688. pmDemandExpertRefLambdaQueryWrapper.eq(PmDemandExpertRef::getDemandId,demandId);
  689. pmDemandExpertRefLambdaQueryWrapper.eq(PmDemandExpertRef::getAccessTime,accessTime);
  690. List<PmDemandExpertRef> pmDemandExpertRefList = pmDemandExpertRefService.list(pmDemandExpertRefLambdaQueryWrapper);
  691. List<BaseExpertVo> baseExpertVoList = new ArrayList<>();
  692. if(!ObjectUtils.isEmpty(pmDemandExpertRefList)) {
  693. for(PmDemandExpertRef pmDemandExpertRef : pmDemandExpertRefList) {
  694. BaseExpert baseExpert = baseExpertService.getById(pmDemandExpertRef.getExpertId());
  695. if(baseExpert != null){
  696. BaseExpertVo baseExpertVo = new BaseExpertVo();
  697. BeanUtils.copyProperties(baseExpert,baseExpertVo);
  698. baseExpertVo.setMajorTypeName(getMajorTypeName(baseExpertVo.getMajorType()));
  699. baseExpertVo.setExpertTypeName(ExpertType.getCodeToInfo(baseExpertVo.getExpertType()));
  700. baseExpertVo.setVarietyPurchaseName(PurchaseType.getCodeToInfo(baseExpertVo.getVarietyPurchase()));
  701. baseExpertVoList.add(baseExpertVo);
  702. }
  703. }
  704. }
  705. return success(baseExpertVoList);
  706. }
  707. /**
  708. * 专家信息查看历史详情列表
  709. */
  710. @ApiOperation(value = "专家信息查看历史详情列表", notes = "必传需求ID、回退序号和选取时间(yyyy-MM-dd)")
  711. @GetMapping("/getBaseExpertHisList")
  712. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getBaseExpertHisList')")
  713. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  714. public AjaxResult getBaseExpertHisList(@NotEmpty(message = "需求ID不能为空")
  715. @RequestParam(value = "demandId", required = true) Long demandId,
  716. @NotEmpty(message = "回退序号不能为空")
  717. @RequestParam(value = "returnOrderNumber", required = true) Integer returnOrderNumber,
  718. @NotEmpty(message = "选取时间不能为空")
  719. @RequestParam(value = "accessTime", required = true) String accessTime) {
  720. if( 0 == returnOrderNumber){
  721. return getBaseExpertList(demandId,accessTime);
  722. }
  723. LambdaQueryWrapper<PmDemandExpertRefHis> pmDemandExpertRefLambdaQueryWrapper = new LambdaQueryWrapper<>();
  724. pmDemandExpertRefLambdaQueryWrapper.eq(PmDemandExpertRefHis::getDemandId,demandId);
  725. pmDemandExpertRefLambdaQueryWrapper.eq(PmDemandExpertRefHis::getReturnOrderNumber,returnOrderNumber);
  726. pmDemandExpertRefLambdaQueryWrapper.eq(PmDemandExpertRefHis::getAccessTime,accessTime);
  727. List<PmDemandExpertRefHis> pmDemandExpertRefHisList = pmDemandExpertRefHisService.list(pmDemandExpertRefLambdaQueryWrapper);
  728. List<BaseExpertVo> baseExpertVoList = new ArrayList<>();
  729. if(!ObjectUtils.isEmpty(pmDemandExpertRefHisList)) {
  730. for(PmDemandExpertRefHis pmDemandExpertRefHis : pmDemandExpertRefHisList) {
  731. BaseExpert baseExpert = baseExpertService.getById(pmDemandExpertRefHis.getExpertId());
  732. if(baseExpert != null){
  733. BaseExpertVo baseExpertVo = new BaseExpertVo();
  734. BeanUtils.copyProperties(baseExpert,baseExpertVo);
  735. baseExpertVo.setMajorTypeName(getMajorTypeName(baseExpertVo.getMajorType()));
  736. baseExpertVo.setExpertTypeName(ExpertType.getCodeToInfo(baseExpertVo.getExpertType()));
  737. baseExpertVo.setVarietyPurchaseName(PurchaseType.getCodeToInfo(baseExpertVo.getVarietyPurchase()));
  738. baseExpertVoList.add(baseExpertVo);
  739. }
  740. }
  741. }
  742. return success(baseExpertVoList);
  743. }
  744. private String getMajorTypeName(String majorType){
  745. if(ObjectUtils.isEmpty(majorType)) {
  746. return null;
  747. }
  748. LambdaQueryWrapper<BaseProfessional> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  749. lambdaQueryWrapper.in(BaseProfessional::getProfessionalCode,majorType.split(","));
  750. List<BaseProfessional> list = this.baseProfessionalService.list(lambdaQueryWrapper);
  751. if(ObjectUtils.isEmpty(list)){
  752. return null;
  753. }
  754. StringBuilder sb = new StringBuilder();
  755. for(BaseProfessional baseProfessional : list){
  756. sb.append(baseProfessional.getProfessionalName()).append(",");
  757. }
  758. String majorTypeName = sb.toString();
  759. if(majorTypeName.endsWith(",")){
  760. majorTypeName = majorTypeName.substring(0, majorTypeName.length() - 1);
  761. }
  762. return majorTypeName;
  763. }
  764. /**
  765. * 开标信息查看详情列表
  766. */
  767. @ApiOperation(value = "开标信息查看详情列表", notes = "必传选需求ID和开标时间(yyyy-MM-dd)")
  768. @GetMapping("/getBidOpeningList")
  769. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getBidOpeningList')")
  770. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  771. public AjaxResult getBidOpeningList(@NotEmpty(message = "需求ID不能为空")
  772. @RequestParam(value = "demandId", required = true) Long demandId,
  773. @NotEmpty(message = "开标时间不能为空")
  774. @RequestParam(value = "openBidTime", required = true) String openBidTime) {
  775. LambdaQueryWrapper<PmBidOpening> pmBidOpeningLambdaQueryWrapper = new LambdaQueryWrapper<>();
  776. pmBidOpeningLambdaQueryWrapper.eq(PmBidOpening::getDemandId,demandId)
  777. .eq(PmBidOpening::getOpenBidTime,openBidTime).orderByDesc(PmBidOpening::getScore);
  778. List<PmBidOpening> pmBidOpeningList = pmBidOpeningService.list(pmBidOpeningLambdaQueryWrapper);
  779. return success(pmBidOpeningList);
  780. }
  781. /**
  782. * 开标信息查看历史详情列表
  783. */
  784. @ApiOperation(value = "开标信息查看历史详情列表", notes = "必传选需求ID、回退序号和开标时间(yyyy-MM-dd)")
  785. @GetMapping("/getBidOpeningHisList")
  786. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getBidOpeningHisList')")
  787. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  788. public AjaxResult getBidOpeningHisList(@NotEmpty(message = "需求ID不能为空")
  789. @RequestParam(value = "demandId", required = true) Long demandId,
  790. @NotEmpty(message = "回退序号不能为空")
  791. @RequestParam(value = "returnOrderNumber", required = true) Integer returnOrderNumber,
  792. @NotEmpty(message = "开标时间不能为空")
  793. @RequestParam(value = "openBidTime", required = true) String openBidTime) {
  794. if( 0 == returnOrderNumber){
  795. return getBidOpeningList(demandId,openBidTime);
  796. }
  797. LambdaQueryWrapper<PmBidOpeningHis> pmBidOpeningLambdaQueryWrapper = new LambdaQueryWrapper<>();
  798. pmBidOpeningLambdaQueryWrapper.eq(PmBidOpeningHis::getDemandId,demandId).eq(PmBidOpeningHis::getReturnOrderNumber,returnOrderNumber)
  799. .eq(PmBidOpeningHis::getOpenBidTime,openBidTime).orderByDesc(PmBidOpeningHis::getScore);
  800. List<PmBidOpeningHis> pmBidOpeningList = pmBidOpeningHisService.list(pmBidOpeningLambdaQueryWrapper);
  801. return success(pmBidOpeningList);
  802. }
  803. /**
  804. * 评标结果公告详情查看中标单位列表
  805. */
  806. @ApiOperation(value = "评标结果公告详情查看中标单位列表", notes = "必传选需求ID和中标ID")
  807. @GetMapping("/getBidWinningUnitList")
  808. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getBidWinningUnitList')")
  809. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  810. public AjaxResult getBidWinningUnitList(@NotEmpty(message = "需求ID不能为空")
  811. @RequestParam(value = "demandId", required = true) Long demandId,
  812. @NotEmpty(message = "开中标ID不能为空")
  813. @RequestParam(value = "winningId", required = true) Long winningId) {
  814. LambdaQueryWrapper<PmBidWinningOpeningRef> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  815. lambdaQueryWrapper.eq(PmBidWinningOpeningRef::getDemandId,demandId).eq(PmBidWinningOpeningRef::getWinningId,winningId);
  816. List<PmBidWinningOpeningRef> pmBidWinningOpeningRefList = pmBidWinningOpeningRefService.list(lambdaQueryWrapper);
  817. if(ObjectUtils.isEmpty(pmBidWinningOpeningRefList)){
  818. return AjaxResult.error("中标单位列表为空");
  819. }
  820. List<Long> idList = new ArrayList<>();
  821. for (PmBidWinningOpeningRef pmBidWinningOpeningRef : pmBidWinningOpeningRefList) {
  822. idList.add(pmBidWinningOpeningRef.getOpeningId());
  823. }
  824. LambdaQueryWrapper<PmBidOpening> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
  825. lambdaQueryWrapper1.in(PmBidOpening::getId,idList).orderByDesc(PmBidOpening::getScore);
  826. List<PmBidOpening> pmBidOpeningList = this.pmBidOpeningService.list(lambdaQueryWrapper1);
  827. return success(pmBidOpeningList);
  828. }
  829. /**
  830. * 历史评标结果公告详情查看中标单位列表
  831. */
  832. @ApiOperation(value = "历史评标结果公告详情查看中标单位列表", notes = "必传选需求ID、回退序号和中标ID")
  833. @GetMapping("/getBidWinningUnitHisList")
  834. @PreAuthorize("@ss.hasPermi('pm:purchaseExecution:getBidWinningUnitHisList')")
  835. @Log(title = ModularConstans.purchaseExecution, businessType = BusinessType.QUERY)
  836. public AjaxResult getBidWinningUnitHisList(@NotEmpty(message = "需求ID不能为空")
  837. @RequestParam(value = "demandId", required = true) Long demandId,
  838. @NotEmpty(message = "回退序号不能为空")
  839. @RequestParam(value = "returnOrderNumber", required = true) Integer returnOrderNumber,
  840. @NotEmpty(message = "开中标ID不能为空")
  841. @RequestParam(value = "winningId", required = true) Long winningId) {
  842. if( 0 == returnOrderNumber){
  843. return getBidWinningUnitList(demandId,winningId);
  844. }
  845. LambdaQueryWrapper<PmBidWinningOpeningRefHis> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  846. lambdaQueryWrapper.eq(PmBidWinningOpeningRefHis::getDemandId,demandId).eq(PmBidWinningOpeningRefHis::getReturnOrderNumber,returnOrderNumber)
  847. .eq(PmBidWinningOpeningRefHis::getWinningId,winningId);
  848. List<PmBidWinningOpeningRefHis> pmBidWinningOpeningRefHisList = pmBidWinningOpeningRefHisService.list(lambdaQueryWrapper);
  849. if(ObjectUtils.isEmpty(pmBidWinningOpeningRefHisList)){
  850. return AjaxResult.error("中标单位列表为空");
  851. }
  852. List<Long> idList = new ArrayList<>();
  853. for (PmBidWinningOpeningRefHis pmBidWinningOpeningRefHis : pmBidWinningOpeningRefHisList) {
  854. idList.add(pmBidWinningOpeningRefHis.getOpeningId());
  855. }
  856. LambdaQueryWrapper<PmBidOpeningHis> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
  857. lambdaQueryWrapper1.in(PmBidOpeningHis::getId,idList).eq(PmBidOpeningHis::getReturnOrderNumber,returnOrderNumber)
  858. .orderByDesc(PmBidOpeningHis::getScore);
  859. List<PmBidOpeningHis> pmBidOpeningHisList = this.pmBidOpeningHisService.list(lambdaQueryWrapper1);
  860. return success(pmBidOpeningHisList);
  861. }
  862. }