package com.kingdee.eas.hr.perf.handler; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.kingdee.bos.BOSException; import com.kingdee.bos.Context; import com.kingdee.bos.rabbitmq.guava.Lists; import com.kingdee.eas.hr.perf.PerformProTeamCollection; import com.kingdee.eas.hr.perf.PerformProTeamFactory; import com.kingdee.eas.hr.perf.PersonPerformProCollection; import com.kingdee.eas.hr.perf.PersonPerformProFactory; import com.kingdee.eas.util.app.DbUtil; import com.kingdee.jdbc.rowset.IRowSet; import com.kingdee.shr.base.syssetting.api.bean.BatchMessageTipsBody; import com.kingdee.shr.base.syssetting.api.bean.BatchMessageTipsHeader; import com.kingdee.shr.base.syssetting.context.SHRContext; import com.kingdee.shr.base.syssetting.exception.SHRWebException; import com.kingdee.shr.base.syssetting.exception.ShrWebBizException; import com.kingdee.shr.perfweb.app.base.evalplan.EvaResultSumLogSourceEnum; import com.kingdee.shr.perfweb.app.exception.SHRPerfWebBizException; import com.kingdee.shr.perfweb.app.resource.SHRPerfWebResource; import com.kingdee.shr.perfweb.exception.SHRPerfWebException; import com.kingdee.shr.perfweb.planexecute.handler.EvaresultAuditBillEntryListHandler; import com.kingdee.shr.perfweb.util.BOSWorkFlowUtil; import com.kingdee.shr.perfweb.util.EvaResultSummaryBillUtil; import com.kingdee.shr.perfweb.util.SHRPerfWebResourceUtil; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.ui.ModelMap; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; import java.sql.SQLException; import java.util.*; import java.util.stream.Collectors; /** * description: EvaresultAuditBillEntryListHandler
* date: 2025/6/24 12:48
* author: lhbj
* version: 1.0
*/ public class EvaresultAuditBillEntryListHandlerEx extends EvaresultAuditBillEntryListHandler { private static Logger logger = LoggerFactory.getLogger(EvaresultAuditBillEntryListHandlerEx.class); @Override protected void setInitData(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap, Map initData) throws SHRWebException { super.setInitData(request, response, modelMap, initData); try { initData.put("performanceLevel", this.getPerformanceLevelByLevelAction(request, response, modelMap)); } catch (Exception e) { e.printStackTrace(); } } public Map> getPerformanceLevelByLevelAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws ShrWebBizException { Map> result = Maps.newHashMap(); try { Context ctx = SHRContext.getInstance().getContext(); String sql = "select CFLEVEL,CFCOEFFICIENT,CFMAXCOEFFICIENT,CFMINCOEFFICIENT from CT_PER_PerformanceLevel "; IRowSet rs = DbUtil.executeQuery(ctx, sql.toString()); while (rs.next()) { Map map = Maps.newHashMap(); String CFLEVEL = rs.getString("CFLEVEL"); BigDecimal CFCOEFFICIENT = rs.getBigDecimal("CFCOEFFICIENT"); BigDecimal CFMAXCOEFFICIENT = rs.getBigDecimal("CFMAXCOEFFICIENT"); BigDecimal CFMINCOEFFICIENT = rs.getBigDecimal("CFMINCOEFFICIENT"); map.put("level", CFLEVEL); map.put("coefficient", CFCOEFFICIENT); map.put("maxcoefficient", CFMAXCOEFFICIENT); map.put("mincoefficient", CFMINCOEFFICIENT); result.put(CFLEVEL, map); } } catch (Exception e) { e.printStackTrace(); throw new ShrWebBizException(e.getMessage()); } return result; } /** [{"evaResult.pnumber":"0000381","evaResult.pname":"谭梓傲","evaResult.positionName":"物资岗","evaResult.evaObj.perfFile.adminOrgUnit.company.name":"湖南红太阳光电科技有限公司","evaResult.evaObj.perfFile.adminOrgUnit.department.name":"综合管理","evaResult.sumScore":"","evaResult.gradeLevel":"","evaResult.auditSumScore":"86.00","evaResult.auditGradeLevel":"C","evaResult.auditReason":"
正态分布更新结果
","evaResult.reviseSumScore":"86.00","evaResult.reviseGradeLevel":"C","evaResult.reviseReason":"正态分布更新结果","id":"KQukJy27Skiy1rPPghjkJBdK16Q=","evaResult.id":"Ka7FkRQuTAaPlTaLvJSD3IESG3Q=","bill.id":"m85zTeeDSmaAU2QLbYWMUoZLdW4=","evaResult.evaObj.id":"gjX3giS2RKurkJVjPhnwa4GI54s=","reviseGradeLevelSelect":"[{\\"value\\":\\"S\\",\\"alias\\":\\"S\\"},{\\"value\\":\\"A\\",\\"alias\\":\\"A\\"},{\\"value\\":\\"B\\",\\"alias\\":\\"B\\"},{\\"value\\":\\"C\\",\\"alias\\":\\"C\\"},{\\"value\\":\\"D\\",\\"alias\\":\\"D\\"}]","levelScoreKVInfo":"{\\n \\"90.00~100.00\\": \\"S\\",\\n \\"80.00~90.00\\": \\"A\\",\\n \\"70.00~80.00\\": \\"B\\",\\n \\"60.00~70.00\\": \\"C\\",\\n \\"0.00~60.00\\": \\"D\\"\\n}","scoreLowLimit":"0","scoreUpLimit":"100","evaResult.period.id":"q6myAjHaQLK+wnczfdLCJEUaiOU=","evaResult.reviseFlag":"是","evaResult.auditFlag":"否"}] * @param request * @param response * @param modelMap * @throws SHRWebException */ public void verifyBeforeSubmitAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException { String entryData = request.getParameter("entryData"); BatchMessageTipsHeader header = new BatchMessageTipsHeader(); boolean isExists = true; if (!com.kingdee.util.StringUtils.isEmpty(entryData)) { int success = 0; int fail = 0; StringBuilder ids = new StringBuilder(); List allIdList = new ArrayList<>(); try { Context ctx = SHRContext.getInstance().getContext(); //明细数据 JSONArray entryList = JSON.parseArray(entryData); for(int i=0;i messageListExt = new ArrayList<>(); messageListExt.add(pnumber); messageListExt.add(pname); messageListExt.add(positionName); body.addMessageListExt(messageListExt); header.addResult(body); } } catch (BOSException | SQLException var7) { var7.printStackTrace(); } ids.delete(ids.length()-1,ids.length()); header.setBillId(ids.toString()); header.setFailureCount(fail); header.setSuccessCount(success); } this.writeSuccessData(header); } protected static void addBatchMessageTip(String unvalidEvaObj, String message, BatchMessageTipsHeader batchMessageTipsHeader) { BatchMessageTipsBody body = new BatchMessageTipsBody(); body.setId(unvalidEvaObj); body.setMuitTipsState(Boolean.FALSE); body.setMuitTipsMessage(message); batchMessageTipsHeader.addResult(body); batchMessageTipsHeader.setFailureCount(batchMessageTipsHeader.getFailureCount() + 1); } /** * 获取人员项目正态分布规则 * * @param ctx * @param idList 非必填 * @param batchMessage 非必填 * @return * @throws BOSException * @throws SQLException */ public Map> getProjectPerformPro(Context ctx, List idList, Map batchMessage) throws BOSException, SQLException { //获取正态分布规则 Map> orgLevelMap = Maps.newHashMap(); PerformProTeamCollection proCollection = PerformProTeamFactory.getLocalInstance(ctx).getPerformProTeamCollection(" where status=1 "); if (proCollection.size() == 1) { StringBuilder orgPerSql = new StringBuilder(); orgPerSql.append(" select fp.fid,fpe.CFS,fpe.CFA,fpe.CFB,fpe.CFC,fpe.CFD,fpe.CFORGPERFORMTYPE "); orgPerSql.append(" from CT_PF_PerformProTeam fp "); orgPerSql.append(" left join CT_PF_PerformProTeamEntry fpe on fp.fid=fpe.FPARENTID "); orgPerSql.append(" where fp.CFSTATUS = 1 "); orgPerSql.append(" order by fp.FCREATETIME "); IRowSet rs = DbUtil.executeQuery(ctx, orgPerSql.toString()); while (rs.next()) { Map objectMap = Maps.newHashMap(); String type = rs.getString("CFORGPERFORMTYPE"); objectMap.put("S", rs.getBigDecimal("CFS")); objectMap.put("A", rs.getBigDecimal("CFA")); objectMap.put("B", rs.getBigDecimal("CFB")); objectMap.put("C", rs.getBigDecimal("CFC")); objectMap.put("D", rs.getBigDecimal("CFD")); orgLevelMap.put(type, objectMap); } } else if (proCollection.size() > 1) { if (null != batchMessage && null != idList) { for (String key : idList) { batchMessage.put(key, "存在多个正态分布规则,请检查!"); } } } else { if (null != batchMessage && null != idList) { for (String key : idList) { batchMessage.put(key, "不存在正态分布规则,请检查!"); } } } return orgLevelMap; } /** * 获取人员组织正态分布规则 * * @param ctx * @param idList 非必填 * @param batchMessage 非必填 * @return * @throws BOSException * @throws SQLException */ public Map> getPersonPerformPro(Context ctx, List idList, Map batchMessage) throws BOSException, SQLException { //获取正态分布规则 Map> orgLevelMap = Maps.newHashMap(); PersonPerformProCollection proCollection = PersonPerformProFactory.getLocalInstance(ctx).getPersonPerformProCollection(" where state=1 "); if (proCollection.size() == 1) { StringBuilder orgPerSql = new StringBuilder(); orgPerSql.append(" select fp.fid,fpe.CFS,fpe.CFA,fpe.CFB,fpe.CFC,fpe.CFD,fpe.CFORGPERFORMTYPE "); orgPerSql.append(" from CT_PF_PersonPerformPro fp "); orgPerSql.append(" left join CT_PF_PersonPerformProEntry fpe on fp.fid=fpe.FPARENTID "); orgPerSql.append(" where fp.CFSTATE = 1 "); orgPerSql.append(" order by fp.FCREATETIME "); IRowSet rs = DbUtil.executeQuery(ctx, orgPerSql.toString()); while (rs.next()) { Map objectMap = Maps.newHashMap(); String type = rs.getString("CFORGPERFORMTYPE"); objectMap.put("S", rs.getBigDecimal("CFS")); objectMap.put("A", rs.getBigDecimal("CFA")); objectMap.put("B", rs.getBigDecimal("CFB")); objectMap.put("C", rs.getBigDecimal("CFC")); objectMap.put("D", rs.getBigDecimal("CFD")); orgLevelMap.put(type, objectMap); } } else if (proCollection.size() > 1) { if (null != batchMessage && null != idList) { for (String key : idList) { batchMessage.put(key, "存在多个正态分布规则,请检查!"); } } } else { if (null != batchMessage && null != idList) { for (String key : idList) { batchMessage.put(key, "不存在正态分布规则,请检查!"); } } } return orgLevelMap; } /** * 获取人员的等级组织分组 * * @param ctx * @param entryList * @return * @throws BOSException * @throws SQLException */ public Map> getPersonLevelLensMap(Context ctx, JSONArray entryList) throws BOSException, SQLException { Map> personLevelMap = Maps.newHashMap(); Map revLevelMap = Maps.newHashMap(); for(int i=0;i map = Maps.newHashMap(); String key = auditGradeLevel; map.put("lens", revLevelMap.get(auditGradeLevel)); map.put("id",id); map.put("evaResult",evaResult); map.put("revLevel",auditGradeLevel); personLevelMap.put(key, map); } return personLevelMap; } /** * 根据上季度的组织等级,校验当前周期,当前考核计划,所选员工的所属组织的员工绩效等级分布校验 * * @param request * @param response * @param modelMap * @param batchMessageTipsHeader * @throws SHRWebException */ public void beforeAuditEvaResutAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap, BatchMessageTipsHeader batchMessageTipsHeader) throws SHRWebException { Context ctx = SHRContext.getInstance().getContext(); String ids = (String) request.getParameter("ids"); String period = (String) request.getParameter("period"); String planId = (String) request.getParameter("planId"); String entryData = request.getParameter("entryData"); if (ids == null) { throw new ShrWebBizException(new SHRPerfWebBizException(SHRPerfWebBizException.SYSTEMERR)); } try { List idList = Lists.newArrayList(); Set idSet = Sets.newHashSet(idList); for (String id : ids.split(",")) { idList.add(id); } //明细数据 JSONArray entryList = JSON.parseArray(entryData); StringBuilder planSql = new StringBuilder(); planSql.append("select fid,CFPerobjectIdId from T_EVA_PerfPlan where fid=? and CFPerobjectIdId is not null "); IRowSet rs = DbUtil.executeQuery(ctx, planSql.toString(), new Object[]{planId}); if (rs.next()) { String CFPerobjectIdId = rs.getString("CFPerobjectIdId"); Map batchMessage = this.beforeAuditProjectEvaResut(ctx, period, planId, idList,entryList); if (null != batchMessage && batchMessage.size() > 0) { for (Map.Entry entry : batchMessage.entrySet()) { addBatchMessageTip(entry.getKey(), entry.getValue(), batchMessageTipsHeader); idSet.remove(entry.getKey()); } } } else { Map batchMessage = this.beforeAuditEvaResut(ctx, period, planId, idList,entryList); if (null != batchMessage && batchMessage.size() > 0) { for (Map.Entry entry : batchMessage.entrySet()) { addBatchMessageTip(entry.getKey(), entry.getValue(), batchMessageTipsHeader); idSet.remove(entry.getKey()); } } //addBatchMessageSuccessTips(idSet,"验证成功",batchMessageTipsHeader); } this.setSuccessMessage("验证成功"); } catch (Exception e) { e.printStackTrace(); throw new ShrWebBizException(e); } } public Map beforeAuditProjectEvaResut(Context ctx, String period, String planId, List idList,JSONArray entryList ) throws BOSException, SQLException { Map batchMessage = Maps.newHashMap(); StringBuilder selParamId = new StringBuilder("''"); for (int i = 0; i < idList.size(); i++) { selParamId.append(",?"); } //获取正态分布规则 Map> personPerformMap = this.getProjectPerformPro(ctx, idList, batchMessage); if (null != personPerformMap && personPerformMap.size() > 0) { //获取组织分组人数 //Map> orgLevelMap = this.getProjectLevelCountMap(ctx, period, planId,selParamId, idList); //获取人员等级分组 Map> personLevelMap = this.getPersonLevelLensMap(ctx,entryList); BigDecimal big100 = new BigDecimal(100); for(int i=0;i personPerform = personPerformMap.get(projectLevel); if (null == personPerform) { String msg = String.format("没有找到%s项目绩效等级%s的正态分布规则", CFPROJECTNAME, projectLevel); batchMessage.put(fid, msg); continue; } //获取该组织下的人员总数 //Map orgMap = orgLevelMap.get(key); //获取该组织下的人员各个绩效等级分组汇总 // String keyRevLevel = FADMINORGUNITID + FPERIODID + FEVAPLANID + revLevel; // Map personMap = personLevelMap.get(keyRevLevel); Map leveList = Maps.newHashMap(); //获取该组织下的人员总数 //Map orgMap = orgLevelMap.get(key); //获取等级D人数 String keyRevLevelD = "D"; Map personMapD = personLevelMap.get(keyRevLevelD); BigDecimal dLens = BigDecimal.ZERO; if (null != personMapD) { dLens = (BigDecimal) personMapD.get("lens"); leveList.put("D", dLens); } //获取等级C人数 String keyRevLevelC = "C"; Map personMapC = personLevelMap.get(keyRevLevelC); BigDecimal cLens = BigDecimal.ZERO; if (null != personMapC) { cLens = (BigDecimal) personMapC.get("lens"); leveList.put("C", cLens); } //获取等级B人数 String keyRevLevelB = "B"; Map personMapB = personLevelMap.get(keyRevLevelB); BigDecimal bLens = BigDecimal.ZERO; if (null != personMapB) { bLens = (BigDecimal) personMapB.get("lens"); leveList.put("B", bLens); } //获取等级A人数 String keyRevLevelA = "A"; Map personMapA = personLevelMap.get(keyRevLevelA); BigDecimal aLens = BigDecimal.ZERO; if (null != personMapA) { aLens = (BigDecimal) personMapA.get("lens"); leveList.put("A", aLens); } //获取等级S人数 String keyRevLevelS = "S"; Map personMapS = personLevelMap.get(keyRevLevelS); BigDecimal sLens = BigDecimal.ZERO; if (null != personMapS) { sLens = (BigDecimal) personMapS.get("lens"); leveList.put("S", sLens); } //总人数 BigDecimal alls = new BigDecimal(idList.size()); //当前等级正态分布比例 BigDecimal scale = personPerform.get(revLevel); //创建每个等级的人数列表 Map bigsList = Maps.newHashMap(); BigDecimal bigS = ((personPerform.get("S").divide(big100, BigDecimal.ROUND_HALF_UP, BigDecimal.ROUND_HALF_UP)).multiply(alls).setScale(0, BigDecimal.ROUND_HALF_UP)); bigsList.put("S", bigS); BigDecimal bigA = ((personPerform.get("A").divide(big100, BigDecimal.ROUND_HALF_UP, BigDecimal.ROUND_HALF_UP)).multiply(alls).setScale(0, BigDecimal.ROUND_HALF_UP)); bigsList.put("A", bigA); BigDecimal bigB = ((personPerform.get("B").divide(big100, BigDecimal.ROUND_HALF_UP, BigDecimal.ROUND_HALF_UP)).multiply(alls).setScale(0, BigDecimal.ROUND_HALF_UP)); bigsList.put("B", bigB); BigDecimal bigC = ((personPerform.get("C").divide(big100, BigDecimal.ROUND_HALF_UP, BigDecimal.ROUND_HALF_UP)).multiply(alls).setScale(0, BigDecimal.ROUND_HALF_UP)); bigsList.put("C", bigC); BigDecimal bigD = ((personPerform.get("D").divide(big100, BigDecimal.ROUND_HALF_UP, BigDecimal.ROUND_HALF_UP)).multiply(alls).setScale(0, BigDecimal.ROUND_HALF_UP)); bigsList.put("D", bigD); //已占用数 BigDecimal lens = BigDecimal.ZERO; //进行额度加减 BigDecimal personSize = BigDecimal.ZERO; BigDecimal personMaxSize = BigDecimal.ZERO; BigDecimal personMinSize = BigDecimal.ZERO; List ldrs = Lists.newArrayList(); Map ldrcd = Maps.newHashMap(); switch (revLevel) { case "A": personSize = personSize.add(bigA).subtract(aLens); lens = lens.add(aLens); if ("A".equals(revLevel)) { personMaxSize = personMaxSize.add((bigA)); } else { personMaxSize = personMaxSize.add((bigA).subtract(aLens)); } ldrs.add("A最多%A人,"); //bigsList.remove("A"); case "S": personSize = personSize.add(bigS).subtract(sLens); lens = lens.add(sLens); if ("S".equals(revLevel)) { personMaxSize = personMaxSize.add((bigS)); } else { personMaxSize = personMaxSize.add((bigS).subtract(sLens)); } ldrs.add("S最多%S人,"); //bigsList.remove("S"); case "B": case "C": if ("C".equals(revLevel)) { personMinSize = personMinSize.add((bigC)); } else { personMinSize = personMinSize.add((bigC).subtract(cLens)); } ldrcd.put("C","C最少"+(personMinSize.compareTo(BigDecimal.ZERO) > 0?personMinSize.toPlainString():'0')+"人,"); //bigsList.remove("C"); case "D": if ("D".equals(revLevel)) { personMinSize = personMinSize.add((bigD)); } else { personMinSize = personMinSize.add((bigD).subtract(dLens)); } ldrcd.put("D","D最少"+(personMinSize.compareTo(BigDecimal.ZERO) > 0?personMinSize.toPlainString():'0')+"人,"); } String ld = "当前周期绩效等级为%l的人数为%maxs人,"; if (personMinSize.compareTo(BigDecimal.ZERO) > 0 || personSize.compareTo(BigDecimal.ZERO) < 0) { if(ldrs.size()>0) { String ldrstr = ldrs.get(0); ld += ldrstr; ld = ld.replace("%" + revLevel, (personMaxSize.compareTo(BigDecimal.ZERO) > 0 ? (personMaxSize) : BigDecimal.ZERO).toPlainString()); } ld = ld.replace("%l", revLevel); ld = ld.replace("%maxs", (leveList.get(revLevel) == null ? BigDecimal.ZERO : leveList.get(revLevel)).toPlainString()); for (Map.Entry entry : ldrcd.entrySet()) { String eKey = entry.getKey(); String ldr= entry.getValue(); ld += ldr; } ld += "请修正后重新审核."; batchMessage.put(fid, ld); } } } return batchMessage; } /** * 结果直接审核、结果工作流审核,绩效等级分布比例校验人数由整个绩效考核计划的人数改为按选择的人数进行分布比例校验。 * * @param ctx * @param period * @param planId * @param idList * @return * @throws BOSException * @throws SQLException */ public Map beforeAuditEvaResut(Context ctx, String period, String planId, List idList,JSONArray entryList) throws BOSException, SQLException { Map batchMessage = Maps.newHashMap(); StringBuilder selParamId = new StringBuilder("''"); for (int i = 0; i < idList.size(); i++) { selParamId.append(",?"); } //获取正态分布规则 Map> personPerformMap = this.getPersonPerformPro(ctx, idList, batchMessage); if (null != personPerformMap && personPerformMap.size() > 0) { //获取组织分组人数 //Map> orgLevelMap = this.getOrgLevelCountMap(ctx, period, planId); //获取人员等级分组 Map> personLevelMap = this.getPersonLevelLensMap(ctx, entryList); BigDecimal big100 = new BigDecimal(100); for(int i=0;i personPerform = personPerformMap.get(orgLevel); if (null == personPerform) { String msg = String.format("没有找到%s上季度组织绩效等级%s的正态分布规则", FADMINORGNAME, orgLevel); batchMessage.put(fid, msg); continue; } //获取该组织下的人员总数 //Map orgMap = orgLevelMap.get(key); Map leveList = Maps.newHashMap(); //获取等级D人数 String keyRevLevelD = "D"; Map personMapD = personLevelMap.get(keyRevLevelD); BigDecimal dLens = BigDecimal.ZERO; if (null != personMapD) { dLens = (BigDecimal) personMapD.get("lens"); leveList.put("D", dLens); } //获取等级C人数 String keyRevLevelC = "C"; Map personMapC = personLevelMap.get(keyRevLevelC); BigDecimal cLens = BigDecimal.ZERO; if (null != personMapC) { cLens = (BigDecimal) personMapC.get("lens"); leveList.put("C", cLens); } //获取等级B人数 String keyRevLevelB = "B"; Map personMapB = personLevelMap.get(keyRevLevelB); BigDecimal bLens = BigDecimal.ZERO; if (null != personMapB) { bLens = (BigDecimal) personMapB.get("lens"); leveList.put("B", bLens); } //获取等级A人数 String keyRevLevelA = "A"; Map personMapA = personLevelMap.get(keyRevLevelA); BigDecimal aLens = BigDecimal.ZERO; if (null != personMapA) { aLens = (BigDecimal) personMapA.get("lens"); leveList.put("A", aLens); } //获取等级S人数 String keyRevLevelS = "S"; Map personMapS = personLevelMap.get(keyRevLevelS); BigDecimal sLens = BigDecimal.ZERO; if (null != personMapS) { sLens = (BigDecimal) personMapS.get("lens"); leveList.put("S", sLens); } System.out.println("leveList:"+leveList); //总人数 BigDecimal alls = new BigDecimal(idList.size()); //当前等级正态分布比例 BigDecimal scale = personPerform.get(auditGradeLevel); //创建每个等级的人数列表 Map bigsList = Maps.newHashMap(); BigDecimal bigS = ((personPerform.get("S").divide(big100, BigDecimal.ROUND_HALF_UP, BigDecimal.ROUND_HALF_UP)).multiply(alls).setScale(0, BigDecimal.ROUND_HALF_UP)); bigsList.put("S", bigS); BigDecimal bigA = ((personPerform.get("A").divide(big100, BigDecimal.ROUND_HALF_UP, BigDecimal.ROUND_HALF_UP)).multiply(alls).setScale(0, BigDecimal.ROUND_HALF_UP)); bigsList.put("A", bigA); BigDecimal bigB = ((personPerform.get("B").divide(big100, BigDecimal.ROUND_HALF_UP, BigDecimal.ROUND_HALF_UP)).multiply(alls).setScale(0, BigDecimal.ROUND_HALF_UP)); bigsList.put("B", bigB); BigDecimal bigC = ((personPerform.get("C").divide(big100, BigDecimal.ROUND_HALF_UP, BigDecimal.ROUND_HALF_UP)).multiply(alls).setScale(0, BigDecimal.ROUND_HALF_UP)); bigsList.put("C", bigC); BigDecimal bigD = ((personPerform.get("D").divide(big100, BigDecimal.ROUND_HALF_UP, BigDecimal.ROUND_HALF_UP)).multiply(alls).setScale(0, BigDecimal.ROUND_HALF_UP)); bigsList.put("D", bigD); System.out.println("bigsList:"+bigsList); //已占用数 BigDecimal lens = BigDecimal.ZERO; //进行额度加减 //if ("S".equals(revLevel) || "A".equals(revLevel)||"B".equals(revLevel) || "C".equals(revLevel) || "D".equals(revLevel)) { BigDecimal personSize = BigDecimal.ZERO; BigDecimal personMaxSize = BigDecimal.ZERO; BigDecimal personMinSize = BigDecimal.ZERO; List ldrs = Lists.newArrayList(); Map ldrcd = Maps.newHashMap(); switch (auditGradeLevel) { case "A": personSize = personSize.add(bigA).subtract(aLens); lens = lens.add(aLens); if ("A".equals(auditGradeLevel)) { personMaxSize = personMaxSize.add((bigA)); } else { personMaxSize = personMaxSize.add((bigA).subtract(aLens)); } ldrs.add("A最多%A人,"); //bigsList.remove("A"); case "S": personSize = personSize.add(bigS).subtract(sLens); lens = lens.add(sLens); if ("S".equals(auditGradeLevel)) { personMaxSize = personMaxSize.add((bigS)); } else { personMaxSize = personMaxSize.add((bigS).subtract(sLens)); } ldrs.add("S最多%S人,"); //bigsList.remove("S"); case "B": case "C": if ("C".equals(auditGradeLevel)) { personMinSize = personMinSize.add((bigC)); } else { personMinSize = personMinSize.add((bigC).subtract(cLens)); } ldrcd.put("C","C最少"+(personMinSize.compareTo(BigDecimal.ZERO) > 0?personMinSize.toPlainString():'0')+"人,"); //bigsList.remove("C"); case "D": // if (bigD.compareTo(dLens) > 0) { // ldrcd.add("D最少" + bigD.toPlainString() + "人,"); // } if ("D".equals(auditGradeLevel)) { personMinSize = personMinSize.add((bigD)); } else { personMinSize = personMinSize.add((bigD).subtract(dLens)); } ldrcd.put("D","D最少"+(personMinSize.compareTo(BigDecimal.ZERO) > 0?personMinSize.toPlainString():'0')+"人,"); } String ld = "当前周期绩效等级为%l的人数为%maxs人,"; if (personMinSize.compareTo(BigDecimal.ZERO) > 0 || personSize.compareTo(BigDecimal.ZERO) < 0) { if(ldrs.size()>0){ String ldrstr = ldrs.get(0); ld += ldrstr; ld = ld.replace("%" + auditGradeLevel, (personMaxSize.compareTo(BigDecimal.ZERO) > 0 ? (personMaxSize) : BigDecimal.ZERO).toPlainString()); } ld = ld.replace("%l", auditGradeLevel); ld = ld.replace("%maxs", (leveList.get(auditGradeLevel) == null ? BigDecimal.ZERO : leveList.get(auditGradeLevel)).toPlainString()); for (Map.Entry entry : ldrcd.entrySet()) { String eKey = entry.getKey(); String ldr= entry.getValue(); ld += ldr; } ld += "请修正后重新审核."; batchMessage.put(fid, ld); } } } return batchMessage; } public void batchSaveReviseDataAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap, BatchMessageTipsHeader batchMessageTipsHeader) throws SHRWebException { Context ctx = SHRContext.getInstance().getContext(); String assignmentID = request.getParameter("assignmentID"); String billId = request.getParameter("billId"); if (!StringUtils.isEmpty(assignmentID) && !StringUtils.isEmpty(billId)) { List evaResultIds = (List)Arrays.stream(billId.split(",")).collect(Collectors.toList()); try { Map auditingNode = BOSWorkFlowUtil.isAuditingNode(ctx, assignmentID); if (!"1".equals(auditingNode.get("isAuditing"))) { logger.error("current node is not auditing -- {}", StringUtils.defaultString(assignmentID)); addBatchMessageTips(evaResultIds, SHRPerfWebResourceUtil.getRes(SHRPerfWebResource.CANNOTREVISESCOREBYNOTAUDITING, ctx), batchMessageTipsHeader); return; } } catch (Exception var17) { logger.error("", var17); throw new ShrWebBizException(SHRPerfWebResourceUtil.getRes(SHRPerfWebResource.CANNOTREVISESCOREBYNOTAUDITING, ctx)); } String datas = request.getParameter("datas"); if (!StringUtils.isEmpty(datas)) { List reviseDataList = JSONArray.parseArray(datas, HashMap.class); Iterator var11 = reviseDataList.iterator(); while(var11.hasNext()) { HashMap map = (HashMap)var11.next(); String id = (String)map.get("id"); String id_id = (String)map.get("id_id"); try { request.setAttribute("toRevisedId", id); request.setAttribute("reviseScore", map.get("reviseSumScore")); request.setAttribute("reviseLevel", map.get("reviseGradeLevel")); request.setAttribute("reviseReason", map.get("reviseReason")); Map saveReturnData = EvaResultSummaryBillUtil.saveReviseData(ctx, request, response, false, EvaResultSumLogSourceEnum.AUDITING); if ("500".equals(saveReturnData.get("result"))) { addBatchMessageTip(id, SHRPerfWebResourceUtil.getRes(SHRPerfWebResource.SAVEFAILED, ctx), batchMessageTipsHeader); } } catch (SHRPerfWebException var15) { logger.error("saveReviseData is error", var15); addBatchMessageTip(id, var15.getMessage(), batchMessageTipsHeader); } catch (Exception var16) { logger.error("saveReviseData is error", var16); addBatchMessageTip(id, SHRPerfWebResourceUtil.getRes(SHRPerfWebResource.SAVEFAILED, ctx), batchMessageTipsHeader); } try { request.setAttribute("toRevisedId", id); request.setAttribute("reviseScore", map.get("reviseSumScore")); request.setAttribute("reviseLevel", map.get("reviseGradeLevel")); request.setAttribute("reviseReason", map.get("reviseReason")); request.setAttribute("perCoefficient", map.get("perCoefficient")); String coefficient = "0"; String perCoefficient = "0"; String perMaxCoefficient = "0"; String perMinCoefficient = "0"; if(map.get("coefficient") instanceof BigDecimal){ coefficient = ((BigDecimal) map.get("coefficient")).toPlainString(); } else { coefficient = map.get("coefficient").toString(); } if(map.get("perCoefficient") instanceof BigDecimal){ perCoefficient = ((BigDecimal) map.get("perCoefficient")).toPlainString(); } else { perCoefficient = map.get("perCoefficient").toString(); } if(map.get("perMaxCoefficient") instanceof BigDecimal){ perMaxCoefficient = ((BigDecimal) map.get("perMaxCoefficient")).toPlainString(); } else { perMaxCoefficient = map.get("perMaxCoefficient").toString(); } if(map.get("perMinCoefficient") instanceof BigDecimal){ perMinCoefficient = ((BigDecimal) map.get("perMinCoefficient")).toPlainString(); } else { perMinCoefficient = map.get("perMinCoefficient").toString(); } if(null!=perCoefficient) { DbUtil.execute(ctx, "update T_EVA_EvaResultSummary set CFPERMAXCOEFFICIENT='"+perMaxCoefficient +"', CFPerMinCoefficient='"+perMinCoefficient +"', CFperCoefficient='" + perCoefficient +"', CFcoefficient='"+coefficient+"' where fid = '" + id + "'"); } } catch (Exception var16) { logger.error("saveReviseData is error", var16); //addBatchMessageTip(id, SHRPerfWebResourceUtil.getRes(SHRPerfWebResource.SAVEFAILED, ctx), batchMessageTipsHeader); } } } } else { logger.error("assignmentID is null or billId is null"); } } }