From c88249211ac0979019d8e491688d4832d375c190 Mon Sep 17 00:00:00 2001 From: sy Date: Fri, 15 Mar 2024 16:37:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E5=8B=A4-=E5=87=BA=E5=B7=AE=E6=92=A4?= =?UTF-8?q?=E9=94=80=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflow/BusinessTripsApplyActionApi.java | 14 +++ .../workflow/action/RevokeLeaveAction.java | 88 ++++++++++++++ .../cmd/GetBusinessTripsApplyListCmd.java | 109 ++++++++++++++++++ .../service/BusinessTripsApplyService.java | 7 ++ .../impl/BusinessTripsApplyServiceImpl.java | 19 +++ .../workflow/web/BusinessTripsApplyApi.java | 48 ++++++++ 6 files changed, 285 insertions(+) create mode 100644 src/com/api/attendance/workflow/BusinessTripsApplyActionApi.java create mode 100644 src/com/engine/attendance/workflow/action/RevokeLeaveAction.java create mode 100644 src/com/engine/attendance/workflow/cmd/GetBusinessTripsApplyListCmd.java create mode 100644 src/com/engine/attendance/workflow/service/BusinessTripsApplyService.java create mode 100644 src/com/engine/attendance/workflow/service/impl/BusinessTripsApplyServiceImpl.java create mode 100644 src/com/engine/attendance/workflow/web/BusinessTripsApplyApi.java diff --git a/src/com/api/attendance/workflow/BusinessTripsApplyActionApi.java b/src/com/api/attendance/workflow/BusinessTripsApplyActionApi.java new file mode 100644 index 0000000..792440d --- /dev/null +++ b/src/com/api/attendance/workflow/BusinessTripsApplyActionApi.java @@ -0,0 +1,14 @@ +package com.api.attendance.workflow; + +import com.engine.attendance.workflow.web.BusinessTripsApplyApi; + +import javax.ws.rs.Path; + +/** + * @Author: sy + * @Description: 出差申请相关api + * @Date: 2024/3/15 + **/ +@Path("/attendance/businesstripsapply") +public class BusinessTripsApplyActionApi extends BusinessTripsApplyApi { +} diff --git a/src/com/engine/attendance/workflow/action/RevokeLeaveAction.java b/src/com/engine/attendance/workflow/action/RevokeLeaveAction.java new file mode 100644 index 0000000..edde7e0 --- /dev/null +++ b/src/com/engine/attendance/workflow/action/RevokeLeaveAction.java @@ -0,0 +1,88 @@ +package com.engine.attendance.workflow.action; + +import com.engine.jucailin.util.DbTools; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import weaver.general.Util; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.*; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Author: sy + * @Description: 撤销请假 + * @Date: 2024/3/15 + **/ +@Slf4j +public class RevokeLeaveAction implements Action { + + @Override + public String execute(RequestInfo requestInfo) { + log.info("RevokeLeaveAction,do action on request:" + requestInfo.getRequestid()); + String requestid = requestInfo.getRequestid(); + try { + +// Property[] property = requestInfo.getMainTableInfo().getProperty(); +// User user = requestInfo.getRequestManager().getUser(); +// for (Property pro : property) { +// String name = Util.null2String(pro.getName()); +// if(name.equals("cxsm")){ +// +// } +// } + + DetailTable[] detailTable = requestInfo.getDetailTableInfo().getDetailTable(); + List> updateList = new ArrayList<>(); + if (detailTable.length > 0) { + for (DetailTable dt : detailTable) { + //明细表 + Row[] s = dt.getRow(); + for (Row r : s) { + //行 + Cell[] h = r.getCell(); + for (Cell c : h) { + //列 + Map itemMap = new HashMap<>(); + String name = Util.null2String(c.getName()); + if ("cxsm".equals(name)) { + itemMap.put("cxsm", Util.null2String(c.getValue())); + } else if ("cxlyid".equals(name)) { + itemMap.put("cxlyid", Util.null2String(c.getValue())); + updateList.add(itemMap); + } + } + } + } + } + if (updateList.size() > 0) { + updateList.forEach(f -> { + if (StringUtils.isNotBlank(f.get("cxlyid"))) { + String sql = "update uf_jcl_kq_ccjl_dt1" +" set "+"cxly=0,cxcc=1,cxsm=?,cxid=? where id = ?"; + log.info("RevokeLeaveAction sql : [{}]",sql); + DbTools.update(sql, Util.null2String(f.get("cxsm")), requestid, f.get("cxlyid")); + log.info("RevokeLeaveAction cxsm : {}, requestid : {}, cxlyid : {}",Util.null2String(f.get("cxsm")), requestid, f.get("cxlyid")); + } + }); + } + + } catch (Exception e) { + log.info("流程数据报错:RevokeLeaveAction:"); + StringWriter errorsWriter = new StringWriter(); + e.printStackTrace(new PrintWriter(errorsWriter)); + log.info(errorsWriter.toString()); + requestInfo.getRequestManager().setMessageid("11111" + requestInfo.getRequestid() + "22222"); + requestInfo.getRequestManager().setMessagecontent("【考勤报表统计action】报错,请联系管理员!"); + return Action.FAILURE_AND_CONTINUE; + } + + return SUCCESS; + + + } +} diff --git a/src/com/engine/attendance/workflow/cmd/GetBusinessTripsApplyListCmd.java b/src/com/engine/attendance/workflow/cmd/GetBusinessTripsApplyListCmd.java new file mode 100644 index 0000000..6bbe7f9 --- /dev/null +++ b/src/com/engine/attendance/workflow/cmd/GetBusinessTripsApplyListCmd.java @@ -0,0 +1,109 @@ +package com.engine.attendance.workflow.cmd; + +import com.cloudstore.eccom.constant.WeaBoolAttr; +import com.cloudstore.eccom.pc.table.WeaTable; +import com.cloudstore.eccom.pc.table.WeaTableColumn; +import com.cloudstore.eccom.result.WeaResultMsg; +import com.engine.common.biz.AbstractCommonCommand; +import com.engine.common.entity.BizLogContext; +import com.engine.core.interceptor.CommandContext; +import com.engine.jucailin.util.DbTools; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.systeminfo.SystemEnv; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Author: sy + * @Description: 出差申请列表 + * @Date: 2024/3/15 + **/ +public class GetBusinessTripsApplyListCmd extends AbstractCommonCommand> { + + public GetBusinessTripsApplyListCmd(Map params, User user){ + this.user = user; + this.params = params; + } + + @Override + public BizLogContext getLogContext() { + return null; + } + + @Override + public Map execute(CommandContext commandContext) { + Map retmap = new HashMap(); + + //获取主表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")); + + 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 maidList = new ArrayList<>(); + if (!targetUserId.equals("")) { + List> datas = DbTools.getSqlToList(sql); + if (datas.size() > 0) { + datas.forEach(f -> { + maidList.add(f.get("id")); + }); + } + } + + String backFields = "a.id,a.calendar_name,a.default_calendar,a.calendar_desc"; + String sqlFrom = " uf_jcl_kq_ccjl_dt1 a"; + String sqlWhere = " where 1=1"; + if (maidList.size() > 0) { + sqlWhere = sqlWhere+ " and mainid in ("+String.join(",",maidList)+")"; + } + String orderby = " id "; + String tableString = ""; + +// String pageId = PageUidFactory.getHrmPageUid("KQCalendarSettingList"); + WeaTable table = new WeaTable(); +// table.setPageID(pageId); +// table.setPageUID(pageId + "_" + user.getUID()); +// String pageSize = PageIdConst.getPageSize(pageId, user.getUID()); + table.setPagesize("10"); + + table.setBackfields(backFields); + table.setSqlform(sqlFrom); + table.setSqlwhere(sqlWhere); + table.setSqlprimarykey("id"); + table.setSqlorderby("id"); +// table.getColumns().addAll(tableFields()); + + WeaResultMsg result = new WeaResultMsg(false); + if (maidList.size() > 0) { + result.putAll(table.makeDataResult()); + } + result.success(); + retmap.putAll(result.getResultMap()); + + return retmap; + } + /** + * 构建表格字段 + */ + private List tableFields() { + return new ArrayList() {{ + add(new WeaTableColumn("id").setDisplay(WeaBoolAttr.FALSE)); + add(new WeaTableColumn("10%", SystemEnv.getHtmlLabelName(000000, user.getLanguage()), "xxxxxxx"));// + }}; + } + +} diff --git a/src/com/engine/attendance/workflow/service/BusinessTripsApplyService.java b/src/com/engine/attendance/workflow/service/BusinessTripsApplyService.java new file mode 100644 index 0000000..c48d832 --- /dev/null +++ b/src/com/engine/attendance/workflow/service/BusinessTripsApplyService.java @@ -0,0 +1,7 @@ +package com.engine.attendance.workflow.service; + +import java.util.Map; + +public interface BusinessTripsApplyService { + Map getBusinessTripsApplyList(Map params); +} diff --git a/src/com/engine/attendance/workflow/service/impl/BusinessTripsApplyServiceImpl.java b/src/com/engine/attendance/workflow/service/impl/BusinessTripsApplyServiceImpl.java new file mode 100644 index 0000000..9e9c569 --- /dev/null +++ b/src/com/engine/attendance/workflow/service/impl/BusinessTripsApplyServiceImpl.java @@ -0,0 +1,19 @@ +package com.engine.attendance.workflow.service.impl; + +import com.engine.attendance.workflow.service.BusinessTripsApplyService; +import com.engine.core.impl.Service; + +import java.util.Map; + +/** + * @Author: sy + * @Description: 出差申请 + * @Date: 2024/3/15 + **/ +public class BusinessTripsApplyServiceImpl extends Service implements BusinessTripsApplyService { + @Override + public Map getBusinessTripsApplyList(Map params) { + + return null; + } +} diff --git a/src/com/engine/attendance/workflow/web/BusinessTripsApplyApi.java b/src/com/engine/attendance/workflow/web/BusinessTripsApplyApi.java new file mode 100644 index 0000000..af284c8 --- /dev/null +++ b/src/com/engine/attendance/workflow/web/BusinessTripsApplyApi.java @@ -0,0 +1,48 @@ +package com.engine.attendance.workflow.web; + +import com.engine.attendance.workflow.service.BusinessTripsApplyService; +import com.engine.attendance.workflow.service.impl.BusinessTripsApplyServiceImpl; +import com.engine.common.util.ParamUtil; +import com.engine.common.util.ServiceUtil; +import com.engine.jucailin.service.KQCalendarSettingService; +import com.engine.jucailin.service.impl.KQCalendarSettingServiceImpl; +import com.engine.jucailin.util.ResponseResult; +import lombok.extern.slf4j.Slf4j; +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.Map; + +/** + * @Author: sy + * @Description: 出差申请 + * @Date: 2024/3/15 + **/ +@Slf4j +public class BusinessTripsApplyApi { + private BusinessTripsApplyService getBusinessTripsApplyService(User user) { + return ServiceUtil.getService(BusinessTripsApplyServiceImpl.class,user); + } + /** + * 出差申请列表 + * @param request + * @param response + * @return + */ + @GET + @Path("/getBusinessTripsApplyList") + @Produces(MediaType.APPLICATION_JSON) + public String getBusinessTripsApplyList(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + Map param = ParamUtil.request2Map(request); + return new ResponseResult, Map>(user).run(getBusinessTripsApplyService(user) :: getBusinessTripsApplyList,param); + } + +}