张延森 3 年前
父节点
当前提交
95b0005982

+ 3
- 0
src/main/java/com/njyunzhi/pet_identity/common/Constants.java 查看文件

@@ -59,4 +59,7 @@ public class Constants {
59 59
     public final static String SYSSETTING_EXPRESS_FEE = "express_fee";  // 快递费
60 60
     public final static String SYSSETTING_PRODUCTION_COST = "production_cost";  // 工本费
61 61
     public final static String SYSSETTING_CARD_EXPIRE = "card_expire";  // 证件有效期
62
+
63
+    // 统计表分类
64
+    public final static String STATIS_APPLICATION_DAILY = "application_daily"; // 日提交申请
62 65
 }

+ 62
- 0
src/main/java/com/njyunzhi/pet_identity/controller/TsCommonFormController.java 查看文件

@@ -0,0 +1,62 @@
1
+package com.njyunzhi.pet_identity.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.njyunzhi.pet_identity.common.BaseController;
7
+import com.njyunzhi.pet_identity.common.Constants;
8
+import com.njyunzhi.pet_identity.common.ResponseBean;
9
+import com.njyunzhi.pet_identity.vo.StatisValue;
10
+import io.swagger.annotations.Api;
11
+import io.swagger.annotations.ApiOperation;
12
+import io.swagger.annotations.ApiParam;
13
+import org.slf4j.Logger;
14
+import org.slf4j.LoggerFactory;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.web.bind.annotation.PathVariable;
17
+import org.springframework.web.bind.annotation.RequestBody;
18
+import org.springframework.web.bind.annotation.RequestMapping;
19
+import org.springframework.web.bind.annotation.RequestMethod;
20
+import org.springframework.web.bind.annotation.RequestParam;
21
+import com.njyunzhi.pet_identity.service.ITsCommonFormService;
22
+import com.njyunzhi.pet_identity.entity.TsCommonForm;
23
+import org.springframework.web.bind.annotation.RestController;
24
+
25
+import java.util.List;
26
+
27
+/**
28
+ * <p>
29
+    * 通用统计 前端控制器
30
+    * </p>
31
+ *
32
+ * @author yansen
33
+ * @since 2022-05-28
34
+ */
35
+
36
+@Api(tags = "通用统计")
37
+@RestController
38
+@RequestMapping("/admin/statis")
39
+public class TsCommonFormController extends BaseController {
40
+
41
+    private final Logger logger = LoggerFactory.getLogger(TsCommonFormController.class);
42
+
43
+    @Autowired
44
+    public ITsCommonFormService iTsCommonFormService;
45
+
46
+
47
+    /**
48
+     * 统计日提交
49
+     * @param startDate
50
+     * @param days
51
+     * @return
52
+     */
53
+    @RequestMapping(value="/applyDaily",method= RequestMethod.GET)
54
+    @ApiOperation(value="统计日提交", notes = "统计日提交", httpMethod = "GET", response = ResponseBean.class)
55
+    public ResponseBean getApplyDaily(@ApiParam(value = "起始日期", example = "2022-05-01") @RequestParam(value ="startDate") String startDate,
56
+									 @ApiParam("统计天数") @RequestParam(value ="days",defaultValue = "10") Integer days) throws Exception{
57
+
58
+        List<StatisValue> result = iTsCommonFormService.getStatisDataBy(Constants.STATIS_APPLICATION_DAILY, startDate, days);
59
+        return ResponseBean.success(result);
60
+    }
61
+
62
+}

+ 45
- 0
src/main/java/com/njyunzhi/pet_identity/entity/TsCommonForm.java 查看文件

@@ -0,0 +1,45 @@
1
+package com.njyunzhi.pet_identity.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import java.io.Serializable;
6
+import io.swagger.annotations.ApiModel;
7
+import io.swagger.annotations.ApiModelProperty;
8
+import lombok.Data;
9
+import lombok.EqualsAndHashCode;
10
+import lombok.experimental.Accessors;
11
+
12
+/**
13
+ * <p>
14
+ * 通用统计
15
+ * </p>
16
+ *
17
+ * @author yansen
18
+ * @since 2022-05-28
19
+ */
20
+@Data
21
+@EqualsAndHashCode(callSuper = false)
22
+@Accessors(chain = true)
23
+@ApiModel(value="TsCommonForm对象", description="通用统计")
24
+public class TsCommonForm implements Serializable {
25
+
26
+    private static final long serialVersionUID = 1L;
27
+
28
+    @ApiModelProperty(value = "统计ID")
29
+    @TableId(value = "statis_id", type = IdType.AUTO)
30
+    private Integer statisId;
31
+
32
+    @ApiModelProperty(value = "机构ID")
33
+    private String orgId;
34
+
35
+    @ApiModelProperty(value = "统计类型")
36
+    private String stType;
37
+
38
+    @ApiModelProperty(value = "统计名称")
39
+    private String name;
40
+
41
+    @ApiModelProperty(value = "统计值")
42
+    private Integer value;
43
+
44
+
45
+}

+ 25
- 0
src/main/java/com/njyunzhi/pet_identity/mapper/TsCommonFormMapper.java 查看文件

@@ -0,0 +1,25 @@
1
+package com.njyunzhi.pet_identity.mapper;
2
+
3
+import com.njyunzhi.pet_identity.entity.TsCommonForm;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import com.njyunzhi.pet_identity.vo.StatisValue;
6
+import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+import java.util.List;
10
+
11
+/**
12
+ * <p>
13
+ * 通用统计 Mapper 接口
14
+ * </p>
15
+ *
16
+ * @author yansen
17
+ * @since 2022-05-28
18
+ */
19
+@Mapper
20
+public interface TsCommonFormMapper extends BaseMapper<TsCommonForm> {
21
+
22
+    List<StatisValue> getStatisDataBy(@Param("stType") String stType,
23
+                                      @Param("startDate") String startDate,
24
+                                      @Param("days") Integer days);
25
+}

+ 20
- 0
src/main/java/com/njyunzhi/pet_identity/service/ITsCommonFormService.java 查看文件

@@ -0,0 +1,20 @@
1
+package com.njyunzhi.pet_identity.service;
2
+
3
+import com.njyunzhi.pet_identity.entity.TsCommonForm;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+import com.njyunzhi.pet_identity.vo.StatisValue;
6
+
7
+import java.util.List;
8
+
9
+/**
10
+ * <p>
11
+ * 通用统计 服务类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-05-28
16
+ */
17
+public interface ITsCommonFormService extends IService<TsCommonForm> {
18
+
19
+    List<StatisValue> getStatisDataBy(String stType, String startDate, Integer days) throws Exception;
20
+}

+ 27
- 0
src/main/java/com/njyunzhi/pet_identity/service/impl/TsCommonFormServiceImpl.java 查看文件

@@ -0,0 +1,27 @@
1
+package com.njyunzhi.pet_identity.service.impl;
2
+
3
+import com.njyunzhi.pet_identity.entity.TsCommonForm;
4
+import com.njyunzhi.pet_identity.mapper.TsCommonFormMapper;
5
+import com.njyunzhi.pet_identity.service.ITsCommonFormService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import com.njyunzhi.pet_identity.vo.StatisValue;
8
+import org.springframework.stereotype.Service;
9
+
10
+import java.util.List;
11
+
12
+/**
13
+ * <p>
14
+ * 通用统计 服务实现类
15
+ * </p>
16
+ *
17
+ * @author yansen
18
+ * @since 2022-05-28
19
+ */
20
+@Service
21
+public class TsCommonFormServiceImpl extends ServiceImpl<TsCommonFormMapper, TsCommonForm> implements ITsCommonFormService {
22
+
23
+    @Override
24
+    public List<StatisValue> getStatisDataBy(String stType, String startDate, Integer days) throws Exception {
25
+        return baseMapper.getStatisDataBy(stType, startDate, days);
26
+    }
27
+}

+ 18
- 0
src/main/resources/mapper/TsCommonFormMapper.xml 查看文件

@@ -0,0 +1,18 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.njyunzhi.pet_identity.mapper.TsCommonFormMapper">
4
+
5
+    <select id="getStatisDataBy" resultType="com.njyunzhi.pet_identity.vo.StatisValue">
6
+        SELECT
7
+            DATE_FORMAT( DATE_ADD( STR_TO_DATE( #{startDate}, '%Y-%m-%d' ), INTERVAL t.rownum DAY ), '%Y-%m-%d' ) AS `name`,
8
+            IFNULL( s.`value`, 0 ) AS `value`
9
+        FROM
10
+            sequence t
11
+            LEFT JOIN ts_resume_work_form s ON s.st_type = #{stType}
12
+                AND s.`name` = DATE_FORMAT( DATE_ADD( STR_TO_DATE( #{startDate}, '%Y-%m-%d' ), INTERVAL t.rownum DAY ), '%Y-%m-%d' )
13
+        WHERE
14
+            t.rownum &lt; #{days}
15
+        ORDER BY
16
+            t.rownum ASC
17
+    </select>
18
+</mapper>