From f3452e172e49eb8b588bec6c81a7e08b458fc4bd Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Fri, 22 Apr 2022 09:44:36 +0800
Subject: [PATCH] 企业整顿清单

---
 screen-api/src/main/java/com/moral/api/service/RectifyService.java                      |   31 ++++
 screen-api/src/main/java/com/moral/api/controller/RectifyController.java                |   89 ++++++++++++
 screen-job/src/main/java/com/moral/api/service/impl/CityWeatherForecastServiceImpl.java |   14 ++
 screen-api/src/main/java/com/moral/api/service/impl/RectifyServiceImpl.java             |   79 +++++++++++
 screen-api/src/main/java/com/moral/api/entity/Rectify.java                              |  156 ++++++++++++++++++++++
 screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java          |    2 
 screen-job/src/main/java/com/moral/api/service/impl/CityWeatherServiceImpl.java         |    1 
 screen-api/src/main/resources/application-specialCity.yml                               |    8 
 screen-job/src/main/java/com/moral/api/service/impl/CityAqiServiceImpl.java             |    1 
 screen-api/src/main/java/com/moral/api/mapper/RectifyMapper.java                        |   16 ++
 10 files changed, 393 insertions(+), 4 deletions(-)

diff --git a/screen-api/src/main/java/com/moral/api/controller/RectifyController.java b/screen-api/src/main/java/com/moral/api/controller/RectifyController.java
new file mode 100644
index 0000000..c667c5a
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/controller/RectifyController.java
@@ -0,0 +1,89 @@
+package com.moral.api.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import com.moral.api.entity.Rectify;
+import com.moral.api.service.RectifyService;
+import com.moral.constant.ResponseCodeEnum;
+import com.moral.constant.ResultMessage;
+import com.moral.util.WebUtils;
+
+@Slf4j
+@Api(tags = {"������������"})
+@RestController
+@CrossOrigin(origins = "*", maxAge = 3600)
+@RequestMapping("rectify")
+public class RectifyController {
+
+    @Autowired
+    private RectifyService rectifyService;
+
+    @PostMapping("addRectify")
+    public ResultMessage addRectify(@RequestBody Rectify rectify) {
+        if (rectify.getCityCode() == null || rectify.getCityName() == null) {
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+        }
+        int count = rectifyService.addRectify(rectify);
+        if (count > 0) {
+            return ResultMessage.ok();
+        }
+        return ResultMessage.fail();
+    }
+
+
+    @ApiOperation(value = "������������������", notes = "������������������")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "cityCode", value = "������������", required = false, paramType = "query", dataType = "int"),
+            @ApiImplicitParam(name = "time", value = "���������������2022", required = false, paramType = "query", dataType = "String"),
+            @ApiImplicitParam(name = "page", value = "���������", required = false, paramType = "query", dataType = "int"),
+            @ApiImplicitParam(name = "size", value = "������������", required = false, paramType = "query", dataType = "int")
+    })
+    @GetMapping("queryRectify")
+    public ResultMessage queryRectify(HttpServletRequest request) {
+        Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
+        if (params.get("cityCode") == null || params.get("time") == null) {
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+        }
+        Map<String, Object> response = rectifyService.queryRectifyByCityCode(params);
+        return ResultMessage.ok(response);
+    }
+
+    @PostMapping("updateRectify")
+    public ResultMessage updateRectify(@RequestBody Rectify rectify) {
+        if (rectify.getId() == null) {
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+        }
+        int count = rectifyService.updateRectify(rectify);
+        if (count > 0) {
+            return ResultMessage.ok();
+        }
+        return ResultMessage.fail();
+    }
+
+    @GetMapping("deleteRectify")
+    public ResultMessage deleteRectify(Integer id) {
+        if (id == null) {
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+        }
+        int count = rectifyService.deleteRectify(id);
+        if (count > 0) {
+            return ResultMessage.ok();
+        }
+        return ResultMessage.fail();
+    }
+}
diff --git a/screen-api/src/main/java/com/moral/api/entity/Rectify.java b/screen-api/src/main/java/com/moral/api/entity/Rectify.java
new file mode 100644
index 0000000..38193b8
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/entity/Rectify.java
@@ -0,0 +1,156 @@
+package com.moral.api.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * ������������������
+ * </p>
+ *
+ * @author moral
+ * @since 2022-04-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class Rectify extends Model<Rectify> {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ������
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * ������������
+     */
+    private Integer cityCode;
+
+    /**
+     * ������������
+     */
+    private String cityName;
+
+    /**
+     * ���������������
+     */
+    private String areaName;
+
+    /**
+     * ������������
+     */
+    private String townName;
+
+    /**
+     * ������������������
+     */
+    private String institutionCode;
+
+    /**
+     * ������������
+     */
+    private String enterpriseName;
+
+    /**
+     * ������������
+     */
+    private String enterpriseAddress;
+
+    /**
+     * ������
+     */
+    private Double longitude;
+
+    /**
+     * ������
+     */
+    private Double latitude;
+
+    /**
+     * ������������
+     */
+    private String enterpriseScale;
+
+    /**
+     * ���������������������������������
+     */
+    private String material;
+
+    /**
+     * ���������������������������������
+     */
+    private String fuel;
+
+    /**
+     * ���������������������������������
+     */
+    private String product;
+
+    /**
+     * ������������
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date completeTime;
+
+    /**
+     * ������������
+     */
+    private String responsibleUnit;
+
+    /**
+     * ���������
+     */
+    private String responsiblePerson;
+
+    /**
+     * ������������
+     */
+    private String isComplete;
+
+    /**
+     * ������������
+     */
+    private String rectifyCategory;
+
+    /**
+     * ������
+     */
+    private String remarks;
+
+    /**
+     * ������������
+     */
+    @JsonIgnore
+    private Date createTime;
+
+    /**
+     * ������������
+     */
+    @JsonIgnore
+    private Date updateTime;
+
+    /**
+     * ���������������0���������������1���������
+     */
+    @JsonIgnore
+    private String isDelete;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}
diff --git a/screen-api/src/main/java/com/moral/api/mapper/RectifyMapper.java b/screen-api/src/main/java/com/moral/api/mapper/RectifyMapper.java
new file mode 100644
index 0000000..ad22293
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/mapper/RectifyMapper.java
@@ -0,0 +1,16 @@
+package com.moral.api.mapper;
+
+import com.moral.api.entity.Rectify;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * ������������������ Mapper ������
+ * </p>
+ *
+ * @author moral
+ * @since 2022-04-13
+ */
+public interface RectifyMapper extends BaseMapper<Rectify> {
+
+}
diff --git a/screen-api/src/main/java/com/moral/api/service/RectifyService.java b/screen-api/src/main/java/com/moral/api/service/RectifyService.java
new file mode 100644
index 0000000..60d091d
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/service/RectifyService.java
@@ -0,0 +1,31 @@
+package com.moral.api.service;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import com.moral.api.entity.Rectify;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * ������������������ ���������
+ * </p>
+ *
+ * @author moral
+ * @since 2022-04-13
+ */
+public interface RectifyService extends IService<Rectify> {
+
+    //������������������������
+    int addRectify(Rectify rectify);
+
+    //������������������������������
+    Map<String, Object> queryRectifyByCityCode(Map<String, Object> params);
+
+    //������id������������
+    int updateRectify(Rectify rectify);
+
+    //������id������
+    int deleteRectify(Integer id);
+}
diff --git a/screen-api/src/main/java/com/moral/api/service/impl/RectifyServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/RectifyServiceImpl.java
new file mode 100644
index 0000000..4375fc3
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/service/impl/RectifyServiceImpl.java
@@ -0,0 +1,79 @@
+package com.moral.api.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.moral.api.entity.Rectify;
+import com.moral.api.mapper.RectifyMapper;
+import com.moral.api.service.RectifyService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.moral.constant.Constants;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * ������������������ ���������������
+ * </p>
+ *
+ * @author moral
+ * @since 2022-04-13
+ */
+@Service
+public class RectifyServiceImpl extends ServiceImpl<RectifyMapper, Rectify> implements RectifyService {
+
+    @Autowired
+    private RectifyMapper rectifyMapper;
+
+    @Override
+    public int addRectify(Rectify rectify) {
+        return rectifyMapper.insert(rectify);
+    }
+
+    @Override
+    public Map<String, Object> queryRectifyByCityCode(Map<String, Object> params) {
+        //������������������
+        Integer cityCode = Integer.parseInt(params.get("cityCode").toString());
+        String time = params.get("time").toString();
+        int page = Integer.parseInt(params.get("page").toString());
+        int size = Integer.parseInt(params.get("size").toString());
+
+
+        QueryWrapper<Rectify> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("city_code", cityCode)
+                .eq("is_delete", Constants.NOT_DELETE)
+                .likeRight("complete_time", time);
+
+        Page<Rectify> rectifyPage = new Page<>(page, size);
+        rectifyMapper.selectPage(rectifyPage, queryWrapper);
+        List<Rectify> rectifyList = rectifyPage.getRecords();
+
+        Map<String, Object> result = new LinkedHashMap<>();
+        result.put("total", rectifyPage.getTotal());
+        result.put("totalPage", rectifyPage.getPages());
+        result.put("current", rectifyPage.getCurrent());
+        result.put("pageSize", rectifyPage.getSize());
+        result.put("item", rectifyList);
+        return result;
+    }
+
+    @Override
+    public int updateRectify(Rectify rectify) {
+        UpdateWrapper<Rectify> wrapper = new UpdateWrapper<>();
+        wrapper.eq("id", rectify.getId());
+        return rectifyMapper.updateById(rectify);
+    }
+
+    @Override
+    public int deleteRectify(Integer id) {
+        Rectify rectify = new Rectify();
+        rectify.setId(id);
+        rectify.setIsDelete(Constants.DELETE);
+        return rectifyMapper.updateById(rectify);
+    }
+}
diff --git a/screen-api/src/main/resources/application-specialCity.yml b/screen-api/src/main/resources/application-specialCity.yml
index 06d2f57..693c451 100644
--- a/screen-api/src/main/resources/application-specialCity.yml
+++ b/screen-api/src/main/resources/application-specialCity.yml
@@ -276,8 +276,8 @@
       areaName: ���������
     - areaCode: 411200
       areaName: ������������
-    - areaCode: 220403
-      areaName: ���������
+    - areaCode: 610100
+      areaName: ���������
     - areaCode: 610400
       areaName: ���������
     - areaCode: 610300
@@ -304,8 +304,8 @@
       areaName: ���������
     - areaCode: 511100
       areaName: ���������
-    - areaCode: 511181
-      areaName: ������������
+    - areaCode: 511400
+      areaName: ���������
     - areaCode: 511500
       areaName: ���������
     - areaCode: 511800
diff --git a/screen-job/src/main/java/com/moral/api/service/impl/CityAqiServiceImpl.java b/screen-job/src/main/java/com/moral/api/service/impl/CityAqiServiceImpl.java
index 9fcb377..7d589da 100644
--- a/screen-job/src/main/java/com/moral/api/service/impl/CityAqiServiceImpl.java
+++ b/screen-job/src/main/java/com/moral/api/service/impl/CityAqiServiceImpl.java
@@ -60,6 +60,7 @@
     @Autowired
     private RedisTemplate redisTemplate;
 
+    //������aqi������������������������������������������������������������CityID���������������������������������
     @Override
     public void insertCityAqi() {
         //pubtime=08���������������07-08������������������������������������������������07���
diff --git a/screen-job/src/main/java/com/moral/api/service/impl/CityWeatherForecastServiceImpl.java b/screen-job/src/main/java/com/moral/api/service/impl/CityWeatherForecastServiceImpl.java
index ef6d160..b8d827f 100644
--- a/screen-job/src/main/java/com/moral/api/service/impl/CityWeatherForecastServiceImpl.java
+++ b/screen-job/src/main/java/com/moral/api/service/impl/CityWeatherForecastServiceImpl.java
@@ -40,6 +40,8 @@
     @Autowired
     private CityWeatherForecastMapper cityWeatherForecastMapper;
 
+
+    //���������������������������������������������������������������������������������72������������������
     @Override
     public void insertCityWeatherForecast() {
         Date nextDay = DateUtils.addDays(new Date(), 1);
@@ -71,4 +73,16 @@
         }
         cityWeatherForecastMapper.insertCityWeatherForecast(cityWeatherForecasts);
     }
+
+    public static void main(String[] args) {
+        String time = "20221231";
+        long currentMils = DateUtils.getDate(time, DateUtils.yyyyMMdd_EN).getTime();
+
+        long startMils = DateUtils.getDate("2022", DateUtils.yyyy).getTime();
+        long mss = currentMils - startMils;
+        long days = mss / (1000 * 60 * 60 * 24);
+        System.out.println(days + 1);
+
+
+    }
 }
diff --git a/screen-job/src/main/java/com/moral/api/service/impl/CityWeatherServiceImpl.java b/screen-job/src/main/java/com/moral/api/service/impl/CityWeatherServiceImpl.java
index 1872469..2637f8f 100644
--- a/screen-job/src/main/java/com/moral/api/service/impl/CityWeatherServiceImpl.java
+++ b/screen-job/src/main/java/com/moral/api/service/impl/CityWeatherServiceImpl.java
@@ -45,6 +45,7 @@
     @Autowired
     private RedisTemplate redisTemplate;
 
+    //������������������������������������������������������������������
     @Override
     public void insertCityWeather() {
         //������������������
diff --git a/screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java b/screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java
index 08d9f08..2cb03bc 100644
--- a/screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java
+++ b/screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java
@@ -55,6 +55,8 @@
     @Autowired
     private RedisTemplate redisTemplate;
 
+
+    //���������aqi���������������������������������������������������������API--���������������
     @Override
     @Transactional
     public void insertHistoryAqi() {

--
Gitblit v1.8.0