Commit 6ed18014 authored by daijunxiong's avatar daijunxiong

修改定时任务 新增假期管理

parent 6e69e733
......@@ -83,7 +83,7 @@ public class ArtemisPostTest {
final String getCamsApi = ARTEMIS_PATH + "/api/resource/v1/person/personList";
Map<String, String> paramMap = new HashMap<String, String>();// post请求Form表单参数
paramMap.put("pageNo", "1");
paramMap.put("pageSize", "10");
paramMap.put("pageSize", "1000");
String body = JSON.toJSON(paramMap).toString();
Map<String, String> path = new HashMap<String, String>(2) {
{
......@@ -106,7 +106,7 @@ public class ArtemisPostTest {
final String getCamsApi = ARTEMIS_PATH + "/api/resource/v1/person/personList";
Map<String, String> paramMap = new HashMap<String, String>();// post请求Form表单参数
paramMap.put("pageNo", "1");
paramMap.put("pageSize", "10");
paramMap.put("pageSize", "1000");
String body = JSON.toJSON(paramMap).toString();
Map<String, String> path = new HashMap<String, String>(2) {
{
......
......@@ -18,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
......@@ -43,32 +44,35 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
String resultPerson = ArtemisPostTest.callPostApiGetPersonList();
JSONObject jsonObject = JSON.parseObject(resultPerson);
JSONObject jsonObject1 = jsonObject.getJSONObject("data");
PersonHikData personHikData =JSONObject.parseObject(jsonObject1.toJSONString(),PersonHikData.class);
log.info("海康人员数据"+personHikData);
PersonHikData personHikData = JSONObject.parseObject(jsonObject1.toJSONString(), PersonHikData.class);
if (Objects.nonNull(personHikData)) {
for (ListItem list : personHikData.getList()) {
//根据id获取本地数据
StaffEntity staffEntity1 = staffDao.get(Long.valueOf(list.getPersonId()));
List<StaffEntity> staffEntitieList = staffDao.queryAllList();
StaffEntity staffEntity1 = staffDao.queryHik(list.getPersonId());
List<StaffEntity> staffEntitieList = new ArrayList<>();
//判断本地数据是否为空
if (Objects.isNull(staffEntity1)) {
//如果为空则将数据存入数据库
staffEntity1.setName(list.getPersonName());
staffEntity1.setRemark(list.getPersonId());
staffEntity1.setPhotoPath(list.getPersonPhoto().getPicUri());
staffEntity1.setDeptName(list.getOrgName());
staffEntity1.setDeptId(Long.valueOf(list.getOrgIndexCode()));
staffEntity1.setDeptName(list.getOrgName());
staffEntity1.setSource(1);
if (list.getBirthday()!=null){
staffEntity1.setBirthday((Date) list.getBirthday());
StaffEntity staffEntity= new StaffEntity();
System.out.println(list.getPersonName());
staffEntity.setName(list.getPersonName());
staffEntity.setRemark(list.getPersonId());
staffEntity.setPhotoPath(list.getPersonPhoto().getPicUri());
staffEntity.setDeptName(list.getOrgName());
staffEntity.setSource(1);
staffEntity.setCreateUserId(Long.valueOf(1));
staffEntity.setCreateTime(new Date());
if (list.getBirthday() != null) {
staffEntity.setBirthday((Date) list.getBirthday());
}
if (list.getPhoneNo()!=null){
staffEntity1.setPhoneNumber(String.valueOf(list.getPhoneNo()));
if (list.getPhoneNo() != null) {
staffEntity.setPhoneNumber(String.valueOf(list.getPhoneNo()));
}
log.info("新增人员信息"+staffEntity1);
staffDao.insert(staffEntity1);
System.out.println("111" + staffEntity);
staffDao.insert(staffEntity);
}
//本地数据不为空
else {
//本地数据遍历数据
......
package com.mortals.xhx.module.attendance.web;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordEntity;
import com.mortals.xhx.module.attendance.service.AttendanceLeaveRecordService;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.workman.model.WorkmanQuery;
import com.mortals.xhx.module.workman.service.WorkmanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordEntity;
import com.mortals.xhx.module.attendance.service.AttendanceLeaveRecordService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 请假记录信息
......@@ -35,6 +28,10 @@ public class AttendanceLeaveRecordController extends BaseCRUDJsonBodyMappingCont
@Autowired
private ParamService paramService;
@Autowired
private DeptService deptService;
@Autowired
private WorkmanService workmanService;
public AttendanceLeaveRecordController(){
super.setModuleDesc( "请假记录信息");
......@@ -42,6 +39,8 @@ public class AttendanceLeaveRecordController extends BaseCRUDJsonBodyMappingCont
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "deptId", deptService.find(new DeptQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(), y->y.getDeptName(),(o, n)->n)));
this.addDict(model, "approverId", workmanService.find(new WorkmanQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(), y->y.getName(),(o, n)->n)));
this.addDict(model, "leaveType", paramService.getParamBySecondOrganize("AttendanceLeaveRecord","leaveType"));
super.init(model, context);
}
......
package com.mortals.xhx.module.attendance.web;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceEntity;
import com.mortals.xhx.module.attendance.service.AttendanceVacationBalanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceEntity;
import com.mortals.xhx.module.attendance.service.AttendanceVacationBalanceService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 员工假期余额信息
......
package com.mortals.xhx.module.attendance.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceEntity;
import com.mortals.xhx.module.attendance.model.AttendanceVacationRecordEntity;
import com.mortals.xhx.module.attendance.service.AttendanceVacationBalanceService;
import com.mortals.xhx.module.attendance.service.AttendanceVacationRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.attendance.model.AttendanceVacationRecordEntity;
import com.mortals.xhx.module.attendance.service.AttendanceVacationRecordService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 员工假期记录信息
......@@ -35,6 +25,8 @@ public class AttendanceVacationRecordController extends BaseCRUDJsonBodyMappingC
@Autowired
private ParamService paramService;
@Autowired
private AttendanceVacationBalanceService attendanceVacationBalanceService;
public AttendanceVacationRecordController(){
super.setModuleDesc( "员工假期记录信息");
......@@ -47,5 +39,10 @@ public class AttendanceVacationRecordController extends BaseCRUDJsonBodyMappingC
super.init(model, context);
}
@Override
protected void saveBefore(AttendanceVacationRecordEntity entity, Map<String, Object> model, Context context) throws AppException {
AttendanceVacationBalanceEntity attendanceVacationBalanceEntity=attendanceVacationBalanceService.get(entity.getStaffId());
model.put("allHoliday",attendanceVacationBalanceEntity);
super.saveBefore(entity, model, context);
}
}
\ No newline at end of file
......@@ -51,8 +51,8 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "deptStatus", paramService.getParamBySecondOrganize("Dept", "deptStatus"));
this.addDict(model, "id", deptService.find(new DeptQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(), y->y.getDeptName(),(o, n)->n)));
this.addDict(model, "id", workmanService.find(new WorkmanQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(), y->y.getName(),(o, n)->n)));
this.addDict(model, "deptName", deptService.find(new DeptQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(), y->y.getDeptName(),(o, n)->n)));
this.addDict(model, "workName", workmanService.find(new WorkmanQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(), y->y.getName(),(o, n)->n)));
super.init(model, context);
}
......
......@@ -58,4 +58,8 @@ public interface StaffDao extends ICRUDDao<StaffEntity,Long>{
int queryPersonNum(Long deptId);
/**
*
* */
StaffEntity queryHik(String remark);
}
......@@ -58,6 +58,10 @@ public class StaffDaoImpl extends BaseCRUDDaoMybatis<StaffEntity,Long> implement
return this.getSqlSession().selectOne(this.getSqlId("queryPersonNum"),deptId);
}
@Override
public StaffEntity queryHik(String remark) {
return this.getSqlSession().selectOne(this.getSqlId("queryHik"),remark);
}
}
......@@ -1340,5 +1340,8 @@
<select id="queryPersonNum" resultType="integer">
select count(1) personNum from mortals_xhx_staff where deptId = #{deptId}
</select>
<select id="queryHik" resultType="com.mortals.xhx.module.staff.model.StaffEntity">
select * from mortals_xhx_staff where remark = #{remark}
</select>
</mapper>
\ No newline at end of file
......@@ -19,16 +19,6 @@ Authorization: {{authToken}}
Content-Type: application/json
{
"staffId":89,
"staffName":"7kltos",
"deptId":609,
"deptName":"6476z6",
"entryTime":"1680796800000",
"personalLeaveDays":0,
"compensatedLeaveDays":0,
"sickLeaveDays":0,
"annualLeaveDays":0,
"marriageLeaveDays":0,
"page":1,
"size":10
}
......@@ -58,7 +48,7 @@ client.global.set("AttendanceVacationBalance_id", JSON.parse(response.body).data
%}
###员工假期余额信息查看
GET {{baseUrl}}/attendance/vacation/balance/info?id={{AttendanceVacationBalance_id}}
GET {{baseUrl}}/attendance/vacation/balance/info?id=1
Authorization: {{authToken}}
Accept: application/json
......
......@@ -47,7 +47,7 @@ client.global.set("AttendanceVacationRecord_id", JSON.parse(response.body).data.
%}
###员工假期记录信息查看
GET {{baseUrl}}/attendance/vacation/record/info?id={{AttendanceVacationRecord_id}}
GET {{baseUrl}}/attendance/vacation/record/info?id=1
Authorization: {{authToken}}
Accept: application/json
......
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