Parcourir la source

开发完成车辆道闸代码

wuxw il y a 6 ans
Parent
commit
2c0addb285

+ 64 - 2
Api/src/main/java/com/java110/api/listener/machineTranslate/MachineRoadGateOpenListener.java

@@ -5,21 +5,27 @@ import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Listener;
 import com.java110.core.context.DataFlowContext;
 import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.core.smo.fee.IFeeConfigInnerServiceSMO;
+import com.java110.core.smo.fee.IFeeInnerServiceSMO;
 import com.java110.core.smo.hardwareAdapation.ICarBlackWhiteInnerServiceSMO;
 import com.java110.core.smo.hardwareAdapation.ICarInoutInnerServiceSMO;
 import com.java110.core.smo.hardwareAdapation.IMachineInnerServiceSMO;
+import com.java110.core.smo.owner.IOwnerCarInnerServiceSMO;
+import com.java110.dto.FeeConfigDto;
+import com.java110.dto.FeeDto;
 import com.java110.dto.hardwareAdapation.CarBlackWhiteDto;
 import com.java110.dto.hardwareAdapation.CarInoutDto;
 import com.java110.dto.hardwareAdapation.MachineDto;
+import com.java110.dto.owner.OwnerCarDto;
 import com.java110.entity.center.AppService;
 import com.java110.event.service.api.ServiceDataFlowEvent;
 import com.java110.utils.constant.BusinessTypeConstant;
 import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.constant.FeeTypeConstant;
 import com.java110.utils.constant.ServiceCodeMachineTranslateConstant;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.DateUtil;
-import com.java110.utils.util.StringUtil;
 import com.java110.vo.api.machine.MachineResDataVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpHeaders;
@@ -58,6 +64,15 @@ public class MachineRoadGateOpenListener extends BaseMachineListener {
     @Autowired
     private ICarBlackWhiteInnerServiceSMO carBlackWhiteInnerServiceSMOImpl;
 
+    @Autowired
+    private IOwnerCarInnerServiceSMO carInnerServiceSMOImpl;
+
+    @Autowired
+    private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
+
+    @Autowired
+    private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl;
+
     @Override
     protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
 
@@ -170,9 +185,56 @@ public class MachineRoadGateOpenListener extends BaseMachineListener {
         }
 
         //判断车辆出租和出售 时间是否到期
+        OwnerCarDto ownerCarDto = new OwnerCarDto();
+        ownerCarDto.setCarNum(carNum);
+        ownerCarDto.setCommunityId(tmpCarInoutDto.getCommunityId());
+        List<OwnerCarDto> ownerCarDtos = carInnerServiceSMOImpl.queryOwnerCars(ownerCarDto);
+        //这里获取最新的一条记录 我们认为 一个小区中一辆车不能同时有两个车位
+        OwnerCarDto tmpOwnerCarDto = ownerCarDtos.get(0);
+        FeeDto feeDto = new FeeDto();
+        feeDto.setPayerObjId(tmpOwnerCarDto.getPsId());
+        feeDto.setCommunityId(tmpCarInoutDto.getCommunityId());
+        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
+
+        FeeDto tmpFeeDto = feeDtos.get(0);
+
+        Date endTime = tmpFeeDto.getEndTime();
+        Date nowTime = new Date();
+        long betweenTime = (endTime.getTime() - nowTime.getTime());
+
+        if (betweenTime > 0) {
+            long day = betweenTime / (60 * 60 * 24 * 1000);
+            JSONObject data = new JSONObject();
+            data.put("day", day);//还剩余多少天
+            modifyCarInoutInfo(event, context, reqJson, tmpCarInoutDto, machineDto);
+            context.setResponseEntity(MachineResDataVo.getResData(MachineResDataVo.CODE_SUCCESS, "成功", data));
+            return;
+        }
+
+        //计算缴费金额
+
+        Date inTime = tmpCarInoutDto.getInTime();
+
+        FeeConfigDto feeConfigDto = new FeeConfigDto();
+        feeConfigDto.setCommunityId(tmpCarInoutDto.getCommunityId());
+        feeConfigDto.setFeeTypeCd(FeeTypeConstant.FEE_TYPE_TEMP_DOWN_PARKING_SPACE);
+        List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
+
+        FeeConfigDto tmpFeeConfigDto = feeConfigDtos.get(0);
+        Double hour = Math.ceil((nowTime.getTime() - inTime.getTime()) / (60 * 60 * 1000));
+        double money = 0.00;
+        if (hour <= 2) {
+            money = Double.parseDouble(tmpFeeConfigDto.getAdditionalAmount());
+        } else {
+            double lastHour = hour - 2;
+            money = lastHour * Double.parseDouble(tmpFeeConfigDto.getSquarePrice()) + Double.parseDouble(tmpFeeConfigDto.getAdditionalAmount());
+        }
 
+        JSONObject data = new JSONObject();
+        data.put("money", money);//缴费金额
+        data.put("hour", hour);//停车时间
 
-        context.setResponseEntity(MachineResDataVo.getResData(MachineResDataVo.CODE_ERROR, "车辆未支付,请先支付"));
+        context.setResponseEntity(MachineResDataVo.getResData(MachineResDataVo.CODE_ERROR, "车辆未支付,请先支付", data));
     }
 
     private void modifyCarInoutInfo(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson, CarInoutDto tmpCarInoutDto, MachineDto machineDto) {

+ 0 - 34
WebService/src/main/resources/components/feePackage/view-parkingSpace-fee-config/viewParkingSpaceFeeConfig.html

@@ -150,40 +150,6 @@
             </div>
         </div>
     </div>
-    <div class="col-lg-12">
-        <div class="ibox ">
-            <div class="ibox-title">
-                <h5>{{feeConfigUpTempInfo.feeName}}信息</h5>
-                <div class="ibox-tools" style="top:10px;">
-                    <button type="button" class="btn btn-primary btn-sm" v-on:click="openConfigParkingSpaceTempFeeModel(feeConfigUpTempInfo)">
-                        <i class="glyphicon glyphicon-plus"></i> 编辑</button>
-                </div>
-            </div>
-            <div class="ibox-content">
-                <div class="row">
-                    <div class="col-sm-4">
-                        <div class="form-group">
-                            <label class="col-form-label" >地上临时配置ID:</label>
-                            <label class="">{{feeConfigUpTempInfo.configId}}</label>
-                        </div>
-                    </div>
-                    <div class="col-sm-4">
-                        <div class="form-group">
-                            <label class="col-form-label">每小时单价:</label>
-                            <label class="">{{feeConfigUpTempInfo.squarePrice}} 元</label>
-                        </div>
-                    </div>
-                    <div class="col-sm-4">
-                        <div class="form-group">
-                            <label class="col-form-label" >首两个小时:</label>
-                            <label class="">{{feeConfigUpTempInfo.additionalAmount}} 元</label>
-                        </div>
-                    </div>
-
-                </div>
-            </div>
-        </div>
-    </div>
     <vc:create name="configParkingSpaceFee"></vc:create>
     <vc:create name="configParkingSpaceTempFee"></vc:create>
 </div>

+ 1 - 9
WebService/src/main/resources/components/feePackage/view-parkingSpace-fee-config/viewParkingSpaceFeeConfig.js

@@ -35,14 +35,7 @@
                  squarePrice:"",
                  feeName:"临时地下停车费",
                  feeTypeCd:'888800010007'
-             },
-           feeConfigUpTempInfo:{
-               configId:"",
-               squarePrice:"",
-               additionalAmount:"",
-               feeName:"临时地上停车费",
-               feeTypeCd:'888800010008'
-           }
+             }
         },
         _initMethod:function(){
                 vc.component.loadParkingSpaceConfigFee(vc.component.feeConfigUpHireInfo);
@@ -50,7 +43,6 @@
                 vc.component.loadParkingSpaceConfigFee(vc.component.feeConfigUpSellInfo);
                 vc.component.loadParkingSpaceConfigFee(vc.component.feeConfigDownSellInfo);
                 vc.component.loadParkingSpaceConfigFee(vc.component.feeConfigDownTempInfo);
-                vc.component.loadParkingSpaceConfigFee(vc.component.feeConfigUpTempInfo);
         },
         _initEvent:function(){
             vc.on('viewParkingSpaceFeeConfig','loadParkingSpaceConfigFee',function(_param){

+ 18 - 17
java110-bean/src/main/java/com/java110/dto/hardwareAdapation/CarInoutDto.java

@@ -15,13 +15,13 @@ import java.util.Date;
  **/
 public class CarInoutDto extends PageDto implements Serializable {
 
-    private String inTime;
+    private Date inTime;
     private String inoutId;
     private String carNum;
     private String state;
     private String[] states;
     private String communityId;
-    private String outTime;
+    private Date outTime;
 
 
     private Date createTime;
@@ -29,14 +29,6 @@ public class CarInoutDto extends PageDto implements Serializable {
     private String statusCd = "0";
 
 
-    public String getInTime() {
-        return inTime;
-    }
-
-    public void setInTime(String inTime) {
-        this.inTime = inTime;
-    }
-
     public String getInoutId() {
         return inoutId;
     }
@@ -69,13 +61,6 @@ public class CarInoutDto extends PageDto implements Serializable {
         this.communityId = communityId;
     }
 
-    public String getOutTime() {
-        return outTime;
-    }
-
-    public void setOutTime(String outTime) {
-        this.outTime = outTime;
-    }
 
 
     public Date getCreateTime() {
@@ -101,4 +86,20 @@ public class CarInoutDto extends PageDto implements Serializable {
     public void setStates(String[] states) {
         this.states = states;
     }
+
+    public Date getInTime() {
+        return inTime;
+    }
+
+    public void setInTime(Date inTime) {
+        this.inTime = inTime;
+    }
+
+    public Date getOutTime() {
+        return outTime;
+    }
+
+    public void setOutTime(Date outTime) {
+        this.outTime = outTime;
+    }
 }

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/owner/OwnerCarDto.java

@@ -20,6 +20,7 @@ public class OwnerCarDto extends PageDto implements Serializable {
     private String carType;
     private String carTypeName;
     private String carNum;
+    private String communityId;
     private String psId;
     private String remark;
     private String ownerId;
@@ -128,4 +129,12 @@ public class OwnerCarDto extends PageDto implements Serializable {
     public void setCarTypeName(String carTypeName) {
         this.carTypeName = carTypeName;
     }
+
+    public String getCommunityId() {
+        return communityId;
+    }
+
+    public void setCommunityId(String communityId) {
+        this.communityId = communityId;
+    }
 }

+ 1 - 0
java110-db/src/main/resources/mapper/fee/FeeServiceDaoImplMapper.xml

@@ -154,6 +154,7 @@
         <if test="payerObjId !=null and payerObjId != ''">
             and t.payer_obj_id= #{payerObjId}
         </if>
+        order by t.create_time desc
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>

+ 22 - 6
java110-db/src/main/resources/mapper/user/OwnerCarServiceDaoImplMapper.xml

@@ -7,9 +7,9 @@
     <!-- 保存车辆管理信息 add by wuxw 2018-07-03 -->
     <insert id="saveBusinessOwnerCarInfo" parameterType="Map">
         insert into business_owner_car(
-        car_color,car_brand,car_type,operate,car_num,ps_id,remark,owner_id,b_id,user_id,car_id
+        car_color,car_brand,car_type,operate,car_num,ps_id,remark,owner_id,b_id,user_id,car_id,community_id
         ) values (
-        #{carColor},#{carBrand},#{carType},#{operate},#{carNum},#{psId},#{remark},#{ownerId},#{bId},#{userId},#{carId}
+        #{carColor},#{carBrand},#{carType},#{operate},#{carNum},#{psId},#{remark},#{ownerId},#{bId},#{userId},#{carId},#{communityId}
         )
     </insert>
 
@@ -18,7 +18,7 @@
     <select id="getBusinessOwnerCarInfo" parameterType="Map" resultType="Map">
         select t.car_color,t.car_color carColor,t.car_brand,t.car_brand carBrand,t.car_type,t.car_type
         carType,t.operate,t.car_num,t.car_num carNum,t.ps_id,t.ps_id psId,t.remark,t.owner_id,t.owner_id
-        ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.car_id,t.car_id carId
+        ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.car_id,t.car_id carId,t.community_id,t.community_id communityId
         from business_owner_car t
         where 1 =1
         <if test="carColor !=null and carColor != ''">
@@ -54,6 +54,9 @@
         <if test="carId !=null and carId != ''">
             and t.car_id= #{carId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
     </select>
 
@@ -61,8 +64,8 @@
     <!-- 保存车辆管理信息至 instance表中 add by wuxw 2018-07-03 -->
     <insert id="saveOwnerCarInfoInstance" parameterType="Map">
         insert into owner_car(
-        car_color,car_brand,car_type,car_num,ps_id,remark,status_cd,owner_id,b_id,user_id,car_id
-        ) select t.car_color,t.car_brand,t.car_type,t.car_num,t.ps_id,t.remark,'0',t.owner_id,t.b_id,t.user_id,t.car_id
+        car_color,car_brand,car_type,car_num,ps_id,remark,status_cd,owner_id,b_id,user_id,car_id,community_id
+        ) select t.car_color,t.car_brand,t.car_type,t.car_num,t.ps_id,t.remark,'0',t.owner_id,t.b_id,t.user_id,t.car_id,t.community_id
         from business_owner_car t where 1=1
         <if test="carColor !=null and carColor != ''">
             and t.car_color= #{carColor}
@@ -95,6 +98,9 @@
         <if test="carId !=null and carId != ''">
             and t.car_id= #{carId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
     </insert>
 
@@ -104,7 +110,7 @@
         select t.car_color,t.car_color carColor,t.car_brand,t.car_brand carBrand,t1.name car_type,t1.name carType,
         t.car_num,t.car_num carNum,t.ps_id,t.ps_id psId,t.remark,t.status_cd,t.status_cd statusCd,t.owner_id,
         t.owner_id ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.car_id,t.car_id carId ,t.create_time
-        createTime
+        createTime,t.community_id communityId
         from owner_car t,t_dict t1 where t.car_type=t1.status_cd and t1.table_name='owner_car'
         <if test="carColor !=null and carColor != ''">
             and t.car_color= #{carColor}
@@ -139,6 +145,10 @@
         <if test="carId !=null and carId != ''">
             and t.car_id= #{carId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        order by t.create_time desc
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
@@ -183,6 +193,9 @@
         <if test="carId !=null and carId != ''">
             and t.car_id= #{carId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
     </update>
 
@@ -224,6 +237,9 @@
         <if test="carId !=null and carId != ''">
             and t.car_id= #{carId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
 
     </select>

+ 1 - 1
java110-utils/src/main/java/com/java110/utils/constant/FeeTypeConstant.java

@@ -60,7 +60,7 @@ public class FeeTypeConstant {
     /**
      * 停车费 地上 临时车费用
      */
-    public static final String FEE_TYPE_TEMP_UP_PARKING_SPACE = "888800010008";
+//    public static final String FEE_TYPE_TEMP_UP_PARKING_SPACE = "888800010008";