Commit bcb621fb authored by 姬鋆屾's avatar 姬鋆屾
parents c8d61da5 434a796d
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 考核等级
*/
public enum ExamineLevelEnum {
(1, "通过"),
较好(2, "不通过"),
一般(3, "通过"),
较差(4, "不通过");
private Integer value;
private String desc;
ExamineLevelEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static ExamineLevelEnum getByValue(Integer value) {
for (ExamineLevelEnum ExamineLevelEnum : ExamineLevelEnum.values()) {
if (ExamineLevelEnum.getValue() == value) {
return ExamineLevelEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (ExamineLevelEnum item : ExamineLevelEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 窗口考核存储状态
*/
public enum FillStatusEnum {
暂存(0, "暂存"),
提交(1, "提交");
private Integer value;
private String desc;
FillStatusEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static SelfLevelEnum getByValue(Integer value) {
for (SelfLevelEnum SelfLevelEnum : SelfLevelEnum.values()) {
if (SelfLevelEnum.getValue() == value) {
return SelfLevelEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (SelfLevelEnum item : SelfLevelEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 自评等级
*/
public enum SelfLevelEnum {
红旗窗(1, "红旗窗"),
黑旗窗(2, "黑旗窗");
private Integer value;
private String desc;
SelfLevelEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static SelfLevelEnum getByValue(Integer value) {
for (SelfLevelEnum SelfLevelEnum : SelfLevelEnum.values()) {
if (SelfLevelEnum.getValue() == value) {
return SelfLevelEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (SelfLevelEnum item : SelfLevelEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 窗口考核审查结果
*/
public enum WindowCheckResultEnum {
通过(1, "通过"),
不通过(2, "不通过");
private Integer value;
private String desc;
WindowCheckResultEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static WindowCheckResultEnum getByValue(Integer value) {
for (WindowCheckResultEnum WindowCheckResultEnum : WindowCheckResultEnum.values()) {
if (WindowCheckResultEnum.getValue() == value) {
return WindowCheckResultEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (WindowCheckResultEnum item : WindowCheckResultEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
......@@ -3,6 +3,7 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.attendance.dao.AttendanceRecordHikDao;
import com.mortals.xhx.module.attendance.model.AttendanceRecordHikEntity;
import com.mortals.xhx.module.attendance.model.AttendanceRecordHikQuery;
import java.util.List;
......@@ -48,4 +49,11 @@ public interface AttendanceRecordHikService extends ICRUDService<AttendanceRecor
void addAttendanceRecordList(List<AttendanceRecordHikEntity> hikEntityList, Context context) throws Exception;
/**
* 虚增未有考勤记录
* @param recordHikQuery
* @param context
*/
void buildCustomHikRecord(AttendanceRecordHikQuery recordHikQuery,Context context);
}
......@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.attendance.model.*;
......@@ -61,7 +62,8 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
private StaffService staffService;
@Autowired
private AttendanceRecordErrorService errorService;
@Autowired
private AttendanceGroupFixedworkService groupFixedworkService;
@Autowired
private HolidayService holidayService;
......@@ -81,7 +83,7 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
@Override
public void addAttendanceRecordByQueryCustom(AttendanceRecordHikEntity attendanceRecordHikQuery, Context context) throws Exception {
List<AttendanceRecordHikEntity> hikEntityList = attendanceRecordHikService.find(attendanceRecordHikQuery);
hikEntityList=hikEntityList.stream().map(item->{
hikEntityList = hikEntityList.stream().map(item -> {
String dateStr = DateUtil.formatDate(item.getAttendanceDate());
Boolean checkWorkByHoliday = checkWorkByHoliday(dateStr);
Boolean checkHolidayByWorkDay = checkHolidayByWorkDay(dateStr);
......@@ -92,7 +94,7 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
return null;
}
return item;
}).filter(f->f!=null).collect(Collectors.toList());
}).filter(f -> f != null).collect(Collectors.toList());
addAttendanceOtherRecordList(hikEntityList, context);
}
......@@ -436,6 +438,7 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
}
}
private void genErrorAttendRecord(Context context, String dateStr, AttendanceRecordEntity attendanceRecordEntity, List<AttendanceRecordDetailEntity> detailEntityList) {
//处理异常打卡,所以异常打卡的 都新增一条记录
List<AttendanceRecordErrorEntity> errorEntityList = new ArrayList<>();
......@@ -517,10 +520,8 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
//if(error.getStaffId()==checkError.getStaffId()&&error.getShiftsId()=)
}
return bool;
}
......@@ -716,6 +717,78 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
return weekClassId;
}
@Override
public void buildCustomHikRecord(AttendanceRecordHikQuery recordHikQuery, Context context) {
Set<Long> attendStaffSet = this.find(recordHikQuery).stream().map(i -> i.getStaffId()).distinct().collect(Collectors.toSet());
Map<Long, List<AttendanceGroupStaffEntity>> groupStaffCollect = attendanceGroupStaffService.find(new AttendanceGroupStaffQuery()).stream().collect(Collectors.groupingBy(x -> x.getGroupId()));
Iterator<Map.Entry<Long, List<AttendanceGroupStaffEntity>>> iterator = groupStaffCollect.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<Long, List<AttendanceGroupStaffEntity>> item = iterator.next();
//分组查看当前人
Long groupId = item.getKey();
AttendanceGroupFixedworkEntity attendanceGroupFixedworkEntity = groupFixedworkService.selectOne(new AttendanceGroupFixedworkQuery().groupId(groupId));
String week = this.getWeek(new Date());
Long weekClassId = this.getWeekClassId(attendanceGroupFixedworkEntity, week);
//weekClassId为-1 则不在考勤
//对于节假日 分两种情况。
// 1.当前是工作日,但是是节假日。则不做考勤continue;
// 2.当前是非工作日,但是由于节假日情况,需要补班,需要做考勤
//weekClassId == -1L 当日不需要考勤的 与节假日冲突的 以节假日为准
Boolean checkWorkByHoliday = checkWorkByHoliday(recordHikQuery.getAttendanceDateStart());
Boolean checkHolidayByWorkDay = checkHolidayByWorkDay(recordHikQuery.getAttendanceDateStart());
if (weekClassId == -1L) {
//跳过本次循环
log.info("当前日期不在考勤时间范围内,不做处理!");
if (!checkWorkByHoliday) {
continue;
}
} else {
if (checkHolidayByWorkDay) {
//本来当天是需要考勤的,但是是节假日,则不计算考勤
continue;
}
}
List<AttendanceGroupStaffEntity> groupStaffList = item.getValue();
//查看当前需要考勤但是没有记录的人
List<Long> unAttendStaffIdList = groupStaffList.stream().filter(f -> !attendStaffSet.contains(f.getStaffId())).map(i -> i.getStaffId()).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(unAttendStaffIdList)) {
for (Long staffId : unAttendStaffIdList) {
StaffEntity staffCache = staffService.getCache(staffId.toString());
if (!ObjectUtils.isEmpty(staffCache) && StaffSatusEnum.离职.getValue() != staffCache.getStatus()) {
//构建考勤记录 判断当前人是否离职,如果非离职 构建记录
AttendanceRecordHikEntity recordHikEntity = new AttendanceRecordHikEntity();
recordHikEntity.initAttrValue();
recordHikEntity.setStaffId(staffCache.getId());
recordHikEntity.setStaffName(staffCache.getName());
recordHikEntity.setWorkNum(staffCache.getWorkNum());
recordHikEntity.setDeptId(staffCache.getDeptId());
recordHikEntity.setDeptName(staffCache.getDeptName());
recordHikEntity.setSalaId(staffCache.getSalaId());
recordHikEntity.setSalaName(staffCache.getSalaName());
recordHikEntity.setPositionId(staffCache.getPositionId());
recordHikEntity.setPositionName(staffCache.getPositionName());
recordHikEntity.setAttendanceGroupId(groupId);
recordHikEntity.setAttendanceDate(DateUtil.parseDate(DateUtil.today()).toJdkDate());
recordHikEntity.setAttendanceAddress("自定义地点");
recordHikEntity.setEventSource("当日未有记录虚增考勤记录!");
recordHikEntity.setCreateTime(new Date());
recordHikEntity.setCreateUserId(1L);
try {
this.getDao().insert(recordHikEntity);
} catch (Exception e) {
log.error(e.getMessage());
}
} else {
log.error("未找到当前员工,staffId:{}", staffId);
}
}
}
}
}
}
/* //map遍历.先把所有键取出来
Set<String> workNumSet = listMap.keySet();
......
package com.mortals.xhx.module.attendance.web;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.mortals.framework.annotation.UnAuth;
......@@ -16,10 +18,7 @@ import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.keys.RedisCacheKeys;
import com.mortals.xhx.common.utils.AddAttendThread;
import com.mortals.xhx.module.attendance.model.AttendanceClassEntity;
import com.mortals.xhx.module.attendance.model.AttendanceExportRecordEntity;
import com.mortals.xhx.module.attendance.model.AttendanceGroupEntity;
import com.mortals.xhx.module.attendance.model.AttendanceRecordHikEntity;
import com.mortals.xhx.module.attendance.model.*;
import com.mortals.xhx.module.attendance.service.AttendanceClassService;
import com.mortals.xhx.module.attendance.service.AttendanceExportRecordService;
import com.mortals.xhx.module.attendance.service.AttendanceGroupService;
......@@ -30,9 +29,11 @@ import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -52,6 +53,7 @@ import java.util.stream.Collectors;
*/
@RestController
@RequestMapping("attendance/record/hik")
@Slf4j
public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingController<AttendanceRecordHikService, AttendanceRecordHikEntity, Long> {
@Autowired
......@@ -164,19 +166,31 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
}
@PostMapping(value = "/addAttendanceRecordCustom")
@UnAuth
public Rest<String> addAttendanceRecordCustom(@RequestBody AttendanceRecordHikEntity hikEntity) {
public Rest<String> addAttendanceRecordCustom(@RequestBody AttendanceRecordHikQuery hikEntity) {
Rest<String> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询" + this.getModuleDesc();
int code = 1;
try {
//排除节假日
hikService.addAttendanceRecordByQuery(hikEntity, getContext());
//天数区间分段计算
DateTime attendStart = DateUtil.parseDate(hikEntity.getAttendanceDateStart());
DateTime attendEnd = DateUtil.parseDate(hikEntity.getAttendanceDateEnd());
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
StopWatch stopWatch = new StopWatch("stopwatch attend1");
log.info("考勤计算天数区间:{}", compare);
for (int i = 0; i <= compare.intValue(); i++) {
DateTime curDate = DateUtil.offsetDay(attendStart, i);
log.info("考勤计算日期:{}", curDate.toDateStr());
stopWatch.start("执行本地方法");
hikEntity.setAttendanceDateStart(curDate.toDateStr());
hikEntity.setAttendanceDateEnd(curDate.toDateStr());
hikService.buildCustomHikRecord(hikEntity, context);
stopWatch.stop();
log.info("考勤计算日期:{} 完成,耗时:{}ms", curDate.toDateStr(), stopWatch.getLastTaskTimeMillis());
}
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception e) {
......
......@@ -11,93 +11,97 @@ import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.check.model.vo.CheckWindowWorkmanPerformVo;
import lombok.Data;
/**
* 窗口人员考核汇总核查实体对象
*
* @author zxfei
* @date 2024-01-17
*/
* 窗口人员考核汇总核查实体对象
*
* @author zxfei
* @date 2024-01-17
*/
@Data
public class CheckWindowWorkmanPerformEntity extends CheckWindowWorkmanPerformVo {
private static final long serialVersionUID = 1L;
/**
* 记录ID
*/
* 记录ID
*/
private Long recordId;
/**
* 考核年度
*/
* 考核年度
*/
private Integer year;
/**
* 考核月份
*/
* 考核月份
*/
private Integer month;
/**
* 窗口ID
*/
* 窗口ID
*/
private Long windowId;
/**
* 窗口名称
*/
* 窗口名称
*/
private String windowName;
/**
* 窗口负责人id
*/
* 窗口负责人id
*/
private Long ownerId;
/**
* 窗口负责人名称
*/
* 窗口负责人名称
*/
private String ownerName;
/**
* 所属部门id
*/
* 所属部门id
*/
private Long deptId;
/**
* 所属部门名称
*/
* 所属部门名称
*/
private String deptName;
/**
* 所属大厅
*/
* 所属大厅
*/
private Long salaId;
/**
* 所属大厅名称
*/
* 所属大厅名称
*/
private String salaName;
/**
* 考核表单名称
*/
* 考核表单名称
*/
private String fromName;
/**
* 提交时间
*/
* 提交时间
*/
private Date submitDate;
/**
* 管理组核查人员
*/
* 管理组核查人员
*/
@Excel(name = "管理组核查人员")
private String manageCheckPerson;
/**
* 管理组核查时间
*/
* 管理组核查时间
*/
private Date manageCheckTime;
/**
* 管理组核查说明
*/
* 管理组核查说明
*/
@Excel(name = "管理组核查说明")
private String manageCheckDesc;
/**
* 管理组核查结果(1.通过,2.不通过)
*/
* 管理组核查结果(1.通过,2.不通过)
*/
@Excel(name = "管理组核查结果", readConverterExp = "1=通过,2=不通过")
private String manageCheckResult;
/**
* 备注
*/
* 备注
*/
private String remark;
/**
* 处理状态(1.未处理,2.已处理)
*/
private Integer checkStatus;
@Override
public int hashCode() {
return this.getId().hashCode();
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
......@@ -105,30 +109,31 @@ public class CheckWindowWorkmanPerformEntity extends CheckWindowWorkmanPerformVo
if (obj instanceof CheckWindowWorkmanPerformEntity) {
CheckWindowWorkmanPerformEntity tmp = (CheckWindowWorkmanPerformEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
return true;
}
}
return false;
}
public void initAttrValue(){
this.recordId = null;
this.year = DateUtil.year(new Date());
this.month = DateUtil.month(new Date())+1;
this.windowId = null;
this.windowName = "";
this.ownerId = null;
this.ownerName = "";
this.deptId = null;
this.deptName = "";
this.salaId = null;
this.salaName = "";
this.fromName = "";
this.submitDate = new Date();
this.manageCheckPerson = "";
this.manageCheckTime = new Date();
this.manageCheckDesc = "";
this.manageCheckResult = "";
this.remark = "";
this.recordId = null;
this.year = DateUtil.year(new Date());
this.month = DateUtil.month(new Date())+1;
this.windowId = null;
this.windowName = "";
this.ownerId = null;
this.ownerName = "";
this.deptId = null;
this.deptName = "";
this.salaId = null;
this.salaName = "";
this.fromName = "";
this.submitDate = new Date();
this.manageCheckPerson = "";
this.manageCheckTime = new Date();
this.manageCheckDesc = "";
this.manageCheckResult = "";
this.remark = "";
this.checkStatus = 1;
}
}
\ No newline at end of file
......@@ -43,9 +43,9 @@ public class CheckWindowPerformController extends BaseCRUDJsonBodyMappingControl
@Override
protected void init(Map<String, Object> model, Context context) {
// this.addDict(model, "manageCheckResult", ManageCheckResultEnum.getEnumMap());
// this.addDict(model, "leaderCheckResult", LeaderCheckResultEnum.getEnumMap());
this.addDict(model, "checkStatus", CheckStatusEnum.getEnumMap());
this.addDict(model, "manageCheckResult", WindowCheckResultEnum.getEnumMap());
this.addDict(model, "leaderCheckResult", WindowCheckResultEnum.getEnumMap());
this.addDict(model, "checkStatus", CheckStatusEnum.getEnumMap());
super.init(model, context);
}
......
......@@ -43,7 +43,8 @@ public class CheckWindowWorkmanPerformController extends BaseCRUDJsonBodyMapping
@Override
protected void init(Map<String, Object> model, Context context) {
// this.addDict(model, "manageCheckResult", ManageCheckResultEnum.getEnumMap());
this.addDict(model, "manageCheckResult", WindowCheckResultEnum.getEnumMap());
this.addDict(model, "checkStatus", CheckStatusEnum.getEnumMap());
super.init(model, context);
}
......
......@@ -278,7 +278,7 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
@Override
public List<DeptEntity> getDeptBySalaId(Long salaId) throws AppException {
DeptQuery query = new DeptQuery();
if(salaId == null){
if(salaId == null || salaId == -1l){
List<DeptEntity> allSala = dao.getList(new DeptQuery().parentId(71l));
List<Long> salaList = new ArrayList<>();
for(DeptEntity item:allSala){
......
package com.mortals.xhx.module.dept.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
......@@ -142,11 +145,60 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
return super.doListAfter(query, model, context);
}
/**
* 查询大厅列表
* @return
*/
@GetMapping({"getSalaList"})
public Rest<Object> getAllSala() {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询大厅列表";
int code = 1;
try {
List<DeptEntity> allSala = this.getService().getAllSala();
model.put("data", allSala);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
this.init(model, context);
ret.setCode(code);
ret.setData(model);
ret.setDict(model.get("dict"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
/**
* 查询大厅列表
* @return
*/
@GetMapping({"getDeptBySalaId"})
public Rest<Object> getDeptBySalaId(Long salaId) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询大厅对应的部门列表";
int code = 1;
try {
List<DeptEntity> allDept = this.getService().getDeptBySalaId(salaId);
model.put("data", allDept);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
this.init(model, context);
ret.setCode(code);
ret.setData(model);
ret.setDict(model.get("dict"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
}
\ No newline at end of file
package com.mortals.xhx.module.window.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.window.model.WindowWorkmanPerformEntity;
import java.util.ArrayList;
import java.util.List;
import com.mortals.xhx.module.window.model.WindowWorkmanPerformDetailEntity;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 窗口人员考核汇总登记视图对象
*
......@@ -19,5 +17,5 @@ public class WindowWorkmanPerformVo extends BaseEntityLong {
/** 序号,主键,自增长列表 */
private List <Long> idList;
private List <WindowWorkmanPerformDetailEntity> workmanPerformDetailList;
}
\ No newline at end of file
package com.mortals.xhx.module.window.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.common.pdu.window.WindowPdu;
import com.mortals.xhx.module.window.model.WindowOwnerDetailEntity;
import com.mortals.xhx.module.window.dao.WindowOwnerDetailDao;
import java.util.List;
/**
* WindowOwnerDetailService
*
......@@ -13,4 +17,11 @@ import com.mortals.xhx.module.window.dao.WindowOwnerDetailDao;
public interface WindowOwnerDetailService extends ICRUDService<WindowOwnerDetailEntity,Long>{
WindowOwnerDetailDao getDao();
/**
* 获取基础平台与考勤绩效系统已分配的窗口差集列表
* @param pdu
* @return
*/
List<WindowPdu> subWindowPduList(WindowPdu pdu);
}
\ No newline at end of file
package com.mortals.xhx.module.window.service.impl;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.window.WindowPdu;
import com.mortals.xhx.feign.window.IWindowFeign;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -7,6 +14,13 @@ import com.mortals.xhx.module.window.dao.WindowOwnerDetailDao;
import com.mortals.xhx.module.window.model.WindowOwnerDetailEntity;
import com.mortals.xhx.module.window.service.WindowOwnerDetailService;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* WindowOwnerDetailService
* 窗口负责人详细 service实现
......@@ -17,5 +31,30 @@ import lombok.extern.slf4j.Slf4j;
@Service("windowOwnerDetailService")
@Slf4j
public class WindowOwnerDetailServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerDetailDao, WindowOwnerDetailEntity, Long> implements WindowOwnerDetailService {
@Autowired
private IWindowFeign windowFeign;
@Override
public List<WindowPdu> subWindowPduList(WindowPdu pdu) {
List<WindowPdu> subList = new ArrayList<>();
if(pdu.getSiteId()==null){
pdu.setSiteId(1l); //默认只查宜宾市民中心
}
pdu.setSize(-1);
Rest<RespData<List<WindowPdu>>> respDataRest = windowFeign.list(pdu);
if (respDataRest.getCode() == YesNoEnum.YES.getValue()) {
List<WindowOwnerDetailEntity> ownerDetail = this.getAllList();
if(!CollectionUtils.isEmpty(ownerDetail)){
Map<Long,List<WindowOwnerDetailEntity>> windowMap = ownerDetail.stream().collect(Collectors.groupingBy(WindowOwnerDetailEntity::getWindowId));
List<WindowPdu> allWindow = respDataRest.getData().getData();
for(WindowPdu item:allWindow){
if(!windowMap.containsKey(item.getId())){
subList.add(item);
}
}
}
}
return subList;
}
}
\ No newline at end of file
package com.mortals.xhx.module.window.service.impl;
import com.mortals.xhx.module.window.model.WindowWorkmanPerformDetailEntity;
import com.mortals.xhx.module.window.model.WindowWorkmanPerformDetailQuery;
import com.mortals.xhx.module.window.service.WindowWorkmanPerformDetailService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -7,6 +12,11 @@ import com.mortals.xhx.module.window.dao.WindowWorkmanPerformDao;
import com.mortals.xhx.module.window.model.WindowWorkmanPerformEntity;
import com.mortals.xhx.module.window.service.WindowWorkmanPerformService;
import lombok.extern.slf4j.Slf4j;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* WindowWorkmanPerformService
* 窗口人员考核汇总登记 service实现
......@@ -17,5 +27,45 @@ import lombok.extern.slf4j.Slf4j;
@Service("windowWorkmanPerformService")
@Slf4j
public class WindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<WindowWorkmanPerformDao, WindowWorkmanPerformEntity, Long> implements WindowWorkmanPerformService {
@Autowired
private WindowWorkmanPerformDetailService windowWorkmanPerformDetailService;
@Override
protected void saveAfter(WindowWorkmanPerformEntity entity, Context context) throws AppException {
if(CollectionUtils.isNotEmpty(entity.getWorkmanPerformDetailList())){
entity.getWorkmanPerformDetailList().forEach(item->{
item.setPerformId(entity.getId());
item.setCreateUserId(this.getContextUserId(context));
item.setCreateTime(new Date());
});
windowWorkmanPerformDetailService.save(entity.getWorkmanPerformDetailList());
}
super.saveAfter(entity, context);
}
@Override
protected void updateAfter(WindowWorkmanPerformEntity entity, Context context) throws AppException {
if(CollectionUtils.isNotEmpty(entity.getWorkmanPerformDetailList())){
Long[] detailList = windowWorkmanPerformDetailService.find(new WindowWorkmanPerformDetailQuery().performId(entity.getId())).stream().map(WindowWorkmanPerformDetailEntity::getId).toArray(Long[]::new);
windowWorkmanPerformDetailService.remove(detailList,context);
entity.getWorkmanPerformDetailList().forEach(item->{
item.setPerformId(entity.getId());
item.setCreateUserId(this.getContextUserId(context));
item.setCreateTime(new Date());
item.setUpdateUserId(this.getContextUserId(context));
item.setUpdateTime(new Date());
});
windowWorkmanPerformDetailService.save(entity.getWorkmanPerformDetailList());
}
super.updateAfter(entity, context);
}
@Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
List<WindowWorkmanPerformDetailEntity> detailEntities = windowWorkmanPerformDetailService.find(new WindowWorkmanPerformDetailQuery().performIdList(Arrays.asList(ids)));
windowWorkmanPerformDetailService.removeList(detailEntities, context);
super.removeAfter(ids, context, result);
}
}
\ No newline at end of file
......@@ -59,10 +59,11 @@ public class WindowOwnerController extends BaseCRUDJsonBodyMappingController<Win
@Override
protected void init(Map<String, Object> model, Context context) {
Map<String, String> collect = userService.find(new UserQuery(), getContext()).stream()
.collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getRealName(), (o, n) -> n));
this.addDict(model, "updateUserId", collect);
this.addDict(model, "deptName", deptService.find(new DeptQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(), y->y.getDeptName(),(o, n)->n)));
// Map<String, String> collect = userService.find(new UserQuery(), getContext()).stream()
// .collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getRealName(), (o, n) -> n));
// this.addDict(model, "updateUserId", collect);
this.addDict(model, "deptId", deptService.getDeptBySalaId(-1l).stream().collect(Collectors.toMap(x->x.getId().toString(), y->y.getDeptName(),(o, n)->n)));
this.addDict(model, "salaId", deptService.getAllSala().stream().collect(Collectors.toMap(x->x.getId().toString(), y->y.getDeptName(),(o, n)->n)));
super.init(model, context);
}
......
package com.mortals.xhx.module.window.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
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.common.Rest;
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.common.pdu.window.WindowPdu;
import com.mortals.xhx.module.window.model.WindowOwnerDetailEntity;
import com.mortals.xhx.module.window.service.WindowOwnerDetailService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.*;
/**
*
* 窗口负责人详细
......@@ -33,9 +25,6 @@ import static com.mortals.framework.ap.SysConstains.*;
@RequestMapping("window/owner/detail")
public class WindowOwnerDetailController extends BaseCRUDJsonBodyMappingController<WindowOwnerDetailService,WindowOwnerDetailEntity,Long> {
@Autowired
private ParamService paramService;
public WindowOwnerDetailController(){
super.setModuleDesc( "窗口负责人详细");
}
......@@ -46,4 +35,29 @@ public class WindowOwnerDetailController extends BaseCRUDJsonBodyMappingControll
}
@PostMapping({"subWindowList"})
public Rest<Object> subWindowList(@RequestBody WindowPdu query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询待分配的窗口列表";
int code = 1;
try {
List<WindowPdu> result = this.getService().subWindowPduList(query);
model.put("data", result);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
this.init(model, context);
ret.setCode(code);
ret.setData(model);
ret.setDict(model.get("dict"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
}
\ No newline at end of file
package com.mortals.xhx.module.window.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
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.common.code.FillStatusEnum;
import com.mortals.xhx.common.code.SelfLevelEnum;
import com.mortals.xhx.module.window.model.WindowPerformEntity;
import com.mortals.xhx.module.window.service.WindowPerformService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.*;
import com.mortals.xhx.common.code.*;
/**
*
* 大厅窗口信息
* 大厅窗口考核登记信息
*
* @author zxfei
* @date 2024-01-17
......@@ -34,15 +21,15 @@ import com.mortals.xhx.common.code.*;
@RequestMapping("window/perform")
public class WindowPerformController extends BaseCRUDJsonBodyMappingController<WindowPerformService,WindowPerformEntity,Long> {
@Autowired
private ParamService paramService;
public WindowPerformController(){
super.setModuleDesc( "大厅窗口信息");
super.setModuleDesc( "大厅窗口考核登记信息");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "selfLevel", SelfLevelEnum.getEnumMap());
this.addDict(model, "fillStatus", FillStatusEnum.getEnumMap());
super.init(model, context);
}
......
package com.mortals.xhx.module.window.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
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.common.code.ExamineLevelEnum;
import com.mortals.xhx.common.code.FillStatusEnum;
import com.mortals.xhx.module.window.model.WindowWorkmanPerformEntity;
import com.mortals.xhx.module.window.service.WindowWorkmanPerformService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.*;
import com.mortals.xhx.common.code.*;
/**
*
* 窗口人员考核汇总登记
......@@ -34,8 +21,6 @@ import com.mortals.xhx.common.code.*;
@RequestMapping("window/workman/perform")
public class WindowWorkmanPerformController extends BaseCRUDJsonBodyMappingController<WindowWorkmanPerformService,WindowWorkmanPerformEntity,Long> {
@Autowired
private ParamService paramService;
public WindowWorkmanPerformController(){
super.setModuleDesc( "窗口人员考核汇总登记");
......@@ -43,6 +28,8 @@ public class WindowWorkmanPerformController extends BaseCRUDJsonBodyMappingContr
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "examineLevel", ExamineLevelEnum.getEnumMap());
this.addDict(model, "fillStatus", FillStatusEnum.getEnumMap());
super.init(model, context);
}
......
package com.mortals.xhx.module.window.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
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.common.code.ExamineLevelEnum;
import com.mortals.xhx.module.window.model.WindowWorkmanPerformDetailEntity;
import com.mortals.xhx.module.window.service.WindowWorkmanPerformDetailService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.*;
import com.mortals.xhx.common.code.*;
/**
*
* 窗口人员考核汇总明细
......@@ -34,15 +20,13 @@ import com.mortals.xhx.common.code.*;
@RequestMapping("window/workman/perform/detail")
public class WindowWorkmanPerformDetailController extends BaseCRUDJsonBodyMappingController<WindowWorkmanPerformDetailService,WindowWorkmanPerformDetailEntity,Long> {
@Autowired
private ParamService paramService;
public WindowWorkmanPerformDetailController(){
super.setModuleDesc( "窗口人员考核汇总明细");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "examineLevel", ExamineLevelEnum.getEnumMap());
super.init(model, context);
}
......
......@@ -86,7 +86,7 @@
<!-- 子表所有列 -->
<sql id="_columns_sub">
<trim suffixOverrides="," suffix="">
b.id,b.ownerId,b.staffId,b.remark,b.createTime,b.createUserId,b.updateUserId,b.updateTime,
b.id,b.performId,b.staffId,b.staffName,b.discipline,b.specification,b.management,b.evaluation,b.efficiency,b.bonusScore,b.sumScore,b.vexamineLevel,b.remark,b.createUserId,b.createTime,b.updateUserId,b.updateTime,
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
......
......@@ -25,9 +25,28 @@
<result property="createTime" column="createTime" />
<result property="updateUserId" column="updateUserId" />
<result property="updateTime" column="updateTime" />
<collection property="workmanPerformDetailList" column="id" ofType="WindowWorkmanPerformDetailEntity" javaType="ArrayList" select="getWorkmanPerformDetailByPerformId"></collection>
</resultMap>
<resultMap type="WindowWorkmanPerformDetailEntity" id="WindowWorkmanPerformDetailEntity-Map">
<id property="id" column="id" />
<result property="performId" column="performId" />
<result property="staffId" column="staffId" />
<result property="staffName" column="staffName" />
<result property="discipline" column="discipline" />
<result property="specification" column="specification" />
<result property="management" column="management" />
<result property="evaluation" column="evaluation" />
<result property="efficiency" column="efficiency" />
<result property="bonusScore" column="bonusScore" />
<result property="sumScore" column="sumScore" />
<result property="examineLevel" column="examineLevel" />
<result property="remark" column="remark" />
<result property="createUserId" column="createUserId" />
<result property="createTime" column="createTime" />
<result property="updateUserId" column="updateUserId" />
<result property="updateTime" column="updateTime" />
</resultMap>
<!-- 表所有列 -->
<sql id="_columns">
......@@ -94,6 +113,12 @@
</if>
</trim>
</sql>
<!-- 子表所有列 -->
<sql id="_columns_sub">
<trim suffixOverrides="," suffix="">
b.id,b.ownerId,b.staffId,b.remark,b.createTime,b.createUserId,b.updateUserId,b.updateTime,
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="WindowWorkmanPerformEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_window_workman_perform
......@@ -453,7 +478,14 @@
<include refid="_orderCols_"/>
</select>
<!-- 获取子列表 -->
<select id="getWorkmanPerformDetailByPerformId" parameterType="java.lang.Long" resultMap="WindowWorkmanPerformDetailEntity-Map">
select <include refid="_columns_sub"/>
from mortals_xhx_window_workman_perform_detail as b
<trim suffixOverrides="where" suffix="">
where b.performId = #{id}
</trim>
</select>
<!-- 获取 -->
<select id="getListCount" parameterType="paramDto" resultType="int">
......
......@@ -5,7 +5,7 @@ Content-Type: application/json
{
"loginName":"admin",
"password":"xhxADMIN8@a",
"password":"admin",
"securityCode":"admin"
}
......@@ -30,8 +30,8 @@ Authorization: {{authToken}}
Content-Type: application/json
{
"attendanceDateStart":"2023-12-01",
"attendanceDateEnd":"2024-01-15"
"attendanceDateStart":"2024-12-01",
"attendanceDateEnd":"2024-01-20"
}
###海康考勤打卡记录计算1
......
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