Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/glxp/api/http/ErpBasicClient.java
master
郑明梁 2 years ago
commit 4b7de1e2f7

@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Validated
@RequiredArgsConstructor
@ -64,7 +65,7 @@ public class SysRoleController extends BaseController {
*/
@PostMapping
public BaseResponse add(@Validated @RequestBody SysRole role) {
role.setRoleKey(UUID.randomUUID() + "");
if (Constant.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
return ResultVOUtils.error(500, "新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
} else if (Constant.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {

@ -10,6 +10,7 @@ import com.glxp.api.req.basic.FilterBusTypeChangeRequest;
import com.glxp.api.req.basic.FilterBusTypePreRequest;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.service.auth.InvWarehouseService;
import com.glxp.api.service.basic.IBasicBusTypePreService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
@ -30,6 +31,8 @@ public class BasicBusTypePreController {
@Resource
private IBasicBusTypePreService basicBusTypePreService;
@Resource
private InvWarehouseService invWarehouseService;
@GetMapping("/spms/bussinessChangeType/filter")
@ -100,14 +103,14 @@ public class BasicBusTypePreController {
}
/*if (basicBusTypePreEntity != null) {
if (StrUtil.isNotEmpty(basicBusTypePreEntity.getDefaultSubInv())) {
InvSubWarehouseEntity invSubWarehouseEntity = invSubWarehouseService.findByInvSubByCode(basicBusTypePreEntity.getDefaultSubInv());
InvWarehouseEntity byInvSubByCode = invWarehouseService.findByInvSubByCode(basicBusTypePreEntity.getDefaultSubInv());
basicBusTypePreEntity.setDefaultInv(invSubWarehouseEntity.getParentId());
}
if (StrUtil.isNotEmpty(basicBusTypePreEntity.getLocSubInv())) {
InvSubWarehouseEntity invSubWarehouseEntity = invSubWarehouseService.findByInvSubByCode(basicBusTypePreEntity.getLocSubInv());
basicBusTypePreEntity.setLocInv(invSubWarehouseEntity.getParentId());
}
bussinessChangeTypeService.insertBusChangeTypee(basicBusTypePreEntity);
basicBusTypePreService.insertBusChangeTypee(basicBusTypePreEntity);
} else {
ResultVOUtils.error(999, "参数错误");
}*/

@ -1,8 +1,34 @@
package com.glxp.api.controller.thrsys;
import cn.hutool.core.collection.CollUtil;
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.ThrBusTypeOriginEntity;
import com.glxp.api.entity.thrsys.ThrSystemBusApiEntity;
import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.glxp.api.http.ErpBasicClient;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.req.thrsys.FilterBasicThirdSysDetailRequest;
import com.glxp.api.req.thrsys.FilterThrBusTypeOriginRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.thrsys.ThrBusTypeOriginResponse;
import com.glxp.api.service.thrsys.IThrBusTypeOriginService;
import com.glxp.api.service.thrsys.ThrSystemService;
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;
/**
*
*/
@ -10,6 +36,176 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
public class ThrBusTypeOriginController {
@Resource
private IThrBusTypeOriginService thrBusTypeOriginService;
@Resource
private ThrSystemService thrSystemService;
@Resource
private ErpBasicClient erpBasicClient;
/**
*
*
* @param filterThrBusTypeOriginRequest
* @param bindingResult
* @return
*/
@GetMapping("/udiwms/originBusType/filter")
public BaseResponse filterList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (filterThrBusTypeOriginRequest.isOnlyMain()) {
ThrSystemEntity thrSystemEntity = thrSystemService.selectMainThrSys();
filterThrBusTypeOriginRequest.setThirdSys(thrSystemEntity.getThirdId());
} else if (StrUtil.isEmpty(filterThrBusTypeOriginRequest.getThirdSys())) {
ThrSystemEntity thrSystemEntity = thrSystemService.selectMainThrSys();
filterThrBusTypeOriginRequest.setThirdSys(thrSystemEntity.getThirdId());
}
List<ThrBusTypeOriginEntity> thrBusTypeOriginEntities = thrBusTypeOriginService.filterEnableList(filterThrBusTypeOriginRequest);
PageInfo<ThrBusTypeOriginEntity> pageInfo = new PageInfo<>(thrBusTypeOriginEntities);
return ResultVOUtils.page(pageInfo);
}
/**
*
*
* @param filterThrBusTypeOriginRequest
* @param bindingResult
* @return
*/
@GetMapping("/udiwms/originBusType/filterJoin")
public BaseResponse filterJoinList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<ThrBusTypeOriginResponse> list = thrBusTypeOriginService.filterJoinList(filterThrBusTypeOriginRequest);
PageInfo<ThrBusTypeOriginResponse> pageInfo = new PageInfo<>(list);
return ResultVOUtils.page(pageInfo);
}
/**
*
*
* @param thrBusTypeOriginEntity
* @param bindingResult
* @return
*/
@PostMapping("/udiwms/originBusType/update")
public BaseResponse updateBussinessType(@RequestBody @Valid ThrBusTypeOriginEntity thrBusTypeOriginEntity,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (thrBusTypeOriginEntity != null) {
//校验单据类型代码是否重复
boolean exists = thrBusTypeOriginService.checkActionExists(thrBusTypeOriginEntity.getAction(), thrBusTypeOriginEntity.getThirdSys());
if (exists) {
return ResultVOUtils.error(500, "单据类型已存在!");
}
thrBusTypeOriginService.updateBusOriginType(thrBusTypeOriginEntity);
} else {
ResultVOUtils.error(999, "参数错误");
}
return ResultVOUtils.success("更新成功");
}
/**
*
*
* @param thrBusTypeOriginEntity
* @param bindingResult
* @return
*/
@PostMapping("/udiwms/originBusType/add")
public BaseResponse addBussinessType(@RequestBody ThrBusTypeOriginEntity thrBusTypeOriginEntity,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (thrBusTypeOriginEntity != null) {
boolean exists = thrBusTypeOriginService.checkActionExists(thrBusTypeOriginEntity.getAction(), thrBusTypeOriginEntity.getThirdSys());
if (exists) {
return ResultVOUtils.error(500, "单据类型已存在!");
}
thrBusTypeOriginService.insertBusOriginType(thrBusTypeOriginEntity);
} else {
return ResultVOUtils.error(999, "参数错误");
}
return ResultVOUtils.success("更新成功");
}
/**
*
*
* @param deleteRequest
* @param bindingResult
* @return
*/
@PostMapping("/udiwms/originBusType/delete")
public BaseResponse delBussinessType(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (deleteRequest != null) {
thrBusTypeOriginService.deleteById(deleteRequest.getId());
} else {
return ResultVOUtils.error(999, "参数错误");
}
return ResultVOUtils.success("更新成功");
}
/**
*
*
* @param filterThrBusTypeOriginRequest
* @param bindingResult
* @return
*/
@PostMapping("/udiwms/originBusType/download")
public BaseResponse dlBusType(@RequestBody @Valid FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest = new FilterBasicThirdSysDetailRequest();
filterBasicThirdSysDetailRequest.setThirdSysFk(filterThrBusTypeOriginRequest.getThirdSys());
int page = 1;
int limit = 100;
while (true) {
filterBasicThirdSysDetailRequest.setPage(page);
filterBasicThirdSysDetailRequest.setLimit(limit);
BaseResponse<PageSimpleResponse<ThrSystemBusApiEntity>> baseResponse = erpBasicClient.getBusTypes(filterBasicThirdSysDetailRequest);
if (baseResponse != null && baseResponse.getCode() == 20000) {
List<ThrSystemBusApiEntity> thrSystemBusApiList = baseResponse.getData().getList();
if (CollUtil.isNotEmpty(thrSystemBusApiList)) {
for (ThrSystemBusApiEntity basicThirdSysBusApiEntity : thrSystemBusApiList) {
ThrBusTypeOriginEntity thrBusTypeOriginEntity = new ThrBusTypeOriginEntity();
thrBusTypeOriginEntity.setName(basicThirdSysBusApiEntity.getName());
thrBusTypeOriginEntity.setAction(basicThirdSysBusApiEntity.getCode());
thrBusTypeOriginEntity.setThirdSys(filterThrBusTypeOriginRequest.getThirdSys());
thrBusTypeOriginEntity.setInoutType(basicThirdSysBusApiEntity.getInoutType());
thrBusTypeOriginEntity.setRemark(basicThirdSysBusApiEntity.getRemark());
thrBusTypeOriginEntity.setEnable(true);
thrBusTypeOriginEntity.setUpdateTime(new Date());
thrBusTypeOriginService.insertBusOriginType(thrBusTypeOriginEntity);
}
if (thrSystemBusApiList.size() >= 100) {
page++;
} else
break;
} else {
break;
}
} else {
return baseResponse;
}
}
return ResultVOUtils.success("下载成功");
}
}

@ -2,12 +2,39 @@ package com.glxp.api.dao.thrsys;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity;
import com.glxp.api.req.thrsys.FilterThrBusTypeOriginRequest;
import com.glxp.api.res.thrsys.ThrBusTypeOriginResponse;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
*
*/
@Mapper
public interface ThrBusTypeOriginDao extends BaseMapper<ThrBusTypeOriginEntity> {
/**
*
*
* @param filterThrBusTypeOriginRequest
* @return
*/
List<ThrBusTypeOriginEntity> filterEnableList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest);
/**
*
*
* @param filterThrBusTypeOriginRequest
* @return
*/
List<ThrBusTypeOriginResponse> filterJoinList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest);
/**
*
*
* @param thrBusTypeOriginEntity
* @return
*/
boolean insertBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity);
}

@ -5,12 +5,15 @@ import com.alibaba.fastjson.JSONObject;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.entity.basic.BasicThirdSysEntity;
import com.glxp.api.entity.thrsys.ThrSystemBusApiEntity;
import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.alibaba.fastjson.TypeReference;
import com.glxp.api.req.thrsys.FilterThrProductsRequest;
import com.glxp.api.req.thrsys.ThrProductsRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.thrsys.ThrProductsResponse;
import com.glxp.api.req.thrsys.FilterBasicThirdSysDetailRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.service.thrsys.ThrSystemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -133,5 +136,8 @@ public class ErpBasicClient {
}
}
//下载第三方系统单据类型
public BaseResponse<PageSimpleResponse<ThrSystemBusApiEntity>> getBusTypes(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest) {
return null;
}
}

@ -9,6 +9,14 @@ import lombok.Data;
@Data
public class FilterBusTypePreRequest extends ListPageRequest {
/**
*
*/
private String action;
/**
*
*/
private String thirdAction;
}

@ -10,13 +10,63 @@ import lombok.Data;
public class FilterThrBusTypeOriginRequest extends ListPageRequest {
/**
*
*
*/
private String action;
/**
*
*/
private String name;
/**
*
*/
private String thirdSys;
/**
*
*/
private String thirdSysName;
/**
*
*/
private Boolean enable;
/**
*
*/
private String thirdAction;
/**
*
*/
private String mainAction;
/**
*
*/
private String busAction;
/**
*
*/
private String lastUpdateTime;
/**
*
*/
private Integer corpType;
/**
*
*/
private String key;
/**
*
*/
private boolean onlyMain;
}

@ -1,7 +1,82 @@
package com.glxp.api.service.thrsys;
import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.req.thrsys.FilterThrBusTypeOriginRequest;
import com.glxp.api.res.thrsys.ThrBusTypeOriginResponse;
import java.util.List;
/**
* Service
*/
public interface IThrBusTypeOriginService {
/**
*
*
* @param filterThrBusTypeOriginRequest
* @return
*/
List<ThrBusTypeOriginEntity> filterEnableList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest);
/**
*
*
* @param filterThrBusTypeOriginRequest
* @return
*/
List<ThrBusTypeOriginResponse> filterJoinList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest);
/**
*
*
* @param thrBusTypeOriginEntity
*/
boolean insertBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity);
/**
*
*
* @param id
* @return
*/
boolean deleteById(String id);
/**
*
*
* @param action
* @param thirdSys
* @return
*/
boolean checkActionExists(String action, String thirdSys);
/**
*
*
* @param thrBusTypeOriginEntity
* @return
*/
boolean updateBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity);
/**
*
*
* @param action
* @return
*/
ThrBusTypeOriginEntity findByAction(String action);
/**
*
*
* @param action
* @param key
* @return
*/
ThrSystemDetailEntity findSysByAction(String action, String key);
//ThrBusTypeOriginResponse findByThirdAction
}

@ -1,12 +1,105 @@
package com.glxp.api.service.thrsys.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.thrsys.ThrBusTypeOriginDao;
import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.req.thrsys.FilterThrBusTypeOriginRequest;
import com.glxp.api.res.thrsys.ThrBusTypeOriginResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.thrsys.IThrBusTypeOriginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrBusTypeOriginServiceImpl implements IThrBusTypeOriginService {
@Resource
private CustomerService customerService;
@Resource
private ThrBusTypeOriginDao thrBusTypeOriginDao;
@Override
public List<ThrBusTypeOriginEntity> filterEnableList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest) {
if (null != filterThrBusTypeOriginRequest.getPage() && null != filterThrBusTypeOriginRequest.getLimit()) {
PageHelper.offsetPage((filterThrBusTypeOriginRequest.getPage() - 1) * filterThrBusTypeOriginRequest.getLimit(), filterThrBusTypeOriginRequest.getLimit());
}
return thrBusTypeOriginDao.filterEnableList(filterThrBusTypeOriginRequest);
}
@Override
public List<ThrBusTypeOriginResponse> filterJoinList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest) {
if (null == filterThrBusTypeOriginRequest) {
return Collections.emptyList();
}
if (null != filterThrBusTypeOriginRequest.getPage() && null != filterThrBusTypeOriginRequest.getLimit()) {
PageHelper.offsetPage((filterThrBusTypeOriginRequest.getPage() - 1) * filterThrBusTypeOriginRequest.getLimit(), filterThrBusTypeOriginRequest.getLimit());
}
return thrBusTypeOriginDao.filterJoinList(filterThrBusTypeOriginRequest);
}
@Override
public boolean insertBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity) {
//设置创建信息
setUpdateInfo(thrBusTypeOriginEntity);
return thrBusTypeOriginDao.insertBusOriginType(thrBusTypeOriginEntity);
}
@Override
public boolean deleteById(String id) {
return thrBusTypeOriginDao.deleteById(id) != 0;
}
@Override
public boolean checkActionExists(String action, String thirdSys) {
Long count = thrBusTypeOriginDao.selectCount(new QueryWrapper<ThrBusTypeOriginEntity>().eq("action", action).eq("thirdSys", thirdSys));
if (count > 0) {
return true;
}
return false;
}
@Override
public boolean updateBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity) {
//设置更新信息
setUpdateInfo(thrBusTypeOriginEntity);
thrBusTypeOriginEntity.setEnable(true);
return thrBusTypeOriginDao.updateById(thrBusTypeOriginEntity) != 0;
}
@Override
public ThrBusTypeOriginEntity findByAction(String action) {
return null;
}
@Override
public ThrSystemDetailEntity findSysByAction(String action, String key) {
return null;
}
/**
* /
*
* @param thrBusTypeOriginEntity
*/
private void setUpdateInfo(ThrBusTypeOriginEntity thrBusTypeOriginEntity) {
Date now = new Date();
String userId = String.valueOf(customerService.getUserId());
if (null == thrBusTypeOriginEntity.getId()) {
thrBusTypeOriginEntity.setCreateUser(userId);
thrBusTypeOriginEntity.setCreateTime(now);
}
thrBusTypeOriginEntity.setUpdateUser(userId);
thrBusTypeOriginEntity.setUpdateTime(now);
}
}

@ -1,5 +1,77 @@
<?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.ThrBusTypeOriginDao">
<select id="filterEnableList" resultType="com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity">
select *
from thr_bustype_origin tbo
left join thr_system_detail
on tbo.thirdSys = thr_system_detail.thirdSysFk
<where>
thr_system_detail.`key` = 'busTypeQueryUrl'
and thr_system_detail.enabled = 1
<if test="name != null and name != ''">
AND tbo.name like concat('%', #{name}, '%')
</if>
<if test="action != null and action != ''">
AND tbo.action like concat('%', #{action}, '%')
</if>
<if test="key != null and key != ''">
AND ((tbo.name LIKE concat('%', #{key}, '%')) or (tbo.action LIKE
concat('%', #{key}, '%')))
</if>
<if test="thirdSys != null and thirdSys != ''">
AND tbo.thirdSys = #{thirdSys}
</if>
</where>
</select>
<select id="filterJoinList" resultType="com.glxp.api.res.thrsys.ThrBusTypeOriginResponse">
select tbo.name,
tbo.action thirdAction,
tbo.name thirdName,
bu.action,
bu.mainAction,
tbo.thirdSys,
bu.corpType
from thr_bustype_origin tbo
left join basic_bussiness_type bu on tbo.action = bu.originAction
<where>
<if test="name != null and name != ''">
AND tbo.name like concat('%', #{name}, '%')
</if>
<if test="thirdAction != ''and thirdAction != null">
AND tbo.action = #{thirdAction}
</if>
<if test="mainAction != ''and mainAction != null">
AND tbo.action = #{mainAction}
</if>
<if test="busAction != ''and busAction != null">
AND bu.action = #{busAction}
</if>
<if test="action != ''and action != null">
AND tbo.action = #{thirdAction}
</if>
<if test="corpType != ''and corpType != null">
AND bu.corpType = #{corpType}
</if>
</where>
group by tbo.action
</select>
<insert id="insertBusOriginType" parameterType="com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity">
replace into thr_bustype_origin
(`name`, `action`, thirdSys, thirdSysName, `enable`, inoutType, updateTime, remark, createUser, updateUser,
createTime)
values (#{name},
#{action},
#{thirdSys},
#{thirdSysName},
#{enable},
#{inoutType},
#{updateTime},
#{remark},
#{createUser},
#{updateUser},
#{createTime})
</insert>
</mapper>
Loading…
Cancel
Save