Compare commits

..

21 Commits
master ... hsf

Author SHA1 Message Date
ljw f93f1cc765 去除审核流程 2026-04-28 12:02:21 +08:00
ljw 778690d8b6 1 2026-04-20 10:34:23 +08:00
ljw ce0f24bd7b 非称重品类,派车方式 2026-04-10 14:00:54 +08:00
ljw 3064ed8425 清运公司修改 2026-04-03 17:30:37 +08:00
ljw 20222eff99 批量 2026-04-03 15:08:07 +08:00
ljw db8d2479a6 Merge branch 'dev' of https://git.njzscloud.com/lzq/njzscloud into dev 2026-03-17 13:35:45 +08:00
ljw dea9e81fc1 添加日志 2026-03-17 13:35:35 +08:00
lzq 1742e2f576 可重复接单 2026-03-06 16:55:56 +08:00
lzq b9154f900d 1 2026-03-06 14:16:42 +08:00
lzq 1fea77bab2 1 2026-03-06 13:44:50 +08:00
lzq 24ae61a8e5 出场 2026-02-12 19:25:59 +08:00
ljw 11e38b86c8 发送消息修改 2026-02-11 09:05:10 +08:00
ljw 07864ba89a 修改模板 2026-02-10 18:35:26 +08:00
ljw d51b56254e Merge branch 'dev' of https://git.njzscloud.com/lzq/njzscloud into dev 2026-02-10 17:39:04 +08:00
ljw 1750233c90 模板修改 2026-02-10 17:38:57 +08:00
lzq a4a334a4bd 推送数据 2026-02-10 16:57:37 +08:00
lzq 45c2cc854f 推送数据 2026-02-10 16:34:14 +08:00
ljw 3e052223e6 Merge branch 'dev' of https://git.njzscloud.com/lzq/njzscloud into dev 2026-02-06 14:54:22 +08:00
ljw ea2a7b5b14 分账备注修改 2026-02-06 14:53:12 +08:00
lzq 06f860e11e 图片 2026-02-05 15:43:59 +08:00
lzq 3c27bc3bc0 推送记录 2026-02-05 15:14:18 +08:00
34 changed files with 763 additions and 264 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
/**/.DS_Store
/**/.back*
db-model/*/
/njzscloud-svr/docs

View File

@ -8,6 +8,7 @@ import com.njzscloud.supervisory.biz.pojo.entity.BizCompanyEntity;
import com.njzscloud.supervisory.biz.pojo.param.ModifyBizCompanyParam;
import com.njzscloud.supervisory.biz.pojo.param.SearchCompanyParam;
import com.njzscloud.supervisory.biz.pojo.param.SettlementWayParam;
import com.njzscloud.supervisory.biz.pojo.param.SsrParam;
import com.njzscloud.supervisory.biz.pojo.result.SearchCompanyResult;
import com.njzscloud.supervisory.biz.pojo.result.StationResult;
import com.njzscloud.supervisory.biz.service.BizCompanyService;
@ -62,6 +63,39 @@ public class BizCompanyController {
return R.success();
}
/**
*
*
* @param ssr
*/
@PostMapping("/updateSsr")
public R<?> updateSsr(@RequestBody SsrParam ssr) {
BizCompanyEntity entity = new BizCompanyEntity();
entity.setId(ssr.getId());
if (!ssr.getServiceScope().isEmpty()) {
entity.setServiceScope(ssr.getServiceScope());
}
if (ssr.getRemark() != null) {
entity.setRemark(ssr.getRemark());
}
bizCompanyService.updateById(entity);
return R.success();
}
/**
*
*
* @param id Id
*/
@GetMapping("/enabled")
public R<?> enabled(@RequestParam("id") Long id, @RequestParam("enabled") Boolean enabled) {
BizCompanyEntity entity = new BizCompanyEntity();
entity.setId(id);
entity.setEnabled(enabled);
bizCompanyService.updateById(entity);
return R.success();
}
/**
*
*

View File

@ -1,6 +1,7 @@
package com.njzscloud.supervisory.biz.pojo.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.njzscloud.common.mp.support.handler.j.JsonTypeHandler;
import com.njzscloud.supervisory.biz.constant.AuditStatus;
import com.njzscloud.supervisory.biz.constant.BizObj;
import lombok.Getter;
@ -9,6 +10,7 @@ import lombok.experimental.Accessors;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
*
@ -197,4 +199,26 @@ public class BizCompanyEntity {
*/
private String settlementWay;
/**
* ; 0-->1-->
*/
private Boolean enabled;
/**
*
*/
@TableField(typeHandler = JsonTypeHandler.class)
private List<String> serviceScope;
/**
*
*/
private String remark;
/**
* ids
*/
@TableField(typeHandler = JsonTypeHandler.class)
private List<String> goodsIds;
}

View File

@ -1,5 +1,7 @@
package com.njzscloud.supervisory.biz.pojo.param;
import com.baomidou.mybatisplus.annotation.TableField;
import com.njzscloud.common.mp.support.handler.j.JsonTypeHandler;
import com.njzscloud.supervisory.biz.constant.AuditStatus;
import com.njzscloud.supervisory.biz.constant.BizObj;
import lombok.Getter;
@ -161,4 +163,11 @@ public class ModifyBizCompanyParam {
* ; audit_status
*/
private AuditStatus auditStatus;
/**
* ids
*/
@TableField(typeHandler = JsonTypeHandler.class)
private List<String> goodsIds;
}

View File

@ -41,4 +41,15 @@ public class SearchCompanyParam {
* ; audit_status
*/
private AuditStatus auditStatus;
/**
* ; 0-->1-->
*/
private Boolean enabled;
/**
*
*/
private String area;
}

View File

@ -0,0 +1,33 @@
package com.njzscloud.supervisory.biz.pojo.param;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.util.List;
/**
*
*/
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class SsrParam {
/**
* Id
*/
private Long id;
/**
*
*/
private List<String> serviceScope;
/**
*
*/
private String remark;
}

View File

@ -1,5 +1,7 @@
package com.njzscloud.supervisory.biz.pojo.result;
import com.baomidou.mybatisplus.annotation.TableField;
import com.njzscloud.common.mp.support.handler.j.JsonTypeHandler;
import com.njzscloud.supervisory.biz.constant.AuditStatus;
import com.njzscloud.supervisory.biz.constant.BizObj;
import lombok.Getter;
@ -10,6 +12,7 @@ import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
*
@ -30,6 +33,8 @@ public class SearchCompanyResult {
* ; 0-->1-->
*/
private Boolean station;
private Integer stationType;
/**
* ; 0-->1-->
*/
@ -153,4 +158,23 @@ public class SearchCompanyResult {
private String idcardFront;
private String idcardBack;
/**
* ; 0-->1-->
*/
private Boolean enabled;
/**
*
*/
@TableField(typeHandler = JsonTypeHandler.class)
private List<String> serviceScope;
/**
*
*/
private String remark;
@TableField(typeHandler = JsonTypeHandler.class)
private List<String> goodsIds;
}

View File

@ -191,11 +191,15 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
String stationName = searchCompanyParam.getStationName();
String legalRepresentative = searchCompanyParam.getLegalRepresentative();
Integer station = searchCompanyParam.getStation();
Boolean enabled = searchCompanyParam.getEnabled();
String area = searchCompanyParam.getArea();
return PageResult.of(baseMapper.paging(pageParam.toPage(), Wrappers.query()
// .eq("a.station", Boolean.FALSE)
.eq("a.deleted", 0)
.eq(StrUtil.isNotBlank(aStatus), "a.audit_status", aStatus)
.eq(station != null, "a.station", station)
.eq(enabled != null, "a.enabled", enabled)
.eq(StrUtil.isNotBlank(area), "a.area", area)
// .eq(StrUtil.isNotBlank(searchCompanyParam.getStation()), "a.station", searchCompanyParam.getStation())
.in(CollUtil.isNotEmpty(bizObjList), "b.biz_obj", bizObjList)
.like(StrUtil.isNotBlank(companyName), "a.company_name", companyName)

View File

@ -174,7 +174,7 @@ public class BizDriverService extends ServiceImpl<BizDriverMapper, BizDriverEnti
SearchCompanyResult searchCompanyResult = baseMapper.selectCompanyByUserId(userDetail.getUserId());
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<BizDriverEntity>lambdaQuery()
.eq(BizDriverEntity::getBusy, false)
// .eq(BizDriverEntity::getBusy, false)
.eq(BizDriverEntity::getCompanyId, searchCompanyResult.getId())
.eq(BizDriverEntity::getAuditStatus, AuditStatus.TongGuo)
.and(StrUtil.isNotBlank(keywords), it ->

View File

@ -188,7 +188,7 @@ public class BizTruckService extends ServiceImpl<BizTruckMapper, BizTruckEntity>
SearchCompanyResult searchCompanyResult = baseMapper.selectCompanyByUserId(userDetail.getUserId());
Assert.notNull(searchCompanyResult, () -> Exceptions.exception("未查询到公司信息"));
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<BizTruckEntity>lambdaQuery()
.eq(BizTruckEntity::getBusy, false)
// .eq(BizTruckEntity::getBusy, false)
.eq(BizTruckEntity::getAuditStatus, AuditStatus.TongGuo)
.eq(BizTruckEntity::getCompanyId, searchCompanyResult.getId())
.and(StrUtil.isNotBlank(keywords), it ->

View File

@ -1,5 +1,7 @@
package com.njzscloud.supervisory.customer.pojo.result;
import com.baomidou.mybatisplus.annotation.TableField;
import com.njzscloud.common.mp.support.handler.j.JsonTypeHandler;
import com.njzscloud.supervisory.biz.constant.AuditStatus;
import lombok.Getter;
import lombok.Setter;
@ -7,6 +9,7 @@ import lombok.ToString;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.util.List;
@Getter
@Setter
@ -109,4 +112,24 @@ public class SearchCompanyResult {
private String idcardEndTime;
private String idcardFront;
private String idcardBack;
/**
* ; 0-->1-->
*/
private Boolean enabled;
/**
*
*/
@TableField(typeHandler = JsonTypeHandler.class)
private List<String> serviceScope;
/**
*
*/
private String remark;
@TableField(typeHandler = JsonTypeHandler.class)
private List<String> goodsIds;
}

View File

@ -120,7 +120,7 @@ public class DeviceInfoController {
}
/**
* 1
* 1,
*/
@PostMapping("/report1")
public Map<String, Object> report1(@RequestBody JSONObject data) {
@ -128,7 +128,7 @@ public class DeviceInfoController {
}
/**
* 2
* 2
*/
@PostMapping("/report2")
public Map<String, Object> report2(@RequestBody JSONObject data) {

View File

@ -202,10 +202,20 @@ public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoE
* @param pageParam
* @return PageResult&lt;DeviceInfoEntity&gt;
*/
public PageResult<DeviceInfoEntity> paging(PageParam pageParam, DeviceInfoEntity deviceInfoEntity) {
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<DeviceInfoEntity>query(deviceInfoEntity)));
}
private void open(String sn, String cid) {
log.info("开门: {} {}", sn, cid);
Mqtt.publish(cid + "/1/barrier", MapUtil.builder()
.put("deviceNo", sn)
.build());
}
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> report1(JSONObject data) {
MapBuilder<String, Object> resBuilder = MapUtil.<String, Object>builder()
@ -336,13 +346,6 @@ public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoE
.build();
}
private void open(String sn, String cid) {
log.info("开门: {} {}", sn, cid);
Mqtt.publish(cid + "/1/barrier", MapUtil.builder()
.put("deviceNo", sn)
.build());
}
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> report2(JSONObject data) {
MapBuilder<String, Object> resBuilder = MapUtil.<String, Object>builder()
@ -441,6 +444,9 @@ public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoE
if (orderInfo.getCheckStatus() == CheckStatus.WeiKanLiao) {
// 播语音
playVoice(sn, cid, "{}未看料", licensePlate);
return resBuilder
.put("data", dataBuilder.build())
.build();
}
boolean b = orderInfoService.truckLeaving(new TruckLeavingOrderParam()
.setOrderId(orderId)
@ -510,6 +516,7 @@ public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoE
.build();
}
private void playVoice(String sn, String cid, String content, Object... params) {
String format = StrUtil.format(content, params);
log.info("播语音: {} {} {}", sn, cid, format);

View File

@ -2,6 +2,7 @@ package com.njzscloud.supervisory.hsoa;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.njzscloud.common.core.jackson.Jackson;
import com.njzscloud.common.http.HttpClientDecorator;
import com.njzscloud.supervisory.config.AppProperties;
import com.njzscloud.supervisory.hsoa.pojo.param.*;
@ -57,6 +58,7 @@ public class Hsoa {
return new HsoaResult<>()
.setSuccess(false);
}
log.info("电子联单最终上传数据:{}", Jackson.toJsonStr(param));
return API.pushProvincial(param, new TokenParam().setTnt(tnt).setRefTnt(refTnt));
} finally {
rlock.unlock();
@ -117,7 +119,11 @@ public class Hsoa {
}
}
public static void relogin() {
public synchronized static void relogin() {
if (StrUtil.isBlank(refTnt) || StrUtil.isBlank(tnt)) {
log.info("无需重置登录TOKEN");
return;
}
try {
wlock.lock();
log.info("重置登录TOKEN");

View File

@ -0,0 +1,19 @@
package com.njzscloud.supervisory.hsoa.constant;
import com.njzscloud.common.core.ienum.DictStr;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* push_type
*
*/
@Getter
@RequiredArgsConstructor
public enum PushType implements DictStr {
GuiJi("GuiJi", "车辆轨迹推送"),
LianDan("LianDan", "联单推送"),
;
private final String val;
private final String txt;
}

View File

@ -1,7 +1,11 @@
package com.njzscloud.supervisory.hsoa.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.hsoa.Hsoa;
import com.njzscloud.supervisory.hsoa.constant.PushType;
import com.njzscloud.supervisory.hsoa.pojo.entity.HsoaRecode;
import com.njzscloud.supervisory.hsoa.pojo.param.PushProvincialSaveParam;
import com.njzscloud.supervisory.hsoa.pojo.param.PushVehicleTrajectoryParam;
import com.njzscloud.supervisory.hsoa.pojo.result.HsoaResult;
@ -9,6 +13,8 @@ import com.njzscloud.supervisory.hsoa.service.HsoaService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
@RestController
@RequiredArgsConstructor
@RequestMapping("/hsoa")
@ -28,4 +34,19 @@ public class HsoaController {
return R.success(hsoaResult);
}
/**
*
*/
@GetMapping("/paging")
public R<PageResult<HsoaRecode>> paging(PageParam pageParam,
@RequestParam("pushType") PushType pushType,
@RequestParam(value = "orderSn", required = false) String orderSn,
@RequestParam(value = "licensePlate", required = false) String licensePlate,
@RequestParam(value = "success", required = false) Boolean success,
@RequestParam(value = "startTime", required = false) LocalDateTime startTime,
@RequestParam(value = "endTime", required = false) LocalDateTime endTime
) {
return R.success(hsoaService.paging(pageParam, orderSn, licensePlate, pushType, success, startTime, endTime));
}
}

View File

@ -0,0 +1,9 @@
package com.njzscloud.supervisory.hsoa.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njzscloud.supervisory.hsoa.pojo.entity.HsoaRecode;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface HsoaMapper extends BaseMapper<HsoaRecode> {
}

View File

@ -0,0 +1,29 @@
package com.njzscloud.supervisory.hsoa.pojo.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.njzscloud.supervisory.hsoa.constant.PushType;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
@Getter
@Setter
@ToString
@Accessors(chain = true)
@TableName("hsoa_recode")
public class HsoaRecode {
@TableId(type = IdType.ASSIGN_ID)
private Long id;
private Long orderId;
private String orderSn;
private String licensePlate;
private PushType pushType;
private Boolean success;
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
}

View File

@ -1,17 +1,39 @@
package com.njzscloud.supervisory.hsoa.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njzscloud.common.core.jackson.Jackson;
import com.njzscloud.common.core.tuple.Tuple2;
import com.njzscloud.common.core.utils.ImgUtil;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.common.oss.util.AliOSS;
import com.njzscloud.supervisory.hsoa.Hsoa;
import com.njzscloud.supervisory.hsoa.constant.PushType;
import com.njzscloud.supervisory.hsoa.mapper.HsoaMapper;
import com.njzscloud.supervisory.hsoa.pojo.entity.HsoaRecode;
import com.njzscloud.supervisory.hsoa.pojo.param.PushProvincialSaveParam;
import com.njzscloud.supervisory.hsoa.pojo.param.PushProvincialUploadParam;
import com.njzscloud.supervisory.hsoa.pojo.result.HsoaResult;
import com.njzscloud.supervisory.hsoa.pojo.result.UploadResult;
import com.njzscloud.supervisory.order.pojo.result.OrderPagingResult;
import com.njzscloud.supervisory.order.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
@ -20,120 +42,12 @@ import static com.njzscloud.supervisory.hsoa.pojo.param.PushProvincialUploadPara
@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();
} */
public class HsoaService extends ServiceImpl<HsoaMapper, HsoaRecode> implements IService<HsoaRecode> {
public HsoaResult<?> pushProvincialSave(OrderPagingResult detail) {
log.info("上传数据:{}", Jackson.toJsonStr(detail));
List<String> route = detail.getRoute();
PushProvincialSaveParam param = new PushProvincialSaveParam()
.setHandleInfo(new PushProvincialSaveParam.HandleInfo()
.setApproveDate(detail.getOutTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
@ -231,7 +145,7 @@ public class HsoaService {
.setLicenseValidityPeriodDateRange(detail.getShiAuditTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + "-" + detail.getShiAuditTime().plusHours(24).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
.setLicenseValidityPeriodStartDate(detail.getShiAuditTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
.setLicenseValidityPeriodEndDate(detail.getShiAuditTime().plusHours(24).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
// .setRoute("")
.setRoute(CollUtil.isEmpty(route) ? "" : String.join("-", route))
.setSuperviseUnitName(detail.getAreaName())
.setTransportDateRange(detail.getTransTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + "-" + detail.getOutTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
.setTransportStartDate(detail.getTransTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
@ -239,14 +153,13 @@ public class HsoaService {
.setTransportationEnterpriseId(detail.getTransCompanyId() == null ? null : detail.getTransCompanyId().toString())
.setTransportationEnterpriseName(detail.getTransCompanyName())
);
log.info(Jackson.toJsonStr(param));
// log.info(Jackson.toJsonStr(param));
return Hsoa.pushProvincial(param);
// return null;
}
private String upload(List<String> urls, String uploadPath) {
return null;
/* if (CollUtil.isEmpty(urls)) return null;
if (CollUtil.isEmpty(urls)) return null;
String url = urls.get(0);
if (StrUtil.isBlank(url)) return null;
url = url.substring(1);
@ -262,15 +175,28 @@ public class HsoaService {
.setUploadPath(uploadPath)
);
if (upload.isSuccess()) {
log.info("图片:{}、{}", uploadPath, upload.getUrl());
return upload.getUrl();
} else {
return null;
}
} catch (Exception e) {
throw new RuntimeException(e);
log.error("上传失败", e);
return null;
} finally {
IoUtil.close(in);
} */
}
}
public PageResult<HsoaRecode> paging(PageParam pageParam, String orderSn, String licensePlate, PushType pushType, Boolean success, LocalDateTime startTime, LocalDateTime endTime) {
Page<HsoaRecode> page = pageParam.toPage();
page.addOrder(OrderItem.desc("create_time"), OrderItem.desc("id"));
return PageResult.of(this.page(page, Wrappers.<HsoaRecode>lambdaQuery()
.eq(StrUtil.isNotBlank(orderSn), HsoaRecode::getOrderSn, orderSn)
.eq(StrUtil.isNotBlank(licensePlate), HsoaRecode::getLicensePlate, licensePlate)
.eq(pushType != null, HsoaRecode::getPushType, pushType)
.eq(success != null, HsoaRecode::getSuccess, success)
.ge(startTime != null, HsoaRecode::getCreateTime, startTime)
.le(endTime != null, HsoaRecode::getCreateTime, endTime)
));
}
}

View File

@ -0,0 +1,20 @@
package com.njzscloud.supervisory.order.contant;
import com.njzscloud.common.core.ienum.DictStr;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* car_way
*
*/
@Getter
@RequiredArgsConstructor
public enum CarWay implements DictStr {
PROJECT("project", "项目"),
PLATFORM("platform", "平台"),
OPTIONAL("optional", "自选")
;
private final String val;
private final String txt;
}

View File

@ -44,7 +44,7 @@ public class OrderInfoController {
|| orderCategory == OrderCategory.DuanBoChu
, "订单类型必须是普通订单、短驳出");
Integer truckCount = addOrderInfoParam.getTruckCount();
Assert.isTrue(truckCount != null && truckCount > 0 && truckCount <= 10, "车辆数量必须大于0小于等于10");
Assert.isTrue(truckCount != null && truckCount > 0, "车辆数量必须大于0");
Integer estimatedQuantity = addOrderInfoParam.getEstimatedQuantity();
if (estimatedQuantity != null && estimatedQuantity > 0) {
addOrderInfoParam.setEstimatedQuantity(estimatedQuantity / truckCount);
@ -151,6 +151,15 @@ public class OrderInfoController {
return R.success();
}
/**
*
*/
@PostMapping("/batch_audit")
public R<?> batchAudit(@RequestBody BatchAuditOrderParam param) {
orderInfoService.batchAudit(param);
return R.success();
}
/**
*
*/
@ -169,6 +178,28 @@ public class OrderInfoController {
return R.success();
}
/**
*
*
* @param param
*/
@PostMapping("/batch_assignment")
public R<?> batchAssignment(@RequestBody BatchAssignmentOrderParam param) {
orderInfoService.batchAssignment(param);
return R.success();
}
/**
*
*
* @param param
*/
@PostMapping("/batch_confirm")
public R<?> batchConfirm(@RequestBody BatchConfirmOrderParam param) {
orderInfoService.batchConfirm(param);
return R.success();
}
/**
*
*

View File

@ -56,4 +56,10 @@ public interface OrderInfoMapper extends BaseMapper<OrderInfoEntity> {
@SuppressWarnings("MybatisXMapperMethodInspection")
List<Map<String, Object>> statisticsByAreaGoods(@Param("ew") QueryWrapper<Object> ew);
Boolean driverIsBusy(@Param("driverId") Long driverId);
Boolean truckIsBusy(@Param("truckId") Long truckId);
Boolean hasInProgressOrder(@Param("driverId") Long driverId, @Param("orderStatuses") List<String> orderStatuses);
}

View File

@ -3,10 +3,7 @@ package com.njzscloud.supervisory.order.pojo.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.njzscloud.common.mp.support.handler.j.JsonTypeHandler;
import com.njzscloud.supervisory.biz.constant.AuditStatus;
import com.njzscloud.supervisory.order.contant.CheckStatus;
import com.njzscloud.supervisory.order.contant.OrderCategory;
import com.njzscloud.supervisory.order.contant.OrderStatus;
import com.njzscloud.supervisory.order.contant.PaymentStatus;
import com.njzscloud.supervisory.order.contant.*;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@ -312,4 +309,9 @@ public class OrderInfoEntity {
*/
private BigDecimal changeMoney;
/**
* -->project -->platform -->optional
*/
private CarWay carWay;
}

View File

@ -3,6 +3,7 @@ package com.njzscloud.supervisory.order.pojo.param;
import com.njzscloud.common.mvc.validator.Constrained;
import com.njzscloud.common.mvc.validator.Constraint;
import com.njzscloud.common.mvc.validator.ValidRule;
import com.njzscloud.supervisory.order.contant.CarWay;
import com.njzscloud.supervisory.order.contant.OrderCategory;
import com.njzscloud.supervisory.order.contant.PayerCategory;
import lombok.Getter;
@ -73,6 +74,11 @@ public class AddOrderInfoParam implements Constrained {
*/
private Long targetOrderId;
/**
* -->project -->platform -->optional
*/
private CarWay carWay;
/**
* ; order_category
*/

View File

@ -0,0 +1,23 @@
package com.njzscloud.supervisory.order.pojo.param;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.util.List;
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class BatchAssignmentOrderParam {
/**
* Id
*/
private List<Long> orderIds;
/**
* Id
*/
private Long driverId;
}

View File

@ -0,0 +1,35 @@
package com.njzscloud.supervisory.order.pojo.param;
import com.njzscloud.supervisory.biz.constant.AuditStatus;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.util.List;
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class BatchAuditOrderParam {
/**
* Id
*/
private List<Long> orderIds;
/**
* ; audit_status
*/
private AuditStatus auditStatus;
/**
*
*/
private String auditMemo;
/**
*
*/
private String auditPicture;
}

View File

@ -0,0 +1,23 @@
package com.njzscloud.supervisory.order.pojo.param;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.util.List;
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class BatchConfirmOrderParam {
/**
* Id
*/
private List<Long> orderIds;
/**
* Id
*/
private Long truckId;
}

View File

@ -26,11 +26,6 @@ public class OrderExportResult {
*/
private Integer sort;
/**
*
*/
private String sn;
/**
*
*/

View File

@ -544,4 +544,9 @@ public class OrderPagingResult {
private Double stationLat;
private List<String> route;
// endregion
/**
* -->project -->platform -->optional
*/
private CarWay carWay;
}

View File

@ -1,5 +1,11 @@
package com.njzscloud.supervisory.order.service;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
@ -15,7 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
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.google.common.base.Strings;
// import com.google.common.base.Strings;
import com.njzscloud.common.core.ex.Exceptions;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
@ -38,6 +44,8 @@ import com.njzscloud.supervisory.expense.pojo.entity.ExpenseItemsConfigEntity;
import com.njzscloud.supervisory.expense.service.ExpenseItemsConfigService;
import com.njzscloud.supervisory.goods.contant.MoneyStrategy;
import com.njzscloud.supervisory.hsoa.Hsoa;
import com.njzscloud.supervisory.hsoa.constant.PushType;
import com.njzscloud.supervisory.hsoa.pojo.entity.HsoaRecode;
import com.njzscloud.supervisory.hsoa.pojo.param.PushVehicleTrajectoryParam;
import com.njzscloud.supervisory.hsoa.pojo.result.HsoaResult;
import com.njzscloud.supervisory.hsoa.service.HsoaService;
@ -57,19 +65,21 @@ import com.njzscloud.supervisory.station.service.StationManageService;
import com.njzscloud.supervisory.sys.auth.pojo.result.MyResult;
import com.njzscloud.supervisory.sys.dict.pojo.DictItemEntity;
import com.njzscloud.supervisory.sys.dict.service.DictItemService;
import com.njzscloud.supervisory.sys.role.pojo.entity.RoleEntity;
import com.njzscloud.supervisory.sys.role.service.RoleService;
// 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.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.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.wxPay.contant.TempType;
// import com.njzscloud.supervisory.wxPay.contant.TempType;
// import com.njzscloud.supervisory.wxPay.dto.RefundRequestDto;
// import com.njzscloud.supervisory.wxPay.param.TemplateMessageParam;
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.WechatTemplateMessageService;
// import com.njzscloud.supervisory.wxPay.service.WechatTemplateMessageService;
// import com.njzscloud.supervisory.wxPay.service.WechatTemplateMessageService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
@ -78,10 +88,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
@ -109,13 +116,13 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
private final MoneyAccountService moneyAccountService;
private final MoneyChangeDetailService moneyChangeDetailService;
private final PaymentService paymentService;
private final WechatTemplateMessageService wechatTemplateMessageService;
private final BizDriverService bizDriverService;
// 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 RoleService roleService;
// private final UserRoleService userRoleService;
// private final UserService userService;
// private final BizTruckService bizTruckService;
private final DiscountManageService discountManageService;
private final HsoaService hsoaService;
private final DictItemService dictItemService;
@ -131,7 +138,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
Long stationId = addOrderInfoParam.getStationId();
BizCompanyEntity stationInfo = bizCompanyService.getById(stationId);
Assert.notNull(stationInfo, () -> Exceptions.clierr("站点信息错误"));
Assert.isTrue(Integer.valueOf(1).equals(stationInfo.getStationType()), () -> Exceptions.clierr("系统暂未对接,预约失败"));
// Assert.isTrue(Integer.valueOf(1).equals(stationInfo.getStationType()), () -> Exceptions.clierr("系统暂未对接,预约失败"));
Assert.isFalse(this.exists(Wrappers.<OrderInfoEntity>lambdaQuery().eq(OrderInfoEntity::getSn, addOrderInfoParam.getSn())), () -> Exceptions.exception("订单创建失败,订单号重复"));
AddOrderCargoPlaceParam cargoPlace = addOrderInfoParam.getCargoPlace();
long cargoPlaceId = orderCargoPlaceService.add(cargoPlace);
@ -177,7 +184,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
BizCompanyEntity transCompanyEntity = baseMapper.getTransInfo(transCompanyId);
cloudVoiceboxService.play(transCompanyEntity.getUserId(), "您有新的待分配订单,请及时处理");
// 通知清运公司
try {
/* try {
TemplateMessageParam param = new TemplateMessageParam();
param.setUserId(transCompanyEntity.getUserId());
param.setTempType(TempType.TRANS_COMPANY.getVal());
@ -187,7 +194,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
wechatTemplateMessageService.sendTemplateMessage(param);
} catch (Exception e) {
log.error("通知失败", e);
}
} */
} else {
cloudVoiceboxService.play(1L, "您有新的待分配订单,请及时处理");
}
@ -504,11 +511,15 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
if (CollUtil.isEmpty(areaList) && CollUtil.isEmpty(cityList) && CollUtil.isEmpty(cityAreaList)) {
return PageResult.of(pageParam.toPage());
}
Page<OrderPagingResult> page = pageParam.toPage();
page.addOrder(OrderItem.desc("a.create_time"));
QueryWrapper<OrderPagingResult> ew = Wrappers.query();
AuditStatus auditStatus = orderPagingSearchParam.getAuditStatus();
Page<OrderPagingResult> page = pageParam.toPage();
page.orders().clear(); // 移除所有入参排序
if ("2".equals(orderPagingSearchParam.getAuditType()) || auditStatus == AuditStatus.TongGuo) {
page.addOrder(OrderItem.desc("a.shi_audit_time"));
} else {
page.addOrder(OrderItem.desc("a.create_time"));
}
QueryWrapper<OrderPagingResult> ew = Wrappers.query();
if (Boolean.TRUE.equals(orderPagingSearchParam.getIsCertificatePaging())) {
ew.isNotNull("a.certificate_sn");
}
@ -597,6 +608,20 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
return PageResult.of(baseMapper.paging(page, ew));
}
@Transactional(rollbackFor = Exception.class)
public void batchAudit(BatchAuditOrderParam param) {
List<Long> orderIds = param.getOrderIds();
Assert.notEmpty(orderIds, () -> Exceptions.clierr("订单ID列表不能为空"));
for (Long orderId : orderIds) {
AuditOrderParam auditOrderParam = new AuditOrderParam()
.setId(orderId)
.setAuditStatus(param.getAuditStatus())
.setAuditMemo(param.getAuditMemo())
.setAuditPicture(param.getAuditPicture());
audit(auditOrderParam);
}
}
@Transactional(rollbackFor = Exception.class)
public void audit(AuditOrderParam auditOrderParam) {
OrderPagingResult detail = detail(auditOrderParam.getId());
@ -692,22 +717,29 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
OrderCategory orderCategory = detail.getOrderCategory();
if (orderCategory == OrderCategory.DuanBoRu) return;
// auditStatus为市待审核状态通知市通过状态通知司机
try {
/* 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());
param.setCompanyName(detail.getTransCompanyName());
param.setCreateTime(detail.getCreateTime());
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 = new TemplateMessageParam();
param.setSn(detail.getSn());
param.setCfCompanyName(detail.getNickname());
param.setTempType(TempType.AUDIT_PENDING.getVal());
param.setUserId(userRoleEntity.getUserId());
param.setGoodsName(entity.getGoodsName());
param.setCompanyName(detail.getTransCompanyName());
param.setCreateTime(detail.getCreateTime());
wechatTemplateMessageService.sendTemplateMessage(param);
}
} else if (AuditStatus.TongGuo.equals(auditStatus)) {
@ -722,7 +754,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
}
} catch (Exception e) {
log.error("通知失败", e);
}
} */
}
@Transactional(rollbackFor = Exception.class)
@ -733,7 +765,32 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
CheckStatus checkStatus = oldOrder.getCheckStatus();
Assert.isFalse(checkStatus == null, () -> Exceptions.clierr("当前订单无需看料"));
Assert.isFalse(CheckStatus.YiKanLiao == checkStatus, () -> Exceptions.clierr("当前订单已看料"));
Assert.isTrue(oldOrder.getOrderStatus() == OrderStatus.YiJinChang, () -> Exceptions.clierr("当前订单状态,无法看料"));
// 查询站点企业信息,判断是否为站点且配置了非称重产品
Long stationId = oldOrder.getStationId();
BizCompanyEntity stationCompany = bizCompanyService.getById(stationId);
boolean isStationWithNoWeighGoods = stationCompany != null
&& Boolean.TRUE.equals(stationCompany.getStation())
&& CollUtil.isNotEmpty(stationCompany.getGoodsIds());
// 如果是站点且配置了非称重产品,则判断订单产品是否属于非称重产品
boolean isNoWeighProductOrder = false;
if (isStationWithNoWeighGoods) {
// 通过订单的 goodsId 查询 order_goods 表获取 origin_goods_id
OrderGoodsEntity orderGoods = orderGoodsService.getById(oldOrder.getGoodsId());
if (orderGoods != null) {
Long originGoodsId = orderGoods.getOriginGoodsId();
// 判断 originGoodsId 是否在企业的非称重产品 goodsIds 集合中
isNoWeighProductOrder = stationCompany.getGoodsIds()
.contains(originGoodsId.toString());
}
}
// 如果是非称重产品订单,直接完成订单
if (isNoWeighProductOrder) {
// 获取支付上下文,获取支付方式
PaymentContextResult paymentCtx = paymentContext(orderId);
String settlementWay = paymentCtx != null ? paymentCtx.getSettlementWay() : null;
this.updateById(new OrderInfoEntity()
.setId(orderId)
@ -741,9 +798,47 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
.setCheckTime(LocalDateTime.now())
.setCheckStatus(CheckStatus.YiKanLiao)
.setCheckerId(SecurityUtil.currentUserId())
.setOrderStatus(OrderStatus.YiWanCheng)
.setPaymentStatus(PaymentStatus.YiZhiFu)
.setFinishTime(LocalDateTime.now())
.setSettlementWay(settlementWay)
);
} else {
// 普通产品订单,仅更新看料状态
Assert.isTrue(oldOrder.getOrderStatus() == OrderStatus.YiJinChang, () -> Exceptions.clierr("当前订单状态,无法看料"));
this.updateById(new OrderInfoEntity()
.setId(orderId)
.setCheckPhoto(checkGoodsParam.getCheckPhoto())
.setCheckTime(LocalDateTime.now())
.setCheckStatus(CheckStatus.YiKanLiao)
.setCheckerId(SecurityUtil.currentUserId())
);
}
}
// truckLeaving(new TruckLeavingOrderParam().setOrderId(orderId), 0);
@Transactional(rollbackFor = Exception.class)
public void batchAssignment(BatchAssignmentOrderParam param) {
List<Long> orderIds = param.getOrderIds();
Assert.notEmpty(orderIds, () -> Exceptions.clierr("订单ID列表不能为空"));
Assert.notNull(param.getDriverId(), () -> Exceptions.clierr("司机ID不能为空"));
for (Long orderId : orderIds) {
AssignmentOrderParam assignmentOrderParam = new AssignmentOrderParam()
.setOrderId(orderId)
.setDriverId(param.getDriverId());
OrderInfoEntity oldOrder = this.getById(orderId);
Assert.notNull(oldOrder, () -> Exceptions.clierr("订单不存在, orderId: " + orderId));
assignmentDriver(assignmentOrderParam, oldOrder);
}
}
@Transactional(rollbackFor = Exception.class)
public void batchConfirm(BatchConfirmOrderParam param) {
List<Long> orderIds = param.getOrderIds();
Assert.notEmpty(orderIds, () -> Exceptions.clierr("订单ID列表不能为空"));
Assert.notNull(param.getTruckId(), () -> Exceptions.clierr("车辆ID不能为空"));
for (Long orderId : orderIds) {
confirm(orderId, param.getTruckId());
}
}
@Transactional(rollbackFor = Exception.class)
@ -777,7 +872,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
throw Exceptions.clierr("公司账户余额不足");
}
}
baseMapper.busyDriver(driverId, Boolean.TRUE);
// baseMapper.busyDriver(driverId, Boolean.TRUE);
OrderCategory orderCategory = orderInfo.getOrderCategory();
if (orderCategory == OrderCategory.DuanBoChu) {
@ -795,7 +890,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
.setOrderStatus(OrderStatus.DaiJieDan)
);
// 通知司机
try {
/* try {
BizDriverEntity driverEntity = bizDriverService.getById(driverId);
TemplateMessageParam param = new TemplateMessageParam();
param.setUserId(driverEntity.getUserId());
@ -809,7 +904,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
wechatTemplateMessageService.sendTemplateMessage(param);
} catch (Exception e) {
log.error("通知失败", e);
}
} */
}
private boolean assignmentTrafficCompany(AssignmentOrderParam assignmentOrderParam,
@ -829,7 +924,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
// OrderInfoEntity orderInfoEntity = this.getById(orderInfoId);
// settleForTransCompany(orderInfoEntity, 0);
// 通知清运公司
try {
/* try {
TemplateMessageParam param = new TemplateMessageParam();
BizCompanyEntity transCompanyEntity = baseMapper.getTransInfo(transCompanyId);
param.setUserId(transCompanyEntity.getUserId());
@ -842,7 +937,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
wechatTemplateMessageService.sendTemplateMessage(param);
} catch (Exception e) {
log.error("通知失败", e);
}
} */
return true;
}
@ -855,70 +950,59 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
long userId = SecurityUtil.currentUserId();
Long driverId_ = baseMapper.getDriverId(userId);
Assert.isTrue(driverId_ != null && driverId == driverId_, () -> Exceptions.clierr("您没有权限确认此单"));
baseMapper.busyTruck(truckId, Boolean.TRUE);
OrderCargoPlaceEntity cargoPlaceEntity = orderCargoPlaceService.getById(orderInfo.getCargoPlaceId());
String area = cargoPlaceEntity.getArea();
BizAuditConfigEntity bizAuditConfigEntity = bizAuditConfigService.getOne(Wrappers.lambdaQuery(BizAuditConfigEntity.class).eq(BizAuditConfigEntity::getArea, area));
AuditStatus auditStatus = AuditStatus.DaiShenHe;
if (bizAuditConfigEntity != null) {
String areaRole = bizAuditConfigEntity.getAreaRole();
String cityRole = bizAuditConfigEntity.getCityRole();
if (areaRole != null && cityRole != null) {
auditStatus = AuditStatus.QuDaiShenHe;
} else if (areaRole == null && cityRole != null) {
auditStatus = AuditStatus.ShiDaiShenHe;
}
}
Boolean driverHasInProgress = baseMapper.hasInProgressOrder(driverId,
Arrays.asList(OrderStatus.QingYunZhong.getVal(), OrderStatus.YiJinChang.getVal(), OrderStatus.YiChuChang.getVal()));
Assert.isFalse(driverHasInProgress, () -> Exceptions.clierr("您有正在进行中的订单,不能接单"));
baseMapper.busyDriver(driverId, Boolean.TRUE);
baseMapper.busyTruck(truckId, Boolean.TRUE);
String certificateSn = SnUtil.next(CERTIFICATE_SN_CODE);
this.updateById(new OrderInfoEntity()
.setId(orderInfo.getId())
.setDriverConfirmTime(LocalDateTime.now())
.setAuditStatus(auditStatus)
.setAuditStatus(AuditStatus.TongGuo)
.setTruckId(truckId)
.setOrderStatus(OrderStatus.YiJieDan)
.setOrderStatus(OrderStatus.QingYunZhong)
.setCertificateSn(certificateSn)
.setCheckStatus(CheckStatus.WeiKanLiao)
.setTransTime(LocalDateTime.now())
);
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());
UserEntity orderUserEntity = userService.getById(orderInfo.getUserId());
param.setCfCompanyName(orderUserEntity.getNickname());
OrderGoodsEntity entity = orderGoodsService.getById(orderInfo.getGoodsId());
param.setGoodsName(entity.getGoodsName());
BizCompanyEntity companyEntity = bizCompanyService.getById(orderInfo.getTransCompanyId());
param.setCompanyName(companyEntity.getCompanyName());
param.setCreateTime(orderInfo.getCreateTime());
Set<String> openId = new HashSet<>();
for (SysUserRoleEntity userRoleEntity : userIds) {
UserEntity userEntity = userService.getById(userRoleEntity.getUserId());
if (null != userEntity && !Strings.isNullOrEmpty(userEntity.getOpenid())) {
if (openId.add(userEntity.getOpenid())) {
param.setUserId(userRoleEntity.getUserId());
log.info("发送审核通知模板消息,参数:{}", param);
wechatTemplateMessageService.sendTemplateMessage(param);
}
} else {
log.info("未查到用户信息:{}", userRoleEntity.getUserId());
Assert.notNull(truckId, () -> Exceptions.clierr("订单未分配车辆"));
BizTruckEntity truckInfo = baseMapper.getTruckInfo(truckId);
Assert.notNull(truckInfo, () -> Exceptions.clierr("车辆不存在"));
String gpsId = truckInfo.getGps();
String licensePlate = truckInfo.getLicensePlate();
if (checkGps) {
Assert.notEmpty(gpsId, () -> Exceptions.clierr("车辆未绑定GPS"));
DeviceLocalizerEntity deviceLocalizerEntity = baseMapper.gpsLastOnlineTime(gpsId);
LocalDateTime lastTime = deviceLocalizerEntity.getLastTime();
boolean after = lastTime == null || lastTime.isBefore(LocalDateTime.now().minusMinutes(5));
if (after) {
bizWarnService.save(new BizWarnEntity()
.setWarnCategory(WarnCategory.EQUIPMENT.getVal())
.setWarnContent(StrUtil.format("{} 绑定的 GPS 设备已离线,设备号:{}", licensePlate, gpsId))
.setOrderId(orderInfo.getId())
);
return;
}
}
}
} catch (Exception e) {
log.error("通知失败", e);
}
startTrack(gpsId, licensePlate, orderInfo.getId(), truckId);
CompletableFuture.runAsync(() -> Websocket.publish(new WsMsg().setEvent("down/order/status_change")
.setData(MapUtil.builder()
.put("sn", orderInfo.getSn())
.put("licensePlate", licensePlate)
.put("orderStatus", OrderStatus.QingYunZhong)
.build()))).exceptionally(e -> {
log.error("订单状态改变事件发布失败,订单{},状态{}", orderInfo.getSn(), OrderStatus.QingYunZhong, e);
return null;
});
}
@Transactional(rollbackFor = Exception.class)
@ -927,6 +1011,11 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
Assert.notNull(orderInfo, () -> Exceptions.clierr("订单不存在"));
Assert.isTrue(orderInfo.getOrderStatus() == OrderStatus.YiJieDan, () -> Exceptions.clierr("当前订单状态,无法开始运输"));
Assert.isTrue(orderInfo.getAuditStatus() == AuditStatus.TongGuo, () -> Exceptions.clierr("当前订单未审核完成,无法开始运输"));
Long truckId = orderInfo.getTruckId();
Long driverId = orderInfo.getDriverId();
Boolean driverHasInProgress = baseMapper.hasInProgressOrder(driverId,
Arrays.asList(OrderStatus.QingYunZhong.getVal(), OrderStatus.YiJinChang.getVal(), OrderStatus.YiChuChang.getVal()));
Assert.isFalse(driverHasInProgress, () -> Exceptions.clierr("您有正在进行中的订单,不能清运"));
Long orderInfoId = orderInfo.getId();
OrderGoodsEntity entity = orderGoodsService.getById(orderInfo.getGoodsId());
@ -938,14 +1027,39 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
handleCompanyPay(orderInfo, Boolean.TRUE, new BigDecimal("0"), Boolean.FALSE);
}
baseMapper.busyDriver(driverId, Boolean.TRUE);
baseMapper.busyTruck(truckId, Boolean.TRUE);
// 查询站点企业信息,判断是否为站点且配置了非称重产品
Long stationId = orderInfo.getStationId();
BizCompanyEntity stationCompany = bizCompanyService.getById(stationId);
boolean isStationWithNoWeighGoods = stationCompany != null
&& Boolean.TRUE.equals(stationCompany.getStation())
&& CollUtil.isNotEmpty(stationCompany.getGoodsIds());
// 如果是站点且配置了非称重产品,则判断订单产品是否属于非称重产品
boolean isNoWeighProductOrder = false;
if (isStationWithNoWeighGoods) {
// 通过订单的 goodsId 查询 order_goods 表获取 origin_goods_id
OrderGoodsEntity orderGoods = orderGoodsService.getById(orderInfo.getGoodsId());
if (orderGoods != null) {
Long originGoodsId = orderGoods.getOriginGoodsId();
// 判断 originGoodsId 是否在企业的非称重产品 goodsIds 集合中
isNoWeighProductOrder = stationCompany.getGoodsIds()
.contains(originGoodsId.toString());
}
}
OrderStatus orderStatus = OrderStatus.QingYunZhong;
if (isNoWeighProductOrder) {
orderStatus = OrderStatus.YiJinChang;
}
this.updateById(new OrderInfoEntity()
.setId(orderInfoId)
.setCargoPhoto(startTransportOrderParam.getCargoPhoto())
.setOrderStatus(OrderStatus.QingYunZhong)
.setOrderStatus(orderStatus)
.setTransTime(LocalDateTime.now())
);
Long truckId = orderInfo.getTruckId();
Assert.notNull(truckId, () -> Exceptions.clierr("订单未分配车辆"));
BizTruckEntity truckInfo = baseMapper.getTruckInfo(truckId);
Assert.notNull(truckInfo, () -> Exceptions.clierr("车辆不存在"));
@ -1273,6 +1387,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
Long orderId = truckLeavingOrderParam.getOrderId();
OrderInfoEntity orderInfoEntity = this.getById(orderId);
Long truckId = orderInfoEntity.getTruckId();
boolean result = false;
try {
Assert.notNull(orderInfoEntity, () -> Exceptions.clierr("订单不存在"));
OrderStatus orderStatus = orderInfoEntity.getOrderStatus();
@ -1348,18 +1463,6 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
log.error("订单状态改变事件发布失败,订单{},状态{}", orderInfoEntity_.getSn(), newOrderStatus, e);
return null;
});
/* CompletableFuture.runAsync(() -> {
OrderPagingResult detail = this.detail(orderId);
HsoaResult<?> result = hsoaService.pushProvincialSave(detail);
if (result == null || !result.isSuccess()) {
Hsoa.relogin();
log.error("推送订单数据失败数据Id{}", entity.getId());
}
}).exceptionally(e -> {
log.error("推送订单数据失败数据Id{}", entity.getId(), e);
return null;
}); */
// 出厂付费
if (OrderCategory.PuTong.equals(orderInfoEntity.getOrderCategory()) && MoneyWay.OUT.getVal().equals(entity.getMoneyWay())) {
@ -1367,12 +1470,13 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
// updateOrderItems(orderInfoEntity.getId(), settleWeight, Boolean.FALSE);
// 扣费
return handleCompanyPay(orderInfoEntity, Boolean.FALSE, new BigDecimal("0"), Boolean.FALSE);
result = handleCompanyPay(orderInfoEntity, Boolean.FALSE, new BigDecimal("0"), Boolean.FALSE);
} else if (OrderCategory.DuanBoRu.equals(orderInfoEntity.getOrderCategory())) {
// 扣费
return handleCompanyPay(orderInfoEntity, Boolean.FALSE, new BigDecimal("0"), Boolean.FALSE);
result = handleCompanyPay(orderInfoEntity, Boolean.FALSE, new BigDecimal("0"), Boolean.FALSE);
}
OrderPagingResult detail = this.detail(orderId);
pushData(detail);
} finally {
if (orderInfoEntity.getOrderCategory() != OrderCategory.DuanBoChu) {
// 关闭 GPS
@ -1380,8 +1484,33 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
String gpsId = truckInfo.getGps();
stopTrack(gpsId);
}
}
return false;
return result;
}
public void pushData(OrderPagingResult detail) {
Long orderId = detail.getId();
List<String> routes = baseMapper.getRoute(orderId);
detail.setRoute(routes);
CompletableFuture.runAsync(() -> {
HsoaResult<?> result = hsoaService.pushProvincialSave(detail);
HsoaRecode hsoaRecode = new HsoaRecode()
.setOrderId(orderId)
.setOrderSn(detail.getSn())
.setLicensePlate(detail.getLicensePlate())
.setPushType(PushType.LianDan);
if (result == null || !result.isSuccess()) {
Hsoa.relogin();
log.error("推送订单数据失败数据Id{}", orderId);
hsoaService.save(hsoaRecode.setSuccess(Boolean.FALSE));
} else {
hsoaService.save(hsoaRecode.setSuccess(Boolean.TRUE));
}
}).exceptionally(e -> {
log.error("推送订单数据失败数据Id{}", orderId, e);
return null;
});
}
/**
@ -1931,10 +2060,19 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
.setAccStatus(1)
.setGpsTime(time)
.setLocationMode("WGS84");
HsoaRecode hsoaRecode = new HsoaRecode()
.setOrderId(orderInfoId)
.setOrderSn(orderDetail.getSn())
.setLicensePlate(licensePlate)
.setPushType(PushType.GuiJi);
HsoaResult<?> result = Hsoa.pushVehicleTrajectory(param);
if (result == null || !result.isSuccess()) {
Hsoa.relogin();
log.error("推送定位数据失败数据Id{}", entity.getId());
hsoaService.save(hsoaRecode.setSuccess(Boolean.FALSE));
} else {
hsoaService.save(hsoaRecode.setSuccess(Boolean.TRUE));
}
} catch (Exception e) {
log.error("推送定位数据失败数据Id{}", entity.getId(), e);
@ -2238,7 +2376,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
placeEntity.setArea(area);
placeEntity.setAreaName(areaName);
orderCargoPlaceService.updateById(placeEntity);
BizAuditConfigEntity bizAuditConfigEntity = bizAuditConfigService.getOne(Wrappers.lambdaQuery(BizAuditConfigEntity.class)
/* BizAuditConfigEntity bizAuditConfigEntity = bizAuditConfigService.getOne(Wrappers.lambdaQuery(BizAuditConfigEntity.class)
.eq(BizAuditConfigEntity::getArea, area));
try {
// 通知审核人
@ -2276,7 +2414,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
}
} catch (Exception e) {
log.error("通知失败", e);
}
} */
} else {
throw Exceptions.clierr("未查询到装货地址");
}
@ -2292,6 +2430,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
OrderInfoEntity orderInfo = this.getOne(Wrappers.<OrderInfoEntity>lambdaQuery().eq(OrderInfoEntity::getSn, orderSn));
Long orderId = orderInfo.getId();
OrderPagingResult detail = this.detail(orderId);
List<String> routes = baseMapper.getRoute(orderId);
detail.setRoute(routes);
HsoaResult<?> hsoaResult = hsoaService.pushProvincialSave(detail);
list.add(MapUtil.<String, Object>builder()
.put("result", hsoaResult)

View File

@ -89,7 +89,7 @@ public class PaymentServiceImpl implements PaymentService {
int receiverMoney = sharingAmount.multiply(BigDecimal.valueOf(100)).intValue();
receiversJson.append("{\"type\":\"MERCHANT_ID\",\"account\":\"").append(properties.getReceiverMchId()).append("\",")
.append("\"amount\":").append(receiverMoney)
.append(",\"description\":\"分账商户108\"}");
.append(",\"description\":\"系统分账108\"}");
receiversJson.append("]");
request.setReceivers(receiversJson.toString());
// 指定分账发生在收款子商户下
@ -254,7 +254,7 @@ public class PaymentServiceImpl implements PaymentService {
request.setReturnAccountType("MERCHANT_ID");
// 从分账商户回退
request.setReturnAccount(properties.getReceiverMchId());
request.setDescription("订单退款分账回退108");
request.setDescription("用户退款108");
// 设置回退金额(分)
int returnMoney = returnAmount.multiply(BigDecimal.valueOf(100)).intValue();
request.setReturnAmount(returnMoney);

View File

@ -2,7 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njzscloud.supervisory.biz.mapper.BizCompanyMapper">
<select id="paging" resultType="com.njzscloud.supervisory.biz.pojo.entity.BizCompanyEntity">
<resultMap id="CompanyResultMap" autoMapping="true" type="com.njzscloud.supervisory.biz.pojo.entity.BizCompanyEntity">
<result property="serviceScope" column="service_scope" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result property="goodsIds" column="goods_ids" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
</resultMap>
<select id="paging" resultMap="CompanyResultMap">
select a.*, b.biz_obj from biz_company a
left join sys_user b on b.id = a.user_id
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
@ -10,7 +14,7 @@
</if>
</select>
<select id="selectDetailWithBizObj" resultType="com.njzscloud.supervisory.biz.pojo.entity.BizCompanyEntity">
<select id="selectDetailWithBizObj" resultMap="CompanyResultMap">
select a.*, b.biz_obj
from biz_company a
left join sys_user b on b.id = a.user_id

View File

@ -7,6 +7,8 @@
<id column="company_id" property="id"/>
<result column="contacts_phone" property="phone"/>
<result column="audit_status" property="auditStatus" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="serviceScope" column="service_scope" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result property="goodsIds" column="goods_ids" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
<result column="idcard" property="idcard"/>
<result column="idcard_Start_Time" property="idcardStartTime"/>
<result column="idcard_end_time" property="idcardEndTime"/>
@ -57,7 +59,10 @@
c.idcard_Start_Time,
c.idcard_end_time,
c.idcard_front,
c.idcard_back
c.idcard_back,
c.enabled,
c.service_scope,
c.remark
FROM sys_user a
INNER JOIN sys_user_account b ON b.user_id = a.id AND b.deleted = 0
LEFT JOIN biz_company c ON c.user_id = a.id AND c.station = 0 AND c.deleted = 0

View File

@ -155,6 +155,7 @@
a.driver_confirm_time,
a.phone,
a.expect_time,
a.car_way,
a.estimated_quantity,
e.truck_license_date,
e.qualification_date truck_qualification_date,
@ -210,6 +211,7 @@
<result property="payerCategory" column="payer_category" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="paymentStatus" column="payment_status" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="moneyStrategy" column="money_strategy" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
<result property="carWay" column="car_way" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
</resultMap>
<resultMap id="OrderExportResultMap" type="com.njzscloud.supervisory.order.pojo.result.OrderExportResult">
@ -400,4 +402,26 @@
INNER JOIN goods_info t2 ON t2.id = t1.goods_id
INNER JOIN sys_district t3 ON t3.id = t1.area_code
</select>
<select id="driverIsBusy" resultType="java.lang.Boolean">
SELECT COUNT(*) > 0 busy
FROM biz_driver
WHERE busy = 0
AND id = #{driverId}
</select>
<select id="truckIsBusy" resultType="java.lang.Boolean">
SELECT COUNT(*) > 0 busy
FROM biz_truck
WHERE busy = 0
AND id = #{truckId}
</select>
<select id="hasInProgressOrder" resultType="java.lang.Boolean">
SELECT COUNT(*) > 0
FROM order_info
WHERE driver_id = #{driverId}
AND order_status IN
<foreach collection="orderStatuses" item="status" open="(" separator="," close=")">
#{status}
</foreach>
AND deleted = 0
</select>
</mapper>