新购绑定

This commit is contained in:
mashuai 2024-10-23 11:12:46 +08:00
parent 30364e6b19
commit 0013ceeed0
4 changed files with 29 additions and 5 deletions

View File

@ -89,7 +89,7 @@ public class PurchaseBindController extends BaseController {
@ApiOperation(value = "二维码生成下载") @ApiOperation(value = "二维码生成下载")
@PostMapping(value = "/downloadQrCode") @PostMapping(value = "/downloadQrCode")
@PreventRepeatSubmit @PreventRepeatSubmit
//@RequiresPermissions("purchase:bind:download") @RequiresPermissions("purchase:bind:download")
public void downloadQrCode(HttpServletResponse response, PurchaseDto purchaseDto) { public void downloadQrCode(HttpServletResponse response, PurchaseDto purchaseDto) {
purchaseBindService.downloadQrCode(response, purchaseDto); purchaseBindService.downloadQrCode(response, purchaseDto);
} }

View File

@ -80,4 +80,12 @@ public interface PurchaseBindMapper {
* @param purchaseId * @param purchaseId
*/ */
void updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") String purchaseId); void updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") String purchaseId);
/**
* 更新数量
* @param dto
* @param num
* @return
*/
int updateNum(@Param("dto") PurchaseDto dto, @Param("num") int num);
} }

View File

@ -154,8 +154,20 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
purchaseDto.setCreateTime(DateUtils.getNowDate()); purchaseDto.setCreateTime(DateUtils.getNowDate());
purchaseDto.setTaskId(dto.getTaskId()); purchaseDto.setTaskId(dto.getTaskId());
purchaseDto.setTypeId(dto.getTypeId()); purchaseDto.setTypeId(dto.getTypeId());
purchaseDto.setStatus(0);
result += purchaseBindMapper.add(purchaseDto); result += purchaseBindMapper.add(purchaseDto);
} }
//根据前端传参更新绑定数量
result += purchaseBindMapper.updateNum(dto, dto.getDtoList().size());
//根据任务id和类型id查询状态
List<PurchaseVo> voList = purchaseBindMapper.selectPurchaseCheckInfoById(dto);
if (CollectionUtils.isNotEmpty(voList)) {
for (PurchaseVo purchaseVo : voList) {
if (purchaseVo.getBindNum().equals(purchaseVo.getCheckNum())) {
}
}
}
if (result > 0) { if (result > 0) {
return AjaxResult.success("绑定成功"); return AjaxResult.success("绑定成功");
} }

View File

@ -88,9 +88,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateNum"> <update id="updateNum">
UPDATE purchase_check_details UPDATE purchase_check_details
SET input_num = #{purchaseNum} SET bind_num = bind_num + COALESCE(#{num}, 0)
WHERE WHERE task_id = #{dto.taskId}
id = #{id} AND type_id = #{dto.typeId}
AND #{num} IS NOT NULL
</update> </update>
<update id="updateStatusById"> <update id="updateStatusById">
@ -171,6 +172,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
pcd.production_time AS productDate, pcd.production_time AS productDate,
pm.qr_code AS qrCode, pm.qr_code AS qrCode,
pm.qr_url AS qrUrl, pm.qr_url AS qrUrl,
pcd.check_num AS purchaseNum,
pcd.check_num AS checkNum,
pcd.bind_num AS bindNum,
pcd.status AS status pcd.status AS status
FROM FROM
purchase_macode_info pm purchase_macode_info pm
@ -245,7 +249,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM FROM
purchase_macode_info purchase_macode_info
WHERE WHERE
DATE_FORMAT(create_time, '%Y-%m') = #{genMonth} DATE_FORMAT(create_time, '%Y-%m') = #{genMonth} and ma_code is not null
ORDER BY ORDER BY
qr_code DESC qr_code DESC
</select> </select>