|
@@ -1,10 +1,15 @@
|
|
|
package nc.ui.hr.plugin;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.GregorianCalendar;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Locale;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import uap.distribution.dao.DAOException;
|
|
@@ -34,7 +39,7 @@ import nc.vo.pub.lang.UFLiteralDate;
|
|
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
|
|
import nc.vo.pubapp.pflow.PfUserObject;
|
|
|
|
|
|
-public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
+public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin {
|
|
|
|
|
|
static BaseDAO baseDao;
|
|
|
|
|
@@ -56,93 +61,92 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
public PreAlertObject executeTask(BgWorkingContext bgwc) throws BusinessException {
|
|
|
NcLog.info("HrLaborcostcopycbPlugin定时任务开始执行");
|
|
|
System.out.println("HrLaborcostcopycbPlugin定时任务开始执行");
|
|
|
-
|
|
|
+
|
|
|
InvocationInfoProxy.getInstance().setGroupId(pk_group);
|
|
|
-
|
|
|
- Map<String, String> pndocIDMap = null;
|
|
|
- Map<String, String> outlaytypeIDMap = null;
|
|
|
- Map<String, String> xzsxIDMap = null;
|
|
|
- Map<String, String> islssuedIDMap = null;
|
|
|
- Map<String, String> ispaymentIDMap = null;
|
|
|
- Map<String, String> wa_typeIDMap = null;
|
|
|
- Map<String, String> wa_typeMemoMap = null;
|
|
|
- Map<String, String> pk_deptMap = null;
|
|
|
- Map<String, String> pk_accperiodmonthMap = null;
|
|
|
- String cuserid = null;
|
|
|
- String pk_taxcode = null;
|
|
|
- Map<String, String> pk_suppliermap = null;
|
|
|
- Map<String, String> orgnamemap = null;
|
|
|
- Map<String, List<String>> mapsl = null;
|
|
|
- //2025-03-28
|
|
|
- Map<String, String> outlaytypeMemoMap = null;
|
|
|
+
|
|
|
+ Map<String, String> pndocIDMap = null;
|
|
|
+ Map<String, String> outlaytypeIDMap = null;
|
|
|
+ Map<String, String> xzsxIDMap = null;
|
|
|
+ Map<String, String> islssuedIDMap = null;
|
|
|
+ Map<String, String> ispaymentIDMap = null;
|
|
|
+ Map<String, String> wa_typeIDMap = null;
|
|
|
+ Map<String, String> wa_typeMemoMap = null;
|
|
|
+ Map<String, String> pk_deptMap = null;
|
|
|
+ Map<String, String> pk_accperiodmonthMap = null;
|
|
|
+ String cuserid = null;
|
|
|
+ String pk_taxcode = null;
|
|
|
+ Map<String, String> pk_suppliermap = null;
|
|
|
+ Map<String, String> orgnamemap = null;
|
|
|
+ Map<String, List<String>> mapsl = null;
|
|
|
+ // 2025-03-28
|
|
|
+ Map<String, String> outlaytypeMemoMap = null;
|
|
|
+ try {
|
|
|
+ pndocIDMap = getPsndocID();// 人员主键
|
|
|
+ outlaytypeIDMap = getOutlaytypeID();// 费用归属类别id
|
|
|
+ // 2025-03-28
|
|
|
+ outlaytypeMemoMap = getOutlaytypeMemo();// 费用归属类别备注
|
|
|
+ xzsxIDMap = getXzsxID();// 薪资事项id
|
|
|
+ islssuedIDMap = getIslssuedID();// 是否代发id
|
|
|
+ ispaymentIDMap = getIspaymentID();// 是否代收付id
|
|
|
+ wa_typeIDMap = getWa_typeid();// 薪资类型id
|
|
|
+ wa_typeMemoMap = getWa_typeMemo();// 薪资类型备注
|
|
|
+ pk_deptMap = getPk_dept();// 部门id
|
|
|
+ pk_accperiodmonthMap = getPk_accperiodmonth();// 查询会计月份id
|
|
|
+ cuserid = getCuserid();// 用户主键
|
|
|
+ pk_taxcode = getPk_taxcode();// 税码主键
|
|
|
+ pk_suppliermap = getPk_supplier();// 供应商主键
|
|
|
+ orgnamemap = getOrgName();// 组织名称
|
|
|
+ mapsl = getOrgPk();// 查询档案成本归属公司名称
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.getStackTrace();
|
|
|
+ NcLog.info("查询表数据异常" + e.getMessage());
|
|
|
+ ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ LinkedHashMap<String, Object> billmap = bgwc.getKeyMap();
|
|
|
+ String date = String.valueOf(billmap.get("date"));
|
|
|
+ String ym = "";
|
|
|
+ String date2 = "";
|
|
|
+ if (date != null && !"null".equals(date)) {
|
|
|
+ String yearst = date.substring(0, 4);
|
|
|
+ String monthst = date.substring(4, 6);
|
|
|
+ ym = yearst + "-" + monthst;
|
|
|
+ date2 = yearst + monthst;
|
|
|
+ } else {
|
|
|
+ UFLiteralDate workday = new UFLiteralDate();
|
|
|
+ String[] s = workday.toString().split("-");
|
|
|
+ String s1 = s[0] + "-" + s[1] + "-" + "01";
|
|
|
+ UFDate time = new UFDate(s1);
|
|
|
+ UFDate time1 = time.getDateBefore(1);
|
|
|
+ String[] s2 = time1.toString().split("-");
|
|
|
+ ym = s2[0] + "-" + s2[1];
|
|
|
+ date2 = s2[0] + s2[1];
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String, String>> listCostMap1 = null;
|
|
|
+
|
|
|
+ List<Map<String, String>> listCostMap2 = null;
|
|
|
+
|
|
|
+ if (date != null && !"null".equals(date)) {
|
|
|
try {
|
|
|
- pndocIDMap = getPsndocID();// 人员主键
|
|
|
- outlaytypeIDMap = getOutlaytypeID();// 费用归属类别id
|
|
|
- //2025-03-28
|
|
|
- outlaytypeMemoMap = getOutlaytypeMemo();// 费用归属类别备注
|
|
|
- xzsxIDMap = getXzsxID();// 薪资事项id
|
|
|
- islssuedIDMap = getIslssuedID();// 是否代发id
|
|
|
- ispaymentIDMap = getIspaymentID();// 是否代收付id
|
|
|
- wa_typeIDMap = getWa_typeid();// 薪资类型id
|
|
|
- wa_typeMemoMap = getWa_typeMemo();// 薪资类型备注
|
|
|
- pk_deptMap = getPk_dept();// 部门id
|
|
|
- pk_accperiodmonthMap = getPk_accperiodmonth();// 查询会计月份id
|
|
|
- cuserid = getCuserid();// 用户主键
|
|
|
- pk_taxcode = getPk_taxcode();// 税码主键
|
|
|
- pk_suppliermap = getPk_supplier();// 供应商主键
|
|
|
- orgnamemap = getOrgName();// 组织名称
|
|
|
- mapsl = getOrgPk();// 查询档案成本归属公司名称
|
|
|
+ listCostMap2 = getLaborost1(date);// 人力成本备份数据
|
|
|
+ listCostMap1 = getNewListCostMap(listCostMap2, mapsl, orgnamemap);
|
|
|
} catch (Exception e) {
|
|
|
e.getStackTrace();
|
|
|
- NcLog.info("查询表数据异常" + e.getMessage());
|
|
|
- ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
|
- }
|
|
|
|
|
|
- LinkedHashMap<String, Object> billmap = bgwc.getKeyMap();
|
|
|
- String date = String.valueOf(billmap.get("date"));
|
|
|
- String ym = "";
|
|
|
- String date2 = "";
|
|
|
- if (date != null && !"null".equals(date)) {
|
|
|
- String yearst = date.substring(0, 4);
|
|
|
- String monthst = date.substring(4, 6);
|
|
|
- ym = yearst + "-" + monthst;
|
|
|
- date2 = yearst + monthst;
|
|
|
- } else {
|
|
|
- UFLiteralDate workday = new UFLiteralDate();
|
|
|
- String[] s = workday.toString().split("-");
|
|
|
- String s1 = s[0] + "-" + s[1] + "-" + "01";
|
|
|
- UFDate time = new UFDate(s1);
|
|
|
- UFDate time1 = time.getDateBefore(1);
|
|
|
- String[] s2 = time1.toString().split("-");
|
|
|
- ym = s2[0] + "-" + s2[1];
|
|
|
- date2 = s2[0] + s2[1];
|
|
|
+ NcLog.info("手工传日期查询人力成本备份数据异常" + e.getMessage());
|
|
|
+ ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
|
}
|
|
|
-
|
|
|
- List<Map<String, String>> listCostMap1 = null;
|
|
|
-
|
|
|
- List<Map<String, String>> listCostMap2 = null;
|
|
|
-
|
|
|
- if (date != null && !"null".equals(date)) {
|
|
|
- try {
|
|
|
- listCostMap2 = getLaborost1(date);// 人力成本备份数据
|
|
|
- listCostMap1=getNewListCostMap(listCostMap2,mapsl,orgnamemap);
|
|
|
- } catch (Exception e) {
|
|
|
- e.getStackTrace();
|
|
|
-
|
|
|
- NcLog.info("手工传日期查询人力成本备份数据异常" + e.getMessage());
|
|
|
- ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
|
- }
|
|
|
- } else {
|
|
|
- try {
|
|
|
- listCostMap2 = getLaborost1(date);// 人力成本备份数据
|
|
|
- listCostMap1=getNewListCostMap(listCostMap2,mapsl,orgnamemap);
|
|
|
- } catch (Exception e) {
|
|
|
- e.getStackTrace();
|
|
|
- NcLog.info("定时传日期查询人力成本备份数据异常" + e.getMessage());
|
|
|
- ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ listCostMap2 = getLaborost1(date2);// 人力成本备份数据
|
|
|
+ listCostMap1 = getNewListCostMap(listCostMap2, mapsl, orgnamemap);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.getStackTrace();
|
|
|
+ NcLog.info("定时传日期查询人力成本备份数据异常" + e.getMessage());
|
|
|
+ ExceptionUtils.wrappBusinessException(e.getMessage());
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
// List<String> orglist = new ArrayList<String>();
|
|
|
// for (Map<String, String> map : listCostMap1) {
|
|
|
// String wa_org = map.get("wa_org");
|
|
@@ -151,26 +155,24 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
// orglist.add(wa_org);
|
|
|
// }
|
|
|
// }
|
|
|
- //start 2025-03-25
|
|
|
- List<String> wa_costorglist = new ArrayList<String>();
|
|
|
- for (Map<String, String> map : listCostMap1) {
|
|
|
- String wa_org = map.get("wa_org");
|
|
|
- String cost_org = map.get("cost_org");
|
|
|
- String wa_costorg=wa_org+","+cost_org;
|
|
|
-
|
|
|
- if (wa_org != null && !"null".equals(wa_org)&&cost_org != null && !"null".equals(cost_org) ) {
|
|
|
- if (!wa_costorglist.contains(wa_costorg))
|
|
|
- wa_costorglist.add(wa_costorg);
|
|
|
- }
|
|
|
+ // start 2025-03-25
|
|
|
+ List<String> wa_costorglist = new ArrayList<String>();
|
|
|
+ for (Map<String, String> map : listCostMap1) {
|
|
|
+ String wa_org = map.get("wa_org");
|
|
|
+ String cost_org = map.get("cost_org");
|
|
|
+ String wa_costorg = wa_org + "," + cost_org;
|
|
|
+ if (wa_org != null && !"null".equals(wa_org) && cost_org != null && !"null".equals(cost_org)) {
|
|
|
+ if (!wa_costorglist.contains(wa_costorg))
|
|
|
+ wa_costorglist.add(wa_costorg);
|
|
|
}
|
|
|
-
|
|
|
- for (int j = 0; j < wa_costorglist.size(); j++) {
|
|
|
- try {
|
|
|
-
|
|
|
- String wa_costorg= wa_costorglist.get(j);
|
|
|
- String waorg = wa_costorg.split(",")[0];
|
|
|
- String costorg = wa_costorg.split(",")[1];
|
|
|
- //end 2025-03-25
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int j = 0; j < wa_costorglist.size(); j++) {
|
|
|
+ try {
|
|
|
+ String wa_costorg = wa_costorglist.get(j);
|
|
|
+ String waorg = wa_costorg.split(",")[0];
|
|
|
+ String costorg = wa_costorg.split(",")[1];
|
|
|
+ // end 2025-03-25
|
|
|
UFDouble debitamounttotal = new UFDouble();
|
|
|
AggReceivableBillVO aggReceivableBillVO = new AggReceivableBillVO();
|
|
|
ReceivableBillVO receivableBillVO = new ReceivableBillVO();
|
|
@@ -185,19 +187,22 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
receivableBillVO.setSett_org_v(pk_org);// 结算财务组织版本
|
|
|
String pk_user = cuserid;// 制单人
|
|
|
receivableBillVO.setBillmaker(pk_user);// 制单人
|
|
|
- receivableBillVO.setBilldate(new UFDate());// 单据日期
|
|
|
+ Date newDate = convertStringToDate(ym + "-01", "yyyy-MM-dd");
|
|
|
+ String nowMonthDateStr = getMonthLastDate(newDate, 1);// 下月最后一天
|
|
|
+ nowMonthDateStr = nowMonthDateStr.substring(0, 7) + "-01";// 下月第一天
|
|
|
+ receivableBillVO.setBilldate(new UFDate(nowMonthDateStr));// 单据日期
|
|
|
receivableBillVO.setCreator(pk_user);// 创建人
|
|
|
receivableBillVO.setCreationtime(new UFDateTime());// 创建时间
|
|
|
receivableBillVO.setBillstatus(-1);// 单据状态
|
|
|
- receivableBillVO.setBusidate(new UFDate());// 开票日期
|
|
|
+ receivableBillVO.setBusidate(new UFDate(nowMonthDateStr));// 开票日期
|
|
|
receivableBillVO.setObjtype(0);// 往来对象
|
|
|
receivableBillVO.setPk_deptid(GetDataUtil.getDeptPK(""));// 收款部门
|
|
|
String pk_bankaccsub = GetDataUtil.getBankaccsubPK("");// 收款账户
|
|
|
receivableBillVO.setRecaccount(pk_bankaccsub);// 收款银行账户
|
|
|
receivableBillVO.setPk_busitype(GetDataUtil.getBusitypePK("AR01"));// 业务流程:选择收款
|
|
|
receivableBillVO.setBillclass("ys");// 单据大类:应收单
|
|
|
- String year = date2.substring(0, 4);// 会计年度
|
|
|
- String month = date2.substring(4, 6);// 会计月份
|
|
|
+ String year = nowMonthDateStr.substring(0, 4);// 会计年度
|
|
|
+ String month = nowMonthDateStr.substring(5, 7);// 会计月份
|
|
|
receivableBillVO.setBillyear(year);// 单据会计年度
|
|
|
receivableBillVO.setBillperiod(month);// 单据会计期间
|
|
|
receivableBillVO.setPk_billtype("F0");// 单据类型编码
|
|
@@ -257,27 +262,25 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
UFDouble total = new UFDouble(decimalmny.toString());
|
|
|
Double dtotal = -total.toDouble();
|
|
|
debitamounttotal = debitamounttotal.add(dtotal);
|
|
|
-
|
|
|
+
|
|
|
UFDouble fstotal = new UFDouble(dtotal);
|
|
|
- if (waorg.equals(wa_org)&&costorg.equals(cost_org)) {
|
|
|
+ if (waorg.equals(wa_org) && costorg.equals(cost_org)) {
|
|
|
// 赋值子表数据
|
|
|
receivableBillItemVO.setPk_org(pk_org);
|
|
|
receivableBillItemVO.setPk_org_v(pk_org_v);
|
|
|
receivableBillItemVO.setPk_group(pk_group);
|
|
|
receivableBillItemVO.setPk_fiorg(pk_org);// 应收财务组织
|
|
|
- receivableBillItemVO.setDef30(getDefdocPKByName("05",outlaytypeMemoMap.get(outlaytype)));// 费用归属—备注
|
|
|
+ receivableBillItemVO.setDef30(getDefdocPKByName("05", outlaytypeMemoMap.get(outlaytype)));// 费用归属—备注
|
|
|
receivableBillItemVO.setDef23(outlaytype);// 费用归属类别
|
|
|
- receivableBillItemVO.setDef26(GetDataUtil.getDefdocPK("S00009", "08", "代垫费用"));// 收款摘要:S00009代垫费用
|
|
|
- String watypeNewName= wa_typeMemoMap.get(wa_type);
|
|
|
-// if("辞退福利".equals(watypeNewName)) {
|
|
|
-// watypeNewName="辞退补偿";
|
|
|
-// }
|
|
|
+// receivableBillItemVO.setDef26(GetDataUtil.getDefdocPK("S00009", "08", "代垫费用"));// 收款摘要:S00009代垫费用
|
|
|
+ receivableBillItemVO.setDef26(GetDataUtil.getDefdocPK("S000091", "08", "代垫费用(薪酬)"));// 收款摘要:S000091代垫费用(薪酬)
|
|
|
+ String watypeNewName = wa_typeMemoMap.get(wa_type);
|
|
|
// receivableBillItemVO.setDef29(getDefdocPKByName("YS001", "人工成本结算--" + watypeNewName));// 收款业务性质:人工成本结算
|
|
|
receivableBillItemVO.setDef29(getDefdocPKByName("YS001", "暂估人工成本结算-" + watypeNewName));// 收款业务性质:人工成本结算
|
|
|
receivableBillItemVO.setDef15(GetDataUtil.getDefdocPK("其他合同(财务专用)", "01", "其他合同(财务专用)"));// 经营合同名称
|
|
|
receivableBillItemVO.setDef16("其他合同(财务专用)");// 合同编号
|
|
|
receivableBillItemVO.setDef10(year + month + "人力成本备份" + workercode + name);// 备注
|
|
|
- receivableBillItemVO.setCustomer(getCustomerPKBynameOrPkorg(cost_orgname,cost_org));// 客户
|
|
|
+ receivableBillItemVO.setCustomer(getCustomerPKBynameOrPkorg(cost_orgname, cost_org));// 客户
|
|
|
// receivableBillItemVO.setOrdercubasdoc(getCustomerPKByName(cost_orgname));// 订单客户
|
|
|
receivableBillItemVO.setTaxcodeid(GetDataUtil.getTaxcodePK("10"));// 税码
|
|
|
receivableBillItemVO.setTaxrate(new UFDouble(0));// 税率
|
|
@@ -294,8 +297,8 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
receivableBillItemVO.setCaltaxmny(fstotal);// 计税金额
|
|
|
receivableBillItemVO.setPrice(fstotal);// 单价
|
|
|
receivableBillItemVO.setTaxprice(fstotal);// 含税单价
|
|
|
- receivableBillItemVO.setBilldate(new UFDate());// 单据日期
|
|
|
- receivableBillItemVO.setBusidate(new UFDate());// 起算日期
|
|
|
+ receivableBillItemVO.setBilldate(new UFDate(nowMonthDateStr));// 单据日期
|
|
|
+ receivableBillItemVO.setBusidate(new UFDate(nowMonthDateStr));// 起算日期
|
|
|
receivableBillItemVO.setPk_billtype("F0");// 单据类型编码
|
|
|
receivableBillItemVO.setBillclass("ys");// 单据大类
|
|
|
receivableBillItemVO.setRowno(m * 10 + 10);// 单据分录号--行号
|
|
@@ -338,14 +341,13 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
// 调用应收单新增方法
|
|
|
IReceivableService receivableService = NCLocator.getInstance().lookup(IReceivableService.class);
|
|
|
AggReceivableBillVO aggvo = receivableService.receivable_RequiresNew(aggReceivableBillVO);
|
|
|
- } catch (Exception e) {
|
|
|
- e.getStackTrace();
|
|
|
- e.getMessage();
|
|
|
- NcLog.info("生成应收单异常" + e.getMessage());
|
|
|
- continue;
|
|
|
- }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.getStackTrace();
|
|
|
+ e.getMessage();
|
|
|
+ NcLog.info("生成应收单异常" + e.getMessage());
|
|
|
+ continue;
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -354,8 +356,10 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
*/
|
|
|
public List<Map<String, String>> getLaborost1(String date) throws Exception {
|
|
|
String sql = "SELECT t.wa_period,t.workercode,t.name,t.wa_org,t.data_source,t.cost_org,t.cost_dept,t.outlaytype,t.wa_type,t.vdef2,t.vdef3,t.vdef4,SUM(t.decimalmny) decimalmny,"
|
|
|
- + " case when t.wa_org != t.cost_org then '是' else '否' end as islssued FROM hr_laborcostcopy t " + " where t.wa_period = '" + date
|
|
|
- + "' and t.decimalmny !=0 and t.wa_org!='~' and t.wa_org is not null and t.dr=0 " + "GROUP BY t.wa_period,t.wa_org,t.data_source,t.cost_org,t.cost_dept,t.outlaytype,t.wa_type,"
|
|
|
+ + " case when t.wa_org != t.cost_org then '是' else '否' end as islssued FROM hr_laborcostcopy t "
|
|
|
+ + " where t.wa_period = '" + date
|
|
|
+ + "' and t.decimalmny !=0 and t.wa_org!='~' and t.wa_org is not null and t.dr=0 "
|
|
|
+ + "GROUP BY t.wa_period,t.wa_org,t.data_source,t.cost_org,t.cost_dept,t.outlaytype,t.wa_type,"
|
|
|
+ "t.vdef2,t.vdef3,t.vdef4,t.workercode,t.name,t.islssued having SUM(t.decimalmny)!=0";
|
|
|
List<Map<String, String>> listCostVO = (List<Map<String, String>>) new BaseDAO().executeQuery(sql, new MapListProcessor());
|
|
|
return listCostVO;
|
|
@@ -365,7 +369,8 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
* 根据财务组织编码查询主键
|
|
|
*/
|
|
|
public String getOrgcode(String code) throws Exception {
|
|
|
- String sql = "select pk_financeorg from org_financeorg where dr=0 and code='" + code + "' and pk_group = '" + pk_group + "' ";
|
|
|
+ String sql = "select pk_financeorg from org_financeorg where dr=0 and code='" + code + "' and pk_group = '"
|
|
|
+ + pk_group + "' ";
|
|
|
String orgid = (String) new BaseDAO().executeQuery(sql, new ColumnProcessor());
|
|
|
return orgid;
|
|
|
}
|
|
@@ -374,8 +379,8 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
* 根据管理部门编码查询主键
|
|
|
*/
|
|
|
public String getMandept(String orgcode, String mandept) throws Exception {
|
|
|
- String sql = "select pk_dept from org_dept od, org_orgs o where od.pk_org=o.pk_org and o.code='" + orgcode + "' and od.code='" + mandept + "' and od.pk_group = '" + pk_group
|
|
|
- + "' and od.dr=0 and o.dr=0";
|
|
|
+ String sql = "select pk_dept from org_dept od, org_orgs o where od.pk_org=o.pk_org and o.code='" + orgcode
|
|
|
+ + "' and od.code='" + mandept + "' and od.pk_group = '" + pk_group + "' and od.dr=0 and o.dr=0";
|
|
|
String orgid = (String) new BaseDAO().executeQuery(sql, new ColumnProcessor());
|
|
|
return orgid;
|
|
|
}
|
|
@@ -383,8 +388,7 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
/**
|
|
|
* 查询部门主键
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public Map<String, String> getPk_dept() throws Exception {
|
|
|
String sql = "SELECT pk_org,pk_dept FROM org_dept where name='其他-虚拟(财务成本归结)' ";
|
|
@@ -404,11 +408,11 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
/**
|
|
|
* 查询费用归属类别主键
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public Map<String, String> getOutlaytypeID() throws Exception {
|
|
|
- String sql = "SELECT bd.pk_defdoc,bd.name FROM bd_defdoc bd left join bd_defdoclist def " + "on def.pk_defdoclist = bd.pk_defdoclist where def.name='费用归属类别';";
|
|
|
+ String sql = "SELECT bd.pk_defdoc,bd.name FROM bd_defdoc bd left join bd_defdoclist def "
|
|
|
+ + "on def.pk_defdoclist = bd.pk_defdoclist where def.name='费用归属类别';";
|
|
|
List<Map<String, String>> listMap = (List<Map<String, String>>) new BaseDAO().executeQuery(sql, new MapListProcessor());
|
|
|
Map<String, String> tyMap = new HashMap<String, String>();
|
|
|
if (listMap == null || listMap.size() <= 0)
|
|
@@ -421,12 +425,11 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
}
|
|
|
return tyMap;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 查询费用归属类别备注
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public Map<String, String> getOutlaytypeMemo() throws Exception {
|
|
|
String sql = "select name,memo from bd_defdoc where pk_defdoclist = (select pk_defdoclist from bd_defdoclist where code = 'HRFI01' and nvl(dr,0) = 0) and enablestate = '2' and nvl(dr,0) = 0";
|
|
@@ -446,11 +449,11 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
/**
|
|
|
* 查询是否代发id
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public Map<String, String> getIslssuedID() throws Exception {
|
|
|
- String sql = "SELECT bd.pk_defdoc,bd.name FROM bd_defdoc bd left join bd_defdoclist " + " def on def.pk_defdoclist = bd.pk_defdoclist where def.name='是否代发'; ";
|
|
|
+ String sql = "SELECT bd.pk_defdoc,bd.name FROM bd_defdoc bd left join bd_defdoclist "
|
|
|
+ + " def on def.pk_defdoclist = bd.pk_defdoclist where def.name='是否代发'; ";
|
|
|
List<Map<String, String>> listMap = (List<Map<String, String>>) new BaseDAO().executeQuery(sql, new MapListProcessor());
|
|
|
Map<String, String> tyMap = new HashMap<String, String>();
|
|
|
if (listMap == null || listMap.size() <= 0)
|
|
@@ -464,14 +467,14 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
return tyMap;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
+ /**
|
|
|
* 查询薪资类型id
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public Map<String, String> getWa_typeid() throws Exception {
|
|
|
- String sql = "SELECT bd.pk_defdoc,bd.name FROM bd_defdoc bd left join bd_defdoclist " + " def on def.pk_defdoclist = bd.pk_defdoclist where def.name='薪资类型'; ";
|
|
|
+ String sql = "SELECT bd.pk_defdoc,bd.name FROM bd_defdoc bd left join bd_defdoclist "
|
|
|
+ + " def on def.pk_defdoclist = bd.pk_defdoclist where def.name='薪资类型'; ";
|
|
|
List<Map<String, String>> listMap = (List<Map<String, String>>) new BaseDAO().executeQuery(sql, new MapListProcessor());
|
|
|
Map<String, String> tyMap = new HashMap<String, String>();
|
|
|
if (listMap == null || listMap.size() <= 0)
|
|
@@ -488,11 +491,11 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
/**
|
|
|
* 查询薪资类型备注
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public Map<String, String> getWa_typeMemo() throws Exception {
|
|
|
- String sql = "SELECT bd.name,bd.memo FROM bd_defdoc bd left join bd_defdoclist " + " def on def.pk_defdoclist = bd.pk_defdoclist where def.name='薪资类型'; ";
|
|
|
+ String sql = "SELECT bd.name,bd.memo FROM bd_defdoc bd left join bd_defdoclist "
|
|
|
+ + " def on def.pk_defdoclist = bd.pk_defdoclist where def.name='薪资类型'; ";
|
|
|
List<Map<String, String>> listMap = (List<Map<String, String>>) new BaseDAO().executeQuery(sql, new MapListProcessor());
|
|
|
Map<String, String> tyMap = new HashMap<String, String>();
|
|
|
if (listMap == null || listMap.size() <= 0)
|
|
@@ -509,11 +512,11 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
/**
|
|
|
* 查询薪资事项id
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public Map<String, String> getXzsxID() throws Exception {
|
|
|
- String sql = "SELECT bd.pk_defdoc,bd.name FROM bd_defdoc bd left join bd_defdoclist " + " def on def.pk_defdoclist = bd.pk_defdoclist where def.name='薪资事项'; ";
|
|
|
+ String sql = "SELECT bd.pk_defdoc,bd.name FROM bd_defdoc bd left join bd_defdoclist "
|
|
|
+ + " def on def.pk_defdoclist = bd.pk_defdoclist where def.name='薪资事项'; ";
|
|
|
List<Map<String, String>> listMap = (List<Map<String, String>>) new BaseDAO().executeQuery(sql, new MapListProcessor());
|
|
|
Map<String, String> tyMap = new HashMap<String, String>();
|
|
|
if (listMap == null || listMap.size() <= 0)
|
|
@@ -530,11 +533,11 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
/**
|
|
|
* 查询是否代收付id
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public Map<String, String> getIspaymentID() throws Exception {
|
|
|
- String sql = "SELECT bd.pk_defdoc,bd.name FROM bd_defdoc bd left join bd_defdoclist " + " def on def.pk_defdoclist = bd.pk_defdoclist where def.name='是否代收付'; ";
|
|
|
+ String sql = "SELECT bd.pk_defdoc,bd.name FROM bd_defdoc bd left join bd_defdoclist "
|
|
|
+ + " def on def.pk_defdoclist = bd.pk_defdoclist where def.name='是否代收付'; ";
|
|
|
List<Map<String, String>> listMap = (List<Map<String, String>>) new BaseDAO().executeQuery(sql, new MapListProcessor());
|
|
|
Map<String, String> tyMap = new HashMap<String, String>();
|
|
|
if (listMap == null || listMap.size() <= 0)
|
|
@@ -551,8 +554,7 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
/**
|
|
|
* 查询会计月份主键
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public Map<String, String> getPk_accperiodmonth() throws Exception {
|
|
|
String sql = "SELECT bd_accperiodmonth.yearmth,bd_accperiodmonth.pk_accperiodmonth FROM bd_accperiod "
|
|
@@ -573,8 +575,7 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
/**
|
|
|
* 查询人员主键
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public Map<String, String> getPsndocID() throws Exception {
|
|
|
String sql = "select pk_psndoc,name from bd_psndoc where pk_group = '0001A110000000000LO7'";
|
|
@@ -594,8 +595,7 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
/**
|
|
|
* 查询用户id
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public String getCuserid() throws Exception {
|
|
|
String sql = "SELECT cuserid FROM sm_user where user_code='xtyh001' ";
|
|
@@ -606,8 +606,7 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
/**
|
|
|
* 增值税税码税率
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public String getPk_taxcode() throws Exception {
|
|
|
String sql = "SELECT pk_taxcode FROM bd_taxcode where code='10' ";
|
|
@@ -625,8 +624,7 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
/**
|
|
|
* 供应商id
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public Map<String, String> getPk_supplier() throws Exception {
|
|
|
String sql = "SELECT name,pk_supplier FROM bd_supplier ";
|
|
@@ -646,8 +644,7 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
/**
|
|
|
* 组织名称
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public Map<String, String> getOrgName() throws Exception {
|
|
|
String sql = "SELECT name,pk_org FROM org_orgs where dr=0";
|
|
@@ -667,8 +664,7 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
/**
|
|
|
* 档案TH03组织名称
|
|
|
*
|
|
|
- * @throws
|
|
|
- * @throws DAOException
|
|
|
+ * @throws @throws DAOException
|
|
|
*/
|
|
|
public Map<String, List<String>> getOrgPk() throws Exception {
|
|
|
Map<String, List<String>> mapl = new HashMap<String, List<String>>();
|
|
@@ -680,7 +676,7 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
for (int i = 0; i < listMap.size(); i++) {
|
|
|
orgList = new ArrayList<String>();
|
|
|
Map<String, String> codeMap = listMap.get(i);
|
|
|
- String name = codeMap.get("name");//成本归属公司
|
|
|
+ String name = codeMap.get("name");// 成本归属公司
|
|
|
String memo = codeMap.get("memo");
|
|
|
String[] smemo = memo.split(",");
|
|
|
for (String org : smemo) {
|
|
@@ -717,66 +713,111 @@ public class HrLaborcostcopycbPlugin implements IBackgroundWorkPlugin{
|
|
|
Object pk_currtype = iuap.executeQuery(sql, parameter, new ColumnProcessor());
|
|
|
return pk_currtype != null ? pk_currtype + "" : "";
|
|
|
}
|
|
|
-
|
|
|
- //自定义档案
|
|
|
- private String getDefdocPKByName(String defdoclistcode,String name) throws Exception {
|
|
|
- if("".equals(name)) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- String sql = "select pk_defdoc from bd_defdoc where pk_defdoclist = (select pk_defdoclist from bd_defdoclist where code = '"+defdoclistcode+"' and nvl(dr,0) = 0) and name = '"+name+"' and enablestate = '2' and nvl(dr,0) = 0";
|
|
|
- String pk_defdoc = (String) iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
- if (pk_defdoc == null) {
|
|
|
- throw new Exception("获取"+name+"信息失败,未找到与参数" + name + "有关的数据!");
|
|
|
- }
|
|
|
- return pk_defdoc;
|
|
|
- }
|
|
|
|
|
|
- // 客户
|
|
|
- private String getCustomerPKBynameOrPkorg(String name,String pkorg) throws Exception {
|
|
|
- if ("".equals(name)) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- String sql = "select pk_customer from bd_customer where ( name = '" + name + "' or pk_financeorg = '" + pkorg + "' ) and enablestate = '2' and nvl(dr,0) = 0";
|
|
|
- String pk_customer = (String) iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
- if (pk_customer == null) {
|
|
|
- throw new Exception("获取客户信息失败,未找到与参数" + name + "有关的数据!");
|
|
|
- }
|
|
|
- return pk_customer;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 排除薪资发放公司与成本归属公司相同、排除TH03对应关系的公司数据
|
|
|
+ *
|
|
|
* @param listCostMap
|
|
|
* @param maps
|
|
|
* @param orgnamemap
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<Map<String, String>> getNewListCostMap(List<Map<String, String>> listCostMap,Map<String, List<String>> maps,Map<String, String> orgnamemap){
|
|
|
- List<Map<String, String>> listCostMapNew=new LinkedList<Map<String, String>>();
|
|
|
- for(Map<String, String> map :listCostMap){
|
|
|
+ private List<Map<String, String>> getNewListCostMap(List<Map<String, String>> listCostMap,
|
|
|
+ Map<String, List<String>> maps, Map<String, String> orgnamemap) {
|
|
|
+ List<Map<String, String>> listCostMapNew = new LinkedList<Map<String, String>>();
|
|
|
+ for (Map<String, String> map : listCostMap) {
|
|
|
String wa_org = map.get("wa_org");
|
|
|
String cost_org = map.get("cost_org");
|
|
|
String cost_orgname = orgnamemap.get(cost_org);
|
|
|
String wa_orgname = orgnamemap.get(wa_org);
|
|
|
- boolean flag=true;
|
|
|
- if(wa_orgname.equals(cost_orgname)){
|
|
|
- flag=false;
|
|
|
- }else{
|
|
|
+ boolean flag = true;
|
|
|
+ if (wa_orgname.equals(cost_orgname)) {
|
|
|
+ flag = false;
|
|
|
+ } else {
|
|
|
if (maps != null && maps.size() > 0) {
|
|
|
List<String> orgNameList = maps.get(cost_orgname);
|
|
|
if (orgNameList != null && orgNameList.size() > 0) {
|
|
|
if (orgNameList.contains(wa_orgname)) {
|
|
|
- flag=false;
|
|
|
+ flag = false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(flag){
|
|
|
+ if (flag) {
|
|
|
listCostMapNew.add(map);
|
|
|
}
|
|
|
}
|
|
|
return listCostMapNew;
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
+ // 自定义档案
|
|
|
+ private String getDefdocPKByName(String defdoclistcode, String name) throws Exception {
|
|
|
+ if ("".equals(name)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ String sql = "select pk_defdoc from bd_defdoc where pk_defdoclist = (select pk_defdoclist from bd_defdoclist where code = '"
|
|
|
+ + defdoclistcode + "' and nvl(dr,0) = 0) and name = '" + name + "' and enablestate = '2' and nvl(dr,0) = 0";
|
|
|
+ String pk_defdoc = (String) iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+ if (pk_defdoc == null) {
|
|
|
+ throw new Exception("获取" + name + "信息失败,未找到与参数" + name + "有关的数据!");
|
|
|
+ }
|
|
|
+ return pk_defdoc;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 客户
|
|
|
+ private String getCustomerPKBynameOrPkorg(String name, String pkorg) throws Exception {
|
|
|
+ if ("".equals(name)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ String sql = "select pk_customer from bd_customer where ( name = '" + name + "' or pk_financeorg = '" + pkorg
|
|
|
+ + "' ) and enablestate = '2' and nvl(dr,0) = 0";
|
|
|
+ String pk_customer = (String) iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+ if (pk_customer == null) {
|
|
|
+ throw new Exception("获取客户信息失败,未找到与参数" + name + "有关的数据!");
|
|
|
+ }
|
|
|
+ return pk_customer;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取相差月份最后一天addMonth==0 当月 1 下月
|
|
|
+ private String getMonthLastDate(Date date, int addMonth) {
|
|
|
+ Calendar calendar = new GregorianCalendar();
|
|
|
+ calendar.setTime(date);
|
|
|
+ calendar.add(Calendar.MONTH, addMonth);
|
|
|
+ calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
|
|
|
+ Date first = calendar.getTime();
|
|
|
+ return convertDateToString(first, "yyyy-MM-dd");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 日期格式转字符串
|
|
|
+ private String convertDateToString(Date inDate, String dateFormat) {
|
|
|
+ String resultValue = "";
|
|
|
+ if (inDate == null) {
|
|
|
+ return resultValue;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ SimpleDateFormat df = new SimpleDateFormat(dateFormat == null ? "yyyy-MM-dd" : dateFormat, Locale.US);
|
|
|
+ resultValue = df.format(inDate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return resultValue;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 字符串转日期格式
|
|
|
+ private Date convertStringToDate(String inDate, String format) {
|
|
|
+ if (inDate == null || inDate.isEmpty()) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ SimpleDateFormat df;
|
|
|
+ Date resultDate = null;
|
|
|
+ try {
|
|
|
+ df = new SimpleDateFormat(format == null ? "yyyy-MM-dd" : format, Locale.US);
|
|
|
+ df.setLenient(false);
|
|
|
+ resultDate = df.parse(inDate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return resultDate;
|
|
|
}
|
|
|
|
|
|
}
|