Browse Source

增加越南车放行记录,h5客户管理调整

lzm 3 years ago
parent
commit
58e0d0986b

+ 11 - 16
app/pages/customer-management/customer-management.vue

@@ -48,7 +48,7 @@
 		<noData v-if="customerItemList.length==0"></noData>
 		<u-loadmore style="margin: 30rpx;" :status="status" />
 		<uni-popup ref="shpopup" type="center">
-			<uni-popup-dialog type="success" title="确定审核吗?" :duration="2000" @confirm="shconfirm"></uni-popup-dialog>
+			<uni-popup-dialog mode="input" type="success" title="确定审核吗?" placeholder="请输审核意见" :duration="2000" @confirm="shconfirm"></uni-popup-dialog>
 		</uni-popup>
 
 	</view>
@@ -77,14 +77,7 @@
 						name: '禁用',
 					}
 				],
-				customerItemList: [{
-					name: '',
-					dutyPeople: '',
-					phone: '',
-					businessLicence: '',
-					judgeStatus: '',
-					btnShow: 0
-				}, ],
+				customerItemList: [],
 				confirmCustomerId: '',
 				judgeContent: '',
 				perList: []
@@ -100,7 +93,6 @@
 					dataCount: this.dataCount,
 				}).then(resp => {
 					let customerList = resp.data;
-					//todo 还要判断当前用户是否为admin
 					for (let i in customerList) {
 						if (customerList[i].judgeStatus == 1) {
 							customerList[i].btnShow = 1;
@@ -114,7 +106,8 @@
 			},
 			confirmCustomer() {
 				this.$api.confirmCustomer({
-					customerId: this.confirmCustomerId
+					customerId: this.confirmCustomerId,
+					judgeContent: this.judgeContent,
 				}).then(resp => {
 					if (resp.code == 200) {
 						this.getCustomerList();
@@ -145,7 +138,8 @@
 				this.confirmCustomerId = id;
 				this.$refs.shpopup.open('center')
 			},
-			shconfirm(index) {
+			shconfirm(val) {
+				this.judgeContent = val;
 				this.confirmCustomer();
 				this.$refs.shpopup.close()
 			},
@@ -153,20 +147,21 @@
 			addCustomer() {
 				this.$common.to("/pages/enterprise-reg/enterprise-reg");
 			},
-
+				
 			//------------------------------------------
 			//上拉加载更多,分页模拟数据
 			onReachBottom() {
-				this.status = 'loading';
+				console.log("上拉");
 				if (this.dataCount > this.pageSize * this.pageNo) {
+					this.status = 'loading';
 					this.pageSize = parseInt(this.pageSize) + 3;
 					this.getCustomerList();
 				} else {
 					this.status = 'nomore';
 				}
-			}
+			},
 		},
-		onLoad() {
+		mounted() {
 			this.getCustomerList();
 		},
 		onShow() {

+ 7 - 6
app/pages/inout-record/inout-record.vue

@@ -26,13 +26,13 @@
 						<text class="p1">联系电话:</text>
 						<text class="p2">{{recordItem.customerContact}}</text>
 					</view>
-					<view class="item" v-if="recordItem.realInTime != null">
+					<view class="item" v-if="recordItem.inTime != null">
 						<text class="p1">入场时间:</text>
-						<text class="p2">{{recordItem.realInTime}}</text>
+						<text class="p2">{{recordItem.inTime}}</text>
 					</view>
-					<view class="item" v-if="recordItem.outDayTime != null">
+					<view class="item" v-if="recordItem.outTime != null">
 						<text class="p1">出场时间:</text>
-						<text class="p2">{{recordItem.outDayTime}}</text>
+						<text class="p2">{{recordItem.outTime}}</text>
 					</view>
 					<view class="item">
 						<text class="p1">状态:</text>
@@ -82,10 +82,11 @@
 					{
 						customerName:'',
 						cardNo:'',
+						carCountryName: '',
 						dutyPeople:'',
 						customerContact:'',
-						realInTime:'',
-						outDayTime:'',
+						inTime:'',
+						outTime:'',
 						status:''
 					},
 				],

+ 1 - 1
sp-admin/sa-view/tb-costomer/tb-costomer-list.html

@@ -176,7 +176,7 @@
 					},
 					// 查看
 					get: function(data) {
-						sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '800px', '60%');
+						sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '800px', '80%');
 					},
 					// 查看 - 根据选中的
 					getBySelect: function(data) {

+ 1 - 1
sp-admin/sa-view/tb-costomer/tb-costomer-maintain.html

@@ -104,7 +104,7 @@
       },
       // 查看
       get: function(data) {
-        sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '800px', '60%');
+        sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '800px', '80%');
       },
       // 查看 - 根据选中的
       getBySelect: function(data) {

+ 3 - 1
sp-admin/sa-view/tb-pass-record/tb-pass-record-list.html

@@ -36,6 +36,7 @@
 <!--					<sa-td name="客户id" prop="customerId" ></sa-td>-->
 					<sa-td name="企业名称" prop="customerName" ></sa-td>
 					<sa-td name="车牌号码" prop="cardNo" ></sa-td>
+					<sa-td name="车牌国籍" prop="carCountryName" ></sa-td>
 					<sa-td name="入场时间" prop="inTime" ></sa-td>
 					<sa-td name="出场时间" prop="outTime" ></sa-td>
 					<sa-td name="状态" prop="status" type="enum" :jv="{1: '未入场', 2: '已入场', 3: '已出场'}"></sa-td>
@@ -63,7 +64,8 @@
 						businessId: '',		// 业务id 
 						customerId: '',		// 客户id 
 						customerName: '',		// 客户名称 
-						cardNo: '',		// 车牌号 
+						cardNo: '',		// 车牌号
+						carCountryName: '',	//车牌国籍
 						status: '',		// 状态(=未入场, 2=已入场, 3=已出场) 
 						inTime: '',		// 进境时间 
 						outTime: '',		// 离境时间 

+ 8 - 2
sp-server/src/main/java/com/pj/api/bo/InOutRecordBO.java

@@ -6,6 +6,7 @@ import lombok.experimental.Accessors;
 import java.util.Date;
 
 /**
+ * 出入记录
  */
 @Data
 @Accessors(chain = true)
@@ -28,14 +29,19 @@ public class InOutRecordBO {
     private String cardNo;
 
     /**
+     * 车牌国籍
+     */
+    private String carCountryName;
+
+    /**
      * 实际进境时间
      */
-    private Date realInTime;
+    private Date inTime;
 
     /**
      * 离境时间
      */
-    private Date outDayTime;
+    private Date outTime;
 
     /**
      * 状态(1=未入场, 2=已入场, 3=已出场)

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

@@ -77,8 +77,8 @@ public class ApiController {
     }
 
     @PostMapping(value = "confirmCustomer")
-    public AjaxJson confirmCustomer(Long customerId){
-        apiService.confirmCustomer(customerId);
+    public AjaxJson confirmCustomer(Long customerId, String judgeContent){
+        apiService.confirmCustomer(customerId, judgeContent);
         return AjaxJson.getSuccess();
     }
     @PostMapping(value = "confirm")

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

@@ -6,6 +6,8 @@ import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
 import com.pj.project.tb_costomer.TbCostomer;
 import com.pj.project.tb_costomer.TbCostomerService;
+import com.pj.project.tb_pass_record.TbPassRecord;
+import com.pj.project.tb_pass_record.TbPassRecordService;
 import com.pj.utils.so.SoMap;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -27,22 +29,17 @@ public class ApiService {
     TbCostomerService tbCostomerService;
     @Resource
     TbBusinessService tbBusinessService;
+    @Resource
+    TbPassRecordService tbPassRecordService;
 
     public List<InOutRecordBO> getInOutRecord(SoMap so){
-        List<TbBusiness> businessList = tbBusinessService.getList(so);
+        List<TbPassRecord> passRecords = tbPassRecordService.getList(so);
         List<InOutRecordBO> recordList = new ArrayList<>();
-        for (TbBusiness business : businessList) {
+        for (TbPassRecord passRecord : passRecords) {
             InOutRecordBO record = new InOutRecordBO();
-            BeanUtil.copyProperties(business, record);
-            TbCostomer costomer = tbCostomerService.getById(business.getCustomerId());
-            record.setBusinessId(business.getId()).setCustomerContact(costomer.getPhone()).setDutyPeople(costomer.getDutyPeople());
-            if(record.getRealInTime() != null && record.getOutDayTime() != null){
-                record.setStatus(3);//已出场
-            }else if(record.getRealInTime() != null && record.getOutDayTime() == null){
-                record.setStatus(2);//已入场
-            }else{
-                record.setStatus(1);//未入场
-            }
+            BeanUtil.copyProperties(passRecord, record);
+            TbCostomer costomer = tbCostomerService.getById(passRecord.getCustomerId());
+            record.setCustomerContact(costomer.getPhone()).setDutyPeople(costomer.getDutyPeople());
             recordList.add(record);
         }
         return recordList;
@@ -53,11 +50,10 @@ public class ApiService {
         return list;
     }
 
-    public void confirmCustomer(Long customerId) {
-        //
+    public void confirmCustomer(Long customerId, String judgeContent) {
         TbCostomer costomer = tbCostomerService.getById(customerId);
         if(costomer != null && costomer.getJudgeStatus() == 1){
-            tbCostomerService.judge(customerId + "", 2, "H5端审核");
+            tbCostomerService.judge(customerId + "", 2, judgeContent);
         }
     }
 }

+ 15 - 4
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessController.java

@@ -62,6 +62,7 @@ public class TbBusinessController {
     public AjaxJson delete(String id) {
         tbBusinessService.removeById(id);
         tbBusinessItemService.removeByBusinessId(id);
+        tbPassRecordService.removeByBusinessId(id);
         return AjaxJson.getSuccess();
     }
 
@@ -193,10 +194,12 @@ public class TbBusinessController {
         tbBusiness.setChinaCarInTime(chinaCarInTime).setRealInTime(inTime);
         tbBusinessService.updateById(tbBusiness);
 
-        //更新放行记录
-        TbPassRecord record = tbPassRecordService.getByBusinessId(tbBusiness.getId());
-        record.setStatus(2).setInTime(tbBusiness.getRealInTime()).setUpdateTime(new Date());
-        tbPassRecordService.saveOrUpdate(record);
+        //更新境外车入场记录
+        tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
+                tbBusiness.getCardNo(), 2, tbBusiness.getRealInTime(), null, tbBusiness.getCountryName());
+        //更新中国车入场记录
+        tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
+                tbBusiness.getChinaCarNo(), 2, tbBusiness.getChinaCarInTime(), null, "中国车");
 
         return AjaxJson.getSuccess();
     }
@@ -217,6 +220,14 @@ public class TbBusinessController {
         business.setChinaCarOutTime(chinaCarOutTime);
         tbBusinessService. calculationPartMoney("中国车",business);
         tbBusinessService.updateById(business);
+        //更新境外车出场记录
+        tbPassRecordService.addOrUpdate(business.getId(), business.getCustomerId(), business.getCustomerName(),
+                business.getCardNo(), 3,
+                business.getRealInTime(), business.getOutDayTime(), business.getCountryName());
+        //更新中国车出场记录
+        tbPassRecordService.addOrUpdate(business.getId(), business.getCustomerId(), business.getCustomerName(),
+                business.getChinaCarNo(), 3,
+                business.getChinaCarInTime(), business.getChinaCarOutTime(), "中国车");
         return AjaxJson.getSuccess();
     }
 

+ 20 - 16
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -142,14 +142,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         this.saveOrUpdate(t);
         tbBusinessItemService.saveBatch(items);
 
-        //增加或更新一条放行记录
-        TbPassRecord record = tbPassRecordService.getByBusinessId(t.getId());
-        if(record == null)
-            record = new TbPassRecord();
-        record.setBusinessId(t.getId()).setCustomerId(t.getCustomerId())
-                .setCardNo(t.getCardNo()).setCustomerName(t.getCustomerName())
-                .setStatus(1).setUpdateTime(new Date());
-        tbPassRecordService.saveOrUpdate(record);
+        //增加或修改一条境外车未入场记录
+        tbPassRecordService.addOrUpdate(t.getId(), t.getCustomerId(), t.getCustomerName(),
+                t.getCardNo(), 1, null, null, t.getCountryName());
+        //增加或修改一条中国车未入场记录
+        tbPassRecordService.addOrUpdate(t.getId(), t.getCustomerId(), t.getCustomerName(),
+                t.getChinaCarNo(), 1, null, null, "中国车");
 
         return AjaxJson.getSuccess();
     }
@@ -255,10 +253,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         tbBusiness.setRealInTime(new Date()).setInChannel(inChannel);
         this.updateById(tbBusiness);
 
-        //更新放行记录
-        TbPassRecord record = tbPassRecordService.getByBusinessId(tbBusiness.getId());
-        record.setStatus(2).setInTime(tbBusiness.getRealInTime()).setUpdateTime(new Date());
-        tbPassRecordService.saveOrUpdate(record);
+        //更新境外车入场记录
+        tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
+                tbBusiness.getCardNo(), 2, tbBusiness.getRealInTime(), null, tbBusiness.getCountryName());
+        //更新中国车入场记录
+        tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
+                tbBusiness.getChinaCarNo(), 2, tbBusiness.getChinaCarInTime(), null, "中国车");
     }
 
     public void adminOut(String id, Date outDayTime, String outChannel,String carType)  {
@@ -267,10 +267,14 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
        calculationPartMoney(carType,tbBusiness);
        this.updateById(tbBusiness);
 
-        //更新放行记录
-        TbPassRecord record = tbPassRecordService.getByBusinessId(tbBusiness.getId());
-        record.setStatus(3).setOutTime(tbBusiness.getOutDayTime()).setUpdateTime(new Date());
-        tbPassRecordService.saveOrUpdate(record);
+        //更新境外车出场记录
+        tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
+                tbBusiness.getCardNo(), 3,
+                tbBusiness.getRealInTime(), tbBusiness.getOutDayTime(), tbBusiness.getCountryName());
+        //更新中国车出场记录
+        tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
+                tbBusiness.getChinaCarNo(), 3,
+                tbBusiness.getChinaCarInTime(), tbBusiness.getChinaCarOutTime(), "中国车");
 
     }
 

+ 7 - 2
sp-server/src/main/java/com/pj/project/tb_pass_record/TbPassRecord.java

@@ -4,7 +4,7 @@ import java.io.Serializable;
 import java.util.Date;
 
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.pj.project.tb_item_type.TbItemType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -17,7 +17,7 @@ import lombok.experimental.Accessors;
 @Accessors(chain = true)
 @TableName(TbPassRecord.TABLE_NAME)
 @EqualsAndHashCode(callSuper = false)
-public class TbPassRecord implements Serializable {
+public class TbPassRecord extends Model<TbPassRecord> implements Serializable {
 
 	// ---------- 模块常量 ----------
 	/**
@@ -60,6 +60,11 @@ public class TbPassRecord implements Serializable {
 	 */
     private String cardNo;
 
+    /**
+     * 车辆所属国家
+     */
+    private String carCountryName;
+
 	/**
 	 * 状态(=未入场, 2=已入场, 3=已出场) 
 	 */

+ 2 - 0
sp-server/src/main/java/com/pj/project/tb_pass_record/TbPassRecordMapper.java

@@ -55,5 +55,7 @@ public interface TbPassRecordMapper extends BaseMapper<TbPassRecord> {
 
     TbPassRecord getByBusinessId(@Param("businessId") String businessId);
 
+    TbPassRecord getByBusinessIdAndCountryName(@Param("businessId")String businessId, @Param("carCountryName")String carCountryName);
 
+    void deleteByBusinessId(String businessId);
 }

+ 18 - 3
sp-server/src/main/java/com/pj/project/tb_pass_record/TbPassRecordMapper.xml

@@ -5,8 +5,8 @@
 	<!-- 增 [G] -->
 	<insert id="add">
 		insert into 
-		tb_pass_record (id, business_id, customer_id, customer_name, card_no, status, in_time, out_time, update_time)
-		values (#{id}, #{businessId}, #{customerId}, #{customerName}, #{cardNo}, #{status}, #{inTime}, #{outTime}, #{updateTime}) 
+		tb_pass_record (id, business_id, customer_id, customer_name, card_no, car_country_name, status, in_time, out_time, update_time)
+		values (#{id}, #{businessId}, #{customerId}, #{customerName}, #{cardNo}, #{carCountryName}, #{status}, #{inTime}, #{outTime}, #{updateTime})
 	</insert>
 
 	<!-- 删 -->
@@ -15,6 +15,12 @@
 		where id = #{id}
 	</delete>
 
+    <!-- 删 -->
+    <delete id="deleteByBusinessId">
+		delete from tb_pass_record
+		where business_id = #{businessId}
+	</delete>
+
 	<!-- 改 [G] -->
 	<update id="update">
 		update tb_pass_record set
@@ -22,7 +28,8 @@
 		business_id = #{businessId}, 
 		customer_id = #{customerId}, 
 		customer_name = #{customerName}, 
-		card_no = #{cardNo}, 
+		card_no = #{cardNo},
+		car_country_name = #{carCountryName},
 		status = #{status}, 
 		in_time = #{inTime}, 
 		out_time = #{outTime}, 
@@ -41,6 +48,7 @@
 		<result property="customerId" column="customer_id" />
 		<result property="customerName" column="customer_name" />
 		<result property="cardNo" column="card_no" />
+        <result property="carCountryName" column="car_country_name" />
 		<result property="status" column="status" />
 		<result property="inTime" column="in_time" />
 		<result property="outTime" column="out_time" />
@@ -64,6 +72,12 @@
         <include refid="select_sql"></include>
         where business_id = #{businessId}
     </select>
+
+    <!-- 查 - 根据businessId和CountryName -->
+    <select id="getByBusinessIdAndCountryName" resultMap="model">
+        <include refid="select_sql"></include>
+        where business_id = #{businessId} and car_country_name = #{carCountryName}
+    </select>
 	
 	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
 	<select id="getList" resultMap="model">
@@ -75,6 +89,7 @@
 			<if test=' this.has("customerId") '> and customer_id = #{customerId} </if>
 			<if test=' this.has("customerName") '> and customer_name like concat('%',#{customerName},'%') </if>
 			<if test=' this.has("cardNo") '> and card_no like concat('%',#{cardNo},'%') </if>
+            <if test=' this.has("carCountryName") '> and car_country_name = #{carCountryName} </if>
 			<if test=' this.has("status") '> and status = #{status} </if>
 			<if test=' this.has("inTime") '> and in_time = #{inTime} </if>
 			<if test=' this.has("outTime") '> and out_time = #{outTime} </if>

+ 30 - 4
sp-server/src/main/java/com/pj/project/tb_pass_record/TbPassRecordService.java

@@ -1,12 +1,16 @@
 package com.pj.project.tb_pass_record;
 
+import java.util.Date;
 import java.util.List;
 
+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.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 
 /**
@@ -14,6 +18,7 @@ import org.springframework.stereotype.Service;
  * @author lzm 
  */
 @Service
+@Transactional
 public class TbPassRecordService extends ServiceImpl<TbPassRecordMapper, TbPassRecord> implements IService<TbPassRecord> {
 
 	/** 底层 Mapper 对象 */
@@ -40,14 +45,35 @@ public class TbPassRecordService extends ServiceImpl<TbPassRecordMapper, TbPassR
 		return tbPassRecordMapper.getById(id);
 	}
 
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	List<TbPassRecord> getList(SoMap so) {
-		return tbPassRecordMapper.getList(so);	
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
+        public List<TbPassRecord> getList(SoMap so) {
+            return tbPassRecordMapper.getList(so);
 	}
 
     public TbPassRecord getByBusinessId(String businessId){
         return tbPassRecordMapper.getByBusinessId(businessId);
     }
-	
 
+    public TbPassRecord getByBusinessIdAndCountryName(String businessId, String carCountryName){
+        return tbPassRecordMapper.getByBusinessIdAndCountryName(businessId, carCountryName);
+    }
+
+    /** 初始化或更新一条出入记录, 越南车和中国车分开 */
+    @Async
+    public void addOrUpdate(String businessId, String customerId, String customerName, String carNo, int status, Date inTime, Date outTime, String carCountryName){
+        TbPassRecord record = this.getByBusinessIdAndCountryName(businessId, carCountryName);
+        if(record == null)
+            record = new TbPassRecord();
+        record.setBusinessId(businessId)
+                .setCustomerId(customerId).setCustomerName(customerName)
+                .setCardNo(carNo).setStatus(status)
+                .setInTime(inTime).setOutTime(outTime)
+                .setCarCountryName(carCountryName)
+                .setUpdateTime(new Date());
+        saveOrUpdate(record);
+    }
+
+    public void removeByBusinessId(String businessId) {
+       tbPassRecordMapper.deleteByBusinessId(businessId);
+    }
 }