Commit 24d428a1 authored by 赵啸非's avatar 赵啸非

添加接口同步效能记录

parent 05b6cd81
...@@ -148,39 +148,28 @@ public class PerformEffectRecordServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -148,39 +148,28 @@ public class PerformEffectRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
if (rest.getCode() == 0) { if (rest.getCode() == 0) {
List<EffectSaveReq> list = rest.getData(); List<EffectSaveReq> list = rest.getData();
for (EffectSaveReq effectSaveReq : list) { for (EffectSaveReq effectSaveReq : list) {
boolean isMobile = Validator.isMobile(effectSaveReq.getPhone()); //先判断手机号码 如果手机号码为空 再比对人的姓名
if (!isMobile) continue; /* boolean isMobile = Validator.isMobile(effectSaveReq.getPhone());
if (ObjectUtils.isEmpty(effectSaveReq.getRuleCode())) continue; if (!isMobile) continue;*/
if (ObjectUtils.isEmpty(effectSaveReq.getPhone())) {
//通过名称查询员工,再看是否有匹配的
if (!ObjectUtils.isEmpty(effectSaveReq.getStaffName())) { PerformRulesEntity rule = getRule(effectSaveReq.getRuleCode());
StaffQuery staffQuery = new StaffQuery();
staffQuery.setName(effectSaveReq.getStaffName()); if (ObjectUtils.isEmpty(rule)) continue;
StaffEntity staffEntity = staffService.selectOne(staffQuery);
if (!ObjectUtils.isEmpty(staffEntity)) {
effectSaveReq.setPhone(staffEntity.getPhoneNumber());
}
} else {
continue;
}
}
Long ruleId = null;
PerformRulesEntity rule = rulesService.getCache(effectSaveReq.getRuleCode());
if (ObjectUtils.isEmpty(rule)) {
ruleId = rule.getId();
}
//查询是否存在 如果没有 则保存 //查询是否存在 如果没有 则保存
PerformEffectRecordQuery effectRecordQuery = new PerformEffectRecordQuery(); PerformEffectRecordQuery effectRecordQuery = new PerformEffectRecordQuery();
effectRecordQuery.setHappenTime(effectSaveReq.getHappenTime()); effectRecordQuery.setHappenTime(effectSaveReq.getHappenTime());
effectRecordQuery.setWindowNum(effectSaveReq.getWindowNum()); effectRecordQuery.setWindowNum(effectSaveReq.getWindowNum());
if (!ObjectUtils.isEmpty(ruleId)) { effectRecordQuery.setRuleId(rule.getId());
effectRecordQuery.setRuleId(ruleId); PerformEffectRecordEntity performEffectRecordEntity = this.selectOne(effectRecordQuery, context);
if (ObjectUtils.isEmpty(performEffectRecordEntity)) {
performEffectRecordEntity.setRemark(effectSaveReq.getExt());
performEffectRecordEntity.setUpdateTime(new Date());
this.update(performEffectRecordEntity, context);
} else {
effect(effectSaveReq);
} }
// effectRecordQuery.setRemark(effectSaveReq.getExt());
int count = this.count(effectRecordQuery, context);
if (count > 0) continue;
//保存
effect(effectSaveReq);
} }
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -242,7 +231,9 @@ public class PerformEffectRecordServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -242,7 +231,9 @@ public class PerformEffectRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
private boolean effect(EffectSaveReq req) throws AppException { private boolean effect(EffectSaveReq req) throws AppException {
//效能保存 //效能保存
StaffEntity staffEntity = getStaff(req.getPhone()); //StaffEntity staffEntity = getStaff(req.getPhone());
StaffEntity staffEntity = getStaff(req);
if (ObjectUtils.isEmpty(staffEntity))return false;
PerformRulesEntity rule = getRule(req.getRuleCode()); PerformRulesEntity rule = getRule(req.getRuleCode());
PerformEffectRecordEntity recordEntity = new PerformEffectRecordEntity(); PerformEffectRecordEntity recordEntity = new PerformEffectRecordEntity();
recordEntity.initAttrValue(); recordEntity.initAttrValue();
...@@ -299,6 +290,7 @@ public class PerformEffectRecordServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -299,6 +290,7 @@ public class PerformEffectRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
private PerformRulesEntity getRule(String ruleCode) { private PerformRulesEntity getRule(String ruleCode) {
if (ObjectUtils.isEmpty(ruleCode)) return null;
PerformRulesEntity rule = rulesService.getCache(ruleCode); PerformRulesEntity rule = rulesService.getCache(ruleCode);
return rule; return rule;
} }
...@@ -308,6 +300,19 @@ public class PerformEffectRecordServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -308,6 +300,19 @@ public class PerformEffectRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
return staffEntity; return staffEntity;
} }
private StaffEntity getStaff(EffectSaveReq req) {
if (!ObjectUtils.isEmpty(req.getPhone())) {
StaffEntity staffEntity = staffService.selectOne(new StaffQuery().phoneNumber(req.getPhone()));
if (!ObjectUtils.isEmpty(staffEntity)) return staffEntity;
}
if (!ObjectUtils.isEmpty(req.getStaffName())) {
StaffEntity staffEntity = staffService.selectOne(new StaffQuery().name(req.getStaffName()));
if (!ObjectUtils.isEmpty(staffEntity)) return staffEntity;
}
return null;
}
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -4,9 +4,9 @@ POST {{baseUrl}}/login/login ...@@ -4,9 +4,9 @@ POST {{baseUrl}}/login/login
Content-Type: application/json Content-Type: application/json
{ {
"loginName":"admin", "loginName": "admin",
"password":"xhxADMIN8@a", "password": "xhxADMIN8@a",
"securityCode":"admin" "securityCode": "admin"
} }
> {% > {%
...@@ -37,8 +37,8 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceRecord ...@@ -37,8 +37,8 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceRecord
Content-Type: application/json Content-Type: application/json
{ {
"attendanceDateStart":"2024-02-01", "attendanceDateStart": "2024-02-01",
"attendanceDateEnd":"2024-02-29" "attendanceDateEnd": "2024-02-29"
} }
###海康考勤打卡记录计算1 ###海康考勤打卡记录计算1
...@@ -46,8 +46,8 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceRecord ...@@ -46,8 +46,8 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceRecord
Content-Type: application/json Content-Type: application/json
{ {
"attendanceDateStart":"2023-12-04", "attendanceDateStart": "2023-12-04",
"attendanceDateEnd":"2023-12-08", "attendanceDateEnd": "2023-12-08",
"staffId": 322 "staffId": 322
} }
...@@ -59,8 +59,8 @@ Authorization: {{authToken}} ...@@ -59,8 +59,8 @@ Authorization: {{authToken}}
Content-Type: application/json Content-Type: application/json
{ {
"attendanceDateStart":"2023-12-01", "attendanceDateStart": "2023-12-01",
"attendanceDateEnd":"2024-01-25" "attendanceDateEnd": "2024-01-25"
} }
...@@ -69,8 +69,8 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceHikRecordCustom ...@@ -69,8 +69,8 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceHikRecordCustom
Content-Type: application/json Content-Type: application/json
{ {
"attendanceDateStart":"2024-02-01", "attendanceDateStart": "2024-02-01",
"attendanceDateEnd":"2024-03-13" "attendanceDateEnd": "2024-03-13"
} }
...@@ -78,7 +78,10 @@ Content-Type: application/json ...@@ -78,7 +78,10 @@ Content-Type: application/json
POST {{baseUrl}}/attendance/stat/summary POST {{baseUrl}}/attendance/stat/summary
Content-Type: application/json Content-Type: application/json
{"summaryTimeStart":"2024-03-15","summaryTimeEnd":"2024-03-15"} {
"summaryTimeStart": "2024-03-15",
"summaryTimeEnd": "2024-03-15"
}
...@@ -86,15 +89,19 @@ Content-Type: application/json ...@@ -86,15 +89,19 @@ Content-Type: application/json
POST {{baseUrl}}/staff/perform/summary/summary POST {{baseUrl}}/staff/perform/summary/summary
Content-Type: application/json Content-Type: application/json
{"checkTimeStart":"2024-02-01","checkTimeEnd":"2024-03-20","checkType":4} {
"checkTimeStart": "2024-02-01",
"checkTimeEnd": "2024-03-20",
"checkType": 4
}
###考勤打卡记录异常信息列表 ###考勤打卡记录异常信息列表
POST {{baseUrl}}/attendance/record/error/doReprocess POST {{baseUrl}}/attendance/record/error/doReprocess
Content-Type: application/json Content-Type: application/json
{ {
"errorDateTimeStart":"2024-02-01", "errorDateTimeStart": "2024-02-01",
"errorDateTimeEnd":"2024-03-20" "errorDateTimeEnd": "2024-03-20"
} }
###效能监察同步 ###效能监察同步
...@@ -102,8 +109,8 @@ POST {{baseUrl}}/perform/effect/record/sync ...@@ -102,8 +109,8 @@ POST {{baseUrl}}/perform/effect/record/sync
Content-Type: application/json Content-Type: application/json
{ {
"happenTimeStart": "2024-02-01", "happenTimeStart": "2024-03-08",
"happenTimeEnd": "2024-02-29" "happenTimeEnd": "2024-03-09"
} }
...@@ -120,14 +127,14 @@ Accept: application/json ...@@ -120,14 +127,14 @@ Accept: application/json
###钉钉请假 ###钉ding
POST {{baseUrl}}/attendance/leave/record/syncLeaveRecord POST {{baseUrl}}/attendance/leave/record/syncLeaveRecord
Authorization: {{authToken}} Authorization: {{authToken}}
Content-Type: application/json Content-Type: application/json
{ {
"startTimeStart":"2024-03-01", "startTimeStart": "2024-03-08",
"endTimeEnd":"2024-03-14" "endTimeEnd": "2024-03-09"
} }
...@@ -136,6 +143,6 @@ POST {{baseUrl}}/api/v1/web/effect/save ...@@ -136,6 +143,6 @@ POST {{baseUrl}}/api/v1/web/effect/save
Content-Type: application/json Content-Type: application/json
{ {
"windowNum":"123123" "windowNum": "123123"
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment