Commit dc4df905 authored by shenxin's avatar shenxin

蓉易办推送数据

parent eccce7ba
package com.mortals.xhx.modules.implementlist.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.modules.implementlist.model.ImplementlistEntity;
import com.mortals.xhx.modules.implementlist.model.RybMatterListEntry;
import com.mortals.xhx.modules.implementlist.model.RybWorkEntry;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface RybWorkDao extends ICRUDDao<ImplementlistEntity,Long> {
List<RybWorkEntry> find(String deptCode);
}
package com.mortals.xhx.modules.implementlist.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.modules.implementlist.dao.RybMatterDao;
import com.mortals.xhx.modules.implementlist.dao.RybWorkDao;
import com.mortals.xhx.modules.implementlist.model.ImplementlistEntity;
import com.mortals.xhx.modules.implementlist.model.RybMatterListEntry;
import com.mortals.xhx.modules.implementlist.model.RybWorkEntry;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>Title: 实施清单主表</p>
* <p>Description: ImplementlistDaoImpl DAO接口 </p>
* @author
* @version 1.0.0
*/
@Repository("rybWordDao")
public class RybWorkDaoImpl extends BaseCRUDDaoMybatis<ImplementlistEntity,Long> implements RybWorkDao {
@Override
public List<RybWorkEntry> find(String deptCode) {
return getSqlSession().selectList(getSqlId("findRyb"),deptCode);
}
}
package com.mortals.xhx.modules.implementlist.model;
/**
* 蓉易办工作人员对接实体类
*/
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
import java.util.Date;
@Data
public class RybWorkEntry extends BaseEntityLong {
//部门编码
private String deptCode;
//部门名称
private String deptName;
//'接受人'
private String receiveUserName;
//'接收人身份证号'
private String receiveUserIdcard;
//'接收人号码'
private String receiveUserPhone;
}
...@@ -5,16 +5,20 @@ import cn.hutool.http.HttpRequest; ...@@ -5,16 +5,20 @@ import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.common.utils.CollectionUtils;
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.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.dao.RybWorkDao;
import com.mortals.xhx.modules.implementlist.model.RybMatterListEntry; import com.mortals.xhx.modules.implementlist.model.RybMatterListEntry;
import com.mortals.xhx.modules.implementlist.model.RybWorkEntry;
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 org.springframework.beans.factory.annotation.Value;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -34,25 +38,48 @@ import java.util.stream.Collectors; ...@@ -34,25 +38,48 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationDao, InformationEntity, Long> implements InformationService { public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationDao, InformationEntity, Long> implements InformationService {
@Value("${upload.long}")
Long applyAndAcceptSleep;
@Value("${upload.pageSize}")
Integer pageSize;
@Resource @Resource
private InformationService informationService; private InformationService informationService;
@Resource
private RybWorkDao rybWorkDao;
@Resource @Resource
private RybMatterDao rybMatterDao; private RybMatterDao rybMatterDao;
@Override @Override
public void applyAndAccept() { public void applyAndAccept() {
PageInfo pageInfo = new PageInfo(); PageInfo pageInfo = new PageInfo();
pageInfo.setPrePageResult(100); pageInfo.setPrePageResult(pageSize);
InformationQuery informationQuery = new InformationQuery(); InformationQuery informationQuery = new InformationQuery();
informationQuery.setNodeType("BusiType_1"); informationQuery.setNodeType("BusiType_1");
informationQuery.setIsReport("0"); 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 -> {
try {
Thread.sleep(applyAndAcceptSleep);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
//组装参数 //组装参数
HashMap<String, Object> stringObjectHashMap = assemblyParameters(e); HashMap<String, Object> stringObjectHashMap = assemblyParameters(e);
if(stringObjectHashMap == null){
log.info("推送失败,没有该办件所对应的事项部门编码!");
e.setIsReport("1");
e.setIsSuccess("0");
return e;
}
Map<String, String> map = (Map<String, String>) stringObjectHashMap.get("params");
e.setAcceptName(map.get("receiveusername"));
e.setAcceptId(map.get("receiveuseridcard"));
e.setAcceptPhone(map.get("receiveuserphone"));
objects.add(stringObjectHashMap); objects.add(stringObjectHashMap);
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("jsonData", JSONObject.toJSONString(stringObjectHashMap)); params.put("jsonData", JSONObject.toJSONString(stringObjectHashMap));
...@@ -60,12 +87,10 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -60,12 +87,10 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
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")
.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);
log.info("请求:" + key);
HttpResponse appKey = key.execute().charset("utf-8"); HttpResponse appKey = key.execute().charset("utf-8");
JSONObject jsonObject = JSONObject.parseObject(appKey.body()); JSONObject jsonObject = JSONObject.parseObject(appKey.body());
log.info("响应:" + jsonObject); log.info("响应:" + jsonObject);
JSONObject data = JSONObject.parseObject(jsonObject.getString("data")); JSONObject data = JSONObject.parseObject(jsonObject.getString("data"));
log.info("响应2:" + data);
if ("200".equals(jsonObject.getString("code")) && "1".equals(data.getJSONObject("custom").getString("code"))) { if ("200".equals(jsonObject.getString("code")) && "1".equals(data.getJSONObject("custom").getString("code"))) {
log.info("推送成功"); log.info("推送成功");
e.setIsReport("1"); e.setIsReport("1");
...@@ -82,6 +107,7 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -82,6 +107,7 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
} }
return e; return e;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
log.info("推送完成");
informationService.update(entities, null); informationService.update(entities, null);
} }
...@@ -107,7 +133,11 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -107,7 +133,11 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
baseInfoMap.put("address", "地址暂无"); baseInfoMap.put("address", "地址暂无");
baseInfoMap.put("contactmobile", e.getContactPhone()); baseInfoMap.put("contactmobile", e.getContactPhone());
baseInfoMap.put("contactperson", e.getContactName()); baseInfoMap.put("contactperson", e.getContactName());
baseInfoMap.putAll(randomlyExtractPersonnelInformation()); List<RybWorkEntry> workEntries = rybWorkDao.find(e.getDeptCode());
if(CollectionUtils.isEmpty(workEntries)){
return null;
}
baseInfoMap.putAll(randomlyExtractPersonnelInformation(workEntries));
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) {
...@@ -119,13 +149,23 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -119,13 +149,23 @@ 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", "MTEwNDEyOTc0MDAw");
baseInfoMap.put("contactcertnum", e.getContactIdCard()); baseInfoMap.put("contactcertnum", e.getContactIdCard());
baseInfoMap.put("contactidcard", e.getContactIdCard()); baseInfoMap.put("contactidcard", e.getContactIdCard());
dataMap.put("params", baseInfoMap); dataMap.put("params", baseInfoMap);
return dataMap; return dataMap;
} }
private HashMap<String, String> randomlyExtractPersonnelInformation(List<RybWorkEntry> workEntries) {
HashMap<String, String> dataMap = new HashMap<>(16);
Random random = new Random();
int i = random.nextInt(workEntries.size());
dataMap.put("receiveusername", workEntries.get(i).getReceiveUserName());
dataMap.put("receiveuseridcard", workEntries.get(i).getReceiveUserIdcard());
dataMap.put("receiveuserphone", workEntries.get(i).getReceiveUserPhone());
return dataMap;
}
private HashMap<String, String> randomlyExtractPersonnelInformation() { private HashMap<String, String> randomlyExtractPersonnelInformation() {
HashMap<String, String> dataMap = new HashMap<>(16); HashMap<String, String> dataMap = new HashMap<>(16);
Random random = new Random(); Random random = new Random();
...@@ -278,12 +318,18 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -278,12 +318,18 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
informationQuery.setIsSuccess("1"); informationQuery.setIsSuccess("1");
List<InformationEntity> informationEntities = informationService.find(informationQuery, pageInfo, null).getList(); List<InformationEntity> informationEntities = informationService.find(informationQuery, pageInfo, null).getList();
List<InformationEntity> collect = informationEntities.parallelStream().map(e -> { 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/bjsqtjbsl/zs").form(params) .createPost("https://10.1.235.51:4433/gateway/api/1/wllz/bjhjgcsjts/zs").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()
...@@ -303,16 +349,19 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD ...@@ -303,16 +349,19 @@ public class InformationServiceImpl extends AbstractCRUDServiceImpl<InformationD
} }
private HashMap<String, Object> assemblyParametersLink(InformationEntity e) { private HashMap<String, Object> assemblyParametersLink(InformationEntity e) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
HashMap<String, Object> dataMap = new HashMap<>(16); HashMap<String, Object> dataMap = new HashMap<>(16);
dataMap.put("token", "Epoint_WebSerivce_**##0601"); dataMap.put("token", "Epoint_WebSerivce_**##0601");
HashMap<String, Object> baseInfoMap = new HashMap<>(16); HashMap<String, Object> baseInfoMap = new HashMap<>(16);
baseInfoMap.put("flowsn", e.getOfficeCode()); baseInfoMap.put("flowsn", e.getOfficeCode());
baseInfoMap.put("operatetype", "80"); baseInfoMap.put("operatetype", "80");
baseInfoMap.put("startdate", e.getGenTime()); baseInfoMap.put("startdate", format.format(e.getGenTime()));
baseInfoMap.put("enddate", e.getCompleteTime()); baseInfoMap.put("enddate", format.format(e.getCompleteTime()));
baseInfoMap.putAll(randomlyExtractPersonnelInformation()); baseInfoMap.put("operateusername", e.getAcceptName());
baseInfoMap.put("operateuserphone", e.getAcceptPhone());
baseInfoMap.put("operateuseridcard", e.getAcceptId());
baseInfoMap.put("areacode", e.getAreaCode()); baseInfoMap.put("areacode", e.getAreaCode());
baseInfoMap.put("handleTime", e.getCreateTime()); baseInfoMap.put("handleTime", format.format(e.getCreateTime()));
baseInfoMap.put("nodeStatus", "1"); baseInfoMap.put("nodeStatus", "1");
dataMap.put("params", baseInfoMap); dataMap.put("params", baseInfoMap);
return dataMap; return dataMap;
......
...@@ -69,8 +69,10 @@ public class SupplementTaskImpl implements ITaskExcuteService { ...@@ -69,8 +69,10 @@ public class SupplementTaskImpl implements ITaskExcuteService {
SupplementQuery supplementQuery = new SupplementQuery(); SupplementQuery supplementQuery = new SupplementQuery();
supplementQuery.setIsExecute("0"); supplementQuery.setIsExecute("0");
supplementQuery.setIsSuccess("0"); supplementQuery.setIsSuccess("0");
PageInfo pageInfo = new PageInfo();
pageInfo.setPrePageResult(2000);
List<InformationEntity> informationQueries = new ArrayList<>(); List<InformationEntity> informationQueries = new ArrayList<>();
List<SupplementEntity> supplementEntities = supplementService.find(supplementQuery, null); 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:查询实施清单信息,通过事项编码查询有问题(但因数据库存储的事项数据是条件过滤后的,故暂时不改动查询),后期改动
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.mortals.xhx.modules.implementlist.dao.ibatis.RybWorkDaoImpl">
<select id="findRyb" resultType="com.mortals.xhx.modules.implementlist.model.RybWorkEntry">
select
dept_code as deptCode,
dept_name as deptName,
receive_user_name as receiveUserName,
receive_user_idcard as receiveUserIdcard,
receive_user_phone as receiveUserPhone
from ryb_work
where dept_code = #{deptCode}
</select>
</mapper>
\ No newline at end of file
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