基于javaweb+mysql的ssm+maven社区居民户籍管理平台(java+ssm+vue+js+tomcat)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8、Node.js≥10
开发工具
后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM+Maven社区居民户籍管理平台(java+ssm+vue+js+tomcat)
管理员
admin 123456
居民
居民账号1 123456
居民账号2 123456
居民账号3 123456
居民账号4 123456
居民账号5 123456
居民账号6 123456
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,TeshuquntiEntity teshuqunti,
HttpServletRequest request){
EntityWrapper<TeshuquntiEntity> ew = new EntityWrapper<TeshuquntiEntity>();
PageUtils page = teshuquntiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, teshuqunti), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( TeshuquntiEntity teshuqunti){
EntityWrapper<TeshuquntiEntity> ew = new EntityWrapper<TeshuquntiEntity>();
ew.allEq(MPUtil.allEQMapPre( teshuqunti, "teshuqunti"));
return R.ok().put("data", teshuquntiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(TeshuquntiEntity teshuqunti){
EntityWrapper< TeshuquntiEntity> ew = new EntityWrapper< TeshuquntiEntity>();
ew.allEq(MPUtil.allEQMapPre( teshuqunti, "teshuqunti"));
TeshuquntiView teshuquntiView = teshuquntiService.selectView(ew);
return R.ok("查询特殊群体成功").put("data", teshuquntiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
TeshuquntiEntity teshuqunti = teshuquntiService.selectById(id);
return R.ok().put("data", teshuqunti);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
/**
* 保存
*/
@PostMapping("/save")
public R save(@RequestBody ConfigEntity config){
// ValidatorUtils.validateEntity(config);
configService.insert(config);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ConfigEntity config){
// ValidatorUtils.validateEntity(config);
configService.updateById(config);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
configService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( JuzhuzhengxinxiEntity juzhuzhengxinxi){
EntityWrapper<JuzhuzhengxinxiEntity> ew = new EntityWrapper<JuzhuzhengxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( juzhuzhengxinxi, "juzhuzhengxinxi"));
return R.ok().put("data", juzhuzhengxinxiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(JuzhuzhengxinxiEntity juzhuzhengxinxi){
EntityWrapper< JuzhuzhengxinxiEntity> ew = new EntityWrapper< JuzhuzhengxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( juzhuzhengxinxi, "juzhuzhengxinxi"));
JuzhuzhengxinxiView juzhuzhengxinxiView = juzhuzhengxinxiService.selectView(ew);
return R.ok("查询居民户籍信息成功").put("data", juzhuzhengxinxiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
JuzhuzhengxinxiEntity juzhuzhengxinxi = juzhuzhengxinxiService.selectById(id);
return R.ok().put("data", juzhuzhengxinxi);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
JuzhuzhengxinxiEntity juzhuzhengxinxi = juzhuzhengxinxiService.selectById(id);
return R.ok().put("data", juzhuzhengxinxi);
}
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
QuntileibieEntity quntileibie = quntileibieService.selectById(id);
return R.ok().put("data", quntileibie);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody QuntileibieEntity quntileibie, HttpServletRequest request){
quntileibie.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(quntileibie);
quntileibieService.insert(quntileibie);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody QuntileibieEntity quntileibie, HttpServletRequest request){
quntileibie.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(quntileibie);
quntileibieService.insert(quntileibie);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody QuntileibieEntity quntileibie, HttpServletRequest request){
//ValidatorUtils.validateEntity(quntileibie);
quntileibieService.updateById(quntileibie);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
quntileibieService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 特殊群体
* 后端接口
* @email
*/
@RestController
@RequestMapping("/teshuqunti")
public class TeshuquntiController {
@Autowired
private TeshuquntiService teshuquntiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,TeshuquntiEntity teshuqunti,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jumin")) {
teshuqunti.setJuminzhanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<TeshuquntiEntity> ew = new EntityWrapper<TeshuquntiEntity>();
PageUtils page = teshuquntiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, teshuqunti), params), params));
return R.ok().put("data", page);
/**
* 权限(Token)验证
*/
@Component
public class AuthorizationInterceptor implements HandlerInterceptor {
public static final String LOGIN_TOKEN_KEY = "Token";
@Autowired
private TokenService tokenService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//支持跨域请求
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization");
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
IgnoreAuth annotation;
if (handler instanceof HandlerMethod) {
annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class);
} else {
return true;
}
//从header中获取token
String token = request.getHeader(LOGIN_TOKEN_KEY);
/**
* 不需要验证权限的方法直接放过
*/
if(annotation!=null) {
return true;
}
TokenEntity tokenEntity = null;
* 查询
*/
@RequestMapping("/query")
public R query(JuminEntity jumin){
EntityWrapper< JuminEntity> ew = new EntityWrapper< JuminEntity>();
ew.allEq(MPUtil.allEQMapPre( jumin, "jumin"));
JuminView juminView = juminService.selectView(ew);
return R.ok("查询居民成功").put("data", juminView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
JuminEntity jumin = juminService.selectById(id);
return R.ok().put("data", jumin);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
JuminEntity jumin = juminService.selectById(id);
return R.ok().put("data", jumin);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody JuminEntity jumin, HttpServletRequest request){
jumin.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(jumin);
JuminEntity user = juminService.selectOne(new EntityWrapper<JuminEntity>().eq("juminzhanghao", jumin.getJuminzhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
jumin.setId(new Date().getTime());
juminService.insert(jumin);
return R.ok();
}
/**
* 前端保存
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody JuminEntity jumin, HttpServletRequest request){
//ValidatorUtils.validateEntity(jumin);
juminService.updateById(jumin);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
juminService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
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));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<JuminEntity> wrapper = new EntityWrapper<JuminEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
* @param table
* @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
*/
@IgnoreAuth
@RequestMapping("/remind/{tableName}/{columnName}/{type}")
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));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
return R.ok().put("data", juzhuzhengxinxi);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
JuzhuzhengxinxiEntity juzhuzhengxinxi = juzhuzhengxinxiService.selectById(id);
return R.ok().put("data", juzhuzhengxinxi);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody JuzhuzhengxinxiEntity juzhuzhengxinxi, HttpServletRequest request){
juzhuzhengxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(juzhuzhengxinxi);
juzhuzhengxinxiService.insert(juzhuzhengxinxi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody JuzhuzhengxinxiEntity juzhuzhengxinxi, HttpServletRequest request){
juzhuzhengxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(juzhuzhengxinxi);
juzhuzhengxinxiService.insert(juzhuzhengxinxi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody JuzhuzhengxinxiEntity juzhuzhengxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(juzhuzhengxinxi);
juzhuzhengxinxiService.updateById(juzhuzhengxinxi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
}
}
/**
if(tableName.equals("jumin")) {
wrapper.eq("juminzhanghao", (String)request.getSession().getAttribute("username"));
}
int count = qianyixinxiService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
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));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<TeshuquntiEntity> wrapper = new EntityWrapper<TeshuquntiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jumin")) {
wrapper.eq("juminzhanghao", (String)request.getSession().getAttribute("username"));
}
int count = teshuquntiService.selectCount(wrapper);
return R.ok().put("count", count);
}
params.put("yColumn", yColumnName);
List<Map<String, Object>> result = commonService.selectValue(params);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* (按值统计)时间统计类型
*/
@IgnoreAuth
@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}/{timeStatType}")
public R valueDay(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
params.put("timeStatType", timeStatType);
List<Map<String, Object>> result = commonService.selectTimeStatValue(params);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* 人脸比对
*
* @param face1 人脸1
* @param face2 人脸2
* @return
*/
@RequestMapping("/matchFace")
@IgnoreAuth
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) {
/**
* 群体类别
* 后端接口
* @email
*/
@RestController
@RequestMapping("/quntileibie")
public class QuntileibieController {
@Autowired
private QuntileibieService quntileibieService;
/**
* 后端列表
*/
@RequestMapping("/page")
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,JuminEntity jumin,
HttpServletRequest request){
EntityWrapper<JuminEntity> ew = new EntityWrapper<JuminEntity>();
PageUtils page = juminService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jumin), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,JuminEntity jumin,
HttpServletRequest request){
EntityWrapper<JuminEntity> ew = new EntityWrapper<JuminEntity>();
PageUtils page = juminService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jumin), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( JuminEntity jumin){
EntityWrapper<JuminEntity> ew = new EntityWrapper<JuminEntity>();
ew.allEq(MPUtil.allEQMapPre( jumin, "jumin"));
return R.ok().put("data", juminService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(JuminEntity jumin){
EntityWrapper< JuminEntity> ew = new EntityWrapper< JuminEntity>();
ew.allEq(MPUtil.allEQMapPre( jumin, "jumin"));
JuminView juminView = juminService.selectView(ew);
return R.ok("查询居民成功").put("data", juminView);
}
/**
* 后端详情
*/
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<JuzhuzhengxinxiEntity> wrapper = new EntityWrapper<JuzhuzhengxinxiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jumin")) {
wrapper.eq("juminzhanghao", (String)request.getSession().getAttribute("username"));
}
int count = juzhuzhengxinxiService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
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));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<JuminEntity> wrapper = new EntityWrapper<JuminEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = juminService.selectCount(wrapper);
return R.ok().put("count", count);
}
}