二维码标准箱修改

This commit is contained in:
syruan 2024-12-20 14:01:09 +08:00
parent bc2c414a61
commit 82669b3136
3 changed files with 30 additions and 10 deletions

View File

@ -1,6 +1,7 @@
package com.bonus.material.basic.domain.vo;
import com.bonus.material.basic.domain.BmQrBoxInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@ -17,8 +18,19 @@ import java.util.List;
@Accessors(chain = true)
public class BoxInfoBindVo {
private BmQrBoxInfo boxInfo;
@ApiModelProperty(value = "二维码标准箱ID")
private Long boxId;
private List<BmQrBoxInfo> boxBindList;
@ApiModelProperty(value = "二维码标准箱CODE")
private String boxCode;
@ApiModelProperty(value = "二维码标准箱名称")
private String boxName;
@ApiModelProperty(value = "绑定机具总数")
private Integer bindMaTotal;
@ApiModelProperty(value = "符合条件数量")
private Integer successMaTotal;
}

View File

@ -84,17 +84,22 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
if (boxInfos.isEmpty()) {
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "标准箱编码不存在");
} else if (boxInfos.size() == 1) {
if (boxInfos.get(0).getBoxId() == null) {
if (boxInfos.get(0).getBoxId() == null || boxInfos.get(0).getBoxCode() == null) {
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "标准箱信息异常,请联系运维人员处理");
}
boxInfoBindVo.setBoxInfo(boxInfos.get(0));
boxInfoBindVo.setBoxId(boxInfos.get(0).getBoxId());
boxInfoBindVo.setBoxCode(boxInfos.get(0).getBoxCode());
} else {
return AjaxResult.warn("该二维码已绑定多个标准箱,请联系运维人员处理");
}
List<BmQrBoxInfo> boxBindList = bmQrBoxMapper.getBoxBindList(boxInfoBindVo.getBoxInfo().getBoxId());
List<BmQrBoxInfo> boxBindList = bmQrBoxMapper.getBoxBindList(boxInfoBindVo.getBoxId());
boxBindList.removeIf(Objects::isNull);
boxInfoBindVo.setBoxBindList(boxBindList);
boxInfoBindVo.setBindMaTotal(boxBindList.size());
boxBindList.removeIf(o -> o.getMaStatus() == null);
boxBindList.removeIf(info -> !info.getMaStatus().equals(MaMachineStatusEnum.IN_STORE.getStatus().toString()) &&
!info.getMaStatus().equals(MaMachineStatusEnum.NEW_PURCHASE.getStatus().toString()));
boxInfoBindVo.setSuccessMaTotal(boxBindList.size());
return AjaxResult.success(boxInfoBindVo);
}
@ -195,7 +200,8 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "驳回失败,无此标准箱信息!");
}
bmQrBoxInfo.setBoxCode(null).setBoxName(null).setBoxType(null).setStatus(QrBoxStatusEnum.QR_BOX_STATUS_REJECT.getStatus().toString());
return bmQrBoxMapper.updateBmQrcodeInfoById(bmQrBoxInfo) > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) :
return bmQrBoxMapper.updateBmQrcodeInfoById(bmQrBoxInfo) > 0 ?
AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) :
AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
}
@ -215,9 +221,11 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
} else {
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "接收失败,无此标准箱信息!");
}
bmQrBoxInfo.setBoxCode(null).setBoxName(null).setBoxType(null).setInputUser(SecurityUtils.getUserId())
bmQrBoxInfo.setBoxCode(null).setBoxName(null).setBoxType(null)
.setInputUser(SecurityUtils.getUserId())
.setStatus(QrBoxStatusEnum.QR_BOX_STATUS_ON_RECEIVE.getStatus().toString());
return bmQrBoxMapper.updateBmQrcodeInfoById(bmQrBoxInfo) > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) :
return bmQrBoxMapper.updateBmQrcodeInfoById(bmQrBoxInfo) > 0 ?
AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) :
AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
}

View File

@ -5,7 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.bonus.material.basic.mapper.BmQrBoxMapper">
<select id="findBoxInfoByKey" resultType="com.bonus.material.basic.domain.BmQrBoxInfo">
select * from bm_qrcode_box
select * from bm_qrcode_box bqb
<where>
<if test="boxId != null">and bqb.box_id = #{boxId}</if>
<if test="boxCode != null and boxCode != ''">and bqb.box_code = #{boxCode}</if>