|
|
@ -6,7 +6,10 @@ import com.qs.serve.common.model.dto.PageVo; |
|
|
|
import com.qs.serve.common.model.dto.R; |
|
|
|
import com.qs.serve.common.model.enums.BizType; |
|
|
|
import com.qs.serve.common.model.enums.SystemModule; |
|
|
|
import com.qs.serve.common.util.AuthContextUtils; |
|
|
|
import com.qs.serve.common.util.PageUtil; |
|
|
|
import com.qs.serve.modules.oms.entity.bo.OmsCheckParam; |
|
|
|
import com.qs.serve.modules.oms.entity.bo.OmsUrgentParam; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
@ -16,6 +19,7 @@ import com.qs.serve.modules.oms.entity.OmsOrder; |
|
|
|
import com.qs.serve.modules.oms.service.OmsOrderService; |
|
|
|
|
|
|
|
import javax.validation.Valid; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -32,7 +36,7 @@ public class OmsOrderController { |
|
|
|
private OmsOrderService omsOrderService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 翻页查询 |
|
|
|
* 翻页 |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
*/ |
|
|
@ -46,7 +50,7 @@ public class OmsOrderController { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据ID查询 |
|
|
|
* ID查询 |
|
|
|
* @param id |
|
|
|
* @return |
|
|
|
*/ |
|
|
@ -58,45 +62,63 @@ public class OmsOrderController { |
|
|
|
return R.ok(omsOrder); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 根据ID更新 |
|
|
|
* 审核 |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/updateById") |
|
|
|
@PostMapping("/check") |
|
|
|
@SysLog(module = SystemModule.BASE, title = "订单", biz = BizType.UPDATE) |
|
|
|
@PreAuthorize("hasRole('oms:order:update')") |
|
|
|
public R<?> updateById(@RequestBody @Valid OmsOrder param){ |
|
|
|
boolean result = omsOrderService.updateById(param); |
|
|
|
return R.isTrue(result); |
|
|
|
public R<?> check(@RequestBody @Valid OmsCheckParam param){ |
|
|
|
OmsOrder dbOmsOrder = omsOrderService.getById(param.getOrderId()); |
|
|
|
if(dbOmsOrder.getStatus().equals(0)){ |
|
|
|
OmsOrder omsOrder = new OmsOrder(); |
|
|
|
omsOrder.setId(param.getOrderId()); |
|
|
|
omsOrder.setCheckState(param.getCheckSate().equals(1)?1:2); |
|
|
|
omsOrder.setCheckTime(LocalDateTime.now()); |
|
|
|
omsOrder.setCheckUserId(AuthContextUtils.getSysUserId()); |
|
|
|
omsOrderService.updateById(omsOrder); |
|
|
|
return R.ok(); |
|
|
|
} |
|
|
|
return R.error("已完成的订单无法修改"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 新增订单 |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/save") |
|
|
|
@SysLog(module = SystemModule.BASE, title = "订单", biz = BizType.INSERT) |
|
|
|
@PreAuthorize("hasRole('oms:order:insert')") |
|
|
|
public R<?> save(@RequestBody @Valid OmsOrder param){ |
|
|
|
boolean result = omsOrderService.save(param); |
|
|
|
return R.isTrue(result); |
|
|
|
* 设置加急 |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/urgent") |
|
|
|
@SysLog(module = SystemModule.BASE, title = "订单", biz = BizType.UPDATE) |
|
|
|
@PreAuthorize("hasRole('oms:order:update')") |
|
|
|
public R<?> urgent(@RequestBody @Valid OmsUrgentParam param){ |
|
|
|
OmsOrder dbOmsOrder = omsOrderService.getById(param.getOrderId()); |
|
|
|
if(dbOmsOrder.getStatus().equals(0)){ |
|
|
|
OmsOrder omsOrder = new OmsOrder(); |
|
|
|
omsOrder.setId(param.getOrderId()); |
|
|
|
omsOrder.setUrgentFlag(param.getUrgentSate().equals(1)?1:0); |
|
|
|
omsOrderService.updateById(omsOrder); |
|
|
|
return R.ok(); |
|
|
|
} |
|
|
|
return R.error("已完成的订单无法修改"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 删除订单 |
|
|
|
* 删除 |
|
|
|
* @param id |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@DeleteMapping("/deleteById/{id}") |
|
|
|
@SysLog(module = SystemModule.BASE, title = "订单", biz = BizType.DELETE) |
|
|
|
@PreAuthorize("hasRole('oms:order:delete')") |
|
|
|
public R<?> deleteById(@PathVariable("id") String id){ |
|
|
|
boolean result = omsOrderService.removeById(id); |
|
|
|
return R.isTrue(result); |
|
|
|
public R<?> deleteById(@PathVariable("id") Long id){ |
|
|
|
OmsOrder dbOmsOrder = omsOrderService.getById(id); |
|
|
|
if(dbOmsOrder.getStatus().equals(0)&&dbOmsOrder.getCheckState().equals(0)){ |
|
|
|
boolean result = omsOrderService.removeById(id); |
|
|
|
return R.isTrue(result); |
|
|
|
} |
|
|
|
return R.error("当前状态无法删除"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|