Przeglądaj źródła

optimize owner import

java110 3 lat temu
rodzic
commit
077850fa44

+ 2 - 1
java110-bean/src/main/java/com/java110/dto/resourceStoreTimes/ResourceStoreTimesDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.resourceStoreTimes;
 
 import com.java110.dto.PageDto;
+import com.java110.dto.resourceStore.ResourceStoreDto;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -13,7 +14,7 @@ import java.util.Date;
  * @Version 1.0
  * add by wuxw 2019/4/24
  **/
-public class ResourceStoreTimesDto extends PageDto implements Serializable {
+public class ResourceStoreTimesDto extends ResourceStoreDto implements Serializable {
 
     private String price;
     private String totalPrice;

+ 67 - 10
java110-db/src/main/resources/mapper/store/ResourceStoreTimesV1ServiceDaoImplMapper.xml

@@ -19,9 +19,45 @@
     <select id="getResourceStoreTimesInfo" parameterType="Map" resultType="Map">
         select t.price,t.apply_order_id,t.apply_order_id applyOrderId,t.status_cd,t.status_cd
         statusCd,t.store_id,t.store_id storeId,t.stock,t.res_code,t.res_code resCode,t.times_id,
-        t.times_id timesId,t.create_time createTime,(t.price * t.stock) totalPrice
+        t.times_id timesId,t.create_time createTime,(t.price * t.stock) totalPrice,
+        rs.res_name,rs.res_name resName,rs.description,rs.store_id,rs.store_id storeId,
+        rs.stock,rs.warning_stock,rs.warning_stock warningStock,rs.res_id,rs.res_id resId,rs.out_low_price,rs.rss_id,rs.rss_id rssId,
+        rs.out_low_price outLowPrice,rs.out_high_price,rs.out_high_price outHighPrice,
+        rs.unit_code,rs.unit_code unitCode,rs.remark,rs.show_mobile,rs.show_mobile showMobile,
+        rs.sh_id,rs.sh_id shId,sh.sh_name shName,rs.average_price,rs.average_price
+        averagePrice,rss.spec_name rssName,rs.mini_unit_code,rs.mini_unit_code miniUnitCode,rs.mini_stock,rs.mini_stock
+        miniStock,rs.mini_unit_stock,rs.mini_unit_stock miniUnitStock,td.name unitCodeName,td1.name
+        miniUnitCodeName,sh.sh_type shType,rs.parent_rst_id parentRstId,rs.rst_id rstId,rst1.name parentRstName,rst.name
+        rstName,
+        rs.is_fixed,rs.is_fixed isFixed,td2.name isFixedName
         from resource_store_times t
+        inner join resource_store rs on t.res_code = rs.res_code and rs.status_cd = '0'
+        left join resource_store_type rst on rs.rst_id = rst.rst_id and rst.status_cd = '0'
+        left join resource_store_type rst1 on rs.parent_rst_id = rst1.rst_id and rst1.status_cd = '0'
+        left join resource_store_specification rss on rs.rss_id = rss.rss_id and rss.status_cd = '0'
+        left join storehouse sh on rs.sh_id = sh.sh_id and rs.store_id = sh.store_id and sh.status_cd = '0'
+        left join t_dict td on rs.unit_code = td.status_cd and td.table_name = 'resource_store' and td.table_columns =
+        'unit_code'
+        left join t_dict td1 on rs.mini_unit_code = td1.status_cd and td1.table_name = 'resource_store' and
+        td1.table_columns = 'unit_code'
+        left join t_dict td2 on rs.is_fixed = td2.status_cd and td2.table_name='resource_store' and td2.table_columns =
+        'is_fixed'
         where 1 =1
+        <if test="resName !=null and resName != ''">
+            and rs.res_name like concat('%',#{resName},'%')
+        </if>
+        <if test="name != null and name != ''">
+            and rs.res_name = #{name}
+        </if>
+        <if test="rstId !=null and rstId != ''">
+            and rs.rst_id= #{rstId}
+        </if>
+        <if test="parentRstId !=null and parentRstId != ''">
+            and rs.parent_rst_id= #{parentRstId}
+        </if>
+        <if test="resCode !=null and resCode != ''">
+            and t.res_code like concat('%',#{resCode},'%')
+        </if>
         <if test="price !=null and price != ''">
             and t.price= #{price}
         </if>
@@ -40,9 +76,6 @@
         <if test="hasStock !=null and hasStock != ''">
             and t.stock > 0
         </if>
-        <if test="resCode !=null and resCode != ''">
-            and t.res_code= #{resCode}
-        </if>
         <if test="resCodes != null ">
             and t.res_code in
             <foreach collection="resCodes" item="item" open="(" close=")" separator=",">
@@ -72,9 +105,7 @@
         <if test="applyOrderId !=null and applyOrderId != ''">
             , t.apply_order_id= #{applyOrderId}
         </if>
-        <if test="storeId !=null and storeId != ''">
-            , t.store_id= #{storeId}
-        </if>
+
         <if test="stock !=null and stock != ''">
             , t.stock= #{stock}
         </if>
@@ -85,6 +116,9 @@
         <if test="timesId !=null and timesId != ''">
             and t.times_id= #{timesId}
         </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
 
     </update>
 
@@ -92,7 +126,33 @@
     <select id="queryResourceStoreTimessCount" parameterType="Map" resultType="Map">
         select count(1) count
         from resource_store_times t
+        inner join resource_store rs on t.res_code = rs.res_code and rs.status_cd = '0'
+        left join resource_store_type rst on rs.rst_id = rst.rst_id and rst.status_cd = '0'
+        left join resource_store_type rst1 on rs.parent_rst_id = rst1.rst_id and rst1.status_cd = '0'
+        left join resource_store_specification rss on rs.rss_id = rss.rss_id and rss.status_cd = '0'
+        left join storehouse sh on rs.sh_id = sh.sh_id and rs.store_id = sh.store_id and sh.status_cd = '0'
+        left join t_dict td on rs.unit_code = td.status_cd and td.table_name = 'resource_store' and td.table_columns =
+        'unit_code'
+        left join t_dict td1 on rs.mini_unit_code = td1.status_cd and td1.table_name = 'resource_store' and
+        td1.table_columns = 'unit_code'
+        left join t_dict td2 on rs.is_fixed = td2.status_cd and td2.table_name='resource_store' and td2.table_columns =
+        'is_fixed'
         where 1 =1
+        <if test="resName !=null and resName != ''">
+            and rs.res_name like concat('%',#{resName},'%')
+        </if>
+        <if test="name != null and name != ''">
+            and rs.res_name = #{name}
+        </if>
+        <if test="rstId !=null and rstId != ''">
+            and rs.rst_id= #{rstId}
+        </if>
+        <if test="parentRstId !=null and parentRstId != ''">
+            and rs.parent_rst_id= #{parentRstId}
+        </if>
+        <if test="resCode !=null and resCode != ''">
+            and t.res_code like concat('%',#{resCode},'%')
+        </if>
         <if test="price !=null and price != ''">
             and t.price= #{price}
         </if>
@@ -111,9 +171,6 @@
         <if test="hasStock !=null and hasStock != ''">
             and t.stock > 0
         </if>
-        <if test="resCode !=null and resCode != ''">
-            and t.res_code= #{resCode}
-        </if>
         <if test="resCodes != null ">
             and t.res_code in
             <foreach collection="resCodes" item="item" open="(" close=")" separator=",">

+ 2 - 2
service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportOwnerCarSMOImpl.java

@@ -70,7 +70,7 @@ public class ExportOwnerCarSMOImpl extends DefaultAbstractComponentSMO implement
         Row row = sheet.createRow(0);
         Cell cell0 = row.createCell(0);
         cell0.setCellValue("房屋号: 格式为xx-xx-xx(楼栋-单元-房屋);\n车辆类型:9901表示家用小汽车,9902表示客车,9903表示货车;" +
-                "\n车位:xx-xx(停车场-车位)" + "\n起租时间: 格式为YYYY-MM-DD HH:mm:ss;\n截止时间: 格式为YYYY-MM-DD HH:mm:ss;" +
+                "\n停车场:停车场编号,系统中不存在自动创建" + "\n车位:停车位编号,系统中不存在自动创建" + "\n起租时间: 格式为YYYY-MM-DD;\n截止时间: 格式为YYYY-MM-DD;" +
                 "\n停车场类型:1001表示地上停车场,2001表示地下停车场;\n车位状态:S表示出售,H表示出租;" +
                 "\n注意:所有单元格式为文本");
         CellStyle cs = workbook.createCellStyle();
@@ -83,7 +83,7 @@ public class ExportOwnerCarSMOImpl extends DefaultAbstractComponentSMO implement
         row.createCell(2).setCellValue("车辆品牌");
         row.createCell(3).setCellValue("车辆类型");
         row.createCell(4).setCellValue("颜色");
-        row.createCell(5).setCellValue("业主");
+        row.createCell(5).setCellValue("停车场");
         row.createCell(6).setCellValue("车位");
         row.createCell(7).setCellValue("起租时间");
         row.createCell(8).setCellValue("截止时间");

+ 7 - 15
service-api/src/main/java/com/java110/api/smo/assetImport/impl/ImportOwnerCarSMOImpl.java

@@ -119,7 +119,7 @@ public class ImportOwnerCarSMOImpl extends DefaultAbstractComponentSMO implement
             Assert.hasValue(os[2], (osIndex + 1) + "车辆品牌不能为空");
             Assert.hasValue(os[3], (osIndex + 1) + "车辆类型不能为空");
             Assert.hasValue(os[4], (osIndex + 1) + "颜色不能为空");
-            Assert.hasValue(os[5], (osIndex + 1) + "业主不能为空");
+            Assert.hasValue(os[5], (osIndex + 1) + "停车场不能为空");
             Assert.hasValue(os[6], (osIndex + 1) + "车位不能为空");
             Assert.hasValue(os[7], (osIndex + 1) + "起租时间不能为空");
             Assert.hasValue(os[8], (osIndex + 1) + "截止时间不能为空");
@@ -127,27 +127,19 @@ public class ImportOwnerCarSMOImpl extends DefaultAbstractComponentSMO implement
             Assert.hasValue(os[10], (osIndex + 1) + "车位类型不能为空");
             String startTime = excelDoubleToDate(os[7].toString());
             String endTime = excelDoubleToDate(os[8].toString());
-            Assert.isDate(startTime, DateUtil.DATE_FORMATE_STRING_A, (osIndex + 1) + "行开始时间格式错误 请填写YYYY-MM-DD HH:mm:ss文本格式");
-            Assert.isDate(endTime, DateUtil.DATE_FORMATE_STRING_A, (osIndex + 1) + "行结束时间格式错误 请填写YYYY-MM-DD HH:mm:ss文本格式");
+            Assert.isDate(startTime, DateUtil.DATE_FORMATE_STRING_B, (osIndex + 1) + "行开始时间格式错误 请填写YYYY-MM-DD文本格式");
+            Assert.isDate(endTime, DateUtil.DATE_FORMATE_STRING_B, (osIndex + 1) + "行结束时间格式错误 请填写YYYY-MM-DD文本格式");
             importOwnerCar = new OwnerCarDto();
             importOwnerCar.setCarNum(os[0].toString());
             importOwnerCar.setRoomName(os[1].toString());
             importOwnerCar.setCarBrand(os[2].toString());
             importOwnerCar.setCarType(os[3].toString());
             importOwnerCar.setCarColor(os[4].toString());
-            importOwnerCar.setOwnerName(os[5].toString());
+            importOwnerCar.setAreaNum(os[5].toString());
             //获取车位
             String parkingLot = os[6].toString();
-            if(!parkingLot.contains("-")){
-                throw new IllegalArgumentException((osIndex + 1) +"行车位格式错误 格式应为:停车场-车位编号,车位编号可以从1自行编写");
-            }
-            String[] split = parkingLot.split("-",2);
-            if(split.length != 2){
-                throw new IllegalArgumentException((osIndex + 1) +"行车位格式错误 格式应为:停车场-车位编号,车位编号可以从1自行编写");
-            }
-            importOwnerCar.setAreaNum(split[0]);
-            importOwnerCar.setNum(split[1]);
-            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            importOwnerCar.setNum(parkingLot);
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
             importOwnerCar.setStartTime(simpleDateFormat.parse(startTime));
             importOwnerCar.setEndTime(simpleDateFormat.parse(endTime));
             importOwnerCar.setTypeCd(os[9].toString());
@@ -295,7 +287,7 @@ public class ImportOwnerCarSMOImpl extends DefaultAbstractComponentSMO implement
             Assert.listOnlyOne(ownerRoomRelDtos, ownerCarDto.getCarNum() + "查询业主房屋信息错误!");
             OwnerDto ownerDto = new OwnerDto();
             ownerDto.setOwnerId(ownerRoomRelDtos.get(0).getOwnerId());
-            ownerDto.setName(ownerCarDto.getOwnerName());
+            //ownerDto.setName(ownerCarDto.getOwnerName());
             //查询业主
             List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
             Assert.listOnlyOne(ownerDtos, ownerCarDto.getCarNum() + "查询业主信息错误!");

+ 71 - 0
service-store/src/main/java/com/java110/store/cmd/resourceStore/ListResourceStoresAndTimesCmd.java

@@ -0,0 +1,71 @@
+package com.java110.store.cmd.resourceStore;
+
+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.PageDto;
+import com.java110.dto.basePrivilege.BasePrivilegeDto;
+import com.java110.dto.resourceStore.ResourceStoreDto;
+import com.java110.dto.resourceStoreTimes.ResourceStoreTimesDto;
+import com.java110.dto.storehouse.StorehouseDto;
+import com.java110.intf.community.IMenuInnerServiceSMO;
+import com.java110.intf.store.IResourceStoreInnerServiceSMO;
+import com.java110.intf.store.IResourceStoreTimesV1InnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import com.java110.vo.api.resourceStore.ApiResourceStoreDataVo;
+import com.java110.vo.api.resourceStore.ApiResourceStoreVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 查询价格物品
+ * add by wuxw 2023-01-19
+ */
+@Java110Cmd(serviceCode = "resourceStore.listResourceStoresAndTimes")
+public class ListResourceStoresAndTimesCmd extends Cmd {
+
+    @Autowired
+    private IResourceStoreTimesV1InnerServiceSMO resourceStoreTimesV1InnerServiceSMOImpl;
+
+    @Autowired
+    private IMenuInnerServiceSMO menuInnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+        super.validatePageInfo(reqJson);
+        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含小区ID");
+        Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含商户ID");
+
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        ResourceStoreTimesDto resourceStoreTimesDto = BeanConvertUtil.covertBean(reqJson, ResourceStoreTimesDto.class);
+
+        int count = resourceStoreTimesV1InnerServiceSMOImpl.queryResourceStoreTimessCount(resourceStoreTimesDto);
+        List<ResourceStoreTimesDto> resourceStores = null;
+        if (count > 0) {
+            resourceStores = resourceStoreTimesV1InnerServiceSMOImpl.queryResourceStoreTimess(resourceStoreTimesDto);
+        } else {
+            resourceStores = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, resourceStores);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        context.setResponseEntity(responseEntity);
+    }
+}

+ 2 - 2
springboot/src/main/java/com/java110/boot/smo/assetExport/impl/ExportOwnerCarSMOImpl.java

@@ -70,7 +70,7 @@ public class ExportOwnerCarSMOImpl extends DefaultAbstractComponentSMO implement
         Row row = sheet.createRow(0);
         Cell cell0 = row.createCell(0);
         cell0.setCellValue("房屋号: 格式为xx-xx-xx(楼栋-单元-房屋);\n车辆类型:9901表示家用小汽车,9902表示客车,9903表示货车;" +
-                "\n车位:xx-xx(停车场-车位)" + "\n起租时间: 格式为YYYY-MM-DD HH:mm:ss;\n截止时间: 格式为YYYY-MM-DD HH:mm:ss;" +
+                "\n停车场:停车场编号,系统中不存在自动创建" + "\n车位:停车位编号,系统中不存在自动创建" + "\n起租时间: 格式为YYYY-MM-DD;\n截止时间: 格式为YYYY-MM-DD;" +
                 "\n停车场类型:1001表示地上停车场,2001表示地下停车场;\n车位状态:S表示出售,H表示出租;" +
                 "\n注意:所有单元格式为文本");
         CellStyle cs = workbook.createCellStyle();
@@ -83,7 +83,7 @@ public class ExportOwnerCarSMOImpl extends DefaultAbstractComponentSMO implement
         row.createCell(2).setCellValue("车辆品牌");
         row.createCell(3).setCellValue("车辆类型");
         row.createCell(4).setCellValue("颜色");
-        row.createCell(5).setCellValue("业主");
+        row.createCell(5).setCellValue("停车场");
         row.createCell(6).setCellValue("车位");
         row.createCell(7).setCellValue("起租时间");
         row.createCell(8).setCellValue("截止时间");

+ 7 - 15
springboot/src/main/java/com/java110/boot/smo/assetImport/impl/ImportOwnerCarSMOImpl.java

@@ -120,7 +120,7 @@ public class ImportOwnerCarSMOImpl extends DefaultAbstractComponentSMO implement
             Assert.hasValue(os[2], (osIndex + 1) + "车辆品牌不能为空");
             Assert.hasValue(os[3], (osIndex + 1) + "车辆类型不能为空");
             Assert.hasValue(os[4], (osIndex + 1) + "颜色不能为空");
-            Assert.hasValue(os[5], (osIndex + 1) + "业主不能为空");
+            Assert.hasValue(os[5], (osIndex + 1) + "停车场不能为空");
             Assert.hasValue(os[6], (osIndex + 1) + "车位不能为空");
             Assert.hasValue(os[7], (osIndex + 1) + "起租时间不能为空");
             Assert.hasValue(os[8], (osIndex + 1) + "截止时间不能为空");
@@ -128,27 +128,19 @@ public class ImportOwnerCarSMOImpl extends DefaultAbstractComponentSMO implement
             Assert.hasValue(os[10], (osIndex + 1) + "车位类型不能为空");
             String startTime = excelDoubleToDate(os[7].toString());
             String endTime = excelDoubleToDate(os[8].toString());
-            Assert.isDate(startTime, DateUtil.DATE_FORMATE_STRING_A, (osIndex + 1) + "行开始时间格式错误 请填写YYYY-MM-DD HH:mm:ss文本格式");
-            Assert.isDate(endTime, DateUtil.DATE_FORMATE_STRING_A, (osIndex + 1) + "行结束时间格式错误 请填写YYYY-MM-DD HH:mm:ss文本格式");
+            Assert.isDate(startTime, DateUtil.DATE_FORMATE_STRING_B, (osIndex + 1) + "行开始时间格式错误 请填写YYYY-MM-DD文本格式");
+            Assert.isDate(endTime, DateUtil.DATE_FORMATE_STRING_B, (osIndex + 1) + "行结束时间格式错误 请填写YYYY-MM-DD文本格式");
             importOwnerCar = new OwnerCarDto();
             importOwnerCar.setCarNum(os[0].toString());
             importOwnerCar.setRoomName(os[1].toString());
             importOwnerCar.setCarBrand(os[2].toString());
             importOwnerCar.setCarType(os[3].toString());
             importOwnerCar.setCarColor(os[4].toString());
-            importOwnerCar.setOwnerName(os[5].toString());
+            importOwnerCar.setAreaNum(os[5].toString());
             //获取车位
             String parkingLot = os[6].toString();
-            if(!parkingLot.contains("-")){
-                throw new IllegalArgumentException((osIndex + 1) +"行车位格式错误 格式应为:停车场-车位编号,车位编号可以从1自行编写");
-            }
-            String[] split = parkingLot.split("-",2);
-            if(split.length != 2){
-                throw new IllegalArgumentException((osIndex + 1) +"行车位格式错误 格式应为:停车场-车位编号,车位编号可以从1自行编写");
-            }
-            importOwnerCar.setAreaNum(split[0]);
-            importOwnerCar.setNum(split[1]);
-            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            importOwnerCar.setNum(parkingLot);
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
             importOwnerCar.setStartTime(simpleDateFormat.parse(startTime));
             importOwnerCar.setEndTime(simpleDateFormat.parse(endTime));
             importOwnerCar.setTypeCd(os[9].toString());
@@ -296,7 +288,7 @@ public class ImportOwnerCarSMOImpl extends DefaultAbstractComponentSMO implement
             Assert.listOnlyOne(ownerRoomRelDtos, ownerCarDto.getCarNum() + "查询业主房屋信息错误!");
             OwnerDto ownerDto = new OwnerDto();
             ownerDto.setOwnerId(ownerRoomRelDtos.get(0).getOwnerId());
-            ownerDto.setName(ownerCarDto.getOwnerName());
+            //ownerDto.setName(ownerCarDto.getOwnerName());
             //查询业主
             List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
             Assert.listOnlyOne(ownerDtos, ownerCarDto.getCarNum() + "查询业主信息错误!");