Compare commits
22 Commits
Author | SHA1 | Date |
---|---|---|
|
51b5daad19 | 9 months ago |
|
ef966cdb7c | 9 months ago |
|
e972f4c456 | 9 months ago |
|
83cd3e4265 | 9 months ago |
|
615a324f47 | 9 months ago |
|
41436e3e81 | 9 months ago |
|
75a145fbb9 | 10 months ago |
|
8075137807 | 2 years ago |
|
b11dab66cf | 2 years ago |
|
7e7df74b13 | 2 years ago |
|
c9cac990ef | 2 years ago |
|
60daad516f | 2 years ago |
|
245e800a29 | 2 years ago |
|
f71da2b364 | 2 years ago |
|
5b0f51fc5e | 2 years ago |
|
c0375840b4 | 2 years ago |
|
43dd33d0a2 | 2 years ago |
|
fbf3a9eb53 | 2 years ago |
|
2cba1b8467 | 2 years ago |
|
e9b8e62287 | 2 years ago |
|
f2c4df3e32 | 2 years ago |
|
e7e695b05f | 2 years ago |
@ -1,13 +0,0 @@
|
||||
package com.api.jygf.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Path("/mobile/permission")
|
||||
public class MobilePermissionsAction extends com.engine.jygf.web.MobilePermissionsAction {
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.api.kr.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/05/18
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Path("/kangrui/kq/interactive")
|
||||
public class KqInteractiveController extends com.engine.kr.web.KqInteractiveController{
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
package com.engine.jygf.cmd;
|
||||
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.User;
|
||||
import weaver.wechat.util.Utils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class MobilePermissionsCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
private static final String FIELDID = "field100026"; //移动电话自定义字段
|
||||
|
||||
private static final String SCOPE = "HrmCustomFieldByInfoType";
|
||||
|
||||
private static final String SCOPEID = "-1";
|
||||
|
||||
public MobilePermissionsCmd(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> data = new HashMap<>();
|
||||
String uid = Utils.null2String(user.getUID());
|
||||
RecordSet rs = new RecordSet();
|
||||
HashSet<String> ids = new HashSet<>();
|
||||
ids.add(uid);
|
||||
rs.executeQuery("select ckr,bckr from uf_yddhqx_dt1");
|
||||
while (rs.next()) {
|
||||
String ckr = Utils.null2String(rs.getString("ckr"));
|
||||
String bckr = Utils.null2String(rs.getString("bckr"));
|
||||
if (Arrays.asList(ckr.split(",")).contains(uid)) {
|
||||
ids.addAll(Arrays.asList(bckr.split(",")));
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,String> mobileInfo = new HashMap<>();
|
||||
String value = StringUtils.join(ids,",");
|
||||
rs.executeQuery("select id,"+FIELDID+" from cus_fielddata where scope = ? and scopeid = ?" +
|
||||
" and id in ("+value+")",SCOPE,SCOPEID);
|
||||
while (rs.next()){
|
||||
mobileInfo.put(Utils.null2String(rs.getString("id")),rs.getString(FIELDID));
|
||||
}
|
||||
|
||||
data.put("ids",ids);
|
||||
data.put("mobileInfo",mobileInfo);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package com.engine.jygf.service;
|
||||
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public interface MobilePermissionsService {
|
||||
|
||||
Map<String, Object> getPermissionInfo(Map<String, Object> params, User user);
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package com.engine.jygf.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.jygf.cmd.MobilePermissionsCmd;
|
||||
import com.engine.jygf.service.MobilePermissionsService;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class MobilePermissionsServiceImpl extends Service implements MobilePermissionsService {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getPermissionInfo(Map<String, Object> params, User user) {
|
||||
return commandExecutor.execute(new MobilePermissionsCmd(params,user));
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
package com.engine.jygf.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.jygf.service.MobilePermissionsService;
|
||||
import com.engine.jygf.service.impl.MobilePermissionsServiceImpl;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class MobilePermissionsAction {
|
||||
|
||||
public MobilePermissionsService getMobilePermissionsService(User user) {
|
||||
return ServiceUtil.getService(MobilePermissionsServiceImpl.class,user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 晶优光伏 移动电话通过建模控制权限 通讯录显示
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/controller")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getPermissionInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
//实例化Service 并调用业务类处理
|
||||
apidatas = getMobilePermissionsService(user).getPermissionInfo(ParamUtil.request2Map(request), user);
|
||||
} catch (Exception e) {
|
||||
//异常处理
|
||||
apidatas.put("api_status", false);
|
||||
}
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package com.engine.kr.entity.kq;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 加班流程转换类
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/05/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class KqActionBO {
|
||||
|
||||
/**
|
||||
* 根据人员ID获取人员名称
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public static String getUserName(String userId) {
|
||||
String userName = "";
|
||||
if (StringUtils.isBlank(userId)) {
|
||||
return userName;
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select lastname from hrmresource where id = ? ", userId);
|
||||
if (rs.next()) {
|
||||
userName = rs.getString("lastname");
|
||||
}
|
||||
return userName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据人员ID获取人员工号
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public static String getWorkCode(String userId) {
|
||||
String workCode = "";
|
||||
if (StringUtils.isBlank(userId)) {
|
||||
return workCode;
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select workcode from hrmresource where id = ? ", userId);
|
||||
if (rs.next()) {
|
||||
workCode = rs.getString("workcode");
|
||||
}
|
||||
return workCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请假类型代码
|
||||
*
|
||||
* @param leaveType 流程请假类型
|
||||
* @return 请假类型代码
|
||||
*/
|
||||
public static String getLeaveTypeCode(String leaveType) {
|
||||
String leaveTypeCode = "";
|
||||
if (StringUtils.isBlank(leaveType)) {
|
||||
return leaveTypeCode;
|
||||
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select kqxtzdz from uf_jqzdpp where lczd =?", leaveType);
|
||||
if (rs.next()) {
|
||||
leaveTypeCode = rs.getString("kqxtzdz");
|
||||
}
|
||||
return leaveTypeCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取加班类型
|
||||
*
|
||||
* @param workType 流程加班类型
|
||||
* @return 加班类型代码
|
||||
*/
|
||||
public static String getWorkTypeCode(String workType) {
|
||||
String workTypeCode = "";
|
||||
if (StringUtils.isBlank(workType)) {
|
||||
return workTypeCode;
|
||||
}
|
||||
switch (workType) {
|
||||
case "0":
|
||||
workTypeCode = "JB01";
|
||||
break;
|
||||
case "1":
|
||||
workTypeCode = "JB02";
|
||||
break;
|
||||
case "2":
|
||||
workTypeCode = "JB03";
|
||||
break;
|
||||
case "3":
|
||||
workTypeCode = "JB20";
|
||||
break;
|
||||
case "4":
|
||||
workTypeCode = "JB30";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return workTypeCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程创建、最后操作时间
|
||||
*
|
||||
* @param requestId
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, String> getOperateDateTime(String requestId) {
|
||||
Map<String, String> map = new HashMap<>(2);
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select createdate,createtime,lastoperatedate,lastoperatetime from workflow_requestbase where requestid = ? ", requestId);
|
||||
if (rs.next()) {
|
||||
String createdate = rs.getString("createdate");
|
||||
String createtime = rs.getString("createtime");
|
||||
String lastoperatedate = rs.getString("lastoperatedate");
|
||||
String lastoperatetime = rs.getString("lastoperatetime");
|
||||
map.put("addDay", createdate + " " + createtime);
|
||||
map.put("cfmDay", lastoperatedate + " " + lastoperatetime);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.engine.kr.entity.sync;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/20
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class KqOrgData {
|
||||
private String dptprcno;
|
||||
private String dptno;
|
||||
private String dptname;
|
||||
private String isdelete;
|
||||
private String dptsysid;
|
||||
|
||||
private String parentNo;
|
||||
|
||||
private String subCompanyId;
|
||||
|
||||
private String oaId;
|
||||
|
||||
public String getSubCompanyId() {
|
||||
return subCompanyId;
|
||||
}
|
||||
|
||||
public void setSubCompanyId(String subCompanyId) {
|
||||
this.subCompanyId = subCompanyId;
|
||||
}
|
||||
|
||||
public String getOaId() {
|
||||
return oaId;
|
||||
}
|
||||
|
||||
public void setOaId(String oaId) {
|
||||
this.oaId = oaId;
|
||||
}
|
||||
|
||||
public String getParentNo() {
|
||||
if (StringUtils.isNotBlank(dptprcno) && dptprcno.length() > 3) {
|
||||
return dptprcno.substring(0, dptprcno.length() - 3);
|
||||
}
|
||||
return parentNo;
|
||||
}
|
||||
|
||||
public String getDptprcno() {
|
||||
return dptprcno;
|
||||
}
|
||||
|
||||
public void setDptprcno(String dptprcno) {
|
||||
this.dptprcno = dptprcno;
|
||||
}
|
||||
|
||||
public String getDptno() {
|
||||
return dptno;
|
||||
}
|
||||
|
||||
public void setDptno(String dptno) {
|
||||
this.dptno = dptno;
|
||||
}
|
||||
|
||||
public String getDptname() {
|
||||
return dptname;
|
||||
}
|
||||
|
||||
public void setDptname(String dptname) {
|
||||
this.dptname = dptname;
|
||||
}
|
||||
|
||||
/**
|
||||
* N 未封存
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getIsdelete() {
|
||||
if ("Y".equalsIgnoreCase(isdelete)) {
|
||||
return "1";
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
public void setIsdelete(String isdelete) {
|
||||
this.isdelete = isdelete;
|
||||
}
|
||||
|
||||
public String getDptsysid() {
|
||||
return dptsysid;
|
||||
}
|
||||
|
||||
public void setDptsysid(String dptsysid) {
|
||||
this.dptsysid = dptsysid;
|
||||
}
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
package com.engine.kr.entity.sync;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/20
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class KqResourceData {
|
||||
private String empno;
|
||||
private String empname;
|
||||
private String empsexid;
|
||||
private String empstatusid;
|
||||
private String dptsysid;
|
||||
private String empbirthday;
|
||||
private String empidno;
|
||||
private String empgrpdate;
|
||||
private String empnormaldate;
|
||||
private String empleavedate;
|
||||
private String empmobile;
|
||||
private String emplocaladdr;
|
||||
private String emphomeaddr;
|
||||
|
||||
|
||||
public String getEmpno() {
|
||||
return empno;
|
||||
}
|
||||
|
||||
public void setEmpno(String empno) {
|
||||
this.empno = empno;
|
||||
}
|
||||
|
||||
public String getEmpname() {
|
||||
return empname;
|
||||
}
|
||||
|
||||
public void setEmpname(String empname) {
|
||||
this.empname = empname;
|
||||
}
|
||||
|
||||
public String getEmpsexid() {
|
||||
if(StringUtils.isNotBlank(empsexid)){
|
||||
if("1".equals(empsexid)){
|
||||
return "0";
|
||||
}else if("2".equals(empsexid)){
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setEmpsexid(String empsexid) {
|
||||
this.empsexid = empsexid;
|
||||
}
|
||||
|
||||
public String getEmpstatusid() {
|
||||
if(StringUtils.isNotBlank(empstatusid)){
|
||||
if("20".equals(empstatusid)){
|
||||
return "1";
|
||||
}else if("30".equals(empstatusid)){
|
||||
return "5";
|
||||
}
|
||||
}
|
||||
return empstatusid;
|
||||
}
|
||||
|
||||
public void setEmpstatusid(String empstatusid) {
|
||||
this.empstatusid = empstatusid;
|
||||
}
|
||||
|
||||
public String getDptsysid() {
|
||||
return dptsysid;
|
||||
}
|
||||
|
||||
public void setDptsysid(String dptsysid) {
|
||||
this.dptsysid = dptsysid;
|
||||
}
|
||||
|
||||
public String getEmpbirthday() {
|
||||
if(StringUtils.isNotBlank(empbirthday)){
|
||||
return empbirthday.replace(" 00:00:00.0","");
|
||||
}
|
||||
return empbirthday;
|
||||
}
|
||||
|
||||
public void setEmpbirthday(String empbirthday) {
|
||||
this.empbirthday = empbirthday;
|
||||
}
|
||||
|
||||
public String getEmpidno() {
|
||||
return empidno;
|
||||
}
|
||||
|
||||
public void setEmpidno(String empidno) {
|
||||
this.empidno = empidno;
|
||||
}
|
||||
|
||||
public String getEmpgrpdate() {
|
||||
if(StringUtils.isNotBlank(empgrpdate)){
|
||||
return empgrpdate.replace(" 00:00:00.0","");
|
||||
}
|
||||
return empgrpdate;
|
||||
}
|
||||
|
||||
public void setEmpgrpdate(String empgrpdate) {
|
||||
this.empgrpdate = empgrpdate;
|
||||
}
|
||||
|
||||
public String getEmpnormaldate() {
|
||||
if(StringUtils.isNotBlank(empnormaldate)){
|
||||
return empnormaldate.replace(" 00:00:00.0","");
|
||||
}
|
||||
return empnormaldate;
|
||||
}
|
||||
|
||||
public void setEmpnormaldate(String empnormaldate) {
|
||||
this.empnormaldate = empnormaldate;
|
||||
}
|
||||
|
||||
public String getEmpleavedate() {
|
||||
if(StringUtils.isNotBlank(empleavedate)){
|
||||
return empleavedate.replace(" 00:00:00.0","");
|
||||
}
|
||||
return empleavedate;
|
||||
}
|
||||
|
||||
public void setEmpleavedate(String empleavedate) {
|
||||
this.empleavedate = empleavedate;
|
||||
}
|
||||
|
||||
public String getEmpmobile() {
|
||||
return empmobile;
|
||||
}
|
||||
|
||||
public void setEmpmobile(String empmobile) {
|
||||
this.empmobile = empmobile;
|
||||
}
|
||||
|
||||
public String getEmplocaladdr() {
|
||||
return emplocaladdr;
|
||||
}
|
||||
|
||||
public void setEmplocaladdr(String emplocaladdr) {
|
||||
this.emplocaladdr = emplocaladdr;
|
||||
}
|
||||
|
||||
public String getEmphomeaddr() {
|
||||
return emphomeaddr;
|
||||
}
|
||||
|
||||
public void setEmphomeaddr(String emphomeaddr) {
|
||||
this.emphomeaddr = emphomeaddr;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.engine.kr.enums;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/05/18
|
||||
* @version: 1.0
|
||||
*/
|
||||
public enum KqInteractiveEnum {
|
||||
/**
|
||||
* 获取token
|
||||
*/
|
||||
TOKEN("TOKEN", "/Person/getToken"),
|
||||
LEAVE_BAL("LEAVE_BAL", "/Person/iLeaveBal"),
|
||||
SIGN_CREATE("SIGN_CREATE", "/Person/iSignCreate"),
|
||||
OVERTIME_CREATE("OVERTIME_CREATE", "/Person/iOvertimeCreate"),
|
||||
LEAVE_CREATE("LEAVE_CREATE", "/Person/iLeaveCreate"),
|
||||
;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private final String name;
|
||||
/**
|
||||
* 请求路径
|
||||
*/
|
||||
private final String postPath;
|
||||
|
||||
KqInteractiveEnum(String name, String postPath) {
|
||||
this.name = name;
|
||||
this.postPath = postPath;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getPostPath() {
|
||||
return postPath;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.engine.kr.exception;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2023/2/21
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class CustomizeRunTimeException extends RuntimeException{
|
||||
|
||||
public CustomizeRunTimeException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public CustomizeRunTimeException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public CustomizeRunTimeException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.engine.kr.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/05/17
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface KqInteractiveService {
|
||||
|
||||
/**
|
||||
* 获取假期余额
|
||||
*
|
||||
* @param params 参数
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getLeaveBal(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 获取用户照片
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getUserImage(Map<String, Object> params);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.engine.kr.util;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2023/2/21
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class ExceptionUtil {
|
||||
public static String getRealMessage(Throwable e) {
|
||||
while (e != null) {
|
||||
Throwable cause = e.getCause();
|
||||
if (cause == null) {
|
||||
return e.getMessage();
|
||||
}
|
||||
e = cause;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.engine.kr.web;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.kr.service.KqInteractiveService;
|
||||
import com.engine.kr.service.impl.KqInteractiveServiceImpl;
|
||||
import com.engine.kr.util.ResponseResult;
|
||||
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.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.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/05/18
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class KqInteractiveController {
|
||||
public KqInteractiveService getService(User user) {
|
||||
return ServiceUtil.getService(KqInteractiveServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/getLeaveBal")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getLeaveBal(@Context HttpServletRequest request, @Context HttpServletResponse response, Map<String, Object> params) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getLeaveBal, params);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getUserImage")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getUserImage(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getUserImage, params);
|
||||
}
|
||||
}
|
@ -0,0 +1,468 @@
|
||||
package weaver.interfaces.kr.cornjob;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.engine.kr.entity.sync.KqOrgData;
|
||||
import com.engine.kr.entity.sync.KqResourceData;
|
||||
import com.engine.kr.exception.CustomizeRunTimeException;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.IgnoreCaseHashMap;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.interfaces.hrm.HrmServiceManager;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
import weaver.matrix.MatrixUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/19
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class SyncKqOrgDataJob extends BaseCronJob {
|
||||
private static final String COMPANY_TABLE = "hrmcompany";
|
||||
private static final String SUB_COMPANY_TABLE = "hrmsubcompany";
|
||||
private static final String DEPARTMENT_TABLE = "hrmdepartment";
|
||||
private static final String RESOURCE_TABLE = "hrmresource";
|
||||
|
||||
// 组织唯一代码
|
||||
Map<String, KqOrgData> sysIdMap = new HashMap<>();
|
||||
|
||||
private String syncType;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.writeLog("考勤组织信息同步任务开始");
|
||||
try {
|
||||
// 查询组织数据,排除外协
|
||||
rs.executeSqlWithDataSource("select dptprcno,dptno,dptname,isdelete,dptsysid from rs_dpt where dptname != '外协' ", "KAOQIN");
|
||||
List<KqOrgData> dataList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
// 获取考勤组织表的所有数据
|
||||
KqOrgData kqOrgData = new KqOrgData();
|
||||
kqOrgData.setDptprcno(rs.getString("dptprcno"));
|
||||
kqOrgData.setDptno(rs.getString("dptno"));
|
||||
kqOrgData.setDptname(rs.getString("dptname"));
|
||||
kqOrgData.setIsdelete(rs.getString("isdelete"));
|
||||
kqOrgData.setDptsysid(rs.getString("dptsysid"));
|
||||
dataList.add(kqOrgData);
|
||||
}
|
||||
// 完整编号、组织对象
|
||||
Map<String, KqOrgData> keyMap = dataList.stream().collect(Collectors.toMap(KqOrgData::getDptprcno, item -> item));
|
||||
|
||||
|
||||
// 上级编号 、 子元素集合
|
||||
Map<String, List<KqOrgData>> parentMap = dataList.stream().filter(item -> item.getParentNo() != null).collect(Collectors.groupingBy(KqOrgData::getParentNo));
|
||||
|
||||
// 集团
|
||||
KqOrgData companyData = keyMap.get("001");
|
||||
|
||||
String companyId = getCompanyId(rs);
|
||||
if (StringUtils.isBlank(companyId)) {
|
||||
throw new CustomizeRunTimeException("获取集团数据失败");
|
||||
}
|
||||
companyData.setOaId(companyId);
|
||||
sysIdMap.put(companyData.getDptsysid(), companyData);
|
||||
|
||||
// 分部数据
|
||||
List<KqOrgData> subCompanyList = parentMap.get(companyData.getDptprcno());
|
||||
for (KqOrgData subCompany : subCompanyList) {
|
||||
// 同步分部数据
|
||||
syncSubCompany(rs, subCompany, companyId);
|
||||
|
||||
// 处理该分部下的部门数据
|
||||
List<KqOrgData> departmentList = parentMap.get(subCompany.getDptprcno());
|
||||
if (CollectionUtils.isNotEmpty(departmentList)) {
|
||||
for (KqOrgData departmentData : departmentList) {
|
||||
dealDepartmentData(rs, departmentData, parentMap, subCompany.getOaId(), departmentData.getOaId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 按照指定时间 查询人员数据
|
||||
String sql = "select empno,empname,empsexid,empstatusid,dptsysid,empbirthday,empidno,empgrpdate,empnormaldate,empleavedate,empmobile,emplocaladdr,emphomeaddr from rs_emp ";
|
||||
if (!"all".equals(syncType)) {
|
||||
String currentDate = DateUtil.getCurrentDate();
|
||||
sql += "where empgrpdate = '" + currentDate + "' or empleavedate = '" + currentDate + "'";
|
||||
}
|
||||
rs.executeSqlWithDataSource(sql, "KAOQIN");
|
||||
List<KqResourceData> resourceList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
KqResourceData resourceData = new KqResourceData();
|
||||
resourceData.setEmpno(rs.getString("empno"));
|
||||
resourceData.setEmpname(rs.getString("empname"));
|
||||
resourceData.setEmpsexid(rs.getString("empsexid"));
|
||||
resourceData.setEmpstatusid(rs.getString("empstatusid"));
|
||||
resourceData.setDptsysid(rs.getString("dptsysid"));
|
||||
resourceData.setEmpbirthday(rs.getString("empbirthday"));
|
||||
resourceData.setEmpidno(rs.getString("empidno"));
|
||||
resourceData.setEmpgrpdate(rs.getString("empgrpdate"));
|
||||
resourceData.setEmpnormaldate(rs.getString("empnormaldate"));
|
||||
resourceData.setEmpleavedate(rs.getString("empleavedate"));
|
||||
resourceData.setEmpmobile(rs.getString("empmobile"));
|
||||
resourceData.setEmplocaladdr(rs.getString("emplocaladdr"));
|
||||
resourceData.setEmphomeaddr(rs.getString("emphomeaddr"));
|
||||
|
||||
resourceList.add(resourceData);
|
||||
}
|
||||
|
||||
|
||||
// 处理人员数据
|
||||
for (KqResourceData resourceData : resourceList) {
|
||||
KqOrgData kqOrgData = sysIdMap.get(resourceData.getDptsysid());
|
||||
if (null == kqOrgData || StringUtils.isBlank(kqOrgData.getOaId()) || StringUtils.isBlank(kqOrgData.getSubCompanyId())) {
|
||||
// 上级部门不存在的,或者非部门下的人员,该组织下的人员跳过处理
|
||||
continue;
|
||||
}
|
||||
String departmentId = kqOrgData.getOaId();
|
||||
String subCompanyId = kqOrgData.getSubCompanyId();
|
||||
|
||||
// 只做更新,不新增
|
||||
syncResourceData(rs, resourceData, subCompanyId, departmentId);
|
||||
|
||||
|
||||
}
|
||||
rs.writeLog("考勤组织信息同步任务结束");
|
||||
} catch (Exception e) {
|
||||
rs.writeLog("组织同步计划任务异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void dealDepartmentData(RecordSet rs, KqOrgData departmentData, Map<String, List<KqOrgData>> parentMap, String subCompanyId, String supDepId) {
|
||||
// 同步部门数据
|
||||
syncDepartmentData(rs, departmentData, subCompanyId, supDepId);
|
||||
|
||||
List<KqOrgData> departmentList = parentMap.get(departmentData.getDptprcno());
|
||||
if (CollectionUtils.isNotEmpty(departmentList)) {
|
||||
for (KqOrgData child : departmentList) {
|
||||
dealDepartmentData(rs, child, parentMap, subCompanyId, departmentData.getOaId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void syncResourceData(RecordSet rs, KqResourceData resourceData, String subCompanyId, String departmentId) throws Exception {
|
||||
rs.executeQuery("select id from " + RESOURCE_TABLE + " where workcode = ? ", resourceData.getEmpno());
|
||||
String id = "";
|
||||
if (rs.next()) {
|
||||
id = rs.getString("id");
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(id)) {
|
||||
// 新增人员
|
||||
|
||||
IgnoreCaseHashMap<String, Object> dataMap = new IgnoreCaseHashMap<>();
|
||||
dataMap.put("workcode", resourceData.getEmpno());
|
||||
dataMap.put("loginid", resourceData.getEmpno());
|
||||
dataMap.put("subcompanyid1", subCompanyId);
|
||||
dataMap.put("departmentid", departmentId);
|
||||
dataMap.put("lastname", resourceData.getEmpname());
|
||||
dataMap.put("sex", resourceData.getEmpsexid());
|
||||
dataMap.put("status", resourceData.getEmpstatusid());
|
||||
dataMap.put("birthday", resourceData.getEmpbirthday());
|
||||
dataMap.put("certificatenum", resourceData.getEmpidno());
|
||||
dataMap.put("companystartdate", resourceData.getEmpgrpdate());
|
||||
dataMap.put("probationenddate", resourceData.getEmpnormaldate());
|
||||
dataMap.put("mobile", resourceData.getEmpmobile());
|
||||
dataMap.put("residentplace", resourceData.getEmplocaladdr());
|
||||
dataMap.put("regresidentplace", resourceData.getEmphomeaddr());
|
||||
Map<String, Object> returnMap = ResourceSyncUtil.addResource(new User(1), dataMap);
|
||||
if ("1".equals(returnMap.get("status"))) {
|
||||
String resourceId = Util.null2String(returnMap.get("id"));
|
||||
if (StringUtils.isNotBlank(resourceId)) {
|
||||
id = resourceId;
|
||||
}
|
||||
} else {
|
||||
String errorMsg = returnMap.get("message").toString();
|
||||
rs.writeLog("当前人员新增失败," + errorMsg);
|
||||
rs.writeLog("resourceData==" + JSON.toJSONString(resourceData));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
IgnoreCaseHashMap<String, Object> dataMap = new IgnoreCaseHashMap<>();
|
||||
dataMap.put("id", id);
|
||||
//dataMap.put("workcode",resourceData.getEmpno());
|
||||
|
||||
dataMap.put("subcompanyid1", subCompanyId);
|
||||
dataMap.put("departmentid", departmentId);
|
||||
dataMap.put("lastname", resourceData.getEmpname());
|
||||
dataMap.put("sex", resourceData.getEmpsexid());
|
||||
dataMap.put("status", resourceData.getEmpstatusid());
|
||||
dataMap.put("birthday", resourceData.getEmpbirthday());
|
||||
dataMap.put("certificatenum", resourceData.getEmpidno());
|
||||
dataMap.put("companystartdate", resourceData.getEmpgrpdate());
|
||||
dataMap.put("probationenddate", resourceData.getEmpnormaldate());
|
||||
dataMap.put("mobile", resourceData.getEmpmobile());
|
||||
dataMap.put("residentplace", resourceData.getEmplocaladdr());
|
||||
dataMap.put("regresidentplace", resourceData.getEmphomeaddr());
|
||||
|
||||
updateDataById(dataMap, RESOURCE_TABLE);
|
||||
}
|
||||
String sql = "select gzdno,gzdname,jobno,jobname ,gzjno,gzjname from vrs_emp where empno = '" + resourceData.getEmpno() + "' ";
|
||||
rs.executeSqlWithDataSource(sql, "KAOQIN");
|
||||
if (rs.next()) {
|
||||
// 岗位名称
|
||||
String gzdname = rs.getString("gzdname");
|
||||
// 职务名称
|
||||
String jobname = rs.getString("jobname");
|
||||
// 职级名称
|
||||
String gzjname = rs.getString("gzjname");
|
||||
|
||||
String jobTitleIdByName = getJobTitleIdByName(rs, gzdname);
|
||||
String levelValueByName = getLevelValueByName(rs, gzjname);
|
||||
|
||||
rs.writeLog("id==" + id + ",empno==" + resourceData.getEmpno() + ",gzdname==" + gzdname + ",jobTitleIdByName==" + jobTitleIdByName + ",jobname==" + jobname + ",gzjname==" + gzjname + ",levelValueByName==" + levelValueByName);
|
||||
// 更新岗位、职位
|
||||
rs.executeUpdate("update hrmresource set jobtitle = ? where id = ?", jobTitleIdByName, id);
|
||||
// 更新职级名称
|
||||
rs.executeUpdate("update cus_fielddata set field17 = ? where `SCOPE` ='HrmCustomFieldByInfoType' and SCOPEID = -1 and id = ?", levelValueByName, id);
|
||||
}
|
||||
// 更新离职日期
|
||||
rs.executeUpdate("update cus_fielddata set field16 = ? where `SCOPE` ='HrmCustomFieldByInfoType' and SCOPEID =3 and id = ?", resourceData.getEmpleavedate(), id);
|
||||
|
||||
new ResourceComInfo().updateCache(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配职级名称
|
||||
*
|
||||
* @param rs
|
||||
* @param levelName
|
||||
* @return
|
||||
*/
|
||||
private String getLevelValueByName(RecordSet rs, String levelName) {
|
||||
rs.executeQuery("select selectvalue from cus_selectitem where fieldid =17 and selectname =?", levelName);
|
||||
if (rs.next()) {
|
||||
return rs.getString("selectvalue");
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位ID
|
||||
*
|
||||
* @param rs
|
||||
* @param jobTitleName
|
||||
* @return
|
||||
*/
|
||||
private String getJobTitleIdByName(RecordSet rs, String jobTitleName) {
|
||||
rs.executeQuery("select id from hrmjobtitles where jobtitlename = ?", jobTitleName);
|
||||
if (rs.next()) {
|
||||
return rs.getString("id");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getJobActivitiesIdByName(RecordSet rs, String jobActivityName) {
|
||||
rs.executeQuery("select id from hrmjobactivities where jobactivityname = ?", jobActivityName);
|
||||
if (rs.next()) {
|
||||
return rs.getString("id");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步部门
|
||||
*
|
||||
* @param rs
|
||||
* @param departmentData
|
||||
* @param subCompanyId
|
||||
* @param supDepId
|
||||
*/
|
||||
private void syncDepartmentData(RecordSet rs, KqOrgData departmentData, String subCompanyId, String supDepId) {
|
||||
IgnoreCaseHashMap<String, Object> dataMap = new IgnoreCaseHashMap<>();
|
||||
dataMap.put("departmentmark", departmentData.getDptname());
|
||||
dataMap.put("departmentname", departmentData.getDptname());
|
||||
dataMap.put("departmentcode", departmentData.getDptno());
|
||||
dataMap.put("subcompanyid1", subCompanyId);
|
||||
dataMap.put("supdepid", supDepId);
|
||||
dataMap.put("canceled", departmentData.getIsdelete());
|
||||
// 判断有无当前分部数据
|
||||
rs.executeQuery("select id from " + DEPARTMENT_TABLE + " where departmentcode = ? ", departmentData.getDptno());
|
||||
if (rs.next()) {
|
||||
// 更新
|
||||
dataMap.put("id", rs.getString("id"));
|
||||
updateDataById(dataMap, DEPARTMENT_TABLE);
|
||||
} else {
|
||||
// 新增
|
||||
insertData(dataMap, DEPARTMENT_TABLE);
|
||||
}
|
||||
rs.executeQuery("select id from " + DEPARTMENT_TABLE + " where departmentcode = ? ", departmentData.getDptno());
|
||||
if (rs.next()) {
|
||||
// 赋值OA中的ID
|
||||
departmentData.setOaId(rs.getString("id"));
|
||||
departmentData.setSubCompanyId(subCompanyId);
|
||||
sysIdMap.put(departmentData.getDptsysid(), departmentData);
|
||||
|
||||
|
||||
DepartmentComInfo dci = new DepartmentComInfo();
|
||||
dci.removeCompanyCache();
|
||||
dci.addCache(departmentData.getOaId());
|
||||
HrmServiceManager hrmServiceManager = new HrmServiceManager();
|
||||
hrmServiceManager.SynInstantDepartment(departmentData.getOaId(), "2");
|
||||
MatrixUtil.updateDepartmentData(departmentData.getOaId());
|
||||
|
||||
} else {
|
||||
throw new CustomizeRunTimeException("当前部门同步失败," + JSON.toJSONString(departmentData));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步分部
|
||||
*
|
||||
* @param rs
|
||||
* @param subCompany
|
||||
* @param companyId
|
||||
*/
|
||||
private void syncSubCompany(RecordSet rs, KqOrgData subCompany, String companyId) {
|
||||
IgnoreCaseHashMap<String, Object> dataMap = new IgnoreCaseHashMap<>();
|
||||
dataMap.put("subcompanyname", subCompany.getDptname());
|
||||
dataMap.put("subcompanydesc", subCompany.getDptname());
|
||||
dataMap.put("subcompanycode", subCompany.getDptno());
|
||||
dataMap.put("companyid", companyId);
|
||||
dataMap.put("supsubcomid", "0");
|
||||
dataMap.put("canceled", subCompany.getIsdelete());
|
||||
// 判断有无当前分部数据
|
||||
rs.executeQuery("select id from " + SUB_COMPANY_TABLE + " where subcompanycode = ? ", subCompany.getDptno());
|
||||
if (rs.next()) {
|
||||
// 更新
|
||||
dataMap.put("id", rs.getString("id"));
|
||||
updateDataById(dataMap, SUB_COMPANY_TABLE);
|
||||
} else {
|
||||
// 新增
|
||||
insertData(dataMap, SUB_COMPANY_TABLE);
|
||||
}
|
||||
rs.executeQuery("select id from " + SUB_COMPANY_TABLE + " where subcompanycode = ? ", subCompany.getDptno());
|
||||
if (rs.next()) {
|
||||
// 赋值OA中的ID
|
||||
subCompany.setOaId(rs.getString("id"));
|
||||
sysIdMap.put(subCompany.getDptsysid(), subCompany);
|
||||
|
||||
// 刷新缓存
|
||||
SubCompanyComInfo sci = new SubCompanyComInfo();
|
||||
sci.removeCompanyCache();
|
||||
sci.addCache(subCompany.getOaId());
|
||||
MatrixUtil.updateSubcompayData(subCompany.getOaId());
|
||||
new weaver.hrm.appdetach.AppDetachComInfo().initSubDepAppData();
|
||||
} else {
|
||||
throw new CustomizeRunTimeException("当前分部同步失败," + JSON.toJSONString(subCompany));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取OA中集团的ID
|
||||
*
|
||||
* @param rs
|
||||
* @return
|
||||
*/
|
||||
private String getCompanyId(RecordSet rs) {
|
||||
rs.executeQuery("select id from " + COMPANY_TABLE);
|
||||
if (rs.next()) {
|
||||
return rs.getString("id");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入数据
|
||||
*
|
||||
* @param dataMap 数据集合
|
||||
* @param tableName 表名
|
||||
*/
|
||||
public static void insertData(Map<String, Object> dataMap, String tableName) {
|
||||
List<String> fieldList = new ArrayList<>();
|
||||
List<String> dataList = new ArrayList<>();
|
||||
List<String> paramList = new ArrayList<>();
|
||||
|
||||
dataMap.forEach((key, value) -> {
|
||||
if (null != value) {
|
||||
String valueStr = String.valueOf(value);
|
||||
if (StringUtils.isNotBlank(valueStr)) {
|
||||
fieldList.add(key);
|
||||
dataList.add(valueStr);
|
||||
paramList.add("?");
|
||||
}
|
||||
}
|
||||
});
|
||||
String insertSql = " insert into " + tableName + "(" + StringUtils.join(fieldList, ",") + ") values (" + StringUtils.join(paramList, ",") + ")";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeUpdate(insertSql, dataList);
|
||||
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
|
||||
throw new CustomizeRunTimeException(rs.getExceptionMsg());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID更新数据
|
||||
*
|
||||
* @param dataMap
|
||||
* @param tableName
|
||||
*/
|
||||
public static void updateDataById(Map<String, Object> dataMap, String tableName) {
|
||||
List<String> fieldList = new ArrayList<>();
|
||||
List<Object> dataList = new ArrayList<>();
|
||||
String id = Util.null2String(dataMap.get("id"));
|
||||
dataMap.remove("id");
|
||||
|
||||
dataMap.forEach((key, value) -> {
|
||||
fieldList.add(key + " = ? ");
|
||||
dataList.add(value);
|
||||
});
|
||||
dataList.add(id);
|
||||
String updateSql = "update " + tableName + " set " + StringUtils.join(fieldList, ",") + " where id = ? ";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeUpdate(updateSql, dataList);
|
||||
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
|
||||
throw new CustomizeRunTimeException(rs.getExceptionMsg());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID更新数据
|
||||
*
|
||||
* @param dataMap
|
||||
*/
|
||||
public static void updateDataByWorkCode(Map<String, Object> dataMap) {
|
||||
List<String> fieldList = new ArrayList<>();
|
||||
List<Object> dataList = new ArrayList<>();
|
||||
String workCode = Util.null2String(dataMap.get("workcode"));
|
||||
dataMap.remove("workcode");
|
||||
|
||||
dataMap.forEach((key, value) -> {
|
||||
fieldList.add(key + " = ? ");
|
||||
dataList.add(value);
|
||||
});
|
||||
dataList.add(workCode);
|
||||
String updateSql = "update hrmresource set " + StringUtils.join(fieldList, ",") + " where workcode = ? ";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeUpdate(updateSql, dataList);
|
||||
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
|
||||
throw new CustomizeRunTimeException(rs.getExceptionMsg());
|
||||
}
|
||||
}
|
||||
|
||||
public String getSyncType() {
|
||||
return syncType;
|
||||
}
|
||||
|
||||
public void setSyncType(String syncType) {
|
||||
this.syncType = syncType;
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
package weaver.interfaces.kr.workflow.action;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kr.entity.kq.KqActionBO;
|
||||
import com.engine.kr.entity.kq.KqGlobal;
|
||||
import com.engine.kr.enums.KqInteractiveEnum;
|
||||
import com.engine.kr.service.impl.KqInteractiveServiceImpl;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/05/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class KrBatchOvertimeCreateAction implements Action {
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
|
||||
String billNo = "";
|
||||
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
for (Property property : properties) {
|
||||
String name = property.getName();
|
||||
String value = property.getValue();
|
||||
switch (name) {
|
||||
case "lcbh":
|
||||
billNo = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
String token = new KqInteractiveServiceImpl().getToken();
|
||||
String cfmBy = KqActionBO.getUserName(requestInfo.getLastoperator());
|
||||
Map<String, String> operateDateTime = KqActionBO.getOperateDateTime(requestInfo.getRequestid());
|
||||
|
||||
|
||||
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
|
||||
DetailTable detailTable = detailTableInfo.getDetailTable()[0];
|
||||
Row[] rows = detailTable.getRow();
|
||||
boolean isRun = true;
|
||||
int index = 1;
|
||||
for (Row row : rows) {
|
||||
if (!isRun) {
|
||||
break;
|
||||
}
|
||||
String personId = "";
|
||||
String otType = "";
|
||||
String otAdjuest = "";
|
||||
String beginDate = "";
|
||||
String beginTime = "";
|
||||
String endDate = "";
|
||||
String endTime = "";
|
||||
String billHours = "";
|
||||
String otReason = "";
|
||||
Cell[] cells = row.getCell();
|
||||
for (Cell cell : cells) {
|
||||
String name = cell.getName();
|
||||
String value = cell.getValue();
|
||||
switch (name) {
|
||||
case "xm":
|
||||
personId = KqActionBO.getWorkCode(value);
|
||||
break;
|
||||
case "jblx":
|
||||
otType = KqActionBO.getWorkTypeCode(value);
|
||||
break;
|
||||
case "bcfs":
|
||||
otAdjuest = value;
|
||||
break;
|
||||
case "ksrq":
|
||||
beginDate = value;
|
||||
break;
|
||||
case "kssj":
|
||||
beginTime = value;
|
||||
break;
|
||||
case "jsrq":
|
||||
endDate = value;
|
||||
break;
|
||||
case "jssj":
|
||||
endTime = value;
|
||||
break;
|
||||
case "jbsc":
|
||||
billHours = value;
|
||||
break;
|
||||
case "jbsy":
|
||||
otReason = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 每一行发起一次请求
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("token", token);
|
||||
params.put("personId", personId);
|
||||
params.put("billNo", billNo + "-" + index);
|
||||
params.put("otType", otType);
|
||||
params.put("otAdjuest", otAdjuest);
|
||||
params.put("beginDate", beginDate);
|
||||
params.put("beginTime", beginTime);
|
||||
params.put("endDate", endDate);
|
||||
params.put("endTime", endTime);
|
||||
params.put("billHours", billHours);
|
||||
params.put("runsNo", null);
|
||||
params.put("otReason", otReason);
|
||||
params.put("addBy", requestInfo.getCreatorid());
|
||||
params.put("addDay", operateDateTime.get("addDay"));
|
||||
params.put("cfmBy", cfmBy);
|
||||
params.put("cfmDay", operateDateTime.get("cfmDay"));
|
||||
// 1新增、2变动、3取消
|
||||
params.put("billStat", 1);
|
||||
new BaseBean().writeLog("########批量加班流程,requestid={" + requestInfo.getRequestid() + "],传参:"+ JSON.toJSONString(params));
|
||||
|
||||
String returnStr = HttpUtil.post(KqGlobal.POST_URL + KqInteractiveEnum.OVERTIME_CREATE.getPostPath(), params);
|
||||
new BaseBean().writeLog("########批量加班流程,requestid={" + requestInfo.getRequestid() + "],接口响应数据:"+ returnStr);
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(returnStr);
|
||||
String code = jsonObject.getString("code");
|
||||
if (!KqGlobal.SUC_CODE.equals(code)) {
|
||||
//判断接口返回id 14 新增时单据重复 修改billStat=2 再推一次数据
|
||||
if(KqGlobal.REPEAT_CODE.equals(code)){
|
||||
params.put("billStat", 2);
|
||||
new BaseBean().writeLog("########更新批量加班流程,requestid={" + requestInfo.getRequestid() + "],传参:"+ JSON.toJSONString(params));
|
||||
|
||||
String reResStr = HttpUtil.post(KqGlobal.POST_URL + KqInteractiveEnum.OVERTIME_CREATE.getPostPath(), params);
|
||||
new BaseBean().writeLog("########更新批量加班流程,requestid={" + requestInfo.getRequestid() + "],接口响应数据:"+ returnStr);
|
||||
JSONObject reObject = JSONObject.parseObject(reResStr);
|
||||
String reCode = reObject.getString("code");
|
||||
if (!KqGlobal.SUC_CODE.equals(reCode)) {
|
||||
requestInfo.getRequestManager().setMessagecontent(reObject.getString("msg"));
|
||||
isRun = false;
|
||||
}
|
||||
}else{
|
||||
requestInfo.getRequestManager().setMessagecontent(jsonObject.getString("msg"));
|
||||
isRun = false;
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
if (isRun) {
|
||||
return SUCCESS;
|
||||
}
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
package weaver.interfaces.kr.workflow.action;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kr.entity.kq.KqActionBO;
|
||||
import com.engine.kr.entity.kq.KqGlobal;
|
||||
import com.engine.kr.enums.KqInteractiveEnum;
|
||||
import com.engine.kr.service.impl.KqInteractiveServiceImpl;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.MainTableInfo;
|
||||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 康瑞-出差申请流程-Action
|
||||
*
|
||||
* @author wangj
|
||||
* @version 1.00版本
|
||||
* @Date 2023/6/5
|
||||
*/
|
||||
public class KrCCLeaveCreateAction implements Action {
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
String personId = "";
|
||||
String startDate = "";
|
||||
String startTime = "";
|
||||
String endDate = "";
|
||||
String endTime = "";
|
||||
String leaveDuration = "";
|
||||
String leaveReason = "";
|
||||
String billNo = "";
|
||||
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
for (Property property : properties) {
|
||||
String name = property.getName();
|
||||
String value = property.getValue();
|
||||
switch (name) {
|
||||
case "resourceId":
|
||||
personId = value;
|
||||
break;
|
||||
case "lcbh":
|
||||
billNo = value;
|
||||
break;
|
||||
case "ksrq":
|
||||
startDate = value;
|
||||
break;
|
||||
case "kssj":
|
||||
startTime = value;
|
||||
break;
|
||||
case "jsrq":
|
||||
endDate = value;
|
||||
break;
|
||||
case "jssj":
|
||||
endTime = value;
|
||||
break;
|
||||
case "ccsc":
|
||||
leaveDuration = value;
|
||||
break;
|
||||
case "ccsy":
|
||||
leaveReason = value;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
Map<String, String> operateDateTime = KqActionBO.getOperateDateTime(requestInfo.getRequestid());
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("token", new KqInteractiveServiceImpl().getToken());
|
||||
params.put("personId", KqActionBO.getWorkCode(personId));
|
||||
params.put("billNo", billNo);
|
||||
params.put("dayoffType", KqActionBO.getLeaveTypeCode("13"));
|
||||
params.put("beginDate", startDate);
|
||||
params.put("beginTime", startTime);
|
||||
params.put("endDate", endDate);
|
||||
params.put("endTime", endTime);
|
||||
params.put("billHours", leaveDuration);
|
||||
params.put("runsNo", null);
|
||||
params.put("inout", null);
|
||||
params.put("incHoli", null);
|
||||
params.put("dayoffReason", leaveReason);
|
||||
params.put("addBy", requestInfo.getCreatorid());
|
||||
params.put("addDay", operateDateTime.get("addDay"));
|
||||
params.put("cfmBy", KqActionBO.getUserName(requestInfo.getLastoperator()));
|
||||
params.put("cfmDay", operateDateTime.get("addDay"));
|
||||
// 1新增、2变动、3取消
|
||||
params.put("billStat", 1);
|
||||
|
||||
new BaseBean().writeLog("########出差流程,requestid={" + requestInfo.getRequestid() + "],传参:"+ JSON.toJSONString(params));
|
||||
|
||||
String returnStr = HttpUtil.post(KqGlobal.POST_URL + KqInteractiveEnum.LEAVE_CREATE.getPostPath(), params);
|
||||
new BaseBean().writeLog("########出差流程,requestid={" + requestInfo.getRequestid() + "],接口响应数据:"+ returnStr);
|
||||
JSONObject jsonObject = JSONObject.parseObject(returnStr);
|
||||
String code = jsonObject.getString("code");
|
||||
if (KqGlobal.SUC_CODE.equals(code)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
requestInfo.getRequestManager().setMessagecontent(jsonObject.getString("msg"));
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
package weaver.interfaces.kr.workflow.action;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kr.entity.kq.KqActionBO;
|
||||
import com.engine.kr.entity.kq.KqGlobal;
|
||||
import com.engine.kr.enums.KqInteractiveEnum;
|
||||
import com.engine.kr.service.impl.KqInteractiveServiceImpl;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.MainTableInfo;
|
||||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 康瑞-公出申请流程-Action
|
||||
*
|
||||
* @author wangj
|
||||
* @version 1.00版本
|
||||
* @Date 2023/6/5
|
||||
*/
|
||||
public class KrGCLeaveCreateAction implements Action {
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
String personId = "";
|
||||
String startDate = "";
|
||||
String startTime = "";
|
||||
String endDate = "";
|
||||
String endTime = "";
|
||||
String leaveDuration = "";
|
||||
String leaveReason = "";
|
||||
String billNo = "";
|
||||
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
for (Property property : properties) {
|
||||
String name = property.getName();
|
||||
String value = property.getValue();
|
||||
switch (name) {
|
||||
case "resourceId":
|
||||
personId = value;
|
||||
break;
|
||||
case "lcbh":
|
||||
billNo = value;
|
||||
break;
|
||||
case "fromDate":
|
||||
startDate = value;
|
||||
break;
|
||||
case "fromTime":
|
||||
startTime = value;
|
||||
break;
|
||||
case "toDate":
|
||||
endDate = value;
|
||||
break;
|
||||
case "toTime":
|
||||
endTime = value;
|
||||
break;
|
||||
case "duration":
|
||||
leaveDuration = value;
|
||||
break;
|
||||
case "gcsy":
|
||||
leaveReason = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
Map<String, String> operateDateTime = KqActionBO.getOperateDateTime(requestInfo.getRequestid());
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("token", new KqInteractiveServiceImpl().getToken());
|
||||
params.put("personId", KqActionBO.getWorkCode(personId));
|
||||
params.put("billNo", billNo);
|
||||
params.put("dayoffType", KqActionBO.getLeaveTypeCode("14"));
|
||||
params.put("beginDate", startDate);
|
||||
params.put("beginTime", startTime);
|
||||
params.put("endDate", endDate);
|
||||
params.put("endTime", endTime);
|
||||
params.put("billHours", leaveDuration);
|
||||
params.put("runsNo", null);
|
||||
params.put("inout", null);
|
||||
params.put("incHoli", null);
|
||||
params.put("dayoffReason", leaveReason);
|
||||
params.put("addBy", requestInfo.getCreatorid());
|
||||
params.put("addDay", operateDateTime.get("addDay"));
|
||||
params.put("cfmBy", KqActionBO.getUserName(requestInfo.getLastoperator()));
|
||||
params.put("cfmDay", operateDateTime.get("addDay"));
|
||||
// 1新增、2变动、3取消
|
||||
params.put("billStat", 1);
|
||||
|
||||
new BaseBean().writeLog("########公出流程,requestid={" + requestInfo.getRequestid() + "],传参:"+ JSON.toJSONString(params));
|
||||
|
||||
String returnStr = HttpUtil.post(KqGlobal.POST_URL + KqInteractiveEnum.LEAVE_CREATE.getPostPath(), params);
|
||||
new BaseBean().writeLog("########公出流程,requestid={" + requestInfo.getRequestid() + "],接口响应数据:"+ returnStr);
|
||||
JSONObject jsonObject = JSONObject.parseObject(returnStr);
|
||||
String code = jsonObject.getString("code");
|
||||
if (KqGlobal.SUC_CODE.equals(code)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
requestInfo.getRequestManager().setMessagecontent(jsonObject.getString("msg"));
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package weaver.interfaces.kr.workflow.action;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kr.entity.kq.KqActionBO;
|
||||
import com.engine.kr.entity.kq.KqGlobal;
|
||||
import com.engine.kr.enums.KqInteractiveEnum;
|
||||
import com.engine.kr.service.impl.KqInteractiveServiceImpl;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.MainTableInfo;
|
||||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/05/22
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class KrLeaveCreateAction implements Action {
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
|
||||
//判断操作类型 只有submit情况下执行下面推送考勤系统 请假信息
|
||||
String src = Util.null2String(requestInfo.getRequestManager().getSrc());
|
||||
String nodeid = Util.null2String(requestInfo.getRequestManager().getNodeid());
|
||||
String requestid = Util.null2String(requestInfo.getRequestid());
|
||||
//控制仅提交时触发
|
||||
if(!"submit".equals(src)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
new BaseBean().writeLog("--KrLeaveCreateAction-requestid-:"+requestid+", nodeid-:"+nodeid);
|
||||
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
String resourceId = "";
|
||||
String leaveType = "";
|
||||
String startDate = "";
|
||||
String startTime = "";
|
||||
String endDate = "";
|
||||
String endTime = "";
|
||||
String leaveDuration = "";
|
||||
String leaveReason = "";
|
||||
String billNo = "";
|
||||
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
for (Property property : properties) {
|
||||
String name = property.getName();
|
||||
String value = property.getValue();
|
||||
switch (name) {
|
||||
case "resourceId":
|
||||
resourceId = value;
|
||||
break;
|
||||
case "jqlx":
|
||||
leaveType = value;
|
||||
break;
|
||||
case "ksrq":
|
||||
startDate = value;
|
||||
break;
|
||||
case "kssj":
|
||||
startTime = value;
|
||||
break;
|
||||
case "jsrq":
|
||||
endDate = value;
|
||||
break;
|
||||
case "jssj":
|
||||
endTime = value;
|
||||
break;
|
||||
case "qjsc":
|
||||
leaveDuration = value;
|
||||
break;
|
||||
case "qjsy":
|
||||
leaveReason = value;
|
||||
break;
|
||||
case "lcbh":
|
||||
billNo = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
Map<String, String> operateDateTime = KqActionBO.getOperateDateTime(requestInfo.getRequestid());
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("token", new KqInteractiveServiceImpl().getToken());
|
||||
params.put("personId", KqActionBO.getWorkCode(resourceId));
|
||||
params.put("billNo", billNo);
|
||||
params.put("dayoffType", KqActionBO.getLeaveTypeCode(leaveType));
|
||||
params.put("beginDate", startDate);
|
||||
params.put("beginTime", startTime);
|
||||
params.put("endDate", endDate);
|
||||
params.put("endTime", endTime);
|
||||
params.put("billHours", leaveDuration);
|
||||
params.put("runsNo", null);
|
||||
params.put("inout", null);
|
||||
params.put("incHoli", null);
|
||||
params.put("dayoffReason", leaveReason);
|
||||
params.put("addBy", requestInfo.getCreatorid());
|
||||
params.put("addDay", operateDateTime.get("addDay"));
|
||||
params.put("cfmBy", KqActionBO.getUserName(requestInfo.getLastoperator()));
|
||||
params.put("cfmDay", operateDateTime.get("addDay"));
|
||||
// 1新增、2变动、3取消
|
||||
params.put("billStat", 1);
|
||||
|
||||
new BaseBean().writeLog("########请假流程,requestid={" + requestInfo.getRequestid() + "],传参:"+ JSON.toJSONString(params));
|
||||
|
||||
String returnStr = HttpUtil.post(KqGlobal.POST_URL + KqInteractiveEnum.LEAVE_CREATE.getPostPath(), params);
|
||||
new BaseBean().writeLog("########请假流程,requestid={" + requestInfo.getRequestid() + "],接口响应数据:"+ returnStr);
|
||||
JSONObject jsonObject = JSONObject.parseObject(returnStr);
|
||||
String code = jsonObject.getString("code");
|
||||
if (KqGlobal.SUC_CODE.equals(code) || KqGlobal.IGNORE_CODE.equals(code)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
requestInfo.getRequestManager().setMessagecontent(jsonObject.getString("msg"));
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package weaver.interfaces.kr.workflow.action;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.MainTableInfo;
|
||||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/05/24
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class KrLeaveRepeatAction implements Action {
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
String resourceId = "";
|
||||
String leaveType = "";
|
||||
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
for (Property property : properties) {
|
||||
String name = property.getName();
|
||||
String value = property.getValue();
|
||||
switch (name) {
|
||||
case "resourceId":
|
||||
resourceId = value;
|
||||
break;
|
||||
case "jqlx":
|
||||
leaveType = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
String billTableName = requestInfo.getRequestManager().getBillTableName();
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select count(1) as num from " + billTableName + " a LEFT JOIN workflow_requestbase w ON a.requestid = w.requestid where a.resourceId = ? and a.jqlx =? and a.requestid != ? and w.currentnodetype IN ( 1, 2 )", resourceId, leaveType, requestInfo.getRequestid());
|
||||
if (rs.next()) {
|
||||
int num = rs.getInt("num");
|
||||
if (num > 0) {
|
||||
requestInfo.getRequestManager().setMessagecontent("当前人员存在未审批完成的请假审核流程,请勿重复提交");
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package weaver.interfaces.kr.workflow.action;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kr.entity.kq.KqActionBO;
|
||||
import com.engine.kr.entity.kq.KqGlobal;
|
||||
import com.engine.kr.enums.KqInteractiveEnum;
|
||||
import com.engine.kr.service.impl.KqInteractiveServiceImpl;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 康瑞-补卡申请流程-推送签卡数据Action
|
||||
*
|
||||
* @author wangj
|
||||
* @version 1.00版本
|
||||
* @Date 2023/6/5
|
||||
*/
|
||||
|
||||
public class KrSignCreateAction implements Action {
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
//单据编号
|
||||
String billNo = "";
|
||||
//申请人id
|
||||
String personId = "";
|
||||
//主表数据
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
for (Property property : properties) {
|
||||
String name = property.getName();
|
||||
String value = property.getValue();
|
||||
switch (name) {
|
||||
case "resourceId":
|
||||
personId = KqActionBO.getWorkCode(value);
|
||||
break;
|
||||
case "lcbh":
|
||||
billNo = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
String token = new KqInteractiveServiceImpl().getToken();
|
||||
String cfmBy = KqActionBO.getUserName(requestInfo.getLastoperator());
|
||||
Map<String, String> operateDateTime = KqActionBO.getOperateDateTime(requestInfo.getRequestid());
|
||||
|
||||
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
|
||||
DetailTable detailTable = detailTableInfo.getDetailTable()[0];
|
||||
Row[] rows = detailTable.getRow();
|
||||
boolean isRun = true;
|
||||
int index = 1;
|
||||
for (Row row : rows) {
|
||||
if (!isRun) {
|
||||
break;
|
||||
}
|
||||
String signDate = "";
|
||||
String signTime1 = "";
|
||||
|
||||
String signReason = "";
|
||||
|
||||
Cell[] cells = row.getCell();
|
||||
for (Cell cell : cells) {
|
||||
String name = cell.getName();
|
||||
String value = cell.getValue();
|
||||
switch (name) {
|
||||
case "detail_signdate":
|
||||
signDate = value;
|
||||
break;
|
||||
case "detail_signtime":
|
||||
signTime1 = value;
|
||||
break;
|
||||
case "bksm":
|
||||
signReason = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 每一行发起一次请求
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("token", token);
|
||||
params.put("personId", personId);
|
||||
params.put("billNo", billNo + "-" + index);
|
||||
params.put("signDate", signDate);
|
||||
params.put("signTime1", signTime1);
|
||||
params.put("signTime2", null);
|
||||
params.put("signTime3", null);
|
||||
params.put("signTime4", null);
|
||||
params.put("signTime5", null);
|
||||
params.put("signTime6", null);
|
||||
|
||||
params.put("signReason", signReason);
|
||||
params.put("addBy", requestInfo.getCreatorid());
|
||||
params.put("addDay", operateDateTime.get("addDay"));
|
||||
params.put("cfmBy", cfmBy);
|
||||
params.put("cfmDay", operateDateTime.get("cfmDay"));
|
||||
// 1新增、2变动、3取消
|
||||
params.put("billStat", 1);
|
||||
new BaseBean().writeLog("########批量补卡申请流程,requestid={" + requestInfo.getRequestid() + "],传参:" + JSON.toJSONString(params));
|
||||
|
||||
String returnStr = HttpUtil.post(KqGlobal.POST_URL + KqInteractiveEnum.SIGN_CREATE.getPostPath(), params);
|
||||
new BaseBean().writeLog("########批量补卡申请流程,requestid={" + requestInfo.getRequestid() + "],接口响应数据:" + returnStr);
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(returnStr);
|
||||
String code = jsonObject.getString("code");
|
||||
if (!KqGlobal.SUC_CODE.equals(code)) {
|
||||
requestInfo.getRequestManager().setMessagecontent(jsonObject.getString("msg"));
|
||||
isRun = false;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
if (isRun) {
|
||||
return SUCCESS;
|
||||
}
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package weaver.interfaces.kr.workflow.action;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.kr.entity.kq.KqActionBO;
|
||||
import com.engine.kr.entity.kq.KqGlobal;
|
||||
import com.engine.kr.enums.KqInteractiveEnum;
|
||||
import com.engine.kr.service.impl.KqInteractiveServiceImpl;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.MainTableInfo;
|
||||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/05/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class KrSingleOvertimeCreateAction implements Action {
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
String resourceId = "";
|
||||
String fromDate = "";
|
||||
String fromTime = "";
|
||||
String toDate = "";
|
||||
String toTime = "";
|
||||
// 补偿方式
|
||||
String overtimeType = "";
|
||||
String duration = "";
|
||||
String billNo = "";
|
||||
String workType = "";
|
||||
String workReason = "";
|
||||
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||
Property[] properties = mainTableInfo.getProperty();
|
||||
for (Property property : properties) {
|
||||
String name = property.getName();
|
||||
String value = property.getValue();
|
||||
switch (name) {
|
||||
case "resourceId":
|
||||
resourceId = value;
|
||||
break;
|
||||
case "fromDate":
|
||||
fromDate = value;
|
||||
break;
|
||||
case "fromTime":
|
||||
fromTime = value;
|
||||
break;
|
||||
case "toDate":
|
||||
toDate = value;
|
||||
break;
|
||||
case "toTime":
|
||||
toTime = value;
|
||||
break;
|
||||
case "overtime_type":
|
||||
overtimeType = value;
|
||||
break;
|
||||
case "duration":
|
||||
duration = value;
|
||||
break;
|
||||
case "lcbh":
|
||||
billNo = value;
|
||||
break;
|
||||
case "jblx":
|
||||
workType = value;
|
||||
break;
|
||||
case "jbsy":
|
||||
workReason = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
Map<String, String> operateDateTime = KqActionBO.getOperateDateTime(requestInfo.getRequestid());
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("token", new KqInteractiveServiceImpl().getToken());
|
||||
params.put("personId", KqActionBO.getWorkCode(resourceId));
|
||||
params.put("billNo", billNo);
|
||||
params.put("otType", KqActionBO.getWorkTypeCode(workType));
|
||||
params.put("otAdjuest", overtimeType);
|
||||
params.put("beginDate", fromDate);
|
||||
params.put("beginTime", fromTime);
|
||||
params.put("endDate", toDate);
|
||||
params.put("endTime", toTime);
|
||||
params.put("billHours", duration);
|
||||
params.put("runsNo", null);
|
||||
params.put("otReason", workReason);
|
||||
params.put("addBy", requestInfo.getCreatorid());
|
||||
params.put("addDay", operateDateTime.get("addDay"));
|
||||
params.put("cfmBy", KqActionBO.getUserName(requestInfo.getLastoperator()));
|
||||
params.put("cfmDay", operateDateTime.get("addDay"));
|
||||
params.put("billStat", 1);
|
||||
|
||||
new BaseBean().writeLog("########加班流程,requestid={" + requestInfo.getRequestid() + "],传参:"+ JSON.toJSONString(params));
|
||||
|
||||
String returnStr = HttpUtil.post(KqGlobal.POST_URL + KqInteractiveEnum.OVERTIME_CREATE.getPostPath(), params);
|
||||
new BaseBean().writeLog("########加班流程,requestid={" + requestInfo.getRequestid() + "],接口响应数据:"+ returnStr);
|
||||
JSONObject jsonObject = JSONObject.parseObject(returnStr);
|
||||
String code = jsonObject.getString("code");
|
||||
if (KqGlobal.SUC_CODE.equals(code)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
requestInfo.getRequestManager().setMessagecontent(jsonObject.getString("msg"));
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue