71498317679c102ffc79197651e6e8bd1f5c44fd.svn-base 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. package cn.com.goldenwater.dcproj.controller.tac;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.dao.BisInspAllRlationPersDao;
  5. import cn.com.goldenwater.dcproj.dao.TacPawpRgstrDao;
  6. import cn.com.goldenwater.dcproj.model.*;
  7. import cn.com.goldenwater.dcproj.param.TacEvaluationExternalExpertParam;
  8. import cn.com.goldenwater.dcproj.param.TacPawpRgstrParam;
  9. import cn.com.goldenwater.dcproj.param.TacWorkerBParam;
  10. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  11. import cn.com.goldenwater.dcproj.service.TacEvaluationExternalExpertService;
  12. import cn.com.goldenwater.dcproj.service.TacWorkerBService;
  13. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  14. import cn.com.goldenwater.dcproj.utils.StringUtils;
  15. import cn.com.goldenwater.dcproj.vo.TacEvaluationExternalExpertVo;
  16. import cn.com.goldenwater.id.util.UuidUtil;
  17. import com.github.pagehelper.PageHelper;
  18. import com.github.pagehelper.PageInfo;
  19. import io.swagger.annotations.Api;
  20. import io.swagger.annotations.ApiOperation;
  21. import io.swagger.annotations.ApiParam;
  22. import org.slf4j.Logger;
  23. import org.slf4j.LoggerFactory;
  24. import org.springframework.beans.factory.annotation.Autowired;
  25. import org.springframework.web.bind.annotation.PathVariable;
  26. import org.springframework.web.bind.annotation.RequestBody;
  27. import org.springframework.web.bind.annotation.RequestMapping;
  28. import org.springframework.web.bind.annotation.RequestMethod;
  29. import org.springframework.web.bind.annotation.RestController;
  30. import javax.servlet.http.HttpServletResponse;
  31. import java.math.BigDecimal;
  32. import java.util.Date;
  33. import java.util.List;
  34. /**
  35. * 稽查专家测评Controller
  36. *
  37. * @author ruoyi
  38. * @date 2023-03-06
  39. */
  40. @Api(value = "稽查专家测评",tags="稽查专家测评")
  41. @RestController
  42. @RequestMapping("/tac/evalation/expert")
  43. public class TacEvaluationExternalExpertController extends BaseController
  44. {
  45. private Logger logger = LoggerFactory.getLogger(getClass());
  46. /**
  47. * 稽查专家测评 服务
  48. */
  49. @Autowired
  50. private TacEvaluationExternalExpertService tacEvaluationExternalExpertService;
  51. /**
  52. * 机构 区域 服务
  53. */
  54. @Autowired
  55. private OlBisInspOrgService olBisInspOrgService;
  56. @Autowired
  57. private TacWorkerBService tacWorkerBService;
  58. @Autowired
  59. private BisInspAllRlationPersDao bisInspAllRlationPersDao;
  60. @Autowired
  61. TacPawpRgstrDao tacPawpRgstrDao;
  62. /**
  63. * 新增/编辑稽查专家测评单表
  64. */
  65. @ApiOperation(value = "修改")
  66. @RequestMapping(value = "/", method = RequestMethod.POST)
  67. public BaseResponse insert(@ApiParam(name = "tacEvaluationExternalExpert", value = "TacEvaluationExternalExpert", required = true)
  68. @RequestBody TacEvaluationExternalExpert tacEvaluationExternalExpert) {
  69. String userId = getCurrentPersId();// 用户ID
  70. BisInspAllRlationPers user = bisInspAllRlationPersDao.get(userId);// 根据用户ID获取人员信息
  71. if("360000000000".equals(user.getProvince())){// 江西省
  72. TacWorkerBParam workerB = new TacWorkerBParam();
  73. workerB.setLoginId(userId);
  74. workerB.setName(user.getPersName());
  75. workerB.setProvince("360000000000");
  76. TacWorkerB vo = tacWorkerBService.getBy(workerB);
  77. if(null!=vo && "1".equals(vo.getIsExternal())){// 是否外聘为 1是
  78. return buildFailResponse("当前用户为外聘专家,无法评分!");
  79. }
  80. }
  81. // 校验稽查问题是否全部提交,只有全部提交(状态值为4)才可以保存打分结果
  82. // 1.前期与设计基本情况填报状态PDBST_STAT,2.建设管理基本情况表招标投标制填报状态BSTOCM_TSOPBFP_STAT,3.建设管理基本情况表合同管理制填报状态BSTOCM_CMS_STAT
  83. // 4.计划下达与执行基本情况表填报状态RAIOBIS_STAT,5.工程质量基本情况表工程实体质量与验收填报状态BITOPQ_PEQAA_STAT,6.工程安全基本情况表施工单位填报状态BIOES_RWUNIT_STAT
  84. TacPawpRgstrParam TacPawpParam = new TacPawpRgstrParam();
  85. TacPawpParam.setProvince(user.getProvince());// 省份编码
  86. TacPawpParam.setObjId(tacEvaluationExternalExpert.getProjId());// 项目ID
  87. TacPawpRgstr proInfo = tacPawpRgstrDao.getBy(TacPawpParam);// 项目信息
  88. String state = "4";
  89. if(null!=proInfo){
  90. if(!state.equals(proInfo.getPdbstStat()) || !state.equals(proInfo.getBstocmTsopbfpStat()) || !state.equals(proInfo.getBstocmCmsStat())
  91. || !state.equals(proInfo.getRaiobisStat()) || !state.equals(proInfo.getBitopqPeqaaStat()) || !state.equals(proInfo.getBioesRwunitStat())){
  92. return buildFailResponse("问题尚未全部提交,无法保存打分结果!");
  93. }
  94. }
  95. int ret = 0;
  96. if (StringUtils.isBlank(tacEvaluationExternalExpert.getId())) {
  97. logger.debug("新增 tacEvaluationExternalExpert");
  98. tacEvaluationExternalExpert.setOrgId(getCurrentOrgId());
  99. tacEvaluationExternalExpert.setPersId(userId);
  100. tacEvaluationExternalExpert.setAdCode(user.getProvince());
  101. ret = tacEvaluationExternalExpertService.insert(tacEvaluationExternalExpert);
  102. } else {
  103. logger.debug("修改 tacEvaluationExternalExpert");
  104. ret = tacEvaluationExternalExpertService.update(tacEvaluationExternalExpert);
  105. }
  106. // 添加项目综合评分记录信息
  107. String projId = tacEvaluationExternalExpert.getProjId();// 项目ID
  108. String expertId = tacEvaluationExternalExpert.getExpertId();// 外聘专家ID
  109. if(StringUtils.isNotBlank(projId) && StringUtils.isNotBlank(expertId)){
  110. // 先查询有没有记录,有的话,执行更新,没有的话执行新增
  111. TacEvaluationExternalExpert queryRt = tacEvaluationExternalExpertService.selectOneDetailByProjIdAndExpertId(projId,expertId);
  112. // 获取综合评分信息
  113. TacEvaluationExternalExpert hj = tacEvaluationExternalExpertService.selectHjScoreByProjIdAndExpertId(projId,expertId);
  114. TacEvaluationExternalExpert expert = new TacEvaluationExternalExpertParam();
  115. expert.setBusinessLevel(hj.getBusinessLevel());// 业务水平
  116. expert.setQualityResults(hj.getQualityResults());// 成果质量
  117. expert.setWorkStyle(hj.getWorkStyle());// 工作作风
  118. expert.setScore(hj.getScore());// 总得分
  119. expert.setEvalLevel(getEvalLevelByScore(hj.getScore()));// 等级
  120. if(StringUtils.isNotBlank(tacEvaluationExternalExpert.getNote())){
  121. expert.setNote(tacEvaluationExternalExpert.getNote());// 备注
  122. }
  123. if(null==queryRt){// 新增
  124. expert.setId(UuidUtil.uuid());
  125. expert.setProjId(projId);
  126. expert.setExpertId(expertId);
  127. expert.setExpertName(tacEvaluationExternalExpert.getExpertName());
  128. expert.setIntm(new Date());
  129. tacEvaluationExternalExpertService.insertHjScoreByProjIdAndExpertId(expert);
  130. } else {// 修改
  131. expert.setId(queryRt.getId());
  132. expert.setUptm(new Date());
  133. tacEvaluationExternalExpertService.update(expert);
  134. }
  135. }
  136. return buildSuccessResponse(tacEvaluationExternalExpert);
  137. }
  138. // 根据总得分计算等级 优(95-100)、良(85-94)、合格(75-84)、不合格(0-74)
  139. private String getEvalLevelByScore(Double score){
  140. // 分数向下取整(小数不要,取整)后,计算等级
  141. int sco2 = score.intValue();
  142. if(sco2>=95){
  143. return "优";
  144. } else if(85<=sco2 && sco2<=94){
  145. return "良";
  146. } else if(75<=sco2 && sco2<=84){
  147. return "合格";
  148. } else {
  149. return "不合格";
  150. }
  151. }
  152. /**
  153. * 删除稽查专家测评 单表
  154. */
  155. @ApiOperation(value = "根据ID删除")
  156. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  157. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  158. int ret = tacEvaluationExternalExpertService.delete(id);
  159. return buildSuccessResponse();
  160. }
  161. /**
  162. * 查询稽查专家测评单表
  163. */
  164. @ApiOperation(value = "根据ID获取单表")
  165. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  166. public BaseResponse<TacEvaluationExternalExpert> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  167. TacEvaluationExternalExpert tacEvaluationExternalExpert = tacEvaluationExternalExpertService.get(id);
  168. return buildSuccessResponse(tacEvaluationExternalExpert);
  169. }
  170. /**
  171. * 查询稽查专家测评列表
  172. */
  173. @ApiOperation(value = "列表--分页")
  174. @RequestMapping(value = "/page", method = RequestMethod.POST)
  175. public BaseResponse<PageInfo> page(@ApiParam(name = "tacEvaluationExternalExpertParam", value = "tacEvaluationExternalExpertParam", required = true)
  176. @RequestBody TacEvaluationExternalExpertParam tacEvaluationExternalExpertParam) {
  177. tacEvaluationExternalExpertParam.setOrgId(getCurrentOrgId());
  178. if(StringUtils.isBlank(tacEvaluationExternalExpertParam.getAdCode())){
  179. tacEvaluationExternalExpertParam.setAdCode(AdLevelUtil.getAddvcd(olBisInspOrgService.getRlProvince(getCurrentOrgId())));
  180. }
  181. return buildSuccessResponse(tacEvaluationExternalExpertService.findPageInfo(tacEvaluationExternalExpertParam));
  182. }
  183. /**
  184. * 导出稽查专家测评列表
  185. */
  186. @ApiOperation(value = "根据条件导出稽查专家测评")
  187. @RequestMapping(value = "/export", method = RequestMethod.POST)
  188. public void export(@ApiParam(name = "tacEvaluationExternalExpertParam", value = "tacEvaluationExternalExpertParam")
  189. TacEvaluationExternalExpertParam tacEvaluationExternalExpertParam,
  190. HttpServletResponse response) {
  191. tacEvaluationExternalExpertParam.setOrgId(getCurrentOrgId());
  192. if(StringUtils.isBlank(tacEvaluationExternalExpertParam.getAdCode())){
  193. tacEvaluationExternalExpertParam.setAdCode(AdLevelUtil.getAddvcd(olBisInspOrgService.getRlProvince(getCurrentOrgId())));
  194. }
  195. tacEvaluationExternalExpertService.export(tacEvaluationExternalExpertParam, response);
  196. }
  197. /**
  198. * 查询待测评的稽查外聘专家列表
  199. */
  200. @ApiOperation(value = "待打分的外聘专家--列表")
  201. @RequestMapping(value = "/todo/eval/list", method = RequestMethod.POST)
  202. public BaseResponse<List<TacEvaluationExternalExpertVo>> findEavlObjList(@ApiParam(name = "tacEvaluationExternalExpertParam", value = "tacEvaluationExternalExpertParam", required = true)
  203. @RequestBody TacEvaluationExternalExpertParam tacEvaluationExternalExpertParam) {
  204. tacEvaluationExternalExpertParam.setOrgId(getCurrentOrgId());
  205. if(StringUtils.isBlank(tacEvaluationExternalExpertParam.getAdCode())){
  206. tacEvaluationExternalExpertParam.setAdCode(AdLevelUtil.getAddvcd(olBisInspOrgService.getRlProvince(getCurrentOrgId())));
  207. }
  208. // 只查询本人打分记录
  209. tacEvaluationExternalExpertParam.setPersId(getCurrentPersId());
  210. return buildSuccessResponse(tacEvaluationExternalExpertService.selectEavlPersListByGroupId(tacEvaluationExternalExpertParam));
  211. }
  212. /**
  213. * 查询待测评的稽查外聘专家列表
  214. */
  215. @ApiOperation(value = "外聘专家测评结果--分页")
  216. @RequestMapping(value = "/result/page", method = RequestMethod.POST)
  217. public BaseResponse<PageInfo> pageResult(@ApiParam(name = "tacEvaluationExternalExpertParam", value = "tacEvaluationExternalExpertParam", required = true)
  218. @RequestBody(required = false) TacEvaluationExternalExpertParam tacEvaluationExternalExpertParam) {
  219. if(null == tacEvaluationExternalExpertParam){
  220. tacEvaluationExternalExpertParam = new TacEvaluationExternalExpertParam();
  221. }
  222. tacEvaluationExternalExpertParam.setOrgId(getCurrentOrgId());
  223. if(StringUtils.isBlank(tacEvaluationExternalExpertParam.getAdCode())){
  224. tacEvaluationExternalExpertParam.setAdCode(AdLevelUtil.getAddvcd(olBisInspOrgService.getRlProvince(getCurrentOrgId())));
  225. }
  226. return buildSuccessResponse(tacEvaluationExternalExpertService.findEvaluationResult(tacEvaluationExternalExpertParam));
  227. }
  228. /**
  229. * 查询待测评的稽查外聘专家列表
  230. */
  231. @ApiOperation(value = "外聘专家测评结果--分页")
  232. @RequestMapping(value = "/result/details/page", method = RequestMethod.POST)
  233. public BaseResponse<PageInfo> pageResultDetails(@ApiParam(name = "tacEvaluationExternalExpertParam", value = "tacEvaluationExternalExpertParam", required = true)
  234. @RequestBody TacEvaluationExternalExpertParam tacEvaluationExternalExpertParam) {
  235. String expertId = tacEvaluationExternalExpertParam.getExpertId();// 专家ID
  236. String projId = tacEvaluationExternalExpertParam.getProjId();// 项目ID
  237. List<TacEvaluationExternalExpertVo> dataList = tacEvaluationExternalExpertService.findEvaluationResultDetails2(expertId,projId);
  238. // 1.稽查专家测评结果进入详情页面--数据需要特殊处理
  239. // 2.根据项目ID和专家ID进入详情页面--数据不需要处理
  240. if(StringUtils.isBlank(projId) && StringUtils.isNotBlank(expertId)){// 第一种情况
  241. // 处理评分修改内容并添加标记,达到前端特殊效果(修改项展示为红色)
  242. TacEvaluationExternalExpertVo vo = null;
  243. for(int i=0;i<dataList.size();i++){
  244. vo = dataList.get(i);
  245. String back = vo.getBackUp();
  246. if(!"".equals(back) && null!=back){
  247. String rets[] = back.split(",");
  248. if(null!=vo.getBusinessLevel() && checkNotEqual(vo.getBusinessLevel(),rets[0])){
  249. dataList.get(i).setBusinessLevelFlag(1);// 业务水平 标记(1代表修改)
  250. }
  251. if(null!=vo.getQualityResults() && checkNotEqual(vo.getQualityResults(),rets[1])){
  252. dataList.get(i).setQualityResultsFlag(1);// 成果质量 标记(1代表修改)
  253. }
  254. if(null!=vo.getWorkStyle() && checkNotEqual(vo.getWorkStyle(),rets[2])){
  255. dataList.get(i).setWorkStyleFlag(1);// 工作作风 标记(1代表修改)
  256. }
  257. if(null!=vo.getScore() && checkNotEqual(vo.getScore(),rets[3])){
  258. dataList.get(i).setScoreFlag(1);// 总得分 标记(1代表修改)
  259. }
  260. if(null!=vo.getEvalLevel() && !vo.getEvalLevel().equals(rets[4])){
  261. dataList.get(i).setEvalLevelFlag(1);// 等级 标记(1代表修改)
  262. }
  263. }
  264. }
  265. }
  266. PageHelper.startPage(tacEvaluationExternalExpertParam);// 分页
  267. PageInfo<TacEvaluationExternalExpertVo> pageInfo = new PageInfo(dataList);
  268. return buildSuccessResponse(pageInfo);
  269. }
  270. private boolean checkNotEqual(Double value1,String value2){
  271. BigDecimal val1 = new BigDecimal(value1.toString()).setScale(2);
  272. BigDecimal val2 = new BigDecimal(value2).setScale(2);
  273. if(val1.compareTo(val2) == 0){
  274. return false;
  275. }
  276. return true;
  277. }
  278. /**
  279. * 修改可恢复
  280. */
  281. @ApiOperation(value = "修改")
  282. @RequestMapping(value = "/modify", method = RequestMethod.POST)
  283. public BaseResponse modify(@ApiParam(name = "tacEvaluationExternalExpert", value = "TacEvaluationExternalExpert", required = true)
  284. @RequestBody TacEvaluationExternalExpert tacEvaluationExternalExpert) {
  285. this.tacEvaluationExternalExpertService.updateScoreById(tacEvaluationExternalExpert);
  286. return buildSuccessResponse(tacEvaluationExternalExpert);
  287. }
  288. /**
  289. * 恢复
  290. */
  291. @ApiOperation(value = "恢复")
  292. @RequestMapping(value = "/revert/{id}", method = RequestMethod.POST)
  293. public BaseResponse revertModify(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  294. int rowNum = this.tacEvaluationExternalExpertService.revertScoreById(id);
  295. return buildSuccessResponse(rowNum);
  296. }
  297. }