Commit 3976f929 authored by zhengyi's avatar zhengyi

报关删单退场业务bug修复

parent 73dd431f
......@@ -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.vo.PageVO;
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.enums.ApprovalResultStatusEnum;
import cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum;
......@@ -32,11 +33,16 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Collection;
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.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
@RestController
......@@ -53,6 +59,8 @@ public class BoxApprovalController {
@Resource
private OrderApprovalService orderApprovalService;
@Resource
private RedisHelper redisHelper;
/*
创建出货审批流程
*/
......@@ -62,7 +70,20 @@ public class BoxApprovalController {
//@PreAuthorize("@ss.hasPermission('ecw:box-approval:create')")
public CommonResult<Long> createBoxApproval(
@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")
......
......@@ -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.limiter.dynamic.DynamicRateLimiter;
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.order.dto.ContainerNumberSummaryDto;
import cn.iocoder.yudao.module.order.dto.OrderCostSummaryDto;
......@@ -27,7 +28,9 @@ import com.alibaba.excel.write.metadata.fill.FillConfig;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
......@@ -36,16 +39,22 @@ import javax.validation.*;
import javax.servlet.http.*;
import java.io.*;
import java.math.BigDecimal;
import java.text.MessageFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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 cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
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 cn.iocoder.yudao.module.shipment.vo.box.*;
......@@ -62,6 +71,9 @@ public class BoxController {
@Resource
private BoxService boxService;
@Resource
private RedisHelper redisHelper;
@Resource
private FileMakeApi fileMakeApi;
......@@ -105,7 +117,19 @@ public class BoxController {
@DynamicRateLimiter(base = "#Headers['Authorization']", permits = 1)
@Idempotent(timeout = 5)
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);
} catch (Exception e) {
throw e;
} finally {
redisHelper.delete(redisKey);
}
return success(true);
}
......@@ -330,7 +354,7 @@ public class BoxController {
public CommonResult exportOrderSummary(BoxSettlementQueryVO query, HttpServletResponse response) throws Exception {
FileMakeReqDTO reqDTO = new FileMakeReqDTO();
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.setName("出货应收报表");
reqDTO.setFileSuffix("xlsx");
......
package cn.iocoder.yudao.module.shipment.controller.admin;
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.dal.dataobject.BoxCustomsDO;
import cn.iocoder.yudao.module.shipment.service.boxCustoms.BoxCustomsService;
......@@ -15,14 +16,21 @@ import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.text.MessageFormat;
import java.util.*;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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 cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
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
@RestController
......@@ -33,6 +41,9 @@ public class BoxCustomsController {
@Resource
private BoxCustomsService boxCustomsService;
@Resource
private RedisHelper redisHelper;
@PostMapping("/create")
@ApiOperation("创建报关,use this")
// @PreAuthorize("@ss.hasPermission('ecw:box-customs:create')")
......@@ -44,7 +55,19 @@ public class BoxCustomsController {
@ApiOperation("更新报关, use this")
// @PreAuthorize("@ss.hasPermission('ecw:box-customs:update')")
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);
}catch (Exception e){
throw e;
} finally {
redisHelper.delete(redisKey);
}
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