|
@@ -22,6 +22,8 @@ import com.kingdee.jdbc.rowset.IRowSet;
|
|
|
import com.kingdee.shr.base.syssetting.context.SHRContext;
|
|
|
import com.kingdee.shr.base.syssetting.exception.SHRWebException;
|
|
|
import com.kingdee.shr.compensation.app.integrate.*;
|
|
|
+import com.kingdee.shr.compensation.app.utils.DateRange;
|
|
|
+import com.kingdee.shr.compensation.app.utils.SubmitShemeUtils;
|
|
|
import com.kingdee.shr.compensation.exception.ExceptionHandle;
|
|
|
import com.kingdee.shr.base.syssetting.web.json.JSONUtils;
|
|
|
import java.math.BigDecimal;
|
|
@@ -56,39 +58,39 @@ public class TimepieceSchemeBillEditHandlerEx extends TimepieceSchemeBillEditHan
|
|
|
private static Logger logger = LoggerFactory.getLogger(TimepieceSchemeBillEditHandlerEx.class);
|
|
|
private static SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
//完成率
|
|
|
- private static String COMRATE = "MQ005";
|
|
|
- //岗位类型
|
|
|
- private static String JOBTYPE = "MQ004";
|
|
|
- //技能等级 SKILLLEVEL
|
|
|
- private static String SKILLLEVEL = "MQ003";
|
|
|
- //是否现场作业 On site
|
|
|
- private static String ONSITE = "MQ007";
|
|
|
- //班组任职 Team app
|
|
|
- private static String TEAMAPP = "MQ007";
|
|
|
- //工资序列 Salary seq
|
|
|
- private static String SALARYSEQ = "MQ007";
|
|
|
-
|
|
|
- private static String[] ITEMNUMS = {COMRATE,JOBTYPE,SKILLLEVEL,ONSITE,TEAMAPP,SALARYSEQ};
|
|
|
-
|
|
|
- private static Map<String,String> FEILDS = new HashMap();
|
|
|
+// private static String COMRATE = "MQ005";
|
|
|
+// //岗位类型
|
|
|
+// private static String JOBTYPE = "MQ004";
|
|
|
+// //技能等级 SKILLLEVEL
|
|
|
+// private static String SKILLLEVEL = "MQ003";
|
|
|
+// //是否现场作业 On site
|
|
|
+// private static String ONSITE = "MQ007";
|
|
|
+// //班组任职 Team app
|
|
|
+// private static String TEAMAPP = "MQ007";
|
|
|
+// //工资序列 Salary seq
|
|
|
+// private static String SALARYSEQ = "MQ007";
|
|
|
+//
|
|
|
+// private static String[] ITEMNUMS = {COMRATE,JOBTYPE,SKILLLEVEL,ONSITE,TEAMAPP,SALARYSEQ};
|
|
|
+//
|
|
|
+// private static Map<String,String> FEILDS = new HashMap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- public TimepieceSchemeBillEditHandlerEx() throws BOSException {
|
|
|
- Context ctx = SHRContext.getInstance().getContext();
|
|
|
- CalSubmitItemCollection subColl = CalSubmitItemFactory.getLocalInstance(ctx)
|
|
|
- .getCalSubmitItemCollection("SELECT ID,FieldSn,number where number in (" + ToolUtils.aryToStr(ITEMNUMS) + ")");
|
|
|
- if (subColl != null && subColl.size() > 0) {
|
|
|
- for (int i =0 ;i<subColl.size();i++) {
|
|
|
- CalSubmitItemInfo itemInfo = subColl.get(i);
|
|
|
- if (itemInfo != null) {
|
|
|
- String columnName = "S" + itemInfo.getFieldSn();
|
|
|
- FEILDS.put(itemInfo.getNumber() , columnName);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// public TimepieceSchemeBillEditHandlerEx() throws BOSException {
|
|
|
+// Context ctx = SHRContext.getInstance().getContext();
|
|
|
+// CalSubmitItemCollection subColl = CalSubmitItemFactory.getLocalInstance(ctx)
|
|
|
+// .getCalSubmitItemCollection("SELECT ID,FieldSn,number where number in (" + ToolUtils.aryToStr(ITEMNUMS) + ")");
|
|
|
+// if (subColl != null && subColl.size() > 0) {
|
|
|
+// for (int i =0 ;i<subColl.size();i++) {
|
|
|
+// CalSubmitItemInfo itemInfo = subColl.get(i);
|
|
|
+// if (itemInfo != null) {
|
|
|
+// String columnName = "S" + itemInfo.getFieldSn();
|
|
|
+// FEILDS.put(itemInfo.getNumber() , columnName);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
|
|
|
|
|
@@ -105,71 +107,16 @@ public class TimepieceSchemeBillEditHandlerEx extends TimepieceSchemeBillEditHan
|
|
|
//拉取mes点检率数据
|
|
|
exeDataOnDay( request,billId,entry);
|
|
|
//先重置点检率标识
|
|
|
- reductionInspectionRate( ctx, info);
|
|
|
+ SubmitShemeUtils.reductionInspectionRate( ctx, info);
|
|
|
//更新点检率数据
|
|
|
- updateInspectionRate(request, ctx, info);
|
|
|
-
|
|
|
-
|
|
|
+ Set<String> checkbillIds = (Set<String> ) request.getAttribute("checkbillIds");
|
|
|
+ SubmitShemeUtils.updateInspectionRate(ctx, info,checkbillIds);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 从中间表获取mes数据
|
|
|
- */
|
|
|
- private HashMap<String,HashMap> getMesData(HttpServletRequest request,Context ctx ,HashSet<String> selectPerson,DateRange dateRange) {
|
|
|
- HashMap<String,HashMap> checkMap = new HashMap();
|
|
|
- Set<String> checkbillIds = new HashSet();
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- try {
|
|
|
- String sql = " select fid ,CFComrate, cfpersonId, cfpositiontype , cfskillLevel , cfonSite , cfteamApp , cfsalarysEq ,"
|
|
|
- + " cfbizDate "
|
|
|
- + " from CT_CAL_InspectionRate where cfpersonid in "
|
|
|
- + "( "
|
|
|
- + ToolUtils.aryToStr(selectPerson,true)
|
|
|
- + " ) "
|
|
|
- + " and cfbizDate >= '"
|
|
|
- + dateFormat.format(dateRange.getMinDate())
|
|
|
- + "' and cfbizDate <= '"
|
|
|
- + dateFormat.format(dateRange.getMaxDate())
|
|
|
- +"'" ;
|
|
|
-
|
|
|
- IRowSet rst = DbUtil.executeQuery(ctx, sql);
|
|
|
- while( rst.next() ) {
|
|
|
- //点检率id存入
|
|
|
- String checkbillId = rst.getString("fid");
|
|
|
- checkbillIds.add(checkbillId);
|
|
|
- String pId = rst.getString("cfPersonId");
|
|
|
- Date bizDate = rst.getDate("cfbizDate");
|
|
|
- String eDate = SDF.format(bizDate);
|
|
|
- String key = pId+"_"+eDate;
|
|
|
- HashMap<String,String> valMap = new HashMap();
|
|
|
- BigDecimal comrate = rst.getBigDecimal("CFComrate");
|
|
|
- valMap.put(FEILDS.get(COMRATE), comrate.toString());
|
|
|
- //
|
|
|
- valMap.put(FEILDS.get(JOBTYPE), rst.getString("cfpositiontype"));
|
|
|
- valMap.put(FEILDS.get(SKILLLEVEL), rst.getString("cfskillLevel"));
|
|
|
- valMap.put(FEILDS.get(ONSITE), rst.getString("cfonSite"));
|
|
|
- valMap.put(FEILDS.get(TEAMAPP), rst.getString("cfteamApp"));
|
|
|
- valMap.put(FEILDS.get(SALARYSEQ), rst.getString("cfsalarysEq"));
|
|
|
- checkMap.put(key, valMap);
|
|
|
- }
|
|
|
-
|
|
|
- request.setAttribute("checkbillIds", checkbillIds);
|
|
|
- }catch(BOSException e){
|
|
|
- e.printStackTrace();
|
|
|
- } catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return checkMap;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 数据处理
|
|
|
* 校验对应的某一天已存在数据/mes数据获取等
|
|
@@ -207,13 +154,13 @@ public class TimepieceSchemeBillEditHandlerEx extends TimepieceSchemeBillEditHan
|
|
|
return;
|
|
|
}
|
|
|
// 找出最大日期与最小日期
|
|
|
- DateRange dateRange = findMinMaxDate(selectDate);
|
|
|
+ DateRange dateRange = SubmitShemeUtils.findMinMaxDate(selectDate);
|
|
|
//校验重复
|
|
|
verifiOneData(ctx, billId, selectPerson, dateRange, personDateMap);
|
|
|
//校验完后进行mes数据填充;
|
|
|
//获取mes数据
|
|
|
- HashMap<String, HashMap> mesData = getMesData(request,ctx, selectPerson, dateRange);
|
|
|
- setMesData( request, entrys, mesData);
|
|
|
+ HashMap<String, HashMap> mesData = SubmitShemeUtils.getMesData( ctx, selectPerson, dateRange);
|
|
|
+ SubmitShemeUtils.setMesData( request, entrys, mesData);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -276,44 +223,7 @@ public class TimepieceSchemeBillEditHandlerEx extends TimepieceSchemeBillEditHan
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 设置点检率数据
|
|
|
- * @param request
|
|
|
- * @param entrys
|
|
|
- */
|
|
|
- public void setMesData(HttpServletRequest request, BatchSubmitShemeBillEntryCollection entrys,
|
|
|
- HashMap<String, HashMap> mesData) {
|
|
|
- int assignedRows = 0; // 新增:统计实际赋值的行数
|
|
|
-
|
|
|
- for (int i = 0; i < entrys.size(); i++) {
|
|
|
- BatchSubmitShemeBillEntryInfo entry = entrys.get(i);
|
|
|
- String pId = entry.getPerson().getId().toString();
|
|
|
- Date effectDate = entry.getEffectDate();
|
|
|
- String eDate = SDF.format(effectDate);
|
|
|
- String key = pId + "_" + eDate;
|
|
|
- HashMap valMap = mesData.get(key);
|
|
|
-
|
|
|
- if (ObjectUtils.isEmpty(valMap)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- boolean isRowAssigned = false; // 标记当前行是否被赋值
|
|
|
- for (String field : FEILDS.keySet()) {
|
|
|
- String sVal = FEILDS.get(field);
|
|
|
- if (entry.containsKey(sVal)) {
|
|
|
- entry.put(sVal, valMap.get(sVal));
|
|
|
- isRowAssigned = true; // 当前行至少有一个字段被赋值
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (isRowAssigned) {
|
|
|
- assignedRows++; // 只有实际赋值的行才计数
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 将统计结果存入 request
|
|
|
- request.setAttribute("assignedRowsCount", assignedRows);
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -356,7 +266,7 @@ public class TimepieceSchemeBillEditHandlerEx extends TimepieceSchemeBillEditHan
|
|
|
HashMap<String,String> dataMap = new HashMap();
|
|
|
|
|
|
// 找出最大日期与最小日期
|
|
|
- DateRange dateRange = findMinMaxDate(selectData);
|
|
|
+ DateRange dateRange = SubmitShemeUtils.findMinMaxDate(selectData);
|
|
|
IBatchSubmitShemeBillEntry entryIns;
|
|
|
try {
|
|
|
entryIns = BatchSubmitShemeBillEntryFactory.getLocalInstance(ctx);
|
|
@@ -389,51 +299,9 @@ public class TimepieceSchemeBillEditHandlerEx extends TimepieceSchemeBillEditHan
|
|
|
|
|
|
|
|
|
|
|
|
- private DateRange findMinMaxDate(HashSet<String> subDate) {
|
|
|
- if (subDate == null || subDate.isEmpty()) {
|
|
|
- return null;
|
|
|
- }
|
|
|
|
|
|
- List<Date> dates = new ArrayList<>();
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- for (String dateString : subDate) {
|
|
|
- try {
|
|
|
- dates.add(dateFormat.parse(dateString.trim()));
|
|
|
- } catch (ParseException e) {
|
|
|
- // 处理日期格式不正确的情况
|
|
|
- e.printStackTrace();
|
|
|
- return null; // 如果有日期格式不正确,直接返回 null
|
|
|
- }
|
|
|
- }
|
|
|
- if (dates.isEmpty()) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- Date minDate = Collections.min(dates);
|
|
|
- Date maxDate = Collections.max(dates);
|
|
|
-
|
|
|
- return new DateRange(minDate, maxDate);
|
|
|
- }
|
|
|
-
|
|
|
- // 定义一个辅助类来存储日期范围
|
|
|
- private static class DateRange {
|
|
|
- private final Date minDate;
|
|
|
- private final Date maxDate;
|
|
|
-
|
|
|
- public DateRange(Date minDate, Date maxDate) {
|
|
|
- this.minDate = minDate;
|
|
|
- this.maxDate = maxDate;
|
|
|
- }
|
|
|
-
|
|
|
- public Date getMinDate() {
|
|
|
- return minDate;
|
|
|
- }
|
|
|
-
|
|
|
- public Date getMaxDate() {
|
|
|
- return maxDate;
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -450,39 +318,7 @@ public class TimepieceSchemeBillEditHandlerEx extends TimepieceSchemeBillEditHan
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 更新点检率
|
|
|
- * @param request
|
|
|
- * @param ctx
|
|
|
- * @param info
|
|
|
- */
|
|
|
- private static void updateInspectionRate(HttpServletRequest request, Context ctx, BatchSubmitShemeBillInfo info) {
|
|
|
- //更新点检率数据
|
|
|
- Set<String> checkbillIds = (Set<String> ) request.getAttribute("checkbillIds");
|
|
|
- FilterInfo filter = new FilterInfo();
|
|
|
- filter.getFilterItems().add(new FilterItemInfo("id", checkbillIds, CompareType.INCLUDE));
|
|
|
- EntityViewInfo viewInfo = new EntityViewInfo( ) ;
|
|
|
- viewInfo.setFilter(filter);
|
|
|
- SelectorItemCollection selector = viewInfo.getSelector();
|
|
|
- selector.add(new SelectorItemInfo("detailNum"));
|
|
|
- selector.add(new SelectorItemInfo("isSubDetail"));
|
|
|
- try {
|
|
|
- IInspectionRate spIns = InspectionRateFactory.getLocalInstance(ctx);
|
|
|
- InspectionRateCollection inspectionRateCollection = spIns.getInspectionRateCollection(viewInfo);
|
|
|
- CoreBaseCollection cCol = new CoreBaseCollection();
|
|
|
- for(int i = 0;i<inspectionRateCollection.size();i++){
|
|
|
- InspectionRateInfo inspectionRateInfo = inspectionRateCollection.get(i);
|
|
|
- inspectionRateInfo.setDetailNum(info.getNumber());
|
|
|
- inspectionRateInfo.setIsSubDetail(true);
|
|
|
- cCol.add(inspectionRateInfo);
|
|
|
- }
|
|
|
- spIns.updateBatchData(cCol);
|
|
|
- } catch (BOSException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- } catch (EASBizException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
|
|
|
// public void getDataOnDay(String billId,BatchSubmitShemeBillEntryCollection entrys) throws SHRWebException {
|
|
@@ -544,85 +380,49 @@ public class TimepieceSchemeBillEditHandlerEx extends TimepieceSchemeBillEditHan
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 重置点检率标识
|
|
|
- * 将点检率中是否提报标记还原为false;
|
|
|
- * @param ctx
|
|
|
- * @param info
|
|
|
- */
|
|
|
- private static void reductionInspectionRate(Context ctx, BatchSubmitShemeBillInfo info) {
|
|
|
- //更新点检率数据
|
|
|
- String subNum = info.getNumber();
|
|
|
- if(StringUtils.isEmpty(subNum)){
|
|
|
- return;
|
|
|
- }
|
|
|
- FilterInfo filter = new FilterInfo();
|
|
|
- filter.getFilterItems().add(new FilterItemInfo("detailNum", subNum, CompareType.EQUALS));
|
|
|
- EntityViewInfo viewInfo = new EntityViewInfo( ) ;
|
|
|
- viewInfo.setFilter(filter);
|
|
|
- SelectorItemCollection selector = viewInfo.getSelector();
|
|
|
- selector.add(new SelectorItemInfo("detailNum"));
|
|
|
- selector.add(new SelectorItemInfo("isSubDetail"));
|
|
|
- try {
|
|
|
- IInspectionRate spIns = InspectionRateFactory.getLocalInstance(ctx);
|
|
|
- InspectionRateCollection inspectionRateCollection = spIns.getInspectionRateCollection(viewInfo);
|
|
|
- CoreBaseCollection cCol = new CoreBaseCollection();
|
|
|
- for(int i = 0;i<inspectionRateCollection.size();i++){
|
|
|
- InspectionRateInfo inspectionRateInfo = inspectionRateCollection.get(i);
|
|
|
- inspectionRateInfo.setDetailNum("");
|
|
|
- inspectionRateInfo.setIsSubDetail(false);
|
|
|
- cCol.add(inspectionRateInfo);
|
|
|
- }
|
|
|
- spIns.updateBatchData(cCol);
|
|
|
- } catch (BOSException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- } catch (EASBizException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 删除单据
|
|
|
- */
|
|
|
- @Override
|
|
|
- public String deleteAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
|
|
|
- String returnStr = super.deleteAction(request, response, modelMap);
|
|
|
- reductionAllInsRate(request);
|
|
|
- return returnStr ;
|
|
|
- }
|
|
|
|
|
|
+// /**
|
|
|
+// * 删除单据
|
|
|
+// */
|
|
|
+// @Override
|
|
|
+// public String deleteAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
|
|
|
+// String returnStr = super.deleteAction(request, response, modelMap);
|
|
|
+// reductionAllInsRate(request);
|
|
|
+// return returnStr ;
|
|
|
+// }
|
|
|
|
|
|
- /**
|
|
|
- * 重置所有点检率
|
|
|
- * @param request
|
|
|
- * @throws SHRWebException
|
|
|
- */
|
|
|
- private void reductionAllInsRate (HttpServletRequest request) throws SHRWebException {
|
|
|
- String billId = getBillId(request);
|
|
|
- String[] ids = billId.split(",");
|
|
|
- //ids转为list集合
|
|
|
- List<String> idList = Arrays.asList(ids);
|
|
|
-
|
|
|
- Context ctx = SHRContext.getInstance().getContext();
|
|
|
- FilterInfo filter = new FilterInfo();
|
|
|
- filter.getFilterItems().add(new FilterItemInfo("id", ToolUtils.aryToStr(idList,false), CompareType.INCLUDE));
|
|
|
- EntityViewInfo viewInfo = new EntityViewInfo( ) ;
|
|
|
- viewInfo.setFilter(filter);
|
|
|
- SelectorItemCollection selector = viewInfo.getSelector();
|
|
|
- selector.add(new SelectorItemInfo("number"));
|
|
|
- try {
|
|
|
- IBatchSubmitShemeBill subIns = BatchSubmitShemeBillFactory.getLocalInstance(ctx);
|
|
|
- BatchSubmitShemeBillCollection subCol = subIns.getBatchSubmitShemeBillCollection(viewInfo);
|
|
|
- for(int i = 0;i<subCol.size();i++){
|
|
|
- BatchSubmitShemeBillInfo subInfo = subCol.get(i);
|
|
|
- reductionInspectionRate(ctx, subInfo);
|
|
|
- }
|
|
|
- } catch (BOSException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
+// /**
|
|
|
+// * 重置所有点检率
|
|
|
+// * @param request
|
|
|
+// * @throws SHRWebException
|
|
|
+// */
|
|
|
+// private void reductionAllInsRate (HttpServletRequest request) throws SHRWebException {
|
|
|
+// String billId = getBillId(request);
|
|
|
+// String[] ids = billId.split(",");
|
|
|
+// //ids转为list集合
|
|
|
+// List<String> idList = Arrays.asList(ids);
|
|
|
+//
|
|
|
+// Context ctx = SHRContext.getInstance().getContext();
|
|
|
+// FilterInfo filter = new FilterInfo();
|
|
|
+// filter.getFilterItems().add(new FilterItemInfo("id", ToolUtils.aryToStr(idList,false), CompareType.INCLUDE));
|
|
|
+// EntityViewInfo viewInfo = new EntityViewInfo( ) ;
|
|
|
+// viewInfo.setFilter(filter);
|
|
|
+// SelectorItemCollection selector = viewInfo.getSelector();
|
|
|
+// selector.add(new SelectorItemInfo("number"));
|
|
|
+// try {
|
|
|
+// IBatchSubmitShemeBill subIns = BatchSubmitShemeBillFactory.getLocalInstance(ctx);
|
|
|
+// BatchSubmitShemeBillCollection subCol = subIns.getBatchSubmitShemeBillCollection(viewInfo);
|
|
|
+// for(int i = 0;i<subCol.size();i++){
|
|
|
+// BatchSubmitShemeBillInfo subInfo = subCol.get(i);
|
|
|
+// SubmitShemeUtils.reductionInspectionRate(ctx, subInfo);
|
|
|
+// }
|
|
|
+// } catch (BOSException e) {
|
|
|
+// throw new RuntimeException(e);
|
|
|
+// }
|
|
|
+// }
|
|
|
+}
|