java110 лет назад: 3
Родитель
Сommit
3f6fed0cc9

+ 15 - 1
java110-bean/src/main/java/com/java110/dto/owner/OwnerCarDto.java

@@ -1,7 +1,6 @@
 package com.java110.dto.owner;
 
 import com.java110.dto.PageDto;
-import com.java110.dto.RoomAttrDto;
 import com.java110.dto.ownerCarAttr.OwnerCarAttrDto;
 
 import java.io.Serializable;
@@ -29,6 +28,11 @@ public class OwnerCarDto extends PageDto implements Serializable {
 
     public static final String CAR_TYPE_CD_TEMP = "1003";
 
+    public static final String LEASE_TYPE_MONTH = "H"; // 月租车
+    public static final String LEASE_TYPE_SALE = "S"; // 出售车
+    public static final String LEASE_TYPE_INNER = "I"; //内部车
+    public static final String LEASE_TYPE_NO_MONEY = "NM"; //免费车
+
     private String carColor;
     private String carBrand;
     private String carType;
@@ -80,6 +84,8 @@ public class OwnerCarDto extends PageDto implements Serializable {
     private String roomNum;
     private String oweAmount;
 
+    private String leaseType;
+
     private List<OwnerCarAttrDto> ownerCarAttrDto;
 
 
@@ -419,4 +425,12 @@ public class OwnerCarDto extends PageDto implements Serializable {
     public void setOwnerCarAttrDto(List<OwnerCarAttrDto> ownerCarAttrDto) {
         this.ownerCarAttrDto = ownerCarAttrDto;
     }
+
+    public String getLeaseType() {
+        return leaseType;
+    }
+
+    public void setLeaseType(String leaseType) {
+        this.leaseType = leaseType;
+    }
 }

+ 10 - 0
java110-bean/src/main/java/com/java110/po/car/OwnerCarPo.java

@@ -35,6 +35,8 @@ public class OwnerCarPo implements Serializable {
     private String memberId;
     private String statusCd = "0";
 
+    private String leaseType;
+
 
     public String getCarId() {
         return carId;
@@ -171,4 +173,12 @@ public class OwnerCarPo implements Serializable {
     public void setbId(String bId) {
         this.bId = bId;
     }
+
+    public String getLeaseType() {
+        return leaseType;
+    }
+
+    public void setLeaseType(String leaseType) {
+        this.leaseType = leaseType;
+    }
 }

+ 14 - 2
java110-db/src/main/resources/mapper/user/OwnerCarServiceDaoImplMapper.xml

@@ -21,7 +21,7 @@
         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,t.community_id,t.community_id
         communityId,t.start_time,t.end_time,t.state,t.start_time startTime,t.end_time endTime,t.car_type_cd,
-        t.car_type_cd carTypeCd,t.member_id,t.member_id memberId
+        t.car_type_cd carTypeCd,t.member_id,t.member_id memberId,t.lease_type leaseType
         from business_owner_car t
         where 1 =1
         <if test="carColor !=null and carColor != ''">
@@ -51,6 +51,9 @@
         <if test="ownerId !=null and ownerId != ''">
             and t.owner_id= #{ownerId}
         </if>
+        <if test="leaseType !=null and leaseType != ''">
+            and t.lease_type= #{leaseType}
+        </if>
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
         </if>
@@ -128,7 +131,7 @@
         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,t.community_id communityId,bow.name ownerName,bow.id_card idCard,bow.link,t2.name stateName,
         t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.state,
-        t.car_type_cd,t.car_type_cd carTypeCd,t.member_id,t.member_id memberId,ps.num,pa.num areaNum
+        t.car_type_cd,t.car_type_cd carTypeCd,t.member_id,t.member_id memberId,ps.num,pa.num areaNum,t.lease_type leaseType
         from owner_car t
         left join t_dict t1 on t.car_type=t1.status_cd and t1.table_name='owner_car' and t1.table_columns = 'car_type'
         left join t_dict t2 on t.state=t2.status_cd and t2.table_name='owner_car' and t2.table_columns = 'state'
@@ -188,6 +191,9 @@
         <if test="ownerId !=null and ownerId != ''">
             and t.owner_id= #{ownerId}
         </if>
+        <if test="leaseType !=null and leaseType != ''">
+            and t.lease_type= #{leaseType}
+        </if>
         <if test="ownerName !=null and ownerName != ''">
             and bow.name like '%${ownerName}%'
         </if>
@@ -260,6 +266,9 @@
         <if test="ownerId !=null and ownerId != ''">
             , t.owner_id= #{ownerId}
         </if>
+        <if test="leaseType !=null and leaseType != ''">
+            , t.lease_type= #{leaseType}
+        </if>
         <if test="userId !=null and userId != ''">
             , t.user_id= #{userId}
         </if>
@@ -345,6 +354,9 @@
         <if test="ownerId !=null and ownerId != ''">
             and t.owner_id= #{ownerId}
         </if>
+        <if test="leaseType !=null and leaseType != ''">
+            and t.lease_type= #{leaseType}
+        </if>
         <if test="ownerName !=null and ownerName != ''">
             and bow.name like '%${ownerName}%'
         </if>

+ 12 - 3
java110-db/src/main/resources/mapper/user/OwnerCarV1ServiceDaoImplMapper.xml

@@ -8,9 +8,9 @@
     <!-- 保存车辆信息 add by wuxw 2018-07-03 -->
     <insert id="saveOwnerCarInfo" parameterType="Map">
         insert into owner_car(car_brand, car_num, ps_id, remark, owner_id, car_type_cd, user_id, car_id, car_color,
-                              car_type, start_time, end_time, state, community_id, member_id, b_id)
+                              car_type, start_time, end_time, state, community_id, member_id, b_id,lease_type)
         values (#{carBrand}, #{carNum}, #{psId}, #{remark}, #{ownerId}, #{carTypeCd}, #{userId}, #{carId}, #{carColor},
-                #{carType}, #{startTime}, #{endTime}, #{state}, #{communityId}, #{memberId}, '-1')
+                #{carType}, #{startTime}, #{endTime}, #{state}, #{communityId}, #{memberId}, '-1',#{leaseType})
     </insert>
 
 
@@ -20,7 +20,7 @@
         psId,t.remark,t.status_cd,t.status_cd statusCd,t.owner_id,t.owner_id ownerId,t.car_type_cd,t.car_type_cd
         carTypeCd,t.user_id,t.user_id userId,t.car_id,t.car_id carId,t.car_color,t.car_color
         carColor,t.car_type,t.car_type carType,t.start_time,t.start_time startTime,t.end_time,t.end_time
-        endTime,t.state,t.community_id,t.community_id communityId,t.member_id,t.member_id memberId
+        endTime,t.state,t.community_id,t.community_id communityId,t.member_id,t.member_id memberId,t.lease_type leaseType
         from owner_car t
         where 1 =1
         <if test="carBrand !=null and carBrand != ''">
@@ -41,6 +41,9 @@
         <if test="ownerId !=null and ownerId != ''">
             and t.owner_id= #{ownerId}
         </if>
+        <if test="leaseType !=null and leaseType != ''">
+            and t.lease_type= #{leaseType}
+        </if>
         <if test="carTypeCd !=null and carTypeCd != ''">
             and t.car_type_cd= #{carTypeCd}
         </if>
@@ -118,6 +121,9 @@
         <if test="state !=null and state != ''">
             , t.state= #{state}
         </if>
+        <if test="leaseType !=null and leaseType != ''">
+            , t.lease_type= #{leaseType}
+        </if>
         where 1=1
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
@@ -159,6 +165,9 @@
         <if test="ownerId !=null and ownerId != ''">
             and t.owner_id= #{ownerId}
         </if>
+        <if test="leaseType !=null and leaseType != ''">
+            and t.lease_type= #{leaseType}
+        </if>
         <if test="carTypeCd !=null and carTypeCd != ''">
             and t.car_type_cd= #{carTypeCd}
         </if>

+ 11 - 0
service-user/src/main/java/com/java110/user/cmd/owner/EditOwnerCarCmd.java

@@ -28,11 +28,13 @@ import com.java110.po.car.OwnerCarPo;
 import com.java110.utils.exception.CmdException;
 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.ResultVo;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -84,6 +86,15 @@ public class EditOwnerCarCmd extends Cmd {
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
+        if (!reqJson.containsKey("leaseType")) {
+            reqJson.put("leaseType", OwnerCarDto.LEASE_TYPE_MONTH);
+        }
+
+        if (OwnerCarDto.LEASE_TYPE_SALE.equals(reqJson.getString("leaseType"))) {
+            reqJson.put("startTime", DateUtil.getFormatTimeString(new Date(), DateUtil.DATE_FORMATE_STRING_B));
+            reqJson.put("endTime", "2037-01-01");
+        }
+
         OwnerCarPo ownerCarPo = BeanConvertUtil.covertBean(reqJson, OwnerCarPo.class);
         int flag = ownerCarV1InnerServiceSMOImpl.updateOwnerCar(ownerCarPo);
 

+ 12 - 6
service-user/src/main/java/com/java110/user/cmd/owner/SaveOwnerCarCmd.java

@@ -22,14 +22,14 @@ import com.java110.po.car.OwnerCarPo;
 import com.java110.po.ownerCarAttr.OwnerCarAttrPo;
 import com.java110.po.parking.ParkingSpacePo;
 import com.java110.utils.cache.MappingCache;
-import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.exception.CmdException;
-import com.java110.utils.exception.ListenerExecuteException;
 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 org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.Date;
 import java.util.List;
 
 @Java110Cmd(serviceCode = "owner.saveOwnerCar")
@@ -73,10 +73,6 @@ public class SaveOwnerCarCmd extends Cmd {
         Assert.hasLength(reqJson.getString("ownerId"), "ownerId不能为空");
         Assert.hasLength(reqJson.getString("psId"), "psId不能为空");
 
-        if (!"H".equals(reqJson.getString("carNumType"))
-                && !"S".equals(reqJson.getString("carNumType"))) {
-            throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "请求报文中sellOrFire值错误 ,出售为S 出租为H");
-        }
 
         //校验车牌号是否存在
         OwnerCarDto ownerCarDto = new OwnerCarDto();
@@ -117,6 +113,14 @@ public class SaveOwnerCarCmd extends Cmd {
     @Override
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+        if (!reqJson.containsKey("leaseType")) {
+            reqJson.put("leaseType", OwnerCarDto.LEASE_TYPE_MONTH);
+        }
+
+        if (OwnerCarDto.LEASE_TYPE_SALE.equals(reqJson.getString("leaseType"))) {
+            reqJson.put("startTime", DateUtil.getFormatTimeString(new Date(), DateUtil.DATE_FORMATE_STRING_B));
+            reqJson.put("endTime", "2037-01-01");
+        }
         JSONObject businessOwnerCar = new JSONObject();
         businessOwnerCar.putAll(reqJson);
         businessOwnerCar.put("memberId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_carId));
@@ -132,6 +136,8 @@ public class SaveOwnerCarCmd extends Cmd {
         }
         //添加车辆属性
         dealOwnerCarAttr(reqJson, ownerCarPo);
+
+
         int flag = ownerCarV1InnerServiceSMOImpl.saveOwnerCar(ownerCarPo);
         if (flag < 1) {
             throw new CmdException("保存车辆属性失败");