考勤,出差申请明细列表查询接口结果返回优化

zm_dev
sy 1 year ago
parent 4ea06e68ca
commit ae3baba0fb

@ -77,7 +77,7 @@ public class RevokeLeaveAction implements Action {
e.printStackTrace(new PrintWriter(errorsWriter));
log.info(errorsWriter.toString());
requestInfo.getRequestManager().setMessageid("11111" + requestInfo.getRequestid() + "22222");
requestInfo.getRequestManager().setMessagecontent("【考勤报表统计action】报错请联系管理员");
requestInfo.getRequestManager().setMessagecontent("【撤销请假更改请假撤销状态action】报错请联系管理员");
return Action.FAILURE_AND_CONTINUE;
}

@ -1,9 +1,14 @@
package com.engine.attendance.workflow.service.impl;
import com.engine.attendance.workflow.cmd.GetBusinessTripsApplyListCmd;
import com.engine.attendance.workflow.service.BusinessTripsApplyService;
import com.engine.common.util.DbTools;
import com.engine.core.impl.Service;
import lombok.extern.slf4j.Slf4j;
import weaver.general.Util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -11,10 +16,52 @@ import java.util.Map;
* @Description:
* @Date: 2024/3/15
**/
@Slf4j
public class BusinessTripsApplyServiceImpl extends Service implements BusinessTripsApplyService {
@Override
public Map<String, Object> getBusinessTripsApplyList(Map<String, Object> params) {
return commandExecutor.execute(new GetBusinessTripsApplyListCmd(params, user));
// return commandExecutor.execute(new GetBusinessTripsApplyListCmd(params, user));
Map<String, Object> retmap = new HashMap<String, Object>();
//获取主表id列表
String targetUserId = Util.null2String(params.get("targetUserId"));
String businessTripsType = Util.null2String(params.get("businessTripsType"));
String startDate = Util.null2String(params.get("startDate"));
String endDate = Util.null2String(params.get("endDate"));
log.info("targetUserId : {}, businessTripsType : {}, startDate : {}, endDate : {}",targetUserId, businessTripsType, startDate, endDate);
String sql = "select * from uf_jcl_kq_ccjl where ccr="+targetUserId;
if (!businessTripsType.equals("")) {
sql += "and cclx = " + businessTripsType;
}
if (!startDate.equals("")) {
sql += "and ksrq >= " + startDate;
}
if (!endDate.equals("")) {
sql += "and jsrq <= " + endDate;
}
List<String> maidList = new ArrayList<>();
if (!targetUserId.equals("")) {
List<Map<String,Object>> datas = DbTools.getSqlToList(sql);
if (datas.size() > 0) {
datas.forEach(f -> {
maidList.add(f.get("id").toString());
});
}
}
log.info("maidList : [{}]",maidList);
//查询子表数据
if (maidList.size() > 0) {
String detailSql = "select a.id,a.cxcc,a.ksrq,a.kssj,a.jsrq,a.jssj,a.ccsc,a.qtcc,a.btcc,a.cxsm from uf_jcl_kq_ccjl_dt1 a where mainid in ("+String.join(",",maidList)+")";
List<Map<String,Object>> detailList = DbTools.getSqlToList(detailSql);
if (detailList.size() > 0) {
retmap.put("result", detailList);
} else {
retmap.put("result", null);
}
log.info("detailList : [{}]",detailList);
} else {
retmap.put("result", null);
}
return retmap;
}
}

Loading…
Cancel
Save