项目组套相关更新

test
anthonywj 1 year ago
parent 15e7286003
commit a277bc0ba2

@ -1,13 +1,17 @@
package com.glxp.api.controller.basic;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.annotation.CusRedissonAnnotation;
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.constant.RedissonCacheKey;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.basic.BasicSkProjectEntity;
import com.glxp.api.entity.basic.UdiEntity;
@ -177,12 +181,14 @@ public class BasicDestinyRelController {
companyProductRelevanceRequest.setDiType(1);
}
//查询详情id过滤
List<Long> idList = basicDestinyRelService.filterDestinyRelIds(Long.valueOf(companyProductRelevanceRequest.getId()));
List<Long> idList = null;
if (companyProductRelevanceRequest.getId() != null)
idList = basicDestinyRelService.filterDestinyRelIds(Long.valueOf(companyProductRelevanceRequest.getId()));
List<UdiRelevanceResponse> basicInstrumentMaintainRelevanceResponses = null;
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
BeanCopyUtils.copy(companyProductRelevanceRequest, filterUdiRelRequest);
if (idList.size() > 0) {
if (CollUtil.isNotEmpty(idList)) {
filterUdiRelRequest.setIds(idList);
}
basicInstrumentMaintainRelevanceResponses = basicDestinyRelService.filterUdiJoinSup(filterUdiRelRequest);
@ -268,4 +274,18 @@ public class BasicDestinyRelController {
}
@CusRedissonAnnotation(cacheName = RedissonCacheKey.DL_SICKER, key = {"#dlThirdDestinyRequest.thirdSys"}, waitTime = 3, timeOutMsg = "后台正在下载,请勿重复提交")
@PostMapping("/udiwms/basic/destiny/project/download")
public BaseResponse dlProject(@RequestBody DlThirdDestinyRequest dlThirdDestinyRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
ThreadUtil.execAsync(() -> {
basicDestinyRelService.dlThirdDestiny(dlThirdDestinyRequest);
});
return ResultVOUtils.success("后台已开始下载,请稍后刷新查看!");
}
}

@ -1,19 +1,27 @@
package com.glxp.api.http;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.entity.basic.BasicSkProjectDetailEntity;
import com.glxp.api.entity.basic.BasicSkProjectEntity;
import com.glxp.api.entity.basic.BasicSkSickerEntity;
import com.glxp.api.entity.thrsys.ThrSystemBusApiEntity;
import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.glxp.api.http.req.UdiwmsBusTypeRequest;
import com.glxp.api.http.req.UdiwmsUnitRequest;
import com.glxp.api.req.basic.DlThirdDestinyRequest;
import com.glxp.api.req.basic.GetSickPrescribeRequest;
import com.glxp.api.req.basic.GetSickRequest;
import com.glxp.api.req.thrsys.*;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.BasicSkPrescribeResponse;
import com.glxp.api.res.basic.BasicSkProjectDetailResponse;
import com.glxp.api.res.basic.BasicSkProjectResponse;
import com.glxp.api.res.basic.BasicSkSickerResponse;
import com.glxp.api.res.thrsys.ThrCorpsResponse;
import com.glxp.api.res.thrsys.ThrProductsResponse;
@ -25,6 +33,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* HttpClient
@ -231,4 +240,23 @@ public class ErpBasicClient {
}
}
/**
*
*/
public BaseResponse<PageSimpleResponse<BasicSkProjectResponse>> getBasicProject(DlThirdDestinyRequest dlThirdDestinyRequest) {
ThrSystemEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(dlThirdDestinyRequest.getThirdSys());
String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/basic/getProject";
try {
String response = httpOkClient.uCloudPost(url, dlThirdDestinyRequest);
BaseResponse<PageSimpleResponse<BasicSkProjectResponse>> listBaseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<BasicSkProjectResponse>>>() {
});
return listBaseResponse;
} catch (Exception e) {
log.error("获取患者处方信息", e);
return ResultVOUtils.error(500, "连接第三方系统接口服务出错");
}
}
}

@ -0,0 +1,13 @@
package com.glxp.api.req.basic;
import com.glxp.api.util.page.ListPageRequest;
import lombok.Data;
@Data
public class DlThirdDestinyRequest extends ListPageRequest {
private String lastUpdateTime;
private String thirdSys;
}

@ -1,4 +1,40 @@
package com.glxp.api.res.basic;
import lombok.Data;
@Data
public class BasicSkProjectDetailResponse {
private Long id;
/**
* id
*/
private Long relId;
/**
* id
*/
private Long pId;
/**
*
*/
private Integer count;
private String thrName;
private String thrCode;
private String measureCount;
private String measureUnit;
private String category;
private String frequency;
private String price;
private String ggxh;
private String remark;
private String createTime;
private String createUser;
private String updateTime;
private String updateUser;
}

@ -3,6 +3,7 @@ package com.glxp.api.res.basic;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class BasicSkProjectResponse {
@ -53,4 +54,7 @@ public class BasicSkProjectResponse {
* 1使2
*/
private Integer type;
private List<BasicSkProjectDetailResponse> basicSkProjectDetailResponses;
}

@ -1,17 +1,29 @@
package com.glxp.api.service.basic.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.dao.basic.BasicDestinyRelMapper;
import com.glxp.api.dao.basic.BasicSkProjectMapper;
import com.glxp.api.dao.basic.UdiRelevanceDao;
import com.glxp.api.entity.basic.BasicSkProjectDetailEntity;
import com.glxp.api.entity.basic.BasicSkProjectEntity;
import com.glxp.api.entity.basic.BasicSkSickerEntity;
import com.glxp.api.http.ErpBasicClient;
import com.glxp.api.req.basic.BasicDestinyRelRequest;
import com.glxp.api.req.basic.DlThirdDestinyRequest;
import com.glxp.api.req.basic.FilterUdiRelRequest;
import com.glxp.api.req.basic.GetSickRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.BasicSkProjectDetailResponse;
import com.glxp.api.res.basic.BasicSkProjectResponse;
import com.glxp.api.res.basic.BasicSkSickerResponse;
import com.glxp.api.res.basic.UdiRelevanceResponse;
import org.springframework.stereotype.Service;
@ -26,7 +38,8 @@ public class BasicDestinyRelService extends ServiceImpl<BasicDestinyRelMapper, B
@Resource
BasicDestinyRelMapper basicDestinyRelMapper;
@Resource
ErpBasicClient erpBasicClient;
@Resource
UdiRelevanceDao udiRelevanceDao;
@ -95,4 +108,46 @@ public class BasicDestinyRelService extends ServiceImpl<BasicDestinyRelMapper, B
basicSkProjectDetailEntity.setCount(basicDestinyRelRequest.getCount());
return basicDestinyRelMapper.updateById(basicSkProjectDetailEntity) > 0 ? true : false;
}
public BaseResponse dlThirdDestiny(DlThirdDestinyRequest request) {
int page = 1;
int limit = 200;
request.setThirdSys("thirdId");
request.setLimit(limit);
while (true) {
request.setPage(page);
BaseResponse<PageSimpleResponse<BasicSkProjectResponse>> baseResponse = erpBasicClient.getBasicProject(request);
if (baseResponse.getCode() == 20000) {
List<BasicSkProjectResponse> list = baseResponse.getData().getList();
List<BasicSkProjectEntity> basicSkProjectEntities = new ArrayList<>();
if (CollUtil.isNotEmpty(list)) {
list.forEach(item -> { //todo 数据转换
BasicSkProjectEntity basicSkProjectEntity = new BasicSkProjectEntity();
BeanUtil.copyProperties(item, basicSkProjectEntity);
List<BasicSkProjectDetailResponse> basicSkProjectDetailResponses = item.getBasicSkProjectDetailResponses();
if (CollUtil.isNotEmpty(basicSkProjectDetailResponses)) {
list.forEach(detailItem ->
{
//todo 数据转换
BasicSkProjectDetailEntity basicSkProjectDetailEntity = new BasicSkProjectDetailEntity();
BeanUtil.copyProperties(detailItem, basicSkProjectDetailEntity);
}
);
}
});
}
if (list.size() >= limit && !baseResponse.getData().getTotal().equals(-666)) {
// basicDestinyRelMapper.replaceBatchs(basicSkProjectEntities);
page++;
} else {
break;
}
} else {
return ResultVOUtils.error(500, "下载异常中断");
}
}
return ResultVOUtils.success("下载成功!");
}
}

Loading…
Cancel
Save