diff --git a/src/main/java/com/model/enums/TypeEnum.java b/src/main/java/com/model/enums/TypeEnum.java new file mode 100644 index 0000000..39061d8 --- /dev/null +++ b/src/main/java/com/model/enums/TypeEnum.java @@ -0,0 +1,31 @@ +package com.model.enums; + +import java.io.Serializable; + +import com.baomidou.mybatisplus.enums.IEnum; + +/** + * 必须现在 IEnum 配置 该包扫描自动注入,查看文件 spring-mybatis.xml 参数 typeEnumsPackage + */ +public enum TypeEnum implements IEnum { + DISABLED(0, "禁用"), + NORMAL(1, "正常"); + + private final int value; + private final String desc; + + TypeEnum(final int value, final String desc) { + this.value = value; + this.desc = desc; + } + + @Override + public Serializable getValue() { + return this.value; + } + + // Jackson 注解为 JsonValue 返回中文 json 描述 + public String getDesc() { + return this.desc; + } +} diff --git a/src/main/java/com/service/BisaibaomingService.java b/src/main/java/com/service/BisaibaomingService.java new file mode 100644 index 0000000..6e3af98 --- /dev/null +++ b/src/main/java/com/service/BisaibaomingService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.BisaibaomingEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.BisaibaomingVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.BisaibaomingView; + + +/** + * 比赛报名 + * + * @author + * @email + * @date 2021-03-24 19:14:37 + */ +public interface BisaibaomingService extends IService { + + PageUtils queryPage(Map params); + + List selectListVO(Wrapper wrapper); + + BisaibaomingVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(Wrapper wrapper); + + BisaibaomingView selectView(@Param("ew") Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} + diff --git a/src/main/java/com/service/BisaixiangmuService.java b/src/main/java/com/service/BisaixiangmuService.java new file mode 100644 index 0000000..fddeb7b --- /dev/null +++ b/src/main/java/com/service/BisaixiangmuService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.BisaixiangmuEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.BisaixiangmuVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.BisaixiangmuView; + + +/** + * 比赛项目 + * + * @author + * @email + * @date 2021-03-24 19:14:37 + */ +public interface BisaixiangmuService extends IService { + + PageUtils queryPage(Map params); + + List selectListVO(Wrapper wrapper); + + BisaixiangmuVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(Wrapper wrapper); + + BisaixiangmuView selectView(@Param("ew") Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} + diff --git a/src/main/java/com/service/BisaixinxiService.java b/src/main/java/com/service/BisaixinxiService.java new file mode 100644 index 0000000..0b5cd47 --- /dev/null +++ b/src/main/java/com/service/BisaixinxiService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.BisaixinxiEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.BisaixinxiVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.BisaixinxiView; + + +/** + * 比赛信息 + * + * @author + * @email + * @date 2021-03-24 19:14:37 + */ +public interface BisaixinxiService extends IService { + + PageUtils queryPage(Map params); + + List selectListVO(Wrapper wrapper); + + BisaixinxiVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(Wrapper wrapper); + + BisaixinxiView selectView(@Param("ew") Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} + diff --git a/src/main/java/com/service/CaipanyuanService.java b/src/main/java/com/service/CaipanyuanService.java new file mode 100644 index 0000000..61c1e27 --- /dev/null +++ b/src/main/java/com/service/CaipanyuanService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.CaipanyuanEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.CaipanyuanVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.CaipanyuanView; + + +/** + * 裁判员 + * + * @author + * @email + * @date 2021-03-24 19:14:37 + */ +public interface CaipanyuanService extends IService { + + PageUtils queryPage(Map params); + + List selectListVO(Wrapper wrapper); + + CaipanyuanVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(Wrapper wrapper); + + CaipanyuanView selectView(@Param("ew") Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} + diff --git a/src/main/java/com/service/CommonService.java b/src/main/java/com/service/CommonService.java new file mode 100644 index 0000000..beacdbe --- /dev/null +++ b/src/main/java/com/service/CommonService.java @@ -0,0 +1,20 @@ +package com.service; + +import java.util.List; +import java.util.Map; + +public interface CommonService { + List getOption(Map params); + + Map getFollowByOption(Map params); + + void sh(Map params); + + int remindCount(Map params); + + Map selectCal(Map params); + + List> selectGroup(Map params); + + List> selectValue(Map params); +} diff --git a/src/main/java/com/service/ConfigService.java b/src/main/java/com/service/ConfigService.java new file mode 100644 index 0000000..e883440 --- /dev/null +++ b/src/main/java/com/service/ConfigService.java @@ -0,0 +1,16 @@ + +package com.service; + +import java.util.Map; + +import com.baomidou.mybatisplus.service.IService; +import com.entity.ConfigEntity; +import com.utils.PageUtils; + + +/** + * 系统用户 + */ +public interface ConfigService extends IService { + PageUtils queryPage(Map params); +} diff --git a/src/main/java/com/service/DuiyuanService.java b/src/main/java/com/service/DuiyuanService.java new file mode 100644 index 0000000..5bb4baa --- /dev/null +++ b/src/main/java/com/service/DuiyuanService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.DuiyuanEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.DuiyuanVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.DuiyuanView; + + +/** + * 队员 + * + * @author + * @email + * @date 2021-03-24 19:14:37 + */ +public interface DuiyuanService extends IService { + + PageUtils queryPage(Map params); + + List selectListVO(Wrapper wrapper); + + DuiyuanVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(Wrapper wrapper); + + DuiyuanView selectView(@Param("ew") Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} + diff --git a/src/main/java/com/service/NewsService.java b/src/main/java/com/service/NewsService.java new file mode 100644 index 0000000..5e4e630 --- /dev/null +++ b/src/main/java/com/service/NewsService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.NewsEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.NewsVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.NewsView; + + +/** + * 新闻资讯 + * + * @author + * @email + * @date 2021-03-24 19:14:37 + */ +public interface NewsService extends IService { + + PageUtils queryPage(Map params); + + List selectListVO(Wrapper wrapper); + + NewsVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(Wrapper wrapper); + + NewsView selectView(@Param("ew") Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} + diff --git a/src/main/java/com/service/QiquanxinxiService.java b/src/main/java/com/service/QiquanxinxiService.java new file mode 100644 index 0000000..c72fdad --- /dev/null +++ b/src/main/java/com/service/QiquanxinxiService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.QiquanxinxiEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.QiquanxinxiVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.QiquanxinxiView; + + +/** + * 弃权信息 + * + * @author + * @email + * @date 2021-03-24 19:14:37 + */ +public interface QiquanxinxiService extends IService { + + PageUtils queryPage(Map params); + + List selectListVO(Wrapper wrapper); + + QiquanxinxiVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(Wrapper wrapper); + + QiquanxinxiView selectView(@Param("ew") Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} + diff --git a/src/main/java/com/service/SaiqianbianpaiService.java b/src/main/java/com/service/SaiqianbianpaiService.java new file mode 100644 index 0000000..21efee4 --- /dev/null +++ b/src/main/java/com/service/SaiqianbianpaiService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.SaiqianbianpaiEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.SaiqianbianpaiVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.SaiqianbianpaiView; + + +/** + * 赛前编排 + * + * @author + * @email + * @date 2021-03-24 19:14:37 + */ +public interface SaiqianbianpaiService extends IService { + + PageUtils queryPage(Map params); + + List selectListVO(Wrapper wrapper); + + SaiqianbianpaiVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(Wrapper wrapper); + + SaiqianbianpaiView selectView(@Param("ew") Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} + diff --git a/src/main/java/com/service/SaiqiantongzhiService.java b/src/main/java/com/service/SaiqiantongzhiService.java new file mode 100644 index 0000000..6c8ff9e --- /dev/null +++ b/src/main/java/com/service/SaiqiantongzhiService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.SaiqiantongzhiEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.SaiqiantongzhiVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.SaiqiantongzhiView; + + +/** + * 赛前通知 + * + * @author + * @email + * @date 2021-03-24 19:14:37 + */ +public interface SaiqiantongzhiService extends IService { + + PageUtils queryPage(Map params); + + List selectListVO(Wrapper wrapper); + + SaiqiantongzhiVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(Wrapper wrapper); + + SaiqiantongzhiView selectView(@Param("ew") Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} + diff --git a/src/main/java/com/service/SaishichengjiService.java b/src/main/java/com/service/SaishichengjiService.java new file mode 100644 index 0000000..e9335c1 --- /dev/null +++ b/src/main/java/com/service/SaishichengjiService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.SaishichengjiEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.SaishichengjiVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.SaishichengjiView; + + +/** + * 赛事成绩 + * + * @author + * @email + * @date 2021-03-24 19:14:37 + */ +public interface SaishichengjiService extends IService { + + PageUtils queryPage(Map params); + + List selectListVO(Wrapper wrapper); + + SaishichengjiVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(Wrapper wrapper); + + SaishichengjiView selectView(@Param("ew") Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} + diff --git a/src/main/java/com/service/SaizhongxinxiService.java b/src/main/java/com/service/SaizhongxinxiService.java new file mode 100644 index 0000000..0cc043f --- /dev/null +++ b/src/main/java/com/service/SaizhongxinxiService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.SaizhongxinxiEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.SaizhongxinxiVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.SaizhongxinxiView; + + +/** + * 赛中信息 + * + * @author + * @email + * @date 2021-03-24 19:14:37 + */ +public interface SaizhongxinxiService extends IService { + + PageUtils queryPage(Map params); + + List selectListVO(Wrapper wrapper); + + SaizhongxinxiVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(Wrapper wrapper); + + SaizhongxinxiView selectView(@Param("ew") Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} + diff --git a/src/main/java/com/service/TeshuduiyuanService.java b/src/main/java/com/service/TeshuduiyuanService.java new file mode 100644 index 0000000..46d76a9 --- /dev/null +++ b/src/main/java/com/service/TeshuduiyuanService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.TeshuduiyuanEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.TeshuduiyuanVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.TeshuduiyuanView; + + +/** + * 特殊队员 + * + * @author + * @email + * @date 2021-03-24 19:14:37 + */ +public interface TeshuduiyuanService extends IService { + + PageUtils queryPage(Map params); + + List selectListVO(Wrapper wrapper); + + TeshuduiyuanVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(Wrapper wrapper); + + TeshuduiyuanView selectView(@Param("ew") Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} + diff --git a/src/main/java/com/service/TokenService.java b/src/main/java/com/service/TokenService.java new file mode 100644 index 0000000..74e60f1 --- /dev/null +++ b/src/main/java/com/service/TokenService.java @@ -0,0 +1,26 @@ + +package com.service; + +import java.util.List; +import java.util.Map; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.entity.TokenEntity; +import com.utils.PageUtils; + + +/** + * token + */ +public interface TokenService extends IService { + PageUtils queryPage(Map params); + + List selectListView(Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + + String generateToken(Long userid,String username,String tableName, String role); + + TokenEntity getTokenEntity(String token); +} diff --git a/src/main/java/com/service/UserService.java b/src/main/java/com/service/UserService.java new file mode 100644 index 0000000..37429aa --- /dev/null +++ b/src/main/java/com/service/UserService.java @@ -0,0 +1,25 @@ + +package com.service; + +import java.util.List; +import java.util.Map; + +import org.apache.ibatis.annotations.Param; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.entity.UserEntity; +import com.utils.PageUtils; + + +/** + * 系统用户 + */ +public interface UserService extends IService { + PageUtils queryPage(Map params); + + List selectListView(Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} diff --git a/src/main/java/com/service/impl/BisaibaomingServiceImpl.java b/src/main/java/com/service/impl/BisaibaomingServiceImpl.java new file mode 100644 index 0000000..29d03e7 --- /dev/null +++ b/src/main/java/com/service/impl/BisaibaomingServiceImpl.java @@ -0,0 +1,62 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.BisaibaomingDao; +import com.entity.BisaibaomingEntity; +import com.service.BisaibaomingService; +import com.entity.vo.BisaibaomingVO; +import com.entity.view.BisaibaomingView; + +@Service("bisaibaomingService") +public class BisaibaomingServiceImpl extends ServiceImpl implements BisaibaomingService { + + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); + } + + @Override + public BisaibaomingVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public BisaibaomingView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); + } + +} diff --git a/src/main/java/com/service/impl/BisaixiangmuServiceImpl.java b/src/main/java/com/service/impl/BisaixiangmuServiceImpl.java new file mode 100644 index 0000000..e852b52 --- /dev/null +++ b/src/main/java/com/service/impl/BisaixiangmuServiceImpl.java @@ -0,0 +1,62 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.BisaixiangmuDao; +import com.entity.BisaixiangmuEntity; +import com.service.BisaixiangmuService; +import com.entity.vo.BisaixiangmuVO; +import com.entity.view.BisaixiangmuView; + +@Service("bisaixiangmuService") +public class BisaixiangmuServiceImpl extends ServiceImpl implements BisaixiangmuService { + + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); + } + + @Override + public BisaixiangmuVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public BisaixiangmuView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); + } + +} diff --git a/src/main/java/com/service/impl/BisaixinxiServiceImpl.java b/src/main/java/com/service/impl/BisaixinxiServiceImpl.java new file mode 100644 index 0000000..ceaef47 --- /dev/null +++ b/src/main/java/com/service/impl/BisaixinxiServiceImpl.java @@ -0,0 +1,62 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.BisaixinxiDao; +import com.entity.BisaixinxiEntity; +import com.service.BisaixinxiService; +import com.entity.vo.BisaixinxiVO; +import com.entity.view.BisaixinxiView; + +@Service("bisaixinxiService") +public class BisaixinxiServiceImpl extends ServiceImpl implements BisaixinxiService { + + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); + } + + @Override + public BisaixinxiVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public BisaixinxiView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); + } + +} diff --git a/src/main/java/com/service/impl/CaipanyuanServiceImpl.java b/src/main/java/com/service/impl/CaipanyuanServiceImpl.java new file mode 100644 index 0000000..278330e --- /dev/null +++ b/src/main/java/com/service/impl/CaipanyuanServiceImpl.java @@ -0,0 +1,62 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.CaipanyuanDao; +import com.entity.CaipanyuanEntity; +import com.service.CaipanyuanService; +import com.entity.vo.CaipanyuanVO; +import com.entity.view.CaipanyuanView; + +@Service("caipanyuanService") +public class CaipanyuanServiceImpl extends ServiceImpl implements CaipanyuanService { + + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); + } + + @Override + public CaipanyuanVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public CaipanyuanView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); + } + +} diff --git a/src/main/java/com/service/impl/CommonServiceImpl.java b/src/main/java/com/service/impl/CommonServiceImpl.java new file mode 100644 index 0000000..ef4a293 --- /dev/null +++ b/src/main/java/com/service/impl/CommonServiceImpl.java @@ -0,0 +1,59 @@ + +package com.service.impl; + + +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.dao.CommonDao; +import com.service.CommonService; + + +/** + * 系统用户 + */ +@Service("commonService") +public class CommonServiceImpl implements CommonService { + + @Autowired + private CommonDao commonDao; + + @Override + public List getOption(Map params) { + return commonDao.getOption(params); + } + + @Override + public Map getFollowByOption(Map params) { + return commonDao.getFollowByOption(params); + } + + @Override + public void sh(Map params) { + commonDao.sh(params); + } + + @Override + public int remindCount(Map params) { + return commonDao.remindCount(params); + } + + @Override + public Map selectCal(Map params) { + return commonDao.selectCal(params); + } + + @Override + public List> selectGroup(Map params) { + return commonDao.selectGroup(params); + } + + @Override + public List> selectValue(Map params) { + return commonDao.selectValue(params); + } + +} diff --git a/src/main/java/com/service/impl/ConfigServiceImpl.java b/src/main/java/com/service/impl/ConfigServiceImpl.java new file mode 100644 index 0000000..1e1df1e --- /dev/null +++ b/src/main/java/com/service/impl/ConfigServiceImpl.java @@ -0,0 +1,33 @@ + +package com.service.impl; + + +import java.util.Map; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.dao.ConfigDao; +import com.entity.ConfigEntity; +import com.entity.UserEntity; +import com.service.ConfigService; +import com.utils.PageUtils; +import com.utils.Query; + + +/** + * 系统用户 + */ +@Service("configService") +public class ConfigServiceImpl extends ServiceImpl implements ConfigService { + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } +} diff --git a/src/main/java/com/service/impl/DuiyuanServiceImpl.java b/src/main/java/com/service/impl/DuiyuanServiceImpl.java new file mode 100644 index 0000000..bc06b02 --- /dev/null +++ b/src/main/java/com/service/impl/DuiyuanServiceImpl.java @@ -0,0 +1,62 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.DuiyuanDao; +import com.entity.DuiyuanEntity; +import com.service.DuiyuanService; +import com.entity.vo.DuiyuanVO; +import com.entity.view.DuiyuanView; + +@Service("duiyuanService") +public class DuiyuanServiceImpl extends ServiceImpl implements DuiyuanService { + + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); + } + + @Override + public DuiyuanVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public DuiyuanView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); + } + +} diff --git a/src/main/java/com/service/impl/NewsServiceImpl.java b/src/main/java/com/service/impl/NewsServiceImpl.java new file mode 100644 index 0000000..66baf60 --- /dev/null +++ b/src/main/java/com/service/impl/NewsServiceImpl.java @@ -0,0 +1,62 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.NewsDao; +import com.entity.NewsEntity; +import com.service.NewsService; +import com.entity.vo.NewsVO; +import com.entity.view.NewsView; + +@Service("newsService") +public class NewsServiceImpl extends ServiceImpl implements NewsService { + + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); + } + + @Override + public NewsVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public NewsView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); + } + +} diff --git a/src/main/java/com/service/impl/QiquanxinxiServiceImpl.java b/src/main/java/com/service/impl/QiquanxinxiServiceImpl.java new file mode 100644 index 0000000..8972e27 --- /dev/null +++ b/src/main/java/com/service/impl/QiquanxinxiServiceImpl.java @@ -0,0 +1,62 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.QiquanxinxiDao; +import com.entity.QiquanxinxiEntity; +import com.service.QiquanxinxiService; +import com.entity.vo.QiquanxinxiVO; +import com.entity.view.QiquanxinxiView; + +@Service("qiquanxinxiService") +public class QiquanxinxiServiceImpl extends ServiceImpl implements QiquanxinxiService { + + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); + } + + @Override + public QiquanxinxiVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public QiquanxinxiView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); + } + +} diff --git a/src/main/java/com/service/impl/SaiqianbianpaiServiceImpl.java b/src/main/java/com/service/impl/SaiqianbianpaiServiceImpl.java new file mode 100644 index 0000000..fd01f31 --- /dev/null +++ b/src/main/java/com/service/impl/SaiqianbianpaiServiceImpl.java @@ -0,0 +1,62 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.SaiqianbianpaiDao; +import com.entity.SaiqianbianpaiEntity; +import com.service.SaiqianbianpaiService; +import com.entity.vo.SaiqianbianpaiVO; +import com.entity.view.SaiqianbianpaiView; + +@Service("saiqianbianpaiService") +public class SaiqianbianpaiServiceImpl extends ServiceImpl implements SaiqianbianpaiService { + + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); + } + + @Override + public SaiqianbianpaiVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public SaiqianbianpaiView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); + } + +} diff --git a/src/main/java/com/service/impl/SaiqiantongzhiServiceImpl.java b/src/main/java/com/service/impl/SaiqiantongzhiServiceImpl.java new file mode 100644 index 0000000..373a868 --- /dev/null +++ b/src/main/java/com/service/impl/SaiqiantongzhiServiceImpl.java @@ -0,0 +1,62 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.SaiqiantongzhiDao; +import com.entity.SaiqiantongzhiEntity; +import com.service.SaiqiantongzhiService; +import com.entity.vo.SaiqiantongzhiVO; +import com.entity.view.SaiqiantongzhiView; + +@Service("saiqiantongzhiService") +public class SaiqiantongzhiServiceImpl extends ServiceImpl implements SaiqiantongzhiService { + + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); + } + + @Override + public SaiqiantongzhiVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public SaiqiantongzhiView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); + } + +} diff --git a/src/main/java/com/service/impl/SaishichengjiServiceImpl.java b/src/main/java/com/service/impl/SaishichengjiServiceImpl.java new file mode 100644 index 0000000..61ffaa3 --- /dev/null +++ b/src/main/java/com/service/impl/SaishichengjiServiceImpl.java @@ -0,0 +1,62 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.SaishichengjiDao; +import com.entity.SaishichengjiEntity; +import com.service.SaishichengjiService; +import com.entity.vo.SaishichengjiVO; +import com.entity.view.SaishichengjiView; + +@Service("saishichengjiService") +public class SaishichengjiServiceImpl extends ServiceImpl implements SaishichengjiService { + + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); + } + + @Override + public SaishichengjiVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public SaishichengjiView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); + } + +} diff --git a/src/main/java/com/service/impl/SaizhongxinxiServiceImpl.java b/src/main/java/com/service/impl/SaizhongxinxiServiceImpl.java new file mode 100644 index 0000000..0ab54ad --- /dev/null +++ b/src/main/java/com/service/impl/SaizhongxinxiServiceImpl.java @@ -0,0 +1,62 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.SaizhongxinxiDao; +import com.entity.SaizhongxinxiEntity; +import com.service.SaizhongxinxiService; +import com.entity.vo.SaizhongxinxiVO; +import com.entity.view.SaizhongxinxiView; + +@Service("saizhongxinxiService") +public class SaizhongxinxiServiceImpl extends ServiceImpl implements SaizhongxinxiService { + + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); + } + + @Override + public SaizhongxinxiVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public SaizhongxinxiView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); + } + +} diff --git a/src/main/java/com/service/impl/TeshuduiyuanServiceImpl.java b/src/main/java/com/service/impl/TeshuduiyuanServiceImpl.java new file mode 100644 index 0000000..672a67c --- /dev/null +++ b/src/main/java/com/service/impl/TeshuduiyuanServiceImpl.java @@ -0,0 +1,62 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.TeshuduiyuanDao; +import com.entity.TeshuduiyuanEntity; +import com.service.TeshuduiyuanService; +import com.entity.vo.TeshuduiyuanVO; +import com.entity.view.TeshuduiyuanView; + +@Service("teshuduiyuanService") +public class TeshuduiyuanServiceImpl extends ServiceImpl implements TeshuduiyuanService { + + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); + } + + @Override + public TeshuduiyuanVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public TeshuduiyuanView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); + } + +} diff --git a/src/main/java/com/service/impl/TokenServiceImpl.java b/src/main/java/com/service/impl/TokenServiceImpl.java new file mode 100644 index 0000000..de6c052 --- /dev/null +++ b/src/main/java/com/service/impl/TokenServiceImpl.java @@ -0,0 +1,79 @@ + +package com.service.impl; + + +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.dao.TokenDao; +import com.entity.TokenEntity; +import com.entity.TokenEntity; +import com.service.TokenService; +import com.utils.CommonUtil; +import com.utils.PageUtils; +import com.utils.Query; + + +/** + * token + */ +@Service("tokenService") +public class TokenServiceImpl extends ServiceImpl implements TokenService { + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public PageUtils queryPage(Map params, + Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public String generateToken(Long userid,String username, String tableName, String role) { + TokenEntity tokenEntity = this.selectOne(new EntityWrapper().eq("userid", userid).eq("role", role)); + String token = CommonUtil.getRandomString(32); + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + cal.add(Calendar.HOUR_OF_DAY, 1); + if(tokenEntity!=null) { + tokenEntity.setToken(token); + tokenEntity.setExpiratedtime(cal.getTime()); + this.updateById(tokenEntity); + } else { + this.insert(new TokenEntity(userid,username, tableName, role, token, cal.getTime())); + } + return token; + } + + @Override + public TokenEntity getTokenEntity(String token) { + TokenEntity tokenEntity = this.selectOne(new EntityWrapper().eq("token", token)); + if(tokenEntity == null || tokenEntity.getExpiratedtime().getTime() implements UserService { + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public PageUtils queryPage(Map params, + Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } +} diff --git a/src/main/java/com/utils/BaiduUtil.java b/src/main/java/com/utils/BaiduUtil.java new file mode 100644 index 0000000..3c4e0ae --- /dev/null +++ b/src/main/java/com/utils/BaiduUtil.java @@ -0,0 +1,96 @@ +package com.utils; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.json.JSONObject; + + +/** +* 类说明 : +*/ + +public class BaiduUtil { + + /** + * 根据经纬度获得省市区信息 + * @param lon 纬度 + * @param lat 经度 + * @param coordtype 经纬度坐标系 + * @return + */ + public static Map getCityByLonLat(String key, String lng, String lat) { + String location = lat + "," + lng; + try { + //拼装url + String url = "http://api.map.baidu.com/reverse_geocoding/v3/?ak="+key+"&output=json&coordtype=wgs84ll&location="+location; + String result = HttpClientUtils.doGet(url); + JSONObject o = new JSONObject(result); + Map area = new HashMap<>(); + area.put("province", o.getJSONObject("result").getJSONObject("addressComponent").getString("province")); + area.put("city", o.getJSONObject("result").getJSONObject("addressComponent").getString("city")); + area.put("district", o.getJSONObject("result").getJSONObject("addressComponent").getString("district")); + area.put("street", o.getJSONObject("result").getJSONObject("addressComponent").getString("street")); + return area; + }catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * 获取API访问token + * 该token有一定的有效期,需要自行管理,当失效时需重新获取. + * @param ak - 百度云官网获取的 API Key + * @param sk - 百度云官网获取的 Securet Key + * @return assess_token + */ + public static String getAuth(String ak, String sk) { + // 获取token地址 + String authHost = "https://aip.baidubce.com/oauth/2.0/token?"; + String getAccessTokenUrl = authHost + // 1. grant_type为固定参数 + + "grant_type=client_credentials" + // 2. 官网获取的 API Key + + "&client_id=" + ak + // 3. 官网获取的 Secret Key + + "&client_secret=" + sk; + try { + URL realUrl = new URL(getAccessTokenUrl); + // 打开和URL之间的连接 + HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection(); + connection.setRequestMethod("GET"); + connection.connect(); + // 获取所有响应头字段 + Map> map = connection.getHeaderFields(); + // 遍历所有的响应头字段 + for (String key : map.keySet()) { + System.err.println(key + "--->" + map.get(key)); + } + // 定义 BufferedReader输入流来读取URL的响应 + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String result = ""; + String line; + while ((line = in.readLine()) != null) { + result += line; + } + /** + * 返回结果示例 + */ + System.err.println("result:" + result); + org.json.JSONObject jsonObject = new org.json.JSONObject(result); + String access_token = jsonObject.getString("access_token"); + return access_token; + } catch (Exception e) { + System.err.printf("获取token失败!"); + e.printStackTrace(System.err); + } + return null; + } + +} diff --git a/src/main/java/com/utils/CommonUtil.java b/src/main/java/com/utils/CommonUtil.java new file mode 100644 index 0000000..18f7509 --- /dev/null +++ b/src/main/java/com/utils/CommonUtil.java @@ -0,0 +1,22 @@ +package com.utils; + +import java.util.Random; + +public class CommonUtil { + /** + * 获取随机字符串 + * + * @param num + * @return + */ + public static String getRandomString(Integer num) { + String base = "abcdefghijklmnopqrstuvwxyz0123456789"; + Random random = new Random(); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < num; i++) { + int number = random.nextInt(base.length()); + sb.append(base.charAt(number)); + } + return sb.toString(); + } +} diff --git a/src/main/java/com/utils/FileUtil.java b/src/main/java/com/utils/FileUtil.java new file mode 100644 index 0000000..d581324 --- /dev/null +++ b/src/main/java/com/utils/FileUtil.java @@ -0,0 +1,27 @@ +package com.utils; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; + +/** +* 类说明 : +*/ + +public class FileUtil { + public static byte[] FileToByte(File file) throws IOException { + // 将数据转为流 + @SuppressWarnings("resource") + InputStream content = new FileInputStream(file); + ByteArrayOutputStream swapStream = new ByteArrayOutputStream(); + byte[] buff = new byte[100]; + int rc = 0; + while ((rc = content.read(buff, 0, 100)) > 0) { + swapStream.write(buff, 0, rc); + } + // 获得二进制数组 + return swapStream.toByteArray(); + } +} diff --git a/src/main/java/com/utils/HttpClientUtils.java b/src/main/java/com/utils/HttpClientUtils.java new file mode 100644 index 0000000..fd6aae5 --- /dev/null +++ b/src/main/java/com/utils/HttpClientUtils.java @@ -0,0 +1,42 @@ +package com.utils; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + + +/** + * HttpClient工具类 + */ +public class HttpClientUtils { + + /** + * @param uri + * @return String + * @description get请求方式 + * @author: long.he01 + */ + public static String doGet(String uri) { + + StringBuilder result = new StringBuilder(); + try { + String res = ""; + URL url = new URL(uri); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); + String line; + while ((line = in.readLine()) != null) { + res += line+"\n"; + } + in.close(); + return res; + }catch (Exception e) { + e.printStackTrace(); + return null; + } + + } + +} + diff --git a/src/main/java/com/utils/JQPageInfo.java b/src/main/java/com/utils/JQPageInfo.java new file mode 100644 index 0000000..af075a4 --- /dev/null +++ b/src/main/java/com/utils/JQPageInfo.java @@ -0,0 +1,54 @@ +package com.utils; + +public class JQPageInfo{ + private Integer page; + + private Integer limit; + + private String sidx; + + private String order; + + private Integer offset; + + public Integer getPage() { + return page; + } + + public void setPage(Integer page) { + this.page = page; + } + + public Integer getLimit() { + return limit; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public String getSidx() { + return sidx; + } + + public void setSidx(String sidx) { + this.sidx = sidx; + } + + public String getOrder() { + return order; + } + + public void setOrder(String order) { + this.order = order; + } + + public Integer getOffset() { + return offset; + } + + public void setOffset(Integer offset) { + this.offset = offset; + } + +} diff --git a/src/main/java/com/utils/MD5Util.java b/src/main/java/com/utils/MD5Util.java new file mode 100644 index 0000000..358a4b1 --- /dev/null +++ b/src/main/java/com/utils/MD5Util.java @@ -0,0 +1,19 @@ +package com.utils; + +import cn.hutool.crypto.digest.DigestUtil; + +public class MD5Util { + + /** + * @param text明文 + * @param key密钥 + * @return 密文 + */ + // 带秘钥加密 + public static String md5(String text) { + // 加密后的字符串 + String md5str = DigestUtil.md5Hex(text); + return md5str; + } + +} diff --git a/src/main/java/com/utils/MPUtil.java b/src/main/java/com/utils/MPUtil.java new file mode 100644 index 0000000..e5d3916 --- /dev/null +++ b/src/main/java/com/utils/MPUtil.java @@ -0,0 +1,184 @@ +package com.utils; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; + +import cn.hutool.core.bean.BeanUtil; + +import com.baomidou.mybatisplus.mapper.Wrapper; + +/** + * Mybatis-Plus工具类 + */ +public class MPUtil { + public static final char UNDERLINE = '_'; + + + //mybatis plus allEQ 表达式转换 + public static Map allEQMapPre(Object bean,String pre) { + Map map =BeanUtil.beanToMap(bean); + return camelToUnderlineMap(map,pre); + } + + //mybatis plus allEQ 表达式转换 + public static Map allEQMap(Object bean) { + Map map =BeanUtil.beanToMap(bean); + return camelToUnderlineMap(map,""); + } + + public static Wrapper allLikePre(Wrapper wrapper,Object bean,String pre) { + Map map =BeanUtil.beanToMap(bean); + Map result = camelToUnderlineMap(map,pre); + + return genLike(wrapper,result); + } + + public static Wrapper allLike(Wrapper wrapper,Object bean) { + Map result = BeanUtil.beanToMap(bean, true, true); + return genLike(wrapper,result); + } + + + public static Wrapper genLike( Wrapper wrapper,Map param) { + Iterator> it = param.entrySet().iterator(); + int i=0; + while (it.hasNext()) { + if(i>0) wrapper.and(); + Map.Entry entry = it.next(); + String key = entry.getKey(); + String value = (String) entry.getValue(); + wrapper.like(key, value); + i++; + } + return wrapper; + } + + public static Wrapper likeOrEq(Wrapper wrapper,Object bean) { + Map result = BeanUtil.beanToMap(bean, true, true); + return genLikeOrEq(wrapper,result); + } + + public static Wrapper genLikeOrEq( Wrapper wrapper,Map param) { + Iterator> it = param.entrySet().iterator(); + int i=0; + while (it.hasNext()) { + if(i>0) wrapper.and(); + Map.Entry entry = it.next(); + String key = entry.getKey(); + if(entry.getValue().toString().contains("%")) { + wrapper.like(key, entry.getValue().toString().replace("%", "")); + } else { + wrapper.eq(key, entry.getValue()); + } + i++; + } + return wrapper; + } + + public static Wrapper allEq(Wrapper wrapper,Object bean) { + Map result = BeanUtil.beanToMap(bean, true, true); + return genEq(wrapper,result); + } + + + public static Wrapper genEq( Wrapper wrapper,Map param) { + Iterator> it = param.entrySet().iterator(); + int i=0; + while (it.hasNext()) { + if(i>0) wrapper.and(); + Map.Entry entry = it.next(); + String key = entry.getKey(); + wrapper.eq(key, entry.getValue()); + i++; + } + return wrapper; + } + + + public static Wrapper between(Wrapper wrapper,Map params) { + for(String key : params.keySet()) { + String columnName = ""; + if(key.endsWith("_start")) { + columnName = key.substring(0, key.indexOf("_start")); + if(StringUtils.isNotBlank(params.get(key).toString())) { + wrapper.ge(columnName, params.get(key)); + } + } + if(key.endsWith("_end")) { + columnName = key.substring(0, key.indexOf("_end")); + if(StringUtils.isNotBlank(params.get(key).toString())) { + wrapper.le(columnName, params.get(key)); + } + } + } + return wrapper; + } + + public static Wrapper sort(Wrapper wrapper,Map params) { + String order = ""; + if(params.get("order") != null && StringUtils.isNotBlank(params.get("order").toString())) { + order = params.get("order").toString(); + } + if(params.get("sort") != null && StringUtils.isNotBlank(params.get("sort").toString())) { + if(order.equalsIgnoreCase("desc")) { + wrapper.orderDesc(Arrays.asList(params.get("sort"))); + } else { + wrapper.orderAsc(Arrays.asList(params.get("sort"))); + } + } + return wrapper; + } + + + /** + * 驼峰格式字符串转换为下划线格式字符串 + * + * @param param + * @return + */ + public static String camelToUnderline(String param) { + if (param == null || "".equals(param.trim())) { + return ""; + } + int len = param.length(); + StringBuilder sb = new StringBuilder(len); + for (int i = 0; i < len; i++) { + char c = param.charAt(i); + if (Character.isUpperCase(c)) { + sb.append(UNDERLINE); + sb.append(Character.toLowerCase(c)); + } else { + sb.append(c); + } + } + return sb.toString(); + } + + public static void main(String[] ages) { + System.out.println(camelToUnderline("ABCddfANM")); + } + + public static Map camelToUnderlineMap(Map param, String pre) { + + Map newMap = new HashMap(); + Iterator> it = param.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry entry = it.next(); + String key = entry.getKey(); + String newKey = camelToUnderline(key); + if (pre.endsWith(".")) { + newMap.put(pre + newKey, entry.getValue()); + } else if (StringUtils.isEmpty(pre)) { + newMap.put(newKey, entry.getValue()); + } else { + + newMap.put(pre + "." + newKey, entry.getValue()); + } + } + return newMap; + } +} diff --git a/src/main/java/com/utils/PageUtils.java b/src/main/java/com/utils/PageUtils.java new file mode 100644 index 0000000..f7356bf --- /dev/null +++ b/src/main/java/com/utils/PageUtils.java @@ -0,0 +1,101 @@ + +package com.utils; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import com.baomidou.mybatisplus.plugins.Page; + +/** + * 分页工具类 + */ +public class PageUtils implements Serializable { + private static final long serialVersionUID = 1L; + //总记录数 + private long total; + //每页记录数 + private int pageSize; + //总页数 + private long totalPage; + //当前页数 + private int currPage; + //列表数据 + private List list; + + /** + * 分页 + * @param list 列表数据 + * @param totalCount 总记录数 + * @param pageSize 每页记录数 + * @param currPage 当前页数 + */ + public PageUtils(List list, int totalCount, int pageSize, int currPage) { + this.list = list; + this.total = totalCount; + this.pageSize = pageSize; + this.currPage = currPage; + this.totalPage = (int)Math.ceil((double)totalCount/pageSize); + } + + /** + * 分页 + */ + public PageUtils(Page page) { + this.list = page.getRecords(); + this.total = page.getTotal(); + this.pageSize = page.getSize(); + this.currPage = page.getCurrent(); + this.totalPage = page.getPages(); + } + + /* + * 空数据的分页 + */ + public PageUtils(Map params) { + Page page =new Query(params).getPage(); + new PageUtils(page); + } + + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getCurrPage() { + return currPage; + } + + public void setCurrPage(int currPage) { + this.currPage = currPage; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public long getTotalPage() { + return totalPage; + } + + public void setTotalPage(long totalPage) { + this.totalPage = totalPage; + } + + public long getTotal() { + return total; + } + + public void setTotal(long total) { + this.total = total; + } + +} diff --git a/src/main/java/com/utils/Query.java b/src/main/java/com/utils/Query.java new file mode 100644 index 0000000..eb624a7 --- /dev/null +++ b/src/main/java/com/utils/Query.java @@ -0,0 +1,98 @@ + +package com.utils; + +import java.util.LinkedHashMap; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; + +import com.baomidou.mybatisplus.plugins.Page; + +/** + * 查询参数 + */ +public class Query extends LinkedHashMap { + private static final long serialVersionUID = 1L; + /** + * mybatis-plus分页参数 + */ + private Page page; + /** + * 当前页码 + */ + private int currPage = 1; + /** + * 每页条数 + */ + private int limit = 10; + + public Query(JQPageInfo pageInfo) { + //分页参数 + if(pageInfo.getPage()!= null){ + currPage = pageInfo.getPage(); + } + if(pageInfo.getLimit()!= null){ + limit = pageInfo.getLimit(); + } + + + //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) + String sidx = SQLFilter.sqlInject(pageInfo.getSidx()); + String order = SQLFilter.sqlInject(pageInfo.getOrder()); + + + //mybatis-plus分页 + this.page = new Page<>(currPage, limit); + + //排序 + if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){ + this.page.setOrderByField(sidx); + this.page.setAsc("ASC".equalsIgnoreCase(order)); + } + } + + + public Query(Map params){ + this.putAll(params); + + //分页参数 + if(params.get("page") != null){ + currPage = Integer.parseInt((String)params.get("page")); + } + if(params.get("limit") != null){ + limit = Integer.parseInt((String)params.get("limit")); + } + + this.put("offset", (currPage - 1) * limit); + this.put("page", currPage); + this.put("limit", limit); + + //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) + String sidx = SQLFilter.sqlInject((String)params.get("sidx")); + String order = SQLFilter.sqlInject((String)params.get("order")); + this.put("sidx", sidx); + this.put("order", order); + + //mybatis-plus分页 + this.page = new Page<>(currPage, limit); + + //排序 + if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){ + this.page.setOrderByField(sidx); + this.page.setAsc("ASC".equalsIgnoreCase(order)); + } + + } + + public Page getPage() { + return page; + } + + public int getCurrPage() { + return currPage; + } + + public int getLimit() { + return limit; + } +} diff --git a/src/main/java/com/utils/R.java b/src/main/java/com/utils/R.java new file mode 100644 index 0000000..680b3f8 --- /dev/null +++ b/src/main/java/com/utils/R.java @@ -0,0 +1,51 @@ +package com.utils; + +import java.util.HashMap; +import java.util.Map; + +/** + * 返回数据 + */ +public class R extends HashMap { + private static final long serialVersionUID = 1L; + + public R() { + put("code", 0); + } + + public static R error() { + return error(500, "未知异常,请联系管理员"); + } + + public static R error(String msg) { + return error(500, msg); + } + + public static R error(int code, String msg) { + R r = new R(); + r.put("code", code); + r.put("msg", msg); + return r; + } + + public static R ok(String msg) { + R r = new R(); + r.put("msg", msg); + return r; + } + + public static R ok(Map map) { + R r = new R(); + r.putAll(map); + return r; + } + + public static R ok() { + return new R(); + } + + public R put(String key, Object value) { + super.put(key, value); + return this; + } +} diff --git a/src/main/java/com/utils/SQLFilter.java b/src/main/java/com/utils/SQLFilter.java new file mode 100644 index 0000000..f6ce05d --- /dev/null +++ b/src/main/java/com/utils/SQLFilter.java @@ -0,0 +1,42 @@ + +package com.utils; + +import org.apache.commons.lang3.StringUtils; + +import com.entity.EIException; + +/** + * SQL过滤 + */ +public class SQLFilter { + + /** + * SQL注入过滤 + * @param str 待验证的字符串 + */ + public static String sqlInject(String str){ + if(StringUtils.isBlank(str)){ + return null; + } + //去掉'|"|;|\字符 + str = StringUtils.replace(str, "'", ""); + str = StringUtils.replace(str, "\"", ""); + str = StringUtils.replace(str, ";", ""); + str = StringUtils.replace(str, "\\", ""); + + //转换成小写 + str = str.toLowerCase(); + + //非法字符 + String[] keywords = {"master", "truncate", "insert", "select", "delete", "update", "declare", "alter", "drop"}; + + //判断是否包含非法字符 + for(String keyword : keywords){ + if(str.indexOf(keyword) != -1){ + throw new EIException("包含非法字符"); + } + } + + return str; + } +} diff --git a/src/main/java/com/utils/SpringContextUtils.java b/src/main/java/com/utils/SpringContextUtils.java new file mode 100644 index 0000000..fd3705b --- /dev/null +++ b/src/main/java/com/utils/SpringContextUtils.java @@ -0,0 +1,43 @@ + +package com.utils; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + + +/** + * Spring Context 工具类 + */ +@Component +public class SpringContextUtils implements ApplicationContextAware { + public static ApplicationContext applicationContext; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { + SpringContextUtils.applicationContext = applicationContext; + } + + public static Object getBean(String name) { + return applicationContext.getBean(name); + } + + public static T getBean(String name, Class requiredType) { + return applicationContext.getBean(name, requiredType); + } + + public static boolean containsBean(String name) { + return applicationContext.containsBean(name); + } + + public static boolean isSingleton(String name) { + return applicationContext.isSingleton(name); + } + + public static Class getType(String name) { + return applicationContext.getType(name); + } + +} \ No newline at end of file diff --git a/src/main/java/com/utils/ValidatorUtils.java b/src/main/java/com/utils/ValidatorUtils.java new file mode 100644 index 0000000..06ed26c --- /dev/null +++ b/src/main/java/com/utils/ValidatorUtils.java @@ -0,0 +1,39 @@ + +package com.utils; + + +import java.util.Set; + +import javax.validation.ConstraintViolation; +import javax.validation.Validation; +import javax.validation.Validator; + +import com.entity.EIException; + +/** + * hibernate-validator校验工具类 + */ +public class ValidatorUtils { + private static Validator validator; + + static { + validator = Validation.buildDefaultValidatorFactory().getValidator(); + } + + /** + * 校验对象 + * @param object 待校验对象 + * @param groups 待校验的组 + * @throws EIException 校验不通过,则报EIException异常 + */ + public static void validateEntity(Object object, Class... groups) + throws EIException { + Set> constraintViolations = validator.validate(object, groups); + if (!constraintViolations.isEmpty()) { + ConstraintViolation constraint = (ConstraintViolation)constraintViolations.iterator().next(); + throw new EIException(constraint.getMessage()); + } + } + + +}