qzyReal 2 سال پیش
والد
کامیت
7748a9f050
21فایلهای تغییر یافته به همراه183 افزوده شده و 121 حذف شده
  1. 1 1
      app/manifest.json
  2. 7 0
      app/pages/index/index.vue
  3. 2 2
      app/utils/request.js
  4. 1 0
      sp-admin/sa-view/tb-business/tb-car-disincle-list.html
  5. 15 0
      sp-admin/sa-view/tb-item-type/tb-item-type-add.html
  6. 1 0
      sp-admin/sa-view/tb-item-type/tb-item-type-list.html
  7. 1 1
      sp-admin/static/sa.js
  8. 1 1
      sp-server/app.pid
  9. 1 7
      sp-server/src/main/java/com/pj/api/jh/service/JhService.java
  10. 0 4
      sp-server/src/main/java/com/pj/api/jh/task/CheckPayStatusTask.java
  11. 17 4
      sp-server/src/main/java/com/pj/api/service/ApiService.java
  12. 5 1
      sp-server/src/main/java/com/pj/api/wx/service/WxService.java
  13. 1 0
      sp-server/src/main/java/com/pj/project/tb_business/CarDisincle.java
  14. 4 0
      sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java
  15. 1 1
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessMapper.xml
  16. 11 6
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
  17. 2 0
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCar.java
  18. 2 2
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java
  19. 31 36
      sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsService.java
  20. 74 55
      sp-server/src/main/java/com/pj/project/tb_item_type/TbItemType.java
  21. 5 0
      sp-server/src/main/java/com/pj/project/tb_item_type/TbItemTypeController.java

+ 1 - 1
app/manifest.json

@@ -85,7 +85,7 @@
     "vueVersion" : "2",
     "h5" : {
         "router" : {
-            "base" : "/h5/",
+            "base" : "/test/",
             "mode" : "history"
         },
         "devServer" : {

+ 7 - 0
app/pages/index/index.vue

@@ -72,6 +72,13 @@
 					url: '/pages/business-order/partner-business-item',
 				},
 				{
+					auth: false,
+					icon: '../../static/home-icon-06.jpg',
+					text: '其他业务',
+					url: '/pages/onely-disinfect/Index',
+					customer:true
+				},
+				{
 					id:'admin-list',
 					auth: true,
 					icon: '../../static/home-icon-04.png',

+ 2 - 2
app/utils/request.js

@@ -1,5 +1,5 @@
-const server = 'http://127.0.0.1:8099/pro';
-// const server = 'https://pco.aseanbusiness.cn/pro';
+// const server = 'http://127.0.0.1:8099/pro';
+const server = 'https://pco.aseanbusiness.cn/pro';
 // const server = 'https://dxkaa1.bgigc.com/pro';
 
 import common from '../common/js/common.js';

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

@@ -49,6 +49,7 @@
 					<el-table-column type="index" width="50"></el-table-column>
 					<sa-td name="业务单号" prop="no" width="160"></sa-td>
 					<sa-td name="车辆类型" prop="goodsName"></sa-td>
+					<sa-td name="业务项" prop="itemTypeName" width="160"></sa-td>
 					<sa-td name="车牌号" prop="carNo"></sa-td>
 					<sa-td name="确认" prop="adminConfirmInput" type="enum" :jv="{1: '已确认', 0: '未确认'}"></sa-td>
 					<sa-td name="已支付(元)" prop="payMoney" width="140"></sa-td>

+ 15 - 0
sp-admin/sa-view/tb-item-type/tb-item-type-add.html

@@ -40,6 +40,13 @@
 						<sa-item type="text" name="项目名称" v-model="m.name" placeholder="请输入项目名称" br>
 						</sa-item>
 						<div class="c-item">
+							<label class="c-label">付款步骤:</label>
+							<el-select  v-model="m.payStep" placeholder="请选择">
+								<el-option :label="item.name" :value="item.id" v-for="(item,index) in stepList">
+								</el-option>
+							</el-select>
+						</div>
+						<div class="c-item">
 							<label class="c-label">排序:</label>
 							<el-input-number class="item-num" v-model="m.sort" :step="1" :min="1" step-strictly>
 							</el-input-number>
@@ -69,12 +76,19 @@
 						taxRate: 0.6,
 						inc:0,
 						name: '',
+						payStep:'',
 						code: '',
 						business: '0',
 					}, // 实体对象
 					typeList: [],
+					stepList:[]
 				},
 				methods: {
+					getPayStep(){
+						sa.ajax('/TbItemType/getPayStep',function(resp){
+							this.stepList=resp.data;
+						}.bind(this))
+					},
 					// 提交数据 
 					ok: function() {
 						// 表单校验 
@@ -103,6 +117,7 @@
 					},
 				},
 				mounted: function() {
+					this.getPayStep();
 					// 初始化数据 
 					if (this.id <= 0) {} else {
 						sa.ajax('/TbItemType/getById?id=' + this.id, function(res) {

+ 1 - 0
sp-admin/sa-view/tb-item-type/tb-item-type-list.html

@@ -32,6 +32,7 @@
 				<el-table class="data-table" ref="data-table" :data="dataList">
 					<el-table-column type="index" width="50"></el-table-column>
 					<sa-td name="项目名称" prop="name" ></sa-td>
+					<sa-td name="付款步骤" prop="payStep" type="enum" :jv="{1: '下单后', 2: '确认后'}"></sa-td>
 					<sa-td name="排序" prop="sort"></sa-td>
 					<el-table-column label="操作" fixed="right" width="260px">
 						<template slot-scope="s">

+ 1 - 1
sp-admin/static/sa.js

@@ -22,7 +22,7 @@ var sa = {
 		api_url: 'https://dxkaa1.bgigc.com/pro',
 		web_url: 'http://www.baidu.com'
 	}
-	sa.cfg = cfg_dev; // 最终环境 , 上线前请选择正确的环境
+	sa.cfg = cfg_test; // 最终环境 , 上线前请选择正确的环境
 })();
 
 

+ 1 - 1
sp-server/app.pid

@@ -1 +1 @@
-14660
+21340

+ 1 - 7
sp-server/src/main/java/com/pj/api/jh/service/JhService.java

@@ -156,15 +156,9 @@ public class JhService {
             return;
         }
         NotifyBO notifyBO = new NotifyBO();
-        String outTradeNo = bo.getOutTradeNo();
         notifyBO.setOutTradeNo(bo.getOutTradeNo())
-                .setTransactionId(bo.getBankTrxNo())
+                .setTransactionId(bo.getBankTrxNo()).setTimeEnd(bo.getSuccessTime())
                 .setTotalFee(NumberUtil.mul(bo.getOrderPrice(), 100 + "").toString());
         wxService.WxNotify(notifyBO);
-        TbOrder tbOrder = tbOrderService.findByOutTradeNo(outTradeNo);
-        tbOrder.setOrderStatus(orderStatus)
-                .setTransactionId(bo.getBankTrxNo())
-                .setCompleteDate(bo.getSuccessTime());
-        tbOrderService.updateById(tbOrder);
     }
 }

+ 0 - 4
sp-server/src/main/java/com/pj/api/jh/task/CheckPayStatusTask.java

@@ -61,10 +61,6 @@ public class CheckPayStatusTask extends Task {
             TbOrderService tbOrderService = SpringUtil.getBean(TbOrderService.class);
             TbOrder tbOrder = tbOrderService.findByOutTradeNo(outTradeNo);
             if (StrUtil.equals("WAITING_PAYMENT", tbOrder.getOrderStatus())) {
-                tbOrder.setOrderStatus(orderStatus)
-                        .setTransactionId(result.getStr("bankTrxNo"))
-                        .setCompleteDate(result.getStr("completeDate"));
-                tbOrderService.updateById(tbOrder);
                 JhService jhService = SpringUtil.getBean(JhService.class);
                 JhNotifyBO notifyBO = new JhNotifyBO();
                 notifyBO.setAttach(tbOrder.getAttach()).setBankTrxNo(tbOrder.getTransactionId()).setTradeStatus(orderStatus)

+ 17 - 4
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -40,6 +40,8 @@ import com.pj.project.tb_disinfect.TbDisinfectService;
 import com.pj.project.tb_district.TbDistrict;
 import com.pj.project.tb_district.TbDistrictService;
 import com.pj.project.tb_item.TbItem;
+import com.pj.project.tb_item_type.TbItemType;
+import com.pj.project.tb_item_type.TbItemTypeService;
 import com.pj.project.tb_pass_record.TbPassRecord;
 import com.pj.project.tb_pass_record.TbPassRecordService;
 import com.pj.project4sp.admin.SpAdmin;
@@ -104,6 +106,9 @@ public class ApiService {
     @Resource
     private RelationTypeItemService relationTypeItemService;
 
+    @Resource
+    private TbItemTypeService tbItemTypeService;
+
     private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
 
 
@@ -143,10 +148,13 @@ public class ApiService {
             return tbBusiness.getAdminConfirmInput() == 1;
         }).collect(Collectors.toList());
         List<TbBusinessCar> otherBusinessCarList = tbBusinessCarService.searchOtherBusinessCar(carNo);
-        otherBusinessCarList=  otherBusinessCarList.stream().filter(tbBusinessCar -> {
+        otherBusinessCarList = otherBusinessCarList.stream().filter(tbBusinessCar -> {
             String businessCarId = tbBusinessCar.getId();
             List<TbBusiness> businesses = tbBusinessService.findOtherBusinessByCarId(businessCarId);
-            return !businesses.isEmpty();
+           return businesses.stream().anyMatch(tbBusiness -> tbBusiness.getPayMoney().doubleValue() < tbBusiness.getTotalMoney().doubleValue()
+                   && (((TbItemType.PayStep.BEFORE_CONFIRM.getCode().equals(tbBusiness.getPayStep()) && tbBusiness.getAdminConfirmInput() >= 0)
+                   || (TbItemType.PayStep.AFTER_CONFIRM.getCode().equals(tbBusiness.getPayStep()) && tbBusiness.getAdminConfirmInput() == 1))
+           ));
         }).collect(Collectors.toList());
         List<TbBusinessCar> cars = tbBusinessCarService.findTheNoBusinessCar(carNo);
         //过滤掉不用缴费的车
@@ -282,6 +290,7 @@ public class ApiService {
         String carNo = otherBusinessBO.getCarNo().trim().toUpperCase();
         TbBusinessCar db = tbBusinessCarService.findNotOutCar(carNo);
         String customerId = otherBusinessBO.getCustomerId();
+        TbItemType tbItemType = tbItemTypeService.getById(otherBusinessBO.getItemTypeId());
         if (db == null) {
             db = tbBusinessCarService.findNotInCar(carNo);
             if (db == null) {
@@ -296,7 +305,7 @@ public class ApiService {
         }
 
         TbBusiness tbBusiness = new TbBusiness();
-        tbBusiness.setBusinessCarId(db.getId());
+        tbBusiness.setBusinessCarId(db.getId()).setPayStep(tbItemType.getPayStep());
         TbCostomer tbCostomer = tbCostomerService.getById(customerId);
         if (tbCostomer != null) {
             tbBusiness.setCustomerId(customerId).setCustomerName(tbCostomer.getName());
@@ -328,6 +337,7 @@ public class ApiService {
                 .setOperator(otherBusinessBO.getOperator()).setOperateTime(otherBusinessBO.getOperateTime())
                 .setNo(no).setGoodsName(otherBusinessBO.getCarType()).setItemTypeId(otherBusinessBO.getItemTypeId())
                 .setCreateTime(new Date()).setBusinessType(TbBusiness.BusinessType.CAR_DISINCLE.getCode())
+                .setItemTypeName(tbItemType.getName())
                 .setItemPrice(price).setTotalMoney(price);
         String prefix = carNo.substring(0, 1);
         if (CAR_LIST.contains(prefix)) {
@@ -356,6 +366,7 @@ public class ApiService {
         if (tbItems.isEmpty()) {
             throw new BusinessException("请选择明细");
         }
+        TbItemType tbItemType = tbItemTypeService.getById(otherBusinessBO.getItemTypeId());
         String businessId = otherBusinessBO.getId();
         String carNo = otherBusinessBO.getCarNo();
         String customerId = otherBusinessBO.getCustomerId();
@@ -364,6 +375,7 @@ public class ApiService {
         TbBusiness tbBusiness = tbBusinessService.getById(businessId);
         tbBusiness.setOperateTime(otherBusinessBO.getOperateTime())
                 .setOperator(otherBusinessBO.getOperator())
+                .setPayStep(tbItemType.getPayStep()).setItemTypeName(tbItemType.getName())
                 .setCardSize(otherBusinessBO.getCarSize())
                 .setCustomerId(customerId).setNetWeight(otherBusinessBO.getCarWeight())
                 .setGoodsName(otherBusinessBO.getCarType())
@@ -376,7 +388,8 @@ public class ApiService {
         }
         String no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4);
         TbBusinessCar tbBusinessCar = tbBusinessCarService.getById(tbBusiness.getBusinessCarId());
-        tbBusinessCar.setCarSize(otherBusinessBO.getCarSize()).setCustomerId(otherBusinessBO.getCustomerId()).setCarNo(carNo)
+        tbBusinessCar.setCarSize(otherBusinessBO.getCarSize())
+                .setCustomerId(otherBusinessBO.getCustomerId()).setCarNo(carNo)
                 .setTimeUpdate(new Date());
         int index = 1;
         BigDecimal price = new BigDecimal("0");

+ 5 - 1
sp-server/src/main/java/com/pj/api/wx/service/WxService.java

@@ -247,6 +247,7 @@ public class WxService {
                     TbBusiness tbBusiness = tbBusinessService.getById(businessId);
                     businessList.add(tbBusiness);
                 }
+                log.error("items size:{},{}",items.size(),JSONUtil.toJsonStr(items));
                 tbFeeStatisticsService.countBusinessFee(items, transactionId, outTradeNo);//业务费日统计
                 items.forEach(tbBusinessItem -> tbBusinessItem.setPayStatus(1).setPayTime(now));
                 tbBusinessItemService.updateBatchById(items);
@@ -264,7 +265,10 @@ public class WxService {
                 tbAccountService.recharge(chargeBO.getId(), chargeBO.getC(), TbChargeRecord.Ch.WECHAT.getType(), money);
             }
         }
-
+        tbOrder.setOrderStatus("SUCCESS")
+                .setTransactionId(notifyBO.getTransactionId())
+                .setCompleteDate(notifyBO.getTimeEnd());
+        tbOrderService.updateById(tbOrder);
     }
 
 

+ 1 - 0
sp-server/src/main/java/com/pj/project/tb_business/CarDisincle.java

@@ -23,4 +23,5 @@ public class CarDisincle implements Serializable {
     private String createTime;
     private String realInTime;
     private String realOutTime;
+    private String itemTypeName;
 }

+ 4 - 0
sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java

@@ -229,6 +229,10 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
 
     private String businessCarId;
 
+    private String itemTypeName;
+
+    private Integer payStep=2;
+
     private transient String itemJson;
     private transient String peopleJson;
     private transient String carJson;

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessMapper.xml

@@ -74,7 +74,7 @@
             a.`no`,
             a.item_price,a.goods_name,a.admin_confirm_input,b.car_no,
             b.base_part_money,a.total_money,a.pay_money,a.create_time,
-            b.real_in_time,b.real_out_time,b.car_no ,a.net_weight,a.card_size,a.pay_status
+            b.real_in_time,b.real_out_time,b.car_no ,a.net_weight,a.card_size,a.pay_status,a.item_type_name
         from tb_business a,tb_business_car b
         WHERE a.business_car_id=b.id and (a.declare_no='' or a.declare_no is null)
             <if test="cardNo !='' and cardNo !=null">

+ 11 - 6
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -220,7 +220,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             tbBusinessCar.setIsLock(0);
             String carNo = tbBusinessCar.getCarNo().toUpperCase();
             TbBusinessCar db = tbBusinessCarService.findByBusinessIdAndCarNo(t.getId(), carNo);
-            if (db!=null&&TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(db.getBusinessType())){
+            if (db != null && TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(db.getBusinessType())) {
                 throw new BusinessException("该车存在其他业务");
             }
             if (db != null) {
@@ -374,7 +374,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                                 business.getGoodsName() + "(" + item.getItemTypeName() + item.getItemName() + "-" + carNoStr + ")");
                         List<SpAdmin> spAdminList = spAdminService.findByCustomerId(customerId);
                         Date now = new Date();
-                        item.setPickCustomerId(customerId).setPickCustomerName(tbCostomer.getName()).setPickTime(now)
+                        item.setPickCustomerId(customerId).setPick(1)
+                                .setPickCustomerName(tbCostomer.getName()).setPickTime(now)
                                 .setConfirm(1).setConfirmTime(now);
                         tbBusinessItemService.updateById(item);
                         spAdminList.stream().map(SpAdmin::getOpenid).forEach(openId -> {
@@ -530,8 +531,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         Map<String, Object> result = new HashMap<>();
         TbBusinessCar car = tbBusinessCarService.getById(carId);
         String businessId = car.getBusinessId();
-        Integer businessType=car.getBusinessType();
-        result.put("type",businessType);
+        Integer businessType = car.getBusinessType();
+        result.put("type", businessType);
         List<TbBusinessCar> cars = new ArrayList<>();
         List<TbBusinessItem> items = new ArrayList<>();
         cars.add(car);
@@ -539,7 +540,11 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         if (TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(businessType)) {
             List<TbBusiness> businesses = this.findOtherBusinessByCarId(carId);
             businesses = businesses.stream()
-                    .filter(tbBusiness -> tbBusiness.getAdminConfirmInput() == 1 && tbBusiness.getPayMoney().doubleValue() < tbBusiness.getTotalMoney().doubleValue())
+                    .filter(tbBusiness -> tbBusiness.getPayMoney().doubleValue() < tbBusiness.getTotalMoney().doubleValue()
+                    &&((TbItemType.PayStep.BEFORE_CONFIRM.getCode().equals(tbBusiness.getPayStep())&&tbBusiness.getAdminConfirmInput()>=0)
+                            ||(TbItemType.PayStep.AFTER_CONFIRM.getCode().equals(tbBusiness.getPayStep())&&tbBusiness.getAdminConfirmInput()==1)
+                            )
+                    )
                     .collect(Collectors.toList());
             List<String> businessIdList = businesses.stream().map(TbBusiness::getId).collect(Collectors.toList());
             if (!businessIdList.isEmpty()) {
@@ -575,7 +580,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 }
             }
             //越南车牌,整车业务免停车费
-            if (!CAR_LIST.contains(carNo)&&TbBusiness.BusinessType.HOLD_CAR.getCode().equals(businessType)) {
+            if (!CAR_LIST.contains(carNo) && TbBusiness.BusinessType.HOLD_CAR.getCode().equals(businessType)) {
                 partMoney = new BigDecimal("0");
             }
             Map<String, Object> carMap = new HashMap<>();

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

@@ -125,6 +125,8 @@ public class TbBusinessCar extends Model<TbBusinessCar> implements Serializable
     private Integer businessType=0;
 
 
+
+
     @TableField(exist = false)
     private String payType;
 

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

@@ -93,7 +93,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
                 tbBusinessCar.setPayType("免费");
                 continue;
             }
-            final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
             Date inTime = tbBusinessCar.getRealInTime();
             Date outTime = tbBusinessCar.getRealOutTime();
             if (inTime != null && outTime != null) {
@@ -101,7 +100,8 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
                 LocalDateTime outDayTime = outTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
                 long minutes = ChronoUnit.MINUTES.between(inDayTime, outDayTime);
                 PartConfig partConfig = SpringUtil.getBean(PartConfig.class);
-                if (minutes < partConfig.getFreeMinutes() || !CAR_LIST.contains(tbBusinessCar.getCarNo().substring(0, 1))) {
+                if (minutes < partConfig.getFreeMinutes()
+                        || (!CAR_LIST.contains(tbBusinessCar.getCarNo().substring(0, 1)) &&TbBusiness.BusinessType.HOLD_CAR.getCode().equals(tbBusinessCar.getBusinessType()))) {
                     tbBusinessCar.setPayType("免费");
                     continue;
                 }

+ 31 - 36
sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsService.java

@@ -139,19 +139,19 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
 
         for (PriceBO bo1 : cars) {
             BigDecimal price = bo1.getP();
-            if(price.compareTo(BigDecimal.valueOf(0)) != 0){
+            if (price.compareTo(BigDecimal.valueOf(0)) != 0) {
                 totalPrice = totalPrice.add(price);
                 TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
                 Integer addNum = calcuAddNum(car.getMoney(), price);
                 totalNum += addNum;
             }
         }
-        if(totalPrice.compareTo(BigDecimal.valueOf(0)) == 0){
+        if (totalPrice.compareTo(BigDecimal.valueOf(0)) == 0) {
             return;
         }
         parkFee.setNum(totalNum).setTaxMoney(parkFee.getTaxMoney().add(totalPrice));
         BigDecimal taxes = totalPrice
-                .divide(BigDecimal.valueOf(1).add(parkFee.getTaxRate()),2, BigDecimal.ROUND_HALF_UP)
+                .divide(BigDecimal.valueOf(1).add(parkFee.getTaxRate()), 2, BigDecimal.ROUND_HALF_UP)
                 .multiply(parkFee.getTaxRate());
         taxes = taxes.setScale(2, BigDecimal.ROUND_HALF_UP);
         BigDecimal noTaxMoney = totalPrice.subtract(taxes);
@@ -165,20 +165,20 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
         this.saveOrUpdate(parkFee);
     }
 
-    public Integer calcuAddNum(BigDecimal money, BigDecimal p){
+    public Integer calcuAddNum(BigDecimal money, BigDecimal p) {
         BigDecimal baseNightPrice = partConfig.getBasePrice().add(partConfig.getExtraPrice());
         BigDecimal[] qrOld = money.divideAndRemainder(baseNightPrice);
         Integer oldNightNum = qrOld[0].intValue();
-        if(qrOld[1].compareTo(BigDecimal.valueOf(0)) > 0){
+        if (qrOld[1].compareTo(BigDecimal.valueOf(0)) > 0) {
             oldNightNum++;
         }
         BigDecimal newMoney = money.add(p);
         BigDecimal[] qrNew = newMoney.divideAndRemainder(baseNightPrice);
         Integer newNightNum = qrNew[0].intValue();
-        if(qrNew[1].compareTo(BigDecimal.valueOf(0)) > 0){
+        if (qrNew[1].compareTo(BigDecimal.valueOf(0)) > 0) {
             newNightNum++;
         }
-        return newNightNum-oldNightNum;
+        return newNightNum - oldNightNum;
     }
 
     //@Async
@@ -191,7 +191,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
         for (TbBusinessItem item : items) {
             Integer feeType = item.getPayType();
             String itemType = item.getItemTypeName();
-            if(StrUtil.isNotEmpty(itemType)){
+            if (StrUtil.isNotEmpty(itemType)) {
                 if (itemType.contains("核酸")) {
                     feeType = TbFeeStatistics.FeeTypeEnum.NUCLEIC_FEE.getCode();
                 } else if (itemType.contains("消毒") || itemType.contains("消杀")) {
@@ -202,7 +202,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
                     feeType = TbFeeStatistics.FeeTypeEnum.STEVEDORE_FEE.getCode();
                 } else if (itemType.contains("入场管理")) {
                     feeType = TbFeeStatistics.FeeTypeEnum.MANAGE_FEE.getCode();
-                } else if(StrUtil.equals(itemType, "充电打冷")) {
+                } else if (StrUtil.equals(itemType, "充电打冷")) {
                     feeType = TbFeeStatistics.FeeTypeEnum.CHARGE_FEE.getCode();
                 }
             }
@@ -217,7 +217,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
             businessFee.setTaxMoney(businessFee.getTaxMoney().add(item.getTotal()));//含税收入
             businessFee.setNum(businessFee.getNum() + Integer.valueOf(item.getNum()));
             BigDecimal taxes = item.getTotal()
-                    .divide(BigDecimal.valueOf(1).add(businessFee.getTaxRate()),2, BigDecimal.ROUND_HALF_UP)
+                    .divide(BigDecimal.valueOf(1).add(businessFee.getTaxRate()), 2, BigDecimal.ROUND_HALF_UP)
                     .multiply(businessFee.getTaxRate());
             taxes = taxes.setScale(2, BigDecimal.ROUND_HALF_UP);
             BigDecimal noTaxMoney = item.getTotal().subtract(taxes);
@@ -233,28 +233,23 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
             /*-----------------分割线------------------*/
             //添加此item的收费明细
             TbBusiness business = tbBusinessService.getById(item.getBusinessId());
-//            TbFeeDetails businessFeeDetail = tbFeeDetailsService.getByBusinessIdAndCarNoAndItemType(item.getBusinessId(), business.getCardNo(), item.getItemTypeId());
-            TbFeeDetails businessFeeDetail = null;
-            if (businessFeeDetail == null) {
-                businessFeeDetail = new TbFeeDetails();
-                businessFeeDetail.setTaxRate(BigDecimal.valueOf(taxRate));
-            }
-
+            TbFeeDetails businessFeeDetail = new TbFeeDetails();
+            businessFeeDetail.setTaxRate(BigDecimal.valueOf(taxRate));
             BigDecimal taxPrice = item.getTotal()
-                    .divide(BigDecimal.valueOf(1).add(businessFeeDetail.getTaxRate()),2, BigDecimal.ROUND_HALF_UP)
+                    .divide(BigDecimal.valueOf(1).add(businessFeeDetail.getTaxRate()), 2, BigDecimal.ROUND_HALF_UP)
                     .multiply(businessFeeDetail.getTaxRate());
             taxPrice = taxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
             BigDecimal noTaxPrice = item.getTotal().subtract(taxPrice);
             noTaxPrice = noTaxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
             String carNo = business.getCardNo();
-            if(StrUtil.isEmpty(business.getCardNo())){
+            if (StrUtil.isEmpty(business.getCardNo())) {
                 carNo = business.getChinaCarNo();
             }
             TbBusinessCar businessCar;
             if (TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(business.getBusinessType())) {
-                businessCar=tbBusinessCarService.getById(business.getBusinessCarId());
-            }else {
-                businessCar  = tbBusinessCarService.findByBusinessIdAndCarNo(item.getBusinessId(), carNo);
+                businessCar = tbBusinessCarService.getById(business.getBusinessCarId());
+            } else {
+                businessCar = tbBusinessCarService.findByBusinessIdAndCarNo(item.getBusinessId(), carNo);
             }
             businessFeeDetail.setBusinessId(item.getBusinessId()).setBusinessNo(business.getNo())
                     .setBusinessItemNo(item.getNo()).setBusinessCarId(businessCar.getId()).setBusinessCarNo(businessCar.getNo())
@@ -273,13 +268,13 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
         }
     }
 
-    public TbFeeStatistics updateParkNum(String day){
+    public TbFeeStatistics updateParkNum(String day) {
         QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
         qw.like("create_time", day);
         List<TbFeeDetails> list = tbFeeDetailsService.list(qw);
         Integer totalNum = 0;
         for (TbFeeDetails feeDetail : list) {
-            if(feeDetail.getFeeType() == TbFeeStatistics.FeeTypeEnum.PARK_FEE.getCode()){
+            if (feeDetail.getFeeType() == TbFeeStatistics.FeeTypeEnum.PARK_FEE.getCode()) {
                 totalNum = totalNum + feeDetail.getNum();
             }
         }
@@ -289,37 +284,37 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
         return feeStatistics;
     }
 
-    public String exportMonthStatistics(SoMap so) throws Exception{
+    public String exportMonthStatistics(SoMap so) throws Exception {
         String monthStr = so.getString("exportMonth");
-        so.put("month",monthStr);
+        so.put("month", monthStr);
         Date month = DateUtil.parse(monthStr, "yyyy-MM");
         Month monthEnum = DateUtil.monthEnum(month);
         boolean leap = DateUtil.isLeapYear(DateUtil.year(month));
         Integer lastDay = monthEnum.getLastDay(leap);
         Map<String, ExportMonthDataDTO> dataMap = new TreeMap<>();
-        for(int i=1; i<=lastDay ; i++){
+        for (int i = 1; i <= lastDay; i++) {
             ExportMonthDataDTO data = new ExportMonthDataDTO();
-            String index = i<10 ? "0"+i : ""+i;
+            String index = i < 10 ? "0" + i : "" + i;
             String day = monthStr + "-" + index;
             data.setIndex(index).setDay(day);
             dataMap.put(index, data);
         }
         List<TbFeeStatistics> list = this.getList(so);
         Integer totalIn = 0;
-        Integer totalOut= 0;
+        Integer totalOut = 0;
         Integer totalAdd = 0;
         BigDecimal totalMoney = BigDecimal.valueOf(0);
         for (TbFeeStatistics statistics : list) {
             String day = statistics.getDay();
             String key = StrUtil.sub(day, 8, 10);
             ExportMonthDataDTO data = dataMap.get(key);
-            if(data.getDayMoney() == null){
+            if (data.getDayMoney() == null) {
                 data.setDayMoney(BigDecimal.valueOf(0));
             }
             data.setDayMoney(data.getDayMoney().add(statistics.getTaxMoney()));
             totalMoney = totalMoney.add(statistics.getTaxMoney());
         }
-        List<ExportMonthDataDTO> exportList = new ArrayList<>(dataMap.values()) ;
+        List<ExportMonthDataDTO> exportList = new ArrayList<>(dataMap.values());
         for (ExportMonthDataDTO dto : exportList) {
             String day = dto.getDay();
             List<TbBusinessCar> inCarList = tbBusinessCarService.findInCarByDay(day);
@@ -327,21 +322,21 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
             Integer inNum = inCarList != null ? inCarList.size() : 0;
             Integer outNum = outCarList != null ? outCarList.size() : 0;
             Integer addNum = inNum - outNum;
-            if(inNum != 0){
+            if (inNum != 0) {
                 dto.setInNum(inNum);
                 totalIn += inNum;
             }
-            if(outNum != 0){
+            if (outNum != 0) {
                 dto.setOutNum(outNum);
                 totalOut += outNum;
             }
-            if(addNum != 0){
+            if (addNum != 0) {
                 dto.setAddNum(addNum);
                 totalAdd += addNum;
             }
         }
         Map<String, String> head = new HashMap<>();
-        Integer exportMonth = Integer.valueOf(StrUtil.sub(monthStr, 5,7));
+        Integer exportMonth = Integer.valueOf(StrUtil.sub(monthStr, 5, 7));
         String today = DateUtil.today();
         head.put("exportMonth", exportMonth + "");
         head.put("exportDay", today);
@@ -363,7 +358,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
         }
 
         ClassPathResource classPathResource = new ClassPathResource("static/month-fee.xlsx");
-        InputStream tempInputStream =classPathResource.getInputStream();
+        InputStream tempInputStream = classPathResource.getInputStream();
         ExcelWriter excelWriter = EasyExcel.write(savePath + fileName, ExportFeeDetailDTO.class)
                 .withTemplate(tempInputStream).build();
         WriteSheet writeSheet = EasyExcel.writerSheet().build();

+ 74 - 55
sp-server/src/main/java/com/pj/project/tb_item_type/TbItemType.java

@@ -2,21 +2,22 @@ package com.pj.project.tb_item_type;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.pj.project.tb_item.TbItem;
+import lombok.AllArgsConstructor;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
+import lombok.Getter;
 import lombok.experimental.Accessors;
 
 /**
  * Model: tb_item_type -- 业务项类型
- * @author qzy 
+ *
+ * @author qzy
  */
 @Data
 @Accessors(chain = true)
@@ -24,66 +25,84 @@ import lombok.experimental.Accessors;
 @EqualsAndHashCode(callSuper = false)
 public class TbItemType extends Model<TbItemType> implements Serializable {
 
-	// ---------- 模块常量 ----------
-	/**
-	 * 序列化版本id 
-	 */
-	private static final long serialVersionUID = 1L;	
-	/**
-	 * 此模块对应的表名 
-	 */
-	public static final String TABLE_NAME = "tb_item_type";	
-	/**
-	 * 此模块对应的权限码 
-	 */
-	public static final String PERMISSION_CODE = "tb-item-type";	
-
-
-	// ---------- 表中字段 ----------
-	/**
-	 * 主键 
-	 */
-	private String id;
-
-	/**
-	 * 名称 
-	 */
-	private String name;
-
+    // ---------- 模块常量 ----------
     /**
-     * 税率
+     * 序列化版本id
      */
-    private BigDecimal taxRate = new BigDecimal(0);
-
-	/**
-	 * 是否必须(0=否,1=是) 
-	 */
-	private int need;
-	private String code;
-	private Integer inc=0;
-
-	/**
-	 * 业务类型1,消杀;2装卸;0默认
-	 */
-	private String businessType="0";
-	private Integer business=1;
-	private Integer sort;
+    private static final long serialVersionUID = 1L;
+    /**
+     * 此模块对应的表名
+     */
+    public static final String TABLE_NAME = "tb_item_type";
+    /**
+     * 此模块对应的权限码
+     */
+    public static final String PERMISSION_CODE = "tb-item-type";
 
-	@TableField(exist = false)
-	private List<TbItem>items=new ArrayList<>();
 
-	@TableField(exist = false)
-	private String itemId;
-	@TableField(exist = false)
-	private Integer num=1;
-	@TableField(exist = false)
-	private String itemName;
+    // ---------- 表中字段 ----------
+    /**
+     * 主键
+     */
+    private String id;
 
+    /**
+     * 名称
+     */
+    private String name;
 
+    /**
+     * 税率
+     */
+    private BigDecimal taxRate = new BigDecimal(0);
 
+    /**
+     * 是否必须(0=否,1=是)
+     */
+    private int need;
+    private String code;
+    private Integer inc = 0;
 
+    /**
+     * 业务类型1,消杀;2装卸;0默认
+     */
+    private String businessType = "0";
+    private Integer business = 1;
+    private Integer sort;
+    /**
+     * 可以支付步骤1:生成即可,2:确认后
+     */
+    private Integer payStep = 2;
+
+    @TableField(exist = false)
+    private List<TbItem> items = new ArrayList<>();
+
+    @TableField(exist = false)
+    private String itemId;
+    @TableField(exist = false)
+    private Integer num = 1;
+    @TableField(exist = false)
+    private String itemName;
+
+    @Getter
+    @AllArgsConstructor
+    public static enum PayStep {
+        BEFORE_CONFIRM(1,"下单后"),
+        AFTER_CONFIRM(2,"确认订单后");
+        private Integer code;
+        private String desc;
+        public static List<Map<String, Object>> getList() {
+            List<Map<String, Object>> list = new ArrayList<>();
+            for (PayStep tbItem : PayStep.values()) {
+                Map<String, Object> map = new HashMap<>();
+                map.put("id", tbItem.getCode());
+                map.put("name", tbItem.getDesc());
+                list.add(map);
+            }
+            return list;
+        }
+    }
 
-	
 
 
 }

+ 5 - 0
sp-server/src/main/java/com/pj/project/tb_item_type/TbItemTypeController.java

@@ -104,6 +104,11 @@ public class TbItemTypeController {
         return AjaxJson.getPageData(so.getDataCount(), list);
     }
 
+    @RequestMapping("getPayStep")
+    public AjaxJson getPayStep() {
+        return AjaxJson.getSuccessData(TbItemType.PayStep.getList());
+    }
+
     /**
      * 查集合 - 根据条件(参数为空时代表忽略指定条件)
      */