Commit 08b0e4c7 authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents c424dc12 91bfc73c
...@@ -49,8 +49,8 @@ public class ComplexService extends PublicService { ...@@ -49,8 +49,8 @@ public class ComplexService extends PublicService {
/** /**
* 综窗申报 * 综窗申报
*/ */
public String windowApply(ReceiveMsgInfo receiveMsgInfo) throws Exception { public String windowApply(ReceiveMsgInfo receiveMsgInfo) {
logger.info(JSONUtil.toJsonStr(receiveMsgInfo)); logger.info("receiveMsgInfo=" + JSONUtil.toJsonStr(receiveMsgInfo));
Boolean success = receiveMsgInfo.getSuccess(); Boolean success = receiveMsgInfo.getSuccess();
if (success) { if (success) {
ComplexWindowAbstract complexWindowAbstract = ComplexWindowAbstract.newType(receiveMsgInfo.getItemCode()); ComplexWindowAbstract complexWindowAbstract = ComplexWindowAbstract.newType(receiveMsgInfo.getItemCode());
...@@ -76,6 +76,7 @@ public class ComplexService extends PublicService { ...@@ -76,6 +76,7 @@ public class ComplexService extends PublicService {
commonData.setLegalIdNumber(userData.getOrDefault("legalIdNumber",""));//法人id号 commonData.setLegalIdNumber(userData.getOrDefault("legalIdNumber",""));//法人id号
commonData.setLegalSex(userData.getOrDefault("legalSex",""));//法人性别 commonData.setLegalSex(userData.getOrDefault("legalSex",""));//法人性别
commonData.setLegalDocumentId("111"); commonData.setLegalDocumentId("111");
logger.info("receiveMsgInfo=" + JSONUtil.toJsonStr(receiveMsgInfo));
complexWindowAbstract.doHandleWork(commonData); complexWindowAbstract.doHandleWork(commonData);
} else { } else {
log.info("预审事项未通过"); log.info("预审事项未通过");
......
...@@ -31,6 +31,12 @@ public abstract class ComplexWindowAbstract { ...@@ -31,6 +31,12 @@ public abstract class ComplexWindowAbstract {
if (TypeEnum.危险化学品经营许可法人变更.getValue().equals(type)) { if (TypeEnum.危险化学品经营许可法人变更.getValue().equals(type)) {
return new WXHXPJYXKFRBG(type); return new WXHXPJYXKFRBG(type);
}else if (TypeEnum.危险化学品经营许可变更.getValue().equals(type)){
return new WXHXPJYXKBG(type);
} else if (TypeEnum.医疗机构执业变更资金变更.getValue().equals(type)) {
return new YLJGZYBGZJBG(type);
} else if(TypeEnum.医疗机构执业变更法人变更.getValue().equals(type)){
return new YLJGZYBGFRBG(type);
} }
......
package com.lilosoft.api.service.complexWindow;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.lilosoft.api.bean.receive.FileDataItem;
import com.lilosoft.complex.Rest;
import com.lilosoft.complex.matter.model.req.*;
import com.lilosoft.complex.matter.model.rsp.AcceptRspInfo;
import com.lilosoft.complex.matter.model.rsp.LoginRspInfo;
import com.lilosoft.complex.matter.model.rsp.MatterListInfo;
import com.lilosoft.complex.matter.model.rsp.MatterRespInfo;
import com.lilosoft.complex.matter.model.rsp.matter.ChildrenItem;
import com.lilosoft.complex.matter.model.rsp.matter.MatterWorkInfo;
import com.lilosoft.complex.matter.service.IComplexMatterService;
import com.lilosoft.core.enums.TypeEnum;
import com.lilosoft.core.enums.YesNoEnum;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 危险化学品经营许可法人变更
*
* @author:
* @date: 2023/7/31 15:15
*/
@Slf4j
public class WXHXPJYXKBG extends ComplexWindowAbstract {
private IComplexMatterService complexMatterService;
public static String matterName = "从事剧毒、易制爆、汽油加油站、专用危化品仓储的企业,中央企业所属省级";
public WXHXPJYXKBG(String type) {
super(type);
this.complexMatterService = SpringUtil.getBean(IComplexMatterService.class);
}
@Override
String getType() {
return TypeEnum.危险化学品经营许可变更.getValue();
}
@Override
public void doHandleWork(CommonData commonData) {
log.info("commonData = " + JSON.toJSONString(commonData));
//下载附件
List<FileDataItem> fileCollect = commonData.getFileData().stream().map(item -> {
FileDataItem fileDataItem = new FileDataItem();
BeanUtils.copyProperties(item, fileDataItem);
String downloadPath = commonData.getRobertServerUrl()+"aiCase/download?fileUrl=" + item.getFileUrl();
byte[] bytes = HttpUtil.downloadBytes(downloadPath);
fileDataItem.setBytes(bytes);
return fileDataItem;
}).collect(Collectors.toList());
//通过名称查询
DeviceLoginReq deviceLoginReq = new DeviceLoginReq();
deviceLoginReq.setDeviceLogo(commonData.getDeviceLogo());
Rest<LoginRspInfo> loginRspInfoRest = complexMatterService.deviceLogin(deviceLoginReq);
if (loginRspInfoRest.getCode() == YesNoEnum.YES.getValue()) {
//设备登录成功 上传附件
fileCollect.stream().forEach(item -> {
Rest<String> uploadFileRest = complexMatterService.uploadFile(commonData.getDeviceLogo(), item.getBytes(), item.getFileName());
if (uploadFileRest.getCode() == YesNoEnum.YES.getValue()) {
item.setDownloadUrl(uploadFileRest.getData());
}
});
//通过事项查询eventId
ImplementationReq implementationReq = new ImplementationReq();
implementationReq.setImplementName(matterName);
Rest<MatterListInfo> matterRest = complexMatterService.findMatters(commonData.getDeviceLogo(), implementationReq);
log.info("matterRest = " + JSON.toJSONString(matterRest));
if (matterRest.getCode() == YesNoEnum.YES.getValue()) {
List<MatterRespInfo> matterListInfos = matterRest.getData().getRecords();
if (!ObjectUtils.isEmpty(matterListInfos)) {
MatterRespInfo matterRespInfo = matterListInfos.get(0);
String eventId = matterRespInfo.getEventId();
String eventObjectType = matterRespInfo.getEventObjectType();
AcceptReq acceptReq = new AcceptReq();
//查询办理事项情形
Rest<MatterWorkInfo> matterWorkInfoRest = complexMatterService.doWorkMatterSearch(commonData.getDeviceLogo(), eventId);
log.info("matterWorkInfoRest = " + JSON.toJSONString(matterWorkInfoRest));
if (matterWorkInfoRest.getCode() == YesNoEnum.YES.getValue()) {
MatterWorkInfo matterWorkInfo = matterWorkInfoRest.getData();
ChildrenItem childrenItem = matterWorkInfo.getChildren().stream().filter(f -> "变更企业名称".equals(f.getLabel())).findFirst().orElseGet(() -> null);
if (!ObjectUtils.isEmpty(childrenItem)) {
String situationItemId = childrenItem.getSituationItemId();
acceptReq.getItemsIds().add(situationItemId);
//构建受理材料附件
List<MaterialsItem> materialsItemList = childrenItem.getMaterials().stream().map(item -> {
MaterialsItem materialsItem = new MaterialsItem();
String name = item.getName();
if (StrUtil.contains(name, "变更后的工商营业执照副本")) {
matchUploadFile(fileCollect, materialsItem, "营业执照");
} else if (StrUtil.contains(name, "许可证变更申请表")) {
matchUploadFile(fileCollect, materialsItem, "合格证");
} else if (StrUtil.contains(name, "化学品经营许可证")) {
matchUploadFile(fileCollect, materialsItem, "危险化学品经营许可证原件正副本");
}
materialsItem.setMaterialForm(item.getFromId());
materialsItem.setMaterialId(item.getId());
return materialsItem;
}).collect(Collectors.toList());
acceptReq.setMaterials(materialsItemList);
}
}
//提交响应的受理
List<HandlingsItem> handlingsItemList = new ArrayList<>();
HandlingsItem handlingsItem = new HandlingsItem();
handlingsItem.setEventId(eventId);
handlingsItem.setObjectType(eventObjectType);
handlingsItemList.add(handlingsItem);
acceptReq.setHandlings(handlingsItemList);
//申请人信息
ApplicantLeagal applicantLeagal = new ApplicantLeagal();
applicantLeagal.setPhone(commonData.getApplicantPhone());
applicantLeagal.setApplicantSex(commonData.getApplicantSex());
applicantLeagal.setDocumentId(commonData.getApplicantDocumentId());
applicantLeagal.setApplicantName(commonData.getApplicantName());
applicantLeagal.setApplicantIdNumber(commonData.getApplicantIdNumber());
acceptReq.setApplicantLegal(applicantLeagal);
//法人信息
LegalProxy legalProxy = new LegalProxy();
legalProxy.setLegalName(commonData.getLegalName());
legalProxy.setLegalIdNumber(commonData.getLegalIdNumber());
legalProxy.setDocumentId(commonData.getLegalDocumentId());
acceptReq.setLegalProxy(legalProxy);
Rest<List<AcceptRspInfo>> acceptRest = complexMatterService.accept(commonData.getDeviceLogo(), acceptReq);
log.info("受理返回==>{}", JSON.toJSONString(acceptRest));
if (acceptRest.getCode() == YesNoEnum.YES.getValue()) {
log.info("操作成功==>{}", JSON.toJSONString(acceptRest));
}
}
}
}
}
private static void matchUploadFile(List<FileDataItem> fileCollect, MaterialsItem materialsItem, String fileName) {
FileDataItem fileDataItem = fileCollect.stream().filter(f -> StrUtil.contains(f.getName(), fileName)).findFirst().orElseGet(() -> null);
if (!ObjectUtils.isEmpty(fileDataItem)) {
materialsItem.setUploadFileName(fileDataItem.getFileName());
materialsItem.setMaterialPath(fileDataItem.getDownloadUrl());
}
}
}
...@@ -55,6 +55,7 @@ public class WXHXPJYXKFRBG extends ComplexWindowAbstract { ...@@ -55,6 +55,7 @@ public class WXHXPJYXKFRBG extends ComplexWindowAbstract {
@Override @Override
public void doHandleWork(CommonData commonData) { public void doHandleWork(CommonData commonData) {
log.info("commonData = " + JSON.toJSONString(commonData));
//下载附件 //下载附件
List<FileDataItem> fileCollect = commonData.getFileData().stream().map(item -> { List<FileDataItem> fileCollect = commonData.getFileData().stream().map(item -> {
FileDataItem fileDataItem = new FileDataItem(); FileDataItem fileDataItem = new FileDataItem();
...@@ -69,6 +70,7 @@ public class WXHXPJYXKFRBG extends ComplexWindowAbstract { ...@@ -69,6 +70,7 @@ public class WXHXPJYXKFRBG extends ComplexWindowAbstract {
DeviceLoginReq deviceLoginReq = new DeviceLoginReq(); DeviceLoginReq deviceLoginReq = new DeviceLoginReq();
deviceLoginReq.setDeviceLogo(commonData.getDeviceLogo()); deviceLoginReq.setDeviceLogo(commonData.getDeviceLogo());
Rest<LoginRspInfo> loginRspInfoRest = complexMatterService.deviceLogin(deviceLoginReq); Rest<LoginRspInfo> loginRspInfoRest = complexMatterService.deviceLogin(deviceLoginReq);
if (loginRspInfoRest.getCode() == YesNoEnum.YES.getValue()) { if (loginRspInfoRest.getCode() == YesNoEnum.YES.getValue()) {
//设备登录成功 上传附件 //设备登录成功 上传附件
fileCollect.stream().forEach(item -> { fileCollect.stream().forEach(item -> {
...@@ -82,6 +84,7 @@ public class WXHXPJYXKFRBG extends ComplexWindowAbstract { ...@@ -82,6 +84,7 @@ public class WXHXPJYXKFRBG extends ComplexWindowAbstract {
ImplementationReq implementationReq = new ImplementationReq(); ImplementationReq implementationReq = new ImplementationReq();
implementationReq.setImplementName(matterName); implementationReq.setImplementName(matterName);
Rest<MatterListInfo> matterRest = complexMatterService.findMatters(commonData.getDeviceLogo(), implementationReq); Rest<MatterListInfo> matterRest = complexMatterService.findMatters(commonData.getDeviceLogo(), implementationReq);
log.info("matterRest = " + JSON.toJSONString(matterRest));
if (matterRest.getCode() == YesNoEnum.YES.getValue()) { if (matterRest.getCode() == YesNoEnum.YES.getValue()) {
List<MatterRespInfo> matterListInfos = matterRest.getData().getRecords(); List<MatterRespInfo> matterListInfos = matterRest.getData().getRecords();
if (!ObjectUtils.isEmpty(matterListInfos)) { if (!ObjectUtils.isEmpty(matterListInfos)) {
...@@ -92,6 +95,7 @@ public class WXHXPJYXKFRBG extends ComplexWindowAbstract { ...@@ -92,6 +95,7 @@ public class WXHXPJYXKFRBG extends ComplexWindowAbstract {
//查询办理事项情形 //查询办理事项情形
Rest<MatterWorkInfo> matterWorkInfoRest = complexMatterService.doWorkMatterSearch(commonData.getDeviceLogo(), eventId); Rest<MatterWorkInfo> matterWorkInfoRest = complexMatterService.doWorkMatterSearch(commonData.getDeviceLogo(), eventId);
log.info("matterWorkInfoRest = " + JSON.toJSONString(matterWorkInfoRest));
if (matterWorkInfoRest.getCode() == YesNoEnum.YES.getValue()) { if (matterWorkInfoRest.getCode() == YesNoEnum.YES.getValue()) {
MatterWorkInfo matterWorkInfo = matterWorkInfoRest.getData(); MatterWorkInfo matterWorkInfo = matterWorkInfoRest.getData();
ChildrenItem childrenItem = matterWorkInfo.getChildren().stream().filter(f -> "变更法人".equals(f.getLabel())).findFirst().orElseGet(() -> null); ChildrenItem childrenItem = matterWorkInfo.getChildren().stream().filter(f -> "变更法人".equals(f.getLabel())).findFirst().orElseGet(() -> null);
...@@ -104,9 +108,9 @@ public class WXHXPJYXKFRBG extends ComplexWindowAbstract { ...@@ -104,9 +108,9 @@ public class WXHXPJYXKFRBG extends ComplexWindowAbstract {
List<MaterialsItem> materialsItemList = childrenItem.getMaterials().stream().map(item -> { List<MaterialsItem> materialsItemList = childrenItem.getMaterials().stream().map(item -> {
MaterialsItem materialsItem = new MaterialsItem(); MaterialsItem materialsItem = new MaterialsItem();
String name = item.getName(); String name = item.getName();
if (StrUtil.contains(name, "变更申请表")) { if (StrUtil.contains(name, "法定代表人(主要负责人)身份证、主要负责人医师资格证、执业医师证")) {
matchUploadFile(fileCollect, materialsItem, "申请书"); matchUploadFile(fileCollect, materialsItem, "申请书");
} else if (StrUtil.contains(name, "安全资格证书")) { } else if (StrUtil.contains(name, "变更申请表")) {
matchUploadFile(fileCollect, materialsItem, "合格证"); matchUploadFile(fileCollect, materialsItem, "合格证");
} else if (StrUtil.contains(name, "化学品经营许可证")) { } else if (StrUtil.contains(name, "化学品经营许可证")) {
matchUploadFile(fileCollect, materialsItem, "许可证"); matchUploadFile(fileCollect, materialsItem, "许可证");
......
package com.lilosoft.api.service.complexWindow;
import cn.hutool.core.io.resource.FileObjectResource;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.lilosoft.api.bean.receive.FileDataItem;
import com.lilosoft.complex.Rest;
import com.lilosoft.complex.matter.model.req.*;
import com.lilosoft.complex.matter.model.rsp.AcceptRspInfo;
import com.lilosoft.complex.matter.model.rsp.LoginRspInfo;
import com.lilosoft.complex.matter.model.rsp.MatterListInfo;
import com.lilosoft.complex.matter.model.rsp.MatterRespInfo;
import com.lilosoft.complex.matter.model.rsp.matter.ChildrenItem;
import com.lilosoft.complex.matter.model.rsp.matter.MatterWorkInfo;
import com.lilosoft.complex.matter.service.IComplexMatterService;
import com.lilosoft.core.enums.TypeEnum;
import com.lilosoft.core.enums.YesNoEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 危险化学品经营许可法人变更
*
* @author:
* @date: 2023/7/31 15:15
*/
@Slf4j
public class YLJGZYBGFRBG extends ComplexWindowAbstract {
private IComplexMatterService complexMatterService;
public static String matterName = "医疗机构执业变更";
public YLJGZYBGFRBG(String type) {
super(type);
this.complexMatterService = SpringUtil.getBean(IComplexMatterService.class);
}
@Override
String getType() {
return TypeEnum.医疗机构执业变更法人变更.getValue();
}
@Override
public void doHandleWork(CommonData commonData) {
log.info("commonData = " + JSON.toJSONString(commonData));
//下载附件
List<FileDataItem> fileCollect = commonData.getFileData().stream().map(item -> {
FileDataItem fileDataItem = new FileDataItem();
BeanUtils.copyProperties(item, fileDataItem);
String downloadPath = commonData.getRobertServerUrl()+"aiCase/download?fileUrl=" + item.getFileUrl();
byte[] bytes = HttpUtil.downloadBytes(downloadPath);
fileDataItem.setBytes(bytes);
return fileDataItem;
}).collect(Collectors.toList());
//通过名称查询
DeviceLoginReq deviceLoginReq = new DeviceLoginReq();
deviceLoginReq.setDeviceLogo(commonData.getDeviceLogo());
Rest<LoginRspInfo> loginRspInfoRest = complexMatterService.deviceLogin(deviceLoginReq);
if (loginRspInfoRest.getCode() == YesNoEnum.YES.getValue()) {
//设备登录成功 上传附件
fileCollect.stream().forEach(item -> {
Rest<String> uploadFileRest = complexMatterService.uploadFile(commonData.getDeviceLogo(), item.getBytes(), item.getFileName());
if (uploadFileRest.getCode() == YesNoEnum.YES.getValue()) {
item.setDownloadUrl(uploadFileRest.getData());
}
});
//通过事项查询eventId
ImplementationReq implementationReq = new ImplementationReq();
implementationReq.setImplementName(matterName);
Rest<MatterListInfo> matterRest = complexMatterService.findMatters(commonData.getDeviceLogo(), implementationReq);
log.info("matterRest = " + JSON.toJSONString(matterRest));
if (matterRest.getCode() == YesNoEnum.YES.getValue()) {
List<MatterRespInfo> matterListInfos = matterRest.getData().getRecords();
MatterRespInfo matterRespInfo = null;
if (!ObjectUtils.isEmpty(matterListInfos)) {
matterRespInfo = matterListInfos.stream().filter(f -> "11511200MB1887563L300012300400009".equals(f.getHandlingItemCode())).findFirst().orElseGet(() -> null);
if(matterRespInfo != null){
String eventId = matterRespInfo.getEventId();
String eventObjectType = matterRespInfo.getEventObjectType();
AcceptReq acceptReq = new AcceptReq();
//查询办理事项情形
Rest<MatterWorkInfo> matterWorkInfoRest = complexMatterService.doWorkMatterSearch(commonData.getDeviceLogo(), eventId);
log.info("matterWorkInfoRest = " + JSON.toJSONString(matterWorkInfoRest));
if (matterWorkInfoRest.getCode() == YesNoEnum.YES.getValue()) {
MatterWorkInfo matterWorkInfo = matterWorkInfoRest.getData();
ChildrenItem childrenItem = matterWorkInfo.getChildren().stream().filter(f -> "医疗机构执业许可证变更法定代表人及负责人".equals(f.getLabel())).findFirst().orElseGet(() -> null);
if (!ObjectUtils.isEmpty(childrenItem)) {
String situationItemId = childrenItem.getSituationItemId();
acceptReq.getItemsIds().add(situationItemId);
//构建受理材料附件
List<MaterialsItem> materialsItemList = childrenItem.getMaterials().stream().map(item -> {
MaterialsItem materialsItem = new MaterialsItem();
String name = item.getName();
if (StrUtil.contains(name, "负责人医师资格证")) {
matchUploadFile(fileCollect, materialsItem, "申请变更登记情况页");
} else if (StrUtil.contains(name, "履历表")) {
matchUploadFile(fileCollect, materialsItem, "上级主管部门意见页");
} else if (StrUtil.contains(name, "变更登记注册书")) {
matchUploadFile(fileCollect, materialsItem, "医疗机构变更登记页");
} else if (StrUtil.contains(name, "任免职证明文件")) {
matchUploadFile(fileCollect, materialsItem, "核准变更登记事项页");
} else if (StrUtil.contains(name, "法定代表人签字表")) {
matchUploadFile(fileCollect, materialsItem, "核发医疗机构执业许可证");
} else if (StrUtil.contains(name, "医疗机构执业许可证")) {
matchUploadFile(fileCollect, materialsItem, "许可证副本");
}
materialsItem.setMaterialForm(item.getFromId());
materialsItem.setMaterialId(item.getId());
return materialsItem;
}).collect(Collectors.toList());
acceptReq.setMaterials(materialsItemList);
}
}
//提交响应的受理
List<HandlingsItem> handlingsItemList = new ArrayList<>();
HandlingsItem handlingsItem = new HandlingsItem();
handlingsItem.setEventId(eventId);
handlingsItem.setObjectType(eventObjectType);
handlingsItemList.add(handlingsItem);
acceptReq.setHandlings(handlingsItemList);
//申请人信息
ApplicantLeagal applicantLeagal = new ApplicantLeagal();
applicantLeagal.setPhone(commonData.getApplicantPhone());
applicantLeagal.setApplicantSex(commonData.getApplicantSex());
applicantLeagal.setDocumentId(commonData.getApplicantDocumentId());
applicantLeagal.setApplicantName(commonData.getApplicantName());
applicantLeagal.setApplicantIdNumber(commonData.getApplicantIdNumber());
acceptReq.setApplicantLegal(applicantLeagal);
//法人信息
LegalProxy legalProxy = new LegalProxy();
legalProxy.setLegalName(commonData.getLegalName());
legalProxy.setLegalIdNumber(commonData.getLegalIdNumber());
legalProxy.setDocumentId(commonData.getLegalDocumentId());
acceptReq.setLegalProxy(legalProxy);
Rest<List<AcceptRspInfo>> acceptRest = complexMatterService.accept(commonData.getDeviceLogo(), acceptReq);
log.info("受理返回==>{}", JSON.toJSONString(acceptRest));
if (acceptRest.getCode() == YesNoEnum.YES.getValue()) {
log.info("操作成功==>{}", JSON.toJSONString(acceptRest));
}
}else {
log.error("未查询到匹配事项 ==>{}",JSON.toJSONString(matterRest));
}
}else {
log.error("返回事项列表为空 ==>{}",JSON.toJSONString(matterRest));
}
}
}
}
private static void matchUploadFile(List<FileDataItem> fileCollect, MaterialsItem materialsItem, String fileName) {
FileDataItem fileDataItem = fileCollect.stream().filter(f -> StrUtil.contains(f.getName(), fileName)).findFirst().orElseGet(() -> null);
if (!ObjectUtils.isEmpty(fileDataItem)) {
materialsItem.setUploadFileName(fileDataItem.getFileName());
materialsItem.setMaterialPath(fileDataItem.getDownloadUrl());
}
}
}
package com.lilosoft.api.service.complexWindow;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.lilosoft.api.bean.receive.FileDataItem;
import com.lilosoft.complex.Rest;
import com.lilosoft.complex.matter.model.req.*;
import com.lilosoft.complex.matter.model.rsp.AcceptRspInfo;
import com.lilosoft.complex.matter.model.rsp.LoginRspInfo;
import com.lilosoft.complex.matter.model.rsp.MatterListInfo;
import com.lilosoft.complex.matter.model.rsp.MatterRespInfo;
import com.lilosoft.complex.matter.model.rsp.matter.ChildrenItem;
import com.lilosoft.complex.matter.model.rsp.matter.MatterWorkInfo;
import com.lilosoft.complex.matter.service.IComplexMatterService;
import com.lilosoft.core.enums.TypeEnum;
import com.lilosoft.core.enums.YesNoEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 危险化学品经营许可法人变更
*
* @author:
* @date: 2023/7/31 15:15
*/
@Slf4j
public class YLJGZYBGZJBG extends ComplexWindowAbstract {
private IComplexMatterService complexMatterService;
public static String matterName = "医疗机构执业变更";
public YLJGZYBGZJBG(String type) {
super(type);
this.complexMatterService = SpringUtil.getBean(IComplexMatterService.class);
}
@Override
String getType() {
return TypeEnum.医疗机构执业变更资金变更.getValue();
}
@Override
public void doHandleWork(CommonData commonData) {
log.info("commonData = " + JSON.toJSONString(commonData));
//下载附件
List<FileDataItem> fileCollect = commonData.getFileData().stream().map(item -> {
FileDataItem fileDataItem = new FileDataItem();
BeanUtils.copyProperties(item, fileDataItem);
String downloadPath = commonData.getRobertServerUrl()+"aiCase/download?fileUrl=" + item.getFileUrl();
byte[] bytes = HttpUtil.downloadBytes(downloadPath);
fileDataItem.setBytes(bytes);
return fileDataItem;
}).collect(Collectors.toList());
//通过名称查询
DeviceLoginReq deviceLoginReq = new DeviceLoginReq();
deviceLoginReq.setDeviceLogo(commonData.getDeviceLogo());
Rest<LoginRspInfo> loginRspInfoRest = complexMatterService.deviceLogin(deviceLoginReq);
if (loginRspInfoRest.getCode() == YesNoEnum.YES.getValue()) {
//设备登录成功 上传附件
fileCollect.stream().forEach(item -> {
Rest<String> uploadFileRest = complexMatterService.uploadFile(commonData.getDeviceLogo(), item.getBytes(), item.getFileName());
if (uploadFileRest.getCode() == YesNoEnum.YES.getValue()) {
item.setDownloadUrl(uploadFileRest.getData());
}
});
//通过事项查询eventId
ImplementationReq implementationReq = new ImplementationReq();
implementationReq.setImplementName(matterName);
Rest<MatterListInfo> matterRest = complexMatterService.findMatters(commonData.getDeviceLogo(), implementationReq);
log.info("matterRest = " + JSON.toJSONString(matterRest));
if (matterRest.getCode() == YesNoEnum.YES.getValue()) {
List<MatterRespInfo> matterListInfos = matterRest.getData().getRecords();
MatterRespInfo matterRespInfo = null;
if (!ObjectUtils.isEmpty(matterListInfos)) {
matterRespInfo = matterListInfos.stream().filter(f -> "11511200MB1887563L300012300400009".equals(f.getHandlingItemCode())).findFirst().orElseGet(() -> null);
if(matterRespInfo != null){
String eventId = matterRespInfo.getEventId();
String eventObjectType = matterRespInfo.getEventObjectType();
AcceptReq acceptReq = new AcceptReq();
//查询办理事项情形
Rest<MatterWorkInfo> matterWorkInfoRest = complexMatterService.doWorkMatterSearch(commonData.getDeviceLogo(), eventId);
log.info("matterWorkInfoRest = " + JSON.toJSONString(matterWorkInfoRest));
if (matterWorkInfoRest.getCode() == YesNoEnum.YES.getValue()) {
MatterWorkInfo matterWorkInfo = matterWorkInfoRest.getData();
ChildrenItem childrenItem = matterWorkInfo.getChildren().stream().filter(f -> "医疗机构执业许可证变更注册资金".equals(f.getLabel())).findFirst().orElseGet(() -> null);
if (!ObjectUtils.isEmpty(childrenItem)) {
String situationItemId = childrenItem.getSituationItemId();
acceptReq.getItemsIds().add(situationItemId);
//构建受理材料附件
List<MaterialsItem> materialsItemList = childrenItem.getMaterials().stream().map(item -> {
MaterialsItem materialsItem = new MaterialsItem();
String name = item.getName();
if (StrUtil.contains(name, "医疗机构执业许可证")) {
matchUploadFile(fileCollect, materialsItem, "许可证");
} else if (StrUtil.contains(name, "证明材料")) {
matchUploadFile(fileCollect, materialsItem, "公告情况");
} else if (StrUtil.contains(name, "变更登记注册书")) {
matchUploadFile(fileCollect, materialsItem, "医疗机构变更登记页");
}
materialsItem.setMaterialForm(item.getFromId());
materialsItem.setMaterialId(item.getId());
return materialsItem;
}).collect(Collectors.toList());
acceptReq.setMaterials(materialsItemList);
}
}
//提交响应的受理
List<HandlingsItem> handlingsItemList = new ArrayList<>();
HandlingsItem handlingsItem = new HandlingsItem();
handlingsItem.setEventId(eventId);
handlingsItem.setObjectType(eventObjectType);
handlingsItemList.add(handlingsItem);
acceptReq.setHandlings(handlingsItemList);
//申请人信息
ApplicantLeagal applicantLeagal = new ApplicantLeagal();
applicantLeagal.setPhone(commonData.getApplicantPhone());
applicantLeagal.setApplicantSex(commonData.getApplicantSex());
applicantLeagal.setDocumentId(commonData.getApplicantDocumentId());
applicantLeagal.setApplicantName(commonData.getApplicantName());
applicantLeagal.setApplicantIdNumber(commonData.getApplicantIdNumber());
acceptReq.setApplicantLegal(applicantLeagal);
//法人信息
LegalProxy legalProxy = new LegalProxy();
legalProxy.setLegalName(commonData.getLegalName());
legalProxy.setLegalIdNumber(commonData.getLegalIdNumber());
legalProxy.setDocumentId(commonData.getLegalDocumentId());
acceptReq.setLegalProxy(legalProxy);
Rest<List<AcceptRspInfo>> acceptRest = complexMatterService.accept(commonData.getDeviceLogo(), acceptReq);
log.info("受理返回==>{}", JSON.toJSONString(acceptRest));
if (acceptRest.getCode() == YesNoEnum.YES.getValue()) {
log.info("操作成功==>{}", JSON.toJSONString(acceptRest));
}
}else {
log.error("未查询到匹配事项 ==>{}",JSON.toJSONString(matterRest));
}
}else {
log.error("返回事项列表为空 ==>{}",JSON.toJSONString(matterRest));
}
}
}
}
private static void matchUploadFile(List<FileDataItem> fileCollect, MaterialsItem materialsItem, String fileName) {
FileDataItem fileDataItem = fileCollect.stream().filter(f -> StrUtil.contains(f.getName(), fileName)).findFirst().orElseGet(() -> null);
if (!ObjectUtils.isEmpty(fileDataItem)) {
materialsItem.setUploadFileName(fileDataItem.getFileName());
materialsItem.setMaterialPath(fileDataItem.getDownloadUrl());
}
}
}
...@@ -10,6 +10,9 @@ import java.util.Map; ...@@ -10,6 +10,9 @@ import java.util.Map;
*/ */
public enum TypeEnum { public enum TypeEnum {
危险化学品经营许可法人变更("wxhxpjyxkfrbg20231007", "危险化学品经营许可法人变更"), 危险化学品经营许可法人变更("wxhxpjyxkfrbg20231007", "危险化学品经营许可法人变更"),
危险化学品经营许可变更("wxhxpjyxkbg20231116","危险化学品经营许可变更"),
医疗机构执业变更资金变更("yljgzzybgzjbg20231120","医疗机构执业变更-资金变更"),
医疗机构执业变更法人变更("11511200MB1887563L300012300400009","医疗机构执业变更-法人变更"),
; ;
private String value; private String value;
private String desc; private String desc;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment