|
@@ -1,24 +1,29 @@
|
|
|
package thyyxxk.webserver.controller.orderZdMaintain;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import lombok.Data;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import org.aspectj.apache.bcel.classfile.Code;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import thyyxxk.webserver.aop.interfaces.NeedMenu;
|
|
|
import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.dao.his.orderZdMaintain.OrderZdMaintainDao;
|
|
|
import thyyxxk.webserver.entity.ResultVo;
|
|
|
import thyyxxk.webserver.entity.dictionary.CodeName;
|
|
|
-import thyyxxk.webserver.entity.orderZdMaintain.dto.AddOrderOccurenceDTO;
|
|
|
-import thyyxxk.webserver.entity.orderZdMaintain.dto.OrderOccurrenceDTO;
|
|
|
-import thyyxxk.webserver.entity.orderZdMaintain.dto.YzOrderItemDTO;
|
|
|
-import thyyxxk.webserver.entity.orderZdMaintain.dto.ZdChargeItemDto;
|
|
|
+import thyyxxk.webserver.entity.orderZdMaintain.dto.*;
|
|
|
import thyyxxk.webserver.entity.orderZdMaintain.dto.frequency.YzOrderFrequencyDTO;
|
|
|
+import thyyxxk.webserver.entity.orderZdMaintain.enums.SupplyClass;
|
|
|
import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.YzZdOrderItemConfirm;
|
|
|
import thyyxxk.webserver.enums.authorize.MenuEnum;
|
|
|
+import thyyxxk.webserver.service.PublicServer;
|
|
|
import thyyxxk.webserver.service.hutoolcache.CacheEnums;
|
|
|
import thyyxxk.webserver.service.hutoolcache.ExtraCache;
|
|
|
import thyyxxk.webserver.service.orderZdMaintain.OrderZdMaintainService;
|
|
|
+import thyyxxk.webserver.utils.ListUtil;
|
|
|
import thyyxxk.webserver.utils.ResultVoUtil;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -29,6 +34,7 @@ public class OrderZdMaintainController {
|
|
|
private final OrderZdMaintainService service;
|
|
|
private final OrderZdMaintainDao dao;
|
|
|
private final ExtraCache extraCache;
|
|
|
+ private final PublicServer publicServer;
|
|
|
|
|
|
|
|
|
@GetMapping("/getChangeItemType")
|
|
@@ -137,4 +143,93 @@ public class OrderZdMaintainController {
|
|
|
return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_NOTIFICATION);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @AllArgsConstructor
|
|
|
+ @Data
|
|
|
+ public static class TempCodeName {
|
|
|
+ private Integer code;
|
|
|
+ private String name;
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getSupplyClass")
|
|
|
+ @NeedMenu(MenuEnum.orderZdMaintain)
|
|
|
+ public ResultVo<List<TempCodeName>> getSupplyClass() {
|
|
|
+ List<TempCodeName> codeNames = new ArrayList<>();
|
|
|
+ for (SupplyClass value : SupplyClass.values()) {
|
|
|
+ codeNames.add(new TempCodeName(value.getCode(), value.getName()));
|
|
|
+ }
|
|
|
+ return ResultVoUtil.success(codeNames);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/selectAllSupplyType")
|
|
|
+ @NeedMenu(MenuEnum.orderZdMaintain)
|
|
|
+ public ResultVo<List<YzSupplyTypeDTO>> selectAllSupplyType() {
|
|
|
+ return ResultVoUtil.success(dao.selectAllSupplyType());
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/insertSupplyType")
|
|
|
+ @NeedMenu(MenuEnum.orderZdMaintain)
|
|
|
+ public ResultVo<String> insertSupplyType(@RequestBody YzSupplyTypeDTO param) {
|
|
|
+ param.setSupplyCode(publicServer.getSupplyNo());
|
|
|
+ dao.insertSupplyType(param);
|
|
|
+ return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_NOTIFICATION);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/updateSupplyType")
|
|
|
+ @NeedMenu(MenuEnum.orderZdMaintain)
|
|
|
+ public ResultVo<String> updateSupplyType(@RequestBody YzSupplyTypeDTO param) {
|
|
|
+ dao.updateSupplyType(param);
|
|
|
+ return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_NOTIFICATION);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/deleteSupplyType")
|
|
|
+ @NeedMenu(MenuEnum.orderZdMaintain)
|
|
|
+ public ResultVo<String> deleteSupplyType(@RequestParam("code") String code,
|
|
|
+ @RequestParam("delFlag") String delFlag) {
|
|
|
+ dao.delSupplyType(code, delFlag);
|
|
|
+ return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_NOTIFICATION);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Data
|
|
|
+ public static class SupplyCharge {
|
|
|
+ private String supplyCode;
|
|
|
+ private String chargeCode;
|
|
|
+ private String chargeName;
|
|
|
+ private BigDecimal chargeAmount;
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getSupplyCharge")
|
|
|
+ @NeedMenu(MenuEnum.orderZdMaintain)
|
|
|
+ public ResultVo<List<SupplyCharge>> getSupplyCharge(@RequestParam("code") String code) {
|
|
|
+ return ResultVoUtil.success(dao.getSupplyCharges(code));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/delSupplyCharge")
|
|
|
+ @NeedMenu(MenuEnum.orderZdMaintain)
|
|
|
+ public ResultVo<String> delSupplyCharge(@RequestParam("code") String code,
|
|
|
+ @RequestParam("chargeCode") String chargeCode) {
|
|
|
+ dao.delSupplyCharge(code, chargeCode);
|
|
|
+ return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_NOTIFICATION);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Data
|
|
|
+ public static class SaveSupplyCharge {
|
|
|
+ private String supplyCode;
|
|
|
+ private List<SupplyCharge> list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/saveSupplyCharge")
|
|
|
+ public ResultVo<String> saveSupplyCharge(@RequestBody SaveSupplyCharge param) {
|
|
|
+ if (ListUtil.isBlank(param.getList())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.SUCCESS);
|
|
|
+ }
|
|
|
+ dao.delSupplyChargeByCode(param.getSupplyCode());
|
|
|
+ ListUtil.batchList(param.getList(), OrderZdMaintainDao.class, (m, i) -> {
|
|
|
+ if (StrUtil.isNotBlank(i.getChargeCode())) {
|
|
|
+ m.insertSupplyCharge(param.getSupplyCode(), i.getChargeCode(), i.getChargeAmount());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_NOTIFICATION);
|
|
|
+ }
|
|
|
+
|
|
|
}
|