|
@@ -6,6 +6,7 @@ import com.kingdee.bos.util.EASResource;
|
|
|
import com.kingdee.shr.base.syssetting.exception.SHRWebException;
|
|
|
import com.kingdee.shr.base.syssetting.exception.ShrWebBizException;
|
|
|
import com.kingdee.shr.compensation.app.integrate.*;
|
|
|
+import com.kingdee.shr.compensation.app.utils.SubConstants;
|
|
|
import com.kingdee.shr.compensation.integrate.verify.CycleVerify;
|
|
|
import com.kingdee.shr.compensation.integrate.verify.ISubmitBillVerifyInterface;
|
|
|
import com.kingdee.shr.compensation.integrate.verify.SubmitBillDisableElementVerify;
|
|
@@ -15,6 +16,8 @@ import com.google.common.collect.Maps;
|
|
|
import org.apache.log4j.Logger;
|
|
|
import com.kingdee.bos.*;
|
|
|
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
|
|
|
+
|
|
|
+import java.sql.SQLException;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.Date;
|
|
@@ -24,6 +27,7 @@ import com.kingdee.eas.common.EASBizException;
|
|
|
import com.kingdee.eas.framework.CoreBaseInfo;
|
|
|
import com.kingdee.eas.hr.base.HRBillStateEnum;
|
|
|
import com.kingdee.eas.util.app.DbUtil;
|
|
|
+import com.kingdee.jdbc.rowset.IRowSet;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -63,13 +67,26 @@ public class AutoSubDayDetailFacadeControllerBean extends AbstractAutoSubDayDeta
|
|
|
|
|
|
// 在日期范围内每天执行一次executeSubmit方法
|
|
|
while (!startDate.isAfter(endDate)) {
|
|
|
- executeSubmit(ctx, startDate);
|
|
|
+ try {
|
|
|
+ executeSubmit(ctx, startDate);
|
|
|
+ } catch (SQLException e) {
|
|
|
+ logger.error("日提报自动提交sql执行异常"+e);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
startDate = startDate.plusDays(1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void executeSubmit(Context ctx, LocalDate date) throws BOSException, EASBizException {
|
|
|
+ private void executeSubmit(Context ctx, LocalDate date) throws BOSException, EASBizException, SQLException {
|
|
|
// 这里是executeSubmit的具体实现
|
|
|
+ String field = "";
|
|
|
+ CalSubmitItemCollection subColl = CalSubmitItemFactory.getLocalInstance(ctx)
|
|
|
+ .getCalSubmitItemCollection("SELECT ID,FieldSn,number where number = '"+SubConstants.COMRATE+"'");
|
|
|
+ if(subColl.size()>0) {
|
|
|
+ CalSubmitItemInfo calSubmitItemInfo = subColl.get(0);
|
|
|
+ int fieldSn = calSubmitItemInfo.getFieldSn();
|
|
|
+ field = "S"+fieldSn ;
|
|
|
+ }
|
|
|
// 假设你需要将日期格式化为特定格式
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
String formattedDate = date.format(formatter);
|
|
@@ -88,25 +105,27 @@ public class AutoSubDayDetailFacadeControllerBean extends AbstractAutoSubDayDeta
|
|
|
try {
|
|
|
BatchSubmitShemeBillCollection batchSubmitShemeBillCollection = billIns.getBatchSubmitShemeBillCollection(viewInfo);
|
|
|
if (!batchSubmitShemeBillCollection.isEmpty()) {
|
|
|
- BatchSubmitShemeBillControllerBeanEx beanEx = new BatchSubmitShemeBillControllerBeanEx();
|
|
|
for (int i = 0; i < batchSubmitShemeBillCollection.size(); ++i) {
|
|
|
BatchSubmitShemeBillInfo model = batchSubmitShemeBillCollection.get(i);
|
|
|
- beanEx._save(ctx,model);
|
|
|
-
|
|
|
- EntityViewInfo viewInfo2 = new EntityViewInfo();
|
|
|
- FilterInfo filter2 = new FilterInfo();
|
|
|
- filter2.getFilterItems().add(new FilterItemInfo("id", model.getId().toString() , CompareType.EQUALS ));
|
|
|
- filter2.getFilterItems().add(new FilterItemInfo("entry.s68", null, CompareType.ISNOT));
|
|
|
- filter2.getFilterItems().add(new FilterItemInfo("entry.s68", 0, CompareType.GREATER));
|
|
|
- viewInfo2.setFilter(filter2);
|
|
|
- logger.error("executeSubmit:filter2->"+filter2.toSql());
|
|
|
- BatchSubmitShemeBillCollection batchSubmitShemeBillCollection2 = billIns.getBatchSubmitShemeBillCollection(viewInfo2);
|
|
|
- logger.error("batchSubmitShemeBillCollection2->"+batchSubmitShemeBillCollection2.size());
|
|
|
- if(!batchSubmitShemeBillCollection2.isEmpty() && batchSubmitShemeBillCollection2.size() > 0) {
|
|
|
- model=batchSubmitShemeBillCollection2.get(0);
|
|
|
- beforeSubmit(ctx, model);
|
|
|
- billIns.submitEffect(model);
|
|
|
+// BatchSubmitShemeBillControllerBeanEx batchSubmitShemeBillControllerBeanEx = new BatchSubmitShemeBillControllerBeanEx();
|
|
|
+// batchSubmitShemeBillControllerBeanEx._save(ctx,model);
|
|
|
+ billIns.save(new ObjectUuidPK(model.getId()),model);
|
|
|
+ String checkSql = "SELECT "+field +" FROM T_HR_TimepieceBillEntry WHERE FBillID = '"+model.getId().toString()+"' ";
|
|
|
+ IRowSet executeQuery = DbUtil.executeQuery(ctx, checkSql);
|
|
|
+ boolean isOk = true;
|
|
|
+ while(executeQuery.next()) {
|
|
|
+ String value = executeQuery.getString(field);
|
|
|
+ if(value == null ) {
|
|
|
+ logger.error("日提报单"+model.getNumber()+"的"+field+"字段值为空,无法提交");
|
|
|
+ isOk = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!isOk) {
|
|
|
+ continue;
|
|
|
}
|
|
|
+ beforeSubmit(ctx, model);
|
|
|
+ billIns.submitEffect(model);
|
|
|
}
|
|
|
}
|
|
|
} catch (SHRWebException e) {
|