三江-业务中台形象进度接口
This commit is contained in:
parent
810140b6da
commit
ad8e9f4991
@ -19,6 +19,8 @@ import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord;
|
||||
import com.zhgd.xmgl.modules.quality.entity.QualityRectifyRecord;
|
||||
import com.zhgd.xmgl.modules.quality.entity.SjSendQualityInspectionRecord;
|
||||
import com.zhgd.xmgl.modules.quality.entity.SjSendQualityRectifyRecord;
|
||||
import com.zhgd.xmgl.modules.sanjiang.entity.SjImageProgress;
|
||||
import com.zhgd.xmgl.modules.sanjiang.entity.SjSendSjImageProgress;
|
||||
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper;
|
||||
import com.zhgd.xmgl.util.ProfileJudgeUtil;
|
||||
@ -259,9 +261,9 @@ public class SanjiangDataCall {
|
||||
String url = gateWayUrl + uri;
|
||||
SjSendHiddenDangerInspectionRecord inspectionRecord = new SjSendHiddenDangerInspectionRecord();
|
||||
inspectionRecord.setId(id);
|
||||
String inspectionRecordBody = JSON.toJSONString(inspectionRecord);
|
||||
log.info("sendDeleteHiddenDangerInspectRecord,url:{},body:{}", url, inspectionRecordBody);
|
||||
String result = HttpUtil.createPost(url).contentType("application/json").body(inspectionRecordBody).header(apiKeyHeadName, apiKey).execute().body();
|
||||
String body = JSON.toJSONString(inspectionRecord);
|
||||
log.info("sendDeleteHiddenDangerInspectRecord,url:{},body:{}", url, body);
|
||||
String result = HttpUtil.createPost(url).contentType("application/json").body(body).header(apiKeyHeadName, apiKey).execute().body();
|
||||
log.info("sendDeleteHiddenDangerInspectRecord,httpRs:{}", result);
|
||||
}
|
||||
}
|
||||
@ -676,6 +678,78 @@ public class SanjiangDataCall {
|
||||
}
|
||||
}
|
||||
|
||||
@Async
|
||||
public void sendAddSjImageProgress(SjImageProgress ip) {
|
||||
if (judgeSjEnvironment()) {
|
||||
log.info("sendAddSjImageProgress:{}", ip);
|
||||
String uri = "seeyon/imageProgress/add.sj";
|
||||
String url = gateWayUrl + uri;
|
||||
String body = buildBodySjImageProgress(ip);
|
||||
log.info("url:{},body:{}", url, body);
|
||||
String result = HttpUtil.createPost(url).contentType("application/json").body(body).header(apiKeyHeadName, apiKey).execute().body();
|
||||
log.info("httpRs:{}", result);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private String buildBodySjImageProgress(SjImageProgress ip) {
|
||||
SjSendSjImageProgress sjSendSjImageProgress = new SjSendSjImageProgress();
|
||||
sjSendSjImageProgress.setId(String.valueOf(ip.getId()));
|
||||
sjSendSjImageProgress.setOperator(ip.getOperator());
|
||||
sjSendSjImageProgress.setProcessingTime(DateUtil.formatDate(ip.getProcessingTime()));
|
||||
sjSendSjImageProgress.setReportingUnit(ip.getReportingUnit());
|
||||
sjSendSjImageProgress.setProjectNumber(ip.getProjectNumber());
|
||||
sjSendSjImageProgress.setProjectProgress(String.valueOf(ip.getProjectProgress()));
|
||||
sjSendSjImageProgress.setProjectName(ip.getProjectName());
|
||||
sjSendSjImageProgress.setCurrentImageProgress(ip.getCurrentImageProgress());
|
||||
sjSendSjImageProgress.setMajorDifficultyAndProblem(ip.getMajorDifficultyAndProblem());
|
||||
sjSendSjImageProgress.setMajorMatter(ip.getMajorMatter());
|
||||
sjSendSjImageProgress.setImgUrl(getSjImageProgressImgUrl(ip.getImgUrl()));
|
||||
sjSendSjImageProgress.setAttachmentUrl(getSjImageProgressImgUrl(ip.getAttachmentUrl()));
|
||||
return JSON.toJSONString(sjSendSjImageProgress);
|
||||
}
|
||||
|
||||
private String getSjImageProgressImgUrl(String imgUrl) {
|
||||
if (StringUtils.isBlank(imgUrl)) {
|
||||
return null;
|
||||
}
|
||||
ArrayList<QualityRectifyRecordFileUrl> fileUrls = JSON.parseObject(imgUrl, new TypeReference<ArrayList<QualityRectifyRecordFileUrl>>() {
|
||||
});
|
||||
List<String> names = fileUrls.stream().map(q -> q.url).collect(Collectors.toList());
|
||||
return StringUtils.join(names, ",");
|
||||
}
|
||||
|
||||
@Async
|
||||
public void sendUpdateSjImageProgress(SjImageProgress ip) {
|
||||
if (judgeSjEnvironment()) {
|
||||
log.info("sendUpdateSjImageProgress:{}", ip);
|
||||
String uri = "seeyon/imageProgress/update.sj";
|
||||
String url = gateWayUrl + uri;
|
||||
String body = buildBodySjImageProgress(ip);
|
||||
log.info("url:{},body:{}", url, body);
|
||||
String result = HttpUtil.createPost(url).contentType("application/json").body(body).header(apiKeyHeadName, apiKey).execute().body();
|
||||
log.info("httpRs:{}", result);
|
||||
}
|
||||
}
|
||||
|
||||
@Async
|
||||
public void sendDeleteSjImageProgress(SjImageProgress ip) {
|
||||
if (judgeSjEnvironment()) {
|
||||
log.info("sendDeleteSjImageProgress:{}", ip);
|
||||
if (ip == null) {
|
||||
return;
|
||||
}
|
||||
String uri = "seeyon/imageProgress/delete.sj";
|
||||
String url = gateWayUrl + uri;
|
||||
SjSendSjImageProgress inspectionRecord = new SjSendSjImageProgress();
|
||||
inspectionRecord.setId(String.valueOf(ip.getId()));
|
||||
String body = JSON.toJSONString(inspectionRecord);
|
||||
log.info("url:{},body:{}", url, body);
|
||||
String result = HttpUtil.createPost(url).contentType("application/json").body(body).header(apiKeyHeadName, apiKey).execute().body();
|
||||
log.info("httpRs:{}", result);
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class QualityRectifyRecordFileUrl {
|
||||
private String name;
|
||||
|
||||
@ -101,16 +101,7 @@ public class SjImageProgressController {
|
||||
@ApiOperation(value = " 添加三江形象进度信息", notes = "添加三江形象进度信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<SjImageProgress> add(@RequestBody SjImageProgress sjImageProgress) {
|
||||
Result<SjImageProgress> result = new Result<SjImageProgress>();
|
||||
try {
|
||||
sjImageProgressService.save(sjImageProgress);
|
||||
Result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
return sjImageProgressService.add(sjImageProgress);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,16 +113,7 @@ public class SjImageProgressController {
|
||||
@ApiOperation(value = "编辑三江形象进度信息", notes = "编辑三江形象进度信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<SjImageProgress> edit(@RequestBody SjImageProgress sjImageProgress) {
|
||||
Result<SjImageProgress> result = new Result<SjImageProgress>();
|
||||
SjImageProgress sjImageProgressEntity = sjImageProgressService.getById(sjImageProgress.getId());
|
||||
if (sjImageProgressEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
sjImageProgressService.updateById(sjImageProgress);
|
||||
Result.success("修改成功!");
|
||||
}
|
||||
|
||||
return result;
|
||||
return sjImageProgressService.edit(sjImageProgress);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,20 +125,7 @@ public class SjImageProgressController {
|
||||
@ApiOperation(value = "删除三江形象进度信息", notes = "删除三江形象进度信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<SjImageProgress> delete(@RequestBody String id) {
|
||||
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
|
||||
id = String.valueOf(jsonObject.get("id"));
|
||||
Result<SjImageProgress> result = new Result<SjImageProgress>();
|
||||
SjImageProgress sjImageProgress = sjImageProgressService.getById(id);
|
||||
if (sjImageProgress == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = sjImageProgressService.removeById(id);
|
||||
if (ok) {
|
||||
Result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return sjImageProgressService.delete(id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
package com.zhgd.xmgl.modules.sanjiang.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SjSendSjImageProgress {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 经办人
|
||||
*/
|
||||
private String operator;
|
||||
/**
|
||||
* 经办时间(格式:2023-04-04)
|
||||
*/
|
||||
private String processingTime;
|
||||
/**
|
||||
* 上报单位
|
||||
*/
|
||||
private String reportingUnit;
|
||||
/**
|
||||
* 项目编号
|
||||
*/
|
||||
private String projectNumber;
|
||||
/**
|
||||
* 项目进度(在下面)
|
||||
*/
|
||||
private String projectProgress;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String projectName;
|
||||
/**
|
||||
* 当前形象进度
|
||||
*/
|
||||
private String currentImageProgress;
|
||||
/**
|
||||
* 存在主要困难和问题
|
||||
*/
|
||||
private String majorDifficultyAndProblem;
|
||||
/**
|
||||
* 需协调解决主要事项
|
||||
*/
|
||||
private String majorMatter;
|
||||
/**
|
||||
* 图片url(多个,分隔)
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 附件url(多个,分隔)
|
||||
*/
|
||||
private String attachmentUrl;
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.sanjiang.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.modules.sanjiang.entity.SjImageProgress;
|
||||
|
||||
/**
|
||||
@ -11,4 +12,9 @@ import com.zhgd.xmgl.modules.sanjiang.entity.SjImageProgress;
|
||||
*/
|
||||
public interface ISjImageProgressService extends IService<SjImageProgress> {
|
||||
|
||||
Result<SjImageProgress> add(SjImageProgress sjImageProgress);
|
||||
|
||||
Result<SjImageProgress> edit(SjImageProgress sjImageProgress);
|
||||
|
||||
Result<SjImageProgress> delete(String id);
|
||||
}
|
||||
|
||||
@ -1,9 +1,15 @@
|
||||
package com.zhgd.xmgl.modules.sanjiang.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.call.SanjiangDataCall;
|
||||
import com.zhgd.xmgl.modules.sanjiang.entity.SjImageProgress;
|
||||
import com.zhgd.xmgl.modules.sanjiang.mapper.SjImageProgressMapper;
|
||||
import com.zhgd.xmgl.modules.sanjiang.service.ISjImageProgressService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@ -13,6 +19,56 @@ import org.springframework.stereotype.Service;
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SjImageProgressServiceImpl extends ServiceImpl<SjImageProgressMapper, SjImageProgress> implements ISjImageProgressService {
|
||||
@Autowired
|
||||
SanjiangDataCall sanjiangDataCall;
|
||||
|
||||
@Override
|
||||
public Result<SjImageProgress> add(SjImageProgress sjImageProgress) {
|
||||
Result<SjImageProgress> result = new Result<SjImageProgress>();
|
||||
try {
|
||||
save(sjImageProgress);
|
||||
sanjiangDataCall.sendAddSjImageProgress(sjImageProgress);
|
||||
Result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<SjImageProgress> edit(SjImageProgress sjImageProgress) {
|
||||
Result<SjImageProgress> result = new Result<SjImageProgress>();
|
||||
SjImageProgress sjImageProgressEntity = getById(sjImageProgress.getId());
|
||||
if (sjImageProgressEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
updateById(sjImageProgress);
|
||||
sanjiangDataCall.sendUpdateSjImageProgress(sjImageProgress);
|
||||
Result.success("修改成功!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<SjImageProgress> delete(String id) {
|
||||
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
|
||||
id = String.valueOf(jsonObject.get("id"));
|
||||
Result<SjImageProgress> result = new Result<SjImageProgress>();
|
||||
SjImageProgress sjImageProgress = getById(id);
|
||||
if (sjImageProgress == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = removeById(id);
|
||||
if (ok) {
|
||||
Result.success("删除成功!");
|
||||
}
|
||||
sanjiangDataCall.sendDeleteSjImageProgress(sjImageProgress);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.standard.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gexin.fastjson.JSON;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.standard.entity.StandardCurrentData;
|
||||
@ -37,6 +38,7 @@ public class StandardCurrentDataController {
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = " 分页列表查询标养室实时数据信息", notes = "分页列表查询标养室实时数据信息", httpMethod = "POST")
|
||||
@ -55,6 +57,7 @@ public class StandardCurrentDataController {
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@ -63,12 +66,14 @@ public class StandardCurrentDataController {
|
||||
//@PostMapping(value = "/add",produces = {"application/json;charset=UTF-8"})
|
||||
@PostMapping(value = "/saveStandardCurrentData", produces = {"application/json;charset=UTF-8"})
|
||||
public Result saveStandardCurrentData(@RequestBody final JSONObject json) {
|
||||
log.info("saveStandardCurrentData:{}", JSON.toJSONString(json));
|
||||
standardCurrentDataService.saveStandardCurrentData(json);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param standardCurrentData
|
||||
* @return
|
||||
*/
|
||||
@ -76,6 +81,7 @@ public class StandardCurrentDataController {
|
||||
//@PostMapping(value = "/saveStandardCurrentData")
|
||||
@PostMapping(value = "/addCurrentData")
|
||||
public Result<StandardCurrentData> addCurrentData(@RequestBody StandardCurrentData standardCurrentData) {
|
||||
log.info("addCurrentData:{}", JSON.toJSONString(standardCurrentData));
|
||||
standardCurrentDataService.addCurrentData(standardCurrentData);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user