Procházet zdrojové kódy

优化 车位信息

java110 před 3 roky
rodič
revize
7313fa3a67

+ 81 - 49
java110-bean/src/main/java/com/java110/dto/parkingSpaceApply/ParkingSpaceApplyDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.parkingSpaceApply;
 
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -14,27 +15,29 @@ import java.util.Date;
  **/
 public class ParkingSpaceApplyDto extends PageDto implements Serializable {
 
+    public static final String STATE_FAIL = "4004"; // 审核失败
+
     private String carBrand;
-private String applyPersonName;
-private String carNum;
-private String psId;
-private String remark;
-private String applyId;
-private String carColor;
-private String carType;
-private String configId;
-private String applyPersonLink;
-private String startTime;
-private String applyPersonId;
-private String endTime;
-private String state;
-private String communityId;
-private String feeId;
-private String num;
-private String paId;
-private String parkingTypeName;
-private String stateName;
-private String carId;
+    private String applyPersonName;
+    private String carNum;
+    private String psId;
+    private String remark;
+    private String applyId;
+    private String carColor;
+    private String carType;
+    private String configId;
+    private String applyPersonLink;
+    private String startTime;
+    private String applyPersonId;
+    private String endTime;
+    private String state;
+    private String communityId;
+    private String feeId;
+    private String num;
+    private String paId;
+    private String parkingTypeName;
+    private String stateName;
+    private String carId;
     private Date createTime;
 
     private String statusCd = "0";
@@ -43,91 +46,120 @@ private String carId;
     public String getCarBrand() {
         return carBrand;
     }
-public void setCarBrand(String carBrand) {
+
+    public void setCarBrand(String carBrand) {
         this.carBrand = carBrand;
     }
-public String getApplyPersonName() {
+
+    public String getApplyPersonName() {
         return applyPersonName;
     }
-public void setApplyPersonName(String applyPersonName) {
+
+    public void setApplyPersonName(String applyPersonName) {
         this.applyPersonName = applyPersonName;
     }
-public String getCarNum() {
+
+    public String getCarNum() {
         return carNum;
     }
-public void setCarNum(String carNum) {
+
+    public void setCarNum(String carNum) {
         this.carNum = carNum;
     }
-public String getPsId() {
+
+    public String getPsId() {
         return psId;
     }
-public void setPsId(String psId) {
+
+    public void setPsId(String psId) {
         this.psId = psId;
     }
-public String getRemark() {
+
+    public String getRemark() {
         return remark;
     }
-public void setRemark(String remark) {
+
+    public void setRemark(String remark) {
         this.remark = remark;
     }
-public String getApplyId() {
+
+    public String getApplyId() {
         return applyId;
     }
-public void setApplyId(String applyId) {
+
+    public void setApplyId(String applyId) {
         this.applyId = applyId;
     }
-public String getCarColor() {
+
+    public String getCarColor() {
         return carColor;
     }
-public void setCarColor(String carColor) {
+
+    public void setCarColor(String carColor) {
         this.carColor = carColor;
     }
-public String getCarType() {
+
+    public String getCarType() {
         return carType;
     }
-public void setCarType(String carType) {
+
+    public void setCarType(String carType) {
         this.carType = carType;
     }
-public String getConfigId() {
+
+    public String getConfigId() {
         return configId;
     }
-public void setConfigId(String configId) {
+
+    public void setConfigId(String configId) {
         this.configId = configId;
     }
-public String getApplyPersonLink() {
+
+    public String getApplyPersonLink() {
         return applyPersonLink;
     }
-public void setApplyPersonLink(String applyPersonLink) {
+
+    public void setApplyPersonLink(String applyPersonLink) {
         this.applyPersonLink = applyPersonLink;
     }
-public String getStartTime() {
+
+    public String getStartTime() {
         return startTime;
     }
-public void setStartTime(String startTime) {
+
+    public void setStartTime(String startTime) {
         this.startTime = startTime;
     }
-public String getApplyPersonId() {
+
+    public String getApplyPersonId() {
         return applyPersonId;
     }
-public void setApplyPersonId(String applyPersonId) {
+
+    public void setApplyPersonId(String applyPersonId) {
         this.applyPersonId = applyPersonId;
     }
-public String getEndTime() {
+
+    public String getEndTime() {
         return endTime;
     }
-public void setEndTime(String endTime) {
+
+    public void setEndTime(String endTime) {
         this.endTime = endTime;
     }
-public String getState() {
+
+    public String getState() {
         return state;
     }
-public void setState(String state) {
+
+    public void setState(String state) {
         this.state = state;
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
     }
 

+ 100 - 104
java110-db/src/main/resources/mapper/community/ParkingSpaceV1ServiceDaoImplMapper.xml

@@ -5,129 +5,125 @@
 <mapper namespace="parkingSpaceV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 保存车位信息 add by wuxw 2018-07-03 -->
     <insert id="saveParkingSpaceInfo" parameterType="Map">
         insert into parking_space(
-area,parking_type,num,pa_id,ps_id,remark,state,community_id
-) values (
-#{area},#{parkingType},#{num},#{paId},#{psId},#{remark},#{state},#{communityId}
-)
+        area,parking_type,num,pa_id,ps_id,remark,state,community_id
+        ) values (
+        #{area},#{parkingType},#{num},#{paId},#{psId},#{remark},#{state},#{communityId}
+        )
     </insert>
 
 
-
     <!-- 查询车位信息 add by wuxw 2018-07-03 -->
     <select id="getParkingSpaceInfo" parameterType="Map" resultType="Map">
-        select  t.area,t.parking_type,t.parking_type parkingType,t.num,t.pa_id,t.pa_id paId,t.ps_id,t.ps_id psId,t.remark,t.status_cd,t.status_cd statusCd,t.state,t.community_id,t.community_id communityId 
-from parking_space t 
-where 1 =1 
-<if test="area !=null and area != ''">
-   and t.area= #{area}
-</if> 
-<if test="parkingType !=null and parkingType != ''">
-   and t.parking_type= #{parkingType}
-</if> 
-<if test="num !=null and num != ''">
-   and t.num= #{num}
-</if> 
-<if test="paId !=null and paId != ''">
-   and t.pa_id= #{paId}
-</if> 
-<if test="psId !=null and psId != ''">
-   and t.ps_id= #{psId}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</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> 
+        select t.area,t.parking_type,t.parking_type parkingType,t.num,t.pa_id,t.pa_id paId,t.ps_id,t.ps_id
+        psId,t.remark,t.status_cd,t.status_cd statusCd,t.state,t.community_id,t.community_id communityId
+        from parking_space t
+        where 1 =1
+        <if test="area !=null and area != ''">
+            and t.area= #{area}
+        </if>
+        <if test="parkingType !=null and parkingType != ''">
+            and t.parking_type= #{parkingType}
+        </if>
+        <if test="num !=null and num != ''">
+            and t.num= #{num}
+        </if>
+        <if test="paId !=null and paId != ''">
+            and t.pa_id= #{paId}
+        </if>
+        <if test="psId !=null and psId != ''">
+            and t.ps_id= #{psId}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </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>
 
     </select>
 
 
-
-
     <!-- 修改车位信息 add by wuxw 2018-07-03 -->
     <update id="updateParkingSpaceInfo" parameterType="Map">
-        update  parking_space t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="area !=null and area != ''">
-, t.area= #{area}
-</if> 
-<if test="parkingType !=null and parkingType != ''">
-, t.parking_type= #{parkingType}
-</if> 
-<if test="num !=null and num != ''">
-, t.num= #{num}
-</if> 
-<if test="paId !=null and paId != ''">
-, t.pa_id= #{paId}
-</if> 
-<if test="remark !=null and remark != ''">
-, t.remark= #{remark}
-</if> 
-<if test="state !=null and state != ''">
-, t.state= #{state}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
- where 1=1 <if test="psId !=null and psId != ''">
-and t.ps_id= #{psId}
-</if> 
+        update parking_space t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="area !=null and area != ''">
+            , t.area= #{area}
+        </if>
+        <if test="parkingType !=null and parkingType != ''">
+            , t.parking_type= #{parkingType}
+        </if>
+        <if test="num !=null and num != ''">
+            , t.num= #{num}
+        </if>
+        <if test="paId !=null and paId != ''">
+            , t.pa_id= #{paId}
+        </if>
+        <if test="remark !=null and remark != ''">
+            , t.remark= #{remark}
+        </if>
+        <if test="state !=null and state != ''">
+            , t.state= #{state}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        where 1=1
+        <if test="psId !=null and psId != ''">
+            and t.ps_id= #{psId}
+        </if>
 
     </update>
 
     <!-- 查询车位数量 add by wuxw 2018-07-03 -->
-     <select id="queryParkingSpacesCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from parking_space t 
-where 1 =1 
-<if test="area !=null and area != ''">
-   and t.area= #{area}
-</if> 
-<if test="parkingType !=null and parkingType != ''">
-   and t.parking_type= #{parkingType}
-</if> 
-<if test="num !=null and num != ''">
-   and t.num= #{num}
-</if> 
-<if test="paId !=null and paId != ''">
-   and t.pa_id= #{paId}
-</if> 
-<if test="psId !=null and psId != ''">
-   and t.ps_id= #{psId}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
+    <select id="queryParkingSpacesCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from parking_space t
+        where 1 =1
+        <if test="area !=null and area != ''">
+            and t.area= #{area}
+        </if>
+        <if test="parkingType !=null and parkingType != ''">
+            and t.parking_type= #{parkingType}
+        </if>
+        <if test="num !=null and num != ''">
+            and t.num= #{num}
+        </if>
+        <if test="paId !=null and paId != ''">
+            and t.pa_id= #{paId}
+        </if>
+        <if test="psId !=null and psId != ''">
+            and t.ps_id= #{psId}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 28 - 3
service-community/src/main/java/com/java110/community/cmd/parkingSpaceApply/UpdateParkingSpaceApplyCmd.java

@@ -22,27 +22,30 @@ import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.core.log.LoggerFactory;
 import com.java110.dto.CommunityMemberDto;
 import com.java110.dto.fee.FeeConfigDto;
 import com.java110.dto.fee.FeeDto;
 import com.java110.dto.owner.OwnerCarDto;
+import com.java110.dto.parking.ParkingSpaceDto;
 import com.java110.dto.parkingSpaceApply.ParkingSpaceApplyDto;
 import com.java110.intf.community.ICommunityMemberV1InnerServiceSMO;
 import com.java110.intf.community.IParkingSpaceApplyV1InnerServiceSMO;
+import com.java110.intf.community.IParkingSpaceV1InnerServiceSMO;
 import com.java110.intf.fee.IFeeConfigInnerServiceSMO;
 import com.java110.intf.fee.IPayFeeV1InnerServiceSMO;
 import com.java110.intf.user.IOwnerCarV1InnerServiceSMO;
 import com.java110.po.car.OwnerCarPo;
 import com.java110.po.fee.PayFeePo;
+import com.java110.po.parking.ParkingSpacePo;
 import com.java110.po.parkingSpaceApply.ParkingSpaceApplyPo;
 import com.java110.utils.constant.CommonConstant;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.vo.ResultVo;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.slf4j.Logger;
-import com.java110.core.log.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.List;
 
@@ -74,6 +77,9 @@ public class UpdateParkingSpaceApplyCmd extends Cmd {
     @Autowired
     private ICommunityMemberV1InnerServiceSMO communityMemberV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IParkingSpaceV1InnerServiceSMO parkingSpaceV1InnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "applyId", "applyId不能为空");
@@ -86,6 +92,17 @@ public class UpdateParkingSpaceApplyCmd extends Cmd {
         String userId = cmdDataFlowContext.getReqHeaders().get(CommonConstant.USER_ID);
         ParkingSpaceApplyPo parkingSpaceApplyPo = BeanConvertUtil.covertBean(reqJson, ParkingSpaceApplyPo.class);
 
+        //审核失败
+        if (ParkingSpaceApplyDto.STATE_FAIL.equals(parkingSpaceApplyPo.getState())) {
+            parkingSpaceApplyPo.setPsId("");
+            parkingSpaceApplyPo.setConfigId("");
+            int flag = parkingSpaceApplyV1InnerServiceSMOImpl.updateParkingSpaceApply(parkingSpaceApplyPo);
+            if (flag < 1) {
+                throw new CmdException("更新数据失败");
+            }
+            return;
+        }
+
         PayFeePo payFeePo = new PayFeePo();
         payFeePo.setFeeId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
 
@@ -134,10 +151,18 @@ public class UpdateParkingSpaceApplyCmd extends Cmd {
                 throw new CmdException("更新数据失败");
             }
             catId = ownerCarPo.getCarId();
-        }else {
+        } else {
             catId = ownerCarDtos.get(0).getCarId();
         }
 
+        // 将车位状态 修改为已出租状态
+        ParkingSpacePo parkingSpacePo = new ParkingSpacePo();
+        parkingSpacePo.setPsId(parkingSpaceApply.getPsId());
+        parkingSpacePo.setState(ParkingSpaceDto.STATE_HIRE);
+        flag = parkingSpaceV1InnerServiceSMOImpl.updateParkingSpace(parkingSpacePo);
+        if (flag < 1) {
+            throw new CmdException("更新车位状态失败");
+        }
         FeeConfigDto feeConfigDto = new FeeConfigDto();
         feeConfigDto.setConfigId(parkingSpaceApply.getConfigId());
         List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);