Browse Source

车辆导入

qzyReal 2 years ago
parent
commit
6bd7e1a4fb

+ 1 - 6
sp-admin/sa-view/car/tb-business-car-list.html

@@ -37,12 +37,7 @@
 							<el-button type="primary" @click="checkFn(s.row)">查看</el-button>
 						</template>
 					</el-table-column>
-					<el-table-column label="预交停车费">
-						<template slot-scope="s">
-							<label>{{s.row.basePartMoney}}</label>
-						</template>
-					</el-table-column>
-					<el-table-column label="已交费用">
+					<el-table-column label="停车费">
 						<template slot-scope="s">
 							<label v-if="s.row.money">{{s.row.money}}</label>
 							<label v-else>-</label>

+ 1 - 1
sp-admin/sa-view/tb-business-car/tb-business-car-info.html

@@ -41,7 +41,7 @@
 									<label v-if="m.isLock==1">锁定</label>
 									<label v-else>正常</label>
 								</sa-info>
-									<sa-info type="img" name="离场图片" :value="m.outImage" br></sa-info>
+								<sa-info type="img" name="离场图片" :value="m.outImage" br></sa-info>
 							</el-col>
 						</el-row>
 					</el-form>

+ 2 - 7
sp-admin/sa-view/tb-business-car/tb-business-car-list.html

@@ -46,15 +46,10 @@
 					<sa-td name="联系号码" prop="driverPhone"></sa-td>
 					<sa-td name="入场时间" prop="realInTime" width=180></sa-td>
 					<sa-td name="离场时间" prop="realOutTime" width=180></sa-td>
-					<el-table-column label="预交停车费">
-						<template slot-scope="s">
-							<label>{{s.row.basePartMoney}}</label>
-						</template>
-					</el-table-column>
-					<el-table-column label="实际停车费">
+					<el-table-column label="停车费">
 						<template slot-scope="s">
 							<label v-if="s.row.money">{{s.row.money}}</label>
-							<label v-else>未计算</label>
+							<label v-else>-</label>
 						</template>
 					</el-table-column>
 					<el-table-column label="操作" width="200px">

+ 3 - 2
sp-admin/sa-view/tb-car/tb-car-list.html

@@ -46,7 +46,7 @@
 				<!--				<el-button type="success" icon="el-icon-view" @click="getBySelect()">查看</el-button>-->
 				<el-button type="danger" icon="el-icon-delete" @click="deleteByIds()" v-if="sa.isAuth('tb-car-del')">删除
 				</el-button>
-				
+
 				<!-- ------------- 数据列表 ------------- -->
 				<el-table class="data-table" ref="data-table" :data="dataList" style="margin-top: 10px;">
 					<sa-td type="selection"></sa-td>
@@ -76,6 +76,7 @@
 						:on-success="successFn" :on-error="errorFn" :action="sa.cfg.api_url+'/TbCar/importExcel'">
 						<i class="el-icon-upload"></i>
 						<div class="el-upload__text">选择excel文档</em></div>
+						<div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div>
 					</el-upload>
 				</div>
 				<span slot="footer" class="dialog-footer">
@@ -112,7 +113,7 @@
 				},
 				methods: {
 					importTemplate() {
-						window.location.href = '../../static/excel/批量导入车辆.xlsx';
+						window.location.href = '../../static/excel/car-import.xlsx';
 					},
 					importFn() {
 						Object.assign(this.modal, {

+ 0 - 0
sp-admin/static/excel/批量导入车辆.xlsx → sp-admin/static/excel/car-import.xlsx


+ 1 - 1
sp-server/app.pid

@@ -1 +1 @@
-32340
+17080

+ 0 - 1
sp-server/src/main/java/com/pj/api/h5/ApiController.java

@@ -105,7 +105,6 @@ public class ApiController {
     public AjaxJson searchPartCar(String carNo) {
         carNo=carNo.toUpperCase();
         List<TbBusinessCar> list = apiService.searchPartCar(carNo);
-
         return AjaxJson.getSuccessData(list);
     }
 

+ 58 - 0
sp-server/src/main/java/com/pj/api/open/service/CoverBase64ToImageTask.java

@@ -0,0 +1,58 @@
+package com.pj.api.open.service;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.img.ImgUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.RandomUtil;
+import cn.hutool.extra.spring.SpringUtil;
+import com.pj.current.config.SystemObject;
+import com.pj.current.task.Task;
+import com.pj.project.tb_business_car.TbBusinessCar;
+import com.pj.project.tb_business_car.TbBusinessCarService;
+import com.pj.project4sp.uploadfile.UploadConfig;
+import com.pj.utils.ImageUtils;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+
+import javax.annotation.Resource;
+import java.io.File;
+
+@Slf4j
+public class CoverBase64ToImageTask extends Task {
+    private String carId;
+    private String imageData;
+    private int inOrOut;
+
+    public CoverBase64ToImageTask(String id, long delayInMilliseconds, String carId, String imageData, int inOrOut) {
+        super(id, delayInMilliseconds);
+        this.carId = carId;
+        this.imageData = imageData;
+        this.inOrOut = inOrOut;
+    }
+
+    @Override
+    public void run() {
+        UploadConfig uploadConfig = SpringUtil.getBean(UploadConfig.class);
+        TbBusinessCarService tbBusinessCarService = SpringUtil.getBean(TbBusinessCarService.class);
+        String flieTypeFolder = "/channel/";
+        String currDateFolder = DateUtil.today();
+        String fileName = RandomUtil.randomString(32) + ".jpg";
+        String imgFilePath = new File(uploadConfig.rootFolder).getAbsolutePath() + "/" +
+                uploadConfig.httpPrefix + flieTypeFolder + currDateFolder + "/";
+        if (!FileUtil.exist(imgFilePath)){
+            FileUtil.mkdir(imgFilePath);
+        }
+        // 对外暴露的http路径
+        String httpUrl = SystemObject.config.getDomain() + uploadConfig.httpPrefix + flieTypeFolder + currDateFolder + "/" + fileName;
+        ImageUtils.generateImage(imageData, imgFilePath + fileName);
+        TbBusinessCar tbBusinessCar = tbBusinessCarService.getById(carId);
+        if (tbBusinessCar != null) {
+            if (inOrOut == 1) {
+                tbBusinessCar.setInImage(httpUrl);
+            } else {
+                tbBusinessCar.setOutImage(httpUrl);
+            }
+        }
+        tbBusinessCarService.updateById(tbBusinessCar);
+    }
+}

+ 34 - 9
sp-server/src/main/java/com/pj/api/open/service/OpenService.java

@@ -3,10 +3,15 @@ package com.pj.api.open.service;
 import cn.hutool.cache.CacheUtil;
 import cn.hutool.cache.impl.TimedCache;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.img.ImgUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
 import com.pj.api.open.ResultJson;
 import com.pj.api.open.bo.CheckCarNumberBO;
 import com.pj.constants.UserTypeEnum;
+import com.pj.current.config.SystemObject;
+import com.pj.current.task.TaskService;
 import com.pj.project.tb_business.BusinessMessageManager;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
@@ -17,15 +22,20 @@ import com.pj.project.tb_business_item.TbBusinessItem;
 import com.pj.project.tb_business_item.TbBusinessItemService;
 import com.pj.project.tb_car.TbCar;
 import com.pj.project.tb_car.TbCarService;
+import com.pj.project4sp.uploadfile.UploadConfig;
 import com.pj.utils.cache.RedisUtil;
 import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import sun.misc.BASE64Decoder;
 
 import javax.annotation.Resource;
 import javax.xml.crypto.Data;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
@@ -46,6 +56,9 @@ public class OpenService {
     @Resource
     private TbCarService tbCarService;
 
+    @Resource
+    TaskService taskService;
+
     private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
 
 
@@ -65,16 +78,18 @@ public class OpenService {
         carNo = carNo.toUpperCase();
         TbBusinessCar tbBusinessCar = tbBusinessCarService.findTheLastRecord(carNo);
         Date now = new Date();
-        checkFree(carNo, 1, now);
+        TbCar tbCar = tbCarService.findByCardNo(carNo);
         if (tbBusinessCar == null || (tbBusinessCar.getRealInTime() != null && tbBusinessCar.getRealOutTime() != null)) {
             tbBusinessCar = new TbBusinessCar();
-            tbBusinessCar.setCarNo(carNo).setPay(0).setCarSize(3D).setIsLock(0).setInImage(image)
+            tbBusinessCar.setCarNo(carNo).setPay(0).setCarSize(3D).setIsLock(0).setCarCompany(tbCar!=null?tbCar.getCustomerName():"临时")
                     .setInChannel(channel).setRealInTime(now).setBasePartMoney(new BigDecimal("0"));
             tbBusinessCarService.save(tbBusinessCar);
+            CoverBase64ToUrl(image, tbBusinessCar.getId(), 1);
             return;
         }
-        tbBusinessCar.setRealInTime(now).setInChannel(channel).setInImage(image);
+        tbBusinessCar.setRealInTime(now).setInChannel(channel).setCarCompany(tbCar!=null?tbCar.getCustomerName():"临时");
         tbBusinessCarService.saveOrUpdate(tbBusinessCar);
+        CoverBase64ToUrl(image, tbBusinessCar.getId(), 1);
         if (!CAR_LIST.contains(carNo)) {
             TbBusiness tbBusiness = tbBusinessService.getById(tbBusinessCar.getBusinessId());
             if (tbBusiness != null) {
@@ -85,6 +100,11 @@ public class OpenService {
 
     }
 
+    private void CoverBase64ToUrl(String base64image, String carId, int inOrOut) {
+        taskService.addTask(new CoverBase64ToImageTask("=======" + carId + "", 2000, carId, base64image, inOrOut));
+
+    }
+
     private ResultJson handlerOut(String carNo, String channel, String image) {
         carNo = carNo.toUpperCase();
         TbBusinessCar tbBusinessCar = tbBusinessCarService.findNotOutCar(carNo);
@@ -93,26 +113,30 @@ public class OpenService {
         }
         Date now = new Date();
         if (checkFree(carNo, 2, now)) {
-            tbBusinessCar.setRealOutTime(now).setOutImage(image);
+            tbBusinessCar.setRealOutTime(now);
             tbBusinessCarService.updateById(tbBusinessCar);
+            CoverBase64ToUrl(image, tbBusinessCar.getId(), 2);
             return ResultJson.success();
         }
         if (tbBusinessCar.getIsLock() == 1) {
             return ResultJson.error("车辆已锁定");
         }
-
         String businessId = tbBusinessCar.getBusinessId();
-        BigDecimal price = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now, StrUtil.isNotEmpty(businessId));
+        BigDecimal price =new BigDecimal("0");
+        if (CAR_LIST.contains(carNo.substring(0,1))){
+             price = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now);
+        }
         double dif = price.subtract(tbBusinessCar.getMoney()).doubleValue();
         if (dif > 0) {
-            tbBusinessCar.setPay(0).setOutImage(image);
+            tbBusinessCar.setPay(0);
             tbBusinessCarService.updateById(tbBusinessCar);
             RedisUtil.set(channel, carNo);
             return ResultJson.error("请缴停车费" + dif + "元");
         }
         if (StrUtil.isEmpty(businessId)) {
-            tbBusinessCar.setRealOutTime(now).setOutChannel(channel).setOutImage(image);
+            tbBusinessCar.setRealOutTime(now).setOutChannel(channel);
             tbBusinessCarService.updateById(tbBusinessCar);
+            CoverBase64ToUrl(image, tbBusinessCar.getId(), 2);
             return ResultJson.success();
         }
         TbBusiness business = tbBusinessService.getById(businessId);
@@ -132,8 +156,9 @@ public class OpenService {
         if (TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(business.getBusinessType()) && !business.getItemPrice().equals(itemPayPrice)) {
             return ResultJson.error("请缴纳业务费用");
         }
-        tbBusinessCar.setRealOutTime(now).setOutChannel(channel).setOutImage(image);
+        tbBusinessCar.setRealOutTime(now).setOutChannel(channel);
         tbBusinessCarService.updateById(tbBusinessCar);
+        CoverBase64ToUrl(image, tbBusinessCar.getId(), 2);
         return ResultJson.success();
     }
 

+ 9 - 7
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -24,6 +24,8 @@ import com.pj.project.tb_business_car.TbBusinessCar;
 import com.pj.project.tb_business_car.TbBusinessCarService;
 import com.pj.project.tb_business_item.TbBusinessItem;
 import com.pj.project.tb_business_item.TbBusinessItemService;
+import com.pj.project.tb_car.TbCar;
+import com.pj.project.tb_car.TbCarService;
 import com.pj.project.tb_costomer.TbCostomer;
 import com.pj.project.tb_costomer.TbCostomerService;
 import com.pj.project.tb_declare.TbDeclare;
@@ -94,7 +96,7 @@ public class ApiService {
     @Resource
     private MyConfig myConfig;
     @Resource
-    private PartConfig partConfig;
+    private TbCarService tbCarService;
 
     private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
 
@@ -155,7 +157,7 @@ public class ApiService {
             return result;
         }
         Date now = new Date();
-        BigDecimal price = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now,StrUtil.isNotEmpty(tbBusinessCar.getBusinessId()));
+        BigDecimal price = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now);
         BigDecimal dif = price.subtract(tbBusinessCar.getMoney());
         Map<String, Object> car = new HashMap<>();
         car.put("id", tbBusinessCar.getId());
@@ -263,7 +265,8 @@ public class ApiService {
             throw new BusinessException("该车辆有未完成作业");
         }
         db = new TbBusinessCar();
-        db.setCarNo(carNo).setIsLock(0);
+        TbCar tbCar = tbCarService.findByCardNo(carNo);
+        db.setCarNo(carNo).setIsLock(0).setCarCompany(tbCar!=null?tbCar.getCustomerName():"临时");
         TbBusiness tbBusiness = new TbBusiness();
         if (StpUserUtil.isLogin()) {
             String customerId = StpUserUtil.getCustomerId();
@@ -289,12 +292,11 @@ public class ApiService {
             itemList.add(item);
             index++;
         }
-        BigDecimal initCarPartMoney = partConfig.getBasePrice();
-        tbBusiness.setPartMoney(initCarPartMoney)
+//        BigDecimal initCarPartMoney = partConfig.getBasePrice();
+        tbBusiness
                 .setNo(no).setGoodsName(carType)
                 .setCreateTime(new Date()).setBusinessType(TbBusiness.BusinessType.CAR_DISINCLE.getCode())
-                .setItemPrice(price)
-                .setTotalMoney(price.add(initCarPartMoney));
+                .setItemPrice(price);
         String prefix = carNo.substring(0, 1);
         if (CAR_LIST.contains(prefix)) {
             tbBusiness.setChinaCarNo(carNo);

+ 18 - 19
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -122,6 +122,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     WxService wxService;
     @Resource
     MyConfig myConfig;
+    private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
 
 
     public TbBusiness checkCarNo(String carNo) {
@@ -208,8 +209,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             if (car != null) {
                 tbBusinessCar.setId(car.getId()).setRealInTime(car.getRealInTime());
             }
+            TbCar tbCar = tbCarService.findByCardNo(carNo);
             tbBusinessCar.setBusinessId(t.getId());
-            tbBusinessCar.setCarNo(carNo);
+            tbBusinessCar.setCarNo(carNo).setCarCompany(tbCar!=null?tbCar.getCustomerName():"临时");
             tbBusinessCar.setBusinessId(t.getId()).setCustomerId(t.getCustomerId());
         });
         String yueCarNo = t.getCardNo().toUpperCase();
@@ -223,11 +225,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         yueCar.setBusinessId(t.getId()).setCarSize(t.getCardSize()).setCarNo(yueCarNo).setCustomerId(t.getCustomerId());
         carList.add(yueCar);
         tbBusinessCarService.saveOrUpdateBatch(carList);
-        BigDecimal initCarPartMoney = partConfig.getBasePrice();
+//        BigDecimal initCarPartMoney = partConfig.getBasePrice();
         t.setItemPrice(price)
-                .setTotalMoney(price.add(initCarPartMoney.multiply(new BigDecimal(carList.size()))))
-                .setChinaPartMoney(initCarPartMoney.multiply(new BigDecimal(carList.size() - 1)))
-                .setPartMoney(initCarPartMoney);
+                .setTotalMoney(price);
         this.saveOrUpdate(t);
         if (StrUtil.isNotEmpty(t.getDeclareNo())) {
             TbDeclare tbDeclare = tbDeclareService.findByDeclareNo(t.getDeclareNo());
@@ -405,6 +405,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     }
 
     @Async
+    @Deprecated
     public void calculationPartMoney(String itemType, TbBusiness tbBusiness) {
         Date iTime = tbBusiness.getRealInTime();
         Date oTime = tbBusiness.getOutDayTime();
@@ -412,7 +413,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             iTime = tbBusiness.getChinaCarInTime();
             oTime = tbBusiness.getChinaCarOutTime();
         }
-        BigDecimal price = calculationPartMoney(iTime, oTime, true);
+        BigDecimal price = calculationPartMoney(iTime, oTime);
         if (itemType.contains("中国")) {
             int len = tbBusiness.getCardNo().split(" ").length;
             tbBusiness.setChinaPartMoney(price.multiply(new BigDecimal(len)));
@@ -422,7 +423,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         tbBusiness.setTotalMoney(tbBusiness.getItemPrice().add(tbBusiness.getChinaPartMoney()).add(tbBusiness.getPartMoney()));
     }
 
-    public BigDecimal calculationPartMoney(Date iTime, Date oTime, boolean businessCar) {
+    public BigDecimal calculationPartMoney(Date iTime, Date oTime) {
         LocalDateTime inDayTime = iTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
         LocalDateTime outDayTime = oTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
         long minutes = ChronoUnit.MINUTES.between(inDayTime, outDayTime);
@@ -431,15 +432,13 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             return zero;
         }
         long days = ChronoUnit.DAYS.between(inDayTime.toLocalDate(), outDayTime.toLocalDate());
-        long hour = ChronoUnit.HOURS.between(inDayTime, outDayTime);
-        BigDecimal basePrice = businessCar ? partConfig.getBasePrice() : new BigDecimal("0");
         BigDecimal p = partConfig.getBasePrice();//乘积因子
         BigDecimal extraPrice = partConfig.getExtraPrice();
-        BigDecimal unit = new BigDecimal(hour / 24);
-        if (minutes > partConfig.getFreeMinutes() && minutes < 24 * 60) {
-            unit = new BigDecimal("1");
+        int unit = (int) Math.ceil(NumberUtil.div(minutes, 24 * 60));
+        if (minutes < partConfig.getFreeMinutes()) {
+            unit = 0;
         }
-        return basePrice.add(p.multiply(unit)).add(new BigDecimal(days).multiply(extraPrice));
+        return p.multiply(new BigDecimal(unit)).add(new BigDecimal(days).multiply(extraPrice));
     }
 
 
@@ -480,14 +479,14 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         Date now = new Date();
         List<Map<String, Object>> carsList = new ArrayList<>();
         for (TbBusinessCar tbBusinessCar : cars) {
-            BigDecimal basePrice = StrUtil.isEmpty(tbBusinessCar.getBusinessId()) ? new BigDecimal("0") : tbBusinessCar.getBasePartMoney();
-            double partMoney = basePrice.doubleValue();
             Date inTime = tbBusinessCar.getRealInTime();
-            if (inTime != null) {
-                BigDecimal price = this.calculationPartMoney(inTime, now, StrUtil.isNotEmpty(tbBusinessCar.getBusinessId()));
-                BigDecimal money = tbBusinessCar.getMoney();
-                partMoney = money == null ? price.subtract(basePrice).doubleValue() : price.subtract(money).doubleValue();
+            BigDecimal partMoney = new BigDecimal("0");
+            String carNo = tbBusinessCar.getCarNo().substring(0, 1);
+            if (inTime != null && CAR_LIST.contains(carNo)) {
+                partMoney = this.calculationPartMoney(inTime, now);
             }
+            BigDecimal hasPayMoney = tbBusinessCar.getMoney();
+            partMoney = partMoney.subtract(hasPayMoney);
             Map<String, Object> carMap = new HashMap<>();
             carMap.put("price", partMoney);
             carMap.put("id", tbBusinessCar.getId());

+ 1 - 0
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCar.java

@@ -87,6 +87,7 @@ public class TbBusinessCar extends Model<TbBusinessCar> implements Serializable
 	 */
 	private String driverPhone;
 	private String driverName;
+	private String carCompany;
 
 	private Double carSize;
 	/**

+ 0 - 9
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -132,8 +132,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
             tbBusiness.setCardNo(carNo);
             tbBusiness.setCardSize(t.getCarSize());
         }
-        tbBusiness.setChinaPartMoney(tbBusiness.getChinaPartMoney().add(partConfig.getBasePrice()))
-                .setTotalMoney(tbBusiness.getTotalMoney().add(partConfig.getBasePrice()));
         tbBusinessService.updateById(tbBusiness);
         this.save(t);
     }
@@ -179,13 +177,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
             return AjaxJson.getError("越南车不能删除");
         }
         this.removeById(id);
-        TbBusiness tbBusiness = tbBusinessService.getById(db.getBusinessId());
-
-        if (tbBusiness != null) {
-            tbBusiness.setChinaPartMoney(tbBusiness.getChinaPartMoney().subtract(partConfig.getBasePrice()))
-                    .setTotalMoney(tbBusiness.getTotalMoney().subtract(partConfig.getBasePrice()));
-            tbBusinessService.updateById(tbBusiness);
-        }
         return AjaxJson.getSuccess();
     }
 

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_car/ImportCarListener.java

@@ -52,7 +52,7 @@ public class ImportCarListener extends AnalysisEventListener<ImportCarBO> {
             if (StrUtil.isEmpty(carNo)) {
                 throw new BusinessException(customerName + "的车牌号不能为空");
             }
-            carNo = carNo.toUpperCase();
+            carNo = carNo.toUpperCase().trim();
             TbCar db = tbCarService.findByCardNo(carNo);
             if (db == null) {
                 db = new TbCar();

+ 1 - 0
sp-server/src/main/java/com/pj/project/tb_car/TbCar.java

@@ -71,6 +71,7 @@ public class TbCar extends Model<TbCar> implements Serializable {
 
 
     private String countryName;
+    private String remark;
 
     /**
      * 最后一次运输商品

+ 13 - 0
sp-server/src/main/java/com/pj/project/tb_car/TbCarService.java

@@ -42,12 +42,19 @@ public class TbCarService extends ServiceImpl<TbCarMapper, TbCar> implements ISe
      * 增
      */
     void add(TbCar t) {
+        String cardNo=t.getCardNo().trim();
+        TbCar db = this.findByCardNo(cardNo);
+        if (db!=null){
+            throw new BusinessException("车辆已存在");
+        }
         if (StrUtil.isEmpty(t.getCustomerId())) {
             throw new BusinessException("请选择车辆所属");
         }
+        t.setCardNo(cardNo);
         super.save(t);
     }
 
+
     /**
      * 删
      */
@@ -59,6 +66,12 @@ public class TbCarService extends ServiceImpl<TbCarMapper, TbCar> implements ISe
      * 改
      */
     void update(TbCar t) {
+        String cardNo=t.getCardNo().trim();
+        TbCar db = this.findByCardNo(cardNo);
+        if (db!=null&&!StrUtil.equals(t.getId(),db.getId())) {
+            throw new BusinessException("车辆已存在");
+        }
+        t.setCardNo(cardNo);
         super.updateById(t);
     }
 

+ 30 - 0
sp-server/src/main/java/com/pj/utils/ImageUtils.java

@@ -0,0 +1,30 @@
+package com.pj.utils;
+
+import sun.misc.BASE64Decoder;
+
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+
+public class ImageUtils {
+    public static boolean generateImage(String imgStr, String imgFilePath) {
+        BASE64Decoder decoder = new BASE64Decoder();
+        try {
+            // Base64解码
+            byte[] bytes = decoder.decodeBuffer(imgStr);
+            for (int i = 0; i < bytes.length; ++i) {
+                if (bytes[i] < 0) {// 调整异常数据
+                    bytes[i] += 256;
+                }
+            }
+            // 生成jpeg图片
+            OutputStream out = new FileOutputStream(imgFilePath);
+            out.write(bytes);
+            out.flush();
+            out.close();
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+}

+ 1 - 1
sp-server/src/main/resources/application-dev.yml

@@ -45,7 +45,7 @@ spring:
     # 项目自定义配置
     myconfig:
         # 本项目部署到的服务器域名(文件上传等等模块  要用到)
-        domain: https://127.0.0.1:8099/pro
+        domain: http://127.0.0.1:8099/pro
         web-domain: https://127.0.0.1:8080
 part-config:
     base-price: 30 #基础费用