补卡申请、审核、统计
This commit is contained in:
parent
37bf2efaa1
commit
9c4a85ff5d
|
|
@ -155,6 +155,11 @@ public class Constants
|
|||
*/
|
||||
public static final String FILE_UPLOAD_WORKER = "pm_worker";
|
||||
|
||||
/**
|
||||
* 人员入场表
|
||||
*/
|
||||
public static final String FILE_UPLOAD_REPAIR_CARD_APPLY = "bm_repair_card_apply";
|
||||
|
||||
/**
|
||||
* 人员出场表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ import org.springframework.context.annotation.Configuration;
|
|||
*/
|
||||
@Configuration
|
||||
public class MyBatisConfig {
|
||||
@Bean
|
||||
public ConfigurationCustomizer configurationCustomizer() {
|
||||
return configuration -> {
|
||||
configuration.addInterceptor(new DataEnDecryptInterceptor());
|
||||
};
|
||||
}
|
||||
}
|
||||
// @Bean
|
||||
// public ConfigurationCustomizer configurationCustomizer() {
|
||||
// return configuration -> {
|
||||
// configuration.addInterceptor(new DataEnDecryptInterceptor());
|
||||
// };
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
import com.bonus.bmw.domain.dto.*;
|
||||
import com.bonus.bmw.domain.po.PmSub;
|
||||
import com.bonus.bmw.service.RepairCardApplyService;
|
||||
import com.bonus.common.core.utils.json.FastJsonHelper;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
|
@ -10,6 +12,7 @@ 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 org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -91,9 +94,8 @@ public class RepairCardApplyController extends BaseController {
|
|||
@GetMapping("/getRepairCardDetails")
|
||||
public AjaxResult getRepairCardDetails(RepairCardApplyDto cardApply) {
|
||||
try {
|
||||
startPage();
|
||||
List<RepairCardRecordDto> list = repairCardApplyMapper.getRepairCardDetails(cardApply);
|
||||
return AjaxResult.success(list);
|
||||
RepairCardDetailsDto dto = repairCardApplyMapper.getRepairCardDetails(cardApply);
|
||||
return AjaxResult.success(dto);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
|
|
@ -122,12 +124,28 @@ public class RepairCardApplyController extends BaseController {
|
|||
/**
|
||||
* 新增补卡申请
|
||||
*
|
||||
* @param cardApplyDto
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/saverepairCardApply")
|
||||
public AjaxResult saverepairCardApply(@RequestBody RepairCardApplyDto cardApplyDto) {
|
||||
AjaxResult ajaxResult = repairCardApplyMapper.saverepairCardApply(cardApplyDto);
|
||||
@PostMapping("/saveRepairCardApply")
|
||||
public AjaxResult saverepairCardApply(@RequestParam(value = "file", required = false) MultipartFile[] files, @RequestParam(value = "fileMsg", required = false) String fileMsg, @RequestParam(value = "params") String params) {
|
||||
List<WebFileDto> listFile = FastJsonHelper.jsonArrStrToBeanList(fileMsg, WebFileDto.class);
|
||||
RepairCardApplyDto cardApplyDto = FastJsonHelper.jsonStrToBean(params, RepairCardApplyDto.class);
|
||||
AjaxResult ajaxResult = repairCardApplyMapper.saverepairCardApply(cardApplyDto, new FileBasicMsgDto(listFile, files));
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改补卡申请(驳回后重新提交)
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateRepairCardApply")
|
||||
public AjaxResult updateRepairCardApply(@RequestParam(value = "file", required = false) MultipartFile[] files, @RequestParam(value = "fileMsg", required = false) String fileMsg, @RequestParam(value = "params") String params) {
|
||||
List<WebFileDto> listFile = FastJsonHelper.jsonArrStrToBeanList(fileMsg, WebFileDto.class);
|
||||
RepairCardApplyDto cardApplyDto = FastJsonHelper.jsonStrToBean(params, RepairCardApplyDto.class);
|
||||
AjaxResult ajaxResult = repairCardApplyMapper.updateRepairCardApply(cardApplyDto, new FileBasicMsgDto(listFile, files));
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.bonus.bmw.domain.dto;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -25,7 +27,7 @@ public class RepairCardApplyDto {
|
|||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "工程名称")
|
||||
private Integer proName;
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 补卡人员数
|
||||
|
|
@ -41,7 +43,7 @@ public class RepairCardApplyDto {
|
|||
/**
|
||||
* 驳回意见
|
||||
*/
|
||||
private Integer refuseRemark;
|
||||
private String refuseRemark;
|
||||
|
||||
/**
|
||||
* 补卡备注
|
||||
|
|
@ -69,7 +71,7 @@ public class RepairCardApplyDto {
|
|||
* 申请时间
|
||||
*/
|
||||
@Excel(name = "申请时间")
|
||||
private Date applyTime;
|
||||
private String applyTime;
|
||||
|
||||
/**
|
||||
* 0 待审核 1 审核通过 2 审核不通过
|
||||
|
|
@ -117,4 +119,13 @@ public class RepairCardApplyDto {
|
|||
private Integer isActive;
|
||||
|
||||
private List<RepairCardRecordDto> repairCardRecords;
|
||||
|
||||
/**
|
||||
* 补卡附件
|
||||
*/
|
||||
private List<UploadFileVo> files;
|
||||
/**
|
||||
* 删除文件id集合
|
||||
*/
|
||||
private List<String> fileIdList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.bmw.domain.dto;
|
||||
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/8/18 - 10:33
|
||||
*/
|
||||
@Data
|
||||
public class RepairCardDetailsDto {
|
||||
private String repairRemark;
|
||||
private List<RepairCardRecordDto> repairCardDetails;
|
||||
private List<UploadFileVo> files;
|
||||
}
|
||||
|
|
@ -31,5 +31,13 @@ public class WorkPersonDto {
|
|||
* 身份证
|
||||
*/
|
||||
private String idNumber;
|
||||
/**
|
||||
* 班组id
|
||||
*/
|
||||
private String teamId;
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
private String teamName;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,4 +41,7 @@ public interface RepairCardApplyMapper {
|
|||
|
||||
List<RepairCardRecordDto> getRepairCardRecordsList(RepairCardApplyDto cardApplyDto);
|
||||
|
||||
}
|
||||
Integer updateRepairCardApply(RepairCardApplyDto cardApplyDto);
|
||||
|
||||
String getRepairCardApply(RepairCardApplyDto cardApply);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,17 +15,19 @@ public interface RepairCardApplyService {
|
|||
|
||||
List<ProDto> proList();
|
||||
|
||||
List<RepairCardRecordDto> getRepairCardDetails(RepairCardApplyDto cardApply);
|
||||
RepairCardDetailsDto getRepairCardDetails(RepairCardApplyDto cardApply);
|
||||
|
||||
Map<String, CheckRecordDto> getCheckRecord(CheckRecordDto checkRecordDto);
|
||||
|
||||
List<WorkPersonDto> workPersonList(RepairCardApplyDto cardApply);
|
||||
|
||||
AjaxResult saverepairCardApply(RepairCardApplyDto cardApplyDto);
|
||||
AjaxResult saverepairCardApply(RepairCardApplyDto cardApplyDto, FileBasicMsgDto fileBasicMsgDto);
|
||||
|
||||
Integer delRepairCardApply(RepairCardApplyDto cardApplyDto);
|
||||
|
||||
AjaxResult audit(RepairCardApplyDto cardApplyDto);
|
||||
|
||||
List<CardStatisticsDto> getCardStatistics(RepairCardApplyDto cardApply);
|
||||
|
||||
AjaxResult updateRepairCardApply(RepairCardApplyDto cardApplyDto, FileBasicMsgDto fileBasicMsgDto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,12 @@ 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.constant.Constants;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.uuid.UUID;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.model.UploadFileVo;
|
||||
import org.apache.catalina.security.SecurityUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -27,6 +30,8 @@ public class RepairCardApplyServiceImpl implements RepairCardApplyService {
|
|||
|
||||
@Resource
|
||||
private RepairCardApplyMapper repairCardApplyMapper;
|
||||
@Resource
|
||||
private FileUploadUtils fileUploadUtils;
|
||||
|
||||
@Override
|
||||
public List<RepairCardApplyDto> list(RepairCardApplyDto cardApply) {
|
||||
|
|
@ -39,8 +44,15 @@ public class RepairCardApplyServiceImpl implements RepairCardApplyService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<RepairCardRecordDto> getRepairCardDetails(RepairCardApplyDto cardApply) {
|
||||
return repairCardApplyMapper.getRepairCardDetails(cardApply);
|
||||
public RepairCardDetailsDto getRepairCardDetails(RepairCardApplyDto cardApply) {
|
||||
RepairCardDetailsDto dto = new RepairCardDetailsDto();
|
||||
String repairRemark = repairCardApplyMapper.getRepairCardApply(cardApply);
|
||||
List<RepairCardRecordDto> repairCardDetails = repairCardApplyMapper.getRepairCardDetails(cardApply);
|
||||
dto.setRepairRemark(repairRemark);
|
||||
dto.setRepairCardDetails(repairCardDetails);
|
||||
List<UploadFileVo> fileList = fileUploadUtils.getFileList("", cardApply.getId().toString(), Constants.FILE_UPLOAD_REPAIR_CARD_APPLY, "");
|
||||
dto.setFiles(fileList);
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -72,18 +84,19 @@ public class RepairCardApplyServiceImpl implements RepairCardApplyService {
|
|||
LocalDateTime einTime = record.getEinTime();
|
||||
LocalDateTime exitTime = record.getExitTime();
|
||||
|
||||
if ((isActive == 0 && exitTime == null) || (isActive == 1 && exitTime == null)) {
|
||||
// 0 已出场 1已入场
|
||||
if ((isActive == 1 && exitTime == null)) {
|
||||
// 入场事件
|
||||
currentEnter = einTime;
|
||||
teamName = record.getTeamName();
|
||||
} else if (isActive == 1 && currentEnter != null && einTime != null && exitTime != null) {
|
||||
} else if (isActive == 0 && 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; // 匹配完成,清空
|
||||
timeRanges.add(new CheckRecordDto(einTime, exitTime, record.getTeamName()));
|
||||
// 匹配完成,清空
|
||||
currentEnter = null;
|
||||
}
|
||||
// 注意:如果 is_active=0 但前面没有入场,可选择忽略或报错
|
||||
// 注意:如果 is_active=1 但前面没有入场,可选择忽略或报错
|
||||
}
|
||||
|
||||
// 如果最后还有未出场的,可根据业务决定是否闭合(比如用当前时间)
|
||||
|
|
@ -119,11 +132,11 @@ public class RepairCardApplyServiceImpl implements RepairCardApplyService {
|
|||
if (attPersonRecord.contains(entry.getKey())) {
|
||||
CheckRecordDto value = entry.getValue();
|
||||
// 已打卡
|
||||
value.setIsActive(0);
|
||||
value.setIsActive(1);
|
||||
} else {
|
||||
// 未打卡
|
||||
CheckRecordDto value = entry.getValue();
|
||||
value.setIsActive(1);
|
||||
value.setIsActive(0);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
@ -135,17 +148,55 @@ public class RepairCardApplyServiceImpl implements RepairCardApplyService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult saverepairCardApply(RepairCardApplyDto cardApplyDto) {
|
||||
cardApplyDto.setApplyUser(SecurityUtils.getUsername());
|
||||
public AjaxResult saverepairCardApply(RepairCardApplyDto cardApplyDto, FileBasicMsgDto fileBasicMsgDto) {
|
||||
cardApplyDto.setApplyUser(SecurityUtils.getLoginUser().getUsername());
|
||||
Integer num = repairCardApplyMapper.saverepairCardApply(cardApplyDto);
|
||||
if (num > 0) {
|
||||
repairCardApplyMapper.saverepairCardDetails(cardApplyDto.getId(), cardApplyDto.getRepairCardRecords());
|
||||
//添加到文件库和minio上
|
||||
if (StringUtils.isNotNull(fileBasicMsgDto.getFiles())) {
|
||||
//存文件
|
||||
List<WebFileDto> fileMsg = fileBasicMsgDto.getFileMsg();
|
||||
String[] type = new String[fileMsg.size()];
|
||||
for (int i = 0; i < fileMsg.size(); i++) {
|
||||
type[i] = fileMsg.get(i).getType();
|
||||
}
|
||||
List<UploadFileVo> uploadFileVos = fileUploadUtils.uploadFile(fileBasicMsgDto.getFiles(), Constants.FILE_UPLOAD_REPAIR_CARD_APPLY, cardApplyDto.getId().toString(), type, "", "");
|
||||
}
|
||||
return AjaxResult.success("保存成功");
|
||||
} else {
|
||||
return AjaxResult.error("保存失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult updateRepairCardApply(RepairCardApplyDto cardApplyDto, FileBasicMsgDto fileBasicMsgDto) {
|
||||
cardApplyDto.setApplyUser(SecurityUtils.getUsername());
|
||||
Integer num = repairCardApplyMapper.updateRepairCardApply(cardApplyDto);
|
||||
if (num > 0) {
|
||||
repairCardApplyMapper.delRepairCardRecord(cardApplyDto);
|
||||
repairCardApplyMapper.saverepairCardDetails(cardApplyDto.getId(), cardApplyDto.getRepairCardRecords());
|
||||
//添加到文件库和minio上
|
||||
if (StringUtils.isNotNull(cardApplyDto.getFileIdList())) {
|
||||
//判断是否修改图片信息
|
||||
for (String fileId : cardApplyDto.getFileIdList()) {
|
||||
//删除合同图片 删除minio文件
|
||||
fileUploadUtils.delFileListById(fileId, cardApplyDto.getId().toString(), Constants.FILE_UPLOAD_REPAIR_CARD_APPLY, "");
|
||||
}
|
||||
//存文件
|
||||
List<WebFileDto> fileMsg = fileBasicMsgDto.getFileMsg();
|
||||
String[] type = new String[fileMsg.size()];
|
||||
for (int i = 0; i < fileMsg.size(); i++) {
|
||||
type[i] = fileMsg.get(i).getType();
|
||||
}
|
||||
List<UploadFileVo> uploadFileVos = fileUploadUtils.uploadFile(fileBasicMsgDto.getFiles(), Constants.FILE_UPLOAD_REPAIR_CARD_APPLY, cardApplyDto.getId().toString(), type, "", "");
|
||||
}
|
||||
return AjaxResult.success("提交成功");
|
||||
} else {
|
||||
return AjaxResult.error("提交失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer delRepairCardApply(RepairCardApplyDto cardApplyDto) {
|
||||
Integer i = repairCardApplyMapper.delRepairCardApply(cardApplyDto);
|
||||
|
|
@ -158,6 +209,7 @@ public class RepairCardApplyServiceImpl implements RepairCardApplyService {
|
|||
@Override
|
||||
public AjaxResult audit(RepairCardApplyDto cardApplyDto) {
|
||||
try {
|
||||
cardApplyDto.setCheckUser(SecurityUtils.getLoginUser().getUsername());
|
||||
repairCardApplyMapper.updaterepairCardApply(cardApplyDto);
|
||||
if (cardApplyDto.getCheckStatus() == 1) {
|
||||
// 通过
|
||||
|
|
|
|||
|
|
@ -157,10 +157,30 @@
|
|||
<set>
|
||||
<if test="checkStatus != null">check_status = #{checkStatus,jdbcType=INTEGER},</if>
|
||||
<if test="refuseRemark != null">refuse_remark = #{refuseRemark,jdbcType=VARCHAR},</if>
|
||||
check_time = sysdate()
|
||||
<if test="checkUser != null">check_user = #{checkUser,jdbcType=VARCHAR},</if>
|
||||
check_time = sysdate(),
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateRepairCardApply">
|
||||
UPDATE bm_repair_card_apply
|
||||
<set>
|
||||
<if test="proId != null">pro_id = #{proId,jdbcType=INTEGER},</if>
|
||||
<if test="repairNum != null">repair_num = #{repairNum,jdbcType=INTEGER},</if>
|
||||
<if test="repairDay != null">repair_day = #{repairDay,jdbcType=INTEGER},</if>
|
||||
<if test="repairRemark != null">repair_remark = #{repairRemark,jdbcType=VARCHAR},</if>
|
||||
<if test="repairFile != null">repair_file = #{repairFile,jdbcType=VARCHAR},</if>
|
||||
<if test="repairMonth != null">repair_month = #{repairMonth,jdbcType=VARCHAR},</if>
|
||||
<if test="applyUser != null">apply_user = #{applyUser,jdbcType=VARCHAR},</if>
|
||||
<if test="checkUser != null">check_user = #{checkUser,jdbcType=VARCHAR},</if>
|
||||
<if test="checkTime != null">check_time = #{checkTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="createUser != null">create_user = #{createUser,jdbcType=VARCHAR},</if>
|
||||
<if test="updateUser != null">update_user = #{updateUser,jdbcType=VARCHAR},</if>
|
||||
check_status = 0,
|
||||
apply_time = SYSDATE()
|
||||
</set>
|
||||
WHERE id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<delete id="delRepairCardApply">
|
||||
delete from bm_repair_card_apply where id = #{id}
|
||||
</delete>
|
||||
|
|
@ -170,6 +190,8 @@
|
|||
|
||||
<select id="list" resultType="com.bonus.bmw.domain.dto.RepairCardApplyDto">
|
||||
select pp.pro_name as proName,
|
||||
brca.id,
|
||||
brca.pro_id as proId,
|
||||
brca.repair_num as repairNum,
|
||||
brca.repair_day as repairDay,
|
||||
brca.repair_remark as repairRemark,
|
||||
|
|
@ -202,8 +224,6 @@
|
|||
<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,
|
||||
|
|
@ -214,11 +234,10 @@
|
|||
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
|
||||
from bm_repair_card_record brcr
|
||||
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}
|
||||
where brcr.is_active = 1 and brcr.apply_id = #{id}
|
||||
</select>
|
||||
<select id="getCheckRecord" resultType="com.bonus.bmw.domain.dto.CheckRecordDto">
|
||||
select exit_time as exitTime,
|
||||
|
|
@ -229,7 +248,7 @@
|
|||
</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
|
||||
select distinct pw.id, pw.name, pw.phone, pw.id_number,bwepr.team_id, bwepr.team_name 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}
|
||||
|
|
@ -280,4 +299,7 @@
|
|||
and brcr.team_id = bwepr.team_id
|
||||
where brcr.is_active = 1 and brcr.apply_id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
<select id="getRepairCardApply" resultType="java.lang.String">
|
||||
select repair_remark from bm_repair_card_apply where id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue