|
|
@@ -33,6 +33,7 @@ import org.springblade.client.feign.ICorpsDescClient;
|
|
|
import org.springblade.client.feign.IStorageClient;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
@@ -222,13 +223,23 @@ public class DeliveryController extends BladeController {
|
|
|
@ApiOperationSupport(order = 5)
|
|
|
@ApiOperation(value = "修改", notes = "传入delivery")
|
|
|
public R update(@Valid @RequestBody Delivery delivery) {
|
|
|
- if (delivery.getId() == null){
|
|
|
- throw new SecurityException("请选择要删除的数据");
|
|
|
+ if (delivery.getId() == null) {
|
|
|
+ throw new SecurityException("请选择要删除的数据");
|
|
|
}
|
|
|
Delivery deliveryMessage = deliveryService.getById(delivery.getId());
|
|
|
- if (StringUtils.isNotBlank(deliveryMessage.getDeliveryStatus()) && deliveryMessage.getDeliveryStatus().equals(DeliveryStatusEnum.DELIVER.getType())){
|
|
|
- throw new SecurityException("已发货不能删除");
|
|
|
+ if (StringUtils.isNotBlank(deliveryMessage.getDeliveryStatus()) && deliveryMessage.getDeliveryStatus().equals(DeliveryStatusEnum.DELIVER.getType())) {
|
|
|
+ throw new SecurityException("已发货不能删除");
|
|
|
}
|
|
|
+
|
|
|
+ int itemCount = deliveryItemsService.count(new LambdaQueryWrapper<DeliveryItems>()
|
|
|
+ .eq(DeliveryItems::getPid, delivery.getId())
|
|
|
+ .eq(DeliveryItems::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(DeliveryItems::getIsDeleted, 0)
|
|
|
+ );
|
|
|
+ if (itemCount > 0) {
|
|
|
+ throw new SecurityException("存在明细禁止删除");
|
|
|
+ }
|
|
|
+
|
|
|
delivery.setIsDeleted(1);
|
|
|
deliveryService.updateById(delivery);
|
|
|
deliveryFeesService.updateByPid(delivery.getId());
|