Commit 3976f929 authored by zhengyi's avatar zhengyi

报关删单退场业务bug修复

parent 73dd431f
...@@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent; ...@@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO; import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import cn.iocoder.yudao.module.order.dal.dataobject.approval.OrderApprovalDO; import cn.iocoder.yudao.module.order.dal.dataobject.approval.OrderApprovalDO;
import cn.iocoder.yudao.module.order.enums.ApprovalResultStatusEnum; import cn.iocoder.yudao.module.order.enums.ApprovalResultStatusEnum;
import cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum; import cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum;
...@@ -32,11 +33,16 @@ import javax.annotation.Resource; ...@@ -32,11 +33,16 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_UPDATE_REPEAT_COMMIT;
import static cn.iocoder.yudao.module.shipment.controller.admin.constant.Constant.BOX_UPDATE_KEY;
@Validated @Validated
@RestController @RestController
...@@ -53,6 +59,8 @@ public class BoxApprovalController { ...@@ -53,6 +59,8 @@ public class BoxApprovalController {
@Resource @Resource
private OrderApprovalService orderApprovalService; private OrderApprovalService orderApprovalService;
@Resource
private RedisHelper redisHelper;
/* /*
创建出货审批流程 创建出货审批流程
*/ */
...@@ -62,7 +70,20 @@ public class BoxApprovalController { ...@@ -62,7 +70,20 @@ public class BoxApprovalController {
//@PreAuthorize("@ss.hasPermission('ecw:box-approval:create')") //@PreAuthorize("@ss.hasPermission('ecw:box-approval:create')")
public CommonResult<Long> createBoxApproval( public CommonResult<Long> createBoxApproval(
@Valid @RequestBody BoxApprovalCreateReqVO createReqVO) { @Valid @RequestBody BoxApprovalCreateReqVO createReqVO) {
return success(boxApprovalService.createBoxApproval(createReqVO)); String redisKey = MessageFormat.format(BOX_UPDATE_KEY, createReqVO.getShipmentId().toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1) {
return error(ORDER_UPDATE_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
try {
Long id = boxApprovalService.createBoxApproval(createReqVO);
return success(id);
}catch (Exception e){
throw e;
} finally {
redisHelper.delete(redisKey);
}
} }
@PostMapping("/approvalDetail") @PostMapping("/approvalDetail")
......
...@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.i18n.core.I18nMessage; ...@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent; import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.limiter.dynamic.DynamicRateLimiter; import cn.iocoder.yudao.framework.limiter.dynamic.DynamicRateLimiter;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO; import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO; import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.order.dto.ContainerNumberSummaryDto; import cn.iocoder.yudao.module.order.dto.ContainerNumberSummaryDto;
import cn.iocoder.yudao.module.order.dto.OrderCostSummaryDto; import cn.iocoder.yudao.module.order.dto.OrderCostSummaryDto;
...@@ -27,7 +28,9 @@ import com.alibaba.excel.write.metadata.fill.FillConfig; ...@@ -27,7 +28,9 @@ import com.alibaba.excel.write.metadata.fill.FillConfig;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*; import io.swagger.annotations.*;
...@@ -36,16 +39,22 @@ import javax.validation.*; ...@@ -36,16 +39,22 @@ import javax.validation.*;
import javax.servlet.http.*; import javax.servlet.http.*;
import java.io.*; import java.io.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.MessageFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_UPDATE_REPEAT_COMMIT;
import static cn.iocoder.yudao.module.shipment.controller.admin.constant.Constant.BOX_UPDATE_KEY;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.BOX_REPORT_NOT_EXIST; import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.BOX_REPORT_NOT_EXIST;
import cn.iocoder.yudao.module.shipment.vo.box.*; import cn.iocoder.yudao.module.shipment.vo.box.*;
...@@ -62,6 +71,9 @@ public class BoxController { ...@@ -62,6 +71,9 @@ public class BoxController {
@Resource @Resource
private BoxService boxService; private BoxService boxService;
@Resource
private RedisHelper redisHelper;
@Resource @Resource
private FileMakeApi fileMakeApi; private FileMakeApi fileMakeApi;
...@@ -105,7 +117,19 @@ public class BoxController { ...@@ -105,7 +117,19 @@ public class BoxController {
@DynamicRateLimiter(base = "#Headers['Authorization']", permits = 1) @DynamicRateLimiter(base = "#Headers['Authorization']", permits = 1)
@Idempotent(timeout = 5) @Idempotent(timeout = 5)
public CommonResult<Boolean> updateBox(@Valid @RequestBody BoxUpdateReqVO updateReqVO) { public CommonResult<Boolean> updateBox(@Valid @RequestBody BoxUpdateReqVO updateReqVO) {
String redisKey = MessageFormat.format(BOX_UPDATE_KEY, updateReqVO.getId().toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1) {
return error(ORDER_UPDATE_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
try {
boxService.updateBox(updateReqVO); boxService.updateBox(updateReqVO);
} catch (Exception e) {
throw e;
} finally {
redisHelper.delete(redisKey);
}
return success(true); return success(true);
} }
...@@ -330,7 +354,7 @@ public class BoxController { ...@@ -330,7 +354,7 @@ public class BoxController {
public CommonResult exportOrderSummary(BoxSettlementQueryVO query, HttpServletResponse response) throws Exception { public CommonResult exportOrderSummary(BoxSettlementQueryVO query, HttpServletResponse response) throws Exception {
FileMakeReqDTO reqDTO = new FileMakeReqDTO(); FileMakeReqDTO reqDTO = new FileMakeReqDTO();
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("query",JSONObject.toJSONString(query)); jsonObject.put("query", JSONObject.toJSONString(query));
reqDTO.setType(DownloadTypeEnum.SHIPMENT_SUMMERY_EXCEL_EXPORT.getType()); reqDTO.setType(DownloadTypeEnum.SHIPMENT_SUMMERY_EXCEL_EXPORT.getType());
reqDTO.setName("出货应收报表"); reqDTO.setName("出货应收报表");
reqDTO.setFileSuffix("xlsx"); reqDTO.setFileSuffix("xlsx");
......
package cn.iocoder.yudao.module.shipment.controller.admin; package cn.iocoder.yudao.module.shipment.controller.admin;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO; import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import cn.iocoder.yudao.module.shipment.convert.BoxCustomsConvert; import cn.iocoder.yudao.module.shipment.convert.BoxCustomsConvert;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxCustomsDO; import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxCustomsDO;
import cn.iocoder.yudao.module.shipment.service.boxCustoms.BoxCustomsService; import cn.iocoder.yudao.module.shipment.service.boxCustoms.BoxCustomsService;
...@@ -15,14 +16,21 @@ import org.springframework.security.access.prepost.PreAuthorize; ...@@ -15,14 +16,21 @@ import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import javax.validation.*; import javax.validation.*;
import javax.servlet.http.*; import javax.servlet.http.*;
import java.text.MessageFormat;
import java.util.*; import java.util.*;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.TimeUnit;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_UPDATE_REPEAT_COMMIT;
import static cn.iocoder.yudao.module.shipment.controller.admin.constant.Constant.BOX_UPDATE_KEY;
@Validated @Validated
@RestController @RestController
...@@ -33,6 +41,9 @@ public class BoxCustomsController { ...@@ -33,6 +41,9 @@ public class BoxCustomsController {
@Resource @Resource
private BoxCustomsService boxCustomsService; private BoxCustomsService boxCustomsService;
@Resource
private RedisHelper redisHelper;
@PostMapping("/create") @PostMapping("/create")
@ApiOperation("创建报关,use this") @ApiOperation("创建报关,use this")
// @PreAuthorize("@ss.hasPermission('ecw:box-customs:create')") // @PreAuthorize("@ss.hasPermission('ecw:box-customs:create')")
...@@ -44,7 +55,19 @@ public class BoxCustomsController { ...@@ -44,7 +55,19 @@ public class BoxCustomsController {
@ApiOperation("更新报关, use this") @ApiOperation("更新报关, use this")
// @PreAuthorize("@ss.hasPermission('ecw:box-customs:update')") // @PreAuthorize("@ss.hasPermission('ecw:box-customs:update')")
public CommonResult<Boolean> updateBoxCustoms(@Valid @RequestBody BoxCustomsUpdateReqVO updateReqVO) { public CommonResult<Boolean> updateBoxCustoms(@Valid @RequestBody BoxCustomsUpdateReqVO updateReqVO) {
String redisKey = MessageFormat.format(BOX_UPDATE_KEY, updateReqVO.getShipmentId().toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1) {
return error(ORDER_UPDATE_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
try {
boxCustomsService.updateBoxCustoms(updateReqVO); boxCustomsService.updateBoxCustoms(updateReqVO);
}catch (Exception e){
throw e;
} finally {
redisHelper.delete(redisKey);
}
return success(true); return success(true);
} }
......
package cn.iocoder.yudao.module.shipment.controller.admin.constant;
public interface Constant {
String BOX_UPDATE_KEY = "jiedao:box:update:{0}";
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment