新增第三方仓库关联分库等功能。。。

fencang
anthonyywj2 3 years ago
parent 012e1b866c
commit 28ed79c4a1

@ -1,14 +1,19 @@
package com.glxp.sale.admin.controller.inventory;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.sale.admin.annotation.AuthRuleAnnotation;
import com.glxp.sale.admin.entity.auth.AuthAdmin;
import com.glxp.sale.admin.entity.inout.WarehouseBussinessTypeEntity;
import com.glxp.sale.admin.entity.inventory.InvSubWarehouseEntity;
import com.glxp.sale.admin.entity.inventory.InvWarehouseEntity;
import com.glxp.sale.admin.req.basic.FilterBasicThirdSysRequest;
import com.glxp.sale.admin.req.info.DeleteRequest;
import com.glxp.sale.admin.req.inventory.FilterInvSubWarehouseRequest;
import com.glxp.sale.admin.req.inventory.FilterInvWarehouseRequest;
import com.glxp.sale.admin.res.PageSimpleResponse;
import com.glxp.sale.admin.res.inventory.InvWarehouseThirdSysResponse;
import com.glxp.sale.admin.service.auth.CustomerService;
import com.glxp.sale.admin.service.inout.WarehouseBussinessTypeService;
import com.glxp.sale.admin.service.inventory.InvProductService;
@ -57,6 +62,7 @@ public class InvSubWarehouseController {
// return ResultVOUtils.error(500, "用户或仓库不能未空!");
// }
AuthAdmin authAdmin = customerService.getUserBean();
if (filterInvWarehouseRequest.getFilter() == null || filterInvWarehouseRequest.getFilter() == 1) {
if (authAdmin.getCustomerId() == 110)
@ -109,13 +115,6 @@ public class InvSubWarehouseController {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
//判断分库名称在此仓库下是否重复
boolean exist = invSubWarehouseService.checkDuplicateName(invSubWarehouseEntity.getParentId(), invSubWarehouseEntity.getName());
if (exist) {
return ResultVOUtils.error(500, "分库名称已存在!");
}
if (invSubWarehouseEntity.getId() == null) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
@ -124,7 +123,7 @@ public class InvSubWarehouseController {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success();
return ResultVOUtils.success("修改成功!");
}
@AuthRuleAnnotation("")
@ -155,6 +154,7 @@ public class InvSubWarehouseController {
if (count > 0) {
return ResultVOUtils.error(500, "此分库存在库存,不能删除!");
}
boolean b = invSubWarehouseService.deleteById(deleteRequest.getId());
if (!b) {
@ -163,4 +163,49 @@ public class InvSubWarehouseController {
return ResultVOUtils.success();
}
@AuthRuleAnnotation("")
@GetMapping("/spms/sub/inv/warehouse/thridSys/detail")
public BaseResponse getThirdSysDetail(FilterInvSubWarehouseRequest request) {
if (null == request || null == request.getId()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
FilterBasicThirdSysRequest sysRequest = new FilterBasicThirdSysRequest();
sysRequest.setEnabled(true);
List<InvWarehouseThirdSysResponse> list = invSubWarehouseService.getThirdSysDetail(request.getId());
PageInfo<InvWarehouseThirdSysResponse> pageInfo;
pageInfo = new PageInfo<>(list);
PageSimpleResponse<InvWarehouseThirdSysResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(list);
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@PostMapping("/spms/sub/inv/warehouse/bindThrWarehouse")
public BaseResponse bindThrWarehouse(String id, String thridWarehouseId, String sysId) {
if (null == id || null == thridWarehouseId || StrUtil.isBlank(sysId)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
invSubWarehouseService.bindThrWarehouse(id, thridWarehouseId, sysId);
return ResultVOUtils.success();
}
/**
* ID
*
* @param id
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/spms/sub/inv/warehouse/unbindThrWarehouse")
public BaseResponse unbindThrWarehouse(String id, String sysId) {
if (null == id || StrUtil.isBlank(sysId)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
invSubWarehouseService.unbindThrWarehouse(id, sysId);
return ResultVOUtils.success();
}
}

@ -3,6 +3,7 @@ package com.glxp.sale.admin.controller.inventory;
import cn.hutool.Hutool;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@ -19,12 +20,14 @@ import com.glxp.sale.admin.entity.inventory.InvSubWarehouseEntity;
import com.glxp.sale.admin.entity.inventory.InvWarehouseEntity;
import com.glxp.sale.admin.entity.param.SystemParamConfigEntity;
import com.glxp.sale.admin.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.sale.admin.entity.thrsys.ThrSubInvWarehouseEntity;
import com.glxp.sale.admin.req.basic.BasicExportStatusRequest;
import com.glxp.sale.admin.req.basic.BussinessTypeFilterRequest;
import com.glxp.sale.admin.req.basic.FilterBasicThirdSysRequest;
import com.glxp.sale.admin.req.basic.UdimsFilterRequest;
import com.glxp.sale.admin.req.info.DeleteRequest;
import com.glxp.sale.admin.req.inventory.FilterInvWarehouseRequest;
import com.glxp.sale.admin.req.thrsys.FilterThrSubInvWarehouseRequest;
import com.glxp.sale.admin.res.PageSimpleResponse;
import com.glxp.sale.admin.res.basic.BussinessTypResponse;
import com.glxp.sale.admin.res.inventory.InvWarehouseExportResponse;
@ -39,6 +42,7 @@ import com.glxp.sale.admin.service.inventory.InvSubWarehouseService;
import com.glxp.sale.admin.service.inventory.InvWarehouseService;
import com.glxp.sale.admin.service.param.SystemParamConfigService;
import com.glxp.sale.admin.service.thrsys.ThrInvWarehouseService;
import com.glxp.sale.admin.service.thrsys.ThrSubInvWarehouseService;
import com.glxp.sale.admin.util.CustomUtil;
import com.glxp.sale.admin.util.DateUtil;
import com.glxp.sale.admin.util.FileUtils;
@ -76,6 +80,8 @@ public class InvWarehouseController {
@Resource
InvProductDetailService invProductDetailService;
@Resource
BussinessTypeService bussinessTypeService;
@Resource
WarehouseBussinessTypeService warehouseBussinessTypeService;
@ -110,27 +116,6 @@ public class InvWarehouseController {
}
@GetMapping("/udiwms/bussinessType/udims/filterHighterInv")
public BaseResponse udimsFilterHighterInv(UdimsFilterRequest udimsFilterRequest,
BindingResult bindingResult) {
FilterInvWarehouseRequest filterInvWarehouseRequest = new FilterInvWarehouseRequest();
filterInvWarehouseRequest.setPcode("0");
filterInvWarehouseRequest.setStatus(1);
List<InvWarehouseEntity> invWarehouseEntities = invWarehouseService.filterGroupInvWarehouse(filterInvWarehouseRequest);
return ResultVOUtils.success(invWarehouseEntities);
}
@GetMapping("/udiwms/bussinessType/udims/filterSubInv")
public BaseResponse udimsFilterSubInv(UdimsFilterRequest udimsFilterRequest,
BindingResult bindingResult) {
List<InvSubWarehouseEntity> invWarehouseEntities = invSubWarehouseService.findByParentId(udimsFilterRequest.getInvCode());
return ResultVOUtils.success(invWarehouseEntities);
}
@AuthRuleAnnotation("")
@GetMapping("spms/inv/warehouse/filterByUser")
public BaseResponse filterByUser(FilterInvWarehouseRequest filterInvWarehouseRequest) {
@ -431,7 +416,7 @@ public class InvWarehouseController {
String json = FileUtils.readStream(inputStream);
InvWarehouseExportResponse invWarehouseExportResponse = (InvWarehouseExportResponse) JSON.parseObject(json, InvWarehouseExportResponse.class);
List<InvWarehouseEntity> invWarehouseEntities = invWarehouseExportResponse.getInvWarehouseEntities();
if (invWarehouseEntities != null) {
if (CollUtil.isNotEmpty(invWarehouseEntities)) {
invWarehouseService.importInvWarehouse(invWarehouseEntities);
}
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = invWarehouseExportResponse.getThrInvWarehouseEntities();
@ -455,7 +440,7 @@ public class InvWarehouseController {
*/
@AuthRuleAnnotation("")
@PostMapping("/spms/inv/warehouse/bindThrWarehouse")
public BaseResponse bindThrWarehouse(Integer id, String thridWarehouseId, String sysId) {
public BaseResponse bindThrWarehouse(String id, String thridWarehouseId, String sysId) {
if (null == id || null == thridWarehouseId || StrUtil.isBlank(sysId)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
@ -471,7 +456,7 @@ public class InvWarehouseController {
*/
@AuthRuleAnnotation("")
@PostMapping("/spms/inv/warehouse/unbindThrWarehouse")
public BaseResponse unbindThrWarehouse(Integer id, String sysId) {
public BaseResponse unbindThrWarehouse(String id, String sysId) {
if (null == id || StrUtil.isBlank(sysId)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
@ -501,5 +486,28 @@ public class InvWarehouseController {
return ResultVOUtils.success(pageSimpleResponse);
}
@Resource
ThrSubInvWarehouseService thrSubInvWarehouseService;
@GetMapping("/spms/sub/inv/warehouse/filterThridInv")
public BaseResponse filterInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
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<ThrSubInvWarehouseEntity> thrInvWarehouseEntities = thrSubInvWarehouseService.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
PageInfo<ThrSubInvWarehouseEntity> pageInfo;
pageInfo = new PageInfo<>(thrInvWarehouseEntities);
PageSimpleResponse<ThrSubInvWarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(thrInvWarehouseEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
}

@ -0,0 +1,99 @@
package com.glxp.sale.admin.controller.thrsys;
import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.sale.admin.annotation.AuthRuleAnnotation;
import com.glxp.sale.admin.entity.thrsys.ThrSubInvWarehouseEntity;
import com.glxp.sale.admin.req.info.DeleteRequest;
import com.glxp.sale.admin.req.thrsys.FilterThrSubInvWarehouseRequest;
import com.glxp.sale.admin.res.PageSimpleResponse;
import com.glxp.sale.admin.service.thrsys.ThrSubInvWarehouseService;
import com.glxp.sale.common.enums.ResultEnum;
import com.glxp.sale.common.res.BaseResponse;
import com.glxp.sale.common.util.ResultVOUtils;
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.List;
@RestController
public class ThrSubInvWarehouseController {
@Resource
ThrSubInvWarehouseService thrSubInvWarehouseService;
@GetMapping("/thirdSys/sub/inv/warehouse/filter")
public BaseResponse filterInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
List<ThrSubInvWarehouseEntity> thrInvWarehouseEntities = thrSubInvWarehouseService.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
PageInfo<ThrSubInvWarehouseEntity> pageInfo;
pageInfo = new PageInfo<>(thrInvWarehouseEntities);
PageSimpleResponse<ThrSubInvWarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(thrInvWarehouseEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@GetMapping("/thirdSys/sub/inv/warehouse/filterAll")
public BaseResponse filterAllInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest) {
List<ThrSubInvWarehouseEntity> invSubWarehouseEntities = thrSubInvWarehouseService.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
return ResultVOUtils.success(invSubWarehouseEntities);
}
@AuthRuleAnnotation("")
@PostMapping("/thirdSys/sub/inv/warehouse/save")
public BaseResponse save(@RequestBody @Valid ThrSubInvWarehouseEntity 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 = thrSubInvWarehouseService.insertThrInvWarehouse(invSubWarehouseEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success("添加成功!");
}
@AuthRuleAnnotation("")
@PostMapping("/thirdSys/sub/inv/warehouse/edit")
public BaseResponse edit(@RequestBody @Valid ThrSubInvWarehouseEntity 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 = thrSubInvWarehouseService.updateThrInvWarehouse(invSubWarehouseEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
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);
}
boolean b = thrSubInvWarehouseService.deleteById(deleteRequest.getId());
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success("刪除成功!");
}
}

@ -44,4 +44,11 @@ public interface InvSubWarehouseDao {
* @return
*/
String selectNameByCode(@Param("code") String code);
InvSubWarehouseEntity selectJoinThirdSys(FilterInvSubWarehouseRequest filterInvSubWarehouseRequest);
boolean updateThridId(@Param("id") String id, @Param("thridWarehouseId") String thridWarehouseId, @Param("sysId") String sysId);
}

@ -44,7 +44,7 @@ public interface InvWarehouseDao {
* @param sysId
* @return
*/
boolean updateThridId(@Param("id") Integer id, @Param("thridWarehouseId") String thridWarehouseId, @Param("sysId") String sysId);
boolean updateThridId(@Param("id") String id, @Param("thridWarehouseId") String thridWarehouseId, @Param("sysId") String sysId);
boolean updateTime(@Param("code") String code, @Param("updateTime") Date updateTime);

@ -0,0 +1,24 @@
package com.glxp.sale.admin.dao.thrsys;
import com.glxp.sale.admin.entity.thrsys.ThrSubInvWarehouseEntity;
import com.glxp.sale.admin.req.thrsys.FilterThrSubInvWarehouseRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ThrSubInvWarehouseDao {
List<ThrSubInvWarehouseEntity> filterThrInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest);
boolean insertThrInvWarehouse(ThrSubInvWarehouseEntity thrInvWarehouseEntity);
boolean insertInvWarehouses(@Param("thrInvWarehouseEntitys") List<ThrSubInvWarehouseEntity> thrInvWarehouseEntitys);
boolean updateThrInvWarehouse(ThrSubInvWarehouseEntity thrInvWarehouseEntity);
boolean deleteById(@Param("id") String id);
}

@ -35,5 +35,7 @@ public class BussinessLocalTypeEntity {
private boolean vailInv;
private boolean codeFillCheck;
private boolean supplementAll; //是否全量补单
}

@ -67,4 +67,6 @@ public class BussinessTypeEntity {
private boolean codeFillCheck;
private String defaultSubInv;
private String defaultInv;
private int orderVisibleType; //订单详情展示方式0根据批次号展示1:根据条码展示
}

@ -12,5 +12,15 @@ public class InvSubWarehouseEntity {
private String remark;
private boolean defaultInv;
private String thirdId;
private String thirdName;
private String thirdId1;
private String thirdName1;
private String thirdId2;
private String thirdName2;
private String thirdId3;
private String thirdName3;
private String thirdId4;
private String thirdName4;
}

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

@ -0,0 +1,15 @@
package com.glxp.sale.admin.req.thrsys;
import com.glxp.sale.admin.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;
}

@ -3,6 +3,7 @@ package com.glxp.sale.admin.service.inventory;
import com.glxp.sale.admin.entity.inventory.InvSubWarehouseEntity;
import com.glxp.sale.admin.req.inventory.FilterInvSubWarehouseRequest;
import com.glxp.sale.admin.req.inventory.FilterInvWarehouseRequest;
import com.glxp.sale.admin.res.inventory.InvWarehouseThirdSysResponse;
import java.util.List;
@ -28,15 +29,7 @@ public interface InvSubWarehouseService {
boolean deleteByParentCode(String code);
/**
*
*
* @param parentId
* @param name
* @return
*/
boolean checkDuplicateName(String parentId, String name);
public boolean checkDuplicateName(String parentId, String name);
/**
*
@ -45,4 +38,12 @@ public interface InvSubWarehouseService {
* @return
*/
String getSubInvName(String subInvCode);
List<InvWarehouseThirdSysResponse> getThirdSysDetail(String id);
boolean bindThrWarehouse(String id, String thridWarehouseId, String sysId);
boolean unbindThrWarehouse(String id, String sysId);
}

@ -43,7 +43,7 @@ public interface InvWarehouseService {
* @param id
* @param thridWarehouseId
*/
boolean bindThrWarehouse(Integer id, String thridWarehouseId, String sysId);
boolean bindThrWarehouse(String id, String thridWarehouseId, String sysId);
/**
*
@ -51,7 +51,7 @@ public interface InvWarehouseService {
* @param id
* @param thridWarehouseId
*/
boolean unbindThrWarehouse(Integer id, String sysId);
boolean unbindThrWarehouse(String id, String sysId);
/**
*

@ -3,14 +3,19 @@ package com.glxp.sale.admin.service.inventory.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.sale.admin.dao.basic.BasicThirdSysDao;
import com.glxp.sale.admin.dao.inventory.InvSubWarehouseDao;
import com.glxp.sale.admin.entity.basic.BasicThirdSysEntity;
import com.glxp.sale.admin.entity.inventory.InvSubWarehouseEntity;
import com.glxp.sale.admin.req.basic.FilterBasicThirdSysRequest;
import com.glxp.sale.admin.req.inventory.FilterInvSubWarehouseRequest;
import com.glxp.sale.admin.req.inventory.FilterInvWarehouseRequest;
import com.glxp.sale.admin.res.inventory.InvWarehouseThirdSysResponse;
import com.glxp.sale.admin.service.inventory.InvSubWarehouseService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -20,6 +25,8 @@ public class InvSubWarehouseServiceImpl implements InvSubWarehouseService {
@Resource
InvSubWarehouseDao invSubWarehouseDao;
@Resource
private BasicThirdSysDao basicThirdSysDao;
@Override
public InvSubWarehouseEntity findById(String id) {
@ -118,4 +125,55 @@ public class InvSubWarehouseServiceImpl implements InvSubWarehouseService {
}
return invSubWarehouseDao.selectNameByCode(subInvCode);
}
@Override
public List<InvWarehouseThirdSysResponse> getThirdSysDetail(String id) {
FilterBasicThirdSysRequest sysRequest = new FilterBasicThirdSysRequest();
sysRequest.setEnabled(true);
List<BasicThirdSysEntity> data = basicThirdSysDao.filterBasicThiSys(sysRequest);
if (CollUtil.isEmpty(data))
return null;
FilterInvSubWarehouseRequest tempReqeust = new FilterInvSubWarehouseRequest();
tempReqeust.setCode(id);
InvSubWarehouseEntity invSubWarehouseEntity = invSubWarehouseDao.selectJoinThirdSys(tempReqeust);
List<InvWarehouseThirdSysResponse> invWarehouseThirdSysResponses = new ArrayList<>();
for (BasicThirdSysEntity sys : data) {
InvWarehouseThirdSysResponse invWarehouseThirdSysResponse = new InvWarehouseThirdSysResponse();
invWarehouseThirdSysResponse.setSysId(sys.getThirdId());
invWarehouseThirdSysResponse.setSysName(sys.getThirdName());
invWarehouseThirdSysResponse.setCode(invSubWarehouseEntity.getCode());
invWarehouseThirdSysResponse.setName(invSubWarehouseEntity.getName());
if (sys.getThirdId().equals("thirdId")) {
invWarehouseThirdSysResponse.setThirdId(invSubWarehouseEntity.getThirdId());
invWarehouseThirdSysResponse.setThirdName(invSubWarehouseEntity.getThirdName());
} else if (sys.getThirdId().equals("thirdId1")) {
invWarehouseThirdSysResponse.setThirdId(invSubWarehouseEntity.getThirdId1());
invWarehouseThirdSysResponse.setThirdName(invSubWarehouseEntity.getThirdName1());
} else if (sys.getThirdId().equals("thirdId2")) {
invWarehouseThirdSysResponse.setThirdId(invSubWarehouseEntity.getThirdId2());
invWarehouseThirdSysResponse.setThirdName(invSubWarehouseEntity.getThirdName2());
} else if (sys.getThirdId().equals("thirdId3")) {
invWarehouseThirdSysResponse.setThirdId(invSubWarehouseEntity.getThirdId3());
invWarehouseThirdSysResponse.setThirdName(invSubWarehouseEntity.getThirdName3());
} else if (sys.getThirdId().equals("thirdId4")) {
invWarehouseThirdSysResponse.setThirdId(invSubWarehouseEntity.getThirdId4());
invWarehouseThirdSysResponse.setThirdName(invSubWarehouseEntity.getThirdName4());
}
invWarehouseThirdSysResponses.add(invWarehouseThirdSysResponse);
}
return invWarehouseThirdSysResponses;
}
@Override
public boolean bindThrWarehouse(String id, String thridWarehouseId, String sysId) {
return invSubWarehouseDao.updateThridId(id, thridWarehouseId, sysId);
}
@Override
public boolean unbindThrWarehouse(String id, String sysId) {
return invSubWarehouseDao.updateThridId(id, null, sysId);
}
}

@ -126,13 +126,18 @@ public class InvWarehouseServiceImpl implements InvWarehouseService {
}
@Override
public boolean bindThrWarehouse(Integer id, String thridWarehouseId, String sysId) {
public boolean bindThrWarehouse(String id, String thridWarehouseId, String sysId) {
return invWarehouseDao.updateThridId(id, thridWarehouseId, sysId);
}
@Override
public boolean unbindThrWarehouse(Integer id, String sysId) {
public boolean unbindThrWarehouse(String id, String sysId) {
return invWarehouseDao.updateThridId(id, null, sysId);
// InvWarehouseEntity invWarehouseEntity = invWarehouseDao.selectById(id + "");
// ReflectUtil.setFieldValue(invWarehouseEntity, sysId, null);
// return invWarehouseDao.insertInvWarehouse(invWarehouseEntity);
}
@Override
@ -159,8 +164,11 @@ public class InvWarehouseServiceImpl implements InvWarehouseService {
Object thirdId = ReflectUtil.getFieldValue(invWarehouseEntity, sys.getThirdId());
if (null != thirdId) {
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectByCode(String.valueOf(thirdId));
response.setThirdId(thrInvWarehouseEntity.getCode());
response.setThirdName(thrInvWarehouseEntity.getName());
if (thrInvWarehouseEntity != null) {
response.setThirdId(thrInvWarehouseEntity.getCode());
response.setThirdName(thrInvWarehouseEntity.getName());
}
}
result.add(response);
} else if (sys.getThirdId().equals("thirdId1")) {
@ -170,8 +178,10 @@ public class InvWarehouseServiceImpl implements InvWarehouseService {
Object thirdId = ReflectUtil.getFieldValue(invWarehouseEntity, sys.getThirdId());
if (null != thirdId) {
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectByCode(String.valueOf(thirdId));
response.setThirdId(thrInvWarehouseEntity.getCode());
response.setThirdName(thrInvWarehouseEntity.getName());
if (thrInvWarehouseEntity != null) {
response.setThirdId(thrInvWarehouseEntity.getCode());
response.setThirdName(thrInvWarehouseEntity.getName());
}
}
result.add(response);
} else if (sys.getThirdId().equals("thirdId2")) {
@ -181,8 +191,10 @@ public class InvWarehouseServiceImpl implements InvWarehouseService {
Object thirdId = ReflectUtil.getFieldValue(invWarehouseEntity, sys.getThirdId());
if (null != thirdId) {
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectByCode(String.valueOf(thirdId));
response.setThirdId(thrInvWarehouseEntity.getCode());
response.setThirdName(thrInvWarehouseEntity.getName());
if (thrInvWarehouseEntity != null) {
response.setThirdId(thrInvWarehouseEntity.getCode());
response.setThirdName(thrInvWarehouseEntity.getName());
}
}
result.add(response);
} else if (sys.getThirdId().equals("thirdId3")) {
@ -192,8 +204,10 @@ public class InvWarehouseServiceImpl implements InvWarehouseService {
Object thirdId = ReflectUtil.getFieldValue(invWarehouseEntity, sys.getThirdId());
if (null != thirdId) {
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectByCode(String.valueOf(thirdId));
response.setThirdId(thrInvWarehouseEntity.getCode());
response.setThirdName(thrInvWarehouseEntity.getName());
if (thrInvWarehouseEntity != null) {
response.setThirdId(thrInvWarehouseEntity.getCode());
response.setThirdName(thrInvWarehouseEntity.getName());
}
}
result.add(response);
} else if (sys.getThirdId().equals("thirdId4")) {
@ -203,8 +217,10 @@ public class InvWarehouseServiceImpl implements InvWarehouseService {
Object thirdId = ReflectUtil.getFieldValue(invWarehouseEntity, sys.getThirdId());
if (null != thirdId) {
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectByCode(String.valueOf(thirdId));
response.setThirdId(thrInvWarehouseEntity.getCode());
response.setThirdName(thrInvWarehouseEntity.getName());
if (thrInvWarehouseEntity != null) {
response.setThirdId(thrInvWarehouseEntity.getCode());
response.setThirdName(thrInvWarehouseEntity.getName());
}
}
result.add(response);
}

@ -0,0 +1,24 @@
package com.glxp.sale.admin.service.thrsys;
import com.glxp.sale.admin.entity.thrsys.ThrSubInvWarehouseEntity;
import com.glxp.sale.admin.req.thrsys.FilterThrSubInvWarehouseRequest;
import java.util.List;
public interface ThrSubInvWarehouseService {
ThrSubInvWarehouseEntity selectByThrCode(String thirdSys, String thirdId);
List<ThrSubInvWarehouseEntity> filterThrInvWarehouse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest);
boolean insertThrInvWarehouse(ThrSubInvWarehouseEntity thrSubInvWarehouseEntity);
boolean insertInvWarehouses(List<ThrSubInvWarehouseEntity> thrSubInvWarehouseEntities);
boolean updateThrInvWarehouse(ThrSubInvWarehouseEntity thrSubInvWarehouseEntity);
boolean deleteById(String id);
}

@ -0,0 +1,65 @@
package com.glxp.sale.admin.service.thrsys.impl;
import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.sale.admin.dao.thrsys.ThrSubInvWarehouseDao;
import com.glxp.sale.admin.entity.thrsys.ThrSubInvWarehouseEntity;
import com.glxp.sale.admin.req.thrsys.FilterThrSubInvWarehouseRequest;
import com.glxp.sale.admin.service.thrsys.ThrSubInvWarehouseService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class ThrSubInvWarehouseServiceImpl implements ThrSubInvWarehouseService {
@Resource
ThrSubInvWarehouseDao thrSubInvWarehouseDao;
@Override
public ThrSubInvWarehouseEntity selectByThrCode(String thirdSys, String thirdId) {
FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest = new FilterThrSubInvWarehouseRequest();
filterThrSubInvWarehouseRequest.setCode(thirdId);
filterThrSubInvWarehouseRequest.setThirdSysFk(thirdSys);
List<ThrSubInvWarehouseEntity> thrInvWarehouseEntitys = thrSubInvWarehouseDao.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
if (CollUtil.isNotEmpty(thrInvWarehouseEntitys)) {
return thrInvWarehouseEntitys.get(0);
} else return null;
}
@Override
public List<ThrSubInvWarehouseEntity> 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 thrSubInvWarehouseDao.filterThrInvWarehouse(filterThrSubInvWarehouseRequest);
}
@Override
public boolean insertThrInvWarehouse(ThrSubInvWarehouseEntity thrInvWarehouseEntity) {
return thrSubInvWarehouseDao.insertThrInvWarehouse(thrInvWarehouseEntity);
}
@Override
public boolean insertInvWarehouses(List<ThrSubInvWarehouseEntity> thrInvWarehouseEntitys) {
return thrSubInvWarehouseDao.insertInvWarehouses(thrInvWarehouseEntitys);
}
@Override
public boolean updateThrInvWarehouse(ThrSubInvWarehouseEntity thrInvWarehouseEntity) {
return thrSubInvWarehouseDao.updateThrInvWarehouse(thrInvWarehouseEntity);
}
@Override
public boolean deleteById(String id) {
return thrSubInvWarehouseDao.deleteById(id);
}
}

@ -120,7 +120,10 @@
</insert>
<select id="countByParentIdAndName" resultType="int">
select count(*) from inv_warehouse_sub where parentId = #{parentId} and name = #{name}
select count(*)
from inv_warehouse_sub
where parentId = #{parentId}
and name = #{name}
</select>
<select id="selectNameByCode" resultType="java.lang.String">
@ -128,4 +131,28 @@
from inv_warehouse_sub
where code = #{code}
</select>
<select id="selectJoinThirdSys" parameterType="Map"
resultType="com.glxp.sale.admin.entity.inventory.InvSubWarehouseEntity">
select inv_warehouse_sub.* ,a.name thirdName,a1.name thirdName1,a2.name thirdName2,a3.name thirdName3,a4.name
thirdName4
from inv_warehouse_sub
LEFT JOIN thr_inv_warehouse_sub a on a.code = inv_warehouse_sub.thirdId
LEFT JOIN thr_inv_warehouse_sub a1 on a1.code = inv_warehouse_sub.thirdId1
LEFT JOIN thr_inv_warehouse_sub a2 on a2.code = inv_warehouse_sub.thirdId2
LEFT JOIN thr_inv_warehouse_sub a3 on a3.code = inv_warehouse_sub.thirdId3
LEFT JOIN thr_inv_warehouse_sub a4 on a4.code = inv_warehouse_sub.thirdId4
<where>
<if test="code != '' and code != null">
AND inv_warehouse_sub.code = #{code}
</if>
<if test="name != '' and name != null">
AND inv_warehouse_sub.`name` = #{name}
</if>
<if test="parentId != '' and parentId != null">
AND inv_warehouse_sub.parentId = #{parentId}
</if>
</where>
</select>
</mapper>

@ -0,0 +1,83 @@
<?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.sale.admin.dao.thrsys.ThrSubInvWarehouseDao">
<select id="filterThrInvWarehouse" parameterType="com.glxp.sale.admin.req.thrsys.FilterThrInvWarehouseRequest"
resultType="com.glxp.sale.admin.entity.thrsys.ThrSubInvWarehouseEntity">
SELECT *
FROM thr_inv_warehouse_sub
<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.sale.admin.entity.thrsys.ThrSubInvWarehouseEntity">
SELECT *
FROM thr_inv_warehouse_sub
WHERE id = #{id}
</select>
<insert id="insertThrInvWarehouse" keyProperty="id"
parameterType="com.glxp.sale.admin.entity.thrsys.ThrSubInvWarehouseEntity">
replace
INTO thr_inv_warehouse_sub
(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_sub
(id, code, `name`, parentId, remark, thirdSysFk)
VALUES
<foreach collection="thrInvWarehouseEntitys" item="item" index="index"
separator=",">
(
#{id}, #{item.code},
#{item.name}, #{parentId}
#{item.remark}, #{item.thirdSysFk})
</foreach>
</insert>
<delete id="deleteById" parameterType="Map">
DELETE
FROM thr_inv_warehouse_sub
WHERE id = #{id}
</delete>
<update id="updateThrInvWarehouse" parameterType="com.glxp.sale.admin.entity.thrsys.ThrSubInvWarehouseEntity">
UPDATE thr_inv_warehouse_sub
<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