Compare commits
2 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
2f8281179a | |
|
|
fd8f41ef08 |
|
|
@ -0,0 +1,163 @@
|
|||
package com.njzscloud.common.core.utils;
|
||||
|
||||
import com.njzscloud.common.core.ex.Exceptions;
|
||||
|
||||
import javax.imageio.IIOImage;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.imageio.ImageWriteParam;
|
||||
import javax.imageio.ImageWriter;
|
||||
import javax.imageio.stream.ImageOutputStream;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class ImgUtil {
|
||||
|
||||
// 最小缩放比例(防止无限缩小,可根据需求调整)
|
||||
private static final double MIN_SCALE = 0.1;
|
||||
// 最低质量压缩值(防止质量过低导致图片损坏)
|
||||
private static final float MIN_QUALITY = 0.1f;
|
||||
// 压缩衰减系数(每次递归压缩时,缩放/质量的衰减幅度)
|
||||
private static final double COMPRESS_ATTENUATION = 0.8;
|
||||
|
||||
/**
|
||||
* 按质量压缩图片(返回字节流)
|
||||
*/
|
||||
public static ByteArrayOutputStream compressByQuality(InputStream in, float quality, String format) throws IOException {
|
||||
BufferedImage bufferedImage = ImageIO.read(in);
|
||||
if (bufferedImage == null) {
|
||||
throw new IOException("读取图片流失败,图片格式不支持或流已关闭");
|
||||
}
|
||||
|
||||
Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName(format);
|
||||
if (!writers.hasNext()) {
|
||||
throw new IOException("不支持的图片格式:" + format);
|
||||
}
|
||||
ImageWriter writer = writers.next();
|
||||
|
||||
ImageWriteParam param = writer.getDefaultWriteParam();
|
||||
if (param.canWriteCompressed()) {
|
||||
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
|
||||
// 确保质量不低于最小值
|
||||
param.setCompressionQuality(Math.max(quality, MIN_QUALITY));
|
||||
}
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
try (ImageOutputStream ios = ImageIO.createImageOutputStream(out)) {
|
||||
writer.setOutput(ios);
|
||||
writer.write(null, new IIOImage(bufferedImage, null, null), param);
|
||||
return out;
|
||||
} finally {
|
||||
writer.dispose();
|
||||
// 关闭输入流,避免内存泄漏
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按尺寸缩放图片(返回字节流)
|
||||
*/
|
||||
public static ByteArrayOutputStream compressByScale(InputStream in, double scale, String format) throws IOException {
|
||||
BufferedImage srcImage = ImageIO.read(in);
|
||||
if (srcImage == null) {
|
||||
throw new IOException("读取图片流失败,图片格式不支持或流已关闭");
|
||||
}
|
||||
|
||||
// 确保缩放比例不低于最小值
|
||||
double actualScale = Math.max(scale, MIN_SCALE);
|
||||
int newWidth = Math.max(1, (int) (srcImage.getWidth() * actualScale));
|
||||
int newHeight = Math.max(1, (int) (srcImage.getHeight() * actualScale));
|
||||
|
||||
BufferedImage destImage = new BufferedImage(newWidth, newHeight, srcImage.getType());
|
||||
Graphics2D g = destImage.createGraphics();
|
||||
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g.drawImage(srcImage, 0, 0, newWidth, newHeight, null);
|
||||
g.dispose();
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ImageIO.write(destImage, format, out);
|
||||
// 关闭输入流
|
||||
in.close();
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归压缩图片:先校验大小,满足阈值直接返回;否则递归压缩直到满足阈值
|
||||
*
|
||||
* @param in 原始图片输入流
|
||||
* @param initialScale 初始压缩比例(尺寸+质量)
|
||||
* @param format 图片格式(jpg/png等)
|
||||
* @param sizeThreshold 体积阈值(例如:1024*100 表示100KB)
|
||||
* @return 压缩后的字节流
|
||||
*/
|
||||
public static ByteArrayOutputStream compress(InputStream in, double initialScale, String format, long sizeThreshold) {
|
||||
try {
|
||||
// ========== 核心新增:第一步先校验原始图片大小 ==========
|
||||
byte[] originalBytes = readBytes(in);
|
||||
// 若原始体积已满足阈值,直接返回字节流,不执行任何压缩
|
||||
if (originalBytes.length <= sizeThreshold) {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
out.write(originalBytes);
|
||||
return out;
|
||||
}
|
||||
|
||||
// 原始体积不满足阈值,执行第一次组合压缩(质量+尺寸)
|
||||
ByteArrayOutputStream qualityOut = compressByQuality(
|
||||
new ByteArrayInputStream(originalBytes),
|
||||
(float) initialScale,
|
||||
format
|
||||
);
|
||||
ByteArrayOutputStream scaleOut = compressByScale(
|
||||
new ByteArrayInputStream(qualityOut.toByteArray()),
|
||||
initialScale,
|
||||
format
|
||||
);
|
||||
|
||||
// 校验压缩后的体积是否满足阈值
|
||||
long currentSize = scaleOut.size();
|
||||
if (currentSize <= sizeThreshold) {
|
||||
return scaleOut; // 满足阈值,直接返回
|
||||
}
|
||||
|
||||
// 计算下一次压缩的比例(衰减)
|
||||
double nextScale = initialScale * COMPRESS_ATTENUATION;
|
||||
|
||||
// 边界校验:防止无限递归
|
||||
if (nextScale < MIN_SCALE) {
|
||||
// 已达到最小压缩比例,返回当前结果(避免图片失效)
|
||||
return scaleOut;
|
||||
}
|
||||
|
||||
// 递归调用:使用衰减后的比例继续压缩
|
||||
return compress(
|
||||
new ByteArrayInputStream(scaleOut.toByteArray()),
|
||||
nextScale,
|
||||
format,
|
||||
sizeThreshold
|
||||
);
|
||||
|
||||
} catch (IOException e) {
|
||||
throw Exceptions.error(e, "图片压缩失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 辅助方法:读取输入流的所有字节(避免流复用导致的问题)
|
||||
*/
|
||||
private static byte[] readBytes(InputStream in) throws IOException {
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
byte[] temp = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(temp)) != -1) {
|
||||
buffer.write(temp, 0, len);
|
||||
}
|
||||
in.close();
|
||||
return buffer.toByteArray();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -25,6 +25,9 @@ public class CompositeInterceptor implements RequestInterceptor, ResponseInterce
|
|||
|
||||
@Override
|
||||
public Object process(RequestInfo requestInfo, ResponseInfo responseInfo, Type responseType) {
|
||||
if (requestInfo.contentType != null && requestInfo.contentType.contains("multipart/form-data")) {
|
||||
log.info("响应拦截器: {}、{}、{}", Jackson.toJsonStr(requestInfo), new String(responseInfo.body), responseType);
|
||||
}
|
||||
log.info("响应拦截器: {}、{}、{}", Jackson.toJsonStr(requestInfo), new String(responseInfo.body), responseType);
|
||||
Object data = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,10 @@ import cn.hutool.core.util.StrUtil;
|
|||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.njzscloud.common.http.HttpClientDecorator;
|
||||
import com.njzscloud.supervisory.config.AppProperties;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.LoginParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.PushVehicleTrajectoryParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.RefreshTokenParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.TokenParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.*;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.result.HsoaResult;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.result.LoginResult;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.result.UploadResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
|
@ -21,10 +19,10 @@ public class Hsoa {
|
|||
private static final ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock();
|
||||
private static final ReentrantReadWriteLock.ReadLock rlock = rwLock.readLock();
|
||||
private static final ReentrantReadWriteLock.WriteLock wlock = rwLock.writeLock();
|
||||
private static final AppProperties appProperties;
|
||||
private static String refTnt = "";
|
||||
private static String tnt = "";
|
||||
private static long lastLoginTime = 0;
|
||||
private static AppProperties appProperties;
|
||||
|
||||
static {
|
||||
HttpClientDecorator httpClientDecorator = SpringUtil.getBean(HttpClientDecorator.class);
|
||||
|
|
@ -51,6 +49,33 @@ public class Hsoa {
|
|||
}
|
||||
}
|
||||
|
||||
public static HsoaResult<?> pushProvincial(PushProvincialSaveParam param) {
|
||||
login();
|
||||
try {
|
||||
rlock.lock();
|
||||
if (StrUtil.isBlank(tnt) || StrUtil.isBlank(refTnt)) {
|
||||
return new HsoaResult<>()
|
||||
.setSuccess(false);
|
||||
}
|
||||
return API.pushProvincial(param, new TokenParam().setTnt(tnt).setRefTnt(refTnt));
|
||||
} finally {
|
||||
rlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public static UploadResult upload(PushProvincialUploadParam param) {
|
||||
login();
|
||||
try {
|
||||
rlock.lock();
|
||||
if (StrUtil.isBlank(tnt) || StrUtil.isBlank(refTnt)) {
|
||||
return new UploadResult();
|
||||
}
|
||||
return API.upload(param, new TokenParam().setTnt(tnt).setRefTnt(refTnt));
|
||||
} finally {
|
||||
rlock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public static void login() {
|
||||
try {
|
||||
wlock.lock();
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
package com.njzscloud.supervisory.hsoa;
|
||||
|
||||
import com.njzscloud.common.http.annotation.*;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.LoginParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.PushVehicleTrajectoryParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.RefreshTokenParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.TokenParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.*;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.result.HsoaResult;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.result.LoginResult;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.result.UploadResult;
|
||||
|
||||
@RemoteServer(value = "${hsoa.base-url}")
|
||||
public interface HsoaApi {
|
||||
|
|
@ -14,17 +12,30 @@ public interface HsoaApi {
|
|||
* 登录
|
||||
*/
|
||||
@PostEndpoint("/garbage/mLoginApi/login")
|
||||
HsoaResult<LoginResult> login(@FormBodyParam LoginParam apram);
|
||||
HsoaResult<LoginResult> login(@FormBodyParam LoginParam param);
|
||||
|
||||
/**
|
||||
* 刷新 TOKEN
|
||||
*/
|
||||
@GetEndpoint("/garbage/mLoginApi/refreshToken")
|
||||
HsoaResult<LoginResult> refreshToken(@QueryParam RefreshTokenParam apram);
|
||||
HsoaResult<LoginResult> refreshToken(@QueryParam RefreshTokenParam param);
|
||||
|
||||
/**
|
||||
* 发送定位数据
|
||||
*/
|
||||
@PostEndpoint("/garbage/commonApi/pushVehicleTrajectory")
|
||||
HsoaResult<Object> pushVehicleTrajectory(@JsonBodyParam PushVehicleTrajectoryParam apram, @QueryParam TokenParam tokenParam);
|
||||
HsoaResult<Object> pushVehicleTrajectory(@JsonBodyParam PushVehicleTrajectoryParam param, @QueryParam TokenParam tokenParam);
|
||||
|
||||
/**
|
||||
* 电子联单数据
|
||||
*/
|
||||
@PostEndpoint("/garbage/api/pushProvincial/save")
|
||||
HsoaResult<Object> pushProvincial(@JsonBodyParam PushProvincialSaveParam param, @QueryParam TokenParam tokenParam);
|
||||
|
||||
/**
|
||||
* 上传附件
|
||||
*/
|
||||
@PostEndpoint("/garbage/api/pushProvincial/upload")
|
||||
UploadResult upload(@MultiBodyParam PushProvincialUploadParam param, @QueryParam TokenParam tokenParam);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.njzscloud.supervisory.hsoa.controller;
|
|||
|
||||
import com.njzscloud.common.core.utils.R;
|
||||
import com.njzscloud.supervisory.hsoa.Hsoa;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.PushProvincialSaveParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.PushVehicleTrajectoryParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.result.HsoaResult;
|
||||
import com.njzscloud.supervisory.hsoa.service.HsoaService;
|
||||
|
|
@ -15,17 +16,16 @@ public class HsoaController {
|
|||
|
||||
private final HsoaService hsoaService;
|
||||
|
||||
@PostMapping("/push")
|
||||
public R<?> push(@RequestBody PushVehicleTrajectoryParam pushVehicleTrajectoryParam) {
|
||||
@PostMapping("/push_vehicle_trajectory")
|
||||
public R<?> pushVehicleTrajectory(@RequestBody PushVehicleTrajectoryParam pushVehicleTrajectoryParam) {
|
||||
HsoaResult<?> objectHsoaResult = Hsoa.pushVehicleTrajectory(pushVehicleTrajectoryParam);
|
||||
if (objectHsoaResult.isSuccess()) {
|
||||
return R.success(objectHsoaResult);
|
||||
}
|
||||
return R.failed();
|
||||
return R.success(objectHsoaResult);
|
||||
}
|
||||
|
||||
@GetMapping("/push_order")
|
||||
public R<?> pushOrder(@RequestParam Long orderId, @RequestParam Integer count) {
|
||||
return R.success(hsoaService.pushOrder(orderId, count));
|
||||
@PostMapping("/push_provincial")
|
||||
public R<?> pushProvincial(@RequestParam PushProvincialSaveParam param) {
|
||||
HsoaResult<?> hsoaResult = Hsoa.pushProvincial(param);
|
||||
return R.success(hsoaResult);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,653 @@
|
|||
package com.njzscloud.supervisory.hsoa.pojo.param;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 建筑垃圾处置运输订单主实体
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class PushProvincialSaveParam {
|
||||
|
||||
/**
|
||||
* 处置场接收信息DTO
|
||||
*/
|
||||
@JsonProperty("handleInfoDTO")
|
||||
private HandleInfo handleInfo;
|
||||
|
||||
/**
|
||||
* 审批信息DTO
|
||||
*/
|
||||
@JsonProperty("reviewInfoDTO")
|
||||
private ReviewInfo reviewInfo;
|
||||
|
||||
/**
|
||||
* 运输订单基础信息DTO
|
||||
*/
|
||||
@JsonProperty("transportOrderDTO")
|
||||
private TransportOrder transportOrder;
|
||||
|
||||
/**
|
||||
* 运输订单记录DTO
|
||||
*/
|
||||
@JsonProperty("transportOrderRecordDTO")
|
||||
private TransportOrderRecord transportOrderRecord;
|
||||
|
||||
/**
|
||||
* 处置场接收信息DTO
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public static class HandleInfo {
|
||||
|
||||
/**
|
||||
* 核准日期
|
||||
*/
|
||||
private String approveDate;
|
||||
|
||||
/**
|
||||
* 核准人姓名
|
||||
*/
|
||||
private String approveUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createrName;
|
||||
|
||||
/**
|
||||
* 处置场编码
|
||||
*/
|
||||
private String disposalSiteCode;
|
||||
|
||||
/**
|
||||
* 处置场名称
|
||||
*/
|
||||
private String disposalSiteName;
|
||||
|
||||
/**
|
||||
* 处置工艺
|
||||
*/
|
||||
private String handleCraft;
|
||||
|
||||
/**
|
||||
* 处置许可证名称
|
||||
*/
|
||||
private String handleLicenseName;
|
||||
|
||||
/**
|
||||
* 处置许可证编码
|
||||
*/
|
||||
private String handleLicenseNum;
|
||||
|
||||
/**
|
||||
* 处置方式(回填、填埋、资源化利用、焚烧、其他)
|
||||
*/
|
||||
private String handleMethod;
|
||||
|
||||
/**
|
||||
* 处置场纬度
|
||||
*/
|
||||
private String latitude;
|
||||
|
||||
/**
|
||||
* 终端处置场处置许可证附件路径
|
||||
*/
|
||||
@JsonProperty("HANDLE_LICENSE_FILE")
|
||||
private String handleLicenseFile;
|
||||
|
||||
/**
|
||||
* 处置许可证结束有效期
|
||||
*/
|
||||
private String licenseValidEndDate;
|
||||
|
||||
/**
|
||||
* 处置许可证开始有效期
|
||||
*/
|
||||
private String licenseValidStartDate;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String linkPhone;
|
||||
|
||||
/**
|
||||
* 处置场经度
|
||||
*/
|
||||
private String longitude;
|
||||
|
||||
/**
|
||||
* 批准(监督)单位名称
|
||||
*/
|
||||
private String superviseUnitName;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updaterName;
|
||||
|
||||
/**
|
||||
* 终端处置场处置凭证附件路径(勘料照片)
|
||||
*/
|
||||
|
||||
@JsonProperty("HANDLE_VOUCHER_FILE")
|
||||
private String handleVoucherFile;
|
||||
|
||||
/**
|
||||
* 重量(单位: 吨)
|
||||
*/
|
||||
private String weight;
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批信息DTO
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public static class ReviewInfo {
|
||||
|
||||
/**
|
||||
* 城管部门所属区域名称
|
||||
*/
|
||||
private String cgAreaName;
|
||||
|
||||
/**
|
||||
* 城管部门审批意见
|
||||
*/
|
||||
private String cgReviewOpinion;
|
||||
|
||||
/**
|
||||
* 城管部门审批时间
|
||||
*/
|
||||
private LocalDateTime cgReviewTime;
|
||||
|
||||
/**
|
||||
* 城管部门审批人所属部门编码
|
||||
*/
|
||||
private String cgUnitCode;
|
||||
|
||||
/**
|
||||
* 城管部门审批人所属部门名称
|
||||
*/
|
||||
private String cgUnitName;
|
||||
|
||||
/**
|
||||
* 城管部门审批人id
|
||||
*/
|
||||
private String cgUserId;
|
||||
|
||||
/**
|
||||
* 城管部门审批人名称
|
||||
*/
|
||||
private String cgUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createrName;
|
||||
|
||||
/**
|
||||
* 交通部门所属区域名称
|
||||
*/
|
||||
private String jtAreaName;
|
||||
|
||||
/**
|
||||
* 交通部门审批意见
|
||||
*/
|
||||
private String jtReviewOpinion;
|
||||
|
||||
/**
|
||||
* 交通部门审批时间
|
||||
*/
|
||||
private String jtReviewTime;
|
||||
|
||||
/**
|
||||
* 交通部门审批人所属部门编码
|
||||
*/
|
||||
private String jtUnitCode;
|
||||
|
||||
/**
|
||||
* 交通部门审批人所属部门名称
|
||||
*/
|
||||
private String jtUnitName;
|
||||
|
||||
/**
|
||||
* 交通部门审批人id
|
||||
*/
|
||||
private String jtUserId;
|
||||
|
||||
/**
|
||||
* 交通部门审批人名称
|
||||
*/
|
||||
private String jtUserName;
|
||||
|
||||
/**
|
||||
* 交通部门审批附件路径
|
||||
*/
|
||||
@JsonProperty("JT_REVIEW_FILE")
|
||||
private String jtReviewFile;
|
||||
|
||||
/**
|
||||
* 城管部门审批附件路径
|
||||
*/
|
||||
@JsonProperty("CG_REVIEW_FILE")
|
||||
private String cgReviewFile;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updaterName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 运输订单基础信息DTO
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public static class TransportOrder {
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 预约结束日期(yyyy-mm-dd)
|
||||
*/
|
||||
private String appointmentEndDate;
|
||||
|
||||
/**
|
||||
* 预约结束时间(hh: mm)
|
||||
*/
|
||||
private String appointmentEndTime;
|
||||
|
||||
/**
|
||||
* 预约开始日期(yyyy-mm-dd)
|
||||
*/
|
||||
private String appointmentStartDate;
|
||||
|
||||
/**
|
||||
* 预约开始时间(hh: mm)
|
||||
*/
|
||||
private String appointmentStartTime;
|
||||
|
||||
/**
|
||||
* 所属区编码
|
||||
*/
|
||||
private String areaCode;
|
||||
|
||||
/**
|
||||
* 所属区名称
|
||||
*/
|
||||
private String areaName;
|
||||
|
||||
/**
|
||||
* 所属市编码
|
||||
*/
|
||||
private String cityCode;
|
||||
|
||||
/**
|
||||
* 所属市名称
|
||||
*/
|
||||
private String cityName;
|
||||
|
||||
/**
|
||||
* 建设工程(用地)规划许可证号
|
||||
*/
|
||||
private String constructionLandLicenseNum;
|
||||
|
||||
/**
|
||||
* 建设单位统一社会信用代码
|
||||
*/
|
||||
private String constructionUnitCreditCode;
|
||||
|
||||
/**
|
||||
* 建设单位负责人
|
||||
*/
|
||||
private String constructionUnitDirector;
|
||||
|
||||
/**
|
||||
* 建设单位名称
|
||||
*/
|
||||
private String constructionUnitName;
|
||||
|
||||
/**
|
||||
* 建设单位联系电话
|
||||
*/
|
||||
private String constructionUnitPhone;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createrName;
|
||||
|
||||
/**
|
||||
* 排放源(产废单位)
|
||||
*/
|
||||
private String emissionSource;
|
||||
|
||||
/**
|
||||
* 清运企业联系人
|
||||
*/
|
||||
private String enterpriseHead;
|
||||
|
||||
/**
|
||||
* 预估重量(单位: 吨)
|
||||
*/
|
||||
private String estimateWeight;
|
||||
|
||||
/**
|
||||
* 垃圾产出的许可证名称
|
||||
*/
|
||||
private String garbageProductionLicenseName;
|
||||
|
||||
/**
|
||||
* 垃圾产出的许可证编号
|
||||
*/
|
||||
private String garbageProductionLicenseNum;
|
||||
|
||||
/**
|
||||
* 垃圾现场照片路径(多个路径用逗号分隔)
|
||||
*/
|
||||
@JsonProperty("GARBAGE_SCENE_FILE")
|
||||
private String garbageSceneFile;
|
||||
|
||||
/**
|
||||
* 清运企业联系人电话
|
||||
*/
|
||||
private String headContact;
|
||||
|
||||
/**
|
||||
* 纬度(产废单位)
|
||||
*/
|
||||
private String latitude;
|
||||
|
||||
/**
|
||||
* 经度(产废单位)
|
||||
*/
|
||||
private String longitude;
|
||||
|
||||
/**
|
||||
* 订单编号(新的编号方式)
|
||||
*/
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 订单状态(90: 已处置(终端处置场提交处置表单,整个流程结束))
|
||||
*/
|
||||
private Integer orderStatus;
|
||||
|
||||
/**
|
||||
* 订单类型(1: 个人居民 2: 居委物业 3: 沿街商铺 4: 建筑工地)
|
||||
*/
|
||||
private Integer orderType;
|
||||
|
||||
/**
|
||||
* 工程名称(项目名称)
|
||||
*/
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 清运企业注册地址
|
||||
*/
|
||||
private String registerAddress;
|
||||
|
||||
/**
|
||||
* 建筑工地清运预约现场联系人
|
||||
*/
|
||||
private String sceneLinkName;
|
||||
|
||||
/**
|
||||
* 建筑工地清运预约现场联系电话
|
||||
*/
|
||||
private String sceneLinkPhone;
|
||||
|
||||
/**
|
||||
* 所属街道编码
|
||||
*/
|
||||
private String streetCode;
|
||||
|
||||
/**
|
||||
* 所属街道名称
|
||||
*/
|
||||
private String streetName;
|
||||
|
||||
/**
|
||||
* 清运企业id
|
||||
*/
|
||||
private String transportationEnterpriseId;
|
||||
|
||||
/**
|
||||
* 清运企业名称
|
||||
*/
|
||||
private String transportationEnterpriseName;
|
||||
|
||||
/**
|
||||
* 垃圾类型编码(1: 工程渣土 2: 工程泥浆 3: 工程垃圾 4: 拆除垃圾 5: 装修垃圾)
|
||||
*/
|
||||
private String wasteTypeCode;
|
||||
|
||||
/**
|
||||
* 垃圾类型名称(1: 工程渣土 2: 工程泥浆 3: 工程垃圾 4: 拆除垃圾 5: 装修垃圾)
|
||||
*/
|
||||
private String wasteTypeName;
|
||||
|
||||
/**
|
||||
* 施工单位统一社会信用代码
|
||||
*/
|
||||
private String workUnitCreditCode;
|
||||
|
||||
/**
|
||||
* 施工单位负责人
|
||||
*/
|
||||
private String workUnitDirector;
|
||||
|
||||
/**
|
||||
* 施工单位名称
|
||||
*/
|
||||
private String workUnitName;
|
||||
|
||||
/**
|
||||
* 施工单位联系电话
|
||||
*/
|
||||
private String workUnitPhone;
|
||||
}
|
||||
|
||||
/**
|
||||
* 运输订单记录DTO
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public static class TransportOrderRecord {
|
||||
|
||||
/**
|
||||
* 消纳单位名称
|
||||
*/
|
||||
private String absorptionUnitName;
|
||||
|
||||
/**
|
||||
* 审批状态(3: 已审批)
|
||||
*/
|
||||
private Integer auditStatus;
|
||||
|
||||
/**
|
||||
* 运输车辆车牌号
|
||||
*/
|
||||
private String carNo;
|
||||
|
||||
/**
|
||||
* 消纳单位类型(1: 中转站 3: 资源利用企业 4: 消纳场)
|
||||
*/
|
||||
private String absorptionUnitType;
|
||||
|
||||
/**
|
||||
* 消纳单位编码
|
||||
*/
|
||||
private String absorptionUnitCode;
|
||||
|
||||
/**
|
||||
* 创建时间(yyyy-MM-dd HH: mm: ss)
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 运输司机驾驶证号
|
||||
*/
|
||||
private String driverLicense;
|
||||
|
||||
/**
|
||||
* 企业联系人
|
||||
*/
|
||||
private String enterpriseHead;
|
||||
|
||||
/**
|
||||
* 企业运输的许可证名称
|
||||
*/
|
||||
private String enterpriseTransportLicenseName;
|
||||
|
||||
/**
|
||||
* 企业运输的许可证编号
|
||||
*/
|
||||
private String enterpriseTransportLicenseNum;
|
||||
|
||||
/**
|
||||
* 预估重量(单位: 吨)
|
||||
*/
|
||||
private String estimateWeight;
|
||||
|
||||
/**
|
||||
* 司机实际结束运输时间
|
||||
*/
|
||||
private LocalDateTime haulageEndTimeStr;
|
||||
|
||||
/**
|
||||
* 司机实际开始运输时间
|
||||
*/
|
||||
private LocalDateTime haulageStartTimeStr;
|
||||
|
||||
/**
|
||||
* 联系人电话
|
||||
*/
|
||||
private String headContact;
|
||||
|
||||
/**
|
||||
* 运输许可证照片路径
|
||||
*/
|
||||
@JsonProperty("TRANS_LICENSE_FILE")
|
||||
private String transLicenseFile;
|
||||
|
||||
/**
|
||||
* 垃圾装车前附件路径
|
||||
*/
|
||||
@JsonProperty("GARBAGE_LOAD_BEFORE_FILE")
|
||||
private String garbageLoadBeforeFile;
|
||||
|
||||
/**
|
||||
* 垃圾装车后附件路径
|
||||
*/
|
||||
@JsonProperty("GARBAGE_LOAD_AFTER_FILE")
|
||||
private String garbageLoadAfterFile;
|
||||
|
||||
/**
|
||||
* 运输许可证有效期起止(格式:yyyy-MM-dd-yyyy-MM-dd)
|
||||
*/
|
||||
private String licenseValidityPeriodDateRange;
|
||||
|
||||
/**
|
||||
* 企业运输的许可证结束有效期
|
||||
*/
|
||||
private String licenseValidityPeriodEndDate;
|
||||
|
||||
/**
|
||||
* 企业运输的许可证开始有效期
|
||||
*/
|
||||
private String licenseValidityPeriodStartDate;
|
||||
|
||||
/**
|
||||
* 运输路线
|
||||
*/
|
||||
private String route;
|
||||
|
||||
/**
|
||||
* 批准(监督)单位名称
|
||||
*/
|
||||
private String superviseUnitName;
|
||||
|
||||
/**
|
||||
* 运输日期范围(格式:yyyy-MM-dd-yyyy-MM-dd)
|
||||
*/
|
||||
private String transportDateRange;
|
||||
|
||||
/**
|
||||
* 运输结束日期
|
||||
*/
|
||||
private String transportEndDate;
|
||||
|
||||
/**
|
||||
* 运输开始日期
|
||||
*/
|
||||
private String transportStartDate;
|
||||
|
||||
/**
|
||||
* 清运企业id
|
||||
*/
|
||||
private String transportationEnterpriseId;
|
||||
|
||||
/**
|
||||
* 清运企业名称
|
||||
*/
|
||||
private String transportationEnterpriseName;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 修改人名称
|
||||
*/
|
||||
private String updaterName;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.njzscloud.supervisory.hsoa.pojo.param;
|
||||
|
||||
import com.njzscloud.common.http.annotation.MultiBodyParam;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class PushProvincialUploadParam {
|
||||
// 垃圾现场照片
|
||||
public static final String GARBAGE_SCENE_FILE = "GARBAGE_SCENE_FILE";
|
||||
// 垃圾产出的许可证照片
|
||||
public static final String LICENSE_FILE = "LICENSE_FILE";
|
||||
// 垃圾运输的许可证照片
|
||||
public static final String TRANS_LICENSE_FILE = "TRANS_LICENSE_FILE";
|
||||
// 委托书照片
|
||||
public static final String PROXY_STATEMENT_FILE = "PROXY_STATEMENT_FILE";
|
||||
// 建筑工地
|
||||
public static final String CONS_SITE_FILE = "CONS_SITE_FILE";
|
||||
// 居民小区
|
||||
public static final String RES_AREA_FILE = "RES_AREA_FILE";
|
||||
// 沿街商铺
|
||||
public static final String STREET_SHOP_FILE = "STREET_SHOP_FILE";
|
||||
// 运输企业
|
||||
public static final String TRANS_ENTER_FILE = "TRANS_ENTER_FILE";
|
||||
// 运输车辆
|
||||
public static final String TRANS_VEHICLE_FILE = "TRANS_VEHICLE_FILE";
|
||||
// 驾驶员
|
||||
public static final String TRANS_DRIVER_FILE = "TRANS_DRIVER_FILE";
|
||||
// 垃圾中转站
|
||||
public static final String TRANS_STA_FILE = "TRANS_STA_FILE";
|
||||
// 垃圾存放点
|
||||
public static final String STO_POINT_FILE = "STO_POINT_FILE";
|
||||
// 资源利用企业
|
||||
public static final String RES_UTIL_FILE = "RES_UTIL_FILE";
|
||||
// 垃圾消纳场所
|
||||
public static final String CONS_PLACE_FILE = "CONS_PLACE_FILE";
|
||||
// 垃圾回填场所
|
||||
public static final String BACKFILL_PLACE_FILE = "BACKFILL_PLACE_FILE";
|
||||
// 我的意见
|
||||
public static final String MY_OPINION_FILE = "MY_OPINION_FILE";
|
||||
// 主管部门审批附件
|
||||
public static final String ZG_REVIEW_FILE = "ZG_REVIEW_FILE";
|
||||
// 交通部门审批附件
|
||||
public static final String JT_REVIEW_FILE = "JT_REVIEW_FILE";
|
||||
// 城管部门审批附件
|
||||
public static final String CG_REVIEW_FILE = "CG_REVIEW_FILE";
|
||||
// 消息资讯附件
|
||||
public static final String NEWS_INFO_FILE = "NEWS_INFO_FILE";
|
||||
// 垃圾运输附件
|
||||
public static final String GARBAGE_TRANS_FILE = "GARBAGE_TRANS_FILE";
|
||||
// 终端处置场处置许可证附件
|
||||
public static final String HANDLE_LICENSE_FILE = "HANDLE_LICENSE_FILE";
|
||||
// 终端处置场处置凭证附件
|
||||
public static final String HANDLE_VOUCHER_FILE = "HANDLE_VOUCHER_FILE";
|
||||
// 无人机巡检案件附件/手机端上报案件附件
|
||||
public static final String INSPECTION_EVENT_FILE = "INSPECTION_EVENT_FILE";
|
||||
// 垃圾装车前附件
|
||||
public static final String GARBAGE_LOAD_BEFORE_FILE = "GARBAGE_LOAD_BEFORE_FILE";
|
||||
// 垃圾装车后附件
|
||||
public static final String GARBAGE_LOAD_AFTER_FILE = "GARBAGE_LOAD_AFTER_FILE";
|
||||
// 无人机巡检/手机端案件处置附件
|
||||
public static final String DISPOSAL_EVENT_FILE = "DISPOSAL_EVENT_FILE";
|
||||
|
||||
/**
|
||||
* 文件
|
||||
*/
|
||||
@MultiBodyParam
|
||||
private InputStream file;
|
||||
|
||||
/**
|
||||
* 路径,参照下方附件上传接口 路径字典值
|
||||
*/
|
||||
@MultiBodyParam
|
||||
private String uploadPath;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.njzscloud.supervisory.hsoa.pojo.result;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class UploadResult {
|
||||
private String msg;
|
||||
private String flag;
|
||||
private String id;
|
||||
private String url;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return "success".equals(flag);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +1,39 @@
|
|||
package com.njzscloud.supervisory.hsoa.service;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.map.MapBuilder;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.njzscloud.common.core.ex.Exceptions;
|
||||
import com.njzscloud.supervisory.biz.pojo.entity.TruckLocationTrackEntity;
|
||||
import com.njzscloud.supervisory.biz.service.TruckLocationTrackService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njzscloud.common.core.jackson.Jackson;
|
||||
import com.njzscloud.common.core.tuple.Tuple2;
|
||||
import com.njzscloud.common.core.utils.ImgUtil;
|
||||
import com.njzscloud.common.oss.util.AliOSS;
|
||||
import com.njzscloud.supervisory.hsoa.Hsoa;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.PushVehicleTrajectoryParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.PushProvincialSaveParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.PushProvincialUploadParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.result.HsoaResult;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.result.UploadResult;
|
||||
import com.njzscloud.supervisory.order.pojo.result.OrderPagingResult;
|
||||
import com.njzscloud.supervisory.order.service.OrderInfoService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import static com.njzscloud.supervisory.hsoa.pojo.param.PushProvincialUploadParam.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class HsoaService {
|
||||
private final OrderInfoService orderInfoService;
|
||||
private final TruckLocationTrackService truckLocationTrackService;
|
||||
// private final OrderInfoService orderInfoService;
|
||||
/* private final TruckLocationTrackService truckLocationTrackService;
|
||||
private final AtomicBoolean run = new AtomicBoolean(false);
|
||||
private final AtomicInteger succ = new AtomicInteger(0);
|
||||
private final AtomicInteger fail = new AtomicInteger(0);
|
||||
|
|
@ -137,5 +140,140 @@ public class HsoaService {
|
|||
.put("剩余数量", i1 - i2 - i3)
|
||||
.build();
|
||||
|
||||
} */
|
||||
|
||||
public HsoaResult<?> pushProvincialSave(OrderPagingResult detail) {
|
||||
log.info("上传数据:{}", Jackson.toJsonStr(detail));
|
||||
|
||||
return Hsoa.pushProvincial(new PushProvincialSaveParam()
|
||||
.setHandleInfo(new PushProvincialSaveParam.HandleInfo()
|
||||
.setApproveDate(detail.getOutTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
|
||||
.setApproveUserName(detail.getCheckerName())
|
||||
.setCreateTime(detail.getCreateTime())
|
||||
.setCreaterName(detail.getContacts())
|
||||
// .setDisposalSiteCode("")
|
||||
.setDisposalSiteName(detail.getStationName())
|
||||
// .setHandleCraft("")
|
||||
// .setHandleLicenseName("")
|
||||
// .setHandleLicenseNum("")
|
||||
.setHandleMethod("资源化利用")
|
||||
.setLongitude(detail.getStationLng().toString())
|
||||
.setLatitude(detail.getStationLat().toString())
|
||||
// .setHANDLE_LICENSE_FILE("")
|
||||
// .setLicenseValidStartDate("")
|
||||
// .setLicenseValidEndDate("")
|
||||
.setLinkPhone(detail.getCheckerPhone())
|
||||
// .setSuperviseUnitName("")
|
||||
// .setUpdateTime("")
|
||||
// .setUpdaterName("")
|
||||
.setHandleVoucherFile(upload(detail.getCheckPhoto(), HANDLE_VOUCHER_FILE))
|
||||
.setWeight(new BigDecimal(detail.getSettleWeight()).divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP).toPlainString())
|
||||
)
|
||||
.setReviewInfo(new PushProvincialSaveParam.ReviewInfo()
|
||||
.setCgAreaName(detail.getProvinceName() + detail.getCityName() + detail.getAreaName())
|
||||
.setCgReviewOpinion(StrUtil.isBlank(detail.getAuditMemo()) ? "同意" : detail.getAuditMemo())
|
||||
.setCgReviewTime(detail.getAuditTime())
|
||||
// .setCgUnitCode("")
|
||||
.setCgUnitName(detail.getAreaName() + "城管")
|
||||
.setCgUserId(detail.getQuAuditUserId() == null ? (detail.getShiAuditUserId() == null ? null : detail.getShiAuditUserId().toString()) : detail.getQuAuditUserId().toString())
|
||||
.setCgUserName(detail.getQuAuditUserName() == null ? (detail.getShiAuditUserName() == null ? null : detail.getShiAuditUserName()) : detail.getQuAuditUserName())
|
||||
.setCreateTime(detail.getCreateTime())
|
||||
.setCreaterName(detail.getContacts())
|
||||
// .setCG_REVIEW_FILE("")
|
||||
)
|
||||
.setTransportOrder(new PushProvincialSaveParam.TransportOrder()
|
||||
.setAddress(detail.getAddress())
|
||||
.setAppointmentStartDate(detail.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
|
||||
.setAppointmentStartTime(detail.getCreateTime().format(DateTimeFormatter.ofPattern("HH:mm")))
|
||||
.setAreaCode(detail.getArea())
|
||||
.setAreaName(detail.getAreaName())
|
||||
.setCityCode(detail.getCity())
|
||||
.setCityName(detail.getCityName())
|
||||
.setConstructionUnitCreditCode(detail.getUscc())
|
||||
.setConstructionUnitName(detail.getCompanyName())
|
||||
.setConstructionUnitDirector(detail.getContacts())
|
||||
.setConstructionUnitPhone(detail.getPhone())
|
||||
.setEmissionSource(detail.getCompanyName() == null ? detail.getContacts() : detail.getCompanyName())
|
||||
.setEstimateWeight(detail.getEstimatedQuantity())
|
||||
.setGarbageSceneFile(upload(detail.getSitePhotos(), GARBAGE_SCENE_FILE))
|
||||
.setEnterpriseHead(detail.getTransContacts())
|
||||
.setHeadContact(detail.getTransPhone())
|
||||
.setLatitude(detail.getLat() == null ? null : detail.getLat().toString())
|
||||
.setLongitude(detail.getLng() == null ? null : detail.getLng().toString())
|
||||
// .setOrderNumber(detail.getArea() + detail.getSn())
|
||||
.setOrderStatus(90)
|
||||
.setOrderType(detail.getCompanyName() == null ? 1 : 4)
|
||||
.setProjectName(detail.getProjectName())
|
||||
.setRegisterAddress(detail.getTransAddress())
|
||||
.setSceneLinkName(detail.getContacts())
|
||||
.setSceneLinkPhone(detail.getPhone())
|
||||
.setStreetCode(detail.getTown())
|
||||
.setStreetName(detail.getTownName())
|
||||
.setTransportationEnterpriseId(detail.getTransCompanyId() == null ? null : detail.getTransCompanyId().toString())
|
||||
.setTransportationEnterpriseName(detail.getTransCompanyName())
|
||||
.setWasteTypeCode(detail.getGoodsName().contains("拆除") ? "4" : (detail.getGoodsName().contains("装修") ? "5" : (detail.getGoodsName().contains("建筑") ? "3" : null)))
|
||||
.setWasteTypeName(detail.getGoodsName())
|
||||
.setWorkUnitCreditCode(detail.getUscc())
|
||||
.setWorkUnitDirector(detail.getContacts())
|
||||
.setWorkUnitPhone(detail.getPhone())
|
||||
.setWorkUnitName(detail.getCompanyName())
|
||||
)
|
||||
.setTransportOrderRecord(new PushProvincialSaveParam.TransportOrderRecord()
|
||||
.setAbsorptionUnitName(detail.getStationCompanyName())
|
||||
.setAuditStatus(3)
|
||||
.setCarNo(detail.getLicensePlate())
|
||||
.setAbsorptionUnitType("1")
|
||||
.setAbsorptionUnitCode(detail.getStationUscc())
|
||||
.setDriverLicense(detail.getDrivingLicenceNo())
|
||||
.setEnterpriseHead(detail.getDriverName())
|
||||
.setHeadContact(detail.getDriverPhone())
|
||||
// .setEnterpriseTransportLicenseName("")
|
||||
.setEnterpriseTransportLicenseNum(detail.getCertificateSn())
|
||||
.setEstimateWeight(detail.getEstimatedQuantity())
|
||||
.setHaulageStartTimeStr(detail.getTransTime())
|
||||
.setHaulageEndTimeStr(detail.getOutTime())
|
||||
// .setTRANS_LICENSE_FILE("")
|
||||
.setGarbageLoadBeforeFile(upload(detail.getCargoPhoto(), GARBAGE_LOAD_BEFORE_FILE))
|
||||
.setGarbageLoadAfterFile(upload(detail.getCargoPhoto(), GARBAGE_LOAD_AFTER_FILE))
|
||||
.setLicenseValidityPeriodDateRange(detail.getAuditTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + "-" + detail.getAuditTime().plusHours(24).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
|
||||
.setLicenseValidityPeriodStartDate(detail.getAuditTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
|
||||
.setLicenseValidityPeriodEndDate(detail.getAuditTime().plusHours(24).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
|
||||
// .setRoute("")
|
||||
.setSuperviseUnitName(detail.getAreaName())
|
||||
.setTransportDateRange(detail.getTransTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + "-" + detail.getOutTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
|
||||
.setTransportStartDate(detail.getTransTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
|
||||
.setTransportEndDate(detail.getOutTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
|
||||
.setTransportationEnterpriseId(detail.getTransCompanyId() == null ? null : detail.getTransCompanyId().toString())
|
||||
.setTransportationEnterpriseName(detail.getTransCompanyName())
|
||||
));
|
||||
}
|
||||
|
||||
private String upload(List<String> urls, String uploadPath) {
|
||||
if (CollUtil.isEmpty(urls)) return null;
|
||||
String url = urls.get(0);
|
||||
if (StrUtil.isBlank(url)) return null;
|
||||
url = url.substring(1);
|
||||
String[] split = url.split("/");
|
||||
if (split.length < 2) return null;
|
||||
Tuple2<InputStream, String> tuple2 = AliOSS.obtainFile(split[0], split[1]);
|
||||
InputStream in = tuple2.get_0();
|
||||
try {
|
||||
ByteArrayOutputStream out = ImgUtil.compress(in, 0.5, FileUtil.extName(split[1]), 1024 * 1024);
|
||||
byte[] bytes = out.toByteArray();
|
||||
UploadResult upload = Hsoa.upload(new PushProvincialUploadParam()
|
||||
.setFile(new ByteArrayInputStream(bytes))
|
||||
.setUploadPath(uploadPath)
|
||||
);
|
||||
if (upload.isSuccess()) {
|
||||
log.info("图片:{}、{}", uploadPath, upload.getUrl());
|
||||
return upload.getUrl();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
IoUtil.close(in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -263,6 +263,7 @@ public class OrderInfoController {
|
|||
|
||||
/**
|
||||
* 转办
|
||||
*
|
||||
* @param orderId 订单Id
|
||||
*/
|
||||
@GetMapping("/forwarded")
|
||||
|
|
@ -292,4 +293,9 @@ public class OrderInfoController {
|
|||
return R.success();
|
||||
}
|
||||
|
||||
@PostMapping("/hsoa/push_provincial")
|
||||
public R<?> pushProvincial(@RequestParam("orderId") Long orderId) {
|
||||
return R.success(orderInfoService.pushProvincial(orderId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,6 +145,8 @@ public class OrderPagingResult {
|
|||
*/
|
||||
private String auditMemo;
|
||||
private String checkerName;
|
||||
private String checkerPhone;
|
||||
|
||||
|
||||
/**
|
||||
* 订单类型; 字典代码:order_category
|
||||
|
|
@ -530,5 +532,7 @@ public class OrderPagingResult {
|
|||
private String stationUscc;
|
||||
private String stationContacts;
|
||||
private String stationPhone;
|
||||
private Double stationLng;
|
||||
private Double stationLat;
|
||||
// endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import com.njzscloud.supervisory.goods.contant.MoneyStrategy;
|
|||
import com.njzscloud.supervisory.hsoa.Hsoa;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.param.PushVehicleTrajectoryParam;
|
||||
import com.njzscloud.supervisory.hsoa.pojo.result.HsoaResult;
|
||||
import com.njzscloud.supervisory.hsoa.service.HsoaService;
|
||||
import com.njzscloud.supervisory.money.contant.MoneyChangeCategory;
|
||||
import com.njzscloud.supervisory.money.pojo.entity.MoneyAccountEntity;
|
||||
import com.njzscloud.supervisory.money.pojo.entity.MoneyChangeDetailEntity;
|
||||
|
|
@ -115,6 +116,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
private final UserService userService;
|
||||
private final BizTruckService bizTruckService;
|
||||
private final DiscountManageService discountManageService;
|
||||
private final HsoaService hsoaService;
|
||||
private final AtomicBoolean test_thread_running = new AtomicBoolean(false);
|
||||
Thread test_thread = null;
|
||||
@Value("${app.check-gps:false}")
|
||||
|
|
@ -1274,6 +1276,18 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
log.error("订单状态改变事件发布失败,订单{},状态{}", orderInfoEntity_.getSn(), newOrderStatus, e);
|
||||
return null;
|
||||
});
|
||||
CompletableFuture.runAsync(() -> {
|
||||
OrderPagingResult detail = this.detail(orderId);
|
||||
HsoaResult<?> result = hsoaService.pushProvincialSave(detail);
|
||||
|
||||
if (result == null || !result.isSuccess()) {
|
||||
Hsoa.relogin();
|
||||
log.error("推送订单数据失败,数据Id:{}", entity.getId());
|
||||
}
|
||||
}).exceptionally(e -> {
|
||||
log.error("推送订单数据失败,数据Id:{}", entity.getId(), e);
|
||||
return null;
|
||||
});
|
||||
|
||||
// 出厂付费
|
||||
if (MoneyWay.OUT.getVal().equals(entity.getMoneyWay())) {
|
||||
|
|
@ -1696,7 +1710,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
ew.like(StrUtil.isNotBlank(searchParam.getLicensePlate()), "d.license_plate", searchParam.getLicensePlate());
|
||||
ew.like(StrUtil.isNotBlank(searchParam.getPhone()), "a.phone", searchParam.getPhone());
|
||||
ew.like(StrUtil.isNotBlank(searchParam.getNickname()), "a.contacts", searchParam.getNickname());
|
||||
ew.like(StrUtil.isNotBlank(transCompanyName), "g.company_name",transCompanyName);
|
||||
ew.like(StrUtil.isNotBlank(transCompanyName), "g.company_name", transCompanyName);
|
||||
ew.like(StrUtil.isNotBlank(driverName), "f.driver_name", driverName);
|
||||
ew.ge(startTime != null, "a.create_time", startTime);
|
||||
ew.le(endTime != null, "a.create_time", endTime);
|
||||
|
|
@ -2120,4 +2134,9 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
throw Exceptions.clierr("装货地址不存在");
|
||||
}
|
||||
}
|
||||
|
||||
public HsoaResult<?> pushProvincial(Long orderId) {
|
||||
OrderPagingResult detail = this.detail(orderId);
|
||||
return hsoaService.pushProvincialSave(detail);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@
|
|||
j.company_name,
|
||||
j.uscc,
|
||||
k.nickname checker_name,
|
||||
k.phone checker_phone,
|
||||
l.project_name,
|
||||
m.station_name,
|
||||
m.company_name station_company_name,
|
||||
|
|
@ -137,6 +138,8 @@
|
|||
m.uscc station_uscc,
|
||||
m.contacts station_contacts,
|
||||
m.phone station_phone,
|
||||
m.lng station_lng,
|
||||
m.lat station_lat,
|
||||
a.contacts,
|
||||
a.check_time,
|
||||
a.assignment_trans_time,
|
||||
|
|
|
|||
Loading…
Reference in New Issue