计划对接
This commit is contained in:
parent
6015454465
commit
f7c2160050
@ -373,11 +373,11 @@ public class ProgressPanoramaNodePlanController {
|
||||
.orderByAsc(ProgressPanoramaNodePlan::getPlanFinishDate));
|
||||
Map<String, Object> stateMap = new HashMap();
|
||||
stateMap.put("total", list.size());
|
||||
stateMap.put("unStart", list.stream().filter(l -> l.getStatus() == 1).count());
|
||||
stateMap.put("inProgress", list.stream().filter(l -> l.getStatus() == 2 && DateUtil.parseDate(l.getFinishDate()).compareTo(new Date()) >= 0).count());
|
||||
stateMap.put("delay", list.stream().filter(l -> l.getStatus() == 2 && DateUtil.parseDate(l.getFinishDate()).compareTo(new Date()) < 0).count());
|
||||
stateMap.put("delayCompletion", list.stream().filter(l -> l.getStatus() == 4).count());
|
||||
stateMap.put("completion", list.stream().filter(l -> l.getStatus() == 3).count());
|
||||
stateMap.put("unStart", list.stream().filter(l -> l.getStatus() == 0).count());
|
||||
stateMap.put("inProgress", list.stream().filter(l -> l.getStatus() == 1 && DateUtil.parseDate(l.getFinishDate()).compareTo(new Date()) >= 0).count());
|
||||
stateMap.put("delay", list.stream().filter(l -> l.getStatus() == 2).count());
|
||||
stateMap.put("delayCompletion", list.stream().filter(l -> l.getStatus() == 3).count());
|
||||
stateMap.put("completion", list.stream().filter(l -> l.getStatus() == 4).count());
|
||||
resultMap.put("stateMap", stateMap);
|
||||
resultMap.put("planList", list);
|
||||
}
|
||||
@ -416,15 +416,15 @@ public class ProgressPanoramaNodePlanController {
|
||||
execDto.setTotal(panoramaNodePlans.size());
|
||||
List<ProgressPanoramaNodePlan> planCompalete = panoramaNodePlans.stream().filter(p -> DateUtil.parseDate(p.getPlanFinishDate()).compareTo(new Date()) < 0).collect(Collectors.toList());
|
||||
execDto.setPlanCompleteNum(planCompalete.size());
|
||||
int normalNum = (int) panoramaNodePlans.stream().filter(p -> p.getStatus() == 3).count();
|
||||
int normalNum = (int) panoramaNodePlans.stream().filter(p -> p.getStatus() == 4).count();
|
||||
execDto.setNormalNum(normalNum);
|
||||
execDto.setNormalRatio(planCompalete.size() == 0 ? new BigDecimal(0) : new BigDecimal(normalNum).divide(new BigDecimal(planCompalete.size()), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)));
|
||||
int delayNum = (int) panoramaNodePlans.stream().filter(p -> p.getStatus() == 4).count();
|
||||
int delayNum = (int) panoramaNodePlans.stream().filter(p -> p.getStatus() == 3).count();
|
||||
execDto.setDelayNum(delayNum);
|
||||
int completeNum = normalNum + delayNum;
|
||||
execDto.setCompleteNum(completeNum);
|
||||
execDto.setCompleteRatio(planCompalete.size() == 0 ? new BigDecimal(0) : new BigDecimal(completeNum).divide(new BigDecimal(planCompalete.size()), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)));
|
||||
execDto.setDelayUnComplete((int) panoramaNodePlans.stream().filter(p -> p.getStatus() < 3 && DateUtil.parseDate(p.getPlanFinishDate()).compareTo(new Date()) < 0).count());
|
||||
execDto.setDelayUnComplete((int) panoramaNodePlans.stream().filter(p -> p.getStatus() == 2).count());
|
||||
execDtoList.add(execDto);
|
||||
}
|
||||
List<DictionaryItem> planType = dictionaryItemService.getDictList("plan_type", null);
|
||||
@ -435,15 +435,15 @@ public class ProgressPanoramaNodePlanController {
|
||||
execDto.setTotal(panoramaNodePlans.size());
|
||||
List<ProgressPanoramaNodePlan> planCompalete = panoramaNodePlans.stream().filter(p -> DateUtil.parseDate(p.getPlanFinishDate()).compareTo(new Date()) < 0).collect(Collectors.toList());
|
||||
execDto.setPlanCompleteNum(planCompalete.size());
|
||||
int normalNum = (int) panoramaNodePlans.stream().filter(p -> p.getStatus() == 3).count();
|
||||
int normalNum = (int) panoramaNodePlans.stream().filter(p -> p.getStatus() == 4).count();
|
||||
execDto.setNormalNum(normalNum);
|
||||
execDto.setNormalRatio(planCompalete.size() == 0 ? new BigDecimal(0) : new BigDecimal(normalNum).divide(new BigDecimal(planCompalete.size()), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)));
|
||||
int delayNum = (int) panoramaNodePlans.stream().filter(p -> p.getStatus() == 4).count();
|
||||
int delayNum = (int) panoramaNodePlans.stream().filter(p -> p.getStatus() == 3).count();
|
||||
execDto.setDelayNum(delayNum);
|
||||
int completeNum = normalNum + delayNum;
|
||||
execDto.setCompleteNum(completeNum);
|
||||
execDto.setCompleteRatio(planCompalete.size() == 0 ? new BigDecimal(0) : new BigDecimal(completeNum).divide(new BigDecimal(planCompalete.size()), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)));
|
||||
execDto.setDelayUnComplete((int) panoramaNodePlans.stream().filter(p -> p.getStatus() < 3 && DateUtil.parseDate(p.getPlanFinishDate()).compareTo(new Date()) < 0).count());
|
||||
execDto.setDelayUnComplete((int) panoramaNodePlans.stream().filter(p -> p.getStatus() == 2).count());
|
||||
execDtoList.add(execDto);
|
||||
}
|
||||
return Result.success(execDtoList);
|
||||
@ -466,14 +466,19 @@ public class ProgressPanoramaNodePlanController {
|
||||
UserInfo user = SecurityUtils.getUser();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
Map<String, Object> mainMap = new HashMap<>();
|
||||
mainMap.put("sqr", user.getUserId());
|
||||
mainMap.put("sqrg", DateUtil.formatDate(new Date()));
|
||||
mainMap.put("zbr", nodePlan.getChargerId());
|
||||
mainMap.put("rwmc", nodePlan.getNodeName());
|
||||
mainMap.put("zrr", nodePlan.getChargerId());
|
||||
mainMap.put("zrbm", nodePlan.getChargerDeptId());
|
||||
mainMap.put("jhksrq", nodePlan.getPlanStartDate());
|
||||
mainMap.put("jhjsrq", nodePlan.getPlanFinishDate());
|
||||
mainMap.put("rwmc", nodePlan.getNodeName());
|
||||
mainMap.put("content", MapUtils.getString(map, "content"));
|
||||
mainMap.put("requireDate", MapUtils.getString(map, "requireDate"));
|
||||
mainMap.put("rwid", nodePlan.getId());
|
||||
// mainMap.put("sqr", user.getUserId());
|
||||
// mainMap.put("sqrg", DateUtil.formatDate(new Date()));
|
||||
|
||||
|
||||
|
||||
mainMap.put("cbnr", MapUtils.getString(map, "content"));
|
||||
mainMap.put("yqwcrq", MapUtils.getString(map, "requireDate"));
|
||||
JSONArray mainData = new JSONArray();
|
||||
for (String s : mainMap.keySet()) {
|
||||
JSONObject obj = new JSONObject();
|
||||
@ -484,13 +489,13 @@ public class ProgressPanoramaNodePlanController {
|
||||
params.put("requestName", "任务督办");
|
||||
params.put("mainData", JSON.toJSONString(mainData));
|
||||
params.put("detailData","[]");
|
||||
params.put("workflowId", "422");
|
||||
params.put("workflowId", "436");
|
||||
params.put("remark","restful接口创建流程测试");
|
||||
Map<String, String> otherParams = new HashMap<>();
|
||||
otherParams.put("isVerifyPer","0");
|
||||
params.put("otherParams",JSONObject.toJSONString(otherParams));
|
||||
System.out.println(JSON.toJSONString(params));
|
||||
// String result = jiuzhuUtil.testRestful1(ADDRESS, "/api/workflow/paService/doCreateRequest", params, "5583bc0e-220e-4a44-8e14-d838d47ad9b9");
|
||||
String result = jiuzhuUtil.testRestful1(ADDRESS, "/api/workflow/paService/doCreateRequest", params, "5583bc0e-220e-4a44-8e14-d838d47ad9b9");
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,15 @@ import java.util.List;
|
||||
@ApiModel(value = "全景计划信息(DTO)", description = "ProgressPanoramaNodePlanDto")
|
||||
public class ProgressPanoramaNodePlanDto extends ProgressPanoramaNodePlan {
|
||||
|
||||
@ApiModelProperty(value = "项目id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty(value = "里程碑")
|
||||
private String milepostName;
|
||||
|
||||
@ApiModelProperty(value = "计划应完成数")
|
||||
private String resultName;
|
||||
|
||||
@ApiModelProperty(value = "子项信息")
|
||||
private List<ProgressPanoramaNodePlanDto> children;
|
||||
}
|
||||
|
||||
@ -45,4 +45,6 @@ public interface ProgressPanoramaNodePlanMapper extends BaseMapper<ProgressPanor
|
||||
Map<String, Object> selectProjectStatistics(Map<String, Object> map);
|
||||
|
||||
List<EntityMap> selectProjectEarlyWarningList(Map<String, Object> map);
|
||||
|
||||
List<ProgressPanoramaNodePlanDto> getPlan();
|
||||
}
|
||||
|
||||
@ -565,4 +565,8 @@
|
||||
and cp.company_sn = #{sn}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getPlan" resultType="com.zhgd.xmgl.modules.project.entity.dto.ProgressPanoramaNodePlanDto">
|
||||
select * from project_plan
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -195,6 +195,7 @@ public class ProgressPanoramaNodePlanServiceImpl extends ServiceImpl<ProgressPan
|
||||
updateState(progressPanoramaNodePlan.getProjectSn());
|
||||
progressPanoramaNodePlanMapper.insert(progressPanoramaNodePlan);
|
||||
draftInfo(progressPanoramaNodePlan, 1);
|
||||
sendPlan(progressPanoramaNodePlan.getProjectSn());
|
||||
return progressPanoramaNodePlan.getId();
|
||||
|
||||
}
|
||||
@ -298,13 +299,16 @@ public class ProgressPanoramaNodePlanServiceImpl extends ServiceImpl<ProgressPan
|
||||
public boolean delInfo(String id) {
|
||||
List<ProgressPanoramaNodePlan> list = this.list(Wrappers.<ProgressPanoramaNodePlan>lambdaQuery()
|
||||
.apply("find_in_set({0}, ancestors)", id));
|
||||
if (list.size() > 0) {
|
||||
this.removeByIds(list.stream().map(p -> p.getId()).collect(Collectors.toList()));
|
||||
List<String> ids = list.stream().map(p -> p.getId().toString()).collect(Collectors.toList());
|
||||
if (ids.size() > 0) {
|
||||
this.removeByIds(ids);
|
||||
}
|
||||
// 记录变更
|
||||
ProgressPanoramaNodePlan nodePlan = this.getById(id);
|
||||
updateState(nodePlan.getProjectSn());
|
||||
draftInfo(nodePlan, 3);
|
||||
ids.add(id.toString());
|
||||
delPlan(ids);
|
||||
return this.removeById(id);
|
||||
}
|
||||
|
||||
@ -336,8 +340,7 @@ public class ProgressPanoramaNodePlanServiceImpl extends ServiceImpl<ProgressPan
|
||||
progressPanoramaNodePlan.setApprovalStatue(0);
|
||||
boolean flag = this.updateById(progressPanoramaNodePlan);
|
||||
draftInfo(progressPanoramaNodePlan, 2);
|
||||
ProgressPanoramaNodePlan nodePlan = this.getById(progressPanoramaNodePlan.getId());
|
||||
jiuzhuDateUtil.sendPlan(nodePlan);
|
||||
sendPlan(progressPanoramaNodePlan.getProjectSn());
|
||||
return flag;
|
||||
}
|
||||
|
||||
@ -375,6 +378,7 @@ public class ProgressPanoramaNodePlanServiceImpl extends ServiceImpl<ProgressPan
|
||||
}
|
||||
progressPanoramaNodePlanDraftService.saveBatch(draftList);
|
||||
}
|
||||
sendPlan(projectSn);
|
||||
return flag;
|
||||
}
|
||||
|
||||
@ -409,9 +413,20 @@ public class ProgressPanoramaNodePlanServiceImpl extends ServiceImpl<ProgressPan
|
||||
wrapper.eq(ProgressPanoramaNodePlan::getApprovalStatue, 0);
|
||||
this.update(wrapper);
|
||||
updateProjectState(progressPanoramaNodePlan.getProjectSn(), 1);
|
||||
sendPlan(progressPanoramaNodePlan.getProjectSn());
|
||||
return true;
|
||||
}
|
||||
|
||||
private void sendPlan(String projectSn) {
|
||||
List<ProgressPanoramaNodePlanDto> planList = baseMapper.getPlan();
|
||||
planList = planList.stream().filter(p -> p.getProjectSn().equals(projectSn)).collect(Collectors.toList());
|
||||
jiuzhuDateUtil.sendPlan(planList);
|
||||
}
|
||||
|
||||
private void delPlan(List<String> ids) {
|
||||
jiuzhuDateUtil.delPlan(ids);
|
||||
}
|
||||
|
||||
private void updateProjectState(String projectSn, int state) {
|
||||
ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn);
|
||||
projectInfoBySn.setProgressState(state);
|
||||
@ -469,9 +484,11 @@ public class ProgressPanoramaNodePlanServiceImpl extends ServiceImpl<ProgressPan
|
||||
}
|
||||
// 保存变更记录
|
||||
ProgressPanoramaNodePlanDraft updateInfo = progressPanoramaNodePlanDraftService.getById(planDraft.getDraftId());
|
||||
ProgressPanoramaNodePlanChangeRecord record = new ProgressPanoramaNodePlanChangeRecord();
|
||||
BeanUtils.copyProperties(updateInfo, record);
|
||||
progressPanoramaNodePlanChangeRecordService.save(record);
|
||||
if (updateInfo != null) {
|
||||
ProgressPanoramaNodePlanChangeRecord record = new ProgressPanoramaNodePlanChangeRecord();
|
||||
BeanUtils.copyProperties(updateInfo, record);
|
||||
progressPanoramaNodePlanChangeRecordService.save(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -482,7 +499,8 @@ public class ProgressPanoramaNodePlanServiceImpl extends ServiceImpl<ProgressPan
|
||||
try {
|
||||
for (Field field : fields) {
|
||||
ReflectionUtils.makeAccessible(field);
|
||||
if (field.getName().equals("approvalStatue") || field.getName().equals("serialVersionUID")) {
|
||||
if (field.getName().equals("approvalStatue") || field.getName().equals("serialVersionUID")
|
||||
|| field.getName().equals("nature")) {
|
||||
continue;
|
||||
}
|
||||
Field secondField = clazz2.getDeclaredField(field.getName());
|
||||
|
||||
@ -24,6 +24,7 @@ import com.zhgd.xmgl.modules.jz.dto.PlanTargetDto;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProgressPanoramaNodePlan;
|
||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProjectSupplier;
|
||||
import com.zhgd.xmgl.modules.project.entity.dto.ProgressPanoramaNodePlanDto;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectService;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectSupplierService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -213,12 +214,12 @@ public class JiuzhuDateUtil {
|
||||
return planTargetDtoList;
|
||||
}
|
||||
|
||||
public List<PlanTargetDto> sendPlan(ProgressPanoramaNodePlan progressPanoramaNodePlan) {
|
||||
String url = "/api/cube/restful/interface/getModeDataPageList/JHRW";
|
||||
String systemid = "JHTS";
|
||||
String d_password = "F510A75A00ED495389C685792E416269";
|
||||
JSONObject mainTable = convert(progressPanoramaNodePlan);
|
||||
String result = doAction(url, systemid, d_password, mainTable);
|
||||
public List<PlanTargetDto> sendPlan(List<ProgressPanoramaNodePlanDto> progressPanoramaNodePlan) {
|
||||
String url = "/api/cube/restful/interface/saveOrUpdateModeData/JHTS";
|
||||
String systemid = "jhrwts";
|
||||
String d_password = "FD8363502986471684F8443F0BE8A502";
|
||||
JSONArray mainTable = convert(progressPanoramaNodePlan);
|
||||
String result = doAction1(url, systemid, d_password, mainTable);
|
||||
List<PlanTargetDto> planTargetDtoList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(result)) {
|
||||
JSONObject obj = JSONObject.parseObject(result);
|
||||
@ -227,23 +228,68 @@ public class JiuzhuDateUtil {
|
||||
return planTargetDtoList;
|
||||
}
|
||||
|
||||
private JSONObject convert(ProgressPanoramaNodePlan progressPanoramaNodePlan) {
|
||||
JSONObject main = new JSONObject();
|
||||
main.put("id", progressPanoramaNodePlan.getId());
|
||||
main.put("rwlx", progressPanoramaNodePlan.getLevelName());
|
||||
main.put("rwlb", progressPanoramaNodePlan.getType());
|
||||
main.put("sfwgjjd", progressPanoramaNodePlan.getKeyNode());
|
||||
main.put("sfwlcb", progressPanoramaNodePlan.getMilepostNode());
|
||||
main.put("jhksrq", progressPanoramaNodePlan.getPlanStartDate());
|
||||
main.put("jhjsrq", progressPanoramaNodePlan.getPlanFinishDate());
|
||||
main.put("zzr", progressPanoramaNodePlan.getChargerId());
|
||||
main.put("zzbm", progressPanoramaNodePlan.getChargerDeptId());
|
||||
main.put("lcb", progressPanoramaNodePlan.getMilepostId());
|
||||
main.put("jdxcg", progressPanoramaNodePlan.getResultId());
|
||||
main.put("bh", progressPanoramaNodePlan.getNodeCode());
|
||||
main.put("gq", progressPanoramaNodePlan.getDuration());
|
||||
main.put("xzr", progressPanoramaNodePlan.getAssistId());
|
||||
return main;
|
||||
public void delPlan(List<String> ids) {
|
||||
String url = "/api/cube/restful/interface/deleteModeDataByPK/JHSC";
|
||||
String systemid = "JHSC";
|
||||
String d_password = "A58B63C23E684FA0A6120895156AF87E";
|
||||
JSONArray mainTable = convert1(ids);
|
||||
for (int i = 0; i < mainTable.size(); i++) {
|
||||
String result = doAction(url, systemid, d_password, mainTable.getJSONObject(i));
|
||||
System.out.println("删除任务结果======" + result);
|
||||
}
|
||||
}
|
||||
|
||||
private JSONArray convert(List<ProgressPanoramaNodePlanDto> progressPanoramaNodePlans) {
|
||||
JSONArray array = new JSONArray();
|
||||
for (ProgressPanoramaNodePlanDto progressPanoramaNodePlan : progressPanoramaNodePlans) {
|
||||
JSONObject main = new JSONObject();
|
||||
main.put("rwid", progressPanoramaNodePlan.getId());
|
||||
main.put("rwlx", progressPanoramaNodePlan.getLevelName().equals("主项任务") ? 0 : 1);
|
||||
main.put("rwlb", progressPanoramaNodePlan.getType());
|
||||
main.put("sfwgjjd", progressPanoramaNodePlan.getKeyNode() ? 1 : 0);
|
||||
main.put("sfwlcb", progressPanoramaNodePlan.getMilepostNode() ? 1 : 0);
|
||||
main.put("jhksrq", progressPanoramaNodePlan.getPlanStartDate());
|
||||
main.put("jhjsrq", progressPanoramaNodePlan.getPlanFinishDate());
|
||||
main.put("zzr", progressPanoramaNodePlan.getChargerId());
|
||||
main.put("zzbm", progressPanoramaNodePlan.getChargerDeptId());
|
||||
main.put("lcb", progressPanoramaNodePlan.getMilepostName());
|
||||
main.put("jdxcg", progressPanoramaNodePlan.getResultName());
|
||||
main.put("bh", progressPanoramaNodePlan.getNodeCode());
|
||||
main.put("gq", progressPanoramaNodePlan.getDuration());
|
||||
main.put("xzr", progressPanoramaNodePlan.getAssistId());
|
||||
main.put("ndjhmc", progressPanoramaNodePlan.getNodeName());
|
||||
main.put("sfjdxcg", progressPanoramaNodePlan.getResultNode() ? 1 : 0);
|
||||
main.put("ndjhlx ", 1);
|
||||
main.put("zt", progressPanoramaNodePlan.getApprovalStatue());
|
||||
main.put("xmid", progressPanoramaNodePlan.getProjectId());
|
||||
// main.put("rwid", "123");
|
||||
// main.put("rwlx", "");
|
||||
// main.put("rwlb", "");
|
||||
// main.put("sfwgjjd", "");
|
||||
// main.put("sfwlcb", "");
|
||||
// main.put("jhksrq", "");
|
||||
// main.put("jhjsrq", "");
|
||||
// main.put("zzr", "");
|
||||
// main.put("zzbm", "");
|
||||
// main.put("lcb", "");
|
||||
// main.put("jdxcg", "");
|
||||
// main.put("bh", "");
|
||||
// main.put("gq", "");
|
||||
// main.put("xzr", "");
|
||||
// main.put("ndjhmc", "");
|
||||
array.add(main);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
private JSONArray convert1(List<String> ids) {
|
||||
JSONArray array = new JSONArray();
|
||||
for (String id : ids) {
|
||||
JSONObject main = new JSONObject();
|
||||
main.put("rwid", id);
|
||||
array.add(main);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -298,7 +344,7 @@ public class JiuzhuDateUtil {
|
||||
|
||||
//封装operationinfo参数
|
||||
JSONObject operationinfo = new JSONObject();
|
||||
operationinfo.put("operator", "15273");
|
||||
operationinfo.put("operator", "1");
|
||||
paramDatajson.put("operationinfo",operationinfo);
|
||||
|
||||
System.out.println("===请求参数datajson==="+paramDatajson);
|
||||
@ -333,6 +379,85 @@ public class JiuzhuDateUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String doAction1(String url, String systemid, String d_password, JSONArray mainTable){
|
||||
|
||||
CloseableHttpResponse response;// 响应类,
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
|
||||
//restful接口url
|
||||
HttpPost httpPost = new HttpPost(ADDRESS + url);
|
||||
|
||||
//当前日期
|
||||
String currentDate = getCurrentDate();
|
||||
//当前时间
|
||||
String currentTime = getCurrentTime();
|
||||
//获取时间戳
|
||||
String currentTimeTamp = getTimestamp();
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
Map paramDatajson = new HashMap<>();
|
||||
JSONObject dataobj = new JSONObject();
|
||||
JSONArray data = new JSONArray();
|
||||
|
||||
//header
|
||||
Map header = new HashMap<>();
|
||||
|
||||
//系统标识
|
||||
// String systemid = "xmxx";
|
||||
//密码
|
||||
// String d_password = "E3BA750749804E65B0A93833635F8ED2";
|
||||
//封装header里的参数
|
||||
header.put("systemid",systemid);
|
||||
header.put("currentDateTime",currentTimeTamp);
|
||||
String md5Source = systemid+d_password+currentTimeTamp;
|
||||
String md5OfStr = getMD5Str(md5Source).toLowerCase();
|
||||
//Md5是:系统标识+密码+时间戳 并且md5加密的结果
|
||||
header.put("Md5",md5OfStr);
|
||||
dataobj.put("header",header);
|
||||
|
||||
|
||||
//封装operationinfo参数
|
||||
JSONObject operationinfo = new JSONObject();
|
||||
operationinfo.put("operator", "1");
|
||||
for (int i = 0; i < mainTable.size(); i++) {
|
||||
Map paramDatajson1 = new HashMap<>();
|
||||
paramDatajson1.put("operationinfo",operationinfo);
|
||||
paramDatajson1.put("mainTable",mainTable.getJSONObject(i));
|
||||
data.add(paramDatajson1);
|
||||
}
|
||||
System.out.println("===请求参数datajson==="+paramDatajson);
|
||||
dataobj.put("data", data);
|
||||
params.put("datajson",dataobj);
|
||||
//装填参数
|
||||
List nvps = new ArrayList();
|
||||
if(params!=null){
|
||||
for (Object entry : params.entrySet()) {
|
||||
Map.Entry<String, Object> en = (Map.Entry) entry;
|
||||
nvps.add(new BasicNameValuePair(en.getKey(), JSONObject.toJSONString(en.getValue())));
|
||||
}
|
||||
}
|
||||
try{
|
||||
httpPost.addHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8");
|
||||
httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));
|
||||
response = httpClient.execute(httpPost);
|
||||
if (response != null && response.getEntity() != null) {
|
||||
//返回信息
|
||||
String resulString = EntityUtils.toString(response.getEntity());
|
||||
|
||||
//todo这里处理返回信息
|
||||
|
||||
System.out.println("成功"+ resulString);
|
||||
return resulString;
|
||||
|
||||
}else{
|
||||
System.out.println("获取数据失败,请查看日志"+currentDate+" "+currentTime);
|
||||
}
|
||||
}catch (Exception e){
|
||||
System.out.println("请求失败"+currentDate+" "+currentTime+"====errormsg:"+e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getMD5Str(String plainText){
|
||||
//定义一个字节数组
|
||||
byte[] secretBytes = null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user