Преглед изворни кода

更新-状态, excel增加一列

wuweihao пре 3 година
родитељ
комит
7ddb9e56ef

+ 1 - 1
gis_cms/src/main/java/com/gis/cms/entity/dto/HotelPageDto.java

@@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull;
 @Data
 public class HotelPageDto extends PageDto {
 
-    @ApiModelProperty(value = "状态 > 0:可用, 1:储备, 2:应急储备")
+    @ApiModelProperty(value = "状态 > 1 2 3 4")
     private Integer status;
 
     @NotNull(message = "区域不能为空")

+ 11 - 1
gis_cms/src/main/java/com/gis/cms/entity/po/HotelEntity.java

@@ -23,7 +23,17 @@ public class HotelEntity extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "酒店名称")
     private String name;
 
-    @ApiModelProperty(value = "状态 > 0:可用, 1:储备, 2:应急储备")
+    /**
+     * by owen 2022-07-15
+     * 1. 第一梯次启用(12 小时);
+     * 2. 第二梯次启用(24 小时);
+     * 3. 第三梯次启用(48 小时);
+     * 4. 第四梯次启用(72 小时);
+     *
+     * 历史:
+     * 状态 > 0:可用, 1:储备, 2:应急储备
+     */
+    @ApiModelProperty(value = "状态 > 1. 第一梯次启用(12 小时)|  2. 第二梯次启用(24 小时)| 3. 第三梯次启用(48 小时)| 4. 第四梯次启用(72 小时)")
     private Integer status;
 
     @ApiModelProperty(value = "区域 > 1:香洲区, 2:斗门去, 3:金湾区")

+ 4 - 0
gis_cms/src/main/java/com/gis/cms/entity/vo/HotelExcel.java

@@ -60,6 +60,10 @@ public class HotelExcel implements Serializable {
     @ApiModelProperty(value = "备注")
     private String remark;
 
+    @ApiModelProperty(value = "状态 > 1. 第一梯次启用(12 小时)|  2. 第二梯次启用(24 小时)| 3. 第三梯次启用(48 小时)| 4. 第四梯次启用(72 小时)")
+    private String status;
+
+
 
 
 }

+ 1 - 1
gis_cms/src/main/java/com/gis/cms/mapper/HotelMapper.java

@@ -30,7 +30,7 @@ public interface HotelMapper extends BaseMapper<HotelEntity> {
     List<HotelVo> apiList();
 
 
-    @Select("select id, unit, name, total, room_isolation, used, usable, touch, touch_second,remark, " +
+    @Select("select id, unit, name, total, room_isolation, used, usable, touch, touch_second,remark,status, " +
             "IF(case_sign=1, '是', '否') case_sign," +
             "IF(case_accept=1, '是', '否') case_accept," +
             "IF(case_build=1, '是', '否') case_build," +

+ 14 - 7
gis_cms/src/main/java/com/gis/cms/service/impl/HotelServiceImpl.java

@@ -70,6 +70,15 @@ public class HotelServiceImpl extends ServiceImpl<HotelMapper, HotelEntity> impl
     @Autowired
     ContactService contactService;
 
+    private static final Map<String, String> statusMap = new HashMap<String, String>();
+    static{
+        statusMap.put("1", "第一梯次启用(12小时)");
+        statusMap.put("2", "第一梯次启用(24小时)");
+        statusMap.put("3", "第一梯次启用(48小时)");
+        statusMap.put("4", "第一梯次启用(72小时)");
+    }
+
+
 
 
     @Override
@@ -299,8 +308,6 @@ public class HotelServiceImpl extends ServiceImpl<HotelMapper, HotelEntity> impl
 
     @Override
     public Result exportExcel(){
-//        List<HotelExcel> rows = baseMapper.getExcelList();
-//        List<HotelExcel> rows = getRows();
         List<JSONObject> rows = getRows_2();
         String filePath = "/excel/" + DateUtils.getDateTime() +  ".xlsx";
 
@@ -320,10 +327,12 @@ public class HotelServiceImpl extends ServiceImpl<HotelMapper, HotelEntity> impl
         rowTitle.put("caseAccept", "验收情况");
         rowTitle.put("caseBuild", "三区两通道搭建情况");
         rowTitle.put("caseSupplies", "物资情况");
-        rowTitle.put("remark", "备注");
 
         rowTitle.putAll(getContactTypeTitle());
 
+        rowTitle.put("status", "梯次启用计划");
+        rowTitle.put("remark", "备注");
+
 
 
         ExcelUtils.createExcel(rows, configConstant.serverBasePath + filePath, rowTitle);
@@ -401,11 +410,9 @@ public class HotelServiceImpl extends ServiceImpl<HotelMapper, HotelEntity> impl
         // 将联系人信息添加到酒店详情
         List<JSONObject> newRows = new ArrayList<>();
         for (HotelExcel row : rows) {
+            // 映射值
+            row.setStatus(statusMap.get(row.getStatus()));
             // 转json
-//            row.setCaseAccept();
-//            row.setCaseBuild();
-//            row.setCaseSign();
-//            row.setCaseSupplies();
             JSONObject rowJson = (JSONObject)JSONObject.toJSON(row);
 
             for (Map.Entry<Long, Map<String, String>> entry : resMap.entrySet()) {

+ 1 - 1
gis_common/src/main/java/com/gis/common/util/ExcelUtils.java

@@ -32,7 +32,7 @@ public class ExcelUtils {
             for (Map.Entry<String, String> a : rowTitle.entrySet()) {
                 writer.addHeaderAlias(a.getKey(), a.getValue());
                 // 列宽-特殊处理
-                if ("name".equals(a.getKey()) || "remark".equals(a.getKey()) || NumberUtil.isNumber(a.getKey())){
+                if ("name".equals(a.getKey()) || "remark".equals(a.getKey()) || "status".equals(a.getKey()) ||NumberUtil.isNumber(a.getKey())){
                     writer.setColumnWidth(i, 20);
                 }