Merge remote-tracking branch 'origin/main'

This commit is contained in:
方亮 2025-08-16 16:56:58 +08:00
commit 92bea05f0a
14 changed files with 1158 additions and 4 deletions

View File

@ -38,10 +38,12 @@ public class RemoteUakUtilsFallbackFactory implements FallbackFactory<RemoteUakU
}
@Override
public void delDevByProId(int userId, int proId, String source) {
public void delDevByProId(String deviceCode, int proId, String source) {
R.fail("删除考勤机人员:" + throwable.getMessage());
}
@Override
public void delUserByDevice(int userId, int proId, String source) {
R.fail("人员出场:" + throwable.getMessage());

View File

@ -0,0 +1,170 @@
package com.bonus.bmw.controller;
import com.bonus.bmw.domain.dto.*;
import com.bonus.bmw.service.RepairCardApplyService;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @Authorliang.chao
* @Date2025/8/13 - 10:31
*/
@RestController
@RequestMapping("/cardApply")
public class RepairCardApplyController extends BaseController {
@Autowired
private RepairCardApplyService repairCardApplyMapper;
/**
* 工程下拉列表
*
* @param
* @return
*/
@GetMapping("/proList")
public AjaxResult proList() {
try {
List<ProDto> list = repairCardApplyMapper.proList();
return AjaxResult.success(list);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return AjaxResult.error("系统错误");
}
/**
* 人员下拉列表
*
* @param
* @return
*/
@GetMapping("/workPersonList")
public AjaxResult workPersonList(RepairCardApplyDto cardApply) {
try {
List<WorkPersonDto> list = repairCardApplyMapper.workPersonList(cardApply);
return AjaxResult.success(list);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return AjaxResult.error("系统错误");
}
@GetMapping("/list")
@SysLog(title = "补卡申请列表", businessType = OperaType.QUERY, logType = 0, module = "考勤管理-补卡申请", details = "查询补卡申请列表")
public TableDataInfo list(RepairCardApplyDto cardApply) {
try {
startPage();
List<RepairCardApplyDto> list = repairCardApplyMapper.list(cardApply);
return getDataTable(list);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
}
@PostMapping("export")
@SysLog(title = "补卡申请导出", businessType = OperaType.QUERY, logType = 0, module = "考勤管理-补卡申请", details = "导出补卡申请列表")
public void export(HttpServletResponse response, RepairCardApplyDto cardApply) {
List<RepairCardApplyDto> list = repairCardApplyMapper.list(cardApply);
ExcelUtil<RepairCardApplyDto> util = new ExcelUtil<RepairCardApplyDto>(RepairCardApplyDto.class);
util.exportExcel(response, list, "补卡申请数据");
}
/**
* 根据工程id 查询补卡申请清单
*
* @param cardApply
* @return
*/
@GetMapping("/getRepairCardDetails")
public AjaxResult getRepairCardDetails(RepairCardApplyDto cardApply) {
try {
startPage();
List<RepairCardRecordDto> list = repairCardApplyMapper.getRepairCardDetails(cardApply);
return AjaxResult.success(list);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return AjaxResult.error("获取数据失败");
}
/**
* 根据工程id考勤时间查询打卡记录
*
* @param
* @return
*/
@GetMapping("/getCheckRecord")
public AjaxResult getCheckRecord(CheckRecordDto checkRecordDto) {
try {
startPage();
Map<String, CheckRecordDto> map = repairCardApplyMapper.getCheckRecord(checkRecordDto);
return AjaxResult.success(map);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return AjaxResult.error("获取数据失败");
}
/**
* 新增补卡申请
*
* @param cardApplyDto
* @return
*/
@PostMapping("/saverepairCardApply")
public AjaxResult saverepairCardApply(@RequestBody RepairCardApplyDto cardApplyDto) {
AjaxResult ajaxResult = repairCardApplyMapper.saverepairCardApply(cardApplyDto);
return ajaxResult;
}
/**
* 删除补卡申请
*
* @param cardApplyDto
* @return
*/
@PostMapping("/delRepairCardApply")
public AjaxResult delRepairCardApply(@RequestBody RepairCardApplyDto cardApplyDto) {
Integer num = repairCardApplyMapper.delRepairCardApply(cardApplyDto);
AjaxResult ajaxResult = num > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
return ajaxResult;
}
/**
* 审核
*
* @param cardApplyDto
* @return
*/
@PostMapping("/audit")
public AjaxResult audit(@RequestBody RepairCardApplyDto cardApplyDto) {
return repairCardApplyMapper.audit(cardApplyDto);
}
@GetMapping("/cardStatistics")
@SysLog(title = "补卡统计列表", businessType = OperaType.QUERY, logType = 0, module = "考勤管理-补卡申请", details = "查询补卡统计列表")
public TableDataInfo getCardStatistics(RepairCardApplyDto cardApply) {
try {
startPage();
List<CardStatisticsDto> list = repairCardApplyMapper.getCardStatistics(cardApply);
return getDataTable(list);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
}
}

View File

@ -0,0 +1,23 @@
package com.bonus.bmw.domain.dto;
import lombok.Data;
/**
* @Authorliang.chao
* @Date2025/8/14 - 12:00
*/
@Data
public class CardStatisticsDto {
// 工程id
private String proId;
// 工程名称
private String proName;
// 申请补卡次数
private Integer num;
//累计补卡人数
private Integer personNum;
// 累计补卡天数
private Integer days;
// 最新申请时间
private String createTime;
}

View File

@ -0,0 +1,33 @@
package com.bonus.bmw.domain.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
/**
* @Authorliang.chao
* @Date2025/8/13 - 14:11
*/
@Data
@NoArgsConstructor
public class CheckRecordDto {
private Integer proId;
private Integer workerId;
private String startTime;
private String endTime;
// 入场时间
private LocalDateTime einTime;
// 出场时间
private LocalDateTime exitTime;
// 班组名称
private String teamName;
private Integer isActive;
private boolean isInRange;
public CheckRecordDto(LocalDateTime einTime, LocalDateTime exitTime, String teamName) {
this.einTime = einTime;
this.exitTime = exitTime;
this.teamName = teamName;
}
}

View File

@ -0,0 +1,117 @@
package com.bonus.bmw.domain.dto;
import lombok.Data;
import java.util.Date;
/**
* @Authorliang.chao
* @Date2025/8/13 - 10:54
*/
@Data
public class ProDto {
/**
* 编号
*/
private Integer id;
/**
* 工程名称
*/
private String proName;
/**
* 总包工程id
*/
private Integer mainProId;
/**
* 总公司id
*/
private Integer comId;
/**
* 分公司id
*/
private Integer subComId;
/**
* 项目部id
*/
private Integer orgId;
/**
* 工程简称
*/
private String simpleName;
/**
* 工程类型 字典表
*/
private String proType;
/**
* 电压等级 字典表选但直接存值
*/
private String volLevel;
/**
* 是否上海项目 1 0 不是
*/
private Integer isShanghai;
/**
* 工程状态 字典表选但直接存值
*/
private String proStatus;
/**
* 工程地址
*/
private String proAddress;
/**
* 计划开始时间
*/
private Date startTime;
/**
* 计划竣工时间
*/
private Date endTime;
/**
* 经度
*/
private String lon;
/**
* 纬度
*/
private String lat;
/**
* 创建人
*/
private String createUser;
/**
* 修改人
*/
private String updateUser;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 是否有效
*/
private Integer isActive;
}

View File

@ -0,0 +1,120 @@
package com.bonus.bmw.domain.dto;
import com.bonus.common.core.annotation.Excel;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @Authorliang.chao
* @Date2025/8/13 - 10:34
*/
@Data
public class RepairCardApplyDto {
/**
* 编号
*/
private Integer id;
/**
* 工程id
*/
private Integer proId;
/**
* 工程名称
*/
@Excel(name = "工程名称")
private Integer proName;
/**
* 补卡人员数
*/
@Excel(name = "补卡人数")
private Integer repairNum;
/**
* 补卡天数
*/
@Excel(name = "补卡天数")
private Integer repairDay;
/**
* 驳回意见
*/
private Integer refuseRemark;
/**
* 补卡备注
*/
@Excel(name = "补卡说明")
private String repairRemark;
/**
* 补卡文件多个分号隔开
*/
private String repairFile;
/**
* 补卡月份 默认上一个月yyyy-MM
*/
private String repairMonth;
/**
* 申请人
*/
@Excel(name = "申请人")
private String applyUser;
/**
* 申请时间
*/
@Excel(name = "申请时间")
private Date applyTime;
/**
* 0 待审核 1 审核通过 2 审核不通过
*/
private Integer checkStatus;
@Excel(name = "审核状态")
private String checkStatusName;
/**
* 审核人
*/
@Excel(name = "审核人")
private String checkUser;
/**
* 审核时间
*/
@Excel(name = "审核时间")
private Date checkTime;
/**
* 创建人
*/
private String createUser;
/**
* 修改人
*/
private String updateUser;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 是否有效
*/
private Integer isActive;
private List<RepairCardRecordDto> repairCardRecords;
}

View File

@ -0,0 +1,108 @@
package com.bonus.bmw.domain.dto;
import lombok.Data;
import java.util.Date;
/**
* @Authorliang.chao
* @Date2025/8/13 - 11:16
*/
@Data
public class RepairCardRecordDto {
/**
* 补卡申请id
*/
private Integer applyId;
/**
* 施工人员id
*/
private Integer workerId;
/**
* 身份证
*/
private String idNumber;
/**
* 补卡备注
*/
private String repairRemark;
/**
* 补卡文件
*/
private String repairFile;
/**
* 姓名
*/
private String name;
/**
* 电话
*/
private String phone;
/**
* 工程id
*/
private Integer proId;
/**
* 工程名称
*/
private String proName;
/**
* 班组id
*/
private Integer teamId;
/**
* 班组名称
*/
private String teamName;
/**
* 分包id
*/
private Integer subId;
/**
* 分包名称
*/
private String subName;
/**
* 天数
*/
private Integer repairDay;
/**
* 补卡日期
*/
private String repairDate;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 是否有效
*/
private Integer isActive;
/**
* 考勤日期
*/
private String attDay;
/**
* 主键编码
*/
private String idCode;
}

View File

@ -0,0 +1,35 @@
package com.bonus.bmw.domain.dto;
import lombok.Data;
import java.util.Date;
/**
* @Authorliang.chao
* @Date2025/8/13 - 10:54
*/
@Data
public class WorkPersonDto {
/**
* 编号
*/
private Integer id;
/**
* 姓名
*/
private String name;
/**
* 打卡日期
*/
private String attDay;
/**
* 电话
*/
private String phone;
/**
* 身份证
*/
private String idNumber;
}

View File

@ -0,0 +1,44 @@
package com.bonus.bmw.mapper;
import com.bonus.bmw.domain.dto.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface RepairCardApplyMapper {
List<RepairCardApplyDto> list(RepairCardApplyDto cardApply);
List<ProDto> proList();
List<RepairCardRecordDto> getRepairCardDetails(RepairCardApplyDto cardApply);
List<CheckRecordDto> getCheckRecord(CheckRecordDto checkRecordDto);
List<String> attPersonRecord(CheckRecordDto checkRecordDto);
List<WorkPersonDto> workPersonList(RepairCardApplyDto cardApply);
Integer saverepairCardApply(RepairCardApplyDto cardApplyDto);
void saverepairCardDetails(@Param("applyId") Integer applyId, @Param("repairCardRecords") List<RepairCardRecordDto> repairCardRecords);
Integer delRepairCardApply(RepairCardApplyDto cardApplyDto);
Integer delRepairCardRecord(RepairCardApplyDto cardApplyDto);
void updaterepairCardApply(RepairCardApplyDto cardApplyDto);
Integer insertAttPerson(RepairCardRecordDto cardApplyDto);
Integer insertAttRecord(RepairCardRecordDto cardApplyDto);
Integer insertRepairCardDate(RepairCardRecordDto cardApplyDto);
List<CardStatisticsDto> getCardStatistics(RepairCardApplyDto cardApply);
List<RepairCardRecordDto> getRepairCardRecordsList(RepairCardApplyDto cardApplyDto);
}

View File

@ -0,0 +1,31 @@
package com.bonus.bmw.service;
import com.bonus.bmw.domain.dto.*;
import com.bonus.common.core.web.domain.AjaxResult;
import java.util.List;
import java.util.Map;
/**
* @Authorliang.chao
* @Date2025/8/13 - 10:32
*/
public interface RepairCardApplyService {
List<RepairCardApplyDto> list(RepairCardApplyDto cardApply);
List<ProDto> proList();
List<RepairCardRecordDto> getRepairCardDetails(RepairCardApplyDto cardApply);
Map<String, CheckRecordDto> getCheckRecord(CheckRecordDto checkRecordDto);
List<WorkPersonDto> workPersonList(RepairCardApplyDto cardApply);
AjaxResult saverepairCardApply(RepairCardApplyDto cardApplyDto);
Integer delRepairCardApply(RepairCardApplyDto cardApplyDto);
AjaxResult audit(RepairCardApplyDto cardApplyDto);
List<CardStatisticsDto> getCardStatistics(RepairCardApplyDto cardApply);
}

View File

@ -4,6 +4,7 @@ import com.bonus.bmw.domain.dto.WebFileDto;
import com.bonus.common.core.constant.SecurityConstants;
import com.bonus.common.core.domain.R;
import com.bonus.system.api.RemoteUploadUtilsService;
import com.bonus.system.api.domain.FileVo;
import com.bonus.system.api.model.UploadFileVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -58,9 +59,9 @@ public class FileUploadUtils {
* @return
*/
public UploadFileVo uploadBast64( String file, String sourceTable, String sourceId, String sourceType, String prefix, String bucketName ){
R<UploadFileVo> re=service.uploadBast64(file,sourceTable,sourceId,sourceType,prefix,bucketName, SecurityConstants.INNER);
FileVo fileVo=new FileVo(file,sourceTable,sourceType,prefix,bucketName,sourceId);
R<UploadFileVo> re=service.uploadBast64(fileVo, SecurityConstants.INNER);
if(re.getCode()==R.SUCCESS){
UploadFileVo vo=re.getData();
return re.getData();
}
return null;

View File

@ -0,0 +1,187 @@
package com.bonus.bmw.service.impl;
import com.bonus.bmw.domain.dto.*;
import com.bonus.bmw.mapper.RepairCardApplyMapper;
import com.bonus.bmw.service.RepairCardApplyService;
import com.bonus.common.core.utils.uuid.UUID;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import org.apache.catalina.security.SecurityUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Authorliang.chao
* @Date2025/8/13 - 10:37
*/
@Service
public class RepairCardApplyServiceImpl implements RepairCardApplyService {
@Resource
private RepairCardApplyMapper repairCardApplyMapper;
@Override
public List<RepairCardApplyDto> list(RepairCardApplyDto cardApply) {
return repairCardApplyMapper.list(cardApply);
}
@Override
public List<ProDto> proList() {
return repairCardApplyMapper.proList();
}
@Override
public List<RepairCardRecordDto> getRepairCardDetails(RepairCardApplyDto cardApply) {
return repairCardApplyMapper.getRepairCardDetails(cardApply);
}
@Override
public Map<String, CheckRecordDto> getCheckRecord(CheckRecordDto checkRecordDto) {
// 使用 DateTimeFormatter 解析字符串为 LocalDate
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate startDate = LocalDate.parse(checkRecordDto.getStartTime(), formatter);
LocalDate endDate = LocalDate.parse(checkRecordDto.getEndTime(), formatter);
// 创建一个列表来存储日期字符串
List<String> dateList = new ArrayList<>();
// 从开始日期开始逐日增加直到结束日期包含
LocalDate currentDate = startDate;
while (!currentDate.isAfter(endDate)) { // isAfter 返回 true 表示 currentDate > endDate所以用 ! 取反
// 将当前日期格式化为字符串并添加到列表
dateList.add(currentDate.format(formatter));
// 日期加一天
currentDate = currentDate.plusDays(1);
}
List<CheckRecordDto> list = repairCardApplyMapper.getCheckRecord(checkRecordDto);
// 构建时间段对列表
List<CheckRecordDto> timeRanges = new ArrayList<>();
LocalDateTime currentEnter = null;
String teamName = null;
for (CheckRecordDto record : list) {
Integer isActive = record.getIsActive();
LocalDateTime einTime = record.getEinTime();
LocalDateTime exitTime = record.getExitTime();
if ((isActive == 0 && exitTime == null) || (isActive == 1 && exitTime == null)) {
// 入场事件
currentEnter = einTime;
teamName = record.getTeamName();
} else if (isActive == 1 && currentEnter != null && einTime != null && exitTime != null) {
// 出场事件且前面有未匹配的入场
// 使用出场记录中的 exit_time fallback ein_time如果 exit_time 为空
LocalDateTime actualExit = exitTime != null ? exitTime : einTime;
timeRanges.add(new CheckRecordDto(currentEnter, actualExit, record.getTeamName()));
currentEnter = null; // 匹配完成清空
}
// 注意如果 is_active=0 但前面没有入场可选择忽略或报错
}
// 如果最后还有未出场的可根据业务决定是否闭合比如用当前时间
if (currentEnter != null) {
timeRanges.add(new CheckRecordDto(currentEnter, LocalDateTime.now(), teamName));
}
HashMap<String, CheckRecordDto> result = new HashMap<>();
// 判断每个 dateList 中的日期是否落在任意一个 timeRange
for (String dateStr : dateList) {
LocalDate targetDate = LocalDate.parse(dateStr, formatter);
boolean isInRange = false;
for (CheckRecordDto range : timeRanges) {
LocalDate enterDate = range.getEinTime().toLocalDate();
LocalDate exitDate = range.getExitTime().toLocalDate();
teamName = range.getTeamName();
// 判断目标日期是否在 [enterDate, exitDate] 范围内包含首尾
if (!targetDate.isBefore(enterDate) && !targetDate.isAfter(exitDate)) {
isInRange = true;
break;
}
}
CheckRecordDto recordDto = new CheckRecordDto();
// 该时间是否入场
recordDto.setInRange(isInRange);
recordDto.setTeamName(teamName);
result.put(dateStr, recordDto);
System.out.printf("日期 %s %s在入场时间段内%n", dateStr, isInRange ? "" : "");
}
// 获取该人员在该工程下的打卡记录
List<String> attPersonRecord = repairCardApplyMapper.attPersonRecord(checkRecordDto);
// 使用 entrySet() 遍历
for (Map.Entry<String, CheckRecordDto> entry : result.entrySet()) {
if (attPersonRecord.contains(entry.getKey())) {
CheckRecordDto value = entry.getValue();
// 已打卡
value.setIsActive(0);
} else {
// 未打卡
CheckRecordDto value = entry.getValue();
value.setIsActive(1);
}
}
return result;
}
@Override
public List<WorkPersonDto> workPersonList(RepairCardApplyDto cardApply) {
return repairCardApplyMapper.workPersonList(cardApply);
}
@Override
public AjaxResult saverepairCardApply(RepairCardApplyDto cardApplyDto) {
cardApplyDto.setApplyUser(SecurityUtils.getUsername());
Integer num = repairCardApplyMapper.saverepairCardApply(cardApplyDto);
if (num > 0) {
repairCardApplyMapper.saverepairCardDetails(cardApplyDto.getId(), cardApplyDto.getRepairCardRecords());
return AjaxResult.success("保存成功");
} else {
return AjaxResult.error("保存失败");
}
}
@Override
public Integer delRepairCardApply(RepairCardApplyDto cardApplyDto) {
Integer i = repairCardApplyMapper.delRepairCardApply(cardApplyDto);
if (i > 0) {
return repairCardApplyMapper.delRepairCardRecord(cardApplyDto);
}
return i;
}
@Override
public AjaxResult audit(RepairCardApplyDto cardApplyDto) {
try {
repairCardApplyMapper.updaterepairCardApply(cardApplyDto);
if (cardApplyDto.getCheckStatus() == 1) {
// 通过
List<RepairCardRecordDto> repairCardRecords = repairCardApplyMapper.getRepairCardRecordsList(cardApplyDto);
for (RepairCardRecordDto repairCardRecord : repairCardRecords) {
for (String s : repairCardRecord.getRepairDate().split(",")) {
// 新增人员打卡记录bm_att_personbm_att_recordbm_repair_card_date
repairCardRecord.setAttDay(s);
// 数据库设为了必填所以这里生成一个随机字符串填充
repairCardRecord.setIdCode(UUID.randomUUID().toString());
repairCardApplyMapper.insertAttPerson(repairCardRecord);
repairCardApplyMapper.insertAttRecord(repairCardRecord);
repairCardApplyMapper.insertRepairCardDate(repairCardRecord);
}
}
}
return AjaxResult.success("审核成功");
} catch (Exception e) {
return AjaxResult.error("审核失败");
}
}
@Override
public List<CardStatisticsDto> getCardStatistics(RepairCardApplyDto cardApply) {
return repairCardApplyMapper.getCardStatistics(cardApply);
}
}

View File

@ -0,0 +1,283 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.bmw.mapper.RepairCardApplyMapper">
<insert id="saverepairCardApply" useGeneratedKeys="true" keyProperty="id">
INSERT INTO bm_repair_card_apply
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="proId != null">pro_id,</if>
<if test="repairNum != null">repair_num,</if>
<if test="repairDay != null">repair_day,</if>
<if test="repairRemark != null">repair_remark,</if>
<if test="repairFile != null">repair_file,</if>
<if test="repairMonth != null">repair_month,</if>
<if test="applyUser != null">apply_user,</if>
<if test="checkStatus != null">check_status,</if>
<if test="checkUser != null">check_user,</if>
<if test="checkTime != null">check_time,</if>
<if test="createUser != null">create_user,</if>
<if test="updateUser != null">update_user,</if>
apply_time
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="proId != null">#{proId,jdbcType=INTEGER},</if>
<if test="repairNum != null">#{repairNum,jdbcType=INTEGER},</if>
<if test="repairDay != null">#{repairDay,jdbcType=INTEGER},</if>
<if test="repairRemark != null">#{repairRemark,jdbcType=VARCHAR},</if>
<if test="repairFile != null">#{repairFile,jdbcType=VARCHAR},</if>
<if test="repairMonth != null">#{repairMonth,jdbcType=VARCHAR},</if>
<if test="applyUser != null">#{applyUser,jdbcType=VARCHAR},</if>
<if test="checkStatus != null">#{checkStatus,jdbcType=INTEGER},</if>
<if test="checkUser != null">#{checkUser,jdbcType=VARCHAR},</if>
<if test="checkTime != null">#{checkTime,jdbcType=TIMESTAMP},</if>
<if test="createUser != null">#{createUser,jdbcType=VARCHAR},</if>
<if test="updateUser != null">#{updateUser,jdbcType=VARCHAR},</if>
sysdate()
</trim>
</insert>
<insert id="saverepairCardDetails">
INSERT INTO bm_repair_card_record (
apply_id,
worker_id,
id_number,
name,
phone,
pro_id,
team_id,
repair_day,
repair_date
)
VALUES
<foreach collection="repairCardRecords" item="record" separator=",">
(
#{applyId,jdbcType=INTEGER},
#{record.workerId,jdbcType=INTEGER},
#{record.idNumber,jdbcType=VARCHAR},
#{record.name,jdbcType=VARCHAR},
#{record.phone,jdbcType=VARCHAR},
#{record.proId,jdbcType=INTEGER},
#{record.teamId,jdbcType=INTEGER},
#{record.repairDay,jdbcType=INTEGER},
#{record.repairDate,jdbcType=VARCHAR}
)
</foreach>
</insert>
<insert id="insertAttPerson">
INSERT INTO bm_att_person
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workerId != null">worker_id,</if>
<if test="idNumber != null">id_number,</if>
<if test="name != null">name,</if>
<if test="proId != null">pro_id,</if>
<if test="proName != null">pro_name,</if>
<if test="teamId != null">team_id,</if>
<if test="teamName != null">team_name,</if>
<if test="subId != null">sub_id,</if>
<if test="subName != null">sub_name,</if>
<if test="attDay != null">att_day,</if>
is_repair,
device_code,
id,
create_time
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workerId != null">#{workerId},</if>
<if test="idNumber != null">#{idNumber},</if>
<if test="name != null">#{name},</if>
<if test="proId != null">#{proId},</if>
<if test="proName != null">#{proName},</if>
<if test="teamId != null">#{teamId},</if>
<if test="teamName != null">#{teamName},</if>
<if test="subId != null">#{subId},</if>
<if test="subName != null">#{subName},</if>
<if test="attDay != null">#{attDay},</if>
1,
'补卡',
#{idCode},
sysdate()
</trim>
</insert>
<insert id="insertAttRecord">
INSERT INTO bm_att_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workerId != null">worker_id,</if>
<if test="idNumber != null">id_number,</if>
<if test="name != null">name,</if>
<if test="proId != null">pro_id,</if>
<if test="proName != null">pro_name,</if>
<if test="teamId != null">team_id,</if>
<if test="teamName != null">team_name,</if>
<if test="subId != null">sub_id,</if>
<if test="subName != null">sub_name,</if>
<if test="attDay != null">att_day,</if>
is_repair,
id,
device_code,
create_time
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workerId != null">#{workerId},</if>
<if test="idNumber != null">#{idNumber},</if>
<if test="name != null">#{name},</if>
<if test="proId != null">#{proId},</if>
<if test="proName != null">#{proName},</if>
<if test="teamId != null">#{teamId},</if>
<if test="teamName != null">#{teamName},</if>
<if test="subId != null">#{subId},</if>
<if test="subName != null">#{subName},</if>
<if test="attDay != null">#{attDay},</if>
1,
#{idCode},
'补卡',
sysdate()
</trim>
</insert>
<insert id="insertRepairCardDate">
INSERT INTO bm_repair_card_date
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="applyId != null">apply_id,</if>
<if test="workerId != null">worker_id,</if>
<if test="idNumber != null and idNumber != ''">id_number,</if>
<if test="attDay != null and attDay != ''">current_day,</if>
create_time
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="applyId != null">#{applyId},</if>
<if test="workerId != null">#{workerId},</if>
<if test="idNumber != null and idNumber != ''">#{idNumber},</if>
<if test="attDay != null and attDay != ''">#{attDay},</if>
sysdate()
</trim>
</insert>
<update id="updaterepairCardApply">
update bm_repair_card_apply
<set>
<if test="checkStatus != null">check_status = #{checkStatus,jdbcType=INTEGER},</if>
<if test="refuseRemark != null">refuse_remark = #{refuseRemark,jdbcType=VARCHAR},</if>
check_time = sysdate()
</set>
where id = #{id}
</update>
<delete id="delRepairCardApply">
delete from bm_repair_card_apply where id = #{id}
</delete>
<delete id="delRepairCardRecord">
delete from bm_repair_card_record where apply_id = #{id}
</delete>
<select id="list" resultType="com.bonus.bmw.domain.dto.RepairCardApplyDto">
select pp.pro_name as proName,
brca.repair_num as repairNum,
brca.repair_day as repairDay,
brca.repair_remark as repairRemark,
brca.apply_user as applyUser,
brca.apply_time as applyTime,
brca.check_user as checkUser,
brca.check_status as checkStatus,
case when brca.check_status = 0 then '待审核'
when brca.check_status = 1 then '审核通过'
when brca.check_status = 2 then '审核未通过'
else '' end as checkStatusName,
brca.check_time as checkTime
from bm_repair_card_apply brca
left join pm_project pp on pp.id = brca.pro_id
where 1=1
<if test="applyUser != null">
and brca.apply_user like concat('%',#{applyUser},'%')
</if>
<if test="proId != null">
and brca.pro_id = #{proId}
</if>
<if test="checkStatus != null">
and brca.check_status = #{checkStatus}
</if>
</select>
<select id="proList" resultType="com.bonus.bmw.domain.dto.ProDto">
select id, pro_name as proName
from pm_project where is_active = 1
</select>
<select id="getRepairCardDetails" resultType="com.bonus.bmw.domain.dto.RepairCardRecordDto">
select pp.pro_name as proName,
pt.team_name as team_name,
brca.repair_remark as repairRemark,
brca.repair_file as repairFile,
brcr.apply_id as applyId,
brcr.worker_id as workerId,
brcr.id_number as idNumber,
brcr.name,
brcr.phone,
brcr.pro_id as proId,
brcr.team_id as teamId,
brcr.repair_day as repairDay,
brcr.repair_date as repairDate,
brcr.create_time as createTime
from bm_repair_card_apply brca
left join bm_repair_card_record brcr on brca.id = brcr.apply_id
left join pm_project pp on pp.id = brcr.pro_id
left join pm_sub_team pt on pt.id = brcr.team_id
where brcr.is_active = 1 and brca.pro_id = #{proId}
</select>
<select id="getCheckRecord" resultType="com.bonus.bmw.domain.dto.CheckRecordDto">
select exit_time as exitTime,
ein_time as einTime,
team_name as teamName,
is_active as isActive
from bm_worker_ein_pro_record where pro_id = #{proId} and worker_id = #{workerId} ORDER BY create_time ASC
</select>
<select id="workPersonList" resultType="com.bonus.bmw.domain.dto.WorkPersonDto">
select distinct pw.id, pw.name, pw.phone, pw.id_number,bwepr.team_id from pm_worker pw
left join bm_worker_ein_pro_record bwepr on pw.id = bwepr.worker_id
where
pw.is_active = 1 and bwepr.pro_id = #{proId}
</select>
<select id="attPersonRecord" resultType="java.lang.String">
select att_day from bm_att_person where pro_id = #{proId} and worker_id = #{workerId} and is_active = 1
</select>
<select id="getCardStatistics" resultType="com.bonus.bmw.domain.dto.CardStatisticsDto">
SELECT
pp.id proId,
pp.pro_name proName,
count( brca.id ) num,
count( distinct brcr.worker_id ) personNum,
sum( brcr.repair_day ) days,
brca.create_time createTime
FROM
bm_repair_card_apply brca
LEFT JOIN bm_repair_card_record brcr ON brca.id = brcr.apply_id
LEFT JOIN pm_project pp ON pp.id = brca.pro_id
WHERE
brca.is_active = 1
<if test="proId != null">
AND brca.pro_id = #{proId}
</if>
GROUP BY
brca.pro_id
ORDER BY
brca.create_time
</select>
<select id="getRepairCardRecordsList" resultType="com.bonus.bmw.domain.dto.RepairCardRecordDto">
SELECT DISTINCT
brcr.apply_id as applyId,
brcr.worker_id as workerId,
brcr.id_number as idNumber,
brcr.name,
brcr.phone,
brcr.pro_id as proId,
brcr.repair_day as repairDay,
brcr.repair_date as repairDate,
bwepr.sub_id as subId,
bwepr.sub_name as subName,
bwepr.team_id as teamId,
bwepr.team_name as teamName
FROM
bm_repair_card_record brcr
left join bm_worker_ein_pro_record bwepr on bwepr.worker_id = brcr.worker_id
and bwepr.pro_id = brcr.pro_id
and brcr.team_id = bwepr.team_id
where brcr.is_active = 1 and brcr.apply_id = #{id}
</select>
</mapper>

View File

@ -72,7 +72,7 @@ public class DeviceServlet extends HttpServlet {
resp.addHeader(Constant.DEVICE_HEADER_RESPONSE_CODE, Constant.ERROR_NO_CMD);
return;
}
redisUtils.setCacheObject("att_dev:status",1,600L, TimeUnit.SECONDS);
redisUtils.setCacheObject("att_dev:status:"+deviceVo.getDevCode(),1,600L, TimeUnit.SECONDS);
String asTransId = req.getHeader(Constant.DEVICE_HEADER_TRANS_ID);
String requestCode = req.getHeader(Constant.DEVICE_HEADER_REQUEST_CODE);
// zSetOperations.add(CacheConstant.DEVICE_ONLINE_SET_CACHE, deviceVo.getDevCode(), System.currentTimeMillis());