Compare commits

..

No commits in common. 'ml' and 'master' have entirely different histories.
ml ... master

@ -1,7 +0,0 @@
package com.api.xcy.web;
import javax.ws.rs.Path;
@Path("/xcy/kq")
public class KQXCYAction extends com.engine.xcy.web.KQXCYAction {
}

@ -124,10 +124,10 @@ public class KQBalanceDetail extends BaseBean {
errorInfo = ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005288,weaver.general.ThreadVarLanguage.getLang())+"";
return errorInfo;
}
// if (_totalAmount < _usedAmount) {
// errorInfo = ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(508124,weaver.general.ThreadVarLanguage.getLang())+"";
// return errorInfo;
// }
if (_totalAmount < _usedAmount) {
errorInfo = ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(508124,weaver.general.ThreadVarLanguage.getLang())+"";
return errorInfo;
}
if (this.leaveRulesId.equals("")) {
errorInfo = ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005289,weaver.general.ThreadVarLanguage.getLang())+"ID";
return errorInfo;

@ -303,22 +303,16 @@ public class KQReportBiz extends BaseBean {
return unitTypeName;
}
public Map<String,Object> getFlowData(Map<String,Object> params, User user) {
Map<String, Object> datas = new HashMap<>();
try {
datas.putAll(getFlowLeaveData(params, user, ""));
datas.putAll(getFlowEvectionOutData(params, user));
datas.putAll(getFlowOverTimeDataNew(params, user));
datas.putAll(getFlowOtherData(params, user));
datas.putAll(getFlowLeaveBackData(params, user));
datas.putAll(getFlowProcessChangeData(params, user));
// 新创元二开:跨厂办公时长
// datas.putAll(getFlowKCBGData(params, user));
// 新创元二开: 补卡次数
datas.putAll(getFlowBKCSData(params, user));
// 新创元二开: 年累计事假
datas.putAll(getFlowLeaveData(params, user, "1"));
} catch (Exception e) {
public Map<String,Object> getFlowData(Map<String,Object> params, User user){
Map<String,Object> datas = new HashMap<>();;
try{
datas.putAll(getFlowLeaveData(params,user));
datas.putAll(getFlowEvectionOutData(params,user));
datas.putAll(getFlowOverTimeDataNew(params,user));
datas.putAll(getFlowOtherData(params,user));
datas.putAll(getFlowLeaveBackData(params,user));
datas.putAll(getFlowProcessChangeData(params,user));
}catch (Exception e){
writeLog(e);
}
return datas;
@ -330,18 +324,14 @@ public class KQReportBiz extends BaseBean {
* @param user
* @return
*/
public Map<String,Object> getDailyFlowData(Map<String,Object> params, User user) {
Map<String, Object> datas = new HashMap<>();
try {
datas.putAll(getDailyFlowLeaveData(params, user));
datas.putAll(getDailyFlowEvectionOutData(params, user));
datas.putAll(getDailyFlowOverTimeData(params, user));
datas.putAll(getDailyFlowLeaveBackData(params, user));
// 新创元二开:跨厂办公时长
// datas.putAll(getFlowKCBGData(params, user));
// 新创元二开:补卡次数
datas.putAll(getFlowBKCSData(params, user));
} catch (Exception e) {
public Map<String,Object> getDailyFlowData(Map<String,Object> params, User user){
Map<String,Object> datas = new HashMap<>();;
try{
datas.putAll(getDailyFlowLeaveData(params,user));
datas.putAll(getDailyFlowEvectionOutData(params,user));
datas.putAll(getDailyFlowOverTimeData(params,user));
datas.putAll(getDailyFlowLeaveBackData(params,user));
}catch (Exception e){
writeLog(e);
}
return datas;
@ -409,19 +399,18 @@ public class KQReportBiz extends BaseBean {
}
for(String table : tables){
sql = " select b.resourceid, durationrule, sum(b.duration) as val,CCSQLX from hrmresource a, "+table+" b,"+kcbgFlowTable+" c "+
" where a.id = b.resourceid AND b.REQUESTID = c.REQUESTID and (b.status is null or b.status<>1) and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' "+sqlWhere+
" group by b.resourceid, durationrule, CCSQLX ";
sql = " select resourceid, durationrule, sum(duration) as val from hrmresource a, "+table+" b "+
" where a.id = b.resourceid and (b.status is null or b.status<>1) and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' "+sqlWhere+
" group by resourceid, durationrule ";
rs.execute(sql);
while (rs.next()) {
String resourceid = rs.getString("resourceid");
double value = rs.getDouble("val");
String durationrule = rs.getString("durationrule");
String evectionType = rs.getString("CCSQLX");//此次出差类型
String flowType = "";
if(KqSplitFlowTypeEnum.EVECTION.getTablename().equals(table)){
flowType = "businessLeave|"+evectionType;
flowType = "businessLeave";
minimumUnit = KQTravelRulesBiz.getMinimumUnit();//单位类型
proportion = Util.getDoubleValue(KQTravelRulesBiz.getHoursToDay());//换算关系
@ -518,20 +507,19 @@ public class KQReportBiz extends BaseBean {
}
for(String table : tables){
sql = " select b.resourceid, durationrule, sum(b.duration) as val,belongdate,CCSQLX from hrmresource a, "+table+" b,"+kcbgFlowTable+" c "+
" where a.id = b.resourceid and b.REQUESTID = c.REQUESTID and (b.status is null or b.status<>1) and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' "+sqlWhere+
" group by b.resourceid, durationrule,belongdate,CCSQLX ";
sql = " select resourceid, durationrule, sum(duration) as val,belongdate from hrmresource a, "+table+" b "+
" where a.id = b.resourceid and (b.status is null or b.status<>1) and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' "+sqlWhere+
" group by resourceid, durationrule,belongdate ";
rs.execute(sql);
while (rs.next()) {
String resourceid = rs.getString("resourceid");
String belongdate = rs.getString("belongdate");
double value = rs.getDouble("val");
String durationrule = rs.getString("durationrule");
String evectionType = rs.getString("CCSQLX");//此次出差类型
String flowType = "";
if(KqSplitFlowTypeEnum.EVECTION.getTablename().equals(table)){
flowType = "businessLeave"+"|"+evectionType;
flowType = "businessLeave";
minimumUnit = KQTravelRulesBiz.getMinimumUnit();//单位类型
proportion = Util.getDoubleValue(KQTravelRulesBiz.getHoursToDay());//换算关系
}else if(KqSplitFlowTypeEnum.OUT.getTablename().equals(table)){
@ -571,7 +559,7 @@ public class KQReportBiz extends BaseBean {
* @param user
* @return
*/
public Map<String,Object> getFlowLeaveData(Map<String,Object> params, User user,String type){
public Map<String,Object> getFlowLeaveData(Map<String,Object> params, User user){
Map<String,Object> datas = new HashMap<>();;
RecordSet rs = new RecordSet();
String sql = "";
@ -579,7 +567,6 @@ public class KQReportBiz extends BaseBean {
try{
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
String fromDate = Util.null2String(jsonObj.get("fromDate"));
String toDate = Util.null2String(jsonObj.get("toDate"));
String typeselect =Util.null2String(jsonObj.get("typeselect"));
@ -593,13 +580,6 @@ public class KQReportBiz extends BaseBean {
toDate = TimeUtil.getDateByOption(typeselect,"1");
}
}
if (type.equals("1")) {//二开type =1 时,统计请假 汇总值(本年累加)
fromDate = TimeUtil.getDateByOption("5","0");//本年第一天
if (typeselect.equals("6")) {
fromDate = fromDate.substring(0,4) + "-01-01";
}
}
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
String departmentId = Util.null2String(jsonObj.get("departmentId"));
String resourceId = Util.null2String(jsonObj.get("resourceId"));
@ -651,9 +631,6 @@ public class KQReportBiz extends BaseBean {
}
String key = resourceid+"|leaveType_"+newleavetype;
if (type.equals("1")) {//二开:汇总
key = resourceid+"|leaveType_all_"+newleavetype;
}
if(datas.containsKey(key)){
value += Util.getDoubleValue(Util.null2String(datas.get(key)));
}
@ -1460,7 +1437,6 @@ public class KQReportBiz extends BaseBean {
Map<String,Object> tmpdata = null;
Map<String,Object> tmpmap = null;
RecordSet rs = new RecordSet();
RecordSet recordSet = new RecordSet();
String sql = "";
try {
sql = " select resourceid, kqdate, workMins, belatemins, graveBeLateMins, leaveearlymins, graveLeaveEarlyMins, absenteeismmins, forgotcheckMins, forgotBeginWorkCheckMins, "+
@ -1471,7 +1447,6 @@ public class KQReportBiz extends BaseBean {
rs.executeQuery(sql,resourceId, fromDate,toDate);
while (rs.next()) {
String key = rs.getString("resourceid") + "|" + rs.getString("kqdate");
String kqdate = rs.getString("kqdate");
int workMins = rs.getInt("workMins");
int beLateMins = rs.getInt("beLateMins");
int leaveEarlyMins = rs.getInt("leaveEarlyMins");
@ -1554,12 +1529,6 @@ public class KQReportBiz extends BaseBean {
}
}
if (evectionMins > 0) {//出差
String kcbgsql = "select a.REQUESTID from kq_flow_split_evection a,"+kcbgFlowTable+" b\n" +
"WHERE a.REQUESTID = b.REQUESTID AND b.ccsqlx = 1 and b.RESOURCEID ='"+resourceId+"' AND a.FROMDATE >= '"+kqdate+"' AND a.TODATE <= '"+kqdate+"'";
recordSet.execute(kcbgsql);
if (recordSet.next()) {
text += "跨厂办公";
}
if(text.indexOf(SystemEnv.getHtmlLabelName(20084, user.getLanguage()))==-1) {
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(20084, user.getLanguage());
@ -1827,161 +1796,6 @@ public class KQReportBiz extends BaseBean {
return text;
}
/**
* /
* @param params
* @param user
* @return
*/
public Map<String,Object> getFlowKCBGData(Map<String,Object> params, User user){
Map<String,Object> datas = new HashMap<>();;
RecordSet rs = new RecordSet();
String sql = "";
String sqlWhere = " ";
try{
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
String fromDate = Util.null2String(jsonObj.get("fromDate"));
String toDate = Util.null2String(jsonObj.get("toDate"));
String typeselect =Util.null2String(jsonObj.get("typeselect"));
if(typeselect.length()==0)typeselect = "3";
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
if(typeselect.equals("1")){
fromDate = TimeUtil.getCurrentDateString();
toDate = TimeUtil.getCurrentDateString();
}else{
fromDate = TimeUtil.getDateByOption(typeselect,"0");
toDate = TimeUtil.getDateByOption(typeselect,"1");
}
}
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
String departmentId = Util.null2String(jsonObj.get("departmentId"));
String resourceId = Util.null2String(jsonObj.get("resourceId"));
String allLevel = Util.null2String(jsonObj.get("allLevel"));
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
String viewScope = Util.null2String(jsonObj.get("viewScope"));
if(subCompanyId.length()>0){
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
}
if(departmentId.length()>0){
sqlWhere +=" and a.departmentid in("+departmentId+") ";
}
if(resourceId.length()>0){
sqlWhere +=" and b.resourceid in("+resourceId+") ";
}
if(viewScope.equals("4")){//我的下属
if(allLevel.equals("1")){//所有下属
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
}else{
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
}
}
if (!"1".equals(isNoAccount)) {
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
}
sql = "SELECT b.resourceid,b.REQUESTID,max(c.duration) duration FROM HRMRESOURCE a, kq_flow_split_evection b,"+kcbgFlowTable+" c\n" +
"WHERE a.id=b.RESOURCEID AND b.REQUESTID = c.REQUESTID AND c.ccsqlx='2' and fromdatedb >='"+fromDate+"' and fromdatedb <='"+toDate+"' "+sqlWhere+
"GROUP BY b.resourceid,b.REQUESTID ";
rs.execute(sql);
while (rs.next()) {
String resourceid = rs.getString("resourceid");
double value = rs.getDouble("duration");
String flowType = "kcbg";
String key = resourceid+"|"+flowType;
if(datas.containsKey(key)){
value += Util.getDoubleValue(Util.null2String(datas.get(key)));
}
//df.format 默认是不四舍五入的 0.125这样的就会直接变成0.12了
df.setMaximumFractionDigits(5);
datas.put(key, df.format(value));
}
}catch (Exception e){
writeLog(e);
}
return datas;
}
// 补卡流程
private static final String bkWorkFlowMainTable = new BaseBean().getPropValue("xcy_kq", "xcy_kq_bk_mainTab");
private static final String bkWorkFlowDetTable = new BaseBean().getPropValue("xcy_kq", "xcy_kq_bk_detailTab");
// 跨厂办公流程表
private static final String kcbgFlowTable = new BaseBean().getPropValue("xcy_kq","xcy_kq_cckcbg");
/**
*
* @param params
* @param user
* @return
*/
public Map<String,Object> getFlowBKCSData(Map<String,Object> params, User user){
Map<String,Object> datas = new HashMap<>();;
RecordSet rs = new RecordSet();
String sql = "";
String fromSql = " from hrmResource a,"+bkWorkFlowMainTable+" b, "+bkWorkFlowDetTable+" c ";
String sqlWhere = "";
try{
JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
String fromDate = Util.null2String(jsonObj.get("fromDate"));
String toDate = Util.null2String(jsonObj.get("toDate"));
String typeselect =Util.null2String(jsonObj.get("typeselect"));
if(typeselect.length()==0)typeselect = "3";
if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){
if(typeselect.equals("1")){
fromDate = TimeUtil.getCurrentDateString();
toDate = TimeUtil.getCurrentDateString();
}else{
fromDate = TimeUtil.getDateByOption(typeselect,"0");
toDate = TimeUtil.getDateByOption(typeselect,"1");
}
}
String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
String departmentId = Util.null2String(jsonObj.get("departmentId"));
String resourceId = Util.null2String(jsonObj.get("resourceId"));
String allLevel = Util.null2String(jsonObj.get("allLevel"));
String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
String viewScope = Util.null2String(jsonObj.get("viewScope"));
if(subCompanyId.length()>0){
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
}
if(departmentId.length()>0){
sqlWhere +=" and a.departmentid in("+departmentId+") ";
}
if(resourceId.length()>0){
sqlWhere +=" and b.resourceid in("+resourceId+") ";
}
if(viewScope.equals("4")){//我的下属
if(allLevel.equals("1")){//所有下属
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
}else{
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
}
}
if (!"1".equals(isNoAccount)) {
sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
}
sql = "SELECT b.resourceId,c.detail_signdate,count(1) AS bkcs " +fromSql+
"WHERE a.id=b.resourceId AND b.id=c.mainid AND c.bkyy=0 AND c.detail_signdate >='"+fromDate+"' and c.detail_signdate <='"+toDate+"' "+sqlWhere+
"GROUP BY b.resourceId,c.detail_signdate";
rs.execute(sql);
while (rs.next()) {
String resourceid = rs.getString("resourceId");
String value = rs.getString("bkcs");
String flowType = "bkcs";
String key = resourceid+"|"+flowType;
datas.put(key, value);
}
}catch (Exception e){
writeLog(e);
}
return datas;
}
public static boolean getShowFlowText(String leaveInfo,String onOrOff){
Map<String,Object> jsonObject = null;
jsonObject = JSON.parseObject(leaveInfo);

@ -83,11 +83,11 @@ public class EditBalanceCmd extends AbstractCommonCommand<Map<String, Object>> {
double _tiaoxiuAmount = Util.getDoubleValue(tiaoxiuAmount, 0.00);
BigDecimal _tiaoxiuamount = new BigDecimal(Util.getDoubleValue(tiaoxiuAmount, 0.00)).setScale(2,RoundingMode.HALF_UP);
/*已休不能大于总数*/
/* if ((_totalAmount+_tiaoxiuAmount) < _usedAmount) {
if ((_totalAmount+_tiaoxiuAmount) < _usedAmount) {
resultMap.put("sign", "-1");
resultMap.put("message", SystemEnv.getHtmlLabelName(529202, user.getLanguage()));
return resultMap;
}*/
}
/*失效日期不能小于加班日期*/
if (!"".equals(expirationDate)&& !"".equals(effectiveDate) && expirationDate.compareTo(effectiveDate) < 0) {
resultMap.put("sign", "-1");

@ -12,8 +12,6 @@ import com.engine.kq.log.KQLog;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.PageUidFactory;
import java.math.BigDecimal;
import com.engine.kq.util.UtilKQXcy;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
@ -41,7 +39,6 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
public Map<String, Object> execute(CommandContext commandContext) {
Map<String,Object> retmap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
RecordSet recordSet = new RecordSet();
String sql = "";
try{
String pageUid = PageUidFactory.getHrmPageUid("KQDailyReport");
@ -131,11 +128,8 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
// fromDate = today;
// }
// }
String xcy_fields = " a.companystartdate, ";
String forgotBeginWorkCheck_field = " b.forgotbeginworkcheck ";
if(rs.getDBType().equalsIgnoreCase("oracle")&&!Util.null2String(rs.getOrgindbtype()).equals("dm")&&!Util.null2String(rs.getOrgindbtype()).equals("st")&&!Util.null2String(rs.getOrgindbtype()).equals("jc")) {
forgotBeginWorkCheck_field = " nvl(b.forgotBeginWorkCheck,0) ";
}else if((rs.getDBType()).equalsIgnoreCase("mysql")){
@ -144,7 +138,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
}
String backFields = " a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," + xcy_fields +
String backFields = " a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," +
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins," +
" b.beLate,b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins," +
" b.signdays,b.signmins, "+
@ -238,13 +232,6 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
// 查询班次名中含有“夜班”的班次号
rs.executeQuery("select id from kq_shiftmanagement where serial like '%夜班%'");
List<String> serialIdList = new ArrayList<>();
while (rs.next()) {
serialIdList.add(Util.null2String(rs.getString("id")));
}
rs.execute(sql);
while (rs.next()) {
String id = rs.getString("id");
@ -305,7 +292,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
data.put(fieldName + "Id", fieldValueID);
data.put(fieldName, fieldValue);
} else if (kqReportFieldComInfo.getParentid().equals("overtime") || kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|| kqReportFieldComInfo.getParentid().equals("overtime_4leave") || fieldName.equals("businessLeave") || fieldName.equals("officialBusiness") || fieldName.equals("kcbg")) {
|| kqReportFieldComInfo.getParentid().equals("overtime_4leave") || fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
if (fieldName.equals("overtimeTotal")) {
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|" + kqdate + "|workingDayOvertime_4leave")));
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave;
@ -323,11 +310,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave + restDayOvertime_4leave + holidayOvertime_4leave +
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
} else if (fieldName.equals("businessLeave")){
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName + "|0")));
} else if (fieldName.equals("kcbg")) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + kqdate + "|businessLeave|1")));
}else {
} else {
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName)));
}
data.put(fieldName, fieldValue);
@ -336,28 +319,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
if (fieldValue.length()>0) {//弹性工作制没有班次
data.put("serialid", shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage()));
}
} else if (fieldName.equals("ybts") ) {//夜班天数
String serialid = rs.getString("serialid");
if (serialIdList.contains(serialid)) {
fieldValue = isSign(resourceId,kqdate,serialid) ? "1" : "0";
} else {
fieldValue = "0";
}
data.put(fieldName, fieldValue);
} else if (fieldName.equals("companystartdate")) {//入职日期
fieldValue = Util.null2String(rs.getString("companystartdate"));
data.put(fieldName, fieldValue);
} else if (fieldName.equals("companyenddate")) {//离职日期
fieldValue = getCompanyEndDate(recordSet,id);
data.put(fieldName, fieldValue);
} else if (fieldName.equals("bkcs")) {//补卡次数
fieldValue = new UtilKQXcy().getBkCounts(recordSet,id,kqdate,kqdate);
data.put(fieldName, fieldValue);
} else if (fieldName.equals("qqts")) {//缺勤天数
// 每日报表中国缺勤取旷工数
String absenteeism = Util.null2String(rs.getString("absenteeism"));
data.put(fieldName,absenteeism);
} else {
}else {
fieldValue = Util.null2String(rs.getString(fieldName));
if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
@ -427,21 +389,6 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
return retmap;
}
private boolean isSign (String resourceid,String kqdate,String serialid) {
RecordSet recordSet = new RecordSet();
boolean flag = true;
recordSet.execute("select signindate,signintime,signoutdate,signouttime from kq_format_detail where resourceid='"+resourceid+"' and kqdate='"+kqdate+"' and serialid="+serialid+"");
if (recordSet.next()) {
String signindate = Util.null2String(recordSet.getString("signindate"));
String signintime = Util.null2String(recordSet.getString("signintime"));
String signoutdate = Util.null2String(recordSet.getString("signoutdate"));
String signouttime = Util.null2String(recordSet.getString("signouttime"));
if (signindate.equals("") && signintime.equals("") && signoutdate.equals("") && signouttime.equals("") ) {
flag = false;
}
}
return flag;
}
private String getUnitType(String unitType, User user){
String unitTypeName = "";
@ -659,14 +606,4 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
return null;
}
// 获取人员离职日期
private String getCompanyEndDate (RecordSet rs,String resourceId) {
String sql = "select changedate from hrmstatushistory a where TYPE_N=5 and RESOURCEID=?";
rs.executeQuery(sql,resourceId);
if (rs.next()) {
return Util.null2String(rs.getString("changedate"));
}
return "";
}
}

@ -9,11 +9,8 @@ import com.engine.kq.biz.*;
import com.engine.kq.log.KQLog;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.PageUidFactory;
import com.engine.kq.util.UtilKQXcy;
import weaver.blog.WorkDayDao;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
@ -37,7 +34,6 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> retmap = new HashMap<String, Object>();
RecordSet rs = new RecordSet();
RecordSet recordSet = new RecordSet();
String sql = "";
try {
String pageUid = PageUidFactory.getHrmPageUid("KQReport");
@ -164,13 +160,10 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) ";
String xcy_fields = " max(b.serialId) as serialId,max(a.companystartdate) companystartdate, ";
if (rs.getDBType().equalsIgnoreCase("oracle")) {
forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) ";
} else if ((rs.getDBType()).equalsIgnoreCase("mysql")) {
forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) ";
xcy_fields = "b.serialId,a.companystartdate, ";
} else {
forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) ";
}
@ -178,7 +171,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
Map<String, Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
String backFields = "a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," + xcy_fields +
String backFields = " a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," +
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
@ -313,14 +306,6 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey), "0");
Map<String, Object> flowData = kqReportBiz.getFlowData(params, user);
// 查询班次名中含有“夜班”的班次号
rs.executeQuery("select id from kq_shiftmanagement where serial like '%夜班%'");
List<String> serialIdList = new ArrayList<>();
while (rs.next()) {
serialIdList.add(Util.null2String(rs.getString("id")));
}
rs.execute(sql);
while (rs.next()) {
data = new HashMap<>();
@ -376,7 +361,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
data.put(serialIds.get(i), kqReportBiz.getSerialCount(id, fromDate, toDate, serialIds.get(i)));
}
} else if (kqReportFieldComInfo.getParentid().equals("overtime") || kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
|| kqReportFieldComInfo.getParentid().equals("overtime_4leave") || fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")|| fieldName.equals("kcbg")) {
|| kqReportFieldComInfo.getParentid().equals("overtime_4leave") || fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
if (fieldName.equals("overtimeTotal")) {
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id + "|workingDayOvertime_4leave")));
workingDayOvertime_4leave = workingDayOvertime_4leave < 0 ? 0 : workingDayOvertime_4leave;
@ -396,9 +381,6 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
} else if (fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id + "|" + fieldName)), "0.0");
if (fieldName.equals("businessLeave")) {
businessLeaveData = Util.null2s(Util.null2String(flowData.get(id + "|" + fieldName + "|0")), "0.0");
}
String backType = fieldName + "_back";
String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id + "|" + backType)), "0.0");
String businessLeave = "";
@ -419,62 +401,9 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
} catch (Exception e) {
}
fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave);
} else if (fieldName.equals("kcbg")) {//跨厂办公
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|businessLeave|1")));
}
else {
} else {
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id + "|" + fieldName)));
}
} else if (fieldName.equals("ybcs")) {//夜班次数
fieldValue = getMonthYBCS(recordSet, fromDate, toDate, resourceId, String.join(",", serialIdList));
} else if (fieldName.equals("companystartdate")) {//入职日期
fieldValue = Util.null2String(rs.getString("companystartdate"));
} else if (fieldName.equals("companyenddate")) {//离职日期
fieldValue = getCompanyEndDate(recordSet,id);
} else if (fieldName.equals("bkcs")) {//补卡次数
fieldValue = new UtilKQXcy().getBkCounts(recordSet,id,fromDate,toDate);
} else if (fieldName.equals("qqts")) {//缺勤天数
String companystartdate = Util.null2String(rs.getString("companystartdate"));
String companyenddate = getCompanyEndDate(recordSet,id);
// String companystartdate = "2023-04-12";
// String companyenddate = "2023-04-20";
//判断入职日期、离职日期是否在选择范围中
UtilKQXcy utilKQXcy = new UtilKQXcy();
WorkDayDao workDayDao = new WorkDayDao();
List workDays = new ArrayList();
int absenteeism = Util.getIntValue(rs.getInt("absenteeism"));
if (companystartdate.length() > 0) {
boolean startFlag = utilKQXcy.isRangeOfDate(fromDate,toDate,companystartdate);
if (startFlag) {//缺勤天数加上 月初到入职日期的工作日
workDays = workDayDao.getWorkDays(fromDate,companystartdate,id);
absenteeism = absenteeism + workDays.size();
}
}
if (companyenddate.length()>0) {
boolean endFlag = utilKQXcy.isRangeOfDate(fromDate, toDate, companyenddate);
if (endFlag) {//缺勤天数加上 离职日期到月末的工作日
workDays = workDayDao.getWorkDays(companyenddate, toDate, id);
absenteeism = absenteeism + workDays.size();
}
}
fieldValue = String.valueOf(absenteeism);
} else if (fieldName.equals("yearPersonalLeave")) {//年累计事假天数
String yearLeaveData = Util.null2String(flowData.get(id + "|leaveType_all_6"));//原事假天数
//以防止出现精度问题
if (yearLeaveData.length() == 0) {
yearLeaveData = "0.0";
}
fieldValue = KQDurationCalculatorUtil.getDurationRound(yearLeaveData);
} else if (fieldName.equals("yearabsenteeism")) {//年累计旷工天数
String begDate = fromDate.substring(0,4)+"-01-01";
String yearAbsenteeismSql = "select b.resourceid,sum(b.absenteeism) AS yearabsenteeism from hrmresource a, kq_format_total b where a.id= b.resourceid and " +
"b.kqdate >= '"+begDate+"' and b.kqdate <='"+toDate+"' and a.id="+id+" group by b.resourceid";
recordSet.executeQuery(yearAbsenteeismSql);
String yearAbsenteeism = "";
if (recordSet.next()) {
yearAbsenteeism = Util.null2String(recordSet.getString("yearabsenteeism"));
}
fieldValue = yearAbsenteeism.length() == 0 ? "0" : yearAbsenteeism ;
} else {
fieldValue = Util.null2String(rs.getString(fieldName));
if (Util.null2String(kqReportFieldComInfo.getUnittype()).length() > 0) {
@ -702,33 +631,6 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
return lsChildColumns;
}
// 考勤汇总报表中夜班次数
private String getMonthYBCS (RecordSet rs,String fromDate,String toDate,String resourceId,String serialIds) {
String count = "0";
String sql = "select count(1) ybcs from kq_format_detail where kqdate >= '"+fromDate+"' and kqdate <='"+toDate+"' and resourceid='"+resourceId+"' and serialid in ("+serialIds+")";
String sqlWhere = "";
if (rs.getDBType().equalsIgnoreCase("oracle")) {
sqlWhere = " and nvl(signindate,'')!='' and nvl(signintime,'')!='' and nvl(signoutdate,'') != '' and nvl(signouttime,'') !=''";
} else {
sqlWhere = " and IFNULL(signindate,'')!='' and IFNULL(signintime,'')!='' and IFNULL(signoutdate,'') != '' and IFNULL(signouttime,'') !=''";
}
rs.execute(sql+sqlWhere);
if (rs.next()) {
count = Util.null2String(rs.getString("ybcs"));
}
return count;
}
// 获取人员离职日期
private String getCompanyEndDate (RecordSet rs,String resourceId) {
String sql = "select changedate from hrmstatushistory a where TYPE_N=5 and RESOURCEID=?";
rs.executeQuery(sql,resourceId);
if (rs.next()) {
return Util.null2String(rs.getString("changedate"));
}
return "";
}
@Override
public BizLogContext getLogContext() {
return null;

@ -1,78 +0,0 @@
package com.engine.kq.util;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @Author ml
* @Date 2023/4/24
* @Description
* @Since version-1.0
*/
public class UtilKQXcy extends BaseBean {
// 补卡流程
private static final String bkWorkFlowMainTable = new BaseBean().getPropValue("xcy_kq", "xcy_kq_bk_mainTab");
private static final String bkWorkFlowDetTable = new BaseBean().getPropValue("xcy_kq", "xcy_kq_bk_detailTab");
/**
*
* @return String
*/
public String getCompanyEndDate (RecordSet rs,String resourceId) {
String sql = "select changedate from hrmstatushistory a where TYPE_N=5 and RESOURCEID=?";
rs.executeQuery(sql,resourceId);
if (rs.next()) {
return Util.null2String(rs.getString("changedate"));
}
return "";
}
/**
*
* @return boolean
*/
public boolean isRangeOfDate (String begDate, String endDate, String targetDate) {
SimpleDateFormat simpleDateFormat =new SimpleDateFormat("yyyy-MM-dd");
try {
Date date1 = simpleDateFormat.parse(begDate);
Date date2 = simpleDateFormat.parse(endDate);
Date date3 = simpleDateFormat.parse(targetDate);
if(date1.getTime()<=date3.getTime() && date2.getTime()>=date3.getTime()){
System.out.println("date3在date1和date2日期范围内");
return true;
}
} catch (ParseException e) {
throw new RuntimeException(e);
}
return false;
}
// 获取人员补卡次数
public String getBkCounts (RecordSet rs,String resourceId,String fromDate,String toDate) {
String sql = "SELECT userid,signfrom FROM HRMRESOURCE a,\n" +
"HrmScheduleSign b WHERE a.id=b.USERID AND a.id ='"+resourceId+"' AND signdate >= '"+fromDate+"' AND signdate <= '"+toDate+"'";
rs.execute(sql);
RecordSet recordSet = new RecordSet();
int count = 0;
while (rs.next()) {
String signfrom = Util.null2String(rs.getString("signfrom"));
if (signfrom.contains("card")) {
String signfrom1 = signfrom.substring(signfrom.indexOf("|",signfrom.indexOf("|") + 1) + 1);
String signfrom2 = signfrom1.substring(signfrom1.indexOf("|",signfrom1.indexOf("|") + 1) + 1);
String requestId = signfrom2.substring(0,signfrom2.indexOf("|"));
recordSet.execute("SELECT count(1) counts FROM "+bkWorkFlowMainTable+" a,"+bkWorkFlowDetTable+" b WHERE a.ID =b.MAINID AND a.REQUESTID = '"+requestId+"' AND bkyy='0'");
if (recordSet.next()) {
count = count + Integer.parseInt(recordSet.getString("counts"));
}
}
}
return String.valueOf(count);
}
}

@ -1,90 +0,0 @@
package com.engine.xcy.cmd;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.KQGroupMemberComInfo;
import com.engine.kq.biz.KQOvertimeRulesBiz;
import com.engine.kq.biz.KQWorkTime;
import com.engine.kq.entity.WorkTimeEntity;
import com.engine.kq.enums.DurationTypeEnum;
import com.engine.kq.util.KQDurationCalculatorUtil;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import java.util.HashMap;
import java.util.Map;
public class GetOverTimeWorkDurationXcyCmd extends AbstractCommonCommand<Map<String, Object>> {
public GetOverTimeWorkDurationXcyCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> retmap = new HashMap<String, Object>();
RecordSet rs = new RecordSet();
String sql = "";
try{
String resourceId = Util.null2String(params.get("resourceId"));
String fromDate = Util.null2String(params.get("fromDate"));
String toDate = Util.null2String(params.get("toDate"));
String fromTime = Util.null2String(params.get("fromTime"));
String toTime = Util.null2String(params.get("toTime"));
String overtime_type = Util.null2String(params.get("overtime_type"));
String timestamp = Util.null2String(params.get("timestamp"));
int minimumUnit = KQOvertimeRulesBiz.getMinimumUnit();
//
KQWorkTime kqWorkTime = new KQWorkTime();
WorkTimeEntity kqWorkTimeEntity = kqWorkTime.getWorkTime(resourceId,fromDate);
if(kqWorkTimeEntity != null){
String kqType = Util.null2String(kqWorkTimeEntity.getKQType());
if("3".equalsIgnoreCase(kqType)){
writeLog("自由班制不计算加班");
retmap.put("status", "1");
retmap.put("message", ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005330,weaver.general.ThreadVarLanguage.getLang())+"");
return retmap;
}
}
ResourceComInfo rci = new ResourceComInfo();
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
String groupid = kqGroupMemberComInfo.getKQGroupId(resourceId,fromDate);
if(resourceId.length() > 0 && groupid.length() == 0){
retmap.put("status", "-1");
retmap.put("message", rci.getLastname(resourceId)+","+fromDate+""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005329,weaver.general.ThreadVarLanguage.getLang())+"");
return retmap;
}
//加班默认是工作日加班
KQDurationCalculatorUtil kqDurationCalculatorUtil =new KQDurationCalculatorUtil.DurationParamBuilder(resourceId).
fromDateParam(fromDate).toDateParam(toDate).fromTimeParam(fromTime).toTimeParam(toTime).computingModeParam("1").
durationRuleParam(minimumUnit+"").durationTypeEnumParam(DurationTypeEnum.OVERTIME).
overtime_typeParam(overtime_type).build();
Map<String,Object> durationMap = kqDurationCalculatorUtil.getWorkDuration();
retmap.put("duration", Util.null2String(durationMap.get("min_duration")));
retmap.put("timestamp", timestamp);
retmap.put("status", "1");
}catch (Exception e) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
writeLog(e);
}
return retmap;
}
@Override
public BizLogContext getLogContext() {
return null;
}
}

@ -1,20 +0,0 @@
package com.engine.xcy.service;
import weaver.hrm.User;
import java.util.Map;
/**
* ajax
*/
public interface KQXCYService {
/**
*
* @param params
* @param user
* @return
*/
public Map<String, Object> getOverTimeDuration(Map<String, Object> params, User user);
}

@ -1,16 +0,0 @@
package com.engine.xcy.service.impl;
import com.engine.core.impl.Service;
import com.engine.xcy.cmd.GetOverTimeWorkDurationXcyCmd;
import com.engine.xcy.service.KQXCYService;
import weaver.hrm.User;
import java.util.Map;
public class KQXCYServiceImpl extends Service implements KQXCYService {
@Override
public Map<String, Object> getOverTimeDuration(Map<String, Object> params, User user) {
return commandExecutor.execute(new GetOverTimeWorkDurationXcyCmd(params, user));
}
}

@ -1,51 +0,0 @@
package com.engine.xcy.web;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.xcy.service.KQXCYService;
import com.engine.xcy.service.impl.KQXCYServiceImpl;
import weaver.general.BaseBean;
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;
public class KQXCYAction {
private final BaseBean logger = new BaseBean();
private KQXCYService getService(User user) {
return (KQXCYServiceImpl) ServiceUtil.getService(KQXCYServiceImpl.class, user);
}
/**
*
* @param request
* @param response
* @return
*/
@POST
@Path("/getOverTimeDurationXcy")
@Produces(MediaType.TEXT_PLAIN)
public String getOverTimeDuration(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> apidatas = new HashMap<String, Object>();
try {
User user = HrmUserVarify.getUser (request , response) ;
// 调用新创元处理逻辑
apidatas = getService(user).getOverTimeDuration(ParamUtil.request2Map(request), user);
} catch (Exception e) {
apidatas.put("status", "-1");
logger.writeLog(e);
}
return JSONObject.toJSONString(apidatas);
}
}
Loading…
Cancel
Save