Commit eccce7ba authored by shenxin's avatar shenxin

蓉易办推送数据

parent 232078e7
package com.mortals.xhx.modules.information.service.impl; package com.mortals.xhx.modules.information.service.impl;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.common.code.NodeTypeEnum; import com.mortals.xhx.common.code.NodeTypeEnum;
import com.mortals.xhx.common.utils.DateByAffairUtils; import com.mortals.xhx.common.utils.DateByAffairUtils;
import com.mortals.xhx.modules.implementlist.dao.RybMatterDao; import com.mortals.xhx.modules.implementlist.dao.RybMatterDao;
import com.mortals.xhx.modules.implementlist.model.ImplementlistEntity;
import com.mortals.xhx.modules.implementlist.model.ImplementlistQuery;
import com.mortals.xhx.modules.implementlist.model.RybMatterListEntry; import com.mortals.xhx.modules.implementlist.model.RybMatterListEntry;
import com.mortals.xhx.modules.implementlist.service.ImplementlistService;
import com.mortals.xhx.modules.information.dao.InformationDao; import com.mortals.xhx.modules.information.dao.InformationDao;
import com.mortals.xhx.modules.information.model.InformationEntity; import com.mortals.xhx.modules.information.model.InformationEntity;
import com.mortals.xhx.modules.information.model.InformationQuery; import com.mortals.xhx.modules.information.model.InformationQuery;
import com.mortals.xhx.modules.information.service.InformationService; import com.mortals.xhx.modules.information.service.InformationService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.formatter.qual.ReturnsFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -50,46 +41,47 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -50,46 +41,47 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
@Resource @Resource
private RybMatterDao rybMatterDao; private RybMatterDao rybMatterDao;
@Autowired
private ImplementlistService implementlistService;
@Override @Override
public void applyAndAccept() { public void applyAndAccept() {
PageInfo pageInfo = new PageInfo(); PageInfo pageInfo = new PageInfo();
pageInfo.setPrePageResult(100); pageInfo.setPrePageResult(100);
InformationQuery informationQuery = new InformationQuery(); InformationQuery informationQuery = new InformationQuery();
informationQuery.setNodeType("BusiType_1"); informationQuery.setNodeType("BusiType_1");
informationQuery.setIsReport("0");
List<InformationEntity> informationEntities = informationService.find(informationQuery, pageInfo, null).getList(); List<InformationEntity> informationEntities = informationService.find(informationQuery, pageInfo, null).getList();
List<HashMap<String, Object>> objects = new ArrayList<>(); List<HashMap<String, Object>> objects = new ArrayList<>();
List<InformationEntity> entities = informationEntities.parallelStream().map(e -> { List<InformationEntity> entities = informationEntities.parallelStream().map(e -> {
//组装参数 //组装参数
HashMap<String, Object> stringObjectHashMap = assemblyParameters(e); HashMap<String, Object> stringObjectHashMap = assemblyParameters(e);
objects.add(stringObjectHashMap); objects.add(stringObjectHashMap);
String appKey = HttpUtil Map<String, Object> params = new HashMap<>();
.createGet("https://171.221.172.95:4433/gateway/api/1/wllz/bjsqtjbsl/cs") params.put("jsonData", JSONObject.toJSONString(stringObjectHashMap));
.body(JSONObject.toJSONString(stringObjectHashMap)) log.info("参数: " + params);
HttpRequest key = HttpUtil.createPost("https://10.1.235.51:4433/gateway/api/1/wllz/bjsqtjbsl/zs")
.header("AppKey", "743109085582327808") .header("AppKey", "743109085582327808")
.execute() .header("Content-Type", "application/x-www-form-urlencoded;charset=utf-8").form(params);
.charset("utf-8") log.info("请求:" + key);
.body(); HttpResponse appKey = key.execute().charset("utf-8");
JSONObject jsonObject = JSONObject.parseObject(appKey); JSONObject jsonObject = JSONObject.parseObject(appKey.body());
if ("200".equals(jsonObject.getString("code"))) { log.info("响应:" + jsonObject);
JSONObject data = JSONObject.parseObject(jsonObject.getString("data"));
log.info("响应2:" + data);
if ("200".equals(jsonObject.getString("code")) && "1".equals(data.getJSONObject("custom").getString("code"))) {
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(jsonObject.getJSONObject("data").getJSONObject("custom").getJSONObject("content").getString("flowsn")); e.setOfficeCode(data.getJSONObject("custom").getJSONObject("content").getString("flowsn"));
log.info("推送成功");
} else { } else {
log.info("推送失败:" + jsonObject);
e.setIsReport("1"); e.setIsReport("1");
e.setIsSuccess("0"); e.setIsSuccess("0");
log.info("推送失败:"+jsonObject);
} }
return e; return e;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
log.info(JSONArray.toJSONString(objects));
informationService.update(entities, null); informationService.update(entities, null);
} }
...@@ -100,10 +92,13 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -100,10 +92,13 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
HashMap<String, Object> baseInfoMap = new HashMap<>(16); HashMap<String, Object> baseInfoMap = new HashMap<>(16);
baseInfoMap.put("projectname", e.getEventName()); baseInfoMap.put("projectname", e.getEventName());
baseInfoMap.put("applyway", "20"); baseInfoMap.put("applyway", "20");
if ("2".equals(e.getApplicantAttributes())) { if (e.getApplicantAttributes() == 2) {
baseInfoMap.put("applyertype", "20"); baseInfoMap.put("applyertype", "20");
} else { } else {
baseInfoMap.put("applyertype", "10"); baseInfoMap.put("applyertype", "10");
baseInfoMap.put("legal", e.getLegalPerson());
baseInfoMap.put("legalpersoncardtype", "");
baseInfoMap.put("legalpersonidcard", "");
} }
baseInfoMap.put("applyername", e.getApplicantName()); baseInfoMap.put("applyername", e.getApplicantName());
baseInfoMap.put("applyersex", e.getApplicantSex()); baseInfoMap.put("applyersex", e.getApplicantSex());
...@@ -113,7 +108,7 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -113,7 +108,7 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
baseInfoMap.put("contactmobile", e.getContactPhone()); baseInfoMap.put("contactmobile", e.getContactPhone());
baseInfoMap.put("contactperson", e.getContactName()); baseInfoMap.put("contactperson", e.getContactName());
baseInfoMap.putAll(randomlyExtractPersonnelInformation()); baseInfoMap.putAll(randomlyExtractPersonnelInformation());
baseInfoMap.put("receivedate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(e.getCreateTime())); baseInfoMap.put("receivedate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(e.getCreateTime()));
RybMatterListEntry entry = rybMatterDao.find(e.getEventCode()).get(0); RybMatterListEntry entry = rybMatterDao.find(e.getEventCode()).get(0);
if (null != entry) { if (null != entry) {
baseInfoMap.put("tasktype", entry.getMatterType()); baseInfoMap.put("tasktype", entry.getMatterType());
...@@ -125,7 +120,8 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -125,7 +120,8 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
baseInfoMap.put("eventcode", entry.getMatterCode()); baseInfoMap.put("eventcode", entry.getMatterCode());
baseInfoMap.put("areacode", e.getAreaCode()); baseInfoMap.put("areacode", e.getAreaCode());
baseInfoMap.put("source", e.getAreaCode()); baseInfoMap.put("source", e.getAreaCode());
baseInfoMap.put("contactIdCard", e.getContactIdCard()); baseInfoMap.put("contactcertnum", e.getContactIdCard());
baseInfoMap.put("contactidcard", e.getContactIdCard());
dataMap.put("params", baseInfoMap); dataMap.put("params", baseInfoMap);
return dataMap; return dataMap;
} }
...@@ -134,102 +130,140 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -134,102 +130,140 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
HashMap<String, String> dataMap = new HashMap<>(16); HashMap<String, String> dataMap = new HashMap<>(16);
Random random = new Random(); Random random = new Random();
int i = random.nextInt(19); int i = random.nextInt(19);
switch (i){ switch (i) {
case 0: { case 0: {
dataMap.put("receiveusername","陈丽娜"); dataMap.put("receiveusername", "陈丽娜");
dataMap.put("receiveuseridcard","510121198605260045"); dataMap.put("receiveuseridcard", "510121198605260045");
dataMap.put("receiveuserphone","13880461766"); dataMap.put("receiveuserphone", "13880461766");
};break; }
;
break;
case 1: { case 1: {
dataMap.put("receiveusername","阳辉强"); dataMap.put("receiveusername", "阳辉强");
dataMap.put("receiveuseridcard","510121199012101051"); dataMap.put("receiveuseridcard", "510121199012101051");
dataMap.put("receiveuserphone","15882486917"); dataMap.put("receiveuserphone", "15882486917");
};break; }
;
break;
case 2: { case 2: {
dataMap.put("receiveusername","陈雯"); dataMap.put("receiveusername", "陈雯");
dataMap.put("receiveuseridcard","510121198105266088"); dataMap.put("receiveuseridcard", "510121198105266088");
dataMap.put("receiveuserphone","13551872266"); dataMap.put("receiveuserphone", "13551872266");
};break; }
;
break;
case 3: { case 3: {
dataMap.put("receiveusername","李琳"); dataMap.put("receiveusername", "李琳");
dataMap.put("receiveuseridcard","510121197308010029"); dataMap.put("receiveuseridcard", "510121197308010029");
dataMap.put("receiveuserphone","13880367238"); dataMap.put("receiveuserphone", "13880367238");
};break; }
;
break;
case 4: { case 4: {
dataMap.put("receiveusername","黄家玲"); dataMap.put("receiveusername", "黄家玲");
dataMap.put("receiveuseridcard","511302199308260062"); dataMap.put("receiveuseridcard", "511302199308260062");
dataMap.put("receiveuserphone","18111572752"); dataMap.put("receiveuserphone", "18111572752");
};break; }
;
break;
case 5: { case 5: {
dataMap.put("receiveusername","张丁月"); dataMap.put("receiveusername", "张丁月");
dataMap.put("receiveuseridcard","510121199312101029"); dataMap.put("receiveuseridcard", "510121199312101029");
dataMap.put("receiveuserphone","18111572752"); dataMap.put("receiveuserphone", "18111572752");
};break; }
;
break;
case 6: { case 6: {
dataMap.put("receiveusername","廖鸥"); dataMap.put("receiveusername", "廖鸥");
dataMap.put("receiveuseridcard","510121199410040020"); dataMap.put("receiveuseridcard", "510121199410040020");
dataMap.put("receiveuserphone","13699070588"); dataMap.put("receiveuserphone", "13699070588");
};break; }
;
break;
case 7: { case 7: {
dataMap.put("receiveusername","唐泽"); dataMap.put("receiveusername", "唐泽");
dataMap.put("receiveuseridcard","510121199503296076"); dataMap.put("receiveuseridcard", "510121199503296076");
dataMap.put("receiveuserphone","15202806722"); dataMap.put("receiveuserphone", "15202806722");
};break; }
;
break;
case 8: { case 8: {
dataMap.put("receiveusername","高玲"); dataMap.put("receiveusername", "高玲");
dataMap.put("receiveuseridcard","510121199112256069"); dataMap.put("receiveuseridcard", "510121199112256069");
dataMap.put("receiveuserphone","13608192679"); dataMap.put("receiveuserphone", "13608192679");
};break; }
;
break;
case 9: { case 9: {
dataMap.put("receiveusername","胡红霞"); dataMap.put("receiveusername", "胡红霞");
dataMap.put("receiveuseridcard","510121197907215288"); dataMap.put("receiveuseridcard", "510121197907215288");
dataMap.put("receiveuserphone","18980958260"); dataMap.put("receiveuserphone", "18980958260");
};break; }
;
break;
case 10: { case 10: {
dataMap.put("receiveusername","唐瑶"); dataMap.put("receiveusername", "唐瑶");
dataMap.put("receiveuseridcard","510121199812318865"); dataMap.put("receiveuseridcard", "510121199812318865");
dataMap.put("receiveuserphone","15228964765"); dataMap.put("receiveuserphone", "15228964765");
};break; }
;
break;
case 11: { case 11: {
dataMap.put("receiveusername","陈雯"); dataMap.put("receiveusername", "陈雯");
dataMap.put("receiveuseridcard","510121198105266088"); dataMap.put("receiveuseridcard", "510121198105266088");
dataMap.put("receiveuserphone","13551872266"); dataMap.put("receiveuserphone", "13551872266");
};break; }
;
break;
case 12: { case 12: {
dataMap.put("receiveusername","曾华"); dataMap.put("receiveusername", "曾华");
dataMap.put("receiveuseridcard","51012119711230122"); dataMap.put("receiveuseridcard", "51012119711230122");
dataMap.put("receiveuserphone","13438829733"); dataMap.put("receiveuserphone", "13438829733");
};break; }
;
break;
case 13: { case 13: {
dataMap.put("receiveusername","李琳"); dataMap.put("receiveusername", "李琳");
dataMap.put("receiveuseridcard","510121197308010029"); dataMap.put("receiveuseridcard", "510121197308010029");
dataMap.put("receiveuserphone","13880367238"); dataMap.put("receiveuserphone", "13880367238");
};break; }
;
break;
case 14: { case 14: {
dataMap.put("receiveusername","肖开泉"); dataMap.put("receiveusername", "肖开泉");
dataMap.put("receiveuseridcard","510121196810019219"); dataMap.put("receiveuseridcard", "510121196810019219");
dataMap.put("receiveuserphone","15828660138"); dataMap.put("receiveuserphone", "15828660138");
};break; }
;
break;
case 15: { case 15: {
dataMap.put("receiveusername","唐小芳"); dataMap.put("receiveusername", "唐小芳");
dataMap.put("receiveuseridcard","510121199410114843"); dataMap.put("receiveuseridcard", "510121199410114843");
dataMap.put("receiveuserphone","15881045053"); dataMap.put("receiveuserphone", "15881045053");
};break; }
;
break;
case 16: { case 16: {
dataMap.put("receiveusername","王何"); dataMap.put("receiveusername", "王何");
dataMap.put("receiveuseridcard","510121197504040014"); dataMap.put("receiveuseridcard", "510121197504040014");
dataMap.put("receiveuserphone","13880000262"); dataMap.put("receiveuserphone", "13880000262");
};break; }
;
break;
case 17: { case 17: {
dataMap.put("receiveusername","肖毛毛"); dataMap.put("receiveusername", "肖毛毛");
dataMap.put("receiveuseridcard","510121199108300047"); dataMap.put("receiveuseridcard", "510121199108300047");
dataMap.put("receiveuserphone","13668269394"); dataMap.put("receiveuserphone", "13668269394");
};break; }
;
break;
case 18: { case 18: {
dataMap.put("receiveusername","蒋熙揆"); dataMap.put("receiveusername", "蒋熙揆");
dataMap.put("receiveuseridcard","510921199206205215"); dataMap.put("receiveuseridcard", "510921199206205215");
dataMap.put("receiveuserphone","17808253623"); dataMap.put("receiveuserphone", "17808253623");
};break; }
;
break;
} }
return dataMap; return dataMap;
} }
...@@ -246,10 +280,12 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -246,10 +280,12 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
List<InformationEntity> collect = informationEntities.parallelStream().map(e -> { List<InformationEntity> collect = informationEntities.parallelStream().map(e -> {
//组装参数 //组装参数
HashMap<String, Object> stringObjectHashMap = assemblyParametersLink(e); HashMap<String, Object> stringObjectHashMap = assemblyParametersLink(e);
Map<String, Object> params = new HashMap<>();
params.put("jsonData", JSONObject.toJSONString(stringObjectHashMap));
String appKey = HttpUtil String appKey = HttpUtil
.createGet("https://171.221.172.95:4433/gateway/api/1/wllz/bjsqtjbsl/cs") .createPost("https://10.1.235.51:4433/gateway/api/1/wllz/bjsqtjbsl/zs").form(params)
.body(JSONObject.toJSONString(stringObjectHashMap))
.header("AppKey", "743109085582327808") .header("AppKey", "743109085582327808")
.header("Content-Type", "application/x-www-form-urlencoded;charset=utf-8")
.execute() .execute()
.charset("utf-8") .charset("utf-8")
.body(); .body();
...@@ -257,13 +293,13 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -257,13 +293,13 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
e.setBizStatus(NodeTypeEnum.已提交.getDesc()); e.setBizStatus(NodeTypeEnum.已提交.getDesc());
e.setNodeType(NodeTypeEnum.已提交.getCode()); e.setNodeType(NodeTypeEnum.已提交.getCode());
if ("200".equals(jsonObject.getString("code"))) { if ("200".equals(jsonObject.getString("code"))) {
log.info("提交成功"); log.info("提交成功:" + jsonObject);
} else { } else {
log.info("提交失败:" + jsonObject); log.info("提交失败:" + jsonObject);
} }
return e; return e;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
informationService.update(collect,null); informationService.update(collect, null);
} }
private HashMap<String, Object> assemblyParametersLink(InformationEntity e) { private HashMap<String, Object> assemblyParametersLink(InformationEntity e) {
......
...@@ -53,9 +53,6 @@ public class SupplementTaskImpl implements ITaskExcuteService { ...@@ -53,9 +53,6 @@ public class SupplementTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private InformationDao informationDao; private InformationDao informationDao;
@Resource
private RybMatterDao rybMatterDao;
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
//TODO:因临时对接蓉易办暂时屏蔽,等后期蓉易办对接完成后放开 //TODO:因临时对接蓉易办暂时屏蔽,等后期蓉易办对接完成后放开
......
...@@ -12,6 +12,7 @@ import com.mortals.xhx.modules.supplement.dao.SupplementDao; ...@@ -12,6 +12,7 @@ import com.mortals.xhx.modules.supplement.dao.SupplementDao;
import com.mortals.xhx.modules.supplement.listener.TemporaryDockingListener; import com.mortals.xhx.modules.supplement.listener.TemporaryDockingListener;
import com.mortals.xhx.modules.supplement.model.SupplementEntity; import com.mortals.xhx.modules.supplement.model.SupplementEntity;
import com.mortals.xhx.modules.supplement.service.SupplementService; import com.mortals.xhx.modules.supplement.service.SupplementService;
import com.mortals.xhx.modules.supplement.task.SupplementTaskImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -49,6 +50,9 @@ public class SupplementController extends BaseCRUDJsonMappingController<Suppleme ...@@ -49,6 +50,9 @@ public class SupplementController extends BaseCRUDJsonMappingController<Suppleme
@Autowired @Autowired
private SupplementDao supplementDao; private SupplementDao supplementDao;
@Autowired
private SupplementTaskImpl supplementTaskImpl;
/** /**
* 导入办件信息,一阶段通过excel表格导入,放入磁盘中,在通过文件地址去获取文件内容进行数据清洗 * 导入办件信息,一阶段通过excel表格导入,放入磁盘中,在通过文件地址去获取文件内容进行数据清洗
...@@ -92,7 +96,14 @@ public class SupplementController extends BaseCRUDJsonMappingController<Suppleme ...@@ -92,7 +96,14 @@ public class SupplementController extends BaseCRUDJsonMappingController<Suppleme
return respPdu; return respPdu;
} }
/*
*
* 蓉易办对接入口,清洗,临时接口,后期可删除,
* */
@RequestMapping("rybDocking")
public void rybDocking(){
supplementTaskImpl.excuteTask(null);
}
public SupplementController(){ public SupplementController(){
super.setFormClass(SupplementForm.class); super.setFormClass(SupplementForm.class);
......
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