Commit efbe2550 authored by shenxin's avatar shenxin

蓉易办推送数据

parent 1c9c0592
...@@ -15,9 +15,11 @@ import java.util.Map; ...@@ -15,9 +15,11 @@ import java.util.Map;
public enum NodeTypeEnum { public enum NodeTypeEnum {
受理("BusiType_1","11","受理"), 受理("BusiType_1","11","受理"),
蓉易办受理("BusiType_21","21","蓉易办受理"),
蓉易办环节("BusiType_22","22","蓉易办环节"),
审查("BusiType_13","21","审查"), 审查("BusiType_13","21","审查"),
决定("BusiType_8","41","决定"), 决定("BusiType_8","41","决定"),
已提交("BusiType_12","61","已提交"), 已提交("BusiType_23","23","已提交"),
办结("end","81","办结"); 办结("end","81","办结");
private String code; private String code;
......
...@@ -3,18 +3,21 @@ package com.mortals.xhx.modules.information.service; ...@@ -3,18 +3,21 @@ package com.mortals.xhx.modules.information.service;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.modules.information.model.InformationEntity; import com.mortals.xhx.modules.information.model.InformationEntity;
import java.util.List;
/** /**
* <p>Title: 办件信息</p> * <p>Title: 办件信息</p>
* <p>Description: InformationService service接口 </p> * <p>Description: InformationService service接口 </p>
* <p>Copyright: Copyright &reg; </p> * <p>Copyright: Copyright &reg; </p>
* @version 1.0.0 *
*/ * @version 1.0.0
*/
public interface InformationService extends ICRUDService<InformationEntity,Long>{ public interface InformationService extends ICRUDService<InformationEntity, Long> {
void applyAndAccept(); void applyAndAccept(List<InformationEntity> informationEntities);
void submitLinkData(); void submitLinkData(List<InformationEntity> informationEntities);
void pushMaxNum(); void pushMaxNum();
} }
\ No newline at end of file
...@@ -54,23 +54,23 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -54,23 +54,23 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
private RybMatterDao rybMatterDao; private RybMatterDao rybMatterDao;
@Override @Override
public void applyAndAccept() { public void applyAndAccept(List<InformationEntity> informationEntities) {
PageInfo pageInfo = new PageInfo(); log.info("开始推送申请并受理理数据");
pageInfo.setPrePageResult(pageSize); if(CollectionUtils.isEmpty(informationEntities)){
InformationQuery informationQuery = new InformationQuery(); log.info("没有需要推送申请并受理理数据");
informationQuery.setNodeType("BusiType_1"); return;
informationQuery.setIsReport("0");
List<InformationEntity> informationEntities = informationService.find(informationQuery, pageInfo, null).getList();
List<InformationEntity> entities = informationEntities.parallelStream().map(e -> {
try {
Thread.sleep(applyAndAcceptSleep);
} catch (InterruptedException e1) {
e1.printStackTrace();
} }
List<InformationEntity> entities = informationEntities.parallelStream().map(e -> {
// try {
// Thread.sleep(applyAndAcceptSleep);
// } catch (InterruptedException e1) {
// e1.printStackTrace();
// }
//组装参数 //组装参数
HashMap<String, Object> stringObjectHashMap = assemblyParameters(e); HashMap<String, Object> stringObjectHashMap = assemblyParameters(e);
if(stringObjectHashMap == null){ if(stringObjectHashMap == null){
log.info("推送失败,没有该办件所对应的事项部门编码!"); log.info("推送失败,没有该办件所对应的事项部门编码!");
e.setFailReason("推送失败,没有该办件所对应的事项部门编码!");
e.setIsReport("1"); e.setIsReport("1");
e.setIsSuccess("0"); e.setIsSuccess("0");
return e; return e;
...@@ -81,8 +81,8 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -81,8 +81,8 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
e.setAcceptPhone(map.get("receiveuserphone")); e.setAcceptPhone(map.get("receiveuserphone"));
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("jsonData", JSONObject.toJSONString(stringObjectHashMap)); params.put("jsonData", JSONObject.toJSONString(stringObjectHashMap));
log.info("参数: " + params);
HttpRequest key = HttpUtil.createPost("https://10.1.235.51:4433/gateway/api/1/wllz/bjsqtjbsl/zs") HttpRequest key = HttpUtil.createPost("https://10.1.235.51:4433/gateway/api/1/wllz/bjsqtjbsl/zs")
// HttpRequest key = HttpUtil.createPost("http://192.168.0.222:17011/m/supplement/test")
.header("AppKey", "743109085582327808") .header("AppKey", "743109085582327808")
.header("Content-Type", "application/x-www-form-urlencoded;charset=utf-8").form(params); .header("Content-Type", "application/x-www-form-urlencoded;charset=utf-8").form(params);
HttpResponse appKey = key.execute().charset("utf-8"); HttpResponse appKey = key.execute().charset("utf-8");
...@@ -93,19 +93,21 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -93,19 +93,21 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
log.info("推送成功"); log.info("推送成功");
e.setIsReport("1"); e.setIsReport("1");
e.setIsSuccess("1"); e.setIsSuccess("1");
e.setBizStatus(NodeTypeEnum.办结.getDesc()); e.setBizStatus(NodeTypeEnum.蓉易办环节.getDesc());
e.setNodeType(NodeTypeEnum.办结.getCode()); e.setNodeType(NodeTypeEnum.蓉易办环节.getCode());
//默认区间3~20分钟 //默认区间3~20分钟
e.setCreateTime(DateByAffairUtils.getTimeByAddRandomDouble(DateTime.now(), null, null)); e.setCreateTime(DateByAffairUtils.getTimeByAddRandomDouble(DateTime.now(), null, null));
e.setOfficeCode(data.getJSONObject("custom").getJSONObject("content").getString("flowsn")); e.setOfficeCode(data.getJSONObject("custom").getJSONObject("content").getString("flowsn"));
} else { } else {
log.info("推送失败:" + jsonObject); log.info("推送失败:" + jsonObject);
e.setFailReason(jsonObject.toString());
e.setIsReport("1"); e.setIsReport("1");
e.setIsSuccess("0"); e.setIsSuccess("0");
} }
e.setProcessStatusName(NodeTypeEnum.蓉易办受理.getValue());
return e; return e;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
log.info("推送完成"); log.info("申请受理推送完成");
informationService.update(entities, null); informationService.update(entities, null);
} }
...@@ -307,27 +309,25 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -307,27 +309,25 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
} }
@Override @Override
public void submitLinkData() { public void submitLinkData(List<InformationEntity> informationEntities) {
PageInfo pageInfo = new PageInfo(); log.info("开始推送申请并受理理数据");
pageInfo.setPrePageResult(pageSize); if(CollectionUtils.isEmpty(informationEntities)){
InformationQuery informationQuery = new InformationQuery(); log.info("没有需要推送办件环节数据");
informationQuery.setNodeType(NodeTypeEnum.办结.getCode()); return;
informationQuery.setIsReport("1");
informationQuery.setIsSuccess("1");
List<InformationEntity> informationEntities = informationService.find(informationQuery, pageInfo, null).getList();
List<InformationEntity> collect = informationEntities.parallelStream().map(e -> {
try {
Thread.sleep(applyAndAcceptSleep);
} catch (InterruptedException e1) {
e1.printStackTrace();
} }
List<InformationEntity> collect = informationEntities.parallelStream().map(e -> {
// try {
// Thread.sleep(applyAndAcceptSleep);
// } catch (InterruptedException e1) {
// e1.printStackTrace();
// }
//组装参数 //组装参数
HashMap<String, Object> stringObjectHashMap = assemblyParametersLink(e); HashMap<String, Object> stringObjectHashMap = assemblyParametersLink(e);
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("jsonData", JSONObject.toJSONString(stringObjectHashMap)); params.put("jsonData", JSONObject.toJSONString(stringObjectHashMap));
log.info("参数:" + params);
String appKey = HttpUtil String appKey = HttpUtil
.createPost("https://10.1.235.51:4433/gateway/api/1/wllz/bjhjgcsjts/zs").form(params) .createPost("https://10.1.235.51:4433/gateway/api/1/wllz/bjhjgcsjts/zs").form(params)
// .createPost("http://192.168.0.222:17011/m/supplement/test").form(params)
.header("AppKey", "743109085582327808") .header("AppKey", "743109085582327808")
.header("Content-Type", "application/x-www-form-urlencoded;charset=utf-8") .header("Content-Type", "application/x-www-form-urlencoded;charset=utf-8")
.execute() .execute()
...@@ -341,8 +341,10 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -341,8 +341,10 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
} else { } else {
log.info("提交失败:" + jsonObject); log.info("提交失败:" + jsonObject);
} }
e.setProcessStatusName(NodeTypeEnum.蓉易办环节.getValue());
return e; return e;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
log.info("办件环节推送完成");
informationService.update(collect, null); informationService.update(collect, null);
} }
......
package com.mortals.xhx.modules.information.task;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.common.code.NodeTypeEnum;
import com.mortals.xhx.modules.information.model.InformationEntity;
import com.mortals.xhx.modules.information.service.InformationService;
import com.mortals.xhx.modules.service.QueryInformationServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author shenxin
* @Date: 2021/11/17-16:28
* @Description:办件数据推送蓉易办(申请并受理)
*/
@Slf4j
@Component("rybApplyAndAcceptInformationTaskImpl")
public class RybApplyAndAcceptInformationTaskImpl implements ITaskExcuteService {
@Autowired
private InformationService informationService;
@Autowired
private QueryInformationServiceImpl queryInformationService;
@Override
public void excuteTask(ITask task) throws AppException {
//1.查询上月的表是否存在未推送的数据
List<InformationEntity> informationEntities =
queryInformationService.queryDataThatHasNotBeenPushed(NodeTypeEnum.蓉易办受理.getCode(), "1", "0", task.getExcuteParam());
//组装申请并受理数据推送一体化平台
informationService.applyAndAccept(informationEntities);
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
package com.mortals.xhx.modules.information.task;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.common.code.NodeTypeEnum;
import com.mortals.xhx.modules.information.model.InformationEntity;
import com.mortals.xhx.modules.information.service.InformationService;
import com.mortals.xhx.modules.service.QueryInformationServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author shenxin
* @Date: 2021/11/17-16:28
* @Description:办件数据推送蓉易办(办件环节)
*/
@Slf4j
@Component("rybSubmitLinkDataInformationTaskImpl")
public class RybSubmitLinkDataInformationTaskImpl implements ITaskExcuteService {
@Autowired
private InformationService informationService;
@Autowired
private QueryInformationServiceImpl queryInformationService;
@Override
public void excuteTask(ITask task) throws AppException {
//1.查询上月的表是否存在未推送的数据
List<InformationEntity> informationEntities =
queryInformationService.queryDataThatHasNotBeenPushed(NodeTypeEnum.蓉易办环节.getCode(), "1", "1", task.getExcuteParam());
//办件环节数据推送蓉易办
informationService.submitLinkData(informationEntities);
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
...@@ -144,20 +144,20 @@ public class InformationController extends BaseCRUDJsonController<InformationSer ...@@ -144,20 +144,20 @@ public class InformationController extends BaseCRUDJsonController<InformationSer
} }
/** // /**
* 推送蓉易办 // * 推送蓉易办
*/ // */
@GetMapping(value="pushRongyiOffice") // @GetMapping(value="pushRongyiOffice")
public void pushRongyiOffice(@RequestParam("isNumber")String isNumber){ // public void pushRongyiOffice(@RequestParam("isNumber")String isNumber){
if ("1".equals(isNumber)){ // if ("1".equals(isNumber)){
//蓉易办提交申请并受理 // //蓉易办提交申请并受理
informationService.applyAndAccept(); // informationService.applyAndAccept();
}else if ("2".equals(isNumber)){ // }else if ("2".equals(isNumber)){
//蓉易办提交环节数据 // //蓉易办提交环节数据
informationService.submitLinkData(); // informationService.submitLinkData();
} // }
//
} // }
/** /**
* 推送蓉易办测试每次最大推送数量 * 推送蓉易办测试每次最大推送数量
......
...@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -61,6 +62,7 @@ public class TemporaryDockingListener extends AnalysisEventListener<SupplementEn ...@@ -61,6 +62,7 @@ public class TemporaryDockingListener extends AnalysisEventListener<SupplementEn
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
supplementEntity.setApplyTime( supplementEntity.setApplyTime(
new SimpleDateFormat("yyyy-MM-dd").format(DateByAffairUtils.getDayRadomWorkingTime(simpleDateFormat.parse(dateTime), null, null))); new SimpleDateFormat("yyyy-MM-dd").format(DateByAffairUtils.getDayRadomWorkingTime(simpleDateFormat.parse(dateTime), null, null)));
supplementEntity.setCreateDate(new Date());
supplementEntity.setIsExecute("0"); supplementEntity.setIsExecute("0");
supplementEntity.setIsSuccess("0"); supplementEntity.setIsSuccess("0");
entityList.add(supplementEntity); entityList.add(supplementEntity);
......
package com.mortals.xhx.modules.supplement.task; package com.mortals.xhx.modules.supplement.task;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.ITask; import com.mortals.framework.service.ITask;
...@@ -56,23 +57,21 @@ public class SupplementTaskImpl implements ITaskExcuteService { ...@@ -56,23 +57,21 @@ public class SupplementTaskImpl implements ITaskExcuteService {
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
//TODO:因临时对接蓉易办暂时屏蔽,等后期蓉易办对接完成后放开 //TODO:因临时对接蓉易办暂时屏蔽,等后期蓉易办对接完成后放开
// //1.查询上月的表是否存在未清洗的数据 //1.查询上月的表是否存在未清洗的数据
// List<SupplementEntity> supplementEntities = queryDataThatHasNotBeenPushed(task.getExcuteParam()); List<SupplementEntity> supplementEntities = queryDataThatHasNotBeenPushed(task.getExcuteParam());
// //开始进行数据清洗 //开始进行数据清洗
this.ryb(supplementEntities);
// this.dataCleaning(supplementEntities); // this.dataCleaning(supplementEntities);
// this.temporaryDocking();
this.ryb();
} }
//TODO:因临时对接蓉易办,后期可删除 //TODO:因临时对接蓉易办,后期可删除
private void ryb() { private void ryb(List<SupplementEntity> supplementEntities) {
SupplementQuery supplementQuery = new SupplementQuery(); log.info("开始清洗");
supplementQuery.setIsExecute("0"); if(CollectionUtils.isEmpty(supplementEntities)){
supplementQuery.setIsSuccess("0"); log.info("没有需要清洗数据");
PageInfo pageInfo = new PageInfo(); return;
pageInfo.setPrePageResult(2000); }
List<InformationEntity> informationQueries = new ArrayList<>(); List<InformationEntity> informationQueries = new ArrayList<>();
List<SupplementEntity> supplementEntities = supplementService.find(supplementQuery, pageInfo, null).getList();
if (!supplementEntities.isEmpty()) { if (!supplementEntities.isEmpty()) {
List<SupplementEntity> collect = supplementEntities.parallelStream().map(e -> { List<SupplementEntity> collect = supplementEntities.parallelStream().map(e -> {
//TODO:查询实施清单信息,通过事项编码查询有问题(但因数据库存储的事项数据是条件过滤后的,故暂时不改动查询),后期改动 //TODO:查询实施清单信息,通过事项编码查询有问题(但因数据库存储的事项数据是条件过滤后的,故暂时不改动查询),后期改动
...@@ -117,64 +116,10 @@ public class SupplementTaskImpl implements ITaskExcuteService { ...@@ -117,64 +116,10 @@ public class SupplementTaskImpl implements ITaskExcuteService {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
supplementService.update(collect, null); supplementService.update(collect, null);
informationDao.insertBatch(informationQueries); informationDao.insertBatch(informationQueries);
log.info("清洗完成,本次清洗数量:"+ informationQueries.size());
} }
} }
//TODO:因临时对接蓉易办,后期可删除
private void temporaryDocking() {
SupplementQuery supplementQuery = new SupplementQuery();
supplementQuery.setIsExecute("0");
supplementQuery.setIsSuccess("0");
List<InformationEntity> informationQueries = new ArrayList<>();
List<SupplementEntity> supplementEntities = supplementService.find(supplementQuery, null);
if (!supplementEntities.isEmpty()) {
List<SupplementEntity> collect = supplementEntities.parallelStream().map(e -> {
//TODO:查询实施清单信息,通过事项编码查询有问题(但因数据库存储的事项数据是条件过滤后的,故暂时不改动查询),后期改动
ImplementlistEntity thImplement = implementlistService.getThImplement(e.getImplCode());
try {
InformationEntity informationQuery = new InformationEntity();
//组装第一次业务数据(清洗后的)
informationQuery = assemblyOfficeData(informationQuery, e);
if (null != thImplement) {
informationQuery.setDeptCode(thImplement.getDeptCode());
informationQuery.setAreaCode(thImplement.getAreaCode());
informationQuery.setEventCode(thImplement.getEventCode());
informationQuery.setEventName(thImplement.getEventName());
informationQuery.setIsCharge(thImplement.getIsCharges());
//是否转化成功:0默认 1成功
informationQuery.setIsSuccess("1");
//是否推送(0 否 1是)
informationQuery.setIsReport("0");
//设置 失败次数 默认为0
informationQuery.setFailTimes(0);
// 是否执行转化(0.未执行 1.已执行)
e.setIsExecute("1");
//是否转化成功(0默认 1成功)
e.setIsSuccess("1");
} else {
e.setFailReason(" Err:实施清单不存在");
informationQuery.setFailReason(" Err:实施清单不存在");
informationQuery.setIsSuccess("0");
// 是否执行转化(0.未执行 1.已执行)
e.setIsExecute("1");
//是否转化成功(0默认 1成功)
e.setIsSuccess("1");
}
e.setUpdateDate(DateTime.now());
informationQueries.add(informationQuery);
return e;
} catch (Exception ex) {
log.error("转换失败:SupplementID:" + e.getId());
log.error("转换失败:失败原因" + ex.getMessage());
return e;
}
}).collect(Collectors.toList());
supplementService.update(collect, null);
informationDao.insertBatch(informationQueries);
}
}
@Override @Override
public void stopTask(ITask task) throws AppException { public void stopTask(ITask task) throws AppException {
...@@ -277,8 +222,8 @@ public class SupplementTaskImpl implements ITaskExcuteService { ...@@ -277,8 +222,8 @@ public class SupplementTaskImpl implements ITaskExcuteService {
informationQuery.setSystemCode(supplementEntity.getSysCode()); informationQuery.setSystemCode(supplementEntity.getSysCode());
//测试暂时写死 //测试暂时写死
informationQuery.setNodeType(NodeTypeEnum.受理.getCode()); informationQuery.setNodeType(NodeTypeEnum.蓉易办受理.getCode());
informationQuery.setBizStatus(NodeTypeEnum.受理.getDesc()); informationQuery.setBizStatus(NodeTypeEnum.蓉易办受理.getDesc());
informationQuery.setProcessStatusName("申请并受理"); informationQuery.setProcessStatusName("申请并受理");
informationQuery.setDoThingProperty("0"); informationQuery.setDoThingProperty("0");
informationQuery.setApplyNum("1"); informationQuery.setApplyNum("1");
......
...@@ -105,6 +105,20 @@ public class SupplementController extends BaseCRUDJsonMappingController<Suppleme ...@@ -105,6 +105,20 @@ public class SupplementController extends BaseCRUDJsonMappingController<Suppleme
supplementTaskImpl.excuteTask(null); supplementTaskImpl.excuteTask(null);
} }
/*
*
* 蓉易办测试
* */
@PostMapping("test")
public String test(){
try {
Thread.sleep(500);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
return "{ \"code\": \"200\", \"message\": \"\", \"data\":\"{\"custom\":{\"code\":1,\"text\":\"推送成功\",\"content\":{\"projectguid\":\"31f069ea-7df0-45cc-81ed-dcbf32abbb55\",\"flowsn\":\"510100-20200803-000006\"}},\"status\":{\"code\":200,\"text\":\"\"}}\"}";
}
public SupplementController(){ public SupplementController(){
super.setFormClass(SupplementForm.class); super.setFormClass(SupplementForm.class);
super.setModuleDesc("办件补录表"); super.setModuleDesc("办件补录表");
......
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