|
@@ -18,9 +18,14 @@ import com.kingdee.eas.hr.affair.PluralityDelBizBillEntryCollection;
|
|
import com.kingdee.eas.hr.affair.PluralityDelBizBillEntryInfo;
|
|
import com.kingdee.eas.hr.affair.PluralityDelBizBillEntryInfo;
|
|
import com.kingdee.eas.hr.affair.PluralityDelBizBillFactory;
|
|
import com.kingdee.eas.hr.affair.PluralityDelBizBillFactory;
|
|
import com.kingdee.eas.hr.affair.PluralityDelBizBillInfo;
|
|
import com.kingdee.eas.hr.affair.PluralityDelBizBillInfo;
|
|
-import com.kingdee.eas.hr.affair.app.PluralityDelBizBillControllerBean;
|
|
|
|
|
|
+import com.kingdee.eas.hr.base.EmpPosOrgRelationFactory;
|
|
|
|
+import com.kingdee.eas.hr.base.EmpPosOrgRelationInfo;
|
|
|
|
+import com.kingdee.eas.hr.base.IEmpPosOrgRelation;
|
|
import com.kingdee.eas.util.app.DbUtil;
|
|
import com.kingdee.eas.util.app.DbUtil;
|
|
import com.kingdee.jdbc.rowset.IRowSet;
|
|
import com.kingdee.jdbc.rowset.IRowSet;
|
|
|
|
+import com.kingdee.shr.compensation.CmpEmpORelationFactory;
|
|
|
|
+import com.kingdee.shr.compensation.CmpEmpORelationInfo;
|
|
|
|
+import com.kingdee.shr.compensation.ICmpEmpORelation;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 扩展了PluralityDelBizBillControllerBean类,增加了在提交单据后的endDate更新逻辑。
|
|
* 扩展了PluralityDelBizBillControllerBean类,增加了在提交单据后的endDate更新逻辑。
|
|
@@ -83,6 +88,9 @@ public class PluralityDelBizBillControllerBeanEx extends PluralityDelBizBillCont
|
|
PluralityDelBizBillEntryInfo entryInfo = entrys.get(i);
|
|
PluralityDelBizBillEntryInfo entryInfo = entrys.get(i);
|
|
// 检查并更新添加单据的endDate
|
|
// 检查并更新添加单据的endDate
|
|
checkAddBill(ctx, entryInfo.getId().toString(),1);
|
|
checkAddBill(ctx, entryInfo.getId().toString(),1);
|
|
|
|
+ //更新变更记录
|
|
|
|
+ checkRelation(ctx,entryInfo.getId().toString(),null,1);
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -95,10 +103,9 @@ public class PluralityDelBizBillControllerBeanEx extends PluralityDelBizBillCont
|
|
* @throws BOSException 业务基础服务异常
|
|
* @throws BOSException 业务基础服务异常
|
|
* @throws EASBizException EAS业务异常
|
|
* @throws EASBizException EAS业务异常
|
|
*/
|
|
*/
|
|
- private void checkAddBill(Context ctx, String entryId, int type) throws BOSException, EASBizException {
|
|
|
|
|
|
+ private Date checkAddBill(Context ctx, String entryId, int type) throws BOSException, EASBizException {
|
|
// // 创建删除单据条目集合
|
|
// // 创建删除单据条目集合
|
|
// CoreBaseCollection delEnCol = new CoreBaseCollection();
|
|
// CoreBaseCollection delEnCol = new CoreBaseCollection();
|
|
-
|
|
|
|
// 构建SQL查询语句
|
|
// 构建SQL查询语句
|
|
StringBuilder sbu = new StringBuilder();
|
|
StringBuilder sbu = new StringBuilder();
|
|
sbu.append(" select bill.fid addId , entry.fid addEnId ,entry.fendDate addEndDate ");
|
|
sbu.append(" select bill.fid addId , entry.fid addEnId ,entry.fendDate addEndDate ");
|
|
@@ -108,25 +115,132 @@ public class PluralityDelBizBillControllerBeanEx extends PluralityDelBizBillCont
|
|
sbu.append(" left join T_HR_PluralityAddBizBillEntry entry on bill.FId = entry.fbillid ");
|
|
sbu.append(" left join T_HR_PluralityAddBizBillEntry entry on bill.FId = entry.fbillid ");
|
|
sbu.append(" left join T_HR_PluralityDelBizBillEntry delen ");
|
|
sbu.append(" left join T_HR_PluralityDelBizBillEntry delen ");
|
|
sbu.append(" on entry.fpersonid = delen.fpersonid ");
|
|
sbu.append(" on entry.fpersonid = delen.fpersonid ");
|
|
- sbu.append(" and entry.foldpositionid = delen.FMainPositionID ");
|
|
|
|
|
|
+
|
|
|
|
+ sbu.append(" and entry.FBizDate = delen.FBeginDate ");
|
|
|
|
+ sbu.append(" and entry.fpositionid = delen.FOldPositionID ");
|
|
sbu.append(" and ( ");
|
|
sbu.append(" and ( ");
|
|
sbu.append(" entry.cfpthwage = delen.cfpthwage ");
|
|
sbu.append(" entry.cfpthwage = delen.cfpthwage ");
|
|
sbu.append(" OR ( entry.cfpthwage IS NULL AND delen.cfpthwage IS NULL ) ");
|
|
sbu.append(" OR ( entry.cfpthwage IS NULL AND delen.cfpthwage IS NULL ) ");
|
|
sbu.append(" ) ");
|
|
sbu.append(" ) ");
|
|
|
|
+ sbu.append(" and ( ");
|
|
|
|
+ sbu.append(" entry.cfptlmanagerid = delen.cfptlmanagerid ");
|
|
|
|
+ sbu.append(" OR ( entry.cfptlmanagerid IS NULL AND delen.cfptlmanagerid IS NULL ) ");
|
|
|
|
+ sbu.append(" ) ");
|
|
sbu.append(" where bill.fbillstate = '3' ");
|
|
sbu.append(" where bill.fbillstate = '3' ");
|
|
sbu.append(" and delen.fid = '" + entryId + "'");
|
|
sbu.append(" and delen.fid = '" + entryId + "'");
|
|
-
|
|
|
|
|
|
+ //反审核
|
|
if( type == 0 ) {
|
|
if( type == 0 ) {
|
|
- restoreAddBillEndDate(ctx, sbu.toString());
|
|
|
|
|
|
+ return restoreAddBillEndDate(ctx, sbu.toString());
|
|
}else if( type == 1 ) {
|
|
}else if( type == 1 ) {
|
|
- updateAddBillEndDate(ctx, sbu.toString());
|
|
|
|
|
|
+ //审核
|
|
|
|
+ return updateAddBillEndDate(ctx, sbu.toString());
|
|
}
|
|
}
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 检查并更新变动记录的endDate。
|
|
|
|
+ * @param ctx 上下文对象
|
|
|
|
+ * @param entryId 单据条目ID
|
|
|
|
+ * @param type 1:审核 ; 0:反审核
|
|
|
|
+ * @throws BOSException 业务基础服务异常
|
|
|
|
+ * @throws EASBizException EAS业务异常
|
|
|
|
+ */
|
|
|
|
+ private Date checkRelation(Context ctx, String entryId, Date newDate , int type) throws BOSException, EASBizException {
|
|
|
|
+ // 构建SQL查询语句
|
|
|
|
+ StringBuilder sbu = new StringBuilder();
|
|
|
|
+ sbu.append(" select bill.fid billId ");
|
|
|
|
+ sbu.append(" , cmpBill.FID cmpBillId ");
|
|
|
|
+ sbu.append(" , delen.fbizDate newEDate ");
|
|
|
|
+ sbu.append(" from T_HR_EmpOrgRelation bill ");
|
|
|
|
+ sbu.append(" left join T_HR_SCmpEmpORelation cmpBill ");
|
|
|
|
+ sbu.append(" on bill.FID = cmpBill.femporgrelationid ");
|
|
|
|
+ sbu.append(" left join T_HR_PluralityDelBizBillEntry delen ");
|
|
|
|
+ sbu.append(" on bill.fpersonid = delen.fpersonid ");
|
|
|
|
|
|
|
|
+ sbu.append(" and bill.feffdt = delen.FBeginDate ");
|
|
|
|
+ sbu.append(" and bill.fpositionid = delen.FOldPositionID ");
|
|
|
|
+ sbu.append(" and ( ");
|
|
|
|
+ sbu.append(" bill.CFLineManagerNameI = delen.cfptlmanagerid ");
|
|
|
|
+ sbu.append(" OR ( bill.CFLineManagerNameI IS NULL AND delen.cfptlmanagerid IS NULL ) ");
|
|
|
|
+ sbu.append(" ) ");
|
|
|
|
+ sbu.append(" where ");
|
|
|
|
+ sbu.append(" delen.fid = '" + entryId + "'");
|
|
|
|
+ //反审核
|
|
|
|
+ if( type == 0 ) {
|
|
|
|
+ return updateRelationEndDate(ctx, sbu.toString(),newDate,type);
|
|
|
|
+ }else if( type == 1 ) {
|
|
|
|
+ //审核
|
|
|
|
+ return updateRelationEndDate(ctx, sbu.toString(),null,type);
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 更新变动记录结束日期
|
|
|
|
+ * @param ctx
|
|
|
|
+ * @param sqlStr
|
|
|
|
+ * @param newEDate
|
|
|
|
+ * @param opType 0,反审核; 1,审核
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private Date updateRelationEndDate(Context ctx, String sqlStr,Date newEDate,int opType ) {
|
|
|
|
+ // 创建添加单据条目集合
|
|
|
|
+ CoreBaseCollection addEnCol = new CoreBaseCollection();
|
|
|
|
+ try {
|
|
|
|
+ // 获取添加单据条目实例
|
|
|
|
+ IEmpPosOrgRelation billIns = EmpPosOrgRelationFactory.getLocalInstance(ctx);
|
|
|
|
+ ICmpEmpORelation cmpBillIns = CmpEmpORelationFactory.getLocalInstance(ctx);
|
|
|
|
+ // 执行SQL查询
|
|
|
|
+ IRowSet rowSet = DbUtil.executeQuery(ctx, sqlStr);
|
|
|
|
+ // 遍历查询结果
|
|
|
|
+ while (rowSet.next()) {
|
|
|
|
+ // 获取添加单据条目ID
|
|
|
|
+ String billId = rowSet.getString("billId");
|
|
|
|
+ // 获取薪酬档案记录ID
|
|
|
|
+ String cmpBillId = rowSet.getString("cmpBillId");
|
|
|
|
+ // 获取新的endDate 审核的时候;
|
|
|
|
+ if(opType == 1){
|
|
|
|
+ newEDate = rowSet.getDate("newEDate");
|
|
|
|
+ }
|
|
|
|
+ // 变动记录
|
|
|
|
+ EmpPosOrgRelationInfo billInfo = billIns.getEmpPosOrgRelationInfo(new ObjectUuidPK(billId));
|
|
|
|
+ //薪酬 记录
|
|
|
|
+ CmpEmpORelationInfo cmpInfo = cmpBillIns.getCmpEmpORelationInfo(new ObjectUuidPK(cmpBillId));
|
|
|
|
+ if ( null != newEDate) {
|
|
|
|
+ //结束日期 = 单据创建时的结束日期
|
|
|
|
+ billInfo.setLEFFDT(newEDate);
|
|
|
|
+ billInfo.setEndDateTime(newEDate);
|
|
|
|
+ cmpInfo.setLeffectDate(newEDate);
|
|
|
|
+ }
|
|
|
|
+// addEnCol.add(billInfo);
|
|
|
|
+ billIns.update(new ObjectUuidPK(billId),billInfo);
|
|
|
|
+ cmpBillIns.update(new ObjectUuidPK(cmpBillId),cmpInfo);
|
|
|
|
+ }
|
|
|
|
+ // 更新 集合
|
|
|
|
+// billIns.update(addEnCol);
|
|
|
|
+ } catch (BOSException | SQLException | EASBizException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return newEDate;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- private void updateAddBillEndDate(Context ctx, String sqlStr) {
|
|
|
|
|
|
+ private Date updateAddBillEndDate(Context ctx, String sqlStr) {
|
|
|
|
+ Date newEDate = null;
|
|
// 创建添加单据条目集合
|
|
// 创建添加单据条目集合
|
|
CoreBaseCollection addEnCol = new CoreBaseCollection();
|
|
CoreBaseCollection addEnCol = new CoreBaseCollection();
|
|
try {
|
|
try {
|
|
@@ -143,7 +257,7 @@ public class PluralityDelBizBillControllerBeanEx extends PluralityDelBizBillCont
|
|
// 获取oldEDate
|
|
// 获取oldEDate
|
|
Date addEndDate = rowSet.getDate("addEndDate");
|
|
Date addEndDate = rowSet.getDate("addEndDate");
|
|
// 获取新的endDate
|
|
// 获取新的endDate
|
|
- Date newEDate = rowSet.getDate("newEDate");
|
|
|
|
|
|
+ newEDate = rowSet.getDate("newEDate");
|
|
// 如果添加单据条目ID为空,则进行更新操作
|
|
// 如果添加单据条目ID为空,则进行更新操作
|
|
|
|
|
|
// 获取兼职单据条目信息
|
|
// 获取兼职单据条目信息
|
|
@@ -161,6 +275,7 @@ public class PluralityDelBizBillControllerBeanEx extends PluralityDelBizBillCont
|
|
} catch (BOSException | SQLException | EASBizException e) {
|
|
} catch (BOSException | SQLException | EASBizException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
+ return newEDate;
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -185,7 +300,10 @@ public class PluralityDelBizBillControllerBeanEx extends PluralityDelBizBillCont
|
|
PluralityDelBizBillEntryCollection entrys = delInfo.getEntrys();
|
|
PluralityDelBizBillEntryCollection entrys = delInfo.getEntrys();
|
|
for(int i = 0; i < entrys.size(); i++ ) {
|
|
for(int i = 0; i < entrys.size(); i++ ) {
|
|
PluralityDelBizBillEntryInfo entryInfo = entrys.get(i);
|
|
PluralityDelBizBillEntryInfo entryInfo = entrys.get(i);
|
|
- checkAddBill(ctx, entryInfo.getId().toString(), 0);
|
|
|
|
|
|
+ //恢复兼职但上的结束日期
|
|
|
|
+ Date newDate = checkAddBill(ctx, entryInfo.getId().toString(), 0);
|
|
|
|
+ //更新变更记录
|
|
|
|
+ checkRelation(ctx,entryInfo.getId().toString(),newDate,0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -197,7 +315,8 @@ public class PluralityDelBizBillControllerBeanEx extends PluralityDelBizBillCont
|
|
* @param ctx
|
|
* @param ctx
|
|
* @param sqlStr
|
|
* @param sqlStr
|
|
*/
|
|
*/
|
|
- private void restoreAddBillEndDate(Context ctx, String sqlStr) {
|
|
|
|
|
|
+ private Date restoreAddBillEndDate(Context ctx, String sqlStr) {
|
|
|
|
+ Date oldAddEDate = null;
|
|
// 创建添加单据条目集合
|
|
// 创建添加单据条目集合
|
|
CoreBaseCollection addEnCol = new CoreBaseCollection();
|
|
CoreBaseCollection addEnCol = new CoreBaseCollection();
|
|
try {
|
|
try {
|
|
@@ -210,7 +329,7 @@ public class PluralityDelBizBillControllerBeanEx extends PluralityDelBizBillCont
|
|
// 获取添加单据条目ID
|
|
// 获取添加单据条目ID
|
|
String addEnId = rowSet.getString("addEnId");
|
|
String addEnId = rowSet.getString("addEnId");
|
|
// 获取 原兼职单上创建时的日期,第一次写兼职结束时是空的;
|
|
// 获取 原兼职单上创建时的日期,第一次写兼职结束时是空的;
|
|
- Date oldAddEDate = rowSet.getDate("oldAddEDate");
|
|
|
|
|
|
+ oldAddEDate = rowSet.getDate("oldAddEDate");
|
|
// 获取兼职单据条目信息
|
|
// 获取兼职单据条目信息
|
|
PluralityAddBizBillEntryInfo addInfo = addEnIns.getPluralityAddBizBillEntryInfo(new ObjectUuidPK(addEnId));
|
|
PluralityAddBizBillEntryInfo addInfo = addEnIns.getPluralityAddBizBillEntryInfo(new ObjectUuidPK(addEnId));
|
|
if ( null != oldAddEDate) {
|
|
if ( null != oldAddEDate) {
|
|
@@ -224,7 +343,7 @@ public class PluralityDelBizBillControllerBeanEx extends PluralityDelBizBillCont
|
|
} catch (BOSException | SQLException | EASBizException e) {
|
|
} catch (BOSException | SQLException | EASBizException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ return oldAddEDate;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|