领退料模块调试

This commit is contained in:
mashuai 2025-06-13 14:48:14 +08:00
parent 1ad579d579
commit eede50bdd6
30 changed files with 644 additions and 89 deletions

View File

@ -93,14 +93,4 @@ public class MaterialConstants {
*/
public static final String LEASE_PUBLISH = "LF";
/**
* 内部单位协议
*/
public static final String INNER_PROTOCAL = "1";
/**
* 外部单位协议
*/
public static final String OUTER_PROTOCAL = "2";
}

View File

@ -313,4 +313,9 @@ public class LeaseApplyInfo extends BaseEntity{
@ApiModelProperty(value = "是否电子签名 0 是1 否")
private Integer isElectronicSign;
/**
* 身份证号码
*/
private String idCard;
}

View File

@ -1,11 +1,11 @@
package com.bonus.material.app.controller;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.app.domain.IwsTeamUserVo;
import com.bonus.material.app.service.IwsTeamUserService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -27,18 +27,26 @@ public class IwsTeamUserController {
@GetMapping("/selectUserInfoByUserName")
public AjaxResult selectUserInfoByUserName(String userName) {
if (userName == null || userName.isEmpty()) {
return AjaxResult.error("用户名不能为空");
userName = SecurityUtils.getLoginUser().getUsername();
}
return AjaxResult.success(iwsTeamUserService.selectUserInfoByUserName(userName));
}
@ApiModelProperty(value = "根据身份证号码查询班组信息", notes = "根据身份证号码查询班组信息")
@GetMapping("/selectProjectTeamInfoByIdCard")
public AjaxResult selectProjectTeamInfoByIdCard(String idCard, String projectIds) {
if (idCard == null || idCard.isEmpty()) {
return AjaxResult.error("身份证号码不能为空");
}
return AjaxResult.success(iwsTeamUserService.selectProjectTeamInfoByIdCard(idCard, projectIds));
public AjaxResult selectProjectTeamInfoByIdCard(IwsTeamUserVo dto) {
return AjaxResult.success(iwsTeamUserService.selectProjectTeamInfoByIdCard(dto));
}
/**
* 根据第三方信息修改班组及工程信息
* @param dto
* @return
*/
@PostMapping("/updateTeamProject")
public AjaxResult updateTeamProject(@RequestBody IwsTeamUserVo dto) {
return iwsTeamUserService.updateTeamProject(dto);
}
}

View File

@ -5,6 +5,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author : 阮世耀
* @version : 1.0
@ -58,8 +60,41 @@ public class IwsTeamUserVo extends IwsUserBean{
*/
private String projectName;
/**
* 用户id
*/
private String userId;
/**
* 用户手机号
*/
private String userPhone;
/**
* 真实姓名
*/
private String name;
/**
* i皖送登陆用户名
*/
private String userName;
/**
* 身份证号码
*/
private String idCard;
/**
* 备注
*/
private String remark;
/**
* 工程id集合
*/
private List<String> projectIds;
private List<IwsTeamUserVo> teamList;
}

View File

@ -1,5 +1,6 @@
package com.bonus.material.app.service;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.app.domain.IwsTeamUserVo;
import java.util.List;
@ -22,8 +23,16 @@ public interface IwsTeamUserService {
/**
* 根据身份证号码查询用户所属班组及工程信息
* @param idCard 身份证号码班组长
*
* @param dto
* @return List集合
*/
List<IwsTeamUserVo> selectProjectTeamInfoByIdCard(String idCard, String projectIds);
List<IwsTeamUserVo> selectProjectTeamInfoByIdCard(IwsTeamUserVo dto);
/**
* 根据第三方信息修改班组及工程信息
* @param dto
* @return
*/
AjaxResult updateTeamProject(IwsTeamUserVo dto);
}

View File

@ -1,15 +1,23 @@
package com.bonus.material.app.service.impl;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.common.utils.StringUtils;
import com.bonus.common.biz.enums.HttpCodeEnum;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.app.domain.IwsTeamUserVo;
import com.bonus.material.app.mapper.IwsTeamUserMapper;
import com.bonus.material.app.service.IwsTeamUserService;
import com.bonus.material.basic.domain.BmTeam;
import com.bonus.material.basic.mapper.BmTeamMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author : 阮世耀
@ -19,11 +27,15 @@ import java.util.List;
* @Description: i皖送查询班组信息接口
*/
@Service
@Slf4j
public class IwsTeamUserServiceImpl implements IwsTeamUserService {
@Resource
private IwsTeamUserMapper iwsTeamUserMapper;
@Resource
private BmTeamMapper bmTeamMapper;
/**
* 根据userName查询用户的身份证号码(idCard)
*
@ -32,25 +44,90 @@ public class IwsTeamUserServiceImpl implements IwsTeamUserService {
*/
@Override
public IwsTeamUserVo selectUserInfoByUserName(String userName) {
return iwsTeamUserMapper.selectUserInfoByUserName(userName);
IwsTeamUserVo iwsTeamUserVo = iwsTeamUserMapper.selectUserInfoByUserName(userName);
if (iwsTeamUserVo == null) {
return null;
}
if (StringUtils.isBlank(iwsTeamUserVo.getTeamLeaderIdCard())) {
iwsTeamUserVo.setTeamLeaderIdCard(SecurityUtils.getLoginUser().getUsername());
}
return iwsTeamUserVo;
}
/**
* 根据身份证号码查询用户所属班组及工程信息
*
* @param idCard 身份证号码班组长
* @param dto
* @return List集合
*/
@Override
public List<IwsTeamUserVo> selectProjectTeamInfoByIdCard(String idCard, String projectIds) {
List<IwsTeamUserVo> iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByIdCard(idCard);
public List<IwsTeamUserVo> selectProjectTeamInfoByIdCard(IwsTeamUserVo dto) {
List<IwsTeamUserVo> iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByIdCard(dto.getIdCard());
if (iwsTeamUserVos.isEmpty()) {
if (projectIds == null || projectIds.isEmpty()) {
if (CollectionUtils.isEmpty(dto.getProjectIds())) {
return Collections.emptyList();
}
List<String> ids = Arrays.asList(projectIds.split(","));
List<String> ids = dto.getProjectIds();
iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByProjectIds(ids);
}
return iwsTeamUserVos;
}
/**
* 根据第三方信息修改班组及工程信息
* @param dto
* @return
*/
@Override
public AjaxResult updateTeamProject(IwsTeamUserVo dto) {
log.info("i皖送修改班组信息开始:{}", dto);
// 根据前端传的信息获取班组信息
if (CollectionUtils.isEmpty(dto.getTeamList())) {
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
}
try {
// 根据用户名查询班组信息
BmTeam team = new BmTeam();
team.setCreateUser(SecurityUtils.getLoginUser().getUserid());
List<BmTeam> list = bmTeamMapper.queryByPage(team);
// 先从dto中提取所有teamName到Set中提高查找效率
Set<String> dtoTeamNames = dto.getTeamList().stream()
.map(IwsTeamUserVo::getTeamName)
.collect(Collectors.toSet());
// 对比2个集合根据班组名称找出list中有而dto中没有的元素
List<BmTeam> collect = list.stream().filter(bmTeam -> !dtoTeamNames.contains(bmTeam.getTeamName())).collect(Collectors.toList());
if (!collect.isEmpty()) {
// 走删除逻辑
for (BmTeam bmTeam : collect) {
// 将班组状态改为停用
bmTeam.setStatus("1");
int result = bmTeamMapper.update(bmTeam);
if (result <= 0) {
return AjaxResult.error(HttpCodeEnum.UPDATE_TO_DATABASE.getCode(), HttpCodeEnum.UPDATE_TO_DATABASE.getMsg());
}
}
}
for (IwsTeamUserVo iwsTeamUserVo : dto.getTeamList()) {
BmTeam bmTeam = new BmTeam();
bmTeam.setTeamName(StringUtils.isNotBlank(iwsTeamUserVo.getTeamName()) ? iwsTeamUserVo.getTeamName() : null);
bmTeam.setCreateUser(SecurityUtils.getLoginUser().getUserid());
bmTeam.setRelName(StringUtils.isNotBlank(iwsTeamUserVo.getTeamLeaderName()) ? iwsTeamUserVo.getTeamLeaderName() : null);
bmTeam.setIdCard(StringUtils.isNotBlank(iwsTeamUserVo.getTeamLeaderIdCard()) ? iwsTeamUserVo.getTeamLeaderIdCard() : null);
bmTeam.setProjectId(StringUtils.isNotBlank(iwsTeamUserVo.getProjectId()) ? iwsTeamUserVo.getProjectId() : null);
bmTeam.setRelPhone(StringUtils.isNotBlank(iwsTeamUserVo.getTeamLeaderPhone()) ? iwsTeamUserVo.getTeamLeaderPhone() : null);
// 根据班组名称去bm_team表查询班组信息
BmTeam bmTeam1 = bmTeamMapper.selectByName(bmTeam);
if (bmTeam1 == null) {
// 走新增逻辑
int result = bmTeamMapper.insert(bmTeam);
if (result <= 0) {
return AjaxResult.error(HttpCodeEnum.UPDATE_TO_DATABASE.getCode(), HttpCodeEnum.UPDATE_TO_DATABASE.getMsg());
}
}
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg());
}
}

View File

@ -192,4 +192,9 @@ public class BackApplyInfo implements Serializable {
@ApiModelProperty(value = "计量单位")
private String unitNames;
/**
* 身份证号码
*/
private String idCard;
}

View File

@ -89,10 +89,9 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
//先根据外层id查询上层信息
BackApplyInfo backApplyInfo = backApplyInfoMapper.selectBackApplyInfoById(id);
/** 设置审批人签名url 防止代码冲突 **/
/* *//** 设置审批人签名url 防止代码冲突 **//*
String directAuditUrl = backApplyInfoMapper.getDirectAuditUrl(backApplyInfo);
backApplyInfo.setDirectAuditSignUrl(directAuditUrl);
/** 设置审批人签名url 防止代码冲突 **/
backApplyInfo.setDirectAuditSignUrl(directAuditUrl);*/
backApplyRequestVo.setBackApplyInfo(backApplyInfo);
//查询退料详情信息
@ -351,7 +350,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
return AjaxResult.error("参数为空,请重新选择后上传!");
}
if (StringUtils.isBlank(dto.getBackApplyInfo().getCreateBy())) {
dto.getBackApplyInfo().setCreateBy(createBy);
dto.getBackApplyInfo().setCreateBy(SecurityUtils.getLoginUser().getUsername());
createBy = SecurityUtils.getLoginUser().getUsername();
} else {
createBy = dto.getBackApplyInfo().getCreateBy();
}
@ -605,7 +605,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
}
String createBy = "";
if (StringUtils.isBlank(dto.getBackApplyInfo().getCreateBy())) {
dto.getBackApplyInfo().setCreateBy(createBy);
dto.getBackApplyInfo().setCreateBy(SecurityUtils.getLoginUser().getUsername());
createBy = SecurityUtils.getLoginUser().getUsername();
} else {
createBy = dto.getBackApplyInfo().getCreateBy();
}

View File

@ -37,7 +37,7 @@ public class BmTeamController extends BaseController {
public AjaxResult queryByPage(BmTeam tbTeam) {
try {
if (tbTeam.getIsAll() != null && tbTeam.getIsAll() == 0) {
return AjaxResult.success(bmTeamService.queryByPage(tbTeam));
return AjaxResult.success(bmTeamService.getList(tbTeam));
}
startPage();
List<BmTeam> list = bmTeamService.queryByPage(tbTeam);

View File

@ -60,11 +60,11 @@ public class ComplexQueryController extends BaseController {
}
/**
* 工器具台账详情--APP
* 工器具预警设备数量查询--APP
* @param bean
* @return
*/
@ApiOperation(value = "工器具台账详情查询")
@ApiOperation(value = "工器具预警设备数量查询")
@GetMapping("/getToolsLedgerDetailsList")
public AjaxResult getToolsLedgerDetailsList(RetainedEquipmentInfo bean) {
return AjaxResult.success(complexQueryService.getToolsLedgerDetailsList(bean));
@ -447,4 +447,28 @@ public class ComplexQueryController extends BaseController {
ExcelUtil<MaTypeSelectInfo> util = new ExcelUtil<>(MaTypeSelectInfo.class);
util.exportExcel(response, list, "修试查询--导出一机一档案查询");
}
/**
* 班组库存查询
* @param bean
* @return
*/
@ApiOperation(value = "班组库存查询")
@GetMapping("/getTeamUseNumList")
public AjaxResult getTeamUseNumList(RetainedEquipmentInfo bean) {
List<RetainedEquipmentInfo> list = complexQueryService.getTeamUseNumList(bean);
return AjaxResult.success(list);
}
/**
* 班组预警详情查询
* @param bean
* @return
*/
@ApiOperation(value = "班组预警详情查询")
@GetMapping("/getTeamWarnDetailsList")
public AjaxResult getTeamWarnDetailsList(RetainedEquipmentInfo bean) {
List<RetainedEquipmentInfo> list = complexQueryService.getTeamWarnDetailsList(bean);
return AjaxResult.success(list);
}
}

View File

@ -44,6 +44,9 @@ public class BmProject extends BaseEntity
@ApiModelProperty(value = "关联外部(第三方)的工程ID")
private String externalId;
@ApiModelProperty(value = "工程ID")
private String projectId;
/** 外部(第三方)的工程详情json */
@ApiModelProperty(value = "外部(第三方)的工程详情json")
private String externalInfo;
@ -149,4 +152,7 @@ public class BmProject extends BaseEntity
@ApiModelProperty(value = "往来单位ids")
private int[] unitIds;
@ApiModelProperty(value = "班组名称")
private String teamName;
}

View File

@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 班组管理
@ -85,8 +86,28 @@ public class BmTeam {
*/
private Integer delFlag;
/**
* 班组状态0正常 1停用
*/
private String status;
/**
* 关键字
*/
private String keyWord;
/**
* 工程名称
*/
private String projectName;
/**
* 工程id
*/
private String projectId;
/**
* 班组长账号
*/
private String idCard;
}

View File

@ -185,4 +185,26 @@ public class RetainedEquipmentInfo {
*/
private String status;
/** 正常设备数量 */
private long normalNum;
/** 3个月检测到期设备数量 */
private long threeMonthNum;
/** 1个月检测到期设备数量 */
private long oneMonthNum;
/** 已过期设备数量 */
private long expiredNum;
@ApiModelProperty(value = "班组名称")
private String teamName;
@ApiModelProperty(value = "班组id")
private String teamId;
/**
* 班组长账号
*/
private String teamLeaderIdCard;
}

View File

@ -188,4 +188,18 @@ public interface ComplexQueryMapper {
* @return
*/
List<RetainedEquipmentInfo> getToolsDetailsListByTeam(MaCodeVo bean1);
/**
* 班组库存查询
* @param bean
* @return
*/
List<RetainedEquipmentInfo> getTeamUseNumList(RetainedEquipmentInfo bean);
/**
* 班组库存详情查询
* @param bean
* @return
*/
List<RetainedEquipmentInfo> getTeamUseNumDetailsList(RetainedEquipmentInfo bean);
}

View File

@ -38,4 +38,6 @@ public interface BmTeamService {
* @return
*/
AjaxResult deleteById(BmTeam tbTeam);
List<BmTeam> getList(BmTeam tbTeam);
}

View File

@ -129,5 +129,19 @@ public interface ComplexQueryService {
* @param bean
* @return
*/
List<RetainedEquipmentInfo> getToolsLedgerDetailsList(RetainedEquipmentInfo bean);
RetainedEquipmentInfo getToolsLedgerDetailsList(RetainedEquipmentInfo bean);
/**
* 班组库存查询
* @param bean
* @return
*/
List<RetainedEquipmentInfo> getTeamUseNumList(RetainedEquipmentInfo bean);
/**
* 班组预警详情查询
* @param bean
* @return
*/
List<RetainedEquipmentInfo> getTeamWarnDetailsList(RetainedEquipmentInfo bean);
}

View File

@ -1,5 +1,6 @@
package com.bonus.material.basic.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.PhoneUtil;
import com.bonus.common.biz.enums.HttpCodeEnum;
import com.bonus.common.core.utils.StringUtils;
@ -106,6 +107,17 @@ public class BmTeamServiceImpl implements BmTeamService {
return AjaxResult.error(HttpCodeEnum.UPDATE_TO_DATABASE.getCode(), HttpCodeEnum.UPDATE_TO_DATABASE.getMsg());
}
@Override
public List<BmTeam> getList(BmTeam tbTeam) {
List<BmTeam> list = bmTeamMapper.queryByPage(tbTeam);
if (CollectionUtil.isNotEmpty(list)) {
return list;
}
tbTeam.setIdCard(null);
list = bmTeamMapper.queryByPage(tbTeam);
return list;
}
/**
* 手机号校验方法抽取
* @param tbTeam

View File

@ -8,10 +8,10 @@ import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.domain.*;
import com.bonus.material.basic.domain.vo.MaTypeSelectInfo;
import com.bonus.material.basic.mapper.BmTeamMapper;
import com.bonus.material.basic.mapper.ComplexQueryMapper;
import com.bonus.material.basic.service.ComplexQueryService;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.internal.util.StringHelper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -21,9 +21,7 @@ import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit;
import java.util.*;
@ -41,6 +39,9 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
@Resource
private ComplexQueryMapper complexQueryMapper;
@Resource
private BmTeamMapper bmTeamMapper;
/**
* 工程机具使用列表
* @param bean
@ -559,7 +560,7 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
public List<RetainedEquipmentInfo> getToolsDetailsList(RetainedEquipmentInfo bean) {
try {
//1获取当前用户Id
String userId = SecurityUtils.getUserId().toString();
String userId = SecurityUtils.getLoginUser().getUserid().toString();
//2判断用户是否为班组长且对应的是否有班组
BmTeam bmTeam=complexQueryMapper.getTeamData(userId);
List<RetainedEquipmentInfo> list = new ArrayList<>();
@ -620,25 +621,142 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
}
@Override
public List<RetainedEquipmentInfo> getToolsLedgerDetailsList(RetainedEquipmentInfo bean) {
List<RetainedEquipmentInfo> list =new ArrayList<>();
public RetainedEquipmentInfo getToolsLedgerDetailsList(RetainedEquipmentInfo bean) {
List<RetainedEquipmentInfo> list = new ArrayList<>();
try {
list = complexQueryMapper.getToolsLedgerDetailsList(bean);
if (list.size() > 0) {
for (RetainedEquipmentInfo bean1 : list) {
if (!StringHelper.isNullOrEmptyString(bean1.getNextCheckTime())){
//时间数据处理
bean1.setCheckStatus(determineCheckStatus(bean1.getNextCheckTime()));;
// 先根据用户名去查班组信息
String username = SecurityUtils.getLoginUser().getUsername();
BmTeam bmTeam = new BmTeam();
bmTeam.setIdCard(username);
List<BmTeam> teamList = bmTeamMapper.queryByPage(bmTeam);
if (CollectionUtil.isNotEmpty(teamList)) {
bean.setTeamLeaderIdCard(username);
list = complexQueryMapper.getTeamUseNumDetailsList(bean);
} else {
list = complexQueryMapper.getToolsLedgerDetailsList(bean);
}
if (!CollectionUtil.isEmpty(list)) {
for (RetainedEquipmentInfo retainedEquipmentInfo : list) {
if (StringUtils.isNotBlank(retainedEquipmentInfo.getNextCheckTime())) {
String nextCheckTime = retainedEquipmentInfo.getNextCheckTime();
// 解析字符串日期格式yyyy-MM-dd
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate targetDate = LocalDate.parse(nextCheckTime, formatter);
// 当前日期
LocalDate currentDate = LocalDate.now();
boolean isFuture = targetDate.isAfter(currentDate);
if (!isFuture) {
// 已过期
retainedEquipmentInfo.setStatus("3");
continue;
}
Period period = Period.between(currentDate, targetDate);
int years = period.getYears();
int months = period.getMonths();
int days = period.getDays();
// 计算累计月份差向上取整
int totalMonths = years * 12 + months;
if (days > 0 || targetDate.getDayOfMonth() > currentDate.getDayOfMonth()) {
totalMonths++;
}
if (totalMonths <= 1) {
retainedEquipmentInfo.setStatus("2");
} else if (totalMonths <= 3) {
retainedEquipmentInfo.setStatus("1");
} else {
retainedEquipmentInfo.setStatus("0");
}
}
}
// 获取list集合中状态为0的元素的总数
RetainedEquipmentInfo retainedEquipmentInfo = new RetainedEquipmentInfo();
long normalNum = list.stream().filter(item -> "0".equals(item.getStatus())).count();
retainedEquipmentInfo.setNormalNum(normalNum);
long threeMonthNum = list.stream().filter(item -> "1".equals(item.getStatus())).count();
retainedEquipmentInfo.setThreeMonthNum(threeMonthNum);
long oneMonthNum = list.stream().filter(item -> "2".equals(item.getStatus())).count();
retainedEquipmentInfo.setOneMonthNum(oneMonthNum);
long expiredNum = list.stream().filter(item -> "3".equals(item.getStatus())).count();
retainedEquipmentInfo.setExpiredNum(expiredNum);
return retainedEquipmentInfo;
}
} catch (Exception e){
log.error("获取设备详情列表失败,参数:{}", bean, e);
}
return new RetainedEquipmentInfo();
}
/**
* 班组库存查询
* @param bean
* @return
*/
@Override
public List<RetainedEquipmentInfo> getTeamUseNumList(RetainedEquipmentInfo bean) {
List<RetainedEquipmentInfo> list = complexQueryMapper.getTeamUseNumList(bean);
if (CollectionUtils.isNotEmpty(list)) {
for (RetainedEquipmentInfo retainedEquipmentInfo : list) {
RetainedEquipmentInfo info = new RetainedEquipmentInfo();
info.setTypeId(retainedEquipmentInfo.getTypeId());
List<RetainedEquipmentInfo> teamUseNumDetailsList = complexQueryMapper.getTeamUseNumDetailsList(info);
if (CollectionUtils.isNotEmpty(teamUseNumDetailsList)) {
retainedEquipmentInfo.setModelList(teamUseNumDetailsList);
}
}
}
return list;
}
/**
* 班组预警详情查询
* @param bean
* @return
*/
@Override
public List<RetainedEquipmentInfo> getTeamWarnDetailsList(RetainedEquipmentInfo bean) {
List<RetainedEquipmentInfo> list = complexQueryMapper.getTeamUseNumDetailsList(bean);
if (!CollectionUtil.isEmpty(list)) {
// 将list中manageType为0的数据过滤出来
list = list.stream().filter(item -> "0".equals(item.getManageType())).collect(Collectors.toList());
for (RetainedEquipmentInfo retainedEquipmentInfo : list) {
if (StringUtils.isNotBlank(retainedEquipmentInfo.getNextCheckTime())) {
String nextCheckTime = retainedEquipmentInfo.getNextCheckTime();
// 解析字符串日期格式yyyy-MM-dd
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate targetDate = LocalDate.parse(nextCheckTime, formatter);
// 当前日期
LocalDate currentDate = LocalDate.now();
boolean isFuture = targetDate.isAfter(currentDate);
if (!isFuture) {
// 已过期
retainedEquipmentInfo.setStatus("3");
continue;
}
Period period = Period.between(currentDate, targetDate);
int years = period.getYears();
int months = period.getMonths();
int days = period.getDays();
// 计算累计月份差向上取整
int totalMonths = years * 12 + months;
if (days > 0 || targetDate.getDayOfMonth() > currentDate.getDayOfMonth()) {
totalMonths++;
}
if (totalMonths <= 1) {
retainedEquipmentInfo.setStatus("2");
} else if (totalMonths <= 3) {
retainedEquipmentInfo.setStatus("1");
} else {
bean1.setCheckStatus("");
retainedEquipmentInfo.setStatus("0");
}
}
}
return list;
} catch (Exception e){
log.error("获取设备详情列表失败,参数:{}", bean, e);
return new ArrayList<>();
if (StringUtils.isNotBlank(bean.getStatus())) {
return list.stream().filter(item -> {
return item.getStatus().equals(bean.getStatus());
}).collect(Collectors.toList());
}
}
return list;
}
/**

View File

@ -36,6 +36,12 @@ public class SelectController {
return service.getProjectList(bmProject);
}
@ApiOperation(value = "工程下拉选")
@PostMapping("getProjectInfo")
public AjaxResult getProjectInfo(@RequestBody BmProject bmProject) {
return service.getProjectInfo(bmProject);
}
@ApiOperation(value = "机具类型下拉选")
@PostMapping("getMaTypeData")
public AjaxResult getMaTypeData(@RequestBody SelectDto dto){

View File

@ -178,4 +178,6 @@ public interface SelectMapper {
* @return
*/
List<SelectVo> getBranchProject();
List<BmProject> getProjectInfo(BmProject bmProject);
}

View File

@ -212,4 +212,11 @@ public interface SelectService {
* @return
*/
AjaxResult getBranchProject();
/**
* 工程下拉选
* @param bmProject
* @return
*/
AjaxResult getProjectInfo(BmProject bmProject);
}

View File

@ -126,6 +126,21 @@ public class SelectServiceImpl implements SelectService {
}
}
/**
* 工程下拉选
* @param bmProject
* @return
*/
@Override
public AjaxResult getProjectInfo(BmProject bmProject) {
List<BmProject> list = new ArrayList<>();
if (bmProject.getIsApp() != null && bmProject.getIsApp()) {
list = mapper.getProjectInfo(bmProject);
list.removeIf(Objects::isNull);
}
return AjaxResult.success(list);
}
// @Override
// public AjaxResult getDictByPidCbx(SelectDto dto) {
// List<SelectVo> list = new ArrayList<>();

View File

@ -125,7 +125,7 @@ public class LeaseApplyDetails extends BaseEntity {
* 装备管理方式(0编号 1计数)
*/
@ApiModelProperty(name = "装备管理方式")
private int manageType;
private String manageType;
/** 状态0待审批1进行中2已出库 */
private String status;

View File

@ -278,6 +278,17 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
if (CollectionUtil.isEmpty(leaseApplyRequestVo.getLeaseApplyDetailsList())) {
return AjaxResult.error("请先添加领料任务物资明细");
}
Integer isOut = leaseApplyRequestVo.getLeaseApplyInfo().getIsOut();
// 对于编码出库的设备进行出库时需校验编码明细
if (isOut == 1) {
for (LeaseApplyDetails leaseApplyDetails : leaseApplyRequestVo.getLeaseApplyDetailsList()) {
if ("0".equals(leaseApplyDetails.getManageType())) {
if (CollectionUtils.isEmpty(leaseApplyDetails.getMaCodeList())) {
return AjaxResult.error("请先添加领料任务物资编码明细");
}
}
}
}
int res = checkStorageNum(leaseApplyRequestVo.getLeaseApplyDetailsList());
if (res == 0) {
return AjaxResult.error("领料出库数量不能大于库存数量");
@ -285,7 +296,8 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
leaseApplyRequestVo.getLeaseApplyInfo().setCreateTime(DateUtils.getNowDate());
String createBy = "";
if (StringUtils.isBlank(leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy())) {
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(createBy);
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getLoginUser().getUsername());
createBy = SecurityUtils.getLoginUser().getUsername();
} else {
createBy = leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy();
}
@ -621,7 +633,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
lease.setPreNum(detail.getPreNum());
lease.setStorageNum(detail.getStorageNum());
lease.setOutNum(detail.getOutNum());
lease.setManageType(detail.getManageType() == 0 ? "数量管理" : "编码管理");
lease.setManageType("0".equals(detail.getManageType()) ? "数量管理" : "编码管理");
lease.setRemark(detail.getRemark() == null ? "" : detail.getRemark());
leaseOutDetails.add(lease);
}
@ -977,12 +989,30 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo) {
if (null == leaseApplyRequestVo.getLeaseApplyInfo()) {
throw new ServiceException("请先填写领料任务信息");
}
if (CollectionUtil.isEmpty(leaseApplyRequestVo.getLeaseApplyDetailsList())) {
throw new ServiceException("请先添加领料任务物资明细");
}
Integer isOut = leaseApplyRequestVo.getLeaseApplyInfo().getIsOut();
// 对于编码出库的设备进行出库时需校验编码明细
if (isOut == 1) {
for (LeaseApplyDetails leaseApplyDetails : leaseApplyRequestVo.getLeaseApplyDetailsList()) {
if ("0".equals(leaseApplyDetails.getManageType())) {
if (CollectionUtils.isEmpty(leaseApplyDetails.getMaCodeList())) {
throw new ServiceException("请先添加领料任务物资编码明细");
}
}
}
}
try {
String createBy = "";
if (StringUtils.isBlank(leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy())) {
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(createBy);
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getLoginUser().getUsername());
createBy = SecurityUtils.getLoginUser().getUsername();
} else {
createBy = leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy();
createBy = leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy();
}
// 提取到局部变量中减少重复代码
LeaseApplyInfo leaseApplyInfo = leaseApplyRequestVo.getLeaseApplyInfo();

View File

@ -22,8 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bzgl_bz.bz as remark, bzgl_bz.bz_status as teamStatus, bzgl_bz.project_id as projectId,
bzgl_bz.project_name as projectName, org_user.mobile as teamLeaderPhone
from
`micro-tool`.bzgl_bz
left join `uni_org`.org_user on bzgl_bz.bzz_idcard = org_user.id_card
`micro-tool`.bzgl_bz bzgl_bz
left join `uni_org`.org_user org_user on bzgl_bz.bzz_idcard = org_user.id_card
<where>
and bzgl_bz.bz_status = 3
and bzgl_bz.sfjs = 0
@ -33,11 +33,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectProjectTeamInfoByProjectIds" resultType="com.bonus.material.app.domain.IwsTeamUserVo">
select
id, bzmc as teamName, bzz_name as teamLeaderName, bzz_idcard as teamLeaderIdCard,
bz as remark, bz_status as teamStatus, project_id as projectId, project_name as projectName
bzgl_bz.id, bzgl_bz.bzmc as teamName, bzgl_bz.bzz_name as teamLeaderName, bzgl_bz.bzz_idcard as teamLeaderIdCard,
bzgl_bz.bz as remark, bzgl_bz.bz_status as teamStatus, bzgl_bz.project_id as projectId, bzgl_bz.project_name as projectName,
bzgl_bz.bzz_idcard as teamLeaderIdCard, org_user.mobile as teamLeaderPhone
from
`micro-tool`.bzgl_bz
WHERE project_id IN
`micro-tool`.bzgl_bz bzgl_bz
left join `uni_org`.org_user org_user on bzgl_bz.bzz_idcard = org_user.id_card
WHERE bzgl_bz.project_id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>

View File

@ -83,6 +83,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">
and tt.task_status = #{status}
</if>
<if test="idCard != null and idCard != ''">
and bt.bzz_idcard = #{idCard}
</if>
GROUP BY bai.`code`
ORDER BY bai.create_time desc
</select>

View File

@ -12,7 +12,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="relPhone != null">rel_phone,</if>
create_time,
<if test="createUser != null">create_by,</if>
del_flag
del_flag,
<if test="projectId != null">project_id,</if>
<if test="idCard != null">bzz_idcard,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="teamName != null">#{teamName},</if>
@ -21,7 +23,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="relPhone != null">#{relPhone},</if>
NOW(),
<if test="createUser != null">#{createUser},</if>
0
0,
<if test="projectId != null">#{projectId},</if>
<if test="idCard != null">#{idCard},</if>
</trim>
</insert>
@ -33,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="relName != null">rel_name = #{relName},</if>
<if test="relPhone != null">rel_phone = #{relPhone},</if>
<if test="updateUser != null">update_by = #{updateUser},</if>
<if test="status != null">status = #{status},</if>
update_time = NOW()
</set>
WHERE id = #{id}
@ -55,13 +60,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t.create_by as createUser,
t.update_time as updateTime,
t.update_by as updateUser,
t.del_flag as delFlag
t.del_flag as delFlag,
t.bzz_idcard as teamLeaderIdCard
from bm_team t
left join bm_pro_depart sd on t.depart_id = sd.id
where t.del_flag = 0 and sd.del_flag = 0
where t.del_flag = 0
<if test="departId != null ">
and t.depart_id = #{departId}
</if>
<if test="createUser != null">
and t.create_by = #{createUser}
</if>
<if test="idCard != null">
and t.bzz_idcard = #{idCard}
</if>
<if test="keyWord != null and keyWord != ''">
and (
t.team_name like concat('%', #{keyWord}, '%') or
@ -78,7 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
rel_phone as relPhone, create_time as createTime, create_by as createUser,
update_time as updateTime, update_by as updateUser, del_flag as delFlag
from bm_team
where del_flag = 0
where del_flag = 0 and status = '0'
<if test="teamName != null and teamName != ''">
and team_name = #{teamName}
</if>

View File

@ -1180,22 +1180,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and mt.del_flag = '0'
and mt2.type_name is not null
and mt2.type_id is not null
<if test="keyWord != null and keyWord != ''">
and (mt2.type_name like concat('%',#{keyWord},'%')
OR mt.type_name like concat('%',#{keyWord},'%') )
</if>
</select>
<select id="getToolsLedgerDetailsList" resultType="com.bonus.material.basic.domain.RetainedEquipmentInfo">
SELECT
mt1.type_id as typeId,
mt2.type_name as typeName,
mt1.type_name as typeModelName,
mm.ma_code as maCode,
mm.next_check_time as nextCheckTime
mt1.type_name as typeName,
mt.type_name as typeModelName,
mm.ma_code as maCode,
msc.this_check_time as thisCheckTime,
msc.next_check_time as nextCheckTime
FROM
ma_machine mm
LEFT JOIN ma_type mt1 on mt1.type_id=mm.type_id and mt1.del_flag=0
LEFT JOIN ma_type mt2 on mt2.type_id=mt1.parent_id and mt2.del_flag=0
WHERE
mm.type_id=#{typeId}
and mm.ma_status='1'
ma_machine mm
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
LEFT JOIN ma_station_code msc ON mm.ma_code = msc.ma_code
WHERE 1 = 1
<if test="typeId != null">
AND mt.type_id = #{typeId}
</if>
<if test="maCode != null and maCode != ''">
AND mm.ma_code like concat('%',#{maCode},'%')
</if>
</select>
<select id="getTeamData" resultType="com.bonus.material.basic.domain.BmTeam">
SELECT bt.id,
@ -1328,9 +1337,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
LEFT JOIN ma_station_code msc ON mm.ma_code = msc.ma_code
WHERE mm.ma_status = '1' and mt.type_id = #{typeId}
<if test="maCode != null and maCode != ''">
AND mm.ma_code like concat('%',#{maCode},'%')
WHERE mm.ma_status = '1'
<if test="typeId != null">
AND mt.type_id = #{typeId}
</if>
<if test="keyWord != null and keyWord != ''">
AND (mm.ma_code like concat('%',#{keyWord},'%')
OR mt1.type_name like concat('%',#{keyWord},'%')
OR mt.type_name like concat('%',#{keyWord},'%'))
</if>
</select>
<select id="getToolsDetailsListByTeam" resultType="com.bonus.material.basic.domain.RetainedEquipmentInfo">
@ -1385,4 +1399,85 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_station_code msc on mm.ma_code = msc.ma_code
</select>
<select id="getTeamUseNumList" resultType="com.bonus.material.basic.domain.RetainedEquipmentInfo">
SELECT
bt.team_name AS teamName,
mt.type_name AS typeModelName,
mt2.type_name AS typeName,
SUM(IFNULL(sai.num, 0)) AS usNum,
mt2.type_id AS typeId
FROM
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_team bt ON bai.team_id = bt.id
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
WHERE
sai.end_time IS NULL
AND sai.back_id IS NULL
<if test="teamId != null">
AND bt.id = #{teamId}
</if>
<if test="teamName != null">
AND bt.team_name LIKE concat('%',#{teamName},'%')
</if>
<if test="keyWord != null and keyWord != ''">
AND (
mt2.type_name LIKE concat('%',#{keyWord},'%')
OR mt.type_name LIKE concat('%',#{keyWord},'%')
OR bt.team_name LIKE concat('%',#{keyWord},'%')
)
</if>
GROUP BY
bt.team_name,
mt2.type_name;
</select>
<select id="getTeamUseNumDetailsList" resultType="com.bonus.material.basic.domain.RetainedEquipmentInfo">
SELECT
bt.team_name AS teamName,
mt.type_name AS typeModelName,
mt2.type_name AS typeName,
SUM(IFNULL(sai.num, 0)) AS usNum,
mm.ma_code AS maCode,
msc.this_check_time AS thisCheckTime,
msc.next_check_time AS nextCheckTime,
mt.manage_type AS manageType
FROM
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_team bt ON bai.team_id = bt.id
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
LEFT JOIN ma_station_code msc ON mm.ma_code = msc.ma_code
WHERE
sai.end_time IS NULL
AND sai.back_id IS NULL
<if test="typeId != null">
and mt2.type_id = #{typeId}
</if>
<if test="teamId != null">
AND bt.id = #{teamId}
</if>
<if test="teamName != null">
AND bt.team_name LIKE concat('%',#{teamName},'%')
</if>
<if test="teamLeaderIdCard != null">
AND bt.bzz_idcard = #{teamLeaderIdCard}
</if>
<if test="keyWord != null and keyWord != ''">
AND (
mt2.type_name LIKE concat('%',#{keyWord},'%')
OR mt.type_name LIKE concat('%',#{keyWord},'%')
OR bt.team_name LIKE concat('%',#{keyWord},'%')
OR mm.ma_code LIKE concat('%',#{keyWord},'%')
)
</if>
GROUP BY
mt.type_name,
mt2.type_name,
mm.ma_code
</select>
</mapper>

View File

@ -345,10 +345,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE bu.unit_id = #{unitId} AND bu.del_flag = '0'
</if>
<if test="unitId == null">
SELECT pro_id AS proId,
pro_name AS proName
FROM bm_project
WHERE del_flag = '0'
SELECT
bp.pro_id AS proId,
bp.pro_name AS proName
FROM
bm_project bp
LEFT JOIN bm_team bt ON bp.external_id = bt.project_id
WHERE
bp.del_flag = '0'
<if test="teamName != null and teamName != ''">
AND bt.team_name = #{teamName}
</if>
</if>
</select>
@ -404,4 +411,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE dict_type = 'branch_project'
and `status` = 0
</select>
<select id="getProjectInfo" resultType="com.bonus.material.basic.domain.BmProject">
SELECT
bp.pro_id AS proId,
bp.pro_name AS proName,
external_id AS projectId
FROM
bm_project bp
WHERE
bp.del_flag = '0'
</select>
</mapper>

View File

@ -103,6 +103,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="estimateLeaseTime != null "> and lai.estimate_lease_time = #{estimateLeaseTime}</if>
<if test="costBearingParty != null and costBearingParty != ''"> and lai.cost_bearing_party = #{costBearingParty}</if>
and tt.task_type = '2' and lai.lease_style = '1'
<if test="idCard != null and idCard != ''">
AND bt.bzz_idcard = #{idCard}
</if>
</where>
GROUP BY lai.id
ORDER BY tt.task_status,tt.create_time desc