lzm %!s(int64=3) %!d(string=hai) anos
pai
achega
15f5f81724

+ 1 - 0
sp-admin/sa-frame/menu-list.js

@@ -147,6 +147,7 @@ var menuList =	[
 		icon: 'el-icon-folder-opened',
 		info: '收费统计表表数据的维护',
 		childList: [
+			{id: 'tb-fee-details-list', name: '收费明细', url: 'sa-view/tb-fee-statistics/tb-fee-details-list.html'},
 			{id: 'tb-fee-statistics-list', name: '日统计', url: 'sa-view/tb-fee-statistics/tb-fee-statistics-list.html'},
 			{id: 'month-statistcs.html', name: '月统计', url: 'sa-view/tb-fee-statistics/month-statistcs.html'},
 			{id: 'year-statistcs.html', name: '年统计', url: 'sa-view/tb-fee-statistics/year-statistcs.html'},

+ 1 - 0
sp-admin/sa-view/tb-fee-statistics/month-statistcs.html

@@ -49,6 +49,7 @@
             <sa-td name="收费类型" prop="feeType" type="enum"
                    :jv="{1: '核酸检测',2: '消杀作业', 3: '装卸作业', 4: '停车费', 5: '过磅费', 6: '入场管理费'}"></sa-td>
             <sa-td name="月份" prop="month" ></sa-td>
+            <sa-td name="数量" prop="num" ></sa-td>
             <sa-td name="收入(元)" prop="statisticsMoney"></sa-td>
             <!--					<el-table-column label="操作" fixed="right"  width="240px">-->
             <!--						<template slot-scope="s">-->

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

@@ -0,0 +1,131 @@
+<!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="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="https://unpkg.com/vue@2.6.10/dist/vue.js"></script>
+		<script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
+		<script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
+		<script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
+		<script src="https://www.layuicdn.com/layer-v3.1.1/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>
+					<div class="c-item">
+						<label class="c-label">业务类型:</label>
+						<el-select v-model="p.itemTypeName" placeholder="请选择" filterable>
+							<el-option v-for="item in itemTypeList" :key="item.id"
+									   :label="item.name" :value="item.name">
+							</el-option>
+						</el-select>
+					</div>
+					<div class="c-item">
+						<label class="c-label">日期:</label>
+						<el-date-picker type="date" value-format="yyyy-MM-dd" v-model="p.payDay"></el-date-picker>
+					</div>
+					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
+					<br />
+				</el-form>
+				<!-- ------------- 快捷按钮 ------------- -->
+				<sa-item type="fast-btn" show="reset"></sa-item>
+				<!-- ------------- 数据列表 ------------- -->
+				<el-table class="data-table" ref="data-table" :data="dataList" >
+					<sa-td type="selection"></sa-td>
+					<sa-td name="业务单号" prop="businessNo" ></sa-td>
+					<sa-td name="车牌号" prop="carNo" ></sa-td>
+					<sa-td name="收费类型" prop="feeType" type="enum"
+						   :jv="{1: '核酸检测',2: '消杀作业', 3: '装卸作业', 4: '停车费', 5: '过磅费', 6: '入场管理费'}"></sa-td>
+					<sa-td name="业务类型" prop="itemTypeName" ></sa-td>
+					<sa-td name="业务项" prop="itemName" ></sa-td>
+					<sa-td name="项目金额" prop="itemPrice" ></sa-td>
+					<sa-td name="支付日期" prop="payDay" ></sa-td>
+					<sa-td name="支付方式" prop="payType" type="enum" :jv="{3: '微信支付'}"></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)">查看</el-button>-->
+<!--							<el-button class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>-->
+<!--							<el-button 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: {
+					p: { // 查询参数  
+						id: '',		// 主键 
+						businessNo: '',		// 业务单号 
+						carNo: '',		// 车牌号 
+						itemTypeId: '',		// 业务类型id 
+						itemTypeName: '',		// 业务类型 
+						itemId: '',		//  
+						itemName: '',		// 业务项 
+						itemPrice: '',		// 项目金额(元) 
+						payDay: '',		// 支付日期 
+						payType: '',		// 支付方式(3=微信支付) 
+						createTime: '',		// 创建时间 
+						pageNo: 1,		// 当前页 
+						pageSize: 10,	// 页大小 
+						sortType: 0		// 排序方式 
+					},
+					dataCount: 0,
+					dataList: [], // 数据集合
+					itemTypeList: [],
+				},
+				methods: {
+					// 刷新
+					f5: function() {
+						sa.ajax('/TbFeeDetails/getList', sa.removeNull(this.p), function(res) {
+							this.dataList = res.data; // 数据
+							this.dataCount = res.dataCount; // 数据总数 
+							sa.f5TableHeight();		// 刷新表格高度 
+						}.bind(this));
+					},
+					// 查看
+					get: function(data) {
+						sa.showIframe('数据详情', 'tb-fee-details-info.html?id=' + data.id, '1050px', '90%');
+					},
+					// 查看 - 根据选中的
+					getBySelect: function(data) {
+						var selection = this.$refs['data-table'].selection;
+						if(selection.length == 0) {
+							return sa.msg('请选择一条数据')
+						}
+						this.get(selection[0]);
+					},
+					getItemTypeList() {
+						sa.ajax('/TbItemType/getList', {
+							pageNo: 1,
+							pageSize: 100
+						}, function(resp) {
+							this.itemTypeList = resp.data;
+						}.bind(this));
+					},
+
+				},
+				created: function() {
+					this.f5();
+					this.getItemTypeList();
+					sa.onInputEnter();
+				}
+			})
+		</script>
+	</body>
+</html>

+ 1 - 0
sp-admin/sa-view/tb-fee-statistics/year-statistcs.html

@@ -49,6 +49,7 @@
             <sa-td name="收费类型" prop="feeType" type="enum"
                    :jv="{1: '核酸检测',2: '消杀作业', 3: '装卸作业', 4: '停车费', 5: '过磅费', 6: '入场管理费'}"></sa-td>
             <sa-td name="年份" prop="year"></sa-td>
+            <sa-td name="数量" prop="num" ></sa-td>
             <sa-td name="收入(元)" prop="statisticsMoney"></sa-td>
                 <!--					<el-table-column label="操作" fixed="right"  width="240px">-->
                 <!--						<template slot-scope="s">-->

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

@@ -24,6 +24,7 @@ import com.pj.project.tb_business_item.TbBusinessItem;
 import com.pj.project.tb_business_item.TbBusinessItemService;
 import com.pj.project.tb_costomer.TbCostomer;
 import com.pj.project.tb_costomer.TbCostomerService;
+import com.pj.project.tb_fee_details.TbFeeDetailsService;
 import com.pj.project.tb_fee_statistics.TbFeeStatisticsService;
 import com.pj.project.tb_pay_record.TbPayRecord;
 import com.pj.project.tb_pay_record.TbPayRecordService;
@@ -66,6 +67,8 @@ public class WxService {
     TbBusinessItemService tbBusinessItemService;
     @Resource
     TbFeeStatisticsService tbFeeStatisticsService;
+    @Resource
+    TbFeeDetailsService tbFeeDetailsService;
 
     /**
      * 统一下单接口
@@ -170,7 +173,7 @@ public class WxService {
         if (StrUtil.isNotEmpty(attachStr)) {
             Attach attach = JSONUtil.toBean(attachStr, Attach.class);
             List<PriceBO> cars = JSONUtil.toList(attach.getC(), PriceBO.class);
-            tbFeeStatisticsService.countParkFee(cars);
+            tbFeeStatisticsService.countParkFee(cars);//停车费日统计
             for (PriceBO bo1 : cars) {
                 TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
                 BigDecimal price = bo1.getP();
@@ -181,10 +184,11 @@ public class WxService {
                 business.setPayStatus(business.getPayMoney().equals(business.getTotalMoney()) ? 3 : 4);
                 tbBusinessService.updateById(business);
             }
+            tbFeeDetailsService.chargeParkFee(cars);//添加cars的收费明细
             String businessId = attach.getB();
             if (StrUtil.isNotEmpty(businessId)) {
                 List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(businessId);
-                tbFeeStatisticsService.countBusinessFee(items);
+                tbFeeStatisticsService.countBusinessFee(items);//业务费日统计
                 items.forEach(tbBusinessItem -> tbBusinessItem.setPayStatus(1).setPayTime(now));
                 tbBusinessItemService.updateBatchById(items);
                 TbBusiness tbBusiness = tbBusinessService.getById(businessId);

+ 121 - 0
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetails.java

@@ -0,0 +1,121 @@
+package com.pj.project.tb_fee_details;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_fee_details -- 收费明细表
+ * @author lzm 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbFeeDetails.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbFeeDetails implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_fee_details";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-fee-details";	
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 主键 
+	 */
+	public String id;
+
+    public String businessId;
+
+	/**
+	 * 业务单号 
+	 */
+	public String businessNo;	
+
+	/**
+	 * 车牌号 
+	 */
+	public String carNo;
+
+    /**
+     * 收费类型
+     */
+    public Integer feeType;
+
+    /**
+	 * 业务类型id 
+	 */
+	public String itemTypeId;
+
+	/**
+	 * 业务类型 
+	 */
+	public String itemTypeName;	
+
+	/**
+	 *  
+	 */
+	public String itemId;
+
+	/**
+	 * 业务项 
+	 */
+	public String itemName;	
+
+	/**
+	 * 项目金额(元) 
+	 */
+	public BigDecimal itemPrice;
+
+	/**
+	 * 支付日期 
+	 */
+	public String payDay;	
+
+	/**
+	 * 支付方式(3=微信支付) 
+	 */
+	public Integer payType;
+
+	/**
+	 * 创建时间 
+	 */
+	public Date createTime;
+
+
+    @Getter
+    @AllArgsConstructor
+    //(1=核酸检测,2=消杀作业,3=装卸作业,4=停车费,5=过磅费)
+    public static enum fee{
+        NUCLEIC_FEE(1,"核酸检测"),
+        DISINFECT_FEE(2,"消杀作业"),
+        STEVEDORE_FEE(3,"装卸作业"),
+        PARK_FEE(4,"停车费"),
+        WEIGHT_FEE(5,"过磅费"),
+        MANAGE_FEE(6, "入场管理费");
+        private int code;
+        private String desc;
+    }
+
+
+	
+
+
+}

+ 105 - 0
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsController.java

@@ -0,0 +1,105 @@
+package com.pj.project.tb_fee_details;
+
+import java.util.List;
+
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import com.pj.utils.sg.*;
+import com.pj.project4sp.SP;
+
+import com.pj.current.satoken.StpUserUtil;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+
+
+/**
+ * Controller: tb_fee_details -- 收费明细表
+ * @author lzm 
+ */
+@RestController
+@RequestMapping("/TbFeeDetails/")
+public class TbFeeDetailsController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbFeeDetailsService tbFeeDetailsService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@SaCheckPermission(TbFeeDetails.PERMISSION_CODE)
+	@Transactional(rollbackFor = Exception.class)
+	public AjaxJson add(TbFeeDetails t){
+		tbFeeDetailsService.add(t);
+		t = tbFeeDetailsService.getById(SP.publicMapper.getPrimarykey());
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	@SaCheckPermission(TbFeeDetails.PERMISSION_CODE)
+	public AjaxJson delete(Long id){
+		int line = tbFeeDetailsService.delete(id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	@SaCheckPermission(TbFeeDetails.PERMISSION_CODE)
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+		int line = SP.publicMapper.deleteByIds(TbFeeDetails.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	@SaCheckPermission(TbFeeDetails.PERMISSION_CODE)
+	public AjaxJson update(TbFeeDetails t){
+		int line = tbFeeDetailsService.update(t);
+		return AjaxJson.getByLine(line);
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+	public AjaxJson getById(Long id){
+		TbFeeDetails t = tbFeeDetailsService.getById(id);
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	@RequestMapping("getList")
+	public AjaxJson getList() { 
+		SoMap so = SoMap.getRequestSoMap();
+		List<TbFeeDetails> list = tbFeeDetailsService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+	
+	
+	
+	
+	// ------------------------- 前端接口 -------------------------
+	
+	
+	/** 改 - 不传不改 [G] */
+	@RequestMapping("updateByNotNull")
+	public AjaxJson updateByNotNull(Long id){
+		AjaxError.throwBy(true, "如需正常调用此接口,请删除此行代码");
+		// 鉴别身份,是否为数据创建者 
+		long userId = SP.publicMapper.getColumnByIdToLong(TbFeeDetails.TABLE_NAME, "user_id", id);
+		AjaxError.throwBy(userId != StpUserUtil.getLoginIdAsLong(), "此数据您无权限修改");
+		// 开始修改 (请只保留需要修改的字段)
+		SoMap so = SoMap.getRequestSoMap();
+		so.clearNotIn("id", "businessNo", "carNo", "itemTypeId", "itemTypeName", "itemId", "itemName", "itemPrice", "payDay", "payType", "createTime").clearNull().humpToLineCase();	
+		int line = SP.publicMapper.updateBySoMapById(TbFeeDetails.TABLE_NAME, so, id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	
+	
+	
+	
+	
+
+}

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

@@ -0,0 +1,56 @@
+package com.pj.project.tb_fee_details;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+import com.pj.utils.so.*;
+import org.springframework.stereotype.Repository;
+
+/**
+ * Mapper: tb_fee_details -- 收费明细表
+ * @author lzm 
+ */
+
+@Mapper
+@Repository
+public interface TbFeeDetailsMapper extends BaseMapper<TbFeeDetails> {
+
+	/**
+	 * 增  
+	 * @param t 实体对象 
+	 * @return 受影响行数 
+	 */
+	int add(TbFeeDetails t);
+
+	/**
+	 * 删  
+	 * @param id 要删除的数据id  
+	 * @return 受影响行数 
+	 */
+	int delete(Long id);	 
+
+	/** 
+	 * 改  
+	 * @param t 实体对象 
+	 * @return 受影响行数 
+	 */
+	int update(TbFeeDetails t);
+
+	/** 
+	 * 查 - 根据id  
+	 * @param id 要查询的数据id 
+	 * @return 实体对象 
+	 */
+	TbFeeDetails getById(Long id);	 
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<TbFeeDetails> getList(SoMap so);
+
+
+}

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

@@ -0,0 +1,114 @@
+<?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_details.TbFeeDetailsMapper">
+
+	<!-- 增 [G] -->
+	<insert id="add">
+		insert into 
+		tb_fee_details (id, business_id, business_no, car_no, fee_type, item_type_id, item_type_name, item_id, item_name, item_price, pay_day, pay_type, create_time)
+		values (#{id}, #{businessId}, #{businessNo}, #{carNo}, #{feeType}, #{itemTypeId}, #{itemTypeName}, #{itemId}, #{itemName}, #{itemPrice}, #{payDay}, #{payType}, #{createTime})
+	</insert>
+
+	<!-- 删 -->
+	<delete id="delete">
+		delete from tb_fee_details 
+		where id = #{id}
+	</delete>
+
+	<!-- 改 [G] -->
+	<update id="update">
+		update tb_fee_details set
+		id = #{id},
+		business_id = #{businessId},
+		business_no = #{businessNo}, 
+		car_no = #{carNo},
+		fee_type = #{feeType},
+		item_type_id = #{itemTypeId}, 
+		item_type_name = #{itemTypeName}, 
+		item_id = #{itemId}, 
+		item_name = #{itemName}, 
+		item_price = #{itemPrice}, 
+		pay_day = #{payDay}, 
+		pay_type = #{payType}, 
+		create_time = #{createTime}
+		where id = #{id}
+	</update>
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, business_no, car_no, item_type_id, item_type_name, item_id, item_name, item_price, pay_day, pay_type, create_time from tb_fee_details  -->
+	
+	<!-- 通用映射:手动模式 -->
+	<resultMap id="model" type="com.pj.project.tb_fee_details.TbFeeDetails">
+		<result property="id" column="id" />
+        <result property="businessId" column="business_id" />
+		<result property="businessNo" column="business_no" />
+		<result property="carNo" column="car_no" />
+        <result property="feeType" column="fee_type" />
+		<result property="itemTypeId" column="item_type_id" />
+		<result property="itemTypeName" column="item_type_name" />
+		<result property="itemId" column="item_id" />
+		<result property="itemName" column="item_name" />
+		<result property="itemPrice" column="item_price" />
+		<result property="payDay" column="pay_day" />
+		<result property="payType" column="pay_type" />
+		<result property="createTime" column="create_time" />
+	</resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select * 
+		from tb_fee_details 
+	</sql>
+	
+	<!-- 查 - 根据id -->
+	<select id="getById" resultMap="model">
+		<include refid="select_sql"></include>
+		where id = #{id}
+	</select>
+	
+	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+	<select id="getList" resultMap="model">
+		<include refid="select_sql"></include>
+		<where>
+			<if test=' this.has("id") '> and id = #{id} </if>
+            <if test=' this.has("businessId") '> and business_id = #{businessId} </if>
+			<if test=' this.has("businessNo") '> and business_no = #{businessNo} </if>
+			<if test=' this.has("carNo") '> and car_no = #{carNo} </if>
+            <if test=' this.has("feeType") '> and fee_type = #{feeType} </if>
+			<if test=' this.has("itemTypeId") '> and item_type_id = #{itemTypeId} </if>
+			<if test=' this.has("itemTypeName") '> and item_type_name = #{itemTypeName} </if>
+			<if test=' this.has("itemId") '> and item_id = #{itemId} </if>
+			<if test=' this.has("itemName") '> and item_name = #{itemName} </if>
+			<if test=' this.has("itemPrice") '> and item_price = #{itemPrice} </if>
+			<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>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> business_no desc </when>
+			<when test='sortType == 3'> car_no desc </when>
+			<when test='sortType == 4'> item_type_id desc </when>
+			<when test='sortType == 5'> item_type_name desc </when>
+			<when test='sortType == 6'> item_id desc </when>
+			<when test='sortType == 7'> item_name desc </when>
+			<when test='sortType == 8'> item_price desc </when>
+			<when test='sortType == 9'> pay_day desc </when>
+			<when test='sortType == 10'> pay_type desc </when>
+			<when test='sortType == 11'> create_time desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

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

@@ -0,0 +1,139 @@
+package com.pj.project.tb_fee_details;
+
+import java.util.Date;
+import java.util.List;
+
+import cn.hutool.core.date.DateUtil;
+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.api.wx.bo.PriceBO;
+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.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import com.pj.utils.sg.*;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+/**
+ * Service: tb_fee_details -- 收费明细表
+ * @author lzm 
+ */
+@Service
+@Transactional
+public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDetails> implements IService<TbFeeDetails> {
+
+	/** 底层 Mapper 对象 */
+	@Autowired
+	TbFeeDetailsMapper tbFeeDetailsMapper;
+	@Resource
+    TbBusinessCarService tbBusinessCarService;
+    @Resource
+    TbBusinessService tbBusinessService;
+
+	/** 增 */
+	int add(TbFeeDetails t){
+		return tbFeeDetailsMapper.add(t);
+	}
+
+	/** 删 */
+	int delete(Long id){
+		return tbFeeDetailsMapper.delete(id);
+	}
+
+	/** 改 */
+	int update(TbFeeDetails t){
+		return tbFeeDetailsMapper.update(t);
+	}
+
+	/** 查 */
+	TbFeeDetails getById(Long id){
+		return tbFeeDetailsMapper.getById(id);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	List<TbFeeDetails> getList(SoMap so) {
+		return tbFeeDetailsMapper.getList(so);	
+	}
+
+    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 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);
+    }
+
+
+	public void chargeParkFee(List<PriceBO> cars){
+        Date now = new Date();
+        String toDay = DateUtil.format(now, "yyyy-MM-dd");
+        for (PriceBO bo1 : cars) {
+            TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
+            TbBusiness business = tbBusinessService.getById(car.getBusinessId());
+            String carNo = car.getCarNo();
+            TbFeeDetails parkFee = getByBusinessIdAndCarNoAndFeeType(car.getBusinessId(), carNo, TbFeeDetails.fee.PARK_FEE.getCode());
+            if(parkFee == null){
+                parkFee = new TbFeeDetails();
+            }
+            parkFee.setBusinessId(car.getBusinessId()).setBusinessNo(business.getNo())
+                    .setCarNo(car.getCarNo())
+                    .setItemPrice(car.getMoney())
+                    .setFeeType(TbFeeDetails.fee.PARK_FEE.getCode()).setItemTypeName(TbFeeDetails.fee.PARK_FEE.getDesc())
+                    .setPayDay(toDay).setPayType(3).setCreateTime(now);
+            saveOrUpdate(parkFee);
+        }
+    }
+
+    @Async
+    public void chargeBusinessFee(List<TbBusinessItem> items){
+        Date now = new Date();
+        String toDay = DateUtil.format(now, "yyyy-MM-dd");
+        for (TbBusinessItem item : items) {
+            int feeType = -1;
+            String itemType = item.getItemTypeName();
+            if(itemType.contains("核酸")){
+                feeType = TbFeeDetails.fee.NUCLEIC_FEE.getCode();
+            } else if(itemType.contains("消毒")){
+                feeType = TbFeeDetails.fee.DISINFECT_FEE.getCode();
+            } else if(itemType.contains("装卸")){
+                feeType = TbFeeDetails.fee.STEVEDORE_FEE.getCode();
+            } else if(StrUtil.equals(itemType, "特殊车辆") || StrUtil.equals(itemType, "充电打冷") || StrUtil.equals(itemType, "汽车吊" )){
+                feeType = TbFeeDetails.fee.STEVEDORE_FEE.getCode();
+            } else if(itemType.contains("入场管理")){
+                feeType = TbFeeDetails.fee.MANAGE_FEE.getCode();
+            }
+            TbBusiness business = tbBusinessService.getById(item.getBusinessId());
+            TbFeeDetails businessFee = getByBusinessIdAndCarNoAndItemType(item.getBusinessId(), business.getCardNo(), item.getItemTypeId());
+            if(businessFee == null){
+                businessFee = new TbFeeDetails();
+            }
+            businessFee.setBusinessId(item.getBusinessId()).setBusinessNo(business.getNo())
+                    .setCarNo(business.getCardNo())
+                    .setItemPrice(item.getItemPrice())
+                    .setFeeType(feeType)
+                    .setItemTypeId(item.getItemTypeId()).setItemTypeName(item.getItemTypeName())
+                    .setItemId(item.getItemId()).setItemName(item.getItemName())
+                    .setPayDay(toDay).setPayType(3).setCreateTime(now);
+            saveOrUpdate(businessFee);
+        }
+    }
+
+}

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

@@ -5,8 +5,10 @@ import java.math.BigDecimal;
 import java.util.Date;
 
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.AllArgsConstructor;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.experimental.Accessors;
 
@@ -16,6 +18,8 @@ import lombok.experimental.Accessors;
  */
 @Data
 @Accessors(chain = true)
+@TableName(TbFeeStatistics.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
 public class TbFeeStatistics implements Serializable {
 
 	// ---------- 模块常量 ----------

+ 35 - 2
sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsService.java

@@ -11,24 +11,40 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.pj.api.wx.bo.PriceBO;
+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_fee_details.TbFeeDetails;
+import com.pj.project.tb_fee_details.TbFeeDetailsService;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
 import com.pj.utils.sg.*;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
 
 /**
  * Service: tb_fee_statistics -- 收费统计表
  * @author lzm 
  */
 @Service
+@Transactional
 public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, TbFeeStatistics> implements IService<TbFeeStatistics> {
 
 	/** 底层 Mapper 对象 */
 	@Autowired
 	TbFeeStatisticsMapper tbFeeStatisticsMapper;
+	@Resource
+    TbBusinessCarService tbBusinessCarService;
+	@Resource
+    TbBusinessService tbBusinessService;
+    @Resource
+    TbFeeDetailsService tbFeeDetailsService;
 
 	/** 增 */
 	int add(TbFeeStatistics t){
@@ -84,7 +100,8 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
         }
         for (PriceBO bo1 : cars) {
             BigDecimal price = bo1.getP();
-            if(price.compareTo(new BigDecimal(30)) == 0){
+            TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
+            if(car.getMoney().compareTo(new BigDecimal(0)) == 0){
                 parkFee.setNum(parkFee.getNum() + 1);
             }
             parkFee.setTaxMoney(parkFee.getTaxMoney().add(price));
@@ -103,8 +120,8 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
         String toDay = DateUtil.format(now, "yyyy-MM-dd");
         String thisYear = StrUtil.sub(toDay, 0, 4);
         String thisMonth = StrUtil.sub(toDay, 0, 7);
-        int feeType = -1;
         for (TbBusinessItem item : items) {
+            int feeType = -1;
             String itemType = item.getItemTypeName();
             if(itemType.contains("核酸")){
                 feeType = TbFeeStatistics.feeType.NUCLEIC_FEE.getCode();
@@ -130,7 +147,23 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
                     .setFeeType(feeType).setItemTypeName(itemType)
                     .setPayType(3);
             this.saveOrUpdate(businessFee);
+            /*-----------------分割线------------------*/
+            //添加此item的收费明细
+            TbBusiness business = tbBusinessService.getById(item.getBusinessId());
+            TbFeeDetails businessFeeDetail = tbFeeDetailsService.getByBusinessIdAndCarNoAndItemType(item.getBusinessId(), business.getCardNo(), item.getItemTypeId());
+            if(businessFeeDetail == null){
+                businessFeeDetail = new TbFeeDetails();
+            }
+            businessFeeDetail.setBusinessId(item.getBusinessId()).setBusinessNo(business.getNo())
+                    .setCarNo(business.getCardNo())
+                    .setItemPrice(item.getItemPrice())
+                    .setFeeType(feeType)
+                    .setItemTypeId(item.getItemTypeId()).setItemTypeName(item.getItemTypeName())
+                    .setItemId(item.getItemId()).setItemName(item.getItemName())
+                    .setPayDay(toDay).setPayType(3).setCreateTime(now);
+            tbFeeDetailsService.saveOrUpdate(businessFeeDetail);
         }
     }
 
+
 }