| | |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.exception.BusinessException; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | |
| | | import com.vincent.rsf.server.manager.entity.Delivery; |
| | | import com.vincent.rsf.server.manager.entity.DeliveryItem; |
| | | import com.vincent.rsf.server.manager.entity.excel.DeliveryTemplate; |
| | | import com.vincent.rsf.server.manager.enums.AsnExceStatus; |
| | | import com.vincent.rsf.server.manager.enums.OrderType; |
| | | import com.vincent.rsf.server.manager.enums.OrderWorkType; |
| | | import com.vincent.rsf.server.manager.service.CompanysService; |
| | | import com.vincent.rsf.server.manager.service.DeliveryItemService; |
| | | import com.vincent.rsf.server.manager.service.DeliveryService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.manager.utils.buildPageRowsUtils; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import com.vincent.rsf.server.system.service.SerialRuleService; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Delivery, BaseParam> pageParam = new PageParam<>(baseParam, Delivery.class); |
| | | return R.ok().add(deliveryService.page(pageParam, pageParam.buildWrapper(true))); |
| | | PageParam<Delivery, BaseParam> page = deliveryService.page(pageParam, pageParam.buildWrapper(true)); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(page)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:delivery:list')") |
| | | @PostMapping("/delivery/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(deliveryService.list()); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(deliveryService.list())); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:delivery:list')") |
| | | @PostMapping({"/delivery/many/{ids}", "/deliverys/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(deliveryService.listByIds(Arrays.asList(ids))); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(deliveryService.listByIds(Arrays.asList(ids)))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:delivery:list')") |
| | | @GetMapping("/delivery/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(deliveryService.getById(id)); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(deliveryService.getById(id))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:delivery:save')") |
| | |
| | | if (!deliveryService.save(delivery)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(delivery); |
| | | return R.ok("Save Success").add(buildPageRowsUtils.rowsMap(delivery)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:delivery:update')") |
| | |
| | | if (!deliveryService.updateById(delivery)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(delivery); |
| | | return R.ok("Update Success").add(buildPageRowsUtils.rowsMap(delivery)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:delivery:remove')") |
| | | @OperationLog("Delete 综合单据明细") |
| | | @PostMapping("/delivery/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!deliveryService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | List<Long> list = Arrays.asList(ids); |
| | | if (list.isEmpty()) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | return R.ok("操作成功").add(buildPageRowsUtils.rowsMap(deliveryService.removeDo(list))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:delivery:list')") |
| | |
| | | deliveryService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getId())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(vos)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:delivery:list')") |
| | |
| | | orderTemplates.add(template); |
| | | } |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(orderTemplates, DeliveryTemplate.class), response); |
| | | ExcelUtil.build(ExcelUtil.create(buildPageRowsUtils.rowsMap(orderTemplates), DeliveryTemplate.class), response); |
| | | } |
| | | |
| | | @PostMapping("/delivery/import") |
| | |
| | | return R.error("文件不能为空!!"); |
| | | } |
| | | Map<String, Object> hashMap = new HashMap<>(); |
| | | return R.ok("导入成功").add(deliveryItemService.excelImport(file, hashMap, getLoginUserId())); |
| | | return R.ok("导入成功").add(buildPageRowsUtils.rowsMap(deliveryItemService.excelImport(file, hashMap, getLoginUserId()))); |
| | | |
| | | } |
| | | |