|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.wms.asrs.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.Cools; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.R; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.Order; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.OrderType; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.OrderTypeService; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.annotation.CacheData; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.annotation.OperationLog; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.domain.BaseParam; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.domain.KeyValVo; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.domain.PageParam; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.OrderLog; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.OrderLogService; | 
|---|
|  |  |  | import com.zy.asrs.wms.system.controller.BaseController; | 
|---|
|  |  |  | import com.zy.asrs.wms.utils.ExcelUtil; | 
|---|
|  |  |  | import com.zy.asrs.wms.utils.Utils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Arrays; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping("/api") | 
|---|
|  |  |  | public class OrderLogController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderLogService orderLogService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderTypeService orderTypeService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @PostMapping("/orderLog/page") | 
|---|
|  |  |  | @CacheData(tableName = {"man_order_log"}) | 
|---|
|  |  |  | public R page(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | BaseParam baseParam = buildParam(map, BaseParam.class); | 
|---|
|  |  |  | PageParam<OrderLog, BaseParam> pageParam = new PageParam<>(baseParam, OrderLog.class); | 
|---|
|  |  |  | return R.ok().add(orderLogService.page(pageParam, pageParam.buildWrapper(true))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @PostMapping("/orderLog/in/page") | 
|---|
|  |  |  | @CacheData(tableName = {"man_order_log", "man_order_type"}) | 
|---|
|  |  |  | public R pageIn(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | String condition = map.getOrDefault("condition", "").toString(); | 
|---|
|  |  |  | BaseParam baseParam = buildParam(map, BaseParam.class); | 
|---|
|  |  |  | PageParam<OrderLog, BaseParam> pageParam = new PageParam<>(baseParam, OrderLog.class); | 
|---|
|  |  |  | //        QueryWrapper<OrderLog> wrapper = pageParam.buildWrapper(true); | 
|---|
|  |  |  | QueryWrapper<OrderLog> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ArrayList<Long> types = new ArrayList<>(); | 
|---|
|  |  |  | for (OrderType orderType : orderTypeService.list(new LambdaQueryWrapper<OrderType>().eq(OrderType::getType, 1))) { | 
|---|
|  |  |  | types.add(orderType.getId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | wrapper.in("order_type", types); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | wrapper.and(wrapper1 -> { | 
|---|
|  |  |  | wrapper1.or().like("order_no", condition); | 
|---|
|  |  |  | wrapper1.or().like("memo", condition); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Object paramObj = map.get("_param"); | 
|---|
|  |  |  | if (paramObj != null) { | 
|---|
|  |  |  | Map param = (Map) paramObj; | 
|---|
|  |  |  | for (Object value : param.entrySet()) { | 
|---|
|  |  |  | Map.Entry entry = (Map.Entry) value; | 
|---|
|  |  |  | String paramKey = Utils.toSymbolCase(entry.getKey().toString(), '_'); | 
|---|
|  |  |  | if (entry.getValue() != null) { | 
|---|
|  |  |  | wrapper.like(paramKey, entry.getValue()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok().add(orderLogService.page(pageParam, wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @PostMapping("/orderLog/out/page") | 
|---|
|  |  |  | @CacheData(tableName = {"man_order_log", "man_order_type"}) | 
|---|
|  |  |  | public R pageOut(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | String condition = map.getOrDefault("condition", "").toString(); | 
|---|
|  |  |  | BaseParam baseParam = buildParam(map, BaseParam.class); | 
|---|
|  |  |  | PageParam<OrderLog, BaseParam> pageParam = new PageParam<>(baseParam, OrderLog.class); | 
|---|
|  |  |  | //        QueryWrapper<OrderLog> wrapper = pageParam.buildWrapper(true); | 
|---|
|  |  |  | QueryWrapper<OrderLog> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ArrayList<Long> types = new ArrayList<>(); | 
|---|
|  |  |  | for (OrderType orderType : orderTypeService.list(new LambdaQueryWrapper<OrderType>().eq(OrderType::getType, 2))) { | 
|---|
|  |  |  | types.add(orderType.getId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | wrapper.in("order_type", types); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | wrapper.and(wrapper1 -> { | 
|---|
|  |  |  | wrapper1.or().like("order_no", condition); | 
|---|
|  |  |  | wrapper1.or().like("memo", condition); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Object paramObj = map.get("_param"); | 
|---|
|  |  |  | if(paramObj != null) { | 
|---|
|  |  |  | Map param = (Map) paramObj; | 
|---|
|  |  |  | for (Object value : param.entrySet()) { | 
|---|
|  |  |  | Map.Entry entry = (Map.Entry) value; | 
|---|
|  |  |  | String paramKey = Utils.toSymbolCase(entry.getKey().toString(), '_'); | 
|---|
|  |  |  | if (entry.getValue() != null) { | 
|---|
|  |  |  | wrapper.like(paramKey, entry.getValue()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok().add(orderLogService.page(pageParam, wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @PostMapping("/orderLog/list") | 
|---|
|  |  |  | @CacheData(tableName = {"man_order_log"}) | 
|---|
|  |  |  | public R list(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | return R.ok().add(orderLogService.list()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @GetMapping("/orderLog/{id}") | 
|---|
|  |  |  | @CacheData(tableName = {"man_order_log"}) | 
|---|
|  |  |  | public R get(@PathVariable("id") Long id) { | 
|---|
|  |  |  | return R.ok().add(orderLogService.getById(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:save')") | 
|---|
|  |  |  | @OperationLog("添加订单历史管理") | 
|---|
|  |  |  | @PostMapping("/orderLog/save") | 
|---|
|  |  |  | public R save(@RequestBody OrderLog orderLog) { | 
|---|
|  |  |  | if (!orderLogService.save(orderLog)) { | 
|---|
|  |  |  | return R.error("添加失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok("添加成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:update')") | 
|---|
|  |  |  | @OperationLog("修改订单历史管理") | 
|---|
|  |  |  | @PostMapping("/orderLog/update") | 
|---|
|  |  |  | public R update(@RequestBody OrderLog orderLog) { | 
|---|
|  |  |  | if (!orderLogService.updateById(orderLog)) { | 
|---|
|  |  |  | return R.error("修改失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok("修改成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:remove')") | 
|---|
|  |  |  | @OperationLog("删除订单历史管理") | 
|---|
|  |  |  | @PostMapping("/orderLog/remove/{ids}") | 
|---|
|  |  |  | public R remove(@PathVariable Long[] ids) { | 
|---|
|  |  |  | if (!orderLogService.removeByIds(Arrays.asList(ids))) { | 
|---|
|  |  |  | return R.error("删除失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok("删除成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @PostMapping("/orderLog/query") | 
|---|
|  |  |  | public R query(@RequestParam(required = false) String condition) { | 
|---|
|  |  |  | List<KeyValVo> vos = new ArrayList<>(); | 
|---|
|  |  |  | LambdaQueryWrapper<OrderLog> wrapper = new LambdaQueryWrapper<>(); | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | wrapper.like(OrderLog::getId, condition); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | orderLogService.page(new Page<>(1, 30), wrapper).getRecords().forEach( | 
|---|
|  |  |  | item -> vos.add(new KeyValVo(item.getId(), item.getId())) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | return R.ok().add(vos); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @PostMapping("/orderLog/export") | 
|---|
|  |  |  | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { | 
|---|
|  |  |  | String ioModel = map.getOrDefault("ioModel", "").toString(); | 
|---|
|  |  |  | map.remove("ioModel"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | BaseParam baseParam = buildParam(map, BaseParam.class); | 
|---|
|  |  |  | PageParam<OrderLog, BaseParam> pageParam = new PageParam<>(baseParam, OrderLog.class); | 
|---|
|  |  |  | QueryWrapper<OrderLog> queryWrapper = pageParam.buildWrapper(true); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<OrderLog> list = orderLogService.list(queryWrapper); | 
|---|
|  |  |  | if (!Cools.isEmpty(ioModel)) { | 
|---|
|  |  |  | ArrayList<Long> types = new ArrayList<>(); | 
|---|
|  |  |  | for (OrderType orderType : orderTypeService.list(new LambdaQueryWrapper<OrderType>().eq(OrderType::getType, ioModel.equals("in") ? 1 : 2))) { | 
|---|
|  |  |  | types.add(orderType.getId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | queryWrapper.in("order_type", types); | 
|---|
|  |  |  | list = orderLogService.list(queryWrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ExcelUtil.build(ExcelUtil.create(list, OrderLog.class), response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | package com.zy.asrs.wms.asrs.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.Cools; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.R; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.Order; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.OrderType; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.OrderTypeService; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.annotation.CacheData; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.annotation.OperationLog; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.domain.BaseParam; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.domain.KeyValVo; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.domain.PageParam; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.OrderLog; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.OrderLogService; | 
|---|
|  |  |  | import com.zy.asrs.wms.system.controller.BaseController; | 
|---|
|  |  |  | import com.zy.asrs.wms.utils.ExcelUtil; | 
|---|
|  |  |  | import com.zy.asrs.wms.utils.Utils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Arrays; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping("/api") | 
|---|
|  |  |  | public class OrderLogController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderLogService orderLogService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderTypeService orderTypeService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @PostMapping("/orderLog/page") | 
|---|
|  |  |  | @CacheData(tableName = {"man_order_log"}) | 
|---|
|  |  |  | public R page(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | BaseParam baseParam = buildParam(map, BaseParam.class); | 
|---|
|  |  |  | PageParam<OrderLog, BaseParam> pageParam = new PageParam<>(baseParam, OrderLog.class); | 
|---|
|  |  |  | return R.ok().add(orderLogService.page(pageParam, pageParam.buildWrapper(true))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @PostMapping("/orderLog/in/page") | 
|---|
|  |  |  | @CacheData(tableName = {"man_order_log", "man_order_type"}) | 
|---|
|  |  |  | public R pageIn(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | String condition = map.getOrDefault("condition", "").toString(); | 
|---|
|  |  |  | BaseParam baseParam = buildParam(map, BaseParam.class); | 
|---|
|  |  |  | PageParam<OrderLog, BaseParam> pageParam = new PageParam<>(baseParam, OrderLog.class); | 
|---|
|  |  |  | QueryWrapper<OrderLog> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ArrayList<Long> types = new ArrayList<>(); | 
|---|
|  |  |  | for (OrderType orderType : orderTypeService.list(new LambdaQueryWrapper<OrderType>().eq(OrderType::getType, 1))) { | 
|---|
|  |  |  | types.add(orderType.getId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | wrapper.in("order_type", types); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | wrapper.and(wrapper1 -> { | 
|---|
|  |  |  | wrapper1.or().like("order_no", condition); | 
|---|
|  |  |  | wrapper1.or().like("memo", condition); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Object paramObj = map.get("_param"); | 
|---|
|  |  |  | if (paramObj != null) { | 
|---|
|  |  |  | Map param = (Map) paramObj; | 
|---|
|  |  |  | for (Object value : param.entrySet()) { | 
|---|
|  |  |  | Map.Entry entry = (Map.Entry) value; | 
|---|
|  |  |  | String paramKey = Utils.toSymbolCase(entry.getKey().toString(), '_'); | 
|---|
|  |  |  | if (entry.getValue() != null) { | 
|---|
|  |  |  | wrapper.like(paramKey, entry.getValue()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | wrapper.orderByDesc("create_time"); | 
|---|
|  |  |  | return R.ok().add(orderLogService.page(pageParam, wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @PostMapping("/orderLog/out/page") | 
|---|
|  |  |  | @CacheData(tableName = {"man_order_log", "man_order_type"}) | 
|---|
|  |  |  | public R pageOut(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | String condition = map.getOrDefault("condition", "").toString(); | 
|---|
|  |  |  | BaseParam baseParam = buildParam(map, BaseParam.class); | 
|---|
|  |  |  | PageParam<OrderLog, BaseParam> pageParam = new PageParam<>(baseParam, OrderLog.class); | 
|---|
|  |  |  | //        QueryWrapper<OrderLog> wrapper = pageParam.buildWrapper(true); | 
|---|
|  |  |  | QueryWrapper<OrderLog> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ArrayList<Long> types = new ArrayList<>(); | 
|---|
|  |  |  | for (OrderType orderType : orderTypeService.list(new LambdaQueryWrapper<OrderType>().eq(OrderType::getType, 2))) { | 
|---|
|  |  |  | types.add(orderType.getId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | wrapper.in("order_type", types); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | wrapper.and(wrapper1 -> { | 
|---|
|  |  |  | wrapper1.or().like("order_no", condition); | 
|---|
|  |  |  | wrapper1.or().like("memo", condition); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Object paramObj = map.get("_param"); | 
|---|
|  |  |  | if(paramObj != null) { | 
|---|
|  |  |  | Map param = (Map) paramObj; | 
|---|
|  |  |  | for (Object value : param.entrySet()) { | 
|---|
|  |  |  | Map.Entry entry = (Map.Entry) value; | 
|---|
|  |  |  | String paramKey = Utils.toSymbolCase(entry.getKey().toString(), '_'); | 
|---|
|  |  |  | if (entry.getValue() != null) { | 
|---|
|  |  |  | wrapper.like(paramKey, entry.getValue()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok().add(orderLogService.page(pageParam, wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @PostMapping("/orderLog/list") | 
|---|
|  |  |  | @CacheData(tableName = {"man_order_log"}) | 
|---|
|  |  |  | public R list(@RequestBody Map<String, Object> map) { | 
|---|
|  |  |  | return R.ok().add(orderLogService.list()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @GetMapping("/orderLog/{id}") | 
|---|
|  |  |  | @CacheData(tableName = {"man_order_log"}) | 
|---|
|  |  |  | public R get(@PathVariable("id") Long id) { | 
|---|
|  |  |  | return R.ok().add(orderLogService.getById(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:save')") | 
|---|
|  |  |  | @OperationLog("添加订单历史管理") | 
|---|
|  |  |  | @PostMapping("/orderLog/save") | 
|---|
|  |  |  | public R save(@RequestBody OrderLog orderLog) { | 
|---|
|  |  |  | if (!orderLogService.save(orderLog)) { | 
|---|
|  |  |  | return R.error("添加失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok("添加成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:update')") | 
|---|
|  |  |  | @OperationLog("修改订单历史管理") | 
|---|
|  |  |  | @PostMapping("/orderLog/update") | 
|---|
|  |  |  | public R update(@RequestBody OrderLog orderLog) { | 
|---|
|  |  |  | if (!orderLogService.updateById(orderLog)) { | 
|---|
|  |  |  | return R.error("修改失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok("修改成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:remove')") | 
|---|
|  |  |  | @OperationLog("删除订单历史管理") | 
|---|
|  |  |  | @PostMapping("/orderLog/remove/{ids}") | 
|---|
|  |  |  | public R remove(@PathVariable Long[] ids) { | 
|---|
|  |  |  | if (!orderLogService.removeByIds(Arrays.asList(ids))) { | 
|---|
|  |  |  | return R.error("删除失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok("删除成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @PostMapping("/orderLog/query") | 
|---|
|  |  |  | public R query(@RequestParam(required = false) String condition) { | 
|---|
|  |  |  | List<KeyValVo> vos = new ArrayList<>(); | 
|---|
|  |  |  | LambdaQueryWrapper<OrderLog> wrapper = new LambdaQueryWrapper<>(); | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | wrapper.like(OrderLog::getId, condition); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | orderLogService.page(new Page<>(1, 30), wrapper).getRecords().forEach( | 
|---|
|  |  |  | item -> vos.add(new KeyValVo(item.getId(), item.getId())) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | return R.ok().add(vos); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('asrs:orderLog:list')") | 
|---|
|  |  |  | @PostMapping("/orderLog/export") | 
|---|
|  |  |  | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { | 
|---|
|  |  |  | String ioModel = map.getOrDefault("ioModel", "").toString(); | 
|---|
|  |  |  | map.remove("ioModel"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | BaseParam baseParam = buildParam(map, BaseParam.class); | 
|---|
|  |  |  | PageParam<OrderLog, BaseParam> pageParam = new PageParam<>(baseParam, OrderLog.class); | 
|---|
|  |  |  | QueryWrapper<OrderLog> queryWrapper = pageParam.buildWrapper(true); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<OrderLog> list = orderLogService.list(queryWrapper); | 
|---|
|  |  |  | if (!Cools.isEmpty(ioModel)) { | 
|---|
|  |  |  | ArrayList<Long> types = new ArrayList<>(); | 
|---|
|  |  |  | for (OrderType orderType : orderTypeService.list(new LambdaQueryWrapper<OrderType>().eq(OrderType::getType, ioModel.equals("in") ? 1 : 2))) { | 
|---|
|  |  |  | types.add(orderType.getId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | queryWrapper.in("order_type", types); | 
|---|
|  |  |  | list = orderLogService.list(queryWrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ExcelUtil.build(ExcelUtil.create(list, OrderLog.class), response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|