| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- package cn.com.goldenwater.dcproj.controller.tac;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.dao.BisInspAllRlationPersDao;
- import cn.com.goldenwater.dcproj.dao.TacPawpRgstrDao;
- import cn.com.goldenwater.dcproj.model.*;
- import cn.com.goldenwater.dcproj.param.TacEvaluationExternalExpertParam;
- import cn.com.goldenwater.dcproj.param.TacPawpRgstrParam;
- import cn.com.goldenwater.dcproj.param.TacWorkerBParam;
- import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
- import cn.com.goldenwater.dcproj.service.TacEvaluationExternalExpertService;
- import cn.com.goldenwater.dcproj.service.TacWorkerBService;
- import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
- import cn.com.goldenwater.dcproj.utils.StringUtils;
- import cn.com.goldenwater.dcproj.vo.TacEvaluationExternalExpertVo;
- import cn.com.goldenwater.id.util.UuidUtil;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import javax.servlet.http.HttpServletResponse;
- import java.math.BigDecimal;
- import java.util.Date;
- import java.util.List;
- /**
- * 稽查专家测评Controller
- *
- * @author ruoyi
- * @date 2023-03-06
- */
- @Api(value = "稽查专家测评",tags="稽查专家测评")
- @RestController
- @RequestMapping("/tac/evalation/expert")
- public class TacEvaluationExternalExpertController extends BaseController
- {
- private Logger logger = LoggerFactory.getLogger(getClass());
- /**
- * 稽查专家测评 服务
- */
- @Autowired
- private TacEvaluationExternalExpertService tacEvaluationExternalExpertService;
- /**
- * 机构 区域 服务
- */
- @Autowired
- private OlBisInspOrgService olBisInspOrgService;
- @Autowired
- private TacWorkerBService tacWorkerBService;
- @Autowired
- private BisInspAllRlationPersDao bisInspAllRlationPersDao;
- @Autowired
- TacPawpRgstrDao tacPawpRgstrDao;
- /**
- * 新增/编辑稽查专家测评单表
- */
- @ApiOperation(value = "修改")
- @RequestMapping(value = "/", method = RequestMethod.POST)
- public BaseResponse insert(@ApiParam(name = "tacEvaluationExternalExpert", value = "TacEvaluationExternalExpert", required = true)
- @RequestBody TacEvaluationExternalExpert tacEvaluationExternalExpert) {
- String userId = getCurrentPersId();// 用户ID
- BisInspAllRlationPers user = bisInspAllRlationPersDao.get(userId);// 根据用户ID获取人员信息
- if("360000000000".equals(user.getProvince())){// 江西省
- TacWorkerBParam workerB = new TacWorkerBParam();
- workerB.setLoginId(userId);
- workerB.setName(user.getPersName());
- workerB.setProvince("360000000000");
- TacWorkerB vo = tacWorkerBService.getBy(workerB);
- if(null!=vo && "1".equals(vo.getIsExternal())){// 是否外聘为 1是
- return buildFailResponse("当前用户为外聘专家,无法评分!");
- }
- }
- // 校验稽查问题是否全部提交,只有全部提交(状态值为4)才可以保存打分结果
- // 1.前期与设计基本情况填报状态PDBST_STAT,2.建设管理基本情况表招标投标制填报状态BSTOCM_TSOPBFP_STAT,3.建设管理基本情况表合同管理制填报状态BSTOCM_CMS_STAT
- // 4.计划下达与执行基本情况表填报状态RAIOBIS_STAT,5.工程质量基本情况表工程实体质量与验收填报状态BITOPQ_PEQAA_STAT,6.工程安全基本情况表施工单位填报状态BIOES_RWUNIT_STAT
- TacPawpRgstrParam TacPawpParam = new TacPawpRgstrParam();
- TacPawpParam.setProvince(user.getProvince());// 省份编码
- TacPawpParam.setObjId(tacEvaluationExternalExpert.getProjId());// 项目ID
- TacPawpRgstr proInfo = tacPawpRgstrDao.getBy(TacPawpParam);// 项目信息
- String state = "4";
- if(null!=proInfo){
- if(!state.equals(proInfo.getPdbstStat()) || !state.equals(proInfo.getBstocmTsopbfpStat()) || !state.equals(proInfo.getBstocmCmsStat())
- || !state.equals(proInfo.getRaiobisStat()) || !state.equals(proInfo.getBitopqPeqaaStat()) || !state.equals(proInfo.getBioesRwunitStat())){
- return buildFailResponse("问题尚未全部提交,无法保存打分结果!");
- }
- }
- int ret = 0;
- if (StringUtils.isBlank(tacEvaluationExternalExpert.getId())) {
- logger.debug("新增 tacEvaluationExternalExpert");
- tacEvaluationExternalExpert.setOrgId(getCurrentOrgId());
- tacEvaluationExternalExpert.setPersId(userId);
- tacEvaluationExternalExpert.setAdCode(user.getProvince());
- ret = tacEvaluationExternalExpertService.insert(tacEvaluationExternalExpert);
- } else {
- logger.debug("修改 tacEvaluationExternalExpert");
- ret = tacEvaluationExternalExpertService.update(tacEvaluationExternalExpert);
- }
- // 添加项目综合评分记录信息
- String projId = tacEvaluationExternalExpert.getProjId();// 项目ID
- String expertId = tacEvaluationExternalExpert.getExpertId();// 外聘专家ID
- if(StringUtils.isNotBlank(projId) && StringUtils.isNotBlank(expertId)){
- // 先查询有没有记录,有的话,执行更新,没有的话执行新增
- TacEvaluationExternalExpert queryRt = tacEvaluationExternalExpertService.selectOneDetailByProjIdAndExpertId(projId,expertId);
- // 获取综合评分信息
- TacEvaluationExternalExpert hj = tacEvaluationExternalExpertService.selectHjScoreByProjIdAndExpertId(projId,expertId);
- TacEvaluationExternalExpert expert = new TacEvaluationExternalExpertParam();
- expert.setBusinessLevel(hj.getBusinessLevel());// 业务水平
- expert.setQualityResults(hj.getQualityResults());// 成果质量
- expert.setWorkStyle(hj.getWorkStyle());// 工作作风
- expert.setScore(hj.getScore());// 总得分
- expert.setEvalLevel(getEvalLevelByScore(hj.getScore()));// 等级
- if(StringUtils.isNotBlank(tacEvaluationExternalExpert.getNote())){
- expert.setNote(tacEvaluationExternalExpert.getNote());// 备注
- }
- if(null==queryRt){// 新增
- expert.setId(UuidUtil.uuid());
- expert.setProjId(projId);
- expert.setExpertId(expertId);
- expert.setExpertName(tacEvaluationExternalExpert.getExpertName());
- expert.setIntm(new Date());
- tacEvaluationExternalExpertService.insertHjScoreByProjIdAndExpertId(expert);
- } else {// 修改
- expert.setId(queryRt.getId());
- expert.setUptm(new Date());
- tacEvaluationExternalExpertService.update(expert);
- }
- }
- return buildSuccessResponse(tacEvaluationExternalExpert);
- }
- // 根据总得分计算等级 优(95-100)、良(85-94)、合格(75-84)、不合格(0-74)
- private String getEvalLevelByScore(Double score){
- // 分数向下取整(小数不要,取整)后,计算等级
- int sco2 = score.intValue();
- if(sco2>=95){
- return "优";
- } else if(85<=sco2 && sco2<=94){
- return "良";
- } else if(75<=sco2 && sco2<=84){
- return "合格";
- } else {
- return "不合格";
- }
- }
- /**
- * 删除稽查专家测评 单表
- */
- @ApiOperation(value = "根据ID删除")
- @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int ret = tacEvaluationExternalExpertService.delete(id);
- return buildSuccessResponse();
- }
- /**
- * 查询稽查专家测评单表
- */
- @ApiOperation(value = "根据ID获取单表")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<TacEvaluationExternalExpert> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- TacEvaluationExternalExpert tacEvaluationExternalExpert = tacEvaluationExternalExpertService.get(id);
- return buildSuccessResponse(tacEvaluationExternalExpert);
- }
- /**
- * 查询稽查专家测评列表
- */
- @ApiOperation(value = "列表--分页")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo> page(@ApiParam(name = "tacEvaluationExternalExpertParam", value = "tacEvaluationExternalExpertParam", required = true)
- @RequestBody TacEvaluationExternalExpertParam tacEvaluationExternalExpertParam) {
- tacEvaluationExternalExpertParam.setOrgId(getCurrentOrgId());
- if(StringUtils.isBlank(tacEvaluationExternalExpertParam.getAdCode())){
- tacEvaluationExternalExpertParam.setAdCode(AdLevelUtil.getAddvcd(olBisInspOrgService.getRlProvince(getCurrentOrgId())));
- }
- return buildSuccessResponse(tacEvaluationExternalExpertService.findPageInfo(tacEvaluationExternalExpertParam));
- }
- /**
- * 导出稽查专家测评列表
- */
- @ApiOperation(value = "根据条件导出稽查专家测评")
- @RequestMapping(value = "/export", method = RequestMethod.POST)
- public void export(@ApiParam(name = "tacEvaluationExternalExpertParam", value = "tacEvaluationExternalExpertParam")
- TacEvaluationExternalExpertParam tacEvaluationExternalExpertParam,
- HttpServletResponse response) {
- tacEvaluationExternalExpertParam.setOrgId(getCurrentOrgId());
- if(StringUtils.isBlank(tacEvaluationExternalExpertParam.getAdCode())){
- tacEvaluationExternalExpertParam.setAdCode(AdLevelUtil.getAddvcd(olBisInspOrgService.getRlProvince(getCurrentOrgId())));
- }
- tacEvaluationExternalExpertService.export(tacEvaluationExternalExpertParam, response);
- }
- /**
- * 查询待测评的稽查外聘专家列表
- */
- @ApiOperation(value = "待打分的外聘专家--列表")
- @RequestMapping(value = "/todo/eval/list", method = RequestMethod.POST)
- public BaseResponse<List<TacEvaluationExternalExpertVo>> findEavlObjList(@ApiParam(name = "tacEvaluationExternalExpertParam", value = "tacEvaluationExternalExpertParam", required = true)
- @RequestBody TacEvaluationExternalExpertParam tacEvaluationExternalExpertParam) {
- tacEvaluationExternalExpertParam.setOrgId(getCurrentOrgId());
- if(StringUtils.isBlank(tacEvaluationExternalExpertParam.getAdCode())){
- tacEvaluationExternalExpertParam.setAdCode(AdLevelUtil.getAddvcd(olBisInspOrgService.getRlProvince(getCurrentOrgId())));
- }
- // 只查询本人打分记录
- tacEvaluationExternalExpertParam.setPersId(getCurrentPersId());
- return buildSuccessResponse(tacEvaluationExternalExpertService.selectEavlPersListByGroupId(tacEvaluationExternalExpertParam));
- }
- /**
- * 查询待测评的稽查外聘专家列表
- */
- @ApiOperation(value = "外聘专家测评结果--分页")
- @RequestMapping(value = "/result/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo> pageResult(@ApiParam(name = "tacEvaluationExternalExpertParam", value = "tacEvaluationExternalExpertParam", required = true)
- @RequestBody(required = false) TacEvaluationExternalExpertParam tacEvaluationExternalExpertParam) {
- if(null == tacEvaluationExternalExpertParam){
- tacEvaluationExternalExpertParam = new TacEvaluationExternalExpertParam();
- }
- tacEvaluationExternalExpertParam.setOrgId(getCurrentOrgId());
- if(StringUtils.isBlank(tacEvaluationExternalExpertParam.getAdCode())){
- tacEvaluationExternalExpertParam.setAdCode(AdLevelUtil.getAddvcd(olBisInspOrgService.getRlProvince(getCurrentOrgId())));
- }
- return buildSuccessResponse(tacEvaluationExternalExpertService.findEvaluationResult(tacEvaluationExternalExpertParam));
- }
- /**
- * 查询待测评的稽查外聘专家列表
- */
- @ApiOperation(value = "外聘专家测评结果--分页")
- @RequestMapping(value = "/result/details/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo> pageResultDetails(@ApiParam(name = "tacEvaluationExternalExpertParam", value = "tacEvaluationExternalExpertParam", required = true)
- @RequestBody TacEvaluationExternalExpertParam tacEvaluationExternalExpertParam) {
- String expertId = tacEvaluationExternalExpertParam.getExpertId();// 专家ID
- String projId = tacEvaluationExternalExpertParam.getProjId();// 项目ID
- List<TacEvaluationExternalExpertVo> dataList = tacEvaluationExternalExpertService.findEvaluationResultDetails2(expertId,projId);
- // 1.稽查专家测评结果进入详情页面--数据需要特殊处理
- // 2.根据项目ID和专家ID进入详情页面--数据不需要处理
- if(StringUtils.isBlank(projId) && StringUtils.isNotBlank(expertId)){// 第一种情况
- // 处理评分修改内容并添加标记,达到前端特殊效果(修改项展示为红色)
- TacEvaluationExternalExpertVo vo = null;
- for(int i=0;i<dataList.size();i++){
- vo = dataList.get(i);
- String back = vo.getBackUp();
- if(!"".equals(back) && null!=back){
- String rets[] = back.split(",");
- if(null!=vo.getBusinessLevel() && checkNotEqual(vo.getBusinessLevel(),rets[0])){
- dataList.get(i).setBusinessLevelFlag(1);// 业务水平 标记(1代表修改)
- }
- if(null!=vo.getQualityResults() && checkNotEqual(vo.getQualityResults(),rets[1])){
- dataList.get(i).setQualityResultsFlag(1);// 成果质量 标记(1代表修改)
- }
- if(null!=vo.getWorkStyle() && checkNotEqual(vo.getWorkStyle(),rets[2])){
- dataList.get(i).setWorkStyleFlag(1);// 工作作风 标记(1代表修改)
- }
- if(null!=vo.getScore() && checkNotEqual(vo.getScore(),rets[3])){
- dataList.get(i).setScoreFlag(1);// 总得分 标记(1代表修改)
- }
- if(null!=vo.getEvalLevel() && !vo.getEvalLevel().equals(rets[4])){
- dataList.get(i).setEvalLevelFlag(1);// 等级 标记(1代表修改)
- }
- }
- }
- }
- PageHelper.startPage(tacEvaluationExternalExpertParam);// 分页
- PageInfo<TacEvaluationExternalExpertVo> pageInfo = new PageInfo(dataList);
- return buildSuccessResponse(pageInfo);
- }
- private boolean checkNotEqual(Double value1,String value2){
- BigDecimal val1 = new BigDecimal(value1.toString()).setScale(2);
- BigDecimal val2 = new BigDecimal(value2).setScale(2);
- if(val1.compareTo(val2) == 0){
- return false;
- }
- return true;
- }
- /**
- * 修改可恢复
- */
- @ApiOperation(value = "修改")
- @RequestMapping(value = "/modify", method = RequestMethod.POST)
- public BaseResponse modify(@ApiParam(name = "tacEvaluationExternalExpert", value = "TacEvaluationExternalExpert", required = true)
- @RequestBody TacEvaluationExternalExpert tacEvaluationExternalExpert) {
- this.tacEvaluationExternalExpertService.updateScoreById(tacEvaluationExternalExpert);
- return buildSuccessResponse(tacEvaluationExternalExpert);
- }
- /**
- * 恢复
- */
- @ApiOperation(value = "恢复")
- @RequestMapping(value = "/revert/{id}", method = RequestMethod.POST)
- public BaseResponse revertModify(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int rowNum = this.tacEvaluationExternalExpertService.revertScoreById(id);
- return buildSuccessResponse(rowNum);
- }
- }
|