You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
5.7 KiB
Java
156 lines
5.7 KiB
Java
package com.glxp.api.controller.collect;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.glxp.api.annotation.CusRedissonAnnotation;
|
|
import com.glxp.api.annotation.RepeatSubmit;
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
import com.glxp.api.constant.RedissonCacheKey;
|
|
import com.glxp.api.controller.BaseController;
|
|
import com.glxp.api.entity.collect.RelCodeBatch;
|
|
import com.glxp.api.req.collect.RelCodeBatchRequest;
|
|
import com.glxp.api.req.collect.RelCodeDetailRequest;
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
import com.glxp.api.res.collect.RelCodeBatchResponse;
|
|
import com.glxp.api.res.collect.RelCodeDetailByParentCodeResponse;
|
|
import com.glxp.api.service.collect.RelCodeBatchService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.validation.Valid;
|
|
import java.util.List;
|
|
|
|
@Slf4j
|
|
@RestController
|
|
public class RelCodeBatchController extends BaseController {
|
|
|
|
@Resource
|
|
private RelCodeBatchService relCodeBatchService;
|
|
|
|
/**
|
|
* 上传文件保存
|
|
*
|
|
* @param uuid
|
|
* @param file
|
|
* @return
|
|
*/
|
|
@RepeatSubmit()
|
|
@CusRedissonAnnotation(cacheName = RedissonCacheKey.XML_UPLOAD, key = {"#uuid"}, timeOutMsg = "系统正在处理,请勿重复上传")
|
|
@PostMapping("/udiwms/relCode/batch/xmlUpload")
|
|
public BaseResponse xmlUpload(@RequestParam("uuid") String uuid, @RequestParam("file") MultipartFile file) {
|
|
relCodeBatchService.xmlUpload(file);
|
|
return ResultVOUtils.successMsg("上传成功!");
|
|
}
|
|
|
|
/**
|
|
* 手动添加
|
|
*
|
|
* @param relCodeBatchRequest
|
|
* @return
|
|
*/
|
|
@RepeatSubmit()
|
|
@PostMapping("/udiwms/relCode/batch/add")
|
|
public BaseResponse add(@RequestBody @Valid RelCodeBatchRequest relCodeBatchRequest, BindingResult bindingResult) {
|
|
relCodeBatchService.add(relCodeBatchRequest);
|
|
return ResultVOUtils.successMsg("添加成功!");
|
|
}
|
|
|
|
/**
|
|
* 添加拼箱
|
|
*
|
|
* @param relCodeBatchRequest
|
|
* @return
|
|
*/
|
|
@RepeatSubmit()
|
|
@PostMapping("/udiwms/relCode/batch/addRelCodeSpellBox")
|
|
public BaseResponse addRelCodeSpellBox(@RequestBody @Valid List<RelCodeBatchRequest> relCodeBatchRequest, BindingResult bindingResult) {
|
|
relCodeBatchService.addRelCodeSpellBox(relCodeBatchRequest);
|
|
return ResultVOUtils.successMsg("添加成功!");
|
|
}
|
|
|
|
@GetMapping("/udiwms/relCode/batch/filter")
|
|
public BaseResponse list(RelCodeBatchRequest relCodeBatchRequest, BindingResult bindingResult) {
|
|
String customerId = getCustomerId();
|
|
relCodeBatchRequest.setErpId(customerId);
|
|
List<RelCodeBatchResponse> relCodeBatchResponses = relCodeBatchService.filterList(relCodeBatchRequest);
|
|
PageInfo<RelCodeBatchResponse> pageInfo = new PageInfo<>(relCodeBatchResponses);
|
|
PageSimpleResponse<RelCodeBatchResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
pageSimpleResponse.setList(relCodeBatchResponses);
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
}
|
|
|
|
@GetMapping("/udiwms/relCode/batch/get")
|
|
public BaseResponse get(@RequestParam("id") Long id) {
|
|
RelCodeBatch relCodeBatch = relCodeBatchService.getById(id);
|
|
return ResultVOUtils.success(relCodeBatch);
|
|
}
|
|
|
|
@GetMapping("/udiwms/relCode/batch/delete")
|
|
public BaseResponse delete(@RequestParam("id") Long id) {
|
|
relCodeBatchService.delete(id);
|
|
return ResultVOUtils.success("删除成功");
|
|
}
|
|
|
|
|
|
@PostMapping("/udiwms/relCode/batch/update")
|
|
public BaseResponse update(@RequestBody @Valid RelCodeBatch relCodeBatch) {
|
|
relCodeBatchService.updateById(relCodeBatch);
|
|
return ResultVOUtils.success("修改成功!");
|
|
}
|
|
|
|
|
|
@GetMapping("/udiwms/relCode/batch/deleteDetail")
|
|
public BaseResponse deleteDetail(@RequestParam("curCode") String curCode) {
|
|
relCodeBatchService.deleteDetail(curCode);
|
|
return ResultVOUtils.success("删除成功");
|
|
}
|
|
|
|
|
|
@PostMapping("/udiwms/relCode/batch/deleteAllDetail")
|
|
public BaseResponse deleteAllDetail(@RequestBody List<RelCodeDetailRequest> detailList) {
|
|
relCodeBatchService.deleteAllDetail(detailList);
|
|
return ResultVOUtils.success("清空成功");
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取本地是否存在该层级码
|
|
*
|
|
* @param parentCode
|
|
* @return
|
|
*/
|
|
@GetMapping("/udiwms/relCode/batch/exist")
|
|
public BaseResponse batchExist(@RequestParam("parentCode") String parentCode) {
|
|
if (StrUtil.isBlank(parentCode)) return ResultVOUtils.error(500, "层级编码格式错误!");
|
|
return ResultVOUtils.success(relCodeBatchService.batchExist(parentCode));
|
|
}
|
|
|
|
|
|
@GetMapping("/udiwms/relCode/detailByParentCode")
|
|
public BaseResponse detailByParentCode(@RequestParam("parentCode") String parentCode) {
|
|
if (StrUtil.isBlank(parentCode)) return ResultVOUtils.error(500, "层级编码格式错误!");
|
|
List<RelCodeDetailByParentCodeResponse> list = relCodeBatchService.detailByParentCodeSpms(parentCode, 1);
|
|
return ResultVOUtils.success(list);
|
|
}
|
|
|
|
|
|
/**
|
|
* 更新明细
|
|
*
|
|
* @param parentCode
|
|
* @return
|
|
*/
|
|
@GetMapping("/udiwms/relCode/updateIoCodeTempEntity")
|
|
public BaseResponse threadUpdateIoCodeTempEntity(@RequestParam("parentCode") String parentCode) {
|
|
if (StrUtil.isBlank(parentCode)) return ResultVOUtils.error(500, "层级编码格式错误!");
|
|
relCodeBatchService.threadUpdateIoCodeTempEntity(parentCode);
|
|
return ResultVOUtils.success();
|
|
}
|
|
|
|
}
|