Compare commits
35 Commits
4b0c7627fe
...
eff2cf2819
| Author | SHA1 | Date |
|---|---|---|
|
|
eff2cf2819 | |
|
|
fc7632f9b4 | |
|
|
1cfecce36e | |
|
|
be6808af55 | |
|
|
dcb7f32b6d | |
|
|
0eaeea3b24 | |
|
|
d9462239fd | |
|
|
77db899d11 | |
|
|
c6730de026 | |
|
|
835417024c | |
|
|
8b249f37a0 | |
|
|
d6cbc62e5c | |
|
|
ca40e8260f | |
|
|
d59789fb9e | |
|
|
200bc1ee3a | |
|
|
9d5da6f075 | |
|
|
25190d46bd | |
|
|
6f7c13a84d | |
|
|
e4b216a3db | |
|
|
eb17f855dc | |
|
|
9a9df93792 | |
|
|
8e8cc9a5a7 | |
|
|
4816edf028 | |
|
|
376c9a1c8e | |
|
|
eb76f822c1 | |
|
|
d2dfd390b2 | |
|
|
33cdab43d3 | |
|
|
737b3168bc | |
|
|
8ee4147165 | |
|
|
23cd372a37 | |
|
|
1f6b6e78f9 | |
|
|
ea336aece1 | |
|
|
de971ca312 | |
|
|
b275a2c1fc | |
|
|
599bfee4b0 |
|
|
@ -151,6 +151,8 @@ public final class JT808 {
|
||||||
public static JT808Message parseMessage(ByteBuf buf) {
|
public static JT808Message parseMessage(ByteBuf buf) {
|
||||||
JT808Message jt808Message = new JT808Message();
|
JT808Message jt808Message = new JT808Message();
|
||||||
|
|
||||||
|
byte[] h_b = ByteBufUtil.getBytes(buf);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 1. 消息ID (2字节)
|
// 1. 消息ID (2字节)
|
||||||
jt808Message.setMessageId(buf.readUnsignedShort());
|
jt808Message.setMessageId(buf.readUnsignedShort());
|
||||||
|
|
@ -184,14 +186,22 @@ public final class JT808 {
|
||||||
jt808Message.setMessageBody(array);
|
jt808Message.setMessageBody(array);
|
||||||
|
|
||||||
// 7. 校验码 (1字节)
|
// 7. 校验码 (1字节)
|
||||||
jt808Message.setCheckCode(buf.readByte());
|
byte checkCode = buf.readByte();
|
||||||
|
jt808Message.setCheckCode(checkCode);
|
||||||
|
|
||||||
// 验证校验码
|
|
||||||
if (!verifyCheckCode(jt808Message, buf)) {
|
if (jt808Message.getMessageId() == 0x704) {
|
||||||
log.error("校验码错误: {}", jt808Message);
|
log.info("报文:{}", h_b);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int code = 0;
|
||||||
|
for (int i = 0; i < h_b.length - 1; i++) {
|
||||||
|
code = code ^ h_b[i];
|
||||||
|
}
|
||||||
|
if (code != checkCode) {
|
||||||
|
log.error("校验码错误: {} {}", code, checkCode);
|
||||||
|
// return null;
|
||||||
|
}
|
||||||
return jt808Message;
|
return jt808Message;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@ import lombok.Setter;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JT808协议消息实体类
|
* JT808协议消息实体类
|
||||||
* 用于存储解析后的JT808协议消息内容
|
* 用于存储解析后的JT808协议消息内容
|
||||||
|
|
@ -31,6 +34,7 @@ public class JT808Message {
|
||||||
private byte[] messageBody;
|
private byte[] messageBody;
|
||||||
// 校验码 (1字节)
|
// 校验码 (1字节)
|
||||||
private byte checkCode;
|
private byte checkCode;
|
||||||
|
|
||||||
public JT808Message() {
|
public JT808Message() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,6 +43,17 @@ public class JT808Message {
|
||||||
return messageBodyProps & 0x3FF;
|
return messageBodyProps & 0x3FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Integer> getBodyBytes() {
|
||||||
|
if (messageBody == null || messageBody.length == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ArrayList<Integer> integers = new ArrayList<>(messageBody.length);
|
||||||
|
for (byte b : messageBody) {
|
||||||
|
integers.add((int) b);
|
||||||
|
}
|
||||||
|
return integers;
|
||||||
|
}
|
||||||
|
|
||||||
// 从消息体属性中获取是否分包
|
// 从消息体属性中获取是否分包
|
||||||
public boolean isPackaged() {
|
public boolean isPackaged() {
|
||||||
return (messageBodyProps & 0x4000) != 0;
|
return (messageBodyProps & 0x4000) != 0;
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,10 @@ public class JT808MessageCenter {
|
||||||
|
|
||||||
Map<MessageType, Consumer<TerminalMessageBody>> m = listeners.computeIfPresent(localizerType, (k, v) -> {
|
Map<MessageType, Consumer<TerminalMessageBody>> m = listeners.computeIfPresent(localizerType, (k, v) -> {
|
||||||
MessageType messageType = MessageType.getMessageType(messageId);
|
MessageType messageType = MessageType.getMessageType(messageId);
|
||||||
|
if (messageType == MessageType.TerminalLocationBatchReport) {
|
||||||
|
log.info("批量上报:{}", message);
|
||||||
|
}
|
||||||
|
|
||||||
if (messageType == null) {
|
if (messageType == null) {
|
||||||
log.error("未找到消息类型,设备号:{},消息 Id:0x{}", terminalId, Integer.toHexString(messageId));
|
log.error("未找到消息类型,设备号:{},消息 Id:0x{}", terminalId, Integer.toHexString(messageId));
|
||||||
return v;
|
return v;
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,9 @@ public abstract class JT808MessageListener {
|
||||||
int speedThreshold = localizer.getSpeedThreshold();
|
int speedThreshold = localizer.getSpeedThreshold();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
int length = byteBuf.readUnsignedShort();
|
int length = byteBuf.readUnsignedShort();
|
||||||
|
/* if (length > 28) { // 有扩展信息
|
||||||
|
|
||||||
|
} */
|
||||||
LocationReportMessage locationReportMsg = new LocationReportMessage(byteBuf.slice(byteBuf.readerIndex(), length));
|
LocationReportMessage locationReportMsg = new LocationReportMessage(byteBuf.slice(byteBuf.readerIndex(), length));
|
||||||
byteBuf.skipBytes(length);
|
byteBuf.skipBytes(length);
|
||||||
double speed = locationReportMsg.getSpeed();
|
double speed = locationReportMsg.getSpeed();
|
||||||
|
|
@ -144,6 +147,8 @@ public abstract class JT808MessageListener {
|
||||||
Mqtt.publish(terminalId + "/track_location", realtimeLocationResult);
|
Mqtt.publish(terminalId + "/track_location", realtimeLocationResult);
|
||||||
Mqtt.publish(terminalId + "/track_location_real", realtimeLocationResult);
|
Mqtt.publish(terminalId + "/track_location_real", realtimeLocationResult);
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("批量上报处理失败:{} {}", terminalId, message.getFlowId());
|
||||||
} finally {
|
} finally {
|
||||||
byteBuf.release();
|
byteBuf.release();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public class TokenHandshakeInterceptor implements HandshakeInterceptor {
|
||||||
try {
|
try {
|
||||||
HttpServletRequest req = ((ServletServerHttpRequest) request).getServletRequest();
|
HttpServletRequest req = ((ServletServerHttpRequest) request).getServletRequest();
|
||||||
String authorization = req.getParameter(Authorization);
|
String authorization = req.getParameter(Authorization);
|
||||||
if (StrUtil.isBlank(authorization)) return false;
|
// if (StrUtil.isBlank(authorization)) return false;
|
||||||
|
|
||||||
Tuple2<Long, String> resolved = this.resolve(authorization);
|
Tuple2<Long, String> resolved = this.resolve(authorization);
|
||||||
if (resolved == null) return false;
|
if (resolved == null) return false;
|
||||||
|
|
@ -66,7 +66,7 @@ public class TokenHandshakeInterceptor implements HandshakeInterceptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Tuple2<Long, String> resolve(String tokenStr) {
|
private Tuple2<Long, String> resolve(String tokenStr) {
|
||||||
if (StrUtil.isBlank(tokenStr)) return Tuple2.create(0L, IdUtil.fastSimpleUUID());
|
if (StrUtil.isBlank(tokenStr)) return Tuple2.create(1L, IdUtil.fastSimpleUUID());
|
||||||
UserDetail userDetail = SecurityUtil.parseToken(tokenStr);
|
UserDetail userDetail = SecurityUtil.parseToken(tokenStr);
|
||||||
if (userDetail == null) return null;
|
if (userDetail == null) return null;
|
||||||
Token token = userDetail.getToken();
|
Token token = userDetail.getToken();
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,19 @@
|
||||||
package com.njzscloud.supervisory.biz.mapper;
|
package com.njzscloud.supervisory.biz.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njzscloud.supervisory.biz.pojo.entity.BizDriverEntity;
|
import com.njzscloud.supervisory.biz.pojo.entity.BizDriverEntity;
|
||||||
|
import com.njzscloud.supervisory.biz.pojo.result.DriverCantDelResult;
|
||||||
import com.njzscloud.supervisory.biz.pojo.result.SearchCompanyResult;
|
import com.njzscloud.supervisory.biz.pojo.result.SearchCompanyResult;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 司机信息
|
* 司机信息
|
||||||
*/
|
*/
|
||||||
|
|
@ -30,4 +34,5 @@ public interface BizDriverMapper extends BaseMapper<BizDriverEntity> {
|
||||||
@Select("SELECT id,uscc,company_name FROM biz_company WHERE id = #{companyId}")
|
@Select("SELECT id,uscc,company_name FROM biz_company WHERE id = #{companyId}")
|
||||||
SearchCompanyResult selectCompanyById(@Param("companyId") Long companyId);
|
SearchCompanyResult selectCompanyById(@Param("companyId") Long companyId);
|
||||||
|
|
||||||
|
List<DriverCantDelResult> driverCantDel(@Param("ew") QueryWrapper<Object> ew);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njzscloud.supervisory.biz.pojo.entity.BizTruckEntity;
|
import com.njzscloud.supervisory.biz.pojo.entity.BizTruckEntity;
|
||||||
import com.njzscloud.supervisory.biz.pojo.result.SearchCompanyResult;
|
import com.njzscloud.supervisory.biz.pojo.result.SearchCompanyResult;
|
||||||
import com.njzscloud.supervisory.biz.pojo.result.SearchTruckResult;
|
import com.njzscloud.supervisory.biz.pojo.result.SearchTruckResult;
|
||||||
|
import com.njzscloud.supervisory.biz.pojo.result.TruckCantDelResult;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆信息
|
* 车辆信息
|
||||||
*/
|
*/
|
||||||
|
|
@ -26,4 +29,6 @@ public interface BizTruckMapper extends BaseMapper<BizTruckEntity> {
|
||||||
* 根据ID查询预警详情(包含关联信息)
|
* 根据ID查询预警详情(包含关联信息)
|
||||||
*/
|
*/
|
||||||
SearchTruckResult selectDetailById(@Param("id") Long id);
|
SearchTruckResult selectDetailById(@Param("id") Long id);
|
||||||
|
|
||||||
|
List<TruckCantDelResult> truckCantDel(@Param("ew") QueryWrapper<Object> ew);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.njzscloud.supervisory.biz.pojo.result;
|
||||||
|
|
||||||
|
import com.njzscloud.supervisory.order.contant.OrderStatus;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class DriverCantDelResult {
|
||||||
|
private String driverName;
|
||||||
|
private String sn;
|
||||||
|
private OrderStatus orderStatus;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.njzscloud.supervisory.biz.pojo.result;
|
||||||
|
|
||||||
|
import com.njzscloud.supervisory.order.contant.OrderStatus;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class TruckCantDelResult {
|
||||||
|
private String licensePlate;
|
||||||
|
private String sn;
|
||||||
|
private OrderStatus orderStatus;
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@ package com.njzscloud.supervisory.biz.service;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
|
@ -19,6 +20,7 @@ import com.njzscloud.supervisory.biz.pojo.entity.BizDriverEntity;
|
||||||
import com.njzscloud.supervisory.biz.pojo.param.AddDriverParam;
|
import com.njzscloud.supervisory.biz.pojo.param.AddDriverParam;
|
||||||
import com.njzscloud.supervisory.biz.pojo.param.AuditDriverParam;
|
import com.njzscloud.supervisory.biz.pojo.param.AuditDriverParam;
|
||||||
import com.njzscloud.supervisory.biz.pojo.param.ModifyDriverParam;
|
import com.njzscloud.supervisory.biz.pojo.param.ModifyDriverParam;
|
||||||
|
import com.njzscloud.supervisory.biz.pojo.result.DriverCantDelResult;
|
||||||
import com.njzscloud.supervisory.biz.pojo.result.SearchCompanyResult;
|
import com.njzscloud.supervisory.biz.pojo.result.SearchCompanyResult;
|
||||||
import com.njzscloud.supervisory.sys.auth.pojo.result.MyResult;
|
import com.njzscloud.supervisory.sys.auth.pojo.result.MyResult;
|
||||||
import com.njzscloud.supervisory.sys.user.pojo.param.AddUserAccountParam;
|
import com.njzscloud.supervisory.sys.user.pojo.param.AddUserAccountParam;
|
||||||
|
|
@ -31,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 司机信息
|
* 司机信息
|
||||||
|
|
@ -101,6 +104,18 @@ public class BizDriverService extends ServiceImpl<BizDriverMapper, BizDriverEnti
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void del(List<Long> ids) {
|
public void del(List<Long> ids) {
|
||||||
|
Assert.notEmpty(ids, () -> Exceptions.clierr("未指定要删除的数据"));
|
||||||
|
List<BizDriverEntity> bizDriverEntities = this.listByIds(ids);
|
||||||
|
Assert.isTrue(bizDriverEntities.size() == ids.size(), () -> Exceptions.clierr("未找到要删除的数据"));
|
||||||
|
List<DriverCantDelResult> idList = baseMapper.driverCantDel(Wrappers.query()
|
||||||
|
.eq("a.deleted", 0)
|
||||||
|
.in("b.id", ids));
|
||||||
|
Assert.isTrue(idList.isEmpty(), () -> Exceptions.clierr(MapUtil.builder()
|
||||||
|
.put("reason", "存在已关联的订单")
|
||||||
|
.put("details", idList)
|
||||||
|
.build()));
|
||||||
|
List<Long> userIds = bizDriverEntities.stream().map(BizDriverEntity::getUserId).collect(Collectors.toList());
|
||||||
|
sysUserService.del(userIds);
|
||||||
this.removeBatchByIds(ids);
|
this.removeBatchByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.njzscloud.supervisory.biz.service;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
|
@ -22,6 +23,7 @@ import com.njzscloud.supervisory.biz.pojo.param.ModifyBizTruckParam;
|
||||||
import com.njzscloud.supervisory.biz.pojo.param.SearchTruckParam;
|
import com.njzscloud.supervisory.biz.pojo.param.SearchTruckParam;
|
||||||
import com.njzscloud.supervisory.biz.pojo.result.SearchCompanyResult;
|
import com.njzscloud.supervisory.biz.pojo.result.SearchCompanyResult;
|
||||||
import com.njzscloud.supervisory.biz.pojo.result.SearchTruckResult;
|
import com.njzscloud.supervisory.biz.pojo.result.SearchTruckResult;
|
||||||
|
import com.njzscloud.supervisory.biz.pojo.result.TruckCantDelResult;
|
||||||
import com.njzscloud.supervisory.device.pojo.entity.DeviceLocalizerEntity;
|
import com.njzscloud.supervisory.device.pojo.entity.DeviceLocalizerEntity;
|
||||||
import com.njzscloud.supervisory.device.service.DeviceLocalizerService;
|
import com.njzscloud.supervisory.device.service.DeviceLocalizerService;
|
||||||
import com.njzscloud.supervisory.sys.auth.pojo.result.MyResult;
|
import com.njzscloud.supervisory.sys.auth.pojo.result.MyResult;
|
||||||
|
|
@ -104,6 +106,16 @@ public class BizTruckService extends ServiceImpl<BizTruckMapper, BizTruckEntity>
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void del(List<Long> ids) {
|
public void del(List<Long> ids) {
|
||||||
|
Assert.notEmpty(ids, () -> Exceptions.clierr("未指定要删除的数据"));
|
||||||
|
long count = this.count(Wrappers.<BizTruckEntity>query().in("id", ids));
|
||||||
|
Assert.isTrue(count == ids.size(), () -> Exceptions.clierr("未找到要删除的数据"));
|
||||||
|
List<TruckCantDelResult> idList = baseMapper.truckCantDel(Wrappers.query()
|
||||||
|
.eq("a.deleted", 0)
|
||||||
|
.in("b.id", ids));
|
||||||
|
Assert.isTrue(idList.isEmpty(), () -> Exceptions.clierr(MapUtil.builder()
|
||||||
|
.put("reason", "存在已关联的订单")
|
||||||
|
.put("details", idList)
|
||||||
|
.build()));
|
||||||
this.removeBatchByIds(ids);
|
this.removeBatchByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -575,7 +575,7 @@ public class TruckLocationTrackService extends ServiceImpl<TruckLocationTrackMap
|
||||||
|
|
||||||
List<TruckLocationTrackEntity> records = resultPage.getRecords();
|
List<TruckLocationTrackEntity> records = resultPage.getRecords();
|
||||||
if (records.isEmpty()) {
|
if (records.isEmpty()) {
|
||||||
if (errCount >= 200) {
|
if (errCount >= 300) {
|
||||||
log.error("暂无实时数据, 订单ID: {}, 时间: {}", orderId, startTime);
|
log.error("暂无实时数据, 订单ID: {}, 时间: {}", orderId, startTime);
|
||||||
Websocket.publish(new WsMsg()
|
Websocket.publish(new WsMsg()
|
||||||
.setEvent("down/truck_location_track/realtime")
|
.setEvent("down/truck_location_track/realtime")
|
||||||
|
|
@ -585,11 +585,10 @@ public class TruckLocationTrackService extends ServiceImpl<TruckLocationTrackMap
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
errCount++;
|
errCount++;
|
||||||
if (!ThreadUtil.sleep(300)) {
|
if (!ThreadUtil.sleep(1000)) {
|
||||||
log.info("任务被取消");
|
log.info("任务被取消");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
startTime = LocalDateTime.now();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,4 +64,9 @@ public interface SupervisionStatisticsMapper {
|
||||||
|
|
||||||
@SuppressWarnings("MybatisXMapperMethodInspection")
|
@SuppressWarnings("MybatisXMapperMethodInspection")
|
||||||
List<Map<String, Object>> dataTable();
|
List<Map<String, Object>> dataTable();
|
||||||
|
|
||||||
|
Integer getTotalCarCount();
|
||||||
|
|
||||||
|
@SuppressWarnings("MybatisXMapperMethodInspection")
|
||||||
|
List<Map<String, Object>> getKehuList();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,13 @@ public class SupervisionStatisticsService {
|
||||||
|
|
||||||
CarSummary carSummary = supervisionStatisticsMapper.getCarSummary();
|
CarSummary carSummary = supervisionStatisticsMapper.getCarSummary();
|
||||||
Integer todayCarCount = supervisionStatisticsMapper.getTodayCarCount();
|
Integer todayCarCount = supervisionStatisticsMapper.getTodayCarCount();
|
||||||
|
Integer totalCarCount = supervisionStatisticsMapper.getTotalCarCount();
|
||||||
List<RegionSummary> regionSummary = supervisionStatisticsMapper.getRegionSummary();
|
List<RegionSummary> regionSummary = supervisionStatisticsMapper.getRegionSummary();
|
||||||
List<CompanySummary> companySummary = supervisionStatisticsMapper.getCompanySummary();
|
List<CompanySummary> companySummary = supervisionStatisticsMapper.getCompanySummary();
|
||||||
List<StationInfo> stationInfo = supervisionStatisticsMapper.getStationInfo();
|
List<StationInfo> stationInfo = supervisionStatisticsMapper.getStationInfo();
|
||||||
List<Order> orders = supervisionStatisticsMapper.getOrders();
|
List<Order> orders = supervisionStatisticsMapper.getOrders();
|
||||||
List<Project> projects = supervisionStatisticsMapper.getProjects();
|
List<Project> projects = supervisionStatisticsMapper.getProjects();
|
||||||
|
List<Map<String, Object>> kehu = supervisionStatisticsMapper.getKehuList();
|
||||||
|
|
||||||
return MapUtil.<String, Object>builder()
|
return MapUtil.<String, Object>builder()
|
||||||
.put("dispatchSummary", dispatchSummary == null ? new DispatchSummary() : dispatchSummary)
|
.put("dispatchSummary", dispatchSummary == null ? new DispatchSummary() : dispatchSummary)
|
||||||
|
|
@ -59,11 +61,13 @@ public class SupervisionStatisticsService {
|
||||||
.put("disposeTotalWeight", disposeTotalWeight == null ? 0 : disposeTotalWeight)
|
.put("disposeTotalWeight", disposeTotalWeight == null ? 0 : disposeTotalWeight)
|
||||||
.put("carSummary", carSummary == null ? new CarSummary() : carSummary)
|
.put("carSummary", carSummary == null ? new CarSummary() : carSummary)
|
||||||
.put("todayCarCount", todayCarCount == null ? 0 : todayCarCount)
|
.put("todayCarCount", todayCarCount == null ? 0 : todayCarCount)
|
||||||
|
.put("totalCarCount", totalCarCount == null ? 0 : totalCarCount)
|
||||||
.put("regionSummary", regionSummary == null ? new ArrayList<>() : regionSummary)
|
.put("regionSummary", regionSummary == null ? new ArrayList<>() : regionSummary)
|
||||||
.put("companySummary", companySummary == null ? new ArrayList<>() : companySummary)
|
.put("companySummary", companySummary == null ? new ArrayList<>() : companySummary)
|
||||||
.put("stationInfo", stationInfo == null ? new ArrayList<>() : stationInfo)
|
.put("stationInfo", stationInfo == null ? new ArrayList<>() : stationInfo)
|
||||||
.put("orders", orders == null ? new ArrayList<>() : orders)
|
.put("orders", orders == null ? new ArrayList<>() : orders)
|
||||||
.put("projects", projects == null ? new ArrayList<>() : projects)
|
.put("projects", projects == null ? new ArrayList<>() : projects)
|
||||||
|
.put("kehu", kehu == null ? new ArrayList<>() : kehu)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.njzscloud.supervisory.config;
|
||||||
|
|
||||||
|
import com.njzscloud.supervisory.hsoa.HsoaProperties;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Configuration
|
||||||
|
@EnableConfigurationProperties({HsoaProperties.class})
|
||||||
|
public class HsoaAutoConfiguration {
|
||||||
|
|
||||||
|
/* public HsoaAutoConfiguration(){
|
||||||
|
log.info("HsoaAutoConfiguration");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnBean(HttpClientDecorator.class)
|
||||||
|
public HsoaApi hsoaApi(HttpClientDecorator httpClientDecorator) {
|
||||||
|
return httpClientDecorator.decorate(HsoaApi.class);
|
||||||
|
} */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -20,6 +20,7 @@ import com.njzscloud.supervisory.device.pojo.entity.DeviceInfoEntity;
|
||||||
import com.njzscloud.supervisory.order.contant.CheckStatus;
|
import com.njzscloud.supervisory.order.contant.CheckStatus;
|
||||||
import com.njzscloud.supervisory.order.contant.OrderStatus;
|
import com.njzscloud.supervisory.order.contant.OrderStatus;
|
||||||
import com.njzscloud.supervisory.order.contant.PaymentStatus;
|
import com.njzscloud.supervisory.order.contant.PaymentStatus;
|
||||||
|
import com.njzscloud.supervisory.order.contant.SettlementWay;
|
||||||
import com.njzscloud.supervisory.order.pojo.entity.OrderCarInOutEntity;
|
import com.njzscloud.supervisory.order.pojo.entity.OrderCarInOutEntity;
|
||||||
import com.njzscloud.supervisory.order.pojo.entity.OrderInfoEntity;
|
import com.njzscloud.supervisory.order.pojo.entity.OrderInfoEntity;
|
||||||
import com.njzscloud.supervisory.order.pojo.param.TruckComingOrderParam;
|
import com.njzscloud.supervisory.order.pojo.param.TruckComingOrderParam;
|
||||||
|
|
@ -470,6 +471,10 @@ public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoE
|
||||||
BigDecimal weight_ = new BigDecimal(weight);
|
BigDecimal weight_ = new BigDecimal(weight);
|
||||||
BigDecimal v = weight_.divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP);
|
BigDecimal v = weight_.divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP);
|
||||||
try {
|
try {
|
||||||
|
String settlementWay = orderPagingResult.getSettlementWay();
|
||||||
|
if (SettlementWay.CASH.getTxt().equals(settlementWay)) {
|
||||||
|
playVoice(sn, cid, "{}请先支付", licensePlate);
|
||||||
|
}
|
||||||
boolean b = orderInfoService.truckLeaving(new TruckLeavingOrderParam()
|
boolean b = orderInfoService.truckLeaving(new TruckLeavingOrderParam()
|
||||||
.setOrderId(orderId)
|
.setOrderId(orderId)
|
||||||
.setWeight(weight)
|
.setWeight(weight)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.njzscloud.supervisory.discount.controller;
|
||||||
|
|
||||||
|
import com.njzscloud.common.core.utils.R;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity;
|
||||||
|
import com.njzscloud.supervisory.discount.service.DiscountManageService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/discount")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DiscountManageController {
|
||||||
|
|
||||||
|
private final DiscountManageService discountManageService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public R<?> add(@RequestBody DiscountManageEntity discountManageEntity) {
|
||||||
|
discountManageService.add(discountManageEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@PostMapping("/modify")
|
||||||
|
public R<?> modify(@RequestBody DiscountManageEntity discountManageEntity) {
|
||||||
|
discountManageService.modify(discountManageEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@PostMapping("/del")
|
||||||
|
public R<?> del(@RequestBody List<Long> ids) {
|
||||||
|
discountManageService.del(ids);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public R<DiscountManageEntity> detail(@RequestParam Long id) {
|
||||||
|
return R.success(discountManageService.detail(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@GetMapping("/paging")
|
||||||
|
public R<PageResult<DiscountManageEntity>> paging(PageParam pageParam, DiscountManageEntity discountManageEntity) {
|
||||||
|
return R.success(discountManageService.paging(pageParam, discountManageEntity));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.njzscloud.supervisory.discount.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠管理
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface DiscountManageMapper extends BaseMapper<DiscountManageEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
package com.njzscloud.supervisory.discount.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.njzscloud.common.mp.support.handler.j.JsonTypeHandler;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠管理
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName(value = "discount_manage", autoResultMap = true)
|
||||||
|
public class DiscountManageEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司id
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 费用类型:goods 产品 service 服务费
|
||||||
|
*/
|
||||||
|
private String feeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务费id
|
||||||
|
*/
|
||||||
|
private Long expenseId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品ids
|
||||||
|
*/
|
||||||
|
@TableField(value = "goods_ids", typeHandler = JsonTypeHandler.class)
|
||||||
|
private List<String> goodsIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠类型:discount 优惠 raise加价
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 变化金额
|
||||||
|
*/
|
||||||
|
private BigDecimal money;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警信息
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人 Id; sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人 Id; sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Long modifierId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime modifyTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除; 0-->未删除、1-->已删除
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private Boolean deleted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.njzscloud.supervisory.discount.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠管理
|
||||||
|
*/
|
||||||
|
public interface DiscountManageService extends IService<DiscountManageEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
void add(DiscountManageEntity discountManageEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
void modify(DiscountManageEntity discountManageEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
void del(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
DiscountManageEntity detail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
PageResult<DiscountManageEntity> paging(PageParam pageParam, DiscountManageEntity discountManageEntity);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
package com.njzscloud.supervisory.discount.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.biz.pojo.entity.BizCompanyEntity;
|
||||||
|
import com.njzscloud.supervisory.biz.service.BizCompanyService;
|
||||||
|
import com.njzscloud.supervisory.discount.mapper.DiscountManageMapper;
|
||||||
|
import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity;
|
||||||
|
import com.njzscloud.supervisory.discount.service.DiscountManageService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DiscountManageServiceImpl extends ServiceImpl<DiscountManageMapper, DiscountManageEntity> implements DiscountManageService {
|
||||||
|
|
||||||
|
private final BizCompanyService bizCompanyService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void add(DiscountManageEntity discountManageEntity) {
|
||||||
|
this.save(discountManageEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void modify(DiscountManageEntity discountManageEntity) {
|
||||||
|
this.updateById(discountManageEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void del(List<Long> ids) {
|
||||||
|
this.removeBatchByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DiscountManageEntity detail(Long id) {
|
||||||
|
DiscountManageEntity entity = this.getById(id);
|
||||||
|
BizCompanyEntity companyEntity = bizCompanyService.getById(entity.getCompanyId());
|
||||||
|
if (null != companyEntity) {
|
||||||
|
entity.setCompanyName(companyEntity.getCompanyName());
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<DiscountManageEntity> paging(PageParam pageParam, DiscountManageEntity discountManageEntity) {
|
||||||
|
Page<DiscountManageEntity> page = this.page(pageParam.toPage(), Wrappers.<DiscountManageEntity>lambdaQuery()
|
||||||
|
.eq(discountManageEntity.getCompanyId() != null, DiscountManageEntity::getCompanyId, discountManageEntity.getCompanyId())
|
||||||
|
.eq(StrUtil.isNotBlank(discountManageEntity.getFeeType()), DiscountManageEntity::getFeeType, discountManageEntity.getFeeType())
|
||||||
|
.eq(discountManageEntity.getExpenseId() != null, DiscountManageEntity::getExpenseId, discountManageEntity.getExpenseId())
|
||||||
|
.eq(StrUtil.isNotBlank(discountManageEntity.getType()), DiscountManageEntity::getType, discountManageEntity.getType())
|
||||||
|
.eq(discountManageEntity.getDeleted() != null, DiscountManageEntity::getDeleted, Boolean.FALSE)
|
||||||
|
.orderByDesc(DiscountManageEntity::getCreateTime));
|
||||||
|
for (DiscountManageEntity entity: page.getRecords()) {
|
||||||
|
BizCompanyEntity companyEntity = bizCompanyService.getById(entity.getCompanyId());
|
||||||
|
if (null != companyEntity) {
|
||||||
|
entity.setCompanyName(companyEntity.getCompanyName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PageResult.of(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
package com.njzscloud.supervisory.hsoa;
|
||||||
|
|
||||||
|
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.result.HsoaResult;
|
||||||
|
import com.njzscloud.supervisory.hsoa.pojo.result.LoginResult;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class Hsoa {
|
||||||
|
public static final HsoaApi API;
|
||||||
|
private static final HsoaProperties hsoaProperties;
|
||||||
|
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 String refTnt = "";
|
||||||
|
private static String tnt = "";
|
||||||
|
private static long lastLoginTime = 0;
|
||||||
|
private static AppProperties appProperties;
|
||||||
|
|
||||||
|
static {
|
||||||
|
HttpClientDecorator httpClientDecorator = SpringUtil.getBean(HttpClientDecorator.class);
|
||||||
|
appProperties = SpringUtil.getBean(AppProperties.class);
|
||||||
|
API = httpClientDecorator.decorate(HsoaApi.class);
|
||||||
|
hsoaProperties = SpringUtil.getBean(HsoaProperties.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HsoaResult<?> pushVehicleTrajectory(PushVehicleTrajectoryParam param) {
|
||||||
|
login();
|
||||||
|
try {
|
||||||
|
rlock.lock();
|
||||||
|
AppProperties.DefaultPlace defaultPlace = appProperties.getDefaultPlace();
|
||||||
|
param.setCityCode(defaultPlace.getCity())
|
||||||
|
.setCityName(defaultPlace.getCityName())
|
||||||
|
;
|
||||||
|
if (StrUtil.isBlank(tnt) || StrUtil.isBlank(refTnt)) {
|
||||||
|
return new HsoaResult<>()
|
||||||
|
.setSuccess(false);
|
||||||
|
}
|
||||||
|
return API.pushVehicleTrajectory(param, new TokenParam().setTnt(tnt).setRefTnt(refTnt));
|
||||||
|
} finally {
|
||||||
|
rlock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void login() {
|
||||||
|
try {
|
||||||
|
wlock.lock();
|
||||||
|
long now = System.currentTimeMillis() / 1000;
|
||||||
|
if (StrUtil.isBlank(refTnt) || StrUtil.isBlank(tnt)) {
|
||||||
|
HsoaResult<LoginResult> loginResult = API.login(new LoginParam()
|
||||||
|
.setUserName(hsoaProperties.getUsername())
|
||||||
|
.setPassword(hsoaProperties.getPassword())
|
||||||
|
);
|
||||||
|
if (loginResult.isSuccess()) {
|
||||||
|
LoginResult data = loginResult.getData();
|
||||||
|
refTnt = data.getRefTnt();
|
||||||
|
tnt = data.getTnt();
|
||||||
|
lastLoginTime = now;
|
||||||
|
} else {
|
||||||
|
refTnt = "";
|
||||||
|
tnt = "";
|
||||||
|
log.error("政务平台登录失败");
|
||||||
|
}
|
||||||
|
} else if (now - lastLoginTime > hsoaProperties.getExpire() - 60) {
|
||||||
|
HsoaResult<LoginResult> loginResult = API.refreshToken(new RefreshTokenParam().setRefTnt(refTnt));
|
||||||
|
if (loginResult.isSuccess()) {
|
||||||
|
LoginResult data = loginResult.getData();
|
||||||
|
refTnt = data.getRefTnt();
|
||||||
|
tnt = data.getTnt();
|
||||||
|
lastLoginTime = now;
|
||||||
|
} else {
|
||||||
|
refTnt = "";
|
||||||
|
tnt = "";
|
||||||
|
log.error("政务平台登录失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
refTnt = "";
|
||||||
|
tnt = "";
|
||||||
|
log.error("政务平台登录失败", e);
|
||||||
|
} finally {
|
||||||
|
wlock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
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.result.HsoaResult;
|
||||||
|
import com.njzscloud.supervisory.hsoa.pojo.result.LoginResult;
|
||||||
|
|
||||||
|
@RemoteServer(value = "${hsoa.base-url}")
|
||||||
|
public interface HsoaApi {
|
||||||
|
/**
|
||||||
|
* 登录
|
||||||
|
*/
|
||||||
|
@PostEndpoint("/garbage/mLoginApi/login")
|
||||||
|
HsoaResult<LoginResult> login(@FormBodyParam LoginParam apram);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新 TOKEN
|
||||||
|
*/
|
||||||
|
@GetEndpoint("/garbage/mLoginApi/refreshToken")
|
||||||
|
HsoaResult<LoginResult> refreshToken(@QueryParam RefreshTokenParam apram);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送定位数据
|
||||||
|
*/
|
||||||
|
@PostEndpoint("/garbage/commonApi/pushVehicleTrajectory")
|
||||||
|
HsoaResult<Object> pushVehicleTrajectory(@JsonBodyParam PushVehicleTrajectoryParam apram, @QueryParam TokenParam tokenParam);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.njzscloud.supervisory.hsoa;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ConfigurationProperties(prefix = "hsoa")
|
||||||
|
public class HsoaProperties {
|
||||||
|
private String baseUrl;
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private int expire = 72 * 24 * 3600;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
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.PushVehicleTrajectoryParam;
|
||||||
|
import com.njzscloud.supervisory.hsoa.pojo.result.HsoaResult;
|
||||||
|
import com.njzscloud.supervisory.hsoa.service.HsoaService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/hsoa")
|
||||||
|
public class HsoaController {
|
||||||
|
|
||||||
|
private final HsoaService hsoaService;
|
||||||
|
|
||||||
|
@PostMapping("/push")
|
||||||
|
public R<?> push(@RequestBody PushVehicleTrajectoryParam pushVehicleTrajectoryParam) {
|
||||||
|
HsoaResult<?> objectHsoaResult = Hsoa.pushVehicleTrajectory(pushVehicleTrajectoryParam);
|
||||||
|
if (objectHsoaResult.isSuccess()) {
|
||||||
|
return R.success(objectHsoaResult);
|
||||||
|
}
|
||||||
|
return R.failed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/push_order")
|
||||||
|
public R<?> pushOrder(@RequestParam Long orderId, @RequestParam Integer count) {
|
||||||
|
return R.success(hsoaService.pushOrder(orderId, count));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.njzscloud.supervisory.hsoa.pojo.param;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class LoginParam {
|
||||||
|
private String userName;
|
||||||
|
private String password;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class PushVehicleTrajectoryParam {
|
||||||
|
@JsonProperty("cityCode")
|
||||||
|
private String cityCode;
|
||||||
|
@JsonProperty("cityName")
|
||||||
|
private String cityName;
|
||||||
|
@JsonProperty("districtCode")
|
||||||
|
private String districtCode;
|
||||||
|
@JsonProperty("districtName")
|
||||||
|
private String districtName;
|
||||||
|
@JsonProperty("companyName")
|
||||||
|
private String companyName;
|
||||||
|
@JsonProperty("transportLicense")
|
||||||
|
private String transportLicense;
|
||||||
|
@JsonProperty("plateNumber")
|
||||||
|
private String plateNumber;
|
||||||
|
@JsonProperty("vehicleType")
|
||||||
|
private String vehicleType;
|
||||||
|
@JsonProperty("longitude")
|
||||||
|
private String longitude;
|
||||||
|
@JsonProperty("latitude")
|
||||||
|
private String latitude;
|
||||||
|
@JsonProperty("speed")
|
||||||
|
private Double speed;
|
||||||
|
@JsonProperty("loadWeight")
|
||||||
|
private Double loadWeight;
|
||||||
|
@JsonProperty("loadStatus")
|
||||||
|
private String loadStatus;
|
||||||
|
@JsonProperty("sealedStatus")
|
||||||
|
private String sealedStatus;
|
||||||
|
@JsonProperty("liftStatus")
|
||||||
|
private String liftStatus;
|
||||||
|
@JsonProperty("direction")
|
||||||
|
private Double direction;
|
||||||
|
@JsonProperty("directionDesc")
|
||||||
|
private String directionDesc;
|
||||||
|
@JsonProperty("altitude")
|
||||||
|
private Double altitude;
|
||||||
|
@JsonProperty("locationDesc")
|
||||||
|
private String locationDesc;
|
||||||
|
@JsonProperty("address")
|
||||||
|
private String address;
|
||||||
|
@JsonProperty("gpsTime")
|
||||||
|
private String gpsTime;
|
||||||
|
@JsonProperty("receiveTime")
|
||||||
|
private String receiveTime;
|
||||||
|
@JsonProperty("accStatus")
|
||||||
|
private Integer accStatus;
|
||||||
|
@JsonProperty("onlineStatus")
|
||||||
|
private Integer onlineStatus;
|
||||||
|
@JsonProperty("locationMode")
|
||||||
|
private String locationMode;
|
||||||
|
@JsonProperty("stateType")
|
||||||
|
private String stateType;
|
||||||
|
@JsonProperty("alarmType")
|
||||||
|
private String alarmType;
|
||||||
|
@JsonProperty("alarmDesc")
|
||||||
|
private String alarmDesc;
|
||||||
|
@JsonProperty("todayMileage")
|
||||||
|
private Double todayMileage;
|
||||||
|
@JsonProperty("totalMileage")
|
||||||
|
private Double totalMileage;
|
||||||
|
@JsonProperty("temperature")
|
||||||
|
private String temperature;
|
||||||
|
@JsonProperty("humidity")
|
||||||
|
private String humidity;
|
||||||
|
@JsonProperty("oilValue")
|
||||||
|
private String oilValue;
|
||||||
|
@JsonProperty("voltage")
|
||||||
|
private String voltage;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.njzscloud.supervisory.hsoa.pojo.param;
|
||||||
|
|
||||||
|
import com.njzscloud.common.http.annotation.QueryParam;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class RefreshTokenParam {
|
||||||
|
@QueryParam("REF_TNT")
|
||||||
|
private String refTnt;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.njzscloud.supervisory.hsoa.pojo.param;
|
||||||
|
|
||||||
|
import com.njzscloud.common.http.annotation.QueryParam;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class TokenParam {
|
||||||
|
@QueryParam("REF_TNT")
|
||||||
|
private String refTnt;
|
||||||
|
@QueryParam("TNT")
|
||||||
|
private String tnt;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
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 HsoaResult<T> {
|
||||||
|
private String message;
|
||||||
|
private Integer code;
|
||||||
|
private boolean success;
|
||||||
|
private T data;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.njzscloud.supervisory.hsoa.pojo.result;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class LoginResult {
|
||||||
|
@JsonProperty("REF_TNT")
|
||||||
|
private String refTnt;
|
||||||
|
@JsonProperty("TNT")
|
||||||
|
private String tnt;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,141 @@
|
||||||
|
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 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.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.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;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class HsoaService {
|
||||||
|
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);
|
||||||
|
private final AtomicInteger total = new AtomicInteger(0);
|
||||||
|
private final AtomicLong order = new AtomicLong(0);
|
||||||
|
|
||||||
|
public synchronized Map<String, Object> pushOrder(Long orderId, Integer count) {
|
||||||
|
MapBuilder<String, Object> builder = MapUtil.<String, Object>builder();
|
||||||
|
|
||||||
|
if (run.get()) {
|
||||||
|
int i1 = total.get();
|
||||||
|
int i2 = succ.get();
|
||||||
|
int i3 = fail.get();
|
||||||
|
long v = order.get();
|
||||||
|
return builder
|
||||||
|
.put("订单", v)
|
||||||
|
.put("任务数量", i1)
|
||||||
|
.put("成功数量", i2)
|
||||||
|
.put("失败数量", i3)
|
||||||
|
.put("剩余数量", i1 - i2 - i3)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
OrderPagingResult orderDetail = orderInfoService.detail(orderId);
|
||||||
|
Assert.notNull(orderDetail, () -> Exceptions.clierr("订单不存在"));
|
||||||
|
String licensePlate = orderDetail.getLicensePlate();
|
||||||
|
String transCompanyName = orderDetail.getTransCompanyName();
|
||||||
|
List<TruckLocationTrackEntity> list = truckLocationTrackService.list(Wrappers.<TruckLocationTrackEntity>lambdaQuery().eq(TruckLocationTrackEntity::getOrderId, orderId));
|
||||||
|
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
return builder
|
||||||
|
.put("订单", orderId)
|
||||||
|
.put("任务数量", 0)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
if (count == null || count == 0) {
|
||||||
|
count = list.size();
|
||||||
|
} else {
|
||||||
|
count = Math.min(count, list.size());
|
||||||
|
}
|
||||||
|
run.set(true);
|
||||||
|
order.set(orderId);
|
||||||
|
total.set(count);
|
||||||
|
succ.set(0);
|
||||||
|
fail.set(0);
|
||||||
|
int c = count;
|
||||||
|
Thread thread = new Thread(() -> {
|
||||||
|
for (int i = 0; i < c; i++) {
|
||||||
|
ThreadUtil.sleep(1000);
|
||||||
|
TruckLocationTrackEntity locationTrack = list.get(i);
|
||||||
|
boolean b = run.get();
|
||||||
|
if (!b) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Double longitude = locationTrack.getLongitude();
|
||||||
|
Double latitude = locationTrack.getLatitude();
|
||||||
|
Double speed = locationTrack.getSpeed();
|
||||||
|
Integer direction = locationTrack.getDirection();
|
||||||
|
LocalDateTime locationTime = locationTrack.getLocationTime();
|
||||||
|
String time = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(locationTime);
|
||||||
|
HsoaResult<?> result = Hsoa.pushVehicleTrajectory(new PushVehicleTrajectoryParam()
|
||||||
|
.setCompanyName(transCompanyName)
|
||||||
|
.setTransportLicense(orderDetail.getCertificateSn())
|
||||||
|
.setPlateNumber(licensePlate)
|
||||||
|
.setVehicleType(orderDetail.getTruckCategory())
|
||||||
|
.setLongitude(longitude + "")
|
||||||
|
.setLatitude(latitude + "")
|
||||||
|
.setSpeed(speed)
|
||||||
|
.setDirection(direction + 0.0)
|
||||||
|
.setStateType("正常行驶")
|
||||||
|
.setAlarmType("无")
|
||||||
|
.setLoadStatus("2")
|
||||||
|
.setSealedStatus("1")
|
||||||
|
.setLiftStatus("0")
|
||||||
|
.setAccStatus(1)
|
||||||
|
.setGpsTime(time)
|
||||||
|
.setLocationMode("WGS84")
|
||||||
|
);
|
||||||
|
if (result == null || !result.isSuccess()) {
|
||||||
|
fail.incrementAndGet();
|
||||||
|
log.error("推送定位数据失败,数据Id:{}", locationTrack.getId());
|
||||||
|
} else {
|
||||||
|
succ.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
fail.incrementAndGet();
|
||||||
|
log.error("推送定位数据失败,数据Id:{}", locationTrack.getId(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
run.set(false);
|
||||||
|
});
|
||||||
|
thread.setDaemon(true);
|
||||||
|
thread.start();
|
||||||
|
|
||||||
|
int i1 = total.get();
|
||||||
|
int i2 = succ.get();
|
||||||
|
int i3 = fail.get();
|
||||||
|
return builder
|
||||||
|
.put("订单", orderId)
|
||||||
|
.put("任务数量", i1)
|
||||||
|
.put("成功数量", i2)
|
||||||
|
.put("失败数量", i3)
|
||||||
|
.put("剩余数量", i1 - i2 - i3)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -36,10 +36,15 @@ public class MoneyAccountEntity {
|
||||||
private Long stationId;
|
private Long stationId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资金
|
* 余额
|
||||||
*/
|
*/
|
||||||
private BigDecimal money;
|
private BigDecimal money;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营收
|
||||||
|
*/
|
||||||
|
private BigDecimal revenue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改时间
|
* 修改时间
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.njzscloud.supervisory.order.contant;
|
||||||
|
|
||||||
|
import com.njzscloud.common.core.ienum.DictStr;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典代码:discount_type
|
||||||
|
* 字典名称:优惠类型
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public enum DiscountType implements DictStr {
|
||||||
|
DISCOUNT("discount", "优惠"),
|
||||||
|
RAISE("raise", "加价"),
|
||||||
|
;
|
||||||
|
private final String val;
|
||||||
|
private final String txt;
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,7 @@ import com.njzscloud.supervisory.order.pojo.param.*;
|
||||||
import com.njzscloud.supervisory.order.pojo.result.OrderCertificateResult;
|
import com.njzscloud.supervisory.order.pojo.result.OrderCertificateResult;
|
||||||
import com.njzscloud.supervisory.order.pojo.result.OrderPagingResult;
|
import com.njzscloud.supervisory.order.pojo.result.OrderPagingResult;
|
||||||
import com.njzscloud.supervisory.order.pojo.result.TrainBillResult;
|
import com.njzscloud.supervisory.order.pojo.result.TrainBillResult;
|
||||||
|
import com.njzscloud.supervisory.order.service.AccountRegulationService;
|
||||||
import com.njzscloud.supervisory.order.service.OrderInfoService;
|
import com.njzscloud.supervisory.order.service.OrderInfoService;
|
||||||
import com.njzscloud.supervisory.sys.log.annotation.Log;
|
import com.njzscloud.supervisory.sys.log.annotation.Log;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
@ -31,6 +32,8 @@ import java.util.List;
|
||||||
public class OrderInfoController {
|
public class OrderInfoController {
|
||||||
private final OrderInfoService orderInfoService;
|
private final OrderInfoService orderInfoService;
|
||||||
|
|
||||||
|
private final AccountRegulationService accountRegulationService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
|
|
@ -268,4 +271,14 @@ public class OrderInfoController {
|
||||||
return R.success();
|
return R.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调账
|
||||||
|
*/
|
||||||
|
@Log("业务调账")
|
||||||
|
@PostMapping("/account_regulation")
|
||||||
|
public R<?> accountRegulation(@RequestBody RegulationParam param) {
|
||||||
|
accountRegulationService.accountRegulation(param);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import com.njzscloud.supervisory.biz.pojo.entity.BizCompanyEntity;
|
||||||
import com.njzscloud.supervisory.biz.pojo.entity.BizTruckEntity;
|
import com.njzscloud.supervisory.biz.pojo.entity.BizTruckEntity;
|
||||||
import com.njzscloud.supervisory.device.pojo.entity.DeviceLocalizerEntity;
|
import com.njzscloud.supervisory.device.pojo.entity.DeviceLocalizerEntity;
|
||||||
import com.njzscloud.supervisory.order.pojo.entity.OrderInfoEntity;
|
import com.njzscloud.supervisory.order.pojo.entity.OrderInfoEntity;
|
||||||
|
import com.njzscloud.supervisory.order.pojo.result.OrderExportDetailResult;
|
||||||
import com.njzscloud.supervisory.order.pojo.result.OrderExportResult;
|
import com.njzscloud.supervisory.order.pojo.result.OrderExportResult;
|
||||||
import com.njzscloud.supervisory.order.pojo.result.OrderPagingResult;
|
import com.njzscloud.supervisory.order.pojo.result.OrderPagingResult;
|
||||||
import com.njzscloud.supervisory.order.pojo.result.PaymentContextResult;
|
import com.njzscloud.supervisory.order.pojo.result.PaymentContextResult;
|
||||||
|
|
@ -25,6 +26,8 @@ public interface OrderInfoMapper extends BaseMapper<OrderInfoEntity> {
|
||||||
|
|
||||||
List<OrderExportResult> exportList(@Param("ew") QueryWrapper<OrderPagingResult> ew);
|
List<OrderExportResult> exportList(@Param("ew") QueryWrapper<OrderPagingResult> ew);
|
||||||
|
|
||||||
|
List<OrderExportDetailResult> exportDetailList(@Param("ew") QueryWrapper<OrderPagingResult> ew);
|
||||||
|
|
||||||
OrderPagingResult detail(@Param("ew") QueryWrapper<OrderPagingResult> ew);
|
OrderPagingResult detail(@Param("ew") QueryWrapper<OrderPagingResult> ew);
|
||||||
|
|
||||||
OrderPagingResult pendingOrder(@Param("ew") QueryWrapper<Object> ew);
|
OrderPagingResult pendingOrder(@Param("ew") QueryWrapper<Object> ew);
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,6 @@ public class OrderItemsParams {
|
||||||
*/
|
*/
|
||||||
private BigDecimal unitPrice;
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
|
private String bill;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.njzscloud.supervisory.order.pojo.param;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调账入参
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class RegulationParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清运公司Id
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单sn
|
||||||
|
*/
|
||||||
|
private String sn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 变动金额
|
||||||
|
*/
|
||||||
|
private BigDecimal delta;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String memo;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.njzscloud.supervisory.order.pojo.result;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class OrderExportDetailResult {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品名称
|
||||||
|
*/
|
||||||
|
private String expenseItemName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算金额
|
||||||
|
*/
|
||||||
|
private BigDecimal settleMoney;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,11 @@ import lombok.experimental.Accessors;
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class OrderExportResult {
|
public class OrderExportResult {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 序号
|
* 序号
|
||||||
*/
|
*/
|
||||||
|
|
@ -61,6 +66,10 @@ public class OrderExportResult {
|
||||||
*/
|
*/
|
||||||
private String areaName;
|
private String areaName;
|
||||||
|
|
||||||
|
private String townName;
|
||||||
|
|
||||||
|
private String address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入场磅重(吨)
|
* 入场磅重(吨)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -469,6 +469,8 @@ public class OrderPagingResult {
|
||||||
*/
|
*/
|
||||||
private String driverPhone;
|
private String driverPhone;
|
||||||
|
|
||||||
|
private Long driverUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 驾驶证
|
* 驾驶证
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
package com.njzscloud.supervisory.order.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.njzscloud.common.core.ex.Exceptions;
|
||||||
|
import com.njzscloud.supervisory.expense.contant.ExpenseItemCategory;
|
||||||
|
import com.njzscloud.supervisory.money.contant.MoneyChangeCategory;
|
||||||
|
import com.njzscloud.supervisory.money.pojo.entity.MoneyAccountEntity;
|
||||||
|
import com.njzscloud.supervisory.money.pojo.entity.MoneyChangeDetailEntity;
|
||||||
|
import com.njzscloud.supervisory.money.service.MoneyAccountService;
|
||||||
|
import com.njzscloud.supervisory.money.service.MoneyChangeDetailService;
|
||||||
|
import com.njzscloud.supervisory.order.pojo.entity.OrderExpenseItemsEntity;
|
||||||
|
import com.njzscloud.supervisory.order.pojo.entity.OrderInfoEntity;
|
||||||
|
import com.njzscloud.supervisory.order.pojo.param.RegulationParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调账
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AccountRegulationService {
|
||||||
|
|
||||||
|
private final OrderInfoService orderInfoService;
|
||||||
|
|
||||||
|
private final MoneyAccountService moneyAccountService;
|
||||||
|
|
||||||
|
private final MoneyChangeDetailService moneyChangeDetailService;
|
||||||
|
|
||||||
|
private final OrderExpenseItemsService orderExpenseItemsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务调账
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void accountRegulation(RegulationParam param) {
|
||||||
|
OrderInfoEntity order = orderInfoService.getOne(Wrappers.<OrderInfoEntity>lambdaQuery()
|
||||||
|
.eq(OrderInfoEntity::getSn, param.getSn())
|
||||||
|
.eq(OrderInfoEntity::getTransCompanyId, param.getCompanyId()));
|
||||||
|
Assert.notNull(order, () -> Exceptions.clierr("当前客户不存在该笔订单,请检查订单号是否正确"));
|
||||||
|
|
||||||
|
// 判断订单创建时间是否在上个月1号和本月26号之间
|
||||||
|
LocalDateTime createTime = order.getCreateTime();
|
||||||
|
if (createTime != null) {
|
||||||
|
LocalDateTime lastMonthFirstDay = YearMonth.now().minusMonths(1).atDay(1).atStartOfDay();
|
||||||
|
LocalDateTime currentMonth26th = YearMonth.now().atDay(26).atTime(23, 59, 59);
|
||||||
|
boolean isInRange = !createTime.isBefore(lastMonthFirstDay) && !createTime.isAfter(currentMonth26th);
|
||||||
|
if (!isInRange) {
|
||||||
|
throw Exceptions.clierr("只能对上月1号至本月26号之间的订单调账");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增一条付费项
|
||||||
|
OrderExpenseItemsEntity productItem = new OrderExpenseItemsEntity()
|
||||||
|
.setExpenseItemCategory(ExpenseItemCategory.ChanPin.getVal())
|
||||||
|
.setOrderId(order.getId())
|
||||||
|
.setOriginExpenseItemId(202511081532L)
|
||||||
|
.setExpenseItemName("业务调账")
|
||||||
|
.setUnitPrice(new BigDecimal("0"))
|
||||||
|
.setUnit("Che")
|
||||||
|
.setMoneyStrategy("Che")
|
||||||
|
.setQuantity(1)
|
||||||
|
.setTotalMoney(param.getDelta())
|
||||||
|
.setSettleMoney(param.getDelta());
|
||||||
|
orderExpenseItemsService.save(productItem);
|
||||||
|
|
||||||
|
// 查询账户
|
||||||
|
MoneyAccountEntity accountEntity = moneyAccountService.getOne(Wrappers.<MoneyAccountEntity>lambdaQuery()
|
||||||
|
.eq(MoneyAccountEntity::getStationId, param.getCompanyId()));
|
||||||
|
if (null == accountEntity) {
|
||||||
|
throw Exceptions.clierr("资金账户不存在");
|
||||||
|
}
|
||||||
|
BigDecimal newMoney = accountEntity.getMoney().add(param.getDelta());
|
||||||
|
// 新增一条资金明细
|
||||||
|
MoneyChangeDetailEntity changeDetail = new MoneyChangeDetailEntity()
|
||||||
|
.setCompanyId(param.getCompanyId())
|
||||||
|
.setOrderId(order.getId())
|
||||||
|
.setMoneyAccountId(accountEntity.getId())
|
||||||
|
.setOldMoney(accountEntity.getMoney())
|
||||||
|
.setDelta(param.getDelta())
|
||||||
|
.setNewMoney(newMoney)
|
||||||
|
.setMoneyChangeCategory(MoneyChangeCategory.DingDanTiaoZhang)
|
||||||
|
.setMemo(param.getMemo());
|
||||||
|
|
||||||
|
moneyChangeDetailService.save(changeDetail);
|
||||||
|
|
||||||
|
// 变更资金账户金额
|
||||||
|
MoneyAccountEntity companyAccount = new MoneyAccountEntity()
|
||||||
|
.setId(accountEntity.getId())
|
||||||
|
.setMoney(newMoney);
|
||||||
|
moneyAccountService.updateById(companyAccount);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -10,11 +10,13 @@ import cn.hutool.core.thread.ThreadUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||||
import cn.hutool.extra.qrcode.QrConfig;
|
import cn.hutool.extra.qrcode.QrConfig;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.njzscloud.common.core.ex.Exceptions;
|
import com.njzscloud.common.core.ex.Exceptions;
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
|
@ -27,11 +29,11 @@ import com.njzscloud.common.ws.support.WsMsg;
|
||||||
import com.njzscloud.supervisory.biz.constant.AuditStatus;
|
import com.njzscloud.supervisory.biz.constant.AuditStatus;
|
||||||
import com.njzscloud.supervisory.biz.constant.BizObj;
|
import com.njzscloud.supervisory.biz.constant.BizObj;
|
||||||
import com.njzscloud.supervisory.biz.pojo.entity.*;
|
import com.njzscloud.supervisory.biz.pojo.entity.*;
|
||||||
import com.njzscloud.supervisory.biz.service.BizAuditConfigService;
|
import com.njzscloud.supervisory.biz.service.*;
|
||||||
import com.njzscloud.supervisory.biz.service.BizWarnService;
|
|
||||||
import com.njzscloud.supervisory.biz.service.TruckLocationTrackService;
|
|
||||||
import com.njzscloud.supervisory.constant.Constant;
|
import com.njzscloud.supervisory.constant.Constant;
|
||||||
import com.njzscloud.supervisory.device.pojo.entity.DeviceLocalizerEntity;
|
import com.njzscloud.supervisory.device.pojo.entity.DeviceLocalizerEntity;
|
||||||
|
import com.njzscloud.supervisory.discount.pojo.DiscountManageEntity;
|
||||||
|
import com.njzscloud.supervisory.discount.service.DiscountManageService;
|
||||||
import com.njzscloud.supervisory.expense.contant.BillingType;
|
import com.njzscloud.supervisory.expense.contant.BillingType;
|
||||||
import com.njzscloud.supervisory.expense.contant.ExpenseItemCategory;
|
import com.njzscloud.supervisory.expense.contant.ExpenseItemCategory;
|
||||||
import com.njzscloud.supervisory.expense.contant.GoodsScope;
|
import com.njzscloud.supervisory.expense.contant.GoodsScope;
|
||||||
|
|
@ -39,6 +41,9 @@ import com.njzscloud.supervisory.expense.contant.Scope;
|
||||||
import com.njzscloud.supervisory.expense.pojo.entity.ExpenseItemsConfigEntity;
|
import com.njzscloud.supervisory.expense.pojo.entity.ExpenseItemsConfigEntity;
|
||||||
import com.njzscloud.supervisory.expense.service.ExpenseItemsConfigService;
|
import com.njzscloud.supervisory.expense.service.ExpenseItemsConfigService;
|
||||||
import com.njzscloud.supervisory.goods.contant.MoneyStrategy;
|
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.money.contant.MoneyChangeCategory;
|
import com.njzscloud.supervisory.money.contant.MoneyChangeCategory;
|
||||||
import com.njzscloud.supervisory.money.pojo.entity.MoneyAccountEntity;
|
import com.njzscloud.supervisory.money.pojo.entity.MoneyAccountEntity;
|
||||||
import com.njzscloud.supervisory.money.pojo.entity.MoneyChangeDetailEntity;
|
import com.njzscloud.supervisory.money.pojo.entity.MoneyChangeDetailEntity;
|
||||||
|
|
@ -53,10 +58,19 @@ import com.njzscloud.supervisory.order.utils.FileUtil;
|
||||||
import com.njzscloud.supervisory.station.pojo.entity.StationManageEntity;
|
import com.njzscloud.supervisory.station.pojo.entity.StationManageEntity;
|
||||||
import com.njzscloud.supervisory.station.service.StationManageService;
|
import com.njzscloud.supervisory.station.service.StationManageService;
|
||||||
import com.njzscloud.supervisory.sys.auth.pojo.result.MyResult;
|
import com.njzscloud.supervisory.sys.auth.pojo.result.MyResult;
|
||||||
|
import com.njzscloud.supervisory.sys.role.pojo.entity.RoleEntity;
|
||||||
|
import com.njzscloud.supervisory.sys.role.service.RoleService;
|
||||||
import com.njzscloud.supervisory.sys.stationletter.constant.WarnCategory;
|
import com.njzscloud.supervisory.sys.stationletter.constant.WarnCategory;
|
||||||
|
import com.njzscloud.supervisory.sys.user.pojo.entity.UserEntity;
|
||||||
|
import com.njzscloud.supervisory.sys.user.pojo.result.SysUserRoleEntity;
|
||||||
|
import com.njzscloud.supervisory.sys.user.service.UserRoleService;
|
||||||
|
import com.njzscloud.supervisory.sys.user.service.UserService;
|
||||||
import com.njzscloud.supervisory.voicebox.service.CloudVoiceboxService;
|
import com.njzscloud.supervisory.voicebox.service.CloudVoiceboxService;
|
||||||
|
import com.njzscloud.supervisory.wxPay.contant.TempType;
|
||||||
import com.njzscloud.supervisory.wxPay.dto.RefundRequestDto;
|
import com.njzscloud.supervisory.wxPay.dto.RefundRequestDto;
|
||||||
|
import com.njzscloud.supervisory.wxPay.param.TemplateMessageParam;
|
||||||
import com.njzscloud.supervisory.wxPay.service.PaymentService;
|
import com.njzscloud.supervisory.wxPay.service.PaymentService;
|
||||||
|
import com.njzscloud.supervisory.wxPay.service.WechatTemplateMessageService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
@ -96,6 +110,14 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
private final MoneyAccountService moneyAccountService;
|
private final MoneyAccountService moneyAccountService;
|
||||||
private final MoneyChangeDetailService moneyChangeDetailService;
|
private final MoneyChangeDetailService moneyChangeDetailService;
|
||||||
private final PaymentService paymentService;
|
private final PaymentService paymentService;
|
||||||
|
private final WechatTemplateMessageService wechatTemplateMessageService;
|
||||||
|
private final BizDriverService bizDriverService;
|
||||||
|
private final BizCompanyService bizCompanyService;
|
||||||
|
private final RoleService roleService;
|
||||||
|
private final UserRoleService userRoleService;
|
||||||
|
private final UserService userService;
|
||||||
|
private final BizTruckService bizTruckService;
|
||||||
|
private final DiscountManageService discountManageService;
|
||||||
private final AtomicBoolean test_thread_running = new AtomicBoolean(false);
|
private final AtomicBoolean test_thread_running = new AtomicBoolean(false);
|
||||||
Thread test_thread = null;
|
Thread test_thread = null;
|
||||||
@Value("${app.check-gps:false}")
|
@Value("${app.check-gps:false}")
|
||||||
|
|
@ -147,6 +169,18 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
if (transCompanyId != null) {
|
if (transCompanyId != null) {
|
||||||
BizCompanyEntity transCompanyEntity = baseMapper.getTransInfo(transCompanyId);
|
BizCompanyEntity transCompanyEntity = baseMapper.getTransInfo(transCompanyId);
|
||||||
cloudVoiceboxService.play(transCompanyEntity.getUserId(), "您有新的待分配订单,请及时处理");
|
cloudVoiceboxService.play(transCompanyEntity.getUserId(), "您有新的待分配订单,请及时处理");
|
||||||
|
// 通知清运公司
|
||||||
|
try {
|
||||||
|
TemplateMessageParam param = new TemplateMessageParam();
|
||||||
|
param.setUserId(transCompanyEntity.getUserId());
|
||||||
|
param.setTempType(TempType.TRANS_COMPANY.getVal());
|
||||||
|
param.setSn(orderInfoEntity.getSn());
|
||||||
|
param.setGoodsName(entity.getGoodsName());
|
||||||
|
param.setStartAddress(cargoPlace.getAreaName() + cargoPlace.getTownName() + cargoPlace.getAddress());
|
||||||
|
wechatTemplateMessageService.sendTemplateMessage(param);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("通知失败", e);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cloudVoiceboxService.play(1L, "您有新的待分配订单,请及时处理");
|
cloudVoiceboxService.play(1L, "您有新的待分配订单,请及时处理");
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +225,9 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
Long transCompanyId = orderPagingSearchParam.getTransCompanyId();
|
Long transCompanyId = orderPagingSearchParam.getTransCompanyId();
|
||||||
Long goodsId = orderPagingSearchParam.getGoodsId();
|
Long goodsId = orderPagingSearchParam.getGoodsId();
|
||||||
Page<OrderPagingResult> page = pageParam.toPage();
|
Page<OrderPagingResult> page = pageParam.toPage();
|
||||||
|
Long stationId = orderPagingSearchParam.getStationId();
|
||||||
QueryWrapper<OrderPagingResult> ew = Wrappers.<OrderPagingResult>query()
|
QueryWrapper<OrderPagingResult> ew = Wrappers.<OrderPagingResult>query()
|
||||||
|
.eq(stationId != null && stationId > 0, "a.station_id", stationId)
|
||||||
.like(StrUtil.isNotBlank(sn), "a.sn", sn)
|
.like(StrUtil.isNotBlank(sn), "a.sn", sn)
|
||||||
.like(StrUtil.isNotBlank(licensePlate), "e.license_plate", licensePlate)
|
.like(StrUtil.isNotBlank(licensePlate), "e.license_plate", licensePlate)
|
||||||
.like(StrUtil.isNotBlank(nickname), "a.contacts", nickname)
|
.like(StrUtil.isNotBlank(nickname), "a.contacts", nickname)
|
||||||
|
|
@ -248,9 +284,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
}
|
}
|
||||||
Set<String> roles = userDetail.getRoles();
|
Set<String> roles = userDetail.getRoles();
|
||||||
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
||||||
Long stationId = orderPagingSearchParam.getStationId();
|
|
||||||
ew
|
ew
|
||||||
.eq(stationId != null && stationId > 0, "a.station_id", stationId)
|
|
||||||
.eq("a.order_status", OrderStatus.YiYuYue)
|
.eq("a.order_status", OrderStatus.YiYuYue)
|
||||||
.isNull("a.trans_company_id ")
|
.isNull("a.trans_company_id ")
|
||||||
;
|
;
|
||||||
|
|
@ -274,9 +308,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
|
|
||||||
Set<String> roles = userDetail.getRoles();
|
Set<String> roles = userDetail.getRoles();
|
||||||
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
||||||
Long stationId = orderPagingSearchParam.getStationId();
|
|
||||||
ew
|
ew
|
||||||
.eq(stationId != null && stationId > 0, "a.station_id", stationId)
|
|
||||||
.in("a.order_status", OrderStatus.DaiPaiDan, OrderStatus.DaiJieDan, OrderStatus.YiJieDan)
|
.in("a.order_status", OrderStatus.DaiPaiDan, OrderStatus.DaiJieDan, OrderStatus.YiJieDan)
|
||||||
;
|
;
|
||||||
return;
|
return;
|
||||||
|
|
@ -313,9 +345,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
|
|
||||||
Set<String> roles = userDetail.getRoles();
|
Set<String> roles = userDetail.getRoles();
|
||||||
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
||||||
Long stationId = orderPagingSearchParam.getStationId();
|
|
||||||
ew
|
ew
|
||||||
.eq(stationId != null && stationId > 0, "a.station_id", stationId)
|
|
||||||
.in("a.order_status", OrderStatus.QingYunZhong, OrderStatus.YiJinChang, OrderStatus.YiChuChang)
|
.in("a.order_status", OrderStatus.QingYunZhong, OrderStatus.YiJinChang, OrderStatus.YiChuChang)
|
||||||
;
|
;
|
||||||
return;
|
return;
|
||||||
|
|
@ -355,9 +385,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
|
|
||||||
Set<String> roles = userDetail.getRoles();
|
Set<String> roles = userDetail.getRoles();
|
||||||
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
||||||
Long stationId = orderPagingSearchParam.getStationId();
|
|
||||||
ew
|
ew
|
||||||
.eq(stationId != null && stationId > 0, "a.station_id", stationId)
|
|
||||||
.eq("a.order_status", OrderStatus.YiWanCheng)
|
.eq("a.order_status", OrderStatus.YiWanCheng)
|
||||||
;
|
;
|
||||||
return;
|
return;
|
||||||
|
|
@ -379,9 +407,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
|
|
||||||
Set<String> roles = userDetail.getRoles();
|
Set<String> roles = userDetail.getRoles();
|
||||||
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
||||||
Long stationId = orderPagingSearchParam.getStationId();
|
|
||||||
ew
|
ew
|
||||||
.eq(stationId != null && stationId > 0, "a.station_id", stationId)
|
|
||||||
.eq("a.order_status", OrderStatus.YiQuXiao)
|
.eq("a.order_status", OrderStatus.YiQuXiao)
|
||||||
;
|
;
|
||||||
return;
|
return;
|
||||||
|
|
@ -392,9 +418,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
UserDetail userDetail = SecurityUtil.loginUser();
|
UserDetail userDetail = SecurityUtil.loginUser();
|
||||||
Set<String> roles = userDetail.getRoles();
|
Set<String> roles = userDetail.getRoles();
|
||||||
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
||||||
Long stationId = orderPagingSearchParam.getStationId();
|
|
||||||
ew
|
ew
|
||||||
.eq(stationId != null && stationId > 0, "a.station_id", stationId)
|
|
||||||
.ne("a.auto_order", 3)
|
.ne("a.auto_order", 3)
|
||||||
;
|
;
|
||||||
return;
|
return;
|
||||||
|
|
@ -600,6 +624,38 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
.setCheckStatus(checkStatus)
|
.setCheckStatus(checkStatus)
|
||||||
.setAuditMemo(auditOrderParam.getAuditMemo())
|
.setAuditMemo(auditOrderParam.getAuditMemo())
|
||||||
);
|
);
|
||||||
|
// auditStatus为市待审核状态通知市,通过状态通知司机
|
||||||
|
try {
|
||||||
|
TemplateMessageParam param = new TemplateMessageParam();
|
||||||
|
param.setUserId(detail.getDriverUserId());
|
||||||
|
param.setSn(detail.getSn());
|
||||||
|
OrderGoodsEntity entity = orderGoodsService.getById(detail.getGoodsId());
|
||||||
|
param.setGoodsName(entity.getGoodsName());
|
||||||
|
param.setLicensePlate(detail.getLicensePlate());
|
||||||
|
if (AuditStatus.ShiDaiShenHe.equals(auditStatus)) {
|
||||||
|
param.setCfCompanyName(detail.getNickname());
|
||||||
|
param.setTempType(TempType.AUDIT_PENDING.getVal());
|
||||||
|
RoleEntity roleEntity = roleService.getOne(Wrappers.lambdaQuery(RoleEntity.class).eq(
|
||||||
|
RoleEntity::getRoleCode, config.getCityRole()));
|
||||||
|
List<SysUserRoleEntity> userIds = userRoleService.list(Wrappers.lambdaQuery(SysUserRoleEntity.class)
|
||||||
|
.eq(SysUserRoleEntity::getRoleId, roleEntity.getId()));
|
||||||
|
for (SysUserRoleEntity userRoleEntity : userIds) {
|
||||||
|
param.setUserId(userRoleEntity.getUserId());
|
||||||
|
}
|
||||||
|
wechatTemplateMessageService.sendTemplateMessage(param);
|
||||||
|
} else if (AuditStatus.TongGuo.equals(auditStatus)) {
|
||||||
|
param.setTempType(TempType.AUDIT_OK.getVal());
|
||||||
|
param.setDriverName(detail.getDriverName());
|
||||||
|
param.setEndAddress(detail.getStationName());
|
||||||
|
wechatTemplateMessageService.sendTemplateMessage(param);
|
||||||
|
} else if (AuditStatus.BoHui.equals(auditStatus)) {
|
||||||
|
param.setTempType(TempType.AUDIT_REJECT.getVal());
|
||||||
|
param.setStartAddress(detail.getAreaName() + detail.getTownName() + detail.getAddress());
|
||||||
|
wechatTemplateMessageService.sendTemplateMessage(param);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("通知失败", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|
@ -662,6 +718,22 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
.setAssignmentDriverTime(LocalDateTime.now())
|
.setAssignmentDriverTime(LocalDateTime.now())
|
||||||
.setOrderStatus(OrderStatus.DaiJieDan)
|
.setOrderStatus(OrderStatus.DaiJieDan)
|
||||||
);
|
);
|
||||||
|
// 通知司机
|
||||||
|
try {
|
||||||
|
BizDriverEntity driverEntity = bizDriverService.getById(driverId);
|
||||||
|
TemplateMessageParam param = new TemplateMessageParam();
|
||||||
|
param.setUserId(driverEntity.getUserId());
|
||||||
|
param.setTempType(TempType.DRIVER.getVal());
|
||||||
|
param.setSn(orderInfo.getSn());
|
||||||
|
param.setDriverName(driverEntity.getDriverName());
|
||||||
|
OrderCargoPlaceEntity cargoPlace = orderCargoPlaceService.getById(orderInfo.getCargoPlaceId());
|
||||||
|
param.setStartAddress(cargoPlace.getAreaName() + cargoPlace.getTownName() + cargoPlace.getAddress());
|
||||||
|
BizCompanyEntity companyEntity = bizCompanyService.getById(orderInfo.getStationId());
|
||||||
|
param.setEndAddress(companyEntity.getStationName());
|
||||||
|
wechatTemplateMessageService.sendTemplateMessage(param);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("通知失败", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean assignmentTrafficCompany(AssignmentOrderParam assignmentOrderParam,
|
private boolean assignmentTrafficCompany(AssignmentOrderParam assignmentOrderParam,
|
||||||
|
|
@ -680,7 +752,21 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
);
|
);
|
||||||
// OrderInfoEntity orderInfoEntity = this.getById(orderInfoId);
|
// OrderInfoEntity orderInfoEntity = this.getById(orderInfoId);
|
||||||
// settleForTransCompany(orderInfoEntity, 0);
|
// settleForTransCompany(orderInfoEntity, 0);
|
||||||
|
// 通知清运公司
|
||||||
|
try {
|
||||||
|
TemplateMessageParam param = new TemplateMessageParam();
|
||||||
|
BizCompanyEntity transCompanyEntity = baseMapper.getTransInfo(transCompanyId);
|
||||||
|
param.setUserId(transCompanyEntity.getUserId());
|
||||||
|
param.setTempType(TempType.TRANS_COMPANY.getVal());
|
||||||
|
param.setSn(orderInfo.getSn());
|
||||||
|
OrderGoodsEntity entity = orderGoodsService.getById(orderInfo.getGoodsId());
|
||||||
|
param.setGoodsName(entity.getGoodsName());
|
||||||
|
OrderCargoPlaceEntity cargoPlace = orderCargoPlaceService.getById(orderInfo.getCargoPlaceId());
|
||||||
|
param.setStartAddress(cargoPlace.getAreaName() + cargoPlace.getTownName() + cargoPlace.getAddress());
|
||||||
|
wechatTemplateMessageService.sendTemplateMessage(param);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("通知失败", e);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -715,6 +801,38 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
.setTruckId(truckId)
|
.setTruckId(truckId)
|
||||||
.setOrderStatus(OrderStatus.YiJieDan)
|
.setOrderStatus(OrderStatus.YiJieDan)
|
||||||
);
|
);
|
||||||
|
try {
|
||||||
|
// 通知审核人
|
||||||
|
RoleEntity roleEntity = new RoleEntity();
|
||||||
|
if (null != bizAuditConfigEntity && !Strings.isNullOrEmpty(bizAuditConfigEntity.getAreaRole())
|
||||||
|
&& AuditStatus.QuDaiShenHe.equals(auditStatus)) {
|
||||||
|
roleEntity = roleService.getOne(Wrappers.lambdaQuery(RoleEntity.class).eq(
|
||||||
|
RoleEntity::getRoleCode, bizAuditConfigEntity.getAreaRole()));
|
||||||
|
} else if (null != bizAuditConfigEntity && !Strings.isNullOrEmpty(bizAuditConfigEntity.getCityRole())
|
||||||
|
&& AuditStatus.ShiDaiShenHe.equals(auditStatus)) {
|
||||||
|
roleEntity = roleService.getOne(Wrappers.lambdaQuery(RoleEntity.class).eq(
|
||||||
|
RoleEntity::getRoleCode, bizAuditConfigEntity.getCityRole()));
|
||||||
|
}
|
||||||
|
if (null != roleEntity && null != roleEntity.getId()) {
|
||||||
|
List<SysUserRoleEntity> userIds = userRoleService.list(Wrappers.lambdaQuery(SysUserRoleEntity.class)
|
||||||
|
.eq(SysUserRoleEntity::getRoleId, roleEntity.getId()));
|
||||||
|
TemplateMessageParam param = new TemplateMessageParam();
|
||||||
|
param.setTempType(TempType.AUDIT_PENDING.getVal());
|
||||||
|
param.setSn(orderInfo.getSn());
|
||||||
|
OrderGoodsEntity entity = orderGoodsService.getById(orderInfo.getGoodsId());
|
||||||
|
param.setGoodsName(entity.getGoodsName());
|
||||||
|
BizTruckEntity truckEntity = bizTruckService.getById(orderInfo.getTruckId());
|
||||||
|
param.setLicensePlate(truckEntity.getLicensePlate());
|
||||||
|
for (SysUserRoleEntity userRoleEntity : userIds) {
|
||||||
|
UserEntity userEntity = userService.getById(userRoleEntity.getUserId());
|
||||||
|
param.setUserId(userRoleEntity.getUserId());
|
||||||
|
param.setCfCompanyName(userEntity.getNickname());
|
||||||
|
wechatTemplateMessageService.sendTemplateMessage(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("通知失败", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|
@ -785,6 +903,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
}
|
}
|
||||||
if (payMoney != null && payMoney.compareTo(BigDecimal.ZERO) > 0) {
|
if (payMoney != null && payMoney.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
if (!SettlementWay.CASH.getVal().equals(ctx.getSettlementWay())) {
|
if (!SettlementWay.CASH.getVal().equals(ctx.getSettlementWay())) {
|
||||||
|
String way = SettlementWay.BALANCE.getVal().equals(ctx.getSettlementWay()) ?
|
||||||
|
SettlementWay.BALANCE.getTxt() : SettlementWay.MONTH.getTxt();
|
||||||
BigDecimal oldBalance = ctx.getCompanyBalance();
|
BigDecimal oldBalance = ctx.getCompanyBalance();
|
||||||
BigDecimal newBalance = oldBalance.subtract(payMoney);
|
BigDecimal newBalance = oldBalance.subtract(payMoney);
|
||||||
// 更新账户余额(支持负数余额)
|
// 更新账户余额(支持负数余额)
|
||||||
|
|
@ -802,7 +922,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
.setDelta(payMoney.negate()) // 扣减为负数
|
.setDelta(payMoney.negate()) // 扣减为负数
|
||||||
.setNewMoney(newBalance)
|
.setNewMoney(newBalance)
|
||||||
.setMoneyChangeCategory(MoneyChangeCategory.DingDanKouKuan)
|
.setMoneyChangeCategory(MoneyChangeCategory.DingDanKouKuan)
|
||||||
.setMemo("订单支付扣款,订单号:" + orderInfo.getSn() + ",结算方式:" + ctx.getSettlementWay());
|
.setMemo("订单支付扣款,订单号:" + orderInfo.getSn() + ",结算方式:" + way);
|
||||||
|
|
||||||
moneyChangeDetailService.save(changeDetail);
|
moneyChangeDetailService.save(changeDetail);
|
||||||
|
|
||||||
|
|
@ -1042,6 +1162,21 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
Assert.notNull(orderInfoEntity, () -> Exceptions.clierr("订单不存在"));
|
Assert.notNull(orderInfoEntity, () -> Exceptions.clierr("订单不存在"));
|
||||||
OrderStatus orderStatus = orderInfoEntity.getOrderStatus();
|
OrderStatus orderStatus = orderInfoEntity.getOrderStatus();
|
||||||
Assert.isTrue(orderStatus == OrderStatus.YiJinChang, () -> Exceptions.clierr("当前订单状态,无法出场"));
|
Assert.isTrue(orderStatus == OrderStatus.YiJinChang, () -> Exceptions.clierr("当前订单状态,无法出场"));
|
||||||
|
OrderCategory orderCategory = orderInfoEntity.getOrderCategory();
|
||||||
|
|
||||||
|
Integer settleWeight = orderCarInOutService.truckOut(orderInfoEntity.getCarInOutId(), truckLeavingOrderParam, orderCategory, truckId);
|
||||||
|
// 结算(目前仅针对清运公司):
|
||||||
|
// 1) 复制“产品”到 order_expense_items;
|
||||||
|
// 2) 从 expense_items_config 读取可用付费项并按 scope 过滤(all / customer_type=QiYe|GeTi / customer 包含 trans_company_id);
|
||||||
|
// 3) 合并集合,计算 total_money 与 settle_money,并批量落库。
|
||||||
|
OrderGoodsEntity entity = orderGoodsService.getById(orderInfoEntity.getGoodsId());
|
||||||
|
Assert.notNull(entity, () -> Exceptions.clierr("产品不存在"));
|
||||||
|
if (MoneyWay.OUT.getVal().equals(entity.getMoneyWay())) {
|
||||||
|
// 计算费用,出厂付费可能需要称重,需要更新付费项
|
||||||
|
updateOrderItems(orderInfoEntity.getId(), orderInfoEntity.getTransCompanyId(), settleWeight, Boolean.FALSE);
|
||||||
|
orderInfoEntity = this.getById(truckLeavingOrderParam.getOrderId());
|
||||||
|
}
|
||||||
|
|
||||||
baseMapper.busyDriver(orderInfoEntity.getDriverId(), Boolean.FALSE);
|
baseMapper.busyDriver(orderInfoEntity.getDriverId(), Boolean.FALSE);
|
||||||
baseMapper.busyTruck(orderInfoEntity.getTruckId(), Boolean.FALSE);
|
baseMapper.busyTruck(orderInfoEntity.getTruckId(), Boolean.FALSE);
|
||||||
PaymentStatus paymentStatus = orderInfoEntity.getPaymentStatus();
|
PaymentStatus paymentStatus = orderInfoEntity.getPaymentStatus();
|
||||||
|
|
@ -1052,33 +1187,27 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
.setId(orderInfoEntity.getId())
|
.setId(orderInfoEntity.getId())
|
||||||
.setOrderStatus(newOrderStatus)
|
.setOrderStatus(newOrderStatus)
|
||||||
);
|
);
|
||||||
OrderCategory orderCategory = orderInfoEntity.getOrderCategory();
|
|
||||||
// 计算本单净重(或结算重量),作为结算时的数量依据
|
// 计算本单净重(或结算重量),作为结算时的数量依据
|
||||||
Integer settleWeight = orderCarInOutService.truckOut(orderInfoEntity.getCarInOutId(), truckLeavingOrderParam, orderCategory, truckId);
|
|
||||||
|
|
||||||
|
OrderInfoEntity orderInfoEntity_ = orderInfoEntity;
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
BizTruckEntity truckInfo = baseMapper.getTruckInfo(truckId);
|
BizTruckEntity truckInfo = baseMapper.getTruckInfo(truckId);
|
||||||
String licensePlate = truckInfo.getLicensePlate();
|
String licensePlate = truckInfo.getLicensePlate();
|
||||||
Websocket.publish(new WsMsg().setEvent("down/order/status_change")
|
Websocket.publish(new WsMsg().setEvent("down/order/status_change")
|
||||||
.setData(MapUtil.builder()
|
.setData(MapUtil.builder()
|
||||||
.put("sn", orderInfoEntity.getSn())
|
.put("sn", orderInfoEntity_.getSn())
|
||||||
.put("licensePlate", licensePlate)
|
.put("licensePlate", licensePlate)
|
||||||
.put("orderStatus", newOrderStatus)
|
.put("orderStatus", newOrderStatus)
|
||||||
.build()));
|
.build()));
|
||||||
}).exceptionally(e -> {
|
}).exceptionally(e -> {
|
||||||
log.error("订单状态改变事件发布失败,订单{},状态{}", orderInfoEntity.getSn(), newOrderStatus, e);
|
log.error("订单状态改变事件发布失败,订单{},状态{}", orderInfoEntity_.getSn(), newOrderStatus, e);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
// 结算(目前仅针对清运公司):
|
|
||||||
// 1) 复制“产品”到 order_expense_items;
|
|
||||||
// 2) 从 expense_items_config 读取可用付费项并按 scope 过滤(all / customer_type=QiYe|GeTi / customer 包含 trans_company_id);
|
|
||||||
// 3) 合并集合,计算 total_money 与 settle_money,并批量落库。
|
|
||||||
OrderGoodsEntity entity = orderGoodsService.getById(orderInfoEntity.getGoodsId());
|
|
||||||
Assert.notNull(entity, () -> Exceptions.clierr("产品不存在"));
|
|
||||||
// 出厂付费
|
// 出厂付费
|
||||||
if (MoneyWay.OUT.getVal().equals(entity.getMoneyWay())) {
|
if (MoneyWay.OUT.getVal().equals(entity.getMoneyWay())) {
|
||||||
// 计算费用,出厂付费可能需要称重,需要更新付费项
|
// 计算费用,出厂付费可能需要称重,需要更新付费项
|
||||||
updateOrderItems(orderInfoEntity.getId(), settleWeight, Boolean.FALSE);
|
// updateOrderItems(orderInfoEntity.getId(), settleWeight, Boolean.FALSE);
|
||||||
|
|
||||||
// 扣费
|
// 扣费
|
||||||
return handleCompanyPay(orderInfoEntity, Boolean.FALSE, new BigDecimal("0"), Boolean.FALSE);
|
return handleCompanyPay(orderInfoEntity, Boolean.FALSE, new BigDecimal("0"), Boolean.FALSE);
|
||||||
|
|
@ -1139,23 +1268,62 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算付费项的优惠金额
|
||||||
|
* @param companyId 清运公司id
|
||||||
|
* @param item 付费项实体
|
||||||
|
* @return 总金额
|
||||||
|
*/
|
||||||
|
private BigDecimal calculateItemDiscountMoney(Long companyId, OrderExpenseItemsEntity item) {
|
||||||
|
BigDecimal discountMoney = new BigDecimal("0");
|
||||||
|
Long goodsId = null;
|
||||||
|
Long itemId = null;
|
||||||
|
if (ExpenseItemCategory.ChanPin.getVal().equals(item.getExpenseItemCategory())) {
|
||||||
|
OrderGoodsEntity entity = orderGoodsService.getById(item.getOriginExpenseItemId());
|
||||||
|
if (null == entity) {
|
||||||
|
return discountMoney;
|
||||||
|
}
|
||||||
|
goodsId = entity.getOriginGoodsId();
|
||||||
|
} else if (ExpenseItemCategory.QingYunFuWuFei.getVal().equals(item.getExpenseItemCategory())){
|
||||||
|
itemId = item.getOriginExpenseItemId();
|
||||||
|
}
|
||||||
|
List<DiscountManageEntity> discountList = discountManageService.list(Wrappers.lambdaQuery(DiscountManageEntity.class)
|
||||||
|
.eq(DiscountManageEntity::getCompanyId, companyId)
|
||||||
|
.in(null != goodsId, DiscountManageEntity::getGoodsIds, goodsId)
|
||||||
|
.eq(null != itemId, DiscountManageEntity::getExpenseId, itemId)
|
||||||
|
.eq(DiscountManageEntity::getDeleted, Boolean.FALSE));
|
||||||
|
if (null != discountList && discountList.size() > 0) {
|
||||||
|
for (DiscountManageEntity discount: discountList) {
|
||||||
|
if (DiscountType.DISCOUNT.getVal().equals(discount.getType())) {
|
||||||
|
discountMoney = discountMoney.subtract(discount.getMoney());
|
||||||
|
} else if (DiscountType.RAISE.getVal().equals(discount.getType())) {
|
||||||
|
discountMoney = discountMoney.add(discount.getMoney());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return discountMoney;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算并设置付费项的金额(总金额、结算金额)
|
* 计算并设置付费项的金额(总金额、结算金额)
|
||||||
*
|
*
|
||||||
* @param item 付费项实体
|
* @param item 付费项实体
|
||||||
*/
|
*/
|
||||||
private void calculateAndSetItemMoney(OrderExpenseItemsEntity item, Boolean isChange) {
|
private void calculateAndSetItemMoney(OrderExpenseItemsEntity item, Long companyId, Boolean isChange) {
|
||||||
// 计算总金额
|
// 计算总金额
|
||||||
BigDecimal totalMoney = calculateItemTotalMoney(item);
|
BigDecimal totalMoney = calculateItemTotalMoney(item);
|
||||||
|
|
||||||
|
// 计算优惠金额(有正负)
|
||||||
|
BigDecimal discountMoney = calculateItemDiscountMoney(companyId, item);
|
||||||
|
|
||||||
// settle_money = total_money + discount_money + revise_money(discount、revise 可为正负)
|
// settle_money = total_money + discount_money + revise_money(discount、revise 可为正负)
|
||||||
BigDecimal discount = item.getDiscountMoney() == null ? BigDecimal.ZERO : item.getDiscountMoney();
|
BigDecimal discount = discountMoney == null ? BigDecimal.ZERO : discountMoney;
|
||||||
BigDecimal revise = item.getReviseMoney() == null ? BigDecimal.ZERO : item.getReviseMoney();
|
BigDecimal revise = item.getReviseMoney() == null ? BigDecimal.ZERO : item.getReviseMoney();
|
||||||
BigDecimal settle = totalMoney.add(discount).add(revise);
|
BigDecimal settle = totalMoney.add(discount).add(revise);
|
||||||
if (isChange) {
|
if (isChange) {
|
||||||
item.setChangeMoney(settle);
|
item.setTotalMoney(totalMoney).setSettleMoney(settle).setDiscountMoney(discount).setChangeMoney(settle);
|
||||||
} else {
|
} else {
|
||||||
item.setTotalMoney(totalMoney).setSettleMoney(settle);
|
item.setTotalMoney(totalMoney).setSettleMoney(settle).setDiscountMoney(discount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1203,13 +1371,14 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算付费项列表的金额并更新订单汇总金额
|
* 计算付费项列表的金额并更新订单汇总金额
|
||||||
* @param orderId 订单ID
|
*
|
||||||
* @param items 付费项列表
|
* @param orderId 订单ID
|
||||||
|
* @param items 付费项列表
|
||||||
*/
|
*/
|
||||||
private void calculateItemsAndUpdateOrder(Long orderId, List<OrderExpenseItemsEntity> items) {
|
private void calculateItemsAndUpdateOrder(Long orderId, Long companyId, List<OrderExpenseItemsEntity> items) {
|
||||||
// 计算各付费项金额
|
// 计算各付费项金额
|
||||||
for (OrderExpenseItemsEntity item : items) {
|
for (OrderExpenseItemsEntity item : items) {
|
||||||
calculateAndSetItemMoney(item, Boolean.FALSE);
|
calculateAndSetItemMoney(item, companyId, Boolean.FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量更新付费项(包含quantity和所有金额字段)
|
// 批量更新付费项(包含quantity和所有金额字段)
|
||||||
|
|
@ -1219,7 +1388,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
updateOrderTotalMoney(orderId, items, Boolean.FALSE, Boolean.TRUE);
|
updateOrderTotalMoney(orderId, items, Boolean.FALSE, Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateOrderItems(Long orderId, Integer settleWeight, Boolean isChange) {
|
public void updateOrderItems(Long orderId, Long companyId, Integer settleWeight, Boolean isChange) {
|
||||||
List<OrderExpenseItemsEntity> extraItems = orderExpenseItemsService.list(Wrappers.lambdaQuery(OrderExpenseItemsEntity.class)
|
List<OrderExpenseItemsEntity> extraItems = orderExpenseItemsService.list(Wrappers.lambdaQuery(OrderExpenseItemsEntity.class)
|
||||||
.eq(OrderExpenseItemsEntity::getOrderId, orderId)
|
.eq(OrderExpenseItemsEntity::getOrderId, orderId)
|
||||||
.eq(OrderExpenseItemsEntity::getDeleted, Boolean.FALSE));
|
.eq(OrderExpenseItemsEntity::getDeleted, Boolean.FALSE));
|
||||||
|
|
@ -1228,7 +1397,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
for (OrderExpenseItemsEntity item : extraItems) {
|
for (OrderExpenseItemsEntity item : extraItems) {
|
||||||
item.setQuantity(MoneyStrategy.Che.getVal().equals(item.getMoneyStrategy()) ? 1 : settleWeight);
|
item.setQuantity(MoneyStrategy.Che.getVal().equals(item.getMoneyStrategy()) ? 1 : settleWeight);
|
||||||
// 重新计算金额(totalMoney、settleMoney)
|
// 重新计算金额(totalMoney、settleMoney)
|
||||||
calculateAndSetItemMoney(item, isChange);
|
calculateAndSetItemMoney(item, companyId, isChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量更新付费项(包含quantity和所有金额字段)
|
// 批量更新付费项(包含quantity和所有金额字段)
|
||||||
|
|
@ -1328,7 +1497,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
orderExpenseItemsService.saveBatch(extraItems);
|
orderExpenseItemsService.saveBatch(extraItems);
|
||||||
|
|
||||||
// 计算付费项金额并更新订单汇总
|
// 计算付费项金额并更新订单汇总
|
||||||
calculateItemsAndUpdateOrder(orderId, extraItems);
|
calculateItemsAndUpdateOrder(orderId, transCompanyId, extraItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderPagingResult pendingOrder(String licensePlate) {
|
public OrderPagingResult pendingOrder(String licensePlate) {
|
||||||
|
|
@ -1431,15 +1600,17 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
LocalDateTime startTime = searchParam.getStartTime();
|
LocalDateTime startTime = searchParam.getStartTime();
|
||||||
LocalDateTime endTime = searchParam.getEndTime();
|
LocalDateTime endTime = searchParam.getEndTime();
|
||||||
QueryWrapper<OrderPagingResult> ew = Wrappers.query();
|
QueryWrapper<OrderPagingResult> ew = Wrappers.query();
|
||||||
|
ew.eq(null != searchParam.getStationId() && searchParam.getStationId() > 0, "a.station_id", searchParam.getStationId());
|
||||||
ew.like(StrUtil.isNotBlank(searchParam.getSn()), "a.sn", searchParam.getSn());
|
ew.like(StrUtil.isNotBlank(searchParam.getSn()), "a.sn", searchParam.getSn());
|
||||||
ew.like(StrUtil.isNotBlank(searchParam.getLicensePlate()), "e.license_plate", searchParam.getLicensePlate());
|
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.getPhone()), "a.phone", searchParam.getPhone());
|
||||||
ew.like(StrUtil.isNotBlank(searchParam.getNickname()), "a.contacts", searchParam.getNickname());
|
ew.like(StrUtil.isNotBlank(searchParam.getNickname()), "a.contacts", searchParam.getNickname());
|
||||||
ew.ge(startTime != null, "a.create_time", startTime);
|
ew.ge(startTime != null, "a.create_time", startTime);
|
||||||
ew.le(endTime != null, "a.create_time", endTime);
|
ew.le(endTime != null, "a.create_time", endTime);
|
||||||
|
ew.eq(null != searchParam.getTransCompanyId(), "a.trans_company_id", searchParam.getTransCompanyId());
|
||||||
historyEW(searchParam, null, ew);
|
historyEW(searchParam, null, ew);
|
||||||
List<OrderExportResult> list = baseMapper.exportList(ew);
|
List<OrderExportResult> list = baseMapper.exportList(ew);
|
||||||
|
List<OrderExportDetailResult> detailResults = baseMapper.exportDetailList(ew);
|
||||||
List<Map<String, Object>> downList = new ArrayList<>();
|
List<Map<String, Object>> downList = new ArrayList<>();
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (OrderExportResult result : list) {
|
for (OrderExportResult result : list) {
|
||||||
|
|
@ -1454,10 +1625,24 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
map.put("进场时间", result.getInTime());
|
map.put("进场时间", result.getInTime());
|
||||||
map.put("产废单位", result.getCfCompanyName());
|
map.put("产废单位", result.getCfCompanyName());
|
||||||
map.put("所属区域", result.getAreaName());
|
map.put("所属区域", result.getAreaName());
|
||||||
|
map.put("产废地址", result.getTownName() + result.getAddress());
|
||||||
map.put("入场磅重(吨)", result.getRoughWeight());
|
map.put("入场磅重(吨)", result.getRoughWeight());
|
||||||
map.put("皮重(吨)", result.getTareWeight());
|
map.put("皮重(吨)", result.getTareWeight());
|
||||||
map.put("净重(吨)", result.getSettleWeight());
|
map.put("净重(吨)", result.getSettleWeight());
|
||||||
map.put("驾驶员", result.getDriverName());
|
map.put("驾驶员", result.getDriverName());
|
||||||
|
if (null != detailResults && detailResults.size() > 0) {
|
||||||
|
List<OrderExportDetailResult> details = detailResults.stream().filter(t -> t.getOrderId()
|
||||||
|
.equals(result.getId())).collect(Collectors.toList());
|
||||||
|
List<String> detailList = new ArrayList<>();
|
||||||
|
if (details.size() > 0) {
|
||||||
|
for (OrderExportDetailResult detailResult: details) {
|
||||||
|
detailList.add(detailResult.getExpenseItemName() + detailResult.getSettleMoney() + "元");
|
||||||
|
}
|
||||||
|
map.put("明细", JSONObject.toJSONString(detailList));
|
||||||
|
} else {
|
||||||
|
map.put("明细", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
map.put("备注", result.getCheckerMemo());
|
map.put("备注", result.getCheckerMemo());
|
||||||
downList.add(map);
|
downList.add(map);
|
||||||
i++;
|
i++;
|
||||||
|
|
@ -1467,16 +1652,19 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
|
|
||||||
private void startTrack(String gpsId, String licensePlate, Long orderInfoId, Long truckId) {
|
private void startTrack(String gpsId, String licensePlate, Long orderInfoId, Long truckId) {
|
||||||
if (StrUtil.isBlank(gpsId)) return;
|
if (StrUtil.isBlank(gpsId)) return;
|
||||||
|
OrderPagingResult orderDetail = detail(orderInfoId);
|
||||||
|
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
Mqtt.subscribe(gpsId + "/track_location", (msg) -> {
|
Mqtt.subscribe(gpsId + "/track_location", (msg) -> {
|
||||||
RealtimeLocationResult realtimeLocationResult = msg.getMsg(RealtimeLocationResult.class);
|
RealtimeLocationResult realtimeLocationResult = msg.getMsg(RealtimeLocationResult.class);
|
||||||
if (realtimeLocationResult == null) {
|
if (realtimeLocationResult == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
double speed = realtimeLocationResult.getSpeed();
|
||||||
if (realtimeLocationResult.isOverspeed()) {
|
if (realtimeLocationResult.isOverspeed()) {
|
||||||
bizWarnService.save(new BizWarnEntity()
|
bizWarnService.save(new BizWarnEntity()
|
||||||
.setWarnCategory(WarnCategory.SPEED.getVal())
|
.setWarnCategory(WarnCategory.SPEED.getVal())
|
||||||
.setWarnContent(StrUtil.format("{} 已超速,当前时速 {}km/h", licensePlate, realtimeLocationResult.getSpeed()))
|
.setWarnContent(StrUtil.format("{} 已超速,当前时速 {}km/h", licensePlate, speed))
|
||||||
.setOrderId(orderInfoId)
|
.setOrderId(orderInfoId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -1489,6 +1677,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int direction = realtimeLocationResult.getDirection();
|
||||||
TruckLocationTrackEntity entity = new TruckLocationTrackEntity()
|
TruckLocationTrackEntity entity = new TruckLocationTrackEntity()
|
||||||
.setOrderId(orderInfoId)
|
.setOrderId(orderInfoId)
|
||||||
.setTruckId(truckId)
|
.setTruckId(truckId)
|
||||||
|
|
@ -1496,12 +1685,38 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
.setLatitude(latitude)
|
.setLatitude(latitude)
|
||||||
.setLongitude(longitude)
|
.setLongitude(longitude)
|
||||||
.setAltitude(realtimeLocationResult.getAltitude())
|
.setAltitude(realtimeLocationResult.getAltitude())
|
||||||
.setSpeed(realtimeLocationResult.getSpeed())
|
.setSpeed(speed)
|
||||||
.setLocationTime(DateUtil.parseLocalDateTime(time))
|
.setLocationTime(DateUtil.parseLocalDateTime(time))
|
||||||
.setDirection(realtimeLocationResult.getDirection())
|
.setDirection(direction)
|
||||||
.setOverspeed(realtimeLocationResult.isOverspeed())
|
.setOverspeed(realtimeLocationResult.isOverspeed())
|
||||||
.setCompensate(realtimeLocationResult.getType() == 1);
|
.setCompensate(realtimeLocationResult.getType() == 1);
|
||||||
truckLocationTrackService.save(entity);
|
truckLocationTrackService.save(entity);
|
||||||
|
try {
|
||||||
|
String transCompanyName = orderDetail.getTransCompanyName();
|
||||||
|
HsoaResult<?> result = Hsoa.pushVehicleTrajectory(new PushVehicleTrajectoryParam()
|
||||||
|
.setCompanyName(transCompanyName)
|
||||||
|
.setTransportLicense(orderDetail.getCertificateSn())
|
||||||
|
.setPlateNumber(licensePlate)
|
||||||
|
.setVehicleType(orderDetail.getTruckCategory())
|
||||||
|
.setLongitude(longitude + "")
|
||||||
|
.setLatitude(latitude + "")
|
||||||
|
.setSpeed(speed)
|
||||||
|
.setDirection(direction + 0.0)
|
||||||
|
.setStateType("正常行驶")
|
||||||
|
.setAlarmType("无")
|
||||||
|
.setLoadStatus("2")
|
||||||
|
.setSealedStatus("1")
|
||||||
|
.setLiftStatus("0")
|
||||||
|
.setAccStatus(1)
|
||||||
|
.setGpsTime(time)
|
||||||
|
.setLocationMode("WGS84")
|
||||||
|
);
|
||||||
|
if (result == null || !result.isSuccess()) {
|
||||||
|
log.error("推送定位数据失败,数据Id:{}", entity.getId());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("推送定位数据失败,数据Id:{}", entity.getId(), e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
/* Mqtt.publish("location/track", MapUtil.builder()
|
/* Mqtt.publish("location/track", MapUtil.builder()
|
||||||
.put("terminalId", gpsId)
|
.put("terminalId", gpsId)
|
||||||
|
|
@ -1582,14 +1797,13 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
public void changePrice(ChangePriceParam param) {
|
public void changePrice(ChangePriceParam param) {
|
||||||
OrderInfoEntity order = this.getById(param.getOrderId());
|
OrderInfoEntity order = this.getById(param.getOrderId());
|
||||||
Assert.notNull(order, () -> Exceptions.clierr("订单不存在"));
|
Assert.notNull(order, () -> Exceptions.clierr("订单不存在"));
|
||||||
|
Assert.isFalse(null == order.getGoodsId(), () -> Exceptions.clierr("订单商品信息不存在"));
|
||||||
|
OrderGoodsEntity orderGoodsEntity = orderGoodsService.getById(order.getGoodsId());
|
||||||
|
String oldMoneyWay = orderGoodsEntity.getMoneyWay();
|
||||||
if (ChangePriceType.GOODS.getVal().equals(param.getChangePriceType())) {
|
if (ChangePriceType.GOODS.getVal().equals(param.getChangePriceType())) {
|
||||||
// 变更产品与单价,单价如果为空当0计算,依然不加入订单付费项
|
// 变更产品与单价,单价如果为空当0计算,依然不加入订单付费项
|
||||||
Assert.isFalse(null == param.getGoodsId(), () -> Exceptions.clierr("产品ID不可为空"));
|
Assert.isFalse(null == param.getGoodsId(), () -> Exceptions.clierr("产品ID不可为空"));
|
||||||
// 删除原来的订单产品数据
|
// 删除原来的订单产品数据
|
||||||
Assert.isFalse(null == order.getGoodsId(), () -> Exceptions.clierr("订单商品信息不存在"));
|
|
||||||
OrderGoodsEntity orderGoodsEntity = orderGoodsService.getById(order.getGoodsId());
|
|
||||||
String oldMoneyWay = orderGoodsEntity.getMoneyWay();
|
|
||||||
|
|
||||||
orderGoodsService.removeById(order.getGoodsId());
|
orderGoodsService.removeById(order.getGoodsId());
|
||||||
// 添加新的订单产品
|
// 添加新的订单产品
|
||||||
Long orderGoodsId = orderGoodsService.add(param.getGoodsId(), param.getUnitPrice());
|
Long orderGoodsId = orderGoodsService.add(param.getGoodsId(), param.getUnitPrice());
|
||||||
|
|
@ -1697,7 +1911,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
}
|
}
|
||||||
} else if (MoneyWay.IN.getVal().equals(oldMoneyWay) && MoneyWay.IN.getVal().equals(newMoneyWay)) {
|
} else if (MoneyWay.IN.getVal().equals(oldMoneyWay) && MoneyWay.IN.getVal().equals(newMoneyWay)) {
|
||||||
// 重新计算,多退少补
|
// 重新计算,多退少补
|
||||||
reSettlement(order);
|
reSettlement(order, oldMoneyWay);
|
||||||
}
|
}
|
||||||
// 更新产品不用考虑出厂问题,在称重时会重新计算费用并付费
|
// 更新产品不用考虑出厂问题,在称重时会重新计算费用并付费
|
||||||
} else if (ChangePriceType.SERVICE_FEE_PRICE.getVal().equals(param.getChangePriceType())) {
|
} else if (ChangePriceType.SERVICE_FEE_PRICE.getVal().equals(param.getChangePriceType())) {
|
||||||
|
|
@ -1705,13 +1919,20 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
if (null != param.getServiceFeeList() && param.getServiceFeeList().size() > 0) {
|
if (null != param.getServiceFeeList() && param.getServiceFeeList().size() > 0) {
|
||||||
List<OrderItemsParams> params = param.getServiceFeeList();
|
List<OrderItemsParams> params = param.getServiceFeeList();
|
||||||
for (OrderItemsParams itemsParam : params) {
|
for (OrderItemsParams itemsParam : params) {
|
||||||
|
OrderExpenseItemsEntity expenseItemsEntity = orderExpenseItemsService.getById(itemsParam.getId());
|
||||||
|
if (null == expenseItemsEntity) {
|
||||||
|
throw Exceptions.clierr("服务费不存在,请检查参数");
|
||||||
|
}
|
||||||
|
if (BillingType.ELASTICITY.getVal().equals(expenseItemsEntity.getBillingType())) {
|
||||||
|
throw Exceptions.clierr("弹性计费不可改价");
|
||||||
|
}
|
||||||
OrderExpenseItemsEntity itemsEntity = new OrderExpenseItemsEntity();
|
OrderExpenseItemsEntity itemsEntity = new OrderExpenseItemsEntity();
|
||||||
itemsEntity.setId(itemsParam.getId());
|
itemsEntity.setId(itemsParam.getId());
|
||||||
itemsEntity.setUnitPrice(itemsParam.getUnitPrice());
|
itemsEntity.setUnitPrice(itemsParam.getUnitPrice());
|
||||||
orderExpenseItemsService.updateById(itemsEntity);
|
orderExpenseItemsService.updateById(itemsEntity);
|
||||||
}
|
}
|
||||||
// 重新计算,多退少补
|
// 重新计算,多退少补
|
||||||
reSettlement(order);
|
reSettlement(order, oldMoneyWay);
|
||||||
} else {
|
} else {
|
||||||
throw Exceptions.clierr("清运服务费不可为空");
|
throw Exceptions.clierr("清运服务费不可为空");
|
||||||
}
|
}
|
||||||
|
|
@ -1729,26 +1950,30 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
/**
|
/**
|
||||||
* 重新计算,多退少补
|
* 重新计算,多退少补
|
||||||
*/
|
*/
|
||||||
public void reSettlement(OrderInfoEntity order) {
|
public void reSettlement(OrderInfoEntity order, String oldMoneyWay) {
|
||||||
|
// 旧的结算金额
|
||||||
|
BigDecimal oldSettleMoney = order.getSettleMoney();
|
||||||
// 计算费用
|
// 计算费用
|
||||||
updateOrderItems(order.getId(), 0, Boolean.TRUE);
|
updateOrderItems(order.getId(), order.getTransCompanyId(), 0, Boolean.TRUE);
|
||||||
|
|
||||||
// 多退少补 获取改价后的订单信息
|
// 多退少补 获取改价后的订单信息
|
||||||
OrderInfoEntity newOrder = this.getById(order.getId());
|
OrderInfoEntity newOrder = this.getById(order.getId());
|
||||||
BigDecimal changeMoney = newOrder.getChangeMoney() == null ? BigDecimal.ZERO : newOrder.getChangeMoney();
|
// 新的结算金额
|
||||||
BigDecimal settleMoney = newOrder.getSettleMoney() == null ? BigDecimal.ZERO : newOrder.getSettleMoney();
|
BigDecimal newMoney = newOrder.getSettleMoney() == null ? BigDecimal.ZERO : newOrder.getSettleMoney();
|
||||||
// 只有当订单已支付时,才需要多退少补
|
// 如果之前的计费方式就是入场付费,并且订单为已支付时,才需要多退少补;
|
||||||
if (PaymentStatus.YiZhiFu.getVal().equals(order.getPaymentStatus().getVal())) {
|
// 如果之前的计费方式就是出场付费,勘料时一定是未支付,所以不必走下面的多退少补流程
|
||||||
|
if (MoneyWay.IN.getVal().equals(oldMoneyWay) && PaymentStatus.YiZhiFu.getVal().equals(order.getPaymentStatus().getVal())) {
|
||||||
// 比较改价后金额和结算金额
|
// 比较改价后金额和结算金额
|
||||||
if (changeMoney.compareTo(settleMoney) > 0) {
|
if (newMoney.compareTo(oldSettleMoney) > 0) {
|
||||||
// 改价后金额大于结算金额,需要付款(多付)
|
// 改价后金额大于结算金额,需要付款(多付)
|
||||||
BigDecimal payAmount = changeMoney.subtract(settleMoney);
|
BigDecimal payAmount = newMoney.subtract(oldSettleMoney);
|
||||||
// 处理公司支付
|
// 处理公司支付
|
||||||
handleCompanyPay(newOrder, Boolean.TRUE, payAmount, Boolean.TRUE);
|
handleCompanyPay(newOrder, Boolean.TRUE, payAmount, Boolean.TRUE);
|
||||||
// TODO: 微信支付暂不处理
|
// TODO: 微信支付暂不处理
|
||||||
// paymentService.pay(order, payAmount);
|
// paymentService.pay(order, payAmount);
|
||||||
} else if (changeMoney.compareTo(settleMoney) < 0) {
|
} else if (newMoney.compareTo(oldSettleMoney) < 0) {
|
||||||
// 改价后金额小于结算金额,需要退款(少补)
|
// 改价后金额小于结算金额,需要退款(少补)
|
||||||
BigDecimal refundAmount = settleMoney.subtract(changeMoney);
|
BigDecimal refundAmount = oldSettleMoney.subtract(newMoney);
|
||||||
// 调用退款接口
|
// 调用退款接口
|
||||||
RefundRequestDto dto = new RefundRequestDto();
|
RefundRequestDto dto = new RefundRequestDto();
|
||||||
dto.setOrderId(order.getId());
|
dto.setOrderId(order.getId());
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.njzscloud.supervisory.route.controller;
|
||||||
|
|
||||||
|
import com.njzscloud.common.core.utils.R;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.OrderRouteEntity;
|
||||||
|
import com.njzscloud.supervisory.route.service.OrderRouteService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单路线管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/order_route")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class OrderRouteController {
|
||||||
|
|
||||||
|
private final OrderRouteService orderRouteService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public R<?> add(@RequestBody OrderRouteEntity routeEntity) {
|
||||||
|
orderRouteService.add(routeEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@PostMapping("/modify")
|
||||||
|
public R<?> modify(@RequestBody OrderRouteEntity routeEntity) {
|
||||||
|
orderRouteService.modify(routeEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@PostMapping("/del")
|
||||||
|
public R<?> del(@RequestBody List<Long> ids) {
|
||||||
|
orderRouteService.del(ids);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public R<OrderRouteEntity> detail(@RequestParam Long id) {
|
||||||
|
return R.success(orderRouteService.detail(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@GetMapping("/paging")
|
||||||
|
public R<PageResult<OrderRouteEntity>> paging(PageParam pageParam, OrderRouteEntity routeEntity) {
|
||||||
|
return R.success(orderRouteService.paging(pageParam, routeEntity));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据订单Id查看路线详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/getByOrderId")
|
||||||
|
public R<OrderRouteEntity> getByOrderId(@RequestParam Long orderId) {
|
||||||
|
return R.success(orderRouteService.getByOrderId(orderId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.njzscloud.supervisory.route.controller;
|
||||||
|
|
||||||
|
import com.njzscloud.common.core.utils.R;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.OrderRouteDetailEntity;
|
||||||
|
import com.njzscloud.supervisory.route.service.OrderRouteDetailService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线详情管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/order_route_detail")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class OrderRouteDetailController {
|
||||||
|
|
||||||
|
private final OrderRouteDetailService orderRouteDetailService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public R<?> add(@RequestBody OrderRouteDetailEntity detailEntity) {
|
||||||
|
orderRouteDetailService.add(detailEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@PostMapping("/modify")
|
||||||
|
public R<?> modify(@RequestBody OrderRouteDetailEntity detailEntity) {
|
||||||
|
orderRouteDetailService.modify(detailEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@PostMapping("/del")
|
||||||
|
public R<?> del(@RequestBody List<Long> ids) {
|
||||||
|
orderRouteDetailService.del(ids);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public R<OrderRouteDetailEntity> detail(@RequestParam Long id) {
|
||||||
|
return R.success(orderRouteDetailService.detail(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@GetMapping("/paging")
|
||||||
|
public R<PageResult<OrderRouteDetailEntity>> paging(PageParam pageParam, OrderRouteDetailEntity detailEntity) {
|
||||||
|
return R.success(orderRouteDetailService.paging(pageParam, detailEntity));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.njzscloud.supervisory.route.controller;
|
||||||
|
|
||||||
|
import com.njzscloud.common.core.utils.R;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.RouteEntity;
|
||||||
|
import com.njzscloud.supervisory.route.service.RouteService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/route")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RouteController {
|
||||||
|
|
||||||
|
private final RouteService routeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public R<?> add(@RequestBody RouteEntity routeEntity) {
|
||||||
|
routeService.add(routeEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@PostMapping("/modify")
|
||||||
|
public R<?> modify(@RequestBody RouteEntity routeEntity) {
|
||||||
|
routeService.modify(routeEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@PostMapping("/del")
|
||||||
|
public R<?> del(@RequestBody List<Long> ids) {
|
||||||
|
routeService.del(ids);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public R<RouteEntity> detail(@RequestParam Long id) {
|
||||||
|
return R.success(routeService.detail(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@GetMapping("/paging")
|
||||||
|
public R<PageResult<RouteEntity>> paging(PageParam pageParam, RouteEntity routeEntity) {
|
||||||
|
return R.success(routeService.paging(pageParam, routeEntity));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.njzscloud.supervisory.route.controller;
|
||||||
|
|
||||||
|
import com.njzscloud.common.core.utils.R;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.RouteDetailEntity;
|
||||||
|
import com.njzscloud.supervisory.route.service.RouteDetailService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线详情管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/route_detail")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RouteDetailController {
|
||||||
|
|
||||||
|
private final RouteDetailService routeDetailService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public R<?> add(@RequestBody RouteDetailEntity detailEntity) {
|
||||||
|
routeDetailService.add(detailEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@PostMapping("/modify")
|
||||||
|
public R<?> modify(@RequestBody RouteDetailEntity detailEntity) {
|
||||||
|
routeDetailService.modify(detailEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@PostMapping("/del")
|
||||||
|
public R<?> del(@RequestBody List<Long> ids) {
|
||||||
|
routeDetailService.del(ids);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public R<RouteDetailEntity> detail(@RequestParam Long id) {
|
||||||
|
return R.success(routeDetailService.detail(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@GetMapping("/paging")
|
||||||
|
public R<PageResult<RouteDetailEntity>> paging(PageParam pageParam, RouteDetailEntity detailEntity) {
|
||||||
|
return R.success(routeDetailService.paging(pageParam, detailEntity));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.njzscloud.supervisory.route.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.OrderRouteDetailEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单路线详情管理
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface OrderRouteDetailMapper extends BaseMapper<OrderRouteDetailEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.njzscloud.supervisory.route.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.OrderRouteEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线管理
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface OrderRouteMapper extends BaseMapper<OrderRouteEntity> {
|
||||||
|
|
||||||
|
IPage<OrderRouteEntity> paging(Page<Object> page, @Param("ew") QueryWrapper<OrderRouteEntity> ew);
|
||||||
|
|
||||||
|
OrderRouteEntity selectDetailById(@Param("id") Long id);
|
||||||
|
|
||||||
|
OrderRouteEntity getByOrderId(@Param("orderId") Long orderId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.njzscloud.supervisory.route.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.RouteDetailEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线详情管理
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RouteDetailMapper extends BaseMapper<RouteDetailEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.njzscloud.supervisory.route.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.RouteEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线管理
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RouteMapper extends BaseMapper<RouteEntity> {
|
||||||
|
|
||||||
|
IPage<RouteEntity> paging(Page<Object> page, @Param("ew") QueryWrapper<RouteEntity> ew);
|
||||||
|
|
||||||
|
RouteEntity selectDetailById(@Param("id") Long id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
package com.njzscloud.supervisory.route.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单路线详情
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName(value = "order_route_detail", autoResultMap = true)
|
||||||
|
public class OrderRouteDetailEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线id
|
||||||
|
*/
|
||||||
|
private Long orderRouteId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人 Id; sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人 Id; sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Long modifierId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime modifyTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除; 0-->未删除、1-->已删除
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private Boolean deleted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.njzscloud.supervisory.route.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单路线管理
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName(value = "order_route", autoResultMap = true)
|
||||||
|
public class OrderRouteEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单Id
|
||||||
|
*/
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清运公司id
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点id
|
||||||
|
*/
|
||||||
|
private Long stationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始地
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String startAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终点地
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String endAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线详情
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<OrderRouteDetailEntity> detailEntityList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人 Id; sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人 Id; sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Long modifierId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime modifyTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除; 0-->未删除、1-->已删除
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private Boolean deleted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
package com.njzscloud.supervisory.route.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠管理
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName(value = "biz_route_detail", autoResultMap = true)
|
||||||
|
public class RouteDetailEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线id
|
||||||
|
*/
|
||||||
|
private Long routeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人 Id; sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人 Id; sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Long modifierId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime modifyTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除; 0-->未删除、1-->已删除
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private Boolean deleted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
package com.njzscloud.supervisory.route.pojo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线管理
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName(value = "biz_route", autoResultMap = true)
|
||||||
|
public class RouteEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清运公司id
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点id
|
||||||
|
*/
|
||||||
|
private Long stationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始地
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String startAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终点地
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String endAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线详情
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<RouteDetailEntity> detailEntityList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人 Id; sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人 Id; sys_user.id
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Long modifierId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime modifyTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除; 0-->未删除、1-->已删除
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private Boolean deleted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.njzscloud.supervisory.route.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.OrderRouteDetailEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单路线详情管理
|
||||||
|
*/
|
||||||
|
public interface OrderRouteDetailService extends IService<OrderRouteDetailEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
void add(OrderRouteDetailEntity detailEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
void modify(OrderRouteDetailEntity detailEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
void del(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
OrderRouteDetailEntity detail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
PageResult<OrderRouteDetailEntity> paging(PageParam pageParam, OrderRouteDetailEntity detailEntity);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.njzscloud.supervisory.route.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.OrderRouteEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单路线管理
|
||||||
|
*/
|
||||||
|
public interface OrderRouteService extends IService<OrderRouteEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
void add(OrderRouteEntity orderRouteEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
void modify(OrderRouteEntity orderRouteEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
void del(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
OrderRouteEntity detail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
PageResult<OrderRouteEntity> paging(PageParam pageParam, OrderRouteEntity orderRouteEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据订单Id查看路线详情
|
||||||
|
*/
|
||||||
|
OrderRouteEntity getByOrderId(Long orderId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.njzscloud.supervisory.route.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.RouteDetailEntity;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.RouteEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线详情管理
|
||||||
|
*/
|
||||||
|
public interface RouteDetailService extends IService<RouteDetailEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
void add(RouteDetailEntity detailEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
void modify(RouteDetailEntity detailEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
void del(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
RouteDetailEntity detail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
PageResult<RouteDetailEntity> paging(PageParam pageParam, RouteDetailEntity detailEntity);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.njzscloud.supervisory.route.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.RouteEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线管理
|
||||||
|
*/
|
||||||
|
public interface RouteService extends IService<RouteEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
void add(RouteEntity routeEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
void modify(RouteEntity routeEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
void del(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
RouteEntity detail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
PageResult<RouteEntity> paging(PageParam pageParam, RouteEntity routeEntity);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
package com.njzscloud.supervisory.route.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.route.mapper.OrderRouteDetailMapper;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.OrderRouteDetailEntity;
|
||||||
|
import com.njzscloud.supervisory.route.service.OrderRouteDetailService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单路线详情管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class OrderRouteDetailServiceImpl extends ServiceImpl<OrderRouteDetailMapper, OrderRouteDetailEntity> implements OrderRouteDetailService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void add(OrderRouteDetailEntity detailEntity) {
|
||||||
|
this.save(detailEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void modify(OrderRouteDetailEntity detailEntity) {
|
||||||
|
this.updateById(detailEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void del(List<Long> ids) {
|
||||||
|
this.removeBatchByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OrderRouteDetailEntity detail(Long id) {
|
||||||
|
return this.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<OrderRouteDetailEntity> paging(PageParam pageParam, OrderRouteDetailEntity detailEntity) {
|
||||||
|
Page<OrderRouteDetailEntity> page = this.page(pageParam.toPage(), Wrappers.<OrderRouteDetailEntity>lambdaQuery()
|
||||||
|
.eq(StrUtil.isNotBlank(detailEntity.getName()), OrderRouteDetailEntity::getName, detailEntity.getName())
|
||||||
|
.eq(OrderRouteDetailEntity::getDeleted, Boolean.FALSE)
|
||||||
|
.orderByDesc(OrderRouteDetailEntity::getCreateTime));
|
||||||
|
return PageResult.of(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,142 @@
|
||||||
|
package com.njzscloud.supervisory.route.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njzscloud.common.core.ex.Exceptions;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.route.mapper.OrderRouteMapper;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.OrderRouteDetailEntity;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.OrderRouteEntity;
|
||||||
|
import com.njzscloud.supervisory.route.service.OrderRouteDetailService;
|
||||||
|
import com.njzscloud.supervisory.route.service.OrderRouteService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单路线管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class OrderRouteServiceImpl extends ServiceImpl<OrderRouteMapper, OrderRouteEntity> implements OrderRouteService {
|
||||||
|
|
||||||
|
private final OrderRouteDetailService orderRouteDetailService;
|
||||||
|
|
||||||
|
private final OrderRouteMapper orderRouteMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void add(OrderRouteEntity orderRouteEntity) {
|
||||||
|
this.save(orderRouteEntity);
|
||||||
|
// 保存详情
|
||||||
|
List<OrderRouteDetailEntity> detailEntityList = orderRouteEntity.getDetailEntityList();
|
||||||
|
if (null != detailEntityList && detailEntityList.size() > 0) {
|
||||||
|
for (OrderRouteDetailEntity detailEntity : detailEntityList) {
|
||||||
|
detailEntity.setOrderRouteId(orderRouteEntity.getId());
|
||||||
|
}
|
||||||
|
orderRouteDetailService.saveBatch(detailEntityList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void modify(OrderRouteEntity orderRouteEntity) {
|
||||||
|
this.updateById(orderRouteEntity);
|
||||||
|
// 删除原有数据,然后直接新增
|
||||||
|
orderRouteDetailService.remove(Wrappers.<OrderRouteDetailEntity>lambdaQuery()
|
||||||
|
.in(OrderRouteDetailEntity::getOrderRouteId, orderRouteEntity.getId()));
|
||||||
|
List<OrderRouteDetailEntity> detailEntityList = orderRouteEntity.getDetailEntityList();
|
||||||
|
if (null != detailEntityList && detailEntityList.size() > 0) {
|
||||||
|
for (OrderRouteDetailEntity detailEntity : detailEntityList) {
|
||||||
|
detailEntity.setOrderRouteId(orderRouteEntity.getId());
|
||||||
|
}
|
||||||
|
orderRouteDetailService.saveBatch(detailEntityList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void del(List<Long> ids) {
|
||||||
|
this.removeBatchByIds(ids);
|
||||||
|
for (Long id : ids) {
|
||||||
|
// 删除详细路线
|
||||||
|
orderRouteDetailService.remove(Wrappers.<OrderRouteDetailEntity>lambdaQuery()
|
||||||
|
.in(OrderRouteDetailEntity::getOrderRouteId, id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OrderRouteEntity detail(Long id) {
|
||||||
|
OrderRouteEntity entity = orderRouteMapper.selectDetailById(id);
|
||||||
|
List<OrderRouteDetailEntity> detailEntityList = orderRouteDetailService.list(Wrappers.lambdaQuery(OrderRouteDetailEntity.class)
|
||||||
|
.eq(OrderRouteDetailEntity::getOrderRouteId, entity.getId())
|
||||||
|
.orderByAsc(OrderRouteDetailEntity::getSort));
|
||||||
|
if (null != detailEntityList && detailEntityList.size() > 0) {
|
||||||
|
entity.setDetailEntityList(detailEntityList);
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<OrderRouteEntity> paging(PageParam pageParam, OrderRouteEntity routeEntity) {
|
||||||
|
QueryWrapper<OrderRouteEntity> ew = Wrappers.<OrderRouteEntity>query()
|
||||||
|
.eq("a.deleted", 0)
|
||||||
|
.like(StrUtil.isNotBlank(routeEntity.getName()), "a.name", routeEntity.getName())
|
||||||
|
.eq(null != routeEntity.getCompanyId(), "a.company_id", routeEntity.getCompanyId())
|
||||||
|
.eq(null != routeEntity.getStationId(), "a.station_id", routeEntity.getStationId())
|
||||||
|
.eq(null != routeEntity.getOrderId(), "a.order_id", routeEntity.getOrderId());
|
||||||
|
IPage<OrderRouteEntity> page = orderRouteMapper.paging(pageParam.toPage(), ew);
|
||||||
|
for (OrderRouteEntity entity : page.getRecords()) {
|
||||||
|
List<OrderRouteDetailEntity> detailEntityList = orderRouteDetailService.list(Wrappers.lambdaQuery(OrderRouteDetailEntity.class)
|
||||||
|
.eq(OrderRouteDetailEntity::getOrderRouteId, entity.getId()).orderByAsc(OrderRouteDetailEntity::getSort));
|
||||||
|
if (null != detailEntityList && detailEntityList.size() > 0) {
|
||||||
|
entity.setDetailEntityList(detailEntityList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PageResult.of(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据订单Id查看路线详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OrderRouteEntity getByOrderId(Long orderId) {
|
||||||
|
OrderRouteEntity entity = orderRouteMapper.getByOrderId(orderId);
|
||||||
|
if (null != entity) {
|
||||||
|
List<OrderRouteDetailEntity> detailEntityList = orderRouteDetailService.list(Wrappers.lambdaQuery(OrderRouteDetailEntity.class)
|
||||||
|
.eq(OrderRouteDetailEntity::getOrderRouteId, entity.getId())
|
||||||
|
.orderByAsc(OrderRouteDetailEntity::getSort));
|
||||||
|
if (null != detailEntityList && detailEntityList.size() > 0) {
|
||||||
|
entity.setDetailEntityList(detailEntityList);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw Exceptions.error("未查询到路线");
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
package com.njzscloud.supervisory.route.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.route.mapper.RouteDetailMapper;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.RouteDetailEntity;
|
||||||
|
import com.njzscloud.supervisory.route.service.RouteDetailService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线详情管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RouteDetailServiceImpl extends ServiceImpl<RouteDetailMapper, RouteDetailEntity> implements RouteDetailService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void add(RouteDetailEntity detailEntity) {
|
||||||
|
this.save(detailEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void modify(RouteDetailEntity detailEntity) {
|
||||||
|
this.updateById(detailEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void del(List<Long> ids) {
|
||||||
|
this.removeBatchByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public RouteDetailEntity detail(Long id) {
|
||||||
|
return this.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<RouteDetailEntity> paging(PageParam pageParam, RouteDetailEntity detailEntity) {
|
||||||
|
Page<RouteDetailEntity> page = this.page(pageParam.toPage(), Wrappers.<RouteDetailEntity>lambdaQuery()
|
||||||
|
.eq(StrUtil.isNotBlank(detailEntity.getName()), RouteDetailEntity::getName, detailEntity.getName())
|
||||||
|
.eq(RouteDetailEntity::getDeleted, Boolean.FALSE)
|
||||||
|
.orderByDesc(RouteDetailEntity::getCreateTime));
|
||||||
|
return PageResult.of(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
package com.njzscloud.supervisory.route.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.order.pojo.entity.OrderExpenseItemsEntity;
|
||||||
|
import com.njzscloud.supervisory.route.mapper.RouteMapper;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.RouteDetailEntity;
|
||||||
|
import com.njzscloud.supervisory.route.pojo.RouteEntity;
|
||||||
|
import com.njzscloud.supervisory.route.service.RouteDetailService;
|
||||||
|
import com.njzscloud.supervisory.route.service.RouteService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路线管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RouteServiceImpl extends ServiceImpl<RouteMapper, RouteEntity> implements RouteService {
|
||||||
|
|
||||||
|
private final RouteDetailService routeDetailService;
|
||||||
|
|
||||||
|
private final RouteMapper routeMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void add(RouteEntity routeEntity) {
|
||||||
|
this.save(routeEntity);
|
||||||
|
// 保存详情
|
||||||
|
List<RouteDetailEntity> detailEntityList = routeEntity.getDetailEntityList();
|
||||||
|
if (null != detailEntityList && detailEntityList.size() > 0) {
|
||||||
|
for (RouteDetailEntity detailEntity : detailEntityList) {
|
||||||
|
detailEntity.setRouteId(routeEntity.getId());
|
||||||
|
}
|
||||||
|
routeDetailService.saveBatch(detailEntityList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void modify(RouteEntity routeEntity) {
|
||||||
|
this.updateById(routeEntity);
|
||||||
|
// 删除原有数据,然后直接新增
|
||||||
|
routeDetailService.remove(Wrappers.<RouteDetailEntity>lambdaQuery()
|
||||||
|
.in(RouteDetailEntity::getRouteId, routeEntity.getId()));
|
||||||
|
List<RouteDetailEntity> detailEntityList = routeEntity.getDetailEntityList();
|
||||||
|
if (null != detailEntityList && detailEntityList.size() > 0) {
|
||||||
|
for (RouteDetailEntity detailEntity : detailEntityList) {
|
||||||
|
detailEntity.setRouteId(routeEntity.getId());
|
||||||
|
}
|
||||||
|
routeDetailService.saveBatch(detailEntityList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void del(List<Long> ids) {
|
||||||
|
this.removeBatchByIds(ids);
|
||||||
|
for (Long id : ids) {
|
||||||
|
// 删除详细路线
|
||||||
|
routeDetailService.remove(Wrappers.<RouteDetailEntity>lambdaQuery()
|
||||||
|
.in(RouteDetailEntity::getRouteId, id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public RouteEntity detail(Long id) {
|
||||||
|
RouteEntity entity = routeMapper.selectDetailById(id);
|
||||||
|
List<RouteDetailEntity> detailEntityList = routeDetailService.list(Wrappers.lambdaQuery(RouteDetailEntity.class)
|
||||||
|
.eq(RouteDetailEntity::getRouteId, entity.getId())
|
||||||
|
.orderByAsc(RouteDetailEntity::getSort));
|
||||||
|
if (null != detailEntityList && detailEntityList.size() > 0) {
|
||||||
|
entity.setDetailEntityList(detailEntityList);
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<RouteEntity> paging(PageParam pageParam, RouteEntity routeEntity) {
|
||||||
|
QueryWrapper<RouteEntity> ew = Wrappers.<RouteEntity>query()
|
||||||
|
.eq("a.deleted", 0)
|
||||||
|
.like(StrUtil.isNotBlank(routeEntity.getName()), "a.name", routeEntity.getName())
|
||||||
|
.eq(null != routeEntity.getCompanyId(), "a.company_id", routeEntity.getCompanyId())
|
||||||
|
.eq(null != routeEntity.getStationId(), "a.station_id", routeEntity.getStationId());
|
||||||
|
IPage<RouteEntity> page = routeMapper.paging(pageParam.toPage(), ew);
|
||||||
|
for (RouteEntity entity : page.getRecords()) {
|
||||||
|
List<RouteDetailEntity> detailEntityList = routeDetailService.list(Wrappers.lambdaQuery(RouteDetailEntity.class)
|
||||||
|
.eq(RouteDetailEntity::getRouteId, entity.getId()).orderByAsc(RouteDetailEntity::getSort));
|
||||||
|
if (null != detailEntityList && detailEntityList.size() > 0) {
|
||||||
|
entity.setDetailEntityList(detailEntityList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PageResult.of(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -46,4 +46,9 @@ public class MyResult extends UserDetail {
|
||||||
*/
|
*/
|
||||||
private String wechatOpenid;
|
private String wechatOpenid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信授权地址
|
||||||
|
*/
|
||||||
|
private String wxAuthUrl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,14 @@ import com.njzscloud.supervisory.sys.auth.pojo.result.MyResult;
|
||||||
import com.njzscloud.supervisory.sys.user.pojo.entity.UserEntity;
|
import com.njzscloud.supervisory.sys.user.pojo.entity.UserEntity;
|
||||||
import com.njzscloud.supervisory.sys.user.pojo.param.UserRegisterParam;
|
import com.njzscloud.supervisory.sys.user.pojo.param.UserRegisterParam;
|
||||||
import com.njzscloud.supervisory.sys.user.service.UserService;
|
import com.njzscloud.supervisory.sys.user.service.UserService;
|
||||||
|
import com.njzscloud.supervisory.wxPay.contant.WxApiConfig;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
@ -92,7 +95,27 @@ public class AuthService implements IUserService, IRoleService {
|
||||||
.setEndpoints(endpointResources)
|
.setEndpoints(endpointResources)
|
||||||
.setCompany(company)
|
.setCompany(company)
|
||||||
.setDriver(driver)
|
.setDriver(driver)
|
||||||
.setWechatOpenid(wechatOpenid != null ? wechatOpenid : "");
|
.setWechatOpenid(wechatOpenid != null ? wechatOpenid : "")
|
||||||
|
.setWxAuthUrl(wxAuthUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String wxAuthUrl() {
|
||||||
|
// 参数说明
|
||||||
|
// 对回调地址进行URL编码至关重要[citation:1]
|
||||||
|
String redirectUri = null;
|
||||||
|
try {
|
||||||
|
redirectUri = URLEncoder.encode(WxApiConfig.REDIRECT_URI, WxApiConfig.ENC);
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将authUrl返回给前端,引导用户跳转
|
||||||
|
return "https://open.weixin.qq.com/connect/oauth2/authorize?" +
|
||||||
|
"appid=" + WxApiConfig.APP_ID +
|
||||||
|
"&redirect_uri=" + redirectUri +
|
||||||
|
"&response_type=code" +
|
||||||
|
"&scope=" + WxApiConfig.SCOPE +
|
||||||
|
"&state=STATE#wechat_redirect";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,4 +86,9 @@ public class UserEntity {
|
||||||
@TableLogic
|
@TableLogic
|
||||||
private Boolean deleted;
|
private Boolean deleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信 公众号openid
|
||||||
|
*/
|
||||||
|
private String openid;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.njzscloud.supervisory.wxPay.contant;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送类型
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public enum TempType {
|
||||||
|
TRANS_COMPANY("transCompany", "清运公司"),// 清运公司
|
||||||
|
DRIVER("driver", "司机"), // 司机
|
||||||
|
AUDIT_PENDING("auditPending", "待审核"),
|
||||||
|
AUDIT_OK("auditOk", "审核通过"),
|
||||||
|
AUDIT_REJECT("auditReject", "审核驳回"),
|
||||||
|
;
|
||||||
|
private final String val;
|
||||||
|
private final String txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.njzscloud.supervisory.wxPay.contant;
|
||||||
|
|
||||||
|
public class TemplateID {
|
||||||
|
|
||||||
|
public static final String TRANS_COMPANY_TEMP_ID = "PAqlS9-hKgKB_Li8Nx4hgMXBp9kOTFrCD_scJtBC1fM";
|
||||||
|
|
||||||
|
public static final String DRIVER_TEMP_ID = "IwHV1nWwu8pO8Ppntyd7KzzV5S00dOEjbsgAFhz9tJM";
|
||||||
|
|
||||||
|
public static final String AUDIT_PENDING = "0SzJv9l51KTvgXvKhQOwifR5pegR3gC1o3IAY8NpEcE";
|
||||||
|
|
||||||
|
public static final String AUDIT_OK = "3peGD6joWVyZ7B29lfJH_gK0oRqharynt0sXlIHE4cg";
|
||||||
|
|
||||||
|
public static final String AUDIT_REJECT = "vDFOJjrB3VNKGIRe5I_LOrfIPDTTdlZoL537CYqjW64";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.njzscloud.supervisory.wxPay.contant;
|
||||||
|
|
||||||
|
public class WxApiConfig {
|
||||||
|
|
||||||
|
public static final String APP_ID = "wxcf5b818c19c51c07";
|
||||||
|
|
||||||
|
public static final String APP_SECRET = "35f72f3d49a9e24c618b82eb624538c8";
|
||||||
|
|
||||||
|
public static final String REDIRECT_URI = "https://supervisory.njzscloud.com/test/bind/index.html";
|
||||||
|
|
||||||
|
public static final String SCOPE = "snsapi_base"; // 静默授权,仅获取OpenID
|
||||||
|
// String scope = "snsapi_userinfo"; // 非静默授权,可获取用户昵称、头像等更多信息[citation:1]
|
||||||
|
|
||||||
|
public static final String ENC = "UTF-8";
|
||||||
|
|
||||||
|
public static final String OAUTH_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?";
|
||||||
|
|
||||||
|
public static final String GET_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=";
|
||||||
|
|
||||||
|
public static final String SEND_TEMPLATE_MSG_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=";
|
||||||
|
|
||||||
|
public static final String TICKET_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.njzscloud.supervisory.wxPay.controller;
|
||||||
|
|
||||||
|
import com.njzscloud.common.core.utils.R;
|
||||||
|
import com.njzscloud.supervisory.wxPay.param.TemplateMessageParam;
|
||||||
|
import com.njzscloud.supervisory.wxPay.service.WechatTemplateMessageService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付相关接口
|
||||||
|
* 使用微信支付官方SDK的生产级实现
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/wechatTemplateMessage")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class WechatTemplateMessageController {
|
||||||
|
|
||||||
|
private final WechatTemplateMessageService wechatTemplateMessageService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定微信openid
|
||||||
|
*/
|
||||||
|
@GetMapping("/bind")
|
||||||
|
public R<?> bind(@RequestParam String code) {
|
||||||
|
wechatTemplateMessageService.bind(code);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* key
|
||||||
|
*/
|
||||||
|
@GetMapping("/key")
|
||||||
|
public R<?> key(@RequestParam String code) {
|
||||||
|
return R.success(wechatTemplateMessageService.key(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/send-order-notice")
|
||||||
|
public String sendOrderNotice(@RequestBody TemplateMessageParam param) {
|
||||||
|
try {
|
||||||
|
// 发送模板消息
|
||||||
|
wechatTemplateMessageService.sendTemplateMessage(param);
|
||||||
|
return "发送成功";
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "发送失败: " + e.getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.njzscloud.supervisory.wxPay.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板数据封装类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TemplateData {
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
public TemplateData(String value) {
|
||||||
|
this.value = value;
|
||||||
|
this.color = "#173177";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.njzscloud.supervisory.wxPay.param;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class TemplateMessageParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送类型
|
||||||
|
*/
|
||||||
|
private String tempType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
private String sn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货物名称
|
||||||
|
*/
|
||||||
|
private String goodsName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装货地点
|
||||||
|
*/
|
||||||
|
private String startAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卸货地点
|
||||||
|
*/
|
||||||
|
private String endAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 司机名称
|
||||||
|
*/
|
||||||
|
private String driverName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产废单位
|
||||||
|
*/
|
||||||
|
private String cfCompanyName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车牌号
|
||||||
|
*/
|
||||||
|
private String licensePlate;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.njzscloud.supervisory.wxPay.service;
|
||||||
|
|
||||||
|
import com.njzscloud.supervisory.wxPay.dto.TemplateData;
|
||||||
|
import com.njzscloud.supervisory.wxPay.param.TemplateMessageParam;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信消息推送服务接口
|
||||||
|
*/
|
||||||
|
public interface WechatTemplateMessageService {
|
||||||
|
|
||||||
|
void bind(String code);
|
||||||
|
|
||||||
|
Map<String, Object> key(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送消息
|
||||||
|
*/
|
||||||
|
@Async
|
||||||
|
void sendTemplateMessage(TemplateMessageParam param);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,295 @@
|
||||||
|
package com.njzscloud.supervisory.wxPay.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import com.njzscloud.common.core.ex.Exceptions;
|
||||||
|
import com.njzscloud.common.security.util.SecurityUtil;
|
||||||
|
import com.njzscloud.supervisory.sys.user.pojo.entity.UserEntity;
|
||||||
|
import com.njzscloud.supervisory.sys.user.service.UserService;
|
||||||
|
import com.njzscloud.supervisory.wxPay.contant.TempType;
|
||||||
|
import com.njzscloud.supervisory.wxPay.contant.TemplateID;
|
||||||
|
import com.njzscloud.supervisory.wxPay.contant.WxApiConfig;
|
||||||
|
import com.njzscloud.supervisory.wxPay.dto.TemplateData;
|
||||||
|
import com.njzscloud.supervisory.wxPay.param.TemplateMessageParam;
|
||||||
|
import com.njzscloud.supervisory.wxPay.service.WechatTemplateMessageService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信消息推送服务实现类
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class WechatTemplateMessageServiceImpl implements WechatTemplateMessageService {
|
||||||
|
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bind(String code) {
|
||||||
|
// 使用Code换取Access Token和OpenID
|
||||||
|
String tokenUrl = WxApiConfig.OAUTH_URL + "appid=" + WxApiConfig.APP_ID + "&secret=" + WxApiConfig.APP_SECRET +
|
||||||
|
"&code=" + code + "&grant_type=authorization_code";
|
||||||
|
|
||||||
|
// 使用HTTP客户端发起请求
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
String response = restTemplate.getForObject(tokenUrl, String.class);
|
||||||
|
|
||||||
|
// 解析微信返回的JSON数据
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||||
|
if (null == jsonObject) {
|
||||||
|
throw Exceptions.clierr("获取openid失败");
|
||||||
|
}
|
||||||
|
String openId = jsonObject.getString("openid");
|
||||||
|
// String accessToken = jsonObject.getString("access_token");
|
||||||
|
// 返回中通常还包含 expires_in, refresh_token等字段[citation:1]
|
||||||
|
|
||||||
|
if (openId == null || openId.isEmpty()) {
|
||||||
|
// 错误处理
|
||||||
|
String errCode = (String) jsonObject.get("errcode");
|
||||||
|
String errMsg = (String) jsonObject.get("errmsg");
|
||||||
|
log.info("获取OpenID失败: " + errCode + " - " + errMsg);
|
||||||
|
throw Exceptions.clierr("获取openid失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("用户的OpenID是: " + openId);
|
||||||
|
|
||||||
|
// 将openId与你的系统用户关联
|
||||||
|
UserEntity userEntity = new UserEntity();
|
||||||
|
userEntity.setId(SecurityUtil.currentUserId());
|
||||||
|
userEntity.setOpenid(openId);
|
||||||
|
userService.updateById(userEntity);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> key(String code) {
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
// 1. 获取Access Token
|
||||||
|
String accessToken = getAccessToken();
|
||||||
|
String response = restTemplate.postForObject(WxApiConfig.TICKET_URL + accessToken + "&type=jsapi", "", String.class);
|
||||||
|
// 5. 处理响应
|
||||||
|
JSONObject jsonResponse = JSONObject.parseObject(response);
|
||||||
|
if (null == jsonResponse) {
|
||||||
|
throw Exceptions.clierr("获取ticket失败,jsonResponse为null");
|
||||||
|
}
|
||||||
|
if (jsonResponse.getIntValue("errcode") != 0) {
|
||||||
|
log.error("发送模板消息失败: " + jsonResponse.getString("errmsg"));
|
||||||
|
}
|
||||||
|
String jsapi_ticket = jsonResponse.getString("ticket");
|
||||||
|
String timestamp = Long.toString(System.currentTimeMillis() / 1000); // 必填,生成签名的时间戳
|
||||||
|
String nonceStr = UUID.randomUUID().toString().replaceAll("-", ""); // 必填,生成签名的随机串
|
||||||
|
// 注意这里参数名必须全部小写,且必须有序
|
||||||
|
String url = WxApiConfig.REDIRECT_URI + "?code=" + code + "&state=STATE";
|
||||||
|
log.info("url: " + url);
|
||||||
|
String signature = getSignature(jsapi_ticket, timestamp, nonceStr, url);
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("appId", WxApiConfig.APP_ID);
|
||||||
|
map.put("timestamp", timestamp);
|
||||||
|
map.put("nonceStr", nonceStr);
|
||||||
|
map.put("signature", signature);
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendTemplateMessage(TemplateMessageParam param) {
|
||||||
|
UserEntity userEntity = userService.getById(param.getUserId());
|
||||||
|
// UserEntity userEntity = new UserEntity();
|
||||||
|
// userEntity.setOpenid("owC-r2Bf1axK1C2MQ6nOaCDbKuHw");
|
||||||
|
if (!Strings.isNullOrEmpty(userEntity.getOpenid())) {
|
||||||
|
Map<String, TemplateData> data;
|
||||||
|
if (TempType.TRANS_COMPANY.getVal().equals(param.getTempType())) {
|
||||||
|
// 通知清运公司指派司机
|
||||||
|
// 构建模板数据
|
||||||
|
data = new HashMap<>();
|
||||||
|
data.put("character_string2", new TemplateData(param.getSn()));
|
||||||
|
data.put("thing19", new TemplateData(param.getGoodsName()));
|
||||||
|
data.put("thing4", new TemplateData(param.getStartAddress()));
|
||||||
|
sendMessage(userEntity.getOpenid(), TemplateID.TRANS_COMPANY_TEMP_ID, data, null, null);
|
||||||
|
} else if (TempType.DRIVER.getVal().equals(param.getTempType())) {
|
||||||
|
// 通知司机
|
||||||
|
// 构建模板数据
|
||||||
|
data = new HashMap<>();
|
||||||
|
data.put("character_string5", new TemplateData(param.getSn()));
|
||||||
|
data.put("thing7", new TemplateData(param.getDriverName()));
|
||||||
|
data.put("thing2", new TemplateData(param.getStartAddress()));
|
||||||
|
data.put("thing3", new TemplateData(param.getEndAddress()));
|
||||||
|
sendMessage(userEntity.getOpenid(), TemplateID.DRIVER_TEMP_ID, data, null, null);
|
||||||
|
} else if (TempType.AUDIT_PENDING.getVal().equals(param.getTempType())) {
|
||||||
|
// 待审核
|
||||||
|
// 构建模板数据
|
||||||
|
data = new HashMap<>();
|
||||||
|
data.put("character_string5", new TemplateData(param.getSn()));
|
||||||
|
data.put("thing11", new TemplateData(param.getGoodsName()));
|
||||||
|
data.put("thing9", new TemplateData(param.getCfCompanyName()));
|
||||||
|
data.put("car_number13", new TemplateData(param.getLicensePlate()));
|
||||||
|
sendMessage(userEntity.getOpenid(), TemplateID.AUDIT_PENDING, data, null, null);
|
||||||
|
} else if (TempType.AUDIT_OK.getVal().equals(param.getTempType())) {
|
||||||
|
// 审核通过
|
||||||
|
// 构建模板数据
|
||||||
|
data = new HashMap<>();
|
||||||
|
data.put("character_string1", new TemplateData(param.getSn()));
|
||||||
|
data.put("thing4", new TemplateData(param.getGoodsName()));
|
||||||
|
data.put("thing8", new TemplateData(param.getDriverName()));
|
||||||
|
data.put("car_number7", new TemplateData(param.getLicensePlate()));
|
||||||
|
data.put("thing3", new TemplateData(param.getEndAddress()));
|
||||||
|
sendMessage(userEntity.getOpenid(), TemplateID.AUDIT_OK, data, null, null);
|
||||||
|
} else if (TempType.AUDIT_REJECT.getVal().equals(param.getTempType())) {
|
||||||
|
// 审核驳回
|
||||||
|
// 构建模板数据
|
||||||
|
data = new HashMap<>();
|
||||||
|
data.put("character_string8", new TemplateData(param.getSn()));
|
||||||
|
data.put("thing4", new TemplateData(param.getGoodsName()));
|
||||||
|
data.put("thing2", new TemplateData(param.getStartAddress()));
|
||||||
|
sendMessage(userEntity.getOpenid(), TemplateID.AUDIT_REJECT, data, null, null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.info("未查询到用户信息或不存在openid,无法通知");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送模板消息
|
||||||
|
*/
|
||||||
|
public void sendMessage(String openId, String templateId,
|
||||||
|
Map<String, TemplateData> data,
|
||||||
|
String url, String miniProgram) {
|
||||||
|
// 1. 获取Access Token
|
||||||
|
String accessToken = getAccessToken();
|
||||||
|
if (Strings.isNullOrEmpty(accessToken)) {
|
||||||
|
log.error("获取Access Token失败");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 构建请求数据
|
||||||
|
JSONObject requestData = new JSONObject();
|
||||||
|
requestData.put("touser", openId);
|
||||||
|
requestData.put("template_id", templateId);
|
||||||
|
|
||||||
|
if (url != null) {
|
||||||
|
requestData.put("url", url); // 点击消息跳转的URL
|
||||||
|
}
|
||||||
|
|
||||||
|
if (miniProgram != null) {
|
||||||
|
JSONObject miniProgramObj = new JSONObject();
|
||||||
|
miniProgramObj.put("appid", miniProgram);
|
||||||
|
miniProgramObj.put("pagepath", "pages/index/index");
|
||||||
|
requestData.put("miniprogram", miniProgramObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 构建模板数据
|
||||||
|
JSONObject dataObj = new JSONObject();
|
||||||
|
for (Map.Entry<String, TemplateData> entry : data.entrySet()) {
|
||||||
|
JSONObject item = new JSONObject();
|
||||||
|
item.put("value", entry.getValue().getValue());
|
||||||
|
if (entry.getValue().getColor() != null) {
|
||||||
|
item.put("color", entry.getValue().getColor());
|
||||||
|
}
|
||||||
|
dataObj.put(entry.getKey(), item);
|
||||||
|
}
|
||||||
|
requestData.put("data", dataObj);
|
||||||
|
log.info(JSONObject.toJSONString(requestData));
|
||||||
|
|
||||||
|
// 4. 发送请求
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
|
||||||
|
String response = restTemplate.postForObject(WxApiConfig.SEND_TEMPLATE_MSG_URL + accessToken, JSONObject.toJSONString(requestData), String.class);
|
||||||
|
|
||||||
|
// 5. 处理响应
|
||||||
|
JSONObject jsonResponse = JSONObject.parseObject(response);
|
||||||
|
if (null == jsonResponse) {
|
||||||
|
log.error("发送模板消息失败,jsonResponse为null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (jsonResponse.getIntValue("errcode") != 0) {
|
||||||
|
log.error("发送模板消息失败: " + jsonResponse.getString("errmsg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取Access Token
|
||||||
|
*/
|
||||||
|
private String getAccessToken() {
|
||||||
|
String tokenUrl = WxApiConfig.GET_TOKEN_URL + WxApiConfig.APP_ID + "&secret=" + WxApiConfig.APP_SECRET;
|
||||||
|
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
String response = restTemplate.getForObject(tokenUrl, String.class);
|
||||||
|
JSONObject jsonResponse = JSONObject.parseObject(response);
|
||||||
|
if (null == jsonResponse) {
|
||||||
|
log.error("获取Access Token失败");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (jsonResponse.getIntValue("errcode") != 0) {
|
||||||
|
log.error("发送模板消息失败: " + jsonResponse.getString("errmsg"));
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return jsonResponse.getString("access_token");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSignature(String jsapi_ticket, String timestamp,
|
||||||
|
String nonce, String js_url) {
|
||||||
|
// 对 jsapi_ticket、 timestamp 和 nonce 按字典排序 对所有待签名参数按照字段名的 ASCII
|
||||||
|
// 码从小到大排序(字典序)后,使用 URL 键值对的格式(即key1=value1&key2=value2…)拼接成字符串
|
||||||
|
// string1。这里需要注意的是所有参数名均为小写字符。 接下来对 string1 作 sha1 加密,字段名和字段值都采用原始值,不进行
|
||||||
|
// URL 转义。即 signature=sha1(string1)。
|
||||||
|
// 如果没有按照生成的key1=value&key2=value拼接的话会报错
|
||||||
|
String[] paramArr = new String[]{"jsapi_ticket=" + jsapi_ticket, "timestamp=" + timestamp, "noncestr=" + nonce,
|
||||||
|
"url=" + js_url};
|
||||||
|
Arrays.sort(paramArr);
|
||||||
|
// 将排序后的结果拼接成一个字符串
|
||||||
|
String content = paramArr[0].concat("&" + paramArr[1]).concat("&" + paramArr[2]).concat("&" + paramArr[3]);
|
||||||
|
log.info("拼接之后的content为:" + content);
|
||||||
|
String genSignature = null;
|
||||||
|
try {
|
||||||
|
MessageDigest md = MessageDigest.getInstance("SHA-1");
|
||||||
|
// 对拼接后的字符串进行 sha1 加密
|
||||||
|
byte[] digest = md.digest(content.getBytes());
|
||||||
|
genSignature = byteToStr(digest);
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
// 将 sha1 加密后的字符串与 signature 进行对比
|
||||||
|
if (genSignature != null) {
|
||||||
|
return genSignature;// 返回signature
|
||||||
|
} else {
|
||||||
|
return "false";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将字节数组转换为十六进制字符串
|
||||||
|
*/
|
||||||
|
private static String byteToStr(byte[] byteArray) {
|
||||||
|
StringBuilder strDigest = new StringBuilder();
|
||||||
|
for (byte b : byteArray) {
|
||||||
|
strDigest.append(byteToHexStr(b));
|
||||||
|
}
|
||||||
|
return strDigest.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将字节转换为十六进制字符串
|
||||||
|
*/
|
||||||
|
private static String byteToHexStr(byte mByte) {
|
||||||
|
char[] Digit = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A',
|
||||||
|
'B', 'C', 'D', 'E', 'F'};
|
||||||
|
char[] tempArr = new char[2];
|
||||||
|
tempArr[0] = Digit[(mByte >>> 4) & 0X0F];
|
||||||
|
tempArr[1] = Digit[mByte & 0X0F];
|
||||||
|
return new String(tempArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -28,6 +28,8 @@ spring:
|
||||||
- /district/areaList
|
- /district/areaList
|
||||||
- /biz_audit_config/copy
|
- /biz_audit_config/copy
|
||||||
- /order_info/gps_test
|
- /order_info/gps_test
|
||||||
|
- /wechatTemplateMessage/key
|
||||||
|
- /hsoa/push_order
|
||||||
app:
|
app:
|
||||||
default-place:
|
default-place:
|
||||||
province: 320000
|
province: 320000
|
||||||
|
|
@ -55,7 +57,8 @@ ssh-tunnel:
|
||||||
host: 139.224.54.144
|
host: 139.224.54.144
|
||||||
port: 22
|
port: 22
|
||||||
user: root
|
user: root
|
||||||
credentials: D:/我的/再昇云/服务器秘钥/139.224.54.144_YZS_S1.pem
|
# 添加虚拟机参数:-DTUNNEL1_CREDENTIAL=证书文件地址
|
||||||
|
credentials: ${TUNNEL1_CREDENTIAL:}
|
||||||
proxy:
|
proxy:
|
||||||
- localPort: 33061
|
- localPort: 33061
|
||||||
targetHost: localhost
|
targetHost: localhost
|
||||||
|
|
@ -87,3 +90,8 @@ mqtt:
|
||||||
client-id: njzscloud-svr1
|
client-id: njzscloud-svr1
|
||||||
username: gps
|
username: gps
|
||||||
password: TKG4TV3dF7CeazDnUdCF
|
password: TKG4TV3dF7CeazDnUdCF
|
||||||
|
|
||||||
|
hsoa:
|
||||||
|
base-url: http://60.173.195.121:9908
|
||||||
|
username: chuz_trajectory
|
||||||
|
password: e9t2YsgM5ug%2FkpIZpMdY9e9uXq60jyEQ30zQX%2BBzphI%3D
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ spring:
|
||||||
- /payment/wechat/refundNotify
|
- /payment/wechat/refundNotify
|
||||||
- /district/areaList
|
- /district/areaList
|
||||||
- /biz_audit_config/copy
|
- /biz_audit_config/copy
|
||||||
|
- /wechatTemplateMessage/key
|
||||||
|
- /hsoa/push_order
|
||||||
|
|
||||||
app:
|
app:
|
||||||
in-out-gap: 180
|
in-out-gap: 180
|
||||||
|
|
@ -79,10 +81,7 @@ mqtt:
|
||||||
localizer:
|
localizer:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
# INSERT INTO greenfrog.sys_district (id, pid, province, city, area, town, district_name, tier, sort) VALUES ('341101', '341100', '340000', '341100', '341101', '', '市辖区', 3, 0);
|
hsoa:
|
||||||
# INSERT INTO greenfrog.sys_district (id, pid, province, city, area, town, district_name, tier, sort) VALUES ('341122', '341100', '340000', '341100', '341122', '', '来安县', 3, 0);
|
base-url: http://117.68.7.91:8088
|
||||||
# INSERT INTO greenfrog.sys_district (id, pid, province, city, area, town, district_name, tier, sort) VALUES ('341124', '341100', '340000', '341100', '341124', '', '全椒县', 3, 0);
|
username: chuz_trajectory
|
||||||
# INSERT INTO greenfrog.sys_district (id, pid, province, city, area, town, district_name, tier, sort) VALUES ('341125', '341100', '340000', '341100', '341125', '', '定远县', 3, 0);
|
password: e9t2YsgM5ug%2FkpIZpMdY9e9uXq60jyEQ30zQX%2BBzphI%3D
|
||||||
# INSERT INTO greenfrog.sys_district (id, pid, province, city, area, town, district_name, tier, sort) VALUES ('341126', '341100', '340000', '341100', '341126', '', '凤阳县', 3, 0);
|
|
||||||
# INSERT INTO greenfrog.sys_district (id, pid, province, city, area, town, district_name, tier, sort) VALUES ('341181', '341100', '340000', '341100', '341181', '', '天长市', 3, 0);
|
|
||||||
# INSERT INTO greenfrog.sys_district (id, pid, province, city, area, town, district_name, tier, sort) VALUES ('341182', '341100', '340000', '341100', '341182', '', '明光市', 3, 0);
|
|
||||||
|
|
|
||||||
|
|
@ -30,5 +30,13 @@
|
||||||
</if>
|
</if>
|
||||||
ORDER BY d.modify_time DESC
|
ORDER BY d.modify_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
<resultMap id="driverCantDelMap" type="com.njzscloud.supervisory.biz.pojo.result.DriverCantDelResult">
|
||||||
|
<result column="order_status" property="orderStatus" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
|
||||||
|
</resultMap>
|
||||||
|
<select id="driverCantDel" resultMap="driverCantDelMap">
|
||||||
|
SELECT b.driver_name, a.sn, a.order_status
|
||||||
|
FROM order_info a
|
||||||
|
INNER JOIN biz_driver b ON b.id = a.driver_id AND b.deleted = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -74,4 +74,15 @@
|
||||||
LEFT JOIN device_localizer c ON c.terminal_id = a.gps
|
LEFT JOIN device_localizer c ON c.terminal_id = a.gps
|
||||||
WHERE a.id = #{id} AND a.deleted = 0
|
WHERE a.id = #{id} AND a.deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
<resultMap id="truckCantDelMap" type="com.njzscloud.supervisory.biz.pojo.result.TruckCantDelResult">
|
||||||
|
<result column="order_status" property="orderStatus" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
|
||||||
|
</resultMap>
|
||||||
|
<select id="truckCantDel" resultMap="truckCantDelMap">
|
||||||
|
SELECT b.license_plate, a.sn, a.order_status
|
||||||
|
FROM order_info a
|
||||||
|
INNER JOIN biz_truck b ON b.id = a.truck_id AND b.deleted = 0
|
||||||
|
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
og.goods_name,
|
og.goods_name,
|
||||||
bp.project_name,
|
bp.project_name,
|
||||||
bc1.company_name AS trans_company_name,
|
bc1.company_name AS trans_company_name,
|
||||||
bc2.company_name AS cf_company_name,
|
bc2.nickname AS cf_company_name,
|
||||||
bt.license_plate,
|
bt.license_plate,
|
||||||
bt.picture truck_picture,
|
bt.picture truck_picture,
|
||||||
bt.carrying_capacity,
|
bt.carrying_capacity,
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
LEFT JOIN order_goods og ON oi.goods_id = og.id
|
LEFT JOIN order_goods og ON oi.goods_id = og.id
|
||||||
LEFT JOIN biz_project bp ON oi.project_id = bp.id AND bp.deleted = 0
|
LEFT JOIN biz_project bp ON oi.project_id = bp.id AND bp.deleted = 0
|
||||||
LEFT JOIN biz_company bc1 ON oi.trans_company_id = bc1.id AND bc1.deleted = 0
|
LEFT JOIN biz_company bc1 ON oi.trans_company_id = bc1.id AND bc1.deleted = 0
|
||||||
LEFT JOIN biz_company bc2 ON oi.user_id = bc2.user_id AND bc2.deleted = 0
|
LEFT JOIN sys_user bc2 ON oi.user_id = bc2.id AND bc2.deleted = 0
|
||||||
LEFT JOIN biz_truck bt ON oi.truck_id = bt.id AND bt.deleted = 0
|
LEFT JOIN biz_truck bt ON oi.truck_id = bt.id AND bt.deleted = 0
|
||||||
LEFT JOIN biz_driver bd ON oi.driver_id = bd.id AND bd.deleted = 0
|
LEFT JOIN biz_driver bd ON oi.driver_id = bd.id AND bd.deleted = 0
|
||||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
og.goods_name,
|
og.goods_name,
|
||||||
bp.project_name,
|
bp.project_name,
|
||||||
bc1.company_name AS trans_company_name,
|
bc1.company_name AS trans_company_name,
|
||||||
bc2.company_name AS cf_company_name,
|
bc2.nickname AS cf_company_name,
|
||||||
bt.license_plate,
|
bt.license_plate,
|
||||||
bt.picture,
|
bt.picture,
|
||||||
bt.carrying_capacity,
|
bt.carrying_capacity,
|
||||||
|
|
@ -109,7 +109,7 @@
|
||||||
LEFT JOIN order_goods og ON oi.goods_id = og.id
|
LEFT JOIN order_goods og ON oi.goods_id = og.id
|
||||||
LEFT JOIN biz_project bp ON oi.project_id = bp.id AND bp.deleted = 0
|
LEFT JOIN biz_project bp ON oi.project_id = bp.id AND bp.deleted = 0
|
||||||
LEFT JOIN biz_company bc1 ON oi.trans_company_id = bc1.id AND bc1.deleted = 0
|
LEFT JOIN biz_company bc1 ON oi.trans_company_id = bc1.id AND bc1.deleted = 0
|
||||||
LEFT JOIN biz_company bc2 ON oi.user_id = bc2.user_id AND bc2.deleted = 0
|
LEFT JOIN sys_user bc2 ON oi.user_id = bc2.id AND bc2.deleted = 0
|
||||||
LEFT JOIN biz_truck bt ON oi.truck_id = bt.id AND bt.deleted = 0
|
LEFT JOIN biz_truck bt ON oi.truck_id = bt.id AND bt.deleted = 0
|
||||||
LEFT JOIN biz_driver bd ON oi.driver_id = bd.id AND bd.deleted = 0
|
LEFT JOIN biz_driver bd ON oi.driver_id = bd.id AND bd.deleted = 0
|
||||||
WHERE bw.id = #{id} AND bw.deleted = 0
|
WHERE bw.id = #{id} AND bw.deleted = 0
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,18 @@
|
||||||
<select id="getTodayCarCount" resultType="java.lang.Integer">
|
<select id="getTodayCarCount" resultType="java.lang.Integer">
|
||||||
SELECT COUNT(*) car_count
|
SELECT COUNT(*) car_count
|
||||||
FROM order_info a
|
FROM order_info a
|
||||||
WHERE a.create_time >= UNIX_TIMESTAMP(CURDATE())
|
WHERE UNIX_TIMESTAMP(a.create_time) >= UNIX_TIMESTAMP(CURDATE())
|
||||||
AND a.create_time <![CDATA[ < ]]> UNIX_TIMESTAMP(DATE_ADD(CURDATE(), INTERVAL 24 HOUR))
|
AND UNIX_TIMESTAMP(a.create_time) <![CDATA[ < ]]> UNIX_TIMESTAMP(DATE_ADD(CURDATE(), INTERVAL 24 HOUR))
|
||||||
AND a.order_status = 'YiWanCheng'
|
AND a.order_status = 'YiWanCheng'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getTotalCarCount" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM biz_truck
|
||||||
|
WHERE audit_status = 'TongGuo'
|
||||||
|
AND deleted = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getRegionSummary" resultType="com.njzscloud.supervisory.bs.pojo.result.RegionSummary">
|
<select id="getRegionSummary" resultType="com.njzscloud.supervisory.bs.pojo.result.RegionSummary">
|
||||||
SELECT b.area,
|
SELECT b.area,
|
||||||
IFNULL(SUM(c.settle_weight), 0) total_weight
|
IFNULL(SUM(c.settle_weight), 0) total_weight
|
||||||
|
|
@ -411,4 +418,27 @@
|
||||||
AND create_time >= CURDATE()
|
AND create_time >= CURDATE()
|
||||||
AND create_time <![CDATA[ < ]]> DATE_ADD(CURDATE(), INTERVAL 1 DAY)) t
|
AND create_time <![CDATA[ < ]]> DATE_ADD(CURDATE(), INTERVAL 1 DAY)) t
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getKehuList" resultType="java.util.Map">
|
||||||
|
SELECT a.biz_obj bizObj,
|
||||||
|
CASE a.biz_obj
|
||||||
|
WHEN 'GeRen' THEN '个人'
|
||||||
|
WHEN 'WuYe' THEN '物业'
|
||||||
|
WHEN 'ShiGongDanWei' THEN '施工单位'
|
||||||
|
WHEN 'ChaiQian' THEN '拆迁公司'
|
||||||
|
WHEN 'SheQu' THEN '社区/村/街道'
|
||||||
|
ELSE ''
|
||||||
|
END bizObjTxt,
|
||||||
|
b.company_name companyName,
|
||||||
|
IFNULL(b.contacts, a.nickname) contacts,
|
||||||
|
IFNULL(b.phone, a.phone) phone,
|
||||||
|
b.province_name provinceName,
|
||||||
|
b.city_name cityName,
|
||||||
|
b.area_name areaName,
|
||||||
|
b.address,
|
||||||
|
b.uscc
|
||||||
|
FROM sys_user a
|
||||||
|
LEFT JOIN biz_company b ON b.user_id = a.id AND b.audit_status = 'TongGuo' AND b.deleted = 0
|
||||||
|
WHERE a.biz_obj IN ('WuYe', 'ShiGongDanWei', 'ChaiQian', 'SheQu')
|
||||||
|
AND a.deleted = 0
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
AND bc.company_name LIKE CONCAT('%', #{entity.companyName}, '%')
|
AND bc.company_name LIKE CONCAT('%', #{entity.companyName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="entity.goodsName != null and entity.goodsName != ''">
|
<if test="entity.goodsName != null and entity.goodsName != ''">
|
||||||
AND og.goods_name LIKE CONCAT('%', #{entity.goodsName}, '%')
|
AND mb.goods_name LIKE CONCAT('%', #{entity.goodsName}, '%')
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY mb.modify_time DESC
|
ORDER BY mb.modify_time DESC
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@
|
||||||
e.tare_weight history_tare_weight,
|
e.tare_weight history_tare_weight,
|
||||||
p.txt truck_category,
|
p.txt truck_category,
|
||||||
e.picture truck_picture,
|
e.picture truck_picture,
|
||||||
|
f.user_id driver_user_id,
|
||||||
f.driver_name,
|
f.driver_name,
|
||||||
f.phone driver_phone,
|
f.phone driver_phone,
|
||||||
f.driving_licence,
|
f.driving_licence,
|
||||||
|
|
@ -151,7 +152,7 @@
|
||||||
g.idcard trans_idcard,
|
g.idcard trans_idcard,
|
||||||
g.idcard_start_time trans_idcard_start_time,
|
g.idcard_start_time trans_idcard_start_time,
|
||||||
g.idcard_end_time trans_idcard_end_time,
|
g.idcard_end_time trans_idcard_end_time,
|
||||||
gi.money_way
|
c.money_way
|
||||||
FROM order_info a
|
FROM order_info a
|
||||||
LEFT JOIN order_cargo_place b ON b.id = a.cargo_place_id
|
LEFT JOIN order_cargo_place b ON b.id = a.cargo_place_id
|
||||||
LEFT JOIN order_goods c ON c.id = a.goods_id
|
LEFT JOIN order_goods c ON c.id = a.goods_id
|
||||||
|
|
@ -199,6 +200,7 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="OrderExportResultMap" type="com.njzscloud.supervisory.order.pojo.result.OrderExportResult">
|
<resultMap id="OrderExportResultMap" type="com.njzscloud.supervisory.order.pojo.result.OrderExportResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
<result property="transTime" column="trans_time"/>
|
<result property="transTime" column="trans_time"/>
|
||||||
<result property="stationName" column="station_name"/>
|
<result property="stationName" column="station_name"/>
|
||||||
<result property="transCompanyName" column="trans_company_name"/>
|
<result property="transCompanyName" column="trans_company_name"/>
|
||||||
|
|
@ -215,6 +217,12 @@
|
||||||
<result property="checkerMemo" column="checker_memo"/>
|
<result property="checkerMemo" column="checker_memo"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="OrderExportDetailResultMap" type="com.njzscloud.supervisory.order.pojo.result.OrderExportDetailResult">
|
||||||
|
<result property="orderId" column="order_id"/>
|
||||||
|
<result property="expenseItemName" column="expense_item_name"/>
|
||||||
|
<result property="settleMoney" column="settle_money"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<select id="paging" resultMap="OrderPagingResultMap">
|
<select id="paging" resultMap="OrderPagingResultMap">
|
||||||
<include refid="base_select"/>
|
<include refid="base_select"/>
|
||||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||||
|
|
@ -224,37 +232,58 @@
|
||||||
|
|
||||||
<select id="exportList" resultMap="OrderExportResultMap">
|
<select id="exportList" resultMap="OrderExportResultMap">
|
||||||
SELECT
|
SELECT
|
||||||
|
a.id,
|
||||||
DATE_FORMAT( a.trans_time, '%Y-%m-%d' ) AS trans_time,
|
DATE_FORMAT( a.trans_time, '%Y-%m-%d' ) AS trans_time,
|
||||||
b.station_name,
|
b.station_name,
|
||||||
c.company_name AS trans_company_name,
|
g.company_name AS trans_company_name,
|
||||||
d.license_plate,
|
d.license_plate,
|
||||||
e.txt AS truck_category,
|
e.txt AS truck_category,
|
||||||
a.estimated_quantity,
|
a.estimated_quantity,
|
||||||
TIME_FORMAT( f.in_time, '%H:%i' ) AS in_time,
|
TIME_FORMAT( ocio.in_time, '%H:%i' ) AS in_time,
|
||||||
g.company_name AS cf_company_name,
|
su.nickname AS cf_company_name,
|
||||||
h.area_name,
|
h.area_name,
|
||||||
ROUND( f.rough_weight / 1000, 2 ) AS rough_weight,
|
h.town_name,
|
||||||
ROUND( f.tare_weight / 1000, 2 ) AS tare_weight,
|
h.address,
|
||||||
ROUND( f.settle_weight / 1000, 2 ) AS settle_weight,
|
ROUND( ocio.rough_weight / 1000, 2 ) AS rough_weight,
|
||||||
i.driver_name,
|
ROUND( ocio.tare_weight / 1000, 2 ) AS tare_weight,
|
||||||
|
ROUND( ocio.settle_weight / 1000, 2 ) AS settle_weight,
|
||||||
|
f.driver_name,
|
||||||
a.checker_memo
|
a.checker_memo
|
||||||
FROM
|
FROM
|
||||||
order_info a
|
order_info a
|
||||||
LEFT JOIN biz_company b ON b.id = a.station_id
|
LEFT JOIN biz_company b ON b.id = a.station_id
|
||||||
LEFT JOIN biz_company c ON c.id = a.trans_company_id
|
LEFT JOIN biz_company g ON g.id = a.trans_company_id
|
||||||
LEFT JOIN biz_truck d ON d.id = a.truck_id
|
LEFT JOIN biz_truck d ON d.id = a.truck_id
|
||||||
LEFT JOIN sys_dict_item e ON d.truck_category = e.val
|
LEFT JOIN sys_dict_item e ON d.truck_category = e.val
|
||||||
AND e.dict_key = 'vehicle_type'
|
AND e.dict_key = 'vehicle_type'
|
||||||
LEFT JOIN order_car_in_out f ON f.id = a.car_in_out_id
|
LEFT JOIN order_car_in_out ocio ON ocio.id = a.car_in_out_id
|
||||||
LEFT JOIN biz_company g ON a.user_id = g.user_id
|
LEFT JOIN sys_user su ON a.user_id = su.id
|
||||||
LEFT JOIN order_cargo_place h ON h.id = a.cargo_place_id
|
LEFT JOIN order_cargo_place h ON h.id = a.cargo_place_id
|
||||||
LEFT JOIN biz_driver i ON i.id = a.driver_id
|
LEFT JOIN biz_driver f ON f.id = a.driver_id
|
||||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||||
${ew.customSqlSegment}
|
${ew.customSqlSegment}
|
||||||
</if>
|
</if>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
a.create_time DESC
|
a.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="exportDetailList" resultMap="OrderExportDetailResultMap">
|
||||||
|
SELECT
|
||||||
|
oei.order_id,
|
||||||
|
oei.expense_item_name,
|
||||||
|
oei.settle_money
|
||||||
|
FROM
|
||||||
|
order_expense_items oei
|
||||||
|
LEFT JOIN order_info a ON a.id = oei.order_id
|
||||||
|
LEFT JOIN biz_company g ON g.id = a.trans_company_id
|
||||||
|
LEFT JOIN biz_truck d ON d.id = a.truck_id
|
||||||
|
LEFT JOIN biz_driver f ON f.id = a.driver_id
|
||||||
|
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</if>
|
||||||
|
ORDER BY
|
||||||
|
oei.create_time DESC
|
||||||
|
</select>
|
||||||
<select id="detail" resultMap="OrderPagingResultMap">
|
<select id="detail" resultMap="OrderPagingResultMap">
|
||||||
<include refid="base_select"/>
|
<include refid="base_select"/>
|
||||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?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.njzscloud.supervisory.route.mapper.OrderRouteMapper">
|
||||||
|
<select id="paging" resultType="com.njzscloud.supervisory.route.pojo.OrderRouteEntity">
|
||||||
|
SELECT
|
||||||
|
a.id,
|
||||||
|
a.order_id,
|
||||||
|
a.project_id,
|
||||||
|
a.company_id,
|
||||||
|
a.station_id,
|
||||||
|
a.name,
|
||||||
|
a.creator_id,
|
||||||
|
a.modifier_id,
|
||||||
|
a.create_time,
|
||||||
|
a.modify_time,
|
||||||
|
a.deleted,
|
||||||
|
b.company_name start_address,
|
||||||
|
c.station_name end_address
|
||||||
|
FROM order_route a
|
||||||
|
LEFT JOIN biz_company b ON b.id = a.company_id
|
||||||
|
LEFT JOIN biz_company c ON c.id = a.station_id
|
||||||
|
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</if>
|
||||||
|
ORDER BY a.modify_time DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDetailById" resultType="com.njzscloud.supervisory.route.pojo.OrderRouteEntity">
|
||||||
|
SELECT a.id,
|
||||||
|
a.order_id,
|
||||||
|
a.project_id,
|
||||||
|
a.company_id,
|
||||||
|
a.station_id,
|
||||||
|
a.name,
|
||||||
|
a.creator_id,
|
||||||
|
a.modifier_id,
|
||||||
|
a.create_time,
|
||||||
|
a.modify_time,
|
||||||
|
a.deleted,
|
||||||
|
b.company_name start_address,
|
||||||
|
c.station_name end_address
|
||||||
|
FROM order_route a
|
||||||
|
LEFT JOIN biz_company b ON b.id = a.company_id
|
||||||
|
LEFT JOIN biz_company c ON c.id = a.station_id
|
||||||
|
WHERE a.id = #{id}
|
||||||
|
AND a.deleted = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getByOrderId" resultType="com.njzscloud.supervisory.route.pojo.OrderRouteEntity">
|
||||||
|
SELECT a.id,
|
||||||
|
a.order_id,
|
||||||
|
a.project_id,
|
||||||
|
a.company_id,
|
||||||
|
a.station_id,
|
||||||
|
a.name,
|
||||||
|
a.creator_id,
|
||||||
|
a.modifier_id,
|
||||||
|
a.create_time,
|
||||||
|
a.modify_time,
|
||||||
|
a.deleted,
|
||||||
|
b.company_name start_address,
|
||||||
|
c.station_name end_address
|
||||||
|
FROM order_route a
|
||||||
|
LEFT JOIN biz_company b ON b.id = a.company_id
|
||||||
|
LEFT JOIN biz_company c ON c.id = a.station_id
|
||||||
|
WHERE a.order_id = #{orderId}
|
||||||
|
AND a.deleted = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?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.njzscloud.supervisory.route.mapper.RouteMapper">
|
||||||
|
<select id="paging" resultType="com.njzscloud.supervisory.route.pojo.RouteEntity">
|
||||||
|
SELECT
|
||||||
|
a.id,
|
||||||
|
a.project_id,
|
||||||
|
a.company_id,
|
||||||
|
a.station_id,
|
||||||
|
a.name,
|
||||||
|
a.creator_id,
|
||||||
|
a.modifier_id,
|
||||||
|
a.create_time,
|
||||||
|
a.modify_time,
|
||||||
|
a.deleted,
|
||||||
|
b.company_name start_address,
|
||||||
|
c.station_name end_address
|
||||||
|
FROM biz_route a
|
||||||
|
LEFT JOIN biz_company b ON b.id = a.company_id
|
||||||
|
LEFT JOIN biz_company c ON c.id = a.station_id
|
||||||
|
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</if>
|
||||||
|
ORDER BY a.modify_time DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDetailById" resultType="com.njzscloud.supervisory.route.pojo.RouteEntity">
|
||||||
|
SELECT a.id,
|
||||||
|
a.project_id,
|
||||||
|
a.company_id,
|
||||||
|
a.station_id,
|
||||||
|
a.name,
|
||||||
|
a.creator_id,
|
||||||
|
a.modifier_id,
|
||||||
|
a.create_time,
|
||||||
|
a.modify_time,
|
||||||
|
a.deleted,
|
||||||
|
b.company_name start_address,
|
||||||
|
c.station_name end_address
|
||||||
|
FROM biz_route a
|
||||||
|
LEFT JOIN biz_company b ON b.id = a.company_id
|
||||||
|
LEFT JOIN biz_company c ON c.id = a.station_id
|
||||||
|
WHERE a.id = #{id}
|
||||||
|
AND a.deleted = 0
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue