1.修复业务单据提交新增业务单据错误问题

2.修改第三方系统业务单据提交绑定等接口
3.增加第三方系统修改接口状态接口
4.增加测试连通性接口
5.调整日志打印代码
master
x_z 3 years ago
parent ade66b1481
commit b6a392cd5b

@ -1,6 +1,7 @@
package com.glxp.api.admin.controller.basic;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.annotation.AuthRuleAnnotation;
import com.glxp.api.admin.entity.basic.BasicThirdSysBusApiEntity;
@ -180,6 +181,21 @@ public class BasicThirdSysController {
return ResultVOUtils.success("更新成功");
}
/**
*
*
* @param ids
* @return
*/
@PostMapping("/udiwms/basic/thirdsys/enableInterfaces")
public BaseResponse enableInterfaces(@RequestBody List<Integer> ids) {
if (CollUtil.isEmpty(ids)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
basicThirdSysDetailService.enableInterface(ids);
return ResultVOUtils.success("添加成功");
}
@GetMapping("/udiwms/basic/thirdsys/filterBusTypeDetail")
public BaseResponse filterBusTypeDetail(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest,
@ -234,17 +250,17 @@ public class BasicThirdSysController {
/**
*
* /
*
* @param list
* @param basicThirdSysBusApiEntity
* @return
*/
@PostMapping("/udiwms/basic/thirdsys/saveBusTypes")
public BaseResponse saveBusTypes(@RequestBody List<BasicThirdSysBusApiEntity> list) {
if (CollUtil.isEmpty(list)) {
public BaseResponse saveBusTypes(@RequestBody BasicThirdSysBusApiEntity basicThirdSysBusApiEntity) {
if (null == basicThirdSysBusApiEntity || StrUtil.isBlank(basicThirdSysBusApiEntity.getThirdBuyName()) || StrUtil.isBlank(basicThirdSysBusApiEntity.getName())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
boolean result = basicThirdSysBusApiService.saveBusTypes(list);
boolean result = basicThirdSysBusApiService.saveBusTypes(basicThirdSysBusApiEntity);
if (result) {
return ResultVOUtils.success();
}
@ -263,4 +279,14 @@ public class BasicThirdSysController {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
/**
*
*
* @return
*/
@PostMapping("/udiwms/basic/thirdsys/testThirdService")
public BaseResponse testThirdService(@RequestBody BasicThirdSysEntity basicThirdSysEntity) {
return basicThirdSysDetailService.testThirdService(basicThirdSysEntity);
}
}

@ -9,6 +9,7 @@ import java.util.List;
@Mapper
public interface BasicThirdSysBusApiDao {
boolean insertSysBusApi(BasicThirdSysBusApiEntity basicThirdSysEntity);
boolean updateSysBusApi(BasicThirdSysBusApiEntity basicThirdSysEntity);

@ -15,5 +15,12 @@ public class BasicThirdSysBusApiEntity {
private Integer type;
private String remark;
//扩展字段 暂未启用
private String filed;
private String filed1;
private String filed2;
private String filed3;
private String filed4;
}

@ -109,4 +109,16 @@ public class ErpBasicClient {
}
}
//测试连通性
public BaseResponse testConnection(BasicThirdSysEntity basicThirdSysEntity) {
String response = HttpClient.uCloudPost(basicThirdSysEntity.getThridUrl() + "/udiwms/erp/testConnection", "{}");
log.info(response);
try {
return JSONObject.parseObject(response, BaseResponse.class);
} catch (Exception e) {
log.info("测试第三方服务连通性失败");
return ResultVOUtils.error(500, "连接失败");
}
}
}

@ -8,8 +8,9 @@ public class FilterBasicThirdSysDetailRequest extends ListPageRequest {
private String key;
private String thirdSysFk;
private String code;
private String name;
private Integer type;
private Boolean enabled;
}

@ -22,7 +22,7 @@ public interface BasicThirdSysBusApiService {
* @param list
* @return
*/
boolean saveBusTypes(List<BasicThirdSysBusApiEntity> list);
boolean saveBusTypes(BasicThirdSysBusApiEntity basicThirdSysBusApiEntity);
boolean delete(Integer id);
}

@ -1,7 +1,9 @@
package com.glxp.api.admin.service.basic;
import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.api.admin.entity.basic.BasicThirdSysEntity;
import com.glxp.api.admin.req.basic.FilterBasicThirdSysDetailRequest;
import com.glxp.api.common.res.BaseResponse;
import java.util.List;
@ -9,8 +11,16 @@ public interface BasicThirdSysDetailService {
boolean updateBasicThirdSysDetail(BasicThirdSysDetailEntity basicThirdSysEntity);
BasicThirdSysDetailEntity selectByKey(String key,String thirdSys);
BasicThirdSysDetailEntity selectByKey(String key, String thirdSys);
List<BasicThirdSysDetailEntity> filterBasicThirdSysDetail(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest);
void enableInterface(List<Integer> ids);
/**
*
*
* @param basicThirdSysEntity
*/
BaseResponse testThirdService(BasicThirdSysEntity basicThirdSysEntity);
}

@ -46,8 +46,11 @@ public class BasicThirdSysBusApiServiceImpl implements BasicThirdSysBusApiServic
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveBusTypes(List<BasicThirdSysBusApiEntity> list) {
return basicThirdSysBusApiDao.saveBusTypes(list);
public boolean saveBusTypes(BasicThirdSysBusApiEntity basicThirdSysBusApiEntity) {
if (null != basicThirdSysBusApiEntity.getId()) {
return basicThirdSysBusApiDao.updateSysBusApi(basicThirdSysBusApiEntity);
}
return basicThirdSysBusApiDao.insertSysBusApi(basicThirdSysBusApiEntity);
}
@Transactional(rollbackFor = Exception.class)

@ -3,20 +3,27 @@ package com.glxp.api.admin.service.basic.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.basic.BasicThirdSysDetailDao;
import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.api.admin.entity.basic.BasicThirdSysEntity;
import com.glxp.api.admin.httpclient.ErpBasicClient;
import com.glxp.api.admin.req.basic.FilterBasicThirdSysDetailRequest;
import com.glxp.api.admin.service.basic.BasicThirdSysDetailService;
import com.glxp.api.common.res.BaseResponse;
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 BasicThirdSysDetailServiceImpl implements BasicThirdSysDetailService {
@Resource
BasicThirdSysDetailDao basicThirdSysDetailDao;
@Resource
private ErpBasicClient erpBasicClient;
@Override
public boolean updateBasicThirdSysDetail(BasicThirdSysDetailEntity basicThirdSysEntity) {
@ -41,4 +48,20 @@ public class BasicThirdSysDetailServiceImpl implements BasicThirdSysDetailServic
List<BasicThirdSysDetailEntity> data = basicThirdSysDetailDao.filterBasicThirdSysDetail(filterBasicThirdSysDetailRequest);
return data;
}
@Transactional(rollbackFor = Exception.class)
@Override
public void enableInterface(List<Integer> ids) {
for (Integer id : ids) {
BasicThirdSysDetailEntity basicThirdSysDetailEntity = new BasicThirdSysDetailEntity();
basicThirdSysDetailEntity.setId(id);
basicThirdSysDetailEntity.setEnabled(true);
basicThirdSysDetailDao.updateBasicThirdSysDetail(basicThirdSysDetailEntity);
}
}
@Override
public BaseResponse testThirdService(BasicThirdSysEntity basicThirdSysEntity) {
return erpBasicClient.testConnection(basicThirdSysEntity);
}
}

@ -2,8 +2,7 @@ package com.glxp.api.admin.util;
import com.alibaba.fastjson.JSONObject;
import com.glxp.api.admin.entity.basic.BasicThirdSysEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.util.LinkedMultiValueMap;
@ -17,13 +16,13 @@ import java.net.URLEncoder;
import java.util.Iterator;
import java.util.Map;
@Slf4j
public class HttpClient {
private static final Logger logger = LoggerFactory.getLogger(HttpClient.class);
public static String post(String url, Object object) {
RestTemplate restTemplate = new RestTemplate();
String json = JSONObject.toJSON(object).toString();
logger.info(url + "\n" + json);
log.info(url + "\n" + json);
MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>();
postParameters.add("params", json);
HttpHeaders headers = new HttpHeaders();
@ -37,27 +36,27 @@ public class HttpClient {
String json = JSONObject.toJSON(object).toString();
// MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>();
// postParameters.add("params", json);
logger.info(url + "\n" + json);
log.info(url + "\n" + json);
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
headers.add("system", "1");
headers.add("apicode", "1b723931cca84aee8ced6b607fc7dabb");
HttpEntity<String> httpEntity = new HttpEntity<>(json, headers);
String response = restTemplate.postForObject(url, httpEntity, String.class);
System.out.println(response);
log.info(response);
return response;
}
public static String uCloudPost(String url, Object object) {
RestTemplate restTemplate = new RestTemplate();
String json = JSONObject.toJSON(object).toString();
logger.info(url + "\n" + json);
log.info(url + "\n" + json);
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
HttpEntity<String> httpEntity = new HttpEntity<>(json, headers);
logger.info(httpEntity.toString());
log.info(httpEntity.toString());
String response = restTemplate.postForObject(url, httpEntity, String.class);
System.out.println(response);
log.info(response);
return response;
}
@ -72,7 +71,7 @@ public class HttpClient {
public static String uCloudPost(String url, Object object, BasicThirdSysEntity basicThirdSysEntity) {
RestTemplate restTemplate = new RestTemplate();
String json = JSONObject.toJSON(object).toString();
logger.info(url + "\n" + json);
log.info(url + "\n" + json);
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
if (null != basicThirdSysEntity) {
@ -80,17 +79,15 @@ public class HttpClient {
headers.add("secret_key", basicThirdSysEntity.getSecretkey());
}
HttpEntity<String> httpEntity = new HttpEntity<>(json, headers);
logger.info(httpEntity.toString());
String response = restTemplate.postForObject(url, httpEntity, String.class);
return response;
log.info(httpEntity.toString());
return restTemplate.postForObject(url, httpEntity, String.class);
}
public static String mipsGet(String url) {
RestTemplate restTemplate = new RestTemplate();
String accessTokenRequestUrl = url;//"http://127.0.0.1:9997/mips/druginfo/list";
String response = restTemplate.getForObject(accessTokenRequestUrl, String.class);
return response;
return restTemplate.getForObject(accessTokenRequestUrl, String.class);
}
public static String mipsGet(String url, Map params) {
@ -131,9 +128,8 @@ public class HttpClient {
} catch (MalformedURLException e) {
e.printStackTrace();
}
logger.info(accessTokenRequestUrl);
String response = restTemplate.getForObject(accessTokenRequestUrl, String.class);
return response;
log.info(accessTokenRequestUrl);
return restTemplate.getForObject(accessTokenRequestUrl, String.class);
}

@ -58,7 +58,7 @@
</insert>
<insert id="saveBusTypes">
insert into basic_third_sys_bus_api (code, `name`, thirdSys, type)
insert into basic_third_sys_bus_api (code, `name`, thirdBuyName, thirdBuyCode, thirdSys, type)
values
<foreach collection="list" index="index" item="item" separator=",">
(

@ -20,7 +20,8 @@
<select id="filterBasicThirdSysDetail" parameterType="com.glxp.api.admin.req.basic.FilterBasicThirdSysRequest"
resultType="com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity">
SELECT * FROM basic_third_sys_detail
SELECT *
FROM basic_third_sys_detail
<where>
<if test="key != '' and key != null">
AND basic_third_sys_detail.key = #{key}
@ -28,9 +29,11 @@
<if test="thirdSysFk != '' and thirdSysFk != null">
AND thirdSysFk = #{thirdSysFk}
</if>
<if test="enabled != null">
AND enabled = #{enabled}
</if>
</where>
order by enabled desc
order by id desc
</select>
<select id="selectByKey" parameterType="Map"
resultType="com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity">

Loading…
Cancel
Save