package cn.com.goldenwater.dcproj.service.impl.tac; import cn.com.goldenwater.core.service.AbstractCrudService; import cn.com.goldenwater.dcproj.dao.TacEvaluationExternalExpertDao; import cn.com.goldenwater.dcproj.dao.TacInspYearBatchGroupPersDao; import cn.com.goldenwater.dcproj.dao.TacPawpRgstrDao; import cn.com.goldenwater.dcproj.model.TacEvaluationExternalExpert; import cn.com.goldenwater.dcproj.model.TacInspYearBatchGroupPers; import cn.com.goldenwater.dcproj.param.TacEvaluationExternalExpertParam; import cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupPersParam; import cn.com.goldenwater.dcproj.param.TacPawpRgstrParam; import cn.com.goldenwater.dcproj.service.TacEvaluationExternalExpertService; import cn.com.goldenwater.dcproj.utils.StringUtils; import cn.com.goldenwater.dcproj.utils.expExcel.ExportUtil; import cn.com.goldenwater.dcproj.vo.TacEvaluationExternalExpertVo; import cn.com.goldenwater.id.util.UuidUtil; import cn.com.goldenwater.target.CheckException; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * 稽查专家测评Service业务层处理 * * @author ruoyi * @date 2023-03-06 */ @Service @Transactional public class TacEvaluationExternalExpertServiceImpl extends AbstractCrudService implements TacEvaluationExternalExpertService { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private TacEvaluationExternalExpertDao tacEvaluationExternalExpertDao; @Autowired private TacInspYearBatchGroupPersDao tacInspYearBatchGroupPersDao; @Autowired private TacPawpRgstrDao pawpRgstrDao; public TacEvaluationExternalExpertServiceImpl(TacEvaluationExternalExpertDao tacEvaluationExternalExpertDao) { super(tacEvaluationExternalExpertDao); this.tacEvaluationExternalExpertDao = tacEvaluationExternalExpertDao; } /** * 增加稽查专家测评 * * @return 稽查专家测评 */ @Override public int insert(TacEvaluationExternalExpert tacEvaluationExternalExpert) { logger.debug("TacEvaluationExternalExpert 新增"); // 判断 外聘专家是否提交问题 // 1 判定当前专家在组、项目 中有几个角色 TacInspYearBatchGroupPersParam batchGroupPersParam = new TacInspYearBatchGroupPersParam(); batchGroupPersParam.setGroupId(tacEvaluationExternalExpert.getGroupId()); batchGroupPersParam.setPersId(tacEvaluationExternalExpert.getExpertId()); List groupPersList = this.tacInspYearBatchGroupPersDao.findList(batchGroupPersParam); if(null != groupPersList){ TacPawpRgstrParam pawpRgstrParam = new TacPawpRgstrParam(); pawpRgstrParam.setGroupId(tacEvaluationExternalExpert.getGroupId()); pawpRgstrParam.setObjId(tacEvaluationExternalExpert.getProjId()); for(TacInspYearBatchGroupPers batchGroupPers : groupPersList){ pawpRgstrParam.setPersId(batchGroupPers.getRoleType()); Integer num = pawpRgstrDao.findExpertSubmitCount(pawpRgstrParam); if(null == num || num.intValue()<1){ throw new CheckException(null == tacEvaluationExternalExpert.getExpertName()?"":tacEvaluationExternalExpert.getExpertName()+"专家未提交问题,不能打分"); } } }else { throw new CheckException(null == tacEvaluationExternalExpert.getExpertName()?"":tacEvaluationExternalExpert.getExpertName()+"专家信息错误,不能打分"); } String uuid = UuidUtil.uuid(); // 生成uuid tacEvaluationExternalExpert.setId(uuid); tacEvaluationExternalExpert.setIntm(new Date()); tacEvaluationExternalExpert.setUptm(new Date()); return this.tacEvaluationExternalExpertDao.insert(tacEvaluationExternalExpert); } /** * 更新 稽查专家测评 * 主键更新 * @param tacEvaluationExternalExpert 稽查专家测评 * @return 稽查专家测评 */ @Override public int update(TacEvaluationExternalExpert tacEvaluationExternalExpert) { logger.debug("TacEvaluationExternalExpert 更新"); tacEvaluationExternalExpert.setUptm(new Date()); return this.tacEvaluationExternalExpertDao.update(tacEvaluationExternalExpert); } /** * 主键删除 稽查专家测评 * * @param id 稽查专家测评主键 * @return 稽查专家测评 */ @Override public int delete(String id) { logger.debug("TacEvaluationExternalExpert 删除"); return this.tacEvaluationExternalExpertDao.delete(id); } /** * 导出 稽查专家测评 * * @param tacEvaluationExternalExpertParam 筛选查询参数 * @param response */ @Override public void export(TacEvaluationExternalExpertParam tacEvaluationExternalExpertParam, HttpServletResponse response) { logger.debug("TacEvaluationExternalExpert 导出"); List tacEvaluationExternalExpertList = findList(tacEvaluationExternalExpertParam); List columns = new ArrayList() {{ add("id"); add("orgId"); add("adCode"); add("groupId"); add("projId"); add("expertId"); add("expertName"); add("expertProf"); add("businessLevel"); add("qualityResults"); add("workStyle"); add("oneVeto"); add("score"); add("evalLevel"); add("note"); add("persId"); add("intm"); add("uptm"); }}; ExportUtil.exportExcel2(tacEvaluationExternalExpertList, response, "稽查专家测评列表", columns, TacEvaluationExternalExpert.class); } /** * 批量添加 * @param tacEvaluationExternalExpertList * @return */ @Override public int insertBatchFile(List tacEvaluationExternalExpertList){ return this.tacEvaluationExternalExpertDao.insertBatchFile(tacEvaluationExternalExpertList); } /** * 待测评的稽查外聘专家列表 * @param externalExpertParam * @return */ @Override public List selectEavlPersListByGroupId(TacEvaluationExternalExpertParam externalExpertParam){ return this.tacEvaluationExternalExpertDao.selectEavlPersListByGroupId(externalExpertParam); } /** * 稽查外聘专家测评结果 * @param externalExpertParam * @return */ @Override public PageInfo findEvaluationResult(TacEvaluationExternalExpertParam externalExpertParam) { PageHelper.startPage(externalExpertParam); List list = this.tacEvaluationExternalExpertDao.findEvaluationResult2(externalExpertParam); PageInfo pageInfo = new PageInfo(list); return pageInfo; } /** * 稽查外聘专家测评结果详情类别 * @param externalExpertParam * @return */ @Override public PageInfo findEvaluationResultDetails(TacEvaluationExternalExpertParam externalExpertParam){ PageHelper.startPage(externalExpertParam); List list = this.tacEvaluationExternalExpertDao.findEvaluationResultDetails(externalExpertParam); PageInfo pageInfo = new PageInfo(list); return pageInfo; } /** * 修改评分 * @param externalExpertParam * @return */ @Override public int updateScoreById(TacEvaluationExternalExpert externalExpertParam){ return this.tacEvaluationExternalExpertDao.updateScoreById(externalExpertParam); } /** * 恢复评分 * @param id * @return */ @Override public int revertScoreById(String id){ TacEvaluationExternalExpert externalExpert = this.tacEvaluationExternalExpertDao.get(id); if(null != externalExpert){ String backup = externalExpert.getBackUp(); if(StringUtils.isNotBlank(backup)){ String[] strs = backup.split(","); TacEvaluationExternalExpert externalExpertParam = new TacEvaluationExternalExpertParam(); externalExpertParam.setId(id); externalExpertParam.setBusinessLevel(Double.parseDouble(strs[0])); externalExpertParam.setQualityResults(Double.parseDouble(strs[1])); externalExpertParam.setWorkStyle(Double.parseDouble(strs[2])); externalExpertParam.setScore(Double.parseDouble(strs[3])); externalExpertParam.setEvalLevel(strs[4]); if(strs.length==6){ externalExpertParam.setNote(strs[5]); } return this.tacEvaluationExternalExpertDao.revertScoreById(externalExpertParam); } } return 0; } @Override public TacEvaluationExternalExpert selectOneDetailByProjIdAndExpertId(String projId,String expertId){ return this.tacEvaluationExternalExpertDao.selectOneDetailByProjIdAndExpertId(projId,expertId); } @Override public TacEvaluationExternalExpert selectHjScoreByProjIdAndExpertId(String projId,String expertId){ return this.tacEvaluationExternalExpertDao.selectHjScoreByProjIdAndExpertId(projId,expertId); } @Override public int insertHjScoreByProjIdAndExpertId(TacEvaluationExternalExpert vo){ return this.tacEvaluationExternalExpertDao.insert(vo); } @Override public List findEvaluationResultDetails2(String expertId,String projId){ return this.tacEvaluationExternalExpertDao.findEvaluationResultDetails2(expertId,projId); } }