出差流程没有外勤打卡不计算考勤

dev-chenwnj
chenwei 1 year ago
parent d2343f9eba
commit 1332bedb67

@ -0,0 +1,754 @@
package com.engine.kq.biz;
import com.engine.kq.enums.FlowReportTypeEnum;
import com.engine.kq.enums.KqSplitFlowTypeEnum;
import com.engine.kq.wfset.bean.SplitBean;
import weaver.conn.RecordSet;
import weaver.general.Util;
import java.util.*;
/**
*
*/
public class KQFlowDataBiz {
private String resourceid;
private String fromDate;
private String toDate;
private String fromTime;
private String toTime;
private String belongDate;
private String newLeaveType;
private String orderby_sql;
public KQFlowDataBiz(FlowDataParamBuilder build){
this.resourceid = build.resourceid;
this.fromDate = build.fromDate;
this.toDate = build.toDate;
this.fromTime = build.fromTime;
this.toTime = build.toTime;
this.belongDate = build.belongDate;
this.newLeaveType = build.newLeaveType;
this.orderby_sql = build.orderby_sql;
}
/**
*
*
* @param flowMaps
* @param isAll truefalse
* @return
*/
public List<SplitBean> getAllFlowData(Map<String,Object> flowMaps,boolean isAll){
List<SplitBean> allSplitBeans = new ArrayList<>();
Map<String,String> flowDeductCard = getFlowDeductCard();
allSplitBeans.addAll(getLeaveData(flowMaps,flowDeductCard));
// allSplitBeans.addAll(getEvectionData(flowMaps,flowDeductCard));
allSplitBeans.addAll(getOutData(flowMaps,flowDeductCard));
if(isAll){
allSplitBeans.addAll(getOverTimeData(flowMaps));
}
allSplitBeans.addAll(getOtherData(flowMaps));
return allSplitBeans;
}
/**
*
*/
public Map<String,String> getFlowDeductCard() {
RecordSet rs = new RecordSet();
RecordSet rs1 = new RecordSet();
Map<String,String> flowDeductCard = new HashMap<>();
String flowDeductCardSql = "select * from kq_flow_deduct_card t where 1=1 and (isclear is null or isclear<>1) ";
String sqlWhere = sqlFlowCardParamWhere();
if(sqlWhere.length() > 0){
flowDeductCardSql += sqlWhere;
}
rs.execute(flowDeductCardSql);
while(rs.next()){
String requestId= rs.getString("requestId");
String resourceid= rs.getString("resourceid");
String signtype= rs.getString("signtype");
String serialnumber= rs.getString("serialnumber");
String flowtype= rs.getString("flowtype");
String key = requestId+"_"+resourceid+"_"+flowtype;
String serial_signtype = serialnumber+"_"+signtype;
if(flowDeductCard.containsKey(key)){
String tmpSignType = Util.null2String(flowDeductCard.get(key));
flowDeductCard.put(key, tmpSignType+","+serial_signtype);
}else{
flowDeductCard.put(key, serial_signtype);
}
}
return flowDeductCard;
}
/**
*
*/
public List<SplitBean> getLeaveData(Map<String, Object> flowMaps,
Map<String, String> flowDeductCard){
RecordSet rs = new RecordSet();
RecordSet rs1 = new RecordSet();
String tablename = "select a.* from "+KqSplitFlowTypeEnum.LEAVE.getTablename()+" a left join workflow_requestbase b on a.requestid = b.requestid where b.requestid > 0 ";
String leaveSql = "select * from ("+tablename+") t where 1=1 and (status is null or status <> '1') ";
String sqlWhere = sqlParamWhere();
if(sqlWhere.length() > 0){
leaveSql += sqlWhere;
}
List<SplitBean> splitBeans = new ArrayList<>();
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
int[] initArrays = kqTimesArrayComInfo.getInitArr();
rs.execute(leaveSql);
while(rs.next()){
SplitBean splitBean = new SplitBean();
String requestId= rs.getString("requestId");
String resourceid= rs.getString("resourceid");
String fromdate= rs.getString("fromdate");
String belongdate= rs.getString("belongdate");
String fromtime= rs.getString("fromtime");
String todate= rs.getString("todate");
String totime= rs.getString("totime");
String newleavetype= rs.getString("newleavetype");
String duration= rs.getString("duration");
String durationrule= rs.getString("durationrule");
String leavebackrequestid= Util.null2String(rs.getString("leavebackrequestid"));
if(Util.getDoubleValue(duration) <= 0){
continue;
}
//计算规则 1-按天请假 2-按半天请假 3-按小时请假 4-按整天请假
String unitType = "4".equalsIgnoreCase(durationrule)?"1":"2";
String card_key = requestId+"_"+resourceid+"_"+KqSplitFlowTypeEnum.LEAVE.getFlowtype();
String serial_signtype = "";
String serial = "";
String signtype = "";
if(!flowDeductCard.isEmpty() && flowDeductCard.containsKey(card_key)){
serial_signtype = Util.null2String(flowDeductCard.get(card_key));
if(serial_signtype.split("_") != null && serial_signtype.split("_").length == 2){
serial = serial_signtype.split("_")[0];
signtype = serial_signtype.split("_")[1];
}
}
Map<String,String> infoMap = new HashMap<>();
infoMap.put("requestId", requestId);
infoMap.put(newleavetype, duration);
infoMap.put("begintime", fromtime);
infoMap.put("endtime", totime);
infoMap.put("unitType", unitType);
infoMap.put("flowtype", FlowReportTypeEnum.LEAVE.getFlowType());
infoMap.put("newleavetype", newleavetype);
infoMap.put("signtype", signtype);
infoMap.put("serial", serial);
String key = resourceid+"|"+belongdate;
if(flowMaps != null){
if(flowMaps.get(key) != null){
if(leavebackrequestid.length() > 0 && leavebackrequestid.startsWith(",")){
initArrays = kqTimesArrayComInfo.getInitArr();
int fromTimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(fromtime);
int toTimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(totime);
Arrays.fill(initArrays, fromTimeIndex, toTimeIndex+1, 1);
leavebackrequestid = leavebackrequestid.substring(1);
String backSql = "select * from "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" where "+Util.getSubINClause(leavebackrequestid, "requestid", "in")+" and fromdate= '"+fromdate+"'";
rs1.executeQuery(backSql);
while (rs1.next()){
String back_fromtime = rs1.getString("fromtime");
String back_totime = rs1.getString("totime");
if(back_fromtime.equalsIgnoreCase(fromtime)){
Arrays.fill(initArrays, kqTimesArrayComInfo.getArrayindexByTimes(back_fromtime), kqTimesArrayComInfo.getArrayindexByTimes(back_totime), -1);
}else{
Arrays.fill(initArrays, kqTimesArrayComInfo.getArrayindexByTimes(back_fromtime)+1, kqTimesArrayComInfo.getArrayindexByTimes(back_totime), -1);
}
}
List<List<String>> backLists = new ArrayList<>();
List<String> backList = new ArrayList<>();
for(int i = fromTimeIndex ; i <= toTimeIndex ; i ++){
if(initArrays[i] == 1){
backList.add(kqTimesArrayComInfo.getTimesByArrayindex(i));
}else{
if(!backList.isEmpty()){
backLists.add(backList);
backList = new ArrayList<>();
}else{
continue;
}
}
}
if(!backList.isEmpty()){
backLists.add(backList);
}
if(backLists != null && !backLists.isEmpty()){
List<Map<String,String>> time_list_tmp = (List<Map<String,String>>)flowMaps.get(key);
for(int j = 0 ; j < backLists.size() ;j++){
List<String> backListTmp = backLists.get(j);
String back_tmp_fromtime = backListTmp.get(0);
String back_tmp_totime = backListTmp.get(backListTmp.size()-1);
infoMap = new HashMap<>();
infoMap.put("requestId", requestId);
infoMap.put(newleavetype, duration);
infoMap.put("begintime", back_tmp_fromtime);
infoMap.put("endtime", back_tmp_totime);
infoMap.put("unitType", unitType);
infoMap.put("flowtype", FlowReportTypeEnum.LEAVE.getFlowType());
infoMap.put("newleavetype", newleavetype);
time_list_tmp.add(infoMap);
}
}
}else{
List<Map<String,String>> time_list_tmp = (List<Map<String,String>>)flowMaps.get(key);
time_list_tmp.add(infoMap);
}
}else{
if(leavebackrequestid.length() > 0 && leavebackrequestid.startsWith(",")){
initArrays = kqTimesArrayComInfo.getInitArr();
int fromTimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(fromtime);
int toTimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(totime);
Arrays.fill(initArrays, fromTimeIndex, toTimeIndex+1, 1);
leavebackrequestid = leavebackrequestid.substring(1);
String backSql = "select * from "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" where "+Util.getSubINClause(leavebackrequestid, "requestid", "in")+" and fromdate= '"+fromdate+"'";
rs1.executeQuery(backSql);
while (rs1.next()){
String back_fromtime = rs1.getString("fromtime");
String back_totime = rs1.getString("totime");
if(back_fromtime.equalsIgnoreCase(fromtime)){
Arrays.fill(initArrays, kqTimesArrayComInfo.getArrayindexByTimes(back_fromtime), kqTimesArrayComInfo.getArrayindexByTimes(back_totime), -1);
}else{
if(back_fromtime.compareTo(back_totime) < 0){
Arrays.fill(initArrays, kqTimesArrayComInfo.getArrayindexByTimes(back_fromtime)+1, kqTimesArrayComInfo.getArrayindexByTimes(back_totime), -1);
}
}
}
List<List<String>> backLists = new ArrayList<>();
List<String> backList = new ArrayList<>();
for(int i = fromTimeIndex ; i <= toTimeIndex ; i ++){
if(initArrays[i] == 1){
backList.add(kqTimesArrayComInfo.getTimesByArrayindex(i));
}else{
if(!backList.isEmpty()){
backLists.add(backList);
backList = new ArrayList<>();
}else{
continue;
}
}
}
if(!backList.isEmpty()){
backLists.add(backList);
}
if(backLists != null && !backLists.isEmpty()){
List<Map<String,String>> time_list = new ArrayList<>();
for(int j = 0 ; j < backLists.size() ;j++){
List<String> backListTmp = backLists.get(j);
String back_tmp_fromtime = backListTmp.get(0);
String back_tmp_totime = backListTmp.get(backListTmp.size()-1);
infoMap = new HashMap<>();
infoMap.put("requestId", requestId);
infoMap.put(newleavetype, duration);
infoMap.put("begintime", back_tmp_fromtime);
infoMap.put("endtime", back_tmp_totime);
infoMap.put("unitType", unitType);
infoMap.put("flowtype", FlowReportTypeEnum.LEAVE.getFlowType());
infoMap.put("newleavetype", newleavetype);
time_list.add(infoMap);
}
flowMaps.put(key, time_list);
}
}else{
List<Map<String,String>> time_list = new ArrayList<>();
time_list.add(infoMap);
flowMaps.put(key, time_list);
}
}
}
}
return splitBeans;
}
/**
*
*/
public List<SplitBean> getEvectionData(Map<String, Object> flowMaps,
Map<String, String> flowDeductCard){
RecordSet rs = new RecordSet();
String tablename = "select a.* from "+KqSplitFlowTypeEnum.EVECTION.getTablename()+" a left join workflow_requestbase b on a.requestid = b.requestid where b.requestid > 0 ";
String leaveSql = "select * from ("+tablename+") t where 1=1 and (status is null or status <> '1') ";
String sqlWhere = sqlParamWhere();
if(sqlWhere.length() > 0){
leaveSql += sqlWhere;
}
List<SplitBean> splitBeans = new ArrayList<>();
rs.execute(leaveSql);
while(rs.next()){
SplitBean splitBean = new SplitBean();
String requestId= rs.getString("requestId");
String resourceid= rs.getString("resourceid");
String fromdate= rs.getString("fromdate");
String belongdate= rs.getString("belongdate");
String fromtime= rs.getString("fromtime");
String todate= rs.getString("todate");
String totime= rs.getString("totime");
String newleavetype= rs.getString("newleavetype");
String duration= rs.getString("duration");
String durationrule= rs.getString("durationrule");
splitBean.setRequestId(requestId);
splitBean.setResourceId(resourceid);
splitBean.setFromDate(fromdate);
splitBean.setFromTime(fromtime);
splitBean.setToDate(todate);
splitBean.setToTime(totime);
splitBean.setNewLeaveType(newleavetype);
splitBean.setDuration(duration);
splitBean.setDurationrule(durationrule);
splitBeans.add(splitBean);
if(Util.getDoubleValue(duration) <= 0){
continue;
}
//计算规则 1-按天请假 2-按半天请假 3-按小时请假 4-按整天请假
String unitType = "4".equalsIgnoreCase(durationrule)?"1":"2";
String card_key = requestId+"_"+resourceid+"_"+KqSplitFlowTypeEnum.EVECTION.getFlowtype();
String serial_signtype = "";
String serial = "";
String signtype = "";
if(!flowDeductCard.isEmpty() && flowDeductCard.containsKey(card_key)){
serial_signtype = Util.null2String(flowDeductCard.get(card_key));
if(serial_signtype.split("_") != null && serial_signtype.split("_").length == 2){
serial = serial_signtype.split("_")[0];
signtype = serial_signtype.split("_")[1];
}
}
Map<String,String> infoMap = new HashMap<>();
infoMap.put(FlowReportTypeEnum.businessLeave.getFlowType(), duration);
infoMap.put("requestId", requestId);
infoMap.put("begintime", fromtime);
infoMap.put("endtime", totime);
infoMap.put("unitType", unitType);
infoMap.put("duration", duration);
infoMap.put("flowtype", FlowReportTypeEnum.EVECTION.getFlowType());
infoMap.put("signtype", signtype);
infoMap.put("serial", serial);
String key = resourceid+"|"+belongdate;
if(flowMaps != null){
if(flowMaps.get(key) != null){
List<Map<String,String>> time_list_tmp = (List<Map<String,String>>)flowMaps.get(key);
time_list_tmp.add(infoMap);
}else{
List<Map<String,String>> time_list = new ArrayList<>();
time_list.add(infoMap);
flowMaps.put(key, time_list);
}
}
}
return splitBeans;
}
/**
*
*/
public List<SplitBean> getOutData(Map<String, Object> flowMaps,
Map<String, String> flowDeductCard){
RecordSet rs = new RecordSet();
String tablename = "select a.* from "+KqSplitFlowTypeEnum.OUT.getTablename()+" a left join workflow_requestbase b on a.requestid = b.requestid where b.requestid > 0 ";
String leaveSql = "select * from ("+tablename+") t where 1=1 and (status is null or status <> '1') ";
String sqlWhere = sqlParamWhere();
if(sqlWhere.length() > 0){
leaveSql += sqlWhere;
}
List<SplitBean> splitBeans = new ArrayList<>();
rs.execute(leaveSql);
while(rs.next()){
SplitBean splitBean = new SplitBean();
String requestId= rs.getString("requestId");
String resourceid= rs.getString("resourceid");
String fromdate= rs.getString("fromdate");
String belongdate= rs.getString("belongdate");
String fromtime= rs.getString("fromtime");
String todate= rs.getString("todate");
String totime= rs.getString("totime");
String newleavetype= rs.getString("newleavetype");
String duration= rs.getString("duration");
String durationrule= rs.getString("durationrule");
splitBean.setRequestId(requestId);
splitBean.setResourceId(resourceid);
splitBean.setFromDate(fromdate);
splitBean.setFromTime(fromtime);
splitBean.setToDate(todate);
splitBean.setToTime(totime);
splitBean.setNewLeaveType(newleavetype);
splitBean.setDuration(duration);
splitBean.setDurationrule(durationrule);
splitBeans.add(splitBean);
if(Util.getDoubleValue(duration) <= 0){
continue;
}
//计算规则 1-按天请假 2-按半天请假 3-按小时请假 4-按整天请假
String unitType = "4".equalsIgnoreCase(durationrule)?"1":"2";
String card_key = requestId+"_"+resourceid+"_"+KqSplitFlowTypeEnum.OUT.getFlowtype();
String serial_signtype = "";
String serial = "";
String signtype = "";
if(!flowDeductCard.isEmpty() && flowDeductCard.containsKey(card_key)){
serial_signtype = Util.null2String(flowDeductCard.get(card_key));
if(serial_signtype.split("_") != null && serial_signtype.split("_").length == 2){
serial = serial_signtype.split("_")[0];
signtype = serial_signtype.split("_")[1];
}
}
Map<String,String> infoMap = new HashMap<>();
infoMap.put(FlowReportTypeEnum.officialBusiness.getFlowType(), duration);
infoMap.put("requestId", requestId);
infoMap.put("begintime", fromtime);
infoMap.put("endtime", totime);
infoMap.put("unitType", unitType);
infoMap.put("duration", duration);
infoMap.put("flowtype", FlowReportTypeEnum.OUT.getFlowType());
infoMap.put("signtype", signtype);
infoMap.put("serial", serial);
String key = resourceid+"|"+belongdate;
if(flowMaps != null){
if(flowMaps.get(key) != null){
List<Map<String,String>> time_list_tmp = (List<Map<String,String>>)flowMaps.get(key);
time_list_tmp.add(infoMap);
}else{
List<Map<String,String>> time_list = new ArrayList<>();
time_list.add(infoMap);
flowMaps.put(key, time_list);
}
}
}
return splitBeans;
}
/**
*
*/
public List<SplitBean> getOverTimeData(Map<String,Object> flowMaps){
RecordSet rs = new RecordSet();
String tablename = "select a.* from "+KqSplitFlowTypeEnum.OVERTIME.getTablename()+" a left join workflow_requestbase b on a.requestid = b.requestid where b.requestid > 0 ";
String leaveSql = "select * from ("+tablename+") t where 1=1 ";
String sqlWhere = sqlParamWhere();
if(sqlWhere.length() > 0){
leaveSql += sqlWhere;
}
List<SplitBean> splitBeans = new ArrayList<>();
if(orderby_sql.length() > 0){
leaveSql = leaveSql+orderby_sql;
}
rs.execute(leaveSql);
while(rs.next()){
SplitBean splitBean = new SplitBean();
String dataid= rs.getString("dataid");
String detailid= rs.getString("detailid");
String requestId= rs.getString("requestId");
String resourceid= rs.getString("resourceid");
String fromdate= rs.getString("fromdate");
String belongdate= rs.getString("belongdate");
String fromtime= rs.getString("fromtime");
String todate= rs.getString("todate");
String totime= rs.getString("totime");
String newleavetype= rs.getString("newleavetype");
String duration= rs.getString("duration");
String durationrule= rs.getString("durationrule");
String changetype= rs.getString("changetype");
String d_mins= rs.getString("d_mins");
String overtime_type= rs.getString("overtime_type");
String fromdatedb= rs.getString("fromdatedb");
String fromtimedb= rs.getString("fromtimedb");
String todatedb= rs.getString("todatedb");
String totimedb= rs.getString("totimedb");
splitBean.setDataId(dataid);
splitBean.setDetailId(detailid);
splitBean.setRequestId(requestId);
splitBean.setResourceId(resourceid);
splitBean.setFromDate(fromdate);
splitBean.setFromTime(fromtime);
splitBean.setToDate(todate);
splitBean.setToTime(totime);
splitBean.setNewLeaveType(newleavetype);
splitBean.setDuration(duration);
splitBean.setDurationrule(durationrule);
splitBean.setChangeType(Util.getIntValue(changetype));
splitBean.setD_Mins(Util.getDoubleValue(d_mins));
splitBean.setOvertime_type(overtime_type);
splitBean.setFromdatedb(fromdatedb);
splitBean.setFromtimedb(fromtimedb);
splitBean.setTodatedb(todatedb);
splitBean.setTotimedb(totimedb);
splitBeans.add(splitBean);
//计算规则 1-按天请假 2-按半天请假 3-按小时请假 4-按整天请假
String unitType = "4".equalsIgnoreCase(durationrule)?"1":"2";
unitType = "2".equalsIgnoreCase(durationrule)?"1":"2";
Map<String,String> infoMap = new HashMap<>();
infoMap.put(FlowReportTypeEnum.businessLeave.getFlowType(), duration);
infoMap.put("begintime", fromtime);
infoMap.put("endtime", totime);
infoMap.put("unitType", unitType);
infoMap.put("duration", duration);
infoMap.put("flowtype", FlowReportTypeEnum.OVERTIME.getFlowType());
String key = resourceid+"|"+belongdate;
if(flowMaps != null){
if(flowMaps.get(key) != null){
List<Map<String,String>> time_list_tmp = (List<Map<String,String>>)flowMaps.get(key);
time_list_tmp.add(infoMap);
}else{
List<Map<String,String>> time_list = new ArrayList<>();
time_list.add(infoMap);
flowMaps.put(key, time_list);
}
}
}
return splitBeans;
}
/**
*
*/
public List<SplitBean> getOtherData(Map<String,Object> flowMaps){
RecordSet rs = new RecordSet();
String tablename = "select a.* from "+KqSplitFlowTypeEnum.OTHER.getTablename()+" a left join workflow_requestbase b on a.requestid = b.requestid where b.requestid > 0 ";
String leaveSql = "select * from ("+tablename+") t where 1=1 ";
String sqlWhere = sqlParamWhere();
if(sqlWhere.length() > 0){
leaveSql += sqlWhere;
}
List<SplitBean> splitBeans = new ArrayList<>();
rs.execute(leaveSql);
while(rs.next()){
SplitBean splitBean = new SplitBean();
String requestId= rs.getString("requestId");
String resourceid= rs.getString("resourceid");
String fromdate= rs.getString("fromdate");
String belongdate= rs.getString("belongdate");
String fromtime= rs.getString("fromtime");
String todate= rs.getString("todate");
String totime= rs.getString("totime");
String newleavetype= rs.getString("newleavetype");
String duration= rs.getString("duration");
String durationrule= rs.getString("durationrule");
splitBean.setRequestId(requestId);
splitBean.setResourceId(resourceid);
splitBean.setFromDate(fromdate);
splitBean.setFromTime(fromtime);
splitBean.setToDate(todate);
splitBean.setToTime(totime);
splitBean.setNewLeaveType(newleavetype);
splitBean.setDuration(duration);
splitBean.setDurationrule(durationrule);
splitBeans.add(splitBean);
//计算规则 1-按天请假 2-按半天请假 3-按小时请假 4-按整天请假
String unitType = "4".equalsIgnoreCase(durationrule)?"1":"2";
Map<String,String> infoMap = new HashMap<>();
infoMap.put(FlowReportTypeEnum.businessLeave.getFlowType(), duration);
infoMap.put("begintime", fromtime);
infoMap.put("endtime", totime);
infoMap.put("unitType", unitType);
String key = resourceid+"|"+belongdate;
if(flowMaps != null){
if(flowMaps.get(key) != null){
List<Map<String,String>> time_list_tmp = (List<Map<String,String>>)flowMaps.get(key);
time_list_tmp.add(infoMap);
}else{
List<Map<String,String>> time_list = new ArrayList<>();
time_list.add(infoMap);
flowMaps.put(key, time_list);
}
}
}
return splitBeans;
}
/**
*
* @param ruleid
* @return true
*/
public static boolean leaveTypeUsed(String ruleid){
KQFlowDataBiz kqFlowDataBiz = new FlowDataParamBuilder().newLeaveTypeParam(ruleid).build();
List<SplitBean> splitBeans = kqFlowDataBiz.getLeaveData(null, new HashMap<>());
if(!splitBeans.isEmpty()){
return true;
}else{
return false;
}
}
/**
*
* @return
*/
private String sqlParamWhere() {
String sqlWhere = "";
if(resourceid.length() > 0){
sqlWhere += " and resourceid in ( "+resourceid+" )";
}
if(fromDate.length() > 0 && toDate.length() > 0){
sqlWhere += " and ( fromdate between '"+fromDate+"' and '"+toDate+"' or todate between '"+fromDate+"' and '"+toDate+"' )";
}else{
if(fromDate.length() > 0){
sqlWhere += " and fromdate between '"+fromDate+"' and '"+fromDate+"' ";
}
if(toDate.length() > 0){
sqlWhere += " and todate between '"+toDate+"' and '"+toDate+"' ";
}
}
if(belongDate.length() > 0){
sqlWhere += " and belongdate = '"+belongDate+"' ";
}
if(fromTime.length() > 0){
sqlWhere += " and fromtime >= '"+fromTime+"' ";
}
if(toTime.length() > 0){
sqlWhere += " and totime <= '"+toTime+"' ";
}
if(newLeaveType.length() > 0){
sqlWhere += " and newleavetype in ( "+newLeaveType+" )";
}
return sqlWhere;
}
private String sqlFlowCardParamWhere() {
String sqlWhere = "";
if(resourceid.length() > 0){
sqlWhere += " and resourceid in ( "+resourceid+" )";
}
if(fromDate.length() > 0 && toDate.length() > 0){
sqlWhere += " and ( fromdate between '"+fromDate+"' and '"+toDate+"' or todate between '"+fromDate+"' and '"+toDate+"' )";
}else{
if(fromDate.length() > 0){
sqlWhere += " and fromdate between '"+fromDate+"' and '"+fromDate+"' ";
}
if(toDate.length() > 0){
sqlWhere += " and todate between '"+toDate+"' and '"+toDate+"' ";
}
}
if(belongDate.length() > 0){
sqlWhere += " and belongdate = '"+belongDate+"' ";
}
if(fromTime.length() > 0){
sqlWhere += " and fromtime >= '"+fromTime+"' ";
}
if(toTime.length() > 0){
sqlWhere += " and totime <= '"+toTime+"' ";
}
return sqlWhere;
}
/**
* Builder
*/
public static class FlowDataParamBuilder {
private String resourceid = "";
private String fromDate = "";
private String toDate = "";
private String fromTime = "";
private String toTime = "";
private String belongDate = "";
/**
*
*/
private String newLeaveType = "";
private String orderby_sql = "";
public FlowDataParamBuilder() {
this.resourceid = "";
//初始化的时候需要把其他参数先清空下
this.fromDate = "";
this.toDate = "";
this.fromTime = "";
this.toTime = "";
this.newLeaveType = "";
this.belongDate = "";
this.orderby_sql = "";
}
//成员方法返回其自身,所以可以链式调用
public FlowDataParamBuilder resourceidParam(final String resourceid) {
this.resourceid = resourceid;
return this;
}
public FlowDataParamBuilder fromDateParam(final String fromDate) {
this.fromDate = fromDate;
return this;
}
public FlowDataParamBuilder toDateParam(final String toDate) {
this.toDate = toDate;
return this;
}
public FlowDataParamBuilder fromTimeParam(final String fromTime) {
this.fromTime = fromTime;
return this;
}
public FlowDataParamBuilder toTimeParam(final String toTime) {
this.toTime = toTime;
return this;
}
public FlowDataParamBuilder newLeaveTypeParam(final String newLeaveType) {
this.newLeaveType = newLeaveType;
return this;
}
public FlowDataParamBuilder belongDateParam(final String belongDate) {
this.belongDate = belongDate;
return this;
}
public FlowDataParamBuilder orderby_sqlParam(final String orderby_sql) {
this.orderby_sql = orderby_sql;
return this;
}
//Builder的build方法返回外部类的实例
public KQFlowDataBiz build() {
return new KQFlowDataBiz(this);
}
}
}

@ -238,5 +238,54 @@ public class SskjUtil {
return true;
}
public Map<String, Object> customLog( Map<String, String> params) {
Map<String, Object> result = new HashMap<>();
boolean flag = false;
List<List> insertParams = new ArrayList<>();
List insertPa = new ArrayList<>();
String functionType = Util.null2String(params.get("functionType"));
String changeBeforeData = Util.null2String(params.get("changeBeforeData"));
String changeAfterData = Util.null2String(params.get("changeAfterData"));
String changeDateTime = Util.null2String(params.get("changeDateTime"));
if (StringUtils.isNotBlank(functionType) && StringUtils.isNotBlank(changeBeforeData)
&& StringUtils.isNotBlank(changeAfterData) && StringUtils.isNotBlank(changeDateTime)) {
insertPa.add(functionType);
insertPa.add(changeBeforeData);
insertPa.add(changeAfterData);
insertPa.add(changeDateTime);
insertParams.add(insertPa);
} else {
result.put("res",flag);
result.put("msg","入参存在空值,请检查参数");
return result;
}
insertParams.add(insertPa);
String insertSql = "insert into uf_KQCustomLog (functionType, changeBeforeData, changeAfterData, changeDate, " +
" formmodeid, modedatacreater, modedatacreatertype, modedatacreatedate, modedatacreatetime ) values (?,?,?,?,?,?,?,?,?)";
RecordSet rs = new RecordSet();
flag = rs.executeBatchSql(insertSql, insertParams);
if (flag) {
result.put("res",flag);
result.put("msg","保存成功!");
return result;
} else {
result.put("res",flag);
result.put("msg","保存失败!");
return result;
}
}
public boolean customLogBatch( List<Map<String, String>> params) {
boolean result = false;
List<List> insertParams = new ArrayList<>();
List insertPa = new ArrayList<>();
insertParams.add(insertPa);
String insertSql = "insert into uf_KQCustomLog () values ()";
RecordSet rs = new RecordSet();
result = rs.executeBatchSql(insertSql, insertParams);
return result;
}
}

Loading…
Cancel
Save