liuliang 1 year ago
commit 65366e6dfa

@ -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 {
}

@ -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<Map<String, String>> 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<String, String> 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;
}
}

@ -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<Map<String, Object>> {
public GetBusinessTripsApplyListCmd(Map<String, Object> params, User user){
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
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"));
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,String>> 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<WeaTableColumn> tableFields() {
return new ArrayList<WeaTableColumn>() {{
add(new WeaTableColumn("id").setDisplay(WeaBoolAttr.FALSE));
add(new WeaTableColumn("10%", SystemEnv.getHtmlLabelName(000000, user.getLanguage()), "xxxxxxx"));//
}};
}
}

@ -0,0 +1,7 @@
package com.engine.attendance.workflow.service;
import java.util.Map;
public interface BusinessTripsApplyService {
Map<String, Object> getBusinessTripsApplyList(Map<String, Object> params);
}

@ -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<String, Object> getBusinessTripsApplyList(Map<String, Object> params) {
return null;
}
}

@ -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<String,Object> param = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getBusinessTripsApplyService(user) :: getBusinessTripsApplyList,param);
}
}
Loading…
Cancel
Save