|
@@ -40,9 +40,11 @@ import nccloud.commons.collections.CollectionUtils;
|
|
|
import nccloud.pubitf.arap.arappub.IArapBillPubUtilService;
|
|
|
|
|
|
public class PushPayBillMethod {
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- public void processer(String pk_org, String pk_wa_class, String cyear, String cperiod) throws BusinessException {
|
|
|
- // TODO Auto-generated method stub
|
|
|
+ public String checkSendStatus(String pk_org, String pk_wa_class, String cyear, String cperiod, boolean ispushyear) {
|
|
|
+ String mesage = "";
|
|
|
String curcyear =cyear;
|
|
|
String curperiod =cperiod;
|
|
|
//检查取的是否为当前月
|
|
@@ -50,7 +52,30 @@ public class PushPayBillMethod {
|
|
|
curcyear = newperiod.substring(0,4);
|
|
|
curperiod = newperiod.substring(4,6);
|
|
|
//检查是否推送过了
|
|
|
- checkispushed(pk_org,curcyear,curperiod);
|
|
|
+ checkispushed(pk_org,curcyear,curperiod,ispushyear);
|
|
|
+ //1.根据组织及期间,判断当前是否有工资及研发费,并且是已发放状态 ,否则报错
|
|
|
+ HashMap<String, List<DevWaQueryDTO>> waclassmap = (HashMap<String, List<DevWaQueryDTO>>) getSendDataStatus(pk_org,curcyear,curperiod);
|
|
|
+ DevWaQueryDTO[] results = waclassmap.values().stream().flatMap(list->list.stream()).toArray(DevWaQueryDTO[]::new);
|
|
|
+ for (DevWaQueryDTO result : results) {
|
|
|
+ boolean ispayed = result.getPayoffflag().booleanValue();
|
|
|
+ if(!ispayed) {
|
|
|
+ String watype = result.getWatype();
|
|
|
+ mesage = mesage+"薪资期间【"+cyear+cperiod+"】【"+watype+"】未发放!";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return mesage;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void processer(String pk_org, String pk_wa_class, String cyear, String cperiod, boolean ispushyear) throws BusinessException {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+ String curcyear =cyear;
|
|
|
+ String curperiod =cperiod;
|
|
|
+ //检查取的是否为当前月
|
|
|
+ String newperiod = checkiscuryearperiod( pk_org, pk_wa_class, cyear, cperiod);
|
|
|
+ curcyear = newperiod.substring(0,4);
|
|
|
+ curperiod = newperiod.substring(4,6);
|
|
|
+// //检查是否推送过了
|
|
|
+// checkispushed(pk_org,curcyear,curperiod);
|
|
|
//1.根据组织及期间,判断当前是否有工资及研发费,并且是已发放状态 ,否则报错
|
|
|
HashMap<String, List<DevWaQueryDTO>> waclassmap = (HashMap<String, List<DevWaQueryDTO>>) getSendDataStatus(pk_org,curcyear,curperiod);
|
|
|
|
|
@@ -69,13 +94,25 @@ public class PushPayBillMethod {
|
|
|
//社保、公积金、年金项目-研发费用对照
|
|
|
List<DefdocVO> FK007 = BdGainserver.GainDefDocByListcode("XZFK007", " and doc.pk_org ='"+pk_org+"' ");
|
|
|
if(waclassmap.containsKey("研发费用")) {
|
|
|
-
|
|
|
- if(CollectionUtils.isEmpty(FK004)||CollectionUtils.isEmpty(FK005)||CollectionUtils.isEmpty(FK006)||CollectionUtils.isEmpty(FK007))
|
|
|
- ExceptionUtils.wrappBusinessException("请先维护当前公司对照表【薪资项目对照表】、【薪酬研发费对照表】、【社保、公积金对照表】、【社保、公积金_年金项目-研发费业务类型对照表】");
|
|
|
+ if(ispushyear) {
|
|
|
+
|
|
|
+ if(CollectionUtils.isEmpty(FK006)||CollectionUtils.isEmpty(FK007))
|
|
|
+ ExceptionUtils.wrappBusinessException("请先维护当前公司对照表【社保、公积金对照表】、【社保、公积金_年金项目-研发费业务类型对照表】");
|
|
|
+ }else {
|
|
|
+ if(CollectionUtils.isEmpty(FK004)||CollectionUtils.isEmpty(FK005))
|
|
|
+ ExceptionUtils.wrappBusinessException("请先维护当前公司对照表【薪资项目对照表】、【薪酬研发费对照表】");
|
|
|
+
|
|
|
+ }
|
|
|
}else {
|
|
|
-
|
|
|
- if(CollectionUtils.isEmpty(FK004)||CollectionUtils.isEmpty(FK006))
|
|
|
- ExceptionUtils.wrappBusinessException("请先维护当前公司对照表【薪资项目对照表】、【社保、公积金对照表】");
|
|
|
+ if(ispushyear) {
|
|
|
+ if(CollectionUtils.isEmpty(FK006))
|
|
|
+ ExceptionUtils.wrappBusinessException("请先维护当前公司对照表【社保、公积金对照表】");
|
|
|
+
|
|
|
+ }else {
|
|
|
+
|
|
|
+ if(CollectionUtils.isEmpty(FK004))
|
|
|
+ ExceptionUtils.wrappBusinessException("请先维护当前公司对照表【薪资项目对照表】");
|
|
|
+ }
|
|
|
}
|
|
|
//薪资项目
|
|
|
HashMap<String,UFDouble> salarymap = new HashMap<String,UFDouble>();
|
|
@@ -125,10 +162,14 @@ public class PushPayBillMethod {
|
|
|
|
|
|
|
|
|
}
|
|
|
- //构造薪酬付款单数据并保存
|
|
|
- buildPayBill(pk_org,curcyear,curperiod,salarymap,rdnodeptmap,projectmap,FK004,FK005,FK006,FK007,"F3-Cxx-002");
|
|
|
- //构造年金付款单数据并保存
|
|
|
- buildPayBill(pk_org,curcyear,curperiod,salarymap,rdnodeptmap,projectmap,FK004,FK005,FK006,FK007,"F3-Cxx-003");
|
|
|
+ if(ispushyear) {
|
|
|
+ //构造年金付款单数据并保存
|
|
|
+ buildPayBill(pk_org,curcyear,curperiod,salarymap,rdnodeptmap,projectmap,FK004,FK005,FK006,FK007,"F3-Cxx-003");
|
|
|
+ }else {
|
|
|
+ //构造薪酬付款单数据并保存
|
|
|
+ buildPayBill(pk_org,curcyear,curperiod,salarymap,rdnodeptmap,projectmap,FK004,FK005,FK006,FK007,"F3-Cxx-002");
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -154,17 +195,32 @@ public class PushPayBillMethod {
|
|
|
return cyear+cperiod;
|
|
|
}
|
|
|
|
|
|
- private void checkispushed(String pk_org, String cyear, String cperiod) {
|
|
|
+ private void checkispushed(String pk_org, String cyear, String cperiod, boolean ispushyear) {
|
|
|
// TODO Auto-generated method stub
|
|
|
- String qsql = "select count(1) exsistrow from ap_paybill where nvl(dr,0)=0 and pk_tradetype in('F3-Cxx-003','F3-Cxx-002') and def30 = 'Y' and def31 = '"+cyear+cperiod+"'";
|
|
|
- try {
|
|
|
- Integer exsistrow = (Integer) getBaseDAO().executeQuery(qsql, new ColumnProcessor("exsistrow"));
|
|
|
- if(exsistrow>0)
|
|
|
- ExceptionUtils.wrappBusinessException("期间【"+cyear+cperiod+"】数据已经推送到【薪酬付款单】或【社保、公积金、年金缴款单】,请先删除对应的下游单据!");
|
|
|
+ if(ispushyear) {
|
|
|
+
|
|
|
+ String qsql = "select count(1) exsistrow from ap_paybill where nvl(dr,0)=0 and pk_tradetype in('F3-Cxx-003') and def30 = 'Y' and def31 = '"+cyear+cperiod+"'";
|
|
|
+ try {
|
|
|
+ Integer exsistrow = (Integer) getBaseDAO().executeQuery(qsql, new ColumnProcessor("exsistrow"));
|
|
|
+ if(exsistrow>0)
|
|
|
+ ExceptionUtils.wrappBusinessException("期间【"+cyear+cperiod+"】数据已经推送到【社保、公积金、年金缴款单】,请先删除对应的下游单据!");
|
|
|
|
|
|
- } catch (DAOException e) {
|
|
|
- // TODO 自动生成的 catch 块
|
|
|
- ExceptionUtils.wrappBusinessException("构造查询存在数据出错!"+e.getMessage());
|
|
|
+ } catch (DAOException e) {
|
|
|
+ // TODO 自动生成的 catch 块
|
|
|
+ ExceptionUtils.wrappBusinessException("构造查询存在数据出错!"+e.getMessage());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+
|
|
|
+ String qsql = "select count(1) exsistrow from ap_paybill where nvl(dr,0)=0 and pk_tradetype in('F3-Cxx-002') and def30 = 'Y' and def31 = '"+cyear+cperiod+"'";
|
|
|
+ try {
|
|
|
+ Integer exsistrow = (Integer) getBaseDAO().executeQuery(qsql, new ColumnProcessor("exsistrow"));
|
|
|
+ if(exsistrow>0)
|
|
|
+ ExceptionUtils.wrappBusinessException("期间【"+cyear+cperiod+"】数据已经推送到【薪酬付款单】,请先删除对应的下游单据!");
|
|
|
+
|
|
|
+ } catch (DAOException e) {
|
|
|
+ // TODO 自动生成的 catch 块
|
|
|
+ ExceptionUtils.wrappBusinessException("构造查询存在数据出错!"+e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -560,60 +616,66 @@ public class PushPayBillMethod {
|
|
|
for (DataVO datavo : salaryList) {
|
|
|
String pk_dept = datavo.getPk_financedept();
|
|
|
String cyearperiod =datavo.getCyearperiod();
|
|
|
- //处理工资数据
|
|
|
- for (DefdocVO defvo : fK004) {
|
|
|
- String pk_inout = defvo.getDef1();
|
|
|
- String pk_paytype = defvo.getDef3();
|
|
|
- //计算方向
|
|
|
- String caldir = defvo.getDef4();
|
|
|
- UFDouble caldirnum = UFDouble.ONE_DBL;
|
|
|
- if(!PubAppTool.isNull(caldir)&&caldir.equals("-"))
|
|
|
- caldirnum = caldirnum.multiply(-1);
|
|
|
-
|
|
|
- String key = pk_inout+"#"+pk_dept+"#"+pk_paytype;
|
|
|
- if(PubAppTool.isNull(defvo.getDef2()))
|
|
|
- ExceptionUtils.wrappBusinessException("工资对照表配置不全,请检查!!");
|
|
|
- String[] itemkeys = defvo.getDef2().split("\\+");
|
|
|
- UFDouble calmny = UFDouble.ZERO_DBL;
|
|
|
- for (String item : itemkeys) {
|
|
|
- Object itemvalue = datavo.getAttributeValue(item);
|
|
|
- if(null!=itemvalue) {
|
|
|
- calmny=calmny.add(new UFDouble(itemvalue.toString())).multiply(caldirnum);
|
|
|
- }
|
|
|
- }
|
|
|
- if(calmny.doubleValue()!=0) {
|
|
|
-
|
|
|
- //记录数据按收支项目+部门
|
|
|
- if(salarymap.containsKey(key)) {
|
|
|
- salarymap.put(key, salarymap.get(key).add(calmny));
|
|
|
- }else {
|
|
|
- salarymap.put(key, calmny);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //处理年金数据
|
|
|
- for (DefdocVO defvo : fK006) {
|
|
|
- String pk_inout = defvo.getDef1();
|
|
|
- String pk_paytype = defvo.getDef3();
|
|
|
- String key = pk_inout+"#"+pk_dept+"#"+pk_paytype;
|
|
|
- if(PubAppTool.isNull(defvo.getDef2()))
|
|
|
- ExceptionUtils.wrappBusinessException("年金对照表配置不全,请检查!!");
|
|
|
- String[] itemkeys = defvo.getDef2().split("\\+");
|
|
|
- UFDouble calmny = UFDouble.ZERO_DBL;
|
|
|
- for (String item : itemkeys) {
|
|
|
- Object itemvalue = datavo.getAttributeValue(item);
|
|
|
- if(null!=itemvalue) {
|
|
|
- calmny=calmny.add(new UFDouble(itemvalue.toString()));
|
|
|
+ if(CollectionUtils.isNotEmpty(fK004)) {
|
|
|
+
|
|
|
+ //处理工资数据
|
|
|
+ for (DefdocVO defvo : fK004) {
|
|
|
+ String pk_inout = defvo.getDef1();
|
|
|
+ String pk_paytype = defvo.getDef3();
|
|
|
+ //计算方向
|
|
|
+ String caldir = defvo.getDef4();
|
|
|
+ UFDouble caldirnum = UFDouble.ONE_DBL;
|
|
|
+ if(!PubAppTool.isNull(caldir)&&caldir.equals("-"))
|
|
|
+ caldirnum = caldirnum.multiply(-1);
|
|
|
+
|
|
|
+ String key = pk_inout+"#"+pk_dept+"#"+pk_paytype;
|
|
|
+ if(PubAppTool.isNull(defvo.getDef2()))
|
|
|
+ ExceptionUtils.wrappBusinessException("工资对照表配置不全,请检查!!");
|
|
|
+ String[] itemkeys = defvo.getDef2().split("\\+");
|
|
|
+ UFDouble calmny = UFDouble.ZERO_DBL;
|
|
|
+ for (String item : itemkeys) {
|
|
|
+ Object itemvalue = datavo.getAttributeValue(item);
|
|
|
+ if(null!=itemvalue) {
|
|
|
+ calmny=calmny.add(new UFDouble(itemvalue.toString())).multiply(caldirnum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(calmny.doubleValue()!=0) {
|
|
|
+
|
|
|
+ //记录数据按收支项目+部门
|
|
|
+ if(salarymap.containsKey(key)) {
|
|
|
+ salarymap.put(key, salarymap.get(key).add(calmny));
|
|
|
+ }else {
|
|
|
+ salarymap.put(key, calmny);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- if(calmny.doubleValue()!=0) {
|
|
|
-
|
|
|
- //记录数据按收支项目+部门
|
|
|
- if(salarymap.containsKey(key)) {
|
|
|
- salarymap.put(key, salarymap.get(key).add(calmny));
|
|
|
- }else {
|
|
|
- salarymap.put(key, calmny);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(CollectionUtils.isNotEmpty(fK006)) {
|
|
|
+
|
|
|
+ //处理年金数据
|
|
|
+ for (DefdocVO defvo : fK006) {
|
|
|
+ String pk_inout = defvo.getDef1();
|
|
|
+ String pk_paytype = defvo.getDef3();
|
|
|
+ String key = pk_inout+"#"+pk_dept+"#"+pk_paytype;
|
|
|
+ if(PubAppTool.isNull(defvo.getDef2()))
|
|
|
+ ExceptionUtils.wrappBusinessException("年金对照表配置不全,请检查!!");
|
|
|
+ String[] itemkeys = defvo.getDef2().split("\\+");
|
|
|
+ UFDouble calmny = UFDouble.ZERO_DBL;
|
|
|
+ for (String item : itemkeys) {
|
|
|
+ Object itemvalue = datavo.getAttributeValue(item);
|
|
|
+ if(null!=itemvalue) {
|
|
|
+ calmny=calmny.add(new UFDouble(itemvalue.toString()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(calmny.doubleValue()!=0) {
|
|
|
+
|
|
|
+ //记录数据按收支项目+部门
|
|
|
+ if(salarymap.containsKey(key)) {
|
|
|
+ salarymap.put(key, salarymap.get(key).add(calmny));
|
|
|
+ }else {
|
|
|
+ salarymap.put(key, calmny);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -687,13 +749,13 @@ public class PushPayBillMethod {
|
|
|
if(CollectionUtils.isEmpty(results)) {
|
|
|
ExceptionUtils.wrappBusinessException("当前公司薪资期间【"+cyear+cperiod+"】未定义工资方案及研发费方案");
|
|
|
}
|
|
|
- for (DevWaQueryDTO result : results) {
|
|
|
- boolean ispayed = result.getPayoffflag().booleanValue();
|
|
|
- if(!ispayed) {
|
|
|
- String watype = result.getWatype();
|
|
|
- ExceptionUtils.wrappBusinessException("当前公司薪资期间【"+cyear+cperiod+"】【"+watype+"】未发放,请检查!");
|
|
|
- }
|
|
|
- }
|
|
|
+// for (DevWaQueryDTO result : results) {
|
|
|
+// boolean ispayed = result.getPayoffflag().booleanValue();
|
|
|
+// if(!ispayed) {
|
|
|
+// String watype = result.getWatype();
|
|
|
+// ExceptionUtils.wrappBusinessException("当前公司薪资期间【"+cyear+cperiod+"】【"+watype+"】未发放,请检查!");
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
return results.stream().collect(Collectors.groupingBy(DevWaQueryDTO::getWatype ,Collectors.toList()));
|
|
|
}
|