嵌入他人开发文件基础上增加二开需求
parent
e88632d12f
commit
98b7843757
@ -0,0 +1,199 @@
|
||||
<%@ 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 zgs = psjbbdx+xxrjbbdx+jjrjbbdx+dkzgs;
|
||||
|
||||
KqMonthDataPO kqMonthDataPO = KqMonthDataPO.builder()
|
||||
.resourceId(xm)
|
||||
.status(zt)
|
||||
.departmentId(bm)
|
||||
.jobTitle(gw)
|
||||
.psjbbdx(psjbbdx)
|
||||
.xxrjbbdx(xxrjbbdx)
|
||||
.jjrjbbdx(jjrjbbdx)
|
||||
.dkzgs(dkzgs)
|
||||
.zgs(zgs)
|
||||
.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();
|
||||
|
||||
|
||||
boolean exist = isExist(month,kqMonthDataPO.getResourceId());
|
||||
if(exist){
|
||||
//更新
|
||||
String updateSql = " update uf_ydgs set dkzgs=?, psjbbdx=?, xxrjbbdx=?, jjrjbbdx=?, zgs=?, zt=? where xm=? and kqy=? ";
|
||||
rs.executeUpdate(updateSql,new Object[]{dkzgs,psjbbdx,xxrjbbdx,jjrjbbdx,zgs,zt,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,"+
|
||||
"formmodeid,modedatacreater,modedatacreatedate,modedatacreatetime,modeuuid) " +
|
||||
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
|
||||
rs.executeUpdate(insertSql,new Object[]{xm,bm,gw,month,dkzgs,psjbbdx,xxrjbbdx,jjrjbbdx,zgs,zt,
|
||||
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,39 @@
|
||||
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;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,228 @@
|
||||
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 zgs = psjbbdx+xxrjbbdx+jjrjbbdx+dkzgs;
|
||||
|
||||
KqMonthDataPO kqMonthDataPO = KqMonthDataPO.builder()
|
||||
.resourceId(userid)
|
||||
.status(status)
|
||||
.departmentId(departmentid)
|
||||
.jobTitle(jobtitle)
|
||||
.psjbbdx(psjbbdx)
|
||||
.xxrjbbdx(xxrjbbdx)
|
||||
.jjrjbbdx(jjrjbbdx)
|
||||
.dkzgs(dkzgs)
|
||||
.zgs(zgs)
|
||||
.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();
|
||||
|
||||
|
||||
boolean exist = isExist(month,kqMonthDataPO.getResourceId());
|
||||
if(exist){
|
||||
//更新
|
||||
String updateSql = " update uf_ydgs set dkzgs=?, psjbbdx=?, xxrjbbdx=?, jjrjbbdx=?, zgs=?, zt=? where xm=? and kqy=? ";
|
||||
rs.executeUpdate(updateSql,new Object[]{dkzgs,psjbbdx,xxrjbbdx,jjrjbbdx,zgs,zt,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,"+
|
||||
"formmodeid,modedatacreater,modedatacreatedate,modedatacreatetime,modeuuid) " +
|
||||
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
|
||||
rs.executeUpdate(insertSql,new Object[]{xm,bm,gw,month,dkzgs,psjbbdx,xxrjbbdx,jjrjbbdx,zgs,zt,
|
||||
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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue