Compare commits
27 Commits
Author | SHA1 | Date |
---|---|---|
|
358853f9a5 | 7 months ago |
|
48ca746685 | 7 months ago |
|
5bcb90b643 | 7 months ago |
|
fd5b0a9c1e | 9 months ago |
|
bd91ee4b56 | 9 months ago |
|
879b10ebf6 | 9 months ago |
|
b487fd6087 | 9 months ago |
|
97f0edc056 | 9 months ago |
|
05d0a85816 | 9 months ago |
|
a029071999 | 9 months ago |
|
80b285ce56 | 9 months ago |
|
933fcd2e37 | 9 months ago |
|
cfcc208fc4 | 9 months ago |
|
c3cb0dceec | 9 months ago |
|
db81a00b41 | 10 months ago |
|
33775509af | 1 year ago |
|
e72c2f98f2 | 1 year ago |
|
5b4ff6612e | 1 year ago |
|
939758db45 | 1 year ago |
|
bca7c6eb0e | 1 year ago |
|
0a9c52769d | 1 year ago |
|
98b7843757 | 1 year ago |
|
e88632d12f | 1 year ago |
|
945c64e80b | 2 years ago |
|
52595871dd | 2 years ago |
|
b851526e98 | 2 years ago |
|
fe7fde8ac0 | 2 years ago |
@ -0,0 +1,16 @@
|
||||
#东方骏驰花名册快照自定义字段
|
||||
|
||||
#银行卡号
|
||||
account=field31
|
||||
#银行名称
|
||||
bankField=field34
|
||||
#户籍地址
|
||||
regresidentplace=field18
|
||||
#首次参保日期
|
||||
femdate=field11
|
||||
|
||||
#建模快照数据模块id
|
||||
modeId=77
|
||||
|
||||
#考勤工时统计台账模块id
|
||||
kqModeid=77
|
@ -0,0 +1,711 @@
|
||||
<%@ page import="weaver.general.BaseBean" %>
|
||||
<%@ page import="weaver.conn.RecordSetDataSource" %>
|
||||
<%@ page import="cn.hutool.core.date.DateUtil" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="com.wbi.util.StringUtil" %>
|
||||
<%@ page import="java.math.BigDecimal" %>
|
||||
<%@ page import="java.math.RoundingMode" %>
|
||||
<%@ page import="java.util.stream.Collectors" %>
|
||||
<%@ page import="weaver.formmode.setup.ModeRightInfo" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.interfaces.dfjc.entity.ProWagDetPO" %>
|
||||
<%@ page import="com.google.gson.Gson" %>
|
||||
<%@ page import="java.time.format.DateTimeFormatter" %>
|
||||
<%@ page import="java.time.LocalDate" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
|
||||
<%
|
||||
|
||||
out.print("-----------SyncDfjcUatBatch start-------------");
|
||||
BaseBean basebean = new BaseBean();
|
||||
|
||||
String fromdate = request.getParameter("fromdate");
|
||||
String todate = request.getParameter("todate");
|
||||
RecordSetDataSource rsds = new RecordSetDataSource();
|
||||
RecordSet rs = new RecordSet();
|
||||
//获取当前年月日
|
||||
String today = DateUtil.format(new Date(),"yyyy-MM-dd");
|
||||
// //获取当前年月
|
||||
// String nowMonth = DateUtil.format(new Date(),"yyyy-MM");
|
||||
// //获取当前年
|
||||
// String nowYear = DateUtil.format(new Date(),"yyyy");
|
||||
|
||||
try {
|
||||
basebean.writeLog("------------SyncDfjcUatBatch Try-----------");
|
||||
|
||||
//计算出开始日期和结束日期之间的每个日期
|
||||
|
||||
List<String> everyDate = getEveryDate(fromdate, todate);
|
||||
|
||||
for ( String syncdate : everyDate ) {
|
||||
basebean.writeLog("syncdate: " + syncdate);
|
||||
|
||||
//2023-11-22
|
||||
String nowYear = syncdate.substring(0,4);
|
||||
basebean.writeLog("nowYear: " + nowYear);
|
||||
|
||||
String nowMonth = syncdate.substring(0,7);
|
||||
basebean.writeLog("nowMonth: " + nowMonth);
|
||||
|
||||
//获取基础数据
|
||||
List<Map<String, String>> baseDatasList = new ArrayList<>();
|
||||
Map<String, String> baseDataMap = new HashMap<>();
|
||||
//// String acqBaseDatasSql = " select lhid, rksl from uf_u9dddj where rksj = ?";
|
||||
//String acqBaseDatasSql = " SELECT Item, EligibleQty from MO_CompleteRpt WHERE CAST(ActualRcvTime AS DATE) = ? and DocState = 3";
|
||||
|
||||
String acqBaseDatasSql = " SELECT a.id,a.docstate,a.HandleDept, a.item,a.ActualRcvTime,a.EligibleQty,b.BusinessType FROM MO_CompleteRpt a LEFT JOIN MO_CompleteRptDocType b ON a.CompleteDocType=b.ID WHERE b.BusinessType<>48 and CAST(ActualRcvTime AS DATE) = ? and DocState = 3";
|
||||
|
||||
|
||||
//// rs.executeQuery(acqBaseDatasSql,nowDate);
|
||||
rsds.executeQueryWithDatasource( acqBaseDatasSql, "u9", syncdate);
|
||||
while (rsds.next()) {
|
||||
String lhid = Util.null2String(rsds.getString("Item"));//料号id
|
||||
String rksl = Util.null2String(rsds.getString("EligibleQty"));//入库数量
|
||||
if ( StringUtil.isNotBlank(lhid) && StringUtil.isNotBlank(rksl)) {
|
||||
baseDataMap = new HashMap<>();
|
||||
baseDataMap.put("lhid",lhid);
|
||||
baseDataMap.put("rksl",rksl);
|
||||
baseDatasList.add(baseDataMap);
|
||||
}
|
||||
}
|
||||
basebean.writeLog("------baseDatasList.size: " + baseDatasList.size() );
|
||||
basebean.writeLog("------baseDatasList: " + baseDatasList );
|
||||
|
||||
//获取产品单价台账
|
||||
Map<String, Map<String, String>> unitPricesMap = new HashMap<>();
|
||||
Map<String, String> unitPriceMap = new HashMap<>();
|
||||
// String scqunitPriceSql = "select id, lhid, lh, lp, cx, xncx, rklbz1, dj, rklbz2, dj2, rklbz3, dj3 from uf_cpdjb where djnd = ?";
|
||||
String scqunitPriceSql = "select id, lhid, lh, lp, cx, xncx, rklbz1, dj, rklbz2, dj2, rklbz3, dj3 from uf_cpdjb ";
|
||||
boolean b = rs.executeQuery( scqunitPriceSql);
|
||||
basebean.writeLog("------b: " + b );
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));//产品单价id
|
||||
String lhid = Util.null2String(rs.getString("lhid"));//料号id
|
||||
String lh = Util.null2String(rs.getString("lh"));//料号
|
||||
String lp = Util.null2String(rs.getString("lp"));//料品
|
||||
String cx = Util.null2String(rs.getString("cx"));//产线
|
||||
String xncx = Util.null2String(rs.getString("xncx"));//虚拟产线
|
||||
String rklbz1 = Util.null2String(rs.getString("rklbz1"));//入库量标准1
|
||||
String dj = Util.null2String(rs.getString("dj"));//单价1
|
||||
String rklbz2 = Util.null2String(rs.getString("rklbz2"));//入库量标准2
|
||||
String dj2 = Util.null2String(rs.getString("dj2"));//单价2
|
||||
String rklbz3 = Util.null2String(rs.getString("rklbz3"));//入库量标准3
|
||||
String dj3 = Util.null2String(rs.getString("dj3"));//单价3
|
||||
if ( StringUtil.isNotBlank(lhid) && StringUtil.isNotBlank(cx) && StringUtil.isNotBlank(lp) ) {
|
||||
unitPriceMap = new HashMap<>();
|
||||
unitPriceMap.put("id",id);
|
||||
unitPriceMap.put("lhid",lhid);
|
||||
unitPriceMap.put("lh",lh);
|
||||
unitPriceMap.put("lp",lp);
|
||||
unitPriceMap.put("cx",cx);
|
||||
unitPriceMap.put("xncx",xncx);
|
||||
unitPriceMap.put("rklbz1",rklbz1);
|
||||
unitPriceMap.put("dj",dj);
|
||||
unitPriceMap.put("rklbz2",rklbz2);
|
||||
unitPriceMap.put("dj2",dj2);
|
||||
unitPriceMap.put("rklbz3",rklbz3);
|
||||
unitPriceMap.put("dj3",dj3);
|
||||
unitPricesMap.put(lhid,unitPriceMap);
|
||||
}
|
||||
}
|
||||
|
||||
basebean.writeLog("------unitPricesMap: " + new Gson().toJson(unitPricesMap));
|
||||
|
||||
//获取料号和各单价的对应关系
|
||||
Map<String, Map<String, String>> lpToDjMap = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, Map<String, String>> entry : unitPricesMap.entrySet()) {
|
||||
String lp = entry.getValue().get("lp");
|
||||
String dj = entry.getValue().get("dj");
|
||||
String dj2 = entry.getValue().get("dj2");
|
||||
String dj3 = entry.getValue().get("dj3");
|
||||
|
||||
if (lpToDjMap.containsKey(lp)) {
|
||||
Map<String, String> djMap = lpToDjMap.get(lp);
|
||||
djMap.put("dj", dj);
|
||||
djMap.put("dj2", dj2);
|
||||
djMap.put("dj3", dj3);
|
||||
} else {
|
||||
Map<String, String> djMap = new HashMap<>();
|
||||
djMap.put("dj", dj);
|
||||
djMap.put("dj2", dj2);
|
||||
djMap.put("dj3", dj3);
|
||||
lpToDjMap.put(lp, djMap);
|
||||
}
|
||||
}
|
||||
|
||||
//获取虚拟产线和料品的对应关系
|
||||
Map<String, List<String>> xncxToLpMap = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, Map<String, String>> entry : unitPricesMap.entrySet()) {
|
||||
|
||||
String xncx = entry.getValue().get("xncx");
|
||||
String lp = entry.getValue().get("lp");
|
||||
|
||||
if (StringUtil.isNotBlank(xncx)) {
|
||||
if (xncxToLpMap.containsKey(xncx)) {
|
||||
List<String> lpList = xncxToLpMap.get(xncx);
|
||||
lpList.add(lp);
|
||||
} else {
|
||||
List<String> lpList = new ArrayList<>();
|
||||
lpList.add(lp);
|
||||
xncxToLpMap.put(xncx, lpList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//获取产线工价台账
|
||||
// String checkProSql = "select count(*) as number from uf_cxgj where cxmc = ? and scyf = ? ";
|
||||
|
||||
//产线工价主表
|
||||
String acqProMainSql = "select id from uf_cxgj where cxmc = ? and scyf = ?";
|
||||
String acqProMainByMonthSql = "select id from uf_cxgj where scyf = ?";
|
||||
|
||||
//产线工价明细表
|
||||
// String acqProDetSql = "select id, lh, lp, rkrq, cpdj, rkcl, rkje from uf_cxgj_dt1 where mainId = ?";
|
||||
String acqProDetBatSql = "select id, mainid, lh, lp, rkrq, cpdj, rkcl, rkje from uf_cxgj_dt1 where mainid in ";
|
||||
|
||||
//产线工价明细表插入
|
||||
String addProDetSql = "insert into uf_cxgj_dt1 ( mainid, lh, lp, rkrq, cpdj, rkcl, rkje ) values ( ?, ?, ?, ?, ?, ?, ? )";
|
||||
|
||||
//产线工价明细表修改
|
||||
String editProDetSql = "update uf_cxgj_dt1 set cpdj = ? ,rkje = ? where id = ? ";
|
||||
|
||||
//获取当前月份的产线工价数据
|
||||
// out.print("------getProDets start");
|
||||
List<ProWagDetPO> proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
// out.print("------proDetList: " + proDetList );
|
||||
|
||||
//根据料号id处理
|
||||
for ( Map<String,String> baseData:baseDatasList) {
|
||||
basebean.writeLog("=================== " );
|
||||
basebean.writeLog("------baseData: " + baseData );
|
||||
String lhid = baseData.get("lhid");//料号id
|
||||
String rksl = baseData.get("rksl");//入库数量
|
||||
Map<String, String> unitPriceTmpMap = unitPricesMap.get(lhid);
|
||||
|
||||
if ( unitPriceTmpMap == null || unitPriceTmpMap.isEmpty() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String id = unitPriceTmpMap.get("id");//产品单价id
|
||||
String lp = unitPriceTmpMap.get("lp");//料品
|
||||
String lh = unitPriceTmpMap.get("lh");//料号
|
||||
String cx = unitPriceTmpMap.get("cx");//产线
|
||||
String xncx = unitPriceTmpMap.get("xncx");//虚拟产线
|
||||
String rklbz1 = unitPriceTmpMap.get("rklbz1");//标准1
|
||||
String rklbz2 = unitPriceTmpMap.get("rklbz2");//标准2
|
||||
String rklbz3 = unitPriceTmpMap.get("rklbz3");//标准3
|
||||
String dj = unitPriceTmpMap.get("dj");//单价1
|
||||
String dj2 = unitPriceTmpMap.get("dj2");//单价2
|
||||
String dj3 = unitPriceTmpMap.get("dj3");//单价3
|
||||
|
||||
//是否阶梯单价
|
||||
boolean stepUnitPriceFlag = true;
|
||||
if ( StringUtil.isBlank(rklbz2) && StringUtil.isBlank(rklbz3)) {
|
||||
stepUnitPriceFlag = false;
|
||||
}
|
||||
basebean.writeLog("------stepUnitPriceFlag: " + stepUnitPriceFlag );
|
||||
|
||||
//是否虚拟产线
|
||||
boolean virProLineFlag = true;
|
||||
if ( StringUtil.isBlank(xncx)) {
|
||||
virProLineFlag = false;
|
||||
}
|
||||
basebean.writeLog("------virProLineFlag: " + virProLineFlag );
|
||||
|
||||
Integer mainId = -1;
|
||||
rs.executeQuery( acqProMainSql, cx, nowMonth);
|
||||
while (rs.next()) {
|
||||
mainId = Util.getIntValue( Util.null2String( rs.getString("id")));
|
||||
}
|
||||
basebean.writeLog("------mainId: " + mainId );
|
||||
|
||||
Integer tempMainId = -1;
|
||||
if ( mainId == -1) {//主表没有该产线的数据
|
||||
mainId = Util.getIntValue( addProMainData(cx, nowMonth, rs));
|
||||
if (cx.equals("13")) {
|
||||
tempMainId = mainId;
|
||||
}
|
||||
}
|
||||
basebean.writeLog("------mainId: " + mainId );
|
||||
|
||||
if ( !stepUnitPriceFlag ) {//非阶梯单价--直接插入一行明细
|
||||
if ( tempMainId > 0 ) {
|
||||
out.print("--dj:" + dj + "--");
|
||||
out.print("--dj2:" + dj2 + "--");
|
||||
out.print("--dj3:" + dj3 + "--");
|
||||
}
|
||||
|
||||
//计算入库金额
|
||||
BigDecimal depAmount = new BigDecimal(0);
|
||||
if ( StringUtil.isNotBlank(rksl) && StringUtil.isNotBlank(dj)) {
|
||||
BigDecimal depNum = new BigDecimal(rksl);
|
||||
BigDecimal uniPri = new BigDecimal(dj);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
rs.executeUpdate( addProDetSql, mainId, id, lp, syncdate, dj, rksl, depAmount);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
|
||||
} else {//阶梯单价
|
||||
//虚拟产线
|
||||
if ( !virProLineFlag ) {
|
||||
//非虚拟产线,找同料号的明细
|
||||
if ( proDetList.isEmpty()) {//明细表没有数据
|
||||
Double unPr= 0.0;
|
||||
if ( StringUtil.isBlank(dj2) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else {
|
||||
if ( Double.parseDouble(rksl) < Double.parseDouble(rklbz1) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else if ( (Double.parseDouble(rksl) >= Double.parseDouble(rklbz1)) && ( StringUtil.isNotBlank(rklbz2) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz2))) ) {
|
||||
unPr = Double.valueOf(dj2);
|
||||
} else if ( (Double.parseDouble(rksl) >= Double.parseDouble(rklbz2)) && (StringUtil.isNotBlank(rklbz3) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz3)))) {
|
||||
unPr = Double.valueOf(dj3);
|
||||
}
|
||||
}
|
||||
|
||||
//计算入库金额
|
||||
BigDecimal depAmount = new BigDecimal(0);
|
||||
if ( StringUtil.isNotBlank(rksl) && unPr > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(rksl);
|
||||
BigDecimal uniPri = new BigDecimal(unPr);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
rs.executeUpdate( addProDetSql, mainId, id, lp, syncdate, unPr, rksl, depAmount);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
|
||||
} else {
|
||||
String finalMainId = Util.null2String(mainId);
|
||||
List<ProWagDetPO> proWList = proDetList.stream()
|
||||
// .filter(pro -> pro.getMainId().equals(finalMainId) && pro.getLp() != null && pro.getLp().equals(lp))
|
||||
.filter(pro -> pro.getMainId().equals(finalMainId) )
|
||||
.collect(Collectors.toList());
|
||||
// if ( proWList.isEmpty()) {//没有同产线的明细
|
||||
// Double unPr= 0.0;
|
||||
// if ( StringUtil.isBlank(dj2) ) {
|
||||
// unPr = Double.valueOf(dj);
|
||||
// } else {
|
||||
// if (Double.parseDouble(rksl) < Double.parseDouble(rklbz1)) {
|
||||
// unPr = Double.valueOf(dj);
|
||||
// } else if ((Double.parseDouble(rksl) >= Double.parseDouble(rklbz1)) && (StringUtil.isNotBlank(rklbz2) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz2)))) {
|
||||
// unPr = Double.valueOf(dj2);
|
||||
// } else if ((Double.parseDouble(rksl) >= Double.parseDouble(rklbz2)) && (StringUtil.isNotBlank(rklbz3) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz3)))) {
|
||||
// unPr = Double.valueOf(dj3);
|
||||
// }
|
||||
// }
|
||||
// //计算入库金额
|
||||
// BigDecimal depAmount = new BigDecimal(0);
|
||||
// if ( StringUtil.isNotBlank(rksl) && unPr > 0 ) {
|
||||
// BigDecimal depNum = new BigDecimal(rksl);
|
||||
// BigDecimal uniPri = new BigDecimal(unPr);
|
||||
// depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
// }
|
||||
// rs.executeUpdate( addProDetSql, mainId, id, lp, syncdate, unPr, rksl, depAmount);
|
||||
// proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
//
|
||||
// } else {
|
||||
// 存在同产线的明细
|
||||
Double unPr= 0.0;
|
||||
List<String> rkcls = proWList.stream()
|
||||
.map(pro -> pro.getStorageNumber())
|
||||
.collect(Collectors.toList());
|
||||
Double rkclSum = rkcls.stream()
|
||||
.map(str -> Double.parseDouble(str))
|
||||
.reduce(0.0, Double::sum);
|
||||
|
||||
rkclSum = rkclSum + Double.parseDouble(rksl);
|
||||
|
||||
if ( StringUtil.isBlank(dj2) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else {
|
||||
if (rkclSum < Double.parseDouble(rklbz1)) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else if ((rkclSum >= Double.parseDouble(rklbz1)) && (StringUtil.isNotBlank(rklbz2) && (rkclSum < Double.parseDouble(rklbz2)))) {
|
||||
unPr = Double.valueOf(dj2);
|
||||
} else if ((rkclSum >= Double.parseDouble(rklbz2)) && (StringUtil.isNotBlank(rklbz3) && (rkclSum < Double.parseDouble(rklbz3)))) {
|
||||
unPr = Double.valueOf(dj3);
|
||||
}
|
||||
}
|
||||
//计算入库金额
|
||||
BigDecimal depAmount = new BigDecimal(0);
|
||||
if ( Double.parseDouble(rksl) > 0 && unPr > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(rksl);
|
||||
BigDecimal uniPri = new BigDecimal(unPr);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
rs.executeUpdate( addProDetSql, mainId, id, lp, syncdate, unPr, rksl, depAmount);
|
||||
//处理历史明细
|
||||
List<List> oldDetDatas = new ArrayList<>();
|
||||
List<String> detIds = proWList.stream()
|
||||
.map(pro -> pro.getId())
|
||||
.collect(Collectors.toList());
|
||||
Map<String, String> StoNumMap = proWList.stream()
|
||||
.filter(pro -> detIds.contains(pro.getId()))
|
||||
.collect(Collectors.toMap(
|
||||
ProWagDetPO::getId,
|
||||
ProWagDetPO::getStorageNumber
|
||||
));
|
||||
for (String detId : detIds) {
|
||||
Integer stoNum = Util.getIntValue(StoNumMap.get(detId));
|
||||
|
||||
//同产线的总量 rkclSum
|
||||
//获取该料品的入库数量标准和单价
|
||||
for (ProWagDetPO pro : proWList) {
|
||||
if (pro.getId().equals(detId)) {
|
||||
pro.getLhid();
|
||||
}
|
||||
}
|
||||
unitPriceTmpMap = unitPricesMap.get(lhid);
|
||||
|
||||
if ( unitPriceTmpMap == null || unitPriceTmpMap.isEmpty() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
id = unitPriceTmpMap.get("id");//产品单价id
|
||||
lp = unitPriceTmpMap.get("lp");//料品
|
||||
lh = unitPriceTmpMap.get("lh");//料号
|
||||
cx = unitPriceTmpMap.get("cx");//产线
|
||||
xncx = unitPriceTmpMap.get("xncx");//虚拟产线
|
||||
rklbz1 = unitPriceTmpMap.get("rklbz1");//标准1
|
||||
rklbz2 = unitPriceTmpMap.get("rklbz2");//标准2
|
||||
rklbz3 = unitPriceTmpMap.get("rklbz3");//标准3
|
||||
dj = unitPriceTmpMap.get("dj");//单价1
|
||||
dj2 = unitPriceTmpMap.get("dj2");//单价2
|
||||
dj3 = unitPriceTmpMap.get("dj3");//单价3
|
||||
|
||||
if ( StringUtil.isBlank(dj2) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else {
|
||||
if (rkclSum < Double.parseDouble(rklbz1)) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else if ((rkclSum >= Double.parseDouble(rklbz1)) && (StringUtil.isNotBlank(rklbz2) && (rkclSum < Double.parseDouble(rklbz2)))) {
|
||||
unPr = Double.valueOf(dj2);
|
||||
} else if ((rkclSum >= Double.parseDouble(rklbz2)) && (StringUtil.isNotBlank(rklbz3) && (rkclSum < Double.parseDouble(rklbz3)))) {
|
||||
unPr = Double.valueOf(dj3);
|
||||
}
|
||||
}
|
||||
|
||||
//计算入库金额
|
||||
depAmount = new BigDecimal(0);
|
||||
if ( stoNum > 0 && unPr > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(stoNum);
|
||||
BigDecimal uniPri = new BigDecimal(unPr);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
List tempList = new ArrayList<>();
|
||||
tempList.add(unPr);
|
||||
tempList.add(depAmount);
|
||||
tempList.add(detId);
|
||||
oldDetDatas.add(tempList);
|
||||
// }
|
||||
|
||||
rs.executeBatchSql( editProDetSql, oldDetDatas);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( proDetList.isEmpty()) {
|
||||
Double unPr= 0.0;
|
||||
if ( Double.parseDouble(rksl) < Double.parseDouble(rklbz1) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else if ( (Double.parseDouble(rksl) >= Double.parseDouble(rklbz1)) && ( StringUtil.isNotBlank(rklbz2) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz2))) ) {
|
||||
unPr = Double.valueOf(dj2);
|
||||
} else if ( (Double.parseDouble(rksl) >= Double.parseDouble(rklbz2)) && (StringUtil.isNotBlank(rklbz3) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz3)))) {
|
||||
unPr = Double.valueOf(dj3);
|
||||
}
|
||||
//计算入库金额
|
||||
BigDecimal depAmount = new BigDecimal(0);
|
||||
if ( StringUtil.isNotBlank(rksl) && unPr > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(rksl);
|
||||
BigDecimal uniPri = new BigDecimal(unPr);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
rs.executeUpdate( addProDetSql, mainId, id, lp, syncdate, unPr, rksl, depAmount);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
} else {
|
||||
String finalMainId = Util.null2String(mainId);
|
||||
List<String> lpTmpList = xncxToLpMap.get(xncx);
|
||||
List<ProWagDetPO> proWList = proDetList.stream()
|
||||
.filter(pro -> pro.getMainId().equals(finalMainId) && pro.getLp() != null && lpTmpList.contains(pro.getLp()))
|
||||
// .filter(pro -> pro.getMainId().equals(finalMainId))
|
||||
.collect(Collectors.toList());
|
||||
if ( proWList.isEmpty()) {//没有同虚拟产线的明细
|
||||
Double unPr= 0.0;
|
||||
if ( Double.parseDouble(rksl) < Double.parseDouble(rklbz1) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else if ( (Double.parseDouble(rksl) >= Double.parseDouble(rklbz1)) && ( StringUtil.isNotBlank(rklbz2) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz2))) ) {
|
||||
unPr = Double.valueOf(dj2);
|
||||
} else if ( (Double.parseDouble(rksl) >= Double.parseDouble(rklbz2)) && (StringUtil.isNotBlank(rklbz3) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz3)))) {
|
||||
unPr = Double.valueOf(dj3);
|
||||
}
|
||||
//计算入库金额
|
||||
BigDecimal depAmount = new BigDecimal(0);
|
||||
if ( StringUtil.isNotBlank(rksl) && unPr > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(rksl);
|
||||
BigDecimal uniPri = new BigDecimal(unPr);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
rs.executeUpdate( addProDetSql, mainId, id, lp, syncdate, unPr, rksl, depAmount);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
|
||||
} else {//存在同虚拟产线
|
||||
Double unPr= 0.0;
|
||||
String stage = "dj";
|
||||
List<String> rkcls = proWList.stream()
|
||||
.map(pro -> pro.getStorageNumber())
|
||||
.collect(Collectors.toList());
|
||||
Double rkclSum = rkcls.stream()
|
||||
.map(str -> Double.parseDouble(str))
|
||||
.reduce(0.0, Double::sum);
|
||||
|
||||
rkclSum = rkclSum + Double.parseDouble(rksl);
|
||||
|
||||
if ( rkclSum < Double.parseDouble(rklbz1) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else if ( (rkclSum >= Double.parseDouble(rklbz1)) && ( StringUtil.isNotBlank(rklbz2) && (rkclSum < Double.parseDouble(rklbz2))) ) {
|
||||
unPr = Double.valueOf(dj2);
|
||||
stage = "dj2";
|
||||
} else if ( (rkclSum >= Double.parseDouble(rklbz2)) && (StringUtil.isNotBlank(rklbz3) && (rkclSum < Double.parseDouble(rklbz3)))) {
|
||||
unPr = Double.valueOf(dj3);
|
||||
stage = "dj3";
|
||||
}
|
||||
//计算入库金额
|
||||
BigDecimal depAmount = new BigDecimal(0);
|
||||
if ( Double.parseDouble(rksl) > 0 && unPr > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(rksl);
|
||||
BigDecimal uniPri = new BigDecimal(unPr);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
rs.executeUpdate( addProDetSql, mainId, id, lp, syncdate, unPr, rksl, depAmount);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
//处理历史明细
|
||||
List<List> oldDetDatas = new ArrayList<>();
|
||||
List<String> detIds = proWList.stream()
|
||||
.map(pro -> pro.getId())
|
||||
.collect(Collectors.toList());
|
||||
Map<String, Map<String, Object>> idToLpStoNumMap = proWList.stream()
|
||||
.filter(proWagDetPO -> detIds.contains(proWagDetPO.getId()))
|
||||
.collect(Collectors.toMap(
|
||||
proWagDetPO -> proWagDetPO.getId(),
|
||||
proWagDetPO -> {
|
||||
Map<String, Object> innerMap = new HashMap<>();
|
||||
innerMap.put("lp", proWagDetPO.getLp());
|
||||
innerMap.put("storageNumber", proWagDetPO.getStorageNumber());
|
||||
return innerMap;
|
||||
}
|
||||
));
|
||||
for (String detId : detIds) {
|
||||
Map<String, Object> innerMap = idToLpStoNumMap.get(detId);
|
||||
//计算入库金额
|
||||
depAmount = new BigDecimal(0);
|
||||
String lpTmp = Util.null2String(innerMap.get("lp"));
|
||||
Integer stoNumTmp = Util.getIntValue( Util.null2String(innerMap.get("storageNumber")));
|
||||
|
||||
// Map<String, String> djTmpMap = lpToDjMap.get(lpTmp);
|
||||
// Double unPrTmp = Util.getDoubleValue(djTmpMap.get(stage));
|
||||
|
||||
//获取该料品的入库数量标准和单价
|
||||
for (ProWagDetPO pro : proWList) {
|
||||
if (pro.getId().equals(detId)) {
|
||||
pro.getLhid();
|
||||
}
|
||||
}
|
||||
unitPriceTmpMap = unitPricesMap.get(lhid);
|
||||
|
||||
if ( unitPriceTmpMap == null || unitPriceTmpMap.isEmpty() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
id = unitPriceTmpMap.get("id");//产品单价id
|
||||
lp = unitPriceTmpMap.get("lp");//料品
|
||||
lh = unitPriceTmpMap.get("lh");//料号
|
||||
cx = unitPriceTmpMap.get("cx");//产线
|
||||
xncx = unitPriceTmpMap.get("xncx");//虚拟产线
|
||||
rklbz1 = unitPriceTmpMap.get("rklbz1");//标准1
|
||||
rklbz2 = unitPriceTmpMap.get("rklbz2");//标准2
|
||||
rklbz3 = unitPriceTmpMap.get("rklbz3");//标准3
|
||||
dj = unitPriceTmpMap.get("dj");//单价1
|
||||
dj2 = unitPriceTmpMap.get("dj2");//单价2
|
||||
dj3 = unitPriceTmpMap.get("dj3");//单价3
|
||||
|
||||
Double unPrTmp = 0.00;
|
||||
|
||||
if ( StringUtil.isBlank(dj2) ) {
|
||||
unPrTmp = Double.valueOf(dj);
|
||||
} else {
|
||||
if (rkclSum < Double.parseDouble(rklbz1)) {
|
||||
unPrTmp = Double.valueOf(dj);
|
||||
} else if ((rkclSum >= Double.parseDouble(rklbz1)) && (StringUtil.isNotBlank(rklbz2) && (rkclSum < Double.parseDouble(rklbz2)))) {
|
||||
unPrTmp = Double.valueOf(dj2);
|
||||
} else if ((rkclSum >= Double.parseDouble(rklbz2)) && (StringUtil.isNotBlank(rklbz3) && (rkclSum < Double.parseDouble(rklbz3)))) {
|
||||
unPrTmp = Double.valueOf(dj3);
|
||||
}
|
||||
}
|
||||
|
||||
if ( stoNumTmp > 0 && unPrTmp > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(stoNumTmp);
|
||||
BigDecimal uniPri = new BigDecimal(unPrTmp);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
List tempList = new ArrayList<>();
|
||||
tempList.add(unPrTmp);
|
||||
tempList.add(depAmount);
|
||||
tempList.add(detId);
|
||||
oldDetDatas.add(tempList);
|
||||
}
|
||||
|
||||
rs.executeBatchSql( editProDetSql, oldDetDatas);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
List<String> mainidList = new ArrayList<>();
|
||||
rs.executeQuery( acqProMainByMonthSql, nowMonth);
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
if (StringUtil.isNotBlank(id)) {
|
||||
mainidList.add(id);
|
||||
}
|
||||
}
|
||||
if ( !mainidList.isEmpty()) {
|
||||
String editProMainSql = "update uf_cxgj set lrrq = ? , cxzgj = (SELECT sum( rkje ) AS cxzgj FROM uf_cxgj_dt1 WHERE mainid = ?), rkzcl = (SELECT sum( rkcl ) AS rkzcl FROM uf_cxgj_dt1 WHERE mainid = ?) where id = ?";
|
||||
for (String mainid:mainidList) {
|
||||
rs.executeUpdate( editProMainSql, today, mainid, mainid, mainid);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}catch (Exception e) {
|
||||
basebean.writeLog("SyncDfjcUatBatch Exception: " + e);
|
||||
out.print("-----SyncDfjcUatBatch Exception: " + e);
|
||||
}
|
||||
|
||||
out.print("=========SyncDfjcUatBatch End==========");
|
||||
%>
|
||||
|
||||
<%!
|
||||
BaseBean basebean = new BaseBean();
|
||||
|
||||
public List<String> getEveryDate(String fromDate, String toDate) {
|
||||
List<String> everyDate = new ArrayList<>();
|
||||
|
||||
// 创建一个格式化器
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
// 将字符串转换为 LocalDate 对象
|
||||
LocalDate startLocalDate = LocalDate.parse(fromDate, formatter);
|
||||
LocalDate endLocalDate = LocalDate.parse(toDate, formatter);
|
||||
|
||||
// 创建一个列表来存储日期
|
||||
List<LocalDate> dates = new ArrayList<>();
|
||||
|
||||
// 计算并添加所有日期
|
||||
for (LocalDate date = startLocalDate; date.isBefore(endLocalDate.plusDays(1)); date = date.plusDays(1)) {
|
||||
dates.add(date);
|
||||
}
|
||||
|
||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
for (LocalDate date : dates) {
|
||||
everyDate.add(date.format(df));
|
||||
}
|
||||
|
||||
return everyDate;
|
||||
}
|
||||
|
||||
|
||||
public String addProMainData(String cx, String nowMonth, RecordSet rs){
|
||||
String result = "";
|
||||
String addProMainSql = "insert into uf_cxgj (lrr,lrrq,cxmc,scyf,formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,modeuuid) " +
|
||||
" values (?,?,?,?,?,?,?,?,?,?)";
|
||||
String acqMainIdSql = "select id from uf_cxgj where modeuuid = ? ";
|
||||
|
||||
String formmodeid = "48";
|
||||
String nowDate = DateUtil.format(new Date(),"yyyy-MM-dd");
|
||||
String nowTime = DateUtil.format(new Date(),"HH:mm:ss");
|
||||
UUID uuid = UUID.randomUUID();
|
||||
String modeuuid = uuid.toString();
|
||||
boolean addFlag = rs.executeUpdate( addProMainSql, 1, nowDate, cx, nowMonth, formmodeid, 1, 0, nowDate, nowTime, modeuuid);
|
||||
if ( addFlag) {
|
||||
rs.executeQuery( acqMainIdSql, modeuuid);
|
||||
while ( rs.next()) {
|
||||
result = Util.null2String( rs.getString("id"));
|
||||
}
|
||||
}
|
||||
|
||||
//权限重构
|
||||
ModeRightInfo modeRightInfo = new ModeRightInfo();
|
||||
modeRightInfo.setNewRight(true);
|
||||
modeRightInfo.editModeDataShare( 1, Integer.parseInt(formmodeid), Integer.parseInt(result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ProWagDetPO> getProDets(String acqProMainByMonthSql, String acqProDetBatSql, String nowMonth, Map<String, Map<String, String>> unitPricesMap, RecordSet rs) {
|
||||
List<String> proMainList = new ArrayList<>();
|
||||
List<ProWagDetPO> proDetList = new ArrayList<>();
|
||||
try {
|
||||
rs.executeQuery(acqProMainByMonthSql, nowMonth);
|
||||
while ( rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
if ( StringUtil.isNotBlank(id)) {
|
||||
proMainList.add(id);
|
||||
}
|
||||
}
|
||||
basebean.writeLog("============getProDets proMainList:"+ proMainList);
|
||||
basebean.writeLog("============getProDets proMainList:"+ proMainList.size());
|
||||
if ( !proMainList.isEmpty()) {
|
||||
ProWagDetPO po = null;
|
||||
String sqlWhere = String.join(",",proMainList);
|
||||
acqProDetBatSql = acqProDetBatSql + "( " + sqlWhere + " )";
|
||||
rs.executeQuery(acqProDetBatSql);
|
||||
while ( rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));//明细ID
|
||||
String mainid = Util.null2String(rs.getString("mainid"));
|
||||
String lhid = Util.null2String(rs.getString("lh"));
|
||||
String lp = Util.null2String(rs.getString("lp"));
|
||||
String rkrq = Util.null2String(rs.getString("rkrq"));
|
||||
String cpdj = Util.null2String(rs.getString("cpdj"));
|
||||
String rkcl = Util.null2String(rs.getString("rkcl"));//入库产量
|
||||
String rkje = Util.null2String(rs.getString("rkje"));
|
||||
if ( StringUtil.isNotBlank(mainid) && StringUtil.isNotBlank(lhid)) {
|
||||
po = new ProWagDetPO();
|
||||
po.setId(id);
|
||||
po.setMainId(mainid);
|
||||
po.setLhid(lhid);
|
||||
po.setLp(lp);
|
||||
po.setStorageDate(rkrq);
|
||||
po.setUnitPrice(cpdj);
|
||||
po.setStorageNumber(rkcl);
|
||||
po.setStorageAmount(rkje);
|
||||
|
||||
Map<String, String> tmpMap = unitPricesMap.get(lhid);
|
||||
if ( tmpMap != null && !tmpMap.isEmpty()) {
|
||||
String lh = tmpMap.get("lh");
|
||||
po.setLh(lh);
|
||||
}
|
||||
|
||||
proDetList.add(po);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
basebean.writeLog("getProDets exception: " + e);
|
||||
}
|
||||
return proDetList;
|
||||
}
|
||||
%>
|
@ -0,0 +1,206 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="weaver.hrm.User" %>
|
||||
<%@ page import="java.time.LocalDate" %>
|
||||
<%@ page import="weaver.general.TimeUtil" %>
|
||||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="java.util.HashMap" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSON" %>
|
||||
<%@ page import="java.util.UUID" %>
|
||||
<%@ page import="weaver.formmode.setup.ModeRightInfo" %>
|
||||
<%@ page import="com.engine.kq.biz.KQReportBiz" %>
|
||||
<%@ page import="com.engine.kq.util.KQDurationCalculatorUtil" %>
|
||||
<%@ page import="weaver.interfaces.dfjc.entity.KqMonthDataPO" %>
|
||||
|
||||
|
||||
<%
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
String ids = Util.null2String(request.getParameter("ids"));
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(" select xm,status,bm,gw,kqy from uf_ydgs a,hrmresource b where a.xm=b.id and a.id in ("+ids+") ");
|
||||
while(rs.next()){
|
||||
String xm = Util.null2String(rs.getString("xm"));
|
||||
String zt = Util.null2String(rs.getString("status"));
|
||||
String bm = Util.null2String(rs.getString("bm"));
|
||||
String gw = Util.null2String(rs.getString("gw"));
|
||||
String kqy = Util.null2String(rs.getString("kqy"));
|
||||
|
||||
LocalDate localDate = LocalDate.parse(kqy+"-01");
|
||||
String fromDate = localDate.toString();
|
||||
String toDate = localDate.withDayOfMonth(localDate.lengthOfMonth()).toString();
|
||||
|
||||
Map<String,Object> flowData = getKqOvertimeData(fromDate,toDate,xm);
|
||||
|
||||
|
||||
double psjbbdx = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(xm+"|workingDayOvertime_nonleave"))),0);
|
||||
double xxrjbbdx = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(xm+"|restDayOvertime_nonleave"))),0);
|
||||
double jjrjbbdx = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(xm+"|holidayOvertime_nonleave"))),0);
|
||||
double dkzgs = Util.getDoubleValue(Util.null2String(getWorkHours(fromDate,toDate,xm)),0);
|
||||
|
||||
//获取出差时长
|
||||
double ccxs = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(xm+"|businessLeave"))),0);
|
||||
|
||||
double zgs = psjbbdx+xxrjbbdx+jjrjbbdx+dkzgs+ccxs;
|
||||
|
||||
|
||||
KqMonthDataPO kqMonthDataPO = KqMonthDataPO.builder()
|
||||
.resourceId(xm)
|
||||
.status(zt)
|
||||
.departmentId(bm)
|
||||
.jobTitle(gw)
|
||||
.psjbbdx(psjbbdx)
|
||||
.xxrjbbdx(xxrjbbdx)
|
||||
.jjrjbbdx(jjrjbbdx)
|
||||
.dkzgs(dkzgs)
|
||||
.zgs(zgs)
|
||||
.ccxs(ccxs)
|
||||
.build();
|
||||
System.out.println("KqMonthReportSynByUser==>"+JSON.toJSONString(kqMonthDataPO));
|
||||
saveData(kqMonthDataPO,kqy);
|
||||
|
||||
|
||||
}
|
||||
|
||||
data.put("success",true);
|
||||
out.println(JSON.toJSONString(data));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%>
|
||||
|
||||
|
||||
<%!
|
||||
|
||||
/**
|
||||
* 获取加班数据
|
||||
* @param fromDate
|
||||
* @param toDate
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> getKqOvertimeData(String fromDate,String toDate,String resourceId){
|
||||
User user = User.getUser(1,0);
|
||||
Map<String,Object> params = new HashMap<>();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
jsonObject.put("isNoAccount","1");
|
||||
jsonObject.put("attendanceSerial","");
|
||||
jsonObject.put("status","9");
|
||||
jsonObject.put("viewScope","0");
|
||||
jsonObject.put("typeselect","6");
|
||||
jsonObject.put("fromDate",fromDate);
|
||||
jsonObject.put("toDate",toDate);
|
||||
jsonObject.put("resourceId",resourceId);
|
||||
params.put("data",jsonObject);
|
||||
|
||||
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
Map<String,Object> flowData = kqReportBiz.getFlowData(params,user);
|
||||
return flowData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实际打卡时长
|
||||
* @param fromDate
|
||||
* @param toDate
|
||||
* @return
|
||||
*/
|
||||
public String getWorkHours(String fromDate,String toDate,String xm){
|
||||
String workhours = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = " select xm,sum(sjgssc) workhours from uf_kqgs where kqrq>=? and kqrq<=? and xm=? group by xm ";
|
||||
rs.executeQuery(sql,fromDate,toDate,xm);
|
||||
while (rs.next()){
|
||||
workhours = Util.null2String(rs.getString("workhours"));
|
||||
}
|
||||
return workhours;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步数据到建模表
|
||||
* @param kqMonthDataPO
|
||||
* @param month
|
||||
*/
|
||||
public void saveData(KqMonthDataPO kqMonthDataPO,String month){
|
||||
RecordSet rs = new RecordSet();
|
||||
int formmodeid = getModeIdByTableName("uf_ydgs");
|
||||
int modedatacreater = 1;
|
||||
|
||||
String xm = kqMonthDataPO.getResourceId();
|
||||
String zt = kqMonthDataPO.getStatus();
|
||||
String bm = kqMonthDataPO.getDepartmentId();
|
||||
String gw = kqMonthDataPO.getJobTitle();
|
||||
Double dkzgs = kqMonthDataPO.getDkzgs();
|
||||
Double psjbbdx = kqMonthDataPO.getPsjbbdx();
|
||||
Double xxrjbbdx = kqMonthDataPO.getXxrjbbdx();
|
||||
Double jjrjbbdx = kqMonthDataPO.getJjrjbbdx();
|
||||
Double zgs = kqMonthDataPO.getZgs();
|
||||
Double ccxs = kqMonthDataPO.getCcxs();
|
||||
|
||||
|
||||
boolean exist = isExist(month,kqMonthDataPO.getResourceId());
|
||||
if(exist){
|
||||
//更新
|
||||
String updateSql = " update uf_ydgs set dkzgs=?, psjbbdx=?, xxrjbbdx=?, jjrjbbdx=?, zgs=?, zt=?, ccxs=? where xm=? and kqy=? ";
|
||||
rs.executeUpdate(updateSql,new Object[]{dkzgs,psjbbdx,xxrjbbdx,jjrjbbdx,zgs,zt,ccxs,xm,month});
|
||||
|
||||
}else{
|
||||
//插入
|
||||
String modeuuid = UUID.randomUUID().toString();
|
||||
String modedatacreatedate = TimeUtil.getCurrentDateString();
|
||||
String modedatacreatetime = TimeUtil.getOnlyCurrentTimeString();
|
||||
|
||||
String insertSql = " insert into uf_ydgs(xm,bm,gw,kqy,dkzgs,psjbbdx,xxrjbbdx,jjrjbbdx,zgs,zt,ccxs,"+
|
||||
"formmodeid,modedatacreater,modedatacreatedate,modedatacreatetime,modeuuid) " +
|
||||
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
|
||||
rs.executeUpdate(insertSql,new Object[]{xm,bm,gw,month,dkzgs,psjbbdx,xxrjbbdx,jjrjbbdx,zgs,zt,ccxs,
|
||||
formmodeid,modedatacreater,modedatacreatedate,modedatacreatetime,modeuuid});
|
||||
|
||||
rs.executeQuery("select id from uf_ydgs where modeuuid=?",modeuuid);
|
||||
rs.next();
|
||||
int id = rs.getInt("id");
|
||||
if(id>0){
|
||||
ModeRightInfo right = new ModeRightInfo();
|
||||
right.editModeDataShare(1, formmodeid, id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断数据是否存在
|
||||
* @param month
|
||||
* @param userid
|
||||
* @return
|
||||
*/
|
||||
public boolean isExist(String month,String userid){
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = " select 1 from uf_ydgs where kqy=? and xm=? ";
|
||||
rs.executeQuery(sql,month,userid);
|
||||
return rs.next();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据建模表名获取建模id,建模权限同步的使用
|
||||
* @param tableName 建模表名
|
||||
* @return int 建模id
|
||||
*/
|
||||
public static int getModeIdByTableName(String tableName){
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = " select a.id from modeinfo a,workflow_bill b where a.formid=b.id and b.tablename =? ";
|
||||
rs.executeQuery(sql, tableName);
|
||||
if (rs.next()) {
|
||||
return rs.getInt("id");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
%>
|
@ -0,0 +1,37 @@
|
||||
<%@ page import="com.engine.kq.entity.WorkTimeEntity" %>
|
||||
<%@ page import="com.weaver.general.Util" %>
|
||||
<%@ page import="com.engine.kq.biz.KQWorkTime" %>
|
||||
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
||||
<%@ page import="com.engine.kq.biz.KQShiftManagementComInfo" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
|
||||
|
||||
|
||||
<%
|
||||
|
||||
String id = Util.null2String(request.getParameter("id"));
|
||||
String gzrq = Util.null2String(request.getParameter("gzrq"));
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
|
||||
WorkTimeEntity workTimeEntity = kqWorkTime.getWorkTime(id, gzrq);
|
||||
String serialId = workTimeEntity.getSerialId();
|
||||
if (StringUtils.isBlank(serialId) || "-1".equals(serialId)) {
|
||||
kqWorkTime.setIsFormat(true);
|
||||
workTimeEntity = kqWorkTime.getWorkTime(id, gzrq);
|
||||
serialId = workTimeEntity.getSerialId();
|
||||
}
|
||||
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
String isRestTimeOpen = kqShiftManagementComInfo.getIsresttimeopen(serialId);
|
||||
|
||||
|
||||
//1表示开启
|
||||
out.println(isRestTimeOpen);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%>
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
package com.api.jygf.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Path("/mobile/permission")
|
||||
public class MobilePermissionsAction extends com.engine.jygf.web.MobilePermissionsAction {
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.api.kqsolution.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/9/2 10:17 AM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Path("/kqsolution/projectPrice")
|
||||
public class ProjectPriceAction extends com.engine.kqsolution.web.ProjectPriceAction {
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.api.kqsolution.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/8/29 9:22 AM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Path("/kqsolution/resource")
|
||||
public class ResourceSnipAction extends com.engine.kqsolution.web.ResourceSnipAction {
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.api.kqsolution.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/9/18 11:42 AM
|
||||
* @Description: 打卡数据及补卡数更新建模表
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Path("/kqsolution/cube")
|
||||
public class SignDataSummaryAction extends com.engine.kqsolution.web.SignDataSummaryAction{
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
package com.engine.jygf.cmd;
|
||||
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.User;
|
||||
import weaver.wechat.util.Utils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class MobilePermissionsCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private static final String FIELDID = "field100043"; //移动电话自定义字段field100026
|
||||
|
||||
private static final String SCOPE = "HrmCustomFieldByInfoType";
|
||||
|
||||
private static final String SCOPEID = "-1";
|
||||
|
||||
public MobilePermissionsCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
String uid = Utils.null2String(user.getUID());
|
||||
RecordSet rs = new RecordSet();
|
||||
HashSet<String> ids = new HashSet<>();
|
||||
ids.add(uid);
|
||||
rs.executeQuery("select ckr,bckr from uf_yddhqx_dt1");
|
||||
while (rs.next()) {
|
||||
String ckr = Utils.null2String(rs.getString("ckr"));
|
||||
String bckr = Utils.null2String(rs.getString("bckr"));
|
||||
if (Arrays.asList(ckr.split(",")).contains(uid)) {
|
||||
ids.addAll(Arrays.asList(bckr.split(",")));
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,String> mobileInfo = new HashMap<>();
|
||||
String value = StringUtils.join(ids,",");
|
||||
rs.executeQuery("select id,"+FIELDID+" from cus_fielddata where scope = ? and scopeid = ?" +
|
||||
" and id in ("+value+")",SCOPE,SCOPEID);
|
||||
while (rs.next()){
|
||||
mobileInfo.put(Utils.null2String(rs.getString("id")),rs.getString(FIELDID));
|
||||
}
|
||||
|
||||
data.put("ids",ids);
|
||||
data.put("mobileInfo",mobileInfo);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package com.engine.jygf.service;
|
||||
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public interface MobilePermissionsService {
|
||||
|
||||
Map<String, Object> getPermissionInfo(Map<String, Object> params, User user);
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package com.engine.jygf.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.jygf.cmd.MobilePermissionsCmd;
|
||||
import com.engine.jygf.service.MobilePermissionsService;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class MobilePermissionsServiceImpl extends Service implements MobilePermissionsService {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getPermissionInfo(Map<String, Object> params, User user) {
|
||||
return commandExecutor.execute(new MobilePermissionsCmd(params,user));
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
package com.engine.jygf.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.jygf.service.MobilePermissionsService;
|
||||
import com.engine.jygf.service.impl.MobilePermissionsServiceImpl;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class MobilePermissionsAction {
|
||||
|
||||
public MobilePermissionsService getMobilePermissionsService(User user) {
|
||||
return ServiceUtil.getService(MobilePermissionsServiceImpl.class,user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 晶优光伏 移动电话通过建模控制权限 通讯录显示
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/controller")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getPermissionInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
//实例化Service 并调用业务类处理
|
||||
apidatas = getMobilePermissionsService(user).getPermissionInfo(ParamUtil.request2Map(request), user);
|
||||
} catch (Exception e) {
|
||||
//异常处理
|
||||
apidatas.put("api_status", false);
|
||||
}
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.engine.kqsolution.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/5/22 3:05 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CustomSignDataParam {
|
||||
|
||||
private String departments;
|
||||
|
||||
private String month;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.engine.kqsolution.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/8/28 10:05 AM
|
||||
* @Description: 花名册快照
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HistoryResourcePO {
|
||||
|
||||
private Integer resourceId;
|
||||
|
||||
private String workcode;
|
||||
|
||||
private String lastName;
|
||||
|
||||
private String birthday;
|
||||
|
||||
private String sex;
|
||||
|
||||
private String subCompany;
|
||||
|
||||
private String department;
|
||||
|
||||
private String managerId;
|
||||
|
||||
private String companyStartDate;
|
||||
|
||||
private String createDate;
|
||||
|
||||
private String accumfundAccount;
|
||||
|
||||
private String accountId;
|
||||
|
||||
private String bankName;
|
||||
|
||||
private String firstEnrollmentDate;
|
||||
|
||||
private String startdate;
|
||||
|
||||
private String endDate;
|
||||
|
||||
private String jobTitle;
|
||||
|
||||
private String status;
|
||||
|
||||
private String educationlevel;
|
||||
|
||||
private String mobile;
|
||||
|
||||
private String certificatenum;
|
||||
|
||||
private String nativeplace;
|
||||
|
||||
private String regresidentplace;
|
||||
|
||||
private String changeDate;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.engine.kqsolution.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/9/11 9:45 AM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HrmStatusPO {
|
||||
|
||||
private Integer resourceId;
|
||||
|
||||
private String changeDate;
|
||||
|
||||
private Integer typeN;
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.engine.kqsolution.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/11/14 10:47 AM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class KqExceptionVo {
|
||||
|
||||
private Integer resourceId;
|
||||
|
||||
private String lastName;
|
||||
|
||||
private String wordcode;
|
||||
|
||||
private String subCompanyName;
|
||||
|
||||
private String departmentName;
|
||||
|
||||
private String jobTitleName;
|
||||
|
||||
private Integer belate;
|
||||
|
||||
private Integer gravebelate;
|
||||
|
||||
private Integer leaveeearly;
|
||||
|
||||
private Integer graveleaveearly;
|
||||
|
||||
private Integer absenteeism;
|
||||
|
||||
private Integer forgotcheck;
|
||||
|
||||
private String kqResult;
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.engine.kqsolution.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/9/18 2:22 PM
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SignDataPO {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String attendanceMonth;
|
||||
|
||||
private String attendanceDate;
|
||||
|
||||
private Integer resourceId;
|
||||
|
||||
private Integer company;
|
||||
|
||||
private Integer department;
|
||||
|
||||
private Integer jobTitle;
|
||||
|
||||
private String signInDate;
|
||||
|
||||
private String signInTime;
|
||||
|
||||
private String signOutDate;
|
||||
|
||||
private String signOutTime;
|
||||
|
||||
private String signMins;
|
||||
|
||||
private Double signHours;
|
||||
|
||||
private Double workHours;
|
||||
|
||||
private Integer status;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.engine.kqsolution.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import weaver.general.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/9/18 2:14 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SignDataParams {
|
||||
|
||||
private String attendanceDate;
|
||||
|
||||
private String formModeId;
|
||||
|
||||
private String ids;
|
||||
|
||||
public List<Integer> getIds() {
|
||||
if(StringUtil.isEmpty(ids)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return Arrays.stream(ids.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.engine.kqsolution.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/5/27 10:04 AM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WorkflowDetailVO {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String attendanceDate;
|
||||
|
||||
private Integer personId;
|
||||
|
||||
private String personName;
|
||||
|
||||
private Double workHours;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.engine.kqsolution.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/9/2 10:19 AM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface ProjectPriceService {
|
||||
|
||||
/**
|
||||
* @Description: 产线工价台账自定义同步
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/9/2 10:30 AM
|
||||
* @param: [params]
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
Map<String,Object> signData(Map<String, Object> params);
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 多次执行删除历史数据
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/9/3 10:22 AM
|
||||
* @param: [month, cx]
|
||||
* @return: void
|
||||
*/
|
||||
void deleteHData(String month,String cx);
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.engine.kqsolution.service;
|
||||
|
||||
import com.engine.kqsolution.entity.HistoryResourcePO;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/8/29 9:26 AM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface ResourceSnipService {
|
||||
|
||||
/**
|
||||
* @Description: 花名册快照
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/8/29 9:58 AM
|
||||
* @param: [monthDate, companyStartDate]
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
Map<String,Object> resourceSnip(String monthDate, String companyStartDate);
|
||||
|
||||
/**
|
||||
* 花名册快照导出
|
||||
* @param request
|
||||
* @param response
|
||||
* @param monthDate
|
||||
* @param companyStartDate
|
||||
* @return
|
||||
*/
|
||||
XSSFWorkbook snipshotExport(HttpServletRequest request, HttpServletResponse response, String monthDate, String companyStartDate);
|
||||
|
||||
/**
|
||||
* @Description: 人事花名册
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/9/10 5:35 PM
|
||||
* @param: [companyStartDate]
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
Map<String, List<HistoryResourcePO>> hrResource(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* @Description 人事花名册导出
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/9/11 3:18 PM
|
||||
* @param: [request, response, companyStartDate]
|
||||
* @return: org.apache.poi.xssf.usermodel.XSSFWorkbook
|
||||
*/
|
||||
XSSFWorkbook hrResourceExport(HttpServletRequest request, HttpServletResponse response, Map<String, Object> param);
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.engine.kqsolution.service;
|
||||
|
||||
import com.engine.kqsolution.entity.CustomSignDataParam;
|
||||
import com.engine.kqsolution.entity.KqExceptionVo;
|
||||
import com.engine.kqsolution.entity.SignDataParams;
|
||||
import com.engine.kqsolution.entity.WorkflowDetailVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/9/18 11:44 AM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface SignDataSummaryService {
|
||||
|
||||
/**
|
||||
* @Description: 建模表更新打卡数据
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2023/9/18 2:18 PM
|
||||
* @param: [signDataParams]
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
Map<String,Object> recordSignData(SignDataParams signDataParams);
|
||||
|
||||
/**
|
||||
* @Description: 考勤工时统计台账 自定义同步
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/5/22 3:25 PM
|
||||
* @param: [customSignDataParam]
|
||||
* @return: java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
Map<String,Object> customSignData(CustomSignDataParam customSignDataParam);
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 批量调整工时明细表带入
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/5/27 10:23 AM
|
||||
* @param: [ids]
|
||||
* @return: java.util.List<com.engine.kqsolution.entity.WorkflowDetailVO>
|
||||
*/
|
||||
List<WorkflowDetailVO> workflowDetail(String ids);
|
||||
|
||||
/**
|
||||
* @Description: 考勤异常报表
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/11/14 10:41 AM
|
||||
* @param: [request2Map]
|
||||
* @return: j
|
||||
*/
|
||||
Map<String, Object> kqExceptionReport(Map<String, Object> request2Map);
|
||||
}
|
@ -0,0 +1,707 @@
|
||||
package com.engine.kqsolution.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.kqsolution.service.ProjectPriceService;
|
||||
import com.weaver.general.BaseBean;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetDataSource;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.dfjc.entity.ProWagDetPO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/9/2 10:19 AM
|
||||
* @Description: 逻辑同步与之前开发人员代码 SyncDfjcUatBatch.jsp
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class ProjectPriceServiceImpl extends Service implements ProjectPriceService {
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> signData(Map<String, Object> params) {
|
||||
RecordSetDataSource rsds = new RecordSetDataSource();
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
String projectValue = Util.null2String(params.get("projectValue"));
|
||||
String fromdate = Util.null2String(params.get("fromdate"));
|
||||
String todate = Util.null2String(params.get("todate"));
|
||||
String month = Util.null2String(params.get("month"));
|
||||
String today = DateUtil.format(new Date(),"yyyy-MM-dd");
|
||||
|
||||
|
||||
try {
|
||||
|
||||
//根据条线筛选更新数据(台账按钮操作)
|
||||
List<String> lhidList = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(projectValue)) {
|
||||
//根据条线删除历史数据
|
||||
deleteHData(month,projectValue);
|
||||
rs.executeQuery("select lhid from uf_cpdjb where cx = ?",projectValue);
|
||||
while (rs.next()) {
|
||||
lhidList.add(Util.null2String(rs.getString("lhid")));
|
||||
}
|
||||
}
|
||||
|
||||
result.put("lhids",lhidList);
|
||||
|
||||
//计算出开始日期和结束日期之间的每个日期
|
||||
List<String> everyDate = getEveryDate(fromdate, todate);
|
||||
|
||||
for ( String syncdate : everyDate ) {
|
||||
|
||||
String nowYear = syncdate.substring(0,4);
|
||||
String nowMonth = syncdate.substring(0,7);
|
||||
|
||||
//获取基础数据
|
||||
List<Map<String, String>> baseDatasList = new ArrayList<>();
|
||||
Map<String, String> baseDataMap = new HashMap<>();
|
||||
|
||||
String acqBaseDatasSql = " SELECT a.id,a.docstate,a.HandleDept, a.item,a.ActualRcvTime,a.EligibleQty,b.BusinessType FROM MO_CompleteRpt a LEFT JOIN MO_CompleteRptDocType b ON a.CompleteDocType=b.ID WHERE b.BusinessType<>48 and CAST(ActualRcvTime AS DATE) = ? and DocState = 3";
|
||||
|
||||
if (CollectionUtils.isNotEmpty(lhidList)) {
|
||||
List<String> quotedList = lhidList.stream()
|
||||
.map(s -> "'" + s + "'")
|
||||
.collect(Collectors.toList());
|
||||
String str = String.join(",", quotedList);
|
||||
acqBaseDatasSql = acqBaseDatasSql + " and a.item in ("+str+")";
|
||||
}
|
||||
|
||||
rsds.executeQueryWithDatasource( acqBaseDatasSql, "u9", syncdate);
|
||||
while (rsds.next()) {
|
||||
String lhid = Util.null2String(rsds.getString("Item"));//料号id
|
||||
String rksl = Util.null2String(rsds.getString("EligibleQty"));//入库数量
|
||||
if ( StringUtils.isNotBlank(lhid) && StringUtils.isNotBlank(rksl)) {
|
||||
baseDataMap = new HashMap<>();
|
||||
baseDataMap.put("lhid",lhid);
|
||||
baseDataMap.put("rksl",rksl);
|
||||
baseDatasList.add(baseDataMap);
|
||||
}
|
||||
}
|
||||
|
||||
result.put("data",baseDatasList);
|
||||
|
||||
//获取产品单价台账
|
||||
Map<String, Map<String, String>> unitPricesMap = new HashMap<>();
|
||||
Map<String, String> unitPriceMap = new HashMap<>();
|
||||
String scqunitPriceSql = "select id, lhid, lh, lp, cx, xncx, rklbz1, dj, rklbz2, dj2, rklbz3, dj3 from uf_cpdjb ";
|
||||
rs.executeQuery( scqunitPriceSql);
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));//产品单价id
|
||||
String lhid = Util.null2String(rs.getString("lhid"));//料号id
|
||||
String lh = Util.null2String(rs.getString("lh"));//料号
|
||||
String lp = Util.null2String(rs.getString("lp"));//料品
|
||||
String cx = Util.null2String(rs.getString("cx"));//产线
|
||||
String xncx = Util.null2String(rs.getString("xncx"));//虚拟产线
|
||||
String rklbz1 = Util.null2String(rs.getString("rklbz1"));//入库量标准1
|
||||
String dj = Util.null2String(rs.getString("dj"));//单价1
|
||||
String rklbz2 = Util.null2String(rs.getString("rklbz2"));//入库量标准2
|
||||
String dj2 = Util.null2String(rs.getString("dj2"));//单价2
|
||||
String rklbz3 = Util.null2String(rs.getString("rklbz3"));//入库量标准3
|
||||
String dj3 = Util.null2String(rs.getString("dj3"));//单价3
|
||||
if ( StringUtils.isNotBlank(lhid) && StringUtils.isNotBlank(cx) && StringUtils.isNotBlank(lp) ) {
|
||||
unitPriceMap = new HashMap<>();
|
||||
unitPriceMap.put("id",id);
|
||||
unitPriceMap.put("lhid",lhid);
|
||||
unitPriceMap.put("lh",lh);
|
||||
unitPriceMap.put("lp",lp);
|
||||
unitPriceMap.put("cx",cx);
|
||||
unitPriceMap.put("xncx",xncx);
|
||||
unitPriceMap.put("rklbz1",rklbz1);
|
||||
unitPriceMap.put("dj",dj);
|
||||
unitPriceMap.put("rklbz2",rklbz2);
|
||||
unitPriceMap.put("dj2",dj2);
|
||||
unitPriceMap.put("rklbz3",rklbz3);
|
||||
unitPriceMap.put("dj3",dj3);
|
||||
unitPricesMap.put(lhid,unitPriceMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//获取料号和各单价的对应关系
|
||||
Map<String, Map<String, String>> lpToDjMap = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, Map<String, String>> entry : unitPricesMap.entrySet()) {
|
||||
String lp = entry.getValue().get("lp");
|
||||
String dj = entry.getValue().get("dj");
|
||||
String dj2 = entry.getValue().get("dj2");
|
||||
String dj3 = entry.getValue().get("dj3");
|
||||
|
||||
if (lpToDjMap.containsKey(lp)) {
|
||||
Map<String, String> djMap = lpToDjMap.get(lp);
|
||||
djMap.put("dj", dj);
|
||||
djMap.put("dj2", dj2);
|
||||
djMap.put("dj3", dj3);
|
||||
} else {
|
||||
Map<String, String> djMap = new HashMap<>();
|
||||
djMap.put("dj", dj);
|
||||
djMap.put("dj2", dj2);
|
||||
djMap.put("dj3", dj3);
|
||||
lpToDjMap.put(lp, djMap);
|
||||
}
|
||||
}
|
||||
|
||||
//获取虚拟产线和料品的对应关系
|
||||
Map<String, List<String>> xncxToLpMap = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, Map<String, String>> entry : unitPricesMap.entrySet()) {
|
||||
|
||||
String xncx = entry.getValue().get("xncx");
|
||||
String lp = entry.getValue().get("lp");
|
||||
|
||||
if (StringUtils.isNotBlank(xncx)) {
|
||||
if (xncxToLpMap.containsKey(xncx)) {
|
||||
List<String> lpList = xncxToLpMap.get(xncx);
|
||||
lpList.add(lp);
|
||||
} else {
|
||||
List<String> lpList = new ArrayList<>();
|
||||
lpList.add(lp);
|
||||
xncxToLpMap.put(xncx, lpList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//获取产线工价台账
|
||||
// String checkProSql = "select count(*) as number from uf_cxgj where cxmc = ? and scyf = ? ";
|
||||
|
||||
//产线工价主表
|
||||
String acqProMainSql = "select id from uf_cxgj where cxmc = ? and scyf = ?";
|
||||
String acqProMainByMonthSql = "select id from uf_cxgj where scyf = ?";
|
||||
|
||||
//产线工价明细表
|
||||
// String acqProDetSql = "select id, lh, lp, rkrq, cpdj, rkcl, rkje from uf_cxgj_dt1 where mainId = ?";
|
||||
String acqProDetBatSql = "select id, mainid, lh, lp, rkrq, cpdj, rkcl, rkje from uf_cxgj_dt1 where mainid in ";
|
||||
|
||||
//产线工价明细表插入
|
||||
String addProDetSql = "insert into uf_cxgj_dt1 ( mainid, lh, lp, rkrq, cpdj, rkcl, rkje ) values ( ?, ?, ?, ?, ?, ?, ? )";
|
||||
|
||||
//产线工价明细表修改
|
||||
String editProDetSql = "update uf_cxgj_dt1 set cpdj = ? ,rkje = ? where id = ? ";
|
||||
|
||||
//获取当前月份的产线工价数据
|
||||
List<ProWagDetPO> proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
|
||||
//根据料号id处理
|
||||
for ( Map<String,String> baseData:baseDatasList) {
|
||||
String lhid = baseData.get("lhid");//料号id
|
||||
String rksl = baseData.get("rksl");//入库数量
|
||||
Map<String, String> unitPriceTmpMap = unitPricesMap.get(lhid);
|
||||
|
||||
if ( unitPriceTmpMap == null || unitPriceTmpMap.isEmpty() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String id = unitPriceTmpMap.get("id");//产品单价id
|
||||
String lp = unitPriceTmpMap.get("lp");//料品
|
||||
String lh = unitPriceTmpMap.get("lh");//料号
|
||||
String cx = unitPriceTmpMap.get("cx");//产线
|
||||
String xncx = unitPriceTmpMap.get("xncx");//虚拟产线
|
||||
String rklbz1 = unitPriceTmpMap.get("rklbz1");//标准1
|
||||
String rklbz2 = unitPriceTmpMap.get("rklbz2");//标准2
|
||||
String rklbz3 = unitPriceTmpMap.get("rklbz3");//标准3
|
||||
String dj = unitPriceTmpMap.get("dj");//单价1
|
||||
String dj2 = unitPriceTmpMap.get("dj2");//单价2
|
||||
String dj3 = unitPriceTmpMap.get("dj3");//单价3
|
||||
|
||||
//是否阶梯单价
|
||||
boolean stepUnitPriceFlag = true;
|
||||
if ( StringUtils.isBlank(rklbz2) && StringUtils.isBlank(rklbz3)) {
|
||||
stepUnitPriceFlag = false;
|
||||
}
|
||||
|
||||
//是否虚拟产线
|
||||
boolean virProLineFlag = true;
|
||||
if ( StringUtils.isBlank(xncx)) {
|
||||
virProLineFlag = false;
|
||||
}
|
||||
|
||||
Integer mainId = -1;
|
||||
rs.executeQuery( acqProMainSql, cx, nowMonth);
|
||||
while (rs.next()) {
|
||||
mainId = Util.getIntValue( Util.null2String( rs.getString("id")));
|
||||
}
|
||||
|
||||
Integer tempMainId = -1;
|
||||
if ( mainId == -1) {//主表没有该产线的数据
|
||||
mainId = Util.getIntValue( addProMainData(cx, nowMonth, rs));
|
||||
if (cx.equals("13")) {
|
||||
tempMainId = mainId;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !stepUnitPriceFlag ) {//非阶梯单价--直接插入一行明细
|
||||
if ( tempMainId > 0 ) {
|
||||
|
||||
}
|
||||
|
||||
//计算入库金额
|
||||
BigDecimal depAmount = new BigDecimal(0);
|
||||
if ( StringUtils.isNotBlank(rksl) && StringUtils.isNotBlank(dj)) {
|
||||
BigDecimal depNum = new BigDecimal(rksl);
|
||||
BigDecimal uniPri = new BigDecimal(dj);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
rs.executeUpdate( addProDetSql, mainId, id, lp, syncdate, dj, rksl, depAmount);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
|
||||
} else {//阶梯单价
|
||||
//虚拟产线
|
||||
if ( !virProLineFlag ) {
|
||||
//非虚拟产线,找同料号的明细
|
||||
if ( proDetList.isEmpty()) {//明细表没有数据
|
||||
Double unPr= 0.0;
|
||||
if ( StringUtils.isBlank(dj2) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else {
|
||||
if ( Double.parseDouble(rksl) < Double.parseDouble(rklbz1) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else if ( (Double.parseDouble(rksl) >= Double.parseDouble(rklbz1)) && ( StringUtils.isNotBlank(rklbz2) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz2))) ) {
|
||||
unPr = Double.valueOf(dj2);
|
||||
} else if ( (Double.parseDouble(rksl) >= Double.parseDouble(rklbz2)) && (StringUtils.isNotBlank(rklbz3) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz3)))) {
|
||||
unPr = Double.valueOf(dj3);
|
||||
}
|
||||
}
|
||||
|
||||
//计算入库金额
|
||||
BigDecimal depAmount = new BigDecimal(0);
|
||||
if ( StringUtils.isNotBlank(rksl) && unPr > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(rksl);
|
||||
BigDecimal uniPri = new BigDecimal(unPr);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
rs.executeUpdate( addProDetSql, mainId, id, lp, syncdate, unPr, rksl, depAmount);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
|
||||
} else {
|
||||
String finalMainId = Util.null2String(mainId);
|
||||
List<ProWagDetPO> proWList = proDetList.stream()
|
||||
.filter(pro -> pro.getMainId().equals(finalMainId) )
|
||||
.collect(Collectors.toList());
|
||||
Double unPr= 0.0;
|
||||
List<String> rkcls = proWList.stream()
|
||||
.map(pro -> pro.getStorageNumber())
|
||||
.collect(Collectors.toList());
|
||||
Double rkclSum = rkcls.stream()
|
||||
.map(str -> Double.parseDouble(str))
|
||||
.reduce(0.0, Double::sum);
|
||||
|
||||
rkclSum = rkclSum + Double.parseDouble(rksl);
|
||||
|
||||
if ( StringUtils.isBlank(dj2) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else {
|
||||
if (rkclSum < Double.parseDouble(rklbz1)) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else if ((rkclSum >= Double.parseDouble(rklbz1)) && (StringUtils.isNotBlank(rklbz2) && (rkclSum < Double.parseDouble(rklbz2)))) {
|
||||
unPr = Double.valueOf(dj2);
|
||||
} else if ((rkclSum >= Double.parseDouble(rklbz2)) && (StringUtils.isNotBlank(rklbz3) && (rkclSum < Double.parseDouble(rklbz3)))) {
|
||||
unPr = Double.valueOf(dj3);
|
||||
}
|
||||
}
|
||||
//计算入库金额
|
||||
BigDecimal depAmount = new BigDecimal(0);
|
||||
if ( Double.parseDouble(rksl) > 0 && unPr > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(rksl);
|
||||
BigDecimal uniPri = new BigDecimal(unPr);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
rs.executeUpdate( addProDetSql, mainId, id, lp, syncdate, unPr, rksl, depAmount);
|
||||
//处理历史明细
|
||||
List<List> oldDetDatas = new ArrayList<>();
|
||||
List<String> detIds = proWList.stream()
|
||||
.map(pro -> pro.getId())
|
||||
.collect(Collectors.toList());
|
||||
Map<String, String> StoNumMap = proWList.stream()
|
||||
.filter(pro -> detIds.contains(pro.getId()))
|
||||
.collect(Collectors.toMap(
|
||||
ProWagDetPO::getId,
|
||||
ProWagDetPO::getStorageNumber
|
||||
));
|
||||
for (String detId : detIds) {
|
||||
Integer stoNum = Util.getIntValue(StoNumMap.get(detId));
|
||||
|
||||
//同产线的总量 rkclSum
|
||||
//获取该料品的入库数量标准和单价
|
||||
for (ProWagDetPO pro : proWList) {
|
||||
if (pro.getId().equals(detId)) {
|
||||
pro.getLhid();
|
||||
}
|
||||
}
|
||||
unitPriceTmpMap = unitPricesMap.get(lhid);
|
||||
|
||||
if ( unitPriceTmpMap == null || unitPriceTmpMap.isEmpty() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
id = unitPriceTmpMap.get("id");//产品单价id
|
||||
lp = unitPriceTmpMap.get("lp");//料品
|
||||
lh = unitPriceTmpMap.get("lh");//料号
|
||||
cx = unitPriceTmpMap.get("cx");//产线
|
||||
xncx = unitPriceTmpMap.get("xncx");//虚拟产线
|
||||
rklbz1 = unitPriceTmpMap.get("rklbz1");//标准1
|
||||
rklbz2 = unitPriceTmpMap.get("rklbz2");//标准2
|
||||
rklbz3 = unitPriceTmpMap.get("rklbz3");//标准3
|
||||
dj = unitPriceTmpMap.get("dj");//单价1
|
||||
dj2 = unitPriceTmpMap.get("dj2");//单价2
|
||||
dj3 = unitPriceTmpMap.get("dj3");//单价3
|
||||
|
||||
if ( StringUtils.isBlank(dj2) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else {
|
||||
if (rkclSum < Double.parseDouble(rklbz1)) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else if ((rkclSum >= Double.parseDouble(rklbz1)) && (StringUtils.isNotBlank(rklbz2) && (rkclSum < Double.parseDouble(rklbz2)))) {
|
||||
unPr = Double.valueOf(dj2);
|
||||
} else if ((rkclSum >= Double.parseDouble(rklbz2)) && (StringUtils.isNotBlank(rklbz3) && (rkclSum < Double.parseDouble(rklbz3)))) {
|
||||
unPr = Double.valueOf(dj3);
|
||||
}
|
||||
}
|
||||
|
||||
//计算入库金额
|
||||
depAmount = new BigDecimal(0);
|
||||
if ( stoNum > 0 && unPr > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(stoNum);
|
||||
BigDecimal uniPri = new BigDecimal(unPr);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
List tempList = new ArrayList<>();
|
||||
tempList.add(unPr);
|
||||
tempList.add(depAmount);
|
||||
tempList.add(detId);
|
||||
oldDetDatas.add(tempList);
|
||||
// }
|
||||
|
||||
rs.executeBatchSql( editProDetSql, oldDetDatas);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( proDetList.isEmpty()) {
|
||||
Double unPr= 0.0;
|
||||
if ( Double.parseDouble(rksl) < Double.parseDouble(rklbz1) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else if ( (Double.parseDouble(rksl) >= Double.parseDouble(rklbz1)) && ( StringUtils.isNotBlank(rklbz2) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz2))) ) {
|
||||
unPr = Double.valueOf(dj2);
|
||||
} else if ( (Double.parseDouble(rksl) >= Double.parseDouble(rklbz2)) && (StringUtils.isNotBlank(rklbz3) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz3)))) {
|
||||
unPr = Double.valueOf(dj3);
|
||||
}
|
||||
//计算入库金额
|
||||
BigDecimal depAmount = new BigDecimal(0);
|
||||
if ( StringUtils.isNotBlank(rksl) && unPr > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(rksl);
|
||||
BigDecimal uniPri = new BigDecimal(unPr);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
rs.executeUpdate( addProDetSql, mainId, id, lp, syncdate, unPr, rksl, depAmount);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
} else {
|
||||
String finalMainId = Util.null2String(mainId);
|
||||
List<String> lpTmpList = xncxToLpMap.get(xncx);
|
||||
List<ProWagDetPO> proWList = proDetList.stream()
|
||||
.filter(pro -> pro.getMainId().equals(finalMainId) && pro.getLp() != null && lpTmpList.contains(pro.getLp()))
|
||||
// .filter(pro -> pro.getMainId().equals(finalMainId))
|
||||
.collect(Collectors.toList());
|
||||
if ( proWList.isEmpty()) {//没有同虚拟产线的明细
|
||||
Double unPr= 0.0;
|
||||
if ( Double.parseDouble(rksl) < Double.parseDouble(rklbz1) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else if ( (Double.parseDouble(rksl) >= Double.parseDouble(rklbz1)) && ( StringUtils.isNotBlank(rklbz2) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz2))) ) {
|
||||
unPr = Double.valueOf(dj2);
|
||||
} else if ( (Double.parseDouble(rksl) >= Double.parseDouble(rklbz2)) && (StringUtils.isNotBlank(rklbz3) && (Double.parseDouble(rksl) < Double.parseDouble(rklbz3)))) {
|
||||
unPr = Double.valueOf(dj3);
|
||||
}
|
||||
//计算入库金额
|
||||
BigDecimal depAmount = new BigDecimal(0);
|
||||
if ( StringUtils.isNotBlank(rksl) && unPr > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(rksl);
|
||||
BigDecimal uniPri = new BigDecimal(unPr);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
rs.executeUpdate( addProDetSql, mainId, id, lp, syncdate, unPr, rksl, depAmount);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
|
||||
} else {//存在同虚拟产线
|
||||
Double unPr= 0.0;
|
||||
String stage = "dj";
|
||||
List<String> rkcls = proWList.stream()
|
||||
.map(pro -> pro.getStorageNumber())
|
||||
.collect(Collectors.toList());
|
||||
Double rkclSum = rkcls.stream()
|
||||
.map(str -> Double.parseDouble(str))
|
||||
.reduce(0.0, Double::sum);
|
||||
|
||||
rkclSum = rkclSum + Double.parseDouble(rksl);
|
||||
|
||||
if ( rkclSum < Double.parseDouble(rklbz1) ) {
|
||||
unPr = Double.valueOf(dj);
|
||||
} else if ( (rkclSum >= Double.parseDouble(rklbz1)) && ( StringUtils.isNotBlank(rklbz2) && (rkclSum < Double.parseDouble(rklbz2))) ) {
|
||||
unPr = Double.valueOf(dj2);
|
||||
stage = "dj2";
|
||||
} else if ( (rkclSum >= Double.parseDouble(rklbz2)) && (StringUtils.isNotBlank(rklbz3) && (rkclSum < Double.parseDouble(rklbz3)))) {
|
||||
unPr = Double.valueOf(dj3);
|
||||
stage = "dj3";
|
||||
}
|
||||
//计算入库金额
|
||||
BigDecimal depAmount = new BigDecimal(0);
|
||||
if ( Double.parseDouble(rksl) > 0 && unPr > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(rksl);
|
||||
BigDecimal uniPri = new BigDecimal(unPr);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
rs.executeUpdate( addProDetSql, mainId, id, lp, syncdate, unPr, rksl, depAmount);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
//处理历史明细
|
||||
List<List> oldDetDatas = new ArrayList<>();
|
||||
List<String> detIds = proWList.stream()
|
||||
.map(pro -> pro.getId())
|
||||
.collect(Collectors.toList());
|
||||
Map<String, Map<String, Object>> idToLpStoNumMap = proWList.stream()
|
||||
.filter(proWagDetPO -> detIds.contains(proWagDetPO.getId()))
|
||||
.collect(Collectors.toMap(
|
||||
proWagDetPO -> proWagDetPO.getId(),
|
||||
proWagDetPO -> {
|
||||
Map<String, Object> innerMap = new HashMap<>();
|
||||
innerMap.put("lp", proWagDetPO.getLp());
|
||||
innerMap.put("storageNumber", proWagDetPO.getStorageNumber());
|
||||
return innerMap;
|
||||
}
|
||||
));
|
||||
for (String detId : detIds) {
|
||||
Map<String, Object> innerMap = idToLpStoNumMap.get(detId);
|
||||
//计算入库金额
|
||||
depAmount = new BigDecimal(0);
|
||||
String lpTmp = Util.null2String(innerMap.get("lp"));
|
||||
Integer stoNumTmp = Util.getIntValue( Util.null2String(innerMap.get("storageNumber")));
|
||||
|
||||
// Map<String, String> djTmpMap = lpToDjMap.get(lpTmp);
|
||||
// Double unPrTmp = Util.getDoubleValue(djTmpMap.get(stage));
|
||||
|
||||
//获取该料品的入库数量标准和单价
|
||||
for (ProWagDetPO pro : proWList) {
|
||||
if (pro.getId().equals(detId)) {
|
||||
pro.getLhid();
|
||||
}
|
||||
}
|
||||
unitPriceTmpMap = unitPricesMap.get(lhid);
|
||||
|
||||
if ( unitPriceTmpMap == null || unitPriceTmpMap.isEmpty() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
id = unitPriceTmpMap.get("id");//产品单价id
|
||||
lp = unitPriceTmpMap.get("lp");//料品
|
||||
lh = unitPriceTmpMap.get("lh");//料号
|
||||
cx = unitPriceTmpMap.get("cx");//产线
|
||||
xncx = unitPriceTmpMap.get("xncx");//虚拟产线
|
||||
rklbz1 = unitPriceTmpMap.get("rklbz1");//标准1
|
||||
rklbz2 = unitPriceTmpMap.get("rklbz2");//标准2
|
||||
rklbz3 = unitPriceTmpMap.get("rklbz3");//标准3
|
||||
dj = unitPriceTmpMap.get("dj");//单价1
|
||||
dj2 = unitPriceTmpMap.get("dj2");//单价2
|
||||
dj3 = unitPriceTmpMap.get("dj3");//单价3
|
||||
|
||||
Double unPrTmp = 0.00;
|
||||
|
||||
if ( StringUtils.isBlank(dj2) ) {
|
||||
unPrTmp = Double.valueOf(dj);
|
||||
} else {
|
||||
if (rkclSum < Double.parseDouble(rklbz1)) {
|
||||
unPrTmp = Double.valueOf(dj);
|
||||
} else if ((rkclSum >= Double.parseDouble(rklbz1)) && (StringUtils.isNotBlank(rklbz2) && (rkclSum < Double.parseDouble(rklbz2)))) {
|
||||
unPrTmp = Double.valueOf(dj2);
|
||||
} else if ((rkclSum >= Double.parseDouble(rklbz2)) && (StringUtils.isNotBlank(rklbz3) && (rkclSum < Double.parseDouble(rklbz3)))) {
|
||||
unPrTmp = Double.valueOf(dj3);
|
||||
}
|
||||
}
|
||||
|
||||
if ( stoNumTmp > 0 && unPrTmp > 0 ) {
|
||||
BigDecimal depNum = new BigDecimal(stoNumTmp);
|
||||
BigDecimal uniPri = new BigDecimal(unPrTmp);
|
||||
depAmount = depNum.multiply(uniPri).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
List tempList = new ArrayList<>();
|
||||
tempList.add(unPrTmp);
|
||||
tempList.add(depAmount);
|
||||
tempList.add(detId);
|
||||
oldDetDatas.add(tempList);
|
||||
}
|
||||
|
||||
rs.executeBatchSql( editProDetSql, oldDetDatas);
|
||||
proDetList = getProDets(acqProMainByMonthSql, acqProDetBatSql, nowMonth, unitPricesMap, rs);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
List<String> mainidList = new ArrayList<>();
|
||||
rs.executeQuery( acqProMainByMonthSql, nowMonth);
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
mainidList.add(id);
|
||||
}
|
||||
}
|
||||
if ( !mainidList.isEmpty()) {
|
||||
String editProMainSql = "update uf_cxgj set lrrq = ? , cxzgj = (SELECT sum( rkje ) AS cxzgj FROM uf_cxgj_dt1 WHERE mainid = ?), rkzcl = (SELECT sum( rkcl ) AS rkzcl FROM uf_cxgj_dt1 WHERE mainid = ?) where id = ?";
|
||||
for (String mainid:mainidList) {
|
||||
rs.executeUpdate( editProMainSql, today, mainid, mainid, mainid);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteHData(String month, String cx) {
|
||||
RecordSet rs = new RecordSet();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("select id from uf_cxgj where scyf = ?");
|
||||
if (StringUtils.isNotEmpty(cx)) {
|
||||
sb.append(" and cxmc = ").append(cx);
|
||||
}
|
||||
rs.executeQuery(sb.toString(),month);
|
||||
List<String> ids = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
ids.add(Util.null2String(rs.getString("id")));
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
for (String id : ids) {
|
||||
rs.executeUpdate("delete from uf_cxgj whee scyf = ?",month);
|
||||
rs.executeUpdate("delete from uf_cxgj_dt1 where mainid = ?",id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getEveryDate(String fromDate, String toDate) {
|
||||
List<String> everyDate = new ArrayList<>();
|
||||
|
||||
// 创建一个格式化器
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
// 将字符串转换为 LocalDate 对象
|
||||
LocalDate startLocalDate = LocalDate.parse(fromDate, formatter);
|
||||
LocalDate endLocalDate = LocalDate.parse(toDate, formatter);
|
||||
|
||||
// 创建一个列表来存储日期
|
||||
List<LocalDate> dates = new ArrayList<>();
|
||||
|
||||
// 计算并添加所有日期
|
||||
for (LocalDate date = startLocalDate; date.isBefore(endLocalDate.plusDays(1)); date = date.plusDays(1)) {
|
||||
dates.add(date);
|
||||
}
|
||||
|
||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
for (LocalDate date : dates) {
|
||||
everyDate.add(date.format(df));
|
||||
}
|
||||
|
||||
return everyDate;
|
||||
}
|
||||
|
||||
public String addProMainData(String cx, String nowMonth, RecordSet rs){
|
||||
String result = "";
|
||||
String addProMainSql = "insert into uf_cxgj (lrr,lrrq,cxmc,scyf,formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime,modeuuid) " +
|
||||
" values (?,?,?,?,?,?,?,?,?,?)";
|
||||
String acqMainIdSql = "select id from uf_cxgj where modeuuid = ? ";
|
||||
|
||||
String formmodeid = "48";
|
||||
String nowDate = DateUtil.format(new Date(),"yyyy-MM-dd");
|
||||
String nowTime = DateUtil.format(new Date(),"HH:mm:ss");
|
||||
UUID uuid = UUID.randomUUID();
|
||||
String modeuuid = uuid.toString();
|
||||
boolean addFlag = rs.executeUpdate( addProMainSql, 1, nowDate, cx, nowMonth, formmodeid, 1, 0, nowDate, nowTime, modeuuid);
|
||||
if ( addFlag) {
|
||||
rs.executeQuery( acqMainIdSql, modeuuid);
|
||||
while ( rs.next()) {
|
||||
result = Util.null2String( rs.getString("id"));
|
||||
}
|
||||
}
|
||||
|
||||
//权限重构
|
||||
ModeRightInfo modeRightInfo = new ModeRightInfo();
|
||||
modeRightInfo.setNewRight(true);
|
||||
modeRightInfo.editModeDataShare( 1, Integer.parseInt(formmodeid), Integer.parseInt(result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ProWagDetPO> getProDets(String acqProMainByMonthSql, String acqProDetBatSql, String nowMonth, Map<String, Map<String, String>> unitPricesMap, RecordSet rs) {
|
||||
List<String> proMainList = new ArrayList<>();
|
||||
List<ProWagDetPO> proDetList = new ArrayList<>();
|
||||
try {
|
||||
rs.executeQuery(acqProMainByMonthSql, nowMonth);
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
proMainList.add(id);
|
||||
}
|
||||
}
|
||||
if (!proMainList.isEmpty()) {
|
||||
ProWagDetPO po = null;
|
||||
String sqlWhere = String.join(",", proMainList);
|
||||
acqProDetBatSql = acqProDetBatSql + "( " + sqlWhere + " )";
|
||||
rs.executeQuery(acqProDetBatSql);
|
||||
while (rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));//明细ID
|
||||
String mainid = Util.null2String(rs.getString("mainid"));
|
||||
String lhid = Util.null2String(rs.getString("lh"));
|
||||
String lp = Util.null2String(rs.getString("lp"));
|
||||
String rkrq = Util.null2String(rs.getString("rkrq"));
|
||||
String cpdj = Util.null2String(rs.getString("cpdj"));
|
||||
String rkcl = Util.null2String(rs.getString("rkcl"));//入库产量
|
||||
String rkje = Util.null2String(rs.getString("rkje"));
|
||||
if (StringUtils.isNotBlank(mainid) && StringUtils.isNotBlank(lhid)) {
|
||||
po = new ProWagDetPO();
|
||||
po.setId(id);
|
||||
po.setMainId(mainid);
|
||||
po.setLhid(lhid);
|
||||
po.setLp(lp);
|
||||
po.setStorageDate(rkrq);
|
||||
po.setUnitPrice(cpdj);
|
||||
po.setStorageNumber(rkcl);
|
||||
po.setStorageAmount(rkje);
|
||||
|
||||
Map<String, String> tmpMap = unitPricesMap.get(lhid);
|
||||
if (tmpMap != null && !tmpMap.isEmpty()) {
|
||||
String lh = tmpMap.get("lh");
|
||||
po.setLh(lh);
|
||||
}
|
||||
|
||||
proDetList.add(po);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return proDetList;
|
||||
}
|
||||
}
|
@ -0,0 +1,446 @@
|
||||
package com.engine.kqsolution.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cloudstore.eccom.constant.WeaBoolAttr;
|
||||
import com.cloudstore.eccom.pc.table.WeaTable;
|
||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.kq.biz.KQShiftManagementComInfo;
|
||||
import com.engine.kq.biz.KQWorkTime;
|
||||
import com.engine.kq.entity.WorkTimeEntity;
|
||||
import com.engine.kqsolution.entity.*;
|
||||
import com.engine.kqsolution.service.SignDataSummaryService;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.common.StringUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.PageIdConst;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/9/18 11:45 AM
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class SignDataSummaryServiceImpl extends Service implements SignDataSummaryService {
|
||||
|
||||
|
||||
|
||||
public static final DateTimeFormatter MONTH_FORMATTER_PATTERN = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
|
||||
@Override
|
||||
public Map<String, Object> recordSignData(SignDataParams signDataParams) {
|
||||
List<SignDataPO> list = buildSignData(signDataParams);
|
||||
return saveSignData(list,signDataParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> customSignData(CustomSignDataParam param) {
|
||||
|
||||
Map<String,Object> data = new HashMap<>(4);
|
||||
List<Integer> idList = new ArrayList<>();
|
||||
|
||||
//获取部门下人员id
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from hrmresource where departmentid in ("+param.getDepartments()+")");
|
||||
while (rs.next()) {
|
||||
idList.add(Util.getIntValue(rs.getString("id")));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(idList)){
|
||||
data.put("msg","部门下未存在人员");
|
||||
return data;
|
||||
}
|
||||
|
||||
LocalDate localDate = LocalDate.parse(param.getMonth()+"-01");
|
||||
String fromDate = localDate.toString();
|
||||
String toDate = localDate.withDayOfMonth(localDate.lengthOfMonth()).toString();
|
||||
String ids = StringUtils.join(idList,",");
|
||||
rs.executeQuery("select kqdate,resourceid,signindate,signintime,signoutdate,signouttime,signMins from kq_format_detail \n" +
|
||||
" where kqdate >= ? and kqdate <= ?" +
|
||||
" and resourceid in ("+ids+")",fromDate,toDate);
|
||||
List<SignDataPO> pos = new ArrayList<>();
|
||||
DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
||||
while (rs.next()) {
|
||||
String signInTime = Util.null2String(rs.getString("signintime"));
|
||||
String signOutTime = Util.null2String(rs.getString("signouttime"));
|
||||
if (!"".equals(signInTime)){
|
||||
signInTime = signInTime.substring(0,5);
|
||||
}
|
||||
if (!"".equals(signOutTime)){
|
||||
signOutTime = signOutTime.substring(0,5);
|
||||
}
|
||||
Integer signMins = Util.getIntValue(Util.null2String(rs.getString("signMins")),0);
|
||||
int resourceid = Util.getIntValue(rs.getString("resourceid"));
|
||||
String kqdate = Util.null2String(rs.getString("kqdate"));
|
||||
double hours = (double) signMins / 60;
|
||||
double workHours;
|
||||
if (hours <= 4.0) {
|
||||
workHours = hours;
|
||||
} else {
|
||||
workHours = Math.floor(hours);
|
||||
String kqRestTime = checkKqRestTime(String.valueOf(resourceid), kqdate);
|
||||
if ("1".equals(kqRestTime)) {
|
||||
workHours = Math.floor(hours - 1.0);
|
||||
}
|
||||
}
|
||||
SignDataPO build = SignDataPO.builder()
|
||||
.resourceId(resourceid)
|
||||
.attendanceDate(kqdate)
|
||||
.signInDate(Util.null2String(rs.getString("signindate")))
|
||||
.signInTime(signInTime)
|
||||
.signOutDate(Util.null2String(rs.getString("signoutdate")))
|
||||
.signOutTime(signOutTime)
|
||||
.signHours(Double.parseDouble(decimalFormat.format(hours)))
|
||||
.workHours(Double.parseDouble(decimalFormat.format(workHours)))
|
||||
.build();
|
||||
pos.add(build);
|
||||
}
|
||||
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
if (CollectionUtils.isNotEmpty(pos)) {
|
||||
try {
|
||||
rst.setAutoCommit(false);
|
||||
|
||||
for (SignDataPO item : pos) {
|
||||
rst.executeUpdate("update uf_kqgs set qdrq = ?,qdsj = ?,qtrq = ?,qtsj = ?,dkgssc = ?,sjgssc = ? where kqrq = ? and xm=? and zt = 0",item.getSignInDate(),
|
||||
item.getSignInTime(),item.getSignOutDate(),item.getSignOutTime(),item.getSignHours(),item.getWorkHours(),item.getAttendanceDate(),item.getResourceId());
|
||||
}
|
||||
|
||||
rst.commit();
|
||||
}catch (Exception e) {
|
||||
rst.rollback();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public List<WorkflowDetailVO> workflowDetail(String ids) {
|
||||
RecordSet rs = new RecordSet();
|
||||
List<WorkflowDetailVO> data = new ArrayList<>();
|
||||
ResourceComInfo comInfo = new ResourceComInfo();
|
||||
rs.executeQuery("select id,kqrq,xm,sjgssc from uf_kqgs where id in ("+ids+")");
|
||||
while (rs.next()) {
|
||||
String personName = comInfo.getLastname(Util.null2String(rs.getString("xm")));
|
||||
data.add(WorkflowDetailVO.builder()
|
||||
.id(Util.getIntValue(rs.getString("id")))
|
||||
.attendanceDate(Util.null2String(rs.getString("kqrq")))
|
||||
.personId(Util.getIntValue(rs.getString("xm")))
|
||||
.personName(personName)
|
||||
.workHours(Util.getDoubleValue(rs.getString("sjgssc")))
|
||||
.build());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> kqExceptionReport(Map<String, Object> params) {
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String, Object> resultMap = new HashMap<>(4);
|
||||
String date = Util.null2String(params.get("date"));
|
||||
String subCompanyId = Util.null2String(params.get("subCompanyId"));
|
||||
String departmentId = Util.null2String(params.get("departmentId"));
|
||||
String resourceId = Util.null2String(params.get("resourceId"));
|
||||
|
||||
String firstDay = firstDayOfMonth(date);
|
||||
String lastDay = lastDayOfMonth(date);
|
||||
|
||||
WeaTable table = new WeaTable();
|
||||
String pageId = "1f44e9bc-70e0-4f8b-abb5-fcd2ada5bd98";
|
||||
table.setPageID(pageId);
|
||||
table.setPageUID(String.format("%s_%s",pageId,user.getUID()));
|
||||
String pageSize = PageIdConst.getPageSize(pageId, user.getUID());
|
||||
table.setPagesize(pageSize);
|
||||
String fields = "a.resourceid,b.workcode,b.subcompanyid1,b.departmentid,b.jobtitle," +
|
||||
" CAST(ISNULL(SUM(belate), 0) AS VARCHAR) + '/' + \n" +
|
||||
" CAST(ISNULL(SUM(gravebelate), 0) AS VARCHAR) + '/' + \n" +
|
||||
" CAST(ISNULL(SUM(leaveeearly), 0) AS VARCHAR) + '/' + \n" +
|
||||
" CAST(ISNULL(SUM(graveleaveearly), 0) AS VARCHAR) + '/' + \n" +
|
||||
" CAST(ISNULL(SUM(absenteeism), 0) AS VARCHAR) + '/' + \n" +
|
||||
" CAST(ISNULL(SUM(forgotcheck), 0) AS VARCHAR) AS result\n ";
|
||||
table.setBackfields(fields);
|
||||
|
||||
String fromSql = " from kq_format_total a left join hrmresource b on a.resourceid = b.id";
|
||||
table.setSqlform(fromSql);
|
||||
String sqlWhere = " where kqdate >= '"+firstDay+"' and kqdate <= '"+lastDay+"' ";
|
||||
|
||||
if (StringUtils.isNotEmpty(subCompanyId)) {
|
||||
sqlWhere += " and b.subcompanyid1 in ("+subCompanyId+")";
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(departmentId)) {
|
||||
sqlWhere += " and b.departmentid in ("+departmentId+")";
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(resourceId)) {
|
||||
sqlWhere += " and a.resourceid in ("+resourceId+")";
|
||||
}
|
||||
|
||||
sqlWhere += " group by a.resourceid,b.workcode,b.subcompanyid1,b.departmentid,b.jobtitle";
|
||||
table.setSqlwhere(sqlWhere);
|
||||
table.setSqlprimarykey("a.resourceid");
|
||||
table.getColumns().add(new WeaTableColumn("10%", "姓名", "resourceid").setTransmethod("com.engine.kqsolution.util.ResourceSnipUtils.selectResourceName"));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "工号", "workcode"));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "分部", "subcompanyid1").setTransmethod("com.engine.kqsolution.util.ResourceSnipUtils.selectSubCompanyName"));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "部门", "departmentid").setTransmethod("com.engine.kqsolution.util.ResourceSnipUtils.selectDeptName"));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "岗位", "jobtitle").setTransmethod("com.engine.kqsolution.util.ResourceSnipUtils.selectJobName"));
|
||||
table.getColumns().add(new WeaTableColumn("10%", "考勤结果", "result").setTransmethod("com.engine.kqsolution.util.ResourceSnipUtils.selectKqResult"));
|
||||
table.setTableType(WeaTableType.NONE);
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
resultMap.putAll(result.getResultMap());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
private String firstDayOfMonth(String yearMonthStr) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
YearMonth yearMonth = YearMonth.parse(yearMonthStr, formatter);
|
||||
LocalDate firstDayOfMonth = yearMonth.atDay(1);
|
||||
return firstDayOfMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private String lastDayOfMonth(String yearMonthStr) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
YearMonth yearMonth = YearMonth.parse(yearMonthStr, formatter);
|
||||
LocalDate lastDayOfMonth = yearMonth.atEndOfMonth();
|
||||
return lastDayOfMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private Map<String, Object> saveSignData(List<SignDataPO> list,SignDataParams signDataParams){
|
||||
Map<String,Object> data = new HashMap<>(4);
|
||||
BaseBean bb = new BaseBean();
|
||||
DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
RecordSet rs = new RecordSet();
|
||||
ResourceComInfo rcom = new ResourceComInfo();
|
||||
int corePoolSize = 5;
|
||||
int maxPoolSize = 10;
|
||||
int batchSize = 200;
|
||||
List<List<SignDataPO>> splittedLists = splitList(list,batchSize);
|
||||
// 创建线程池
|
||||
ExecutorService executorService = ThreadUtil.newExecutor(corePoolSize, maxPoolSize);
|
||||
for (List<SignDataPO> subList : splittedLists) {
|
||||
executorService.submit(() -> {
|
||||
for (SignDataPO signDataPo : subList) {
|
||||
String resourceId = String.valueOf(signDataPo.getResourceId());
|
||||
Integer signMins = Util.getIntValue(signDataPo.getSignMins(),0);
|
||||
double hours = (double) signMins / 60;
|
||||
double workHours;
|
||||
if (hours <= 4.0) {
|
||||
workHours = hours;
|
||||
} else {
|
||||
workHours = Math.floor(hours);
|
||||
String kqRestTime = checkKqRestTime(resourceId, signDataPo.getAttendanceDate());
|
||||
if ("1".equals(kqRestTime)) {
|
||||
workHours = Math.floor(hours - 1.0);
|
||||
}
|
||||
}
|
||||
signDataPo.setCompany(Integer.parseInt(rcom.getSubCompanyID(resourceId)));
|
||||
signDataPo.setDepartment(Integer.parseInt(rcom.getDepartmentID(resourceId)));
|
||||
signDataPo.setJobTitle(Integer.parseInt(rcom.getJobTitle(resourceId)));
|
||||
signDataPo.setSignHours(Double.parseDouble(decimalFormat.format(hours)));
|
||||
signDataPo.setWorkHours(Double.parseDouble(decimalFormat.format(workHours)));
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
// 关闭线程池
|
||||
executorService.shutdown();
|
||||
while (!executorService.isTerminated()) {
|
||||
}
|
||||
try {
|
||||
rst.setAutoCommit(false);
|
||||
if (CollectionUtils.isNotEmpty(signDataParams.getIds())) {
|
||||
for (SignDataPO item : list) {
|
||||
rst.executeUpdate("update uf_kqgs set qdrq = ?,qdsj = ?,qtrq = ?,qtsj = ?,dkgssc = ?,sjgssc = ? where id = ? and zt = 0",item.getSignInDate(),
|
||||
item.getSignInTime(),item.getSignOutDate(),item.getSignOutTime(),item.getSignHours(),item.getWorkHours(),item.getId());
|
||||
}
|
||||
}else {
|
||||
|
||||
//同一考勤日期执行多次
|
||||
rst.executeUpdate("delete from uf_kqgs where kqrq = ? and zt = 0",signDataParams.getAttendanceDate());
|
||||
|
||||
|
||||
//获取锁定状态数据
|
||||
List<Integer> idList = new ArrayList<>();
|
||||
rs.executeQuery(" select xm from uf_kqgs where kqrq = ?",signDataParams.getAttendanceDate());
|
||||
while (rs.next()) {
|
||||
idList.add(Util.getIntValue(rs.getString("xm")));
|
||||
}
|
||||
|
||||
list = list.stream()
|
||||
.filter(p -> !idList.contains(p.getResourceId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
for (SignDataPO item : list) {
|
||||
rst.executeUpdate("insert into uf_kqgs(formmodeid,xm,kqy,kqrq,zt,fb,bm,gw,qdrq,qdsj,qtrq,qtsj,dkgssc,sjgssc) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)", signDataParams.getFormModeId(), item.getResourceId(),
|
||||
item.getAttendanceMonth(), item.getAttendanceDate(), item.getStatus(), item.getCompany(), item.getDepartment(),
|
||||
item.getJobTitle(), item.getSignInDate(), item.getSignInTime(), item.getSignOutDate(), item.getSignOutTime(),
|
||||
item.getSignHours(), item.getWorkHours());
|
||||
}
|
||||
}
|
||||
rst.commit();
|
||||
bb.writeLog("定时任务同步全部执行成功");
|
||||
|
||||
data.put("count",list.size());
|
||||
}catch (Exception e) {
|
||||
rst.rollback();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造数据
|
||||
* @param signDataParams
|
||||
* @return
|
||||
*/
|
||||
private List<SignDataPO> buildSignData(SignDataParams signDataParams) {
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
List<SignDataPO> pos = new ArrayList<>();
|
||||
String formatYearMonth = getFormatLocalDate(LocalDate.now(),MONTH_FORMATTER_PATTERN);
|
||||
if (StringUtils.isNotEmpty(signDataParams.getAttendanceDate())) {
|
||||
formatYearMonth = signDataParams.getAttendanceDate().substring(0,7);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(signDataParams.getIds())) {
|
||||
String ids = StringUtils.join(signDataParams.getIds(),",");
|
||||
rs.executeQuery("select u.id,u.xm,u.kqrq,u.kqy,k.signindate,k.signintime,k.signoutdate,k.signouttime,k.signMins from uf_kqgs u inner join kq_format_detail k" +
|
||||
" on u.xm = k.resourceid and u.kqrq = k.kqdate and u.zt = 0 and u.id in ("+ids+")");
|
||||
while (rs.next()) {
|
||||
String signInTime = Util.null2String(rs.getString("signintime"));
|
||||
String signOutTime = Util.null2String(rs.getString("signouttime"));
|
||||
if (!"".equals(signInTime)){
|
||||
signInTime = signInTime.substring(0,5);
|
||||
}
|
||||
if (!"".equals(signOutTime)){
|
||||
signOutTime = signOutTime.substring(0,5);
|
||||
}
|
||||
SignDataPO build = SignDataPO.builder()
|
||||
.id(Util.getIntValue(rs.getString("id")))
|
||||
.resourceId(Util.getIntValue(rs.getString("xm")))
|
||||
.attendanceMonth(Util.null2String(rs.getString("kqy")))
|
||||
.attendanceDate(Util.null2String(rs.getString("kqrq")))
|
||||
.signInDate(Util.null2String(rs.getString("signindate")))
|
||||
.signInTime(signInTime)
|
||||
.signOutDate(Util.null2String(rs.getString("signoutdate")))
|
||||
.signOutTime(signOutTime)
|
||||
.signMins(Util.null2String(rs.getString("signMins")))
|
||||
.build();
|
||||
pos.add(build);
|
||||
}
|
||||
|
||||
}else {
|
||||
rs.executeQuery("select resourceid,kqdate,signindate,signintime,signoutdate,signouttime,signMins from kq_format_detail where kqdate = ?",signDataParams.getAttendanceDate());
|
||||
while (rs.next()) {
|
||||
String signInTime = Util.null2String(rs.getString("signintime"));
|
||||
String signOutTime = Util.null2String(rs.getString("signouttime"));
|
||||
if (!"".equals(signInTime)){
|
||||
signInTime = signInTime.substring(0,5);
|
||||
}
|
||||
if (!"".equals(signOutTime)){
|
||||
signOutTime = signOutTime.substring(0,5);
|
||||
}
|
||||
SignDataPO build = SignDataPO.builder()
|
||||
.resourceId(Util.getIntValue(rs.getString("resourceid")))
|
||||
.attendanceMonth(formatYearMonth)
|
||||
.attendanceDate(Util.null2String(rs.getString("kqdate")))
|
||||
.status(0)
|
||||
.signInDate(Util.null2String(rs.getString("signindate")))
|
||||
.signInTime(signInTime)
|
||||
.signOutDate(Util.null2String(rs.getString("signoutdate")))
|
||||
.signOutTime(signOutTime)
|
||||
.signMins(Util.null2String(rs.getString("signMins")))
|
||||
.build();
|
||||
bb.writeLog("同步数据详情"+ JSON.toJSONString(build));
|
||||
pos.add(build);
|
||||
}
|
||||
}
|
||||
|
||||
//日志
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||
String formattedDateTime = now.format(formatter);
|
||||
bb.writeLog("打卡数据同步执行时间:"+formattedDateTime+"==数据size:"+ pos.size());
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 集合分割
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2023/9/13 2:46 PM
|
||||
* @param: [list, batchSize]
|
||||
* @return: java.util.List<java.util.List<T>>
|
||||
*/
|
||||
private <T> List<List<T>> splitList(List<T> list, int batchSize) {
|
||||
List<List<T>> splittedLists = new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i += batchSize) {
|
||||
int endIndex = Math.min(i + batchSize, list.size());
|
||||
List<T> subList = list.subList(i, endIndex);
|
||||
splittedLists.add(subList);
|
||||
}
|
||||
return splittedLists;
|
||||
}
|
||||
|
||||
private String checkKqRestTime(String id,String gzrq) {
|
||||
KQWorkTime kqWorkTime = new KQWorkTime();
|
||||
WorkTimeEntity workTimeEntity = kqWorkTime.getWorkTime(id, gzrq);
|
||||
String serialId = workTimeEntity.getSerialId();
|
||||
if (StringUtils.isBlank(serialId) || "-1".equals(serialId)) {
|
||||
kqWorkTime.setIsFormat(true);
|
||||
workTimeEntity = kqWorkTime.getWorkTime(id, gzrq);
|
||||
serialId = workTimeEntity.getSerialId();
|
||||
}
|
||||
|
||||
KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
|
||||
return kqShiftManagementComInfo.getIsresttimeopen(serialId);
|
||||
|
||||
}
|
||||
|
||||
public String getFormatLocalDate(LocalDate localDate,DateTimeFormatter type) {
|
||||
if (localDate == null) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
try {
|
||||
return localDate.format(type);
|
||||
} catch (Exception e) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.engine.kqsolution.util;
|
||||
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.xssf.usermodel.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ExcelUtil {
|
||||
|
||||
|
||||
public static XSSFWorkbook genWorkbookV2(List<List<Object>> rowList, String sheetName) {
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
|
||||
// 设置title样式
|
||||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREEN.getIndex());//背景色
|
||||
titleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
|
||||
|
||||
// 设置主体样式
|
||||
XSSFCellStyle cellStyle = workbook.createCellStyle();
|
||||
XSSFFont font = workbook.createFont();
|
||||
font.setFontName("宋体");
|
||||
font.setFontHeightInPoints((short) 10);// 设置字体大小
|
||||
cellStyle.setFont(font);// 选择需要用到的字体格式
|
||||
cellStyle.setWrapText(true);
|
||||
|
||||
XSSFSheet sheet = workbook.createSheet(sheetName);
|
||||
//自适应宽度
|
||||
sheet.autoSizeColumn(0, true);
|
||||
//默认列宽
|
||||
sheet.setDefaultColumnWidth(25);
|
||||
//默认行高
|
||||
sheet.setDefaultRowHeightInPoints(18);
|
||||
|
||||
for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) {
|
||||
List<Object> infoList = rowList.get(rowIndex);
|
||||
XSSFRow row = sheet.createRow(rowIndex);
|
||||
for (int cellIndex = 0; cellIndex < infoList.size(); cellIndex++) {
|
||||
XSSFCell cell = row.createCell(cellIndex);
|
||||
if (rowIndex == 0) {
|
||||
cell.setCellStyle(titleCellStyle);
|
||||
} else {
|
||||
cell.setCellStyle(cellStyle);
|
||||
}
|
||||
Object o = infoList.get(cellIndex);
|
||||
if (o instanceof String) {
|
||||
cell.setCellType(CellType.STRING);
|
||||
cell.setCellValue(String.valueOf(o));
|
||||
} else if (o instanceof Boolean) {
|
||||
cell.setCellType(CellType.BOOLEAN);
|
||||
cell.setCellValue(String.valueOf(o));
|
||||
} else {
|
||||
cell.setCellType(CellType.STRING);
|
||||
cell.setCellValue(o == null ? "" : o.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
return workbook;
|
||||
}
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
package com.engine.kqsolution.util;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.EducationLevelComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/8/28 2:35 PM
|
||||
* @Description: 人员数据类型转换工具
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class ResourceSnipUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 分部
|
||||
* @param subcompanyid
|
||||
* @return
|
||||
*/
|
||||
public static String selectSubCompanyName(String subcompanyid) {
|
||||
SubCompanyComInfo sub = new SubCompanyComInfo();
|
||||
return sub.getSubCompanyname(subcompanyid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门
|
||||
* @param departmentId
|
||||
* @return
|
||||
*/
|
||||
public static String selectDeptName(String departmentId) {
|
||||
DepartmentComInfo dept = new DepartmentComInfo();
|
||||
try {
|
||||
return dept.getDepartmentName(departmentId);
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位
|
||||
* @param jobId
|
||||
* @return
|
||||
*/
|
||||
public static String selectJobName(String jobId) {
|
||||
JobTitlesComInfo jc = new JobTitlesComInfo();
|
||||
return jc.getJobTitlesname(jobId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员
|
||||
* @param resourceId
|
||||
* @return
|
||||
*/
|
||||
public static String selectResourceName(String resourceId) {
|
||||
try {
|
||||
ResourceComInfo rc = new ResourceComInfo();
|
||||
return rc.getLastname(resourceId);
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 性别
|
||||
* @param sex
|
||||
* @return
|
||||
*/
|
||||
public static String selectSexName(String sex) {
|
||||
return "0".equals(sex) ? "男" : "女";
|
||||
}
|
||||
|
||||
/**
|
||||
* 考勤结果
|
||||
* @return
|
||||
*/
|
||||
public static String selectKqResult(String value) {
|
||||
boolean flag = Arrays.stream(value.split("/"))
|
||||
.mapToInt(Integer::parseInt)
|
||||
.anyMatch(n -> n > 0);
|
||||
return flag ? "异常" :"正常";
|
||||
}
|
||||
|
||||
/**
|
||||
* 工资银行
|
||||
* @param fieldId
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static String selectBankName(String value,String fieldId){
|
||||
RecordSet rs = new RecordSet();
|
||||
String id = fieldId.substring(Math.min(5, fieldId.length()));
|
||||
rs.executeQuery("select selectname from cus_selectitem where fieldid = ? and selectvalue = ?",id,value);
|
||||
rs.next();
|
||||
return Util.null2String(rs.getString("selectname"));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
public static String selectStatusName(String status) {
|
||||
switch (status) {
|
||||
case "0":
|
||||
return "试用";
|
||||
case "1":
|
||||
return "正式";
|
||||
case "2":
|
||||
return "临时";
|
||||
case "3":
|
||||
return "试用延期";
|
||||
case "4":
|
||||
return "解聘";
|
||||
case "5":
|
||||
return "离职";
|
||||
case "6":
|
||||
return "退休";
|
||||
case "7":
|
||||
return "无效";
|
||||
default :
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 学历
|
||||
* @param educLevel
|
||||
* @return
|
||||
*/
|
||||
public static String selectEducName(String educLevel){
|
||||
EducationLevelComInfo educ = new EducationLevelComInfo();
|
||||
return educ.getEducationLevelname(educLevel);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.engine.kqsolution.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.kqsolution.service.ProjectPriceService;
|
||||
import com.engine.kqsolution.service.impl.ProjectPriceServiceImpl;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/9/2 10:18 AM
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class ProjectPriceAction {
|
||||
|
||||
private ProjectPriceService getService(User user) {
|
||||
return ServiceUtil.getService(ProjectPriceServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/sign")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String customSignData(@Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
Map<String, Object> data = new HashMap<>(8);
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
data.putAll(getService(user).signData(map));
|
||||
data.put("status", true);
|
||||
} catch (Exception e) {
|
||||
data.put("status", false);
|
||||
data.put("msg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
package com.engine.kqsolution.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.kqsolution.service.ResourceSnipService;
|
||||
import com.engine.kqsolution.service.impl.ResourceSnipServiceImpl;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.StreamingOutput;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/8/29 9:22 AM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class ResourceSnipAction {
|
||||
|
||||
private ResourceSnipService getService(User user) {
|
||||
return ServiceUtil.getService(ResourceSnipServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/snipshot")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String resourceSnip(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@QueryParam("monthDate") String monthDate,@QueryParam("companyStartDate") String companyStartDate){
|
||||
Map<String, Object> data = new HashMap<>(8);
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
data.put("datas",getService(user).resourceSnip(monthDate,companyStartDate));
|
||||
data.put("api_status", true);
|
||||
} catch (Exception e) {
|
||||
data.put("api_status", false);
|
||||
data.put("msg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/snipshot/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response snipshotExport(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@QueryParam("monthDate") String monthDate,@QueryParam("companyStartDate") String companyStartDate) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getService(user).snipshotExport(request, response, monthDate,companyStartDate);
|
||||
String fileName = "花名册快照" + monthDate;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/hrResource")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String hrResource(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@QueryParam("companyStartDate") String companyStartDate){
|
||||
Map<String, Object> data = new HashMap<>(8);
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> param = ParamUtil.request2Map(request);
|
||||
data.put("datas",getService(user).hrResource(param));
|
||||
data.put("api_status", true);
|
||||
} catch (Exception e) {
|
||||
data.put("api_status", false);
|
||||
data.put("msg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/hrResource/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response hrResourceExport(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@QueryParam("companyStartDate") String companyStartDate) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> param = ParamUtil.request2Map(request);
|
||||
XSSFWorkbook workbook = getService(user).hrResourceExport(request, response, param);
|
||||
String fileName = "人事花名册";
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package com.engine.kqsolution.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.kqsolution.entity.CustomSignDataParam;
|
||||
import com.engine.kqsolution.entity.SignDataParams;
|
||||
import com.engine.kqsolution.service.SignDataSummaryService;
|
||||
import com.engine.kqsolution.service.impl.SignDataSummaryServiceImpl;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/9/18 11:43 AM
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class SignDataSummaryAction {
|
||||
|
||||
private SignDataSummaryService getService(User user) {
|
||||
return ServiceUtil.getService(SignDataSummaryServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/recordSignData")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String recordSignData(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody SignDataParams signDataParams){
|
||||
Map<String, Object> data = new HashMap<>(8);
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
data.putAll(getService(user).recordSignData(signDataParams));
|
||||
data.put("status", true);
|
||||
} catch (Exception e) {
|
||||
data.put("status", false);
|
||||
data.put("msg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/customSignData")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String customSignData(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody CustomSignDataParam customSignDataParam){
|
||||
Map<String, Object> data = new HashMap<>(8);
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
data.putAll(getService(user).customSignData(customSignDataParam));
|
||||
data.put("status", true);
|
||||
} catch (Exception e) {
|
||||
data.put("status", false);
|
||||
data.put("msg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/workflowDetail")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String workflowDetail(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("ids") String ids){
|
||||
Map<String, Object> data = new HashMap<>(8);
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
data.put("datas",getService(user).workflowDetail(ids));
|
||||
data.put("status", true);
|
||||
} catch (Exception e) {
|
||||
data.put("status", false);
|
||||
data.put("msg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/kqExceptionReport")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String kqExceptionReport(@Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
Map<String, Object> data = new HashMap<>(8);
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
data.put("datas",getService(user).kqExceptionReport(ParamUtil.request2Map(request)));
|
||||
data.put("api_status", true);
|
||||
} catch (Exception e) {
|
||||
data.put("api_status", false);
|
||||
data.put("msg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package weaver.interfaces.dfjc.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class KqMonthDataPO {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String attendanceMonth;
|
||||
|
||||
private String status;
|
||||
|
||||
private String resourceId;
|
||||
|
||||
private String departmentId;
|
||||
|
||||
private String jobTitle;
|
||||
|
||||
private Double psjbbdx;
|
||||
|
||||
private Double xxrjbbdx;
|
||||
|
||||
private Double jjrjbbdx;
|
||||
|
||||
private Double dkzgs;
|
||||
|
||||
private Double zgs;
|
||||
|
||||
private Double ccxs;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package weaver.interfaces.dfjc.entity;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProWagDetPO {
|
||||
|
||||
private String mainId;
|
||||
private String id;
|
||||
private String lhid;
|
||||
private String lh;
|
||||
private String lp;
|
||||
private String unitPrice;
|
||||
private String storageDate;
|
||||
private String storageNumber;
|
||||
private String storageAmount;
|
||||
}
|
@ -0,0 +1,237 @@
|
||||
package weaver.interfaces.dfjc.job;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kq.biz.KQReportBiz;
|
||||
import com.engine.kq.util.KQDurationCalculatorUtil;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.dfjc.entity.KqMonthDataPO;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author wanxq
|
||||
* @date 2024年01月17日09:53:08
|
||||
* @desc 同步考勤报表的数据到建模
|
||||
*/
|
||||
public class KqMonthReportSynJob extends BaseCronJob {
|
||||
|
||||
private BaseBean log = new BaseBean();
|
||||
|
||||
private String synType;
|
||||
|
||||
public String getSynType() {
|
||||
return synType;
|
||||
}
|
||||
|
||||
public void setSynType(String synType) {
|
||||
this.synType = synType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
String fromDate = TimeUtil.getLastMonthBeginDay();
|
||||
String toDate = TimeUtil.getLastMonthEndDay();
|
||||
|
||||
if("1".equals(synType)){
|
||||
fromDate = DateUtil.getFirstDayOfMonthToString();
|
||||
toDate = DateUtil.getLastDayOfMonthToString();
|
||||
}
|
||||
|
||||
|
||||
String currentMonth = fromDate.substring(0,7);
|
||||
|
||||
Map<String,Object> flowData = getKqOvertimeData(fromDate,toDate);
|
||||
Map<String,Object> signData = getSignData(fromDate,toDate);
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = " select a.id,a.departmentid,a.jobtitle,a.status from hrmresource a,kq_format_total b " +
|
||||
" where a.id= b.resourceid and b.kqdate >=? and b.kqdate <=? " +
|
||||
" and a.subcompanyid1 =6 " +
|
||||
" group by a.id,a.departmentid,a.jobtitle,a.status ";
|
||||
rs.executeQuery(sql,fromDate,toDate);
|
||||
|
||||
while(rs.next()){
|
||||
String userid = Util.null2String(rs.getString("id"));
|
||||
String departmentid = Util.null2String(rs.getString("departmentid"));
|
||||
String jobtitle = Util.null2String(rs.getString("jobtitle"));
|
||||
String status = Util.null2String(rs.getString("status"));
|
||||
|
||||
|
||||
double psjbbdx = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(userid+"|workingDayOvertime_nonleave"))),0);
|
||||
double xxrjbbdx = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(userid+"|restDayOvertime_nonleave"))),0);
|
||||
double jjrjbbdx = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(userid+"|holidayOvertime_nonleave"))),0);
|
||||
double dkzgs = Util.getDoubleValue(Util.null2String(signData.get(userid)),0);
|
||||
|
||||
//获取出差时长
|
||||
double ccxs = Util.getDoubleValue(KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(userid+"|businessLeave"))),0);
|
||||
|
||||
double zgs = psjbbdx+xxrjbbdx+jjrjbbdx+dkzgs+ccxs;
|
||||
|
||||
KqMonthDataPO kqMonthDataPO = KqMonthDataPO.builder()
|
||||
.resourceId(userid)
|
||||
.status(status)
|
||||
.departmentId(departmentid)
|
||||
.jobTitle(jobtitle)
|
||||
.psjbbdx(psjbbdx)
|
||||
.xxrjbbdx(xxrjbbdx)
|
||||
.jjrjbbdx(jjrjbbdx)
|
||||
.dkzgs(dkzgs)
|
||||
.zgs(zgs)
|
||||
.ccxs(ccxs)
|
||||
.build();
|
||||
|
||||
log.writeLog("KqMonthReportSynJob==>"+JSON.toJSONString(kqMonthDataPO));
|
||||
saveData(kqMonthDataPO,currentMonth);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取加班数据
|
||||
* @param fromDate
|
||||
* @param toDate
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> getKqOvertimeData(String fromDate,String toDate){
|
||||
User user = User.getUser(1,0);
|
||||
Map<String,Object> params = new HashMap<>();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
jsonObject.put("isNoAccount","1");
|
||||
jsonObject.put("attendanceSerial","");
|
||||
jsonObject.put("status","9");
|
||||
jsonObject.put("viewScope","0");
|
||||
jsonObject.put("typeselect","6");
|
||||
jsonObject.put("fromDate",fromDate);
|
||||
jsonObject.put("toDate",toDate);
|
||||
params.put("data",jsonObject);
|
||||
|
||||
|
||||
KQReportBiz kqReportBiz = new KQReportBiz();
|
||||
Map<String,Object> flowData = kqReportBiz.getFlowData(params,user);
|
||||
return flowData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实际打卡时长
|
||||
* @param fromDate
|
||||
* @param toDate
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> getSignData(String fromDate,String toDate){
|
||||
Map<String,Object> signData = new HashMap<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = " select xm,sum(sjgssc) workhours from uf_kqgs where kqrq>=? and kqrq<=? and fb=6 group by xm ";
|
||||
rs.executeQuery(sql,fromDate,toDate);
|
||||
while (rs.next()){
|
||||
String xm = Util.null2String(rs.getString("xm"));
|
||||
String workhours = Util.null2String(rs.getString("workhours"));
|
||||
signData.put(xm,workhours);
|
||||
}
|
||||
return signData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步数据到建模表
|
||||
* @param kqMonthDataPO
|
||||
* @param month
|
||||
*/
|
||||
public void saveData(KqMonthDataPO kqMonthDataPO,String month){
|
||||
RecordSet rs = new RecordSet();
|
||||
int formmodeid = getModeIdByTableName("uf_ydgs");
|
||||
int modedatacreater = 1;
|
||||
|
||||
String xm = kqMonthDataPO.getResourceId();
|
||||
String zt = kqMonthDataPO.getStatus();
|
||||
String bm = kqMonthDataPO.getDepartmentId();
|
||||
String gw = kqMonthDataPO.getJobTitle();
|
||||
Double dkzgs = kqMonthDataPO.getDkzgs();
|
||||
Double psjbbdx = kqMonthDataPO.getPsjbbdx();
|
||||
Double xxrjbbdx = kqMonthDataPO.getXxrjbbdx();
|
||||
Double jjrjbbdx = kqMonthDataPO.getJjrjbbdx();
|
||||
Double zgs = kqMonthDataPO.getZgs();
|
||||
Double ccxs = kqMonthDataPO.getCcxs();
|
||||
|
||||
|
||||
|
||||
boolean exist = isExist(month,kqMonthDataPO.getResourceId());
|
||||
if(exist){
|
||||
//更新
|
||||
String updateSql = " update uf_ydgs set dkzgs=?, psjbbdx=?, xxrjbbdx=?, jjrjbbdx=?, zgs=?, zt=?, ccxs=? where xm=? and kqy=? ";
|
||||
rs.executeUpdate(updateSql,new Object[]{dkzgs,psjbbdx,xxrjbbdx,jjrjbbdx,zgs,zt,ccxs,xm,month});
|
||||
|
||||
}else{
|
||||
//插入
|
||||
String modeuuid = UUID.randomUUID().toString();
|
||||
String modedatacreatedate = TimeUtil.getCurrentDateString();
|
||||
String modedatacreatetime = TimeUtil.getOnlyCurrentTimeString();
|
||||
|
||||
String insertSql = " insert into uf_ydgs(xm,bm,gw,kqy,dkzgs,psjbbdx,xxrjbbdx,jjrjbbdx,zgs,zt,ccxs,"+
|
||||
"formmodeid,modedatacreater,modedatacreatedate,modedatacreatetime,modeuuid) " +
|
||||
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
|
||||
rs.executeUpdate(insertSql,new Object[]{xm,bm,gw,month,dkzgs,psjbbdx,xxrjbbdx,jjrjbbdx,zgs,zt,ccxs,
|
||||
formmodeid,modedatacreater,modedatacreatedate,modedatacreatetime,modeuuid});
|
||||
|
||||
rs.executeQuery("select id from uf_ydgs where modeuuid=?",modeuuid);
|
||||
rs.next();
|
||||
int id = rs.getInt("id");
|
||||
if(id>0){
|
||||
ModeRightInfo right = new ModeRightInfo();
|
||||
right.editModeDataShare(1, formmodeid, id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断数据是否存在
|
||||
* @param month
|
||||
* @param userid
|
||||
* @return
|
||||
*/
|
||||
public boolean isExist(String month,String userid){
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = " select 1 from uf_ydgs where kqy=? and xm=? ";
|
||||
rs.executeQuery(sql,month,userid);
|
||||
return rs.next();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据建模表名获取建模id,建模权限同步的使用
|
||||
* @param tableName 建模表名
|
||||
* @return int 建模id
|
||||
*/
|
||||
public static int getModeIdByTableName(String tableName){
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = " select a.id from modeinfo a,workflow_bill b where a.formid=b.id and b.tablename =? ";
|
||||
rs.executeQuery(sql, tableName);
|
||||
if (rs.next()) {
|
||||
return rs.getInt("id");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package weaver.interfaces.hostar.action;
|
||||
|
||||
import com.engine.kq.biz.KQFormatBiz;
|
||||
import com.engine.kq.wfset.util.SplitActionUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class OutSignSyncAction implements Action {
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
bb.writeLog("OutSignSyncAction-start");
|
||||
String startDate = "";
|
||||
String endDate = "";
|
||||
String resourceid = "";
|
||||
String nbtxr = "";
|
||||
String sjjsrq = "";
|
||||
|
||||
try {
|
||||
|
||||
Property[] properties = requestInfo.getMainTableInfo().getProperty();
|
||||
for (Property property : properties) {
|
||||
if ("ksrq".equals(property.getName())) {
|
||||
startDate = Util.null2String(property.getValue());
|
||||
}
|
||||
if ("yjjsrq".equals(property.getName())) {
|
||||
endDate = Util.null2String(property.getValue());
|
||||
}
|
||||
if ("sjccr".equals(property.getName())) {
|
||||
resourceid = Util.null2String(property.getValue());
|
||||
}
|
||||
if ("nbtxr".equals(property.getName())) {
|
||||
nbtxr = Util.null2String(property.getValue());
|
||||
}
|
||||
if ("sjjsrq".equals(property.getName())) {
|
||||
sjjsrq = Util.null2String(property.getValue());
|
||||
}
|
||||
}
|
||||
// 如果实际结束日期不为空,则用实际结束日期
|
||||
if (StringUtils.isNotBlank(sjjsrq)) {
|
||||
endDate = sjjsrq;
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate) && StringUtils.isNotBlank(resourceid)) {
|
||||
// 内部同行人也要考虑
|
||||
if (StringUtils.isNotBlank(nbtxr)) {
|
||||
resourceid = resourceid + "," + nbtxr;
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
List<String> infos = new ArrayList<>();
|
||||
String acqOutSignSql = "select a.id, c.signinfo " +
|
||||
"from mobile_sign a " +
|
||||
"left join uf_outsigntype c " +
|
||||
"on c.outsignid = a.id " +
|
||||
"where operate_date > '" + startDate + "' and operate_date < '" + endDate + "' and operater in (?) ";
|
||||
rs.executeQuery(acqOutSignSql, resourceid);
|
||||
while (rs.next()) {
|
||||
String signinfo = Util.null2String(rs.getString("signinfo"));
|
||||
infos.add(signinfo);
|
||||
}
|
||||
|
||||
for (String inf : infos) {
|
||||
if (inf != null) {
|
||||
Map<String, Object> in = mapStringToMap(inf);
|
||||
String userId = Util.null2String(in.get("userId"));
|
||||
String userType = Util.null2String(in.get("userType"));
|
||||
String signType = Util.null2String(in.get("signType"));
|
||||
String signDate = Util.null2String(in.get("signDate"));
|
||||
String signTime = Util.null2String(in.get("signTime"));
|
||||
String clientAddress = Util.null2String(in.get("clientAddress"));
|
||||
String isInCom = Util.null2String(in.get("isInCom"));
|
||||
String timeZone = Util.null2String(in.get("timeZone"));
|
||||
String belongdate = Util.null2String(in.get("belongdate"));
|
||||
String signfrom = Util.null2String(in.get("signfrom"));
|
||||
String longitude = Util.null2String(in.get("longitude"));
|
||||
String latitude = Util.null2String(in.get("latitude"));
|
||||
String address = Util.null2String(in.get("address"));
|
||||
String deviceInfo = Util.null2String(in.get("deviceInfo"));
|
||||
String belongdateIsNull = Util.null2String(in.get("belongdateIsNull"));
|
||||
|
||||
String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo,isdev) " +
|
||||
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
boolean isok = rs.executeUpdate(punchSql, resourceid, userType, signType, signDate, signTime, clientAddress, isInCom,
|
||||
timeZone, belongdate, signfrom, longitude, latitude, address, deviceInfo, "1");
|
||||
bb.writeLog("isok: " + isok);
|
||||
//同步更新考勤数据到考勤报表
|
||||
if ("true".equals(belongdateIsNull)) {
|
||||
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤
|
||||
bb.writeLog("PunchOutButtonCmd:userId:" + userId + ":belongdate:" + DateUtil.getYesterday());
|
||||
new KQFormatBiz().formatDate("" + userId, DateUtil.getYesterday());
|
||||
}
|
||||
bb.writeLog("PunchOutButtonCmd:userId:" + userId + ":belongdate:" + (belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
|
||||
if (belongdate.length() == 0) {
|
||||
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤
|
||||
new KQFormatBiz().formatDate("" + userId, DateUtil.getYesterday());
|
||||
}
|
||||
new KQFormatBiz().formatDate("" + userId, (belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
|
||||
//外勤签到转的考勤 处理加班规则
|
||||
SplitActionUtil.pushOverTimeTasksAll(belongdate, belongdate, "" + userId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
bb.writeLog("OutSignSyncAction Exception: " + e);
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
public static Map<String, Object> mapStringToMap(String str) {
|
||||
str = str.substring(1, str.length() - 1);
|
||||
String[] strs = str.split(",");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for (String string : strs) {
|
||||
String key = string.split("=")[0];
|
||||
String value = string.split("=")[1];
|
||||
// 去掉头部空格
|
||||
String key1 = key.trim();
|
||||
String value1 = value.trim();
|
||||
map.put(key1, value1);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package weaver.interfaces.kqsolution.crob;
|
||||
|
||||
import com.engine.kqsolution.service.impl.ProjectPriceServiceImpl;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/9/2 10:08 AM
|
||||
* @Description: 产线工价台账
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class ProjectPriceCrob extends BaseCronJob {
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
ProjectPriceServiceImpl project = new ProjectPriceServiceImpl();
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate firstDayOfMonth = today.withDayOfMonth(1);
|
||||
LocalDate lastDayOfMonth = today.withDayOfMonth(today.lengthOfMonth());
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
String firstDay = firstDayOfMonth.format(formatter);
|
||||
String lastDay = lastDayOfMonth.format(formatter);
|
||||
|
||||
Map<String,Object> params = new HashMap<>();
|
||||
params.put("fromdate",firstDay);
|
||||
params.put("todate",lastDay);
|
||||
|
||||
//todo 执行前先删除历史数据 主表 明细表
|
||||
|
||||
// 获取当前月份的格式化字符串
|
||||
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
String currentMonth = today.format(formatter1);
|
||||
project.deleteHData(currentMonth,"");
|
||||
|
||||
project.signData(params);
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package weaver.interfaces.kqsolution.crob;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.engine.kqsolution.entity.SignDataParams;
|
||||
import com.engine.kqsolution.service.impl.SignDataSummaryServiceImpl;
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/9/18 11:46 AM
|
||||
* @Description: 建模表定时刷新打卡及补卡流程数据
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class SignDataSummaryCrob extends BaseCronJob {
|
||||
|
||||
public static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
private String attendanceDate;
|
||||
|
||||
private String formModeId;
|
||||
|
||||
public String getFormModeId() {
|
||||
return formModeId;
|
||||
}
|
||||
|
||||
public void setFormModeId(String formModeId) {
|
||||
this.formModeId = formModeId;
|
||||
}
|
||||
|
||||
public String getAttendanceDate() {
|
||||
return attendanceDate;
|
||||
}
|
||||
|
||||
public void setAttendanceDate(String attendanceDate) {
|
||||
this.attendanceDate = attendanceDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
SignDataSummaryServiceImpl summaryService = new SignDataSummaryServiceImpl();
|
||||
BaseBean bb = new BaseBean();
|
||||
|
||||
// bb.writeLog("同步考勤数据原始参数:"+attendanceDate);
|
||||
//
|
||||
//
|
||||
// if (Objects.isNull(attendanceDate)) {
|
||||
// attendanceDate = DateUtil.getYesterday();
|
||||
// }
|
||||
|
||||
String attendanceDateNew = DateUtil.getYesterday();
|
||||
|
||||
SignDataParams build = SignDataParams.builder()
|
||||
.formModeId(formModeId)
|
||||
.attendanceDate(attendanceDateNew)
|
||||
.build();
|
||||
|
||||
bb.writeLog("同步考勤数据参数:"+JSON.toJSONString(build));
|
||||
|
||||
|
||||
summaryService.recordSignData(build);
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package weaver.interfaces.sskj.crob;
|
||||
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/11/28 3:53 PM
|
||||
* @Description: 刷新人员安全级别
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class RefreshHrmSecLevelCrob extends BaseCronJob {
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
List<ReleationPO> releationList = new ArrayList<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select zwlb,aqjb from uf_aqjbdygxb");
|
||||
while (rs.next()) {
|
||||
releationList.add(ReleationPO.builder()
|
||||
.jobGroups(Util.getIntValue(rs.getString("zwlb")))
|
||||
.secLevel(Util.getIntValue(rs.getString("aqjb")))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
releationList.forEach(releationPo -> {
|
||||
List<Integer> jobTitles = new ArrayList<>();
|
||||
selectJobTitlesByJobGroup(jobTitles,releationPo.getJobGroups());
|
||||
if (CollectionUtils.isNotEmpty(jobTitles)) {
|
||||
rs.executeUpdate("update hrmresource a set a.seclevel = ? where " +
|
||||
" a.jobtitle in ("+StringUtils.join(jobTitles, ",")+")",releationPo.getSecLevel());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private List<Integer> selectJobTitlesByJobGroup(List<Integer> jobTitles,Integer jobGroup){
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select a.id from hrmjobtitles a join hrmjobactivities b on a.jobactivityid = b.id\n" +
|
||||
" join hrmjobgroups c on b.jobgroupid = c.id where c.id = ?",jobGroup);
|
||||
while (rs.next()) {
|
||||
jobTitles.add(Util.getIntValue(rs.getString("id")));
|
||||
}
|
||||
|
||||
return jobTitles;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package weaver.interfaces.sskj.crob;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/11/28 4:24 PM
|
||||
* @Description: 安全级别关系对照表
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ReleationPO {
|
||||
|
||||
private Integer jobGroups;
|
||||
|
||||
private Integer secLevel;
|
||||
}
|
Loading…
Reference in New Issue