第三方仓库,仓库信息修改

master
anthonywj 2 years ago
parent 83ef10e32f
commit bc15c42c82

@ -0,0 +1,218 @@
package com.glxp.api.controller.auth;
import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.PageInfo;
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.entity.auth.DeptEntity;
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.system.DeleteRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.service.auth.DeptService;
import com.glxp.api.service.auth.InvBusUserService;
import com.glxp.api.service.auth.InvWarehouseService;
import com.glxp.api.service.auth.WarehouseBussinessTypeService;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@RestController
public class InvBusUserController {
@Resource
InvBusUserService invBusUserService;
@Resource
WarehouseBussinessTypeService warehouseBussinessTypeService;
@AuthRuleAnnotation("")
@GetMapping("spms/bus/user/select/filter")
public BaseResponse filterSelectInvUser(FilterInvBusUserRequest filterInvBusUserRequest) {
List<InvBusUserEntity> responses = invBusUserService.filterInvBusUser(filterInvBusUserRequest);
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntities =
warehouseBussinessTypeService.getListByCode(filterInvBusUserRequest.getSubInvCode());
warehouseBussinessTypeEntities.forEach(warehouseBussinessTypeEntity ->
{
for (InvBusUserEntity invBusUserEntity : responses) {
if (invBusUserEntity.getScAction().equals(warehouseBussinessTypeEntity.getAction())) {
warehouseBussinessTypeEntity.setSelect(true);
break;
}
}
});
return ResultVOUtils.success(warehouseBussinessTypeEntities);
}
//查询用户未关联单据类型
@AuthRuleAnnotation("")
@GetMapping("spms/bus/user/unselect/filter")
public BaseResponse filterUnSelectInvUser(FilterInvBusUserRequest filterInvBusUserRequest) {
List<InvBusUserEntity> responses = invBusUserService.filterInvBusUser(filterInvBusUserRequest);
List<String> selectedCodes = new ArrayList<>();
responses.forEach(invBusUserEntity ->
{
selectedCodes.add(invBusUserEntity.getScAction());
});
filterInvBusUserRequest.setSelectedCodes(selectedCodes);
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntityList = invBusUserService.filterUnSelect(filterInvBusUserRequest);
PageInfo<WarehouseBussinessTypeEntity> pageInfo = new PageInfo<>(warehouseBussinessTypeEntityList);
PageSimpleResponse<WarehouseBussinessTypeEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(warehouseBussinessTypeEntityList);
return ResultVOUtils.success(pageSimpleResponse);
}
/**
*
*
* @param filterInvBusUserRequest
* @return
*/
@AuthRuleAnnotation("")
@GetMapping("spms/bus/user/filterUserBusList")
public BaseResponse filterUserBusList(FilterInvBusUserRequest filterInvBusUserRequest) {
List<InvBusUserEntity> responses = invBusUserService.filterInvBusUser(filterInvBusUserRequest);
PageInfo<InvBusUserEntity> pageInfo = new PageInfo<>(responses);
PageSimpleResponse<WarehouseBussinessTypeEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
if (pageInfo.getTotal() == 0) {
pageSimpleResponse.setList(Collections.emptyList());
} else {
List<String> actions = responses.stream().map(InvBusUserEntity::getScAction).collect(Collectors.toList());
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntities = warehouseBussinessTypeService.selectByActions(filterInvBusUserRequest.getSubInvCode(), actions);
pageSimpleResponse.setList(warehouseBussinessTypeEntities);
}
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@PostMapping("/spms/bus/user/warehouse/update")
public BaseResponse updateRes(@RequestBody UpdateRelBusRequset relBusRequset) {
boolean b = invBusUserService.deleteByUnion(relBusRequset.getUserId(), relBusRequset.getSubInvCode());
if (CollUtil.isNotEmpty(relBusRequset.getInvBusUserEntities())) {
relBusRequset.getInvBusUserEntities().forEach(warehouseBussinessTypeEntity ->
{
InvBusUserEntity invBusUserEntity = new InvBusUserEntity();
invBusUserEntity.setUserId(relBusRequset.getUserId());
invBusUserEntity.setSubInvCode(relBusRequset.getSubInvCode());
invBusUserEntity.setScAction(warehouseBussinessTypeEntity.getAction());
invBusUserService.insertInvBusUser(invBusUserEntity);
});
}
InvBusUserEntity invBusUserEntity = new InvBusUserEntity();
invBusUserEntity.setSubInvCode(relBusRequset.getSubInvCode());
updateInvTime(invBusUserEntity);
return ResultVOUtils.success("修改成功!");
}
@AuthRuleAnnotation("")
@PostMapping("/spms/bus/user/warehouse/post")
public BaseResponse postRes(@RequestBody UpdateRelBusRequset relBusRequset) {
boolean b = invBusUserService.deleteByUnion(relBusRequset.getUserId(), relBusRequset.getSubInvCode());
if (CollUtil.isNotEmpty(relBusRequset.getSelectActions())) {
relBusRequset.getSelectActions().forEach(action ->
{
InvBusUserEntity invBusUserEntity = new InvBusUserEntity();
invBusUserEntity.setUserId(relBusRequset.getUserId());
invBusUserEntity.setSubInvCode(relBusRequset.getSubInvCode());
invBusUserEntity.setScAction(action);
invBusUserService.insertInvBusUser(invBusUserEntity);
});
}
InvBusUserEntity invBusUserEntity = new InvBusUserEntity();
invBusUserEntity.setSubInvCode(relBusRequset.getSubInvCode());
updateInvTime(invBusUserEntity);
return ResultVOUtils.success("修改成功!");
}
@AuthRuleAnnotation("")
@GetMapping("spms/bus/user/warehouse/filter")
public BaseResponse filterInvWarehouse(FilterInvBusUserRequest filterInvBusUserRequest) {
List<InvBusUserEntity> responses = invBusUserService.filterInvBusUser(filterInvBusUserRequest);
return ResultVOUtils.success(responses);
}
@AuthRuleAnnotation("")
@PostMapping("/spms/bus/user/warehouse/save")
public BaseResponse save(@RequestBody @Valid InvBusUserEntity invBusUserEntity,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
boolean b = invBusUserService.insertInvBusUser(invBusUserEntity);
updateInvTime(invBusUserEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success("添加成功!");
}
@AuthRuleAnnotation("")
@PostMapping("/spms/bus/user/warehouse/edit")
public BaseResponse edit(@RequestBody @Valid InvBusUserEntity invBusUserEntity,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (invBusUserEntity.getId() == null) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
boolean b = invBusUserService.updateInvBusUser(invBusUserEntity);
updateInvTime(invBusUserEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success("修改成功!");
}
@AuthRuleAnnotation("")
@PostMapping("/spms/bus/user/warehouse/delete")
public BaseResponse delete(@RequestBody DeleteRequest deleteRequest) {
if (deleteRequest.getId() == null) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
boolean b = invBusUserService.deleteById(deleteRequest.getId());
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success();
}
@Resource
InvWarehouseService invWarehouseService;
@Resource
DeptService deptService;
public void updateInvTime(InvBusUserEntity invBusUserEntity) {
InvWarehouseEntity invSubWarehouseEntity = invWarehouseService.findByInvSubByCode(invBusUserEntity.getSubInvCode());
DeptEntity pEntity = deptService.selectByCode(invSubWarehouseEntity.getParentId());
pEntity.setUpdateTime(new Date());
deptService.updateInvWarehouse(pEntity);
}
}

@ -8,11 +8,10 @@ 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.entity.auth.AuthAdmin;
import com.glxp.api.entity.auth.DeptEntity;
import com.glxp.api.entity.auth.InvWarehouseEntity;
import com.glxp.api.entity.auth.WarehouseUserEntity;
import com.glxp.api.constant.ConstantType;
import com.glxp.api.entity.auth.*;
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;
@ -22,10 +21,7 @@ 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.service.auth.CustomerService;
import com.glxp.api.service.auth.DeptService;
import com.glxp.api.service.auth.InvWarehouseService;
import com.glxp.api.service.auth.WarehouseUserService;
import com.glxp.api.service.auth.*;
import com.glxp.api.service.system.SystemParamConfigService;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.BindingResult;
@ -37,6 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@ -53,6 +50,8 @@ public class InvWarehouseController {
private WarehouseUserService warehouseUserService;
@Resource
private SystemParamConfigService systemParamConfigService;
@Resource
private WarehouseBussinessTypeService warehouseBussinessTypeService;
@AuthRuleAnnotation("")
@GetMapping("spms/sub/inv/warehouse/filter")
@ -326,4 +325,66 @@ public class InvWarehouseController {
return ResultVOUtils.success(response);
}
@AuthRuleAnnotation("")
@PostMapping("/warehouse/inout/warehouseBussniessTypeList")
public BaseResponse getWarehouseBussniessTypeList(@RequestBody @Valid FilterInvLinkDataRequest filterInvLinkDataRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<WarehouseBussinessTypeEntity> warehouseBussniessTypeList = warehouseBussinessTypeService.getWarehouseBussniessTypeList(filterInvLinkDataRequest);
PageInfo<WarehouseBussinessTypeEntity> pageInfo = new PageInfo<>(warehouseBussniessTypeList);
PageSimpleResponse<WarehouseBussinessTypeEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setList(pageInfo.getList());
pageSimpleResponse.setTotal(pageInfo.getTotal());
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@GetMapping("/udiwms/bussinessType/joinFilter")
public BaseResponse filterJoinBussinessType(BussinessTypeFilterRequest bussinessTypeFilterRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (StrUtil.isNotEmpty(bussinessTypeFilterRequest.getIds())) {
List<String> idList = new ArrayList<>(Arrays.asList(bussinessTypeFilterRequest.getIds().split(",")));
bussinessTypeFilterRequest.setActionList(idList);
}
// if (!StrUtil.isEmpty(bussinessTypeFilterRequest.getFilterAction())) {
// BussinessLocalTypeEntity bussinessLocalTypeEntity = bussinessLocalTypeService.findBTByAction(bussinessTypeFilterRequest.getFilterAction());
// if (bussinessLocalTypeEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
// bussinessTypeFilterRequest.setMainAction(ConstantType.TYPE_OUT);
// } else {
// bussinessTypeFilterRequest.setMainAction(ConstantType.TYPE_PUT);
// }
//
// bussinessTypeFilterRequest.setAdvanceType(bussinessLocalTypeEntity.isAdvanceType());
// }
//
// //查询该仓库绑定的单据
// List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntityList = warehouseBussinessTypeService.getListByCode(bussinessTypeFilterRequest.getCode());
// List<BussinessTypResponse> bussinessTypeEntities;
// bussinessTypeEntities = bussinessTypeService.filterJoinList(bussinessTypeFilterRequest);
// for (BussinessTypResponse w1 : bussinessTypeEntities) {
// for (WarehouseBussinessTypeEntity w2 : warehouseBussinessTypeEntityList) {
// if (w1.getAction().equals(w2.getAction())) {
// w1.setCheckSelect(true);
// break;
// }
// }
// }
//
// PageInfo<BussinessTypResponse> pageInfo;
// pageInfo = new PageInfo<>(bussinessTypeEntities);
// PageSimpleResponse<BussinessTypResponse> pageSimpleResponse = new PageSimpleResponse<>();
// pageSimpleResponse.setTotal(pageInfo.getTotal());
// pageSimpleResponse.setList(bussinessTypeEntities);
// return ResultVOUtils.success(pageSimpleResponse);
return null;
}
}

@ -0,0 +1,147 @@
package com.glxp.api.controller.thrsys;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageInfo;
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.entity.thrsys.ThrDeptEntity;
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.req.thrsys.FilterThrDeptRequest;
import com.glxp.api.req.thrsys.FilterThrSubInvWarehouseRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.service.thrsys.ThrDeptService;
import com.glxp.api.service.thrsys.ThrInvWarehouseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Date;
import java.util.List;
/**
*
*/
@Slf4j
@RestController
public class ThrDeptController {
@Resource
ThrDeptService thrDeptService;
@Resource
ThrInvWarehouseService thrInvWarehouseService;
@GetMapping("spms/thrsys/warehouse/filter")
public BaseResponse filterInvWarehouse(FilterThrDeptRequest filterThrDeptRequest) {
List<ThrDeptEntity> thrInvWarehouseEntities = thrDeptService.filterThrInvWarehouse(filterThrDeptRequest);
PageInfo<ThrDeptEntity> pageInfo;
pageInfo = new PageInfo<>(thrInvWarehouseEntities);
PageSimpleResponse<ThrDeptEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(thrInvWarehouseEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
@GetMapping("spms/thrsys/warehouse/filterAll")
public BaseResponse filterAllInvWarehouse(FilterThrDeptRequest filterThrDeptRequest) {
filterThrDeptRequest.setPid(0);
List<ThrDeptEntity> thrInvWarehouseEntities = thrDeptService.filterThrInvWarehouse(filterThrDeptRequest);
return ResultVOUtils.success(thrInvWarehouseEntities);
}
@PostMapping("/spms/thrsys/warehouse/save")
public BaseResponse save(@RequestBody @Valid ThrDeptEntity thrDeptEntity,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (thrDeptEntity.getPid() == null) {//仓库
thrDeptEntity.setPid(0); // 默认设置
FilterThrDeptRequest filterThrDeptRequest = new FilterThrDeptRequest();
filterThrDeptRequest.setPid(thrDeptEntity.getPid());
} else {//货位
FilterThrDeptRequest filterThrDeptRequest = new FilterThrDeptRequest();
filterThrDeptRequest.setPid(thrDeptEntity.getPid());
ThrDeptEntity pEntity = thrDeptService.selectById(thrDeptEntity.getPid() + "");
thrDeptEntity.setAdvanceType(pEntity.getAdvanceType());
thrDeptEntity.setLevel(pEntity.getLevel());
thrDeptEntity.setPcode(pEntity.getPcode());
}
thrDeptEntity.setUpdateTime(new Date());
boolean b = thrDeptService.insertInvWarehouse(thrDeptEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success("添加成功!");
}
@PostMapping("/spms/thrsys/warehouse/edit")
public BaseResponse edit(@RequestBody @Valid ThrDeptEntity thrDeptEntity,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (thrDeptEntity.getId() == null) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
thrDeptEntity.setPid(null); // 不能修改父级 pid
thrDeptEntity.setUpdateTime(new Date());
boolean b = thrDeptService.updateInvWarehouse(thrDeptEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success();
}
@PostMapping("/spms/thrsys/warehouse/delete")
public BaseResponse delete(@RequestBody DeleteRequest deleteRequest) {
if (deleteRequest.getId() == null) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return thrDeptService.deleteInvById(deleteRequest.getId());
}
/**
*
*/
@GetMapping("/spms/thrsys/warehouse/download")
public BaseResponse downloadThirdWarehouse(String thirdSysFk) {
if (StrUtil.isBlank(thirdSysFk)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return thrDeptService.downloadThirdWarehouse(thirdSysFk);
}
@GetMapping("/spms/sub/inv/warehouse/filterThridInv")
public BaseResponse filterInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
// todo
// InvWarehouseEntity invWarehouseEntity = invWarehouseService.selectByCode(filterThrSubInvWarehouseRequest.getParentId());
// Object thirdId = ReflectUtil.getFieldValue(invWarehouseEntity, filterThrSubInvWarehouseRequest.getThirdSysFk());
// if (thirdId == null) {
// return ResultVOUtils.error(500, "请先关联仓库对应的第三方仓库,再关联分库!");
// }
// filterThrSubInvWarehouseRequest.setParentId((String) thirdId);
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = thrInvWarehouseService.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
PageInfo<ThrInvWarehouseEntity> pageInfo;
pageInfo = new PageInfo<>(thrInvWarehouseEntities);
PageSimpleResponse<ThrInvWarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(thrInvWarehouseEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
}

@ -0,0 +1,120 @@
package com.glxp.api.controller.thrsys;
import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageInfo;
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.entity.thrsys.ThrDeptEntity;
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.req.thrsys.FilterThrSubInvWarehouseRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.thrsys.ThrInvWarehouseResponse;
import com.glxp.api.service.thrsys.ThrDeptService;
import com.glxp.api.service.thrsys.ThrInvWarehouseService;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Date;
import java.util.List;
@RestController
public class ThrInvWarehouseController {
@Resource
ThrInvWarehouseService thrInvWarehouseService;
@Resource
ThrDeptService thrDeptService;
@GetMapping("/thirdSys/sub/inv/warehouse/filter")
public BaseResponse filterInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
List<ThrInvWarehouseResponse> ThrInvWarehouseResponses = thrInvWarehouseService.filterThrInvWarehouseResponse(filterThrSubInvWarehouseRequest);
PageInfo<ThrInvWarehouseResponse> pageInfo;
pageInfo = new PageInfo<>(ThrInvWarehouseResponses);
PageSimpleResponse<ThrInvWarehouseResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(ThrInvWarehouseResponses);
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@GetMapping("/thirdSys/sub/inv/warehouse/filterAll")
public BaseResponse filterAllInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
List<ThrInvWarehouseEntity> invSubWarehouseEntities = thrInvWarehouseService.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
return ResultVOUtils.success(invSubWarehouseEntities);
}
@AuthRuleAnnotation("")
@PostMapping("/thirdSys/sub/inv/warehouse/save")
public BaseResponse save(@RequestBody @Valid ThrInvWarehouseEntity invSubWarehouseEntity,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
invSubWarehouseEntity.setId(IdUtil.getSnowflake(6, 1).nextId() + "");
boolean b = thrInvWarehouseService.insertThrInvWarehouse(invSubWarehouseEntity);
ThrDeptEntity thrDeptEntity = thrDeptService.selectByCode(invSubWarehouseEntity.getParentId(), invSubWarehouseEntity.getThirdSysFk());
thrDeptEntity.setUpdateTime(new Date());
thrDeptService.updateInvWarehouse(thrDeptEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success("添加成功!");
}
@AuthRuleAnnotation("")
@PostMapping("/thirdSys/sub/inv/warehouse/edit")
public BaseResponse edit(@RequestBody @Valid ThrInvWarehouseEntity invSubWarehouseEntity,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (invSubWarehouseEntity.getId() == null) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
boolean b = thrInvWarehouseService.updateThrInvWarehouse(invSubWarehouseEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
ThrDeptEntity thrDeptEntity = thrDeptService.selectByCode(invSubWarehouseEntity.getParentId(), invSubWarehouseEntity.getThirdSysFk());
thrDeptEntity.setUpdateTime(new Date());
thrDeptService.updateInvWarehouse(thrDeptEntity);
return ResultVOUtils.success("修改成功!");
}
@AuthRuleAnnotation("")
@PostMapping("/thirdSys/sub/inv/warehouse/delete")
public BaseResponse delete(@RequestBody DeleteRequest deleteRequest) {
if (deleteRequest.getId() == null) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseService.selectById(deleteRequest.getId());
ThrDeptEntity thrDeptEntity = thrDeptService.selectByCode(thrInvWarehouseEntity.getParentId(), thrInvWarehouseEntity.getThirdSysFk());
thrDeptEntity.setUpdateTime(new Date());
thrDeptService.updateInvWarehouse(thrDeptEntity);
boolean b = thrInvWarehouseService.deleteById(deleteRequest.getId());
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success("刪除成功!");
}
}

@ -0,0 +1,29 @@
package com.glxp.api.dao.auth;
import com.glxp.api.entity.auth.InvBusUserEntity;
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
import com.glxp.api.req.auth.FilterInvBusUserRequest;
import com.glxp.api.res.auth.InvBusUserResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface InvBusUserDao {
List<InvBusUserEntity> filterInvBusUser(FilterInvBusUserRequest filterInvBusUserRequest);
List<WarehouseBussinessTypeEntity> filterUnSelect(FilterInvBusUserRequest filterInvBusUserRequest);
List<InvBusUserResponse> filterJoinInvBusUser(FilterInvBusUserRequest filterInvBusUserRequest);
boolean insertInvBusUser(InvBusUserEntity InvBusUserEntity);
boolean updateInvBusUser(InvBusUserEntity InvBusUserEntity);
boolean deleteById(@Param("id") String id);
boolean deleteByUnion(@Param("userId") String userId, @Param("subInvCode") String subInvCode);
}

@ -0,0 +1,50 @@
package com.glxp.api.dao.auth;
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
import com.glxp.api.req.auth.FilterInvBusTypeRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface WarehouseBussinessTypeDao {
WarehouseBussinessTypeEntity selectById(Integer id);
int deleteByPrimaryKey(Integer id);
int insert(WarehouseBussinessTypeEntity record);
int insertOrUpdate(WarehouseBussinessTypeEntity record);
int insertOrUpdateSelective(WarehouseBussinessTypeEntity record);
int insertSelective(WarehouseBussinessTypeEntity record);
WarehouseBussinessTypeEntity selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(WarehouseBussinessTypeEntity record);
int updateByPrimaryKey(WarehouseBussinessTypeEntity record);
int updateBatch(List<WarehouseBussinessTypeEntity> list);
int updateBatchSelective(List<WarehouseBussinessTypeEntity> list);
int batchInsert(@Param("list") List<WarehouseBussinessTypeEntity> list);
List<WarehouseBussinessTypeEntity> selectListByCode(@Param("code") String code);
List<WarehouseBussinessTypeEntity> filterList(FilterInvBusTypeRequest filterInvBusTypeRequest);
void deleteByCode(@Param("code") String code);
/**
*
*
* @param actions
* @return
*/
List<WarehouseBussinessTypeEntity> selectByActions(@Param("subInvCode") String subInvCode, @Param("actions") List<String> actions);
}

@ -14,7 +14,7 @@ import java.util.List;
*
*/
@Mapper
public interface ThrBusTypeOriginDao extends BaseMapperPlus<ThrBusTypeOriginDao, ThrBusTypeOriginEntity, ThrBusTypeOriginEntity> {
public interface ThrBusTypeOriginDao extends BaseMapperPlus<ThrBusTypeOriginDao, ThrBusTypeOriginEntity, ThrBusTypeOriginResponse> {
/**
*

@ -0,0 +1,33 @@
package com.glxp.api.dao.thrsys;
import com.glxp.api.entity.thrsys.ThrDeptEntity;
import com.glxp.api.req.thrsys.FilterThrDeptRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ThrDeptDao {
List<ThrDeptEntity> filterThrInvWarehouse(FilterThrDeptRequest filterThrDeptRequest);
List<ThrDeptEntity> filterThrGroupInvWarehouse(FilterThrDeptRequest filterThrDeptRequest);
boolean insertThrInvWarehouse(ThrDeptEntity thrDeptEntity);
boolean insertInvWarehouses(@Param("thrInvWarehouseEntitys") List<ThrDeptEntity> thrDeptEntities);
boolean updateThrInvWarehouse(ThrDeptEntity thrDeptEntity);
ThrDeptEntity selectById(@Param("id") String id);
boolean deleteById(@Param("id") String id);
/**
* code
*/
ThrDeptEntity selectByCode(@Param("code") String code);
ThrDeptEntity selectMaxCode(FilterThrDeptRequest filterThrDeptRequest);
}

@ -0,0 +1,32 @@
package com.glxp.api.dao.thrsys;
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.api.req.thrsys.FilterThrSubInvWarehouseRequest;
import com.glxp.api.res.thrsys.ThrInvWarehouseResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ThrInvWarehouseDao {
List<ThrInvWarehouseEntity> filterThrInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest);
boolean insertThrInvWarehouse(ThrInvWarehouseEntity thrInvWarehouseEntity);
boolean insertThrInvWarehouses(@Param("thrInvWarehouseEntitys") List<ThrInvWarehouseEntity> thrInvWarehouseEntitys);
boolean updateThrInvWarehouse(ThrInvWarehouseEntity thrInvWarehouseEntity);
boolean deleteById(@Param("id") String id);
/**
*
*/
int countSubInvByParentInvId(String parentInvId);
List<ThrInvWarehouseResponse> filterThrInvWarehouseResponse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest);
}

@ -0,0 +1,13 @@
package com.glxp.api.entity.auth;
import lombok.Data;
@Data
public class InvBusUserEntity {
private Integer id;
private String userId;
private String subInvCode;
private String scAction;
private String remark;
}

@ -0,0 +1,31 @@
package com.glxp.api.entity.auth;
import lombok.Data;
/**
* -
*/
@Data
public class WarehouseBussinessTypeEntity {
/**
* id
*/
private Integer id;
/**
*
*/
private String code;
/**
*
*/
private String action;
/**
*
*/
private String name;
private boolean select;
}

@ -0,0 +1,37 @@
package com.glxp.api.entity.thrsys;
import lombok.Data;
import java.util.Date;
/**
*
*/
@Data
public class ThrDeptEntity {
private Integer id;
private Integer pid;
private String code;
private String name;
private Boolean advanceType;
private Boolean isDefault;
private Integer status;
private Date updateTime;
private String remark;
/**
*
*/
private Integer level;
/**
*
*/
private String pcode;
/**
*
*/
private String thirdSysFk;
}

@ -0,0 +1,17 @@
package com.glxp.api.entity.thrsys;
import lombok.Data;
@Data
public class ThrInvWarehouseEntity {
private String id;
private String code;
private String name;
private String parentId;
private String remark;
private String thirdSysFk;
}

@ -12,9 +12,11 @@ import com.glxp.api.http.req.UdiwmsUnitRequest;
import com.glxp.api.req.thrsys.FilterBasicThirdSysDetailRequest;
import com.glxp.api.req.thrsys.FilterThrProductsRequest;
import com.glxp.api.req.thrsys.ThrUnitMaintainFilterRequest;
import com.glxp.api.req.thrsys.UdiwmsWarehouseRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.thrsys.ThrCorpsResponse;
import com.glxp.api.res.thrsys.ThrProductsResponse;
import com.glxp.api.res.thrsys.UdiwmsWarehouseDetail;
import com.glxp.api.service.thrsys.ThrSystemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@ -98,22 +100,22 @@ public class ErpBasicClient {
// }
// }
//
// //查询仓库货位号
// public BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) {
// BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(udiwmsWarehouseRequest.getThirdSys());
// String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/getWarehouse";
// try {
// String response = httpOkClient.uCloudPost(url, udiwmsWarehouseRequest);
// BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> listBaseResponse =
// JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>>>() {
// });
//
// return listBaseResponse;
// } catch (Exception e) {
// log.error("获取第三方系统的仓库货位码异常", e);
// return ResultVOUtils.error(500, "连接第三方系统接口服务出错");
// }
// }
//查询仓库货位号
public BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) {
ThrSystemEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(udiwmsWarehouseRequest.getThirdSys());
String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/getWarehouse";
try {
String response = httpOkClient.uCloudPost(url, udiwmsWarehouseRequest);
BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> listBaseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>>>() {
});
return listBaseResponse;
} catch (Exception e) {
log.error("获取第三方系统的仓库货位码异常", e);
return ResultVOUtils.error(500, "连接第三方系统接口服务出错");
}
}
//测试连通性
public BaseResponse testConnection(ThrSystemEntity thrSystemEntity) {

@ -0,0 +1,37 @@
package com.glxp.api.req.auth;
import com.glxp.api.req.ListPageRequest;
import lombok.Data;
import java.util.List;
@Data
public class BussinessTypeFilterRequest extends ListPageRequest {
private Boolean enable;
private String action;
private String thirdAction;
private String name;
private String mainAction;
private Boolean enabled;
private Boolean checkEnable;
private Boolean advanceType;
private String type;
private Integer index;
private Boolean spUse;
private String localAction;
private Boolean secCheckEnable;
private String filterAction;
private Integer userId;
private String locInvCode;
private String locSubInvCode;
private String lastUpdateTime;
private String code;
private String ids;
private List<String> actionList;
private Boolean preIn;
}

@ -0,0 +1,12 @@
package com.glxp.api.req.auth;
import com.glxp.api.req.ListPageRequest;
import lombok.Data;
@Data
public class FilterInvBusTypeRequest extends ListPageRequest {
private String lastUpdateTime;
private Integer id;
private String code;
private String action;
}

@ -0,0 +1,17 @@
package com.glxp.api.req.auth;
import com.glxp.api.req.ListPageRequest;
import lombok.Data;
import java.util.List;
@Data
public class FilterInvBusUserRequest extends ListPageRequest {
private String userId;
private String subInvCode;
private String scAction;
private List<String> selectedCodes;
}

@ -0,0 +1,17 @@
package com.glxp.api.req.auth;
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
import lombok.Data;
import java.util.List;
@Data
public class UpdateRelBusRequset {
private String userId;
private String subInvCode;
private List<String> selectActions;
private List<WarehouseBussinessTypeEntity> invBusUserEntities;
}

@ -0,0 +1,29 @@
package com.glxp.api.req.thrsys;
import com.glxp.api.req.ListPageRequest;
import lombok.Data;
import java.util.Date;
@Data
public class FilterThrDeptRequest extends ListPageRequest {
private Integer id;
private Integer pid;
private String code;
private String name;
private Boolean advanceType;
private Boolean isDefault;
private Date updateTime;
private String key;
private String pcode;
private Integer level;
private String lastUpdateTime;
/**
*
*/
private String thirdSysFk;
}

@ -0,0 +1,15 @@
package com.glxp.api.req.thrsys;
import com.glxp.api.req.ListPageRequest;
import lombok.Data;
@Data
public class FilterThrSubInvWarehouseRequest extends ListPageRequest {
private String id;
private String code;
private String name;
private String parentId;
private String thirdSysFk;
}

@ -0,0 +1,21 @@
package com.glxp.api.req.thrsys;
import com.glxp.api.req.ListPageRequest;
import lombok.Data;
/**
*
*/
@Data
public class UdiwmsWarehouseRequest extends ListPageRequest {
//仓库号,支持模糊查询
private String inventoryCode;
//货位号,支持模糊查询
private String warehouseCode;
//第三方系统ID
private String thirdSys;
}

@ -0,0 +1,15 @@
package com.glxp.api.res.auth;
import lombok.Data;
@Data
public class InvBusUserResponse {
private Integer id;
private String userId;
private String subInvCode;
private String scAction;
private String billTypeName;
private String remark;
}

@ -0,0 +1,34 @@
package com.glxp.api.res.thrsys;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class ThrDeptResponse {
private Integer id;
private Integer pid;
private String code;
private String name;
private Boolean advanceType;
private Boolean isDefault;
private Integer status;
private Date updateTime;
private String remark;
/**
*
*/
private String thirdSysFk;
/**
*
*/
private String thirdName;
private List<ThrDeptResponse> children;
}

@ -0,0 +1,17 @@
package com.glxp.api.res.thrsys;
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
import lombok.Data;
/**
*
*/
@Data
public class ThrInvWarehouseResponse extends ThrInvWarehouseEntity {
/**
*
*/
private String parentName;
}

@ -0,0 +1,35 @@
package com.glxp.api.res.thrsys;
import lombok.Data;
import java.util.List;
@Data
public class UdiwmsWarehouseDetail {
//货位号
private String code;
//货位名称
private String name;
//备注
private String remark;
private List<SubWarehouse> subWarehouses;
@Data
public static class SubWarehouse {
//货位号
private String code;
//货位名称
private String name;
//备注
private String remark;
}
}

@ -0,0 +1,17 @@
package com.glxp.api.res.thrsys;
import lombok.Data;
import java.util.List;
/**
*
*/
@Data
public class UdiwmsWarehouseResponse extends UdiwmsWarehouseDetail{
private List<UdiwmsWarehouseDetail> details;
}

@ -0,0 +1,29 @@
package com.glxp.api.service.auth;
import com.glxp.api.entity.auth.InvBusUserEntity;
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
import com.glxp.api.req.auth.FilterInvBusUserRequest;
import com.glxp.api.res.auth.InvBusUserResponse;
import java.util.List;
public interface InvBusUserService {
List<InvBusUserEntity> filterInvBusUser(FilterInvBusUserRequest filterInvBusUserRequest);
List<WarehouseBussinessTypeEntity> filterUnSelect(FilterInvBusUserRequest filterInvBusUserRequest);
List<InvBusUserResponse> filterJoinInvBusUser(FilterInvBusUserRequest filterInvBusUserRequest);
List<InvBusUserEntity> selectByUnion(String userId, String subInvCode);
boolean insertInvBusUser(InvBusUserEntity InvBusUserEntity);
boolean updateInvBusUser(InvBusUserEntity InvBusUserEntity);
boolean deleteById(String id);
boolean deleteByUnion(String userId, String subInvCode);
}

@ -0,0 +1,52 @@
package com.glxp.api.service.auth;
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
import com.glxp.api.req.auth.FilterInvBusTypeRequest;
import com.glxp.api.req.auth.FilterInvLinkDataRequest;
import com.glxp.api.res.basic.BasicBussinessTypeResponse;
import java.util.List;
public interface WarehouseBussinessTypeService {
WarehouseBussinessTypeEntity selectById(Integer id);
/**
* code
*
* @param code
* @return
*/
List<WarehouseBussinessTypeEntity> getListByCode(String code);
List<WarehouseBussinessTypeEntity> filterList(FilterInvBusTypeRequest filterInvBusTypeRequest);
/**
* -
*/
void saveWarehouseBussinessType(String code, List<BasicBussinessTypeResponse> bussinessTypResponseList);
/**
*
*
* @param id
*/
void deleteWarehouseByssuinessType(Integer id);
/**
*
*
* @param filterInvLinkDataRequest
* @return
*/
List<WarehouseBussinessTypeEntity> getWarehouseBussniessTypeList(FilterInvLinkDataRequest filterInvLinkDataRequest);
/**
*
*
* @param actions
* @return
*/
List<WarehouseBussinessTypeEntity> selectByActions(String subInvCode, List<String> actions);
}

@ -0,0 +1,96 @@
package com.glxp.api.service.auth.impl;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.auth.InvBusUserDao;
import com.glxp.api.entity.auth.InvBusUserEntity;
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
import com.glxp.api.req.auth.FilterInvBusUserRequest;
import com.glxp.api.res.auth.InvBusUserResponse;
import com.glxp.api.service.auth.InvBusUserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class InvBusUserServiceImpl implements InvBusUserService {
@Resource
InvBusUserDao invBusUserDao;
@Override
public List<InvBusUserEntity> filterInvBusUser(FilterInvBusUserRequest filterInvBusUserRequest) {
if (filterInvBusUserRequest == null) {
return Collections.emptyList();
}
if (filterInvBusUserRequest.getPage() != null) {
int offset = (filterInvBusUserRequest.getPage() - 1) * filterInvBusUserRequest.getLimit();
PageHelper.offsetPage(offset, filterInvBusUserRequest.getLimit());
}
return invBusUserDao.filterInvBusUser(filterInvBusUserRequest);
}
@Override
public List<WarehouseBussinessTypeEntity> filterUnSelect(FilterInvBusUserRequest filterInvBusUserRequest) {
if (filterInvBusUserRequest == null) {
return Collections.emptyList();
}
if (filterInvBusUserRequest.getPage() != null) {
int offset = (filterInvBusUserRequest.getPage() - 1) * filterInvBusUserRequest.getLimit();
PageHelper.offsetPage(offset, filterInvBusUserRequest.getLimit());
}
return invBusUserDao.filterUnSelect(filterInvBusUserRequest);
}
@Override
public List<InvBusUserResponse> filterJoinInvBusUser(FilterInvBusUserRequest filterInvBusUserRequest) {
if (filterInvBusUserRequest == null) {
return Collections.emptyList();
}
if (filterInvBusUserRequest.getPage() != null) {
int offset = (filterInvBusUserRequest.getPage() - 1) * filterInvBusUserRequest.getLimit();
PageHelper.offsetPage(offset, filterInvBusUserRequest.getLimit());
}
return invBusUserDao.filterJoinInvBusUser(filterInvBusUserRequest);
}
@Override
public List<InvBusUserEntity> selectByUnion(String userId, String subInvCode) {
if (StrUtil.isEmpty(userId) || StrUtil.isEmpty(subInvCode)) {
return Collections.emptyList();
}
FilterInvBusUserRequest filterInvBusUserRequest = new FilterInvBusUserRequest();
filterInvBusUserRequest.setUserId(userId);
filterInvBusUserRequest.setSubInvCode(subInvCode);
return invBusUserDao.filterInvBusUser(filterInvBusUserRequest);
}
@Override
public boolean insertInvBusUser(InvBusUserEntity invBusUserEntity) {
return invBusUserDao.insertInvBusUser(invBusUserEntity);
}
@Override
public boolean updateInvBusUser(InvBusUserEntity invBusUserEntity) {
return invBusUserDao.updateInvBusUser(invBusUserEntity);
}
@Override
public boolean deleteById(String id) {
return invBusUserDao.deleteById(id);
}
@Override
public boolean deleteByUnion(String userId, String subInvCode) {
if (StrUtil.isEmpty(userId) || StrUtil.isEmpty(subInvCode)) {
return false;
}
return invBusUserDao.deleteByUnion(userId, subInvCode);
}
}

@ -0,0 +1,95 @@
package com.glxp.api.service.auth.impl;
import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.auth.WarehouseBussinessTypeDao;
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
import com.glxp.api.req.auth.FilterInvBusTypeRequest;
import com.glxp.api.req.auth.FilterInvLinkDataRequest;
import com.glxp.api.res.basic.BasicBussinessTypeResponse;
import com.glxp.api.service.auth.WarehouseBussinessTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Slf4j
@Service
public class WarehouseBussinessTypeServiceImpl implements WarehouseBussinessTypeService {
@Resource
private WarehouseBussinessTypeDao warehouseBussinessTypeDao;
@Override
public WarehouseBussinessTypeEntity selectById(Integer id) {
return warehouseBussinessTypeDao.selectById(id);
}
@Override
public List<WarehouseBussinessTypeEntity> getListByCode(String code) {
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntities = warehouseBussinessTypeDao.selectListByCode(code);
if (CollUtil.isEmpty(warehouseBussinessTypeEntities)) {
return Collections.emptyList();
}
return warehouseBussinessTypeEntities;
}
@Override
public List<WarehouseBussinessTypeEntity> filterList(FilterInvBusTypeRequest filterInvBusTypeRequest) {
if (filterInvBusTypeRequest == null) {
return Collections.emptyList();
}
if (filterInvBusTypeRequest.getPage() != null) {
int offset = (filterInvBusTypeRequest.getPage() - 1) * filterInvBusTypeRequest.getLimit();
PageHelper.offsetPage(offset, filterInvBusTypeRequest.getLimit());
}
return warehouseBussinessTypeDao.filterList(filterInvBusTypeRequest);
}
@Override
public void saveWarehouseBussinessType(String code, List<BasicBussinessTypeResponse> bussinessTypResponseList) {
if (CollUtil.isNotEmpty(bussinessTypResponseList)) {
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntities = new ArrayList<>(bussinessTypResponseList.size());
bussinessTypResponseList.forEach(bussinessTypeEntity -> {
WarehouseBussinessTypeEntity entity = new WarehouseBussinessTypeEntity();
entity.setCode(code);
entity.setAction(bussinessTypeEntity.getAction());
entity.setName(bussinessTypeEntity.getName());
warehouseBussinessTypeEntities.add(entity);
});
//加入新数据
warehouseBussinessTypeDao.batchInsert(warehouseBussinessTypeEntities);
}
}
@Override
public void deleteWarehouseByssuinessType(Integer id) {
if (null != id) {
warehouseBussinessTypeDao.deleteByPrimaryKey(id);
}
}
@Override
public List<WarehouseBussinessTypeEntity> getWarehouseBussniessTypeList(FilterInvLinkDataRequest filterInvLinkDataRequest) {
if (filterInvLinkDataRequest == null) {
return Collections.emptyList();
}
if (filterInvLinkDataRequest.getPage() != null) {
int offset = (filterInvLinkDataRequest.getPage() - 1) * filterInvLinkDataRequest.getLimit();
PageHelper.offsetPage(offset, filterInvLinkDataRequest.getLimit());
}
return warehouseBussinessTypeDao.selectListByCode(filterInvLinkDataRequest.getCode());
}
@Override
public List<WarehouseBussinessTypeEntity> selectByActions(String subInvCode, List<String> actions) {
return warehouseBussinessTypeDao.selectByActions(subInvCode, actions);
}
}

@ -0,0 +1,48 @@
package com.glxp.api.service.thrsys;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.entity.thrsys.ThrDeptEntity;
import com.glxp.api.req.thrsys.FilterThrDeptRequest;
import java.util.List;
public interface ThrDeptService {
ThrDeptEntity findDefault(Boolean advaceType, Boolean isDefault);
List<ThrDeptEntity> filterThrInvWarehouse(FilterThrDeptRequest filterThrDeptRequest);
List<ThrDeptEntity> filterGroupInvWarehouse(FilterThrDeptRequest filterThrDeptRequest);
boolean insertInvWarehouse(ThrDeptEntity thrDeptEntity);
boolean insertInvWarehouses(List<ThrDeptEntity> thrDeptEntities);
boolean updateInvWarehouse(ThrDeptEntity thrDeptEntity);
ThrDeptEntity selectById(String id);
ThrDeptEntity selectByCode(String code, String thirdSysFk);
boolean deleteById(String id);
ThrDeptEntity selectMaxCode(FilterThrDeptRequest filterThrDeptRequest);
/**
*
*
* @param thirdSysFk
* @return
*/
BaseResponse downloadThirdWarehouse(String thirdSysFk);
/**
*
*
* @param id
* @return
*/
BaseResponse deleteInvById(String id);
}

@ -0,0 +1,34 @@
package com.glxp.api.service.thrsys;
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.api.req.thrsys.FilterThrSubInvWarehouseRequest;
import com.glxp.api.res.thrsys.ThrInvWarehouseResponse;
import java.util.List;
public interface ThrInvWarehouseService {
ThrInvWarehouseEntity selectById(String id);
ThrInvWarehouseEntity selectByThrCode(String thirdSys, String thirdId);
List<ThrInvWarehouseEntity> filterThrInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest);
boolean insertThrInvWarehouse(ThrInvWarehouseEntity thrInvWarehouseEntity);
boolean insertInvWarehouses(List<ThrInvWarehouseEntity> thrSubInvWarehouseEntities);
boolean updateThrInvWarehouse(ThrInvWarehouseEntity thrInvWarehouseEntity);
boolean deleteById(String id);
/**
*
*
* @param filterThrSubInvWarehouseRequest
* @return
*/
List<ThrInvWarehouseResponse> filterThrInvWarehouseResponse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest);
}

@ -0,0 +1,185 @@
package com.glxp.api.service.thrsys.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.dao.thrsys.ThrDeptDao;
import com.glxp.api.dao.thrsys.ThrInvWarehouseDao;
import com.glxp.api.entity.thrsys.ThrDeptEntity;
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.api.http.ErpBasicClient;
import com.glxp.api.req.thrsys.FilterThrDeptRequest;
import com.glxp.api.req.thrsys.UdiwmsWarehouseRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.thrsys.UdiwmsWarehouseDetail;
import com.glxp.api.service.thrsys.ThrDeptService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Service
public class ThrDeptServiceImpl implements ThrDeptService {
@Resource
private ThrDeptDao thrDeptDao;
@Resource
private ErpBasicClient erpBasicClient;
@Resource
private ThrInvWarehouseDao thrInvWarehouseDao;
@Override
public ThrDeptEntity findDefault(Boolean advaceType, Boolean isDefault) {
FilterThrDeptRequest filterThrDeptRequest = new FilterThrDeptRequest();
filterThrDeptRequest.setIsDefault(isDefault);
filterThrDeptRequest.setAdvanceType(advaceType);
List<ThrDeptEntity> thrInvWarehouseEntities = thrDeptDao.filterThrInvWarehouse(filterThrDeptRequest);
if (thrInvWarehouseEntities != null && thrInvWarehouseEntities.size() > 0)
return thrInvWarehouseEntities.get(0);
return null;
}
@Override
public List<ThrDeptEntity> filterThrInvWarehouse(FilterThrDeptRequest filterThrDeptRequest) {
if (filterThrDeptRequest == null) {
return Collections.emptyList();
}
if (filterThrDeptRequest.getPage() != null) {
int offset = (filterThrDeptRequest.getPage() - 1) * filterThrDeptRequest.getLimit();
PageHelper.offsetPage(offset, filterThrDeptRequest.getLimit());
}
return thrDeptDao.filterThrInvWarehouse(filterThrDeptRequest);
}
@Override
public List<ThrDeptEntity> filterGroupInvWarehouse(FilterThrDeptRequest filterThrDeptRequest) {
if (filterThrDeptRequest == null) {
return Collections.emptyList();
}
if (filterThrDeptRequest.getPage() != null) {
int offset = (filterThrDeptRequest.getPage() - 1) * filterThrDeptRequest.getLimit();
PageHelper.offsetPage(offset, filterThrDeptRequest.getLimit());
}
return thrDeptDao.filterThrGroupInvWarehouse(filterThrDeptRequest);
}
@Override
public boolean insertInvWarehouse(ThrDeptEntity thrDeptEntity) {
return thrDeptDao.insertThrInvWarehouse(thrDeptEntity);
}
@Override
public boolean insertInvWarehouses(List<ThrDeptEntity> thrDeptEntities) {
return thrDeptDao.insertInvWarehouses(thrDeptEntities);
}
@Override
public boolean updateInvWarehouse(ThrDeptEntity thrDeptEntity) {
return thrDeptDao.updateThrInvWarehouse(thrDeptEntity);
}
@Override
public ThrDeptEntity selectById(String id) {
return thrDeptDao.selectById(id);
}
@Override
public ThrDeptEntity selectByCode(String code, String thirdSysFk) {
FilterThrDeptRequest thrInvWarehouseRequest = new FilterThrDeptRequest();
thrInvWarehouseRequest.setCode(code);
thrInvWarehouseRequest.setThirdSysFk(thirdSysFk);
List<ThrDeptEntity> invWarehouseEntities = thrDeptDao.filterThrInvWarehouse(thrInvWarehouseRequest);
if (invWarehouseEntities != null && invWarehouseEntities.size() > 0)
return invWarehouseEntities.get(0);
return null;
}
@Override
public boolean deleteById(String id) {
int count = thrInvWarehouseDao.countSubInvByParentInvId(id);
if (count > 0) {
return false;
}
return thrDeptDao.deleteById(id);
}
@Override
public ThrDeptEntity selectMaxCode(FilterThrDeptRequest filterThrDeptRequest) {
return thrDeptDao.selectMaxCode(filterThrDeptRequest);
}
@Transactional(rollbackFor = Exception.class)
@Override
public BaseResponse downloadThirdWarehouse(String thirdSysFk) {
int page = 1;
int limit = 100;
while (true) {
UdiwmsWarehouseRequest udiwmsWarehouseRequest = new UdiwmsWarehouseRequest();
udiwmsWarehouseRequest.setThirdSys(thirdSysFk);
udiwmsWarehouseRequest.setPage(page);
udiwmsWarehouseRequest.setLimit(limit);
BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> baseResponse = erpBasicClient.getWarehouse(udiwmsWarehouseRequest);
if (baseResponse.getCode() == 20000) {
List<UdiwmsWarehouseDetail> responseList = baseResponse.getData().getList();
List<ThrDeptEntity> list = new ArrayList<>();
for (UdiwmsWarehouseDetail response : responseList) {
ThrDeptEntity thrDeptEntity = new ThrDeptEntity();
thrDeptEntity.setPid(0);
thrDeptEntity.setName(response.getName());
thrDeptEntity.setCode(response.getCode());
thrDeptEntity.setThirdSysFk(thirdSysFk);
thrDeptEntity.setAdvanceType(false); //默认是仓库
thrDeptEntity.setStatus(1);//默认启用
thrDeptEntity.setUpdateTime(new Date());
list.add(thrDeptEntity);
List<UdiwmsWarehouseDetail.SubWarehouse> subWarehouseList = response.getSubWarehouses();
if (CollUtil.isNotEmpty(subWarehouseList)) {
for (UdiwmsWarehouseDetail.SubWarehouse subWarehouse : subWarehouseList) {
ThrInvWarehouseEntity thrInvWarehouseEntity = new ThrInvWarehouseEntity();
thrInvWarehouseEntity.setCode(subWarehouse.getCode());
thrInvWarehouseEntity.setName(subWarehouse.getName());
thrInvWarehouseEntity.setRemark(subWarehouse.getRemark());
thrInvWarehouseEntity.setThirdSysFk(thirdSysFk);
thrInvWarehouseEntity.setParentId(response.getCode());
thrInvWarehouseEntity.setId(IdUtil.getSnowflake(6, 1).nextId() + "");
thrInvWarehouseDao.insertThrInvWarehouse(thrInvWarehouseEntity);
}
}
}
//插入数据
thrDeptDao.insertInvWarehouses(list);
if (list.size() >= limit) {
page++;
} else {
break;
}
} else {
return baseResponse;
}
}
return ResultVOUtils.success("下载结束!");
}
@Override
public BaseResponse deleteInvById(String id) {
//查询有无子仓库
int count = thrInvWarehouseDao.countSubInvByParentInvId(id);
if (count > 0) {
return ResultVOUtils.error(500, "请先删除子仓库!");
} else
thrDeptDao.deleteById(id);
return ResultVOUtils.success("删除成功");
}
}

@ -0,0 +1,93 @@
package com.glxp.api.service.thrsys.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.thrsys.ThrInvWarehouseDao;
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.api.req.thrsys.FilterThrSubInvWarehouseRequest;
import com.glxp.api.res.thrsys.ThrInvWarehouseResponse;
import com.glxp.api.service.thrsys.ThrInvWarehouseService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class ThrInvWarehouseServiceImpl implements ThrInvWarehouseService {
@Resource
ThrInvWarehouseDao thrInvWarehouseDao;
@Override
public ThrInvWarehouseEntity selectById(String id) {
if (StrUtil.isEmpty(id)) {
return null;
}
FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest = new FilterThrSubInvWarehouseRequest();
filterThrSubInvWarehouseRequest.setId(id);
List<ThrInvWarehouseEntity> thrSubInvWarehouseEntities = thrInvWarehouseDao.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
if (CollUtil.isNotEmpty(thrSubInvWarehouseEntities)) {
return thrSubInvWarehouseEntities.get(0);
}
return null;
}
@Override
public ThrInvWarehouseEntity selectByThrCode(String thirdSys, String thirdId) {
FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest = new FilterThrSubInvWarehouseRequest();
filterThrSubInvWarehouseRequest.setCode(thirdId);
filterThrSubInvWarehouseRequest.setThirdSysFk(thirdSys);
List<ThrInvWarehouseEntity> thrInvWarehouseEntitys = thrInvWarehouseDao.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
if (CollUtil.isNotEmpty(thrInvWarehouseEntitys)) {
return thrInvWarehouseEntitys.get(0);
} else return null;
}
@Override
public List<ThrInvWarehouseEntity> filterThrInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
if (filterThrSubInvWarehouseRequest == null) {
return Collections.emptyList();
}
if (filterThrSubInvWarehouseRequest.getPage() != null) {
int offset = (filterThrSubInvWarehouseRequest.getPage() - 1) * filterThrSubInvWarehouseRequest.getLimit();
PageHelper.offsetPage(offset, filterThrSubInvWarehouseRequest.getLimit());
}
return thrInvWarehouseDao.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
}
@Override
public boolean insertThrInvWarehouse(ThrInvWarehouseEntity thrInvWarehouseEntity) {
return thrInvWarehouseDao.insertThrInvWarehouse(thrInvWarehouseEntity);
}
@Override
public boolean insertInvWarehouses(List<ThrInvWarehouseEntity> thrInvWarehouseEntitys) {
return thrInvWarehouseDao.insertThrInvWarehouses(thrInvWarehouseEntitys);
}
@Override
public boolean updateThrInvWarehouse(ThrInvWarehouseEntity thrInvWarehouseEntity) {
return thrInvWarehouseDao.updateThrInvWarehouse(thrInvWarehouseEntity);
}
@Override
public boolean deleteById(String id) {
return thrInvWarehouseDao.deleteById(id);
}
@Override
public List<ThrInvWarehouseResponse> filterThrInvWarehouseResponse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
if (null == filterThrSubInvWarehouseRequest) {
return Collections.emptyList();
}
if (filterThrSubInvWarehouseRequest.getPage() != null) {
int offset = (filterThrSubInvWarehouseRequest.getPage() - 1) * filterThrSubInvWarehouseRequest.getLimit();
PageHelper.offsetPage(offset, filterThrSubInvWarehouseRequest.getLimit());
}
return thrInvWarehouseDao.filterThrInvWarehouseResponse(filterThrSubInvWarehouseRequest);
}
}

@ -4,9 +4,9 @@ server:
spring:
datasource:
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
jdbc-url: jdbc:p6spy:mysql://192.168.0.66:3364/udi_wms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: 123456
password: Glxp@6066
hikari:
connection-timeout: 60000
maximum-pool-size: 60

@ -4,7 +4,7 @@ server:
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/udi_wms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
jdbc-url: jdbc:mysql://127.0.0.1:3306/udi_wms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: Glxp@6066
hikari:

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.api.dao.auth.InvBusUserDao">
<select id="filterInvBusUser" parameterType="com.glxp.api.req.auth.FilterInvBusUserRequest"
resultType="com.glxp.api.entity.auth.InvBusUserEntity">
select *
FROM inv_bustype_user
<where>
<if test="userId != '' and userId != null">
AND userId = #{userId}
</if>
<if test="subInvCode != '' and subInvCode != null">
AND subInvCode = #{subInvCode}
</if>
<if test="scAction != '' and scAction != null">
AND scAction = #{scAction}
</if>
</where>
</select>
<select id="filterUnSelect" parameterType="com.glxp.api.req.auth.FilterInvBusUserRequest"
resultType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity">
select inv_warehouse_bussiness_type.id,
inv_warehouse_bussiness_type.code,
inv_warehouse_bussiness_type.action,
basic_bussiness_type.name
from inv_warehouse_bussiness_type
inner join basic_bussiness_type on inv_warehouse_bussiness_type.action = basic_bussiness_type.action
<where>
<if test="subInvCode != '' and subInvCode != null">
AND code = #{subInvCode}
</if>
<if test="selectedCodes != null and selectedCodes.size()!=0">
and inv_warehouse_bussiness_type.action not in
<foreach collection="selectedCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
<select id="filterJoinInvBusUser" parameterType="com.glxp.api.req.auth.FilterInvBusUserRequest"
resultType="com.glxp.api.res.auth.InvBusUserResponse">
select inv_bustype_user.*,basic_bussiness_type.name billTypeName
FROM inv_bustype_user left join basic_bussiness_type on inv_bustype_user.scAction = basic_bussiness_type.action
<where>
<if test="userId != '' and userId != null">
AND userId = #{userId}
</if>
<if test="subInvCode != '' and subInvCode != null">
AND subInvCode = #{subInvCode}
</if>
<if test="scAction != '' and scAction != null">
AND scAction = #{scAction}
</if>
</where>
group by inv_bustype_user.id
</select>
<insert id="insertInvBusUser" keyProperty="id"
parameterType="com.glxp.api.entity.auth.InvBusUserEntity">
replace
INTO inv_bustype_user
(userId, `subInvCode`, scAction, remark)
values (
#{userId},
#{subInvCode},
#{scAction},
#{remark}
)
</insert>
<delete id="deleteById" parameterType="Map">
DELETE
FROM inv_bustype_user
WHERE id = #{id}
</delete>
<delete id="deleteByUnion" parameterType="Map">
DELETE
FROM inv_bustype_user
WHERE subInvCode = #{subInvCode}
and userId = #{userId}
</delete>
<update id="updateInvBusUser" parameterType="com.glxp.api.entity.auth.InvBusUserEntity">
UPDATE inv_bustype_user
<trim prefix="set" suffixOverrides=",">
<if test="userId != null">userId=#{userId},</if>
<if test="subInvCode != null">subInvCode=#{subInvCode},</if>
<if test="parentId != null">parentId=#{parentId},</if>
<if test="scAction != null">scAction=#{scAction},</if>
<if test="remark != null">remark=#{remark},</if>
</trim>
WHERE id = #{id}
</update>
</mapper>

@ -33,11 +33,11 @@
select auth_warehouse.* ,a.name thirdName,a1.name thirdName1,a2.name thirdName2,a3.name thirdName3,a4.name
thirdName4
from auth_warehouse
LEFT JOIN thr_inv_warehouse_sub a on a.code = auth_warehouse.thirdId
LEFT JOIN thr_inv_warehouse_sub a1 on a1.code = auth_warehouse.thirdId1
LEFT JOIN thr_inv_warehouse_sub a2 on a2.code = auth_warehouse.thirdId2
LEFT JOIN thr_inv_warehouse_sub a3 on a3.code = auth_warehouse.thirdId3
LEFT JOIN thr_inv_warehouse_sub a4 on a4.code = auth_warehouse.thirdId4
LEFT JOIN thr_inv_warehouse a on a.code = auth_warehouse.thirdId
LEFT JOIN thr_inv_warehouse a1 on a1.code = auth_warehouse.thirdId1
LEFT JOIN thr_inv_warehouse a2 on a2.code = auth_warehouse.thirdId2
LEFT JOIN thr_inv_warehouse a3 on a3.code = auth_warehouse.thirdId3
LEFT JOIN thr_inv_warehouse a4 on a4.code = auth_warehouse.thirdId4
<where>
<if test="code != '' and code != null">
AND auth_warehouse.code = #{code}

@ -0,0 +1,292 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.auth.WarehouseBussinessTypeDao">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity">
<!--@mbg.generated-->
<!--@Table auth_warehouse_bustype-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="action" jdbcType="VARCHAR" property="action"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, code, `action`, `name`
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List"/>
from auth_warehouse_bustype
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from auth_warehouse_bustype
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into auth_warehouse_bustype (code, `action`, `name`
)
values (#{code,jdbcType=VARCHAR}, #{action,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into auth_warehouse_bustype
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">
code,
</if>
<if test="action != null">
`action`,
</if>
<if test="name != null">
`name`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="action != null">
#{action,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"
parameterType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity">
<!--@mbg.generated-->
update auth_warehouse_bustype
<set>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="action != null">
`action` = #{action,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity">
<!--@mbg.generated-->
update auth_warehouse_bustype
set code = #{code,jdbcType=VARCHAR},
`action` = #{action,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update auth_warehouse_bustype
<trim prefix="set" suffixOverrides=",">
<trim prefix="code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.code,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="`action` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.action,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="`name` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.name,jdbcType=VARCHAR}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update auth_warehouse_bustype
<trim prefix="set" suffixOverrides=",">
<trim prefix="code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.code != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.code,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="`action` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.action != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.action,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="`name` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.name != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.name,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into auth_warehouse_bustype
(code, `action`, `name`)
values
<foreach collection="list" item="item" separator=",">
(#{item.code,jdbcType=VARCHAR}, #{item.action,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}
)
</foreach>
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into auth_warehouse_bustype
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
code,
`action`,
`name`,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
#{code,jdbcType=VARCHAR},
#{action,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
code = #{code,jdbcType=VARCHAR},
`action` = #{action,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into auth_warehouse_bustype
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="code != null">
code,
</if>
<if test="action != null">
`action`,
</if>
<if test="name != null">
`name`,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="action != null">
#{action,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="action != null">
`action` = #{action,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="selectListByCode" parameterType="java.lang.String" resultMap="BaseResultMap">
select auth_warehouse_bustype.id,
auth_warehouse_bustype.code,
auth_warehouse_bustype.action,
basic_bussiness_type.name
from auth_warehouse_bustype
inner join basic_bussiness_type on auth_warehouse_bustype.action = basic_bussiness_type.action
where code = #{code}
</select>
<select id="filterList" parameterType="com.glxp.api.req.auth.FilterInvBusTypeRequest"
resultType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity">
SELECT * FROM auth_warehouse_bustype
<where>
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="code != '' and code != null">
AND code = #{code}
</if>
<if test="action != '' and action != null">
AND `action` = #{action}
</if>
</where>
</select>
<select id="selectById" resultMap="BaseResultMap">
select *
from auth_warehouse_bustype
where id = #{id}
</select>
<select id="selectListByAction" resultMap="BaseResultMap">
select auth_warehouse_bustype.id,
auth_warehouse_bustype.code,
auth_warehouse_bustype.action,
basic_bussiness_type.name
from auth_warehouse_bustype
inner join basic_bussiness_type on auth_warehouse_bustype.action = basic_bussiness_type.action
where code = #{code}
</select>
<delete id="deleteByCode">
delete
from auth_warehouse_bustype
where code = #{code}
</delete>
<select id="selectByActions" resultType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity">
select * from auth_warehouse_bustype where code = #{subInvCode} and action in
<foreach collection="actions" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>

@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.api.dao.thrsys.ThrDeptDao">
<select id="filterThrInvWarehouse" parameterType="com.glxp.api.req.thrsys.FilterThrDeptRequest"
resultType="com.glxp.api.entity.thrsys.ThrDeptEntity">
SELECT *
FROM thr_dept thrInv
left join basic_third_sys thrSys on thrInv.thirdSysFk = thrSys.thirdId
<where>
thrSys.enabled = true
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="pid != '' and pid != null">
AND pid = #{pid}
</if>
<if test="code != '' and code != null">
AND code = #{code}
</if>
<if test="name != '' and name != null">
AND name = #{name}
</if>
<if test="advanceType != null">
AND advanceType = #{advanceType}
</if>
<if test="isDefault != null">
AND isDefault = #{isDefault}
</if>
<if test="key != null">
and (code like concat('%', #{key}, '%')
or `name` like concat('%', #{key}, '%'))
</if>
<if test="lastUpdateTime != null and lastUpdateTime != ''">
<![CDATA[
and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
<if test="thirdSysFk != null">
and thirdSysFk = #{thirdSysFk}
</if>
</where>
</select>
<select id="selectById" parameterType="Map"
resultType="com.glxp.api.entity.thrsys.ThrDeptEntity">
SELECT *
FROM thr_dept
WHERE id = #{id}
</select>
<select id="filterThrGroupInvWarehouse" parameterType="com.glxp.api.req.thrsys.FilterThrDeptRequest"
resultType="com.glxp.api.res.thrsys.ThrDeptResponse">
SELECT * FROM thr_dept
<where>
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="pid != '' and pid != null">
AND pid = #{pid}
</if>
<if test="code != '' and code != null">
AND code = #{code}
</if>
<if test="name != '' and name != null">
AND name = #{name}
</if>
<if test="advanceType != '' and advanceType != null">
AND advanceType = #{advanceType}
</if>
<if test="isDefault != '' and isDefault != null">
AND isDefault = #{isDefault}
</if>
<if test="thirdSysFk != null">
AND thirdSysFk = #{thirdSysFk}
</if>
</where>
</select>
<insert id="insertThrInvWarehouse" keyProperty="id"
parameterType="com.glxp.api.entity.thrsys.ThrDeptEntity">
replace
INTO thr_dept
(pid, code, name, advanceType, isDefault,
status, updateTime, remark, thirdSysFk)
values (
#{pid},
#{code},
#{name},
#{advanceType},
#{isDefault},
#{status},
#{updateTime},
#{remark},
#{thirdSysFk}
)
</insert>
<insert id="insertThrInvWarehouses" parameterType="java.util.List">
replace INTO thr_dept
(pid, code, name, advanceType, isDefault,
status, updateTime, remark, thirdSysFk)
VALUES
<foreach collection="thrDeptEntities" item="item" index="index"
separator=",">
(
#{item.pid}, #{item.code},
#{item.name}, #{item.advanceType}, #{item.isDefault},
#{item.status}, #{item.updateTime},
#{item.remark}, #{item.thirdSysFk})
</foreach>
</insert>
<delete id="deleteById" parameterType="Map">
DELETE
FROM thr_dept
WHERE id = #{id}
</delete>
<update id="updateThrInvWarehouse" parameterType="com.glxp.api.entity.thrsys.ThrDeptEntity">
UPDATE thr_dept
<trim prefix="set" suffixOverrides=",">
<if test="pid != null">pid=#{pid},</if>
<if test="name != null">name=#{name},</if>
<if test="code != null">code=#{code},</if>
<if test="advanceType != null">advanceType=#{advanceType},</if>
<if test="isDefault != null">isDefault=#{isDefault},</if>
<if test="status != null">status=#{status},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="remark != null">remark=#{remark},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
</trim>
WHERE id = #{id}
</update>
<select id="selectByCode" resultType="com.glxp.api.entity.thrsys.ThrDeptEntity">
select *
from thr_dept
where code = #{code}
</select>
<select id="selectMaxCode" resultType="com.glxp.api.entity.thrsys.ThrDeptEntity">
select max(code) as code from thr_dept
<where>
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="pid != '' and pid != null">
AND pid = #{pid}
</if>
<if test="code != '' and code != null">
AND code = #{code}
</if>
<if test="name != '' and name != null">
AND name = #{name}
</if>
<if test=" advanceType != null">
AND advanceType = #{advanceType}
</if>
<if test="isDefault != null">
AND isDefault = #{isDefault}
</if>
<if test="pcode != null">
AND pcode = #{pcode}
</if>
<if test="level != null">
AND `level` = #{level}
</if>
<if test="thirdSysFk != null">
AND `thirdSysFk` = #{thirdSysFk}
</if>
</where>
</select>
<insert id="insertInvWarehouses">
replace into thr_dept (pid, code, `name`, advanceType, isDefault, status, updateTime, remark, `level`,
pcode,
thirdSysFk)
values
<foreach collection="thrDeptEntities" index="index" item="item" separator=",">
(#{item.pid},
#{item.code},
#{item.name},
#{item.advanceType},
#{item.isDefault},
#{item.status},
#{item.updateTime},
#{item.remark},
#{item.level},
#{item.pcode},
#{item.thirdSysFk})
</foreach>
</insert>
</mapper>

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.api.dao.thrsys.ThrInvWarehouseDao">
<select id="filterThrInvWarehouse" parameterType="com.glxp.api.req.thrsys.FilterThrDeptRequest"
resultType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
SELECT *
FROM thr_inv_warehouse
<where>
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="code != '' and code != null">
AND code = #{code}
</if>
<if test="name != '' and name != null">
AND `name` = #{name}
</if>
<if test="parentId != '' and parentId != null">
AND parentId = #{parentId}
</if>
<if test="thirdSysFk != null">
and thirdSysFk = #{thirdSysFk}
</if>
</where>
</select>
<select id="selectById" parameterType="Map"
resultType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
SELECT *
FROM thr_inv_warehouse
WHERE id = #{id}
</select>
<select id="countSubInvByParentInvId" resultType="java.lang.Integer">
select count(*) from thr_inv_warehouse where
parentId = (select code from thr_dept where id = #{parentInvId})
</select>
<select id="filterThrInvWarehouseResponse"
resultType="com.glxp.api.res.thrsys.ThrInvWarehouseResponse">
select t1.*, t2.name as parentName from thr_inv_warehouse t1
left join thr_dept t2
on t2.code =t1.parentId
<where>
<if test="id != '' and id != null">
AND t1.id = #{id}
</if>
<if test="code != '' and code != null">
AND t1.code = #{code}
</if>
<if test="name != '' and name != null">
AND t1.`name` = #{name}
</if>
<if test="parentId != '' and parentId != null">
AND t1.parentId = #{parentId}
</if>
<if test="thirdSysFk != null">
and t1.thirdSysFk = #{thirdSysFk}
</if>
</where>
</select>
<insert id="insertThrInvWarehouse" keyProperty="id"
parameterType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
replace
INTO thr_inv_warehouse
(id, code, `name`, parentId, remark, thirdSysFk)
values (
#{id},
#{code},
#{name},
#{parentId},
#{remark},
#{thirdSysFk}
)
</insert>
<insert id="insertThrInvWarehouses" parameterType="java.util.List">
replace INTO thr_inv_warehouse
(id, code, `name`, parentId, remark, thirdSysFk)
VALUES
<foreach collection="thrDeptEntities" item="item" index="index"
separator=",">
(
#{item.id}, #{item.code},
#{item.name}, #{item.parentId},
#{item.remark}, #{item.thirdSysFk})
</foreach>
</insert>
<delete id="deleteById" parameterType="Map">
DELETE
FROM thr_inv_warehouse
WHERE id = #{id}
</delete>
<update id="updateThrInvWarehouse" parameterType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
UPDATE thr_inv_warehouse
<trim prefix="set" suffixOverrides=",">
<if test="name != null">`name`=#{name},</if>
<if test="code != null">code=#{code},</if>
<if test="parentId != null">parentId=#{parentId},</if>
<if test="remark != null">remark=#{remark},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
</trim>
WHERE id = #{id}
</update>
</mapper>
Loading…
Cancel
Save