1, 工资表导出调整

2. 餐饮管理增加维护及数据导入
3. 考勤新增连续3天未打卡通知人资办和负责人
4. 新增餐厅费用模块
5. 打开记录新增打卡人员照片数据
This commit is contained in:
andy 2025-12-09 11:37:45 +08:00
parent 8b1f2171cf
commit a2c63d09f1
17 changed files with 144 additions and 32 deletions

View File

@ -5,6 +5,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
@RestController
@ -55,7 +56,7 @@ public class PunchTheClockController {
* String sn,String userId,String userName,String userType,String cardNumber,String recog_type,String recog_time,String photo,String body_temperature,String confidence,String button
*/
@RequestMapping("/record/face")
public String face(@RequestBody String json){
public String face(@RequestBody String json) throws UnsupportedEncodingException {
return punchTheClockService.recordFace(json);
}

View File

@ -51,6 +51,8 @@ public class RzAttendanceDetail extends BaseEntity
/** 周六标识 */
private String remark;
private String photo;
/** 删除标记 */
private String delFlag;
@Override

View File

@ -17,6 +17,8 @@ public class RzAttendanceDetailTimeLineVO {
String content;
String photo;
String timestamp;
String type;
@ -25,8 +27,9 @@ public class RzAttendanceDetailTimeLineVO {
String size = "large";
public RzAttendanceDetailTimeLineVO(String content, String timestamp, String delFlag) {
public RzAttendanceDetailTimeLineVO(String content, String photo, String timestamp, String delFlag) {
this.content = content;
this.photo = photo;
this.timestamp = timestamp;
TimeLineEnum timeLine = TimeLineEnum.get(content, delFlag);
this.type = timeLine.type;

View File

@ -51,7 +51,7 @@ public interface PunchTheClockStrategyExchangeProcessor {
* @param rules
* @return
*/
String exchangeFace(String userId, String sn, Date date, String button, String rules);
String exchangeFace(String userId, String sn, Date date, String button, String rules, String photo);
default String checkStaff(SysStaff sysStaff, String sn){
if(sysStaff == null){

View File

@ -113,7 +113,7 @@ public class KQDeviceExchangeProcessor implements PunchTheClockStrategyExchangeP
}
@Override
public String exchangeFace(String userId, String sn, Date date, String button, String rules) {
public String exchangeFace(String userId, String sn, Date date, String button, String rules, String photo) {
//根据ID查询员工信息 ,判断员工是否存在不存在返回失败
SysStaff sysStaff = sysStaffMapper.selectSysStaffByUserId(Long.valueOf(userId));//打卡记录信息
log.info("日常-打卡信息如下: 员工姓名:{}, 打卡时间:{}. 打卡设备:{}, 打卡情况: {}",sysStaff.getName(), sdfd.format(date), sn, rules);
@ -160,7 +160,7 @@ public class KQDeviceExchangeProcessor implements PunchTheClockStrategyExchangeP
// attendanceDetail.setEquipmentCode(sn);
// attendanceDetail.setCreateTime(new Date());
//获取员工的工作时长
RzAttendanceDetail attendanceDetail = rzAttendanceDetailService.addDetail(attendance, rules, sn, date, "");
RzAttendanceDetail attendanceDetail = rzAttendanceDetailService.addDetail(attendance, rules, sn, date, "", photo);
if(attendanceDetail.getId() == null){
return initMessage(1, "打卡失败");
}

View File

@ -82,7 +82,7 @@ public class TSDeviceExchangeProcessor implements PunchTheClockStrategyExchangeP
}
@Override
public String exchangeFace(String userId, String sn, Date date, String button, String rules) {
public String exchangeFace(String userId, String sn, Date date, String button, String rules, String photo) {
if(!ParamUtils.checkTsDeviceButton(sn, rules)){
return initMessage(1, "无效打卡");
}

View File

@ -1,5 +1,7 @@
package com.evo.attendance.service;
import java.io.UnsupportedEncodingException;
public interface PunchTheClockService {
/**
@ -9,6 +11,6 @@ public interface PunchTheClockService {
/**
* 用户点击打卡按钮后请求的接口
*/
public String recordFace(String json);
public String recordFace(String json) throws UnsupportedEncodingException;
}

View File

@ -21,9 +21,9 @@ import java.util.List;
*/
public interface RzAttendanceDetailService extends IService<RzAttendanceDetail> {
public RzAttendanceDetail addDetail(RzAttendance attendance, String rules, String sn, Date date, String remark);
public RzAttendanceDetail addDetail(RzAttendance attendance, String rules, String sn, Date date, String remark, String photo);
public RzAttendanceDetail addOrUpdateDetail(String source, RzAttendance attendance, String rules, String sn, Date date, String remark);
public RzAttendanceDetail addOrUpdateDetail(String source, RzAttendance attendance, String rules, String sn, Date date, String remark, String photo);
public RzAttendanceDetail selectLastRzAttendanceDetail(Long staffId);

View File

@ -16,6 +16,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@ -197,10 +199,11 @@ public class PunchTheClockServiceImpl implements PunchTheClockService {
*/
@Override
@Transactional
public String recordFace(String json){
public String recordFace(String json) throws UnsupportedEncodingException {
//解析收到的数据
JSONObject jsonObject = JSONObject.parseObject(json);
log.info("获取打卡信息{}", jsonObject.toString());
String photo = java.net.URLDecoder.decode(jsonObject.getString("photo"), StandardCharsets.UTF_8.name()).replaceAll("\n","");
String userId = jsonObject.getString("user_id");
String sn = jsonObject.getString("sn");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -222,7 +225,7 @@ public class PunchTheClockServiceImpl implements PunchTheClockService {
Map<String, PunchTheClockStrategyExchangeProcessor> mqttRequestExchangeProcessorMap = applicationContext.getBeansOfType(PunchTheClockStrategyExchangeProcessor.class);
for (PunchTheClockStrategyExchangeProcessor processor : mqttRequestExchangeProcessorMap.values()) {
if(processor.accept(sn)){
return processor.exchangeFace(userId, sn, date, button, rules);
return processor.exchangeFace(userId, sn, date, button, rules, photo);
}
}
return initMessage(1,"打卡失败");

View File

@ -57,12 +57,12 @@ public class RzAttendanceDetailServiceImpl extends ServiceImpl<RzAttendanceDetai
private SysStaffMapper sysStaffMapper;
@Override
public RzAttendanceDetail addDetail(RzAttendance attendance, String rules, String sn, Date date, String remark) {
return addOrUpdateDetail("clock_in", attendance,rules,sn,date,remark);
public RzAttendanceDetail addDetail(RzAttendance attendance, String rules, String sn, Date date, String remark, String photo) {
return addOrUpdateDetail("clock_in", attendance,rules,sn,date,remark, photo);
}
@Override
public RzAttendanceDetail addOrUpdateDetail(String source, RzAttendance attendance, String rules, String sn, Date date, String remark) {
public RzAttendanceDetail addOrUpdateDetail(String source, RzAttendance attendance, String rules, String sn, Date date, String remark, String photo) {
RzAttendanceDetail attendanceDetail = null;
//clock_in为考勤机打卡, 不需要查询
if(!"clock_in".equals(source)){
@ -93,6 +93,9 @@ public class RzAttendanceDetailServiceImpl extends ServiceImpl<RzAttendanceDetai
attendanceDetail.setEquipmentCode(sn);
attendanceDetail.setCreateTime(new Date());
attendanceDetail.setRemark(remark);
if(StringUtils.isNotEmpty(photo)){
attendanceDetail.setPhoto(photo);
}
if(attendanceDetail.getId() == null){
save(attendanceDetail);
}else{
@ -119,7 +122,7 @@ public class RzAttendanceDetailServiceImpl extends ServiceImpl<RzAttendanceDetai
@Override
public List<RzAttendanceDetailTimeLineVO> selectListByAttendanceId(Long attId) {
return list(new LambdaQueryWrapper<RzAttendanceDetail>().eq(RzAttendanceDetail::getAttendanceId, attId)).stream().map(data ->{
return new RzAttendanceDetailTimeLineVO(data.getButtonType(), DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",data.getDateTime()), data.getDelFlag());
return new RzAttendanceDetailTimeLineVO(data.getButtonType(), data.getPhoto(), DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",data.getDateTime()), data.getDelFlag());
}).collect(Collectors.toList());
}

View File

@ -105,14 +105,14 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
if(rzAttendance.getWorkEndTime() == null){
//跟新成功, 插入上班卡信息
if(getBaseMapper().updateRzAttendance(rzAttendance) > 0){
rzAttendanceDetailService.addOrUpdateDetail("fill_in", rzAttendance, rzAttendance.getRules(), sysUser.getTimeClockList().get(0), rzAttendance.getWorkStartTime(),rzAttendance.getRemark());
rzAttendanceDetailService.addOrUpdateDetail("fill_in", rzAttendance, rzAttendance.getRules(), sysUser.getTimeClockList().get(0), rzAttendance.getWorkStartTime(),rzAttendance.getRemark(), null);
}
return 1;
}else if(rzAttendance.getWorkStartTime() != null && rzAttendance.getWorkEndTime() != null){
rzAttendanceDetailService.addOrUpdateDetail("fill_in",rzAttendance, rzAttendance.getRules(), sysUser.getTimeClockList().get(0), rzAttendance.getWorkStartTime(),rzAttendance.getRemark());
rzAttendanceDetailService.addOrUpdateDetail("fill_in",rzAttendance, rzAttendance.getRules(), sysUser.getTimeClockList().get(0), rzAttendance.getWorkStartTime(),rzAttendance.getRemark(), null);
if(KqUtils.workOffDutyCard(rzAttendance.getWorkEndTime(), rzAttendance.getRules(), rzAttendance)){
//此处特殊, 使用rules 记录下班卡规则, 但是不持久化
rzAttendanceDetailService.addOrUpdateDetail("fill_in",rzAttendance, "下班卡", sysUser.getTimeClockList().get(0), rzAttendance.getWorkEndTime(),rzAttendance.getRemark());
rzAttendanceDetailService.addOrUpdateDetail("fill_in",rzAttendance, "下班卡", sysUser.getTimeClockList().get(0), rzAttendance.getWorkEndTime(),rzAttendance.getRemark(), null);
}
return 1;
}

View File

@ -97,7 +97,7 @@ public class RzMealExpensesServiceImpl extends ServiceImpl<RzMealExpensesMapper,
total1 = total1.add(new BigDecimal(mealExpenses.getHospitalityFee())).setScale(2, BigDecimal.ROUND_HALF_UP);
dataList.add(new MealExpensesExportVo("福利费", new BigDecimal(mealExpenses.getOvertimeBenefits()).setScale(2, BigDecimal.ROUND_HALF_UP)));
total1.add(new BigDecimal(mealExpenses.getOvertimeBenefits())).setScale(2, BigDecimal.ROUND_HALF_UP);
total1 = total1.add(new BigDecimal(mealExpenses.getOvertimeBenefits())).setScale(2, BigDecimal.ROUND_HALF_UP);
dataList.add(new MealExpensesExportVo("水费", new BigDecimal(mealExpenses.getWaterFee()).setScale(2, BigDecimal.ROUND_HALF_UP)));
total1 = total1.subtract(new BigDecimal(mealExpenses.getWaterFee())).setScale(2, BigDecimal.ROUND_HALF_UP);
@ -106,8 +106,7 @@ public class RzMealExpensesServiceImpl extends ServiceImpl<RzMealExpensesMapper,
total1 = total1.subtract(new BigDecimal(mealExpenses.getElectricityFee()).setScale(2, BigDecimal.ROUND_HALF_UP));
dataList.add(new MealExpensesExportVo("合计", total1));
indexDataList.add(new MealExpensesExportVo(sheetCompanyName+rzMealExpenses.getYearMonthTime()+"月餐费结算清单", new BigDecimal(mealExpenses.getElectricityFee()).setScale(2, BigDecimal.ROUND_HALF_UP)));
indexDataList.add(new MealExpensesExportVo(sheetCompanyName+rzMealExpenses.getYearMonthTime()+"月餐费结算清单", total1));
}else{
indexDataList.add(new MealExpensesExportVo(sheetCompanyName+rzMealExpenses.getYearMonthTime()+"月餐费结算清单", total.getTotalAmount().setScale(2, BigDecimal.ROUND_HALF_UP)));
}

View File

@ -1,25 +1,33 @@
package com.evo.restaurant.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.evo.common.annotation.Log;
import com.evo.common.constant.Constants;
import com.evo.common.core.controller.BaseController;
import com.evo.common.core.domain.AjaxResult;
import com.evo.common.core.domain.entity.SysUser;
import com.evo.common.core.page.TableDataInfo;
import com.evo.common.enums.BusinessType;
import com.evo.common.utils.DateUtils;
import com.evo.common.utils.SecurityUtils;
import com.evo.common.utils.StringUtils;
import com.evo.common.utils.poi.ExcelUtil;
import com.evo.restaurant.domain.RzRestaurantDetail;
import com.evo.restaurant.service.IRzRestaurantDetailService;
import com.evo.system.domain.SysStaff;
import com.evo.system.domain.SysStaffDetail;
import com.evo.system.service.ISysStaffService;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.List;
@ -121,4 +129,86 @@ public class RzRestaurantDetailController extends BaseController
}
}
/**
* 上传五险一金信息文件
*/
@PreAuthorize("@ss.hasPermi('api:v2:import')")
@PostMapping("/import")
public AjaxResult uploadAccumulationFund(@RequestParam("file") MultipartFile filePath) {
String originalFilename = filePath.getOriginalFilename();
//校验文件后缀
String postfix = originalFilename.substring(originalFilename.length() - 3);
String substring = originalFilename.substring(originalFilename.length() - 4);
//判断是否是xlsx文件或xls文件
if ("xls".equals(postfix) || "xlsx".equals(substring)) {
try {
return writeStaffInformation(filePath.getInputStream());
} catch (IOException e) {
return AjaxResult.error(e.getMessage());
}
}
return AjaxResult.error();
}
private AjaxResult writeStaffInformation(InputStream is){
//在指定位置读取文件
Workbook wb = null;
StringBuilder sb = new StringBuilder("");
try {
wb = WorkbookFactory.create(is);
Sheet sheet = wb.getSheetAt(0);
//得到行数
int rowNumbers = sheet.getLastRowNum();
SysStaffDetail staffDetail = null;
//存储缴纳公积金人员信息
for(int p=1;p<= rowNumbers;p++){
Row row = sheet.getRow(p);
if(StringUtils.isEmpty(row.getCell(0).getStringCellValue()) && (sheet.getRow(p+1)==null || StringUtils.isEmpty(sheet.getRow(p+1).getCell(0).getStringCellValue()))){
//当前行, 和当前的下一行都没有员工姓名,. 默认执行结束了
break;
}
//身份证号为空处理下一条数据
if(row.getCell(1) == null || StringUtils.isEmpty(row.getCell(1).getStringCellValue())){
sb.append(row.getCell(0).getStringCellValue()).append("没有身份证信息;");
continue;
}
if(row.getCell(2) == null || row.getCell(2).getDateCellValue() == null){
sb.append(row.getCell(0).getStringCellValue()).append("没有就餐日志;");
continue;
}
if(row.getCell(3) == null || StringUtils.isEmpty(row.getCell(3).getStringCellValue())){
sb.append(row.getCell(0).getStringCellValue()).append("没有就餐类型;");
continue;
}
SysStaff sysStaff = sysStaffService.queryStaffByIdCard(row.getCell(1).getStringCellValue());
if(sysStaff != null){
RzRestaurantDetail rzRestaurantDetail = new RzRestaurantDetail();
rzRestaurantDetail.setStaffId(sysStaff.getUserId());
rzRestaurantDetail.setName(sysStaff.getName());
rzRestaurantDetail.setDate(row.getCell(2).getDateCellValue());
rzRestaurantDetail.setSign(row.getCell(3).getStringCellValue());
rzRestaurantDetail.setTime(getTime(rzRestaurantDetail));
rzRestaurantDetail.setDelFlag(Constants.DELETE_FLAG_0);
rzRestaurantDetailService.saveRzRestaurantDetail(rzRestaurantDetail);
}
}
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error(e.getMessage());
}finally {
try{
if(wb != null){
wb.close();
}
}catch (Exception e){
e.printStackTrace();
}
}
if(StringUtils.isNotEmpty(sb.toString())){
return AjaxResult.error(sb.toString());
}
return AjaxResult.success();
}
}

View File

@ -98,6 +98,8 @@ public interface ISysStaffService extends IService<SysStaff>
public SysStaff selectSysStaffByName(String employeeName);
SysStaff queryStaffByIdCard(String idCard);
SysStaff selectByDepId(Long deptId);
AjaxResult importSalesCommissions(List<RzSalaryVo> attendanceList);

View File

@ -745,6 +745,11 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
return getBaseMapper().selectOne(wrapper);
}
@Override
public SysStaff queryStaffByIdCard(String idCard) {
return getBaseMapper().queryysStaffByIdCard(idCard);
}
@Override
public SysStaff selectByDepId(Long deptId) {
LambdaQueryWrapper<SysStaff> wrapper = new LambdaQueryWrapper<>();

View File

@ -19,9 +19,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDetailMapByTime" resultType="java.util.Map">
select
SUM(IF(med.type =3 and med.meal_voucher_type ='早餐', med.num, 0)) AS zc,
SUM(IF(med.type =3 and med.meal_voucher_type ='午餐', med.num, 0)) AS wc,
SUM(IF(med.type =3 and med.meal_voucher_type ='晚餐', med.num, 0)) AS wcc,
SUM(IF(med.type =3 and med.meal_voucher_type ='早餐', med.num, 0)) AS '早餐',
SUM(IF(med.type =3 and med.meal_voucher_type ='午餐', med.num, 0)) AS '午餐',
SUM(IF(med.type =3 and med.meal_voucher_type ='晚餐', med.num, 0)) AS '晚餐',
if(dd.dict_label is null or dd.dict_label='外包',"河北伊特",dd.dict_label)as companyName
from rz_meal_expenses_detail med
left join rz_meal_expenses me on me.id = med.expenses_id

View File

@ -31,12 +31,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="sign != null and sign != ''"> and sign = #{sign}</if>
<if test="date != null">and DATE_FORMAT( date, '%Y%m%d' ) = DATE_FORMAT(#{date} , '%Y%m%d' )</if>
<choose>
<when test="month != null">and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT( #{month} , '%Y%m' )</when>
<otherwise>
and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT( NOW() , '%Y%m' )
</otherwise>
</choose>
<if test="month != null">and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT( #{month} , '%Y%m' )</if>
<!-- <choose>-->
<!-- <when test="month != null">and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT( #{month} , '%Y%m' )</when>-->
<!-- <otherwise>-->
<!-- and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT( NOW() , '%Y%m' )-->
<!-- </otherwise>-->
<!-- </choose>-->
</where>
order by create_time desc
</select>