中科大POC
parent
59e17ca9f5
commit
ac89df1b9d
@ -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 {
|
||||
}
|
@ -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 = "field100043"; //移动电话自定义字段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,83 @@
|
||||
package weaver.interfaces.zkdpoc;
|
||||
|
||||
import com.weaver.general.Util;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
import weaver.interfaces.zkdpoc.po.SalaryPayProcessPo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/10/11 5:39 PM
|
||||
* @Description: 中科大POC 更新薪资缴款进度
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class SalaryPayProcessCrob extends BaseCronJob {
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
List<SalaryPayProcessPo> salaryPayProcessList = new ArrayList<>();
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
//1.获取需要更新的缴纳情况人数
|
||||
rs.executeQuery("select ryxm from uf_ryxzjnqk");
|
||||
while (rs.next()) {
|
||||
salaryPayProcessList.add(SalaryPayProcessPo.builder().personId(Util.getIntValue(rs.getString("ryxm"))).build());
|
||||
}
|
||||
|
||||
LocalDate now = LocalDate.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
String localDate = now.format(formatter);
|
||||
|
||||
salaryPayProcessList.forEach(item -> {
|
||||
rs.executeQuery("select yd,ydxz from uf_ryxzbzkd where jkqk = 1 and xm = 1 order by yd desc limit 1");
|
||||
|
||||
if (rs.next()){
|
||||
String payMonth = Util.null2String(rs.getString("yd"));
|
||||
double ydxz = Util.getDoubleValue("ydxz");
|
||||
int monthsDiff = calculateMonthDiff(payMonth,localDate);
|
||||
if (monthsDiff > 3) {
|
||||
item.setPayProcess(0);
|
||||
}else if (monthsDiff >= 0) {
|
||||
item.setPayProcess(1);
|
||||
}else {
|
||||
item.setPayProcess(2);
|
||||
double dueMonth = ydxz * monthsDiff;
|
||||
item.setDueMoney(dueMonth);
|
||||
item.setDueStartMonth(payMonth);
|
||||
item.setDueEndMonth(localDate);
|
||||
}
|
||||
|
||||
if (monthsDiff >= 0) {
|
||||
rs.executeUpdate("update uf_ryxzjnqk set jkjd = ? where ryxm = ?",item.getPayProcess(),item.getPersonId());
|
||||
}else {
|
||||
rs.executeUpdate("update uf_ryxzjnqk set jkjd = ?,qfsdq = ?,qfsdz = ?,qfje = ? where ryxm = ?",
|
||||
item.getPayProcess(),item.getPersonId(),item.getDueStartMonth(),item.getDueEndMonth(),item.getDueMoney());
|
||||
}
|
||||
|
||||
|
||||
}else {
|
||||
//不存在缴款数据情况 todo poc待定
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private int calculateMonthDiff(String payMonth,String localDate){
|
||||
|
||||
LocalDate date1 = LocalDate.parse(localDate + "-01");
|
||||
LocalDate date2 = LocalDate.parse(payMonth + "-01");
|
||||
|
||||
|
||||
return (int) ChronoUnit.MONTHS.between(date1, date2);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package weaver.interfaces.zkdpoc.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/10/11 5:53 PM
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SalaryPayPo {
|
||||
|
||||
private Integer personId;
|
||||
|
||||
/**
|
||||
* 月度
|
||||
*/
|
||||
private String payMonth;
|
||||
|
||||
|
||||
/**
|
||||
* 月度薪资
|
||||
*/
|
||||
private double salaryMonth;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package weaver.interfaces.zkdpoc.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/10/11 5:47 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SalaryPayProcessPo {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer personId;
|
||||
|
||||
|
||||
/**
|
||||
* 缴款进度
|
||||
*/
|
||||
private Integer payProcess;
|
||||
|
||||
|
||||
private String dueStartMonth;
|
||||
|
||||
|
||||
private String dueEndMonth;
|
||||
|
||||
|
||||
private double dueMoney;
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue