/*
**代码功能解释**:
这是一个通用的控制器`CommonController`,提供了多种功能,包括位置查询、人脸比对、选项查询、记录跟随、SFSH状态修改、提醒记录数统计、图表统计、新增功能、柱状图求和等。这些功能通过调用`commonService`实现,并利用MyBatis Plus的`EntityWrapper`和`Wrapper`进行数据库查询。同时,它使用了`R`类封装返回结果,使用`@RestController`注解表明这是一个RESTful风格的控制器。
1. **位置查询**:通过经纬度查询地理位置信息,返回城市名称和编码。
2. **人脸比对**:对两张人脸图片进行比对,返回相似度。
3. **选项查询**:根据指定的表名和列名,获取该列的选项。
4. **记录跟随**:根据表名和列名以及列值,获取单条记录。
5. **SFSH状态修改**:通过请求体中的Map参数修改指定表的SFSH状态。
6. **提醒记录数**:统计需要提醒的记录数,根据表名、列名、类型和附加参数(如日期范围)进行筛选和统计。
7. **图表统计**:提供柱状图和饼状图的统计功能,可以查询当前表或级联表的数据,并按照指定的日期、字符串、下拉框等进行统计和求和。
8. **新增功能**:包括字段数字加减、更新字段值等,这些功能都是基于`commonService`实现的。
9. **柱状图求和**:通过请求参数中的Map对象,统计和返回柱状图的数据。
*/
package com.controller;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import com.alibaba.fastjson.JSON;
import com.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.annotation.IgnoreAuth;
import com.baidu.aip.face.AipFace;
import com.baidu.aip.face.MatchRequest;
import com.baidu.aip.util.Base64Util;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.ConfigEntity;
import com.service.CommonService;
import com.service.ConfigService;
import com.utils.BaiduUtil;
import com.utils.FileUtil;
import com.utils.R;
/**
* 通用接口
*/
@RestController
public class CommonController{
private static final Logger logger = LoggerFactory.getLogger(CommonController.class);
@Autowired
private CommonService commonService;
@Autowired
private ConfigService configService;
private static AipFace client = null;
private static String BAIDU_DITU_AK = null;
@RequestMapping("/location")
public R location(String lng,String lat) {
if(BAIDU_DITU_AK==null) {
BAIDU_DITU_AK = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "baidu_ditu_ak")).getValue();
if(BAIDU_DITU_AK==null) {
return R.error("请在配置管理中正确配置baidu_ditu_ak");
}
}
Map<String, String> map = BaiduUtil.getCityByLonLat(BAIDU_DITU_AK, lng, lat);
return R.ok().put("data", map);
}
/**
* 人脸比对
*
* @param face1 人脸1
* @param face2 人脸2
* @return
*/
@RequestMapping("/matchFace")
public R matchFace(String face1, String face2, HttpServletRequest request) {
if(client==null) {
/*String AppID = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "AppID")).getValue();*/
String APIKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "APIKey")).getValue();
String SecretKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "SecretKey")).getValue();
String token = BaiduUtil.getAuth(APIKey, SecretKey);
if(token==null) {
return R.error("请在配置管理中正确配置APIKey和SecretKey");
}
client = new AipFace(null, APIKey, SecretKey);
client.setConnectionTimeoutInMillis(2000);
client.setSocketTimeoutInMillis(60000);
}
JSONObject res = null;
try {
File file1 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face1);
File file2 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face2);
String img1 = Base64Util.encode(FileUtil.FileToByte(file1));
String img2 = Base64Util.encode(FileUtil.FileToByte(file2));
MatchRequest req1 = new MatchRequest(img1, "BASE64");
MatchRequest req2 = new MatchRequest(img2, "BASE64");
ArrayList<MatchRequest> requests = new ArrayList<MatchRequest>();
requests.add(req1);
requests.add(req2);
res = client.match(requests);
System.out.println(res.get("result"));
} catch (FileNotFoundException e) {
e.printStackTrace();
return R.error("文件不存在");
} catch (IOException e) {
e.printStackTrace();
}
return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString()));
}
/**
* 获取table表中的column列表(联动接口)
* @return
*/
@RequestMapping("/option/{tableName}/{columnName}")
@IgnoreAuth
public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,String level,String parent) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
if(StringUtils.isNotBlank(level)) {
params.put("level", level);
}
if(StringUtils.isNotBlank(parent)) {
params.put("parent", parent);
}
List<String> data = commonService.getOption(params);
return R.ok().put("data", data);
}
/**
* 根据table中的column获取单条记录
* @return
*/
@RequestMapping("/follow/{tableName}/{columnName}")
@IgnoreAuth
public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, @RequestParam String columnValue) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
params.put("columnValue", columnValue);
Map<String, Object> result = commonService.getFollowByOption(params);
return R.ok().put("data", result);
}
/**
* 修改table表的sfsh状态
* @param map
* @return
*/
@RequestMapping("/sh/{tableName}")
public R sh(@PathVariable("tableName") String tableName, @RequestBody Map<String, Object> map) {
map.put("table", tableName);
commonService.sh(map);
return R.ok();
}
/**
* 获取需要提醒的记录数
* @param tableName
* @param columnName
* @param type 1:数字 2:日期
* @param map
* @return
*/
@RequestMapping("/remind/{tableName}/{columnName}/{type}")
@IgnoreAuth
public R remindCount(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("table", tableName);
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
没有合适的资源?快使用搜索试试~ 我知道了~
(源码)基于Spring Boot框架的问卷调查系统.zip

共741个文件
svg:162个
js:156个
java:101个

1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 55 浏览量
2025-06-10
01:47:56
上传
评论
收藏 16.14MB ZIP 举报
温馨提示
# 基于Spring Boot框架的问卷调查系统 ## 项目简介 本项目是一个基于Spring Boot框架的问卷调查系统,采用HTML5技术,可实现问卷调查的在线设计、发布、参与及数据分析等功能。用户能通过浏览器访问前台登录页面和后台管理页面,进行问卷相关操作。 ## 项目的主要特性和功能 1. 用户登录注册用户可通过前台登录页面登录或注册,以参与问卷调查。 2. 问卷设计管理员能在后台管理页面设计问卷,包含添加、编辑、删除问卷题目等操作。 3. 问卷发布管理员可发布设计好的问卷,供用户参与。 4. 问卷参与用户可在前台登录页面参与问卷并提交答案。 5. 数据分析系统自动收集问卷数据并生成相应分析报告。 ## 安装使用步骤 假设已下载本项目的源码文件,安装使用步骤如下 1. 配置数据库依据提供的配置信息,在srcmainresourcesconfig.properties文件中编辑数据库连接信息,如数据库URL、用户名和密码。
资源推荐
资源详情
资源评论


























收起资源包目录





































































































共 741 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论


t0_54program
- 粉丝: 1492
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 联盟小学小学教育信息化建设方案DOC(1).doc
- 浅析高等院校计算机网络教学存在的问题与对策(1).docx
- PLC编程教程专题知识讲座(1).pptx
- 【推荐下载】小谈污水泵站自动化系统控制及结构(1).pdf
- 计算机组装与维护2(CPU)(1).pptx
- 实验室考勤管理系统-计算机科学与技术毕业(设计)论文(1)(1).doc
- Oracle后台数据库设计规范(1).doc
- 软件开发与定制项目可行性分析报告(1).docx
- 计算机网络实验教程的实践与心得(1).docx
- 科普网站平台建设方案书(1)(1).doc
- 互联网教育进小学课堂的必要性分析及发展建议(1).docx
- 浅论企业在财务信息化环境下的新旧准则转换(1).docx
- 电子商务部门管理制度(1)(1).doc
- 大学毕业论文-—基于单片机汽车尾灯控制(1).doc
- 基因工程的应用(2)(1).ppt
- (完整版)photoshop试题汇编第七单元试题.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
