优化调整 餐饮导出

This commit is contained in:
andy 2026-08-07 16:07:58 +08:00
parent c34cb201f6
commit faf571877f
5 changed files with 218 additions and 77 deletions

View File

@ -553,33 +553,6 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
JSONObject ob = jsonArray.getJSONObject(i); JSONObject ob = jsonArray.getJSONObject(i);
if(bizId.equals(ob.getString("bizId"))){ if(bizId.equals(ob.getString("bizId"))){
calculationAddRzOverTime(result, sysStaff, ob, null); calculationAddRzOverTime(result, sysStaff, ob, null);
// //打卡类型
// String checkType = ob.getString("checkType");
// //考勤组
// String groupId = ob.getString("groupId");
// //排班时间
// Long planCheckTime = ob.getLong("planCheckTime");
// // 格式化先转Date对象再格式化
// String formatPlanCheckTime = DateUtils.parseDateToStr("HH:mm:ss", new Date(planCheckTime));
// //用户打卡时间
// Long userCheckTime = ob.getLong("userCheckTime");
// //工作时间 (这里指的是哪一天的卡)
// Long workDate = ob.getLong("workDate");
// /***
// * 打卡结果
// * Normal正常
// * Early早退
// * Late迟到
// * SeriousLate严重迟到
// * Absenteeism旷工迟到
// * NotSigned未打卡
// */
// String timeResult = ob.getString("timeResult");
//
// Date formatWorkDate = Date.from(Instant.ofEpochMilli(workDate));
// Date formatUserCheckTime = Date.from(Instant.ofEpochMilli(userCheckTime));
// DingShiftGroup dingsShiftGroup = dingsShiftGroupMapper.selectByGroupIdAndTypeAndCheckTime(groupId, checkType, formatPlanCheckTime);
// addRzOverTime(result, sysStaff, dingsShiftGroup, checkType, formatWorkDate, formatUserCheckTime, timeResult, null, 0d);
break; break;
} }
} }
@ -614,6 +587,12 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
attendance.setWorkEndTime(formatUserCheckTime); attendance.setWorkEndTime(formatUserCheckTime);
if("Normal".equals(timeResult) && !"1".equals(attendance.getYcsFlag()) && attendance.getWorkStartTime() != null){ if("Normal".equals(timeResult) && !"1".equals(attendance.getYcsFlag()) && attendance.getWorkStartTime() != null){
attendance.setWorkSum(BigDecimal.valueOf(dingsShift.getWorkHour())); attendance.setWorkSum(BigDecimal.valueOf(dingsShift.getWorkHour()));
//核验下打卡信息, 如果实际工作时间 < 默认工作时长, 修正为实际工作时长
Long hours = (attendance.getWorkEndTime().getTime() - attendance.getWorkStartTime().getTime())/1000/60/60;
//如果实际工作时长, 小于设定时长, 存在误差 0.5小时之内, 超出0.5小时, 更新为实际工作时长
if(BigDecimal.valueOf(dingsShift.getWorkHour()).compareTo(BigDecimal.valueOf(hours)) > 0 && hours <= (dingsShift.getWorkHour()-0.5)){
attendance.setWorkSum(BigDecimal.valueOf(hours));
}
}else{ }else{
//早退需要计算工时 //早退需要计算工时
if(attendance.getWorkStartTime() != null){ if(attendance.getWorkStartTime() != null){
@ -631,6 +610,7 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
//终止继续执行 //终止继续执行
return; return;
} }
//判断打卡时间, 添加夜班次数 打卡时间在晚上7点以后 //判断打卡时间, 添加夜班次数 打卡时间在晚上7点以后
if(dingsShift.getWorkHour() == 12 && attendance.getWorkSum().intValue() >= 12 && attendance.getWorkStartTime()!= null && attendance.getWorkStartTime().getHours() > 12){ if(dingsShift.getWorkHour() == 12 && attendance.getWorkSum().intValue() >= 12 && attendance.getWorkStartTime()!= null && attendance.getWorkStartTime().getHours() > 12){
attendance.setNightNumber(1); attendance.setNightNumber(1);

View File

@ -15,6 +15,8 @@ import com.evo.common.utils.Collections;
import com.evo.common.utils.http.HttpUtils; import com.evo.common.utils.http.HttpUtils;
import com.evo.common.utils.spring.SpringUtils; import com.evo.common.utils.spring.SpringUtils;
import com.evo.ding.DingUtils; import com.evo.ding.DingUtils;
import com.evo.ding.processor.callback.DingCallBackExchangeProcessor;
import com.evo.ding.processor.callback.impl.DingCallBackCheckRecordExchangeProcessor;
import com.evo.ding.processor.callback.impl.DingCallBackUserAddOrgExchangeProcessor; import com.evo.ding.processor.callback.impl.DingCallBackUserAddOrgExchangeProcessor;
import com.evo.personnelMatters.mapper.RzOverTimeDetailMapper; import com.evo.personnelMatters.mapper.RzOverTimeDetailMapper;
import com.evo.personnelMatters.mapper.RzOverTimeMapper; import com.evo.personnelMatters.mapper.RzOverTimeMapper;
@ -27,13 +29,11 @@ import com.evo.wechat.dto.MessageTemplate;
import com.evo.wechat.service.GZHAccessTokenService; import com.evo.wechat.service.GZHAccessTokenService;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.jasypt.encryption.StringEncryptor; import org.jasypt.encryption.StringEncryptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -80,6 +80,17 @@ public class TestController {
private GZHAccessTokenService gzhAccessTokenService; private GZHAccessTokenService gzhAccessTokenService;
@Resource @Resource
private StringEncryptor stringEncryptor; private StringEncryptor stringEncryptor;
@Autowired
List<DingCallBackExchangeProcessor> dingCallBackExchangeProcessorList;
/**
* 清洗加班
*/
@GetMapping("/dk")
public AjaxResult dk(@RequestBody JSONObject jsonObject) throws ParseException {
SpringUtils.getBean(DingCallBackCheckRecordExchangeProcessor.class).exchange(jsonObject);
return AjaxResult.success("");
}
/** /**
* 清洗加班 * 清洗加班
@ -539,54 +550,179 @@ public class TestController {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String str = "郝卫明,7410" + String str = "132331198104302969,5" +
";郝亮,1313" + ";13013219980404003X,5" +
";柳晓龙,1575" + ";13013219980911005X,5" +
";王旭,800" + ";130132198208112864,5" +
";张克龙,1560" + ";130123200301063335,10" +
";贾会涛,800" + ";130124198901012722,5" +
";李凯伟,2658" + ";130132200506291936,5" +
";石泽明,600" + ";130823200510275017,10" +
";马明广,514" + ";130124200409112713,5" +
";宋金娜,1085" + ";132332197909035249,5" +
";吴海庆,300" + ";132330197211121556,10" +
";冯翠莎,300" + ";132331197809282537,5" +
";赵科飞,1000" + ";132223196903210011,10" +
";李进江,299" + ";130425200503282017,10" +
";李佳铭,1190" + ";130132198312085341,5" +
";耿利刚,800" + ";132331197907081018,5" +
";张雨轩,500" + ";130132198808171948,5" +
";李永文,1046" + ";130132198510223266,5" +
";代程翼,1000" + ";130132199112222860,5" +
";李晓亮,1200" + ";130132199402281930,5" +
";李兴酉,922" + ";132331197405072250,5" +
";王晓凡,975" + ";130427200507260010,10" +
";董献召,300" + ";130633200510046072,10" +
";王晓军,800" + ";132331196902122373,5" +
";苏冰,2424" + ";13233119650311435X,5" +
";吴建彬,300" + ";130627200502080011,10" +
";赵兰争,1000" + ";132331197009041014,5" +
";齐乐芳,600" + ";132331196705281797,5" +
";魏佳蕊,600" + ";130132198206102865,5" +
";范会雨,500" + ";130129200303021014,10" +
";康坤兰,600" + ";130124199010212418,5" +
";牛立革,1059" + ";130124198705142415,5" +
";付佳兴,320" + ";13013219940118379X,5" +
";王春炜,342" + ";130132200210022913,5" +
";游梦浩,336" + ";130132198512242866,5" +
";魏辰强,875" + ";130132199712312878,5" +
";吴凯亮,500" + ";130185200104092515,10" +
";董亚军,134" + ";132331198106272847,5" +
";王怀志,1000" + ";130124199111162464,5" +
";张广适,60" + ";130127198304171820,5" +
";赵雄飞,810" + ";130132198712262861,5" +
";宁世汉,270" + ";130981200705293871,10" +
";张会杰,600"; ";13233119800512284X,5" +
";130132198608021945,5" +
";130521200510130011,10" +
";130132198208172840,5" +
";140622198704165224,5" +
";130132198808183201,5" +
";130132198405163177,5" +
";132331197906192867,5" +
";130132198212181942,5" +
";13012419821023246X,5" +
";130124198811222427,5" +
";130132198510203193,5" +
";452226198606061307,5" +
";132331197511112527,5" +
";132331197609181563,5" +
";130124197108282423,5" +
";132331196810232882,5" +
";130124200110161211,5" +
";130132199105122861,5" +
";13013219820321284X,5" +
";130132199908050013,5" +
";13233119810823254X,5" +
";130124198805202411,5" +
";130132199905060056,5" +
";130132199510162875,5" +
";13013219951103287X,5" +
";131124200504142313,10" +
";130132199010252946,5" +
";130532198612091526,5" +
";130132200009262878,5" +
";130132198612102887,5" +
";130132198709151968,5" +
";130132198806101970,5" +
";130981200505054817,10" +
";130130200501311536,10" +
";130185199906282518,10" +
";130525198809185717,5" +
";131122200312200010,10" +
";13013219890818288X,5" +
";130124198511212438,5" +
";130823200405243013,10" +
";130726200303022213,10" +
";130582200301013612,10" +
";130429200008068019,10" +
";131122200312282431,10" +
";131122200405010216,10" +
";130132200112192871,5" +
";131122200310071219,10" +
";13013319910307097X,5" +
";130726200203256135,10" +
";130928200104025810,10" +
";130132198811222865,5" +
";130133197912031517,5" +
";130125198908120079,10" +
";130105196807301212,5" +
";130121198909172019,10" +
";130132199001114410,10" +
";130132198903171946,5" +
";130127199209191836,5" +
";130127200308081814,10" +
";372925198703276715,5" +
";130133200012160019,10" +
";130132199004162880,5" +
";130221200411236818,10" +
";130121199811122819,10" +
";130132198407011943,5" +
";13053219860424502x,5" +
";130132199203183190,5" +
";130124197508072417,5" +
";130108197903081217,5" +
";13013219990920001X,5" +
";130132200110210052,5" +
";13012419991024241X,5" +
";130132200107220057,5" +
";130131199202104239,5" +
";130132198506023173,5" +
";130132199007270035,5" +
";130124198904062506,5" +
";130123197905264213,10" +
";130124198407082434,5" +
";130132199505170010,5" +
";130132199512053218,5" +
";130132200309122893,5" +
";130124198603142465,5" +
";130133199002271510,10" +
";130402200201102426,5" +
";130132198701021966,5" +
";130132200312111634,5" +
";130132198908221949,5" +
";431124198612294526,5" +
";130102197209081550,5" +
";130132198610153189,5" +
";130185199207201360,5" +
";130528199209261812,5" +
";130124198512260079,5" +
";130132200008303199,5" +
";130124198910152516,5" +
";132331197312081393,5" +
";130124198612102414,5" +
";130132199210280052,5" +
";130132198304112987,5" +
";130132198404092864,5" +
";132331198108151512,5" +
";130123198207213915,5" +
";130124198808040016,5" +
";130132198301262875,5" +
";130132198603141948,5" +
";130132198701102934,5" +
";130124199504182415,5" +
";132331197903162849,5" +
";132332197812100016,5" +
";130132198812093268,5" +
";130132199106160026,5" +
";130133198208150920,5" +
";13012319720704001X,5" +
";130132198311182860,5" +
";130132199412151937,5" +
";130132198706282903,5" +
";130132199808132871,5" +
";130132199010252903,5" +
";610330197811233028,5" +
";130123196005286930,5";
String[] aa = str.split(";"); String[] aa = str.split(";");
for (int i = 0; i < aa.length; i++) { for (int i = 0; i < aa.length; i++) {
String a = aa[i].trim(); String a = aa[i].trim();
String[] ss = a.split(","); String[] ss = a.split(",");
System.out.println("update sys_staff_detail ssd left join sys_staff ss on ss.user_id = ssd.staff_id set ssd.other_subsidies = ifnull(ssd.other_subsidies, 0)+"+ss[1]+" where ss.name = '"+ss[0]+"';"); //System.out.println("update sys_staff s set s.dept_id = (select dept_id from sys_dept where dept_name = '"+ss[2]+"') where s.name='"+ss[0]+"' and s.id_card = '"+ss[1]+"';");
//System.out.println("update rz_attendance_statistical ras left join sys_staff s on s.user_id = ras.staff_id set ras.dept_id = (select dept_id from sys_dept where dept_name = '"+ss[2]+"') where DATE_FORMAT(ras.month,'%Y-%m') = DATE_FORMAT('2026-07-01','%Y-%m') AND s.name='"+ss[0]+"' and s.id_card = '"+ss[1]+"';");
//System.out.println("update rz_restaurant_statistics ras left join sys_staff s on s.user_id = ras.staff_id set ras.dept_id = (select dept_id from sys_dept where dept_name = '"+ss[2]+"') where DATE_FORMAT(ras.month,'%Y-%m') = DATE_FORMAT('2026-07-01','%Y-%m') AND s.name='"+ss[0]+"' and s.id_card = '"+ss[1]+"';");
//System.out.println("update rz_leave l left join sys_staff s on s.user_id = l.user_id set l.dept_id = (select dept_id from sys_dept where dept_name = '"+ss[2]+"') where s.name='"+ss[0]+"' and s.id_card = '"+ss[1]+"';");
System.out.println("update sys_staff_detail ssd left join sys_staff ss on ss.user_id = ssd.staff_id set ssd.daily_wage = ssd.daily_wage-"+ss[1]+" where ss.id_card = '"+ss[0]+"';");
} }
// BufferedReader reader = new BufferedReader(new FileReader(new File("D:\\andy\\文档\\考勤\\岗位任职部门信息.txt"))); // BufferedReader reader = new BufferedReader(new FileReader(new File("D:\\andy\\文档\\考勤\\岗位任职部门信息.txt")));
// String line = reader.readLine(); // String line = reader.readLine();

View File

@ -7,6 +7,7 @@ import com.evo.common.utils.Collections;
import com.evo.common.utils.DataUtils; import com.evo.common.utils.DataUtils;
import com.evo.common.utils.ParamUtils; import com.evo.common.utils.ParamUtils;
import com.evo.common.utils.SecurityUtils; import com.evo.common.utils.SecurityUtils;
import com.evo.common.utils.bean.BeanUtils;
import com.evo.common.utils.poi.handler.ExcelNewUtils; import com.evo.common.utils.poi.handler.ExcelNewUtils;
import com.evo.personnelMatters.domain.RzMealExpenses; import com.evo.personnelMatters.domain.RzMealExpenses;
import com.evo.personnelMatters.domain.vo.MealExpensesExportVo; import com.evo.personnelMatters.domain.vo.MealExpensesExportVo;
@ -58,6 +59,11 @@ public class RzMealExpensesServiceImpl extends ServiceImpl<RzMealExpensesMapper,
if(Collections.isEmpty(list)){ if(Collections.isEmpty(list)){
return new MealExpensesExportVo(BigDecimal.ZERO.intValue(), BigDecimal.ZERO.toString(), BigDecimal.ZERO); return new MealExpensesExportVo(BigDecimal.ZERO.intValue(), BigDecimal.ZERO.toString(), BigDecimal.ZERO);
} }
if(list.size() == 1){
MealExpensesExportVo result = new MealExpensesExportVo();
BeanUtils.copyProperties(list.get(0), result);
return result;
}
MealExpensesExportVo result = list.stream().reduce((x, y) -> new MealExpensesExportVo( MealExpensesExportVo result = list.stream().reduce((x, y) -> new MealExpensesExportVo(
new BigDecimal(x.getFaceScanNum()).add(new BigDecimal(y.getFaceScanNum())).intValue(), new BigDecimal(x.getFaceScanNum()).add(new BigDecimal(y.getFaceScanNum())).intValue(),
new BigDecimal(x.getMealVoucherNum()).add(new BigDecimal(y.getMealVoucherNum())).toString(),(x.getTotalAmount().add(y.getTotalAmount())))).orElse(new MealExpensesExportVo(BigDecimal.ZERO.intValue(), BigDecimal.ZERO.toString(), BigDecimal.ZERO)); new BigDecimal(x.getMealVoucherNum()).add(new BigDecimal(y.getMealVoucherNum())).toString(),(x.getTotalAmount().add(y.getTotalAmount())))).orElse(new MealExpensesExportVo(BigDecimal.ZERO.intValue(), BigDecimal.ZERO.toString(), BigDecimal.ZERO));

View File

@ -174,7 +174,11 @@ public class RzRestaurantStatisticsServiceImpl extends ServiceImpl<RzRestaurantS
public List<RzRestaurantStatisticsExportVo> buildExportData(RzRestaurantStatistics rzRestaurantStatistics){ public List<RzRestaurantStatisticsExportVo> buildExportData(RzRestaurantStatistics rzRestaurantStatistics){
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()); List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>());
Map<Long, String> deptNameMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName)); //Map<Long, String> deptNameMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName));
Map<Long, String> deptNameMap = Collections.emptyMap(); //deptList.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName));
for (SysDept dept : deptList) {
deptNameMap.put(dept.getDeptId(), buildDept(dept.getDeptId(), deptList, deptNameMap));
}
Map<String, String> nameAndDeptIdMap = deptList.stream().filter(d -> d.getParentId().equals(0l)).collect(Collectors.toMap(d->String.valueOf(d.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(); Map<Long, String> companyNameMap = Collections.emptyMap();
deptList.stream().filter(d -> !d.getParentId().equals(0l)).forEach(d ->{ deptList.stream().filter(d -> !d.getParentId().equals(0l)).forEach(d ->{
@ -213,6 +217,21 @@ public class RzRestaurantStatisticsServiceImpl extends ServiceImpl<RzRestaurantS
return voResult; return voResult;
} }
public String buildDept(Long deptId, List<SysDept> deptList, Map<Long,String> showDeptNameMap){
if(showDeptNameMap.containsKey(deptList)){
return showDeptNameMap.get(deptId);
}
SysDept sysDept = deptList.stream().filter(d -> d.getDeptId().equals(deptId)).findFirst().orElse(null);
if(sysDept != null){
if("1".equals(sysDept.getIsShowFinancial())){
return sysDept.getDeptName();
}else{
return buildDept(sysDept.getParentId(), deptList, showDeptNameMap);
}
}
return null;
}
@Override @Override
public AjaxResult export(RzRestaurantStatistics rzRestaurantStatistics) { public AjaxResult export(RzRestaurantStatistics rzRestaurantStatistics) {
ExcelUtilCy<RzRestaurantStatisticsExportVo> util = new ExcelUtilCy<RzRestaurantStatisticsExportVo>(RzRestaurantStatisticsExportVo.class); ExcelUtilCy<RzRestaurantStatisticsExportVo> util = new ExcelUtilCy<RzRestaurantStatisticsExportVo>(RzRestaurantStatisticsExportVo.class);

View File

@ -96,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT SELECT
count(rd.id) as faceScanNum, count(rd.id) as faceScanNum,
rd.sign as productName, rd.sign as productName,
if(dd.dict_label is null or dd.dict_label='外包',"河北伊特",dd.dict_label)as companyName, if(dd.dict_label is null or dd.dict_label='外包' or dd.dict_label='伊特劳务外包',"河北伊特",dd.dict_label)as companyName,
ddr.dict_value as unitPrice ddr.dict_value as unitPrice
from rz_restaurant_detail rd from rz_restaurant_detail rd
left join sys_staff s on s.user_id = rd.staff_id left join sys_staff s on s.user_id = rd.staff_id