From d80ca95c3c0cf4b1a14f335feb13cdf30820839c Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Thu, 28 Jan 2021 14:31:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into master

---
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/mapper/catalogMapper.java                  |    2 
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/dto/healthcodeDTO.java                  |   35 ++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/controller/DistrictController.java        |    1 
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/mapper/DistrictMapper.xml                 |    2 
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/vo/healthcodeVO.java                    |   36 +++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.java            |   36 +++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/service/impl/DistrictServiceImpl.java     |    1 
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/wrapper/healthcodeWrapper.java          |   44 +++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/controller/healthcodeController.java    |  224 ++++++++++++++++++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/suser/entity/Suser.java                            |    3 
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/controller/catalogController.java          |   28 +
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/service/impl/HealthcodeServiceImpl.java |   54 ++++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/JfptApplication.java                               |    8 
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/entity/healthcode.java                  |   79 ++++++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/suser/mapper/SuserMapper.xml                       |   13 +
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/service/impl/CatalogServiceImpl.java       |    4 
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml             |   83 ++++++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/service/IhealthcodeService.java         |   38 +++
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/mapper/catalogMapper.xml                   |   11 
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/service/catalogService.java                |    2 
 20 files changed, 685 insertions(+), 19 deletions(-)

diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/JfptApplication.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/JfptApplication.java
index 2252a4b..27cddee 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/JfptApplication.java
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/JfptApplication.java
@@ -19,6 +19,8 @@
 import org.springblade.core.cloud.feign.EnableBladeFeign;
 import org.springblade.core.launch.BladeApplication;
 import org.springblade.core.launch.constant.AppConstant;
+import org.springblade.jfpt.nettyServer.Server;
+import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.cloud.client.SpringCloudApplication;
@@ -31,11 +33,15 @@
 @EnableBladeFeign
 @SpringBootApplication
 // @SeataCloudApplication
-public class JfptApplication {
+public class JfptApplication implements CommandLineRunner {
 
 	public static void main(String[] args) {
 		BladeApplication.run("blade-jfpts", JfptApplication.class, args);
 	}
 
+	@Override
+	public void run(String... args) throws Exception {
+		Server server=new Server(8090);
+	}
 }
 
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/controller/catalogController.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/controller/catalogController.java
index 367b41f..8cca2a2 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/controller/catalogController.java
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/controller/catalogController.java
@@ -35,10 +35,8 @@
 
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 /**
  *  控制器
@@ -226,8 +224,24 @@
 		response.setHeader("Access-Control-Allow-Origin", "*");
 		response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
 		response.setHeader("Access-Control-Allow-Credentials","true");
-		List<Map<String, Object>> list = catalogService.selectWar();
-		return R.data(list);
+		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
+		List<Map<String, Object>> listc = new ArrayList<>();
+		String[] str={"内部","周边","挟持","救护","旁路","火警","紧急","出入","防拆"};
+		Map<String, Object> map = new HashMap<String, Object>();
+		String endTime = df.format(new Date());// new Date()为获取当前系统时间
+		String beginTime = getPastDate(7);
+		List<Map<String, Object>> list = catalogService.selectWar(beginTime,endTime);
+		map.put("lists",list);
+		map.put("type",str);
+		listc.add(map);
+		return R.data(listc);
 	}
-
+	public static String getPastDate(int past) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) - past);
+		Date today = calendar.getTime();
+		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+		String result = format.format(today);
+		return result;
+	}
 }
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/mapper/catalogMapper.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/mapper/catalogMapper.java
index 8343697..d157ac9 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/mapper/catalogMapper.java
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/mapper/catalogMapper.java
@@ -33,7 +33,7 @@
 	List<Map<String, Object>> selectCount();
 	List<Map<String, Object>> selectAddvcd();
 	List<Map<String, Object>> selectEq();
-	List<Map<String, Object>> selectWar();
+	List<Map<String, Object>> selectWar(String beginTime,String endTime);
 
 	List selectCatalogEqNUmber(String pid);
 }
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/mapper/catalogMapper.xml b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/mapper/catalogMapper.xml
index 360a982..9e719e8 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/mapper/catalogMapper.xml
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/mapper/catalogMapper.xml
@@ -56,21 +56,20 @@
 GROUP BY
 	s.addvcd
     </select>
+
     <select id="selectEq" resultType="java.util.HashMap">
       SELECT
 	COUNT(*) AS value,
 	s.addvcd,
-	d.addvnm as name
+	jfpth.blade_region.name as name
 FROM
 	sys_equipment s
-	INNER JOIN sys_district d ON d.addvcds = s.addvcd
+	INNER JOIN jfpth.blade_region on jfpth.blade_region.`code`=s.addvcd
 	WHERE s.parent_id!=0
-GROUP BY
-	s.addvcd
+	GROUP BY s.addvcd,jfpth.blade_region.name
     </select>
     <select id="selectWar" resultType="java.util.HashMap">
-     SELECT COUNT(*) as cou,waringType FROM `sys_alarm` GROUP BY waringType ORDER BY cou desc
+     SELECT COUNT(*) as cou,waringType FROM `sys_alarm` where DATE_FORMAT(alarmTime,'%Y-%m-%d')&gt;=#{beginTime} and DATE_FORMAT(alarmTime,'%Y-%m-%d')&lt;=#{endTime} GROUP BY waringType ORDER BY cou desc
     </select>
-
 
 </mapper>
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/service/catalogService.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/service/catalogService.java
index 5e1925e..1864677 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/service/catalogService.java
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/service/catalogService.java
@@ -34,5 +34,5 @@
 	List<Map<String, Object>> selectCount();
 	List<Map<String, Object>> selectAddvcd();
 	List<Map<String, Object>> selectEq();
-	List<Map<String, Object>> selectWar();
+	List<Map<String, Object>> selectWar(String beginTime,String endTime);
 }
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/service/impl/CatalogServiceImpl.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/service/impl/CatalogServiceImpl.java
index 2e0efda..41ef1e3 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/service/impl/CatalogServiceImpl.java
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/catalog/service/impl/CatalogServiceImpl.java
@@ -61,7 +61,7 @@
 	}
 
 	@Override
-	public List<Map<String, Object>> selectWar() {
-		return baseMapper.selectWar();
+	public List<Map<String, Object>> selectWar(String beginTime,String endTime) {
+		return baseMapper.selectWar(beginTime, endTime);
 	}
 }
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/controller/DistrictController.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/controller/DistrictController.java
index 8db632c..224989b 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/controller/DistrictController.java
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/controller/DistrictController.java
@@ -165,4 +165,5 @@
 		response.setHeader("Access-Control-Allow-Credentials","true");
 		return R.data(districtService.selectList());
 	}
+
 }
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/mapper/DistrictMapper.xml b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/mapper/DistrictMapper.xml
index 232e772..90dae39 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/mapper/DistrictMapper.xml
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/mapper/DistrictMapper.xml
@@ -18,5 +18,7 @@
          select * from sys_district
     </select>
 
+
+
 </mapper>
 
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/service/impl/DistrictServiceImpl.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/service/impl/DistrictServiceImpl.java
index 8f8b666..0072a38 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/service/impl/DistrictServiceImpl.java
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/district/service/impl/DistrictServiceImpl.java
@@ -47,4 +47,5 @@
 		return baseMapper.selectList();
 	}
 
+
 }
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/controller/healthcodeController.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/controller/healthcodeController.java
new file mode 100644
index 0000000..772b6a1
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/controller/healthcodeController.java
@@ -0,0 +1,224 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.healthcode.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.jfpt.healthcode.entity.healthcode;
+import org.springblade.jfpt.healthcode.service.IhealthcodeService;
+import org.springblade.jfpt.healthcode.vo.healthcodeVO;
+import org.springblade.jfpt.healthcode.wrapper.healthcodeWrapper;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("healthcode/healthcode")
+@Api(value = "", tags = "接口")
+public class healthcodeController extends BladeController {
+
+	private final IhealthcodeService ihealthcodeService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入lx")
+	public R<healthcodeVO> detail(healthcode healthcode) {
+		healthcode detail = ihealthcodeService.getOne(Condition.getQueryWrapper(healthcode));
+		return R.data(healthcodeWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入lx")
+	public R<IPage<healthcodeVO>> list(healthcode healthcode, Query query) {
+		IPage<healthcode> pages = ihealthcodeService.page(Condition.getPage(query), Condition.getQueryWrapper(healthcode));
+		return R.data(healthcodeWrapper.build().pageVO(pages));
+	}
+
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入lx")
+	public R save(@Valid @RequestBody healthcode healthcode) {
+		return R.status(ihealthcodeService.save(healthcode));
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入lx")
+	public R update(@Valid @RequestBody healthcode healthcode) {
+		return R.status(ihealthcodeService.updateById(healthcode));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入lx")
+	public R submit(@Valid @RequestBody healthcode healthcode) {
+		return R.status(ihealthcodeService.saveOrUpdate(healthcode));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(ihealthcodeService.removeByIds(Func.toLongList(ids)));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/insterh")
+	public R submit(String type, String sex, String province, String city, String district, String dtime,HttpServletResponse response) {
+		response.setHeader("Access-Control-Allow-Origin", "*");
+		response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
+		response.setHeader("Access-Control-Allow-Credentials","true");
+		ihealthcodeService.insert(type,sex, province, city, district, dtime);
+		return R.success("录入成功");
+	}
+
+	/**
+	 * 统计接口
+	 */
+	@PostMapping("/selectCount")
+	public R selectCount(@RequestBody String type, HttpServletResponse response) {
+		response.setHeader("Access-Control-Allow-Origin", "*");
+		response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
+		response.setHeader("Access-Control-Allow-Credentials","true");
+		List<Map<String, Object>> list = new ArrayList<>();
+		Date now = new Date();
+		Date time = new Date(now.getYear(), now.getMonth(), now.getDate());
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 设置时间格式
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(time);
+		// 判断要计算的日期是否是周日,如果是则减一天计算周六的,否则会出问题,计算到下一周去了
+		int dayWeek = cal.get(Calendar.DAY_OF_WEEK);// 获得当前日期是一个星期的第几天
+		if (1 == dayWeek) {
+			cal.add(Calendar.DAY_OF_MONTH, -1);
+		}
+		switch(type){
+			case "0" :
+				//日
+				String times = sdf.format(cal.getTime());
+				list=ihealthcodeService.selectCountr(times);
+				break;
+			case "1" :
+				System.out.println("要计算日期为:" + sdf.format(cal.getTime())); // 输出要计算日期
+				// 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一
+				cal.setFirstDayOfWeek(Calendar.MONDAY);
+				// 获得当前日期是一个星期的第几天
+				int day = cal.get(Calendar.DAY_OF_WEEK);
+				// 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值
+				cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - day);
+				cal.set(Calendar.HOUR, 0);
+				cal.set(Calendar.MINUTE, 0);
+				cal.set(Calendar.SECOND, 0);
+				String beginTime = sdf.format(cal.getTime());
+				Date mondayDate = cal.getTime();
+				cal.add(Calendar.DATE, 6);
+				cal.set(Calendar.HOUR, 23);
+				cal.set(Calendar.MINUTE, 59);
+				cal.set(Calendar.SECOND, 59);
+				String endTime = sdf.format(cal.getTime());
+				Date sundayDate = cal.getTime();
+				list = ihealthcodeService.selectCountz(beginTime, endTime);
+				//周
+				break;
+			default :
+				//月
+				Date d = new Date();
+				// 月初
+				System.out.println("月初" + sdf.format(getMonthStart(d)));
+				String beginTimes = sdf.format(getMonthStart(d));
+				// 月末
+				System.out.println("月末" + sdf.format(getMonthEnd(d)));
+				String endTimes = sdf.format(getMonthEnd(d));
+				list = ihealthcodeService.selectCountz(beginTimes, endTimes);
+		}
+
+		return R.data(list);
+	}
+
+	private static Date getMonthStart(Date date) {
+
+		Calendar calendar = Calendar.getInstance();
+
+		calendar.setTime(date);
+
+		int index = calendar.get(Calendar.DAY_OF_MONTH);
+
+		calendar.add(Calendar.DATE, (1 - index));
+
+		return calendar.getTime();
+
+	}
+
+
+
+	private static Date getMonthEnd(Date date) {
+
+		Calendar calendar = Calendar.getInstance();
+
+		calendar.setTime(date);
+
+		calendar.add(Calendar.MONTH, 1);
+
+		int index = calendar.get(Calendar.DAY_OF_MONTH);
+
+		calendar.add(Calendar.DATE, (-index));
+
+		return calendar.getTime();
+
+	}
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/dto/healthcodeDTO.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/dto/healthcodeDTO.java
new file mode 100644
index 0000000..2f67903
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/dto/healthcodeDTO.java
@@ -0,0 +1,35 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.healthcode.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.jfpt.healthcode.entity.healthcode;
+
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class healthcodeDTO extends healthcode {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/entity/healthcode.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/entity/healthcode.java
new file mode 100644
index 0000000..817d3b9
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/entity/healthcode.java
@@ -0,0 +1,79 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.healthcode.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+@Data
+@TableName("healthcode")
+@ApiModel(value = "healthcode对象", description = "healthcode对象")
+public class healthcode implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	@TableId(value = "id", type = IdType.AUTO)
+	private Integer id;
+	/**
+	* 类型
+	*/
+		@ApiModelProperty(value = "类型")
+		private String type;
+	/**
+	* 姓名
+	*/
+		@ApiModelProperty(value = "性别")
+		private String sex;
+	/**
+	 * 省
+	 */
+	@ApiModelProperty(value = "省")
+	private String province;
+
+	/**
+	 * 市
+	 */
+	@ApiModelProperty(value = "市")
+	private String city;
+
+	/**
+	 * 市
+	 */
+	@ApiModelProperty(value = "县区")
+	private String district;
+
+
+	/**
+	 * 时间
+	 */
+	@ApiModelProperty(value = "时间")
+	private String dtime;
+
+
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.java
new file mode 100644
index 0000000..0ef7cd2
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.java
@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.healthcode.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.jfpt.healthcode.entity.healthcode;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+public interface healthcodeMapper extends BaseMapper<healthcode> {
+	int insert(String type, String sex, String province, String city,String district, String dtime);
+	List<Map<String, Object>> selectCountr(String time);
+	List<Map<String, Object>> selectCountz(String beginTime,String endTime);
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml
new file mode 100644
index 0000000..ea4369d
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.jfpt.healthcode.mapper.healthcodeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="healthcodeResultMap" type="org.springblade.jfpt.healthcode.entity.healthcode">
+        <id column="id" property="id"/>
+        <result column="type" property="type"/>
+        <result column="sex" property="sex"/>
+        <result column="province" property="province"/>
+        <result column="city" property="city"/>
+        <result column="district" property="district"/>
+        <result column="dtime" property="dtime"/>
+    </resultMap>
+
+    <sql id="key">
+        <trim suffixOverrides=",">
+            <if test="type!=null and type!=''">
+                type,
+            </if>
+            <if test="sex!=null and sex!=''">
+                sex,
+            </if>
+            <if test="province!=null and province!=''">
+                province,
+            </if>
+            <if test="city!=null and city!=''">
+                city,
+            </if>
+            <if test="district!=null and district!=''">
+                district,
+            </if>
+            <if test="dtime!=null and dtime!=''">
+                dtime,
+            </if>
+        </trim>
+    </sql>
+    <sql id="value">
+        <trim suffixOverrides=",">
+            <if test="type!=null and type!=''">
+                #{type},
+            </if>
+            <if test="sex!=null and sex!=''">
+                #{sex},
+            </if>
+            <if test="province!=null and province!=''">
+                #{province},
+            </if>
+            <if test="city!=null and city!=''">
+                #{city},
+            </if>
+            <if test="district!=null and district!=''">
+                #{district},
+            </if>
+            <if test="dtime!=null and dtime!=''">
+                #{dtime},
+            </if>
+        </trim>
+    </sql>
+    <insert id="insert">
+        insert into healthcode(<include refid="key"/>) values(<include refid="value"/>)
+    </insert>
+    <select id="selectCountr" resultType="java.util.HashMap">
+     SELECT
+	COUNT( * ) AS num,
+	type
+FROM
+	healthcode
+WHERE
+DATE_FORMAT(dtime,'%Y-%m-%d')=#{time} GROUP BY type
+    </select>
+
+    <select id="selectCountz" resultType="java.util.HashMap">
+        SELECT
+        COUNT( * ) AS num,
+        type
+        FROM
+        healthcode
+        WHERE
+        DATE_FORMAT(dtime,'%Y-%m-%d')&gt;=#{beginTime} and DATE_FORMAT(dtime,'%Y-%m-%d')&lt;=#{endTime} GROUP BY type
+    </select>
+
+</mapper>
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/service/IhealthcodeService.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/service/IhealthcodeService.java
new file mode 100644
index 0000000..f0bcf34
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/service/IhealthcodeService.java
@@ -0,0 +1,38 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.healthcode.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.jfpt.healthcode.entity.healthcode;
+import org.springblade.jfpt.lx.entity.Lx;
+import org.springblade.jfpt.lx.vo.LxVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+public interface IhealthcodeService extends IService<healthcode> {
+	int insert(String type, String sex, String province, String city,String district, String dtime);
+	List<Map<String, Object>> selectCountr(String time);
+	List<Map<String, Object>> selectCountz(String beginTime,String endTime);
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/service/impl/HealthcodeServiceImpl.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/service/impl/HealthcodeServiceImpl.java
new file mode 100644
index 0000000..d2bd1ea
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/service/impl/HealthcodeServiceImpl.java
@@ -0,0 +1,54 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.healthcode.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.jfpt.healthcode.entity.healthcode;
+import org.springblade.jfpt.healthcode.mapper.healthcodeMapper;
+import org.springblade.jfpt.healthcode.service.IhealthcodeService;
+import org.springblade.jfpt.lx.entity.Lx;
+import org.springblade.jfpt.lx.mapper.LxMapper;
+import org.springblade.jfpt.lx.vo.LxVO;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+@Service
+public class HealthcodeServiceImpl extends ServiceImpl<healthcodeMapper, healthcode> implements IhealthcodeService {
+
+	@Override
+	public int insert(String type, String jname, String province, String city, String district, String dtime) {
+		return baseMapper.insert(type,jname,province,city,district,dtime);
+	}
+	@Override
+	public List<Map<String, Object>> selectCountr(String time) {
+		return baseMapper.selectCountr(time);
+	}
+
+	@Override
+	public List<Map<String, Object>> selectCountz(String beginTime, String endTime) {
+		return baseMapper.selectCountz(beginTime, endTime);
+	}
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/vo/healthcodeVO.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/vo/healthcodeVO.java
new file mode 100644
index 0000000..97b522d
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/vo/healthcodeVO.java
@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.healthcode.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.jfpt.healthcode.entity.healthcode;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "healthcode对象", description = "healthcode对象")
+public class healthcodeVO extends healthcode {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/wrapper/healthcodeWrapper.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/wrapper/healthcodeWrapper.java
new file mode 100644
index 0000000..922b7de
--- /dev/null
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/wrapper/healthcodeWrapper.java
@@ -0,0 +1,44 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.jfpt.healthcode.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.jfpt.healthcode.entity.healthcode;
+import org.springblade.jfpt.healthcode.vo.healthcodeVO;
+
+import java.util.Objects;
+
+/**
+ * 包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+public class healthcodeWrapper extends BaseEntityWrapper<healthcode, healthcodeVO> {
+
+	public static healthcodeWrapper build() {
+		return new healthcodeWrapper();
+ 	}
+
+	@Override
+	public healthcodeVO entityVO(healthcode healthcode) {
+		healthcodeVO healthcodeVO = Objects.requireNonNull(BeanUtil.copy(healthcode, healthcodeVO.class));
+		return healthcodeVO;
+	}
+
+}
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/suser/entity/Suser.java b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/suser/entity/Suser.java
index 9efd508..592e678 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/suser/entity/Suser.java
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/suser/entity/Suser.java
@@ -94,6 +94,9 @@
 		private String coordinate;
 
 		private String addvcd;
+		private String province;
+		private String city;
+		private String district;
 
 
 
diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/suser/mapper/SuserMapper.xml b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/suser/mapper/SuserMapper.xml
index b2c48e5..43e327a 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/suser/mapper/SuserMapper.xml
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/suser/mapper/SuserMapper.xml
@@ -31,6 +31,9 @@
         <result column="is_delete" property="isDelete"/>
         <result column="coordinate" property="coordinate"/>
         <result column="addvcd" property="addvcd"/>
+        <result column="province" property="province"/>
+        <result column="city" property="city"/>
+        <result column="district" property="district"/>
     </resultMap>
 
     <resultMap id="ss" type="org.springblade.jfpt.suser.vo.SuserVOs">
@@ -50,7 +53,8 @@
 
 
     <select id="selectSuserPage" resultMap="suserResultMaps">
-        select s.id,s.ynumber,ST_ASTEXT(s.coordinate) as coordinate,s.yname,s.phone,s.address,s.type,s.dj,s.information,s.createtime,s.addvcd from sys_suser s left join sys_district d on d.addvcds=s.addvcd  where is_delete=0
+        select s.id,s.ynumber,ST_ASTEXT(s.coordinate) as coordinate,s.yname,s.phone,s.address,s.type,s.dj,s.information,s.createtime,s.addvcd,province,city,district
+        from sys_suser s left join sys_district d on d.addvcds=s.addvcd  where is_delete=0
         <if test="suser.yname!=null">
             and s.yname like concat(concat('%', #{suser.yname}), '%')
         </if>
@@ -66,6 +70,13 @@
         <if test="suser.dj!=null">
             and s.dj like concat(concat('%', #{suser.dj}), '%')
         </if>
+        <if test="suser.province!=null">
+            and s.province like concat(concat('%', #{suser.province}), '%')
+        </if> <if test="suser.city!=null">
+        and s.city like concat(concat('%', #{suser.city}), '%')
+    </if> <if test="suser.district!=null">
+        and s.district like concat(concat('%', #{suser.district}), '%')
+    </if>
         order  by s.createtime
     </select>
 

--
Gitblit v1.9.3