workplace
			
			
		
		
							parent
							
								
									7e698fc720
								
							
						
					
					
						commit
						03b9171a75
					
				| @ -0,0 +1,33 @@ | |||||||
|  | package com.glxp.api.constant; | ||||||
|  | 
 | ||||||
|  | public enum BusTypeConstant { | ||||||
|  |     YPCF002("药品处方单","YPCF002"), | ||||||
|  |     CGJH001("采购计划","CGJH001"), | ||||||
|  |     LYRK("领药入库","LYRK"), | ||||||
|  |     GMRK("购买入库","GMRK"), | ||||||
|  |     LYCK("领药出库","LYCK"), | ||||||
|  |     ; | ||||||
|  | 
 | ||||||
|  |     private String name; | ||||||
|  |     private String busType; | ||||||
|  |     BusTypeConstant(String name, String busType) { | ||||||
|  |         this.name = name; | ||||||
|  |         this.busType = busType; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getName() { | ||||||
|  |         return name; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void setName(String name) { | ||||||
|  |         this.name = name; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getBusType() { | ||||||
|  |         return busType; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void setBusType(String busType) { | ||||||
|  |         this.busType = busType; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,51 @@ | |||||||
|  | package com.glxp.api.service.collect; | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.common.res.BaseResponse; | ||||||
|  | import com.glxp.api.common.util.ResultVOUtils; | ||||||
|  | import com.glxp.api.constant.BusTypeConstant; | ||||||
|  | import com.glxp.api.req.collect.CollectOrderRequest; | ||||||
|  | import com.glxp.api.service.collect.down.*; | ||||||
|  | import org.springframework.stereotype.Component; | ||||||
|  | 
 | ||||||
|  | import javax.annotation.Resource; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * 下载工厂 | ||||||
|  |  */ | ||||||
|  | @Component | ||||||
|  | public class DownloadFactory { | ||||||
|  | 
 | ||||||
|  |     @Resource | ||||||
|  |     private YPCF002Download ypcf002Download; | ||||||
|  |     @Resource | ||||||
|  |     private LYRKDownload lyrkDownload; | ||||||
|  |     @Resource | ||||||
|  |     private GMRKDownload gmrkDownload; | ||||||
|  |     @Resource | ||||||
|  |     private LYCKDownload lyckDownload; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 第三方单据类型 | ||||||
|  |      * @param collectOrderRequest | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     public BaseResponse downloadOrder(CollectOrderRequest collectOrderRequest){ | ||||||
|  |         String busType = collectOrderRequest.getBusType(); | ||||||
|  |         if(busType == null){ | ||||||
|  |             return ResultVOUtils.error("下载失败,未配置业务类型"); | ||||||
|  |         } | ||||||
|  |         if(busType.equals(BusTypeConstant.YPCF002.getBusType())){ | ||||||
|  |             return ypcf002Download.downloadOrder(collectOrderRequest); | ||||||
|  |         } else if(busType.equals(BusTypeConstant.CGJH001.getBusType())){ | ||||||
|  |             return ResultVOUtils.error("下载失败,未配置业务类型"); | ||||||
|  |         } else if(busType.equals(BusTypeConstant.LYRK.getBusType())){ | ||||||
|  |             return lyrkDownload.downloadOrder(collectOrderRequest); | ||||||
|  |         } else if(busType.equals(BusTypeConstant.GMRK.getBusType())){ | ||||||
|  |             return gmrkDownload.downloadOrder(collectOrderRequest); | ||||||
|  |         } else if(busType.equals(BusTypeConstant.LYCK.getBusType())){ | ||||||
|  |             return lyckDownload.downloadOrder(collectOrderRequest); | ||||||
|  |         } | ||||||
|  |         return ResultVOUtils.error("下载失败,未配置业务类型"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,15 @@ | |||||||
|  | package com.glxp.api.service.collect.down; | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.common.res.BaseResponse; | ||||||
|  | import com.glxp.api.common.util.ResultVOUtils; | ||||||
|  | import com.glxp.api.req.collect.CollectOrderRequest; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  | 
 | ||||||
|  | @Service | ||||||
|  | public class GMRKDownload implements IDownload{ | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public BaseResponse downloadOrder(CollectOrderRequest collectOrderRequest) { | ||||||
|  |         return  ResultVOUtils.error("下载失败"); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,12 @@ | |||||||
|  | package com.glxp.api.service.collect.down; | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.common.res.BaseResponse; | ||||||
|  | import com.glxp.api.req.collect.CollectOrderRequest; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * 下载接口 | ||||||
|  |  */ | ||||||
|  | public interface IDownload { | ||||||
|  |     BaseResponse downloadOrder(CollectOrderRequest collectOrderRequest); | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,40 @@ | |||||||
|  | package com.glxp.api.service.collect.down; | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.common.res.BaseResponse; | ||||||
|  | import com.glxp.api.common.util.ResultVOUtils; | ||||||
|  | import com.glxp.api.entity.collect.IoCollectOrder; | ||||||
|  | import com.glxp.api.http.ErpBasicClient; | ||||||
|  | import com.glxp.api.req.basic.GetSickPrescribeRequest; | ||||||
|  | import com.glxp.api.req.collect.CollectOrderRequest; | ||||||
|  | import com.glxp.api.res.PageSimpleResponse; | ||||||
|  | import com.glxp.api.service.collect.IoCollectOrderService; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  | 
 | ||||||
|  | import javax.annotation.Resource; | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Service | ||||||
|  | public class LYCKDownload implements IDownload{ | ||||||
|  |     @Resource | ||||||
|  |     private ErpBasicClient erpBasicClient; | ||||||
|  |     @Resource | ||||||
|  |     private IoCollectOrderService collectOrderService; | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public BaseResponse downloadOrder(CollectOrderRequest collectOrderRequest) { | ||||||
|  |         GetSickPrescribeRequest getSickPrescribeRequest = new GetSickPrescribeRequest(); | ||||||
|  |         getSickPrescribeRequest.setPage(1); | ||||||
|  |         getSickPrescribeRequest.setLimit(100); | ||||||
|  |         getSickPrescribeRequest.setCode(collectOrderRequest.getBillNo()); | ||||||
|  |         getSickPrescribeRequest.setThirdSys("thirdId"); | ||||||
|  |         getSickPrescribeRequest.setWorkPlaceCode(collectOrderRequest.getWorkPlaceCode()); | ||||||
|  |         getSickPrescribeRequest.setFromType(collectOrderRequest.getFromType()); | ||||||
|  |         BaseResponse<PageSimpleResponse<IoCollectOrder>> baseResponse = erpBasicClient.getPrescribeV2(getSickPrescribeRequest); | ||||||
|  |         if (baseResponse.getCode() == 20000) { | ||||||
|  |             List<IoCollectOrder> list = baseResponse.getData().getList(); | ||||||
|  |             collectOrderService.importPrescribe(list,collectOrderRequest.getBusType()); | ||||||
|  |             return ResultVOUtils.success("下载成功"); | ||||||
|  |         } | ||||||
|  |         return ResultVOUtils.error("下载失败"); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,15 @@ | |||||||
|  | package com.glxp.api.service.collect.down; | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.common.res.BaseResponse; | ||||||
|  | import com.glxp.api.common.util.ResultVOUtils; | ||||||
|  | import com.glxp.api.req.collect.CollectOrderRequest; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  | 
 | ||||||
|  | @Service | ||||||
|  | public class LYRKDownload implements IDownload { | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public BaseResponse downloadOrder(CollectOrderRequest collectOrderRequest) { | ||||||
|  |         return ResultVOUtils.error("下载失败"); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,40 @@ | |||||||
|  | package com.glxp.api.service.collect.down; | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.common.res.BaseResponse; | ||||||
|  | import com.glxp.api.common.util.ResultVOUtils; | ||||||
|  | import com.glxp.api.entity.collect.IoCollectOrder; | ||||||
|  | import com.glxp.api.http.ErpBasicClient; | ||||||
|  | import com.glxp.api.req.basic.GetSickPrescribeRequest; | ||||||
|  | import com.glxp.api.req.collect.CollectOrderRequest; | ||||||
|  | import com.glxp.api.res.PageSimpleResponse; | ||||||
|  | import com.glxp.api.service.collect.IoCollectOrderService; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  | 
 | ||||||
|  | import javax.annotation.Resource; | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Service | ||||||
|  | public class YPCF002Download implements IDownload{ | ||||||
|  |     @Resource | ||||||
|  |     private ErpBasicClient erpBasicClient; | ||||||
|  |     @Resource | ||||||
|  |     private IoCollectOrderService collectOrderService; | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public BaseResponse downloadOrder(CollectOrderRequest collectOrderRequest) { | ||||||
|  |         GetSickPrescribeRequest getSickPrescribeRequest = new GetSickPrescribeRequest(); | ||||||
|  |         getSickPrescribeRequest.setPage(1); | ||||||
|  |         getSickPrescribeRequest.setLimit(100); | ||||||
|  |         getSickPrescribeRequest.setCode(collectOrderRequest.getBillNo()); | ||||||
|  |         getSickPrescribeRequest.setThirdSys("thirdId"); | ||||||
|  |         getSickPrescribeRequest.setWorkPlaceCode(collectOrderRequest.getWorkPlaceCode()); | ||||||
|  |         getSickPrescribeRequest.setFromType(collectOrderRequest.getFromType()); | ||||||
|  |         BaseResponse<PageSimpleResponse<IoCollectOrder>> baseResponse = erpBasicClient.getPrescribeV2(getSickPrescribeRequest); | ||||||
|  |         if (baseResponse.getCode() == 20000) { | ||||||
|  |             List<IoCollectOrder> list = baseResponse.getData().getList(); | ||||||
|  |             collectOrderService.importPrescribe(list,collectOrderRequest.getBusType()); | ||||||
|  |             return ResultVOUtils.success("下载成功"); | ||||||
|  |         } | ||||||
|  |         return ResultVOUtils.error("下载失败"); | ||||||
|  |     } | ||||||
|  | } | ||||||
					Loading…
					
					
				
		Reference in New Issue