Merge remote-tracking branch 'origin/main'

This commit is contained in:
gaoqr
2024-06-17 18:48:06 +08:00
7 changed files with 90 additions and 12 deletions
@@ -108,8 +108,8 @@ public class OrderController {
@PutMapping("/restore")
@Operation(summary = "还原")
@Parameter(name = "orderId", description = "生产单id", required = true, example = "1")
@PreAuthorize("@ss.hasPermission('executor:order:restore')")
public CommonResult<Boolean> restoreOrder(@Valid @RequestBody Long orderId) {
@PreAuthorize("@ss.hasPermission('executor:order:update')")
public CommonResult<Boolean> restoreOrder(@RequestParam("orderId") Long orderId) {
orderService.restoreOrder(orderId);
return success(true);
}
@@ -56,7 +56,7 @@ public interface OrderService {
*
* @param orderId 编号组
*/
void restoreOrder(@Valid Long orderId);
void restoreOrder(Long orderId);
/**
* 获得生产单表 order_{N}
@@ -141,8 +141,7 @@ public class OrderServiceImpl implements OrderService {
validatePhoneNumber(createReqVO.getPhoneNumber());
//验证自定义单号是否存在,业务员、拆单员是否存在
validateOrderImportForCreateOrUpdate(createReqVO.getCustomOrderNo(), createReqVO.getSalesman(), createReqVO.getSplitter());
validateCustomOrderNoExists(createReqVO.getCustomOrderNo());
LocalDateTime time = getAfterDate(createReqVO.getDeliveryDate());
createReqVO.setDeliveryDate(time);
// 插入
@@ -161,8 +160,7 @@ public class OrderServiceImpl implements OrderService {
validatePhoneNumber(updateReqVO.getPhoneNumber());
//验证自定义单号是否存在,业务员、拆单员是否存在
validateOrderImportForCreateOrUpdate(updateReqVO.getCustomOrderNo(), updateReqVO.getSalesman(), updateReqVO.getSplitter());
validateCustomOrderNoExists(updateReqVO.getCustomOrderNo(), updateReqVO.getId());
// 更新
OrderDO updateObj = BeanUtils.toBean(updateReqVO, OrderDO.class);
orderMapper.updateById(updateObj);
@@ -421,6 +419,20 @@ public class OrderServiceImpl implements OrderService {
}
// 验证自定义单号是否存在
private void validateCustomOrderNoExists(String customOrderNo, Long orderId) {
if (customOrderNo != null) {
if (!customOrderNo.isEmpty()) {
if (orderMapper.selectCount(new LambdaQueryWrapper<OrderDO>()
.ne(OrderDO::getId, orderId)
.eq(OrderDO::getCustomOrderNo, customOrderNo)
.eq(OrderDO::getDeleted, false)
.eq(OrderDO::getOrganId, OrganContextHolder.getOrganId())) > 0) {
throw exception(CUSTOM_ORDER_EXISTS);
}
}
}
}
private void validateCustomOrderNoExists(String customOrderNo) {
if (customOrderNo != null) {
if (!customOrderNo.isEmpty()) {
@@ -467,11 +479,11 @@ public class OrderServiceImpl implements OrderService {
}
}
private void validateOrderImportForCreateOrUpdate(String customOrderNo, String salesman, String splitter) {
private void validateOrderImportForCreateOrUpdate(String customOrderNo, String salesman, String splitter, Long orderId) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
DataPermissionUtils.executeIgnore(() -> {
validateCustomOrderNoExists(customOrderNo);
validateCustomOrderNoExists(customOrderNo, orderId);
validateSalesmanOrderNoExists(salesman, organId);
validateSplitterOrderNoExists(splitter, organId);
});
@@ -6,7 +6,7 @@
<select id="selectPlatesDetailByOrderId" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO">
SELECT i.order_id, p.id, p.plate_no, g.material, p.name, p.area, p.seal_left, p.seal_down,
p.seal_right, p.seal_up, p.texture, p.is_special_shaped, p.is_sculpt, p.unregular_point_count, p.front_hole_count,
p.back_hole_count, p.side_hole_count,p.width,p.height,p.thickness
p.back_hole_count, p.side_hole_count,p.width,p.height,p.thickness,gp.name
FROM order_item i
RIGHT JOIN `order_plate` p ON i.plate_id = p.id
LEFT JOIN `order_goods` g ON g.id = p.goods_id