武汉联特科技有限公司

武汉联特科技股份有限公司
Chengliang 6 months ago
parent 8fbf36fc8b
commit fd45118dd7

@ -0,0 +1,26 @@
## \u7B2C\u4E00\u5B66\u5386
firstDegree=field29
## \u7B2C\u4E00\u5B66\u5386\u4E13\u4E1A
firstDegreeMajor=field30
## \u6700\u9AD8\u5B66\u5386
highestDegree=field31
## \u6700\u9AD8\u5B66\u5386\u4E13\u4E1A
highestDegreeMajor=field32
## \u5E74\u9F84
age=field33
## \u6700\u8FD1\u4E00\u4EFD\u5DE5\u4F5C\u5355\u4F4D\u540D\u79F0
lastWorkunitName=field34
## \u6700\u8FD1\u4E00\u4EFD\u5DE5\u4F5C\u5C97\u4F4D
lastJobName=field35
## \u4E2A\u4EBA\u4FE1\u606F
scopeid=1
## \u6D88\u606F\u63D0\u9192ID
messageRemindId=1186

@ -1,14 +0,0 @@
package com.api.seclinktel.web;
import javax.ws.rs.Path;
/**
* @Author liang.cheng
* @Date 2024/11/4 2:19 PM
* @Description: TODO
* @Version 1.0
*/
@Path("/seclinktel/resourceinfo")
public class ResourceOtherInfoAction extends com.engine.seclinktel.web.ResourceOtherInfoAction {
}

@ -1,21 +0,0 @@
package com.engine.seclinktel.entity.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author liang.cheng
* @Date 2024/11/4 2:32 PM
* @Description: TODO
* @Version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ResourceOtherInfoPo {
private Integer id;
}

@ -1,12 +0,0 @@
package com.engine.seclinktel.service;
/**
* @Author liang.cheng
* @Date 2024/11/4 2:22 PM
* @Description: TODO
* @Version 1.0
*/
public interface ResourceOtherInfoService {
int syncResourceInfo();
}

@ -1,17 +0,0 @@
package com.engine.seclinktel.service.impl;
import com.engine.core.impl.Service;
import com.engine.seclinktel.service.ResourceOtherInfoService;
/**
* @Author liang.cheng
* @Date 2024/11/4 2:22 PM
* @Description: TODO
* @Version 1.0
*/
public class ResourceOtherInfoServiceImpl extends Service implements ResourceOtherInfoService {
@Override
public int syncResourceInfo() {
return 0;
}
}

@ -1,49 +0,0 @@
package com.engine.seclinktel.web;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.engine.common.util.ServiceUtil;
import com.engine.seclinktel.service.ResourceOtherInfoService;
import com.engine.seclinktel.service.impl.ResourceOtherInfoServiceImpl;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.HashMap;
import java.util.Map;
/**
* @Author liang.cheng
* @Date 2024/11/4 2:21 PM
* @Description: TODO
* @Version 1.0
*/
public class ResourceOtherInfoAction {
private ResourceOtherInfoService getService(User user) {
return ServiceUtil.getService(ResourceOtherInfoServiceImpl.class,user);
}
@POST
@Path("/sync")
@Produces(MediaType.TEXT_PLAIN)
public String syncResourceInfo(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> data = new HashMap<>(8);
try {
User user = HrmUserVarify.getUser(request, response);
data.put("datas",getService(user).syncResourceInfo());
data.put("api_status", true);
} catch (Exception e) {
data.put("api_status", false);
data.put("msg", "catch exception : " + e.getMessage());
}
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
}
}

@ -1,5 +1,9 @@
package test; package test;
import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;
/** /**
* @Author weaver_cl * @Author weaver_cl
* @Description: * @Description:
@ -9,6 +13,14 @@ package test;
public class MainTest { public class MainTest {
public static void main(String[] args) { public static void main(String[] args) {
String birthDateString = "1997-11-09";
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 解析生日字符串为 LocalDate 对象
LocalDate birthDate = LocalDate.parse(birthDateString, formatter);
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 计算年龄
System.out.println(Period.between(birthDate, currentDate).getYears());
} }
} }

@ -1,7 +1,18 @@
package weaver.interfaces.seclinktel.crob; package weaver.interfaces.seclinktel.crob;
import com.cloudstore.dev.api.bean.MessageBean;
import com.cloudstore.dev.api.bean.MessageType;
import com.cloudstore.dev.api.util.Util_Message;
import com.weaver.general.BaseBean;
import com.weaver.general.Util;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.interfaces.schedule.BaseCronJob; import weaver.interfaces.schedule.BaseCronJob;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
/** /**
* @Author liang.cheng * @Author liang.cheng
* @Date 2024/11/4 2:12 PM * @Date 2024/11/4 2:12 PM
@ -9,8 +20,48 @@ import weaver.interfaces.schedule.BaseCronJob;
* @Version 1.0 * @Version 1.0
*/ */
public class PerMessageRemindCrob extends BaseCronJob { public class PerMessageRemindCrob extends BaseCronJob {
@Override @Override
public void execute() { public void execute() {
// 每年6月30日、12月31日对在职人员发送消息提醒
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
String messageRemindId = bb.getPropValue("seclinktel", "messageRemindId");
MessageType messageType = MessageType.newInstance(Integer.valueOf(messageRemindId));
Set<String> userIdList = new HashSet<>();
rs.executeQuery("select id from hrmresource where status < 4");
while (rs.next()) {
userIdList.add(Util.null2String(rs.getString("id")));
}
String context = "";
String currentDate = DateUtil.getCurrentDate();
String billid = "";
rs.executeQuery("select id,txnr from uf_ryxxbgtx where wybs = 'HrmRemind'");
if (rs.next()){
billid = Util.null2String(rs.getString("id"));
context = Util.null2String(rs.getString("txnr"));
}
context = context.replace("$Date$", currentDate);
String title = "";
String messageModeId = bb.getPropValue("seclinktel", "messageModeId");
String linkUrl = String.format("/spa/cube/index.html#/main/cube/card?type=0&modeId=%s&billid=%s",messageModeId,billid);
String linkMobileUrl = String.format("/spa/cube/index.html#/main/cube/card?type=0&modeId=%s&billid=%s",messageModeId,billid);
MessageBean messageBean = null;
try {
messageBean = Util_Message.createMessage(messageType, userIdList, title, context, linkUrl, linkMobileUrl);
messageBean.setCreater(1);
Util_Message.store(messageBean);
} catch (IOException e) {
e.printStackTrace();
}
} }
} }

@ -1,6 +1,13 @@
package weaver.interfaces.seclinktel.crob; package weaver.interfaces.seclinktel.crob;
import com.weaver.general.BaseBean;
import com.weaver.general.Util;
import weaver.conn.RecordSet;
import weaver.interfaces.schedule.BaseCronJob; import weaver.interfaces.schedule.BaseCronJob;
import weaver.interfaces.seclinktel.entity.po.ResourceOtherInfoPo;
import weaver.interfaces.seclinktel.util.DutyUtils;
import java.util.List;
/** /**
* @Author liang.cheng * @Author liang.cheng
@ -9,8 +16,42 @@ import weaver.interfaces.schedule.BaseCronJob;
* @Version 1.0 * @Version 1.0
*/ */
public class ResourceAgeUpdateCron extends BaseCronJob { public class ResourceAgeUpdateCron extends BaseCronJob {
@Override @Override
public void execute() { public void execute() {
List<ResourceOtherInfoPo> hrmResource = DutyUtils.getHrmResource();
BaseBean bb = new BaseBean();
String scopeId = bb.getPropValue("seclinktel", "scopeid");
String ageField = bb.getPropValue("seclinktel", "age");
RecordSet rs = new RecordSet();
hrmResource.forEach(e -> {
//1.Age计算
Integer age = DutyUtils.getAge(e.getBirthday());
//2.插入更新
rs.executeQuery("select count(1) as nums from cus_fielddata where " +
" scope = 'HrmCustomFieldByInfoType' and scopeid = "+scopeId+" and id = ?",e.getId());
rs.next();
int nums = Util.getIntValue(rs.getString("nums"));
if (nums > 0) {
//更新
rs.executeUpdate("update cus_fielddata set "+ageField+" = ? " +
" where id=? and scope = 'HrmCustomFieldByInfoType' and "+scopeId+" = 1",age,e.getId());
}else {
//插入
rs.executeUpdate("insert into cus_fielddata(scope,scopeid,id,"+ageField+") values(?,?,?,?)","HrmCustomFieldByInfoType",scopeId,e.getId(),age);
}
});
} }
} }

@ -0,0 +1,67 @@
package weaver.interfaces.seclinktel.crob;
import com.weaver.general.Util;
import weaver.conn.RecordSet;
import weaver.interfaces.schedule.BaseCronJob;
import weaver.interfaces.seclinktel.entity.po.EducationModePo;
import weaver.interfaces.seclinktel.entity.po.WorkInfoModePo;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Author liang.cheng
* @Date 2024/11/5 4:10 PM
* @Description: TODO
* @Version 1.0
*/
public class ResourcePersonInfoCron extends BaseCronJob {
@Override
public void execute() {
RecordSet rs = new RecordSet();
//1.工作经历
List<WorkInfoModePo> workInfos = new ArrayList<>();
rs.executeQuery("select xm,qgslzsj,gsmc,zw1 from uf_gzjl");
while (rs.next()) {
Integer userId = Util.getIntValue(rs.getString("xm"));
String lastCompanyLeaveDate = Util.null2String(rs.getString("qgslzsj"));
String lastWorkunitName = Util.null2String(rs.getString("gsmc"));
String lastJobName = Util.null2String(rs.getString("zw1"));
workInfos.add(WorkInfoModePo.builder().userId(userId).lastCompanyLeaveDate(lastCompanyLeaveDate).lastWorkunitName(lastWorkunitName).lastJobName(lastJobName).build());
}
List<WorkInfoModePo> workResult = new ArrayList<>(workInfos.stream()
.filter(workInfo -> workInfo.getLastCompanyLeaveDate() != null)
.collect(Collectors.toMap(
WorkInfoModePo::getUserId,
Function.identity(),
BinaryOperator.maxBy(Comparator.comparing(WorkInfoModePo::getLastCompanyLeaveDate))))
.values());
//2.教育经历第一学历
List<EducationModePo> educationFirst = new ArrayList<>();
rs.executeQuery("select xm,xl,zy from uf_jxjl where sfwdyxl = 0");
while (rs.next()) {
Integer userId = Util.getIntValue(rs.getString("xm"));
}
//2.教育经历最高学历
List<EducationModePo> educationHighest = new ArrayList<>();
rs.executeQuery("select xm,xl,zy from uf_jxjl where sfwzgxl = 0");
while (rs.next()) {
}
}
}

@ -0,0 +1,33 @@
package weaver.interfaces.seclinktel.entity.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author liang.cheng
* @Date 2024/11/5 5:39 PM
* @Description: TODO
* @Version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EducationModePo {
private Integer id;
private Integer userId;
private String firstDegree;
private String firstDegreeMajor;
private String highestDegree;
private String highestDegreeMajor;
}

@ -0,0 +1,41 @@
package weaver.interfaces.seclinktel.entity.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author liang.cheng
* @Date 2024/11/4 2:32 PM
* @Description: TODO
* @Version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ResourceOtherInfoPo {
private Integer id;
private String birthday;
private String firstDegree;
private String firstDegreeMajor;
private String highestDegree;
private String highestDegreeMajor;
private Integer age;
private String lastWorkunitName;
private String lastJobName;
}

@ -0,0 +1,27 @@
package weaver.interfaces.seclinktel.entity.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author liang.cheng
* @Date 2024/11/5 4:53 PM
* @Description: TODO
* @Version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WorkInfoModePo {
private Integer userId;
private String lastCompanyLeaveDate;
private String lastWorkunitName;
private String lastJobName;
}

@ -0,0 +1,47 @@
package weaver.interfaces.seclinktel.util;
import com.weaver.general.Util;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.interfaces.seclinktel.entity.po.ResourceOtherInfoPo;
import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
/**
* @Author liang.cheng
* @Date 2024/11/4 3:44 PM
* @Description: TODO
* @Version 1.0
*/
public class DutyUtils {
public static List<ResourceOtherInfoPo> getHrmResource(){
List<ResourceOtherInfoPo> infoPoList = new ArrayList<>();
RecordSet rs = new RecordSet();
rs.executeQuery("select id,birthday from hrmresource");
while (rs.next()) {
Integer id = Util.getIntValue(rs.getString("id"));
String birthday = Util.null2String(rs.getString("birthday"));
if (StringUtils.isNotBlank(birthday)) {
infoPoList.add(ResourceOtherInfoPo.builder().id(id).birthday(birthday).build());
}
}
return infoPoList;
}
public static Integer getAge(String birthday) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 解析生日字符串为 LocalDate 对象
LocalDate birthDate = LocalDate.parse(birthday, formatter);
LocalDate currentDate = LocalDate.now();
return Period.between(birthDate, currentDate).getYears();
}
}
Loading…
Cancel
Save