Commit 044f62c4 authored by daijunxiong's avatar daijunxiong

新增考勤统计

parent 4cad9a2a
package com.mortals.xhx; package com.mortals.xhx;
import com.mortals.framework.springcloud.boot.BaseWebApplication; import com.mortals.framework.springcloud.boot.BaseWebApplication;
import com.mortals.xhx.module.dept.dao.ibatis.DeptDaoImpl;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.staff.dao.ibatis.StaffDaoImpl;
import com.mortals.xhx.module.staff.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ImportResource; import org.springframework.context.annotation.ImportResource;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@EnableFeignClients @EnableFeignClients
@SpringBootApplication(scanBasePackages = {"com.mortals"}) @SpringBootApplication(scanBasePackages = {"com.mortals"})
@ServletComponentScan("com.mortals") @ServletComponentScan("com.mortals")
@ImportResource(locations = {"classpath:config/spring-config.xml"}) @ImportResource(locations = {"classpath:config/spring-config.xml"})
@Component
public class ManagerApplication extends BaseWebApplication { public class ManagerApplication extends BaseWebApplication {
// @Bean // @Bean
...@@ -17,10 +27,166 @@ public class ManagerApplication extends BaseWebApplication { ...@@ -17,10 +27,166 @@ public class ManagerApplication extends BaseWebApplication {
// return new LocalCacheServiceImpl(); // return new LocalCacheServiceImpl();
// } // }
@Autowired
private DeptDaoImpl deptDao1;
private static DeptDaoImpl deptDao;
@Autowired
private StaffDaoImpl staffDao1;
private static StaffDaoImpl staffDao;
@Autowired
private StaffService service1;
private static StaffService service;
@Autowired
private DeptService deptService1;
private static DeptService deptService;
@PostConstruct
public void init() {
deptDao = deptDao1;
staffDao = staffDao1;
service = service1;
deptService = deptService1;
}
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(ManagerApplication.class, args); SpringApplication.run(ManagerApplication.class, args);
System.out.println(123465); System.out.println("考勤管理项目启动!!!!!!!!!!!!!");
}
//人员-部门跟新 统计
// try {
// //部门同步
// String resultDept = ArtemisPostTest.callPostApiGetDeptList();
// JSONObject jsonObjectDept = JSON.parseObject(resultDept);
// JSONObject jsonObjectDept1 = jsonObjectDept.getJSONObject("data");
// DeptHikData deptHikData = JSONObject.parseObject(jsonObjectDept1.toJSONString(), DeptHikData.class);
// if (Objects.nonNull(deptHikData)) {
// for (ListDept listDept : deptHikData.getList()) {
// //查询数据库信息
// DeptEntity deptEntity = deptDao.queryDept(listDept.getOrgIndexCode());
// DeptEntity deptEntityParent = deptDao.queryDeptParient(listDept.getParentOrgIndexCode());
// //新增
// if (Objects.isNull(deptEntity)) {
// deptEntity.initAttrValue();
// if (Objects.nonNull(deptEntityParent)) {
// deptEntity.setParentId(deptEntityParent.getId());
// }
// deptEntity.setDeptName(listDept.getOrgName());
// deptEntity.setDeptCode(listDept.getOrgIndexCode());
// deptEntity.setAncestors(listDept.getOrgPath());
// deptEntity.setDeptStatus(1);
// deptEntity.setOrderNum(0);
// deptEntity.setRemark(listDept.getParentOrgIndexCode());
// deptEntity.setCreateTime(new Date());
// deptEntity.setCreateUserId(Long.valueOf(1));
// deptEntity.setUpdateTime(new Date());
// deptEntity.setUpdateUserId(Long.valueOf(1));
// deptService.save(deptEntity);
// } else {
// //更新
// deptEntity.initAttrValue();
// if (Objects.nonNull(deptEntityParent)) {
// deptEntity.setParentId(deptEntityParent.getId());
// }
// deptEntity.setDeptName(listDept.getOrgName());
// deptEntity.setDeptCode(listDept.getOrgIndexCode());
// deptEntity.setAncestors(listDept.getOrgPath());
// deptEntity.setCreateTime(new Date());
// deptEntity.setPersonNum(0);
// deptEntity.setCreateUserId(Long.valueOf(1));
// deptService.update(deptEntity);
// }
// }
// }
// //同步员工
// String resultPerson = ArtemisPostTest.callPostApiGetPersonList();
// JSONObject jsonObject = JSON.parseObject(resultPerson);
// JSONObject jsonObject1 = jsonObject.getJSONObject("data");
// PersonHikData personHikData = JSONObject.parseObject(jsonObject1.toJSONString(), PersonHikData.class);
// if (Objects.nonNull(personHikData)) {
// for (ListItem list : personHikData.getList()) {
// //根据id获取本地数据
// StaffEntity staffEntity1 = staffDao.queryHik(list.getPersonId());
// DeptEntity deptEntity = deptDao.queryDept(list.getOrgIndexCode());
// //判断本地数据是否为空
// if (Objects.isNull(staffEntity1)) {
// //新增员工信息
// staffEntity1.initAttrValue();
// if (Objects.nonNull(staffEntity1)) {
// staffEntity1.setDeptId(deptEntity.getId());
// }
// staffEntity1.setName(list.getPersonName());
// staffEntity1.setRemarkId(list.getPersonId());
// staffEntity1.setPicUri(list.getPersonPhoto().getPicUri());
// staffEntity1.setServerIndexCode(list.getPersonPhoto().getServerIndexCode());
// staffEntity1.setDeptName(list.getOrgName());
// staffEntity1.setSource(1);
// staffEntity1.setStatus(1);
// staffEntity1.setGender(list.getGender());
// staffEntity1.setWorkNum(list.getJobNo());
// staffEntity1.setCreateUserId(Long.valueOf(1));
// staffEntity1.setCreateTime(new Date());
// if (list.getBirthday() != null) {
// staffEntity1.setBirthday((Date) list.getBirthday());
// }
// if (list.getPhoneNo() != null) {
// staffEntity1.setPhoneNumber(String.valueOf(list.getPhoneNo()));
// }
// service.save(staffEntity1);
// //统计各级部门员工数量
// DeptEntity deptEntity1 = deptService.get(staffEntity1.getDeptId());
// String ancestor = deptEntity1.getAncestors().split(",", 2)[1];
// String[] ancestors = ancestor.split(",");
// for (String newAncestor : ancestors) {
// DeptEntity deptEntity2 = deptService.get(Long.valueOf(newAncestor));
// if (Objects.nonNull(deptEntity2)) {
// deptEntity2.setPersonNum(deptEntity2.getPersonNum() + 1);
// deptService.update(deptEntity2);
// }
// }
//
// }
// //本地数据不为空
// else {
// //更新员工信息
// staffEntity1.initAttrValue();
// if (Objects.nonNull(deptEntity)) {
// staffEntity1.setDeptId(deptEntity.getId());
// }
// staffEntity1.setName(list.getPersonName());
// staffEntity1.setRemarkId(list.getPersonId());
// staffEntity1.setPicUri(list.getPersonPhoto().getPicUri());
// staffEntity1.setServerIndexCode(list.getPersonPhoto().getServerIndexCode());
// staffEntity1.setDeptName(list.getOrgName());
// staffEntity1.setGender(list.getGender());
// staffEntity1.setWorkNum(list.getJobNo());
// staffEntity1.setCreateUserId(Long.valueOf(1));
// staffEntity1.setCreateTime(new Date());
// if (list.getBirthday() != null) {
// staffEntity1.setBirthday((Date) list.getBirthday());
// }
// if (list.getPhoneNo() != null) {
// staffEntity1.setPhoneNumber(String.valueOf(list.getPhoneNo()));
// }
// service.update(staffEntity1);
// //统计各级部门员工数量
// DeptEntity deptEntity1 = deptService.get(staffEntity1.getDeptId());
// String ancestor = deptEntity1.getAncestors().split(",", 2)[1];
// String[] ancestors = ancestor.split(",");
// for (String newAncestor : ancestors) {
// DeptEntity deptEntity2 = deptService.get(Long.valueOf(newAncestor));
// if (Objects.nonNull(deptEntity2)) {
// deptEntity2.setPersonNum(deptEntity2.getPersonNum() + 1);
// deptService.update(deptEntity2);
// }
// }
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
}
} }
...@@ -10,6 +10,10 @@ import com.mortals.xhx.busiz.rsp.DeptHikData; ...@@ -10,6 +10,10 @@ import com.mortals.xhx.busiz.rsp.DeptHikData;
import com.mortals.xhx.busiz.rsp.ListDept; import com.mortals.xhx.busiz.rsp.ListDept;
import com.mortals.xhx.busiz.rsp.ListItem; import com.mortals.xhx.busiz.rsp.ListItem;
import com.mortals.xhx.busiz.rsp.PersonHikData; import com.mortals.xhx.busiz.rsp.PersonHikData;
import com.mortals.xhx.module.attendance.dao.ibatis.AttendanceStatDaoImpl;
import com.mortals.xhx.module.attendance.dao.ibatis.AttendanceVacationBalanceDaoImpl;
import com.mortals.xhx.module.attendance.model.AttendanceStatEntity;
import com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceEntity;
import com.mortals.xhx.module.dept.dao.ibatis.DeptDaoImpl; import com.mortals.xhx.module.dept.dao.ibatis.DeptDaoImpl;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
...@@ -43,10 +47,17 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -43,10 +47,17 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private StaffService service; private StaffService service;
@Autowired
private AttendanceStatDaoImpl attendanceStatDao;
@Autowired
private AttendanceVacationBalanceDaoImpl balanceDao;
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
log.info("同步用户--部门"); log.info("同步用户--部门");
try { try {
//部门同步
String resultDept = ArtemisPostTest.callPostApiGetDeptList(); String resultDept = ArtemisPostTest.callPostApiGetDeptList();
JSONObject jsonObjectDept = JSON.parseObject(resultDept); JSONObject jsonObjectDept = JSON.parseObject(resultDept);
JSONObject jsonObjectDept1 = jsonObjectDept.getJSONObject("data"); JSONObject jsonObjectDept1 = jsonObjectDept.getJSONObject("data");
...@@ -56,15 +67,15 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -56,15 +67,15 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
//查询数据库信息 //查询数据库信息
DeptEntity deptEntity = deptDao.queryDept(listDept.getOrgIndexCode()); DeptEntity deptEntity = deptDao.queryDept(listDept.getOrgIndexCode());
DeptEntity deptEntityParent = deptDao.queryDeptParient(listDept.getParentOrgIndexCode()); DeptEntity deptEntityParent = deptDao.queryDeptParient(listDept.getParentOrgIndexCode());
//新增
if (Objects.isNull(deptEntity)) { if (Objects.isNull(deptEntity)) {
deptEntity.initAttrValue();
if (Objects.nonNull(deptEntityParent)) { if (Objects.nonNull(deptEntityParent)) {
deptEntity.setParentId(deptEntityParent.getId()); deptEntity.setParentId(deptEntityParent.getId());
} }
deptEntity.setDeptName(listDept.getOrgName()); deptEntity.setDeptName(listDept.getOrgName());
deptEntity.setDeptCode(listDept.getOrgIndexCode()); deptEntity.setDeptCode(listDept.getOrgIndexCode());
deptEntity.setAncestors(listDept.getOrgPath()); deptEntity.setAncestors(listDept.getOrgPath());
deptEntity.setDeptStatus(1);
deptEntity.setOrderNum(0); deptEntity.setOrderNum(0);
deptEntity.setRemark(listDept.getParentOrgIndexCode()); deptEntity.setRemark(listDept.getParentOrgIndexCode());
deptEntity.setCreateTime(new Date()); deptEntity.setCreateTime(new Date());
...@@ -73,6 +84,8 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -73,6 +84,8 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
deptEntity.setUpdateUserId(Long.valueOf(1)); deptEntity.setUpdateUserId(Long.valueOf(1));
deptService.save(deptEntity); deptService.save(deptEntity);
} else { } else {
//更新
deptEntity.initAttrValue();
if (Objects.nonNull(deptEntityParent)) { if (Objects.nonNull(deptEntityParent)) {
deptEntity.setParentId(deptEntityParent.getId()); deptEntity.setParentId(deptEntityParent.getId());
} }
...@@ -80,6 +93,7 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -80,6 +93,7 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
deptEntity.setDeptCode(listDept.getOrgIndexCode()); deptEntity.setDeptCode(listDept.getOrgIndexCode());
deptEntity.setAncestors(listDept.getOrgPath()); deptEntity.setAncestors(listDept.getOrgPath());
deptEntity.setCreateTime(new Date()); deptEntity.setCreateTime(new Date());
deptEntity.setPersonNum(0);
deptEntity.setCreateUserId(Long.valueOf(1)); deptEntity.setCreateUserId(Long.valueOf(1));
deptService.update(deptEntity); deptService.update(deptEntity);
} }
...@@ -97,7 +111,7 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -97,7 +111,7 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
DeptEntity deptEntity = deptDao.queryDept(list.getOrgIndexCode()); DeptEntity deptEntity = deptDao.queryDept(list.getOrgIndexCode());
//判断本地数据是否为空 //判断本地数据是否为空
if (Objects.isNull(staffEntity1)) { if (Objects.isNull(staffEntity1)) {
//如果为空则将数据存入数据库 //新增员工信息
staffEntity1.initAttrValue(); staffEntity1.initAttrValue();
if (Objects.nonNull(staffEntity1)) { if (Objects.nonNull(staffEntity1)) {
staffEntity1.setDeptId(deptEntity.getId()); staffEntity1.setDeptId(deptEntity.getId());
...@@ -120,26 +134,22 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -120,26 +134,22 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
staffEntity1.setPhoneNumber(String.valueOf(list.getPhoneNo())); staffEntity1.setPhoneNumber(String.valueOf(list.getPhoneNo()));
} }
service.save(staffEntity1); service.save(staffEntity1);
//统计各级部门员工数量
DeptEntity deptEntity1 = deptService.get(staffEntity1.getDeptId()); DeptEntity deptEntity1 = deptService.get(staffEntity1.getDeptId());
String ancestor = deptEntity1.getAncestors().split(",", 2)[1]; String ancestor = deptEntity1.getAncestors().split(",", 2)[1];
String[] ancestors = ancestor.split(","); String[] ancestors = ancestor.split(",");
for (String newAncestor : ancestors) { for (String newAncestor : ancestors) {
DeptEntity deptEntity2 = deptService.get(Long.valueOf(newAncestor)); DeptEntity deptEntity2 = deptService.get(Long.valueOf(newAncestor));
if (Objects.nonNull(deptEntity2)) { if (Objects.nonNull(deptEntity2)) {
int personNumcount = staffDao.queryPersonNum(staffEntity1.getDeptId()); deptEntity2.setPersonNum(deptEntity2.getPersonNum() + 1);
if (Objects.nonNull(personNumcount) && Objects.nonNull(deptEntity2)) {
deptEntity2.setPersonNum(personNumcount);
deptService.update(deptEntity2); deptService.update(deptEntity2);
} }
} }
} }
}
//本地数据不为空 //本地数据不为空
else { else {
//执行修改 //更新员工信息
staffEntity1.initAttrValue(); staffEntity1.initAttrValue();
if (Objects.nonNull(deptEntity)) { if (Objects.nonNull(deptEntity)) {
staffEntity1.setDeptId(deptEntity.getId()); staffEntity1.setDeptId(deptEntity.getId());
...@@ -160,27 +170,89 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -160,27 +170,89 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
staffEntity1.setPhoneNumber(String.valueOf(list.getPhoneNo())); staffEntity1.setPhoneNumber(String.valueOf(list.getPhoneNo()));
} }
service.update(staffEntity1); service.update(staffEntity1);
//统计各级部门员工数量
DeptEntity deptEntity1 = deptService.get(staffEntity1.getDeptId()); DeptEntity deptEntity1 = deptService.get(staffEntity1.getDeptId());
String ancestor = deptEntity1.getAncestors().split(",", 2)[1]; String ancestor = deptEntity1.getAncestors().split(",", 2)[1];
String[] ancestors = ancestor.split(","); String[] ancestors = ancestor.split(",");
for (String newAncestor : ancestors) { for (String newAncestor : ancestors) {
DeptEntity deptEntity2 = deptService.get(Long.valueOf(newAncestor)); DeptEntity deptEntity2 = deptService.get(Long.valueOf(newAncestor));
if (Objects.nonNull(deptEntity2)) { if (Objects.nonNull(deptEntity2)) {
int personNumcount = staffDao.queryPersonNum(staffEntity1.getDeptId()); deptEntity2.setPersonNum(deptEntity2.getPersonNum() + 1);
if (Objects.nonNull(personNumcount) && Objects.nonNull(deptEntity2)) {
deptEntity2.setPersonNum(personNumcount);
deptService.update(deptEntity2); deptService.update(deptEntity2);
} }
} }
} }
//同步人员的考勤汇总信息
AttendanceVacationBalanceEntity balanceEntity = balanceDao.queryEntity(staffEntity1.getId());
AttendanceStatEntity statEntity = attendanceStatDao.queryEntity(staffEntity1.getId());
//为空执行新增
if (Objects.nonNull(statEntity)){
statEntity.initAttrValue();
statEntity.setStaffId(staffEntity1.getId());
statEntity.setStaffName(staffEntity1.getName());
statEntity.setDeptId(staffEntity1.getDeptId());
statEntity.setDeptName(staffEntity1.getDeptName());
//21假
statEntity.setBackToUnit(balanceEntity.getBackToUnit());
statEntity.setOnDutyLeave(balanceEntity.getOnDutyLeave());
statEntity.setOutOfOffice(balanceEntity.getOutOfOffice());
statEntity.setShiftCompensation(balanceEntity.getShiftCompensation());
statEntity.setPhysicalExamination(balanceEntity.getPhysicalExamination());
statEntity.setQuarantine(balanceEntity.getQuarantine());
statEntity.setBusinessTrip(balanceEntity.getBusinessTrip());
statEntity.setPublicHoliday(balanceEntity.getPublicHoliday());
statEntity.setSickLeave(balanceEntity.getSickLeaveDays());
statEntity.setFuneralLeave(balanceEntity.getBereavementLeaveDays());
statEntity.setMarriageLeave(balanceEntity.getMarriageLeaveDays());
statEntity.setChildRearingLeave(balanceEntity.getChildRearingLeave());
statEntity.setBreastfeedingLeaveDays(balanceEntity.getBreastfeedingLeaveDays());
statEntity.setMenstrualLeaveDays(balanceEntity.getMenstrualLeaveDays());
statEntity.setAnnualLeaveDays(balanceEntity.getAnnualLeaveDays());
statEntity.setCompensatedLeaveDays(balanceEntity.getCompensatedLeaveDays());
statEntity.setPaternityLeaveDays(balanceEntity.getPaternityLeaveDays());
statEntity.setMaternityLeave(balanceEntity.getMaternityLeaveDays());
statEntity.setTransferBack(balanceEntity.getTransferBack());
statEntity.setHomeLeave(balanceEntity.getHomeLeave());
statEntity.setPersonalLeave(balanceEntity.getPersonalLeaveDays());
attendanceStatDao.insert(statEntity);
}
//不为空执行修改
else {
statEntity.initAttrValue();
statEntity.setStaffId(staffEntity1.getId());
statEntity.setStaffName(staffEntity1.getName());
statEntity.setDeptId(staffEntity1.getDeptId());
statEntity.setDeptName(staffEntity1.getDeptName());
//21假
statEntity.setBackToUnit(balanceEntity.getBackToUnit());
statEntity.setOnDutyLeave(balanceEntity.getOnDutyLeave());
statEntity.setOutOfOffice(balanceEntity.getOutOfOffice());
statEntity.setShiftCompensation(balanceEntity.getShiftCompensation());
statEntity.setPhysicalExamination(balanceEntity.getPhysicalExamination());
statEntity.setQuarantine(balanceEntity.getQuarantine());
statEntity.setBusinessTrip(balanceEntity.getBusinessTrip());
statEntity.setPublicHoliday(balanceEntity.getPublicHoliday());
statEntity.setSickLeave(balanceEntity.getSickLeaveDays());
statEntity.setFuneralLeave(balanceEntity.getBereavementLeaveDays());
statEntity.setMarriageLeave(balanceEntity.getMarriageLeaveDays());
statEntity.setChildRearingLeave(balanceEntity.getChildRearingLeave());
statEntity.setBreastfeedingLeaveDays(balanceEntity.getBreastfeedingLeaveDays());
statEntity.setMenstrualLeaveDays(balanceEntity.getMenstrualLeaveDays());
statEntity.setAnnualLeaveDays(balanceEntity.getAnnualLeaveDays());
statEntity.setCompensatedLeaveDays(balanceEntity.getCompensatedLeaveDays());
statEntity.setPaternityLeaveDays(balanceEntity.getPaternityLeaveDays());
statEntity.setMaternityLeave(balanceEntity.getMaternityLeaveDays());
statEntity.setTransferBack(balanceEntity.getTransferBack());
statEntity.setHomeLeave(balanceEntity.getHomeLeave());
statEntity.setPersonalLeave(balanceEntity.getPersonalLeaveDays());
attendanceStatDao.update(statEntity);
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -2,7 +2,7 @@ package com.mortals.xhx.module.attendance.dao; ...@@ -2,7 +2,7 @@ package com.mortals.xhx.module.attendance.dao;
import com.mortals.framework.dao.ICRUDDao; import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.attendance.model.AttendanceStatEntity; import com.mortals.xhx.module.attendance.model.AttendanceStatEntity;
import java.util.List;
/** /**
* 考勤汇总信息Dao * 考勤汇总信息Dao
* 考勤汇总信息 DAO接口 * 考勤汇总信息 DAO接口
...@@ -12,6 +12,9 @@ import java.util.List; ...@@ -12,6 +12,9 @@ import java.util.List;
*/ */
public interface AttendanceStatDao extends ICRUDDao<AttendanceStatEntity,Long>{ public interface AttendanceStatDao extends ICRUDDao<AttendanceStatEntity,Long>{
/**
* 通过员工id查询
* */
AttendanceStatEntity queryEntity(Long staffId);
} }
...@@ -2,7 +2,6 @@ package com.mortals.xhx.module.attendance.dao; ...@@ -2,7 +2,6 @@ package com.mortals.xhx.module.attendance.dao;
import com.mortals.framework.dao.ICRUDDao; import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceEntity; import com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceEntity;
import java.util.List;
/** /**
* 员工假期余额信息Dao * 员工假期余额信息Dao
* 员工假期余额信息 DAO接口 * 员工假期余额信息 DAO接口
...@@ -13,5 +12,8 @@ import java.util.List; ...@@ -13,5 +12,8 @@ import java.util.List;
public interface AttendanceVacationBalanceDao extends ICRUDDao<AttendanceVacationBalanceEntity,Long>{ public interface AttendanceVacationBalanceDao extends ICRUDDao<AttendanceVacationBalanceEntity,Long>{
/**
* 通过员工id查询
* */
AttendanceVacationBalanceEntity queryEntity(Long staffId);
} }
package com.mortals.xhx.module.attendance.dao.ibatis; package com.mortals.xhx.module.attendance.dao.ibatis;
import org.springframework.stereotype.Repository; import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.attendance.dao.AttendanceStatDao; import com.mortals.xhx.module.attendance.dao.AttendanceStatDao;
import com.mortals.xhx.module.attendance.model.AttendanceStatEntity; import com.mortals.xhx.module.attendance.model.AttendanceStatEntity;
import java.util.Date; import org.springframework.stereotype.Repository;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/** /**
* 考勤汇总信息DaoImpl DAO接口 * 考勤汇总信息DaoImpl DAO接口
* *
...@@ -17,5 +15,8 @@ import java.util.List; ...@@ -17,5 +15,8 @@ import java.util.List;
public class AttendanceStatDaoImpl extends BaseCRUDDaoMybatis<AttendanceStatEntity,Long> implements AttendanceStatDao { public class AttendanceStatDaoImpl extends BaseCRUDDaoMybatis<AttendanceStatEntity,Long> implements AttendanceStatDao {
@Override
public AttendanceStatEntity queryEntity(Long staffId) {
return getSqlSession().selectOne(getSqlId("queryEntity"),staffId);
}
} }
package com.mortals.xhx.module.attendance.dao.ibatis; package com.mortals.xhx.module.attendance.dao.ibatis;
import org.springframework.stereotype.Repository; import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.attendance.dao.AttendanceVacationBalanceDao; import com.mortals.xhx.module.attendance.dao.AttendanceVacationBalanceDao;
import com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceEntity; import com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceEntity;
import java.util.Date; import org.springframework.stereotype.Repository;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/** /**
* 员工假期余额信息DaoImpl DAO接口 * 员工假期余额信息DaoImpl DAO接口
* *
...@@ -17,5 +15,8 @@ import java.util.List; ...@@ -17,5 +15,8 @@ import java.util.List;
public class AttendanceVacationBalanceDaoImpl extends BaseCRUDDaoMybatis<AttendanceVacationBalanceEntity,Long> implements AttendanceVacationBalanceDao { public class AttendanceVacationBalanceDaoImpl extends BaseCRUDDaoMybatis<AttendanceVacationBalanceEntity,Long> implements AttendanceVacationBalanceDao {
@Override
public AttendanceVacationBalanceEntity queryEntity(Long staffId) {
return getSqlSession().selectOne(getSqlId("queryEntity"),staffId);
}
} }
...@@ -857,7 +857,7 @@ public class AttendanceStatEntity extends AttendanceStatVo { ...@@ -857,7 +857,7 @@ public class AttendanceStatEntity extends AttendanceStatVo {
public void initAttrValue(){ public void initAttrValue(){
this.windowCategory = ""; this.windowCategory = "考勤机打卡";
this.staffId = null; this.staffId = null;
......
...@@ -36,8 +36,5 @@ public interface DeptDao extends ICRUDDao<DeptEntity,Long>{ ...@@ -36,8 +36,5 @@ public interface DeptDao extends ICRUDDao<DeptEntity,Long>{
* */ * */
DeptEntity queryDeptParient(String parentCode); DeptEntity queryDeptParient(String parentCode);
/**
*
* */
int queryDeptParentId(Long deptId);
} }
...@@ -37,10 +37,7 @@ public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity,Long> implements ...@@ -37,10 +37,7 @@ public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity,Long> implements
return getSqlSession().selectOne(getSqlId("queryDeptParient"),parentCode); return getSqlSession().selectOne(getSqlId("queryDeptParient"),parentCode);
} }
@Override
public int queryDeptParentId(Long deptId) {
return getSqlSession().selectOne(getSqlId("queryDeptParentId"),deptId);
}
} }
...@@ -51,6 +51,4 @@ public interface DeptService extends ICRUDService<DeptEntity,Long>{ ...@@ -51,6 +51,4 @@ public interface DeptService extends ICRUDService<DeptEntity,Long>{
int queryParentId(Long deptId);
} }
\ No newline at end of file
...@@ -56,7 +56,7 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity ...@@ -56,7 +56,7 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
DeptEntity newParentEntity = this.get(entity.getParentId()); DeptEntity newParentEntity = this.get(entity.getParentId());
DeptEntity oldEntity = this.get(entity.getId()); DeptEntity oldEntity = this.get(entity.getId());
if (!ObjectUtils.isEmpty(newParentEntity) && !ObjectUtils.isEmpty(oldEntity)) { if (!ObjectUtils.isEmpty(newParentEntity) && !ObjectUtils.isEmpty(oldEntity)) {
String newAncestors = newParentEntity.getAncestors() + "," + newParentEntity.getId(); String newAncestors = newParentEntity.getAncestors() + "," +entity.getId();
String oldAncestors = oldEntity.getAncestors(); String oldAncestors = oldEntity.getAncestors();
entity.setAncestors(newAncestors); entity.setAncestors(newAncestors);
updateDeptChildren(entity.getId(), newAncestors, oldAncestors, context); updateDeptChildren(entity.getId(), newAncestors, oldAncestors, context);
...@@ -154,7 +154,6 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity ...@@ -154,7 +154,6 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
if (returnList.isEmpty()) { if (returnList.isEmpty()) {
returnList = list; returnList = list;
} }
return returnList.stream().map(DeptTreeSelect::new).collect(Collectors.toList()); return returnList.stream().map(DeptTreeSelect::new).collect(Collectors.toList());
} }
...@@ -209,9 +208,5 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity ...@@ -209,9 +208,5 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
@Override
public int queryParentId(Long deptId) {
return dao.queryDeptParentId(deptId);
}
} }
...@@ -132,8 +132,17 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic ...@@ -132,8 +132,17 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
@Override @Override
protected int doListAfter(DeptEntity query, Map<String, Object> model, Context context) throws AppException { protected int doListAfter(DeptEntity query, Map<String, Object> model, Context context) throws AppException {
int Allperson =staffService.queryAllPerson(); int allPerson =staffService.queryAllPerson();
model.put("AllPerson",Allperson); model.put("allPerson",allPerson);
return super.doListAfter(query, model, context); return super.doListAfter(query, model, context);
} }
} }
\ No newline at end of file
...@@ -52,11 +52,6 @@ public interface StaffDao extends ICRUDDao<StaffEntity,Long>{ ...@@ -52,11 +52,6 @@ public interface StaffDao extends ICRUDDao<StaffEntity,Long>{
* */ * */
int queryConcurrently(); int queryConcurrently();
/**
* 统计部门
* */
int queryPersonNum(Long deptId);
/** /**
* 查询部门信息 * 查询部门信息
......
...@@ -53,10 +53,6 @@ public class StaffDaoImpl extends BaseCRUDDaoMybatis<StaffEntity,Long> implement ...@@ -53,10 +53,6 @@ public class StaffDaoImpl extends BaseCRUDDaoMybatis<StaffEntity,Long> implement
return this.getSqlSession().selectOne(this.getSqlId("queryConcurrently")); return this.getSqlSession().selectOne(this.getSqlId("queryConcurrently"));
} }
@Override
public int queryPersonNum(Long deptId) {
return this.getSqlSession().selectOne(this.getSqlId("queryPersonNum"),deptId);
}
@Override @Override
public StaffEntity queryHik(String remarkId) { public StaffEntity queryHik(String remarkId) {
......
...@@ -18,5 +18,4 @@ public class StaffVo extends BaseEntityLong { ...@@ -18,5 +18,4 @@ public class StaffVo extends BaseEntityLong {
private List<StaffInfoVo>staffInfoVos; private List<StaffInfoVo>staffInfoVos;
private Integer personNum;
} }
\ No newline at end of file
...@@ -15,7 +15,6 @@ public interface StaffService extends ICRUDCacheService<StaffEntity,Long> { ...@@ -15,7 +15,6 @@ public interface StaffService extends ICRUDCacheService<StaffEntity,Long> {
StaffInfoVo queryAll(); StaffInfoVo queryAll();
int queryDeptNum(Long deptId);
int queryAllPerson(); int queryAllPerson();
......
...@@ -54,10 +54,6 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta ...@@ -54,10 +54,6 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
return staffInfoVo; return staffInfoVo;
} }
@Override
public int queryDeptNum(Long deptId) {
return staffDao.queryPersonNum(deptId);
}
@Override @Override
public int queryAllPerson() { public int queryAllPerson() {
......
...@@ -4,6 +4,9 @@ import com.mortals.framework.exception.AppException; ...@@ -4,6 +4,9 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.model.DeptTreeSelect;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.job.model.JobQuery; import com.mortals.xhx.module.job.model.JobQuery;
import com.mortals.xhx.module.job.service.JobService; import com.mortals.xhx.module.job.service.JobService;
...@@ -50,7 +53,9 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ ...@@ -50,7 +53,9 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ
this.addDict(model, "staffType", paramService.getParamBySecondOrganize("Staff","staffType")); this.addDict(model, "staffType", paramService.getParamBySecondOrganize("Staff","staffType"));
this.addDict(model, "status", paramService.getParamBySecondOrganize("Staff","status")); this.addDict(model, "status", paramService.getParamBySecondOrganize("Staff","status"));
this.addDict(model, "positionId", jobService.find(new JobQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(),y->y.getJobName(),(o,n)->n))); this.addDict(model, "positionId", jobService.find(new JobQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(),y->y.getJobName(),(o,n)->n)));
List<DeptEntity> list = deptService.find(new DeptQuery());
List<DeptTreeSelect> treeSelects = deptService.buildDeptTreeSelect(list);
this.addDict(model,"deptPerson",treeSelects);
super.init(model, context); super.init(model, context);
} }
......
...@@ -2562,4 +2562,7 @@ ...@@ -2562,4 +2562,7 @@
</trim> </trim>
</if> </if>
</sql> </sql>
<select id="queryEntity" resultType="com.mortals.xhx.module.attendance.model.AttendanceStatEntity">
select * from mortals_xhx_attendance_vacation_balance where staffId = #{staffId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -1800,4 +1800,7 @@ ...@@ -1800,4 +1800,7 @@
</trim> </trim>
</if> </if>
</sql> </sql>
<select id="queryEntity" resultType="com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceEntity">
select * from mortals_xhx_attendance_vacation_balance where staffId = #{staffId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -884,7 +884,5 @@ ...@@ -884,7 +884,5 @@
<select id="queryDeptParient" resultType="com.mortals.xhx.module.dept.model.DeptEntity"> <select id="queryDeptParient" resultType="com.mortals.xhx.module.dept.model.DeptEntity">
select * from mortals_xhx_dept where deptCode = #{parentCode} select * from mortals_xhx_dept where deptCode = #{parentCode}
</select> </select>
<select id="queryDeptParentId" resultType="integer">
select parentId from mortals_xhx_dept where deptId = #{deptId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -1417,9 +1417,6 @@ ...@@ -1417,9 +1417,6 @@
select count(1) pricateStaff from mortals_xhx_staff where staffType = 3 select count(1) pricateStaff from mortals_xhx_staff where staffType = 3
</select> </select>
<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 id="queryHik" resultType="com.mortals.xhx.module.staff.model.StaffEntity">
select * from mortals_xhx_staff where remarkId = #{remarkId} select * from mortals_xhx_staff where remarkId = #{remarkId}
</select> </select>
......
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