diff --git a/src/main/java/com/glxp/api/controller/auth/InvBusUserController.java b/src/main/java/com/glxp/api/controller/auth/InvBusUserController.java index 6eb5f24c..880df60b 100644 --- a/src/main/java/com/glxp/api/controller/auth/InvBusUserController.java +++ b/src/main/java/com/glxp/api/controller/auth/InvBusUserController.java @@ -11,7 +11,7 @@ import com.glxp.api.entity.auth.InvBusUserEntity; import com.glxp.api.entity.auth.InvWarehouseEntity; import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity; import com.glxp.api.req.auth.FilterInvBusUserRequest; -import com.glxp.api.req.auth.UpdateRelBusRequset; +import com.glxp.api.req.auth.UpdateUserRelBusRequset; import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.service.auth.DeptService; @@ -106,7 +106,7 @@ public class InvBusUserController { @AuthRuleAnnotation("") @PostMapping("/spms/bus/user/warehouse/update") - public BaseResponse updateRes(@RequestBody UpdateRelBusRequset relBusRequset) { + public BaseResponse updateRes(@RequestBody UpdateUserRelBusRequset relBusRequset) { boolean b = invBusUserService.deleteByUnion(relBusRequset.getUserId(), relBusRequset.getSubInvCode()); if (CollUtil.isNotEmpty(relBusRequset.getInvBusUserEntities())) { relBusRequset.getInvBusUserEntities().forEach(warehouseBussinessTypeEntity -> @@ -126,7 +126,7 @@ public class InvBusUserController { @AuthRuleAnnotation("") @PostMapping("/spms/bus/user/warehouse/post") - public BaseResponse postRes(@RequestBody UpdateRelBusRequset relBusRequset) { + public BaseResponse postRes(@RequestBody UpdateUserRelBusRequset relBusRequset) { boolean b = invBusUserService.deleteByUnion(relBusRequset.getUserId(), relBusRequset.getSubInvCode()); if (CollUtil.isNotEmpty(relBusRequset.getSelectActions())) { relBusRequset.getSelectActions().forEach(action -> diff --git a/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java b/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java index 25ea88fe..9a7c6756 100644 --- a/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java +++ b/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java @@ -8,20 +8,20 @@ import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; -import com.glxp.api.constant.ConstantType; import com.glxp.api.entity.auth.*; +import com.glxp.api.entity.basic.BasicBussinessTypeEntity; import com.glxp.api.entity.system.SystemParamConfigEntity; -import com.glxp.api.req.auth.BussinessTypeFilterRequest; -import com.glxp.api.req.auth.FilterInvLinkDataRequest; -import com.glxp.api.req.auth.FilterInvSubWarehouseRequest; -import com.glxp.api.req.auth.FilterInvWarehouseRequest; +import com.glxp.api.req.auth.*; +import com.glxp.api.req.basic.FilterBussinessTypeRequest; import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.req.thrsys.FilterBasicThirdSysRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.auth.InvSubWarehouseResponse; import com.glxp.api.res.auth.InvWarehouseThirdSysResponse; import com.glxp.api.res.auth.WarehouseUserResponse; +import com.glxp.api.res.basic.BasicBussinessTypeResponse; import com.glxp.api.service.auth.*; +import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.service.system.SystemParamConfigService; import org.springframework.beans.BeanUtils; import org.springframework.validation.BindingResult; @@ -52,6 +52,8 @@ public class InvWarehouseController { private SystemParamConfigService systemParamConfigService; @Resource private WarehouseBussinessTypeService warehouseBussinessTypeService; + @Resource + private IBasicBussinessTypeService basicBussinessTypeService; @AuthRuleAnnotation("") @GetMapping("spms/sub/inv/warehouse/filter") @@ -340,6 +342,65 @@ public class InvWarehouseController { return ResultVOUtils.success(pageSimpleResponse); } + + //仓库关联单据类型管理页面数据 + @AuthRuleAnnotation("") + @PostMapping("/warehouse/invRelBusType/manageList") + public BaseResponse getManageList(@RequestBody @Valid FilterInvLinkDataRequest filterInvLinkDataRequest, BindingResult bindingResult) { + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + + //1.获取所有单据类型 + FilterBussinessTypeRequest filterBussinessTypeRequest = new FilterBussinessTypeRequest(); + filterBussinessTypeRequest.setEnable(true); + List basicBussinessTypeEntities = basicBussinessTypeService.findList(filterBussinessTypeRequest); + + //获取仓库关联单据类型 + if (StrUtil.isEmpty(filterInvLinkDataRequest.getCode())) + return ResultVOUtils.error(500, "仓库编码不能为空!"); + List warehouseBussniessTypeList = warehouseBussinessTypeService.getWarehouseBussniessTypeList(filterInvLinkDataRequest); + + basicBussinessTypeEntities.forEach(basicBussinessTypeEntity -> + { + for (WarehouseBussinessTypeEntity warehouseBussinessTypeEntity : warehouseBussniessTypeList) { + if (warehouseBussinessTypeEntity.getAction().equals(basicBussinessTypeEntity.getAction())) { + basicBussinessTypeEntity.setSelect(true); + break; + } + } + }); + return ResultVOUtils.success(basicBussinessTypeEntities); + } + + + @AuthRuleAnnotation("") + @PostMapping("/spms/invRelBusType/warehouse/post") + public BaseResponse postRes(@RequestBody UpdateInvRelBusRequest relBusRequset) { + if (StrUtil.isEmpty(relBusRequset.getInvCode())) + return ResultVOUtils.error(500, "仓库编码不能为空!"); + boolean b = warehouseBussinessTypeService.deleteByCode(relBusRequset.getInvCode()); + if (CollUtil.isNotEmpty(relBusRequset.getSelectActions())) { + List basicBussinessTypeResponses = new ArrayList<>(); + relBusRequset.getSelectActions().forEach(action -> + { + BasicBussinessTypeResponse basicBussinessTypeResponse = new BasicBussinessTypeResponse(); + basicBussinessTypeResponse.setAction(action); + basicBussinessTypeResponses.add(basicBussinessTypeResponse); + + }); + + warehouseBussinessTypeService.saveWarehouseBussinessType(relBusRequset.getInvCode(), basicBussinessTypeResponses); + } + //更新仓库修改时间 + InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(relBusRequset.getInvCode()); + DeptEntity pEntity = deptService.selectByCode(invWarehouseEntity.getParentId()); + pEntity.setUpdateTime(new Date()); + deptService.updateInvWarehouse(pEntity); + return ResultVOUtils.success("修改成功!"); + } + + @AuthRuleAnnotation("") @GetMapping("/udiwms/bussinessType/joinFilter") public BaseResponse filterJoinBussinessType(BussinessTypeFilterRequest bussinessTypeFilterRequest, diff --git a/src/main/java/com/glxp/api/dao/auth/WarehouseBussinessTypeDao.java b/src/main/java/com/glxp/api/dao/auth/WarehouseBussinessTypeDao.java index e0bdd8ba..a55e75fc 100644 --- a/src/main/java/com/glxp/api/dao/auth/WarehouseBussinessTypeDao.java +++ b/src/main/java/com/glxp/api/dao/auth/WarehouseBussinessTypeDao.java @@ -37,7 +37,7 @@ public interface WarehouseBussinessTypeDao { List filterList(FilterInvBusTypeRequest filterInvBusTypeRequest); - void deleteByCode(@Param("code") String code); + boolean deleteByCode(@Param("code") String code); /** diff --git a/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeEntity.java b/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeEntity.java index de618949..e1f27b43 100644 --- a/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeEntity.java +++ b/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeEntity.java @@ -338,4 +338,6 @@ public class BasicBussinessTypeEntity { */ @TableField(value = "createTime") private Date createTime; + + private boolean select; } \ No newline at end of file diff --git a/src/main/java/com/glxp/api/req/auth/FilterInvLinkDataRequest.java b/src/main/java/com/glxp/api/req/auth/FilterInvLinkDataRequest.java index 120ea3bd..c6a10220 100644 --- a/src/main/java/com/glxp/api/req/auth/FilterInvLinkDataRequest.java +++ b/src/main/java/com/glxp/api/req/auth/FilterInvLinkDataRequest.java @@ -9,8 +9,6 @@ import lombok.Data; @Data public class FilterInvLinkDataRequest extends ListPageRequest { - //分仓码 private String code; - } diff --git a/src/main/java/com/glxp/api/req/auth/UpdateInvRelBusRequest.java b/src/main/java/com/glxp/api/req/auth/UpdateInvRelBusRequest.java new file mode 100644 index 00000000..2c7a96af --- /dev/null +++ b/src/main/java/com/glxp/api/req/auth/UpdateInvRelBusRequest.java @@ -0,0 +1,15 @@ +package com.glxp.api.req.auth; + +import lombok.Data; + +import java.util.List; + +@Data +public class UpdateInvRelBusRequest { + + private String invCode; + private List selectActions; + + + +} diff --git a/src/main/java/com/glxp/api/req/auth/UpdateRelBusRequset.java b/src/main/java/com/glxp/api/req/auth/UpdateUserRelBusRequset.java similarity index 88% rename from src/main/java/com/glxp/api/req/auth/UpdateRelBusRequset.java rename to src/main/java/com/glxp/api/req/auth/UpdateUserRelBusRequset.java index 676da8ad..a03379ac 100644 --- a/src/main/java/com/glxp/api/req/auth/UpdateRelBusRequset.java +++ b/src/main/java/com/glxp/api/req/auth/UpdateUserRelBusRequset.java @@ -6,7 +6,7 @@ import lombok.Data; import java.util.List; @Data -public class UpdateRelBusRequset { +public class UpdateUserRelBusRequset { private String userId; private String subInvCode; private List selectActions; diff --git a/src/main/java/com/glxp/api/service/auth/WarehouseBussinessTypeService.java b/src/main/java/com/glxp/api/service/auth/WarehouseBussinessTypeService.java index bcf18209..20341e8f 100644 --- a/src/main/java/com/glxp/api/service/auth/WarehouseBussinessTypeService.java +++ b/src/main/java/com/glxp/api/service/auth/WarehouseBussinessTypeService.java @@ -33,6 +33,8 @@ public interface WarehouseBussinessTypeService { */ void deleteWarehouseByssuinessType(Integer id); + boolean deleteByCode(String code); + /** * 查询仓库关联的单据类型数据 * diff --git a/src/main/java/com/glxp/api/service/auth/impl/WarehouseBussinessTypeServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/WarehouseBussinessTypeServiceImpl.java index a9e2f342..0554507c 100644 --- a/src/main/java/com/glxp/api/service/auth/impl/WarehouseBussinessTypeServiceImpl.java +++ b/src/main/java/com/glxp/api/service/auth/impl/WarehouseBussinessTypeServiceImpl.java @@ -76,6 +76,11 @@ public class WarehouseBussinessTypeServiceImpl implements WarehouseBussinessType } } + @Override + public boolean deleteByCode(String code) { + return warehouseBussinessTypeDao.deleteByCode(code); + } + @Override public List getWarehouseBussniessTypeList(FilterInvLinkDataRequest filterInvLinkDataRequest) { if (filterInvLinkDataRequest == null) { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index afaae9e7..833ca2c7 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - active: dev + active: pro jmx: enabled: true