|
@@ -16,6 +16,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollStreamUtil;
|
|
|
import cn.hutool.core.date.DatePattern;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.img.ImgUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -28,7 +29,9 @@ import com.alibaba.excel.write.metadata.style.WriteFont;
|
|
|
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
|
|
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
|
|
|
import com.alibaba.excel.write.style.row.AbstractRowHeightStyleStrategy;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import jakarta.annotation.Resource;
|
|
@@ -42,6 +45,7 @@ import vip.xiaonuo.biz.modular.bizappointmentrecord.entity.BizAppointmentRecord;
|
|
|
import vip.xiaonuo.biz.modular.bizappointmentrecord.service.BizAppointmentRecordService;
|
|
|
import vip.xiaonuo.biz.modular.bizorder.entity.BizOrder;
|
|
|
import vip.xiaonuo.biz.modular.bizorder.service.BizOrderService;
|
|
|
+import vip.xiaonuo.biz.modular.mq.MqttSubscribeClient;
|
|
|
import vip.xiaonuo.biz.modular.record.param.*;
|
|
|
import vip.xiaonuo.biz.modular.record.result.BizRecordExportResult;
|
|
|
import vip.xiaonuo.biz.modular.record.result.CarResult;
|
|
@@ -79,6 +83,9 @@ public class BizRecordServiceImpl extends ServiceImpl<BizRecordMapper, BizRecord
|
|
|
@Resource
|
|
|
private BizOrderService bizOrderService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private MqttSubscribeClient mqttSubscribeClient;
|
|
|
+
|
|
|
@Override
|
|
|
public Page<BizRecord> page(BizRecordPageParam bizRecordPageParam) {
|
|
|
QueryWrapper<BizRecord> queryWrapper = getQueryWrapper(bizRecordPageParam);
|
|
@@ -141,6 +148,7 @@ public class BizRecordServiceImpl extends ServiceImpl<BizRecordMapper, BizRecord
|
|
|
this.save(bizRecord);
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
@Override
|
|
|
public void push(BizRecordEditParam bizRecordEditParam) {
|
|
|
if(StringUtils.equals(bizRecordEditParam.getWeighingType(),"1")){
|
|
@@ -159,8 +167,12 @@ public class BizRecordServiceImpl extends ServiceImpl<BizRecordMapper, BizRecord
|
|
|
}
|
|
|
}else{
|
|
|
//二次过磅
|
|
|
- BizRecord bizRecord = this.queryEntity(bizRecordEditParam.getId());
|
|
|
- bizRecordEditParam.setId(null);
|
|
|
+ BizRecord bizRecord = this.getOne(new QueryWrapper<BizRecord>().lambda().eq(BizRecord::getRelationId,bizRecordEditParam.getId()));
|
|
|
+ if(ObjectUtil.isNull(bizRecord)){
|
|
|
+ throw new CommonException("未查询到过磅记录!");
|
|
|
+ }
|
|
|
+ bizRecordEditParam.setRelationId(bizRecordEditParam.getId());
|
|
|
+ bizRecordEditParam.setId(bizRecord.getId());
|
|
|
BeanUtil.copyProperties(bizRecordEditParam, bizRecord);
|
|
|
this.updateById(bizRecord);
|
|
|
|
|
@@ -183,7 +195,10 @@ public class BizRecordServiceImpl extends ServiceImpl<BizRecordMapper, BizRecord
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void edit(BizRecordEditParam bizRecordEditParam) {
|
|
|
- BizRecord bizRecord = this.queryEntity(bizRecordEditParam.getId());
|
|
|
+ BizRecord bizRecord = this.getOne(new QueryWrapper<BizRecord>().lambda().eq(BizRecord::getRelationId,bizRecordEditParam.getId()));
|
|
|
+ if(ObjectUtil.isNull(bizRecord)){
|
|
|
+ throw new CommonException("未查询到过磅记录!");
|
|
|
+ }
|
|
|
BeanUtil.copyProperties(bizRecordEditParam, bizRecord);
|
|
|
this.updateById(bizRecord);
|
|
|
}
|
|
@@ -497,6 +512,7 @@ public class BizRecordServiceImpl extends ServiceImpl<BizRecordMapper, BizRecord
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
@Override
|
|
|
public void confirmRecord(BizRecordIdParam bizRecordIdParam) {
|
|
|
//设置确认人
|
|
@@ -511,4 +527,34 @@ public class BizRecordServiceImpl extends ServiceImpl<BizRecordMapper, BizRecord
|
|
|
bizAppointmentRecordService.updateById(appointmentRecord);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void updateDriverSign(BizRecordEditParam bizRecordEditParam) {
|
|
|
+ BizRecord bizRecord = this.queryEntity(bizRecordEditParam.getId());
|
|
|
+ if(ObjectUtil.isEmpty(bizRecordEditParam.getDriverSign())){
|
|
|
+ throw new CommonException("司机签名不能为空!");
|
|
|
+ }
|
|
|
+ String driverSign = bizRecordEditParam.getDriverSign();
|
|
|
+ if(bizRecordEditParam.getDriverSign().contains(StrUtil.COMMA)) {
|
|
|
+ driverSign = StrUtil.split(driverSign, StrUtil.COMMA).get(1);
|
|
|
+ }
|
|
|
+ String base64 = ImgUtil.toBase64DataUri(ImgUtil.scale(ImgUtil.toImage(driverSign),
|
|
|
+ 100, 50, null), ImgUtil.IMAGE_TYPE_PNG);
|
|
|
+
|
|
|
+ bizRecord.setDriverSign(base64);
|
|
|
+ this.updateById(bizRecord);
|
|
|
+
|
|
|
+ //修改预约记录状态
|
|
|
+ BizAppointmentRecord appointmentRecord = bizAppointmentRecordService.getById(bizRecord.getAppointmentId());
|
|
|
+ if(ObjectUtil.isNotNull(appointmentRecord)){
|
|
|
+ //司机签名后修改为可入场状态
|
|
|
+ appointmentRecord.setStatus("9");
|
|
|
+ bizAppointmentRecordService.updateById(appointmentRecord);
|
|
|
+ }
|
|
|
+
|
|
|
+ //mqtt发送过磅记录id给地磅端,告诉地磅端可打印磅单,抬道闸
|
|
|
+ mqttSubscribeClient.publishMessage("hnzydb", bizRecord.getRelationId());
|
|
|
+
|
|
|
+ }
|
|
|
}
|