新增晚餐福利餐逻辑
This commit is contained in:
parent
4482d05ff4
commit
a315bf4b7a
@ -86,4 +86,5 @@ public interface RzAttendanceMapper extends BaseMapper<RzAttendance> {
|
||||
|
||||
List<Map<String,Object>> getAttendanceHour(@Param("date") Date date);
|
||||
|
||||
public Long selectDinnerCount( @Param("limitWorkSum")String limitWorkSum, @Param("staffId")String staffId, @Param("days")String days);
|
||||
}
|
||||
|
||||
@ -69,101 +69,6 @@ public class PunchTheClockServiceImpl implements PunchTheClockService {
|
||||
}
|
||||
return initMessage(1,"未找到打卡机信息", "000000000");
|
||||
|
||||
/***
|
||||
* PS: 注解为原代码逻辑
|
||||
* //解析收到的数据
|
||||
* JSONObject jsonObject = JSONObject.parseObject(json);
|
||||
* String userId = jsonObject.getString("user_id");
|
||||
* //需要推送的数据
|
||||
* String message = "";
|
||||
* //需要返回的对象
|
||||
* RzAttendanceVo cardV = new RzAttendanceVo();
|
||||
* RzAttendanceData cardD = new RzAttendanceData();
|
||||
* String sn = jsonObject.getString("sn");
|
||||
* if(com.evo.equipment.constant.Constants.EQ_DEVICE_OVER_TIME_CODE.equals(sn)){
|
||||
* boolean flag = DateUtil.isSaturday(new Date(),1);
|
||||
* if(flag){
|
||||
* cardV.setResult(1);
|
||||
* cardV.setMsg("{\"Result\":1,\"Msg\":\"周日不能打卡\"}");
|
||||
* cardD.setButton("000000000");
|
||||
* cardV.setContent(cardD);
|
||||
* //Java对象转换成JSON字符串
|
||||
* message = JSONObject.toJSONString(cardV);
|
||||
* return message;
|
||||
* }
|
||||
* EqOverStaff eqOverStaff = eqOverStaffMapper.selectEqOverStaffByUserId(Long.valueOf(userId));
|
||||
* if(StringUtils.isNull(eqOverStaff)){
|
||||
* cardV.setResult(1);
|
||||
* cardV.setMsg("{\"Result\":1,\"Msg\":\"验证失败,未设置考勤权限\"}");
|
||||
* cardD.setButton("000000000");
|
||||
* cardV.setContent(cardD);
|
||||
* //Java对象转换成JSON字符串
|
||||
* message = JSONObject.toJSONString(cardV);
|
||||
* return message;
|
||||
* }
|
||||
* RzSpecialAttendance rzSpecialAttendance = rzSpecialAttendanceMapper.selectRzSpecialAttendanceByuserIdAndDate(Long.valueOf(userId),new Date());
|
||||
* if(StringUtils.isNull(rzSpecialAttendance)){
|
||||
* cardV.setResult(0);
|
||||
* cardV.setMsg("验证通过");
|
||||
* cardD.setButton("111100000");
|
||||
* cardV.setContent(cardD);
|
||||
* //Java对象转换成JSON字符串
|
||||
* message = JSONObject.toJSONString(cardV);
|
||||
* }else{
|
||||
* cardV.setResult(0);
|
||||
* cardV.setMsg("验证通过");
|
||||
* cardD.setButton("000011000");
|
||||
* cardV.setContent(cardD);
|
||||
* //Java对象转换成JSON字符串
|
||||
* message = JSONObject.toJSONString(cardV);
|
||||
* }
|
||||
* return message;
|
||||
* }
|
||||
* //根据ID查询在职员工信息
|
||||
* SysStaff sysStaff = sysStaffMapper.selectSysStaffByUserId(Long.valueOf(userId));
|
||||
* //员工不存在,说明离职没有打卡权限
|
||||
* if(StringUtils.isNull(sysStaff)){
|
||||
* cardV.setResult(1);
|
||||
* cardV.setMsg("{\"Result\":1,\"Msg\":\"验证失败,未设置考勤权限\"}");
|
||||
* cardD.setButton("000000000");
|
||||
* cardV.setContent(cardD);
|
||||
* //Java对象转换成JSON字符串
|
||||
* message = JSONObject.toJSONString(cardV);
|
||||
* return message;
|
||||
* }
|
||||
* //根据id查询当前员工不是员工列表中的人,返回提示
|
||||
* EqImages userImg = eqImagesMapper.selectEqImagesByStaffId(Long.valueOf(userId));
|
||||
* if(StringUtils.isNull(userImg)){
|
||||
* cardV.setResult(1);
|
||||
* cardV.setMsg("{\"Result\":1,\"Msg\":\"验证失败,未设置考勤权限\"}");
|
||||
* cardD.setButton("000000000");
|
||||
* cardV.setContent(cardD);
|
||||
* //Java对象转换成JSON字符串
|
||||
* message = JSONObject.toJSONString(cardV);
|
||||
* return message;
|
||||
* }
|
||||
* //查询员工的最后一次打卡 按钮切换
|
||||
* RzAttendanceDetail rzAttendanceDetail = rzAttendanceDetailMapper.selectLastRzAttendanceDetail(Long.valueOf(userId));
|
||||
* //判断最后一次打卡为下班卡或没有打卡记录,则打卡为上班卡
|
||||
* if(StringUtils.isNull(rzAttendanceDetail) || "下班卡".equals(rzAttendanceDetail.getButtonType()) || "撤销".equals(rzAttendanceDetail.getButtonType())){
|
||||
* //如果最后一条数据的卡类型为下班卡,则返回上班卡和加班卡权限
|
||||
* cardV.setResult(0);
|
||||
* cardV.setMsg("验证通过");
|
||||
* cardD.setButton("111100000");
|
||||
* cardV.setContent(cardD);
|
||||
* //Java对象转换成JSON字符串
|
||||
* message = JSONObject.toJSONString(cardV);
|
||||
* }else{
|
||||
* cardV.setResult(0);
|
||||
* cardV.setMsg("验证通过");
|
||||
* cardD.setButton("000011000");
|
||||
* cardV.setContent(cardD);
|
||||
* //Java对象转换成JSON字符串
|
||||
* message = JSONObject.toJSONString(cardV);
|
||||
* }
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
private String initMessage(Integer result, String meg){
|
||||
@ -229,374 +134,6 @@ public class PunchTheClockServiceImpl implements PunchTheClockService {
|
||||
}
|
||||
}
|
||||
return initMessage(1,"打卡失败");
|
||||
|
||||
/***
|
||||
* PS: 注解为原代码逻辑
|
||||
* //解析收到的数据
|
||||
* JSONObject jsonObject = JSONObject.parseObject(json);
|
||||
* String userId = jsonObject.getString("user_id");
|
||||
* String sn = jsonObject.getString("sn");
|
||||
* SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
* SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd");
|
||||
* Date date = null; //打卡时间
|
||||
* try{
|
||||
* date = sdf.parse(jsonObject.getString("recog_time"));
|
||||
* }catch (Exception e){
|
||||
* e.printStackTrace();
|
||||
* return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
* }
|
||||
* String rules = ""; //打卡规则
|
||||
* String button = jsonObject.getString("button");
|
||||
* switch (button){
|
||||
* case "1":
|
||||
* rules = "上班卡(单班制)";
|
||||
* break;
|
||||
* case "2":
|
||||
* rules = "上班卡(双班制)";
|
||||
* break;
|
||||
* case "3":
|
||||
* rules = "上班卡(三班制)";
|
||||
* break;
|
||||
* case "4":
|
||||
* rules = "加班卡";
|
||||
* break;
|
||||
* case "5":
|
||||
* rules = "下班卡";
|
||||
* break;
|
||||
* default:
|
||||
* rules = "撤销";
|
||||
* break;
|
||||
* }
|
||||
*
|
||||
* //判断是打特殊加班卡
|
||||
* if(com.evo.equipment.constant.Constants.EQ_DEVICE_OVER_TIME_CODE.equals(sn)){
|
||||
* RzSpecialAttendance rzSpecialAttendance = null;
|
||||
* SysStaff sysStaff = sysStaffMapper.selectSysStaffByUserId(Long.valueOf(userId));
|
||||
* if("1".equals(button) || "2".equals(button) || "3".equals(button) || "6".equals(button)){
|
||||
* return "{\"Result\":1,\"Msg\":\"无效打卡\"}";
|
||||
* }
|
||||
* if("4".equals(button)){
|
||||
* rzSpecialAttendance = new RzSpecialAttendance();
|
||||
* rzSpecialAttendance.setAttendanceDate(new Date());
|
||||
* rzSpecialAttendance.setStaffId(Long.valueOf(userId));
|
||||
* rzSpecialAttendance.setName(sysStaff.getName());
|
||||
* rzSpecialAttendance.setWorkStartTime(date);
|
||||
* rzSpecialAttendance.setDeptId(sysStaff.getDeptId());
|
||||
* rzSpecialAttendance.setDelFlag("0");
|
||||
* rzSpecialAttendance.setCreateBy("admin");
|
||||
* rzSpecialAttendance.setCreateTime(new Date());
|
||||
* rzSpecialAttendanceMapper.insertRzSpecialAttendance(rzSpecialAttendance);
|
||||
*
|
||||
* RzSpecialOverTime rzSpecialOverTime = rzSpecialOverTimeMapper.selectRzSpecialOverTimeByUserIdAndDate(rzSpecialAttendance.getStaffId(),rzSpecialAttendance.getAttendanceDate());
|
||||
* if(StringUtils.isNull(rzSpecialOverTime)){
|
||||
* rzSpecialOverTime = new RzSpecialOverTime();
|
||||
* rzSpecialOverTime.setUserId(Long.valueOf(userId));
|
||||
* rzSpecialOverTime.setName(sysStaff.getName());
|
||||
* rzSpecialOverTime.setDeptId(sysStaff.getDeptId());
|
||||
* rzSpecialOverTime.setDelFlag("0");
|
||||
* rzSpecialOverTime.setOverDate(date);
|
||||
* rzSpecialOverTime.setCreateTime(new Date());
|
||||
* rzSpecialOverTime.setCreateBy("admin");
|
||||
* rzSpecialOverTimeMapper.insertRzSpecialOverTime(rzSpecialOverTime);
|
||||
* }
|
||||
* return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
* }else {
|
||||
* rzSpecialAttendance = rzSpecialAttendanceMapper.selectRzSpecialAttendanceByuserIdAndDate(Long.valueOf(userId),new Date());
|
||||
* rzSpecialAttendance.setWorkEndTime(date);
|
||||
* SpecialOverTime specialOverTime = bsOverTimeMapper.selectSpecialOverTimeById();
|
||||
* try{
|
||||
* Date overDate_s = sdf.parse(sdfd.format(rzSpecialAttendance.getWorkStartTime())+" "+specialOverTime.getWorkStart());
|
||||
* Date overDate_e = sdf.parse(sdfd.format(date)+" "+specialOverTime.getWorkEnd());
|
||||
*
|
||||
* Long minutes = 0l;
|
||||
* if(overDate_s.after(rzSpecialAttendance.getWorkStartTime()) && overDate_e.before(date)){
|
||||
* minutes = (overDate_e.getTime() - overDate_s.getTime())/1000/60;
|
||||
* }else {
|
||||
* if(overDate_s.before(rzSpecialAttendance.getWorkStartTime()) && overDate_e.after(date)){
|
||||
* minutes = (date.getTime() - rzSpecialAttendance.getWorkStartTime().getTime())/1000/60;
|
||||
* }else{
|
||||
* if(overDate_e.after(date)){
|
||||
* minutes = (date.getTime() - overDate_s.getTime())/1000/60;
|
||||
* }else {
|
||||
* minutes = (overDate_e.getTime() - rzSpecialAttendance.getWorkStartTime().getTime())/1000/60;
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* if(minutes >= 180){
|
||||
* rzSpecialAttendance.setWorkHours(new BigDecimal(3));
|
||||
* }else if(minutes >= 120){
|
||||
* rzSpecialAttendance.setWorkHours(new BigDecimal(2));
|
||||
* }
|
||||
* rzSpecialAttendanceMapper.updateRzSpecialAttendance(rzSpecialAttendance);
|
||||
*
|
||||
* RzSpecialOverTime rzSpecialOverTime = rzSpecialOverTimeMapper.selectRzSpecialOverTimeByUserIdAndDate(rzSpecialAttendance.getStaffId(),rzSpecialAttendance.getAttendanceDate());
|
||||
* rzSpecialOverTime.setSickHours(rzSpecialOverTime.getSickHours().add(rzSpecialAttendance.getWorkHours()));
|
||||
* rzSpecialOverTimeMapper.updateRzSpecialOverTime(rzSpecialOverTime);
|
||||
*
|
||||
* RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(rzSpecialAttendance.getStaffId(),rzSpecialAttendance.getAttendanceDate());
|
||||
* if(StringUtils.isNull(rzAttendanceStatistical.getOverTimeHours())){
|
||||
* rzAttendanceStatistical.setOverTimeHours(new BigDecimal(0.0));
|
||||
* }
|
||||
* rzAttendanceStatistical.setOverTimeHours(rzAttendanceStatistical.getOverTimeHours().add(rzSpecialAttendance.getWorkHours()));
|
||||
* rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
* return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
* }catch (Exception e){
|
||||
* e.printStackTrace();
|
||||
* return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* //根据ID查询员工信息 ,判断员工是否存在,不存在返回失败
|
||||
* SysStaff sysStaff = sysStaffMapper.selectSysStaffByUserId(Long.valueOf(userId));//打卡记录信息
|
||||
* if(sysStaff == null){
|
||||
* return "{\"Result\":1,\"Msg\":\"验证失败,未设置考勤权限\"}";
|
||||
* }
|
||||
* //获取员工的工作时长
|
||||
* EqImages eqImages = eqImagesMapper.selectEqImagesByStaffId(Long.valueOf(userId));
|
||||
* //打卡明细
|
||||
* RzAttendanceDetail attendanceDetail = new RzAttendanceDetail();
|
||||
* //打卡明细表中插入数据
|
||||
* attendanceDetail.setButtonType(rules);
|
||||
* attendanceDetail.setName(sysStaff.getName());
|
||||
* attendanceDetail.setDateTime(date);
|
||||
* attendanceDetail.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
* attendanceDetail.setStaffId(Long.valueOf(userId));
|
||||
* attendanceDetail.setEquipmentCode(sn);
|
||||
* attendanceDetail.setCreateTime(new Date());
|
||||
* int i = rzAttendanceDetailMapper.insertRzAttendanceDetail(attendanceDetail);
|
||||
* if(i < 1){
|
||||
* return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
* }
|
||||
* //考勤加班统计
|
||||
* RzOverTime rzOverTime = null;
|
||||
* RzOverTimeDetail rzOverTimeDetail = null;
|
||||
*
|
||||
* //打的是加班卡,加班列表中填写数据
|
||||
* if("4".equals(button)){
|
||||
* //判断打卡月是否统计过加班
|
||||
* rzOverTime = rzOverTimeMapper.selectRzOverTimeByNameAndMonth(Long.valueOf(userId),date);
|
||||
* if(rzOverTime == null){
|
||||
* rzOverTime = new RzOverTime();
|
||||
* rzOverTime.setUserId(Long.valueOf(userId));
|
||||
* rzOverTime.setOverHours(new BigDecimal("0.0"));
|
||||
* rzOverTime.setDeptId(sysStaff.getDeptId());
|
||||
* rzOverTime.setName(sysStaff.getName());
|
||||
* rzOverTime.setOverTimeMonth(date);
|
||||
* rzOverTime.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
* rzOverTime.setCreateBy("admin");
|
||||
* rzOverTime.setCreateTime(DateUtils.getNowDate());
|
||||
* i = rzOverTimeMapper.insertRzOverTime(rzOverTime);
|
||||
* if(i < 1){
|
||||
* return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
* }
|
||||
* }
|
||||
* rzOverTimeDetail = new RzOverTimeDetail();
|
||||
* rzOverTimeDetail.setOverTimeId(rzOverTime.getId());
|
||||
* rzOverTimeDetail.setOverTimeStart(date);
|
||||
* rzOverTimeDetail.setName(sysStaff.getName());
|
||||
* rzOverTimeDetail.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
* rzOverTimeDetail.setCreateBy("admin");
|
||||
* rzOverTimeDetail.setCreateTime(DateUtils.getNowDate());
|
||||
* i = rzOverTimeDetailMapper.insertRzOverTimeDetail(rzOverTimeDetail);
|
||||
* if(i < 1){
|
||||
* return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
* }
|
||||
* return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
* }
|
||||
*
|
||||
* //员工考勤记录
|
||||
* RzAttendance attendance = rzAttendanceMapper.queryNowDayAttendanceByStatisticalIdAndDate(Long.valueOf(userId),date);
|
||||
* //判断是撤销卡
|
||||
* if("6".equals(button)){
|
||||
* attendance.setRules("");
|
||||
* i = rzAttendanceMapper.updateRzAttendance(attendance);
|
||||
* if(i < 1){
|
||||
* return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
* }
|
||||
* return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
* }
|
||||
*
|
||||
* //判断是上班卡
|
||||
* if("1".equals(button) || "2".equals(button) || "3".equals(button)){
|
||||
* if(StringUtils.isNotNull(attendance.getWorkStartTime())){
|
||||
* attendance.setRules(rules);
|
||||
* }else{
|
||||
* attendance.setRules(rules);
|
||||
* attendance.setWorkStartTime(date);
|
||||
* }
|
||||
* try{
|
||||
* //判断三种上班卡
|
||||
* Date db_pre = sdf.parse(sdfd.format(date) + " 08:30:00");
|
||||
* Date sb_pre = sdf.parse(sdfd.format(date) + " 17:00:00");
|
||||
* Date sbz_pre = sdf.parse(sdfd.format(date) + " 20:30:00");
|
||||
* if("上班卡(单班制)".equals(rules) && date.after(db_pre)
|
||||
* || ("上班卡(双班制)".equals(rules) && ((date.after(db_pre) && date.getHours() < 12) || (date.after(sb_pre) && date.getHours() <21)))
|
||||
* || ("上班卡(三班制)".equals(rules) && ((date.after(db_pre) && date.getHours() < 12) || (date.after(sbz_pre) && date.getHours() < 24)))){
|
||||
* attendance.setYcsFlag("1");
|
||||
* }
|
||||
* }catch (Exception e){
|
||||
* e.printStackTrace();
|
||||
* }
|
||||
* i = rzAttendanceMapper.updateRzAttendance(attendance);
|
||||
* if(i < 1){
|
||||
* return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
* }
|
||||
* return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
* }
|
||||
*
|
||||
* // 查询员工的最后一次上班打卡信息
|
||||
* RzAttendanceDetail rzAttendanceDetail = rzAttendanceDetailMapper.selectRzAttendanceDetailByStaffId(Long.valueOf(userId));
|
||||
*
|
||||
* //下班卡
|
||||
* //最后一次打卡为加班卡 跨月加班按上个月加班计算
|
||||
* if("加班卡".equals(rzAttendanceDetail.getButtonType())){
|
||||
* //修改加班打卡记录 根据员工ID和时间查找 统计数据
|
||||
* rzOverTime = rzOverTimeMapper.selectRzOverTimeByNameAndMonth(Long.valueOf(userId),rzAttendanceDetail.getDateTime());
|
||||
* //查找加班详情 加班统计ID和加班开始时间
|
||||
* rzOverTimeDetail = rzOverTimeDetailMapper.queryRzOverTimeDetailByDateAndOverId(rzOverTime.getId(),rzAttendanceDetail.getDateTime());
|
||||
* rzOverTimeDetail.setOverTimeEnd(date);
|
||||
* //计算加班时长 小时
|
||||
* double hours = (rzOverTimeDetail.getOverTimeEnd().getTime() - rzOverTimeDetail.getOverTimeStart().getTime())/1000/60/60;
|
||||
* if(hours > 4){
|
||||
* rzOverTimeDetail.setOverTimeHours(BigDecimal.valueOf(4));
|
||||
* }else{
|
||||
* rzOverTimeDetail.setOverTimeHours(BigDecimal.valueOf(hours));
|
||||
* }
|
||||
*
|
||||
* i = rzOverTimeDetailMapper.updateRzOverTimeDetail(rzOverTimeDetail);
|
||||
* if(i < 1){
|
||||
* return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
* }
|
||||
* //加班修改统计
|
||||
* rzOverTime.setOverHours(rzOverTime.getOverHours().add(rzOverTimeDetail.getOverTimeHours()));
|
||||
* i = rzOverTimeMapper.updateRzOverTime(rzOverTime);
|
||||
* if(i < 1){
|
||||
* return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
* }
|
||||
* //反写考勤汇总
|
||||
* RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(Long.valueOf(userId),rzOverTime.getOverTimeMonth());
|
||||
* rzAttendanceStatistical.setWorkOvertimeNumber(rzOverTime.getOverHours());
|
||||
* i = rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
* if(i < 1){
|
||||
* return"{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
* }
|
||||
* return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
* }
|
||||
*
|
||||
* BigDecimal res = new BigDecimal("0.0"); //记录工时
|
||||
* //计算工时
|
||||
* Long hours = (date.getTime() - rzAttendanceDetail.getDateTime().getTime())/1000/60/60;
|
||||
* //判断不是当天的下班卡
|
||||
* if(StringUtils.isNull(attendance.getWorkStartTime())){
|
||||
* //最后一次上班卡打卡时间
|
||||
* attendance = rzAttendanceMapper.selectLastRzAttendanceByStaffId(Long.valueOf(userId));
|
||||
* //判断是单班,双班,还是三班
|
||||
* if("上班卡(三班制)".equals(attendance.getRules())){
|
||||
* if(hours >= eqImages.getHours().longValue() -1){
|
||||
* res = eqImages.getHours();
|
||||
* }else if(hours >= 5){
|
||||
* res = new BigDecimal(6);
|
||||
* }
|
||||
* //判断打卡时间, 添加夜班次数 打卡时间在晚上7点以后
|
||||
* if(hours > 8 && attendance.getWorkStartTime().getHours() > 18){
|
||||
* attendance.setNightNumber(1);
|
||||
* }
|
||||
* }else if("上班卡(双班制)".equals(attendance.getRules())){
|
||||
* if(hours >= 7.5){
|
||||
* res = new BigDecimal("8");
|
||||
* }else if(hours >= 3.5){
|
||||
* res = new BigDecimal(4);
|
||||
* }
|
||||
* //判断打卡时间, 添加中班次数 打卡时间在下午3点以后
|
||||
* if(hours > 6.5 && attendance.getWorkStartTime().getHours() > 15){
|
||||
* attendance.setMiddleShiftNumber(1);
|
||||
* }
|
||||
* }else{
|
||||
* if(hours >= 8){
|
||||
* res = new BigDecimal("8");
|
||||
* }else if(hours >= 3){
|
||||
* res = new BigDecimal(4);
|
||||
* }
|
||||
* }
|
||||
* }else{
|
||||
* try{
|
||||
* if("上班卡(单班制)".equals(rzAttendanceDetail.getButtonType())){
|
||||
* if(attendance.getWorkStartTime().getTime() - sdf.parse(sdfd.format(date) + " 08:30:00").getTime() > 1000*60*+60
|
||||
* || sdf.parse(sdfd.format(date) + " 17:30:00").getTime() - date.getTime() > 1000*60*+60){
|
||||
* if(hours >= 3){
|
||||
* res = new BigDecimal("4");
|
||||
* }
|
||||
* }else{
|
||||
* if(hours >= 8){
|
||||
* res = new BigDecimal("8.0");
|
||||
* }else if(hours >= 4){
|
||||
* res = new BigDecimal(4);
|
||||
* }
|
||||
* }
|
||||
* }else if("上班卡(双班制)".equals(rzAttendanceDetail.getButtonType())){
|
||||
* if(attendance.getWorkStartTime().getTime() - sdf.parse(sdfd.format(date) + " 08:30:00").getTime() > 1000*60*+60
|
||||
* || sdf.parse(sdfd.format(date) + " 17:30:00").getTime() - date.getTime() > 1000*60*+60){
|
||||
* if(hours >= 4){
|
||||
* res = new BigDecimal("4");
|
||||
* }
|
||||
* }else{
|
||||
* if(hours >= 8){
|
||||
* res = new BigDecimal("8.0");
|
||||
* }else if(hours >= 4){
|
||||
* res = new BigDecimal(4);
|
||||
* }
|
||||
* }
|
||||
* }else if("上班卡(三班制)".equals(rzAttendanceDetail.getButtonType())){
|
||||
* if(attendance.getWorkStartTime().getTime() - sdf.parse(sdfd.format(date) + " 08:30:00").getTime() > 1000*60*+60
|
||||
* || sdf.parse(sdfd.format(date) + " 20:30:00").getTime() - date.getTime() > 1000*60*+60){
|
||||
* if(hours >= 5){
|
||||
* res = new BigDecimal("6");
|
||||
* }
|
||||
* }else{
|
||||
* if(hours >= eqImages.getHours().longValue()-1){
|
||||
* res = eqImages.getHours();
|
||||
* }else if(hours >= 5){
|
||||
* res = new BigDecimal(6);
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }catch (Exception e){
|
||||
*
|
||||
* }
|
||||
* }
|
||||
* try{
|
||||
* //下班卡异常
|
||||
* Date db_pre = sdf.parse(sdfd.format(date) + " 08:30:00");
|
||||
* Date sb_pre = sdf.parse(sdfd.format(date) + " 17:00:00");
|
||||
* Date db_pre_2 = sdf.parse(sdfd.format(date) + " 17:30:00");
|
||||
* Date sbz_pre = sdf.parse(sdfd.format(date) + " 20:30:00");
|
||||
* Date sbz_pre_2 = sdf.parse(sdfd.format(date) + " 01:30:00");
|
||||
* if(("上班卡(单班制)".equals(rzAttendanceDetail.getButtonType()) && date.before(db_pre_2))
|
||||
* || ("上班卡(双班制)".equals(rzAttendanceDetail.getButtonType())
|
||||
* && ((date.before(sb_pre) && date.after(db_pre)) || ((date.before(sbz_pre_2)) && date.after(sb_pre))))
|
||||
* || ("上班卡(三班制)".equals(rzAttendanceDetail.getButtonType()) && ((date.before(sbz_pre) && date.getHours() > 14) || date.before(db_pre)))){
|
||||
* attendance.setYcxFlag("1");
|
||||
* }
|
||||
* }catch (Exception e){
|
||||
* e.printStackTrace();
|
||||
* }
|
||||
* //修改打卡记录
|
||||
* attendance.setWorkEndTime(date);
|
||||
* attendance.setWorkSum(res);
|
||||
* i = rzAttendanceMapper.updateRzAttendance(attendance);
|
||||
* if(i < 1){
|
||||
* return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
* }
|
||||
* //反写考勤汇总
|
||||
* RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(Long.valueOf(userId),attendance.getAttendanceDate());
|
||||
* rzAttendanceStatistical.setRealAttendance(rzAttendanceStatistical.getRealAttendance().add(attendance.getWorkSum()));
|
||||
* i = rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
* if(i < 1){
|
||||
* return"{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
* }
|
||||
* return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -193,13 +193,13 @@ public class RzAttendanceDetailServiceImpl extends ServiceImpl<RzAttendanceDetai
|
||||
List<SysStaff> rzb = sysStaffMapper.queryysStaffByDeptId(Collections.asList(28l));
|
||||
if(Collections.isNotEmpty(rzb)){
|
||||
for (SysStaff rz : rzb){
|
||||
sendAttendanceDetail(userName, deptName, rz.getOpenid());
|
||||
sendAttendanceDetail(userName, rz.getName(), deptName, rz.getOpenid());
|
||||
}
|
||||
}
|
||||
//查询部门负责人
|
||||
SysStaff leaderSysStaff = sysStaffMapper.selectLeaderSysStaffByDeptId(sysStaff.getDeptId());
|
||||
if(leaderSysStaff != null){
|
||||
sendAttendanceDetail(userName, deptName, leaderSysStaff.getOpenid());
|
||||
sendAttendanceDetail(userName, leaderSysStaff.getName(), deptName, leaderSysStaff.getOpenid());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -212,10 +212,11 @@ public class RzAttendanceDetailServiceImpl extends ServiceImpl<RzAttendanceDetai
|
||||
|
||||
|
||||
@Async
|
||||
protected void sendAttendanceDetail(String userName, String deptName, String openId){
|
||||
protected void sendAttendanceDetail(String userName, String pushName, String deptName, String openId){
|
||||
try {
|
||||
if(StringUtils.isNotEmpty(openId)){
|
||||
sendClientService.sendAbnormalAttendance(deptName,userName, "长时间未打卡", new Date(), openId);
|
||||
String res = sendClientService.sendAbnormalAttendance(deptName,userName, "长时间未打卡", new Date(), openId);
|
||||
log.info("超过三天推送>>>>>>>>>>>>>>>员工:{}, 部门:{}, 推送人员:{}, 推送结果:{}", userName, deptName, pushName, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("推送公众号打卡异常失败, 原因为: {}", e.getMessage(), e);
|
||||
|
||||
@ -13,12 +13,14 @@ import com.evo.attendance.service.RzAttendanceDetailService;
|
||||
import com.evo.common.annotation.DataScope;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.domain.entity.SysDept;
|
||||
import com.evo.common.utils.Collections;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.equipment.service.IEqImagesService;
|
||||
import com.evo.system.domain.SysStaff;
|
||||
import com.evo.system.mapper.SysDeptMapper;
|
||||
import com.evo.system.mapper.SysStaffMapper;
|
||||
import com.evo.system.service.ISysStaffService;
|
||||
import com.evo.wechat.service.SendClientService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -31,6 +33,7 @@ import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 考勤记录Service业务层处理
|
||||
@ -51,6 +54,8 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
||||
private RzAttendanceDetailService rzAttendanceDetailService;
|
||||
@Resource
|
||||
private SendClientService sendClientService;
|
||||
@Autowired
|
||||
private SysStaffMapper sysStaffMapper;
|
||||
|
||||
private static final String MORNING_CARD_SINGLE = "上班卡(单班制)";
|
||||
private static final String MORNING_CARD_DOUBLE = "上班卡(双班制)";
|
||||
@ -467,6 +472,8 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
||||
return rzAttendance;
|
||||
}
|
||||
|
||||
private static Map<Long, String> deptNameMap = Collections.emptyMap();
|
||||
|
||||
@Override
|
||||
public void sendAbnormalAttendance(){
|
||||
try {
|
||||
@ -475,6 +482,21 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
||||
RzAttendance beforeAttendance = getBaseMapper().queryNowDayAttendanceByStatisticalIdAndDate(sysStaff.getUserId(), date);
|
||||
if(beforeAttendance.getWorkStartTime() != null && beforeAttendance.getWorkEndTime() == null){
|
||||
sendAbnormalAttendance(sysStaff, beforeAttendance.getWorkStartTime());
|
||||
|
||||
if(sysStaff != null) {
|
||||
String deptName = deptNameMap.get(sysStaff.getDeptId());
|
||||
if(StringUtils.isEmpty(deptName)){
|
||||
SysDept sysDept = sysDeptMapper.selectById(sysStaff.getDeptId());
|
||||
deptName = sysDept != null ? sysDept.getDeptName() : "未知";
|
||||
deptNameMap.put(sysDept.getDeptId(), deptName);
|
||||
}
|
||||
String userName = sysStaff.getName();
|
||||
//查询部门负责人
|
||||
SysStaff leaderSysStaff = sysStaffMapper.selectLeaderSysStaffByDeptId(sysStaff.getDeptId());
|
||||
if(leaderSysStaff != null){
|
||||
sendAttendanceDetail(userName, leaderSysStaff.getName(), deptName, leaderSysStaff.getOpenid());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -491,12 +513,24 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
||||
try {
|
||||
if(sysStaff != null && StringUtils.isNotEmpty(sysStaff.getOpenid())){
|
||||
SysDept sysDept = sysDeptMapper.selectById(sysStaff.getDeptId());
|
||||
sendClientService.sendAbnormalAttendance(sysDept != null ? sysDept.getDeptName() : "未知",sysStaff.getName(), "昨天下班未打卡", date, sysStaff.getOpenid());
|
||||
String res = sendClientService.sendAbnormalAttendance(sysDept != null ? sysDept.getDeptName() : "未知",sysStaff.getName(), "昨天下班未打卡", date, sysStaff.getOpenid());
|
||||
log.info("员工:{}, 推送结果:{}", sysStaff.getName(), res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("推送公众号打卡异常失败, 原因为: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Async
|
||||
protected void sendAttendanceDetail(String userName, String pushName, String deptName, String openId){
|
||||
try {
|
||||
if(StringUtils.isNotEmpty(openId)){
|
||||
String res = sendClientService.sendAbnormalAttendance(deptName,userName, "长时间未打卡", new Date(), openId);
|
||||
log.info("日常推送>>>>>>>>>>>>>>>员工:{}, 部门:{}, 推送人员:{}, 推送结果:{}", userName, deptName, pushName, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("推送公众号打卡异常失败, 原因为: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
44
evo-admin/src/main/java/com/evo/common/config/Global.java
Normal file
44
evo-admin/src/main/java/com/evo/common/config/Global.java
Normal file
@ -0,0 +1,44 @@
|
||||
package com.evo.common.config;
|
||||
|
||||
import com.evo.common.utils.spring.SpringUtils;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 全局属性配置
|
||||
* @author andy.shi
|
||||
* @ClassName:Global
|
||||
* @date: 2026年01月10日 10:16
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Configuration
|
||||
@ConfigurationProperties //(prefix = "yt", ignoreInvalidFields = true)
|
||||
@Data
|
||||
public class Global {
|
||||
/***
|
||||
* 云平台私钥
|
||||
*/
|
||||
@Value("${spring.profiles.active}")
|
||||
public String active;
|
||||
//单例模式全局属性
|
||||
private static volatile Global global;
|
||||
|
||||
|
||||
public static Global newInstance() {
|
||||
if(global == null){
|
||||
synchronized (Global.class){
|
||||
if(global == null){
|
||||
global = SpringUtils.getBean(Global.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
return global;
|
||||
}
|
||||
|
||||
// public String getActive() {
|
||||
// return active;
|
||||
// }
|
||||
|
||||
}
|
||||
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.evo.attendance.service.IRzAttendanceService;
|
||||
import com.evo.attendance.service.IRzAttendanceStatisticalService;
|
||||
import com.evo.attendance.service.RzAttendanceDetailService;
|
||||
import com.evo.common.config.Global;
|
||||
import com.evo.common.constant.Constants;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.utils.Collections;
|
||||
@ -97,7 +98,7 @@ public class TestController {
|
||||
// rzOverTimeDetail.setOverTimeHours(BigDecimal.valueOf(((hours > maxOverTimeHour) ? maxOverTimeHour : hours)));
|
||||
|
||||
// if(rzOverTimeDetailMapper.updateRzOverTimeDetail(rzOverTimeDetail) < 1){
|
||||
return AjaxResult.success();
|
||||
return AjaxResult.success(Global.newInstance().getActive());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -101,6 +101,13 @@ public class ParamUtils {
|
||||
RzSysParam param= paramService.getRzSysParam("月中转正的补助限制日期", "limit_subsidy_day","10","月中转正的补助限制日期; 如value填写的为10. 则10号之前转正有补助, 10号之后转正没有补助");
|
||||
return param.getParamValue();
|
||||
}
|
||||
|
||||
public static String getLimitWorkSum(){
|
||||
RzSysParam param= paramService.getRzSysParam("晚餐福利餐最少工作时长", "limit_work_sum","10","晚餐福利餐最少工作时长, 单位为小时");
|
||||
return param.getParamValue();
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 不住宿的实习生人员
|
||||
* @return
|
||||
|
||||
@ -82,6 +82,14 @@ public class RzRestaurantStatistics extends BaseEntity
|
||||
@Excel(name = "晚餐次数")
|
||||
private Long supperNumber;
|
||||
|
||||
/** 晚餐消费 */
|
||||
@Excel(name = "福利晚餐消费")
|
||||
private BigDecimal benefitsSupperExpend;
|
||||
|
||||
/** 晚餐次数 */
|
||||
@Excel(name = "福利晚餐次数")
|
||||
private Long benefitsSupperNumber;
|
||||
|
||||
/** 晚餐个人总消费 */
|
||||
@Excel(name = "晚餐个人总消费")
|
||||
private BigDecimal supperPreSumExpend;
|
||||
|
||||
@ -50,4 +50,6 @@ public interface RzRestaurantDetailMapper extends BaseMapper<RzRestaurantDetail>
|
||||
public List<Map<String, Object>> selectRzRestaurantDetailListMap(@Param("month") Date month);
|
||||
|
||||
public List<Map<String, Object>> selectDetailAllListMap(@Param("month") String month);
|
||||
|
||||
public List<Map<String, Object>> selectDinnerRzRestaurantDetailListMap(@Param("month") Date month);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.evo.restaurant.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.evo.attendance.mapper.RzAttendanceMapper;
|
||||
import com.evo.common.constant.Constants;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.domain.entity.SysDept;
|
||||
@ -46,7 +47,11 @@ public class RzRestaurantStatisticsServiceImpl extends ServiceImpl<RzRestaurantS
|
||||
@Resource
|
||||
private SysDictDataMapper sysDictDataMapper; //数据字典
|
||||
@Resource
|
||||
private RzRestaurantDetailMapper rzRestaurantDetailMapper; //餐饮详情
|
||||
private RzRestaurantDetailMapper rzRestaurantDetailMapper;
|
||||
@Resource
|
||||
private RzAttendanceMapper rzAttendanceMapper;
|
||||
|
||||
//餐饮详情
|
||||
/**
|
||||
* 查询餐饮统计
|
||||
*
|
||||
@ -67,29 +72,7 @@ public class RzRestaurantStatisticsServiceImpl extends ServiceImpl<RzRestaurantS
|
||||
@Override
|
||||
public List<RzRestaurantStatistics> selectRzRestaurantStatisticsList(RzRestaurantStatistics rzRestaurantStatistics)
|
||||
{
|
||||
|
||||
return getBaseMapper().selectRzRestaurantStatisticsList(rzRestaurantStatistics);
|
||||
//
|
||||
// List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>());
|
||||
// Map<Long, String> deptNameMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName));
|
||||
// Map<String, String> nameAndDeptIdMap = deptList.stream().filter(d -> d.getParentId().equals(0l)).collect(Collectors.toMap(d->String.valueOf(d.getDeptId()), SysDept::getDeptName));
|
||||
// Map<Long, String> companyNameMap = Collections.emptyMap();
|
||||
// deptList.stream().filter(d -> !d.getParentId().equals(0l)).forEach(d ->{
|
||||
// List<String> parentIdList = Collections.asList(d.getAncestors().split(","));
|
||||
// Iterator<String> it = nameAndDeptIdMap.keySet().iterator();
|
||||
// while (it.hasNext()){
|
||||
// String pid = it.next();
|
||||
// if(parentIdList.contains(pid)){
|
||||
// companyNameMap.put(d.getDeptId(), nameAndDeptIdMap.get(pid));
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// List<RzRestaurantStatistics> res_list = getBaseMapper().selectRzRestaurantStatisticsList(rzRestaurantStatistics);
|
||||
// for (RzRestaurantStatistics restaurantStatistics : res_list) {
|
||||
// restaurantStatistics.setCompanyName(DataUtils.findDefaultValue(companyNameMap.get(restaurantStatistics.getDeptId()), "实习生"));
|
||||
// restaurantStatistics.setDeptName(DataUtils.findDefaultValue(deptNameMap.get(restaurantStatistics.getDeptId()), "实习生"));
|
||||
// }
|
||||
// return res_list;
|
||||
}
|
||||
|
||||
|
||||
@ -114,6 +97,16 @@ public class RzRestaurantStatisticsServiceImpl extends ServiceImpl<RzRestaurantS
|
||||
* 不住宿日薪:438
|
||||
*/
|
||||
Map<String, List<Map<String, Object>>> map = rzRestaurantDetailMapper.selectRzRestaurantDetailListMap(rzRestaurantStatistics.getMonth()).stream().collect(Collectors.groupingBy(d->String.valueOf(d.get("staffId"))));
|
||||
//查询晚餐人数, 用于计算福利餐次数
|
||||
Map<String, List<Map<String, Object>>> dinnerMap = rzRestaurantDetailMapper.selectDinnerRzRestaurantDetailListMap(rzRestaurantStatistics.getMonth()).stream().collect(Collectors.groupingBy(d->String.valueOf(d.get("staffId"))));
|
||||
//计算每个人的福利餐次数
|
||||
Map<String, Long> dinnerNum = Collections.emptyMap();
|
||||
String limitWorkSum = ParamUtils.getLimitWorkSum();
|
||||
for (String key : dinnerMap.keySet()){
|
||||
String dateStr = dinnerMap.get(key).stream().map(data-> DateUtils.parseDateToStr("yyyy-MM-dd", DateUtils.parseDate(data.get("date")))).collect(Collectors.joining(","));
|
||||
dinnerNum.put(key, rzAttendanceMapper.selectDinnerCount(limitWorkSum, key, dateStr));
|
||||
}
|
||||
|
||||
//查询消费情况
|
||||
Map<Long,String> dicMap = sysDictDataMapper.selectDictDataByType(Constants.SYS_RESTAUTANT).stream().collect(Collectors.toMap(SysDictData::getDictCode, SysDictData::getDictValue));
|
||||
//优先检查是否为住宿
|
||||
@ -122,11 +115,10 @@ public class RzRestaurantStatisticsServiceImpl extends ServiceImpl<RzRestaurantS
|
||||
//然后在检查是否为日薪
|
||||
Map<Long, Boolean> rxMap = sysStaffDetailMapper.selectList(new LambdaQueryWrapper<SysStaffDetail>().in(SysStaffDetail::getStaffId, zsMap.keySet().toArray())).stream().collect(Collectors.toMap(SysStaffDetail::getStaffId, d->d.getDailyWage() != null && d.getDailyWage().intValue() > 0));
|
||||
List<String> dailyWageNames = ParamUtils.getInternDailyWage();
|
||||
//查这个人, 这个月, 有多少加班, 并且吃完饭了
|
||||
|
||||
//循环统计信息
|
||||
for (RzRestaurantStatistics restaurantStatistics : rt_list) {
|
||||
if(restaurantStatistics.getName().equals("高宇腾")){
|
||||
System.out.println(1111);
|
||||
}
|
||||
//记录早午晚三餐次数
|
||||
//循环打卡详情
|
||||
|
||||
@ -134,12 +126,20 @@ public class RzRestaurantStatisticsServiceImpl extends ServiceImpl<RzRestaurantS
|
||||
restaurantStatistics.setBreakfastNumber(Long.valueOf(DataUtils.findDefaultValue(mapDetail.get("早餐"),"0")));
|
||||
restaurantStatistics.setLunchNumber(Long.valueOf(DataUtils.findDefaultValue(mapDetail.get("午餐"),"0")));
|
||||
restaurantStatistics.setSupperNumber(Long.valueOf(DataUtils.findDefaultValue(mapDetail.get("晚餐"),"0")));
|
||||
//福利餐次数
|
||||
restaurantStatistics.setBenefitsSupperNumber(DataUtils.findDefaultValue(dinnerNum.get(String.valueOf(restaurantStatistics.getStaffId())),0l));
|
||||
//更新晚餐次数
|
||||
restaurantStatistics.setSupperNumber(restaurantStatistics.getSupperNumber()-restaurantStatistics.getBenefitsSupperNumber());
|
||||
|
||||
//记录午餐单价
|
||||
restaurantStatistics.setLunchExpend(new BigDecimal(dicMap.get(Constants.gr_wc_code)));
|
||||
//午餐消费
|
||||
restaurantStatistics.setBreakfastExpend(new BigDecimal(dicMap.get(Constants.gr_zc_code)));
|
||||
//晚餐
|
||||
restaurantStatistics.setSupperExpend( new BigDecimal(dicMap.get(Constants.gr_wcc_code)));
|
||||
//福利晚餐单价
|
||||
restaurantStatistics.setBenefitsSupperExpend(new BigDecimal(dicMap.get(Constants.gr_wcc_code)));
|
||||
|
||||
//不是实习生住宿人员 或者 不是住宿人员
|
||||
if(notAccommodationNames.contains(restaurantStatistics.getName()) || !DataUtils.findDefaultValue(zsMap.get(restaurantStatistics.getStaffId()),false)){
|
||||
restaurantStatistics.setBreakfastExpend(new BigDecimal(dicMap.get(Constants.zc_code)));
|
||||
@ -151,7 +151,8 @@ public class RzRestaurantStatisticsServiceImpl extends ServiceImpl<RzRestaurantS
|
||||
//计算费用
|
||||
restaurantStatistics.setBreakfastPreSumExpend(restaurantStatistics.getBreakfastExpend().multiply(new BigDecimal(restaurantStatistics.getBreakfastNumber())));
|
||||
restaurantStatistics.setLunchPreSumExpend(restaurantStatistics.getLunchExpend().multiply(new BigDecimal(restaurantStatistics.getLunchNumber())));
|
||||
restaurantStatistics.setSupperPreSumExpend(restaurantStatistics.getSupperExpend().multiply(new BigDecimal(restaurantStatistics.getSupperNumber())));
|
||||
restaurantStatistics.setSupperPreSumExpend(restaurantStatistics.getSupperExpend().multiply(new BigDecimal(restaurantStatistics.getSupperNumber())).add(restaurantStatistics.getBenefitsSupperExpend().multiply(new BigDecimal(restaurantStatistics.getBenefitsSupperNumber()))));
|
||||
//计算个人总消费
|
||||
restaurantStatistics.setPersonalSumConsumption(restaurantStatistics.getBreakfastPreSumExpend().add(restaurantStatistics.getLunchPreSumExpend()).add(restaurantStatistics.getSupperPreSumExpend()));
|
||||
|
||||
//计算总消费
|
||||
|
||||
@ -3,6 +3,7 @@ package com.evo.wechat.service;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.evo.common.config.Global;
|
||||
import com.evo.common.utils.Collections;
|
||||
import com.evo.wechat.TemplateMessageUtil;
|
||||
import com.evo.wechat.config.GZHProperties;
|
||||
@ -30,18 +31,22 @@ public class SendClientService {
|
||||
GZHProperties gzhProperties;
|
||||
|
||||
|
||||
public void sendAbnormalAttendance(String deptName, String userName, String info, Date date, String openId){
|
||||
AbnormalAttendanceTemplate templateData = new AbnormalAttendanceTemplate();
|
||||
templateData.setThing1((JSONObject) JSON.toJSON(Collections.asMap("value", deptName)));
|
||||
templateData.setThing2((JSONObject)JSON.toJSON(Collections.asMap("value",userName)));//动态跟换车牌号
|
||||
templateData.setConst4((JSONObject)JSON.toJSON(Collections.asMap("value", info)));//动态跟换车牌号
|
||||
templateData.setTime6((JSONObject)JSON.toJSON(Collections.asMap("value", DateUtil.format(date, "yyyy年MM月dd日"))));//动态跟换车牌号
|
||||
public String sendAbnormalAttendance(String deptName, String userName, String info, Date date, String openId){
|
||||
//检查是否为生产环境, 非生产环境,无需发送
|
||||
if("druid".equals(Global.newInstance().getActive())){
|
||||
AbnormalAttendanceTemplate templateData = new AbnormalAttendanceTemplate();
|
||||
templateData.setThing1((JSONObject) JSON.toJSON(Collections.asMap("value", deptName)));
|
||||
templateData.setThing2((JSONObject)JSON.toJSON(Collections.asMap("value",userName)));//动态跟换车牌号
|
||||
templateData.setConst4((JSONObject)JSON.toJSON(Collections.asMap("value", info)));//动态跟换车牌号
|
||||
templateData.setTime6((JSONObject)JSON.toJSON(Collections.asMap("value", DateUtil.format(date, "yyyy年MM月dd日"))));//动态跟换车牌号
|
||||
|
||||
MessageTemplate sendData = new MessageTemplate();
|
||||
sendData.setTouser(openId);
|
||||
sendData.setTemplate_id(gzhProperties.getAbnormalAttendanceTemplateId());
|
||||
sendData.setData((JSONObject)JSON.toJSON(templateData));
|
||||
TemplateMessageUtil.templateMessageSend(gzhAccessTokenService.gzhAccessToken(), sendData);
|
||||
MessageTemplate sendData = new MessageTemplate();
|
||||
sendData.setTouser(openId);
|
||||
sendData.setTemplate_id(gzhProperties.getAbnormalAttendanceTemplateId());
|
||||
sendData.setData((JSONObject)JSON.toJSON(templateData));
|
||||
return TemplateMessageUtil.templateMessageSend(gzhAccessTokenService.gzhAccessToken(), sendData);
|
||||
}
|
||||
return "非生产环境, 无需发送";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -133,4 +133,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from rz_attendance
|
||||
where del_flag = '0' and DATE_FORMAT(attendance_date,"%y-%m") = DATE_FORMAT(#{date},"%y-%m") GROUP BY staff_id, name
|
||||
</select>
|
||||
<!-- or (ra.work_sum = 11 and EXISTS (select 1 from rz_sys_param sp where LOCATE(ra.name, sp.param_value) > 0 and sp.param_code = 'ts_work_hour' ))-->
|
||||
<select id="selectDinnerCount" resultType="java.lang.Long">
|
||||
select count(ra.id) from rz_attendance ra
|
||||
where ra.staff_id = #{staffId} and LOCATE(DATE_FORMAT( ra.attendance_date, '%Y-%m-%d' ), #{days}) > 0
|
||||
and (ra.work_sum >= #{limitWorkSum}
|
||||
|
||||
or (ra.work_sum = 8 and EXISTS (select count(id) from rz_attendance_detail rad where rad.attendance_id = ra.id and rad.button_type = '加班卡' ))
|
||||
)
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -105,4 +105,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
|
||||
<select id="selectDinnerRzRestaurantDetailListMap" resultType="java.util.Map">
|
||||
select rrd.staff_id as staffId, rrd.date
|
||||
from rz_restaurant_detail rrd
|
||||
left join sys_staff ss on ss.user_id = rrd.staff_id
|
||||
left join sys_staff_detail ssd on ssd.staff_id = ss.user_id
|
||||
where rrd.del_flag = '0'
|
||||
and sign = '晚餐'
|
||||
and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT( #{month} , '%Y%m' )
|
||||
and ss.del_flag = '0'
|
||||
and ssd.daily_wage > 0
|
||||
and ss.zs_Flag = '否'
|
||||
and status != '-1'
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -20,6 +20,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="lunchSumExpend" column="lunch_sum_expend" />
|
||||
<result property="supperExpend" column="supper_expend" />
|
||||
<result property="supperNumber" column="supper_number" />
|
||||
<result property="benefitsSupperExpend" column="benefits_supper_expend" />
|
||||
<result property="benefitsSupperNumber" column="benefits_supper_number" />
|
||||
<result property="supperPreSumExpend" column="supper_pre_sum_expend" />
|
||||
<result property="supperSumExpend" column="supper_sum_expend" />
|
||||
<result property="personalSumConsumption" column="personal_sum_consumption" />
|
||||
@ -33,7 +35,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRzRestaurantStatisticsVo">
|
||||
select id, staff_id, dept_id, name, month, breakfast_expend, breakfast_number, breakfast_pre_sum_expend, breakfast_sum_expend, lunch_expend, lunch_number, lunch_pre_sum_expend, lunch_sum_expend, supper_expend, supper_number, supper_pre_sum_expend, supper_sum_expend, personal_sum_consumption, sum_consumption, remarks, del_flag, create_by, create_time, update_by, update_time from rz_restaurant_statistics
|
||||
select id, staff_id, dept_id, name, month,
|
||||
breakfast_expend, breakfast_number, breakfast_pre_sum_expend, breakfast_sum_expend,
|
||||
lunch_expend, lunch_number, lunch_pre_sum_expend, lunch_sum_expend,
|
||||
supper_expend, supper_number, supper_pre_sum_expend, supper_sum_expend,
|
||||
benefits_supper_expend, benefits_supper_number,
|
||||
personal_sum_consumption, sum_consumption,
|
||||
remarks, del_flag, create_by, create_time, update_by, update_time
|
||||
|
||||
|
||||
from rz_restaurant_statistics
|
||||
</sql>
|
||||
|
||||
<select id="selectRzRestaurantStatisticsList" parameterType="RzRestaurantStatistics" resultType="com.evo.restaurant.domain.RzRestaurantStatistics">
|
||||
@ -76,6 +87,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="lunchSumExpend != null">lunch_sum_expend,</if>
|
||||
<if test="supperExpend != null">supper_expend,</if>
|
||||
<if test="supperNumber != null">supper_number,</if>
|
||||
<if test="benefitsSupperExpend != null">benefits_supper_expend,</if>
|
||||
<if test="benefitsSupperNumber != null">benefits_supper_number,</if>
|
||||
<if test="supperPreSumExpend != null">supper_pre_sum_expend,</if>
|
||||
<if test="supperSumExpend != null">supper_sum_expend,</if>
|
||||
<if test="personalSumConsumption != null">personal_sum_consumption,</if>
|
||||
@ -102,6 +115,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="lunchSumExpend != null">#{lunchSumExpend},</if>
|
||||
<if test="supperExpend != null">#{supperExpend},</if>
|
||||
<if test="supperNumber != null">#{supperNumber},</if>
|
||||
<if test="benefitsSupperExpend != null">#{benefitsSupperExpend},</if>
|
||||
<if test="benefitsSupperNumber != null">#{benefitsSupperNumber},</if>
|
||||
<if test="supperPreSumExpend != null">#{supperPreSumExpend},</if>
|
||||
<if test="supperSumExpend != null">#{supperSumExpend},</if>
|
||||
<if test="personalSumConsumption != null">#{personalSumConsumption},</if>
|
||||
@ -132,6 +147,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="lunchSumExpend != null">lunch_sum_expend = #{lunchSumExpend},</if>
|
||||
<if test="supperExpend != null">supper_expend = #{supperExpend},</if>
|
||||
<if test="supperNumber != null">supper_number = #{supperNumber},</if>
|
||||
<if test="benefitsSupperExpend != null">benefits_supper_expend=#{benefitsSupperExpend},</if>
|
||||
<if test="benefitsSupperNumber != null">benefits_supper_number=#{benefitsSupperNumber},</if>
|
||||
<if test="supperPreSumExpend != null">supper_pre_sum_expend = #{supperPreSumExpend},</if>
|
||||
<if test="supperSumExpend != null">supper_sum_expend = #{supperSumExpend},</if>
|
||||
<if test="personalSumConsumption != null">personal_sum_consumption = #{personalSumConsumption},</if>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user