Your Name лет назад: 3
Родитель
Сommit
fb5e86fa2b

+ 41 - 0
java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml

@@ -229,4 +229,45 @@
         order by CONVERT(t.layer,SIGNED),CONVERT(t.room_num,SIGNED)
     </select>
 
+    <select id="queryHisOwnerCarCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from business_owner_car t
+        left join c_business cb on t.b_id = cb.b_id
+        left join c_orders co on cb.o_id = co.o_id
+        left join u_user uu on co.user_id = uu.user_id
+        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'
+        left join t_dict t3 on t.lease_type = t3.status_cd and t3.table_name = 'owner_car' and t3.table_columns = 'lease_type'
+        left join t_dict t4 on t.car_type_cd=t4.status_cd and t4.table_name='owner_car' and t4.table_columns = 'car_type_cd'
+        where 1=1
+        and t.car_num = #{carNum}
+        and t.community_id= #{communityId}
+    </select>
+
+    <select id="queryHisOwnerCars" parameterType="Map" resultType="Map">
+        select t.car_color carColor,t.car_brand carBrand,t.car_type carType,t1.name
+        carTypeName,
+        t.car_num carNum,t.ps_id psId,t.remark,
+        t.owner_id ownerId,t.b_id bId,t.user_id userId,t.car_id carId ,t.create_time
+        createTime,t.community_id communityId,t2.name stateName,
+        t.start_time startTime,t.end_time endTime,t.state,
+        t.car_type_cd carTypeCd,t.member_id memberId,t.lease_type leaseType,
+        t3.name leaseTypeName,t4.name carTypeCdName,t.operate,uu.`name`
+        from business_owner_car t
+        left join c_business cb on t.b_id = cb.b_id
+        left join c_orders co on cb.o_id = co.o_id
+        left join u_user uu on co.user_id = uu.user_id
+        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'
+        left join t_dict t3 on t.lease_type = t3.status_cd and t3.table_name = 'owner_car' and t3.table_columns = 'lease_type'
+        left join t_dict t4 on t.car_type_cd=t4.status_cd and t4.table_name='owner_car' and t4.table_columns = 'car_type_cd'
+        where 1=1
+        and t.car_num = #{carNum}
+        and t.community_id= #{communityId}
+        order by t.create_time desc,t.operate
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
+
 </mapper>

+ 15 - 0
java110-interface/src/main/java/com/java110/intf/report/IReportCommunityInnerServiceSMO.java

@@ -49,4 +49,19 @@ public interface IReportCommunityInnerServiceSMO {
     @RequestMapping(value = "/queryRoomsTree", method = RequestMethod.POST)
     List<RoomDto> queryRoomsTree(@RequestBody RoomDto roomDto);
 
+    /**
+     * 查询车辆变更总数
+     * @param ownerCarDto
+     * @return
+     */
+    @RequestMapping(value = "/queryHisOwnerCarCount", method = RequestMethod.POST)
+    int queryHisOwnerCarCount(@RequestBody OwnerCarDto ownerCarDto);
+
+    /**
+     * 查询车辆变更
+     * @param ownerCarDto
+     * @return
+     */
+    @RequestMapping(value = "/queryHisOwnerCars", method = RequestMethod.POST)
+    List<OwnerCarDto> queryHisOwnerCars(@RequestBody OwnerCarDto ownerCarDto);
 }

+ 57 - 0
service-report/src/main/java/com/java110/report/cmd/car/QueryHisOwnerCarCmd.java

@@ -0,0 +1,57 @@
+package com.java110.report.cmd.car;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.basePrivilege.BasePrivilegeDto;
+import com.java110.dto.owner.OwnerCarDto;
+import com.java110.intf.report.IReportCommunityInnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 查询车辆变更记录
+ */
+@Java110Cmd(serviceCode = "car.queryHisOwnerCar")
+public class QueryHisOwnerCarCmd extends Cmd {
+
+    @Autowired
+    private IReportCommunityInnerServiceSMO reportCommunityInnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        Assert.hasKeyAndValue(reqJson,"carNum","未包含车辆");
+        Assert.hasKeyAndValue(reqJson,"communityId","未包含小区");
+
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        int row = reqJson.getInteger("row");
+        OwnerCarDto ownerCarDto = BeanConvertUtil.covertBean(reqJson, OwnerCarDto.class);
+
+        int total = reportCommunityInnerServiceSMOImpl.queryHisOwnerCarCount(ownerCarDto);
+//        int count = 0;
+        List<OwnerCarDto> ownerCarDtos = null;
+        if (total > 0) {
+            ownerCarDtos = reportCommunityInnerServiceSMOImpl.queryHisOwnerCars(ownerCarDto);
+        } else {
+            ownerCarDtos = new ArrayList<>();
+        }
+
+        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity((int) Math.ceil((double) total / (double) row), total, ownerCarDtos);
+        context.setResponseEntity(responseEntity);
+    }
+}

+ 13 - 0
service-report/src/main/java/com/java110/report/dao/IReportCommunityServiceDao.java

@@ -82,4 +82,17 @@ public interface IReportCommunityServiceDao {
 
     List<Map>  queryRoomsTree(Map info);
 
+    /**
+     * 查询车辆变更记录
+     * @param info
+     * @return
+     */
+    int queryHisOwnerCarCount(Map info);
+
+    /**
+     * 车辆变更记录
+     * @param info
+     * @return
+     */
+    List<Map> queryHisOwnerCars(Map info);
 }

+ 21 - 0
service-report/src/main/java/com/java110/report/dao/impl/ReportCommunityServiceDaoImpl.java

@@ -127,4 +127,25 @@ public class ReportCommunityServiceDaoImpl extends BaseServiceDao implements IRe
 
         return communityDtos;
     }
+
+    @Override
+    public int queryHisOwnerCarCount(Map info) {
+        logger.debug("查询车辆管理数据 入参 info : {}", info);
+
+        List<Map> businessOwnerCarInfos = sqlSessionTemplate.selectList("reportCommunityServiceDaoImpl.queryHisOwnerCarCount", info);
+        if (businessOwnerCarInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessOwnerCarInfos.get(0).get("count").toString());
+    }
+
+    @Override
+    public List<Map> queryHisOwnerCars(Map info) {
+        logger.debug("查询车辆管理信息 入参 info : {}", info);
+
+        List<Map> businessOwnerCarInfos = sqlSessionTemplate.selectList("reportCommunityServiceDaoImpl.queryHisOwnerCars", info);
+
+        return businessOwnerCarInfos;
+    }
 }

+ 23 - 0
service-report/src/main/java/com/java110/report/smo/impl/ReportCommunityInnerServiceSMOImpl.java

@@ -5,18 +5,22 @@ import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.dto.PageDto;
 import com.java110.dto.RoomDto;
 import com.java110.dto.owner.OwnerCarDto;
+import com.java110.dto.ownerCarAttr.OwnerCarAttrDto;
 import com.java110.dto.reportOwnerPayFee.ReportOwnerPayFeeDto;
 import com.java110.intf.report.IReportCommunityInnerServiceSMO;
 import com.java110.intf.report.IReportOwnerPayFeeInnerServiceSMO;
 import com.java110.po.reportOwnerPayFee.ReportOwnerPayFeePo;
 import com.java110.report.dao.IReportCommunityServiceDao;
 import com.java110.report.dao.IReportOwnerPayFeeServiceDao;
+import com.java110.utils.constant.StatusConstant;
 import com.java110.utils.util.BeanConvertUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @ClassName FloorInnerServiceSMOImpl
@@ -64,4 +68,23 @@ public class ReportCommunityInnerServiceSMOImpl extends BaseServiceSMO implement
         return roomDtos;
     }
 
+    @Override
+    public int queryHisOwnerCarCount(@RequestBody OwnerCarDto ownerCarDto) {
+        return reportCommunityServiceDaoImpl.queryHisOwnerCarCount(BeanConvertUtil.beanCovertMap(ownerCarDto));
+    }
+
+    @Override
+    public List<OwnerCarDto> queryHisOwnerCars(@RequestBody OwnerCarDto ownerCarDto) {
+
+        int page = ownerCarDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            ownerCarDto.setPage((page - 1) * ownerCarDto.getRow());
+        }
+
+        List<OwnerCarDto> ownerCars = BeanConvertUtil.covertBeanList(reportCommunityServiceDaoImpl.queryHisOwnerCars(BeanConvertUtil.beanCovertMap(ownerCarDto)), OwnerCarDto.class);
+
+        return ownerCars;
+    }
+
 }