Merge branch 'zmlDev' into dev
commit
17a0e0b99c
@ -0,0 +1,251 @@
|
|||||||
|
package com.glxp.api.controller.inout;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
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.inout.UnitMaintainPlatformEntity;
|
||||||
|
import com.glxp.api.entity.system.PlatformEntity;
|
||||||
|
import com.glxp.api.req.inout.PlatformLinkRequest;
|
||||||
|
import com.glxp.api.req.system.DeleteRequest;
|
||||||
|
import com.glxp.api.req.system.PlatformUserInfoRequest;
|
||||||
|
import com.glxp.api.res.PageSimpleResponse;
|
||||||
|
import com.glxp.api.res.inout.PlatformLinkResponse;
|
||||||
|
import com.glxp.api.service.auth.CustomerService;
|
||||||
|
import com.glxp.api.service.inout.PlatformService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
public class PlatformController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PlatformService platformService;
|
||||||
|
@Resource
|
||||||
|
private CustomerService customerService;
|
||||||
|
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@PostMapping("/udiwms/platform/remove")
|
||||||
|
public BaseResponse remove(@RequestBody PlatformEntity platformEntity) {
|
||||||
|
if (platformService.remove(platformEntity.getId()) > 0) {
|
||||||
|
ResultVOUtils.success("删除成功");
|
||||||
|
}
|
||||||
|
return ResultVOUtils.error(500, "删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@PostMapping("/udiwms/platform/update")
|
||||||
|
public BaseResponse update(@RequestBody PlatformEntity platformEntity) {
|
||||||
|
if (StrUtil.isBlank(platformEntity.getName()) || StrUtil.isBlank(platformEntity.getHost())) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数不能为空");
|
||||||
|
}
|
||||||
|
return platformService.update(platformEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@GetMapping("/udiwms/platform/list")
|
||||||
|
public BaseResponse list(@RequestParam Map<String, Object> params) {
|
||||||
|
List<PlatformEntity> list = platformService.list(params);
|
||||||
|
PageInfo<PlatformEntity> pageInfo = new PageInfo<>(list);
|
||||||
|
PageSimpleResponse<PlatformEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
pageSimpleResponse.setList(pageInfo.getList());
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试账号连通性
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@PostMapping("/udiwms/platform/testUserInfo")
|
||||||
|
public BaseResponse testUserInfo(@RequestBody PlatformUserInfoRequest platformUserInfoRequest, BindingResult bindingResult) {
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
PlatformEntity platformEntity = platformService.getPlatformById(platformUserInfoRequest.getPlatformId());
|
||||||
|
if (null == platformEntity || StrUtil.isBlank(platformEntity.getHost())) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
|
||||||
|
String url = platformEntity.getHost() + "/verify";
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("username", platformUserInfoRequest.getUsername());
|
||||||
|
map.put("password", platformUserInfoRequest.getPassword());
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||||
|
|
||||||
|
HttpEntity<String> request = new HttpEntity<>(JSON.toJSONString(map), headers);
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
log.error(url);
|
||||||
|
|
||||||
|
String result = restTemplate.postForObject(url, request, String.class, map);
|
||||||
|
log.error(result);
|
||||||
|
Map<String, Object> object = JSON.parseObject(result, Map.class);
|
||||||
|
if (!String.valueOf(object.get("code")).equals("20000")) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, String.valueOf(object.get("message")));
|
||||||
|
}
|
||||||
|
Map<String, Object> data = JSON.parseObject(JSON.toJSONString(object.get("data")), Map.class);
|
||||||
|
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
UnitMaintainPlatformEntity unitMaintainPlatformEntity = mapper.convertValue(data, UnitMaintainPlatformEntity.class);
|
||||||
|
return ResultVOUtils.success(unitMaintainPlatformEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@PostMapping("/udiwms/platform/link")
|
||||||
|
public BaseResponse update(@RequestBody PlatformLinkRequest platformLinkRequest) {
|
||||||
|
//判断此数据是否重复
|
||||||
|
String verifyResult = platformService.verifyUnitMaintainPlatform(platformLinkRequest);
|
||||||
|
if (!verifyResult.equals("success")) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, verifyResult);
|
||||||
|
}
|
||||||
|
UnitMaintainPlatformEntity unitMaintainPlatform = new UnitMaintainPlatformEntity();
|
||||||
|
BeanUtil.copyProperties(platformLinkRequest, unitMaintainPlatform);
|
||||||
|
unitMaintainPlatform.setCustomerId(Long.valueOf(unitMaintainPlatform.getUnitId()));
|
||||||
|
platformService.saveUnitPlatform(unitMaintainPlatform);
|
||||||
|
return ResultVOUtils.success("关联成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取往来单位与自助平台关联数据
|
||||||
|
*/
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@GetMapping("/udiwms/platform/getLinkPlatformList")
|
||||||
|
public BaseResponse getLinkPlatformList(PlatformLinkRequest platformLinkRequest, BindingResult bindingResult) {
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
platformLinkRequest.setCustomerId(String.valueOf(customerService.getUserBean().getCustomerId()));
|
||||||
|
List<PlatformLinkResponse> list = platformService.getLinkPlatformList(platformLinkRequest);
|
||||||
|
PageInfo<PlatformLinkResponse> pageInfo = new PageInfo<>(list);
|
||||||
|
PageSimpleResponse<PlatformLinkResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
pageSimpleResponse.setList(pageInfo.getList());
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解绑往来单位和自助平台的关联
|
||||||
|
*
|
||||||
|
* @param deleteRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@PostMapping("/udiwms/platform/unbind")
|
||||||
|
public BaseResponse unbindPlatform(DeleteRequest deleteRequest) {
|
||||||
|
if (StrUtil.isBlank(deleteRequest.getId())) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
platformService.unbindPlatform(deleteRequest.getId());
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取对应平台单据类型
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@GetMapping("/udiwms/platform/getTargetActions")
|
||||||
|
public BaseResponse getTargetActions(String platformId, String invSubCode, String apiKey, String apiSecret) {
|
||||||
|
if (StrUtil.isBlank(platformId)) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
return platformService.getTargetActions(platformId, invSubCode, apiKey, apiSecret);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@GetMapping("/udiwms/platform/getTargetInv")
|
||||||
|
public BaseResponse getTargetInv(String platformId, String apiKey, String apiSecret) {
|
||||||
|
if (StrUtil.isBlank(platformId)) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
return platformService.getTargetInv(platformId, apiKey, apiSecret);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@GetMapping("/udiwms/platform/getTargetSubInv")
|
||||||
|
public BaseResponse getTargetSubInv(String platformId, String invCode, String apiKey, String apiSecret) {
|
||||||
|
if (StrUtil.isBlank(platformId)) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
return platformService.getTargetSubInv(platformId, invCode, apiKey, apiSecret);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试自助平台连通性
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@GetMapping("udiwms/platform/testPlatformConnection")
|
||||||
|
public BaseResponse testPlatformConnection(String host) {
|
||||||
|
if (StrUtil.isBlank(host)) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
return platformService.testPlatformConnection(host);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取客户详情
|
||||||
|
*
|
||||||
|
* @param platformLinkRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@PostMapping("/udiwms/platform/getPlatFormDelect")
|
||||||
|
public BaseResponse getPlatFormDelect(@RequestBody PlatformLinkRequest platformLinkRequest) {
|
||||||
|
|
||||||
|
List<PlatformLinkResponse> platformLinkResponses = platformService.selectDelectList(platformLinkRequest);
|
||||||
|
PageInfo<PlatformLinkResponse> pageInfo = new PageInfo<>(platformLinkResponses);
|
||||||
|
PageSimpleResponse<PlatformLinkResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
pageSimpleResponse.setList(pageInfo.getList());
|
||||||
|
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传单据到自助
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@GetMapping("/udiwms/platform/uploadOrder")
|
||||||
|
public BaseResponse uploadOrder(String orderId) throws JsonProcessingException {
|
||||||
|
if (StrUtil.isBlank(orderId)) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
return platformService.uploadOrder(orderId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.glxp.api.dao.basic;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.glxp.api.entity.basic.BasicProductCategory;
|
||||||
|
import com.glxp.api.res.basic.BasicProductCategoryTypeResponse;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface BasicProductCategoryMapper extends BaseMapper<BasicProductCategory> {
|
||||||
|
List<BasicProductCategoryTypeResponse> getTreeList();
|
||||||
|
List<BasicProductCategory> selectLowTypeAll(@Param("code") String code);
|
||||||
|
|
||||||
|
Long selectProductByRelCode(@Param("relCode") String relCode);
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.glxp.api.dao.basic;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.glxp.api.entity.basic.BasicProductCategoryRel;
|
||||||
|
import com.glxp.api.req.basic.FilterUdiProductRequest;
|
||||||
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface BasicProductCategoryRelMapper extends BaseMapper<BasicProductCategoryRel> {
|
||||||
|
|
||||||
|
List<UdiRelevanceResponse> selectAll(FilterUdiProductRequest filterUdiProductRequest);
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.glxp.api.dao.inout;
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.entity.system.PlatformEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface PlatformDao {
|
||||||
|
|
||||||
|
int batchSave(List<PlatformEntity> list);
|
||||||
|
|
||||||
|
List<PlatformEntity> list( Map<String, Object> map);
|
||||||
|
|
||||||
|
int count(Map<String, Object> map);
|
||||||
|
|
||||||
|
PlatformEntity get(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据名称和访问地址查询平台信息
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param host
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PlatformEntity> selectByNameAndHost(@Param("name") String name, @Param("host") String host);
|
||||||
|
|
||||||
|
PlatformEntity selectById(@Param("platformId") String platformId);
|
||||||
|
|
||||||
|
int insert(PlatformEntity platformEntity);
|
||||||
|
|
||||||
|
List<PlatformEntity> selectList(@Param("id") String id, @Param("name") String name, @Param("host") String host);
|
||||||
|
|
||||||
|
int deleteById(@Param("id") String id);
|
||||||
|
|
||||||
|
void updateById(PlatformEntity platformEntity);
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.glxp.api.dao.inout;
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.entity.inout.UnitMaintainPlatformEntity;
|
||||||
|
import com.glxp.api.req.inout.PlatformLinkRequest;
|
||||||
|
import com.glxp.api.res.inout.PlatformLinkResponse;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface UnitMaintainPlatformDao {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询医院客户列表
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @param customerId
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PlatformLinkResponse> getLinkPlatformList(@Param("customerId") String customerId, @Param("key") String key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据客户ID查询关联数据
|
||||||
|
*
|
||||||
|
* @param customerId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<UnitMaintainPlatformEntity> selectByCustomerId(@Param("customerId") Long customerId);
|
||||||
|
|
||||||
|
void updateById(UnitMaintainPlatformEntity maintainPlatform);
|
||||||
|
|
||||||
|
void insert(UnitMaintainPlatformEntity unitMaintainPlatformEntity);
|
||||||
|
|
||||||
|
List<UnitMaintainPlatformEntity> selectList(PlatformLinkRequest platformLinkRequest);
|
||||||
|
|
||||||
|
UnitMaintainPlatformEntity findLinkData(@Param("customerId") long customerId, @Param("action") String action, @Param("unitId") String unitId);
|
||||||
|
|
||||||
|
void deleteById(String id);
|
||||||
|
|
||||||
|
Long selectCount(@Param("unitId") String unitId, @Param("action") String action);
|
||||||
|
|
||||||
|
List<PlatformLinkResponse> selectDelectList(@Param("platformId") String platformId);
|
||||||
|
|
||||||
|
PlatformLinkResponse selectByUnitld(@Param("unitld") String unitld);
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.glxp.api.entity.basic;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.util.Date;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物资类别表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "basic_product_category")
|
||||||
|
public class BasicProductCategory {
|
||||||
|
@TableId(value = "id", type = IdType.INPUT)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物资类别编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "code")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "parentCode")
|
||||||
|
private String parentCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物资类别名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "`name`")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@TableField(value = "remark")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "createTime")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "updateTime")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@TableField(value = "`createUser`")
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@TableField(value = "updateUser")
|
||||||
|
private String updateUser;
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.glxp.api.entity.basic;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName(value = "basic_product_category_rel")
|
||||||
|
public class BasicProductCategoryRel {
|
||||||
|
@TableId(value = "id", type = IdType.INPUT)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 院内编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "code")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 耗材字典ID主键
|
||||||
|
*/
|
||||||
|
@TableField(value = "relId")
|
||||||
|
private String relId;
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package com.glxp.api.entity.inout;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 医院客户表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UnitMaintainPlatformEntity {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 往来单位ID
|
||||||
|
*/
|
||||||
|
private String unitId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户ID
|
||||||
|
*/
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台ID
|
||||||
|
*/
|
||||||
|
private String platformId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 源单据类型
|
||||||
|
*/
|
||||||
|
private String sourceAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目标单据类型
|
||||||
|
*/
|
||||||
|
private String targetAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库码
|
||||||
|
*/
|
||||||
|
private String invCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分库码
|
||||||
|
*/
|
||||||
|
private String invSubCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用名称
|
||||||
|
*/
|
||||||
|
private String appid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 秘钥
|
||||||
|
*/
|
||||||
|
private String secretKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用ID
|
||||||
|
*/
|
||||||
|
private String apiKey;
|
||||||
|
|
||||||
|
|
||||||
|
//目标单据类型
|
||||||
|
private String targetName;
|
||||||
|
|
||||||
|
private String invName;
|
||||||
|
|
||||||
|
private String invSubName;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.glxp.api.req.basic;
|
||||||
|
|
||||||
|
import com.glxp.api.util.page.ListPageRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BasicProductTypeFilterRequest extends ListPageRequest {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private Integer type;
|
||||||
|
private String code;
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.glxp.api.req.basic;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BasicProductTypeRequest {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String code;
|
||||||
|
private String parentCode;
|
||||||
|
private String name;
|
||||||
|
private String remark;
|
||||||
|
List<String> ids;
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.glxp.api.req.basic;
|
||||||
|
|
||||||
|
import com.glxp.api.util.page.ListPageRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FilterUdiProductRequest extends ListPageRequest {
|
||||||
|
|
||||||
|
private String ylqxzcrbarmc;
|
||||||
|
private String cpmctymc;
|
||||||
|
private String ggxh;
|
||||||
|
private String udiCode;
|
||||||
|
private String unionCode;
|
||||||
|
private String zczbhhzbapzbh;
|
||||||
|
private String manufactory;
|
||||||
|
private String code;
|
||||||
|
private String parentCode;
|
||||||
|
private String nameCode;
|
||||||
|
private String thrPiId;
|
||||||
|
private String originUuid;
|
||||||
|
private Integer diType;
|
||||||
|
private List<Long> existid;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.glxp.api.req.inout;
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.util.page.ListPageRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 医院客户请求参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PlatformLinkRequest extends ListPageRequest {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String unitId;
|
||||||
|
|
||||||
|
private String corpName;
|
||||||
|
|
||||||
|
private String platformId;
|
||||||
|
|
||||||
|
private String platformUsername;
|
||||||
|
|
||||||
|
private String platformPassword;
|
||||||
|
|
||||||
|
private String appid;
|
||||||
|
|
||||||
|
private String apiKey;
|
||||||
|
|
||||||
|
private String secretKey;
|
||||||
|
|
||||||
|
private String sourceAction;
|
||||||
|
|
||||||
|
private String targetAction;
|
||||||
|
|
||||||
|
private String invCode;
|
||||||
|
|
||||||
|
private String invSubCode;
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
private String customerId;
|
||||||
|
|
||||||
|
private String invName;
|
||||||
|
private String invSubName;
|
||||||
|
private String targetName;
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.glxp.api.res.basic;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BasicProductCategoryTypeResponse {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String code;
|
||||||
|
private String parentCode;
|
||||||
|
private String name;
|
||||||
|
private String remark;
|
||||||
|
private Date createTime;
|
||||||
|
private Date updateTime;
|
||||||
|
private String createUser;
|
||||||
|
private String updateUser;
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.glxp.api.res.inout;
|
||||||
|
|
||||||
|
import com.glxp.api.entity.inout.*;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class IoUploadOrderResponse {
|
||||||
|
|
||||||
|
private List<IoOrderDetailCodeEntity> ioOrderDetailCodeEntityList;
|
||||||
|
private List<IoCodeTempEntity> ioCodeTempEntityList;
|
||||||
|
private IoOrderEntity ioOrderEntity;
|
||||||
|
private PlatformLinkResponse platformLinkRespons;
|
||||||
|
private List<IoOrderDetailBizEntity> ioOrderDetailBizEntityList;
|
||||||
|
private List<IoOrderDetailResultEntity> ioOrderDetailResultEntityList;
|
||||||
|
private List<IoOrderInvoiceEntity> ioOrderInvoiceEntityList;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.glxp.api.res.inout;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 往来单位关联自助平台数据实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PlatformLinkResponse {
|
||||||
|
|
||||||
|
//往来单位ID
|
||||||
|
private Long id;
|
||||||
|
//往来单位编码
|
||||||
|
private String unitId;
|
||||||
|
//往来单位名称
|
||||||
|
private String corpName;
|
||||||
|
//往来单位类型
|
||||||
|
private Integer corpType;
|
||||||
|
//拼音码
|
||||||
|
private String pinyinCode;
|
||||||
|
//自助平台名称
|
||||||
|
private String platformName;
|
||||||
|
//自助平台ID
|
||||||
|
private String platformId;
|
||||||
|
|
||||||
|
private String socurceName;
|
||||||
|
|
||||||
|
//本地单据类型
|
||||||
|
private String sourceAction;
|
||||||
|
private String sourceName;
|
||||||
|
//目标单据类型
|
||||||
|
private String targetAction;
|
||||||
|
private String targetName;
|
||||||
|
|
||||||
|
private String invCode;
|
||||||
|
private String invName;
|
||||||
|
private String invSubCode;
|
||||||
|
private String invSubName;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String host;
|
||||||
|
private String appid;
|
||||||
|
private String secretKey;
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.glxp.api.service.basic;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.glxp.api.dao.basic.BasicProductCategoryRelMapper;
|
||||||
|
import com.glxp.api.entity.basic.BasicProductCategoryRel;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class BasicProductCategoryRelService extends ServiceImpl<BasicProductCategoryRelMapper, BasicProductCategoryRel> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,191 @@
|
|||||||
|
package com.glxp.api.service.basic;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.dao.basic.BasicProductCategoryMapper;
|
||||||
|
import com.glxp.api.dao.basic.BasicProductCategoryRelMapper;
|
||||||
|
import com.glxp.api.entity.basic.BasicProductCategory;
|
||||||
|
import com.glxp.api.entity.basic.BasicProductCategoryRel;
|
||||||
|
import com.glxp.api.req.basic.BasicProductTypeFilterRequest;
|
||||||
|
import com.glxp.api.req.basic.BasicProductTypeRequest;
|
||||||
|
import com.glxp.api.req.basic.FilterUdiProductRequest;
|
||||||
|
import com.glxp.api.res.basic.BasicProductCategoryTypeResponse;
|
||||||
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
||||||
|
import com.glxp.api.service.auth.CustomerService;
|
||||||
|
import com.glxp.api.service.basic.impl.BasicProductCategoryService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class BasicProductCategoryServiceImpl implements BasicProductCategoryService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BasicProductCategoryMapper basicProductCategoryMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
CustomerService customerService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BasicProductCategoryRelMapper basicProductCategoryRelMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BasicProductCategoryTypeResponse> getTreeList() {
|
||||||
|
|
||||||
|
return basicProductCategoryMapper.getTreeList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BasicProductCategory selectBasicHospTypeEntity() {
|
||||||
|
QueryWrapper<BasicProductCategory> Wrapper = new QueryWrapper<>();
|
||||||
|
Wrapper.eq("code",10000);
|
||||||
|
return basicProductCategoryMapper.selectOne(Wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BasicProductCategory> getMenuList(BasicProductTypeFilterRequest basicProductTypeFilterRequest) {
|
||||||
|
QueryWrapper<BasicProductCategory> ew=new QueryWrapper<>();
|
||||||
|
ew.ne("code",10000);
|
||||||
|
if(basicProductTypeFilterRequest.getType()!=null && basicProductTypeFilterRequest.getType()==1 && StrUtil.isNotEmpty(basicProductTypeFilterRequest.getCode())){
|
||||||
|
List<BasicProductCategory> basicProductCategories = basicProductCategoryMapper.selectLowTypeAll(basicProductTypeFilterRequest.getCode());
|
||||||
|
List<Long> ids = basicProductCategories.stream().map(BasicProductCategory::getId).collect(Collectors.toList());
|
||||||
|
ew.notIn("id",ids);
|
||||||
|
}
|
||||||
|
List<BasicProductCategory> list = basicProductCategoryMapper.selectList(ew);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean checkName(BasicProductTypeRequest basicProductTypeRequest, Integer type) {
|
||||||
|
Long sum=null;
|
||||||
|
//1添加
|
||||||
|
if(type==1){
|
||||||
|
//查看名字是不是重复
|
||||||
|
QueryWrapper<BasicProductCategory> ew=new QueryWrapper<>();
|
||||||
|
ew.eq("name",basicProductTypeRequest.getName());
|
||||||
|
sum=basicProductCategoryMapper.selectCount(ew);
|
||||||
|
}else{
|
||||||
|
QueryWrapper<BasicProductCategory> ew=new QueryWrapper<>();
|
||||||
|
ew.eq("name",basicProductTypeRequest.getName());
|
||||||
|
ew.ne("id",basicProductTypeRequest.getId());
|
||||||
|
sum=basicProductCategoryMapper.selectCount(ew);
|
||||||
|
}
|
||||||
|
if(sum>0){
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateBasicHospType(BasicProductTypeRequest basicProductTypeRequest) {
|
||||||
|
boolean falg=true;
|
||||||
|
BasicProductCategory basicProductCategory = new BasicProductCategory();
|
||||||
|
basicProductCategory.setId(basicProductTypeRequest.getId());
|
||||||
|
basicProductCategory.setCreateTime(new Date());
|
||||||
|
basicProductCategory.setUpdateTime(new Date());
|
||||||
|
basicProductCategory.setName(basicProductTypeRequest.getName());
|
||||||
|
basicProductCategory.setParentCode(basicProductTypeRequest.getParentCode());
|
||||||
|
basicProductCategory.setRemark(basicProductTypeRequest.getRemark());
|
||||||
|
Long userId=customerService.getUserId();
|
||||||
|
basicProductCategory.setCreateUser(userId+"");
|
||||||
|
basicProductCategory.setUpdateUser(userId+"");
|
||||||
|
int i = basicProductCategoryMapper.updateById(basicProductCategory);
|
||||||
|
if(i == 0){
|
||||||
|
falg=false;
|
||||||
|
}
|
||||||
|
return falg;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean saveBasicHospType(BasicProductTypeRequest basicProductTypeRequest) {
|
||||||
|
boolean falg=true;
|
||||||
|
BasicProductCategory basicProductCategory = new BasicProductCategory();
|
||||||
|
basicProductCategory.setId(basicProductTypeRequest.getId());
|
||||||
|
basicProductCategory.setCreateTime(new Date());
|
||||||
|
basicProductCategory.setUpdateTime(new Date());
|
||||||
|
basicProductCategory.setName(basicProductTypeRequest.getName());
|
||||||
|
basicProductCategory.setParentCode(basicProductTypeRequest.getParentCode());
|
||||||
|
basicProductCategory.setRemark(basicProductTypeRequest.getRemark());
|
||||||
|
Long userId=customerService.getUserId();
|
||||||
|
basicProductCategory.setCreateUser(userId+"");
|
||||||
|
basicProductCategory.setUpdateUser(userId+"");
|
||||||
|
//获取数据库最大的code
|
||||||
|
QueryWrapper<BasicProductCategory> ew=new QueryWrapper<>();
|
||||||
|
ew.select("max(code) as code");
|
||||||
|
BasicProductCategory basicProductCategory1 = basicProductCategoryMapper.selectOne(ew);
|
||||||
|
basicProductCategory.setCode(Integer.valueOf(basicProductCategory1.getCode())+1+"");
|
||||||
|
basicProductCategory.setId(IdUtil.getSnowflakeNextId());
|
||||||
|
int insert = basicProductCategoryMapper.insert(basicProductCategory);
|
||||||
|
if(insert == 0){
|
||||||
|
falg=false;
|
||||||
|
}
|
||||||
|
return falg;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String delectBasicHospType(BasicProductTypeRequest basicProductTypeRequest) {
|
||||||
|
//查询是否有自己的子集
|
||||||
|
QueryWrapper<BasicProductCategory> ew=new QueryWrapper<>();
|
||||||
|
ew.eq("parentCode",basicProductTypeRequest.getCode());
|
||||||
|
Long count=basicProductCategoryMapper.selectCount(ew);
|
||||||
|
if(count>0){
|
||||||
|
return "请先删除该节点底下的数据!";
|
||||||
|
}
|
||||||
|
//查询是否有绑定产品
|
||||||
|
count = basicProductCategoryMapper.selectProductByRelCode(basicProductTypeRequest.getCode());
|
||||||
|
if(count >0){
|
||||||
|
return "该节点还存在产品,请先删除!";
|
||||||
|
}
|
||||||
|
basicProductCategoryMapper.deleteById(basicProductTypeRequest.getId());
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UdiRelevanceResponse> selectAll(FilterUdiProductRequest filterUdiProductRequest) {
|
||||||
|
if (filterUdiProductRequest == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
if (filterUdiProductRequest.getPage() != null) {
|
||||||
|
int offset = (filterUdiProductRequest.getPage() - 1) * filterUdiProductRequest.getLimit();
|
||||||
|
PageHelper.offsetPage(offset, filterUdiProductRequest.getLimit());
|
||||||
|
}
|
||||||
|
|
||||||
|
return basicProductCategoryRelMapper.selectAll(filterUdiProductRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean insertCateRel(BasicProductTypeRequest basicProductTypeRequest) {
|
||||||
|
BasicProductCategoryRel basicProductCategoryRel = new BasicProductCategoryRel();
|
||||||
|
int insert =0;
|
||||||
|
for (String id : basicProductTypeRequest.getIds()) {
|
||||||
|
basicProductCategoryRel.setRelId(id);
|
||||||
|
basicProductCategoryRel.setCode(basicProductTypeRequest.getCode());
|
||||||
|
insert = basicProductCategoryRelMapper.insert(basicProductCategoryRel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return insert>0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BasicProductCategory checkCode(String parentCode) {
|
||||||
|
return basicProductCategoryMapper.selectOne(new QueryWrapper<BasicProductCategory>().eq("code",parentCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleterelByid(Integer id) {
|
||||||
|
|
||||||
|
return basicProductCategoryRelMapper.deleteById(id)>0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.glxp.api.service.basic.impl;
|
||||||
|
|
||||||
|
import com.glxp.api.entity.basic.BasicProductCategory;
|
||||||
|
import com.glxp.api.req.basic.BasicProductTypeFilterRequest;
|
||||||
|
import com.glxp.api.req.basic.BasicProductTypeRequest;
|
||||||
|
import com.glxp.api.req.basic.FilterUdiProductRequest;
|
||||||
|
import com.glxp.api.res.basic.BasicProductCategoryTypeResponse;
|
||||||
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface BasicProductCategoryService {
|
||||||
|
|
||||||
|
List<BasicProductCategoryTypeResponse> getTreeList();
|
||||||
|
|
||||||
|
BasicProductCategory selectBasicHospTypeEntity();
|
||||||
|
|
||||||
|
List<BasicProductCategory> getMenuList(BasicProductTypeFilterRequest basicProductTypeFilterRequest);
|
||||||
|
|
||||||
|
Boolean checkName(BasicProductTypeRequest basicProductTypeRequest, Integer type);
|
||||||
|
|
||||||
|
boolean updateBasicHospType(BasicProductTypeRequest basicProductTypeRequest);
|
||||||
|
|
||||||
|
Boolean saveBasicHospType(BasicProductTypeRequest basicProductTypeRequest);
|
||||||
|
|
||||||
|
String delectBasicHospType(BasicProductTypeRequest basicProductTypeRequest);
|
||||||
|
|
||||||
|
|
||||||
|
List<UdiRelevanceResponse> selectAll(FilterUdiProductRequest filterUdiProductRequest);
|
||||||
|
|
||||||
|
boolean insertCateRel(BasicProductTypeRequest basicProductTypeRequest);
|
||||||
|
|
||||||
|
BasicProductCategory checkCode(String parentCode);
|
||||||
|
|
||||||
|
boolean deleterelByid(Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
|||||||
|
package com.glxp.api.service.inout;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.entity.inout.UnitMaintainPlatformEntity;
|
||||||
|
import com.glxp.api.entity.system.PlatformEntity;
|
||||||
|
import com.glxp.api.req.inout.PlatformLinkRequest;
|
||||||
|
import com.glxp.api.res.inout.PlatformLinkResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface PlatformService {
|
||||||
|
|
||||||
|
|
||||||
|
public int save(PlatformEntity platformEntity);
|
||||||
|
|
||||||
|
public int remove(String id);
|
||||||
|
|
||||||
|
public BaseResponse update(PlatformEntity platformEntity);
|
||||||
|
|
||||||
|
List<PlatformEntity> list(Map<String, Object> map);
|
||||||
|
|
||||||
|
int count(Map<String, Object> map);
|
||||||
|
|
||||||
|
PlatformEntity get(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询往来单位和自助平台关联数据
|
||||||
|
*
|
||||||
|
* @param platformLinkRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PlatformLinkResponse> getLinkPlatformList(PlatformLinkRequest platformLinkRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 往来单位和自助平台解绑
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
void unbindPlatform(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取自助平台单据类型
|
||||||
|
*
|
||||||
|
* @param platformId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse getTargetActions(String platformId, String invSubCode,String apiKey,String apiSecret);
|
||||||
|
|
||||||
|
|
||||||
|
//获取自助平台一级仓库
|
||||||
|
BaseResponse getTargetInv(String platformId,String apiKey,String apiSecret);
|
||||||
|
|
||||||
|
|
||||||
|
//获取自助平台一级仓库所属分库
|
||||||
|
BaseResponse getTargetSubInv(String platformId, String invCode,String apiKey,String apiSecret);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试自助平台连通性
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse testPlatformConnection(String host);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询自助平台信息
|
||||||
|
*
|
||||||
|
* @param platformId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PlatformEntity getPlatformById(String platformId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存医院客户关联关系
|
||||||
|
*
|
||||||
|
* @param unitMaintainPlatform
|
||||||
|
*/
|
||||||
|
void saveUnitPlatform(UnitMaintainPlatformEntity unitMaintainPlatform);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验关联数据
|
||||||
|
*
|
||||||
|
* @param platformLinkRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String verifyUnitMaintainPlatform(PlatformLinkRequest platformLinkRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询关联数据
|
||||||
|
*
|
||||||
|
* @param customerId
|
||||||
|
* @param action
|
||||||
|
* @param unitId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
UnitMaintainPlatformEntity findLinkData(long customerId, String action, String unitId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取客户关联详情
|
||||||
|
* @param platformId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PlatformLinkResponse> selectDelectList(PlatformLinkRequest platformLinkRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传单据到自助
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse uploadOrder(String orderId) throws JsonProcessingException;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,436 @@
|
|||||||
|
package com.glxp.api.service.inout.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
|
||||||
|
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.dao.inout.*;
|
||||||
|
import com.glxp.api.entity.inout.*;
|
||||||
|
import com.glxp.api.entity.system.PlatformEntity;
|
||||||
|
import com.glxp.api.idc.service.FileService;
|
||||||
|
import com.glxp.api.req.inout.PlatformLinkRequest;
|
||||||
|
import com.glxp.api.res.inout.IoUploadOrderResponse;
|
||||||
|
import com.glxp.api.res.inout.PlatformLinkResponse;
|
||||||
|
import com.glxp.api.service.inout.*;
|
||||||
|
import com.glxp.api.util.OkHttpCli;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import okhttp3.*;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.tools.ant.util.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class PlatformServiceImpl implements PlatformService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PlatformDao platformDao;
|
||||||
|
@Resource
|
||||||
|
private UnitMaintainPlatformDao unitMaintainPlatformDao;
|
||||||
|
@Resource
|
||||||
|
private OkHttpCli okHttpCli;
|
||||||
|
@Resource
|
||||||
|
IoOrderService ioOrderService;
|
||||||
|
@Resource
|
||||||
|
IoOrderDetailCodeService ioOrderDetailCodeService;
|
||||||
|
@Resource
|
||||||
|
IoCodeTempService ioCodeTempService;
|
||||||
|
@Resource
|
||||||
|
IoOrderDetailBizDao ioOrderDetailBizDao;
|
||||||
|
@Resource
|
||||||
|
IoOrderDetailResultDao ioOrderDetailResultDao;
|
||||||
|
@Resource
|
||||||
|
IoOrderInvoiceMapper ioOrderInvoiceMapper;
|
||||||
|
@Value("${file_path}")
|
||||||
|
private String filePath;
|
||||||
|
@Value("${API_KEY}")
|
||||||
|
private String apiKey;
|
||||||
|
@Value("${API_SECRET}")
|
||||||
|
private String apiSecret;
|
||||||
|
|
||||||
|
public int save(PlatformEntity platformEntity) {
|
||||||
|
if (StringUtils.isEmpty(platformEntity.getId())) {
|
||||||
|
platformEntity.setId(String.valueOf(IdUtil.getSnowflake().nextId()));
|
||||||
|
}
|
||||||
|
return platformDao.insert(platformEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int remove(String id) {
|
||||||
|
return platformDao.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseResponse update(PlatformEntity platformEntity) {
|
||||||
|
if (StrUtil.isBlank(platformEntity.getId())) {
|
||||||
|
if (!verifyPlatformExist(platformEntity)) {
|
||||||
|
save(platformEntity);
|
||||||
|
return ResultVOUtils.success("添加成功");
|
||||||
|
} else {
|
||||||
|
return ResultVOUtils.error(500, "已存在相同数据");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
platformDao.updateById(platformEntity);
|
||||||
|
return ResultVOUtils.success("更新成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean verifyPlatformExist(PlatformEntity platformEntity) {
|
||||||
|
//校验名称和地址是否重复
|
||||||
|
List<PlatformEntity> list = platformDao.selectByNameAndHost(platformEntity.getName(), platformEntity.getHost());
|
||||||
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PlatformEntity> list(Map<String, Object> map) {
|
||||||
|
if (map.get("page") != null && map.get("limit") != null) {
|
||||||
|
Integer page = Integer.valueOf(String.valueOf(map.get("page")));
|
||||||
|
Integer limit = Integer.valueOf(String.valueOf(map.get("limit")));
|
||||||
|
PageHelper.offsetPage((page - 1) * limit, limit);
|
||||||
|
}
|
||||||
|
List<PlatformEntity> list = platformDao.selectList(String.valueOf(map.get("id")), String.valueOf(map.get("name")), String.valueOf(map.get("host")));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int count(Map<String, Object> map) {
|
||||||
|
return platformDao.count(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlatformEntity get(String id) {
|
||||||
|
return platformDao.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询往来单位和自助平台关联数据
|
||||||
|
*
|
||||||
|
* @param platformLinkRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<PlatformLinkResponse> getLinkPlatformList(PlatformLinkRequest platformLinkRequest) {
|
||||||
|
if (null == platformLinkRequest) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
if (null != platformLinkRequest.getPage() && null != platformLinkRequest.getLimit()) {
|
||||||
|
PageHelper.offsetPage((platformLinkRequest.getPage() - 1) * platformLinkRequest.getLimit(), platformLinkRequest.getLimit());
|
||||||
|
}
|
||||||
|
return unitMaintainPlatformDao.getLinkPlatformList(platformLinkRequest.getCustomerId(), platformLinkRequest.getKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 往来单位和自助平台解绑
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public void unbindPlatform(String id) {
|
||||||
|
unitMaintainPlatformDao.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取自助平台单据类型
|
||||||
|
*
|
||||||
|
* @param platformId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BaseResponse getTargetActions(String platformId, String invSubCode, String apiKey, String apiSecret) {
|
||||||
|
PlatformEntity platformEntity = platformDao.get(platformId);
|
||||||
|
if (null == platformEntity) {
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
String host = platformEntity.getHost();
|
||||||
|
Map<String, String> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("invSubCode", invSubCode);
|
||||||
|
String resp = okHttpCli.doGet(host + "/udiwms/bussinessType/udimsFilter", paramMap, buildHeader(apiKey, apiSecret));
|
||||||
|
if (StrUtil.isNotBlank(resp) && resp.contains("20000")) {
|
||||||
|
return JSON.parseObject(resp, BaseResponse.class);
|
||||||
|
} else {
|
||||||
|
log.error("获取自助平台单据类型异常");
|
||||||
|
return ResultVOUtils.error(500, "获取自助平台接口异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取自助平台一级仓库
|
||||||
|
public BaseResponse getTargetInv(String platformId, String apiKey, String apiSecret) {
|
||||||
|
PlatformEntity platformEntity = platformDao.get(platformId);
|
||||||
|
if (null == platformEntity) {
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
String host = platformEntity.getHost();
|
||||||
|
String url = host + "/spms/inv/warehouse/filterInv/forUdims";
|
||||||
|
log.info("拉取自助平台仓库数据:" + url);
|
||||||
|
String resp = okHttpCli.doGet(url, buildHeader(apiKey, apiSecret));
|
||||||
|
log.info("拉取结果:" + resp);
|
||||||
|
if (StrUtil.isNotBlank(resp) && resp.contains("20000")) {
|
||||||
|
try {
|
||||||
|
return JSON.parseObject(resp, BaseResponse.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("格式化自助平台仓库信息异常", e);
|
||||||
|
return ResultVOUtils.error(500, "调用自助平台接口异常");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("获取自助平台仓库失败");
|
||||||
|
return ResultVOUtils.error(500, "调用自助平台接口异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取自助平台一级仓库所属分库
|
||||||
|
public BaseResponse getTargetSubInv(String platformId, String invCode, String apiKey, String apiSecret) {
|
||||||
|
PlatformEntity platformEntity = platformDao.get(platformId);
|
||||||
|
if (null == platformEntity) {
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
String host = platformEntity.getHost();
|
||||||
|
Map<String, String> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("invCode", invCode);
|
||||||
|
String resp = okHttpCli.doGet(host + "/spms/sub/inv/warehouse/getSubInvForUdims", paramMap, buildHeader(apiKey, apiSecret));
|
||||||
|
if (StrUtil.isNotBlank(resp) && resp.contains("20000")) {
|
||||||
|
return JSON.parseObject(resp, BaseResponse.class);
|
||||||
|
} else {
|
||||||
|
log.error("获取自助平台分库失败");
|
||||||
|
return ResultVOUtils.error(500, "获取自助平台接口异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试自助平台连通性
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BaseResponse testPlatformConnection(String host) {
|
||||||
|
String testUrl = host + "/udiwms/auth/device/connect";
|
||||||
|
String response = HttpUtil.get(testUrl);
|
||||||
|
if (StrUtil.isNotBlank(response)) {
|
||||||
|
try {
|
||||||
|
BaseResponse result = JSONUtil.toBean(response, BaseResponse.class);
|
||||||
|
if (result.getCode() == 20000) {
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询自助平台信息
|
||||||
|
*
|
||||||
|
* @param platformId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public PlatformEntity getPlatformById(String platformId) {
|
||||||
|
return platformDao.selectById(platformId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存医院客户关联关系
|
||||||
|
*
|
||||||
|
* @param unitMaintainPlatformEntity
|
||||||
|
*/
|
||||||
|
public void saveUnitPlatform(UnitMaintainPlatformEntity unitMaintainPlatformEntity) {
|
||||||
|
if (null != unitMaintainPlatformEntity.getId()) {
|
||||||
|
unitMaintainPlatformDao.updateById(unitMaintainPlatformEntity);
|
||||||
|
} else {
|
||||||
|
unitMaintainPlatformDao.insert(unitMaintainPlatformEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新当前客户关联数据的所有key
|
||||||
|
List<UnitMaintainPlatformEntity> list = unitMaintainPlatformDao.selectByCustomerId(unitMaintainPlatformEntity.getCustomerId());
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
for (UnitMaintainPlatformEntity maintainPlatform : list) {
|
||||||
|
maintainPlatform.setAppid(unitMaintainPlatformEntity.getAppid());
|
||||||
|
maintainPlatform.setApiKey(unitMaintainPlatformEntity.getApiKey());
|
||||||
|
maintainPlatform.setSecretKey(unitMaintainPlatformEntity.getSecretKey());
|
||||||
|
unitMaintainPlatformDao.updateById(maintainPlatform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String verifyUnitMaintainPlatform(PlatformLinkRequest platformLinkRequest) {
|
||||||
|
List<UnitMaintainPlatformEntity> list = unitMaintainPlatformDao.selectList(platformLinkRequest);
|
||||||
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
return "success";
|
||||||
|
} else {
|
||||||
|
for (UnitMaintainPlatformEntity maintainPlatform : list) {
|
||||||
|
if (maintainPlatform.getId().equals(platformLinkRequest.getId())) {
|
||||||
|
return "success";
|
||||||
|
} else {
|
||||||
|
return "重复添加";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "重复添加";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询关联数据
|
||||||
|
*
|
||||||
|
* @param customerId
|
||||||
|
* @param action
|
||||||
|
* @param unitId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public UnitMaintainPlatformEntity findLinkData(long customerId, String action, String unitId) {
|
||||||
|
return unitMaintainPlatformDao.findLinkData(customerId, action, unitId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PlatformLinkResponse> selectDelectList(PlatformLinkRequest platformLinkRequest) {
|
||||||
|
if (null == platformLinkRequest) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
if (null != platformLinkRequest.getPage() && null != platformLinkRequest.getLimit()) {
|
||||||
|
PageHelper.offsetPage((platformLinkRequest.getPage() - 1) * platformLinkRequest.getLimit(), platformLinkRequest.getLimit());
|
||||||
|
}
|
||||||
|
return unitMaintainPlatformDao.selectDelectList(platformLinkRequest.getPlatformId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse uploadOrder(String orderId) throws JsonProcessingException {
|
||||||
|
|
||||||
|
//查询单据信息
|
||||||
|
IoOrderEntity ioOrderEntity = ioOrderService.findByBillNo(orderId);
|
||||||
|
if (ioOrderEntity == null) {
|
||||||
|
return ResultVOUtils.error(999, "该单据不存在!");
|
||||||
|
}
|
||||||
|
//查询客户关联信息
|
||||||
|
PlatformLinkResponse platformLinkRespons = unitMaintainPlatformDao.selectByUnitld(ioOrderEntity.getFromCorp());
|
||||||
|
if(platformLinkRespons == null){
|
||||||
|
return ResultVOUtils.error(999, "该单没有设置补单条件!");
|
||||||
|
}
|
||||||
|
//获取单据详情
|
||||||
|
List<IoOrderDetailCodeEntity> ioOrderDetailCodeEntityList=ioOrderDetailCodeService.findByOrderId(orderId);
|
||||||
|
List<IoCodeTempEntity> ioCodeTempEntityList = ioCodeTempService.findByOrderId(orderId);
|
||||||
|
for (IoCodeTempEntity ioCodeTempEntity : ioCodeTempEntityList) {
|
||||||
|
Map<String, String> jsonMap = new HashMap<>();
|
||||||
|
jsonMap.put("code", ioCodeTempEntity.getCode());
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
String json = mapper.writeValueAsString(jsonMap);
|
||||||
|
ioCodeTempEntity.setCode(json);
|
||||||
|
}
|
||||||
|
//获取业务单
|
||||||
|
QueryWrapper<IoOrderDetailBizEntity> ew=new QueryWrapper<>();
|
||||||
|
ew.eq("orderIdFk",orderId);
|
||||||
|
List<IoOrderDetailBizEntity> ioOrderDetailBizEntityList=ioOrderDetailBizDao.selectList(ew);
|
||||||
|
|
||||||
|
//获取结果单
|
||||||
|
QueryWrapper<IoOrderDetailResultEntity> ew1=new QueryWrapper<>();
|
||||||
|
ew1.eq("orderIdFk",orderId);
|
||||||
|
List<IoOrderDetailResultEntity> ioOrderDetailResultEntityList=ioOrderDetailResultDao.selectList(ew1);
|
||||||
|
|
||||||
|
//获取发票
|
||||||
|
QueryWrapper<IoOrderInvoiceEntity> ew2=new QueryWrapper<>();
|
||||||
|
ew2.eq("orderIdFk",orderId);
|
||||||
|
List<IoOrderInvoiceEntity> ioOrderInvoiceEntityList=ioOrderInvoiceMapper.selectList(ew2);
|
||||||
|
ArrayList<String> list=new ArrayList<>();
|
||||||
|
for (IoOrderInvoiceEntity ioOrderInvoiceEntity : ioOrderInvoiceEntityList) {
|
||||||
|
if(StrUtil.isNotBlank(ioOrderInvoiceEntity.getLicenseUrl())){
|
||||||
|
list.add(filePath + "/register/image2/" + ioOrderInvoiceEntity.getLicenseUrl());
|
||||||
|
ioOrderInvoiceEntity.setLicenseUrl("as" + ioOrderInvoiceEntity.getLicenseUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
relayFile(list,platformLinkRespons.getHost());
|
||||||
|
|
||||||
|
//组装数据
|
||||||
|
String host = platformLinkRespons.getHost();
|
||||||
|
IoUploadOrderResponse ioUploadOrderResponse=new IoUploadOrderResponse();
|
||||||
|
ioUploadOrderResponse.setIoOrderEntity(ioOrderEntity);
|
||||||
|
ioUploadOrderResponse.setPlatformLinkRespons(platformLinkRespons);
|
||||||
|
ioUploadOrderResponse.setIoCodeTempEntityList(ioCodeTempEntityList);
|
||||||
|
ioUploadOrderResponse.setIoOrderDetailCodeEntityList(ioOrderDetailCodeEntityList);
|
||||||
|
ioUploadOrderResponse.setIoOrderDetailResultEntityList(ioOrderDetailResultEntityList);
|
||||||
|
ioUploadOrderResponse.setIoOrderDetailBizEntityList(ioOrderDetailBizEntityList);
|
||||||
|
ioUploadOrderResponse.setIoOrderInvoiceEntityList(ioOrderInvoiceEntityList);
|
||||||
|
String resp = okHttpCli.doPostJson(host + "/spms/sub/inv/warehouse/addOrder",
|
||||||
|
JSON.toJSONString(ioUploadOrderResponse), buildHeader(platformLinkRespons.getAppid(), platformLinkRespons.getSecretKey()));
|
||||||
|
//回调结果 返回信息
|
||||||
|
if (StrUtil.isNotBlank(resp) && resp.contains("20000")) {
|
||||||
|
return JSON.parseObject(resp, BaseResponse.class);
|
||||||
|
} else {
|
||||||
|
log.error("获取自助平台分库失败");
|
||||||
|
return ResultVOUtils.error(500, "获取自助平台接口异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] buildHeader(String apiKey, String apiSecret) {
|
||||||
|
String[] headers = {"api_key", apiKey, "secret_key", apiSecret};
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*转发图片*/
|
||||||
|
private String relayFile(ArrayList<String> files, String ip) {
|
||||||
|
String host = ip;
|
||||||
|
String result = "";
|
||||||
|
|
||||||
|
if (!StringUtils.isEmpty(host)) {
|
||||||
|
host += "/udiwms/file/uploadFile";
|
||||||
|
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||||
|
.connectTimeout(30, TimeUnit.SECONDS)//设置连接超时时间
|
||||||
|
.readTimeout(30, TimeUnit.SECONDS)//设置读取超时时间
|
||||||
|
.build();
|
||||||
|
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||||
|
|
||||||
|
MultipartBody.Builder builder = new MultipartBody.Builder();
|
||||||
|
builder.setType(MultipartBody.FORM);
|
||||||
|
String fileType = "application/octet-stream";
|
||||||
|
if (files != null && files.size() > 0) {
|
||||||
|
for (int i = 0; i < files.size(); i++) {
|
||||||
|
if (!StringUtils.isEmpty(files.get(i))) {
|
||||||
|
File file = new File(files.get(i));
|
||||||
|
String fileName = files.get(i);
|
||||||
|
fileName = "as"+ fileName.substring(fileName.lastIndexOf("/")+1);
|
||||||
|
builder.addFormDataPart("files", fileName,
|
||||||
|
RequestBody.create(MediaType.parse(fileType), file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RequestBody body = builder.build();
|
||||||
|
|
||||||
|
Request req = new Request.Builder()
|
||||||
|
.url(host)
|
||||||
|
.method("POST", body)
|
||||||
|
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
.addHeader("format", "json")
|
||||||
|
.addHeader("apiKey", apiKey)
|
||||||
|
.addHeader("secretKey", apiSecret)
|
||||||
|
.addHeader("timestamp", DateUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"))
|
||||||
|
.addHeader("Access-Control-Allow-Headers", "Authorization, Origin, X-Requested-With, Content-Type, Accept")
|
||||||
|
.build();
|
||||||
|
try {
|
||||||
|
Response response = client.newCall(req).execute();
|
||||||
|
result = response.body().string();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
package com.glxp.api.util;
|
||||||
|
|
||||||
|
import org.apache.commons.fileupload.FileItem;
|
||||||
|
import org.apache.commons.fileupload.FileItemFactory;
|
||||||
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
public class MultipartFileTest {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(MultipartFileTest.class);
|
||||||
|
|
||||||
|
private MultipartFileTest() { }
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// 本地文件转为MultipartFile类型
|
||||||
|
String fileName="D:\\1s\\a6294b6b58de15136bb827dd1efdc76.jpg";
|
||||||
|
fileName = fileName.substring(fileName.lastIndexOf("/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MultipartFile getMultipartFile(InputStream inputStream, String fileName) {
|
||||||
|
FileItem fileItem = createFileItem(inputStream, fileName);
|
||||||
|
return new CommonsMultipartFile(fileItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static MultipartFile[] getMultipartFiles(InputStream[] inputStream, String fileName) {
|
||||||
|
// 多文件转换
|
||||||
|
int length = inputStream.length;
|
||||||
|
MultipartFile[] multipartFiles = new MultipartFile[length];
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
FileItem fileItem = createFileItem(inputStream[i], fileName);
|
||||||
|
multipartFiles[i] = new CommonsMultipartFile(fileItem);
|
||||||
|
}
|
||||||
|
return multipartFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static FileItem createFileItem(InputStream inputStream, String fileName) {
|
||||||
|
FileItemFactory factory = new DiskFileItemFactory(16, null);
|
||||||
|
FileItem fileItem = factory.createItem("file", MediaType.MULTIPART_FORM_DATA_VALUE, true, fileName);
|
||||||
|
int read = 0;
|
||||||
|
OutputStream os = null;
|
||||||
|
byte[] buffer = new byte[10 * 1024 * 1024];
|
||||||
|
try {
|
||||||
|
os = fileItem.getOutputStream();
|
||||||
|
while ((read = inputStream.read(buffer, 0, 4096)) != -1) {
|
||||||
|
os.write(buffer, 0, read);
|
||||||
|
}
|
||||||
|
inputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("os write exception", e);
|
||||||
|
throw new IllegalArgumentException("文件流输出失败");
|
||||||
|
} finally {
|
||||||
|
if (os != null) {
|
||||||
|
try {
|
||||||
|
os.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("stream os close exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inputStream != null) {
|
||||||
|
try {
|
||||||
|
inputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("stream inputStream close exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fileItem;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
<?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.basic.BasicProductCategoryMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.glxp.api.entity.basic.BasicProductCategory">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table wms_cs.basic_product_category-->
|
||||||
|
<id column="id" jdbcType="BIGINT" property="id" />
|
||||||
|
<result column="code" jdbcType="VARCHAR" property="code" />
|
||||||
|
<result column="parentCode" jdbcType="VARCHAR" property="parentCode" />
|
||||||
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||||
|
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||||
|
<result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="createUser" jdbcType="VARCHAR" property="createUser" />
|
||||||
|
<result column="updateUser" jdbcType="VARCHAR" property="updateUser" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
id, code, parentCode, `name`, remark, createTime, updateTime, `createUser`, updateUser
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="getTreeList" resultType="com.glxp.api.res.basic.BasicProductCategoryTypeResponse">
|
||||||
|
SELECT id, code, name as label, parentCode
|
||||||
|
FROM basic_product_category
|
||||||
|
ORDER BY id DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectLowTypeAll" parameterType="java.lang.String" resultType="com.glxp.api.entity.basic.BasicProductCategory">
|
||||||
|
WITH recursive table_a AS (
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
basic_product_category ta
|
||||||
|
WHERE
|
||||||
|
code = #{code}
|
||||||
|
UNION ALL
|
||||||
|
SELECT
|
||||||
|
tb.*
|
||||||
|
FROM
|
||||||
|
basic_product_category tb
|
||||||
|
INNER JOIN table_a ON table_a.CODE = tb.parentCode
|
||||||
|
) SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
table_a
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectProductByRelCode" resultType="Long">
|
||||||
|
select count(*)
|
||||||
|
from basic_udirel
|
||||||
|
where basic_udirel.relCode = #{relCode}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,84 @@
|
|||||||
|
<?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.basic.BasicProductCategoryRelMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.glxp.api.entity.basic.BasicProductCategoryRel">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table wms_cs.basic_product_category_rel-->
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
|
<result column="code" jdbcType="VARCHAR" property="code" />
|
||||||
|
<result column="relId" jdbcType="VARCHAR" property="relId" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
id, code, relId
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectAll" parameterType="com.glxp.api.req.basic.FilterUdiProductRequest"
|
||||||
|
resultType="com.glxp.api.res.basic.UdiRelevanceResponse">
|
||||||
|
SELECT
|
||||||
|
basic_products.nameCode,
|
||||||
|
basic_products.cpmctymc,
|
||||||
|
basic_products.ggxh,
|
||||||
|
basic_products.zczbhhzbapzbh,
|
||||||
|
basic_products.ylqxzcrbarmc,
|
||||||
|
basic_products.manufactory,
|
||||||
|
basic_products.qxlb,
|
||||||
|
basic_udirel.id,
|
||||||
|
basic_product_category_rel.id as bpcrid
|
||||||
|
FROM basic_product_category_rel
|
||||||
|
INNER JOIN basic_udirel ON basic_product_category_rel.relId=basic_udirel.id
|
||||||
|
INNER JOIN basic_products on basic_udirel.uuid=basic_products.uuid
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<if test="thrPiId != '' and thrPiId != null">
|
||||||
|
and (basic_udirel.thirdId LIKE concat('%', #{thrPiId}, '%')
|
||||||
|
or basic_udirel.thirdId1 LIKE concat('%', #{thrPiId}, '%')
|
||||||
|
or basic_udirel.thirdId2 LIKE concat('%', #{thrPiId}, '%')
|
||||||
|
or basic_udirel.thirdId3 LIKE concat('%', #{thrPiId}, '%')
|
||||||
|
or basic_udirel.thirdId4 LIKE concat('%', #{thrPiId}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="code != '' and code != null">
|
||||||
|
AND basic_product_category_rel.code= #{code}
|
||||||
|
</if>
|
||||||
|
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
|
||||||
|
AND basic_products.ylqxzcrbarmc LIKE concat('%', #{ylqxzcrbarmc}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="unionCode != '' and unionCode != null">
|
||||||
|
and (
|
||||||
|
basic_products.nameCode LIKE concat('%', #{unionCode}, '%')
|
||||||
|
or basic_products.ybbm LIKE concat('%', #{unionCode}, '%')
|
||||||
|
or basic_products.sptm LIKE concat('%', #{unionCode}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="nameCode != '' and nameCode != null">
|
||||||
|
AND basic_products.nameCode LIKE concat(#{nameCode}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="cpmctymc != '' and cpmctymc != null">
|
||||||
|
AND basic_products.cpmctymc LIKE concat('%', #{cpmctymc}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="ggxh != '' and ggxh != null">
|
||||||
|
AND basic_products.ggxh LIKE concat('%', #{ggxh}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="manufactory != null and manufactory != ''">
|
||||||
|
and basic_products.manufactory LIKE concat('%', #{manufactory}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
|
||||||
|
AND basic_products.zczbhhzbapzbh LIKE concat(#{zczbhhzbapzbh}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="originUuid != null and originUuid != ''">
|
||||||
|
and basic_products.originUuid = #{originUuid}
|
||||||
|
</if>
|
||||||
|
<if test="existid != null and existid.size() != 0">
|
||||||
|
and basic_udirel.id not in
|
||||||
|
<foreach collection="existid" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
</where>
|
||||||
|
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,106 @@
|
|||||||
|
<?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.inout.PlatformDao">
|
||||||
|
<insert id="batchSave" parameterType="java.util.List">
|
||||||
|
replace into auth_platform
|
||||||
|
(id, name, host)
|
||||||
|
values
|
||||||
|
<foreach item="item" index="index" collection="list"
|
||||||
|
separator=",">
|
||||||
|
(#{item.id}, #{item.name,jdbcType=VARCHAR}, #{item.host,jdbcType=VARCHAR})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="get" resultType="com.glxp.api.entity.system.PlatformEntity">
|
||||||
|
select *
|
||||||
|
from auth_platform
|
||||||
|
where id = #{value}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="list" resultType="com.glxp.api.entity.system.PlatformEntity">
|
||||||
|
select *
|
||||||
|
from auth_platform
|
||||||
|
<where>
|
||||||
|
<if test="id != null and id != ''">
|
||||||
|
and id = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
and instr(name, #{name})
|
||||||
|
</if>
|
||||||
|
<if test="host != null and host != ''">
|
||||||
|
and instr(host, #{host})
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by id desc
|
||||||
|
</select>
|
||||||
|
<select id="count" resultType="int">
|
||||||
|
select count(*)
|
||||||
|
from auth_platform
|
||||||
|
<where>
|
||||||
|
<if test="id != null and id != ''">
|
||||||
|
and id = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
and instr(name, #{name})
|
||||||
|
</if>
|
||||||
|
<if test="host != null and host != ''">
|
||||||
|
and instr(host, #{host})
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByNameAndHost" resultType="com.glxp.api.entity.system.PlatformEntity">
|
||||||
|
select *
|
||||||
|
from auth_platform
|
||||||
|
where name = #{name}
|
||||||
|
and host = #{host}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectById" resultType="com.glxp.api.entity.system.PlatformEntity">
|
||||||
|
select *
|
||||||
|
from auth_platform
|
||||||
|
where id = #{platformId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insert">
|
||||||
|
insert into auth_platform(id, name, host)
|
||||||
|
VALUES (#{id}, #{name}, #{host})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="selectList" resultType="com.glxp.api.entity.system.PlatformEntity">
|
||||||
|
select *
|
||||||
|
from auth_platform
|
||||||
|
<where>
|
||||||
|
<if test="id != null and id != '' and id != 'null'">
|
||||||
|
AND id = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="name != null and name != '' and name != 'null'">
|
||||||
|
AND name like concat('%', #{name}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="host != null and host != '' and host != 'null'">
|
||||||
|
AND host like concat('%', #{host}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteById">
|
||||||
|
delete
|
||||||
|
from auth_platform
|
||||||
|
where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<update id="updateById">
|
||||||
|
update auth_platform
|
||||||
|
<trim prefix="set" suffixOverrides=",">
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
name = #{name},
|
||||||
|
</if>
|
||||||
|
<if test="host != null and host != ''">
|
||||||
|
host = #{host},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
@ -0,0 +1,188 @@
|
|||||||
|
<?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.inout.UnitMaintainPlatformDao">
|
||||||
|
<select id="getLinkPlatformList" resultType="com.glxp.api.res.inout.PlatformLinkResponse">
|
||||||
|
SELECT a1.id as platformId,
|
||||||
|
a1.`name`,
|
||||||
|
a1.`host`,
|
||||||
|
iu.id,
|
||||||
|
iu.unitId,
|
||||||
|
iu.customerId,
|
||||||
|
iu.invCode,
|
||||||
|
iu.targetAction,
|
||||||
|
iu.sourceAction,
|
||||||
|
iu.invSubCode,
|
||||||
|
b1.`name` as corpName
|
||||||
|
FROM auth_platform a1
|
||||||
|
LEFT JOIN io_unit_maintain_platform iu ON a1.id = iu.platformId
|
||||||
|
LEFT JOIN basic_corp b1 ON b1.erpId = iu.unitId
|
||||||
|
<where>
|
||||||
|
<if test="key != null and key != ''">
|
||||||
|
AND a1.`name` = #{key}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY a1.id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByCustomerId" resultType="com.glxp.api.entity.inout.UnitMaintainPlatformEntity">
|
||||||
|
select *
|
||||||
|
from io_unit_maintain_platform
|
||||||
|
where customerId = #{customerId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateById" parameterType="com.glxp.api.entity.inout.UnitMaintainPlatformEntity">
|
||||||
|
update io_unit_maintain_platform
|
||||||
|
<trim prefix="set" suffixOverrides=",">
|
||||||
|
<if test="unitId != null and unitId != ''">
|
||||||
|
unitId = #{unitId},
|
||||||
|
</if>
|
||||||
|
<if test="customerId != null">
|
||||||
|
customerId = #{customerId},
|
||||||
|
</if>
|
||||||
|
<if test="platformId != null and platformId != ''">
|
||||||
|
platformId = #{platformId},
|
||||||
|
</if>
|
||||||
|
<if test="sourceAction != null and sourceAction != ''">
|
||||||
|
sourceAction = #{sourceAction},
|
||||||
|
</if>
|
||||||
|
<if test="targetAction != null and targetAction != ''">
|
||||||
|
targetAction = #{targetAction},
|
||||||
|
</if>
|
||||||
|
<if test="invCode != null and invCode != ''">
|
||||||
|
invCode = #{invCode},
|
||||||
|
</if>
|
||||||
|
<if test="invSubCode != null and invSubCode != ''">
|
||||||
|
invSubCode = #{invSubCode},
|
||||||
|
</if>
|
||||||
|
<if test="appid != null and appid != ''">
|
||||||
|
appid = #{appid},
|
||||||
|
</if>
|
||||||
|
<if test="apiKey != null and apiKey != ''">
|
||||||
|
apiKey = #{apiKey},
|
||||||
|
</if>
|
||||||
|
<if test="secretKey != null and secretKey != ''">
|
||||||
|
secretKey = #{secretKey},
|
||||||
|
</if>
|
||||||
|
<if test="invName != null and invName != ''">
|
||||||
|
invName = #{invName},
|
||||||
|
</if>
|
||||||
|
<if test="invSubName != null and invSubName != ''">
|
||||||
|
invSubName = #{invSubName},
|
||||||
|
</if>
|
||||||
|
<if test="targetName != null and targetName != ''">
|
||||||
|
targetName = #{targetName}
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id"
|
||||||
|
parameterType="com.glxp.api.entity.inout.UnitMaintainPlatformEntity">
|
||||||
|
insert into io_unit_maintain_platform (unitId, customerId, platformId, sourceAction, targetAction, invCode,
|
||||||
|
invSubCode, appid, apiKey, secretKey, invName, invSubName, targetName)
|
||||||
|
VALUES (#{unitId}, #{customerId}, #{platformId}, #{sourceAction}, #{targetAction}, #{invCode}, #{invSubCode},
|
||||||
|
#{appid}, #{apiKey}, #{secretKey}, #{invName}, #{invSubName}, #{targetName})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="selectList" resultType="com.glxp.api.entity.inout.UnitMaintainPlatformEntity">
|
||||||
|
select *
|
||||||
|
from io_unit_maintain_platform
|
||||||
|
<where>
|
||||||
|
<if test="unitId != null and unitId != ''">
|
||||||
|
AND unitId = #{unitId}
|
||||||
|
</if>
|
||||||
|
<if test="customerId != null and customerId != ''">
|
||||||
|
AND customerId = #{customerId}
|
||||||
|
</if>
|
||||||
|
<if test="platformId != null and platformId != ''">
|
||||||
|
AND platformId = #{platformId}
|
||||||
|
</if>
|
||||||
|
<if test="sourceAction != null and sourceAction != ''">
|
||||||
|
AND sourceAction = #{sourceAction}
|
||||||
|
</if>
|
||||||
|
<if test="targetAction != null and targetAction != ''">
|
||||||
|
AND targetAction = #{targetAction}
|
||||||
|
</if>
|
||||||
|
<if test="invSubCode != null and invSubCode != ''">
|
||||||
|
AND invCode = #{invCode}
|
||||||
|
</if>
|
||||||
|
<if test="invSubCode != null and invSubCode != ''">
|
||||||
|
AND invSubCode = #{invSubCode}
|
||||||
|
</if>
|
||||||
|
<if test="appid != null and appid != ''">
|
||||||
|
AND appid = #{appid}
|
||||||
|
</if>
|
||||||
|
<if test="apiKey != null and apiKey != ''">
|
||||||
|
AND apiKey = #{apiKey}
|
||||||
|
</if>
|
||||||
|
<if test="secretKey != null and secretKey != ''">
|
||||||
|
AND secretKey = #{secretKey}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findLinkData" resultType="com.glxp.api.entity.inout.UnitMaintainPlatformEntity">
|
||||||
|
select *
|
||||||
|
from io_unit_maintain_platform
|
||||||
|
<where>
|
||||||
|
<if test="unitId != null and unitId != ''">
|
||||||
|
AND unitId = #{unitId}
|
||||||
|
</if>
|
||||||
|
<if test="customerId != null">
|
||||||
|
AND customerId = #{customerId}
|
||||||
|
</if>
|
||||||
|
<if test="action != null and action != ''">
|
||||||
|
AND sourceAction = #{action}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteById">
|
||||||
|
delete
|
||||||
|
from io_unit_maintain_platform
|
||||||
|
where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="selectCount" resultType="java.lang.Long">
|
||||||
|
select count(*)
|
||||||
|
from io_unit_maintain_platform
|
||||||
|
where sourceAction = #{action}
|
||||||
|
and unitId = #{unitId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDelectList" resultType="com.glxp.api.res.inout.PlatformLinkResponse">
|
||||||
|
SELECT io.id,
|
||||||
|
io.platformId,
|
||||||
|
io.invCode,
|
||||||
|
io.invName,
|
||||||
|
io.invSubCode,
|
||||||
|
io.invSubName,
|
||||||
|
io.targetAction,
|
||||||
|
io.targetName,
|
||||||
|
io.sourceAction,
|
||||||
|
b1.`name` as sourceName
|
||||||
|
FROM io_unit_maintain_platform io
|
||||||
|
LEFT JOIN basic_bussiness_type b1 ON b1.action = io.sourceAction
|
||||||
|
where io.platformId = #{platformId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByUnitld" resultType="com.glxp.api.res.inout.PlatformLinkResponse">
|
||||||
|
SELECT
|
||||||
|
io.id,
|
||||||
|
io.unitId,
|
||||||
|
io.platformId,
|
||||||
|
io.invCode,
|
||||||
|
io.invName,
|
||||||
|
io.invSubCode,
|
||||||
|
io.invSubName,
|
||||||
|
io.targetAction,
|
||||||
|
io.targetName,
|
||||||
|
io.sourceAction,
|
||||||
|
io.appid,
|
||||||
|
io.secretKey,
|
||||||
|
a1.host
|
||||||
|
FROM io_unit_maintain_platform io
|
||||||
|
inner join auth_platform a1 on a1.id = io.platformId
|
||||||
|
where io.unitId = #{unitld}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue