You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-spms-java/src/main/java/com/glxp/api/service/thrsys/YbDrugService.java

37 lines
1.3 KiB
Java

package com.glxp.api.service.thrsys;
import cn.hutool.core.collection.CollUtil;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.dao.thrsys.YbDrugMapper;
import com.glxp.api.entity.thrsys.YbDrug;
import com.glxp.api.httpClient.ErpBasicClient;
import com.glxp.api.req.basic.YbDrugDetailFilterRequest;
import com.glxp.api.res.PageSimpleResponse;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class YbDrugService {
@Resource
YbDrugMapper ybDrugMapper;
@Resource
ErpBasicClient erpBasicClient;
public List<YbDrug> getList(YbDrugDetailFilterRequest ybHcflDetailFilterRequest) {
ybHcflDetailFilterRequest.setPage(1);
ybHcflDetailFilterRequest.setLimit(1);
List<YbDrug> list = ybDrugMapper.list(ybHcflDetailFilterRequest);
if (CollUtil.isEmpty(list)){
BaseResponse<PageSimpleResponse<YbDrug>> ybDrugDetail = erpBasicClient.getYbDrugDetail(ybHcflDetailFilterRequest);
PageSimpleResponse<YbDrug> data = ybDrugDetail.getData();
List<YbDrug> list1 = data.getList();
if (CollUtil.isNotEmpty(list1)) ybDrugMapper.batchSaveOrUpdateByGoodsCode(list1);
return list1;
}
return list;
}
}