领退料优化

This commit is contained in:
mashuai 2025-06-06 18:02:02 +08:00
parent cac137011a
commit 1fb377de60
22 changed files with 379 additions and 157 deletions

View File

@ -41,4 +41,6 @@ public class LeaseMaCodeDto {
@ApiModelProperty(value = "出库方式 0 编码1 数量2 二维码3 RFID, 4 OCR")
private Integer outType;
private String status;
}

View File

@ -247,6 +247,18 @@ public class BackApplyInfoController extends BaseController {
}
}
@ApiOperation(value = "单个退料")
@PreventRepeatSubmit
//@SysLog(title = "单个退料", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改退料任务")
@PostMapping("/backOne")
public AjaxResult backOne(@Valid @RequestBody BackApplyRequestVo dto) {
try {
return backApplyInfoService.backOne(dto);
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}
@ApiOperation(value = "修改退料任务打印状态")
@PreventRepeatSubmit
// @RequiresPermissions("back:info:edit")

View File

@ -102,7 +102,7 @@ public class BackApplyDetails extends BaseEntity {
private BigDecimal num;
/** 状态(0待审批1进行中2已出库3已驳回) */
@ApiModelProperty(value = "状态(0待审批1进行中2已出库3已驳回)")
@ApiModelProperty(value = "状态(0待退料1进行中2已退料3已驳回)")
private String status;
@ApiModelProperty(value = "机具外观判断")

View File

@ -27,6 +27,9 @@ public class BackApplyInfo implements Serializable {
private Boolean isExport;
@ApiModelProperty(value = "是否退料 0 否1 是")
private Integer isBack;
/** ID */
private Long id;

View File

@ -57,4 +57,7 @@ public class BackApplyInfoVo {
@ApiModelProperty(value = "不合格图片")
private List<BmFileInfo> fileInfoList;
@ApiModelProperty(value = "是否完成 (0:未完成 1:已完成)")
private Integer isFinished;
}

View File

@ -360,7 +360,7 @@ public interface BackApplyInfoMapper {
BackApplyInfoVo selectIdList(BackApplyInfoVo dto);
BackApplyInfoVo selectDetails(BackApplyInfoVo dto);
List<BackApplyInfoVo> selectDetails(BackApplyInfoVo dto);
/**
* 查询总站点退料记录数据

View File

@ -185,5 +185,12 @@ public interface IBackApplyInfoService {
* @return
*/
AjaxResult deleteDetailsById(Long id);
/**
* 单个退料
* @param dto
* @return
*/
AjaxResult backOne(BackApplyRequestVo dto);
}

View File

@ -10,7 +10,6 @@ import cn.hutool.core.util.PhoneUtil;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.bonus.common.biz.constant.MaterialConstants;
import com.bonus.common.biz.domain.TypeTreeNode;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
import com.bonus.common.biz.enums.*;
import com.bonus.common.core.exception.ServiceException;
@ -25,7 +24,6 @@ import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.material.common.domain.dto.SelectDto;
import com.bonus.material.common.domain.vo.AgreementVo;
import com.bonus.material.common.mapper.SelectMapper;
import com.bonus.material.lease.domain.vo.LeaseTotalInfo;
import com.bonus.material.ma.mapper.MachineMapper;
import com.bonus.material.purchase.config.RemoteConfig;
import com.bonus.material.settlement.domain.SltAgreementInfo;
@ -76,6 +74,9 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
@Resource
private SelectMapper mapper;
@Resource
private TmTaskMapper tmTaskMapper;
/**
* 查询退料任务
*
@ -343,9 +344,13 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult insertBackApplyInfo(BackApplyRequestVo dto) {
String createBy = "";
if (dto == null || dto.getBackApplyInfo() == null || CollectionUtils.isEmpty(dto.getBackApplyDetailsList())) {
return AjaxResult.error("参数为空,请重新选择后上传!");
}
if (StringUtils.isBlank(dto.getBackApplyInfo().getCreateBy())) {
dto.getBackApplyInfo().setCreateBy(createBy);
}
//对传入的手机号进行校验
if (StringUtils.isNotBlank(dto.getBackApplyInfo().getPhone()) && !PhoneUtil.isMobile(dto.getBackApplyInfo().getPhone())) {
return AjaxResult.error("手机号格式不正确,请重新填写!");
@ -368,37 +373,46 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
}
}
}
for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) {
if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) {
if (backApplyDetails.getNum().compareTo(backApplyDetails.getPreNum())<0 ) {
return AjaxResult.error(backApplyDetails.getTypeName() + "退料数量不能大于预退数量,请重新填写!");
}
}
}
int result = 0;
try {
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId());
String code = genderTaskCode(thisMonthMaxOrder);
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(),
BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus(),
null,thisMonthMaxOrder + 1, code);
TmTask tmTask = new TmTask();
if (dto.getBackApplyInfo().getIsBack() == 1) {
tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(),
BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus(),
null, thisMonthMaxOrder + 1, code);
} else {
tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(),
BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus(),
null, thisMonthMaxOrder + 1, code);
}
tmTask.setCreateTime(DateUtils.getNowDate());
tmTask.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
tmTask.setCreateBy(createBy);
BackApplyInfo backApplyInfo = dto.getBackApplyInfo();
backApplyInfo.setCode(code);
backApplyInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
backApplyInfo.setCreateBy(createBy);
backApplyInfo.setCreateTime(DateUtils.getNowDate());
// 保存退料信息到 tm_task 表中
result += taskMapper.insertTmTask(tmTask);
if (result > 0) {
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), dto.getBackApplyInfo().getAgreementId());
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
tmTaskAgreement.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
tmTaskAgreement.setCreateBy(createBy);
taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
backApplyInfo.setTaskId(tmTask.getTaskId());
/** 设置审批人为默认的李勇 --防止代码冲突 **/
Long peopleId = backApplyInfoMapper.getDirectAuditBy();
backApplyInfo.setDirectAuditBy(peopleId);
/** 设置审批人为默认的李勇 --防止代码冲突 **/
result += backApplyInfoMapper.insertBackApplyInfo(backApplyInfo);
}
// 保存退料详情
result = saveBackApplyDetails(dto, backApplyInfo, result);
result = saveBackApplyDetails(createBy, dto, backApplyInfo, result);
} catch (Exception e) {
log.error("保存退料信息时发生异常: ", e);
}
@ -425,7 +439,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
* @param result
* @return
*/
private int saveBackApplyDetails(BackApplyRequestVo dto, BackApplyInfo backApplyInfo, int result) {
private int saveBackApplyDetails(String createBy, BackApplyRequestVo dto, BackApplyInfo backApplyInfo, int result) {
List<TypeTreeNode> listL4 = new ArrayList<>();
// 针对app二维码扫描时需要根据单位id和工程id获取协议id然后根据协议id获取退料在用数量
if (backApplyInfo.getUnitId() != null && backApplyInfo.getProId() != null) {
@ -452,21 +466,49 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
details.setParentId(backApplyInfo.getId());
details.setAuditNum(details.getPreNum());
details.setStatus(String.valueOf(BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus()));
details.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
details.setCreateBy(createBy);
details.setCreateTime(DateUtils.getNowDate());
// 保存退料详情
// 先根据typeId和parentId查询该类型是否存在
BackApplyDetails backApplyDetails = backApplyInfoMapper.getBackApplyDetailsByTypeIdAndParentId(details);
if (backApplyDetails != null) {
backApplyDetails.setPreNum(details.getPreNum());
result += backApplyInfoMapper.updateDetails(backApplyDetails);
} else {
result += backApplyInfoMapper.insertBackApplyDetails(details);
}
result += backApplyInfoMapper.insertBackApplyDetails(details);
// 处理附件
result = saveBmFileInfo(details, backApplyInfo.getId(), result);
// 判断是否为编码设备并处理附件
result = saveMaCodeBmFileInfo(details, backApplyInfo.getId(), result);
Integer isBack = dto.getBackApplyInfo().getIsBack();
details.setIsFinished(isBack);
result = saveMaCodeBmFileInfo(isBack, details, backApplyInfo.getId(), result);
if (isBack == 1) {
// 更新任务表及退料申请表状态
result += updateTaskAndBackInfo(backApplyInfo);
// 更新结算表
backApplyInfo.setTypeId(details.getTypeId().toString());
List<BackApplyInfo> allList = backApplyInfoMapper.selectBackDetails(backApplyInfo);
if (CollectionUtils.isNotEmpty(allList)) {
List<BackApplyInfo> newList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(details.getMaCodeList())) {
// 将allList和details.getMaCodeList()进行比较如果allList中的typeId和maId与details.getMaCodeList()中的相同
//则进行保留
for (BackApplyInfo applyInfo : allList) {
for (MaCodeDto maCodeDto : details.getMaCodeList()) {
if (applyInfo.getMaId().equals(maCodeDto.getMaId()) && applyInfo.getTypeId().equals(details.getTypeId().toString())) {
newList.add(applyInfo);
}
}
}
} else {
for (BackApplyInfo applyInfo : allList) {
if (applyInfo.getTypeId().equals(details.getTypeId().toString())
&& applyInfo.getBackNum().toString().equals(details.getPreNum().toString())) {
newList.add(applyInfo);
}
}
}
int res = updateSlt4Bean(backApplyInfo, newList);
// 检查机具是否领料
if (res == 0) {
throw new RuntimeException("该机具未被领料使用");
}
}
}
}
return result;
}
@ -499,7 +541,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
* @param result
* @return
*/
private int saveMaCodeBmFileInfo(BackApplyDetails details, Long id, int result) {
private int saveMaCodeBmFileInfo(Integer isBack, BackApplyDetails details, Long id, int result) {
// 设置公共字段
setCommonFields(details, id);
if (CollectionUtils.isNotEmpty(details.getMaCodeList())) {
@ -508,16 +550,6 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
details.setMaId(maCodeDto.getMaId());
details.setPreNum(BigDecimal.valueOf(1));
details.setApDetection(maCodeDto.getApDetection());
/*if ("1".equals(maCodeDto.getApDetection())) {
details.setGoodNum(BigDecimal.valueOf(1));
} else {
details.setGoodNum(BigDecimal.valueOf(0));
}
if ("0".equals(maCodeDto.getApDetection())) {
details.setBadNum(BigDecimal.valueOf(1));
} else {
details.setBadNum(BigDecimal.valueOf(0));
}*/
// 插入 CheckDetails
result += backApplyInfoMapper.insertCheckDetails(details);
if (CollectionUtils.isNotEmpty(maCodeDto.getBmFileInfos())) {
@ -530,6 +562,9 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
result += bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
}
}
if (isBack == 1) {
result += machineMapper.updateStatus(maCodeDto.getMaId(), MaMachineStatusEnum.IN_STORE.getStatus());
}
}
} else {
// 如果 MaCodeList 为空只插入 CheckDetails
@ -548,10 +583,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
details.setCreateBy(SecurityUtils.getUsername());
details.setCreateTime(DateUtils.getNowDate());
details.setStatus("0");
// 默认为 0表示未完成
details.setIsFinished(0);
// 默认返回状态 1
details.setBackStatus("1");
// 默认返回状态 0
details.setBackStatus("0");
}
/**
@ -565,6 +598,10 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
if (dto == null || dto.getBackApplyInfo() == null || dto.getBackApplyInfo().getId() == null || CollectionUtils.isEmpty(dto.getBackApplyDetailsList())) {
return AjaxResult.error("参数为空,请重新选择后上传!");
}
String createBy = "";
if (StringUtils.isBlank(dto.getBackApplyInfo().getCreateBy())) {
dto.getBackApplyInfo().setCreateBy(createBy);
}
//对提交的退料详情数量进行校验
for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) {
if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) {
@ -596,11 +633,15 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
//执行新增操作
BackApplyInfo info = dto.getBackApplyInfo();
info.setUpdateTime(DateUtils.getNowDate());
info.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
info.setUpdateBy(createBy);
info.setCode(backApplyInfo.getCode());
result += backApplyInfoMapper.updateBackApplyInfo(info);
// 保存退料详情
result = saveBackApplyDetails(dto, info, result);
result = saveBackApplyDetails(createBy, dto, info, result);
// 根据任务id修改任务状态
if (dto.getBackApplyInfo().getIsBack() == 1) {
tmTaskMapper.updateTaskStatus(dto.getBackApplyInfo().getTaskId().toString(), BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus());
}
return AjaxResult.success(result);
}
} catch (Exception e) {
@ -649,6 +690,66 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
}
/**
* 单个退料
* @param dto
* @return
*/
@Override
public AjaxResult backOne(BackApplyRequestVo dto) {
//对提交的退料详情数量进行校验
for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) {
if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) {
if (backApplyDetails.getNum().compareTo(backApplyDetails.getPreNum())<0 ) {
return AjaxResult.error(backApplyDetails.getTypeName() + "退料数量不能大于预退数量,请重新填写!");
}
}
}
try {
BackApplyInfo backApplyInfo = dto.getBackApplyInfo();
int result = 0;
for (BackApplyDetails details : dto.getBackApplyDetailsList()) {
if (CollectionUtils.isNotEmpty(details.getMaCodeList())) {
for (MaCodeDto maCodeDto : details.getMaCodeList()) {
backApplyInfo.setTypeId(details.getTypeId().toString());
backApplyInfo.setMaId(maCodeDto.getMaId());
backApplyInfoMapper.updateCheckDetails(backApplyInfo);
}
} else {
backApplyInfo.setTypeId(details.getTypeId().toString());
backApplyInfoMapper.updateCheckDetails(backApplyInfo);
}
// 查询退料相关信息
BackApplyInfoVo vo = new BackApplyInfoVo();
vo.setId(backApplyInfo.getId());
List<BackApplyInfoVo> list = backApplyInfoMapper.selectDetails(vo);
if (CollectionUtils.isNotEmpty(list)) {
// 判断list中的isFinished状态是否都为1
boolean allFinished = list.stream()
.allMatch(item -> item.getIsFinished() != null && item.getIsFinished() == 1);
if (allFinished) {
// 更新任务表及退料申请表状态
result += updateTaskAndBackInfo(backApplyInfo);
tmTaskMapper.updateTaskStatus(dto.getBackApplyInfo().getTaskId().toString(), BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus());
}
}
// 更新结算表
backApplyInfo.setTypeId(details.getTypeId().toString());
List<BackApplyInfo> allList = backApplyInfoMapper.selectBackDetails(backApplyInfo);
if (CollectionUtils.isNotEmpty(allList)) {
int res = updateSlt4Bean(backApplyInfo, allList);
// 检查机具是否领料
if (res == 0) {
throw new RuntimeException("该机具未被领料使用");
}
}
}
} catch (Exception e) {
throw new ServiceException("修改失败,请联系管理员");
}
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
}
/**
* 删除任务信息
* @param backApplyInfo
@ -1408,7 +1509,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
// 根据id以及typeId以及maId查询相关信息
BackApplyInfoVo info = backApplyInfoMapper.selectIdList(dto);
// 查询退料相关信息
BackApplyInfoVo vo = backApplyInfoMapper.selectDetails(dto);
List<BackApplyInfoVo> list = backApplyInfoMapper.selectDetails(dto);
BackApplyInfoVo vo = list.get(0);
BmFileInfo bmFileInfo = new BmFileInfo();
if (dto != null && dto.getTypeId() != null) {
bmFileInfo.setTaskId(dto.getId());
@ -1533,8 +1635,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
* @return
*/
private int updateTaskAndBackInfo(BackApplyInfo backApplyInfo) {
int result = backApplyInfoMapper.updateTaskStatus(backApplyInfo);
result += backApplyInfoMapper.updateBack(backApplyInfo);
backApplyInfo.setTaskStatus(2);
int result = backApplyInfoMapper.updateBack(backApplyInfo);
result += backApplyInfoMapper.updateBackDetails(backApplyInfo);
return result;
}

View File

@ -70,6 +70,17 @@ public class ComplexQueryController extends BaseController {
return AjaxResult.success(complexQueryService.getToolsLedgerDetailsList(bean));
}
/**
* 工器具台账--APP详情查询
* @param bean
* @return
*/
@ApiOperation(value = "工器具台账详情查询")
@GetMapping("/getToolsDetailsList")
public AjaxResult getToolsDetailsList(RetainedEquipmentInfo bean) {
return AjaxResult.success(complexQueryService.getToolsDetailsList(bean));
}
/**
* 保有设备总量查询不带分页
* @param bean

View File

@ -164,17 +164,25 @@ public class RetainedEquipmentInfo {
* 是否伸展APP
*/
private boolean expanded = false;
/**
* 编码
*/
private String maCode;
/**
* 下次检验时间
*/
private String nextCheckTime;
/**
* 检验状态
*/
private String checkStatus;
private String maCode;
/** 本次检验日期 */
@ApiModelProperty(value = "本次检验日期")
private String thisCheckTime;
/** 下次检验日期 */
@ApiModelProperty(value = "下次检验日期")
private String nextCheckTime;
/**
* 状态(0 =正常1= 3个月检测到期2= 1个月检测到期3= 已过期)
*/
private String status;
}

View File

@ -153,6 +153,13 @@ public interface ComplexQueryMapper {
*/
List<RetainedEquipmentInfo> getToolsLedgerList(RetainedEquipmentInfo bean);
/**
* 工器具台账详情查询
* @param bean
* @return
*/
List<RetainedEquipmentInfo> getToolsDetailsList(RetainedEquipmentInfo bean);
/**
* 工器具台账详情查询
* @param bean

View File

@ -117,6 +117,13 @@ public interface ComplexQueryService {
*/
List<RetainedEquipmentInfo> getToolsLedgerList(RetainedEquipmentInfo bean);
/**
* 工器具台账详情查询
* @param bean
* @return
*/
List<RetainedEquipmentInfo> getToolsDetailsList(RetainedEquipmentInfo bean);
/**
* 工器具台账详情查询
* @param bean

View File

@ -17,6 +17,9 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
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;
@ -533,6 +536,55 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
}
}
/**
* 工器具台账详情查询
* @param bean
* @return
*/
@Override
public List<RetainedEquipmentInfo> getToolsDetailsList(RetainedEquipmentInfo bean) {
List<RetainedEquipmentInfo> list = complexQueryMapper.getToolsDetailsList(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");
}
}
}
if (StringUtils.isNotBlank(bean.getStatus())) {
return list.stream().filter(item -> {
return item.getStatus().equals(bean.getStatus());
}).collect(Collectors.toList());
}
}
return list;
}
@Override
public List<RetainedEquipmentInfo> getToolsLedgerDetailsList(RetainedEquipmentInfo bean) {
List<RetainedEquipmentInfo> list =new ArrayList<>();

View File

@ -410,8 +410,6 @@ public class SelectServiceImpl implements SelectService {
List<AgreementVo> list = mapper.getAgreementInfoById(dto);
if (CollectionUtils.isNotEmpty(list)) {
vo = list.get(0);
} else {
return AjaxResult.error("未找到匹配的协议信息");
}
} catch (Exception e) {
log.error("班组id和标段工程id获取协议信息", e);

View File

@ -107,7 +107,7 @@ public class LeaseApplyInfoController extends BaseController {
public AjaxResult getInfo(@NotNull(message = "领料任务ID不能为空") @PathVariable("id") Long id,
@RequestParam(value = "keyWord", required = false) String keyWord,
@RequestParam(value = "publishTask", required = false) String publishTask) {
return success(leaseApplyInfoService.selectLeaseApplyInfoById(id, keyWord, publishTask));
return leaseApplyInfoService.selectLeaseApplyInfoById(id, keyWord, publishTask);
}
@ApiOperation(value = "获取领料任务详细信息")

View File

@ -36,7 +36,6 @@ public class LeaseTotalInfo {
@Excel(name = "计量单位")
private String unitName;
@Excel(name = "预领数量")
@ApiModelProperty(value = "预领料数")
private BigDecimal preNum;
@ -45,7 +44,6 @@ public class LeaseTotalInfo {
private BigDecimal outNum;
@ApiModelProperty(value = "待出库数量")
@Excel(name = "待出库数量")
private BigDecimal pendingNum;
@ApiModelProperty(value = "领料日期")

View File

@ -32,7 +32,7 @@ public interface ILeaseApplyInfoService {
* @param publishTask 发布批次
* @return 领料任务
*/
LeaseApplyRequestVo selectLeaseApplyInfoById(Long id, String keyword, String publishTask);
AjaxResult selectLeaseApplyInfoById(Long id, String keyword, String publishTask);
/**
* 查询领料任务列表

View File

@ -26,7 +26,6 @@ import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.domain.BmAgreementInfo;
import com.bonus.material.basic.domain.BmQrcodeInfo;
import com.bonus.material.basic.domain.RetainedEquipmentInfo;
import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.material.lease.domain.LeaseApplyDetails;
@ -52,7 +51,6 @@ import com.bonus.material.task.mapper.TmTaskAgreementMapper;
import com.bonus.material.task.mapper.TmTaskMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import com.bonus.material.lease.mapper.LeaseApplyInfoMapper;
@ -113,8 +111,9 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
* @return 领料任务
*/
@Override
public LeaseApplyRequestVo selectLeaseApplyInfoById(Long id, String keyword, String publishTask) {
public AjaxResult selectLeaseApplyInfoById(Long id, String keyword, String publishTask) {
try {
List<LeaseMaCodeDto> newCodeList = new ArrayList<>();
LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo();
leaseApplyInfo.setId(id);
Optional<LeaseApplyInfo> optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo));
@ -147,9 +146,20 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
detail.setUseNum(BigDecimal.ZERO);
}
// 获取编码详情
// 移出maCodeList集合中状态不为在库的数据
List<LeaseMaCodeDto> maCodeVoList = leaseApplyDetailsMapper.getCodeList(id, detail.getTypeId());
if (!CollectionUtils.isEmpty(maCodeVoList)) {
if (!CollectionUtils.isEmpty(maCodeVoList)) {
// 将maCodeList不等于2的收集到新集合中
for (LeaseMaCodeDto maCodeVo : maCodeVoList) {
if (StringUtils.isNotBlank(maCodeVo.getStatus()) && !"1".equals(maCodeVo.getStatus())) {
newCodeList.add(maCodeVo);
}
}
}
maCodeVoList = maCodeVoList.stream().filter(maCodeVo -> "1".equals(maCodeVo.getStatus())).collect(Collectors.toList());
detail.setMaCodeList(maCodeVoList);
detail.setPreNum(BigDecimal.valueOf(maCodeVoList.size()));
}
}
}
@ -162,9 +172,25 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
}
}
}
});
return leaseApplyRequestVo;
AjaxResult ajaxResult = AjaxResult.success();
ajaxResult.put("data", leaseApplyRequestVo);
if (!CollectionUtils.isEmpty(newCodeList)) {
// 拼接消息内容
StringBuffer msgBuilder = new StringBuffer("您所选择的编码设备编号");
for (int i = 0; i < newCodeList.size(); i++) {
String code = newCodeList.get(i).getMaCode();
msgBuilder.append(code);
if (i < newCodeList.size() - 1) {
msgBuilder.append(", ");
}
}
msgBuilder.append("已被他人完成出库,请注意查看!");
String msg = msgBuilder.toString();
msg = msg.replaceAll("\n","");
ajaxResult.put("msg", msg);
}
return ajaxResult;
} catch (Exception e) {
// 记录异常日志
System.err.println("Error occurred while selecting lease apply info by ID: " + id + e.getMessage());
@ -245,8 +271,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult insertLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo) {
String nickName = SecurityUtils.getLoginUser().getSysUser().getNickName();
System.err.println("nickName:" + nickName);
log.info("新增接口传参:{}", leaseApplyRequestVo);
if (null == leaseApplyRequestVo.getLeaseApplyInfo()) {
return AjaxResult.error("请先填写领料任务信息");
}
@ -258,7 +283,10 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
return AjaxResult.error("领料出库数量不能大于库存数量");
}
leaseApplyRequestVo.getLeaseApplyInfo().setCreateTime(DateUtils.getNowDate());
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
String createBy = "";
if (StringUtils.isBlank(leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy())) {
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(createBy);
}
try {
int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
String taskCode = genderTaskCode(thisMonthMaxOrder);
@ -273,13 +301,13 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(),thisMonthMaxOrder + 1, taskCode);
}
tmTask.setCreateTime(DateUtils.getNowDate());
tmTask.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
tmTask.setCreateBy(createBy);
tmTaskMapper.insertTmTask(tmTask);
BmAgreementInfo bmAgreementInfo = new BmAgreementInfo();
bmAgreementInfo.setProjectId(leaseApplyRequestVo.getLeaseApplyInfo().getProjectId());
bmAgreementInfo.setTeamId(leaseApplyRequestVo.getLeaseApplyInfo().getTeamId());
bmAgreementInfo.setCreateTime(DateUtils.getNowDate());
bmAgreementInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
bmAgreementInfo.setCreateBy(createBy);
// 先根据班组和工程id查询若存在则直接返回不存在则新增
BmAgreementInfo info = bmAgreementInfoMapper.queryByTeamIdAndProjectId(bmAgreementInfo);
if (info != null) {
@ -320,7 +348,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
});
}
if (count > 0) {
return insertPurchaseCheckDetails(tmTask.getTaskId(),leaseApplyRequestVo.getLeaseApplyDetailsList(), leaseApplyRequestVo.getLeaseApplyInfo().getId(), leaseApplyRequestVo.getLeaseApplyInfo().getIsOut());
return insertPurchaseCheckDetails(createBy, tmTask.getTaskId(),leaseApplyRequestVo.getLeaseApplyDetailsList(), leaseApplyRequestVo.getLeaseApplyInfo().getId(), leaseApplyRequestVo.getLeaseApplyInfo().getIsOut());
} else {
return AjaxResult.error("新增任务失败,lease_apply_info表插入0条");
}
@ -615,6 +643,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
LeaseTotalInfo totalInfo = leaseApplyInfoMapper.getTotalInfo(leaseTotalInfo);
if (totalInfo != null) {
leaseTotalInfo.setPreNum(totalInfo.getPreNum());
leaseTotalInfo.setPendingNum(leaseTotalInfo.getPreNum().subtract(leaseTotalInfo.getOutNum()));
}
preNum = preNum.add(leaseTotalInfo.getPreNum());
outNum = outNum.add(leaseTotalInfo.getOutNum());
@ -804,14 +833,14 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
* @param parentId
* @return
*/
private AjaxResult insertPurchaseCheckDetails(Long taskId, List<LeaseApplyDetails> leaseApplyDetailsList, Long parentId, Integer isOut) {
private AjaxResult insertPurchaseCheckDetails(String createBy, Long taskId, List<LeaseApplyDetails> leaseApplyDetailsList, Long parentId, Integer isOut) {
if (!CollectionUtils.isEmpty(leaseApplyDetailsList)) {
for (LeaseApplyDetails details : leaseApplyDetailsList) {
details.setParentId(parentId); // 设置info.parentId
details.setCreateTime(DateUtils.getNowDate());
details.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
details.setCreateBy(createBy);
LeaseOutDetails record = new LeaseOutDetails();
record.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
record.setCreateBy(createBy);
record.setIsFinished(isOut == 1 ? 1 : 0);
// 领料出库
if (isOut == 1) {
@ -866,7 +895,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
record.setTypeId(Long.parseLong(leaseMaCodeDto.getTypeId()));
int res = leaseOutDetailsMapper.insertLeaseOutDetails(record);
// 更新 (ma_machine 设备表)的状态
machineMapper.updateMaMachineStatus(record, MaMachineStatusEnum.RETURNED_MATERIAL.getStatus());
//machineMapper.updateMaMachineStatus(record, MaMachineStatusEnum.RETURNED_MATERIAL.getStatus());
}
} else {
record.setTypeId(details.getTypeId());
@ -946,11 +975,15 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
@Transactional(rollbackFor = Exception.class)
public boolean updateLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo) {
try {
String createBy = "";
if (StringUtils.isBlank(leaseApplyRequestVo.getLeaseApplyInfo().getCreateBy())) {
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(createBy);
}
// 提取到局部变量中减少重复代码
LeaseApplyInfo leaseApplyInfo = leaseApplyRequestVo.getLeaseApplyInfo();
if (leaseApplyInfo != null && leaseApplyInfo.getId() != null) {
leaseApplyInfo.setUpdateTime(DateUtils.getNowDate());
leaseApplyInfo.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
leaseApplyInfo.setUpdateBy(createBy);
// 去除创建一个新的数组对象直接复用
Long[] ids = {leaseApplyInfo.getId()};
@ -967,7 +1000,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
fileInfo.setModelId(leaseApplyInfo.getId());
fileInfo.setTaskType(2);
fileInfo.setFileType(5L);
fileInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
fileInfo.setCreateBy(createBy);
fileInfo.setCreateTime(DateUtils.getNowDate());
bmFileInfoMapper.insertBmFileInfo(fileInfo);
}
@ -985,7 +1018,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
}
}
}
insertPurchaseCheckDetails(leaseApplyInfo.getTaskId(), leaseApplyRequestVo.getLeaseApplyDetailsList(), leaseApplyInfo.getId(), leaseApplyRequestVo.getLeaseApplyInfo().getIsOut());
insertPurchaseCheckDetails(createBy, leaseApplyInfo.getTaskId(), leaseApplyRequestVo.getLeaseApplyDetailsList(), leaseApplyInfo.getId(), leaseApplyRequestVo.getLeaseApplyInfo().getIsOut());
}
// 修改外层info
leaseApplyInfoMapper.updateLeaseApplyInfo(leaseApplyInfo);
@ -1003,54 +1036,6 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
} catch (Exception e) {
throw new ServiceException("未知异常: " + e.getMessage());
}
/*try {
int result = 0;
// 提取到局部变量中减少重复代码
LeaseApplyInfo leaseApplyInfo = leaseApplyRequestVo.getLeaseApplyInfo();
if (leaseApplyInfo != null && leaseApplyInfo.getId() != null) {
// 去除创建一个新的数组对象直接复用
Long[] ids = {leaseApplyInfo.getId()};
result = leaseApplyInfoMapper.deleteLeaseApplyInfoByIds(ids);
if (result == 0) {
throw new RuntimeException("删除主要任务失败");
}
if (CollectionUtil.isNotEmpty(leaseApplyRequestVo.getLeaseApplyDetailsList())) {
// 业务逻辑代码
result = leaseApplyDetailsMapper.deleteLeaseApplyDetailsByParentIds(ids);
if (result == 0) {
throw new RuntimeException("删除详情任务失败");
}
}
// 查询是否存在文件
BmFileInfo fileInfo = new BmFileInfo();
fileInfo.setTaskId(leaseApplyInfo.getTaskId());
fileInfo.setModelId(leaseApplyInfo.getId());
fileInfo.setTaskType(2);
fileInfo.setFileType(5L);
List<BmFileInfo> bmFileInfos = bmFileInfoMapper.selectBmFileInfoList(fileInfo);
// 删除原有数据
if (!CollectionUtils.isEmpty(bmFileInfos)) {
result = bmFileInfoMapper.deleteBmFileInfoByBizInfo(fileInfo);
if (result == 0) {
throw new RuntimeException("删除文件失败");
}
}
// 重新走新增逻辑
AjaxResult ajaxResult = insertLeaseApplyInfo(leaseApplyRequestVo);
if (!ajaxResult.isSuccess()) {
System.err.println(ajaxResult.get("msg"));
throw new RuntimeException("修改新增数据异常");
}
return true;
}
return false;
} catch (DataAccessException dae) {
throw new ServiceException("数据访问异常: " + dae.getMessage());
} catch (IllegalArgumentException iae) {
throw new ServiceException("非法参数异常: " + iae.getMessage());
} catch (Exception e) {
throw new ServiceException("未知异常: " + e.getMessage());
}*/
}
/**

View File

@ -99,10 +99,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
mm.ma_id AS maId,
mm.ma_code AS maCode,
sd.dict_label AS maStatusName,
mm.ma_status AS maStatus,
mt1.type_name AS typeName,
mt1.type_name AS materialName,
mm.type_id AS typeId,
mt.type_name AS materialName,
mt.type_name AS typeName,
mt2.type_name AS materialType
FROM
lease_out_details lod
@ -116,6 +117,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN slt_agreement_info sai on lod.type_id = sai.type_id
and sai.ma_id = lod.ma_id
LEFT JOIN bm_agreement_info ba ON sai.agreement_id = ba.agreement_id
LEFT JOIN sys_dict_data sd ON mm.ma_status = sd.dict_value
and sd.dict_type = 'ma_machine_status'
WHERE
1 = 1 and mm.ma_status = '2' and mm.type_id = #{typeId}
AND ba.team_id = #{teamId}
@ -163,8 +166,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ba.parent_id AS parentId,
ba.type_id AS typeId,
mt2.type_name AS materialType,
mt.type_name AS typeModel,
mt1.type_name AS typeName,
mt.type_name AS typeName,
mt1.type_name AS materialName,
mt.unit_name AS unitName,
mt.unit_value AS unitValue,
mt.manage_type AS manageType,
@ -178,7 +181,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ba.remark AS remark,
ba.ap_detection AS apDetection,
ba.bad_num AS badNum,
ba.good_num AS goodNum
ba.good_num AS goodNum,
ba.status AS status
FROM
back_apply_details ba
LEFT JOIN ma_type mt ON mt.type_id = ba.type_id and mt.del_flag = 0
@ -200,18 +204,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mm.ma_code as maCode,
bcd.type_id AS typeId,
mt2.type_name AS materialType,
mt.type_name AS materialName,
mt1.type_name AS typeName,
mt.type_name AS typeName,
mt1.type_name AS materialName,
bcd.ap_detection AS apDetection,
mm.ma_status AS maStatus,
sd.dict_label AS maStatusName,
bcd.bad_num AS badNum,
bcd.good_num AS goodNum
bcd.good_num AS goodNum,
mm.ma_status AS maStatus
FROM
back_check_details bcd
left join ma_machine mm on bcd.ma_id = mm.ma_id
left join ma_type mt ON mt.type_id = mm.type_id and mt.del_flag = 0
left join ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = 0
left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = 0
LEFT JOIN sys_dict_data sd ON mm.ma_status = sd.dict_value
and sd.dict_type = 'ma_machine_status'
where bcd.parent_id = #{id}
</select>
@ -233,7 +240,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id
LEFT JOIN ma_machine mm ON bcd.ma_id = mm.ma_id
WHERE
bcd.parent_id = #{id} and (bcd.is_finished is null or bcd.is_finished != 1)
bcd.parent_id = #{id}
<if test="typeId != '' and typeId != null">
and bcd.type_id = #{typeId}
</if>
@ -667,7 +674,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="updateCheckDetails">
update back_check_details set is_finished = '1', update_time = now() where parent_id = #{id} and type_id = #{typeId} and (is_finished is null or is_finished != 1)
update back_check_details set is_finished = '1', update_time = now()
where parent_id = #{id} and type_id = #{typeId} and (is_finished is null or is_finished != 1)
<if test="maId != null">
and ma_id = #{maId}
</if>
</update>
<update id="updateStlInfo">
@ -925,7 +936,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bcd.back_num AS backNum,
bcd.good_num AS passNum,
bcd.bad_num AS unPassNum,
bcd.remark AS unPassReason
bcd.remark AS unPassReason,
bcd.is_finished AS isFinished
FROM
back_check_details bcd
LEFT JOIN ma_type mt ON bcd.type_id = mt.type_id

View File

@ -1198,4 +1198,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and mm.ma_status='1'
</select>
<select id="getToolsDetailsList" resultType="com.bonus.material.basic.domain.RetainedEquipmentInfo">
SELECT
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 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},'%')
</if>
</select>
</mapper>

View File

@ -745,7 +745,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_name as materialModel,
mm.ma_id as maId,
mm.ma_code as maCode,
sd.dict_label as maStatus
sd.dict_label as maStatus,
mm.ma_status as status
FROM
lease_out_details lod
LEFT JOIN ma_machine mm ON lod.ma_id = mm.ma_id

View File

@ -350,39 +350,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getLeaseInfoDetails" resultType="com.bonus.material.lease.domain.vo.LeaseTotalInfo">
SELECT
lad.id AS id,
lad.parent_id AS parentId,
lod.id AS id,
lod.parent_id AS parentId,
mt.type_id AS typeId,
mt2.type_name AS maTypeName,
mt.type_name AS typeName,
mt.manage_type AS manageType,
mt.unit_name AS unitName,
SUM( lad.out_num ) AS outNum,
SUM(IFNULL( lod.pre_num, 0 )) AS preNum,
IF(SUM(IFNULL( lod.pre_num, 0 )) - SUM( lad.out_num ) &lt; 0, 0, SUM(IFNULL( lod.pre_num, 0 )) - SUM( lad.out_num )) as pendingNum,
lad.remark AS remark,
SUM( lod.out_num ) AS outNum,
lod.remark AS remark,
lai.create_time as leaseDate,
lad.create_time as outDate,
lod.create_time as outDate,
bt.team_name as teamName,
bp.pro_name as projectName,
lai.create_by as leasePerson,
lad.create_by as outPerson,
lai.lease_person as leasePerson,
lod.create_by as outPerson,
lai.`code` as code
FROM
lease_out_details lad
LEFT JOIN lease_apply_details lod ON lad.parent_id = lod.parent_id
AND lad.type_id = lod.type_id
LEFT JOIN ma_type mt ON lad.type_id = mt.type_id
lease_out_details lod
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
AND mt.`level` = '4'
AND mt.del_flag = '0'
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
AND mt2.`level` = '3'
AND mt2.del_flag = '0'
LEFT JOIN lease_apply_info lai ON lad.parent_id = lai.id
LEFT JOIN lease_apply_info lai ON lod.parent_id = lai.id
LEFT JOIN bm_team bt on lai.team_id = bt.id
LEFT JOIN bm_project bp ON lai.pro_id = bp.pro_id
WHERE
lad.is_finished = '1'
lod.is_finished = '1'
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[and DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
@ -391,8 +387,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt2.type_name like concat('%', #{keyWord}, '%') or
mt.type_name like concat('%', #{keyWord}, '%') or
lai.`code` like concat('%', #{keyWord}, '%') or
lai.create_by like concat('%', #{keyWord}, '%') or
lad.create_by like concat('%', #{keyWord}, '%') or
lai.lease_person like concat('%', #{keyWord}, '%') or
lod.create_by like concat('%', #{keyWord}, '%') or
bt.team_name like concat('%', #{keyWord}, '%') or
bp.pro_name like concat('%', #{keyWord}, '%')
)