Browse Source

Merge branch 'dev'

# Conflicts:
#	sp-server/src/main/java/com/pj/api/open/service/OpenService.java
#	sp-server/src/main/java/com/pj/api/service/ApiService.java
#	sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
#	sp-server/src/main/java/com/pj/project/tb_business_item/PayTask.java
#	sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java
qzyReal 2 years ago
parent
commit
30cbde7d6d
100 changed files with 2921 additions and 1991 deletions
  1. 2 2
      app-ui/manifest.json
  2. 0 28
      app-ui/pages/index/index.vue
  3. 527 598
      app-ui/pages/onely-disinfect/type-business-edit.vue
  4. 4 75
      app-ui/pages/onely-disinfect/type-business.vue
  5. 49 6
      app-ui/pages/wx/pay.vue
  6. 3 56
      sp-admin/sa-frame/menu-list-sp.js
  7. 26 49
      sp-admin/sa-view/tb-business/tb-car-disincle-add.html
  8. 8 35
      sp-admin/sa-view/tb-business/tb-car-disincle-edit.html
  9. 2 2
      sp-admin/sa-view/tb-business/tb-car-disincle-info.html
  10. 2 2
      sp-admin/sa-view/tb-business/tb-car-disincle-list.html
  11. 13 4
      sp-admin/sa-view/tb-fee-statistics/dayStatsPrint.html
  12. 11 2
      sp-admin/sa-view/tb-fee-statistics/detailPrint.html
  13. 2 0
      sp-admin/sa-view/tb-fee-statistics/tb-fee-details-list.html
  14. 11 10
      sp-admin/sa-view/tb-fee-statistics/tb-fee-statistics-list.html
  15. 0 2
      sp-admin/sa-view/tb-goods/tb-goods-list.html
  16. 2 2
      sp-admin/sa-view/tb-item-type/tb-item-add.html
  17. 2 2
      sp-admin/sa-view/tb-item-type/tb-item-edit.html
  18. 16 19
      sp-admin/sa-view/tb-item-type/tb-item-list.html
  19. 2 11
      sp-admin/sa-view/tb-item-type/tb-item-select.html
  20. 150 146
      sp-admin/sa-view/tb-item-type/tb-item-type-list.html
  21. 0 7
      sp-admin/sa-view/tb-item-type/tb-item.html
  22. 2 1
      sp-server/src/main/java/com/pj/api/invoice/service/InvoiceApplyService.java
  23. 4 1
      sp-server/src/main/java/com/pj/api/jh/service/JhService.java
  24. 17 0
      sp-server/src/main/java/com/pj/api/open/bo/ItemPriceBO.java
  25. 53 31
      sp-server/src/main/java/com/pj/api/open/service/OpenService.java
  26. 62 104
      sp-server/src/main/java/com/pj/api/pushfee/bo/SyncBillParam.java
  27. 42 32
      sp-server/src/main/java/com/pj/api/pushfee/task/FeeDetailSyncTask.java
  28. 0 5
      sp-server/src/main/java/com/pj/api/pushfee/web/TestApi.java
  29. 3 3
      sp-server/src/main/java/com/pj/api/service/ApiService.java
  30. 4 0
      sp-server/src/main/java/com/pj/api/wx/bo/Attach.java
  31. 18 0
      sp-server/src/main/java/com/pj/api/wx/bo/ManagerBO.java
  32. 22 2
      sp-server/src/main/java/com/pj/api/wx/bo/PriceBO.java
  33. 14 2
      sp-server/src/main/java/com/pj/api/wx/service/WxService.java
  34. 22 22
      sp-server/src/main/java/com/pj/constants/business/FeeTypeEnum.java
  35. 21 0
      sp-server/src/main/java/com/pj/constants/business/ManagerEnum.java
  36. 2 2
      sp-server/src/main/java/com/pj/constants/business/PartFeeEnum.java
  37. 14 0
      sp-server/src/main/java/com/pj/current/config/MyConfig.java
  38. 7 0
      sp-server/src/main/java/com/pj/current/config/PushfeeConfig.java
  39. 6 0
      sp-server/src/main/java/com/pj/project/relation_goods_type/RelationGoodsTypeService.java
  40. 5 0
      sp-server/src/main/java/com/pj/project/relation_type_item/RelationTypeItemService.java
  41. 70 0
      sp-server/src/main/java/com/pj/project/sync/HelpService.java
  42. 111 0
      sp-server/src/main/java/com/pj/project/sync/SyncService.java
  43. 48 0
      sp-server/src/main/java/com/pj/project/sync/api/AsyncApi.java
  44. 13 0
      sp-server/src/main/java/com/pj/project/sync/bo/FactorDTO.java
  45. 10 0
      sp-server/src/main/java/com/pj/project/sync/bo/FactorParams.java
  46. 18 0
      sp-server/src/main/java/com/pj/project/sync/bo/IExpenseListQueryRes.java
  47. 26 0
      sp-server/src/main/java/com/pj/project/sync/bo/ItemTypeBO.java
  48. 17 0
      sp-server/src/main/java/com/pj/project/sync/bo/PriceFactorDTO.java
  49. 11 0
      sp-server/src/main/java/com/pj/project/sync/bo/SubExpenseDTO.java
  50. 29 0
      sp-server/src/main/java/com/pj/project/sync/bo/SyncResultBO.java
  51. 39 0
      sp-server/src/main/java/com/pj/project/sync/dto/IExpensePriceReq.java
  52. 18 0
      sp-server/src/main/java/com/pj/project/sync/dto/ItemTypeDTO.java
  53. 13 0
      sp-server/src/main/java/com/pj/project/sync/dto/PartnerDTO.java
  54. 29 0
      sp-server/src/main/java/com/pj/project/sync/dto/PartnerParam.java
  55. 18 0
      sp-server/src/main/java/com/pj/project/sync/dto/item/IFactorItem.java
  56. 17 0
      sp-server/src/main/java/com/pj/project/sync/dto/item/IOrderFactorDiffItem.java
  57. 29 0
      sp-server/src/main/java/com/pj/project/sync/dto/item/IOrderItem.java
  58. 19 0
      sp-server/src/main/java/com/pj/project/sync/request/IExpenseFactorQueryReq.java
  59. 31 0
      sp-server/src/main/java/com/pj/project/sync/request/IExpenseListQueryReq.java
  60. 37 0
      sp-server/src/main/java/com/pj/project/sync/request/IExpensePriceReq.java
  61. 19 0
      sp-server/src/main/java/com/pj/project/sync/request/IExpenseQueryReq.java
  62. 41 0
      sp-server/src/main/java/com/pj/project/sync/request/IOrderPriceReq.java
  63. 18 0
      sp-server/src/main/java/com/pj/project/sync/request/item/IFactorItem.java
  64. 17 0
      sp-server/src/main/java/com/pj/project/sync/request/item/IOrderFactorDiffItem.java
  65. 31 0
      sp-server/src/main/java/com/pj/project/sync/request/item/IOrderItem.java
  66. 22 0
      sp-server/src/main/java/com/pj/project/sync/response/IExpenseFactorQueryRes.java
  67. 18 0
      sp-server/src/main/java/com/pj/project/sync/response/IExpenseListQueryRes.java
  68. 19 0
      sp-server/src/main/java/com/pj/project/sync/response/IExpensePriceRes.java
  69. 13 0
      sp-server/src/main/java/com/pj/project/sync/response/IExpenseQueryRes.java
  70. 41 0
      sp-server/src/main/java/com/pj/project/sync/response/IOrderPriceRes.java
  71. 107 0
      sp-server/src/main/java/com/pj/project/sync/response/item/IExpenseItem.java
  72. 24 0
      sp-server/src/main/java/com/pj/project/sync/response/item/IFireResultItem.java
  73. 42 0
      sp-server/src/main/java/com/pj/project/sync/response/item/IPriceFactorItem.java
  74. 26 0
      sp-server/src/main/java/com/pj/project/sync/response/item/IrulesItem.java
  75. 28 0
      sp-server/src/main/java/com/pj/project/sync/response/item/OrderPriceResultItem.java
  76. 11 0
      sp-server/src/main/java/com/pj/project/sync/response/item/PriceDetailItem.java
  77. 68 0
      sp-server/src/main/java/com/pj/project/sync/task/SyncTask.java
  78. 54 18
      sp-server/src/main/java/com/pj/project/tb_account/AutomaticPay.java
  79. 4 0
      sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java
  80. 0 17
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessController.java
  81. 241 86
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
  82. 0 14
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java
  83. 0 432
      sp-server/src/main/java/com/pj/project/tb_business_item/PayTask.java
  84. 4 0
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItem.java
  85. 18 4
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemService.java
  86. 6 1
      sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomer.java
  87. 7 0
      sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerController.java
  88. 37 1
      sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerService.java
  89. 5 0
      sp-server/src/main/java/com/pj/project/tb_deduction_record/TbDeductionRecord.java
  90. 5 1
      sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetails.java
  91. 70 139
      sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java
  92. 1 7
      sp-server/src/main/java/com/pj/project/tb_fee_details/statics/FeeTypeStatics.java
  93. 67 0
      sp-server/src/main/java/com/pj/project/tb_fee_item/TbFeeItem.java
  94. 36 0
      sp-server/src/main/java/com/pj/project/tb_fee_item/TbFeeItemController.java
  95. 21 0
      sp-server/src/main/java/com/pj/project/tb_fee_item/TbFeeItemMapper.java
  96. 8 0
      sp-server/src/main/java/com/pj/project/tb_fee_item/TbFeeItemMapper.xml
  97. 22 0
      sp-server/src/main/java/com/pj/project/tb_fee_item/TbFeeItemService.java
  98. 4 0
      sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatistics.java
  99. 5 1
      sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsController.java
  100. 8 7
      sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsMapper.xml

+ 2 - 2
app-ui/manifest.json

@@ -83,11 +83,11 @@
     "vueVersion" : "2",
     "h5" : {
         "router" : {
-            "base" : "/h5",
+            "base" : "/h5/",
             "mode" : "history"
         },
         "devServer" : {
-            "https" : true
+            "https" : false
         }
     }
 }

+ 0 - 28
app-ui/pages/index/index.vue

@@ -93,20 +93,6 @@ export default {
         text: '充值',
         url: '/pages/account/account-redirect',
       },
-        {
-          id: 'tb-declare',
-          auth: false,
-          icon: '../../static/home-icon-07.jpg',
-          text: '申报录入',
-          url: '/pages/declare/add',
-        },
-        {
-          id: 'tb-disinfect',
-          auth: false,
-          icon: '../../static/home-icon-06.jpg',
-          text: '消杀申报',
-          url: '/pages/disinfect/addDisinfect',
-        },
         // {
         // 	id: 'tb-business',
         // 	auth: true,
@@ -153,20 +139,6 @@ export default {
 
         // },
         {
-          id: 'tb-declare',
-          auth: false,
-          icon: '../../static/home-icon-07.jpg',
-          text: '申报录入',
-          url: '/pages/declare/add',
-        },
-        {
-          id: 'tb-disinfect',
-          auth: false,
-          icon: '../../static/home-icon-06.jpg',
-          text: '消杀申报',
-          url: '/pages/disinfect/addDisinfect',
-        },
-        {
           auth: false,
           icon: '../../static/home-icon-03.png',
           text: '业务管理',

+ 527 - 598
app-ui/pages/onely-disinfect/type-business-edit.vue

@@ -1,619 +1,548 @@
 <template>
-  <view>
-    <view class="box">
-      <view class="top">
-        <text class="title">{{ goods.name }}</text>
-      </view>
-      <view class="item" v-if="goods.needDeclare==1">
-        <view class="l">
-          <text style="color: red;" v-if="goods.needDeclare==1">*</text>
-          申报单号:
-        </view>
-        <view class="r">
-          <u-input placeholder="申报订单号" v-model="form.declareNo" clearable readonly>
-            <text slot="suffix" style="font-size: 50rpx;" @click="selectDeclare">+</text>
-          </u-input>
-        </view>
-      </view>
-      <view class="item" v-if="goods.needCustomer==1">
-        <view class="l">客户:</view>
-        <view class="r" style="flex: 12;">
-          <picker :disabled="goods.needDeclare==1" v-if="customer.customerList.length>0" class="p-picker"
-                  @change="customerChange($event)" :value="customer.index" :range="customer.customerList"
-                  range-key="name">
-            <text class="p-text">{{ customer.customerList[customer.index].name }}</text>
-          </picker>
-        </view>
-      </view>
-     <view class="item" v-if="goods.needOwner==1">
-     	<view class="l">
-     		<text style="color: red;">*</text>
-     		货物:
-     	</view>
-     	<view class="r">
-     		<u-input placeholder="输入货物" v-model="form.businessGoodsName">
-     		</u-input>
-     	</view>
-     </view>
-     <view class="item">
-     	<view class="l">
-     		<text style="color: red;" v-if="goods.needOperateTime">*</text>
-     		件数:
-     	</view>
-     	<view class="r">
-     		<u-input v-model="form.businessGoodsNum" type="number">
-     		</u-input>
-     	</view>
-     </view>
-      <view class="item">
-        <view class="l">作业人员:</view>
-        <view class="r">
-          <u-input placeholder="输入作业人员" v-model="form.operator">
-          </u-input>
-        </view>
-      </view>
-      <view class="item-line">
-        <u-row style="height: 40px;">
-          <u-col span=4>车辆</u-col>
-          <u-col span=8>
-            <u-button type="primary" text="添加" @click="addCar" icon="plus"
-                      style="width: 60px;height: 26px;" v-if="goods.mulCar==1||car.list.length==0"/>
-          </u-col>
-        </u-row>
-      </view>
-      <view class="item" v-for="(car,index) in car.list" :key="index">
-        <view class="l">车牌:</view>
-        <view class="r">
-          <u-input placeholder="车辆" v-model="car.carNo" readonly>
-            <view slot="suffix" style="display: flex;">
-              <u-icon @click="editCar(car)" size="20" name="edit-pen-fill" color="blue"></u-icon>
-              <u-icon style="margin-left:20rpx;" size="20" @click="delCar(car)" name="close-circle-fill"
-                      color="red"></u-icon>
-            </view>
-          </u-input>
-        </view>
-      </view>
-      <view class="item-line" style="margin-top: 30rpx;">
-        业务项
-      </view>
-      <view class="business-list" v-for="(item,index) in typeList">
-        <u-row>
-          <u-col span="4">
-            <text>
-              <text style="color: red;display: inline;" v-if="item.need==1">*</text>
-              {{ item.name }}:
-            </text>
-          </u-col>
-          <u-col span="8" style="display: flex;">
-            <u-row>
-              <u-col span="10" @click="showSelect(item)">
-                {{ item.itemName ? item.itemName : '请选择' }}
-              </u-col>
-              <u-col span="2" @click="item.itemName='',item.itemId=''" v-if="item.itemId">
-                <u-icon style="margin-left:15rpx;display: inline;" size="20" name="close-circle-fill"
-                        color="red"></u-icon>
-              </u-col>
-            </u-row>
-          </u-col>
-        </u-row>
-        <view style="display: flex;position: relative;left: 30%;">
-          <u-number-box style="margin-left: 15rpx;" v-if="item.itemName" :disabled="item.inc==0"
-                        v-model="item.num"></u-number-box>
-          <text style="margin-left: 20rpx;color: red;" v-if="item.itemName">
-            ¥{{ item.num * item.price }}
-          </text>
-          <view style="margin-left: 60rpx;" @click="remarkFn(item)">
-            备注
-          </view>
-        </view>
-        <u-line></u-line>
-      </view>
-      <view class="hj" v-show="totalPrice>0">
-        合计:{{ totalPrice }}元
-      </view>
-    </view>
-    <u-button type="primary" text="确定" @click="saveFn" v-show="perList.indexOf('tb-flex-business-edit')!==-1">
-    </u-button>
-    <!-- ---------------------------------------------------------- -->
-    <view class="bottom-safety"></view>
-    <u-picker :show="show" :columns="columns" @confirm="confirmFn" keyName="itemName" @cancel="show=false">
-    </u-picker>
-  </view>
+	<view>
+		<view class="box">
+			<view class="top">
+				<text class="title">{{ goods.name }}</text>
+			</view>
+			<view class="item" v-if="goods.needCustomer==1">
+				<view class="l">客户:</view>
+				<view class="r" style="flex: 12;">
+					<picker v-if="customer.customerList.length>0" class="p-picker" @change="customerChange($event)"
+						:value="customer.index" :range="customer.customerList" range-key="name">
+						<text class="p-text">{{ customer.customerList[customer.index].name }}</text>
+					</picker>
+				</view>
+			</view>
+			<view class="item" v-if="goods.needOwner==1">
+				<view class="l">
+					<text style="color: red;">*</text>
+					货物:
+				</view>
+				<view class="r">
+					<u-input placeholder="输入货物" v-model="form.businessGoodsName">
+					</u-input>
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">
+					<text style="color: red;" v-if="goods.needOperateTime">*</text>
+					数量(件):
+				</view>
+				<view class="r">
+					<u-input v-model="form.businessGoodsNum" type="number">
+					</u-input>
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">作业人员:</view>
+				<view class="r">
+					<u-input placeholder="输入作业人员" v-model="form.operator">
+					</u-input>
+				</view>
+			</view>
+			<view class="item-line">
+				<u-row style="height: 40px;">
+					<u-col span=4>车辆</u-col>
+					<u-col span=8>
+						<u-button type="primary" text="添加" @click="addCar" icon="plus" style="width: 60px;height: 26px;"
+							v-if="goods.mulCar==1||car.list.length==0" />
+					</u-col>
+				</u-row>
+			</view>
+			<view class="item" v-for="(car,index) in car.list" :key="index">
+				<view class="l">车牌:</view>
+				<view class="r">
+					<u-input placeholder="车辆" v-model="car.carNo" readonly>
+						<view slot="suffix" style="display: flex;">
+							<u-icon @click="editCar(car)" size="20" name="edit-pen-fill" color="blue"></u-icon>
+							<u-icon style="margin-left:20rpx;" size="20" @click="delCar(car)" name="close-circle-fill"
+								color="red"></u-icon>
+						</view>
+					</u-input>
+				</view>
+			</view>
+			<view class="item-line" style="margin-top: 30rpx;">
+				业务项
+			</view>
+			<view class="business-list" v-for="(item,index) in typeList">
+				<u-row>
+					<u-col span="4">
+						<text>
+							<text style="color: red;display: inline;" v-if="item.need==1">*</text>
+							{{ item.name }}:
+						</text>
+					</u-col>
+					<u-col span="8" style="display: flex;">
+						<u-row>
+							<u-col span="10" @click="showSelect(item)">
+								{{ item.itemName ? item.itemName : '请选择' }}
+							</u-col>
+							<u-col span="2" @click="item.itemName='',item.itemId=''" v-if="item.itemId">
+								<u-icon style="margin-left:15rpx;display: inline;" size="20" name="close-circle-fill"
+									color="red"></u-icon>
+							</u-col>
+						</u-row>
+					</u-col>
+				</u-row>
+				<view style="display: flex;position: relative;left: 30%;">
+					<u-number-box style="margin-left: 15rpx;" v-if="item.itemName" :disabled="item.inc==0"
+						v-model="item.num"></u-number-box>
+					<text style="margin-left: 20rpx;color: red;" v-if="item.itemName">
+						¥{{ item.num * item.price }}
+					</text>
+					<view style="margin-left: 60rpx;" @click="remarkFn(item)">
+						备注
+					</view>
+				</view>
+				<u-line></u-line>
+			</view>
+			<view class="hj" v-show="totalPrice>0">
+				合计:{{ totalPrice }}元
+			</view>
+		</view>
+		<u-button type="primary" text="确定" @click="saveFn" v-show="perList.indexOf('tb-flex-business-edit')!==-1">
+		</u-button>
+		<!-- ---------------------------------------------------------- -->
+		<view class="bottom-safety"></view>
+		<u-picker :show="show" :columns="columns" @confirm="confirmFn" keyName="itemName" @cancel="show=false">
+		</u-picker>
+	</view>
 </template>
 
 <script>
-export default {
-  data() {
-    return {
-      show: false,
-      columns: [],
-      customerId: '1',
-      customer: {
-        index: 0,
-        customerList: [],
-      },
-      goods: {
-        id: '',
-        name: '',
-        mulCar: 0
-      },
-      typeList: [],
-      allTypeList: [],
-      form: {
-        customerId: '',
-        declareNo: '',
-        carNo: '',
-        owner: '',
-        carSize: '',
-        goodsName: '',
-        netWeight: '',
-      },
-      show: false,
-      item: {
-        items: []
-      },
-      car: {
-        list: [{
-          id: '',
-          carNo: '',
-          index: 0
-        }]
-      },
-      perList: []
-    }
-  },
-  computed: {
-    totalPrice() {
-      let typeList = this.typeList.filter(obj => obj.itemName);
-      let price = 0;
-      for (let i in typeList) {
-        let type = typeList[i];
-        price = price + type.price * type.num;
-      }
-      return price;
-    },
-  },
-  onLoad(options) {
-    let id = options.id;
-    this.form.id = id;
-    this.customerId = uni.getStorageSync('customerId');
-    this.goods = JSON.parse(options.goodsJson);
-    this.getOtherBusinessById();
-    let that = this;
-    uni.$on('getSelectDeclare', declare => {
-      that.$nextTick(() => {
-        that.handlerSelectDeclare(declare)
-      })
-    })
-    uni.$on('getCar', car => {
-      that.$nextTick(() => {
-        that.handlerCar(car)
-      })
-    })
-    uni.$on('getRemark', type => {
-      that.$nextTick(() => {
-        that.handlerRemark(type)
-      })
-    })
+	export default {
+		data() {
+			return {
+				show: false,
+				columns: [],
+				customerId: '1',
+				customer: {
+					index: 0,
+					customerList: [],
+				},
+				goods: {
+					id: '',
+					name: '',
+					mulCar: 0
+				},
+				typeList: [],
+				allTypeList: [],
+				form: {
+					customerId: '',
+					declareNo: '',
+					carNo: '',
+					owner: '',
+					carSize: '',
+					goodsName: '',
+					netWeight: '',
+				},
+				show: false,
+				item: {
+					items: []
+				},
+				car: {
+					list: [{
+						id: '',
+						carNo: '',
+						index: 0
+					}]
+				},
+				perList: []
+			}
+		},
+		computed: {
+			totalPrice() {
+				let typeList = this.typeList.filter(obj => obj.itemName);
+				let price = 0;
+				for (let i in typeList) {
+					let type = typeList[i];
+					price = price + type.price * type.num;
+				}
+				return price;
+			},
+		},
+		onLoad(options) {
+			let id = options.id;
+			this.form.id = id;
+			this.customerId = uni.getStorageSync('customerId');
+			this.goods = JSON.parse(options.goodsJson);
+			this.getOtherBusinessById();
+			let that = this;
 
-  },
-  onShow() {
+			uni.$on('getCar', car => {
+				that.$nextTick(() => {
+					that.handlerCar(car)
+				})
+			})
+			uni.$on('getRemark', type => {
+				that.$nextTick(() => {
+					that.handlerRemark(type)
+				})
+			})
 
-    this.perList = uni.getStorageSync('perList')
-  },
-  methods: {
-    remarkFn(type) {
-      console.log(type)
-      let remark = type.remark ? type.remark : '';
-      this.$common.to('/pages/onely-disinfect/add-remark?needRemark=' + type.needRemark + '&typeId=' + type.id + '&remark=' + remark)
-    },
-    handlerRemark(type) {
-      let typeList = this.typeList;
-      typeList.filter(obj => type.typeId == obj.id).forEach(obj => obj.remark = type.remark)
-    },
-    addCar() {
-      this.car.list.push({
-        index: Math.random(),
-        id: '',
-        carNo: '',
-        index: 0
-      })
-    },
-    filterItems(car) {
-      let carList = this.car.list;
-      let filterTypeList = JSON.parse(JSON.stringify(this.allTypeList));
-      if (carList.length == 0) {
-        this.typeList = filterTypeList;
-        return;
-      }
-      if (!car) {
-        let checkList = carList.filter(obj => obj.carType.indexOf('空') === -1);
-        if (checkList.length > 0) {
-          car = checkList[0];
-        }
-      }
-      let carSize = car.carSize;
-      let carType = car.carType;
-      if (carType.indexOf('空') !== -1 && carList.length > 1) {
-        return;
-      }
-      let netWeight = car.netWeight;
-      let tempList = [];
-      for (let i in filterTypeList) {
-        let type = filterTypeList[i];
-        let items = type.items;
-        if (carType) {
-          items = items.filter(item => item.itemType && item.itemType.indexOf(carType) !== -1);
-        }
-        if (carSize && carSize > 1) {
-          items = items.filter(item => item.minLength <= carSize && item.carLength >= carSize);
-        }
-        if (netWeight && netWeight > 1 && carType.indexOf('空') == -1) {
-          items = items.filter(item => item.minWeight <= netWeight && item.maxWeight >= netWeight);
-        }
-        let itemIds = items.map(item => item.id);
-        if (itemIds.indexOf(type.itemId) == -1) {
-          this.cleanItem(type);
-        }
-        type.items = items;
-        tempList.push(type);
-      }
-      this.typeList = tempList;
-    },
-    cleanItem(type) {
-      type.itemId = '';
-      type.itemName = '';
-      type.price = '';
-    },
-    getOtherBusinessById() {
-      this.$api.getOtherBusinessById({
-        id: this.form.id
-      }).then(resp => {
-        let data = resp.data;
-        this.car.list = data.cars;
-        let items = data.items;
-        this.form = data;
-        this.getTypeByGoodsId(items);
-        this.getCustomerList(data.customerId);
-      })
-    },
-    showSelect(item) {
-      if (this.validBefore()) {
-        this.columns = [];
-        this.columns.push(item.items);
-        this.show = true;
-      }
-    },
+		},
+		onShow() {
 
-    confirmFn(e) {
-      let selects = e.value;
-      if (selects.length > 0) {
-        let item = selects[0];
-        let typeId = item.typeId;
-        let typeList = this.typeList;
-        typeList.filter(obj => obj.id == typeId).forEach(obj => {
-          obj.itemId = item.id;
-          obj.itemName = item.itemName;
-          obj.inc = item.inc;
-          obj.price = item.price;
-          obj.needRemark = item.needRemark;
-        })
-      }
-      this.show = false;
-    },
-    getTypeByGoodsId(items) {
-      this.$api.getTypeByGoodsId({
-        goodsId: this.goods.id
-      }).then(resp => {
-        let list = resp.data;
-        for (let i in items) {
-          let item = items[i];
-          for (let j in list) {
-            let type = list[j];
-            if (type.id == item.itemTypeId) {
-              type.items.filter(obj => obj.id == item.itemId)
-                  .forEach(obj => {
-                    console.log(obj)
-                    type.num = item.num;
-                    type.price = item.itemPrice;
-                    type.itemName = item.itemName;
-                    type.itemId = item.itemId;
-                    type.inc = obj.inc;
-                    type.remark = item.remark;
-                  })
+			this.perList = uni.getStorageSync('perList')
+		},
+		methods: {
+			remarkFn(type) {
+				console.log(type)
+				let remark = type.remark ? type.remark : '';
+				this.$common.to('/pages/onely-disinfect/add-remark?needRemark=' + type.needRemark + '&typeId=' + type.id +
+					'&remark=' + remark)
+			},
+			handlerRemark(type) {
+				let typeList = this.typeList;
+				typeList.filter(obj => type.typeId == obj.id).forEach(obj => obj.remark = type.remark)
+			},
+			addCar() {
+				this.car.list.push({
+					index: Math.random(),
+					id: '',
+					carNo: '',
+					index: 0
+				})
+			},
+			filterItems(car) {
+				let carList = this.car.list;
+				let filterTypeList = JSON.parse(JSON.stringify(this.allTypeList));
+				if (carList.length == 0) {
+					this.typeList = filterTypeList;
+					return;
+				}
+				if (!car) {
+					let checkList = carList.filter(obj => obj.carType.indexOf('空') === -1);
+					if (checkList.length > 0) {
+						car = checkList[0];
+					}
+				}
+				let carSize = car.carSize;
+				let carType = car.carType;
+				if (carType.indexOf('空') !== -1 && carList.length > 1) {
+					return;
+				}
+				let netWeight = car.netWeight;
+				let tempList = [];
+				for (let i in filterTypeList) {
+					let type = filterTypeList[i];
+					let items = type.items;
+					if (carType) {
+						items = items.filter(item => item.itemType && item.itemType.indexOf(carType) !== -1);
+					}
+					if (carSize && carSize > 1) {
+						items = items.filter(item => item.minLength <= carSize && item.carLength >= carSize);
+					}
+					if (netWeight && netWeight > 1 && carType.indexOf('空') == -1) {
+						items = items.filter(item => item.minWeight <= netWeight && item.maxWeight >= netWeight);
+					}
+					let itemIds = items.map(item => item.id);
+					if (itemIds.indexOf(type.itemId) == -1) {
+						this.cleanItem(type);
+					}
+					type.items = items;
+					tempList.push(type);
+				}
+				this.typeList = tempList;
+			},
+			cleanItem(type) {
+				type.itemId = '';
+				type.itemName = '';
+				type.price = '';
+			},
+			getOtherBusinessById() {
+				this.$api.getOtherBusinessById({
+					id: this.form.id
+				}).then(resp => {
+					let data = resp.data;
+					this.car.list = data.cars;
+					let items = data.items;
+					this.form = data;
+					this.getTypeByGoodsId(items);
+					this.getCustomerList(data.customerId);
+				})
+			},
+			showSelect(item) {
+				if (this.validBefore()) {
+					this.columns = [];
+					this.columns.push(item.items);
+					this.show = true;
+				}
+			},
 
+			confirmFn(e) {
+				let selects = e.value;
+				if (selects.length > 0) {
+					let item = selects[0];
+					let typeId = item.typeId;
+					let typeList = this.typeList;
+					typeList.filter(obj => obj.id == typeId).forEach(obj => {
+						obj.itemId = item.id;
+						obj.itemName = item.itemName;
+						obj.inc = item.inc;
+						obj.price = item.price;
+						obj.needRemark = item.needRemark;
+					})
+				}
+				this.show = false;
+			},
+			getTypeByGoodsId(items) {
+				this.$api.getTypeByGoodsId({
+					goodsId: this.goods.id
+				}).then(resp => {
+					let list = resp.data;
+					for (let i in items) {
+						let item = items[i];
+						for (let j in list) {
+							let type = list[j];
+							if (type.id == item.itemTypeId) {
+								type.items.filter(obj => obj.id == item.itemId)
+									.forEach(obj => {
+										console.log(obj)
+										type.num = item.num;
+										type.price = item.itemPrice;
+										type.itemName = item.itemName;
+										type.itemId = item.itemId;
+										type.inc = obj.inc;
+										type.remark = item.remark;
+									})
 
-            }
-          }
-        }
-        this.allTypeList = JSON.parse(JSON.stringify(list));
-        this.typeList = list;
-      })
-    },
-    getCustomerList(customerId) {
-      this.$api.getCustomerList({
-        pageNo: 1,
-        pageSize: 100
-      }).then(resp => {
-        let list = resp.data;
-        console.log(list.map(obj => obj.id).indexOf(customerId))
-        this.customer.index = list.map(obj => obj.id).indexOf(customerId);
-        this.customer.customerList = list;
-        console.log(this.customer)
-      })
-    },
-    customerChange(e) {
-      var value = e.detail.value; //当前picker选中的值
-      this.customer.index = value;
-    },
-    handlerCar(car) {
-      let list = this.car.list;
-      let check = list.filter(obj => obj.carNo == car.carNo).pop();
-      if (check) {
-        check.carSize = car.carSize;
-        check.netWeight = car.netWeight;
-        check.carType = car.carType;
-      } else {
-        this.car.list.push(car);
-      }
-      this.clearEmptyCar(car);
-    },
-    clearEmptyCar(car) {
-      let list = this.car.list;
-      let obj = list.filter(obj => !obj.carNo).pop();
-      if (obj) {
-        this.car.list.splice(list.indexOf(obj), 1);
-      }
-      this.filterItems(car);
-    },
-    handlerSelectDeclare(declare) {
-      let oldDeclareNo = this.form.declareNo;
-      if (oldDeclareNo && oldDeclareNo !== declare.declareNo) {
-        this.car.list = [];
-      }
-      this.form.declareNo = declare.declareNo;
-      this.form.cardNo = declare.carNo;
-      this.form.chinaCarNo = declare.chinaCarNo;
-      this.form.netWeight = declare.grossWeight;
-      this.form.owner = declare.sendUnit;
-      let customerList = this.customer.customerList;
-      this.customer.index = customerList.map(customer => customer.id).indexOf(declare.customerId);
-      let carNo = declare.carNo;
-      let grossWeight = declare.grossWeight;
-      let carList = this.car.list;
-      let exit = carList.filter(obj => obj.carNo == carNo).pop();
-      if (!exit) {
-        let car = {
-          carNo: carNo,
-          netWeight: grossWeight,
-          carType: '载重'
-        }
-        this.car.list.push(car)
-      }
-      this.form.cardNo = declare.carNo;
-      this.form.chinaCarNo = declare.chinaCarNo;
-      this.form.netWeight = declare.grossWeight;
-      let chinaCarNo = declare.chinaCarNo;
-      if (chinaCarNo) {
-        let list = [];
-        chinaCarNo.replace(",", ",").split(",").forEach(carNo => {
-          let exit = carList.filter(obj => obj.carNo == carNo).pop();
-          if (!exit) {
-            let car = {
-              carNo: carNo,
-              carType: '空车'
-            }
-            this.car.list.push(car)
-          }
-        })
-      }
-      this.clearEmptyCar();
-    },
 
-    selectDeclare() {
-      this.$common.to('/pages/business-entering/declare-select?declareNo=' + this.form.declareNo)
-    },
-    editCar(car) {
-      let goods = this.goods;
-      this.$common.to('/pages/onely-disinfect/car-manager?carJson=' + JSON.stringify(car) + "&needCarSize=" +
-          goods.needCarSize + '&needWeight=' + goods.needWeight)
-    },
-    delCar(car) {
-      let list = this.car.list;
-      if (list.length == 1) {
-        this.$common.toast('至少有一辆车');
-        return;
-      }
-      this.car.list.splice(list.indexOf(car), 1);
-      this.filterItems();
-    },
-    validBefore() {
-      let form = this.form;
-      let goods = this.goods;
-      let needDeclare = goods.needDeclare;
-      let needCustomer = goods.needCustomer;
-      let index = this.customer.index;
-      if (needDeclare == 1 && !form.declareNo) {
-        this.$common.toast('请选择申报单');
-        return false;
-      }
-     if (!form.businessGoodsName && goods.needOwner == 1) {
-     	this.$common.toast('请填写货物');
-     	return false;
-     }
-     let needOperateTime = goods.needOperateTime;
-     let businessGoodsNum = form.businessGoodsNum;
-     if ((!businessGoodsNum || businessGoodsNum <= 0) && needOperateTime == '1') {
-     	this.$common.toast('请填写件数');
-     	return false;
-     }
-      let carList = this.car.list;
-      if (carList.length == 0) {
-        this.$common.toast('请录入车辆');
-        return false;
-      }
-      let needCarSize = goods.needCarSize;
-      let needWeight = goods.needWeight;
-      for (let i in carList) {
-        let car = carList[i];
-        if (needCarSize == 1 && !car.carSize) {
-          this.$common.toast('请补充' + car.carNo + '的规格');
-          return false;
-        }
-        if (needWeight == 1 && car.carType.indexOf('重') !== -1 && !car.netWeight) {
-          this.$common.toast('请补充' + car.carNo + '载重');
-          return false;
-        }
-      }
-      return true;
-    },
-    check() {
-      let form = this.form;
-      let goods = this.goods;
-      let needDeclare = goods.needDeclare;
-      let needCustomer = goods.needCustomer;
-      let index = this.customer.index;
-      if (needDeclare == 1 && !form.declareNo) {
-        this.$common.toast('请选择申报单');
-        return false;
-      }
-     if (!form.businessGoodsName && goods.needOwner == 1) {
-     	this.$common.toast('请填写货物');
-     	return false;
-     }
-     let needOperateTime = goods.needOperateTime;
-     let businessGoodsNum = form.businessGoodsNum;
-     if ((!businessGoodsNum || businessGoodsNum <= 0) && needOperateTime == '1') {
-     	this.$common.toast('请填写件数');
-     	return false;
-     }
-      let carList = this.car.list;
-      if (carList.length == 0) {
-        this.$common.toast('请录入车辆');
-        return false;
-      }
-      let needCarSize = goods.needCarSize;
-      let needWeight = goods.needWeight;
-      for (let i in carList) {
-        let car = carList[i];
-        if (needCarSize == 1 && !car.carSize) {
-          this.$common.toast('请补充' + car.carNo + '的规格');
-          return false;
-        }
-        if (needWeight == 1 && car.carType && car.carType.indexOf('重') !== -1 && !car.netWeight) {
-          this.$common.toast('请补充' + car.carNo + '载重');
-          return false;
-        }
-      }
-      let typeList = this.typeList;
-      let selectList = [];
-      for (let i in typeList) {
-        let type = typeList[i];
-        if (type.need == 1 && !type.itemId) {
-          this.$common.toast('【' + type.name + '】必选');
-          return false;
-        }
-        if (type.needRemark == 1 && !type.remark) {
-          this.$common.toast('请录入【' + type.name + '】备注');
-          return false;
-        }
-        if (type.itemId) {
-          let obj = {
-            typeId: type.id,
-            typeName: type.name,
-            id: type.itemId,
-            num: type.num,
-            price: type.price,
-            remark: type.remark
-          }
-          selectList.push(obj);
-        }
-      }
-      this.form.itemJson = JSON.stringify(selectList);
-      this.form.carJson = JSON.stringify(this.car.list);
-      this.form.items = null;
-      this.form.cars = null;
-      if (needCustomer == 1) {
-        let customerList = this.customer.customerList;
-        let index = this.customer.index;
-        let customer = customerList[index];
-        this.form.customerId = customer.id;
-        this.form.customerName = customer.name;
-      } else {
-        this.form.customerId = '';
-        this.form.customerName = '';
-      }
-      this.form.goodsId = this.goods.id;
-      this.form.goodsName = this.goods.name;
-      let chinaCarNo = carList
-          .filter(car => this.$common.isCarNo(car.carNo.toUpperCase()))
-          .map(car => car.carNo.toUpperCase())
-          .join("、");
-      let yueCarNo = carList
-          .filter(car => !this.$common.isCarNo(car.carNo.toUpperCase()))
-          .map(car => car.carNo.toUpperCase())
-          .join("、");
-      this.form.cardNo = yueCarNo;
-      this.form.chinaCarNo = chinaCarNo;
-      return true;
-    },
-    saveFn() {
-      if (this.check()) {
-        let obj = this.$common.removeNull(this.form);
-        this.$api.editOtherBusiness(obj).then(resp => {
-          if (resp.code == 200) {
-            this.$common.toast('修改成功');
-            setTimeout(() => {
-              this.$common.to('/pages/onely-disinfect/Index')
-            }, 1000)
-          }
-        })
-      }
-    },
-  }
-}
+							}
+						}
+					}
+					this.allTypeList = JSON.parse(JSON.stringify(list));
+					this.typeList = list;
+				})
+			},
+			getCustomerList(customerId) {
+				this.$api.getCustomerList({
+					pageNo: 1,
+					pageSize: 100
+				}).then(resp => {
+					let list = resp.data;
+					console.log(list.map(obj => obj.id).indexOf(customerId))
+					this.customer.index = list.map(obj => obj.id).indexOf(customerId);
+					this.customer.customerList = list;
+					console.log(this.customer)
+				})
+			},
+			customerChange(e) {
+				var value = e.detail.value; //当前picker选中的值
+				this.customer.index = value;
+			},
+			handlerCar(car) {
+				let list = this.car.list;
+				let check = list.filter(obj => obj.carNo == car.carNo).pop();
+				if (check) {
+					check.carSize = car.carSize;
+					check.netWeight = car.netWeight;
+					check.carType = car.carType;
+				} else {
+					this.car.list.push(car);
+				}
+				this.clearEmptyCar(car);
+			},
+			clearEmptyCar(car) {
+				let list = this.car.list;
+				let obj = list.filter(obj => !obj.carNo).pop();
+				if (obj) {
+					this.car.list.splice(list.indexOf(obj), 1);
+				}
+				this.filterItems(car);
+			},
+
+			editCar(car) {
+				let goods = this.goods;
+				this.$common.to('/pages/onely-disinfect/car-manager?carJson=' + JSON.stringify(car) + "&needCarSize=" +
+					goods.needCarSize + '&needWeight=' + goods.needWeight)
+			},
+			delCar(car) {
+				let list = this.car.list;
+				if (list.length == 1) {
+					this.$common.toast('至少有一辆车');
+					return;
+				}
+				this.car.list.splice(list.indexOf(car), 1);
+				this.filterItems();
+			},
+			validBefore() {
+				let form = this.form;
+				let goods = this.goods;
+				let needCustomer = goods.needCustomer;
+				let index = this.customer.index;
+				if (!form.businessGoodsName && goods.needOwner == 1) {
+					this.$common.toast('请填写货物');
+					return false;
+				}
+				let needOperateTime = goods.needOperateTime;
+				let businessGoodsNum = form.businessGoodsNum;
+				if ((!businessGoodsNum || businessGoodsNum <= 0) && needOperateTime == '1') {
+					this.$common.toast('请填写件数');
+					return false;
+				}
+				let carList = this.car.list;
+				if (carList.length == 0) {
+					this.$common.toast('请录入车辆');
+					return false;
+				}
+				let needCarSize = goods.needCarSize;
+				let needWeight = goods.needWeight;
+				for (let i in carList) {
+					let car = carList[i];
+					if (needCarSize == 1 && !car.carSize) {
+						this.$common.toast('请补充' + car.carNo + '的规格');
+						return false;
+					}
+					if (needWeight == 1 && car.carType.indexOf('重') !== -1 && !car.netWeight) {
+						this.$common.toast('请补充' + car.carNo + '载重');
+						return false;
+					}
+				}
+				return true;
+			},
+			check() {
+				let form = this.form;
+				let goods = this.goods;
+				let needCustomer = goods.needCustomer;
+				let index = this.customer.index;
+				if (!form.businessGoodsName && goods.needOwner == 1) {
+					this.$common.toast('请填写货物');
+					return false;
+				}
+				let needOperateTime = goods.needOperateTime;
+				let businessGoodsNum = form.businessGoodsNum;
+				if ((!businessGoodsNum || businessGoodsNum <= 0) && needOperateTime == '1') {
+					this.$common.toast('请填写件数');
+					return false;
+				}
+				let carList = this.car.list;
+				if (carList.length == 0) {
+					this.$common.toast('请录入车辆');
+					return false;
+				}
+				let needCarSize = goods.needCarSize;
+				let needWeight = goods.needWeight;
+				for (let i in carList) {
+					let car = carList[i];
+					if (needCarSize == 1 && !car.carSize) {
+						this.$common.toast('请补充' + car.carNo + '的规格');
+						return false;
+					}
+					if (needWeight == 1 && car.carType && car.carType.indexOf('重') !== -1 && !car.netWeight) {
+						this.$common.toast('请补充' + car.carNo + '载重');
+						return false;
+					}
+				}
+				let typeList = this.typeList;
+				let selectList = [];
+				for (let i in typeList) {
+					let type = typeList[i];
+					if (type.need == 1 && !type.itemId) {
+						this.$common.toast('【' + type.name + '】必选');
+						return false;
+					}
+					if (type.needRemark == 1 && !type.remark) {
+						this.$common.toast('请录入【' + type.name + '】备注');
+						return false;
+					}
+					if (type.itemId) {
+						let obj = {
+							typeId: type.id,
+							typeName: type.name,
+							id: type.itemId,
+							num: type.num,
+							price: type.price,
+							remark: type.remark
+						}
+						selectList.push(obj);
+					}
+				}
+				this.form.itemJson = JSON.stringify(selectList);
+				this.form.carJson = JSON.stringify(this.car.list);
+				this.form.items = null;
+				this.form.cars = null;
+				if (needCustomer == 1) {
+					let customerList = this.customer.customerList;
+					let index = this.customer.index;
+					let customer = customerList[index];
+					this.form.customerId = customer.id;
+					this.form.customerName = customer.name;
+				} else {
+					this.form.customerId = '';
+					this.form.customerName = '';
+				}
+				this.form.goodsId = this.goods.id;
+				this.form.goodsName = this.goods.name;
+				let chinaCarNo = carList
+					.filter(car => this.$common.isCarNo(car.carNo.toUpperCase()))
+					.map(car => car.carNo.toUpperCase())
+					.join("、");
+				let yueCarNo = carList
+					.filter(car => !this.$common.isCarNo(car.carNo.toUpperCase()))
+					.map(car => car.carNo.toUpperCase())
+					.join("、");
+				this.form.cardNo = yueCarNo;
+				this.form.chinaCarNo = chinaCarNo;
+				return true;
+			},
+			saveFn() {
+				if (this.check()) {
+					let obj = this.$common.removeNull(this.form);
+					this.$api.editOtherBusiness(obj).then(resp => {
+						if (resp.code == 200) {
+							this.$common.toast('修改成功');
+							setTimeout(() => {
+								this.$common.to('/pages/onely-disinfect/Index')
+							}, 1000)
+						}
+					})
+				}
+			},
+		}
+	}
 </script>
 
 <style lang="scss">
-page {
-  background-color: #fff;
-}
+	page {
+		background-color: #fff;
+	}
 
-.hs-item {
-  text-align: center;
-}
+	.hs-item {
+		text-align: center;
+	}
 
-.item-line {
-  color: #a2a2a2;
-  padding: 5px 0 10px 29px;
-  border-bottom: 1px solid #E5E5E5;
-}
+	.item-line {
+		color: #a2a2a2;
+		padding: 5px 0 10px 29px;
+		border-bottom: 1px solid #E5E5E5;
+	}
 
-.hj {
-  padding: 50rpx;
-  font-size: 40rpx;
-  color: red;
-  font-weight: bold;
-}
+	.hj {
+		padding: 50rpx;
+		font-size: 40rpx;
+		color: red;
+		font-weight: bold;
+	}
 
-.business-list {
-  line-height: 75rpx;
-  margin: 4rpx 0 0 48rpx;
+	.business-list {
+		line-height: 75rpx;
+		margin: 4rpx 0 0 48rpx;
 
-}
+	}
 
-.save-btn {
-  background-color: #ff4200;
-  height: 88rpx;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  margin: 60rpx;
-  color: #fff;
-  font-size: 30rpx;
-  font-weight: bold;
-  border-radius: 10rpx;
-}
+	.save-btn {
+		background-color: #ff4200;
+		height: 88rpx;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		margin: 60rpx;
+		color: #fff;
+		font-size: 30rpx;
+		font-weight: bold;
+		border-radius: 10rpx;
+	}
 
-@import '@/common/common.scss'
+	@import '@/common/common.scss'
 </style>

+ 4 - 75
app-ui/pages/onely-disinfect/type-business.vue

@@ -4,21 +4,10 @@
 			<view class="top">
 				<text class="title">{{ goods.name }}</text>
 			</view>
-			<view class="item" v-if="goods.needDeclare==1">
-				<view class="l">
-					<text style="color: red;" v-if="goods.needDeclare==1">*</text>
-					申报单号:
-				</view>
-				<view class="r">
-					<u-input placeholder="申报订单号" v-model="form.declareNo" clearable readonly>
-						<text slot="suffix" style="font-size: 50rpx;" @click="selectDeclare">+</text>
-					</u-input>
-				</view>
-			</view>
 			<view class="item" v-if="goods.needCustomer==1">
 				<view class="l">客户:</view>
 				<view class="r" style="flex: 12;">
-					<picker :disabled="goods.needDeclare==1" v-if="customer.customerList.length>0" class="p-picker"
+					<picker  v-if="customer.customerList.length>0" class="p-picker"
 						@change="customerChange($event)" :value="customer.index" :range="customer.customerList"
 						range-key="name">
 						<text class="p-text">{{ customer.customerList[customer.index].name }}</text>
@@ -38,7 +27,7 @@
 			<view class="item">
 				<view class="l">
 					<text style="color: red;" v-if="goods.needOperateTime">*</text>
-					件数
+					数量(件)
 				</view>
 				<view class="r">
 					<u-input v-model="form.businessGoodsNum" type="number">
@@ -184,11 +173,6 @@
 			this.getCustomerList();
 			this.getTypeByGoodsId();
 			let that = this;
-			uni.$on('getSelectDeclare', declare => {
-				that.$nextTick(() => {
-					that.handlerSelectDeclare(declare)
-				})
-			})
 			uni.$on('getCar', car => {
 				that.$nextTick(() => {
 					that.handlerCar(car)
@@ -333,53 +317,6 @@
 				}
 				this.filterItems(car);
 			},
-			handlerSelectDeclare(declare) {
-				let oldDeclareNo = this.form.declareNo;
-				if (oldDeclareNo && oldDeclareNo !== declare.declareNo) {
-					this.car.list = [];
-				}
-				this.form.declareNo = declare.declareNo;
-				this.form.cardNo = declare.carNo;
-				this.form.chinaCarNo = declare.chinaCarNo;
-				this.form.netWeight = declare.grossWeight;
-				this.form.owner = declare.sendUnit;
-				let customerList = this.customer.customerList;
-				this.customer.index = customerList.map(customer => customer.id).indexOf(declare.customerId);
-				let carNo = declare.carNo;
-				let grossWeight = declare.grossWeight;
-				let carList = this.car.list;
-				let exit = carList.filter(obj => obj.carNo == carNo).pop();
-				if (!exit) {
-					let car = {
-						carNo: carNo,
-						netWeight: grossWeight,
-						carType: '载重'
-					}
-					this.car.list.push(car)
-				}
-				this.form.cardNo = declare.carNo;
-				this.form.chinaCarNo = declare.chinaCarNo;
-				this.form.netWeight = declare.grossWeight;
-				let chinaCarNo = declare.chinaCarNo;
-				if (chinaCarNo) {
-					let list = [];
-					chinaCarNo.replace(",", ",").split(",").forEach(carNo => {
-						let exit = carList.filter(obj => obj.carNo == carNo).pop();
-						if (!exit) {
-							let car = {
-								carNo: carNo,
-								carType: '空车',
-							}
-							this.car.list.push(car)
-						}
-					})
-				}
-				this.clearEmptyCar();
-			},
-
-			selectDeclare() {
-				this.$common.to('/pages/business-entering/declare-select?declareNo=' + this.form.declareNo)
-			},
 			editCar(car) {
 				let goods = this.goods;
 				this.$common.to('/pages/onely-disinfect/car-manager?carJson=' + JSON.stringify(car) + "&needCarSize=" +
@@ -398,13 +335,9 @@
 			validBefore() {
 				let form = this.form;
 				let goods = this.goods;
-				let needDeclare = goods.needDeclare;
 				let needCustomer = goods.needCustomer;
 				let index = this.customer.index;
-				if (needDeclare == 1 && !form.declareNo) {
-					this.$common.toast('请选择申报单');
-					return false;
-				}
+				
 				if (!form.businessGoodsName && goods.needOwner == 1) {
 					this.$common.toast('请填写货物');
 					return false;
@@ -439,13 +372,9 @@
 			check() {
 				let form = this.form;
 				let goods = this.goods;
-				let needDeclare = goods.needDeclare;
 				let needCustomer = goods.needCustomer;
 				let index = this.customer.index;
-				if (needDeclare == 1 && !form.declareNo) {
-					this.$common.toast('请选择申报单');
-					return false;
-				}
+				
 				if (!form.businessGoodsName && goods.needOwner == 1) {
 					this.$common.toast('请填写货物');
 					return false;

+ 49 - 6
app-ui/pages/wx/pay.vue

@@ -34,7 +34,22 @@
 					</view>
 				</u-checkbox-group>
 			</view>
-
+			<view class="card" v-if="manager">
+				<view class="title">
+					入场管理费:
+				</view>
+					<view >
+						<label class="c-item">
+							<view class="l">
+								<u-checkbox :checked="manager.id!=''" :customStyle="{marginBottom: '8px'}" :name="manager.id"
+									disabled>
+								</u-checkbox>
+							</view>
+							<view class="c">{{ manager.label }}</view>
+							<view class="r">{{ manager.price }}元</view>
+						</label>
+					</view>
+			</view>
 			<view class="card" v-if="item.itemsPrice">
 				<view class="title">
 					<u-checkbox-group placement="column" v-model="businessSelect" @change="businessChange">
@@ -127,9 +142,13 @@
 				businessAble: true,
 				showPay: false,
 				judge: false,
+				manager:{
+				  id:''	
+				},
 				item: {
 					itemsPrice: 0,
 					businessId: '',
+					calculateId: '',
 					list: []
 				},
 				payTypeList: [{
@@ -156,7 +175,7 @@
 		mounted() {
 			this.getChannelCar();
 			this.getWxConfig();
-			
+
 		},
 		beforeDestroy() {
 			this.$common.hidingLoading()
@@ -173,6 +192,10 @@
 					.map(obj => obj.price).reduce(function(pre, cur) {
 						return pre + cur;
 					}, 0) : 0;
+					let manager=this.manager;
+					if(manager){
+						itemMoney=manager.price+itemMoney;
+					}
 				return (carMoney + itemMoney).toFixed(2);
 			}
 		},
@@ -190,7 +213,7 @@
 					}).then(resp => {
 						let data = resp.data;
 						if (data.cars && data.cars.length > 0) {
-							this.cars = data.cars;
+							// this.cars = data.cars;
 							let carId = [data.cars[0].id];
 							this.carsSelect = carId;
 							this.groupChange(carId)
@@ -225,19 +248,30 @@
 				let carNos = this.cars.map(obj => obj.carNo).join('、');
 				let carBusinessNo = this.cars.map(obj => obj.no).join('、');
 				let businessSelect = this.businessSelect;
-				let openid=this.openid?this.openid:uni.getStorageSync('openid')
+				let openid = this.openid ? this.openid : uni.getStorageSync('openid')
 				let p = {
 					b: businessSelect.length > 0 ? this.item.businessId : '',
 					c: JSON.stringify(cars.map(obj => {
 						return {
 							id: obj.id,
-							p: obj.price
+							p: obj.price,
+							uniqExpenseId: obj.uniqExpenseId,
+							carDesc: obj.carDesc,
+							hourDesc: obj.hourDesc,
+							standard: obj.standard,
+							over24Hour: obj.over24Hour,
+							extraPrice: obj.extraPrice,
+							calculateId: obj.calculateId
 						}
 					})),
 					money: this.total,
 					tradeType: "JSAPI",
 					openid: openid
 				}
+				let manager=this.manager;
+				if(manager&&manager.id){
+					p.i=JSON.stringify(manager);
+				}
 				let con = 'A1-停车费-' + carBusinessNo;
 				let tradeType = 'PORT_PARKING_FEE';
 				if (carIds.length == 0 || businessSelect.length > 0) { //交业务费
@@ -246,6 +280,7 @@
 				}
 				p.desc = con + '-' + carNos;
 				p.businessType = tradeType;
+				p.calculateId = this.item.calculateId;
 				this.$common.showLoading('正在请求...');
 				let that = this;
 				that.$api.getPrePay(that.$common.removeNull(p)).then(resp => {
@@ -311,8 +346,15 @@
 					carId: carId,
 					state: this.state
 				}).then(resp => {
+					let code = resp.code;
+					if (code !== 200) {
+						this.$common.toast('系统异常');
+						return;
+					}
 					let data = resp.data;
-					let cars=data.carList;
+					let cars = data.carList;
+					this.manager=data.manager;
+					
 					this.cars = cars;
 					this.goodsName = data.goodsName;
 					this.showPay = data.showPay;
@@ -324,6 +366,7 @@
 					Object.assign(this.item, {
 						itemsPrice: data.itemsPrice,
 						businessId: data.businessId,
+						calculateId: data.calculateId,
 						list: list
 					})
 					this.businessAble = list.filter(obj => obj.pay == 1).length == list.length;

+ 3 - 56
sp-admin/sa-frame/menu-list-sp.js

@@ -483,7 +483,7 @@ window.menuList.unshift({
 				]
 			}, {
 				id: 'tb-item-type-list',
-				name: '收费项管理',
+				name: '业务类型管理',
 				url: 'sa-view/tb-item-type/tb-item-type-list.html',
 				childList: [{
 						id: 'tb-item-type-add',
@@ -511,7 +511,7 @@ window.menuList.unshift({
 
 			{
 				id: 'tb-item-re-list',
-				name: '明细管理',
+				name: '车型管理',
 				url: 'sa-view/tb-item-type/tb-item-list.html',
 				childList: [{
 						id: 'tb-item-manager-add',
@@ -677,60 +677,7 @@ window.menuList.unshift({
 			name: '支付记录',
 			url: 'sa-view/tb-pay-record/tb-pay-record-list.html'
 		}, ]
-	}, {
-		id: 'tb-declare',
-		name: '申报信息',
-		icon: 'el-icon-folder-opened',
-		parent: true,
-		childList: [{
-			id: 'tb-declare-list',
-			name: '申报列表',
-			url: 'sa-view/tb-declare/tb-declare-list.html',
-
-			childList: [{
-					id: 'tb-declare-print',
-					name: '打印申报信息',
-					isShow: false
-				},
-				{
-					id: 'tb-declare-edit',
-					name: '修改申报信息',
-					isShow: false
-				},
-				{
-					id: 'tb-declare-del',
-					name: '删除申报信息',
-					isShow: false
-				},
-			]
-		}, ]
-	}, {
-		id: 'tb-disinfect',
-		name: '消毒信息',
-		icon: 'el-icon-folder-opened',
-		parent: true,
-		childList: [{
-			id: 'tb-disinfect-list',
-			name: '申请列表',
-			url: 'sa-view/tb-disinfect/tb-disinfect-list.html',
-			childList: [{
-					id: 'tb-disinfect-print',
-					name: '打印信息',
-					isShow: false
-				},
-				{
-					id: 'tb-disinfect-edit',
-					name: '修改信息',
-					isShow: false
-				},
-				{
-					id: 'tb-disinfect-del',
-					name: '删除信息',
-					isShow: false
-				},
-			]
-		}, ]
-	}, {
+	},  {
 		id: 'tb-discount',
 		name: '折扣管理',
 		icon: 'el-icon-folder-opened',

+ 26 - 49
sp-admin/sa-view/tb-business/tb-car-disincle-add.html

@@ -70,35 +70,29 @@
 													</el-option>
 												</el-select>
 											</div>
-											<div class="c-item" v-if="goods.needDeclare==1">
+											<div class="c-item" v-if="goods.needOwner==1">
 												<label class="c-label">
 													<span style="color: red;">*</span>
-													申报单号:</label>
-												<el-input v-model="m.declareNo" placeholder="选择申报单"
-													:readonly="goods.needDeclare==1" clearable>
+													货物名称:</label>
+												<el-input v-model="m.businessGoodsName" placeholder="填写货物" clearable>
 												</el-input>
-												<div style="cursor: pointer;color: blue;display: inline;"
-													@click="handlerDeclare">
-													<i class="el-icon-folder-add"></i>
-												</div>
 											</div>
 										</el-col>
 										<el-col span=8>
 											<div class="c-item" v-if="goods.needCustomer">
 												<label class="c-label"><span style="color: red;">*</span>客户:</label>
-												<el-select :disabled="goods.needDeclare||m.declareNo"
-													v-model="m.customerId" placeholder="请选择">
+												<el-select 
+													v-model="m.customerId" placeholder="请选择" filterable>
 													<el-option v-for="item in customerList" :key="item.id"
 														:label="item.name" :value="item.id">
 													</el-option>
 												</el-select>
 											</div>
-											<div class="c-item" v-if="goods.needOwner==1">
-												<label class="c-label">
-													<span style="color: red;">*</span>
-													货物:</label>
-												<el-input v-model="m.businessGoodsName" placeholder="填写货物" clearable>
-												</el-input>
+											<div class="c-item" v-if="goods.needOperateTime==1">
+												<label class="c-label"><span style="color: red;">*</span>数量(件):</label>
+												<el-input-number class="item-num" v-model="m.businessGoodsNum"
+													:min="1" :max="99999" size="mini">
+												</el-input-number>
 											</div>
 										</el-col>
 										<el-col span=8>
@@ -107,12 +101,7 @@
 												<el-input v-model="m.operator" placeholder="作业人员" clearable>
 												</el-input>
 											</div>
-											<div class="c-item" v-if="goods.needOperateTime==1">
-												<label class="c-label"><span style="color: red;">*</span>件数:</label>
-												<el-input-number class="item-num" v-model="m.businessGoodsNum"
-													:min="1" :max="99999" size="mini">
-												</el-input-number>
-											</div>
+											
 										</el-col>
 									</el-row>
 								</div>
@@ -155,7 +144,7 @@
 								<div>
 									<el-form-item v-for="(type,index) in itemTypeList">
 										<el-row justify="center">
-											<el-col span="9">
+											<el-col span="16">
 												<label style="color: red;"
 													v-if="type.need==1">*</label><label>{{type.name}}:</label>
 												<el-select v-model="type.itemId" style="width: 120px;"
@@ -165,10 +154,10 @@
 													</el-option>
 												</el-select>
 											</el-col>
-											<el-col span="7">
+											<el-col span="8">
 												<el-input-number style="margin-left: 60px;" class="item-num"
 													v-model="type.num" :min="1" :max="10" size="mini"
-													:disabled="type.inc==0"></el-input-number>
+													></el-input-number>
 												<div class="xj" v-if="type.itemId">
 													{{type.price * type.num}}元
 													<label @click="cleanItem(type)"
@@ -176,12 +165,6 @@
 															class="el-icon-delete"></i>)</label>
 												</div>
 											</el-col>
-											<el-col span="8">
-												<label class="c-label">
-													备注:</label>
-												<el-input v-model="type.remark" placeholder="请输入备注" clearable>
-												</el-input>
-											</el-col>
 										</el-row>
 										<el-divider></el-divider>
 									</el-form-item>
@@ -455,14 +438,15 @@
 						type.price = '';
 					},
 					itemChange(type) {
-						let itemId = type.itemId;
-						let item = type.items.filter(obj => obj.id == itemId).pop();
-						if (item) {
-							type.inc = item.inc;
-							type.price = item.price;
-							type.needRemark = item.needRemark
+						if(this.validBefore()){
+							let itemId = type.itemId;
+							let item = type.items.filter(obj => obj.id == itemId).pop();
+							if (item) {
+								type.inc = item.inc;
+								type.price = item.price;
+								type.needRemark = item.needRemark
+							}
 						}
-						this.validBefore();
 					},
 					confirmAdd() {
 						let list = this.car.list;
@@ -586,7 +570,8 @@
 							goodsId: this.m.goodsId
 						}, function(resp) {
 							let list = resp.data;
-							this.itemTypeList = list;
+							this.itemTypeList = list.filter(type=>type.status==1);
+							console.log(this.itemTypeList);
 							this.filterTypeList = JSON.parse(JSON.stringify(this.itemTypeList));
 							this.filterItems();
 						}.bind(this))
@@ -606,7 +591,7 @@
 					getCustomerList() {
 						sa.ajax('/TbCostomer/getList', {
 							pageNo: 1,
-							pageSize: 30,
+							pageSize: 200,
 							sortType: 20,
 							judgeStatus: 2
 						}, function(res) {
@@ -629,10 +614,6 @@
 						let goods = this.goods;
 						let needCustomer = goods.needCustomer;
 						let m = this.m;
-						if (goods.needDeclare == 1 && !m.declareNo) {
-							sa.error('请选择申报单');
-							return false;
-						}
 						if (needCustomer == 1 && !m.customerId) {
 							sa.error('请选择客户');
 							return false;
@@ -657,18 +638,14 @@
 								sa.error('请补充' + car.carNo + '规格');
 								return;
 							}
-
 						}
+						return true;
 					},
 					// 提交数据
 					ok: function() {
 						let goods = this.goods;
 						let needCustomer = goods.needCustomer;
 						let m = this.m;
-						if (goods.needDeclare == 1 && !m.declareNo) {
-							sa.error('请选择申报单');
-							return false;
-						}
 						if (needCustomer == 1 && !m.customerId) {
 							sa.error('请选择客户');
 							return false;

+ 8 - 35
sp-admin/sa-view/tb-business/tb-car-disincle-edit.html

@@ -66,25 +66,13 @@
 													</el-option>
 												</el-select>
 											</div>
-											<div class="c-item" v-if="goods.needDeclare==1">
-												<label class="c-label">
-													<span style="color: red;">*</span>
-													申报单号:</label>
-												<el-input v-model="m.declareNo" placeholder="选择申报单"
-													:readonly="goods.needDeclare==1" clearable>
-												</el-input>
-												<div style="cursor: pointer;color: blue;display: inline;"
-													@click="handlerDeclare">
-													<i class="el-icon-folder-add"></i>
-												</div>
-											</div>
 										</el-col>
 										<el-col span=8>
 											<div class="c-item" v-if="goods.needCustomer">
 												<label class="c-label"><span style="color: red;">*</span>客户:</label>
 												<el-select
-													:disabled="goods.needDeclare||m.declareNo||currentCustomerId!='1'"
-													v-model="m.customerId" placeholder="请选择">
+													:disabled="currentCustomerId!='1'"
+													v-model="m.customerId" placeholder="请选择" filterable>
 													<el-option v-for="item in customerList" :key="item.id"
 														:label="item.name" :value="item.id">
 													</el-option>
@@ -93,7 +81,7 @@
 											<div class="c-item" v-if="goods.needOwner==1">
 												<label class="c-label">
 													<span style="color: red;">*</span>
-													货物:</label>
+													货物名称:</label>
 												<el-input v-model="m.businessGoodsName" placeholder="填写货物" clearable>
 												</el-input>
 											</div>
@@ -105,7 +93,7 @@
 												</el-input>
 											</div>
 											<div class="c-item" v-if="goods.needOperateTime==1">
-												<label class="c-label"><span style="color: red;">*</span>件数:</label>
+												<label class="c-label"><span style="color: red;">*</span>数量(件):</label>
 												<el-input-number class="item-num" v-model="m.businessGoodsNum" :min="1"
 													:max="99999" size="mini">
 												</el-input-number>
@@ -152,7 +140,7 @@
 								<div>
 									<el-form-item v-for="(type,index) in itemTypeList">
 										<el-row justify="center">
-											<el-col span="9">
+											<el-col span="16">
 												<label style="color: red;"
 													v-if="type.need==1">*</label><label>{{type.name}}:</label>
 												<el-select v-model="type.itemId" style="width: 120px;"
@@ -162,10 +150,9 @@
 													</el-option>
 												</el-select>
 											</el-col>
-											<el-col span="7">
+											<el-col span="8">
 												<el-input-number style="margin-left: 60px;" class="item-num"
-													v-model="type.num" :min="1" :max="10" size="mini"
-													:disabled="type.inc==0"></el-input-number>
+													v-model="type.num" :min="1" :max="10" size="mini"></el-input-number>
 												<div class="xj" v-if="type.itemId">
 													{{type.price * type.num}}元
 													<label @click="cleanItem(type)"
@@ -173,12 +160,6 @@
 															class="el-icon-delete"></i>)</label>
 												</div>
 											</el-col>
-											<el-col span="8">
-												<label class="c-label">
-													备注:</label>
-												<el-input v-model="type.remark" placeholder="请输入备注" clearable>
-												</el-input>
-											</el-col>
 										</el-row>
 										<el-divider></el-divider>
 									</el-form-item>
@@ -624,7 +605,7 @@
 					getCustomerList() {
 						sa.ajax('/TbCostomer/getList', {
 							pageNo: 1,
-							pageSize: 30,
+							pageSize: 200,
 							sortType: 20,
 							judgeStatus: 2
 						}, function(res) {
@@ -647,10 +628,6 @@
 						let goods = this.goods;
 						let needCustomer = goods.needCustomer;
 						let m = this.m;
-						if (goods.needDeclare == 1 && !m.declareNo) {
-							sa.error('请选择申报单');
-							return false;
-						}
 						if (needCustomer == 1 && !m.customerId) {
 							sa.error('请选择客户');
 							return false;
@@ -682,10 +659,6 @@
 					ok: function() {
 						let goods = this.goods;
 						let m = this.m;
-						if (goods.needDeclare == 1 && !m.declareNo) {
-							sa.error('请选择申报单');
-							return false;
-						}
 						if (!m.businessGoodsName && goods.needOwner == 1) {
 							sa.error('请填写货物');
 							return false;

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

@@ -42,8 +42,8 @@
 												<sa-info name="业务项目" br>{{m.goodsName}}</sa-info>
 												<!-- <sa-info name="作业时间" br>{{m.operateTime}}</sa-info> -->
 												<sa-info name="业务费用" br>{{m.itemPrice}}(元)</sa-info>
-												<sa-info name="货物" br v-if="m.businessGoodsName">{{m.businessGoodsName}}</sa-info>
-												<sa-info name="件数" br v-if="m.businessGoodsNum">{{m.businessGoodsNum}}</sa-info>
+												<sa-info name="货物名称" br v-if="m.businessGoodsName">{{m.businessGoodsName}}</sa-info>
+												<sa-info name="数量(件)" br v-if="m.businessGoodsNum">{{m.businessGoodsNum}}</sa-info>
 												<sa-info name="补录人" br v-if="m.supplementBy">{{m.supplementBy}}
 												</sa-info>
 												<sa-info name="补录时间" br v-if="m.supplementTime">{{m.supplementTime}}

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

@@ -72,14 +72,14 @@
 					<el-table-column type="index" width="50"></el-table-column>
 					<sa-td name="业务单号" prop="no" width="160"></sa-td>
 					<sa-td name="客户名称" prop="customerName" width="190"></sa-td>
-					<sa-td name="货物" prop="businessGoodsName" width="160"></sa-td>
+					<sa-td name="货物名称" prop="businessGoodsName" width="160"></sa-td>
 					<sa-td name="业务项" prop="goodsName" width="160"></sa-td>
 					<el-table-column label="车牌号" width="160">
 						<template slot-scope="s">
 							<label>{{s.row.carNoStr}}</label>
 						</template>
 					</el-table-column>
-					<sa-td name="作业时间" prop="operateTime" width="160"></sa-td>
+					<sa-td name="支付时间" prop="payTime" width="160"></sa-td>
 					
 					<sa-td name="确认" prop="adminConfirmInput" type="enum" :jv="{1: '已确认', 0: '未确认'}"></sa-td>
 					<sa-td name="已支付(元)" prop="payMoney" width="140"></sa-td>

+ 13 - 4
sp-admin/sa-view/tb-fee-statistics/dayStatsPrint.html

@@ -121,8 +121,8 @@
 								<td>-</td>
 								<td>{{(total.totalTaxes).toFixed(2)}}</td>
 								<td>{{total.totalWxPrice}}</td>
-								<td>-</td>
-								<td>-</td>
+								<td>0</td>
+								<td>0</td>
 								<td>{{total.totalYuePrice}}</td>
 								<td>-</td>
 								<td>-</td>
@@ -130,7 +130,7 @@
 								<td>-</td>
 							</tr>
 						</table>
-						<span style="position: absolute;top: 750px;left: 1050px">{{index+1}}/{{dataList.length}}</span>
+						<span style="position: absolute;top: 780px;left: 1050px">{{index+1}}/{{dataList.length}}</span>
 					</div>
 				</div>
 			</div>
@@ -190,7 +190,16 @@
 								totalTaxMoney += item.taxes;
 								totalNoTaxMoney += item.noTaxMoney;
 								child.push(item);
-								if (child.length == 10 || i == len - 1) {
+								if(child.length == 11&&dataList.length==0){
+									let title = {
+										time: this.p.ids ? "勾选打印" : this.p.beginTime ? this.p.beginTime +
+											'至' + this.p.endTime : '所有时间',
+										list: child
+									}
+									dataList.push(title);
+									child = [];
+								}
+								if (child.length == 12 || i == len - 1) {
 									let title = {
 										time: this.p.beginDay ? this.p.beginDay + '至' + this.p.endDay :
 											'所有时间',

+ 11 - 2
sp-admin/sa-view/tb-fee-statistics/detailPrint.html

@@ -138,7 +138,7 @@
 								<td></td>
 							</tr>
 						</table>
-						<span style="position: absolute;top: 750px;left: 1050px">{{index+1}}/{{dataList.length}}</span>
+						<span style="position: absolute;top: 780px;left: 1050px">{{index+1}}/{{dataList.length}}</span>
 					</div>
 				</div>
 			</div>
@@ -173,7 +173,16 @@
 							for (i = 0; i < len; i++) {
 								let item = list[i];
 								child.push(item);
-								if (child.length == 10 || i == len - 1) {
+								if(child.length == 11&&dataList.length==0){
+									let title = {
+										time: this.p.ids ? "勾选打印" : this.p.beginTime ? this.p.beginTime +
+											'至' + this.p.endTime : '所有时间',
+										list: child
+									}
+									dataList.push(title);
+									child = [];
+								}
+								if (child.length == 12 || i == len - 1) {
 									let title = {
 										time: this.p.ids ? "勾选打印" : this.p.beginTime ? this.p.beginTime +
 											'至' + this.p.endTime : '所有时间',

+ 2 - 0
sp-admin/sa-view/tb-fee-statistics/tb-fee-details-list.html

@@ -537,6 +537,8 @@
 								str += '车型为:' + itemName;
 							}
 						}
+						this.p.beginTime=beginTime;
+						this.p.endTime=endTime;
 						this.$confirm('确定导出' + str + '的数据?', '提示', {
 							confirmButtonText: '确定',
 							cancelButtonText: '取消',

+ 11 - 10
sp-admin/sa-view/tb-fee-statistics/tb-fee-statistics-list.html

@@ -25,13 +25,9 @@
 						<label class="c-label">收费项目:</label>
 						<el-select v-model="p.feeType" placeholder="请选择" filterable>
 							<el-option label="-全部-" value=""></el-option>
-							<el-option label="核酸检测" value="1"></el-option>
-							<el-option label="消杀作业" value="2"></el-option>
-							<el-option label="装卸作业" value="3"></el-option>
-							<el-option label="停车业务" value="4"></el-option>
-							<el-option label="过磅费" value="5"></el-option>
-							<el-option label="入场管理费" value="6"></el-option>
-							<el-option label="充电打冷作业" value="7"></el-option>
+							<el-option v-for="(item,index) in feeItemList" :label="item.name" :value="item.id"
+								:key="index">
+							</el-option>
 						</el-select>
 					</div>
 
@@ -55,9 +51,7 @@
 				<!-- ------------- 数据列表 ------------- -->
 				<el-table class="data-table" ref="data-table" :data="dataList" show-summary :summary-method="getSumRol">
 					<!--					<sa-td type="selection"></sa-td>-->
-					<sa-td name="收费项目" prop="feeType" type="enum"
-						:jv="{1: '核酸检测',2: '消杀作业', 3: '装卸作业', 4: '停车业务', 5: '过磅费', 6: '入场管理费', 7: '充电打冷作业'}"></sa-td>
-					<!--					<sa-td name="业务类型" prop="itemTypeName" ></sa-td>-->
+					<sa-td name="收费项目" prop="feeTypeName"></sa-td>
 					<sa-td name="日期" type="date" prop="dayTime"></sa-td>
 					<sa-td name="数量" prop="num"></sa-td>
 					<!--					<sa-td name="含税收入(元)" prop="taxMoney" ></sa-td>-->
@@ -138,6 +132,7 @@
 						beginDay: '', //查询开始时间
 						endDay: '', //查询结束时间
 					},
+					feeItemList: [],
 					tableSum: {
 						taxMoneySum: 0,
 						taxesSum: 0,
@@ -145,6 +140,11 @@
 					},
 				},
 				methods: {
+					getFeeItemList() {
+						sa.ajax('/TbFeeItem/getList', function(res) {
+							this.feeItemList = res.data;
+						}.bind(this));
+					},
 					judgeFn(data) {
 						sa.showIframe('统计审核', 'tb-fee-details-info.html?id=' + data.id, '600px', '60%');
 					},
@@ -340,6 +340,7 @@
 
 				},
 				created: function() {
+					this.getFeeItemList();
 					this.f5();
 					sa.onInputEnter();
 				}

+ 0 - 2
sp-admin/sa-view/tb-goods/tb-goods-list.html

@@ -40,8 +40,6 @@
                    @change="s => updateNeedCarSize(s.row)" width="90"></sa-td>
             <sa-td name="车辆" prop="mulCar" type="switch" :jv="{0: '单辆[#005500]', 1: '多辆[#ff0000]'}"
                    @change="s => updateMulCar(s.row)" width="90"></sa-td>
-            <sa-td name="申报单" prop="needDeclare" type="switch" :jv="{0: '选填[#005500]', 1: '必填[#ff0000]'}"
-                   @change="s => updateNeedDeclare(s.row)" width="90"></sa-td>
             <sa-td name="客户" prop="needCustomer" type="switch" :jv="{0: '选填[#005500]', 1: '必填[#ff0000]'}"
                    @change="s => updateNeedCustomer(s.row)" width="90"></sa-td>
             <sa-td name="货物" prop="needOwner" type="switch" :jv="{0: '选填[#005500]', 1: '必填[#ff0000]'}"

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

@@ -40,7 +40,7 @@
             <el-form v-if="m">
                 <sa-item type="text" name="车型" v-model="m.itemName" placeholder="请输入项目名称" br></sa-item>
                 <div class="c-item">
-                    <label class="c-label">业务类型:</label>
+                    <label class="c-label">通知类型:</label>
                     <el-select v-model="m.businessType">
                         <el-option v-for="item in businessTypeList" :key="item.id" :value="item.id"
                                    :label="item.name">
@@ -48,7 +48,7 @@
                     </el-select>
                 </div>
                 <div class="c-item">
-                    <label class="c-label">收费项目:</label>
+                    <label class="c-label">统计类型:</label>
                     <el-select v-model="m.payType">
                         <el-option v-for="item in payTypeList" :key="item.id" :value="item.id"
                                    :label="item.name">

+ 2 - 2
sp-admin/sa-view/tb-item-type/tb-item-edit.html

@@ -40,7 +40,7 @@
             <el-form v-if="m">
                 <sa-item type="text" name="车型" v-model="m.itemName" placeholder="请输入业务类型" br></sa-item>
                 <div class="c-item">
-                    <label class="c-label">业务类型:</label>
+                    <label class="c-label">通知类型:</label>
                     <el-select v-model="m.businessType">
                         <el-option v-for="item in businessTypeList" :key="item.id" :value="item.id"
                                    :label="item.name">
@@ -48,7 +48,7 @@
                     </el-select>
                 </div>
                 <div class="c-item">
-                    <label class="c-label">收费项目:</label>
+                    <label class="c-label">统计类型:</label>
                     <el-select v-model="m.payType">
                         <el-option v-for="item in payTypeList" :key="item.id" :value="item.id"
                                    :label="item.name">

+ 16 - 19
sp-admin/sa-view/tb-item-type/tb-item-list.html

@@ -24,32 +24,29 @@
 					<sa-item type="text" name="车型" v-model="p.itemName"></sa-item>
 					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
 					<sa-item type="fast-btn" show="reset" style="display: inline;"></sa-item>
-					<el-button v-if="sa.isAuth('tb-item-manager-add')" type="primary" icon="el-icon-plus"
+					<!-- <el-button v-if="sa.isAuth('tb-item-manager-add')" type="primary" icon="el-icon-plus"
 						@click="add()">新增
-					</el-button>
+					</el-button> -->
 					<br />
 				</el-form>
 				<!-- ------------- 数据列表 ------------- -->
 				<el-table class="data-table" ref="data-table" :data="dataList">
 					<el-table-column type="index" width="50">
 					</el-table-column>
-					<sa-td name="车型" prop="itemName" width="300px"></sa-td>
-					<sa-td name="业务类型" prop="businessTypeName"></sa-td>
-					<sa-td name="空车/载重" prop="itemType"></sa-td>
-					<sa-td name="收费项目" prop="payTypeName"></sa-td>
-					<sa-td name="价格" prop="price"></sa-td>
-					<sa-td name="计价单位" prop="unit"></sa-td>
-					<sa-td name="税率(%)" prop="taxRate"></sa-td>
-					<sa-td name="适合规格(米)" width="120">
-						<template slot-scope="s">
-							<label>{{s.row.minLength}}—{{s.row.carLength}}</label>
-						</template>
-					</sa-td>
-					<sa-td name="适合载重(kg)" width="120">
+					<sa-td name="车型" prop="itemName" width="200px"></sa-td>
+					<sa-td name="业务类型" prop="typeName"></sa-td>
+					<sa-td name="通知类型" prop="businessTypeName"></sa-td>
+					<!-- <sa-td name="空车/载重" prop="itemType"></sa-td> -->
+					<sa-td name="统计类型" prop="payTypeName"></sa-td>
+					<el-table-column label="价格">
 						<template slot-scope="s">
-							<label>{{s.row.minWeight}}—{{s.row.maxWeight}}</label>
+							<span v-if="s.row.itemName.indexOf('停车')==-1">{{s.row.price}}</span>
+							<span v-else>-</span>
 						</template>
-					</sa-td>
+					</el-table-column>
+					<sa-td name="计价单位" prop="unit"></sa-td>
+					<sa-td name="税率(%)" prop="taxRate"></sa-td>
+
 					<el-table-column label="操作" fixed="right" width="240px">
 						<template slot-scope="s">
 							<el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看
@@ -57,9 +54,9 @@
 							<el-button v-if="sa.isAuth('tb-item-manager-edit')" class="c-btn" type="primary"
 								icon="el-icon-edit" @click="update(s.row)">修改
 							</el-button>
-							<el-button v-if="sa.isAuth('tb-item-manager-del')" class="c-btn" type="danger"
+						<!-- 	<el-button v-if="sa.isAuth('tb-item-manager-del')" class="c-btn" type="danger"
 								icon="el-icon-delete" @click="del(s.row)">删除
-							</el-button>
+							</el-button> -->
 						</template>
 					</el-table-column>
 				</el-table>

+ 2 - 11
sp-admin/sa-view/tb-item-type/tb-item-select.html

@@ -31,19 +31,10 @@
         <!-- ------------- 数据列表 ------------- -->
         <el-table class="data-table" ref="data-table" :data="dataList">
             <sa-td type="selection"></sa-td>
-            <sa-td name="业务类型" prop="itemName" width="300px"></sa-td>
+            <sa-td name="业务类型" prop="itemName"></sa-td>
             <sa-td name="价格" prop="price"></sa-td>
             <sa-td name="单位" prop="unit"></sa-td>
-            <sa-td name="适合规格(米)">
-                <template slot-scope="s">
-                    <label>{{s.row.minLength}}—{{s.row.carLength}}</label>
-                </template>
-            </sa-td>
-            <sa-td name="适合载重(吨)">
-                <template slot-scope="s">
-                    <label>{{s.row.minWeight}}—{{s.row.maxWeight}}</label>
-                </template>
-            </sa-td>
+          
             <el-table-column label="操作" fixed="right">
                 <template slot-scope="s">
                     <el-button class="c-btn" type="primary" @click="selectFn(s.row)">选择

+ 150 - 146
sp-admin/sa-view/tb-item-type/tb-item-type-list.html

@@ -1,149 +1,153 @@
 <!DOCTYPE html>
 <html>
-<head>
-    <title>作业配置项-列表</title>
-    <meta charset="utf-8">
-    <meta name="viewport"
-          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
-    <!-- 所有的 css & js 资源 -->
-    <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
-    <link rel="stylesheet" href="../../static/sa.css">
-    <script src="../../static/kj/vue.min.js"></script>
-    <script src="../../static/kj/element-ui/index.js"></script>
-    <script src="../../static/kj/httpVueLoader.js"></script>
-    <script src="../../static/kj/jquery.min.js"></script>
-    <script src="../../static/kj/layer/layer.js"></script>
-    <script src="../../static/sa.js"></script>
-</head>
-<body>
-<div class="vue-box" style="display: none;" :style="'display: block;'">
-    <div class="c-panel">
-        <!-- ------------- 检索参数 ------------- -->
-        <div class="c-title">检索参数</div>
-        <el-form ref="form" :model='p' @submit.native.prevent>
-            <sa-item type="text" name="项目名称" v-model="p.name"></sa-item>
-            <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
-            <sa-item type="fast-btn" show="reset" style="display: inline;"></sa-item>
-            <el-button v-if="sa.isAuth('tb-item-type-add')" type="primary" icon="el-icon-plus" @click="add()">新增
-            </el-button>
-            <br/>
-        </el-form>
-        <!-- ------------- 数据列表 ------------- -->
-        <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="sort"></sa-td>
-            <el-table-column label="操作" fixed="right" width="260px">
-                <template slot-scope="s">
-                    <!-- <el-button class="c-btn" type="success"  @click="get(s.row)">二维码
-                    </el-button> -->
-                    <el-button v-if="sa.isAuth('tb-item-type-relation')" class="c-btn" type="success"
-                               @click="itemFn(s.row)">收费明细
-                    </el-button>
-                    <el-button v-if="sa.isAuth('tb-item-type-edit')" class="c-btn" type="primary" icon="el-icon-edit"
-                               @click="update(s.row)">修改
-                    </el-button>
-                    <el-button v-if="sa.isAuth('tb-item-type-del')" class="c-btn" type="danger" icon="el-icon-delete"
-                               @click="del(s.row)">删除
-                    </el-button>
-                </template>
-            </el-table-column>
-        </el-table>
-        <!-- ------------- 分页 ------------- -->
-        <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
-        </sa-item>
-    </div>
-</div>
-<script>
-    var app = new Vue({
-        components: {
-            "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
-            "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
-        },
-        el: '.vue-box',
-        data: {
-            idStr: sa.p('idStr', ''),
-            goodsId: sa.p('goodsId', ''),
-            p: { // 查询参数
-                id: '', // 主键
-                name: '', // 项目名称
-                pageNo: 1, // 当前页
-                pageSize: 20, // 页大小
-                sortType: 0 // 排序方式
-            },
-            dataCount: 0,
-            dataList: [], // 数据集合
-            itemTypeList: [],
-            businessTypeList: [{
-                value: '0',
-                name: '默认'
-            },
-                {
-                    value: '1',
-                    name: '消杀'
-                },
-                {
-                    value: '2',
-                    name: '装卸'
-                },
-                {
-                    value: '3',
-                    name: '核酸'
-                },
-            ]
-        },
-        methods: {
-            itemFn(data) {
-                sa.showIframe('【' + data.name + '】收费明细', 'tb-item.html?id=' + data.id, '1080px', '90%');
-            },
-            businessChange(data) {
-                data.businessType = data.type.join(',');
-                data.type = '';
-                sa.ajax('/TbItemType/update', data, function (res) {
-                    this.f5();
-                }.bind(this));
-            },
-            // 修改
-            update: function (data) {
-                sa.showIframe('修改数据', 'tb-item-type-add.html?id=' + data.id, '600px', '60%');
-            },
-            // 修改
-            get: function (data) {
-                sa.showIframe('【' + data.name + '】二维码', 'tb-item-type-info.html?id=' + data.id, '550px', '80%');
-            },
-            // 新增
-            add: function (data) {
-                sa.showIframe('新增数据', 'tb-item-type-add.html?id=-1', '600px', '60%');
-            },
-            // 删除
-            del: function (data) {
-                sa.confirm('是否删除,此操作不可撤销', function () {
-                    sa.ajax('/TbItemType/delete?id=' + data.id, function (res) {
-                        sa.arrayDelete(this.dataList, data);
-                        sa.ok('删除成功');
-                        sa.f5TableHeight(); // 刷新表格高度
-                    }.bind(this))
-                }.bind(this));
-            },
-            // 刷新
-            f5: function () {
-                sa.ajax('/TbItemType/getList', sa.removeNull(this.p), function (res) {
-                    let list = res.data;
-                    for (let i in list) {
-                        let obj = list[i];
-                        obj.type = obj.businessType.split(',')
-                    }
-                    this.dataList = list; // 数据
-                    this.dataCount = res.dataCount; // 数据总数
-                    sa.f5TableHeight(); // 刷新表格高度
-                }.bind(this));
-            },
-        },
-        created: function () {
-            this.f5();
-            sa.onInputEnter();
-        }
-    })
-</script>
-</body>
+	<head>
+		<title>作业配置项-列表</title>
+		<meta charset="utf-8">
+		<meta name="viewport"
+			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+		<!-- 所有的 css & js 资源 -->
+		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="../../static/kj/vue.min.js"></script>
+		<script src="../../static/kj/element-ui/index.js"></script>
+		<script src="../../static/kj/httpVueLoader.js"></script>
+		<script src="../../static/kj/jquery.min.js"></script>
+		<script src="../../static/kj/layer/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+	</head>
+	<body>
+		<div class="vue-box" style="display: none;" :style="'display: block;'">
+			<div class="c-panel">
+				<!-- ------------- 检索参数 ------------- -->
+				<div class="c-title">检索参数</div>
+				<el-form ref="form" :model='p' @submit.native.prevent>
+					<sa-item type="text" name="业务类型" v-model="p.name"></sa-item>
+					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
+					<sa-item type="fast-btn" show="reset" style="display: inline;"></sa-item>
+					<!-- <el-button v-if="sa.isAuth('tb-item-type-add')" type="primary" icon="el-icon-plus" @click="add()">新增
+					</el-button> -->
+					<br />
+				</el-form>
+				<!-- ------------- 数据列表 ------------- -->
+				<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>
+					<el-table-column label="有效期" width="260px">
+						<template slot-scope="s">
+							{{s.row.startTime}}~{{s.row.endTime}}
+						</template>
+					</el-table-column>
+					<sa-td name="状态" prop="status" type="enum" :jv="{0: '禁用[#ff0000]', 1: '启用[#005500]'}"></sa-td>
+					<el-table-column label="操作" fixed="right" width="260px">
+						<template slot-scope="s">
+							<el-button v-if="sa.isAuth('tb-item-type-relation')" class="c-btn" type="success"
+								@click="itemFn(s.row)">对应车型
+							</el-button>
+							<el-button v-if="sa.isAuth('tb-item-type-edit')" class="c-btn" type="primary"
+								icon="el-icon-edit" @click="update(s.row)">修改
+							</el-button>
+						<!-- 	<el-button v-if="sa.isAuth('tb-item-type-del')" class="c-btn" type="danger"
+								icon="el-icon-delete" @click="del(s.row)">删除
+							</el-button> -->
+						</template>
+					</el-table-column>
+				</el-table>
+				<!-- ------------- 分页 ------------- -->
+				<sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
+				</sa-item>
+			</div>
+		</div>
+		<script>
+			var app = new Vue({
+				components: {
+					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
+					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
+				},
+				el: '.vue-box',
+				data: {
+					idStr: sa.p('idStr', ''),
+					goodsId: sa.p('goodsId', ''),
+					p: { // 查询参数
+						id: '', // 主键
+						name: '', // 项目名称
+						pageNo: 1, // 当前页
+						pageSize: 20, // 页大小
+						sortType: 0 // 排序方式
+					},
+					dataCount: 0,
+					dataList: [], // 数据集合
+					itemTypeList: [],
+					businessTypeList: [{
+							value: '0',
+							name: '默认'
+						},
+						{
+							value: '1',
+							name: '消杀'
+						},
+						{
+							value: '2',
+							name: '装卸'
+						},
+						{
+							value: '3',
+							name: '核酸'
+						},
+					]
+				},
+				methods: {
+					itemFn(data) {
+						sa.showIframe('【' + data.name + '】收费明细', 'tb-item.html?id=' + data.id, '1080px', '90%');
+					},
+					businessChange(data) {
+						data.businessType = data.type.join(',');
+						data.type = '';
+						sa.ajax('/TbItemType/update', data, function(res) {
+							this.f5();
+						}.bind(this));
+					},
+					// 修改
+					update: function(data) {
+						sa.showIframe('修改数据', 'tb-item-type-add.html?id=' + data.id, '600px', '60%');
+					},
+					// 修改
+					get: function(data) {
+						sa.showIframe('【' + data.name + '】二维码', 'tb-item-type-info.html?id=' + data.id, '550px',
+							'80%');
+					},
+					// 新增
+					add: function(data) {
+						sa.showIframe('新增数据', 'tb-item-type-add.html?id=-1', '600px', '60%');
+					},
+					// 删除
+					del: function(data) {
+						sa.confirm('是否删除,此操作不可撤销', function() {
+							sa.ajax('/TbItemType/delete?id=' + data.id, function(res) {
+								sa.arrayDelete(this.dataList, data);
+								sa.ok('删除成功');
+								sa.f5TableHeight(); // 刷新表格高度
+							}.bind(this))
+						}.bind(this));
+					},
+					// 刷新
+					f5: function() {
+						sa.ajax('/TbItemType/getList', sa.removeNull(this.p), function(res) {
+							let list = res.data;
+							for (let i in list) {
+								let obj = list[i];
+								obj.type = obj.businessType.split(',')
+							}
+							this.dataList = list; // 数据
+							this.dataCount = res.dataCount; // 数据总数
+							sa.f5TableHeight(); // 刷新表格高度
+						}.bind(this));
+					},
+				},
+				created: function() {
+					this.f5();
+					sa.onInputEnter();
+				}
+			})
+		</script>
+	</body>
 </html>

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

@@ -43,13 +43,6 @@
                     <label>{{s.row.minWeight}}—{{s.row.maxWeight}}</label>
                 </template>
             </sa-td>
-
-            <sa-td name="明细数量" prop="inc" type="switch" :jv="{1: '多个[#005500]', 0: '单个[#ff0000]'}"
-                   @change="s => updateNum(s.row)" width="100"></sa-td>
-            <sa-td name="备注" prop="needRemark" type="switch" :jv="{1: '必填[#005500]', 0: '选填[#ff0000]'}"
-                   @change="s => updateRemarkNeed(s.row)" width="100"></sa-td>
-            <!-- <sa-td name="状态" prop="mustRemark" type="switch" :jv="{1: '必填[#005500]', 0: '选填[#ff0000]'}"
-                @change="s => updateRemarkMust(s.row)"></sa-td> -->
             <el-table-column label="操作" fixed="right">
                 <template slot-scope="s">
                     <el-button class="c-btn" type="danger" @click="del(s.row)">移除

+ 2 - 1
sp-server/src/main/java/com/pj/api/invoice/service/InvoiceApplyService.java

@@ -18,6 +18,7 @@ import com.pj.api.invoice.bo.InvoiceApplySubDetail;
 import com.pj.api.invoice.utils.InvoiceUtils;
 import com.pj.api.wx.bo.Attach;
 import com.pj.api.wx.bo.PriceBO;
+import com.pj.constants.business.PayEnum;
 import com.pj.current.config.InvoiceConfig;
 import com.pj.project.tb_fee_details.TbFeeDetails;
 import com.pj.project.tb_fee_details.TbFeeDetailsService;
@@ -102,7 +103,7 @@ public class InvoiceApplyService {
         List<InvoiceApplySub> applys = new ArrayList<>();
         for (TbInvoiceDetails invoiceDetail : invoiceDetails) {
             InvoiceApplySub apply = new InvoiceApplySub();
-            apply.setBillNo(invoiceDetail.getId()).setPayType("微信支付")
+            apply.setBillNo(invoiceDetail.getId()).setPayType(PayEnum.PayType.WX_PAY.getDesc())
                     .setBillDate(DateUtil.format(now, "yyyy-MM-dd"))
                     .setTotalAmount(invoiceDetail.getMoney()).setIncludeTaxFlag(1)
                     .setAutoInvoice(1).setAutoMerge(1)

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

@@ -77,13 +77,15 @@ public class JhService {
             throw new BusinessException("金额不正确");
         }
         String openid = request.getParameter("openid");
+        String calculateId = request.getParameter("calculateId");
         String desc = handlerDesc(request.getParameter("desc"));
         String businessId = request.getParameter("b");
         String c = request.getParameter("c");
         String a = request.getParameter("a");
+        String i = request.getParameter("i");
         String businessType = request.getParameter("businessType");
         Attach atchMap = new Attach();
-        atchMap.setC(c).setB(businessId).setA(a);
+        atchMap.setC(c).setB(businessId).setA(a).setI(i);
         String attchStr = JSONUtil.toJsonStr(atchMap);
         TbOrder dbOrder = tbOrderService.find30Seconds(attchStr, LocalDateTime.now().minusSeconds(wxConfig.getLimitPaySeconds()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
         if (dbOrder != null && !StrUtil.equals(dbOrder.getOpenid(), openid)) {
@@ -129,6 +131,7 @@ public class JhService {
             object.set("outTradeNo", out_trade_no);
             TbOrder tbOrder = new TbOrder();
             tbOrder.setAttach(attchStr)
+                    .setCalculateId(calculateId)
                     .setOpenid(openid)
                     .setOrderTime(new Date())
                     .setOutTradeNo(out_trade_no).setPrice(money);

+ 17 - 0
sp-server/src/main/java/com/pj/api/open/bo/ItemPriceBO.java

@@ -0,0 +1,17 @@
+package com.pj.api.open.bo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class ItemPriceBO implements Serializable {
+    private Long id;
+    private String name;
+    private BigDecimal price;
+    private int pay;
+    private String uniqExpenseId;
+}

+ 53 - 31
sp-server/src/main/java/com/pj/api/open/service/OpenService.java

@@ -14,12 +14,17 @@ import com.pj.constants.business.GoodsEnum;
 import com.pj.constants.business.PayEnum;
 import com.pj.current.config.PartConfig;
 import com.pj.current.task.TaskService;
+import com.pj.project.sync.SyncService;
+import com.pj.project.sync.request.item.IOrderItem;
+import com.pj.project.sync.response.IOrderPriceRes;
 import com.pj.project.tb_account.AutomaticPay;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
 
 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_deduction_bind.TbDeductionBindService;
@@ -39,6 +44,7 @@ import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -73,6 +79,11 @@ public class OpenService {
     @Resource
     private TbMildCarService tbMildCarService;
 
+    @Resource
+    private TbBusinessItemService tbBusinessItemService;
+    @Resource
+    private SyncService syncService;
+
     public ResultJson checkCarNumber(CheckCarNumberBO checkCarNumberBO) {
         String carNo = checkCarNumberBO.getCarNumber();
         int inOrOut = checkCarNumberBO.getInOrOut();
@@ -140,6 +151,7 @@ public class OpenService {
     }
 
     final TimedCache<String, String> IMAGE_CACHE = CacheUtil.newTimedCache(30 * 60 * 1000);
+    final TimedCache<String, BigDecimal> BUSINESS_MONEY_CACHE = CacheUtil.newTimedCache(5000);
 
     private ResultJson handlerOut(String carNo, String channel, String image) {
         carNo = carNo.toUpperCase();
@@ -189,18 +201,23 @@ public class OpenService {
         String carType = tbBusinessCar.getCarType();
         BigDecimal yueCarMoney = new BigDecimal(0);
         BigDecimal chinaCarMoney = new BigDecimal(0);
+        IOrderPriceRes yueRes = new IOrderPriceRes();
+        IOrderPriceRes chinaRes = new IOrderPriceRes();
+        IOrderPriceRes businessRes = new IOrderPriceRes();
+        List<IOrderItem> expenses = new ArrayList<>();
         List<TbBusiness> businessList = tbBusinessService.findOtherBusinessByCarId(businessCarId);
-        int payPart=tbBusinessCar.getPay();
-        businessList=businessList.stream().filter(tbBusiness -> tbBusiness.getPayStatus()!= PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode()).collect(Collectors.toList());
+        int payPart = tbBusinessCar.getPay();
+        businessList = businessList.stream().filter(tbBusiness -> tbBusiness.getPayStatus() != PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode()).collect(Collectors.toList());
         if (businessList.isEmpty()) {//无业务车辆===>计算停车费
             //如果已经支付过,则从支付时间算起,重新计算停车费
-            double dif = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now,tbBusinessCar.getCarNo()).doubleValue();
-            if (dif > 0&&payPart==0) {
+            IOrderPriceRes res = tbBusinessService.getPartMoney(tbBusinessCar.getRealInTime(), now, carNo, tbBusinessCar.getColor());
+            double dif = res.getTotalOrderPrice().doubleValue();
+            if (dif > 0 && payPart == 0) {
                 RedisUtil.setByMINUTES(channel, carNo, 5);
                 log.error("请求返回:请缴停车费:{},{}元", carNo, dif);
                 //是否可以预充值缴费 true扣款成功 false否
-                boolean flag = automaticPay.payPartMoney(tbBusinessCar,dif, now);
-                if (flag){
+                boolean flag = automaticPay.payPartMoney(tbBusinessCar, res, now);
+                if (flag) {
                     tbBusinessCar.setMoney(new BigDecimal(dif));
                     freeOut(tbBusinessCar, now, channel, image);
                     automaticPay.unbindRun(carNo);
@@ -225,12 +242,14 @@ public class OpenService {
                     TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
                     return tbGoods.getChinaCarPay() == 1;
                 });
-                if (chinaCarPay&&payPart==0) {
-                    double dif = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now,tbBusinessCar.getCarNo()).doubleValue();
+                if (chinaCarPay && payPart == 0) {
+                    IOrderPriceRes res = tbBusinessService.getPartMoney(tbBusinessCar.getRealInTime(), now, carNo, tbBusinessCar.getColor());
+                    double dif = res.getTotalOrderPrice().doubleValue();
                     if (dif > 0) {
                         RedisUtil.setByMINUTES(channel, carNo, 5);
                         log.error("中国车停车费:{},{}元", carNo, dif);
                         chinaCarMoney = new BigDecimal(dif);
+                        chinaRes = res;
                         //  return ResultJson.error("请缴停车费" + dif + "元");
                     } else {
                         if (tbBusinessCar.getPayTime() == null) {
@@ -243,13 +262,14 @@ public class OpenService {
                     TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
                     return tbGoods.getVietnamCarPay() == 1;
                 });
-                if (vietnamCarPay&&payPart==0) {
-                    double dif = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now,tbBusinessCar.getCarNo()).doubleValue();
+                if (vietnamCarPay && payPart == 0) {
+                    IOrderPriceRes res = tbBusinessService.getPartMoney(tbBusinessCar.getRealInTime(), now, carNo, tbBusinessCar.getColor());
+                    double dif = res.getTotalOrderPrice().doubleValue();
                     if (dif > 0) {
                         RedisUtil.setByMINUTES(channel, carNo, 5);
                         log.error("越南车停车费:{},{}元", carNo, dif);
                         yueCarMoney = new BigDecimal(dif);
-                        //  return ResultJson.error("请缴停车费" + dif + "元");
+                        yueRes = res;
                     } else {
                         if (tbBusinessCar.getPayTime() == null) {
                             tbBusinessCar.setPayType(CarEnum.PayTypeEnum.FEE_TYPE.getType()).setPay(1);
@@ -259,8 +279,11 @@ public class OpenService {
             }
         }
         //============业务费计算是否交完
-        BigDecimal businessMoney = new BigDecimal(0);
-        int autoPayCount=0;
+        int autoPayCount = 0;
+        List<String> businessIds = businessList.stream().map(TbBusiness::getId).collect(Collectors.toList());
+        List<TbBusinessItem> businessItems = tbBusinessItemService.findByBusinessId(businessIds);
+        //入场管理费。。。。
+       // boolean needPayManagerMoney = tbBusinessService.needPayManagerMoney(carNo, businessItems);
         for (TbBusiness tbBusiness : businessList) {
             TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
             if (GoodsEnum.DeductionTypeEnum.OUT_KK.getCode().equals(tbGoods.getAutoDeductionType())) {
@@ -269,36 +292,43 @@ public class OpenService {
             int vietnamLeave = tbGoods.getVietnamCarLeave();
             int chinaCarLeave = tbGoods.getChinaCarLeave();
             boolean pay = tbBusiness.getPayMoney().doubleValue() >= tbBusiness.getItemPrice().doubleValue();
+
             //需要交业务费
             if (CarEnum.CarTypeEnum.WEIGHT_TYPE.getType().equals(carType)) {//越南车==重车
                 if (GoodsEnum.LeaveEnum.PART_MONEY.getCode() != vietnamLeave
                         && !pay) {
                     RedisUtil.setByMINUTES(channel, carNo, 5);
+                    tbBusinessItemService.buildExpenses(businessItems, expenses);
                     log.error("越南车==重车:缴纳业务费用:{}", carNo);
-                    businessMoney = businessMoney.add(tbBusiness.getItemPrice());
+                    // businessMoney = businessMoney.add(tbBusiness.getItemPrice());
                     // return ResultJson.error("请缴纳业务费用");
                 }
             } else {
                 if (GoodsEnum.LeaveEnum.PART_MONEY.getCode() != chinaCarLeave
                         && !pay) {
                     RedisUtil.setByMINUTES(channel, carNo, 5);
-                    businessMoney = businessMoney.add(tbBusiness.getItemPrice());
-                    log.error("需要缴纳业务费用:{},{}", carNo, businessMoney.toString());
+                    tbBusinessItemService.buildExpenses(businessItems, expenses);
+//                    businessMoney = businessMoney.add(tbBusiness.getItemPrice());
+//                    log.error("需要缴纳业务费用:{},{}", carNo, businessMoney.toString());
                     // return ResultJson.error("请缴纳业务费用");
                 }
             }
         }
+        if (!expenses.isEmpty()) {
+            businessRes = syncService.orderPriceCal(expenses);
+        }
         if (autoPayCount == businessList.size()) {
             log.info("车辆到达卡口进行扣停车费和业务费:{}", carNo);
             //自动缴费
-          boolean flag=  automaticPay.payBusinessAndPartMoney(businessList,businessMoney,tbBusinessCar,chinaCarMoney,yueCarMoney);
-          if (flag){
-              tbDeductionBindService.autoUnbindCar(tbBusinessCar.getCarNo());
-              freeOut(tbBusinessCar, now, channel, image);
-              return ResultJson.success();
-          }
+            boolean flag = automaticPay.payBusinessAndPartMoney(businessList, businessRes, tbBusinessCar, chinaRes, yueRes);
+            if (flag) {
+                tbDeductionBindService.autoUnbindCar(tbBusinessCar.getCarNo());
+                freeOut(tbBusinessCar, now, channel, image);
+                return ResultJson.success();
+            }
         }
-        BigDecimal carMoney=chinaCarMoney.add(yueCarMoney);
+        BigDecimal carMoney = chinaCarMoney.add(yueCarMoney);
+        BigDecimal businessMoney = businessRes.getTotalOrderPrice();
         BigDecimal total = businessMoney.add(carMoney);
         if (total.doubleValue() > 0) {
             String desc = "请缴";
@@ -317,15 +347,7 @@ public class OpenService {
     }
 
 
-
-
     private void freeOut(TbBusinessCar tbBusinessCar, Date now, String outChannel, String base64Image) {
-        if (StrUtil.equals(tbBusinessCar.getPayType(), CarEnum.PayTypeEnum.NO_PAY_TYPE.getType())) {
-            BigDecimal partMoney = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now, tbBusinessCar.getCarNo());
-            if (partMoney.doubleValue() <= 0) {
-                tbBusinessCar.setPayType(CarEnum.PayTypeEnum.FEE_TYPE.getType());
-            }
-        }
         tbBusinessCar.setRealOutTime(now).setTimeUpdate(now).setOutChannel(outChannel);
         if (tbBusinessCar.getPay() == 0) {
             tbBusinessCar.setPay(1);

+ 62 - 104
sp-server/src/main/java/com/pj/api/pushfee/bo/SyncBillParam.java

@@ -3,137 +3,95 @@ package com.pj.api.pushfee.bo;
 import lombok.Data;
 import lombok.experimental.Accessors;
 
-import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
 
 @Data
 @Accessors(chain = true)
-public class SyncBillParam implements Serializable {
-    /**
-     * 产品编号
-     */
+public class SyncBillParam {
+
+    private Integer id;
+
+    private String sysId;
+
+    private String sysName;
+
     private String prdNo;
-    /**
-     *产品名称
-     */
+
     private String prdName;
-    /**
-     *商品编号
-     */
+
     private String goodNo;
-    /**
-     *商品名称
-     */
+
     private String goodName;
-    /**
-     * 缴费主体编号
-     */
+
     private String subjectNo;
-    /**
-     * 缴费主体名称
-     */
+
     private String subjectName;
-    /**
-     *父订单号
-     */
+
     private String mainBillNo;
-    /**
-     *订单号
-     */
+
     private String subBillNo;
-    /**
-     *业务类型编号(二级分类)
-     */
+
     private String bizTypeNo;
-    /**
-     *业务类型名称
-     */
+
     private String bizTypeName;
-    /**
-     *收费项目编号(一级分类)
-     */
+
     private String chargeItemNo;
-    /**
-     *收费项目名称(一级分类)
-     */
+
     private String chargeItemName;
-    /**
-     *渠道支付流水号
-     */
+
+    private String paymentWayNo;
+
+    private String paymentWayName;
+
     private String paidSerialNo;
-    /**
-     *支付金额
-     */
-    private String paidAmount;
-    /**
-     *退款金额
-     */
-    private String refundAmount;
-    /**
-     *退款流水号
-     */
+
+    private BigDecimal paidAmount;
+
+    private String refundStatus;
+
+    private String refundStatusDesc;
+
+    private BigDecimal refundAmount;
+
     private String refundSerialNo;
-    /**
-     *支付状态
-     */
+
     private String payStatus;
-    /**
-     *订单日期
-     */
-    private Date billTime;
-    /**
-     *支付日期
-     */
-    private String payTime;
-    /**
-     *订单描述
-     */
+
+    private String payStatusDesc;
+
     private String billDesc;
-    /**
-     *订单状态
-     */
+
     private String billStatus;
-    /**
-     * insert update delete
-     */
-    private String syncType="insert";
-    /**
-     *数量
-     */
-    private String quantity;
-    /**
-     * 金额元(两位小数)
-     */
-    private String price;
-    /**
-     *分类路径
-     */
+
+    private String billStatusDesc;
+
+    private Integer quantity;
+
+    private BigDecimal price;
+
+    private BigDecimal saleAmount;
+
+    private Date billTime;
+
+    private Date payTime;
+
+    private BigDecimal actPrice;
+
     private String classifyPath;
-    /**
-     * 合作伙伴ID
-     */
+
     private String partnersId;
-    /**
-     *合作伙伴名称
-     */
+
     private String partnersName;
-    /**
-     * 减免金额
-     */
-    private BigDecimal saleAmount;
 
-    /**
-     * 实际金额
-     */
-    private BigDecimal actPrice;
+    private String calculateId;
+
+    private BigDecimal settlementAmount;
+
 
     /**
-     * 支付渠道编号
-     */
-    private String paymentWayNo;
-    /**
-     * 支付渠道名称
+     * 同步类型(从Bill copy字段的时候这个不能删啊。。。)
      */
-    private String paymentWayName;
+    private String syncType;
+
 }

+ 42 - 32
sp-server/src/main/java/com/pj/api/pushfee/task/FeeDetailSyncTask.java

@@ -6,6 +6,7 @@ import cn.com.btxc.micro.uni.openapi.keys.ApiKey;
 import cn.com.btxc.micro.uni.openapi.role.ClientRole;
 import cn.com.btxc.micro.uni.openapi.role.builder.ClientRoleBuilder;
 import cn.com.btxc.micro.uni.openapi.rsa.operation.ComposeOperationImpl;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.spring.SpringUtil;
 import cn.hutool.http.HttpUtil;
@@ -16,14 +17,22 @@ import com.pj.api.pushfee.bo.SyncBillParam;
 import com.pj.api.pushfee.bo.SyncBillRequest;
 import com.pj.constants.business.FeeTypeEnum;
 import com.pj.constants.business.PartFeeEnum;
+import com.pj.constants.business.PayEnum;
 import com.pj.current.config.PushfeeConfig;
 import com.pj.current.task.Task;
+import com.pj.project.sync.HelpService;
+import com.pj.project.sync.bo.SyncResultBO;
 import com.pj.project.tb_costomer.TbCostomer;
 import com.pj.project.tb_costomer.TbCostomerService;
 import com.pj.project.tb_fee_details.TbFeeDetails;
 import com.pj.project.tb_fee_details.TbFeeDetailsService;
+import com.pj.project.tb_fee_item.TbFeeItem;
+import com.pj.project.tb_fee_item.TbFeeItemService;
 import lombok.extern.slf4j.Slf4j;
 
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -33,20 +42,17 @@ import java.util.List;
  */
 @Slf4j
 public class FeeDetailSyncTask extends Task {
-    //客户端公私钥
-    public static final String clientPublicKeyBase6 = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCimSu5J8apt2YR/o9joOCNdFzO3rOHcdcqnSCm1Wt19VwskTVjkKHc/CXHUoskX5vMiMiv6xPnf/lDpMO6KnCrwlVQFtbPvmnkwyUs/haW8ggR865MqDcBpdMGnuV0YJ04UXxSrOX+eu+dl91Web4/ZiRKbObOa8WhFm/Ln2QKswIDAQAB";
-    public static final String clientPrivateKeyBase6 = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKKZK7knxqm3ZhH+j2Og4I10XM7es4dx1yqdIKbVa3X1XCyRNWOQodz8JcdSiyRfm8yIyK/rE+d/+UOkw7oqcKvCVVAW1s++aeTDJSz+FpbyCBHzrkyoNwGl0wae5XRgnThRfFKs5f56752X3VZ5vj9mJEps5s5rxaEWb8ufZAqzAgMBAAECgYAmP/QaLXI9kIgxaXnfzQOmIx6GB7uh/DTKsIXy2TfbWunhDhPKJUb+jk5w0kkrOFaVSgQz5hAboG5J7GOi0sMINLb7H2WsOm3uGM/8HPZYsrNFnB8VUiD26LIZ6+HhPXfp/LN+k5eUnUlD6z/dZU1k6hJPOSFC3PyzfBWqaQMqGQJBAMVdQ9Uw+eC94qD1MSSEQZhqpfGE4vO7WrSACLFqyZrHvaIwZTjdUZRF1aMlJyT0afOkfSN/53QQEcejXMUrSBcCQQDS576SXkpdfrN2jmr9BAimi+6AP71GUgXL3O+2yRL2szLoU7GwtMREPBFw+ocnC4UN87NCYveJCzenQEt48JfFAkAqEIa0mYuoatAyng+rSMTyR0i3ASud5wCeF+vCZJAzfP7d4pKwW/tXLsspynFdXvp2A0jomAosooAnnJnZLDBhAkBzXoXm92Fip45wShPIeE5rHJzI1xUoxHGbRS50JKYVAY3VfQL0kM3ULa+0x7bq6uhL64WhyRVziAlXmlouvB2pAkEAuDvsjVhdo3uMGL7Tr+igPhajoWUTjPuAf+Od3SsqMTPFLBpbJM8ziXk39Me9S8wqgGwR3pnlC1Z6Rybgm+uy4g==";
-    //服务端公私钥
-    public static final String serverPublicKeyBase6 = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCb5yK85EKqwiQU+z1jyjOng6ecssQpEjC6STbCuSWN6KHLkijBxdqrCumXhbIyOVx4lHK9Rg5EjzlQxoaXQTgJdItaGjLC+UTE+NNAnnaFLg0x4jajNpLo473zdZxTYQaT3q/aKnTeXuKHw11PPUe4hmmfxPcdt9yJ0Iqo/XxV3QIDAQAB";
-    public static final String serverPrivateKeyBase64 = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJvnIrzkQqrCJBT7PWPKM6eDp5yyxCkSMLpJNsK5JY3oocuSKMHF2qsK6ZeFsjI5XHiUcr1GDkSPOVDGhpdBOAl0i1oaMsL5RMT400CedoUuDTHiNqM2kujjvfN1nFNhBpPer9oqdN5e4ofDXU89R7iGaZ/E9x233InQiqj9fFXdAgMBAAECgYASoeKgcaVYFCDM0yQIn5thy1XGYAUapX5mXSaqygbneWSQ2FR/qB5Ur9awEb30y682CAPYhB1jazyd30QpopVINvyhaWhgq1b/8KD92FqOg1eXxa7bTuTe8aMuKTB/ZJjEry0d5Mu3i6zYKtTSbnpnag5I3UE5awLDy7utYOoOHwJBAPtvz2ZBhtJvL3lsMgs7kGqrPqqI2LAX8J3oOCtE/6eQjQ0I5fBCybrwHp3baDrYul5KTL3kJvl4iWN/gHDi/nMCQQCeu3gzy0DVtM8M8bzFc/ZA753WRn4Z5axQa6lE7Tski8TUw4Bhbfan9E/C6l6Guo/+2hXPAE/RMcncClqeXXZvAkEAgf6FsO1x4fxABDvvB6Ws/ak5hfuoZCqMaWd1GtHah2yRsEqIbxZoq7CXc6/LDJmeiT9Ku+ZoTBSIm5uA8Vw6hwJALEbs872pmzMxYlH4Lzf2pAxzAbduK3kmhNRTRjfKfJpEUHksUYEkAZujuCI6NejKi/N3i+NxYFA8F5YHyw8VHwJAWoiYSYLSziHgDytoPKFvUp6EKLGDClhACJKc4LuaPNWICMxb5Dp88sY0NDYb4HzCyWIE5G4vbiF/K3kEEwCIVA==";
-    private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
+
+
     private String detailId;
     private String syncType;
+    private PayEnum.PayType payType;
 
-    public FeeDetailSyncTask(String taskId, long delayInMilliseconds, String detailId, String syncType) {
-        super(taskId, delayInMilliseconds);
+    public FeeDetailSyncTask(String id, long delayInMilliseconds, String detailId, String syncType, PayEnum.PayType payType) {
+        super(id, delayInMilliseconds);
         this.detailId = detailId;
         this.syncType = syncType;
+        this.payType = payType;
     }
 
     private List<SyncBillParam> buildParams(TbFeeDetails tbFeeDetails) {
@@ -68,18 +74,31 @@ public class FeeDetailSyncTask extends Task {
                 opd.setPartnersId(tbCostomer.getId());
             }
         }
+        TbFeeItemService tbFeeItemService = SpringUtil.getBean(TbFeeItemService.class);
+        TbFeeItem tbFeeItem = tbFeeItemService.getById(tbFeeDetails.getFeeType());
         String subBillNo = StrUtil.isEmpty(tbFeeDetails.getBusinessNo()) ? tbFeeDetails.getBusinessCarNo() : tbFeeDetails.getBusinessCarNo();
         String classifyPath = tbFeeDetails.getFeeType() + "-" + itemTypeId + "-" + itemId;
-        opd.setSyncType(syncType).setQuantity(tbFeeDetails.getNum().toString())
-                .setSubjectName(tbFeeDetails.getCarNo()).setSubBillNo(subBillNo)
-                .setBizTypeNo(itemTypeId).setBizTypeName(tbFeeDetails.getItemTypeName())
-                .setChargeItemName(FeeTypeEnum.getDesc(tbFeeDetails.getFeeType())).setChargeItemNo(tbFeeDetails.getFeeType() + "")
-                .setClassifyPath(classifyPath).setPartnersName(partnersName)
+        opd.setSyncType(syncType)
+                .setSubjectNo(tbFeeDetails.getCarNo())
+                .setSubjectName(tbFeeDetails.getCarNo())
+                .setSubBillNo(subBillNo)
+                .setBizTypeNo(itemTypeId)
+                .setBizTypeName(tbFeeDetails.getItemTypeName())
+                .setChargeItemName(tbFeeItem.getName())
+                .setChargeItemNo(tbFeeDetails.getFeeType() + "")
+                .setClassifyPath(classifyPath)
+                .setPartnersName(partnersName)
                 .setPaidSerialNo(tbFeeDetails.getTransactionId())
-                .setPaidAmount(tbFeeDetails.getItemPrice().toString()).setRefundAmount("0").setPayStatus("支付成功")
-                .setPayTime(tbFeeDetails.getPayTime()).setBillTime(tbFeeDetails.getCreateTime())
-                .setPrice(tbFeeDetails.getItemPrice().toString()).setActPrice(tbFeeDetails.getItemPrice())
-                .setBillStatus("已完成");
+                .setPaidAmount(tbFeeDetails.getItemPrice())
+                .setRefundAmount(BigDecimal.valueOf(0))
+                .setPayStatus("支付成功")
+                .setPayTime(DateUtil.parse(tbFeeDetails.getPayTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
+                .setBillTime(tbFeeDetails.getCreateTime())
+                .setPrice(tbFeeDetails.getItemPrice())
+                .setActPrice(tbFeeDetails.getItemPrice())
+                .setBillStatus("已完成")
+                .setPaymentWayNo(payType.getCode() + "")
+                .setPaymentWayName(payType.getDesc());
         log.info("基础数据:{}", JSONUtil.parseObj(opd));
         opdList.add(opd);
         return opdList;
@@ -89,11 +108,12 @@ public class FeeDetailSyncTask extends Task {
     @Override
     public void run() {
         PushfeeConfig pushfeeConfig = SpringUtil.getBean(PushfeeConfig.class);
-        if (!pushfeeConfig.isEnable()){
+        if (!pushfeeConfig.isEnable()) {
             log.info("系统未启用同步功能");
             return;
         }
-        log.info("开始同步发票信息:{}", detailId);
+        HelpService helpService = SpringUtil.getBean(HelpService.class);
+        log.info("开始同步订单信息:{}", detailId);
         TbFeeDetailsService tbFeeDetailsService = SpringUtil.getBean(TbFeeDetailsService.class);
         TbFeeDetails tbFeeDetails = tbFeeDetailsService.getById(detailId);
         if (tbFeeDetails == null || tbFeeDetails.getSyncStatus() == 1) {
@@ -101,20 +121,10 @@ public class FeeDetailSyncTask extends Task {
             return;
         }
         List<SyncBillParam> list = buildParams(tbFeeDetails);
-        String sysId = pushfeeConfig.getSysId();
-        ApiKey clientApiKey = new ApiKey(sysId, pushfeeConfig.getSysName(), serverPublicKeyBase6, clientPublicKeyBase6, clientPrivateKeyBase6);
-        ComposeOperation operation = new ComposeOperationImpl();
-        ClientRole clientHelper = ClientRoleBuilder.builder().operation(operation).build();
         SyncBillRequest detail = new SyncBillRequest();
         detail.setBillList(list);
-        Message message = clientHelper.requestPayloadObject(sysId, detail, clientApiKey);
-        String messageToBeSend = gson.toJson(message);
-        log.info("客户端发送报文:" + messageToBeSend);
-        String response = HttpUtil.createPost(pushfeeConfig.getSyncUrl())
-                .header("Authorization", "openApi")
-                .timeout(2000).setReadTimeout(3000).body(messageToBeSend).execute().body();
-        log.info("服务端返回响应:{}", response);
-        if (JSONUtil.parseObj(response).getInt("code") == 200) {
+        SyncResultBO response = helpService.req("/data/sync/bill", detail);
+        if (response.getCode() == 200) {
             tbFeeDetails.setSyncStatus(1);
         } else {
             tbFeeDetails.setSyncStatus(2);

+ 0 - 5
sp-server/src/main/java/com/pj/api/pushfee/web/TestApi.java

@@ -15,9 +15,4 @@ public class TestApi {
     @Resource
     TaskService taskService;
 
-    @RequestMapping("test")
-    public AjaxJson test(String id){
-        taskService.addTask(new FeeDetailSyncTask(RandomUtil.randomNumbers(5),2000,id,"insert"));
-        return AjaxJson.getSuccess();
-    }
 }

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

@@ -158,12 +158,12 @@ public class ApiService {
         if (tbBusinessCar.getPayTime() != null) {
             startTime = tbBusinessCar.getPayTime();
         }
-        BigDecimal price = tbBusinessService.calculationPartMoney(startTime, now, tbBusinessCar.getCarNo());
+//        BigDecimal price = tbBusinessService.calculationPartMoney(startTime, now, tbBusinessCar.getCarSize());
         Map<String, Object> car = new HashMap<>();
         car.put("id", tbBusinessCar.getId());
         car.put("carNo", tbBusinessCar.getCarNo());
-        car.put("price", price);
-        result.put("total", price);
+//        car.put("price", price);
+//        result.put("total", price);
         result.put("cars", Collections.singleton(car));
         return result;
     }

+ 4 - 0
sp-server/src/main/java/com/pj/api/wx/bo/Attach.java

@@ -21,5 +21,9 @@ public class Attach implements Serializable {
      * 账户充值json
      */
     private String a;
+    /**
+     * 入场管理费
+     */
+    private String i;
 
 }

+ 18 - 0
sp-server/src/main/java/com/pj/api/wx/bo/ManagerBO.java

@@ -0,0 +1,18 @@
+package com.pj.api.wx.bo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+public class ManagerBO implements Serializable {
+    private String calculateId;
+    private String name;
+    private String label;
+    private String id;
+    private String carNo;
+    private String carId;
+    private BigDecimal price;
+
+}

+ 22 - 2
sp-server/src/main/java/com/pj/api/wx/bo/PriceBO.java

@@ -9,9 +9,29 @@ import java.math.BigDecimal;
 
 @Data
 @Accessors(chain = true)
-@AllArgsConstructor
-@NoArgsConstructor
+
 public class PriceBO {
     private String id;
     private BigDecimal p;
+    private String uniqExpenseId;
+    private String calculateId;
+    private String carDesc;
+    private String hourDesc;
+    //24小时内费用
+    private BigDecimal standard;
+    /**
+     * 额外
+     */
+    private BigDecimal extraPrice;
+
+    public PriceBO() {
+    }
+
+    public PriceBO(String id, BigDecimal p, String uniqExpenseId, String carDesc, String hourDesc) {
+        this.id = id;
+        this.p = p;
+        this.uniqExpenseId = uniqExpenseId;
+        this.carDesc = carDesc;
+        this.hourDesc = hourDesc;
+    }
 }

+ 14 - 2
sp-server/src/main/java/com/pj/api/wx/service/WxService.java

@@ -249,7 +249,9 @@ public class WxService {
                 //支付完之后要解绑
                 automaticPay.unbindRun(car.getCarNo());
             }
-            tbFeeDetailsService.chargeParkFee(cars, transactionId, outTradeNo, payTime, PayEnum.PayType.WX_PAY);//添加cars的收费明细
+            if (!cars.isEmpty()) {
+                tbFeeDetailsService.chargeParkFee(cars, transactionId, outTradeNo, payTime, PayEnum.PayType.WX_PAY);//添加cars的收费明细
+            }
             String businessId = attach.getB();
             Date finalPayTime = payTime;
             if (StrUtil.isNotEmpty(businessId)) {
@@ -262,6 +264,7 @@ public class WxService {
                 for (TbBusiness tbBusiness : businessList) {
                     tbBusiness.setPayTime(payTime).setPayType(PayEnum.PayType.WX_PAY.getCode()).setConfirmInput(1).setConfirmInputTime(payTime)
                             .setPayMoney(tbBusiness.getItemPrice()).setPayOpenid(payopenid)
+                            .setCalculateId(tbOrder.getCalculateId())
                             .setPayNo(transactionId).setOutTradeNo(outTradeNo);
                     tbBusiness.setPayStatus(PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode());
                     tbBusinessService.updateById(tbBusiness);
@@ -277,11 +280,20 @@ public class WxService {
                         }
                     });
                 }
+                items.forEach(tbBusinessItem -> tbBusinessItem.setPayStatus(1).setPayTime(finalPayTime).setCalculateId(tbOrder.getCalculateId()));
                 tbFeeDetailsService.chargeBusinessFee(items, transactionId, outTradeNo, payTime, PayEnum.PayType.WX_PAY);//添加items的收费明细
-                items.forEach(tbBusinessItem -> tbBusinessItem.setPayStatus(1).setPayTime(finalPayTime));
                 tbBusinessItemService.updateBatchById(items);
             }
+            String i = attach.getI();
+            //入场管理费
+            if (StrUtil.isNotEmpty(i)) {
+                // ManagerBO managerBO = JSONUtil.toBean(i, ManagerBO.class);
+                //   tbFeeDetailsService.chargeManagerFee(managerBO, transactionId, outTradeNo, payTime, PayEnum.PayType.WX_PAY);//添加cars的收费明细
+            }
+
             tbFeeStatisticsService.addOrUpdateStatistic(payTime);//更新当前日期的日统计
+
+
             String a = attach.getA();
             if (StrUtil.isNotEmpty(a)) {//充值的======>
                 AccountChargeBO chargeBO = JSONUtil.toBean(a, AccountChargeBO.class);

+ 22 - 22
sp-server/src/main/java/com/pj/constants/business/FeeTypeEnum.java

@@ -8,29 +8,29 @@ import java.util.*;
 @Getter
 @AllArgsConstructor
 public enum FeeTypeEnum {
-    OTHER_FEE(-1, "其他"),
-    NUCLEIC_FEE(1, "核酸检测"),
-    DISINFECT_FEE(2, "消杀作业"),
-    STEVEDORE_FEE(3, "装卸作业"),
+//    OTHER_FEE(-1, "其他"),
+//    NUCLEIC_FEE(1, "核酸检测"),
+//    DISINFECT_FEE(2, "消杀作业"),
+//    STEVEDORE_FEE(3, "装卸作业"),
     PARK_FEE(4, "停车业务"),
-    WEIGHT_FEE(5, "过磅费"),
-    MANAGE_FEE(6, "入场管理费"),
-    CHARGE_FEE(7, "充电打冷作业");
+//    WEIGHT_FEE(5, "过磅费"),
+    MANAGE_FEE(6, "入场管理费");
+//    CHARGE_FEE(7, "充电打冷作业");
     private int code;
     private String desc;
-
-    public static List<Map<String, Object>> getList() {
-        List<Map<String, Object>> list = new ArrayList<>();
-        for (FeeTypeEnum feeTypeEnum : FeeTypeEnum.values()) {
-            Map<String, Object> map = new HashMap<>();
-            map.put("id", feeTypeEnum.getCode());
-            map.put("name", feeTypeEnum.getDesc());
-            list.add(map);
-        }
-        return list;
-    }
-    public static String getDesc(int code) {
-      return   Arrays.stream(FeeTypeEnum.values()).filter(feeTypeEnum -> feeTypeEnum.getCode()==code)
-                .findAny().orElse(OTHER_FEE).getDesc();
-    }
+//
+//    public static List<Map<String, Object>> getList() {
+//        List<Map<String, Object>> list = new ArrayList<>();
+//        for (FeeTypeEnum feeTypeEnum : FeeTypeEnum.values()) {
+//            Map<String, Object> map = new HashMap<>();
+//            map.put("id", feeTypeEnum.getCode());
+//            map.put("name", feeTypeEnum.getDesc());
+//            list.add(map);
+//        }
+//        return list;
+//    }
+//    public static String getDesc(int code) {
+//      return   Arrays.stream(FeeTypeEnum.values()).filter(feeTypeEnum -> feeTypeEnum.getCode()==code)
+//                .findAny().orElse(OTHER_FEE).getDesc();
+//    }
 }

+ 21 - 0
sp-server/src/main/java/com/pj/constants/business/ManagerEnum.java

@@ -0,0 +1,21 @@
+package com.pj.constants.business;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Getter
+@AllArgsConstructor
+public enum  ManagerEnum {
+
+    VER_PAY(1, "越南车收管理费"),
+    CHINA_PAY(2, "中国车收管理费");
+
+    private int type;
+    private String desc;
+
+}

+ 2 - 2
sp-server/src/main/java/com/pj/constants/business/PartFeeEnum.java

@@ -10,10 +10,10 @@ import java.util.Arrays;
 @Getter
 @AllArgsConstructor
 public enum PartFeeEnum {
-    DAY_PART("1", "白天停车"),
-    NIGHT_PART("2", "夜间停车"),
     IN_24_HOURS("3","24小时内停车服务收费"),
     OUT_24_HOURS("4","停放超24小时停车服务收费"),
+    BIG_CAR("5","大型货车(含9.6米以上货车)"),
+    MIDDLER_CAR("6","中小型货车(9.6米以下货车)"),
     UNKNOW("-1", "未知"),
     ;
     private String no;

+ 14 - 0
sp-server/src/main/java/com/pj/current/config/MyConfig.java

@@ -4,6 +4,8 @@ import lombok.Data;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
+
 /**
  * 项目自定义配置
  *
@@ -40,6 +42,18 @@ public class MyConfig {
      * 系统日志路径
      */
     private String sysLogPath;
+    /**
+     * 场地管理费配置
+     */
+    private List<Integer> managerMoney;
+    /**
+     * 入场管理费匹配词
+     */
+    private String managerWord;
+    /**
+     * 收入场管理费需要先做的业务类型
+     */
+    private List<String> managerItemType;
 
 
 }

+ 7 - 0
sp-server/src/main/java/com/pj/current/config/PushfeeConfig.java

@@ -24,4 +24,11 @@ public class PushfeeConfig {
     private String startTime;
     private Integer timeSpan;
 
+    //客户端公私钥
+    private String clientPublicKeyBase6;
+    private String clientPrivateKeyBase6;
+    //服务端公私钥
+    private String serverPublicKeyBase6;
+    private String serverPrivateKeyBase64;
+
 }

+ 6 - 0
sp-server/src/main/java/com/pj/project/relation_goods_type/RelationGoodsTypeService.java

@@ -100,4 +100,10 @@ public class RelationGoodsTypeService extends ServiceImpl<RelationGoodsTypeMappe
         ew.eq("type_id", typeId);
         return getOne(ew);
     }
+
+    public void removeByTypeId(String typeId) {
+        QueryWrapper<RelationGoodsType> ew = new QueryWrapper<>();
+        ew.eq("type_id", typeId);
+        this.remove(ew);
+    }
 }

+ 5 - 0
sp-server/src/main/java/com/pj/project/relation_type_item/RelationTypeItemService.java

@@ -127,4 +127,9 @@ public class RelationTypeItemService extends ServiceImpl<RelationTypeItemMapper,
     }
 
 
+    public void removeByItemId(String itemId) {
+        QueryWrapper<RelationTypeItem> ew = new QueryWrapper<>();
+        ew.lambda().eq(RelationTypeItem::getItemId, itemId);
+        this.remove(ew);
+    }
 }

+ 70 - 0
sp-server/src/main/java/com/pj/project/sync/HelpService.java

@@ -0,0 +1,70 @@
+package com.pj.project.sync;
+
+import cn.com.btxc.micro.uni.openapi.inject.ComposeOperation;
+import cn.com.btxc.micro.uni.openapi.inter.message.Message;
+import cn.com.btxc.micro.uni.openapi.inter.message.ParsedMessage;
+import cn.com.btxc.micro.uni.openapi.keys.ApiKey;
+import cn.com.btxc.micro.uni.openapi.role.ClientRole;
+import cn.com.btxc.micro.uni.openapi.role.builder.ClientRoleBuilder;
+import cn.com.btxc.micro.uni.openapi.role.builder.ServerRoleBuilder;
+import cn.com.btxc.micro.uni.openapi.rsa.operation.ComposeOperationImpl;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONUtil;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.pj.current.config.PushfeeConfig;
+import com.pj.project.sync.bo.SyncResultBO;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.formula.functions.T;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+@Component
+@Slf4j
+public class HelpService {
+    @Resource
+    private PushfeeConfig pushfeeConfig;
+    public static final String clientPublicKeyBase6 = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCimSu5J8apt2YR/o9joOCNdFzO3rOHcdcqnSCm1Wt19VwskTVjkKHc/CXHUoskX5vMiMiv6xPnf/lDpMO6KnCrwlVQFtbPvmnkwyUs/haW8ggR865MqDcBpdMGnuV0YJ04UXxSrOX+eu+dl91Web4/ZiRKbObOa8WhFm/Ln2QKswIDAQAB";
+    public static final String clientPrivateKeyBase6 = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKKZK7knxqm3ZhH+j2Og4I10XM7es4dx1yqdIKbVa3X1XCyRNWOQodz8JcdSiyRfm8yIyK/rE+d/+UOkw7oqcKvCVVAW1s++aeTDJSz+FpbyCBHzrkyoNwGl0wae5XRgnThRfFKs5f56752X3VZ5vj9mJEps5s5rxaEWb8ufZAqzAgMBAAECgYAmP/QaLXI9kIgxaXnfzQOmIx6GB7uh/DTKsIXy2TfbWunhDhPKJUb+jk5w0kkrOFaVSgQz5hAboG5J7GOi0sMINLb7H2WsOm3uGM/8HPZYsrNFnB8VUiD26LIZ6+HhPXfp/LN+k5eUnUlD6z/dZU1k6hJPOSFC3PyzfBWqaQMqGQJBAMVdQ9Uw+eC94qD1MSSEQZhqpfGE4vO7WrSACLFqyZrHvaIwZTjdUZRF1aMlJyT0afOkfSN/53QQEcejXMUrSBcCQQDS576SXkpdfrN2jmr9BAimi+6AP71GUgXL3O+2yRL2szLoU7GwtMREPBFw+ocnC4UN87NCYveJCzenQEt48JfFAkAqEIa0mYuoatAyng+rSMTyR0i3ASud5wCeF+vCZJAzfP7d4pKwW/tXLsspynFdXvp2A0jomAosooAnnJnZLDBhAkBzXoXm92Fip45wShPIeE5rHJzI1xUoxHGbRS50JKYVAY3VfQL0kM3ULa+0x7bq6uhL64WhyRVziAlXmlouvB2pAkEAuDvsjVhdo3uMGL7Tr+igPhajoWUTjPuAf+Od3SsqMTPFLBpbJM8ziXk39Me9S8wqgGwR3pnlC1Z6Rybgm+uy4g==";
+    //服务端公私钥
+    public static final String serverPublicKeyBase6 = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCb5yK85EKqwiQU+z1jyjOng6ecssQpEjC6STbCuSWN6KHLkijBxdqrCumXhbIyOVx4lHK9Rg5EjzlQxoaXQTgJdItaGjLC+UTE+NNAnnaFLg0x4jajNpLo473zdZxTYQaT3q/aKnTeXuKHw11PPUe4hmmfxPcdt9yJ0Iqo/XxV3QIDAQAB";
+
+
+    private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
+
+    /**
+     * 发送请求
+     *
+     * @param body
+     * @return
+     */
+    public SyncResultBO req(String path, Object body) {
+        String sysId = pushfeeConfig.getSysId();
+        ApiKey clientApiKey = new ApiKey(sysId, pushfeeConfig.getSysName(), pushfeeConfig.getServerPublicKeyBase6(), pushfeeConfig.getClientPublicKeyBase6(), pushfeeConfig.getClientPrivateKeyBase6());
+        ComposeOperation operation = new ComposeOperationImpl();
+        ClientRole clientHelper = ClientRoleBuilder.builder().operation(operation).build();
+        Message message = clientHelper.requestPayloadObject(sysId, body, clientApiKey);
+        String messageToBeSend = gson.toJson(message);
+        log.info("客户端发送报文:{},{}" +path, messageToBeSend);
+        String resp= HttpUtil.createPost(pushfeeConfig.getSyncUrl() + path)
+                .header("Authorization", "openApi")
+                .timeout(2000).setReadTimeout(3000).body(messageToBeSend).execute().body();
+        log.info("返回:{},{}" +path, resp);
+        return JSONUtil.toBean(resp,SyncResultBO.class);
+    }
+
+    /**
+     * 解密
+     * @param content
+     * @param
+     * @return
+     */
+    public <T> T deCrypte(String content, Class<T> clazz) {
+        String sysId = pushfeeConfig.getSysId();
+        ApiKey clientApiKey = new ApiKey(sysId, pushfeeConfig.getSysName(), pushfeeConfig.getServerPublicKeyBase6(), pushfeeConfig.getClientPublicKeyBase6(), pushfeeConfig.getClientPrivateKeyBase6());
+        ComposeOperation operation = new ComposeOperationImpl();
+        ParsedMessage parsedMessage = ServerRoleBuilder.builder().operation(operation).build().processRequestBody(content, clientApiKey);
+        return parsedMessage.getBean(clazz);
+    }
+}

+ 111 - 0
sp-server/src/main/java/com/pj/project/sync/SyncService.java

@@ -0,0 +1,111 @@
+package com.pj.project.sync;
+
+import cn.hutool.json.JSONUtil;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.pj.current.config.PushfeeConfig;
+import com.pj.project.sync.bo.*;
+import com.pj.project.sync.dto.IExpensePriceReq;
+import com.pj.project.sync.dto.ItemTypeDTO;
+import com.pj.project.sync.dto.PartnerDTO;
+import com.pj.project.sync.dto.PartnerParam;
+import com.pj.project.sync.dto.item.IFactorItem;
+import com.pj.project.sync.request.IOrderPriceReq;
+import com.pj.project.sync.request.item.IOrderItem;
+import com.pj.project.sync.response.IExpensePriceRes;
+import com.pj.project.sync.response.IOrderPriceRes;
+import com.pj.project.sync.response.item.IExpenseItem;
+import com.pj.utils.sg.AjaxError;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.Collections;
+import java.util.List;
+
+@Service
+@Slf4j
+public class SyncService {
+    @Resource
+    private PushfeeConfig pushfeeConfig;
+    @Resource
+    private HelpService helpService;
+    private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
+
+    /**
+     * 同步合作伙伴
+     *
+     * @param id
+     * @param name
+     * @param syncType
+     */
+    @Async
+    public void syncPartnes(String id, String name, String syncType) {
+        log.info("sync partner:{},{},{}",id,name,syncType);
+        PartnerParam dto = new PartnerParam(id, name, syncType);
+        List<PartnerParam> list = Collections.singletonList(dto);
+        PartnerDTO partnerDTO = new PartnerDTO();
+        partnerDTO.setPartnersList(list);
+        helpService.req("/data/sync/partners", partnerDTO);
+    }
+
+    @Async
+    public void syncPartnes(  PartnerDTO partnerDTO ) {
+        log.info("sync partner:{}",JSONUtil.toJsonStr(partnerDTO));
+        helpService.req("/data/sync/partners", partnerDTO);
+    }
+
+    public List<IExpenseItem> syncItemTypeList(String itemTypeName, String itemCode) {
+        ItemTypeDTO dto = new ItemTypeDTO();
+        dto.setSysId(pushfeeConfig.getSysId()).setBizTypeNo(itemCode).setExpenseName(itemTypeName);
+        SyncResultBO resultBO = helpService.req("/price/external/expense/list", dto);
+        IExpenseListQueryRes res = helpService.deCrypte(resultBO.getData(), IExpenseListQueryRes.class);
+        return res.getList();
+
+    }
+
+    /**
+     * 费项价格计算
+     *
+     * @param uniqExpenseId
+     * @param num
+     * @param factorItems
+     * @return
+     */
+    public IExpensePriceRes calItemPrice(String uniqExpenseId, int num, List<IFactorItem> factorItems) {
+        IExpensePriceReq iExpensePriceReq = new IExpensePriceReq();
+        iExpensePriceReq.setUniqExpenseId(uniqExpenseId)
+                .setExpenseNum(num)
+                .setFactors(factorItems);
+        SyncResultBO resultBO = helpService.req("/price/external/expense/price", iExpensePriceReq);
+        if (resultBO.getCode() == 200) {
+            IExpensePriceRes res = helpService.deCrypte(resultBO.getData(), IExpensePriceRes.class);
+            return res;
+        }
+        throw new AjaxError("计算费用出错");
+    }
+
+    /**
+     * 计费规则
+     * let standard = 30;
+     * let extraPrice=40;
+     * let overStandard = floor(hour/24) * extraPrice;
+     * let total = standard + overStandard;
+     * return total;
+     * 订单计算接口
+     * @param expenses
+     */
+    public IOrderPriceRes orderPriceCal(  List<IOrderItem> expenses ){
+        log.info("order price:{}",JSONUtil.toJsonStr(expenses));
+        IOrderPriceReq iOrderPriceReq=new IOrderPriceReq();
+        iOrderPriceReq.setSysId(pushfeeConfig.getSysId()).setExpenses(expenses).setOrderNum(1);
+        SyncResultBO resultBO = helpService.req("/price/external/order/calc", iOrderPriceReq);
+        if (resultBO.getCode() == 200) {
+            return  helpService.deCrypte(resultBO.getData(), IOrderPriceRes.class);
+        }
+        throw new AjaxError(resultBO.getMsg());
+    }
+
+}

+ 48 - 0
sp-server/src/main/java/com/pj/project/sync/api/AsyncApi.java

@@ -0,0 +1,48 @@
+package com.pj.project.sync.api;
+
+import cn.com.btxc.micro.uni.openapi.inject.ComposeOperation;
+import cn.com.btxc.micro.uni.openapi.keys.ApiKey;
+import cn.com.btxc.micro.uni.openapi.rsa.operation.ComposeOperationImpl;
+import com.pj.project.sync.HelpService;
+import com.pj.project.sync.SyncService;
+import com.pj.project.sync.dto.ItemTypeDTO;
+import com.pj.project.tb_item.TbItemService;
+import com.pj.project.tb_item_type.TbItemTypeService;
+import com.pj.utils.sg.AjaxJson;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("business/sync")
+@Slf4j
+public class AsyncApi {
+
+    @Resource
+    private TbItemTypeService tbItemTypeService;
+    @Resource
+    private TbItemService tbItemService;
+
+
+    /**
+     * 业务类型同步接口
+     * @param request
+     * @return
+     */
+    @PostMapping("item-type")
+    public int syncItemType(@RequestBody String request) {
+        log.info("sync 业务类型:{}", request);
+        tbItemTypeService.receive(request);
+        return 1;
+    }
+    @PostMapping("item-detail")
+    public int syncItemDetail(@RequestBody String request) {
+        log.info("sync 费项详情:{}", request);
+        tbItemService.receive(request);
+        return 1;
+    }
+}

+ 13 - 0
sp-server/src/main/java/com/pj/project/sync/bo/FactorDTO.java

@@ -0,0 +1,13 @@
+package com.pj.project.sync.bo;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@OpenApi(apiName = "REQ_004")
+public class FactorDTO {
+    private String uniqueExpenseId;
+    private List<PriceFactorDTO> priceFactors;
+}

+ 10 - 0
sp-server/src/main/java/com/pj/project/sync/bo/FactorParams.java

@@ -0,0 +1,10 @@
+package com.pj.project.sync.bo;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import lombok.Data;
+
+@Data
+@OpenApi(apiName = "REQ_004")
+public class FactorParams {
+    private String uniqueExpenseId;
+}

+ 18 - 0
sp-server/src/main/java/com/pj/project/sync/bo/IExpenseListQueryRes.java

@@ -0,0 +1,18 @@
+package com.pj.project.sync.bo;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import com.pj.project.sync.response.item.IExpenseItem;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@OpenApi(apiName = "REQ_003")
+public class IExpenseListQueryRes {
+
+    /**
+     * 费项列表
+     */
+    List<IExpenseItem> list;
+
+}

+ 26 - 0
sp-server/src/main/java/com/pj/project/sync/bo/ItemTypeBO.java

@@ -0,0 +1,26 @@
+package com.pj.project.sync.bo;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@OpenApi(apiName = "REQ_012")
+public class ItemTypeBO implements Serializable {
+    private String sysId;
+    private String sysName;
+    private String keyId;
+    private String keyName;
+    private String syncType;
+    private String parentId;
+    private String label;
+    private String level;
+    private String partnersId;
+    //0 启用 1禁用
+    private int state=0;
+    private Date startTime;
+    private Date endTime;
+
+}

+ 17 - 0
sp-server/src/main/java/com/pj/project/sync/bo/PriceFactorDTO.java

@@ -0,0 +1,17 @@
+package com.pj.project.sync.bo;
+import lombok.Data;
+import java.io.Serializable;
+
+@Data
+public class PriceFactorDTO implements Serializable {
+    private String id;
+    private String sysId;
+    private String unit;
+    private String facName;
+    private String aliasName;
+    private String textType;
+    private String operator;
+    private String rangeVal;
+
+
+}

+ 11 - 0
sp-server/src/main/java/com/pj/project/sync/bo/SubExpenseDTO.java

@@ -0,0 +1,11 @@
+package com.pj.project.sync.bo;
+
+import lombok.Data;
+
+@Data
+public class SubExpenseDTO {
+    private String subExpenseName;
+
+    private String subExpensePrice;
+
+}

+ 29 - 0
sp-server/src/main/java/com/pj/project/sync/bo/SyncResultBO.java

@@ -0,0 +1,29 @@
+package com.pj.project.sync.bo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class SyncResultBO implements Serializable {
+    private Integer code;
+    private String msg;
+    private String timestamp;
+    private String data;
+
+    @Data
+  public   static class DataBO {
+        private ReqBO request;
+        private String signature;
+
+        @Data
+        public static class ReqBO {
+            private String sysId;
+            private String encrypted;
+            private String keyEncrypted;
+            private String apiName;
+            private String timeStamp;
+        }
+    }
+
+}

+ 39 - 0
sp-server/src/main/java/com/pj/project/sync/dto/IExpensePriceReq.java

@@ -0,0 +1,39 @@
+package com.pj.project.sync.dto;
+
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import com.pj.project.sync.dto.item.IFactorItem;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * 订单商品项
+ */
+@Data
+@NoArgsConstructor
+@OpenApi(apiName = "REQ_006")
+@Accessors(chain = true)
+public class IExpensePriceReq {
+
+    private String sysId;
+
+    /**
+     * 费项唯一编号
+     */
+    private String uniqExpenseId;
+
+    /**
+     * 数量。
+     */
+    private Integer expenseNum;
+
+    /**
+     * 订单费项列表
+     */
+    private List<IFactorItem> factors;
+
+
+}

+ 18 - 0
sp-server/src/main/java/com/pj/project/sync/dto/ItemTypeDTO.java

@@ -0,0 +1,18 @@
+package com.pj.project.sync.dto;
+
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+@Data
+@OpenApi(apiName = "REQ_003")
+@Accessors(chain = true)
+public class ItemTypeDTO implements Serializable {
+    private String sysId;
+    private String bizTypeNo;
+    private String expenseName;
+
+}

+ 13 - 0
sp-server/src/main/java/com/pj/project/sync/dto/PartnerDTO.java

@@ -0,0 +1,13 @@
+package com.pj.project.sync.dto;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+@OpenApi(apiName = "REQ_002")
+public class PartnerDTO implements Serializable {
+    private List<PartnerParam> partnersList;
+}

+ 29 - 0
sp-server/src/main/java/com/pj/project/sync/dto/PartnerParam.java

@@ -0,0 +1,29 @@
+package com.pj.project.sync.dto;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+@Data
+@Accessors(chain = true)
+@AllArgsConstructor
+@NoArgsConstructor
+public class PartnerParam implements Serializable {
+    /**
+     * 合作伙伴id
+     */
+    private String partnersId;
+    /**
+     * 合作伙伴id
+     */
+    private String partnersName;
+    /**
+     * 数据操作类型。insert-新增数据,update-修改数据,delete-删除数据
+     */
+    private String syncType;
+
+}

+ 18 - 0
sp-server/src/main/java/com/pj/project/sync/dto/item/IFactorItem.java

@@ -0,0 +1,18 @@
+package com.pj.project.sync.dto.item;
+
+import lombok.Data;
+
+@Data
+public class IFactorItem {
+
+    /**
+     * 因子id
+     */
+    private String facId;
+
+    /**
+     * 因子参数
+     */
+    private String facParams;
+
+}

+ 17 - 0
sp-server/src/main/java/com/pj/project/sync/dto/item/IOrderFactorDiffItem.java

@@ -0,0 +1,17 @@
+package com.pj.project.sync.dto.item;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class IOrderFactorDiffItem {
+    private Integer expenseNum;
+
+    /**
+     * 费项差价 = 变更后费项价格 - 初始费项价格
+     */
+    private BigDecimal priceDiff;
+
+    private BigDecimal totalPriceDiff;
+}

+ 29 - 0
sp-server/src/main/java/com/pj/project/sync/dto/item/IOrderItem.java

@@ -0,0 +1,29 @@
+package com.pj.project.sync.dto.item;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 订单商品项
+ */
+@Data
+public class IOrderItem implements Serializable {
+
+    /**
+     * 费项唯一编号
+     */
+    private String uniqExpenseId;
+
+    /**
+     * 数量
+     */
+    private Integer expenseNum;
+
+    /**
+     * 订单费项列表
+     */
+    private List<IFactorItem> factors;
+
+}

+ 19 - 0
sp-server/src/main/java/com/pj/project/sync/request/IExpenseFactorQueryReq.java

@@ -0,0 +1,19 @@
+package com.pj.project.sync.request;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@NoArgsConstructor
+@OpenApi(apiName = "REQ_005")
+public class IExpenseFactorQueryReq implements Serializable {
+
+  /**
+   * 费项编号
+   */
+  private String uniqueExpenseId;
+
+}

+ 31 - 0
sp-server/src/main/java/com/pj/project/sync/request/IExpenseListQueryReq.java

@@ -0,0 +1,31 @@
+package com.pj.project.sync.request;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@NoArgsConstructor
+@OpenApi(apiName = "REQ_003")
+public class IExpenseListQueryReq implements Serializable {
+
+  /**
+   * 系统id
+   */
+  private String sysId;
+  /**
+   * 业务类型编号
+   */
+  private String bizTypeNo;
+  /**
+   * 费项编号
+   */
+  private String uniqueExpenseId;
+  /**
+   * 费项名称
+   */
+  private String expenseName;
+
+}

+ 37 - 0
sp-server/src/main/java/com/pj/project/sync/request/IExpensePriceReq.java

@@ -0,0 +1,37 @@
+package com.pj.project.sync.request;
+
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import com.pj.project.sync.request.item.IFactorItem;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 订单商品项
+ */
+@Data
+@NoArgsConstructor
+@OpenApi(apiName = "REQ_007")
+public class IExpensePriceReq {
+
+    private String sysId;
+
+    /**
+     * 费项唯一编号
+     */
+    private String uniqExpenseId;
+
+    /**
+     * 数量。
+     */
+    private Integer expenseNum;
+
+    /**
+     * 订单费项列表
+     */
+    private List<IFactorItem> factors;
+
+
+}

+ 19 - 0
sp-server/src/main/java/com/pj/project/sync/request/IExpenseQueryReq.java

@@ -0,0 +1,19 @@
+package com.pj.project.sync.request;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@NoArgsConstructor
+@OpenApi(apiName = "REQ_004")
+public class IExpenseQueryReq implements Serializable {
+
+  /**
+   * 费项编号
+   */
+  private String uniqueExpenseId;
+
+}

+ 41 - 0
sp-server/src/main/java/com/pj/project/sync/request/IOrderPriceReq.java

@@ -0,0 +1,41 @@
+package com.pj.project.sync.request;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import com.pj.project.sync.request.item.IOrderFactorDiffItem;
+import com.pj.project.sync.request.item.IOrderItem;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@OpenApi(apiName = "REQ_005")
+public class IOrderPriceReq implements Serializable {
+
+    private String sysId;
+
+    /**
+     * 订单唯一id
+     */
+    private String orderId;
+
+    /**
+     * 订单数量
+     */
+    private Integer orderNum;
+
+    /**
+     * 费项项
+     */
+    private List<IOrderItem> expenses;
+
+    /**
+     * 动态调价
+     */
+    private List<IOrderFactorDiffItem> factorDiff;
+
+}

+ 18 - 0
sp-server/src/main/java/com/pj/project/sync/request/item/IFactorItem.java

@@ -0,0 +1,18 @@
+package com.pj.project.sync.request.item;
+
+import lombok.Data;
+
+@Data
+public class IFactorItem {
+
+    /**
+     * 因子id
+     */
+    private String facId;
+
+    /**
+     * 因子参数
+     */
+    private String facParams;
+
+}

+ 17 - 0
sp-server/src/main/java/com/pj/project/sync/request/item/IOrderFactorDiffItem.java

@@ -0,0 +1,17 @@
+package com.pj.project.sync.request.item;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class IOrderFactorDiffItem {
+    private Integer expenseNum;
+
+    /**
+     * 费项差价 = 变更后费项价格 - 初始费项价格
+     */
+    private BigDecimal priceDiff;
+
+    private BigDecimal totalPriceDiff;
+}

+ 31 - 0
sp-server/src/main/java/com/pj/project/sync/request/item/IOrderItem.java

@@ -0,0 +1,31 @@
+package com.pj.project.sync.request.item;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 订单商品项
+ */
+@Data
+@Accessors(chain = true)
+public class IOrderItem implements Serializable {
+
+    /**
+     * 费项唯一编号
+     */
+    private String uniqExpenseId;
+
+    /**
+     * 数量
+     */
+    private Integer expenseNum;
+
+    /**
+     * 订单费项列表
+     */
+    private List<IFactorItem> factors;
+
+}

+ 22 - 0
sp-server/src/main/java/com/pj/project/sync/response/IExpenseFactorQueryRes.java

@@ -0,0 +1,22 @@
+package com.pj.project.sync.response;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import com.pj.project.sync.response.item.IPriceFactorItem;
+import lombok.Data;
+import org.apache.commons.compress.utils.Lists;
+
+import java.util.List;
+
+@Data
+@OpenApi(apiName = "REQ_005")
+public class IExpenseFactorQueryRes {
+    /**
+     * 费项编号
+     */
+    private String uniqueExpenseId;
+
+    /**
+     * 费项
+     */
+    private List<IPriceFactorItem> priceFactors = Lists.newArrayList();
+}

+ 18 - 0
sp-server/src/main/java/com/pj/project/sync/response/IExpenseListQueryRes.java

@@ -0,0 +1,18 @@
+package com.pj.project.sync.response;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import com.pj.project.sync.response.item.IExpenseItem;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@OpenApi(apiName = "REQ_003")
+public class IExpenseListQueryRes {
+
+    /**
+     * 费项列表
+     */
+    List<IExpenseItem> list;
+
+}

+ 19 - 0
sp-server/src/main/java/com/pj/project/sync/response/IExpensePriceRes.java

@@ -0,0 +1,19 @@
+package com.pj.project.sync.response;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import com.pj.project.sync.response.item.IFireResultItem;
+import lombok.Data;
+
+@Data
+@OpenApi(apiName = "REQ_007")
+public class IExpensePriceRes {
+    /**
+     * 数量。
+     */
+    private Integer expenseNum;
+
+    /**
+     * 命中结果
+     */
+    private IFireResultItem expenseResult;
+}

+ 13 - 0
sp-server/src/main/java/com/pj/project/sync/response/IExpenseQueryRes.java

@@ -0,0 +1,13 @@
+package com.pj.project.sync.response;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import com.pj.project.sync.response.item.IExpenseItem;
+import lombok.Data;
+
+@OpenApi(apiName = "REQ_004")
+@Data
+public class IExpenseQueryRes {
+
+    IExpenseItem item;
+
+}

+ 41 - 0
sp-server/src/main/java/com/pj/project/sync/response/IOrderPriceRes.java

@@ -0,0 +1,41 @@
+package com.pj.project.sync.response;
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import com.pj.project.sync.response.item.OrderPriceResultItem;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+@OpenApi(apiName = "REQ_006")
+@NoArgsConstructor
+@Accessors(chain = true)
+public class IOrderPriceRes implements Serializable {
+
+    /**
+     * 计价ID
+     */
+    private String calculateId;
+
+    /**
+     * 订单应支付的总金额
+     */
+    private BigDecimal totalOrderPrice=BigDecimal.valueOf(0);
+
+    /**
+     * 单价命中结果
+     */
+    private List<OrderPriceResultItem> fireResult;
+
+
+    private String hourDesc;
+
+    private String carDesc;
+    private int over24Hour;
+    private String uniqueExpenseId;
+
+}

+ 107 - 0
sp-server/src/main/java/com/pj/project/sync/response/item/IExpenseItem.java

@@ -0,0 +1,107 @@
+package com.pj.project.sync.response.item;
+
+
+import cn.com.btxc.micro.uni.openapi.inter.OpenApi;
+import com.pj.project.sync.bo.SubExpenseDTO;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+@Data
+@Slf4j
+@OpenApi(apiName = "REQ_013")
+public class IExpenseItem {
+    /**
+     * 操作类型
+     */
+    private String syncType;
+    /**
+     * 系统id
+     */
+    private String sysId;
+
+    /**
+     *  系统名称
+     */
+    private String sysName;
+
+    /**
+     * 费项编号
+     */
+    private String uniqueExpenseId;
+
+    /**
+     * 费项名称
+     */
+    private String expenseName;
+
+    /**
+     * 业务类型编号
+     */
+    private String bizTypeNo;
+
+    /**
+     * 业务类型名称
+     */
+    private String bizTypeName;
+
+    /**
+     * 税率
+     */
+    private BigDecimal taxRate;
+
+    /**
+     * 费项单位
+     */
+    private String expenseUnit;
+
+    /**
+     * 费项描述
+     */
+    private String expenseDesc;
+
+    /**
+     * 规格编号
+     */
+    private String pattern;
+
+    /**
+     * 规格名称:单规格、多规格
+     */
+    private String patternName;
+
+    /**
+     * 费项金额。只有单规格费项才有值
+     */
+    private BigDecimal fixedPrice;
+
+    /**
+     * 生效时间
+     */
+    private Date affectDate;
+
+    /**
+     * 过期时间
+     */
+    private Date finishDate;
+
+    /**
+     * 动态调价
+     */
+    private Integer isDynamicPrice;
+
+    /**
+     * 版本号
+     */
+    private String version;
+
+    /**
+     * 多规格规则
+     */
+
+    private List<IrulesItem> rules;
+
+}

+ 24 - 0
sp-server/src/main/java/com/pj/project/sync/response/item/IFireResultItem.java

@@ -0,0 +1,24 @@
+package com.pj.project.sync.response.item;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+@Data
+public class IFireResultItem {
+
+    /**
+     * 命中规则id
+     */
+    private Long fireRuleId;
+
+    /**
+     * 命中价格
+     */
+    private BigDecimal firePrice;
+
+    /**
+     * 当前费项优惠前的总金额 = firePrice * expenseNum
+     */
+    private BigDecimal expenseTotalPrice;
+
+}

+ 42 - 0
sp-server/src/main/java/com/pj/project/sync/response/item/IPriceFactorItem.java

@@ -0,0 +1,42 @@
+package com.pj.project.sync.response.item;
+
+import lombok.Data;
+
+@Data
+public class IPriceFactorItem {
+
+    private Long id;
+
+    private String sysId;
+
+
+    /**
+     * 因子名称
+     */
+    private String facName;
+
+
+    /**
+     * 类型:Enum-枚举,Number-数字,Date-日期,Time-时间
+     */
+    private String textType;
+
+
+    /**
+     * 单位
+     */
+    private String unit;
+
+
+    /**
+     * 比较运算符
+     */
+    private String operator;
+
+
+    /**
+     * 因子值
+     */
+    private String rangeVal;
+
+}

+ 26 - 0
sp-server/src/main/java/com/pj/project/sync/response/item/IrulesItem.java

@@ -0,0 +1,26 @@
+package com.pj.project.sync.response.item;
+
+import com.pj.project.sync.bo.PriceFactorDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class IrulesItem implements Serializable {
+    private Long id;        //Long	价格因子树的节点id
+    private Long expenseId;//		Long	费项id
+    private Long facId;//		Long	因子id
+    private Long parentId;//	Long	当前规则节点的父id
+    private String nodeType;//		String	结点类型,ROOT根节点,LEAF叶节点
+    private String path;//	String	节点路径,根节点为/,叶节点如/14/
+    private String factorPath;//	String	节点的因子路径,/facId1/facId2/
+    private int sort;//	int	排序
+    private String operator;//	String	运算符:GreaterThan-大于,LessThan-小于,Equals-等于,Contains-包含,Range-范围
+    private String action;//		String	响应
+    private String actionParams;//	String	响应参数
+    private String actionParamsDesc;//	String	响应描述
+    private String isFormula;//		int	是否是公式,0-非公式,1-公式
+    private PriceFactorDTO priceFactor;//	Object	价格因子
+    private List<IrulesItem> children;
+}

+ 28 - 0
sp-server/src/main/java/com/pj/project/sync/response/item/OrderPriceResultItem.java

@@ -0,0 +1,28 @@
+package com.pj.project.sync.response.item;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+@NoArgsConstructor
+@Data
+public class OrderPriceResultItem implements Serializable {
+
+    /**
+     * 费项唯一id
+     */
+    protected String uniqExpenseId;
+
+    /**
+     * 命中价格(单价)
+     */
+    protected BigDecimal firePrice;
+    /**
+     * 公式计算中间变量(仅公式价格返回)
+     */
+    private List<PriceDetailItem> priceDetail;
+
+}

+ 11 - 0
sp-server/src/main/java/com/pj/project/sync/response/item/PriceDetailItem.java

@@ -0,0 +1,11 @@
+package com.pj.project.sync.response.item;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class PriceDetailItem implements Serializable {
+    private String key;
+    private String value;
+}

+ 68 - 0
sp-server/src/main/java/com/pj/project/sync/task/SyncTask.java

@@ -0,0 +1,68 @@
+package com.pj.project.sync.task;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.RandomUtil;
+import cn.hutool.core.util.StrUtil;
+import com.pj.constants.business.CarEnum;
+import com.pj.project.relation_type_item.RelationTypeItem;
+import com.pj.project.relation_type_item.RelationTypeItemService;
+import com.pj.project.sync.SyncService;
+import com.pj.project.sync.response.item.IExpenseItem;
+import com.pj.project.tb_costomer.TbCostomer;
+import com.pj.project.tb_item.TbItem;
+import com.pj.project.tb_item.TbItemService;
+import com.pj.project.tb_item_fac.TbItemFac;
+import com.pj.project.tb_item_fac.TbItemFacService;
+import com.pj.project.tb_item_type.TbItemType;
+import com.pj.project.tb_item_type.TbItemTypeService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Component
+@Slf4j
+public class SyncTask {
+    @Resource
+    private TbItemTypeService tbItemTypeService;
+    @Resource
+    private SyncService syncService;
+    @Resource
+    private TbItemService tbItemService;
+    @Resource
+    private RelationTypeItemService relationTypeItemService;
+    @Resource
+    private TbItemFacService tbItemFacService;
+
+//    @Scheduled(fixedRate = 60000)
+    public void sync() {
+        List<IExpenseItem> items = syncService.syncItemTypeList(null, null);
+        Date now = new Date();
+        for (IExpenseItem item : items) {
+            TbItemType tbItemType = handlerItemType(item, now);
+        }
+    }
+
+
+
+
+    TbItemType handlerItemType(IExpenseItem item, Date now) {
+        String code = item.getBizTypeNo();
+        String name = item.getBizTypeName();
+        TbItemType tbItemType = tbItemTypeService.findByCode(code);
+        if (tbItemType == null) {
+            tbItemType = new TbItemType();
+            tbItemType.setSort(RandomUtil.randomInt(0, 15));
+        }
+        tbItemType.setName(name)
+                .setCode(code)
+                .setSyncTime(now);
+        tbItemTypeService.saveOrUpdate(tbItemType);
+        return tbItemType;
+    }
+}

+ 54 - 18
sp-server/src/main/java/com/pj/project/tb_account/AutomaticPay.java

@@ -4,12 +4,15 @@ package com.pj.project.tb_account;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.RandomUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.log.StaticLog;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.pj.api.wx.bo.PriceBO;
 import com.pj.constants.business.CarEnum;
 import com.pj.constants.business.GoodsEnum;
 import com.pj.constants.business.PayEnum;
+import com.pj.project.sync.response.IOrderPriceRes;
+import com.pj.project.sync.response.item.PriceDetailItem;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
 import com.pj.project.tb_business_car.TbBusinessCar;
@@ -587,11 +590,10 @@ public class AutomaticPay {
      * 支付停车费
      *
      * @param tbBusinessCar
-     * @param partMoney
      * @param now
      * @return
      */
-    public boolean payPartMoney(TbBusinessCar tbBusinessCar, double partMoney, Date now) {
+    public boolean payPartMoney(TbBusinessCar tbBusinessCar, IOrderPriceRes orderPriceRes, Date now) {
         String carNo = tbBusinessCar.getCarNo();
         TbDeductionBind bind = tbDeductionBindService.getBindCarByPlate(carNo);
         //未绑定
@@ -602,15 +604,30 @@ public class AutomaticPay {
         String key = AesUtil.reverse(tbAccount.getAccSalt());
         BigDecimal balance = new BigDecimal(tbAccount.getTotalMoney());
         //不足
-        if (balance.doubleValue() < partMoney) {
+        BigDecimal partMoney = orderPriceRes.getTotalOrderPrice();
+        if (balance.compareTo(partMoney) < 0) {
             return false;
         }
-        balance = balance.subtract(new BigDecimal(partMoney));
+        balance = balance.subtract(partMoney);
         tbAccount.setTotalMoney(AesUtil.encryptECB(balance.toString(), key));
         tbAccountService.updateById(tbAccount);
-        tbBusinessCar.setMoney(new BigDecimal(partMoney)).setPayType(CarEnum.PayTypeEnum.HAS_PAY_TYPE.getType()).setPayTime(now);
+        tbBusinessCar.setMoney(partMoney).setPayType(CarEnum.PayTypeEnum.HAS_PAY_TYPE.getType()).setPayTime(now);
+        //todo 自动扣款修改
+        PriceBO priceBO = new PriceBO();
+        priceBO.setId(tbBusinessCar.getId()).setHourDesc(orderPriceRes.getHourDesc()).setCarDesc(orderPriceRes.getCarDesc())
+                .setCalculateId(orderPriceRes.getCalculateId()).setP(orderPriceRes.getTotalOrderPrice());
+        List<PriceDetailItem> priceDetailItems = orderPriceRes.getFireResult().get(0).getPriceDetail();
+        for (PriceDetailItem priceDetailItem : priceDetailItems) {
+            String k = StrUtil.trim(priceDetailItem.getKey()).toLowerCase();
+            String v = priceDetailItem.getValue();
+            if (k.equals("standard")) {
+                priceBO.setStandard(new BigDecimal(v));
+            } else if (k.equals("extraPrice")) {
+                priceBO.setExtraPrice(new BigDecimal(v));
+            }
+        }
         List<PriceBO> priceBOList = new ArrayList<PriceBO>() {{
-            add(new PriceBO(tbBusinessCar.getId(), tbBusinessCar.getMoney()));
+            add(priceBO);
         }};
         String no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + RandomUtil.randomNumbers(4);
         //车辆的扣费记录
@@ -625,17 +642,13 @@ public class AutomaticPay {
      * 支付停车费和业务费
      *
      * @param businessList
-     * @param businessMoney
-     * @param tbBusinessCar
-     * @param chinaCarMoney
-     * @param yueCarMoney
      * @return
      */
     public boolean payBusinessAndPartMoney(List<TbBusiness> businessList,
-                                           BigDecimal businessMoney,
+                                           IOrderPriceRes businessRes,
                                            TbBusinessCar tbBusinessCar,
-                                           BigDecimal chinaCarMoney,
-                                           BigDecimal yueCarMoney) {
+                                           IOrderPriceRes chinaCarRes,
+                                           IOrderPriceRes yueCarRes) {
         Date now = new Date();
         TbDeductionBind bind = null;
         for (TbBusiness tbBusiness : businessList) {
@@ -652,6 +665,9 @@ public class AutomaticPay {
         if (bind == null) {
             return false;
         }
+        BigDecimal businessMoney = businessRes.getTotalOrderPrice();
+        BigDecimal chinaCarMoney = chinaCarRes.getTotalOrderPrice();
+        BigDecimal yueCarMoney = yueCarRes.getTotalOrderPrice();
         BigDecimal totalMoney = businessMoney.add(chinaCarMoney).add(yueCarMoney).add(chinaCarMoney);
         TbAccount tbAccount = tbAccountService.getByCustomerId(bind.getCustomerId());
         String key = AesUtil.reverse(tbAccount.getAccSalt());
@@ -663,20 +679,40 @@ public class AutomaticPay {
         balance = balance.subtract(totalMoney);
         tbAccount.setTotalMoney(AesUtil.encryptECB(balance.toString(), key));
         tbAccountService.updateById(tbAccount);
+        String businessCalculateId = businessRes.getCalculateId();
         businessList.forEach(tbBusiness -> {
-            tbBusiness.setPayStatus(PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode())
+            tbBusiness.setPayStatus(PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode()).setCalculateId(businessCalculateId)
                     .setPayMoney(tbBusiness.getItemPrice()).setTotalMoney(tbBusiness.getItemPrice());
         });
         tbBusinessService.updateBatchById(businessList);
         List<TbBusinessItem> tbBusinessItems = tbBusinessItemService.findByBusinessIdList(businessList.stream().map(TbBusiness::getId).collect(Collectors.toList()));
-        tbBusinessItems.parallelStream().forEach(item -> item.setPayStatus(1).setPayTime(now));
+        tbBusinessItems.parallelStream().forEach(item -> item.setPayStatus(1).setPayTime(now).setCalculateId(businessCalculateId));
         tbBusinessItemService.updateBatchById(tbBusinessItems);
         tbBusinessCar.setPay(1).setPayType(CarEnum.PayTypeEnum.HAS_PAY_TYPE.getType())
                 .setPayTime(now);
         tbBusinessCarService.updateById(tbBusinessCar);
-        List<PriceBO> priceBOList = new ArrayList<PriceBO>() {{
-            add(new PriceBO(tbBusinessCar.getId(), tbBusinessCar.getMoney()));
-        }};
+        //todo 构造统计数据
+        BigDecimal p = chinaCarRes.getTotalOrderPrice();
+        String uniqExpenseId = chinaCarRes.getUniqueExpenseId();
+        String calculateId = chinaCarRes.getCalculateId();
+        String carDesc = chinaCarRes.getCarDesc();
+        String hourDesc = chinaCarRes.getHourDesc();
+        List<PriceDetailItem> items = chinaCarRes.getFireResult().get(0).getPriceDetail();
+        if (yueCarRes.getTotalOrderPrice().intValue() > 0) {
+            items = yueCarRes.getFireResult().get(0).getPriceDetail();
+        }
+        PriceBO priceBO = new PriceBO();
+        List<PriceBO> priceBOList = new ArrayList<>();
+        priceBO.setId(tbBusinessCar.getId()).setP(p).setCalculateId(calculateId)
+                .setCarDesc(carDesc).setHourDesc(hourDesc)
+                .setUniqExpenseId(uniqExpenseId);
+        for (PriceDetailItem item : items) {
+            if (item.getKey().toLowerCase().trim().equals("standard")) {
+                priceBO.setStandard(new BigDecimal(item.getValue()));
+            } else if (item.getKey().toLowerCase().trim().equals("extraPrice")) {
+                priceBO.setStandard(new BigDecimal(item.getValue()));
+            }
+        }
         String plate = tbBusinessCar.getCarNo();
         String no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + RandomUtil.randomNumbers(4);
         List<TbFeeDetails> parkFeeDetailsList = tbFeeDetailsService.chargeParkFee(priceBOList, null, null, now, PayEnum.PayType.PER_PAY);

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

@@ -305,6 +305,10 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
      * 件数
      */
     private int businessGoodsNum;
+    /**
+     * 计费系统订单计算ID
+     */
+    private String calculateId;
 
 
 

+ 0 - 17
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessController.java

@@ -96,23 +96,6 @@ public class TbBusinessController {
         return AjaxJson.getSuccess();
     }
 
-    /**
-     * 手动入场确认 see adminSetIn
-     */
-    @RequestMapping("adminConfirmIn")
-    @Transactional(rollbackFor = Exception.class)
-    @Deprecated
-    public AjaxJson adminConfirmIn() {
-        if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
-            return AjaxJson.getError("无确认入场权限");
-        }
-        SoMap so = SoMap.getRequestSoMap();
-        String id = so.getString("id");
-        String inChannel = so.getString("inChannel");
-        tbBusinessService.adminConfirmIn(id, inChannel);
-        return AjaxJson.getSuccess();
-    }
-
 
     /**
      * 查 - 根据id

+ 241 - 86
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -8,6 +8,7 @@ import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.RandomUtil;
@@ -20,15 +21,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import com.pj.api.open.bo.ItemPriceBO;
 import com.pj.api.pushfee.oa.CallbackBO;
 import com.pj.api.wx.bo.MsgDataBO;
 import com.pj.api.wx.bo.PriceBO;
 import com.pj.api.wx.service.WxService;
 import com.pj.constants.UserTypeEnum;
-import com.pj.constants.business.CarEnum;
-import com.pj.constants.business.GoodsEnum;
-import com.pj.constants.business.OAResultEnum;
-import com.pj.constants.business.PayEnum;
+import com.pj.constants.business.*;
 import com.pj.current.config.*;
 import com.pj.current.satoken.StpUserUtil;
 import com.pj.project.oa.bo.OAResultBO;
@@ -36,6 +35,13 @@ import com.pj.project.oa.bo.ParamsBO;
 import com.pj.project.relation_business_car.RelationBusinessCar;
 import com.pj.project.relation_business_car.RelationBusinessCarService;
 
+import com.pj.project.sync.SyncService;
+import com.pj.project.sync.request.IOrderPriceReq;
+import com.pj.project.sync.request.item.IFactorItem;
+import com.pj.project.sync.request.item.IOrderItem;
+import com.pj.project.sync.response.IOrderPriceRes;
+import com.pj.project.sync.response.item.IExpenseItem;
+import com.pj.project.sync.response.item.PriceDetailItem;
 import com.pj.project.tb_account.AutomaticPay;
 import com.pj.project.tb_account.TbAccount;
 import com.pj.project.tb_account.TbAccountService;
@@ -64,10 +70,10 @@ import com.pj.project.tb_goods.TbGoods;
 import com.pj.project.tb_goods.TbGoodsService;
 import com.pj.project.tb_item.TbItem;
 import com.pj.project.tb_item.TbItemService;
+import com.pj.project.tb_item_fac.TbItemFac;
+import com.pj.project.tb_item_fac.TbItemFacService;
 import com.pj.project.tb_item_type.TbItemType;
 import com.pj.project.tb_item_type.TbItemTypeService;
-import com.pj.project.tb_mild_car.TbMildCar;
-import com.pj.project.tb_mild_car.TbMildCarService;
 import com.pj.project.tb_notices.TbNoticesService;
 import com.pj.project.tb_sort_group.TbSortGroup;
 import com.pj.project.tb_sort_group.TbSortGroupService;
@@ -119,14 +125,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     @Resource
     private TbBusinessItemService tbBusinessItemService;
 
-    @Resource
-    TbUnitService tbUnitService;
-    @Resource
-    TbBusinessPeopleService tbBusinessPeopleService;
+
     @Resource
     private PartConfig partConfig;
-    @Resource
-    private CarConfig carConfig;
+
 
     @Resource
     private TbNoticesService tbNoticesService;
@@ -177,6 +179,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     @Lazy
     private TbFeeStatisticsService tbFeeStatisticsService;
     @Resource
+    private SyncService syncService;
+    @Resource
+    private TbItemFacService tbItemFacService;
+    @Resource
     private TbMildCarService tbMildCarService;
 
     private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
@@ -191,35 +197,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         }
     }
 
-    private void createBusinessPeople(TbBusiness t) {
-        tbBusinessPeopleService.removeByBusinessId(t.getId());
-        List<TbBusinessPeople> peopleList = JSONUtil.toList(t.getPeopleJson(), TbBusinessPeople.class);
-        peopleList.forEach(tbBusinessPeople -> tbBusinessPeople.setBusinessId(t.getId()).setCreateTime(new Date()));
-        tbBusinessPeopleService.saveBatch(peopleList);
-    }
-
-    private void createCarUnit(TbBusiness t) {
-        TbUnit tbUnit = tbUnitService.findByUnit(t.getCardSize());
-        if (tbUnit == null) {
-            tbUnit = new TbUnit();
-            tbUnit.setUnit(t.getCardSize() + "");
-            tbUnitService.save(tbUnit);
-        }
-    }
-
-
-    private TbDriver createDriver(TbBusiness business) {
-        TbDriver tbDriver = tbDriverService.findByIdCardNo(business.getCardNo());
-        if (tbDriver == null) {
-            tbDriver = new TbDriver();
-            tbDriver.setCreateTime(new Date()).setIdCard(business.getCardNo())
-                    .setName(business.getDriverName()).setPhone(business.getDriverPhone());
-            tbDriverService.save(tbDriver);
-        }
-        return tbDriver;
-
-    }
-
 
     /**
      * 查集合 - 根据条件(参数为空时代表忽略指定条件)
@@ -324,7 +301,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             TbGoods tbGoods = tbGoodsService.getById(business.getGoodsId());
             //只有改业务是在确认后扣费才需要执行自动扣费
             if (GoodsEnum.DeductionTypeEnum.BUSINESS_OK.getCode().equals(tbGoods.getAutoDeductionType())) {
-                automaticPay.run(business.getId(), null, 2);
+                //automaticPay.run(business.getId(), null, 2);
             }
         });
     }
@@ -342,25 +319,111 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         });
     }
 
+    /**
+     * 计费系统计算停车费
+     *
+     * @param iTime 入场时间
+     * @param oTime 离场时间
+     * @return
+     */
+    public IOrderPriceRes getPartMoney(Date iTime, Date oTime, String carNo, String carColor) {
+        long minutes = DateUtil.between(iTime, oTime, DateUnit.MINUTE);
+        double hours = NumberUtil.div(minutes, 60, 1);
+        List<IOrderItem> expenses = new ArrayList<>();
+        TbMildCar tbMildCar = tbMildCarService.findByCarNo(carNo);
+        IOrderPriceRes res = new IOrderPriceRes();
+        double carSize = 8D;
+        res.setCarDesc(PartFeeEnum.MIDDLER_CAR.getDesc());
+        res.setHourDesc(PartFeeEnum.IN_24_HOURS.getDesc());
+        if (tbMildCar == null) {
+            // 9.6以上
+            carSize = 13D;
+            res.setCarDesc(PartFeeEnum.BIG_CAR.getDesc());
+        }
+        if (hours > 24) {
+            res.setOver24Hour(1);
+            res.setHourDesc(PartFeeEnum.OUT_24_HOURS.getDesc());
+        }
+        List<TbItemFac> list = tbItemFacService.list();
+        if (list.isEmpty()) {
+            throw new AjaxError("未配置停车费规则");
+        }
+        TbItemFac itemFac = list.get(0);
+        IOrderItem orderItem = new IOrderItem();
+        String uniqueExpenseId = itemFac.getUniqueExpenseId();
+        orderItem.setUniqExpenseId(uniqueExpenseId).setExpenseNum(1);
+        List<IFactorItem> factors = new ArrayList<>();
+        for (TbItemFac fac : list) {
+            String operator = fac.getOperator();
+            if (StrUtil.equals(operator, "carSize")) {
+                IFactorItem iFactorItem = new IFactorItem();
+                iFactorItem.setFacId(fac.getFacId() + "");
+                iFactorItem.setFacParams(carSize + "");
+                factors.add(iFactorItem);
+            } else if (StrUtil.equals(operator, "hour")) {
+                IFactorItem iFactorItem = new IFactorItem();
+                iFactorItem.setFacId(fac.getFacId() + "");
+                iFactorItem.setFacParams(hours + "");
+                factors.add(iFactorItem);
+            } else if (StrUtil.equals(operator, "carColor")) {
+                IFactorItem iFactorItem = new IFactorItem();
+                iFactorItem.setFacId(fac.getFacId() + "");
+                iFactorItem.setFacParams(carColor);
+                factors.add(iFactorItem);
+            }
+        }
+        orderItem.setFactors(factors);
+        expenses.add(orderItem);
+        IOrderPriceRes orderPriceRes = syncService.orderPriceCal(expenses);
+        res.setCalculateId(orderPriceRes.getCalculateId())
+                .setUniqueExpenseId(uniqueExpenseId)
+                .setFireResult(orderPriceRes.getFireResult())
+                .setTotalOrderPrice(orderPriceRes.getTotalOrderPrice());
+        log.info("part money resp:{}", JSONUtil.toJsonStr(res));
+        return res;
+    }
 
-    @Deprecated
-    public void adminConfirmIn(String id, String inChannel) {
-        TbBusiness tbBusiness = this.getById(id);
-        tbBusiness.setRealInTime(new Date()).setInChannel(inChannel);
-        this.updateById(tbBusiness);
-
-        //更新境外车入场记录
-
-        //更新中国车入场记录
-
-        //发送消息
-        String text = "您的车辆已入场,业务单号[" + tbBusiness.getNo() + "]";
-        tbNoticesService.sendNotice(tbBusiness.getId(), tbBusiness.getNo(), tbBusiness.getCustomerId(), text);
-
+    /**
+     * 停车费因子构建
+     * qzyReal:
+     * 时长---hour;车长--carSize
+     * qzyReal:
+     * 颜色--carColor
+     *
+     * @param iTime
+     * @param oTime
+     * @param carSize
+     * @return
+     */
+    public List<IOrderItem> getPartExpenses(Date iTime, Date oTime, double carSize) {
+        long minutes = DateUtil.between(iTime, oTime, DateUnit.MINUTE);
+        double hours = NumberUtil.div(minutes, 60, 1);
+        List<IOrderItem> expenses = new ArrayList<>();
+        TbItem tbItem = tbItemService.getPartItem();
+        if (tbItem == null) {
+            throw new AjaxError("未配置停车费规则");
+        }
+        IOrderItem orderItem = new IOrderItem();
+        orderItem.setUniqExpenseId(tbItem.getItemCode()).setExpenseNum(1);
+        List<TbItemFac> facList = tbItemFacService.getByItemId(tbItem.getId());
+        List<IFactorItem> factors = new ArrayList<>();
+        facList.forEach(tbItemFac -> {
+            String operator = tbItemFac.getOperator();
+            IFactorItem iFactorItem = new IFactorItem();
+            iFactorItem.setFacId(tbItemFac.getId());
+            if (StrUtil.equals(operator, "carSize")) {
+                iFactorItem.setFacParams(carSize + "");
+            } else if (StrUtil.equals(operator, "hour")) {
+                iFactorItem.setFacParams(hours + "");
+            }
+            factors.add(iFactorItem);
+        });
+        orderItem.setFactors(factors);
+        return expenses;
     }
 
 
-    public BigDecimal calculationPartMoney(Date iTime, Date oTime, String carNo) {
+    public BigDecimal calculationPartMoney(Date iTime, Date oTime, double carSize) {
         BigDecimal zero = new BigDecimal("0");
         if (iTime == null || oTime == null) {
             return zero;
@@ -375,8 +438,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         BigDecimal basePrice = partConfig.getBasePrice();
         BigDecimal uniPrice = basePrice.add(extraPrice);//超过24小时之后每24个小时收费金额
         //4.2~9.6
-        TbMildCar tbMildCar = tbMildCarService.findByCarNo(carNo);
-        if (tbMildCar != null) {
+        if (carSize <= partConfig.getMildCarLength() && carSize > partConfig.getFreeCarLength()) {
             basePrice = partConfig.getMildCarBasePrice();
             uniPrice = basePrice.add(extraPrice);
         }
@@ -395,6 +457,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
 
     }
 
+
     /**
      * 微信端获取缴费信息
      *
@@ -407,12 +470,13 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         //对应的业务
         List<TbBusiness> businessList = this.findOtherBusinessByCarId(businessCarId);
         TbBusinessCar tbBusinessCar = tbBusinessCarService.getById(businessCarId);
-        //越南车是否需要支付
+        String carNo = tbBusinessCar.getCarNo();
+        //越南车是否需要支付---停车费
         int vietnamCarPay = businessList.stream().anyMatch(tbBusiness -> {
             TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
             return tbGoods.getVietnamCarPay() == 1;
         }) ? 1 : 0;
-        //中国车是否需要支付
+        //中国车是否需要支付--停车费
         int chinaCarPay = businessList.stream().anyMatch(tbBusiness -> {
             TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
             return tbGoods.getChinaCarPay() == 1;
@@ -446,6 +510,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         int pay = tbBusinessCar.getPay();
         Map<String, Object> carMap = new HashMap<>();
         carMap.put("price", 0);
+        List<String> carCalculateIds = new ArrayList<>();
+        //停车费
         if (pay == 0 && inTime != null) {
             Date outTime = tbBusinessCar.getRealOutTime();
             String cacheCarNo = RedisUtil.get(channel);
@@ -457,7 +523,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 if (StrUtil.isEmpty(carType)) {
                     carType = CarEnum.CarTypeEnum.EMPTY_TYPE.getType();
                 }
-                BigDecimal partMoney = calculationPartMoney(inTime, outTime, tbBusinessCar.getCarNo());
+                //默认需要缴费--->
+                BigDecimal partMoney = new BigDecimal("1");
+
                 if (StrUtil.isNotEmpty(tbBusinessCar.getColor()) && tbBusinessCar.getCarSize() != null) {
                     String freeColor = partConfig.getFreeColor();
                     //4.2米以下蓝色车辆
@@ -476,6 +544,24 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 if (CarEnum.PayTypeEnum.FEE_TYPE.getType().equals(tbBusinessCar.getPayType())) {
                     partMoney = new BigDecimal("0");
                 }
+                if (partMoney.doubleValue() == 1) {
+                    IOrderPriceRes partPriceRes = getPartMoney(inTime, outTime, tbBusinessCar.getCarNo(), tbBusinessCar.getColor());
+                    BigDecimal partPrice = partPriceRes.getTotalOrderPrice();
+                    carCalculateIds.add(partPriceRes.getCalculateId());
+                    partMoney = partPrice;
+                    if (partPrice.doubleValue() > 0) {
+                        carMap.put("uniqExpenseId", partPriceRes.getFireResult().get(0).getUniqExpenseId());
+                        carMap.put("carDesc", partPriceRes.getCarDesc());
+                        carMap.put("calculateId;", partPriceRes.getCalculateId());
+                        carMap.put("hourDesc", partPriceRes.getHourDesc());
+                        carMap.put("over24Hour", partPriceRes.getOver24Hour());
+                        List<PriceDetailItem> detailItemList = partPriceRes.getFireResult().get(0)
+                                .getPriceDetail();
+                        detailItemList.forEach(obj -> carMap.put(obj.getKey(), obj.getValue()));
+                    }
+                    //todo 计算停车费
+                }
+                // partMoney = calculationPartMoney(inTime, outTime, tbBusinessCar.getCarSize());
                 carMap.put("price", partMoney);
             }
         }
@@ -486,39 +572,105 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         result.put("carList", Collections.singleton(carMap));
         BigDecimal itemsPrice = new BigDecimal("0");
         List<Map<String, Object>> itemList = new ArrayList<>();
-        //未支付的
-        items = items.stream().filter(item -> item.getPayStatus() == 0).collect(Collectors.toList());
-        for (TbBusinessItem item : items) {
-            BigDecimal itemPrice = item.getItemPrice().multiply(new BigDecimal(item.getNum()));
-            itemsPrice = itemsPrice.add(itemPrice);
-            Map<String, Object> itemMap = new HashMap<>();
-            itemMap.put("id", item.getId());
-            itemMap.put("name", item.getItemName() + "(" + item.getItemTypeName() + ")");
-            itemMap.put("price", itemPrice);
-            itemMap.put("pay", item.getPayStatus());
-            itemList.add(itemMap);
-            TbBusinessSort tbBusinessSort = tbBusinessSortService.findByItemTypeId(item.getItemTypeId());
-            if (tbBusinessSort != null) {
-                TbSortGroup sortGroup = tbSortGroupService.getById(tbBusinessSort.getGroupId());
-                if (sortGroup.getCompletePay().equals(1) && sortGroup.getStatus().equals(1)) {
-                    List<TbBusinessSort> sorts = tbBusinessSortService.findByGroupId(sortGroup.getId());
-                    for (TbBusinessSort sort : sorts) {
-                        long count = items.stream().filter(tbBusinessItem -> StrUtil.equals(sort.getTypeId(), tbBusinessItem.getItemTypeId()))
-                                .count();
-                        if (count == 0) {
-                            result.put("showPay", false);
+        if (!items.isEmpty()) {
+            //未支付的
+            List<IOrderItem> expenses = new ArrayList<>();
+            items = items.stream().filter(item -> item.getPayStatus() == 0).collect(Collectors.toList());
+            //如果不需要支付,则过滤掉入场管理费
+//            boolean needPayManagerMoney = needPayManagerMoney(carNo, items);
+//            if (needPayManagerMoney) {
+//                //查询出对应的费项
+//                TbItem tbItem = tbItemService.findByName(SystemObject.config.getManagerWord());
+//                if (tbItem != null) {
+//                    List<IOrderItem> managerList = new ArrayList<>();
+//                    IOrderItem iOrderItem = new IOrderItem();
+//                    iOrderItem.setExpenseNum(1).setUniqExpenseId(tbItem.getItemCode());
+//                    managerList.add(iOrderItem);
+//                    IOrderPriceRes managerPriceRes = syncService.orderPriceCal(managerList);
+//                    Map<String, Object> managerMap = new HashMap<>();
+//                    managerMap.put("id", tbItem.getId());
+//                    managerMap.put("name", tbItem.getItemName());
+//                    managerMap.put("carNo", carNo);
+//                    managerMap.put("carId", businessCarId);
+//                    managerMap.put("label", tbItem.getItemName() + "(入场管理费)");
+//                    managerMap.put("price", managerPriceRes.getTotalOrderPrice());
+//                    managerMap.put("calculateId", managerPriceRes.getCalculateId());
+//                    result.put("manager", managerMap);
+//                }
+//            }
+            items.forEach(item -> {
+                String num = item.getNum();
+                String itemCode = item.getItemCode();
+                IOrderItem iOrderItem = new IOrderItem();
+                iOrderItem.setExpenseNum(Integer.parseInt(num)).setUniqExpenseId(itemCode);
+                expenses.add(iOrderItem);
+            });
+            if (!expenses.isEmpty()){
+                IOrderPriceRes orderPriceRes = syncService.orderPriceCal(expenses);
+                BigDecimal totalPrice = orderPriceRes.getTotalOrderPrice();
+                carCalculateIds.add(orderPriceRes.getCalculateId());
+                for (TbBusinessItem item : items) {
+                    BigDecimal itemPrice = item.getItemPrice().multiply(new BigDecimal(item.getNum()));
+                    itemsPrice = itemsPrice.add(itemPrice);
+                    Map<String, Object> itemMap = new HashMap<>();
+                    itemMap.put("id", item.getId());
+                    itemMap.put("name", item.getItemName() + "(" + item.getItemTypeName() + ")");
+                    itemMap.put("price", itemPrice);
+                    itemMap.put("pay", item.getPayStatus());
+                    orderPriceRes.getFireResult().stream().filter(priceItem -> StrUtil.equals(item.getItemCode(), priceItem.getUniqExpenseId()))
+                            .findAny().ifPresent(priceItem -> {
+                        itemMap.put("price", priceItem.getFirePrice().multiply(new BigDecimal(item.getNum())));
+                    });
+                    itemList.add(itemMap);
+                    TbBusinessSort tbBusinessSort = tbBusinessSortService.findByItemTypeId(item.getItemTypeId());
+                    if (tbBusinessSort != null) {
+                        TbSortGroup sortGroup = tbSortGroupService.getById(tbBusinessSort.getGroupId());
+                        if (sortGroup.getCompletePay().equals(1) && sortGroup.getStatus().equals(1)) {
+                            List<TbBusinessSort> sorts = tbBusinessSortService.findByGroupId(sortGroup.getId());
+                            for (TbBusinessSort sort : sorts) {
+                                long count = items.stream().filter(tbBusinessItem -> StrUtil.equals(sort.getTypeId(), tbBusinessItem.getItemTypeId()))
+                                        .count();
+                                if (count == 0) {
+                                    result.put("showPay", false);
+                                }
+                            }
                         }
                     }
                 }
+                result.put("itemsPrice", totalPrice);
             }
         }
-        result.put("itemsPrice", itemsPrice);
         result.put("itemList", itemList);
+        result.put("calculateId", String.join(",", carCalculateIds));
         result.put("businessNo", businessList.stream().map(TbBusiness::getNo).distinct().collect(Collectors.joining("、")));
         result.put("goodsName", businessList.stream().map(TbBusiness::getGoodsName).distinct().collect(Collectors.joining("、")));
         return result;
     }
 
+    /**
+     * 是否需要交入场管理费
+     *
+     * @param carNo
+     * @return
+     */
+    public boolean needPayManagerMoney(String carNo, List<TbBusinessItem> items) {
+        List<String> needItemTypeList = SystemObject.config.getManagerItemType();
+        //是否有相关业务,,,没有的话直接不用交入场管理费
+        boolean before = items.stream().anyMatch(item -> needItemTypeList.contains(item.getItemTypeName()));
+        if (!before) {
+            return false;
+        }
+        String carPrefix = StrUtil.sub(carNo, 0, 1);
+        boolean isvietnamCar = !CAR_LIST.contains(carPrefix);
+        List<Integer> managerList = SystemObject.config.getManagerMoney();
+        //越南车是否需要支付
+        boolean verNeePay = managerList.contains(ManagerEnum.VER_PAY.getType());
+        //中国车是否需要支付
+        boolean chinaNeePay = managerList.contains(ManagerEnum.CHINA_PAY.getType());
+        //是否需要支付入场管理费
+        return isvietnamCar && verNeePay || !isvietnamCar && chinaNeePay;
+
+    }
 
     public List<TbBusiness> findOtherBusinessByCarId(String businessCarId) {
         return tbBusinessMapper.findOtherBusinessByCarId(businessCarId);
@@ -623,7 +775,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 Date realInTime = tbBusinessCar.getRealInTime();
                 Date realOutTime = tbBusinessCar.getRealOutTime();
                 if (realInTime != null && realOutTime != null) {
-                    BigDecimal price = calculationPartMoney(realInTime, realOutTime, tbBusinessCar.getCarNo());
+                    BigDecimal price = calculationPartMoney(realInTime, realOutTime, tbBusinessCar.getCarSize());
                     if (price.doubleValue() > 0) {
                         PriceBO priceBO = new PriceBO();
                         priceBO.setId(tbBusinessCar.getId()).setP(price);
@@ -983,6 +1135,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 .map(TbBusinessCar::getCarNo).collect(Collectors.joining("、")).toUpperCase();
         dbBusiness.setChinaCarNo(chinaCar);
         this.updateById(dbBusiness);
+        if (dbBusiness.getConfirmInput() == 1) {
+            this.confirm(Collections.singletonList(dbBusiness.getId()));
+        }
     }
 
     public void bindOtherBusinessCar(String businessId, List<String> businessCarIdList) {
@@ -1129,7 +1284,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             outTime = payTime;
         }
         //计算停车费
-        BigDecimal parkMoney = this.calculationPartMoney(inTime, outTime, tbBusinessCar.getCarNo());
+        BigDecimal parkMoney = this.calculationPartMoney(inTime, outTime, tbBusinessCar.getCarSize());
         tbBusinessCar.setMoney(parkMoney);
     }
 

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

@@ -304,16 +304,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
             feeDetailsLIst.forEach(fee -> fee.setCarNo(newCarNo));
             tbFeeDetailsService.updateBatchById(feeDetailsLIst);
         }
-        if (businessList.isEmpty()) {
-            List<TbFeeDetails> feeDetailsList = tbFeeDetailsService.getByBusinessCarIdAndCarNoAndFeeType(t.getId(), oldCarNo, FeeTypeEnum.PARK_FEE.getCode());
-            for (TbFeeDetails feeDetail : feeDetailsList) {
-                if (feeDetail != null) {
-                    feeDetail.setCarNo(newCarNo);
-                    tbFeeDetailsService.updateById(feeDetail);
-                }
-            }
-
-        }
     }
 
     public List<TbBusinessCar> findTheNoBusinessCar(String carNo) {
@@ -353,10 +343,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     }
 
     public AjaxJson deleteRecord(String id) {
-        List<TbFeeDetails> tbFeeDetails = tbFeeDetailsService.findByBusinessCarId(id, FeeTypeEnum.PARK_FEE.getCode());
-        if (!tbFeeDetails.isEmpty()) {
-            return AjaxJson.getError("该车有付款记录,不能删除");
-        }
         List<RelationBusinessCar> relationBusinessCars = relationBusinessCarService.findByBusinessCarId(id);
         if (!relationBusinessCars.isEmpty()) {
             return AjaxJson.getError("该车有业务,不能删除");

+ 0 - 432
sp-server/src/main/java/com/pj/project/tb_business_item/PayTask.java

@@ -1,432 +0,0 @@
-package com.pj.project.tb_business_item;
-
-
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.codec.Base64;
-import cn.hutool.core.util.NumberUtil;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.RandomUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.extra.spring.SpringUtil;
-import cn.hutool.log.StaticLog;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.pj.api.wx.bo.PriceBO;
-import com.pj.constants.business.CarEnum;
-import com.pj.constants.business.GoodsEnum;
-import com.pj.constants.business.PayEnum;
-import com.pj.current.task.Task;
-import com.pj.project.tb_account.TbAccount;
-import com.pj.project.tb_account.TbAccountService;
-import com.pj.project.tb_business.TbBusiness;
-import com.pj.project.tb_business.TbBusinessService;
-import com.pj.project.tb_business_car.TbBusinessCar;
-import com.pj.project.tb_business_car.TbBusinessCarService;
-import com.pj.project.tb_deduction_bind.TbDeductionBind;
-import com.pj.project.tb_deduction_bind.TbDeductionBindService;
-import com.pj.project.tb_deduction_record.TbDeductionRecord;
-import com.pj.project.tb_fee_details.TbFeeDetails;
-import com.pj.project.tb_fee_details.TbFeeDetailsService;
-import com.pj.project.tb_goods.TbGoods;
-import com.pj.project.tb_invoice_order.TbInvoiceOrder;
-import com.pj.project.tb_invoice_order.TbInvoiceOrderService;
-import com.pj.project.tb_pay_record.TbPayRecord;
-import com.pj.project.tb_pay_record.TbPayRecordService;
-import com.pj.utils.AesUtil;
-import com.pj.utils.sg.NbUtil;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.transaction.interceptor.TransactionAspectSupport;
-
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-
-public class PayTask extends Task {
-
-    private String businessId;
-    private String customerId;
-    private String plate;
-
-    public PayTask(String businessId, long delayInMilliseconds, String customerId, String plate) {
-        super(businessId, delayInMilliseconds);
-        this.businessId = businessId;
-        this.customerId = customerId;
-        this.plate = plate;
-    }
-
-    @Override
-    @Transactional(rollbackFor={RuntimeException.class, Exception.class})
-    public void run() {
-//        StaticLog.info("开始执行自动扣款业务:{},{}", customerId, businessId);
-//        TbAccountService tbAccountService = SpringUtil.getBean(TbAccountService.class);
-//        TbAccount tbAccount = tbAccountService.getByCustomerId(customerId);
-//        if (tbAccount == null) {
-//            StaticLog.info("该客户还未开通存款账户,退出扣款程序:{}", customerId);
-//            return;
-//        }
-//        String totalMoney = AesUtil.decryptECB(tbAccount.getTotalMoney(),AesUtil.reverse(tbAccount.getAccSalt()));
-//        BigDecimal money = new BigDecimal(0);
-//        if (NumberUtil.isNumber(totalMoney)) {
-//            money = new BigDecimal(totalMoney);
-//        }
-//        chargeBusinessFee(null,null);
-//       // BigDecimal money = new BigDecimal(Base64.decodeStr(totalMoney));
-//        TbBusinessService tbBusinessService = SpringUtil.getBean(TbBusinessService.class);
-//        TbBusiness tbBusiness = tbBusinessService.getById(businessId);
-//        TbBusinessItemService tbBusinessItemService = SpringUtil.getBean(TbBusinessItemService.class);
-//        List<TbBusinessItem> list = tbBusinessItemService.findByBusinessId(businessId);
-//        List<TbBusinessItem> allList = list;
-//        long notConfirmCount = list.stream()
-//                .filter(tbBusinessItem -> tbBusinessItem.getConfirm() == 0 && !StrUtil.equals(tbBusinessItem.getBusinessType(), "0"))
-//                .count();
-//        Date now = new Date();
-//        if (notConfirmCount == 0) {
-//            BigDecimal shouldPay = new BigDecimal("0");
-//            list = allList.stream().filter(tbBusinessItem -> tbBusinessItem.getPayStatus() == 0).collect(Collectors.toList());
-//            for (TbBusinessItem tbBusinessItem : list) {
-//                tbBusinessItem.setPayStatus(1).setPayTime(now);
-//                shouldPay = shouldPay.add(tbBusinessItem.getItemPrice());
-//            }
-//
-//            TbBusinessCarService tbBusinessCarService = SpringUtil.getBean(TbBusinessCarService.class);
-//            List<TbBusinessCar> cars = tbBusinessCarService.findOtherBusinessCar(businessId);
-//            cars = cars.stream().filter(tbBusinessCar -> tbBusinessCar.getPay() == 0).collect(Collectors.toList());
-//            for (TbBusinessCar tbBusinessCar : cars) {
-//                shouldPay = shouldPay.add(tbBusinessCar.getBasePartMoney());
-//                tbBusinessCar.setPayTime(now).setPay(1);
-//            }
-//            if (shouldPay.subtract(money).doubleValue() > 0) {
-//                StaticLog.error("账户支付余额不足");
-//                return;
-//            }
-//            String no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + RandomUtil.randomNumbers(4);
-//            tbBusiness.setPayMoney(tbBusiness.getPayMoney().add(shouldPay)).setPayTime(now)
-//                    .setPayNo(no);
-//            tbBusiness.setPayStatus(tbBusiness.getPayMoney().equals(tbBusiness.getTotalMoney()) ? 3 : 4);
-//            tbBusinessItemService.updateBatchById(list);
-//            tbBusinessService.updateById(tbBusiness);
-//            tbBusinessCarService.updateBatchById(cars);
-//            BigDecimal leftMoney = money.subtract(shouldPay);
-//            tbAccount.setTotalMoney(Base64.encode(leftMoney.toString()));
-//            tbAccountService.updateById(tbAccount);
-//            TbPayRecord payRecord = new TbPayRecord();
-//            TbPayRecordService tbPayRecordService = SpringUtil.getBean(TbPayRecordService.class);
-//            payRecord.setCreateTime(now)
-//                    .setOutTradeNo(no)
-//                    .setTransactionId(no)
-//                    .setPayMoney(shouldPay)
-//                    .setCustomerId(tbBusiness.getCustomerId()).setCustomerName(tbBusiness.getCustomerName());
-//            tbPayRecordService.save(payRecord);
-//        }
-        try {
-             TbBusinessCarService tbBusinessCarService = SpringUtil.getBean(TbBusinessCarService.class);
-        if(!NbUtil.isNull(this.businessId) && NbUtil.isNull(this.plate)){
-          List<TbBusinessCar> cars = tbBusinessCarService.findOtherBusinessCar(this.businessId);
-             for (TbBusinessCar car : cars){
-              this.doBusinessFee(this.businessId,car.getCarNo());
-          }
-           }else {
-                    doOutFee(this.plate);
-            }
-        }catch (RuntimeException e){
-
-            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-
-        }
-
-
-    }
-
-    /**
-     * 收业务费
-     * @param businessId
-     */
-    private void doBusinessFee(String businessId,String plate){
-        if(!NumberUtil.isNumber(businessId) || NbUtil.isNull(plate)){
-            return;
-        }
-        StaticLog.info("开始收取业务费:{}" , businessId);
-        TbBusinessService tbBusinessService = SpringUtil.getBean(TbBusinessService.class);
-        TbBusiness tbBusiness = tbBusinessService.getById(businessId);
-        if(PayEnum.PayStatusEnum.NO_PAY.getCode()!=tbBusiness.getPayStatus()){
-            StaticLog.info("已收取过业务费,退出收费程序:{}" , businessId);
-            return;
-        }
-        if(!NumberUtil.isNumber(tbBusiness.getItemPrice().toString())){
-            StaticLog.info("未获取到收费总金额或收费总金额非法,退出收费程序:{}" , businessId);
-            return;
-        }
-        TbDeductionBindService deductionBindService = SpringUtil.getBean(TbDeductionBindService.class);
-        if(!deductionBindService.checkBind(tbBusiness.getCustomerId(),plate)){
-            StaticLog.info("业务车辆未绑定指定客户的预存款账户,退出收费程序:{}{}",businessId,tbBusiness.getCustomerName());
-            return;
-        }
-        TbBusinessCarService tbBusinessCarService = SpringUtil.getBean(TbBusinessCarService.class);
-        List<TbBusinessCar> cars = tbBusinessCarService.findOtherBusinessCar(businessId);
-        TbAccountService tbAccountService = SpringUtil.getBean(TbAccountService.class);
-        TbAccount tbAccount = tbAccountService.getByCustomerId(tbBusiness.getCustomerId());
-        String key = AesUtil.reverse(tbAccount.getAccSalt());
-        String totalMoney = tbAccount.getTotalMoney();
-        BigDecimal parkingMoneyBig = new BigDecimal(0);
-        BigDecimal totalMoneyBig = new BigDecimal(totalMoney);
-        BigDecimal balance = totalMoneyBig.subtract(tbBusiness.getItemPrice());
-        boolean isOut = (GoodsEnum.DeductionTypeEnum.OUT_KK.getCode()==tbBusiness.getAutoDeductionType())&&NbUtil.isNull(this.plate);
-        if(isOut){
-            parkingMoneyBig = getParkings(cars);
-            balance = balance.subtract(parkingMoneyBig);
-        }
-        if(balance.doubleValue()<0){
-            StaticLog.info("支付账户余额不足!,退出收费程序:{}" , businessId);
-            deductionBindService.setFeeFailRecord(tbBusiness.getCustomerId(),plate,
-                    tbBusiness.getGoodsName()+":因支付账户余额不足,自动缴费失败。。");
-            return;
-        }
-        Date now = new Date();
-        String no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + RandomUtil.randomNumbers(4);
-        tbBusiness.setPayMoney(tbBusiness.getItemPrice()).setPayTime(now).setPayType(5)
-                  .setPayNo(no).setConfirmInput(1).setConfirmInputTime(now).setPayStatus(
-                        PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode());
-        tbBusiness.updateById();
-        TbBusinessItemService tbBusinessItemService = SpringUtil.getBean(TbBusinessItemService.class);
-        List<TbBusinessItem> businessItems = tbBusinessItemService.findByBusinessId(businessId);
-        for(TbBusinessItem businessItem:businessItems){
-            if(businessItem.getPayStatus()==1){
-                continue;
-            }
-            businessItem.setPayStatus(1).setPayTime(now);
-        }
-        tbBusinessItemService.updateBatchById(businessItems);
-        if(isOut){
-            this.updateTbBusinessCars(cars);
-        }
-        //更新账户余额
-        tbAccount.setTotalMoney(AesUtil.encryptECB(balance.toString(),key));
-        tbAccount.updateById();
-        deductionBindService.setDeductMoney(tbBusiness.getCustomerId(),plate,tbBusiness.getItemPrice());
-        //生成收费明细
-        TbFeeDetailsService tbFeeDetailsService = SpringUtil.getBean(TbFeeDetailsService.class);
-        List<TbFeeDetails> tbFeeDetailsList = tbFeeDetailsService.autoChargeBusinessFee(
-                businessItems,null,null,now);
-        //生成扣费记录
-        createTbDeductionRecord(tbFeeDetailsList,deductionBindService,tbFeeDetailsService,tbAccount,
-                tbBusiness,totalMoneyBig,plate);
-        //生成开票信息
-        createTbInvoiceOrder(tbBusiness,cars,parkingMoneyBig);
-        if(isOut){
-            List<PriceBO> priceBOList=cars.stream().map(tbBusinessCar -> new PriceBO(tbBusinessCar.getId(),tbBusinessCar.getMoney())).collect(Collectors.toList());
-            List<TbFeeDetails> parkFeeDetailsList = tbFeeDetailsService.chargeParkFee(
-                    priceBOList,null,null,now,PayEnum.PayType.PER_PAY);
-            createTbDeductionRecord(parkFeeDetailsList,deductionBindService,tbFeeDetailsService,tbAccount,
-                    tbBusiness,totalMoneyBig,plate);
-            deductionBindService.autoUnbindCar(cars);
-        }
-        StaticLog.info("预充值自动缴费成功!,退出收费程序:{}{}" , businessId,tbAccount.getCustomerId());
-    }
-
-    /**
-     * 出场所收费,根据车牌号
-     * @param plate
-     */
-    private void doOutFee(String plate){
-        if(NbUtil.isNull(plate)){
-            return;
-        }
-        TbBusinessCarService tbBusinessCarService = SpringUtil.getBean(TbBusinessCarService.class);
-        TbBusinessCar tbBusinessCar = tbBusinessCarService.findTheLastRecord(plate);
-        if(tbBusinessCar==null){
-            return;
-        }
-        TbBusinessService tbBusinessService = SpringUtil.getBean(TbBusinessService.class);
-        List<TbBusiness> businessList = tbBusinessService.findOtherBusinessByCarId(tbBusinessCar.getId());
-        if(businessList==null){return;}
-        for (TbBusiness business: businessList){
-            List<TbBusinessCar> cars = tbBusinessCarService.findOtherBusinessCar(business.getId());
-            if(cars==null)continue;
-            for (TbBusinessCar car:cars){
-                doBusinessFee(business.getId(), car.getCarNo());
-            }
-        }
-
-    }
-
-
-    private void doParkingFee(TbBusinessCar car, double parkingFee){
-        if(car==null)return;
-        StaticLog.info("开始自动缴纳停车费:{}" , car.getCarNo());
-        if(car.getPay()==1 || car.getPayTime()!=null){
-            StaticLog.info("该车辆已缴纳过停车费!,退出收费程序:{}" , car.getCarNo());
-            return;
-        }
-        TbAccountService tbAccountService = SpringUtil.getBean(TbAccountService.class);
-        TbAccount account = tbAccountService.getTbAccountByPlate(car.getCarNo());
-        if (account==null){
-            StaticLog.info("该车辆还未绑定客户预存款账户!,退出收费程序:{}" , car.getCarNo());
-            return;
-        }
-        BigDecimal totalBig = new BigDecimal("0");
-        String key = null;
-        if(!NumberUtil.isNumber(account.getTotalMoney())){
-            key = AesUtil.reverse(account.getAccSalt());
-            totalBig = new BigDecimal(AesUtil.decryptECB(account.getTotalMoney(),key));
-        }
-        BigDecimal parkFeeBig = null;
-        if(parkingFee>0){
-            parkFeeBig = new BigDecimal(String.valueOf(parkingFee));
-        }else {
-            TbBusinessService tbBusinessService = SpringUtil.getBean(TbBusinessService.class);
-            parkFeeBig = caulatePrice(car, new Date(), tbBusinessService);
-        }
-        BigDecimal balance = totalBig.subtract(parkFeeBig);
-        if(balance.doubleValue()<0){
-            StaticLog.info("支付账户余额不足!,退出收费程序:{}" , car.getCarNo());
-            return;
-        }
-        car.setMoney(parkFeeBig);
-        updateTbBusinessCar(car);
-        account.setTotalMoney(AesUtil.encryptECB(balance.toString(),key));
-        account.updateById();
-//        List<TbFeeDetails> parkFeeDetailsList = tbFeeDetailsService.autoChargeParkFee(
-//                cars,null,null,now);
-//        createTbDeductionRecord(parkFeeDetailsList,deductionBindService,tbFeeDetailsService,tbAccount,
-//                tbBusiness,totalMoneyBig,plate);
-//        deductionBindService.autoUnbindCar(cars);
-        StaticLog.info("停车费自动缴费成功!,退出收费程序:{}" , car.getCarNo());
-    }
-
-    /**
-     * 生成扣费记录
-     * @param tbFeeDetailsList
-     * @param deductionBindService
-     * @param tbFeeDetailsService
-     * @param tbAccount
-     * @param tbBusiness
-     * @param totalMoneyBig
-     */
-    private void createTbDeductionRecord(List<TbFeeDetails> tbFeeDetailsList,TbDeductionBindService deductionBindService,
-                                         TbFeeDetailsService tbFeeDetailsService,TbAccount tbAccount,
-                                         TbBusiness tbBusiness,BigDecimal totalMoneyBig,String plate){
-        if(tbFeeDetailsList==null)return;
-        int i = 0;
-        for (TbFeeDetails feeDetails : tbFeeDetailsList){
-            TbDeductionRecord deductionRecord = BeanUtil.toBean(feeDetails,TbDeductionRecord.class);
-            if(GoodsEnum.DeductionTypeEnum.BUSINESS_OK.getCode()==tbBusiness.getAutoDeductionType()){
-                String bindIdStr = deductionBindService.getBindId(plate);
-                deductionRecord.setDeductionBindId(bindIdStr);
-            }
-            String totalStr = null;
-//            if(!NbUtil.isNull(totalStr) && !NumberUtil.isNumber(totalStr)){
-//                totalStr = AesUtil.decryptECB(totalStr,AesUtil.reverse(tbAccount.getAccSalt()));
-//            }
-            if(totalMoneyBig!=null && feeDetails.getNoTaxPrice()!=null){
-                if(i!=0){
-                    totalMoneyBig = new BigDecimal(deductionRecord.getTotalMoney());
-                }
-                totalStr = totalMoneyBig.subtract(feeDetails.getNoTaxPrice()).toString();
-            }
-            deductionRecord.setId(null);
-            deductionRecord.setCustomerId(tbAccount.getCustomerId());
-            deductionRecord.setFeeDetailsId(feeDetails.getId());
-            deductionRecord.setOriginalMoney(totalMoneyBig.toString());
-            deductionRecord.setDeductMoney(feeDetails.getNoTaxPrice());
-            deductionRecord.setTotalMoney(totalStr);
-            deductionRecord.setReviewStatus(0);
-            deductionRecord.setCarNo(plate);
-            deductionRecord.insert();
-            feeDetails.setCarNo(plate);
-            feeDetails.setCustomerId(tbAccount.getCustomerId());
-            tbFeeDetailsService.updateById(feeDetails);
-            i++;
-        }
-    }
-
-    /**
-     * 更新停车费状态
-     */
-    private void updateTbBusinessCar(TbBusinessCar car){
-        if(car == null)return;
-        car.setPay(1).setMoney(car.getMoney()).setPayTime(new Date()).setPayType(
-                    CarEnum.PayTypeEnum.HAS_PAY_TYPE.getType());
-        car.updateById();
-    }
-
-    /**
-     * 更新停车费状态
-     */
-    private void updateTbBusinessCars(List<TbBusinessCar> cars){
-        if(cars == null)return;
-        for (TbBusinessCar car:cars){
-            updateTbBusinessCar(car);
-        }
-    }
-
-    /**
-     * 生成开票订单信息
-     * @param tbBusiness
-     */
-    private void createTbInvoiceOrder(TbBusiness tbBusiness,List<TbBusinessCar> cars, BigDecimal parkingFee){
-        TbInvoiceOrder invoiceOrder = new TbInvoiceOrder();
-        List<String> businessNameList = new ArrayList<>();
-        List<String> businessNoList = new ArrayList<>();
-        List<String> carNos = new ArrayList<>();
-        businessNoList.add(tbBusiness.getNo());
-        carNos.add(tbBusiness.getCardNo());
-        businessNameList.add(tbBusiness.getGoodsName());
-        if(cars!=null && (GoodsEnum.DeductionTypeEnum.OUT_KK.getCode()==tbBusiness.getAutoDeductionType()) &&
-                NbUtil.isNull(this.plate)){
-            businessNameList.add("停车费");
-            for (TbBusinessCar car : cars) {
-                businessNoList.add(car.getNo());
-                carNos.add(car.getCarNo());
-            }
-        }
-        String businessNameStr = businessNameList.stream().map(String::valueOf).collect(Collectors.joining(","));
-        String businessNoStr = businessNoList.stream().map(String::valueOf).collect(Collectors.joining(","));
-        String carNoStr = carNos.stream().map(String::valueOf).collect(Collectors.joining(","));
-        BigDecimal billMoney = tbBusiness.getItemPrice();
-        if(parkingFee!=null){
-            billMoney = parkingFee.add(billMoney);
-        }
-        invoiceOrder.setBusinessName(businessNameStr).setBusinessNo(businessNoStr).setCarNo(carNoStr)
-                    .setTransactionId(null).setBillMoney(billMoney)
-                    .setStatus(0).setCreateTime(new Date()).setCustomerId(tbBusiness.getCustomerId());
-        TbInvoiceOrderService invoiceOrderService = SpringUtil.getBean(TbInvoiceOrderService.class);
-        invoiceOrderService.save(invoiceOrder);
-    }
-
-    /**
-     * 生成停车费
-     * @param tbBusinessCar
-     * @param now
-     * @return
-     */
-    private BigDecimal caulatePrice(TbBusinessCar tbBusinessCar, Date now, TbBusinessService tbBusinessService) {
-        if(tbBusinessCar==null || now==null) new BigDecimal("0");
-        Date inTime = tbBusinessCar.getRealInTime();
-        if (tbBusinessCar.getPay() == 1 && tbBusinessCar.getRealOutTime() == null && tbBusinessCar.getPayTime() != null) {
-            inTime = tbBusinessCar.getPayTime();
-        }
-        BigDecimal price = tbBusinessService.calculationPartMoney(inTime, now,tbBusinessCar.getCarNo());
-        return price;
-    }
-
-    /**
-     * 获取所有停车费总和
-     * @param cars
-     * @return
-     */
-    private BigDecimal getParkings(List<TbBusinessCar> cars){
-        if(cars==null) new BigDecimal("0");
-        Date now = new Date();
-        BigDecimal value = new BigDecimal("0");
-        TbBusinessService tbBusinessService = SpringUtil.getBean(TbBusinessService.class);
-        for (TbBusinessCar tbBusinessCar:cars){
-            value = value.add(this.caulatePrice(tbBusinessCar,now,tbBusinessService));
-        }
-        return value;
-    }
-}

+ 4 - 0
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItem.java

@@ -124,6 +124,10 @@ public class TbBusinessItem extends Model<TbBusinessItem> implements Serializabl
      */
     private String pickBy;
     private String pickByAdminId;
+	/**
+	 * 计价ID
+	 */
+	private String calculateId;
 
 	@TableField(exist = false)
 	private String goodsName;

+ 18 - 4
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemService.java

@@ -16,6 +16,7 @@ import com.pj.current.config.MyConfig;
 import com.pj.current.config.WxConfig;
 import com.pj.current.satoken.StpUserUtil;
 import com.pj.current.task.TaskService;
+import com.pj.project.sync.request.item.IOrderItem;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
 import com.pj.project.tb_costomer.TbCostomer;
@@ -88,7 +89,6 @@ public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper, TbB
     private TbItemTypeService tbItemTypeService;
 
 
-
     /**
      * 查集合 - 根据条件(参数为空时代表忽略指定条件)
      */
@@ -258,15 +258,15 @@ public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper, TbB
         }
         List<TbBusinessItem> list = this.getByBusinessCarId(businessId);
         TbBusinessItem tbBusinessItem = new TbBusinessItem();
-        BigDecimal totalPrice=new BigDecimal(num).multiply(tbItem.getPrice());
+        BigDecimal totalPrice = new BigDecimal(num).multiply(tbItem.getPrice());
         tbBusinessItem.setBusinessId(businessId).setItemTypeId(tbItemType.getId()).setItemTypeName(tbItemType.getName())
                 .setItemId(tbItem.getId()).setItemName(tbItem.getItemName()).setItemCode(tbItem.getItemCode())
                 .setItemPrice(tbItem.getPrice())
                 .setUnit(tbItem.getUnit()).setNum(num)
                 .setTotal(totalPrice).setCreateTime(new Date())
-                .setTaxRate(new BigDecimal(tbItem.getTaxRate()).divide(new BigDecimal(100),2,BigDecimal.ROUND_UP).doubleValue())
+                .setTaxRate(new BigDecimal(tbItem.getTaxRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_UP).doubleValue())
                 .setNo(tbBusiness.getNo() + list.size() + 1)
-        .setPayType(tbItem.getPayType()).setPayTypeName(tbItem.getPayTypeName());
+                .setPayType(tbItem.getPayType()).setPayTypeName(tbItem.getPayTypeName());
         this.save(tbBusinessItem);
         tbBusiness.setPayStatus(PayEnum.PayStatusEnum.NO_PAY.getCode())
                 .setItemPrice(tbBusiness.getItemPrice().add(totalPrice));
@@ -289,4 +289,18 @@ public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper, TbB
         }
         this.removeById(id);
     }
+
+    /**
+     * 构建统一计费中心的订单计算参数
+     *
+     * @param businessItems
+     * @return
+     */
+    public void buildExpenses(List<TbBusinessItem> businessItems, List<IOrderItem> orderItems) {
+        businessItems.forEach(item -> {
+            IOrderItem orderItem = new IOrderItem();
+            orderItem.setUniqExpenseId(item.getItemCode()).setExpenseNum(Integer.parseInt(item.getNum()));
+            orderItems.add(orderItem);
+        });
+    }
 }

+ 6 - 1
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomer.java

@@ -13,6 +13,7 @@ import lombok.experimental.Accessors;
 
 import java.io.Serializable;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * Model: tb_costomer -- 客户管理
@@ -106,7 +107,7 @@ public class TbCostomer extends Model<TbCostomer> implements Serializable {
      */
     private int payType;
     /**
-     * 类型0、理货员;1、消杀;2、装卸
+     * 类型0、理货员;1、消杀;2、装卸====>收微信通知用
      */
     private String type = "0";
 
@@ -150,6 +151,10 @@ public class TbCostomer extends Model<TbCostomer> implements Serializable {
                     .findFirst().orElseThrow(() -> new BusinessException("不存在")).getDesc();
         }
 
+        public static String getDescs(String type) {
+            return StrUtil.splitTrim(type, ",").stream().map(CustomerEnum::getDesc).collect(Collectors.joining(","));
+        }
+
         public static List<Map<String, String>> getList() {
             List<Map<String, String>> list = new ArrayList<>();
             for (CustomerEnum customerEnum : CustomerEnum.values()) {

+ 7 - 0
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerController.java

@@ -5,6 +5,7 @@ import cn.dev33.satoken.annotation.SaMode;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.pj.constants.UserTypeEnum;
+import com.pj.current.config.SystemObject;
 import com.pj.current.satoken.StpUserUtil;
 import com.pj.utils.sg.AjaxJson;
 import com.pj.utils.so.SoMap;
@@ -202,4 +203,10 @@ public class TbCostomerController {
         tbCostomerService.addAdminMenu(perStr);
         return AjaxJson.getSuccess();
     }
+
+    @RequestMapping("init-push")
+    public AjaxJson pushData(){
+        tbCostomerService.initPush();
+        return AjaxJson.getSuccess();
+    }
 }

+ 37 - 1
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerService.java

@@ -4,6 +4,10 @@ import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.pj.constants.business.SyncTypeEnum;
+import com.pj.project.sync.SyncService;
+import com.pj.project.sync.dto.PartnerDTO;
+import com.pj.project.sync.dto.PartnerParam;
 import com.pj.project.tb_init_permission.TbInitPermission;
 import com.pj.project.tb_init_permission.TbInitPermissionService;
 import com.pj.project4sp.SP;
@@ -13,6 +17,7 @@ import com.pj.project4sp.admin.SpAdminService;
 import com.pj.project4sp.role.SpRole;
 import com.pj.project4sp.role.SpRoleMapper;
 import com.pj.project4sp.role4permission.SpRolePermissionMapper;
+import com.pj.utils.sg.AjaxError;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -20,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -48,6 +54,8 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
     private SpAdminMapper spAdminMapper;
     @Resource
     private SpAdminService spAdminService;
+    @Resource
+    private SyncService syncService;
 
     /**
      * 增
@@ -64,13 +72,17 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
         spRoleMapper.add(spRole);
         long roleId = SP.publicMapper.getPrimarykey();
         List<String> codeList = new ArrayList<>();
-        for (String type : StrUtil.splitTrim(t.getType(), ",")) {
+        List<String> typeList = StrUtil.splitTrim(t.getType(), ",");
+        for (String type : typeList) {
             SoMap perSoMap = SoMap.getRequestSoMap();
             perSoMap.put("type", type);
             List<TbInitPermission> permissions = tbInitPermissionService.getList(perSoMap);
             codeList.addAll(permissions.stream().map(TbInitPermission::getCode).distinct().collect(Collectors.toList()));
         }
         spRolePermissionMapper.saveRolePer(roleId, codeList);
+        if (!typeList.contains("0")) {
+            syncService.syncPartnes(t.getId(), t.getName(), SyncTypeEnum.INSERT.getCode());
+        }
         return 1;
     }
 
@@ -93,6 +105,10 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
      * 删
      */
     int delete(String id) {
+        TbCostomer tbCostomer = this.getById(id);
+        if (tbCostomer == null) {
+            throw new AjaxError("信息不存在");
+        }
         this.removeById(id);
         SoMap soMap = SoMap.getRequestSoMap();
         soMap.put("customerId", id);
@@ -103,6 +119,9 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
         spRoleMapper.removeByCustomerId(id);
         spRolePermissionMapper.removeByRoleIds(roles.stream().map(SpRole::getId).collect(Collectors.toList()));
         spAdminMapper.removeByCustomerId(id);
+        if (!StrUtil.contains(tbCostomer.getType(), "0")) {
+            syncService.syncPartnes(id, tbCostomer.getName(), SyncTypeEnum.DELETE.getCode());
+        }
         return 1;
     }
 
@@ -114,6 +133,7 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
             throw new RuntimeException("名称已存在");
         }
         this.updateById(t);
+        syncService.syncPartnes(t.getId(), t.getName(), SyncTypeEnum.UPDATE.getCode());
         return 1;
     }
 
@@ -257,4 +277,20 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
             tbCostomerMapper.addAdminPermission(perCode);
         });
     }
+
+    public void initPush() {
+        QueryWrapper<TbCostomer> ew = new QueryWrapper<>();
+        ew.lambda().ne(TbCostomer::getType, "0");
+        List<TbCostomer> list = this.list(ew);
+        PartnerDTO partnerDTO = new PartnerDTO();
+        List<PartnerParam> partnerParams = list.stream().map(tbCostomer -> {
+            PartnerParam partnerParam = new PartnerParam();
+            partnerParam.setPartnersId(tbCostomer.getId())
+                    .setPartnersName(tbCostomer.getName())
+                    .setSyncType(SyncTypeEnum.INSERT.getCode());
+            return partnerParam;
+        }).collect(Collectors.toList());
+        partnerDTO.setPartnersList(partnerParams);
+        syncService.syncPartnes(partnerDTO);
+    }
 }

+ 5 - 0
sp-server/src/main/java/com/pj/project/tb_deduction_record/TbDeductionRecord.java

@@ -253,4 +253,9 @@ public class TbDeductionRecord extends Model<TbDeductionRecord> implements Seria
      */
     private String preOrderNum;
 
+    /**
+     * 统计非中心ID
+     */
+    private String calculateId;
+
 }

+ 5 - 1
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetails.java

@@ -67,6 +67,10 @@ public class TbFeeDetails implements Serializable {
      * 收费类型
      */
     private Integer feeType;
+    /**
+     * 统计费项名称
+     */
+    private String feeTypeName;
 
     /**
      * 业务类型id
@@ -135,7 +139,7 @@ public class TbFeeDetails implements Serializable {
      * 开票主体
      */
     private String entityName;
-
+    private String calculateId;
 
     /**
      * 不含税款

+ 70 - 139
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java

@@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.pj.api.pushfee.task.FeeDetailSyncTask;
+import com.pj.api.wx.bo.ManagerBO;
 import com.pj.api.wx.bo.PriceBO;
 import com.pj.constants.business.*;
 import com.pj.current.config.MyConfig;
@@ -40,12 +41,16 @@ import com.pj.project.tb_fee_details.dto.DetailSumDTO;
 import com.pj.project.tb_fee_details.dto.ExportFeeDetailDTO;
 import com.pj.project.tb_fee_details.dto.PrintFeeDetailDTO;
 import com.pj.project.tb_fee_details.statics.FeeTypeStatics;
+import com.pj.project.tb_fee_item.TbFeeItem;
+import com.pj.project.tb_fee_item.TbFeeItemService;
 import com.pj.project.tb_fee_statistics.TbFeeStatistics;
 import com.pj.project.tb_fee_statistics.TbFeeStatisticsService;
 import com.pj.project.tb_goods.TbGoods;
 import com.pj.project.tb_goods.TbGoodsService;
-import com.pj.project.tb_mild_car.TbMildCar;
-import com.pj.project.tb_mild_car.TbMildCarService;
+import com.pj.project.tb_item.TbItem;
+import com.pj.project.tb_item.TbItemService;
+import com.pj.project.tb_item_fac.TbItemFac;
+import com.pj.project.tb_item_fac.TbItemFacService;
 import com.pj.project4sp.admin.SpAdmin;
 import com.pj.project4sp.global.BusinessException;
 import com.pj.project4sp.role.SpRole;
@@ -87,8 +92,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
     private MyConfig myConfig;
     @Resource
     private PartConfig partConfig;
-    @Resource
-    SpRoleMapper spRoleMapper;
+
     @Resource
     TbFeeStatisticsService tbFeeStatisticsService;
     @Resource
@@ -102,7 +106,11 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
     @Resource
     TaskService taskService;
     @Resource
-    private TbMildCarService tbMildCarService;
+    private TbFeeItemService tbFeeItemService;
+    @Resource
+    private TbItemFacService tbItemFacService;
+    @Resource
+    private TbItemService tbItemService;
 
     /**
      * 增
@@ -145,13 +153,6 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         return list(qw);
     }
 
-    public TbFeeDetails getByBusinessIdAndCarNoAndFeeType(String businessId, String carNo, Integer feeType) {
-        QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
-        qw.eq("business_id", businessId);
-        qw.eq("car_no", carNo);
-        qw.eq("fee_type", feeType);
-        return getOne(qw);
-    }
 
     public List<TbFeeDetails> getByBusinessIdAndCarNo(String businessId, String carNo) {
         QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
@@ -160,48 +161,6 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         return list(qw);
     }
 
-    public TbFeeDetails getByBusinessIdAndCarNoAndItemType(String businessId, String carNo, String itemTypeId) {
-        QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
-        qw.eq("business_id", businessId);
-        qw.eq("car_no", carNo);
-        qw.eq("item_type_id", itemTypeId);
-        return getOne(qw);
-    }
-
-    /**
-     * 查找放行记录所有的收费明细
-     *
-     * @param businessCarId
-     * @param carNo
-     * @param feeType
-     * @return
-     */
-    public List<TbFeeDetails> getByBusinessCarIdAndCarNoAndFeeType(String businessCarId, String carNo, Integer feeType) {
-        QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
-        qw.eq("business_car_id", businessCarId);
-        qw.eq("car_no", carNo);
-        qw.eq("fee_type", feeType);
-        return list(qw);
-    }
-
-    public List<TbFeeDetails> getByBusinessCarIdAndCarNoAndFeeTypeAndPayDay(String businessCarId, String carNo, Integer feeType, String payDay) {
-        QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
-        qw.eq("business_car_id", businessCarId);
-        qw.eq("car_no", carNo);
-        qw.eq("fee_type", feeType);
-        qw.eq("pay_day", payDay);
-        return list(qw);
-    }
-
-    public TbFeeDetails findBuCarIdAndCarNoAndFeeTypeAndItemTypeName(String businessCarId, String carNo, Integer feeType, String itemTypeName) {
-        QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
-        qw.eq("business_car_id", businessCarId);
-        qw.eq("car_no", carNo);
-        qw.eq("fee_type", feeType);
-        qw.eq("item_type_name", itemTypeName);
-        return getOne(qw);
-    }
-
     public List<TbFeeDetails> findByTransactionId(String transactionId) {
         QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
         qw.like("transaction_id", transactionId);
@@ -218,67 +177,64 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
      */
     public List<TbFeeDetails> chargeParkFee(List<PriceBO> cars, String transactionId, String outTradeNo, Date now, PayEnum.PayType payType) {
         List<TbFeeDetails> details = new ArrayList<>();
-        for (PriceBO bo1 : cars) {
-            //本次支付的停车费金额
-            BigDecimal payPrice = bo1.getP();
-            if (payPrice.compareTo(BigDecimal.valueOf(0)) == 0) {
-                continue;
-            }
-            TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
-            String bindIdStr = "";
-            if (payType.getCode() == PayEnum.PayType.PER_PAY.getCode()) {
-                bindIdStr = tbDeductionBindService.getBindId(car.getCarNo());
-            }
-            //24小时内的停车费
-            BigDecimal in24Price = partConfig.getBasePrice();
-            TbFeeDetails in24Detail = new TbFeeDetails();
-            TbFeeDetails out24Details = new TbFeeDetails();
-            in24Detail.setItemName("大型货车(含9.6米以上货车)");
-            out24Details.setItemName("大型货车(含9.6米以上货车)");
-            //4.2~9.6
-            TbMildCar tbMildCar = tbMildCarService.findByCarNo(car.getCarNo());
-            if (tbMildCar !=  null) {
-                in24Price = partConfig.getMildCarBasePrice();
-                in24Detail.setItemName("中小型货车(9.6米以下货车)");
-                out24Details.setItemName("中小型货车(9.6米以下货车)");
-            }
-            //24小时内的停车费
-            in24Detail.setNum(1).setItemTypeName(PartFeeEnum.IN_24_HOURS.getDesc())
-                    .setUnitPrice(in24Price).setItemPrice(in24Price).setModule(payType.getDesc()).setBusinessId(bindIdStr);
-            setFee(in24Detail, car, transactionId, outTradeNo, now);
-            String type = StrUtil.isEmpty(in24Detail.getId()) ? SyncTypeEnum.INSERT.getCode() : SyncTypeEnum.UPDATE.getCode();
-            saveOrUpdate(in24Detail);
-            details.add(in24Detail);
-            taskService.addTask(new FeeDetailSyncTask(RandomUtil.randomNumbers(10), 1000, in24Detail.getId(), type));
-            //24小时外的停车费
-            BigDecimal out24Price = payPrice.subtract(in24Price);
-            if (out24Price.compareTo(BigDecimal.valueOf(0)) > 0) {
-                BigDecimal unitPrice = in24Price.add(partConfig.getExtraPrice());
-                int num = out24Price.divide(unitPrice, BigDecimal.ROUND_UP, 0).intValue();
-                out24Details.setNum(num).setItemTypeName(PartFeeEnum.OUT_24_HOURS.getDesc())
-                        .setUnitPrice(unitPrice).setItemPrice(out24Price).setModule(payType.getDesc()).setBusinessId(bindIdStr);
-                setFee(out24Details, car, transactionId, outTradeNo, now);
-                type = StrUtil.isEmpty(out24Details.getId()) ? SyncTypeEnum.INSERT.getCode() : SyncTypeEnum.UPDATE.getCode();
-                saveOrUpdate(out24Details);
-                taskService.addTask(new FeeDetailSyncTask(RandomUtil.randomNumbers(10), 1000, out24Details.getId(), type));
-                details.add(out24Details);
-            }
-        }
+       if (!cars.isEmpty()){
+           String uniqExpenseId = cars.get(0).getUniqExpenseId();
+           TbItem tbItem = tbItemService.findByCode(uniqExpenseId);
+           BigDecimal taxRate=BigDecimal.valueOf(tbItem.getTaxRate()).divide(BigDecimal.valueOf(100),2,BigDecimal.ROUND_UP);
+           for (PriceBO bo1 : cars) {
+               //本次支付的停车费金额
+               BigDecimal payPrice = bo1.getP();
+               if (payPrice.compareTo(BigDecimal.valueOf(0)) == 0) {
+                   continue;
+               }
+               TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
+               String bindIdStr = "";
+               if (payType.getCode() == PayEnum.PayType.PER_PAY.getCode()) {
+                   bindIdStr = tbDeductionBindService.getBindId(car.getCarNo());
+               }
+               //24小时内的停车费
+               BigDecimal in24Price = bo1.getStandard();
+               TbFeeDetails in24Detail = new TbFeeDetails();
+               in24Detail.setItemName(bo1.getCarDesc());
+               //24小时内的停车费
+               in24Detail.setNum(1).setItemTypeName(PartFeeEnum.IN_24_HOURS.getDesc()).setCalculateId(bo1.getCalculateId())
+                       .setUnitPrice(in24Price).setItemPrice(in24Price).setModule(payType.getDesc()).setBusinessId(bindIdStr);
+               setFee(taxRate, in24Detail, car, transactionId, outTradeNo, now);
+               String type = StrUtil.isEmpty(in24Detail.getId()) ? SyncTypeEnum.INSERT.getCode() : SyncTypeEnum.UPDATE.getCode();
+               saveOrUpdate(in24Detail);
+               details.add(in24Detail);
+               taskService.addTask(new FeeDetailSyncTask(RandomUtil.randomNumbers(10), 1000, in24Detail.getId(), type, payType));
+               //24小时外的停车费
+               BigDecimal out24Price = payPrice.subtract(in24Price);
+               if (out24Price.compareTo(BigDecimal.valueOf(0)) > 0) {
+                   TbFeeDetails out24Details = new TbFeeDetails();
+                   BigDecimal unitPrice = bo1.getExtraPrice();
+                   int num = out24Price.divide(unitPrice, BigDecimal.ROUND_UP, 0).intValue();
+                   out24Details.setNum(num).setItemTypeName(PartFeeEnum.OUT_24_HOURS.getDesc())
+                           .setUnitPrice(unitPrice).setItemPrice(out24Price).setModule(payType.getDesc()).setBusinessId(bindIdStr);
+                   setFee(taxRate, out24Details, car, transactionId, outTradeNo, now);
+                   type = StrUtil.isEmpty(out24Details.getId()) ? SyncTypeEnum.INSERT.getCode() : SyncTypeEnum.UPDATE.getCode();
+                   saveOrUpdate(out24Details);
+                   taskService.addTask(new FeeDetailSyncTask(RandomUtil.randomNumbers(10), 1000, out24Details.getId(), type, payType));
+                   details.add(out24Details);
+               }
+           }
+       }
         return details;
     }
 
-    private void setFee(TbFeeDetails parkFee, TbBusinessCar car, String transactionId, String outTradeNo, Date now) {
+    private void setFee(BigDecimal taxRate, TbFeeDetails parkFee, TbBusinessCar car, String transactionId, String outTradeNo, Date now) {
         String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm:ss");
         String toDay = DateUtil.format(now, "yyyy-MM-dd");
-        parkFee.setTaxRate(partConfig.getTaxRate());
-        BigDecimal taxPrice = parkFee.getItemPrice().divide(BigDecimal.valueOf(1).add(parkFee.getTaxRate()), 2, BigDecimal.ROUND_HALF_UP).multiply(parkFee.getTaxRate());
+        parkFee.setTaxRate(taxRate);
+        BigDecimal taxPrice = parkFee.getItemPrice().divide(BigDecimal.valueOf(1).add(taxRate), 2, BigDecimal.ROUND_HALF_UP).multiply(taxRate);
         taxPrice = taxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
         BigDecimal noTaxPrice = parkFee.getItemPrice().subtract(taxPrice);
         noTaxPrice = noTaxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
         parkFee.setBusinessCarId(car.getId())
                 .setCarNo(car.getCarNo())
                 .setNoTaxPrice(noTaxPrice).setTaxPrice(taxPrice)
-                .setFeeType(FeeTypeEnum.PARK_FEE.getCode())
+                .setFeeType(FeeTypeEnum.PARK_FEE.getCode()).setFeeTypeName(FeeTypeEnum.PARK_FEE.getDesc())
                 .setPayDay(toDay).setPayType(3).setCreateTime(now).setUpdateTime(now)
                 .setIsSettle(1).setPayMode(1).setPayTime(nowStr)
                 .setTransactionId(transactionId).setOutTradeNo(outTradeNo)
@@ -342,7 +298,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
             businessCarNos = StrUtil.sub(businessCarNos, 0, businessCarNos.length() - 1);
             businessFeeDetail.setBusinessId(item.getBusinessId()).setBusinessNo(business.getNo())
                     .setBusinessItemNo(item.getNo()).setBusinessCarId(businessCarIds).setBusinessCarNo(businessCarNos)
-                    .setCarNo(carNo)
+                    .setCarNo(carNo).setCalculateId(item.getCalculateId())
                     .setItemPrice(item.getTotal()).setUnitPrice(item.getItemPrice()).setNoTaxPrice(noTaxPrice).setTaxPrice(taxPrice)
                     .setFeeType(feeType)
                     .setItemTypeId(item.getItemTypeId()).setItemTypeName(item.getItemTypeName())
@@ -357,7 +313,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
                     .setModule(module);
             String type = StrUtil.isEmpty(businessFeeDetail.getId()) ? SyncTypeEnum.INSERT.getCode() : SyncTypeEnum.UPDATE.getCode();
             saveOrUpdate(businessFeeDetail);
-            taskService.addTask(new FeeDetailSyncTask(RandomUtil.randomNumbers(10), 1000, businessFeeDetail.getId(), type));
+            taskService.addTask(new FeeDetailSyncTask(RandomUtil.randomNumbers(10), 1000, businessFeeDetail.getId(), type, payType));
             feeDetails.add(businessFeeDetail);
         }
         return feeDetails;
@@ -392,13 +348,13 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         }
         int index = 1;
         for (TbFeeDetails feeDetails : list) {
-            String feeType = FeeTypeEnum.getDesc(feeDetails.getFeeType());
+            TbFeeItem tbFeeItem = tbFeeItemService.getById(feeDetails.getFeeType());
             ExportFeeDetailDTO detailDTO = new ExportFeeDetailDTO();
             detailDTO.setBusinessNo(feeDetails.getBusinessNo()).setCarNo(feeDetails.getCarNo())
-                    .setFeeType(feeType).setItemTypeName(feeDetails.getItemTypeName())
+                    .setFeeType(tbFeeItem.getName()).setItemTypeName(feeDetails.getItemTypeName())
                     .setItemName(feeDetails.getItemName()).setItemPrice(feeDetails.getItemPrice())
-                    .setPayType("微信支付").setIndex(index++)
-                    .setPayMode("直接收款")
+                    .setPayType(PayEnum.PayType.WX_PAY.getDesc()).setIndex(index++)
+                    .setPayMode(PayEnum.PayType.CASH_PAY.getDesc())
                     .setWeight(feeDetails.getWeight()).setNum(feeDetails.getNum()).setUnitPrice(feeDetails.getUnitPrice())
                     .setSettle("已结算").setTaxRate(feeDetails.getTaxRate().multiply(new BigDecimal(100)))
                     .setTaxPrice(feeDetails.getTaxPrice()).setNoTaxPrice(feeDetails.getNoTaxPrice()).setPayTime(feeDetails.getPayTime())
@@ -519,10 +475,10 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         List<ExportFeeDetailDTO> printList = new ArrayList<>();
         Integer index = 1;
         for (TbFeeDetails feeDetails : feeDetaillist) {
-            String feeType = FeeTypeEnum.getDesc(feeDetails.getFeeType());
+            TbFeeItem tbFeeItem = tbFeeItemService.getById(feeDetails.getFeeType());
             ExportFeeDetailDTO detailDTO = new ExportFeeDetailDTO();
             detailDTO.setBusinessNo(feeDetails.getBusinessNo()).setCarNo(feeDetails.getCarNo())
-                    .setFeeType(feeType).setItemTypeName(feeDetails.getItemTypeName())
+                    .setFeeType(tbFeeItem.getName()).setItemTypeName(feeDetails.getItemTypeName())
                     .setItemName(feeDetails.getItemName()).setItemPrice(feeDetails.getItemPrice())
                     .setPayType("微信支付").setIndex(index++)
                     .setPayMode("直接收款")
@@ -670,11 +626,6 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
     }
 
     public void jiChaCancel(List<Long> ids) {
-        SpAdmin admin = StpUserUtil.getAdmin();
-        SpRole role = spRoleMapper.getById(Long.valueOf(admin.getRoleId()));
-        if (!StrUtil.equals(PersonEnum.JICHA.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())) {
-            throw new BusinessException("该操作需要统计稽查员的权限");
-        }
         List<TbFeeDetails> detailsList = this.listByIds(ids);
         Set<String> days = new HashSet<>();
         for (TbFeeDetails detail : detailsList) {
@@ -783,27 +734,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
     }
 
 
-    private void setFeeAuto(TbFeeDetails parkFee, TbBusinessCar car, String transactionId, String outTradeNo, Date now) {
-        String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm:ss");
-        String toDay = DateUtil.format(now, "yyyy-MM-dd");
-        parkFee.setTaxRate(partConfig.getTaxRate());
-        BigDecimal taxPrice = parkFee.getItemPrice().divide(BigDecimal.valueOf(1).add(parkFee.getTaxRate()), 2, BigDecimal.ROUND_HALF_UP).multiply(parkFee.getTaxRate());
-        taxPrice = taxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
-        BigDecimal noTaxPrice = parkFee.getItemPrice().subtract(taxPrice);
-        noTaxPrice = noTaxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
-        parkFee.setBusinessCarId(car.getId())
-                .setCarNo(car.getCarNo())
-                .setNoTaxPrice(noTaxPrice).setTaxPrice(taxPrice)
-                .setFeeType(FeeTypeEnum.PARK_FEE.getCode())
-                .setPayDay(toDay).setPayType(5).setCreateTime(now).setUpdateTime(now)
-                .setIsSettle(1).setPayMode(1).setPayTime(nowStr)
-                .setTransactionId(transactionId).setOutTradeNo(outTradeNo)
-                .setBusinessCarNo(car.getNo());
-        if (StrUtil.isNotEmpty(car.getCustomerId())) {
-            TbCostomer costomer = tbCostomerService.getById(car.getCustomerId());
-            if (costomer != null) {
-                parkFee.setCustomerName(costomer.getName());
-            }
-        }
+    public void chargeManagerFee(ManagerBO managerBO, String transactionId, String outTradeNo, Date payTime, PayEnum.PayType wxPay) {
+
     }
 }

+ 1 - 7
sp-server/src/main/java/com/pj/project/tb_fee_details/statics/FeeTypeStatics.java

@@ -15,11 +15,5 @@ public class FeeTypeStatics implements Serializable {
     private Integer feeType;
 
 
-    public String getName() {
-        Integer feeType = this.getFeeType();
-        if (feeType == null) {
-            return this.name;
-        }
-        return FeeTypeEnum.getDesc(feeType);
-    }
+
 }

+ 67 - 0
sp-server/src/main/java/com/pj/project/tb_fee_item/TbFeeItem.java

@@ -0,0 +1,67 @@
+package com.pj.project.tb_fee_item;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.EqualsAndHashCode;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_fee_item -- 统计分类
+ * @author qzy 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbFeeItem.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbFeeItem extends Model<TbFeeItem> implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_fee_item";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-fee-item";	
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 *  
+	 */
+	@TableId(type = IdType.AUTO)
+	private Long id;	
+
+	/**
+	 *  
+	 */
+	private Integer feeCode;	
+
+	/**
+	 *  
+	 */
+	private String name;	
+
+	/**
+	 *  
+	 */
+	private Date syncTime;
+
+
+
+
+
+	
+
+
+}

+ 36 - 0
sp-server/src/main/java/com/pj/project/tb_fee_item/TbFeeItemController.java

@@ -0,0 +1,36 @@
+package com.pj.project.tb_fee_item;
+
+
+import com.pj.utils.sg.AjaxJson;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * Controller: tb_goods -- 商品管理
+ *
+ * @author qzy
+ */
+@RestController
+@RequestMapping("/TbFeeItem/")
+public class TbFeeItemController {
+
+    /**
+     * 底层 Service 对象
+     */
+    @Autowired
+    TbFeeItemService tbFeeItemService;
+
+
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    @RequestMapping("getList")
+    public AjaxJson getList() {
+        return AjaxJson.getSuccessData(tbFeeItemService.list());
+    }
+
+
+}

+ 21 - 0
sp-server/src/main/java/com/pj/project/tb_fee_item/TbFeeItemMapper.java

@@ -0,0 +1,21 @@
+package com.pj.project.tb_fee_item;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.pj.utils.so.*;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * Mapper: tb_fee_item -- 统计分类
+ * @author qzy 
+ */
+
+@Mapper
+@Repository
+public interface TbFeeItemMapper extends BaseMapper <TbFeeItem> {
+
+
+}

+ 8 - 0
sp-server/src/main/java/com/pj/project/tb_fee_item/TbFeeItemMapper.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.pj.project.tb_fee_item.TbFeeItemMapper">
+
+	
+	
+
+</mapper>

+ 22 - 0
sp-server/src/main/java/com/pj/project/tb_fee_item/TbFeeItemService.java

@@ -0,0 +1,22 @@
+package com.pj.project.tb_fee_item;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import org.springframework.stereotype.Service;
+
+/**
+ * Service: tb_fee_item -- 统计分类
+ * @author qzy 
+ */
+@Service
+public class TbFeeItemService extends ServiceImpl<TbFeeItemMapper, TbFeeItem> implements IService<TbFeeItem> {
+
+
+    public TbFeeItem findByName(String label) {
+        QueryWrapper<TbFeeItem>ew=new QueryWrapper<>();
+        ew.lambda().eq(TbFeeItem::getName,label);
+        return getOne(ew);
+    }
+}

+ 4 - 0
sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatistics.java

@@ -49,6 +49,10 @@ public class TbFeeStatistics implements Serializable {
      * 收费类型(1=核酸检测,2消杀作业,3=装卸作业,4=停车费,5=过磅费)
      */
     private Integer feeType;
+    /**
+     * 类型名称
+     */
+    private String feeTypeName;
 
 
     /**

+ 5 - 1
sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsController.java

@@ -2,6 +2,7 @@ package com.pj.project.tb_fee_statistics;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import com.pj.constants.business.FeeTypeEnum;
+import com.pj.project.tb_fee_item.TbFeeItemService;
 import com.pj.project4sp.SP;
 import com.pj.utils.sg.AjaxJson;
 import com.pj.utils.so.SoMap;
@@ -10,6 +11,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 
@@ -27,6 +29,8 @@ public class TbFeeStatisticsController {
      */
     @Autowired
     TbFeeStatisticsService tbFeeStatisticsService;
+    @Resource
+    private TbFeeItemService tbFeeItemService;
 
     /**
      * 增
@@ -170,7 +174,7 @@ public class TbFeeStatisticsController {
 
     @RequestMapping(value = "getFeeType")
     public AjaxJson getFeeType() {
-        return AjaxJson.getSuccessData(FeeTypeEnum.getList());
+        return AjaxJson.getSuccessData(tbFeeItemService.list());
     }
 
 

+ 8 - 7
sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsMapper.xml

@@ -43,6 +43,7 @@
     <resultMap id="model" type="com.pj.project.tb_fee_statistics.TbFeeStatistics">
         <result property="id" column="id"/>
         <result property="feeType" column="fee_type"/>
+        <result property="feeTypeName" column="fee_type_name,"/>
         <result property="itemTypeId" column="item_type_id"/>
         <result property="itemTypeName" column="item_type_name"/>
         <result property="year" column="year"/>
@@ -69,7 +70,7 @@
     </select>
 
     <!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
-    <select id="getList" resultMap="model">
+    <select id="getList" resultType="com.pj.project.tb_fee_statistics.TbFeeStatistics">
         <include refid="select_sql"></include>
         <where>
             <if test=' this.has("id") '>and id = #{id}</if>
@@ -108,8 +109,8 @@
         </choose>
     </select>
 
-    <select id="getMonth" resultMap="model">
-        select month, fee_type, sum(num) as num, sum(tax_money) as tax_money, sum(taxes) as taxes, sum(no_tax_money) as
+    <select id="getMonth" resultType="com.pj.project.tb_fee_statistics.TbFeeStatistics">
+        select `month`, fee_type, sum(num) as num, sum(tax_money) as tax_money, sum(taxes) as taxes, sum(no_tax_money) as
         no_tax_money, any_value(tax_rate) as tax_rate
         from tb_fee_statistics
         <where>
@@ -120,19 +121,19 @@
                 and month &lt;= #{endMonth}
             </if>
         </where>
-        group by month, fee_type
+        group by `month`, fee_type
         order by month desc
     </select>
 
-    <select id="getYear" resultMap="model">
-        select year, fee_type, sum(num) as num, sum(tax_money) as tax_money, sum(taxes) as taxes, sum(no_tax_money) as
+    <select id="getYear" resultType="com.pj.project.tb_fee_statistics.TbFeeStatistics">
+        select `year`, fee_type, sum(num) as num, sum(tax_money) as tax_money, sum(taxes) as taxes, sum(no_tax_money) as
         no_tax_money, any_value(tax_rate) as tax_rate
         from tb_fee_statistics
         <where>
             <if test=' this.has("feeType") '>and fee_type = #{feeType}</if>
             <if test=' this.has("year") '>and year = #{year}</if>
         </where>
-        group by year, fee_type
+        group by `year`, fee_type
         order by year desc
     </select>
 

Some files were not shown because too many files changed in this diff