Browse Source

收费明细调整

lzm 3 years ago
parent
commit
148dc56a50

+ 15 - 1
sp-server/src/main/java/com/pj/project/tb_fee_details/ExportFeeDetailDTO.java

@@ -22,12 +22,26 @@ import java.util.List;
 public class ExportFeeDetailDTO {
 
     private Integer index;
-    private String businessNo;
     private String carNo;
     private String feeType;
     private String itemTypeName;
     private String itemName;
+    private Double weight;
+    private Integer num;
+    private BigDecimal unitPrice;
     private BigDecimal itemPrice;
+    private  String settle;
+    private BigDecimal taxRate;
+    private BigDecimal taxPrice;
+    private BigDecimal noTaxPrice;
     private String payType;
+    private String payMode;
+    private String businessNo;
+    private String payTime;
+
+
+
+
+
 
 }

+ 53 - 3
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetails.java

@@ -70,7 +70,7 @@ public class TbFeeDetails implements Serializable {
     private String itemTypeName;
 
 	/**
-	 *  
+	 *  业务项 id
 	 */
     private String itemId;
 
@@ -82,18 +82,22 @@ public class TbFeeDetails implements Serializable {
 	/**
 	 * 项目金额(元) 
 	 */
-    private BigDecimal itemPrice;
+    private BigDecimal itemPrice = new BigDecimal(0);
 
 	/**
 	 * 支付日期 
 	 */
     private String payDay;
 
+
+    private String payTime;
+
 	/**
 	 * 支付方式(3=微信支付) 
 	 */
     private Integer payType;
 
+
 	/**
 	 * 创建时间 
 	 */
@@ -101,12 +105,21 @@ public class TbFeeDetails implements Serializable {
 
     private String businessItemId;
 
+    private String businessItemNo;
+
     private String pickCustomerName;
 
+
+
     /**
      * 不含税款
      */
-    public BigDecimal noTaxPrice = new BigDecimal(0);
+    private BigDecimal noTaxPrice = new BigDecimal(0);
+
+    /**
+     * 税款
+     */
+    private BigDecimal taxPrice = new BigDecimal(0);
 
     /**
      * 税率
@@ -114,6 +127,43 @@ public class TbFeeDetails implements Serializable {
     private BigDecimal taxRate = new BigDecimal(0);
 
 
+    /**
+     * 单价
+     */
+    private BigDecimal unitPrice = new BigDecimal(0);
+
+    /**
+     * 重量
+     */
+    private Double weight;
+
+    /**
+     * 数量
+     */
+    private Integer num;
+
+    /**
+     * 是否结算(0=未结算, 1=已结算)
+     */
+    private Integer isSettle;
+
+    /**
+     * 支付方式(1=直接支付)
+     */
+    private Integer payMode;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 发票
+     */
+    private String invoice;
+
+
+
     @Getter
     @AllArgsConstructor
     //(1=核酸检测,2=消杀作业,3=装卸作业,4=停车费,5=过磅费)

+ 4 - 0
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsMapper.xml

@@ -84,6 +84,10 @@
 			<if test=' this.has("payDay") '> and pay_day = #{payDay} </if>
 			<if test=' this.has("payType") '> and pay_type = #{payType} </if>
 			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
+            <if test=' this.has("beginTime") and this.has("endTime") '>
+                and pay_day >= #{beginTime}
+                and pay_day  &lt;= #{endTime}
+            </if>
 		</where>
 		order by
 		<choose>

+ 21 - 11
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java

@@ -123,6 +123,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
 
     public void chargeParkFee(List<PriceBO> cars) {
         Date now = new Date();
+        String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm:ss");
         String toDay = DateUtil.format(now, "yyyy-MM-dd");
         for (PriceBO bo1 : cars) {
             TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
@@ -135,11 +136,13 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
             }
 
             BigDecimal noTaxPrice = car.getMoney().subtract(car.getMoney().multiply(parkFee.getTaxRate()));
+            BigDecimal taxPrice = car.getMoney().multiply(parkFee.getTaxRate());
             parkFee.setBusinessId(car.getBusinessId()).setBusinessNo(business.getNo())
                     .setCarNo(car.getCarNo())
-                    .setItemPrice(car.getMoney()).setNoTaxPrice(noTaxPrice)
-                    .setFeeType(TbFeeDetails.fee.PARK_FEE.getCode()).setItemTypeName(TbFeeDetails.fee.PARK_FEE.getDesc())
-                    .setPayDay(toDay).setPayType(3).setCreateTime(now);
+                    .setItemPrice(car.getMoney()).setUnitPrice(car.getMoney()).setNoTaxPrice(noTaxPrice).setTaxPrice(taxPrice)
+                    .setFeeType(TbFeeDetails.fee.PARK_FEE.getCode()).setItemTypeName("停车业务")
+                    .setPayDay(toDay).setPayType(3).setCreateTime(now)
+                    .setNum(1).setIsSettle(1).setPayMode(1).setPayTime(nowStr).setWeight(business.getNetWeight());
             saveOrUpdate(parkFee);
         }
     }
@@ -153,7 +156,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
             String itemType = item.getItemTypeName();
             if (itemType.contains("核酸")) {
                 feeType = TbFeeDetails.fee.NUCLEIC_FEE.getCode();
-            } else if (itemType.contains("消毒")) {
+            } else if (itemType.contains("消毒") || itemType.contains("消杀")) {
                 feeType = TbFeeDetails.fee.DISINFECT_FEE.getCode();
             } else if (itemType.contains("装卸")) {
                 feeType = TbFeeDetails.fee.STEVEDORE_FEE.getCode();
@@ -180,10 +183,13 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         }
     }
 
-    public String export(SoMap so) throws Exception {
+    public String export(SoMap so) throws Exception{
+        Date now = new Date();
+        String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm");
         Map<String, String> head = new HashMap<>();
         head.put("time", so.getString("payDay"));
-        List<ExportFeeDetailDTO> exportList = new ArrayList<>();
+        head.put("exportTime", nowStr);
+	    List<ExportFeeDetailDTO> exportList = new ArrayList<>();
         List<TbFeeDetails> list = this.getList(so);
         Integer index = 1;
         for (TbFeeDetails feeDetails : list) {
@@ -192,7 +198,11 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
             detailDTO.setBusinessNo(feeDetails.getBusinessNo()).setCarNo(feeDetails.getCarNo())
                     .setFeeType(feeType).setItemTypeName(feeDetails.getItemTypeName())
                     .setItemName(feeDetails.getItemName()).setItemPrice(feeDetails.getItemPrice())
-                    .setPayType("微信支付").setIndex(index++);
+                    .setPayType("微信支付").setIndex(index++)
+                    .setPayMode("直接收款")
+                    .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());
             exportList.add(detailDTO);
         }
 
@@ -201,15 +211,15 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         String rootPath = UploadUtil.uploadConfig.rootFolder + separator + UploadUtil.uploadConfig.httpPrefix;
         String prefix = myConfig.getDomain() + UploadUtil.uploadConfig.httpPrefix;
         String extPath = "feeDetails" + separator + today + separator;
-        String fileName = "收费登记表_" + today + ".xlsx";
+        String fileName = "收费明细表_" + today + ".xlsx";
         String savePath = rootPath + separator + extPath;
         File saveFIle = new File(savePath);
         if (!saveFIle.exists()) {
             saveFIle.mkdirs();
         }
 
-        ClassPathResource classPathResource = new ClassPathResource("static/day-fee.xlsx");
-        InputStream tempInputStream = classPathResource.getInputStream();
+        ClassPathResource classPathResource = new ClassPathResource("static/day-fee-new.xlsx");
+        InputStream tempInputStream =classPathResource.getInputStream();
 
         ExcelWriter excelWriter = EasyExcel.write(savePath + fileName, ExportFeeDetailDTO.class)
                 .withTemplate(tempInputStream).build();
@@ -217,7 +227,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         excelWriter.fill(exportList, writeSheet);
         excelWriter.fill(head, writeSheet);
         excelWriter.finish();
-        return prefix + "/feeDetails/" + today + "/收费登记表_" + today + ".xlsx";
+        return prefix + "/feeDetails/" + today + "/收费明细表_" + today + ".xlsx";
     }
 
 }

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

@@ -82,6 +82,10 @@
 			<if test=' this.has("taxRate") '> and tax_rate = #{taxRate} </if>
 			<if test=' this.has("noTaxMoney") '> and no_tax_money = #{noTaxMoney} </if>
 			<if test=' this.has("payType") '> and pay_type = #{payType} </if>
+            <if test=' this.has("beginDay") and this.has("endDay") '>
+                and day_time >= #{beginDay}
+                and day_time  &lt;= #{endDay}
+            </if>
 		</where>
 		order by
 		<choose>
@@ -107,6 +111,10 @@
         <where>
             <if test=' this.has("feeType") '> and fee_type = #{feeType} </if>
             <if test=' this.has("month") '> and month = #{month} </if>
+            <if test=' this.has("beginMonth") and this.has("endMonth") '>
+                and month >= #{beginMonth}
+                and month  &lt;= #{endMonth}
+            </if>
         </where>
         group by month, fee_type
         order by month desc

+ 15 - 6
sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsService.java

@@ -112,7 +112,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
         TbFeeStatistics parkFee = this.getByDayAndFeeType(toDay, TbFeeStatistics.feeType.PARK_FEE.getCode());
         if (parkFee == null) {
             parkFee = new TbFeeStatistics();
-            parkFee.setTaxRate(partConfig.getTaxRate());
+            parkFee.setTaxRate(new BigDecimal(TbFeeStatistics.taxRate.PARK.getValue()));
         }
         for (PriceBO bo1 : cars) {
             BigDecimal price = bo1.getP();
@@ -133,6 +133,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
     //@Async
     public void countBusinessFee(List<TbBusinessItem> items) {
         Date now = new Date();
+        String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm:ss");
         String toDay = DateUtil.format(now, "yyyy-MM-dd");
         String thisYear = StrUtil.sub(toDay, 0, 4);
         String thisMonth = StrUtil.sub(toDay, 0, 7);
@@ -141,7 +142,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
             String itemType = item.getItemTypeName();
             if (itemType.contains("核酸")) {
                 feeType = TbFeeStatistics.feeType.NUCLEIC_FEE.getCode();
-            } else if (itemType.contains("消毒")) {
+            } else if (itemType.contains("消毒") || itemType.contains("消杀")) {
                 feeType = TbFeeStatistics.feeType.DISINFECT_FEE.getCode();
             } else if (itemType.contains("装卸")) {
                 feeType = TbFeeStatistics.feeType.STEVEDORE_FEE.getCode();
@@ -162,7 +163,8 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
             BigDecimal noTaxMoney = businessFee.getTaxMoney().subtract(businessFee.getTaxMoney().multiply(businessFee.getTaxRate()));
             businessFee.setNoTaxMoney(noTaxMoney);
             businessFee.setDayTime(now).setMonth(thisMonth).setYear(thisYear).setDay(toDay)
-                    .setFeeType(feeType).setItemTypeName(itemType)
+                    .setFeeType(feeType)
+                    //.setItemTypeName(itemType)
                     .setPayType(3);
             this.saveOrUpdate(businessFee);
             /*-----------------分割线------------------*/
@@ -175,15 +177,22 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
             }
 
             BigDecimal noTaxPrice = item.getItemPrice().subtract(item.getItemPrice().multiply(businessFeeDetail.getTaxRate()));
+            BigDecimal taxPrice = item.getItemPrice().multiply(businessFeeDetail.getTaxRate());
+            String carNo = business.getCardNo();
+            if(StrUtil.isEmpty(business.getCardNo())){
+                carNo = business.getChinaCarNo();
+            }
             businessFeeDetail.setBusinessId(item.getBusinessId()).setBusinessNo(business.getNo())
-                    .setCarNo(business.getCardNo())
-                    .setItemPrice(item.getItemPrice()).setNoTaxPrice(noTaxPrice)
+                    .setBusinessItemNo(item.getNo())
+                    .setCarNo(carNo)
+                    .setItemPrice(item.getItemPrice()).setUnitPrice(item.getItemPrice()).setNoTaxPrice(noTaxPrice).setTaxPrice(taxPrice)
                     .setFeeType(feeType)
                     .setItemTypeId(item.getItemTypeId()).setItemTypeName(item.getItemTypeName())
                     .setItemId(item.getItemId()).setItemName(item.getItemName())
                     .setPayDay(toDay).setPayType(3).setCreateTime(now)
                     .setBusinessItemId(item.getId() + "")
-                    .setPickCustomerName(item.getPickCustomerName());
+                    .setPickCustomerName(item.getPickCustomerName())
+                    .setNum(1).setIsSettle(1).setPayMode(1).setPayTime(nowStr).setWeight(business.getNetWeight());
             tbFeeDetailsService.saveOrUpdate(businessFeeDetail);
         }
     }

BIN
sp-server/src/main/resources/static/day-fee-new.xlsx