新增第三系统设置以及接口相关代码
parent
ff3c880aa3
commit
b1b6a1b849
@ -0,0 +1,318 @@
|
||||
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.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.ThrSystemBusApiEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrSystemEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
|
||||
import com.glxp.api.http.ErpBasicClient;
|
||||
import com.glxp.api.req.thrsys.FilterBasicThirdSysDetailRequest;
|
||||
import com.glxp.api.req.thrsys.FilterBasicThirdSysRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.res.thrsys.BasicThirdSysResponse;
|
||||
import com.glxp.api.service.thrsys.ThrSystemBusApiService;
|
||||
import com.glxp.api.service.thrsys.ThrSystemDetailService;
|
||||
import com.glxp.api.service.thrsys.ThrSystemService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
public class ThrSystemController {
|
||||
|
||||
|
||||
@Resource
|
||||
private ThrSystemService thrSystemService;
|
||||
@Resource
|
||||
private ThrSystemDetailService thrSystemDetailService;
|
||||
// @Resource
|
||||
// UdiRelevanceService udiRelevanceService;
|
||||
// @Resource
|
||||
// UnitMaintainService unitMaintainService;
|
||||
@Resource
|
||||
ThrSystemBusApiService thrSystemBusApiService;
|
||||
// @Resource
|
||||
// private BussinessOriginTypeService bussinessOriginTypeService;
|
||||
|
||||
|
||||
@GetMapping("/udiwms/basic/thirdsys/filter")
|
||||
public BaseResponse filter(FilterBasicThirdSysRequest filterBasicThirdSysRequest,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
List<ThrSystemEntity> basicThirdSysEntities;
|
||||
|
||||
basicThirdSysEntities = thrSystemService.filterBasicThiSys(filterBasicThirdSysRequest);
|
||||
|
||||
PageInfo<ThrSystemEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(basicThirdSysEntities);
|
||||
PageSimpleResponse<ThrSystemEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(basicThirdSysEntities);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码精灵获取第三方系统列表
|
||||
*/
|
||||
@AuthRuleAnnotation("")
|
||||
@GetMapping("/udiwms/basic/thirdsys/get")
|
||||
public BaseResponse get(FilterBasicThirdSysRequest filterBasicThirdSysRequest,
|
||||
BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
List<ThrSystemEntity> basicThirdSysEntities;
|
||||
basicThirdSysEntities = thrSystemService.filterBasicThiSys(filterBasicThirdSysRequest);
|
||||
List<BasicThirdSysResponse> basicThirdSysResponses = basicThirdSysEntities.stream().map(item ->
|
||||
{
|
||||
BasicThirdSysResponse basicThirdSysResponse = new BasicThirdSysResponse();
|
||||
BeanUtils.copyProperties(item, basicThirdSysResponse);
|
||||
return basicThirdSysResponse;
|
||||
}).collect(Collectors.toList());
|
||||
basicThirdSysResponses.add(new BasicThirdSysResponse("ybbm", "医保编码"));
|
||||
basicThirdSysResponses.add(new BasicThirdSysResponse("sptm", "商品条码"));
|
||||
basicThirdSysResponses.add(new BasicThirdSysResponse("udiCode", "UDI最小销售标识"));
|
||||
return ResultVOUtils.success(basicThirdSysResponses);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/udiwms/basic/thirdsys/selectIp")
|
||||
public BaseResponse selectIp(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
ThrSystemEntity thrSystemEntity = thrSystemService.selectByThirdId(filterBasicThirdSysDetailRequest.getThirdSysFk());
|
||||
return ResultVOUtils.success(thrSystemEntity);
|
||||
}
|
||||
|
||||
@PostMapping("/udiwms/basic/thirdsys/update")
|
||||
public BaseResponse save(@RequestBody @Valid ThrSystemEntity thrSystemEntity,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
if (thrSystemEntity != null) {
|
||||
//校验系统名称
|
||||
if (StrUtil.isBlank(thrSystemEntity.getThirdName())) {
|
||||
return ResultVOUtils.error(500, "系统名称不能为空");
|
||||
}
|
||||
//校验系统名称是否重复
|
||||
boolean exists = thrSystemService.selectThirdNameExists(thrSystemEntity.getThirdId(), thrSystemEntity.getThirdName());
|
||||
if (exists) {
|
||||
return ResultVOUtils.error(500, "第三方系统名称重复");
|
||||
}
|
||||
|
||||
ThrSystemEntity temp = thrSystemService.selectByThirdId(thrSystemEntity.getThirdId());
|
||||
|
||||
if (!thrSystemEntity.getEnabled()) {
|
||||
//如操作为禁用第三方系统,则需要判断是否是最后一个启用的第三方系统,需要保留至少启用一个第三方系统
|
||||
FilterBasicThirdSysRequest filterBasicThirdSysRequest = new FilterBasicThirdSysRequest();
|
||||
filterBasicThirdSysRequest.setEnabled(true);
|
||||
int count = thrSystemService.countThirdSys(filterBasicThirdSysRequest);
|
||||
if (count == 1) {
|
||||
return ResultVOUtils.error(500, "至少需需用一个第三方系统!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (thrSystemEntity.getMainSys() && !thrSystemEntity.getEnabled()) {
|
||||
return ResultVOUtils.error(500, "主系统必须启用");
|
||||
}
|
||||
|
||||
//todo 耗材字典还未完成
|
||||
// if (!temp.getMainSys().equals(basicThirdSysEntity.getMainSys())) {
|
||||
// if (udiRelevanceService.isExit() || unitMaintainService.isExit()) {
|
||||
// return ResultVOUtils.error(999, "产品信息已经关联,无法取消主系统!");
|
||||
// }
|
||||
// if ((!temp.getEnabled()) && basicThirdSysEntity.getMainSys()) {
|
||||
// if (!basicThirdSysEntity.getEnabled()) {
|
||||
// return ResultVOUtils.error(999, "请先启用系统!");
|
||||
// }
|
||||
// }
|
||||
// if (!basicThirdSysEntity.getEnabled() && basicThirdSysEntity.getMainSys()) {
|
||||
// return ResultVOUtils.error(999, "请先启用系统!");
|
||||
// }
|
||||
// }
|
||||
if (thrSystemEntity.getMainSys()) {
|
||||
List<ThrSystemEntity> basicThirdSysEntities = thrSystemService.filterBasicThiSys(new FilterBasicThirdSysRequest());
|
||||
for (ThrSystemEntity thrSystemEntity1 : basicThirdSysEntities) {
|
||||
thrSystemEntity1.setMainSys(false);
|
||||
thrSystemService.updateBasicThiSys(thrSystemEntity1);
|
||||
}
|
||||
}
|
||||
thrSystemService.updateBasicThiSys(thrSystemEntity);
|
||||
} else {
|
||||
ResultVOUtils.error(999, "参数错误");
|
||||
}
|
||||
return ResultVOUtils.success("更新成功");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/udiwms/basic/thirdsys/filterDetail")
|
||||
public BaseResponse filterDetail(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
List<ThrSystemDetailEntity> basicThirdSysEntities;
|
||||
basicThirdSysEntities = thrSystemDetailService.filterBasicThirdSysDetail(filterBasicThirdSysDetailRequest);
|
||||
PageInfo<ThrSystemDetailEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(basicThirdSysEntities);
|
||||
PageSimpleResponse<ThrSystemDetailEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(basicThirdSysEntities);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
@GetMapping("/udiwms/basic/thirdsys/filterDetailByKey")
|
||||
public BaseResponse filterDetailByKey(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
ThrSystemDetailEntity thrSystemDetailEntity = thrSystemDetailService.
|
||||
selectByKey(filterBasicThirdSysDetailRequest.getKey(), filterBasicThirdSysDetailRequest.getThirdSysFk());
|
||||
return ResultVOUtils.success(thrSystemDetailEntity);
|
||||
}
|
||||
|
||||
@PostMapping("/udiwms/basic/thirdsys/saveDetail")
|
||||
public BaseResponse saveDetail(@RequestBody @Valid ThrSystemDetailEntity thrSystemDetailEntity,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
if (thrSystemDetailEntity != null) {
|
||||
thrSystemDetailService.updateBasicThirdSysDetail(thrSystemDetailEntity);
|
||||
} else {
|
||||
ResultVOUtils.error(999, "参数错误");
|
||||
}
|
||||
return ResultVOUtils.success("更新成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用第三方系统接口
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/udiwms/basic/thirdsys/updateInterfaceStatus")
|
||||
public BaseResponse updateInterfaceStatus(@RequestBody List<ThrSystemDetailEntity> list) {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||
}
|
||||
thrSystemDetailService.updateInterfaceStatus(list);
|
||||
return ResultVOUtils.success("添加成功");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/udiwms/basic/thirdsys/filterBusTypeDetail")
|
||||
public BaseResponse filterBusTypeDetail(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest,
|
||||
BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
List<ThrSystemBusApiEntity> basicThirdSysEntities = thrSystemBusApiService.filterSysBusApi(filterBasicThirdSysDetailRequest);
|
||||
|
||||
PageInfo<ThrSystemBusApiEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(basicThirdSysEntities);
|
||||
PageSimpleResponse<ThrSystemBusApiEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(basicThirdSysEntities);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/udiwms/basic/thirdsys/saveBusTypeDetail")
|
||||
public BaseResponse saveBusTypeDetail(@RequestBody @Valid ThrSystemBusApiEntity thrSystemBusApiEntity,
|
||||
BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
if (thrSystemBusApiEntity != null) {
|
||||
thrSystemBusApiService.updateSysBusApi(thrSystemBusApiEntity);
|
||||
} else {
|
||||
ResultVOUtils.error(999, "参数错误");
|
||||
}
|
||||
return ResultVOUtils.success("更新成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 第三方系统 业务单据提交接口添加/更新单据类型
|
||||
*
|
||||
* @param thrSystemBusApiEntity
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/udiwms/basic/thirdsys/saveBusTypes")
|
||||
public BaseResponse saveBusTypes(@RequestBody ThrSystemBusApiEntity thrSystemBusApiEntity) {
|
||||
if (null == thrSystemBusApiEntity || null == thrSystemBusApiEntity.getType()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||
}
|
||||
|
||||
//todo 第三方单据类型还未完成
|
||||
// BussinessOriginTypeResponse bussinessOriginTypeResponse = bussinessOriginTypeService.finByLocalAction(basicThirdSysBusApiEntity.getCode());
|
||||
// if (bussinessOriginTypeResponse != null) {
|
||||
// basicThirdSysBusApiEntity.setThirdBuyCode(bussinessOriginTypeResponse.getThirdAction());
|
||||
// basicThirdSysBusApiEntity.setThirdBuyName(bussinessOriginTypeResponse.getThirdName());
|
||||
// }
|
||||
|
||||
boolean result = thrSystemBusApiService.saveBusTypes(thrSystemBusApiEntity);
|
||||
if (result) {
|
||||
return ResultVOUtils.success();
|
||||
}
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
|
||||
@GetMapping("/udiwms/basic/thirdsys/delete")
|
||||
public BaseResponse delete(Integer id) {
|
||||
if (null == id) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||
}
|
||||
boolean result = thrSystemBusApiService.delete(id);
|
||||
if (result) {
|
||||
return ResultVOUtils.success();
|
||||
}
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试第三方服务连通性
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/udiwms/basic/thirdsys/testThirdService")
|
||||
public BaseResponse testThirdService(@RequestBody ThrSystemEntity thrSystemEntity) {
|
||||
return thrSystemDetailService.testThirdService(thrSystemEntity);
|
||||
}
|
||||
|
||||
@Resource
|
||||
ErpBasicClient erpBasicClient;
|
||||
|
||||
@PostMapping("/udiwms/basic/thirdsys/testThirdInter")
|
||||
public BaseResponse testThirdInter(@RequestBody ThrSystemEntity thrSystemEntity) {
|
||||
return erpBasicClient.testThridConnect(thrSystemEntity);
|
||||
}
|
||||
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
package com.glxp.api.dao.system;
|
||||
|
||||
import com.glxp.api.entity.system.BasicThirdSysEntity;
|
||||
import com.glxp.api.req.system.FilterBasicThirdSysRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BasicThirdSysDao {
|
||||
|
||||
boolean updateBasicThiSys(BasicThirdSysEntity basicThirdSysEntity);
|
||||
|
||||
BasicThirdSysEntity selectByThirdId(@Param("thirdId") String thirdId);
|
||||
|
||||
List<BasicThirdSysEntity> filterBasicThiSys(FilterBasicThirdSysRequest filterBasicThirdSysRequest);
|
||||
|
||||
/**
|
||||
* 查询启用的第三方系统的ID
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<String> selectEnabledThirdId();
|
||||
|
||||
/**
|
||||
* 查询第三方系统名称数量
|
||||
*
|
||||
* @param thirdName
|
||||
* @return
|
||||
*/
|
||||
int selectCountByThirdName(@Param("thirdName") String thirdName);
|
||||
|
||||
/**
|
||||
* 根据系统ID和名称查询第三方系统配置信息
|
||||
*
|
||||
* @param thirdId
|
||||
* @param thirdName
|
||||
* @return
|
||||
*/
|
||||
BasicThirdSysEntity selectByThirdIdAndThirdName(@Param("thirdId") String thirdId, @Param("thirdName") String thirdName);
|
||||
|
||||
/**
|
||||
* 根据第三方系统ID查询第三方系统名称
|
||||
*
|
||||
* @param thirdSysFk
|
||||
* @return
|
||||
*/
|
||||
String selectThirdNameByThirdId(@Param("thirdId") String thirdId);
|
||||
|
||||
int countThirdSys(FilterBasicThirdSysRequest filterBasicThirdSysRequest);
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.glxp.api.dao.thrsys;
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrSystemEntity;
|
||||
import com.glxp.api.req.thrsys.FilterBasicThirdSysRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ThrSystemDao {
|
||||
|
||||
boolean updateBasicThiSys(ThrSystemEntity thrSystemEntity);
|
||||
|
||||
ThrSystemEntity selectByThirdId(@Param("thirdId") String thirdId);
|
||||
|
||||
List<ThrSystemEntity> filterBasicThiSys(FilterBasicThirdSysRequest filterBasicThirdSysRequest);
|
||||
|
||||
/**
|
||||
* 查询启用的第三方系统的ID
|
||||
*/
|
||||
List<String> selectEnabledThirdId();
|
||||
|
||||
/**
|
||||
* 查询第三方系统名称数量
|
||||
*/
|
||||
int selectCountByThirdName(@Param("thirdName") String thirdName);
|
||||
|
||||
/**
|
||||
* 根据系统ID和名称查询第三方系统配置信息
|
||||
*/
|
||||
ThrSystemEntity selectByThirdIdAndThirdName(@Param("thirdId") String thirdId, @Param("thirdName") String thirdName);
|
||||
|
||||
/**
|
||||
* 根据第三方系统ID查询第三方系统名称
|
||||
*/
|
||||
String selectThirdNameByThirdId(@Param("thirdId") String thirdId);
|
||||
|
||||
int countThirdSys(FilterBasicThirdSysRequest filterBasicThirdSysRequest);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.glxp.api.dao.thrsys;
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
|
||||
import com.glxp.api.req.thrsys.FilterBasicThirdSysDetailRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ThrSystemDetailDao {
|
||||
|
||||
|
||||
boolean updateBasicThirdSysDetail(ThrSystemDetailEntity basicThirdSysEntity);
|
||||
|
||||
ThrSystemDetailEntity selectByKey(@Param("key") String key, @Param("thirdSys") String thirdSys);
|
||||
|
||||
List<ThrSystemDetailEntity> filterBasicThirdSysDetail(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest);
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.glxp.api.entity.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ThrSystemBusApiEntity {
|
||||
|
||||
private Integer id;
|
||||
private String code;
|
||||
private String name;
|
||||
private String thirdBuyName; //第三方系统单据类型名称
|
||||
private String thirdBuyCode; //第三方系统单据类型代码
|
||||
private String thirdSys;
|
||||
private String url;
|
||||
private Integer type;
|
||||
private String remark;
|
||||
private Integer inoutType;
|
||||
|
||||
//扩展字段 暂未启用
|
||||
private String filed;
|
||||
private String filed1;
|
||||
private String filed2;
|
||||
private String filed3;
|
||||
private String filed4;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.glxp.api.entity.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ThrSystemDetailEntity {
|
||||
|
||||
private Integer id;
|
||||
private String key;
|
||||
private String value;
|
||||
private Boolean enabled;
|
||||
private Boolean itrCache;
|
||||
private String guideUrl;
|
||||
private String thridUrl;
|
||||
private String remark;
|
||||
private String thirdSysFk;
|
||||
private String name;
|
||||
private Integer fromType;
|
||||
private String localAction;
|
||||
private String thirdAction;
|
||||
|
||||
public String getValue() {
|
||||
if (value == null)
|
||||
return null;
|
||||
else if (thridUrl != null)
|
||||
return thridUrl + value;
|
||||
else
|
||||
return value;
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package com.glxp.api.entity.system;
|
||||
package com.glxp.api.entity.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BasicThirdSysEntity {
|
||||
public class ThrSystemEntity {
|
||||
private String id;
|
||||
private String thirdId;
|
||||
private String thirdName;
|
@ -0,0 +1,131 @@
|
||||
package com.glxp.api.http;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.entity.thrsys.ThrSystemEntity;
|
||||
import com.glxp.api.service.thrsys.ThrSystemService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 第三方服务HttpClient
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ErpBasicClient {
|
||||
@Resource
|
||||
HttpOkClient httpOkClient;
|
||||
@Resource
|
||||
private ThrSystemService basicThirdSysService;
|
||||
|
||||
|
||||
//todo 基础信息相关接口还未完成
|
||||
// //获取往来单位
|
||||
// public BaseResponse<PageSimpleResponse<ErpUnitsResponse>> getErpCrop(BasicUnitMaintainFilterRequest unitMaintainFilterRequest) {
|
||||
// UdiwmsUnitRequest udiwmsUnitRequest = new UdiwmsUnitRequest();
|
||||
// BeanUtils.copyProperties(unitMaintainFilterRequest, udiwmsUnitRequest);
|
||||
// udiwmsUnitRequest.setUnitId(unitMaintainFilterRequest.getErpId());
|
||||
// BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(unitMaintainFilterRequest.getThirdSys());
|
||||
//
|
||||
// try {
|
||||
// String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/getUnits";
|
||||
// String response = httpOkClient.uCloudPost(url, udiwmsUnitRequest, basicThirdSysEntity);
|
||||
// BaseResponse<PageSimpleResponse<ErpUnitsResponse>> udiDlDeviceResponse =
|
||||
// JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ErpUnitsResponse>>>() {
|
||||
// });
|
||||
// return udiDlDeviceResponse;
|
||||
// } catch (Exception e) {
|
||||
// log.error("获取往来单位异常", e);
|
||||
// return ResultVOUtils.error(500, "连接第三方系统接口服务出错!");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //获取产品信息
|
||||
// public BaseResponse<PageSimpleResponse<ErpProductsResponse>> getErpProducts(FilterErpGoodsRequest filterErpGoodsRequest) {
|
||||
//
|
||||
// BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(filterErpGoodsRequest.getThirdSys());
|
||||
// String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/getProducts";
|
||||
//
|
||||
// try {
|
||||
// String response = httpOkClient.uCloudPost(url, filterErpGoodsRequest, basicThirdSysEntity);
|
||||
// BaseResponse<PageSimpleResponse<ErpProductsResponse>> udiDlDeviceResponse =
|
||||
// JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ErpProductsResponse>>>() {
|
||||
// });
|
||||
// return udiDlDeviceResponse;
|
||||
// } catch (Exception e) {
|
||||
// log.error("获取产品信息异常", e);
|
||||
// return ResultVOUtils.error(500, "连接第三方系统接口服务出错!");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //获取单据类型
|
||||
// public BaseResponse<PageSimpleResponse<BasicThirdSysBusApiEntity>> getBusTypes(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest) {
|
||||
// BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(filterBasicThirdSysDetailRequest.getThirdSysFk());
|
||||
// String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/getOrderType";
|
||||
// UdiwmsBusTypeRequest udiwmsBusTypeRequest = new UdiwmsBusTypeRequest();
|
||||
// udiwmsBusTypeRequest.setThirdSys(filterBasicThirdSysDetailRequest.getThirdSysFk());
|
||||
// udiwmsBusTypeRequest.setPage(filterBasicThirdSysDetailRequest.getPage());
|
||||
// udiwmsBusTypeRequest.setLimit(filterBasicThirdSysDetailRequest.getLimit());
|
||||
// try {
|
||||
// String response = httpOkClient.uCloudPost(url, udiwmsBusTypeRequest, basicThirdSysEntity);
|
||||
// log.info(response);
|
||||
// BaseResponse<PageSimpleResponse<BasicThirdSysBusApiEntity>> udiDlDeviceResponse =
|
||||
// JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<BasicThirdSysBusApiEntity>>>() {
|
||||
// });
|
||||
// return udiDlDeviceResponse;
|
||||
// } catch (Exception e) {
|
||||
// log.error("获取单据类型异常", e);
|
||||
// return ResultVOUtils.error(500, "连接第三方系统接口服务出错!");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //查询仓库货位号
|
||||
// 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 testConnection(ThrSystemEntity thrSystemEntity) {
|
||||
String response = httpOkClient.uCloudPost(thrSystemEntity.getThridUrl() + "/udispsync/sync/testConnection", "{}");
|
||||
log.info(response);
|
||||
if (StrUtil.isBlank(response)) {
|
||||
return ResultVOUtils.error(500, "连接失败");
|
||||
}
|
||||
try {
|
||||
return JSONObject.parseObject(response, BaseResponse.class);
|
||||
} catch (Exception e) {
|
||||
log.info("测试第三方服务连通性失败");
|
||||
return ResultVOUtils.error(500, "连接失败");
|
||||
}
|
||||
}
|
||||
|
||||
//测试连通性
|
||||
public BaseResponse testThridConnect(ThrSystemEntity thrSystemEntity) {
|
||||
String response = httpOkClient.uCloudPost(thrSystemEntity.getThridUrl() + "/udiwms/erp/testThirdSys", "{}");
|
||||
log.info(response);
|
||||
try {
|
||||
return JSONObject.parseObject(response, BaseResponse.class);
|
||||
} catch (Exception e) {
|
||||
log.info("测试第三方服务接口连通性失败");
|
||||
return ResultVOUtils.error(500, "连接失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.glxp.api.http;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.glxp.api.entity.thrsys.ThrSystemEntity;
|
||||
import com.glxp.api.util.OkHttpCli;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class HttpOkClient {
|
||||
|
||||
@Resource
|
||||
OkHttpCli okHttpCli;
|
||||
|
||||
public String uCloudPost(String url, Object object) {
|
||||
|
||||
String json = JSONUtil.toJsonStr(object);
|
||||
log.info(url + "\n" + json);
|
||||
String response = okHttpCli.doPostJson(url, json, "Content-Type", "application/json");
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
public String uCloudPost(String url, Object object, ThrSystemEntity thrSystemEntity) {
|
||||
String json = JSONUtil.toJsonStr(object);
|
||||
log.info(url + "\n" + json);
|
||||
List<String> header = new ArrayList<>();
|
||||
header.add("Content-Type");
|
||||
header.add("application/json");
|
||||
if (null != thrSystemEntity) {
|
||||
|
||||
if (StrUtil.isNotEmpty(thrSystemEntity.getApikey())) {
|
||||
header.add("api_key");
|
||||
header.add(thrSystemEntity.getApikey());
|
||||
}
|
||||
|
||||
|
||||
if (StrUtil.isNotEmpty(thrSystemEntity.getSecretkey())) {
|
||||
header.add("secret_key");
|
||||
header.add(thrSystemEntity.getSecretkey());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
String[] strArray = new String[header.size()];
|
||||
header.toArray(strArray);
|
||||
|
||||
return okHttpCli.doPostJson(url, json, strArray);
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.glxp.api.req.system;
|
||||
package com.glxp.api.req.thrsys;
|
||||
|
||||
import com.glxp.api.req.ListPageRequest;
|
||||
import lombok.Data;
|
@ -1,4 +1,4 @@
|
||||
package com.glxp.api.req.system;
|
||||
package com.glxp.api.req.thrsys;
|
||||
|
||||
import com.glxp.api.req.ListPageRequest;
|
||||
import lombok.Data;
|
@ -0,0 +1,19 @@
|
||||
package com.glxp.api.res.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BasicThirdSysResponse {
|
||||
public BasicThirdSysResponse() {
|
||||
|
||||
}
|
||||
|
||||
public BasicThirdSysResponse(String thirdId, String thirdName) {
|
||||
this.thirdId = thirdId;
|
||||
this.thirdName = thirdName;
|
||||
}
|
||||
|
||||
private String thirdId;
|
||||
private String thirdName;
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package com.glxp.api.service.system;
|
||||
|
||||
|
||||
import com.glxp.api.entity.system.BasicThirdSysEntity;
|
||||
import com.glxp.api.req.system.FilterBasicThirdSysRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BasicThirdSysService {
|
||||
|
||||
|
||||
boolean updateBasicThiSys(BasicThirdSysEntity basicThirdSysEntity);
|
||||
|
||||
BasicThirdSysEntity selectByThirdId(String thirdId);
|
||||
|
||||
List<BasicThirdSysEntity> filterBasicThiSys(FilterBasicThirdSysRequest filterBasicThirdSysRequest);
|
||||
|
||||
BasicThirdSysEntity selectMainThrSys();
|
||||
|
||||
/**
|
||||
* 校验第三方系统名称是否重复
|
||||
*
|
||||
* @param thirdId 第三方系统ID
|
||||
* @param thirdName 第三方系统名称
|
||||
* @return
|
||||
*/
|
||||
boolean selectThirdNameExists(String thirdId, String thirdName);
|
||||
|
||||
int countThirdSys(FilterBasicThirdSysRequest filterBasicThirdSysRequest);
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.glxp.api.service.thrsys;
|
||||
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrSystemBusApiEntity;
|
||||
import com.glxp.api.req.thrsys.FilterBasicThirdSysDetailRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ThrSystemBusApiService {
|
||||
|
||||
boolean insertSysBusApi(ThrSystemBusApiEntity basicThirdSysEntity);
|
||||
|
||||
boolean updateSysBusApi(ThrSystemBusApiEntity basicThirdSysEntity);
|
||||
|
||||
ThrSystemBusApiEntity selectByKey(String key, String thirdSys);
|
||||
|
||||
List<ThrSystemBusApiEntity> filterSysBusApi(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest);
|
||||
|
||||
|
||||
/**
|
||||
* 第三方系统 业务单据提交接口添加单据类型
|
||||
*/
|
||||
boolean saveBusTypes(ThrSystemBusApiEntity thrSystemBusApiEntity);
|
||||
|
||||
boolean delete(Integer id);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.glxp.api.service.thrsys;
|
||||
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.entity.thrsys.ThrSystemEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
|
||||
import com.glxp.api.req.thrsys.FilterBasicThirdSysDetailRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ThrSystemDetailService {
|
||||
|
||||
boolean updateBasicThirdSysDetail(ThrSystemDetailEntity basicThirdSysEntity);
|
||||
|
||||
ThrSystemDetailEntity selectByKey(String key, String thirdSys);
|
||||
|
||||
List<ThrSystemDetailEntity> filterBasicThirdSysDetail(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest);
|
||||
|
||||
void updateInterfaceStatus(List<ThrSystemDetailEntity> list);
|
||||
|
||||
/**
|
||||
* 测试第三方服务连通性
|
||||
*/
|
||||
BaseResponse testThirdService(ThrSystemEntity thrSystemEntity);
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.glxp.api.service.thrsys;
|
||||
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrSystemEntity;
|
||||
import com.glxp.api.req.thrsys.FilterBasicThirdSysRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ThrSystemService {
|
||||
|
||||
|
||||
boolean updateBasicThiSys(ThrSystemEntity thrSystemEntity);
|
||||
|
||||
ThrSystemEntity selectByThirdId(String thirdId);
|
||||
|
||||
List<ThrSystemEntity> filterBasicThiSys(FilterBasicThirdSysRequest filterBasicThirdSysRequest);
|
||||
|
||||
ThrSystemEntity selectMainThrSys();
|
||||
|
||||
/**
|
||||
* 校验第三方系统名称是否重复
|
||||
*
|
||||
* @param thirdId 第三方系统ID
|
||||
* @param thirdName 第三方系统名称
|
||||
* @return
|
||||
*/
|
||||
boolean selectThirdNameExists(String thirdId, String thirdName);
|
||||
|
||||
int countThirdSys(FilterBasicThirdSysRequest filterBasicThirdSysRequest);
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.glxp.api.service.thrsys.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.glxp.api.dao.thrsys.ThrSystemBusApiDao;
|
||||
import com.glxp.api.entity.thrsys.ThrSystemBusApiEntity;
|
||||
import com.glxp.api.req.thrsys.FilterBasicThirdSysDetailRequest;
|
||||
import com.glxp.api.service.thrsys.ThrSystemBusApiService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ThrSystemBusApiServiceImpl implements ThrSystemBusApiService {
|
||||
|
||||
@Resource
|
||||
ThrSystemBusApiDao thrSystemBusApiDao;
|
||||
|
||||
@Override
|
||||
public boolean insertSysBusApi(ThrSystemBusApiEntity basicThirdSysEntity) {
|
||||
return thrSystemBusApiDao.insertSysBusApi(basicThirdSysEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateSysBusApi(ThrSystemBusApiEntity basicThirdSysEntity) {
|
||||
return thrSystemBusApiDao.updateSysBusApi(basicThirdSysEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThrSystemBusApiEntity selectByKey(String key, String thirdSys) {
|
||||
FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest = new FilterBasicThirdSysDetailRequest();
|
||||
filterBasicThirdSysDetailRequest.setThirdSysFk(thirdSys);
|
||||
filterBasicThirdSysDetailRequest.setKey(key);
|
||||
List<ThrSystemBusApiEntity> basicThirdSysBusApiEntities = thrSystemBusApiDao.filterSysBusApi(filterBasicThirdSysDetailRequest);
|
||||
if (CollUtil.isNotEmpty(basicThirdSysBusApiEntities)) {
|
||||
return basicThirdSysBusApiEntities.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThrSystemBusApiEntity> filterSysBusApi(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest) {
|
||||
return thrSystemBusApiDao.filterSysBusApi(filterBasicThirdSysDetailRequest);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean saveBusTypes(ThrSystemBusApiEntity thrSystemBusApiEntity) {
|
||||
if (null != thrSystemBusApiEntity.getId()) {
|
||||
return thrSystemBusApiDao.updateSysBusApi(thrSystemBusApiEntity);
|
||||
}
|
||||
return thrSystemBusApiDao.insertSysBusApi(thrSystemBusApiEntity);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean delete(Integer id) {
|
||||
return thrSystemBusApiDao.deleteById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.glxp.api.service.thrsys.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.dao.thrsys.ThrSystemDetailDao;
|
||||
import com.glxp.api.entity.thrsys.ThrSystemEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
|
||||
import com.glxp.api.http.ErpBasicClient;
|
||||
import com.glxp.api.req.thrsys.FilterBasicThirdSysDetailRequest;
|
||||
import com.glxp.api.service.thrsys.ThrSystemDetailService;
|
||||
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.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ThrSystemDetailServiceImpl implements ThrSystemDetailService {
|
||||
|
||||
@Resource
|
||||
ThrSystemDetailDao thrSystemDetailDao;
|
||||
@Resource
|
||||
private ErpBasicClient erpBasicClient;
|
||||
|
||||
@Override
|
||||
public boolean updateBasicThirdSysDetail(ThrSystemDetailEntity basicThirdSysEntity) {
|
||||
return thrSystemDetailDao.updateBasicThirdSysDetail(basicThirdSysEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThrSystemDetailEntity selectByKey(String key, String thirdSys) {
|
||||
return thrSystemDetailDao.selectByKey(key, thirdSys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThrSystemDetailEntity> filterBasicThirdSysDetail(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest) {
|
||||
if (filterBasicThirdSysDetailRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
if (filterBasicThirdSysDetailRequest.getPage() != null) {
|
||||
int offset = (filterBasicThirdSysDetailRequest.getPage() - 1) * filterBasicThirdSysDetailRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, filterBasicThirdSysDetailRequest.getLimit());
|
||||
}
|
||||
List<ThrSystemDetailEntity> data = thrSystemDetailDao.filterBasicThirdSysDetail(filterBasicThirdSysDetailRequest);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateInterfaceStatus(List<ThrSystemDetailEntity> list) {
|
||||
for (ThrSystemDetailEntity thrSystemDetailEntity : list) {
|
||||
thrSystemDetailDao.updateBasicThirdSysDetail(thrSystemDetailEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse testThirdService(ThrSystemEntity thrSystemEntity) {
|
||||
return erpBasicClient.testThridConnect(thrSystemEntity);
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
<?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.ThrSystemBusApiDao">
|
||||
|
||||
<update id="updateSysBusApi" parameterType="com.glxp.api.entity.thrsys.ThrSystemBusApiEntity">
|
||||
UPDATE thr_system_bus_api
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="code != null">code=#{code},</if>
|
||||
<if test="name != null">`name`=#{name},</if>
|
||||
<if test="thirdBuyName != null">`thirdBuyName`=#{thirdBuyName},</if>
|
||||
<if test="thirdBuyCode != null">`thirdBuyCode`=#{thirdBuyCode},</if>
|
||||
<if test="thirdSys != null">thirdSys=#{thirdSys},</if>
|
||||
<if test="url != null">url=#{url},</if>
|
||||
<if test="type != null">`type`=#{type},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
</trim>
|
||||
WHERE id=#{id}
|
||||
</update>
|
||||
|
||||
<select id="filterSysBusApi" parameterType="com.glxp.api.req.thrsys.FilterBasicThirdSysDetailRequest"
|
||||
resultType="com.glxp.api.entity.thrsys.ThrSystemBusApiEntity">
|
||||
SELECT * FROM thr_system_bus_api
|
||||
<where>
|
||||
<if test="key != '' and key != null">
|
||||
AND code = #{code}
|
||||
</if>
|
||||
<if test="type != '' and type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="code != '' and code != null">
|
||||
AND code = #{code}
|
||||
</if>
|
||||
<if test="name != '' and name != null">
|
||||
AND name = #{name}
|
||||
</if>
|
||||
<if test="thirdSysFk != '' and thirdSysFk != null">
|
||||
AND thirdSys = #{thirdSysFk}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertSysBusApi" keyProperty="id"
|
||||
parameterType="com.glxp.api.entity.thrsys.ThrSystemBusApiEntity">
|
||||
insert
|
||||
ignore
|
||||
INTO thr_system_bus_api
|
||||
(`code`, `name`, thirdBuyName, thirdBuyCode, `thirdSys`, url, `type`, remark)
|
||||
values (
|
||||
#{code},
|
||||
#{name},
|
||||
#{thirdBuyName},
|
||||
#{thirdBuyCode},
|
||||
#{thirdSys},
|
||||
#{url},
|
||||
#{type},
|
||||
#{remark}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="saveBusTypes">
|
||||
insert into thr_system_bus_api (code, `name`, thirdBuyName, thirdBuyCode, thirdSys, type)
|
||||
values
|
||||
<foreach collection="list" index="index" item="item" separator=",">
|
||||
(
|
||||
#{item.code},
|
||||
#{item.name},
|
||||
#{item.thirdBuyName},
|
||||
#{item.thirdBuyCode},
|
||||
#{item.thirdSys},
|
||||
#{item.type}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from thr_system_bus_api
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<select id="selectByCode" resultType="com.glxp.api.entity.thrsys.ThrSystemBusApiEntity">
|
||||
select *
|
||||
from thr_system_bus_api
|
||||
where code = #{code}
|
||||
</select>
|
||||
|
||||
<select id="selectAllCode" resultType="java.lang.String">
|
||||
select code
|
||||
from thr_system_bus_api
|
||||
</select>
|
||||
|
||||
<select id="countByThirdSysAndType" resultType="int">
|
||||
select count(*)
|
||||
from thr_system_bus_api
|
||||
where thirdSys = #{thirdSys}
|
||||
and type = #{type}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,47 @@
|
||||
<?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.ThrSystemDetailDao">
|
||||
|
||||
<update id="updateBasicThirdSysDetail" parameterType="com.glxp.api.entity.thrsys.ThrSystemDetailEntity">
|
||||
UPDATE thr_system_detail
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="value != null">value=#{value},</if>
|
||||
<if test="enabled != null">enabled=#{enabled},</if>
|
||||
<if test="itrCache != null">itrCache=#{itrCache},</if>
|
||||
<if test="guideUrl != null">guideUrl=#{guideUrl},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
<if test="name != null">name=#{name},</if>
|
||||
<if test="fromType != null">fromType=#{fromType},</if>
|
||||
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
|
||||
</trim>
|
||||
WHERE id=#{id}
|
||||
</update>
|
||||
|
||||
<select id="filterBasicThirdSysDetail" parameterType="com.glxp.api.req.thrsys.FilterBasicThirdSysRequest"
|
||||
resultType="com.glxp.api.entity.thrsys.ThrSystemDetailEntity">
|
||||
SELECT *
|
||||
FROM thr_system_detail
|
||||
<where>
|
||||
<if test="key != '' and key != null">
|
||||
AND thr_system_detail.key = #{key}
|
||||
</if>
|
||||
<if test="thirdSysFk != '' and thirdSysFk != null">
|
||||
AND thirdSysFk = #{thirdSysFk}
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
AND enabled = #{enabled}
|
||||
</if>
|
||||
</where>
|
||||
order by id
|
||||
</select>
|
||||
<select id="selectByKey" parameterType="Map"
|
||||
resultType="com.glxp.api.entity.thrsys.ThrSystemDetailEntity">
|
||||
select thr_system_detail.*, thr_system.thridUrl
|
||||
FROM thr_system_detail
|
||||
inner join thr_system on thr_system_detail.thirdSysFk = thr_system.thirdId
|
||||
WHERE thr_system_detail.key = #{key}
|
||||
and thr_system_detail.thirdSysFk = #{thirdSys}
|
||||
and thr_system.enabled = 1
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue