|
|
@@ -7,7 +7,6 @@ import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
-import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -25,10 +24,7 @@ import com.kingdee.eas.basedata.person.IPerson;
|
|
|
import com.kingdee.eas.basedata.person.PersonFactory;
|
|
|
import com.kingdee.eas.basedata.person.PersonInfo;
|
|
|
import com.kingdee.eas.framework.DataBaseInfo;
|
|
|
-import com.kingdee.shr.compensation.CmpEmpORelationCollection;
|
|
|
-import com.kingdee.shr.compensation.CmpEmpORelationFactory;
|
|
|
-import com.kingdee.shr.compensation.CmpEmpORelationInfo;
|
|
|
-import com.kingdee.shr.compensation.ICmpEmpORelation;
|
|
|
+import com.kingdee.eas.hr.affair.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.log4j.Logger;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
@@ -55,7 +51,6 @@ import com.kingdee.shr.compensation.app.integrate.CalSubmitSchemeInfo;
|
|
|
import com.kingdee.shr.compensation.util.columnModel.CmpColumnModels;
|
|
|
import com.kingdee.shr.compensation.web.handler.integrate.BatchSubmitShemeBillMySubmissionEditHandler;
|
|
|
import com.kingdee.shr.customer.gtiit.util.DateTimeUtils;
|
|
|
-import com.kingdee.bos.metadata.query.util.CompareType;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -64,8 +59,7 @@ import com.kingdee.bos.metadata.query.util.CompareType;
|
|
|
* @author xiaoxin
|
|
|
*/
|
|
|
public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitShemeBillMySubmissionEditHandler {
|
|
|
- private static Logger logger =
|
|
|
- Logger.getLogger("com.kingdee.shr.customer.gtiit.handler.BatchSubmitShemeBillMySubmissionEditHandlerEx");
|
|
|
+ private static Logger logger = Logger.getLogger("com.kingdee.shr.customer.gtiit.handler.BatchSubmitShemeBillMySubmissionEditHandlerEx");
|
|
|
|
|
|
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
@@ -73,6 +67,7 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
* 获取开始结束时间
|
|
|
* 罗俊新增方法
|
|
|
* 2025-07-10
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @param response
|
|
|
* @param modelMap
|
|
|
@@ -82,7 +77,10 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
public void getDateTimeAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws BOSException, SHRWebException {
|
|
|
String personId = request.getParameter("personId");
|
|
|
String type = request.getParameter("type");
|
|
|
- String adminOrgId = request.getParameter("adminOrgId");
|
|
|
+ String id = request.getParameter("id");
|
|
|
+ String effectDate = request.getParameter("effectDate");
|
|
|
+ String leffectDate = request.getParameter("leffectDate");
|
|
|
+ String ptlmanagerName = request.getParameter("ptlmanagerName");
|
|
|
String positionId = request.getParameter("positionId");
|
|
|
String hourlywage = request.getParameter("hourlywage");
|
|
|
Context ctx = SHRContext.getInstance().getContext();
|
|
|
@@ -135,33 +133,51 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
map.put("endDate", jobEndTime == null ? "" : sdf.format(jobEndTime));
|
|
|
}
|
|
|
} else if (type.equals("Part")) {//兼职任职
|
|
|
- if (StringUtils.isEmpty(adminOrgId) || StringUtils.isEmpty(positionId)) {
|
|
|
- throw new ShrWebBizException("组织ID或职位ID不能为空!!");
|
|
|
+ if (StringUtils.isEmpty(id)) {
|
|
|
+ throw new ShrWebBizException("人员任职信息Id不能为空!!");
|
|
|
}
|
|
|
- //发薪档案任职分录
|
|
|
- ICmpEmpORelation iCmpEmpORelation = CmpEmpORelationFactory.getLocalInstance(ctx);
|
|
|
+ //兼职单
|
|
|
+ IPluralityAddBizBillEntry iPluralityAddBizBillEntry = PluralityAddBizBillEntryFactory.getLocalInstance(ctx);
|
|
|
FilterInfo filterInfo = new FilterInfo();
|
|
|
FilterItemCollection filterItems = filterInfo.getFilterItems();
|
|
|
- filterItems.add(new FilterItemInfo("empOrgRelation.person", personInfo.getId().toString()));
|
|
|
- filterItems.add(new FilterItemInfo("empOrgRelation.adminOrg", adminOrgId));
|
|
|
- filterItems.add(new FilterItemInfo("empOrgRelation.position", positionId));
|
|
|
- filterItems.add(new FilterItemInfo("empOrgRelation.hourlywage", StringUtils.isEmpty(hourlywage) ? null : hourlywage));
|
|
|
- filterItems.add(new FilterItemInfo("leffectDate", "2199-12-31 00:00:00"));
|
|
|
+ filterItems.add(new FilterItemInfo("person.id", personId));
|
|
|
+ filterItems.add(new FilterItemInfo("bizDate", DateTimeUtils.parseDate(effectDate)));
|
|
|
+ filterItems.add(new FilterItemInfo("ptlmanager.name", ptlmanagerName));
|
|
|
+ filterItems.add(new FilterItemInfo("position.id", positionId));
|
|
|
+ filterItems.add(new FilterItemInfo("pthwage", hourlywage));
|
|
|
+ filterItems.add(new FilterItemInfo("bill.billState", 3));
|
|
|
EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, null, null);
|
|
|
- logger.error("发薪档案任职分录查询person:" + personInfo.getId().toString() + ";adminOrg:" + adminOrgId + "; position:" + positionId + "; hourlywage:" + hourlywage);
|
|
|
- CmpEmpORelationCollection cmpEmpORelationCollection = iCmpEmpORelation.getCmpEmpORelationCollection(entityViewInfo);
|
|
|
- logger.error("查询到CmpEmpORelationCollection数量:" + cmpEmpORelationCollection.size());
|
|
|
- //if (cmpEmpORelationCollection.size() > 1) {
|
|
|
- // throw new ShrWebBizException("员工任职信息数据异常,请排查是否存在多条[人员、组织、职位、时薪]数据!!");
|
|
|
- //}
|
|
|
- if (null != cmpEmpORelationCollection && cmpEmpORelationCollection.size() > 0) {
|
|
|
- CmpEmpORelationInfo cmpEmpORelationInfo = cmpEmpORelationCollection.get(0);
|
|
|
- //生效日期
|
|
|
- Date effectDate = cmpEmpORelationInfo.getEffectDate();
|
|
|
- //失效日期
|
|
|
- Date leffectDate = cmpEmpORelationInfo.getLeffectDate();
|
|
|
- map.put("startDate", sdf.format(effectDate));
|
|
|
- map.put("endDate", sdf.format(leffectDate));
|
|
|
+ System.out.println("查询兼职单信息SQL:" + entityViewInfo.getFilter().toSql());
|
|
|
+ logger.error("查询兼职单信息SQL:" + entityViewInfo.getFilter().toSql());
|
|
|
+ PluralityAddBizBillEntryCollection pluralityAddBizBillEntryCollection = iPluralityAddBizBillEntry.getPluralityAddBizBillEntryCollection(entityViewInfo);
|
|
|
+ System.out.println("pluralityAddBizBillEntryCollection:" + pluralityAddBizBillEntryCollection.size());
|
|
|
+ map.put("startDate", effectDate);
|
|
|
+ if (pluralityAddBizBillEntryCollection.size() > 0) {
|
|
|
+ PluralityAddBizBillEntryInfo pluralityAddBizBillEntryInfo = pluralityAddBizBillEntryCollection.get(0);
|
|
|
+ Date bizDate = null;
|
|
|
+ //查询单据是否存在兼职终止单
|
|
|
+ IPluralityDelBizBillEntry iPluralityDelBizBillEntry = PluralityDelBizBillEntryFactory.getLocalInstance(ctx);
|
|
|
+ FilterInfo filterInfo2 = new FilterInfo();
|
|
|
+ FilterItemCollection filterItems2 = filterInfo.getFilterItems();
|
|
|
+ filterItems2.add(new FilterItemInfo("person.id", personId));
|
|
|
+ filterItems2.add(new FilterItemInfo("beginDate", DateTimeUtils.parseDate(effectDate)));
|
|
|
+ filterItems2.add(new FilterItemInfo("ptlmanager.name", ptlmanagerName));
|
|
|
+ filterItems2.add(new FilterItemInfo("position.id", positionId));
|
|
|
+ filterItems2.add(new FilterItemInfo("pthwage", hourlywage));
|
|
|
+ filterItems2.add(new FilterItemInfo("bill.billState", 3));
|
|
|
+ EntityViewInfo entityViewInfo2 = EntityViewInfo.getInstance(filterInfo, null, null);
|
|
|
+ PluralityDelBizBillEntryCollection pluralityDelBizBillEntryCollection = iPluralityDelBizBillEntry.getPluralityDelBizBillEntryCollection(entityViewInfo2);
|
|
|
+ //判断是否存在兼职终止单 存在获取兼职终止单结束日期 不存在获取兼职单结束日期
|
|
|
+ if (pluralityDelBizBillEntryCollection.size() > 0) {
|
|
|
+ PluralityDelBizBillEntryInfo pluralityDelBizBillEntryInfo = pluralityDelBizBillEntryCollection.get(0);
|
|
|
+ bizDate = pluralityDelBizBillEntryInfo.getBizDate();
|
|
|
+ } else {
|
|
|
+ bizDate = pluralityAddBizBillEntryInfo.getEndDate();
|
|
|
+ }
|
|
|
+ map.put("endDate", sdf.format(bizDate));
|
|
|
+ } else {
|
|
|
+ throw new ShrWebBizException("未查询到兼职单信息!!");
|
|
|
+ //map.put("endDate", leffectDate);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -174,8 +190,7 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public String getEditGridColModelAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap)
|
|
|
- throws SHRWebException {
|
|
|
+ public String getEditGridColModelAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
|
|
|
String submitSchemeId = request.getParameter("submitSchemeId");
|
|
|
if (StringUtils.isEmpty(submitSchemeId)) {
|
|
|
JSONUtils.writeJson(response, modelMap);
|
|
|
@@ -209,8 +224,7 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- protected void beforeSubmit(HttpServletRequest request, HttpServletResponse response, CoreBaseInfo model)
|
|
|
- throws SHRWebException {
|
|
|
+ protected void beforeSubmit(HttpServletRequest request, HttpServletResponse response, CoreBaseInfo model) throws SHRWebException {
|
|
|
super.beforeSubmit(request, response, model);
|
|
|
Context ctx = SHRContext.getInstance().getContext();
|
|
|
BatchSubmitShemeBillInfo info = (BatchSubmitShemeBillInfo) model;
|
|
|
@@ -255,12 +269,7 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
public void checkPosition(BatchSubmitShemeBillInfo info) throws ShrWebBizException {
|
|
|
Context ctx = SHRContext.getInstance().getContext();
|
|
|
String billId = info.getId().toString();
|
|
|
- String sql = "select b.FNAME_L1 from T_HR_SchemeBillEntry a left join T_ORG_Position b on a.FPOSITIONID = b.FID "
|
|
|
- + "where a.FBILLID = '" + billId + "' "
|
|
|
- + "and b.FNAME_L1 = (SELECT fname_l2 FROM T_HR_SHRRSVITEM0 where fstate = '1' and FNUMBER = '1007') "
|
|
|
- + "and EXISTS (SELECT d.CFWORKMULTIPLE FROM T_HR_ATS_LegalHoliday c "
|
|
|
- + "left join T_HR_ATS_LegalHolidayItem d on c.fid = d.FGROUPID where c.FSTATE = '1' "
|
|
|
- + "and d.CFWORKMULTIPLE = '3' and d.FSTARTDATE <= a.feffectdate and d.FENDDATE >= a.feffectdate)";
|
|
|
+ String sql = "select b.FNAME_L1 from T_HR_SchemeBillEntry a left join T_ORG_Position b on a.FPOSITIONID = b.FID " + "where a.FBILLID = '" + billId + "' " + "and b.FNAME_L1 = (SELECT fname_l2 FROM T_HR_SHRRSVITEM0 where fstate = '1' and FNUMBER = '1007') " + "and EXISTS (SELECT d.CFWORKMULTIPLE FROM T_HR_ATS_LegalHoliday c " + "left join T_HR_ATS_LegalHolidayItem d on c.fid = d.FGROUPID where c.FSTATE = '1' " + "and d.CFWORKMULTIPLE = '3' and d.FSTARTDATE <= a.feffectdate and d.FENDDATE >= a.feffectdate)";
|
|
|
logger.error("查询职位对应日期是否在法定节假日SQL:" + sql);
|
|
|
try {
|
|
|
boolean flag = false;
|
|
|
@@ -303,13 +312,7 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
String endDateStr = DateTimeUtils.dateFormat(endDate, "yyyy-MM-dd");
|
|
|
|
|
|
boolean flag = false;
|
|
|
- String sql = "SELECT a.*,b.billNumber FROM T_HR_SchemeBillEntry a , "
|
|
|
- + "(SELECT a.fnumber billNumber,b.* FROM T_HR_SBatchSubmitShemeBill a "
|
|
|
- + "left join T_HR_SchemeBillEntry b on a.fid = b.fbillid "
|
|
|
- + "where a.FBILLSTATE in ('1','2','3') and b.FPERSONID = '" + personId + "' "
|
|
|
- + "and b.FEFFECTDATE >= '" + startDateStr + "' and b.FEFFECTDATE < '" + endDateStr + "' and a.FDATASOURCE = '1') b "
|
|
|
- + "where a.FBILLID = '" + billId + "' and a.cfstarttime < b.CFENDTIME "
|
|
|
- + "and a.cfendtime > b.CFSTARTTIME";
|
|
|
+ String sql = "SELECT a.*,b.billNumber FROM T_HR_SchemeBillEntry a , " + "(SELECT a.fnumber billNumber,b.* FROM T_HR_SBatchSubmitShemeBill a " + "left join T_HR_SchemeBillEntry b on a.fid = b.fbillid " + "where a.FBILLSTATE in ('1','2','3') and b.FPERSONID = '" + personId + "' " + "and b.FEFFECTDATE >= '" + startDateStr + "' and b.FEFFECTDATE < '" + endDateStr + "' and a.FDATASOURCE = '1') b " + "where a.FBILLID = '" + billId + "' and a.cfstarttime < b.CFENDTIME " + "and a.cfendtime > b.CFSTARTTIME";
|
|
|
logger.error("查询是否有时间段重叠数据SQL:" + sql);
|
|
|
try {
|
|
|
IRowSet rowSet = DbUtil.executeQuery(ctx, sql);
|
|
|
@@ -517,8 +520,7 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
* @param modelMap
|
|
|
* @throws SHRWebException
|
|
|
*/
|
|
|
- public void checkSumbitDateAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap)
|
|
|
- throws SHRWebException {
|
|
|
+ public void checkSumbitDateAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
|
|
|
Context ctx = SHRContext.getInstance().getContext();
|
|
|
int day = 0;
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
@@ -554,8 +556,7 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
* @return
|
|
|
* @throws SHRWebException
|
|
|
*/
|
|
|
- public String getPersonCareerDataAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap)
|
|
|
- throws SHRWebException {
|
|
|
+ public String getPersonCareerDataAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
|
|
|
Context ctx = SHRContext.getInstance().getContext();
|
|
|
String personId = request.getParameter("personId");
|
|
|
String parentId = "";
|
|
|
@@ -587,8 +588,7 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
* @return
|
|
|
* @throws SHRWebException
|
|
|
*/
|
|
|
- public String getInductionDateAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap)
|
|
|
- throws SHRWebException {
|
|
|
+ public String getInductionDateAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
|
|
|
Context ctx = SHRContext.getInstance().getContext();
|
|
|
String personId = ContextUtil.getCurrentUserInfo(ctx).getPerson().getId().toString();
|
|
|
String sql = "select b.fenterdate from (SELECT FPERSONID,max(FEFFDT) as maxDate FROM T_HR_EmpLaborRelationHis group by fpersonid) a left join T_HR_EmpLaborRelationHis b on a.fpersonid=b.fpersonid and a.maxdate=b.FEFFDT where a.fpersonid='" + personId + "'";
|
|
|
@@ -701,8 +701,7 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
* @return
|
|
|
* @throws SHRWebException
|
|
|
*/
|
|
|
- public String checkEscalationDateAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap)
|
|
|
- throws SHRWebException {
|
|
|
+ public String checkEscalationDateAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
|
|
|
Context ctx = SHRContext.getInstance().getContext();
|
|
|
String personId = ContextUtil.getCurrentUserInfo(ctx).getPerson().getId().toString();
|
|
|
BigDecimal hours = new BigDecimal(request.getParameter("hours"));
|
|
|
@@ -844,6 +843,7 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
JSONUtils.writeJson(response, returnMap);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 根据人员档案获取当月是否离职或兼职失效
|
|
|
*
|
|
|
@@ -879,7 +879,7 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
IRowSet resignRow = DbUtil.executeQuery(ctx, resignSql);
|
|
|
int resignYear = 0;
|
|
|
int resignMonth = 0;
|
|
|
- while (resignRow.next()) {
|
|
|
+ if (resignRow.next()) {
|
|
|
resignYear = resignRow.getInt("year");
|
|
|
resignMonth = resignRow.getInt("month");
|
|
|
}
|
|
|
@@ -892,7 +892,7 @@ public class BatchSubmitShemeBillMySubmissionEditHandlerEx extends BatchSubmitSh
|
|
|
int leffdtYear = 0;
|
|
|
int leffdtMonth = 0;
|
|
|
IRowSet empRow = DbUtil.executeQuery(ctx, empSql);
|
|
|
- while (empRow.next()) {
|
|
|
+ if (empRow.next()) {
|
|
|
leffdtYear = empRow.getInt("year");
|
|
|
leffdtMonth = empRow.getInt("month");
|
|
|
}
|