BUG,分包薪水转换
This commit is contained in:
@ -1,11 +1,22 @@
|
||||
package org.dromara.contractor.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.beust.ah.A;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.utils.DateUtils;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
@ -14,10 +25,16 @@ import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.utils.IdCardEncryptorUtil;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.contractor.domain.SubConstructionUser;
|
||||
import org.dromara.contractor.domain.SubConstructionUserFile;
|
||||
import org.dromara.contractor.domain.dto.constructionuser.*;
|
||||
import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileQueryReq;
|
||||
import org.dromara.contractor.domain.exportvo.BusConstructionUserExportVo;
|
||||
import org.dromara.contractor.domain.vo.constructionuser.*;
|
||||
import org.dromara.contractor.domain.vo.constructionuserfile.SubConstructionUserFileVo;
|
||||
import org.dromara.contractor.service.ISubConstructionUserFileService;
|
||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||
import org.dromara.project.domain.dto.project.BusProjectQueryReq;
|
||||
import org.dromara.project.domain.dto.projectteam.BusProjectTeamQueryReq;
|
||||
@ -28,11 +45,20 @@ import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.project.service.IBusProjectTeamMemberService;
|
||||
import org.dromara.project.service.IBusProjectTeamService;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 施工人员
|
||||
@ -53,7 +79,8 @@ public class SubConstructionUserController extends BaseController {
|
||||
private final IBusProjectTeamMemberService busProjectTeamMemberService;
|
||||
|
||||
private final IBusProjectService projectService;
|
||||
|
||||
private final IdCardEncryptorUtil idCardEncryptorUtil;
|
||||
private final ISubConstructionUserFileService constructionUserFileService;
|
||||
/**
|
||||
* 查询施工人员列表
|
||||
*/
|
||||
@ -82,16 +109,16 @@ public class SubConstructionUserController extends BaseController {
|
||||
return R.ok(constructionUserService.queryAttendanceMonthList(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出施工人员列表
|
||||
*/
|
||||
@SaCheckPermission("contractor:constructionUser:export")
|
||||
@Log(title = "施工人员", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(SubConstructionUserQueryReq req, HttpServletResponse response) {
|
||||
List<BusConstructionUserExportVo> list = constructionUserService.queryList(req);
|
||||
ExcelUtil.exportExcel(list, "施工人员", BusConstructionUserExportVo.class, response);
|
||||
}
|
||||
// /**
|
||||
// * 导出施工人员列表
|
||||
// */
|
||||
// @SaCheckPermission("contractor:constructionUser:export")
|
||||
// @Log(title = "施工人员", businessType = BusinessType.EXPORT)
|
||||
// @PostMapping("/export")
|
||||
// public void export(SubConstructionUserQueryReq req, HttpServletResponse response) {
|
||||
// List<BusConstructionUserExportVo> list = constructionUserService.queryList(req);
|
||||
// ExcelUtil.exportExcel(list, "施工人员", BusConstructionUserExportVo.class, response);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取施工人员详细信息
|
||||
@ -262,4 +289,162 @@ public class SubConstructionUserController extends BaseController {
|
||||
return R.ok(constructionUserService.faceRecognize(file));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Log(title = "施工人员导出", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(SubConstructionUserQueryReq req, HttpServletResponse response) {
|
||||
LambdaQueryWrapper<SubConstructionUser> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(req.getProjectId() != null, SubConstructionUser::getProjectId, req.getProjectId());
|
||||
lqw.like(StringUtils.isNotBlank(req.getUserName()), SubConstructionUser::getUserName, req.getUserName());
|
||||
lqw.eq(req.getContractorId() != null, SubConstructionUser::getContractorId, req.getContractorId());
|
||||
lqw.eq(req.getTeamId() != null, SubConstructionUser::getTeamId, req.getTeamId());
|
||||
lqw.eq(StringUtils.isNotBlank(req.getTypeOfWork()), SubConstructionUser::getTypeOfWork, req.getTypeOfWork());
|
||||
lqw.eq(StringUtils.isNotBlank(req.getClock()), SubConstructionUser::getClock, req.getClock());
|
||||
|
||||
List<SubConstructionUser> list = constructionUserService.list(lqw);
|
||||
|
||||
List<Long> userIds = list.stream().map(SubConstructionUser::getSysUserId).toList();
|
||||
List<SubConstructionUserFile> fileList = new ArrayList<>();
|
||||
if(CollectionUtils.isNotEmpty(userIds)){
|
||||
fileList = constructionUserFileService.list(Wrappers.lambdaQuery(SubConstructionUserFile.class)
|
||||
.in(SubConstructionUserFile::getUserId, userIds));
|
||||
}
|
||||
// 1. 设置响应头(告诉浏览器这是下载文件)
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
// 文件名编码,避免中文乱码
|
||||
String fileName = URLEncoder.encode("多Sheet测试Excel_" + System.currentTimeMillis(), StandardCharsets.UTF_8);
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
// 2. 用ByteArrayOutputStream作为中间缓存,接收EasyExcel的输出
|
||||
try (
|
||||
// 自动关闭流:ByteArrayOutputStream无需手动关闭,try-with-resources会处理
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
// 3. EasyExcel写入ByteArrayOutputStream(不指定本地路径)
|
||||
ExcelWriter excelWriter = EasyExcel.write(outputStream, SubConstructionUserExportVo.class).build()
|
||||
) {
|
||||
Map<Long, String> teamMap = list.stream()
|
||||
.filter(vo -> vo.getTeamId() != null)
|
||||
.collect(Collectors.toMap(
|
||||
SubConstructionUser::getTeamId,
|
||||
SubConstructionUser::getTeamName,
|
||||
(existing, replacement) -> existing // 遇到重复的key时保留第一个值
|
||||
));
|
||||
// 4. 循环生成多个Sheet(示例:5个Sheet,对应5页数据)
|
||||
int i = 0;
|
||||
for (Long teamId : teamMap.keySet()) {
|
||||
// 每个Sheet必须指定唯一的sheetNo和sheetName
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(i, teamMap.get(teamId)).build();
|
||||
i++;
|
||||
List<SubConstructionUser> list1 = list.stream().filter(user -> user.getTeamId()!=null && user.getTeamId().equals(teamId)).toList();
|
||||
ArrayList<SubConstructionUserExportVo> dataList = new ArrayList<>();
|
||||
int order = 1;
|
||||
for (SubConstructionUser user : list1) {
|
||||
SubConstructionUserExportVo vo = new SubConstructionUserExportVo();
|
||||
BeanUtils.copyProperties(user,vo,"leaveDate","entryDate");
|
||||
vo.setOrder(order);
|
||||
if (user.getLeaveDate() != null) {
|
||||
vo.setLeaveDate(DateUtils.formatDateTime(user.getLeaveDate()));
|
||||
}
|
||||
if (user.getEntryDate() != null) {
|
||||
vo.setEntryDate(DateUtils.formatDateTime(user.getEntryDate()));
|
||||
}
|
||||
String sex = vo.getSex();
|
||||
if (sex != null && sex.equals("1")) {
|
||||
vo.setSex("男");
|
||||
} else if (sex != null && sex.equals("2")) {
|
||||
vo.setSex("女");
|
||||
}else {
|
||||
vo.setSex("未知");
|
||||
}
|
||||
String sfzNumber = vo.getSfzNumber();
|
||||
try {
|
||||
vo.setSfzNumber(idCardEncryptorUtil.decrypt(sfzNumber));
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
List<SubConstructionUserFile> list2 = fileList.stream()
|
||||
.filter(file -> file.getUserId().equals(user.getSysUserId()) && StringUtils.isNotBlank(file.getPath()))
|
||||
.toList();
|
||||
if(list2.isEmpty()){
|
||||
vo.setUploadFile("未上传");
|
||||
}else if (list2.size() >= 6){
|
||||
vo.setUploadFile("已上传");
|
||||
}else {
|
||||
vo.setUploadFile("部分上传");
|
||||
}
|
||||
dataList.add(vo);
|
||||
}
|
||||
// 写入当前Sheet的数据
|
||||
excelWriter.write(dataList, writeSheet);
|
||||
}
|
||||
//无班组的写入
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(i, "无班组").build();
|
||||
List<SubConstructionUser> noList = list.stream().filter(user -> user.getTeamId()==null).toList();
|
||||
if(CollectionUtils.isNotEmpty(noList)){
|
||||
int order = 1;
|
||||
ArrayList<SubConstructionUserExportVo> dataList = new ArrayList<>();
|
||||
for (SubConstructionUser user : noList) {
|
||||
SubConstructionUserExportVo vo = new SubConstructionUserExportVo();
|
||||
BeanUtils.copyProperties(user,vo,"leaveDate","entryDate");
|
||||
vo.setOrder(order);
|
||||
if (user.getLeaveDate() != null) {
|
||||
vo.setLeaveDate(DateUtils.formatDateTime(user.getLeaveDate()));
|
||||
}
|
||||
if (user.getEntryDate() != null) {
|
||||
vo.setEntryDate(DateUtils.formatDateTime(user.getEntryDate()));
|
||||
}
|
||||
String sex = vo.getSex();
|
||||
if (sex != null && sex.equals("1")) {
|
||||
vo.setSex("男");
|
||||
} else if (sex != null && sex.equals("2")) {
|
||||
vo.setSex("女");
|
||||
}else {
|
||||
vo.setSex("未知");
|
||||
}
|
||||
String sfzNumber = vo.getSfzNumber();
|
||||
try {
|
||||
vo.setSfzNumber(idCardEncryptorUtil.decrypt(sfzNumber));
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
List<SubConstructionUserFile> list2 = fileList.stream()
|
||||
.filter(file -> file.getUserId().equals(user.getSysUserId()) && StringUtils.isNotBlank(file.getPath()))
|
||||
.toList();
|
||||
if(list2.isEmpty()){
|
||||
vo.setUploadFile("未上传");
|
||||
}else if (list2.size() >= 6){
|
||||
vo.setUploadFile("已上传");
|
||||
}else {
|
||||
vo.setUploadFile("部分上传");
|
||||
}
|
||||
dataList.add(vo);
|
||||
}
|
||||
// 写入当前Sheet的数据
|
||||
excelWriter.write(dataList, writeSheet);
|
||||
}
|
||||
|
||||
|
||||
// 5. 将ByteArrayOutputStream的字节写入响应输出流
|
||||
try (OutputStream responseOs = response.getOutputStream()) {
|
||||
// 刷新ExcelWriter,确保所有数据写入outputStream
|
||||
excelWriter.finish();
|
||||
// 字节数组写入响应流
|
||||
responseOs.write(outputStream.toByteArray());
|
||||
// 强制刷新,确保数据全部发送
|
||||
responseOs.flush();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 异常处理(如返回错误信息给前端)
|
||||
response.setContentType("text/plain;charset=UTF-8");
|
||||
try {
|
||||
response.getWriter().write("Excel生成失败:" + e.getMessage());
|
||||
} catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,102 @@
|
||||
package org.dromara.contractor.domain.vo.constructionuser;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
import org.dromara.contractor.domain.SubConstructionUser;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 施工人员视图对象 bus_construction_user
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-03-07
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class SubConstructionUserExportVo{
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "序号")
|
||||
private Integer order;
|
||||
|
||||
/**
|
||||
* 人员姓名
|
||||
*/
|
||||
@ExcelProperty(value = "姓名")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
@ExcelProperty(value = "班组")
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 0:保密 1:男 2女
|
||||
*/
|
||||
@ExcelProperty(value = "性别")
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
@ExcelProperty(value = "身份证")
|
||||
private String sfzNumber;
|
||||
|
||||
/**
|
||||
* 身份证地址
|
||||
*/
|
||||
@ExcelProperty(value = "地址")
|
||||
private String sfzSite;
|
||||
|
||||
/**
|
||||
* 民族
|
||||
*/
|
||||
@ExcelProperty(value = "民族")
|
||||
private String nation;
|
||||
|
||||
/**
|
||||
* 银行卡号
|
||||
*/
|
||||
@ExcelProperty(value = "银行卡卡号")
|
||||
private String yhkNumber;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@ExcelProperty(value = "联系电话")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 入场时间
|
||||
*/
|
||||
@ExcelProperty(value = "入场时间")
|
||||
private String entryDate;
|
||||
|
||||
/**
|
||||
* 离场时间
|
||||
*/
|
||||
@ExcelProperty(value = "离场时间")
|
||||
private String leaveDate;
|
||||
|
||||
/**
|
||||
* 资料上传(部分,已上传,未上传)
|
||||
*/
|
||||
@ExcelProperty(value = "资料上传")
|
||||
private String uploadFile;
|
||||
|
||||
}
|
||||
@ -26,7 +26,7 @@ import java.util.stream.Collectors;
|
||||
* @date 2025/6/18 15:59
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
//@Component
|
||||
public class IncSyncYs7DeviceCapturePicData {
|
||||
|
||||
@Resource
|
||||
|
||||
@ -17,7 +17,7 @@ import java.util.List;
|
||||
* @date 2025/6/17 9:33
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
//@Component
|
||||
public class IncSyncYs7DeviceData {
|
||||
|
||||
@Resource
|
||||
|
||||
@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.github.linpeilie.utils.CollectionUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -359,21 +360,17 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
// 判断当前用户打卡状态
|
||||
|
||||
int clockTypeByTime = getClockTypeByTime(localDate, now, busAttendanceRuleVo);
|
||||
if (clockTypeByTime == 1) {
|
||||
List<BusAttendance> attendances = this.lambdaQuery()
|
||||
.eq(BusAttendance::getUserId, userId)
|
||||
.eq(BusAttendance::getClockDate, localDate)
|
||||
.eq(BusAttendance::getClockType, BusAttendanceCommuterEnum.CLOCKIN.getValue())
|
||||
.list();
|
||||
if (CollectionUtil.isNotEmpty(attendances)) {
|
||||
BusAttendance busAttendance = attendances.getFirst();
|
||||
if (busAttendance.getClockStatus().equals(BusAttendanceClockStatusEnum.UNCLOCK.getValue())) {
|
||||
throw new ServiceException("上班缺卡记录已生成,不能更新");
|
||||
}
|
||||
//更新打卡时间
|
||||
busAttendance.setClockTime(now);
|
||||
updateById(busAttendance);
|
||||
} else {
|
||||
|
||||
List<BusAttendance> attendances = this.lambdaQuery()
|
||||
.eq(BusAttendance::getUserId, userId)
|
||||
.eq(BusAttendance::getClockDate, localDate)
|
||||
.list();
|
||||
List<BusAttendance> inAttendances = attendances.stream().filter(attendance ->
|
||||
BusAttendanceCommuterEnum.CLOCKIN.getValue().equals(attendance.getClockType())).toList();
|
||||
List<BusAttendance> outAttendances = attendances.stream().filter(attendance ->
|
||||
BusAttendanceCommuterEnum.CLOCKOUT.getValue().equals(attendance.getClockType())).toList();
|
||||
|
||||
if (clockTypeByTime == 1 && CollectionUtils.isEmpty(inAttendances)) {
|
||||
BusAttendance attendance = new BusAttendance();
|
||||
// 上班打卡
|
||||
attendance.setClockType(BusAttendanceCommuterEnum.CLOCKIN.getValue());
|
||||
@ -404,15 +401,11 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
//插入工资
|
||||
userSalaryDetailService.insertByAttendance(userId, attendance.getClockDate());
|
||||
return save;
|
||||
}
|
||||
} else if (clockTypeByTime == 2) {
|
||||
List<BusAttendance> attendances = this.lambdaQuery()
|
||||
.eq(BusAttendance::getUserId, userId)
|
||||
.eq(BusAttendance::getClockDate, localDate)
|
||||
.eq(BusAttendance::getClockType, BusAttendanceCommuterEnum.CLOCKOUT.getValue())
|
||||
.list();
|
||||
if (CollectionUtil.isNotEmpty(attendances)) {
|
||||
BusAttendance busAttendance = attendances.getFirst();
|
||||
|
||||
} else if (clockTypeByTime == 2 || CollectionUtils.isEmpty(outAttendances)) {
|
||||
|
||||
if (CollectionUtil.isNotEmpty(outAttendances)) {
|
||||
BusAttendance busAttendance = outAttendances.getFirst();
|
||||
if (busAttendance.getClockStatus().equals(BusAttendanceClockStatusEnum.UNCLOCK.getValue())) {
|
||||
throw new ServiceException("下班缺卡记录已生成,不能更新");
|
||||
}
|
||||
@ -425,8 +418,7 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
} else {
|
||||
busAttendance.setClockStatus(BusAttendanceClockStatusEnum.NORMAL.getValue());
|
||||
busAttendance.setMinuteCount(0);
|
||||
}
|
||||
updateById(busAttendance);
|
||||
}updateById(busAttendance);
|
||||
} else {
|
||||
BusAttendance attendance = new BusAttendance();
|
||||
// 下班打卡
|
||||
@ -1168,9 +1160,8 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
);
|
||||
|
||||
Map<Long, List<SubConstructionUser>> teamUserMap = list.stream()
|
||||
.filter(user -> user.getTeamId() != null)
|
||||
.collect(Collectors.groupingBy(SubConstructionUser::getTeamId));
|
||||
|
||||
.collect(Collectors.groupingBy(user ->
|
||||
user.getTeamId() != null ? user.getTeamId() : 0L));
|
||||
Workbook workbook = new HSSFWorkbook();
|
||||
|
||||
for (Map.Entry<Long, List<SubConstructionUser>> entry : teamUserMap.entrySet()) {
|
||||
@ -1179,6 +1170,12 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
List<SubConstructionUser> users = entry.getValue();
|
||||
SubConstructionUser constructionUser = users.getFirst();
|
||||
String teamName = constructionUser.getTeamName();
|
||||
if(teamId == 0){
|
||||
teamName = "无班组";
|
||||
}
|
||||
if(StringUtils.isBlank(teamName)){
|
||||
teamName = teamId.toString();
|
||||
}
|
||||
System.out.println("name:" + teamName);
|
||||
Sheet sheet = workbook.createSheet(teamName);
|
||||
|
||||
|
||||
@ -362,7 +362,9 @@ public class BusReissueCardServiceImpl extends ServiceImpl<BusReissueCardMapper,
|
||||
|
||||
//查看是否已提交该id的申请
|
||||
List<BusReissueCard> busReissueCards = baseMapper.selectList(Wrappers.<BusReissueCard>lambdaQuery()
|
||||
.eq(BusReissueCard::getAttendanceId, bean.getAttendanceId()));
|
||||
.eq(BusReissueCard::getAttendanceId, bean.getAttendanceId())
|
||||
.eq(BusReissueCard::getGangerOpinion,"2")
|
||||
);
|
||||
if (CollUtil.isNotEmpty(busReissueCards)) {
|
||||
throw new ServiceException("已提交该申请");
|
||||
}
|
||||
|
||||
@ -825,8 +825,10 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateAppUserType(Long userId, String appUserType) {
|
||||
//直接添加权限
|
||||
//直接添加权限 app用户类型 0-施工人员 1-管理人员 2-分包人员
|
||||
if("1".equals(appUserType)){
|
||||
|
||||
}
|
||||
|
||||
|
||||
return baseMapper.update(null,
|
||||
|
||||
@ -215,4 +215,10 @@ public class TransferDataController {
|
||||
transferDataService.handleUserFace();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/handleContractorId")
|
||||
private void handleContractorId() {
|
||||
transferDataService.handleContractorId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,8 +3,12 @@ package org.dromara.transferData.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class UserFace {
|
||||
private Long id;
|
||||
private String pacePhoto;
|
||||
private Long labourserviceId;
|
||||
private BigDecimal salary;
|
||||
}
|
||||
|
||||
@ -86,4 +86,16 @@ public interface TransferDataMapper {
|
||||
"</foreach>" +
|
||||
"</script>")
|
||||
List<UserFace> getUserFace(List<Long> goIds);
|
||||
|
||||
|
||||
|
||||
@DS("slave1")
|
||||
@Select("<script>" +
|
||||
"SELECT id,labourservice_id,salary FROM bus_construction_user " +
|
||||
"WHERE id IN " +
|
||||
"<foreach collection='goIds' item='userId' open='(' separator=',' close=')'>" +
|
||||
"#{userId}" +
|
||||
"</foreach>" +
|
||||
"</script>")
|
||||
List<UserFace> getUserLw(List<Long> goIds);
|
||||
}
|
||||
|
||||
@ -869,9 +869,66 @@ public class TransferDataService {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<Long, Long> COMPANY_SEQ_ID_MAP = new HashMap<>();
|
||||
|
||||
static {
|
||||
// 序号3:重庆电建(无匹配ID)
|
||||
COMPANY_SEQ_ID_MAP.put(3L, null);
|
||||
// 序号4:重庆巨鹏电力安装工程公司(无匹配ID)
|
||||
COMPANY_SEQ_ID_MAP.put(4L, null);
|
||||
// 序号6:中煤科工重庆工程技术有限公司 -> 对应ID
|
||||
COMPANY_SEQ_ID_MAP.put(6L, 1966461522901282818L);
|
||||
// 序号7:贵州巽顺劳务服务有限公司 -> 对应ID
|
||||
COMPANY_SEQ_ID_MAP.put(7L, 1966461445860306946L);
|
||||
// 序号8:贵州笔锋电力咨询服务有限责任公司 -> 对应ID
|
||||
COMPANY_SEQ_ID_MAP.put(8L, 1966461353422041089L);
|
||||
// 序号9:贵州瑞维建筑劳务有限公司 -> 对应ID
|
||||
COMPANY_SEQ_ID_MAP.put(9L, 1966461264385355777L);
|
||||
// 序号10:湖南宇达电力工程有限公司 -> 对应ID
|
||||
COMPANY_SEQ_ID_MAP.put(10L, 1966461169623445506L);
|
||||
// 序号11:黔西南州航宇商贸有限公司 -> 对应ID
|
||||
COMPANY_SEQ_ID_MAP.put(11L, 1966461042317930498L);
|
||||
// 序号12:中煤科工重庆设计研究院(集团)有限公司 -> 对应ID
|
||||
COMPANY_SEQ_ID_MAP.put(12L, 1966460958549291009L);
|
||||
// 序号16:贵州黔盛嘉鹏建设有限公司 -> 对应ID
|
||||
COMPANY_SEQ_ID_MAP.put(16L, 1966460872603807746L);
|
||||
// 序号17:上海耀垦建设有限公司 -> 对应ID
|
||||
COMPANY_SEQ_ID_MAP.put(17L, 1966460013996224513L);
|
||||
// 序号18:贵州源梦诚电力工程有限公司 -> 对应ID
|
||||
COMPANY_SEQ_ID_MAP.put(18L, 1966459882005671938L);
|
||||
// 序号19:贵州兰亭电力建设(集团)有限公司 -> 对应ID
|
||||
COMPANY_SEQ_ID_MAP.put(19L, 1966459708873191425L);
|
||||
// 序号20:重庆工业设备安装集团有限公司 -> 对应ID
|
||||
COMPANY_SEQ_ID_MAP.put(20L, 1966459541835034625L);
|
||||
}
|
||||
public void handleContractorId() {
|
||||
List<SubConstructionUser> usersWithoutFacePic = constructionUserService.list(
|
||||
Wrappers.<SubConstructionUser>lambdaQuery()
|
||||
.isNotNull(SubConstructionUser::getGoId)
|
||||
);
|
||||
List<Long> goIds = usersWithoutFacePic.stream().map(SubConstructionUser::getGoId).toList();
|
||||
List<UserFace> userLw = transferDataMapper.getUserLw(goIds);
|
||||
|
||||
|
||||
List<SubConstructionUser> updateList = new ArrayList<>();
|
||||
Map<Long, UserFace> collect = userLw.stream().collect(Collectors.toMap(UserFace::getId, vo -> vo));
|
||||
|
||||
for (SubConstructionUser user : usersWithoutFacePic) {
|
||||
|
||||
UserFace userFace = collect.get(user.getGoId());
|
||||
|
||||
SubConstructionUser update = new SubConstructionUser();
|
||||
update.setId(user.getId());
|
||||
update.setSalary(userFace.getSalary());
|
||||
|
||||
Long s = COMPANY_SEQ_ID_MAP.get(userFace.getLabourserviceId());
|
||||
|
||||
update.setContractorId(s);
|
||||
updateList.add(update);
|
||||
}
|
||||
|
||||
constructionUserService.updateBatchById(updateList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user