Compare commits
No commits in common. "hsf" and "master" have entirely different histories.
|
|
@ -5,4 +5,3 @@
|
|||
/**/.DS_Store
|
||||
/**/.back*
|
||||
db-model/*/
|
||||
/njzscloud-svr/docs
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ 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;
|
||||
|
|
@ -63,39 +62,6 @@ 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤销
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
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;
|
||||
|
|
@ -10,7 +9,6 @@ import lombok.experimental.Accessors;
|
|||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业信息
|
||||
|
|
@ -199,26 +197,4 @@ 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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
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;
|
||||
|
|
@ -163,11 +161,4 @@ public class ModifyBizCompanyParam {
|
|||
* 审核状态; 字典代码:audit_status
|
||||
*/
|
||||
private AuditStatus auditStatus;
|
||||
|
||||
/**
|
||||
* 非称重产品ids集合
|
||||
*/
|
||||
@TableField(typeHandler = JsonTypeHandler.class)
|
||||
private List<String> goodsIds;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,15 +41,4 @@ public class SearchCompanyParam {
|
|||
* 审核状态; 字典代码:audit_status
|
||||
*/
|
||||
private AuditStatus auditStatus;
|
||||
|
||||
/**
|
||||
* 企业是否可选; 0-->否、1-->是
|
||||
*/
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
private String area;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
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;
|
||||
|
|
@ -12,7 +10,6 @@ import lombok.experimental.Accessors;
|
|||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业信息
|
||||
|
|
@ -33,8 +30,6 @@ public class SearchCompanyResult {
|
|||
* 是否为站点; 0-->否、1-->是
|
||||
*/
|
||||
private Boolean station;
|
||||
|
||||
private Integer stationType;
|
||||
/**
|
||||
* 企业是否开启; 0-->否、1-->是
|
||||
*/
|
||||
|
|
@ -158,23 +153,4 @@ 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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,15 +191,11 @@ 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)
|
||||
|
|
|
|||
|
|
@ -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 ->
|
||||
|
|
|
|||
|
|
@ -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 ->
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
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;
|
||||
|
|
@ -9,7 +7,6 @@ import lombok.ToString;
|
|||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
|
@ -112,24 +109,4 @@ 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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -202,20 +202,10 @@ public class DeviceInfoService extends ServiceImpl<DeviceInfoMapper, DeviceInfoE
|
|||
* @param pageParam 分页参数
|
||||
* @return PageResult<DeviceInfoEntity> 分页结果
|
||||
*/
|
||||
|
||||
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()
|
||||
|
|
@ -346,6 +336,13 @@ 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()
|
||||
|
|
@ -444,9 +441,6 @@ 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)
|
||||
|
|
@ -516,7 +510,6 @@ 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);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ 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.*;
|
||||
|
|
@ -58,7 +57,6 @@ 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();
|
||||
|
|
@ -119,11 +117,7 @@ public class Hsoa {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized static void relogin() {
|
||||
if (StrUtil.isBlank(refTnt) || StrUtil.isBlank(tnt)) {
|
||||
log.info("无需重置登录TOKEN");
|
||||
return;
|
||||
}
|
||||
public static void relogin() {
|
||||
try {
|
||||
wlock.lock();
|
||||
log.info("重置登录TOKEN");
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -1,11 +1,7 @@
|
|||
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;
|
||||
|
|
@ -13,8 +9,6 @@ import com.njzscloud.supervisory.hsoa.service.HsoaService;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/hsoa")
|
||||
|
|
@ -34,19 +28,4 @@ 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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
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> {
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -1,39 +1,17 @@
|
|||
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;
|
||||
|
||||
|
|
@ -42,12 +20,120 @@ import static com.njzscloud.supervisory.hsoa.pojo.param.PushProvincialUploadPara
|
|||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class HsoaService extends ServiceImpl<HsoaMapper, HsoaRecode> implements IService<HsoaRecode> {
|
||||
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 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")))
|
||||
|
|
@ -145,7 +231,7 @@ public class HsoaService extends ServiceImpl<HsoaMapper, HsoaRecode> implements
|
|||
.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(CollUtil.isEmpty(route) ? "" : String.join("-", route))
|
||||
// .setRoute("")
|
||||
.setSuperviseUnitName(detail.getAreaName())
|
||||
.setTransportDateRange(detail.getTransTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + "-" + detail.getOutTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
|
||||
.setTransportStartDate(detail.getTransTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
|
||||
|
|
@ -153,13 +239,14 @@ public class HsoaService extends ServiceImpl<HsoaMapper, HsoaRecode> implements
|
|||
.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) {
|
||||
if (CollUtil.isEmpty(urls)) return null;
|
||||
return null;
|
||||
/* if (CollUtil.isEmpty(urls)) return null;
|
||||
String url = urls.get(0);
|
||||
if (StrUtil.isBlank(url)) return null;
|
||||
url = url.substring(1);
|
||||
|
|
@ -175,28 +262,15 @@ public class HsoaService extends ServiceImpl<HsoaMapper, HsoaRecode> implements
|
|||
.setUploadPath(uploadPath)
|
||||
);
|
||||
if (upload.isSuccess()) {
|
||||
log.info("图片:{}、{}", uploadPath, upload.getUrl());
|
||||
return upload.getUrl();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("上传失败", e);
|
||||
return null;
|
||||
throw new RuntimeException(e);
|
||||
} 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)
|
||||
));
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ public class OrderInfoController {
|
|||
|| orderCategory == OrderCategory.DuanBoChu
|
||||
, "订单类型必须是普通订单、短驳出");
|
||||
Integer truckCount = addOrderInfoParam.getTruckCount();
|
||||
Assert.isTrue(truckCount != null && truckCount > 0, "车辆数量必须大于0");
|
||||
Assert.isTrue(truckCount != null && truckCount > 0 && truckCount <= 10, "车辆数量必须大于0小于等于10");
|
||||
Integer estimatedQuantity = addOrderInfoParam.getEstimatedQuantity();
|
||||
if (estimatedQuantity != null && estimatedQuantity > 0) {
|
||||
addOrderInfoParam.setEstimatedQuantity(estimatedQuantity / truckCount);
|
||||
|
|
@ -151,15 +151,6 @@ public class OrderInfoController {
|
|||
return R.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量审核
|
||||
*/
|
||||
@PostMapping("/batch_audit")
|
||||
public R<?> batchAudit(@RequestBody BatchAuditOrderParam param) {
|
||||
orderInfoService.batchAudit(param);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 看料
|
||||
*/
|
||||
|
|
@ -178,28 +169,6 @@ 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机确认接单
|
||||
*
|
||||
|
|
|
|||
|
|
@ -56,10 +56,4 @@ 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@ 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.*;
|
||||
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 lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
|
@ -309,9 +312,4 @@ public class OrderInfoEntity {
|
|||
*/
|
||||
private BigDecimal changeMoney;
|
||||
|
||||
/**
|
||||
* 派车方式:项目-->project 平台-->platform 自选-->optional
|
||||
*/
|
||||
private CarWay carWay;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ 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;
|
||||
|
|
@ -74,11 +73,6 @@ public class AddOrderInfoParam implements Constrained {
|
|||
*/
|
||||
private Long targetOrderId;
|
||||
|
||||
/**
|
||||
* 派车方式:项目-->project 平台-->platform 自选-->optional
|
||||
*/
|
||||
private CarWay carWay;
|
||||
|
||||
/**
|
||||
* 订单类型; 字典代码:order_category
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -26,6 +26,11 @@ public class OrderExportResult {
|
|||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String sn;
|
||||
|
||||
/**
|
||||
* 清运时间(日期)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -544,9 +544,4 @@ public class OrderPagingResult {
|
|||
private Double stationLat;
|
||||
private List<String> route;
|
||||
// endregion
|
||||
|
||||
/**
|
||||
* 派车方式:项目-->project 平台-->platform 自选-->optional
|
||||
*/
|
||||
private CarWay carWay;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,5 @@
|
|||
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;
|
||||
|
|
@ -21,7 +15,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;
|
||||
|
|
@ -44,8 +38,6 @@ 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;
|
||||
|
|
@ -65,21 +57,19 @@ 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.dto.RefundRequestDto;
|
||||
// import com.njzscloud.supervisory.wxPay.param.TemplateMessageParam;
|
||||
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.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;
|
||||
|
|
@ -88,7 +78,10 @@ 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;
|
||||
|
||||
|
|
@ -116,13 +109,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;
|
||||
|
|
@ -138,7 +131,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);
|
||||
|
|
@ -184,7 +177,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());
|
||||
|
|
@ -194,7 +187,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
wechatTemplateMessageService.sendTemplateMessage(param);
|
||||
} catch (Exception e) {
|
||||
log.error("通知失败", e);
|
||||
} */
|
||||
}
|
||||
} else {
|
||||
cloudVoiceboxService.play(1L, "您有新的待分配订单,请及时处理");
|
||||
}
|
||||
|
|
@ -511,15 +504,11 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
if (CollUtil.isEmpty(areaList) && CollUtil.isEmpty(cityList) && CollUtil.isEmpty(cityAreaList)) {
|
||||
return PageResult.of(pageParam.toPage());
|
||||
}
|
||||
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"));
|
||||
}
|
||||
page.addOrder(OrderItem.desc("a.create_time"));
|
||||
QueryWrapper<OrderPagingResult> ew = Wrappers.query();
|
||||
AuditStatus auditStatus = orderPagingSearchParam.getAuditStatus();
|
||||
if (Boolean.TRUE.equals(orderPagingSearchParam.getIsCertificatePaging())) {
|
||||
ew.isNotNull("a.certificate_sn");
|
||||
}
|
||||
|
|
@ -608,20 +597,6 @@ 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());
|
||||
|
|
@ -717,29 +692,22 @@ 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)) {
|
||||
|
|
@ -754,7 +722,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
}
|
||||
} catch (Exception e) {
|
||||
log.error("通知失败", e);
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
@ -765,80 +733,17 @@ 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());
|
||||
this.updateById(new OrderInfoEntity()
|
||||
.setId(orderId)
|
||||
.setCheckPhoto(checkGoodsParam.getCheckPhoto())
|
||||
.setCheckTime(LocalDateTime.now())
|
||||
.setCheckStatus(CheckStatus.YiKanLiao)
|
||||
.setCheckerId(SecurityUtil.currentUserId())
|
||||
);
|
||||
|
||||
// 如果是站点且配置了非称重产品,则判断订单产品是否属于非称重产品
|
||||
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)
|
||||
.setCheckPhoto(checkGoodsParam.getCheckPhoto())
|
||||
.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())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
// truckLeaving(new TruckLeavingOrderParam().setOrderId(orderId), 0);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
@ -872,7 +777,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) {
|
||||
|
|
@ -890,7 +795,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());
|
||||
|
|
@ -904,7 +809,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
wechatTemplateMessageService.sendTemplateMessage(param);
|
||||
} catch (Exception e) {
|
||||
log.error("通知失败", e);
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
private boolean assignmentTrafficCompany(AssignmentOrderParam assignmentOrderParam,
|
||||
|
|
@ -924,7 +829,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());
|
||||
|
|
@ -937,7 +842,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
wechatTemplateMessageService.sendTemplateMessage(param);
|
||||
} catch (Exception e) {
|
||||
log.error("通知失败", e);
|
||||
} */
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -950,59 +855,70 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
long userId = SecurityUtil.currentUserId();
|
||||
Long driverId_ = baseMapper.getDriverId(userId);
|
||||
Assert.isTrue(driverId_ != null && driverId == driverId_, () -> Exceptions.clierr("您没有权限确认此单"));
|
||||
|
||||
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);
|
||||
OrderCargoPlaceEntity cargoPlaceEntity = orderCargoPlaceService.getById(orderInfo.getCargoPlaceId());
|
||||
String area = cargoPlaceEntity.getArea();
|
||||
BizAuditConfigEntity bizAuditConfigEntity = bizAuditConfigService.getOne(Wrappers.lambdaQuery(BizAuditConfigEntity.class).eq(BizAuditConfigEntity::getArea, area));
|
||||
|
||||
String certificateSn = SnUtil.next(CERTIFICATE_SN_CODE);
|
||||
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;
|
||||
}
|
||||
}
|
||||
this.updateById(new OrderInfoEntity()
|
||||
.setId(orderInfo.getId())
|
||||
.setDriverConfirmTime(LocalDateTime.now())
|
||||
.setAuditStatus(AuditStatus.TongGuo)
|
||||
.setAuditStatus(auditStatus)
|
||||
.setTruckId(truckId)
|
||||
.setOrderStatus(OrderStatus.QingYunZhong)
|
||||
.setCertificateSn(certificateSn)
|
||||
.setCheckStatus(CheckStatus.WeiKanLiao)
|
||||
.setTransTime(LocalDateTime.now())
|
||||
.setOrderStatus(OrderStatus.YiJieDan)
|
||||
);
|
||||
|
||||
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;
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
} 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)
|
||||
|
|
@ -1011,11 +927,6 @@ 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());
|
||||
|
|
@ -1027,39 +938,14 @@ 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)
|
||||
.setOrderStatus(OrderStatus.QingYunZhong)
|
||||
.setTransTime(LocalDateTime.now())
|
||||
);
|
||||
|
||||
Long truckId = orderInfo.getTruckId();
|
||||
Assert.notNull(truckId, () -> Exceptions.clierr("订单未分配车辆"));
|
||||
BizTruckEntity truckInfo = baseMapper.getTruckInfo(truckId);
|
||||
Assert.notNull(truckInfo, () -> Exceptions.clierr("车辆不存在"));
|
||||
|
|
@ -1387,7 +1273,6 @@ 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();
|
||||
|
|
@ -1463,6 +1348,18 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
log.error("订单状态改变事件发布失败,订单{},状态{}", orderInfoEntity_.getSn(), newOrderStatus, e);
|
||||
return null;
|
||||
});
|
||||
/* CompletableFuture.runAsync(() -> {
|
||||
OrderPagingResult detail = this.detail(orderId);
|
||||
HsoaResult<?> result = hsoaService.pushProvincialSave(detail);
|
||||
|
||||
if (result == null || !result.isSuccess()) {
|
||||
Hsoa.relogin();
|
||||
log.error("推送订单数据失败,数据Id:{}", entity.getId());
|
||||
}
|
||||
}).exceptionally(e -> {
|
||||
log.error("推送订单数据失败,数据Id:{}", entity.getId(), e);
|
||||
return null;
|
||||
}); */
|
||||
|
||||
// 出厂付费
|
||||
if (OrderCategory.PuTong.equals(orderInfoEntity.getOrderCategory()) && MoneyWay.OUT.getVal().equals(entity.getMoneyWay())) {
|
||||
|
|
@ -1470,13 +1367,12 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
// updateOrderItems(orderInfoEntity.getId(), settleWeight, Boolean.FALSE);
|
||||
|
||||
// 扣费
|
||||
result = handleCompanyPay(orderInfoEntity, Boolean.FALSE, new BigDecimal("0"), Boolean.FALSE);
|
||||
return handleCompanyPay(orderInfoEntity, Boolean.FALSE, new BigDecimal("0"), Boolean.FALSE);
|
||||
} else if (OrderCategory.DuanBoRu.equals(orderInfoEntity.getOrderCategory())) {
|
||||
// 扣费
|
||||
result = handleCompanyPay(orderInfoEntity, Boolean.FALSE, new BigDecimal("0"), Boolean.FALSE);
|
||||
return handleCompanyPay(orderInfoEntity, Boolean.FALSE, new BigDecimal("0"), Boolean.FALSE);
|
||||
}
|
||||
OrderPagingResult detail = this.detail(orderId);
|
||||
pushData(detail);
|
||||
|
||||
} finally {
|
||||
if (orderInfoEntity.getOrderCategory() != OrderCategory.DuanBoChu) {
|
||||
// 关闭 GPS
|
||||
|
|
@ -1484,33 +1380,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
String gpsId = truckInfo.getGps();
|
||||
stopTrack(gpsId);
|
||||
}
|
||||
|
||||
}
|
||||
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;
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2060,19 +1931,10 @@ 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);
|
||||
|
|
@ -2376,7 +2238,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 {
|
||||
// 通知审核人
|
||||
|
|
@ -2414,7 +2276,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
}
|
||||
} catch (Exception e) {
|
||||
log.error("通知失败", e);
|
||||
} */
|
||||
}
|
||||
} else {
|
||||
throw Exceptions.clierr("未查询到装货地址");
|
||||
}
|
||||
|
|
@ -2430,8 +2292,6 @@ 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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
<!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">
|
||||
<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 id="paging" resultType="com.njzscloud.supervisory.biz.pojo.entity.BizCompanyEntity">
|
||||
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 != ''">
|
||||
|
|
@ -14,7 +10,7 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectDetailWithBizObj" resultMap="CompanyResultMap">
|
||||
<select id="selectDetailWithBizObj" resultType="com.njzscloud.supervisory.biz.pojo.entity.BizCompanyEntity">
|
||||
select a.*, b.biz_obj
|
||||
from biz_company a
|
||||
left join sys_user b on b.id = a.user_id
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@
|
|||
<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"/>
|
||||
|
|
@ -59,10 +57,7 @@
|
|||
c.idcard_Start_Time,
|
||||
c.idcard_end_time,
|
||||
c.idcard_front,
|
||||
c.idcard_back,
|
||||
c.enabled,
|
||||
c.service_scope,
|
||||
c.remark
|
||||
c.idcard_back
|
||||
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
|
||||
|
|
|
|||
|
|
@ -155,7 +155,6 @@
|
|||
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,
|
||||
|
|
@ -211,7 +210,6 @@
|
|||
<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">
|
||||
|
|
@ -402,26 +400,4 @@
|
|||
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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue