|
@@ -27,6 +27,11 @@ public class KYServiceImpl implements KYService {
|
|
|
@Autowired
|
|
|
private DDConf ddConf;
|
|
|
|
|
|
+ //成都凯悦-年假(测试)
|
|
|
+ private static final String LEAVE_CODE = "28abb7bf-e1b6-4387-9e2a-e1b2ae983e7a";
|
|
|
+ //体验社-年假测试wzy
|
|
|
+// private static final String LEAVE_CODE = "f9240c02-8fe7-4535-af2c-ca6740e1c654";
|
|
|
+
|
|
|
@Override
|
|
|
public List<Map> getEmployeeRosterInfo(Map<String, Object> map) {
|
|
|
//获取accessToken
|
|
@@ -221,7 +226,7 @@ public class KYServiceImpl implements KYService {
|
|
|
//查询出用户消费年假记录 当返回leaveRecords中calType为null或不返回该字段则为请假消耗 将计算出的年假数减去请假消耗的数量
|
|
|
Map body = new HashMap();
|
|
|
body.put("opUserId",opUserId);
|
|
|
- body.put("leaveCode","f9240c02-8fe7-4535-af2c-ca6740e1c654");//测试年假wzy
|
|
|
+ body.put("leaveCode",LEAVE_CODE);
|
|
|
body.put("userIds",new String[]{userId});
|
|
|
body.put("pageNumber",0);
|
|
|
body.put("pageSize",50);
|
|
@@ -229,21 +234,24 @@ public class KYServiceImpl implements KYService {
|
|
|
Map useResult = (Map) useDdr.getResult();
|
|
|
List<Map> useList = (List<Map>) useResult.get("leaveRecords");
|
|
|
Double useLeaveNum = 0d;
|
|
|
- for (Map use : useList) {
|
|
|
- //判断是否为今年请假
|
|
|
- DateTime gmtCreate = DateUtil.date((long) use.get("gmtCreate"));
|
|
|
- if (DateUtil.year(gmtCreate) == DateUtil.year(new Date())){
|
|
|
- //判断是否为正常请假而不是接口测试或期初假期发放
|
|
|
- if (!"接口测试修改".equals(use.get("leaveReason").toString()) && !"期初假期发放".equals(use.get("leaveReason").toString())){
|
|
|
- //若是请假消耗或管理员手动减少
|
|
|
- if (!use.containsKey("calType") || Objects.isNull(use.get("calType")) || "delete".equals(use.get("calType").toString())){
|
|
|
- useLeaveNum += (int) use.get("recordNumPerDay") / 100;
|
|
|
+ if (Objects.nonNull(useList) && !useList.isEmpty()){
|
|
|
+ for (Map use : useList) {
|
|
|
+ //判断是否为今年请假
|
|
|
+ DateTime gmtCreate = DateUtil.date((long) use.get("gmtCreate"));
|
|
|
+ if (DateUtil.year(gmtCreate) == DateUtil.year(new Date())){
|
|
|
+ //判断是否为正常请假而不是接口测试或期初假期发放
|
|
|
+ if (!"接口测试修改".equals(use.get("leaveReason").toString()) && !"期初假期发放".equals(use.get("leaveReason").toString())){
|
|
|
+ //若是请假消耗或管理员手动减少
|
|
|
+ if (!use.containsKey("calType") || Objects.isNull(use.get("calType")) || "delete".equals(use.get("calType").toString())){
|
|
|
+ useLeaveNum += (int) use.get("recordNumPerDay") / 100;
|
|
|
+ }
|
|
|
+ //注:若是管理员手动增加 则假期余额会多出一个BCXsunNm记录增加的假期天数 最终会在设置的假期余额的基础上加上这些天数
|
|
|
+ //故此处手动新增的假期余额不做处理
|
|
|
}
|
|
|
- //注:若是管理员手动增加 则假期余额会多出一个BCXsunNm记录增加的假期天数 最终会在设置的假期余额的基础上加上这些天数
|
|
|
- //故此处手动新增的假期余额不做处理
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//实际年假数
|
|
|
double realYearLeave = (yearLeave - useLeaveNum) < 0 ? 0 : (yearLeave - useLeaveNum);
|
|
|
|
|
@@ -263,8 +271,7 @@ public class KYServiceImpl implements KYService {
|
|
|
//额度所对应的周期,格式必须是"yyyy",例如"2021"
|
|
|
leave_quotas.put("quota_cycle",DateUtil.year(new Date())+"");
|
|
|
//自定义添加的假期类型:年假开发测试的leave_code
|
|
|
- //leave_quotas.put("leave_code","28abb7bf-e1b6-4387-9e2a-e1b2ae983e7a");
|
|
|
- leave_quotas.put("leave_code","f9240c02-8fe7-4535-af2c-ca6740e1c654");//测试
|
|
|
+ leave_quotas.put("leave_code",LEAVE_CODE);
|
|
|
//要更新的员工的userId
|
|
|
leave_quotas.put("userid",userId);
|
|
|
|