100 lines
3.1 KiB
Java
100 lines
3.1 KiB
Java
|
|
package com.klp.controller;
|
||
|
|
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.Arrays;
|
||
|
|
|
||
|
|
import lombok.RequiredArgsConstructor;
|
||
|
|
import javax.servlet.http.HttpServletResponse;
|
||
|
|
import javax.validation.constraints.*;
|
||
|
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
import org.springframework.validation.annotation.Validated;
|
||
|
|
import com.klp.common.annotation.RepeatSubmit;
|
||
|
|
import com.klp.common.annotation.Log;
|
||
|
|
import com.klp.common.core.controller.BaseController;
|
||
|
|
import com.klp.common.core.domain.PageQuery;
|
||
|
|
import com.klp.common.core.domain.R;
|
||
|
|
import com.klp.common.core.validate.AddGroup;
|
||
|
|
import com.klp.common.core.validate.EditGroup;
|
||
|
|
import com.klp.common.enums.BusinessType;
|
||
|
|
import com.klp.common.utils.poi.ExcelUtil;
|
||
|
|
import com.klp.domain.vo.WmsOrderProfitVo;
|
||
|
|
import com.klp.domain.bo.WmsOrderProfitBo;
|
||
|
|
import com.klp.service.IWmsOrderProfitService;
|
||
|
|
import com.klp.common.core.page.TableDataInfo;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 订单盈亏
|
||
|
|
*
|
||
|
|
* @author klp
|
||
|
|
* @date 2025-08-13
|
||
|
|
*/
|
||
|
|
@Validated
|
||
|
|
@RequiredArgsConstructor
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/klp/orderProfit")
|
||
|
|
public class WmsOrderProfitController extends BaseController {
|
||
|
|
|
||
|
|
private final IWmsOrderProfitService iWmsOrderProfitService;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询订单盈亏列表
|
||
|
|
*/
|
||
|
|
@GetMapping("/list")
|
||
|
|
public TableDataInfo<WmsOrderProfitVo> list(WmsOrderProfitBo bo, PageQuery pageQuery) {
|
||
|
|
return iWmsOrderProfitService.queryPageList(bo, pageQuery);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 导出订单盈亏列表
|
||
|
|
*/
|
||
|
|
@Log(title = "订单盈亏", businessType = BusinessType.EXPORT)
|
||
|
|
@PostMapping("/export")
|
||
|
|
public void export(WmsOrderProfitBo bo, HttpServletResponse response) {
|
||
|
|
List<WmsOrderProfitVo> list = iWmsOrderProfitService.queryList(bo);
|
||
|
|
ExcelUtil.exportExcel(list, "订单盈亏", WmsOrderProfitVo.class, response);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取订单盈亏详细信息
|
||
|
|
*
|
||
|
|
* @param profitId 主键
|
||
|
|
*/
|
||
|
|
@GetMapping("/{profitId}")
|
||
|
|
public R<WmsOrderProfitVo> getInfo(@NotNull(message = "主键不能为空")
|
||
|
|
@PathVariable Long profitId) {
|
||
|
|
return R.ok(iWmsOrderProfitService.queryById(profitId));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 新增订单盈亏
|
||
|
|
*/
|
||
|
|
@Log(title = "订单盈亏", businessType = BusinessType.INSERT)
|
||
|
|
@RepeatSubmit()
|
||
|
|
@PostMapping()
|
||
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsOrderProfitBo bo) {
|
||
|
|
return toAjax(iWmsOrderProfitService.insertByBo(bo));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 修改订单盈亏
|
||
|
|
*/
|
||
|
|
@Log(title = "订单盈亏", businessType = BusinessType.UPDATE)
|
||
|
|
@RepeatSubmit()
|
||
|
|
@PutMapping()
|
||
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsOrderProfitBo bo) {
|
||
|
|
return toAjax(iWmsOrderProfitService.updateByBo(bo));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 删除订单盈亏
|
||
|
|
*
|
||
|
|
* @param profitIds 主键串
|
||
|
|
*/
|
||
|
|
@Log(title = "订单盈亏", businessType = BusinessType.DELETE)
|
||
|
|
@DeleteMapping("/{profitIds}")
|
||
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||
|
|
@PathVariable Long[] profitIds) {
|
||
|
|
return toAjax(iWmsOrderProfitService.deleteWithValidByIds(Arrays.asList(profitIds), true));
|
||
|
|
}
|
||
|
|
}
|