Commit 4c3d0f57 authored by 郭建文's avatar 郭建文

分年级教学目标

parents
package com.chineseall.teachgoal;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
package com.chineseall.teachgoal;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class SpringBootStartApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
}
\ No newline at end of file
package com.chineseall.teachgoal;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
import java.util.List;
/**
* Created by guojw on 2020/4/10.
*/
@Configuration
@EnableSwagger2
public class Swagger2{
@Bean
public Docket createRestApi() {
ParameterBuilder ticketPar = new ParameterBuilder();
List<Parameter> pars = new ArrayList<Parameter>();
ticketPar.name("token").description("user token")
.modelRef(new ModelRef("string")).parameterType("header")
.required(false).build(); //header中的ticket参数非必填,传空也可以
ParameterBuilder userIdPar = new ParameterBuilder();
userIdPar.name("x-userId").description("user id")
.modelRef(new ModelRef("string")).parameterType("header")
.required(false).build();
pars.add(ticketPar.build()); //根据每个方法名也知道当前方法在设置什么参数
pars.add(userIdPar.build());
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.chineseall.teachgoal.web"))
.build()
.globalOperationParameters(pars)
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("分年级教学目标API平台")
.description("")
.version("1.0")
.build();
}
}
package com.chineseall.teachgoal.configurer;
import org.springframework.stereotype.Component;
import com.chineseall.teachgoal.model.User;
/**
* 拦截器
* @ 用来判断用户的
*1. 当preHandle方法返回false时,从当前拦截器往回执行所有拦截器的afterCompletion方法,再退出拦截器链。也就是说,请求不继续往下传了,直接沿着来的链往回跑。
2.当preHandle方法全为true时,执行下一个拦截器,直到所有拦截器执行完。再运行被拦截的Controller。然后进入拦截器链,运
行所有拦截器的postHandle方法,完后从最后一个拦截器往回执行所有拦截器的afterCompletion方法.
*/
//@component (把普通pojo实例化到spring容器中,相当于配置文件中的
@Component
public class HostHolder {
private static ThreadLocal<User> users = new ThreadLocal<User>();
public static User getUser() {
return users.get();
}
public static void setUser(User user) {
users.set(user);
}
public static void clear() {
users.remove();
}
}
package com.chineseall.teachgoal.configurer;
import com.github.pagehelper.PageHelper;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import tk.mybatis.spring.mapper.MapperScannerConfigurer;
import javax.sql.DataSource;
import java.util.Properties;
import static com.chineseall.teachgoal.core.ProjectConstant.*;
/**
* Mybatis & Mapper & PageHelper 配置
*/
@Configuration
public class MybatisConfigurer {
@Bean
public SqlSessionFactory sqlSessionFactoryBean(DataSource dataSource) throws Exception {
SqlSessionFactoryBean factory = new SqlSessionFactoryBean();
factory.setDataSource(dataSource);
factory.setTypeAliasesPackage(MODEL_PACKAGE);
//配置分页插件,详情请查阅官方文档
PageHelper pageHelper = new PageHelper();
Properties properties = new Properties();
properties.setProperty("pageSizeZero", "true");//分页尺寸为0时查询所有纪录不再执行分页
properties.setProperty("reasonable", "true");//页码<=0 查询第一页,页码>=总页数查询最后一页
properties.setProperty("supportMethodsArguments", "true");//支持通过 Mapper 接口参数来传递分页参数
pageHelper.setProperties(properties);
//添加插件
factory.setPlugins(new Interceptor[]{pageHelper});
//添加XML目录
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
factory.setMapperLocations(resolver.getResources("classpath:mapper/*.xml"));
return factory.getObject();
}
@Bean
public MapperScannerConfigurer mapperScannerConfigurer() {
MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactoryBean");
mapperScannerConfigurer.setBasePackage(MAPPER_PACKAGE);
//配置通用Mapper,详情请查阅官方文档
Properties properties = new Properties();
properties.setProperty("mappers", MAPPER_INTERFACE_REFERENCE);
properties.setProperty("notEmpty", "false");//insert、update是否判断字符串类型!='' 即 test="str != null"表达式内是否追加 and str != ''
properties.setProperty("IDENTITY", "MYSQL");
mapperScannerConfigurer.setProperties(properties);
return mapperScannerConfigurer;
}
}
package com.chineseall.teachgoal.configurer;
import com.alibaba.fastjson.JSON;
import com.chineseall.teachgoal.core.Result;
import com.chineseall.teachgoal.core.ResultCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 拦截器
* @ 用来判断用户的
*1. 当preHandle方法返回false时,从当前拦截器往回执行所有拦截器的afterCompletion方法,再退出拦截器链。也就是说,请求不继续往下传了,直接沿着来的链往回跑。
2.当preHandle方法全为true时,执行下一个拦截器,直到所有拦截器执行完。再运行被拦截的Controller。然后进入拦截器链,运
行所有拦截器的postHandle方法,完后从最后一个拦截器往回执行所有拦截器的afterCompletion方法.
*/
@Component
public class PassportInterceptor extends HandlerInterceptorAdapter {
private final Logger logger = LoggerFactory.getLogger(PassportInterceptor.class);
@Value("${http.PlatCallUrl}")
private String platCallUrl;
//判断然后进行用户拦截
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (request.getMethod().equals("OPTIONS")) {
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "*");
//response.setHeader("Access-Control-Allow-Headers", "Content-Type,token");
response.setHeader("Access-Control-Allow-Headers", "*");
response.setHeader("Access-Control-Expose-Headers", "*");
response.setStatus(HttpStatus.OK.value());
return false;
}
//getHeadersInfo(request);
/*String tickets = null;
String clientId=null;
String userId=null;
if(request.getCookies() != null){
for(Cookie cookie : request.getCookies()){
if(cookie.getName().equals("token")){
tickets = cookie.getValue();
break;
}
}
}
if(request.getHeader("token") != null){
tickets=(String) request.getHeaders("token").nextElement();
if(request.getParameter("clientId")!=null) {
clientId = request.getParameter("clientId");
}
else
{
clientId ="a29ed28f90d54689af1886ca12e899b6";
}
}
else{
return validTokenFalse(request, response,"token为空");
}
if(request.getHeader("x-userId") != null){
userId=(String) request.getHeaders("x-userId").nextElement();
}
else{
return validTokenFalse(request, response,"userId为空");
}
if(tickets != null){
//LoginTicket loginTickets = loginService.selectLoginTicketByTicket(tickets);
//if(loginTickets == null || loginTickets.getExpired().before(new Date()) || loginTickets.getStatus() ==false){
// return validTokenFalse(request, response,"token过期,请重新登录");
//}
//String url = "http://support.etextbook.cn/support/api/2/valid_token";
String url =platCallUrl+"/api/2/valid_token";
Map<String, String> headerMap = new HashMap<String, String>();
headerMap.put("token", tickets);
headerMap.put("Content-Type", "application/json;charset=UTF-8");
Map<String, String> param = new HashMap<String, String>();
param.put("clientId",clientId);
String requestBody= HttpClientUtil.send(url, param, headerMap,"GET", "UTF-8");
//JSONObject object=JSON.parseObject(requestBody);
JSONObject jsonx = JSON.parseObject(requestBody);
JSONObject jo = jsonx.getJSONObject("data");
String valid = jo.getString("valid");
if(!"1".equals(valid)){
return validTokenFalse(request, response,"token过期,请重新登录");
}
}
*/
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
//就是为了能够在渲染之前所有的freemaker模板能够访问这个对象user,就是在所有的controller渲染之前将这个user加进去
if(modelAndView != null){
//这个其实就和model.addAttribute一样的功能,就是把这个变量与前端视图进行交互 //就是与header.html页面的user对应
//modelAndView.addObject("user",HostHolder.getUser());
}
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//HostHolder.clear(); //当执行完成之后呢需要将变量清空
}
private Boolean validTokenFalse(HttpServletRequest request, HttpServletResponse response,String message)
{
logger.warn("认证失败,请求接口:{},请求IP:{},请求参数:{}",
request.getRequestURI(), getIpAddress(request), JSON.toJSONString(request.getParameterMap()));
Result result = new Result();
result.setCode(ResultCode.UNAUTHORIZED).setMessage(message);
responseResult(response, result);
return false;
}
private void responseResult(HttpServletResponse response, Result result) {
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-type", "application/json;charset=UTF-8");
response.setStatus(403);
//try {
//response.getWriter().write(JSON.toJSONString(result));
//} catch (IOException ex) {
// logger.error(ex.getMessage());
//}
}
private String getIpAddress(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
// 如果是多级代理,那么取第一个ip为客户端ip
if (ip != null && ip.indexOf(",") != -1) {
ip = ip.substring(0, ip.indexOf(",")).trim();
}
return ip;
}
}
package com.chineseall.teachgoal.convert;
/**
* 对象转换类
* 说明:根据入参和方法名To后面转换后的对象类型区分,
*/
public class Convert {
}
package com.chineseall.teachgoal.core;
import org.apache.ibatis.exceptions.TooManyResultsException;
import org.springframework.beans.factory.annotation.Autowired;
import tk.mybatis.mapper.entity.Condition;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.util.List;
/**
* 基于通用MyBatis Mapper插件的Service接口的实现
*/
public abstract class AbstractService<T> implements Service<T> {
@Autowired
protected Mapper<T> mapper;
private Class<T> modelClass; // 当前泛型真实类型的Class
public AbstractService() {
ParameterizedType pt = (ParameterizedType) this.getClass().getGenericSuperclass();
modelClass = (Class<T>) pt.getActualTypeArguments()[0];
}
public void save(T model) {
mapper.insertSelective(model);
}
public void save(List<T> models) {
mapper.insertList(models);
}
public void deleteById(Long id) {
mapper.deleteByPrimaryKey(id);
}
public void deleteByIds(String ids) {
mapper.deleteByIds(ids);
}
public void update(T model) {
mapper.updateByPrimaryKeySelective(model);
}
public T findById(Long id) {
return mapper.selectByPrimaryKey(id);
}
@Override
public T findBy(String fieldName, Object value) throws TooManyResultsException {
try {
T model = modelClass.newInstance();
Field field = modelClass.getDeclaredField(fieldName);
field.setAccessible(true);
field.set(model, value);
return mapper.selectOne(model);
} catch (ReflectiveOperationException e) {
throw new ServiceException(e.getMessage(), e);
}
}
public List<T> findByIds(String ids) {
return mapper.selectByIds(ids);
}
public List<T> findByCondition(Condition condition) {
return mapper.selectByCondition(condition);
}
public List<T> findAll() {
return mapper.selectAll();
}
}
package com.chineseall.teachgoal.core;
import java.util.Collection;
import java.util.Map;
/**
* Assert class
*
* @author guojw
* @description 断言判空类
* @date 2019/4/24 10:43
*/
public class Assert {
public static boolean isEmpty(Object obj){
return obj == null ;
}
public static boolean isEmpty(Collection obj){
return (obj == null || obj.isEmpty());
}
public static boolean isEmpty(Map obj)
{
return obj == null || obj.isEmpty();
}
public static boolean isEmpty(Object obj[]){
return obj == null || obj.length == 0 ;
}
public static boolean notEmpty(Object obj){
return !isEmpty(obj);
}
public static boolean notEmpty(Collection obj){
return !isEmpty(obj);
}
public static boolean notEmpty(Map obj)
{
return !isEmpty(obj);
}
public static boolean notEmpty(Object obj[]){
return !isEmpty(obj);
}
}
package com.chineseall.teachgoal.core;
import org.modelmapper.ModelMapper;
import org.modelmapper.TypeToken;
import org.modelmapper.convention.MatchingStrategies;
import java.util.List;
/**
* 转换javabean到目标类Util
*/
public class AutoMapperUtil {
public static <T> T mapperToModel(Object o, Class<T> clazz) {
if(o == null){
return null;
}
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration().setFullTypeMatchingRequired(true);
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
T t = modelMapper.map(o,clazz);
return t;
}
public static <T> List<T> mapperToBean(Object o, TypeToken typeToken) {
if(o == null){
return null;
}
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration().setFullTypeMatchingRequired(true);
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
return modelMapper.map(o, typeToken.getType());
}
}
/*
package com.chineseall.teachgoal.core;
import com.chineseall.teachgoal.configurer.HostHolder;
*/
/**
* Service 层 基础接口,其他Service 接口 请继承该接口
*//*
public class BaseController {
protected Long getUserId() {
return HostHolder.getUser().getId();
}
protected String getOrgId() {
return HostHolder.getUser().getOrgId();
}
protected String getToken() {
return HostHolder.getUser().getToken();
}
}
*/
package com.chineseall.teachgoal.core;
import com.chineseall.teachgoal.model.Client;
import com.chineseall.teachgoal.service.impl.client.ClientEService;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import sun.misc.BASE64Encoder;
import java.util.List;
public class BaseNoLoginController {
@Autowired
ClientEService clientEService;
@Value("${security.switch}")
private String isSecurity;
protected String validClientId(String tClientId,String timeStamp,String sign,String versionNo) {
if(versionNo!=null || "T".equals(isSecurity)) {
if(tClientId == null || timeStamp==null || sign==null)
{
return "SIGNFAIL";
}
if (tClientId != null) {
List<Client> clientCount = clientEService.selectByClientId(tClientId);
if (clientCount == null || clientCount.size() == 0) {
return "NOCLIENT";
}
String signdata = DigestUtils.sha1Hex(tClientId + timeStamp);
System.out.println(signdata);
if (!sign.equals(signdata)) {
return "SIGNFAIL";
}
}
}
return "SUCCESS";
}
public static String encryptBASE64(String key) {
byte[] bt = key.getBytes();
return (new BASE64Encoder()).encodeBuffer(bt);
}
}
package com.chineseall.teachgoal.core;
import java.util.*;
/**
* Created by zhangqing on 2018/9/11.
*/
public class CollectionUtils{
public static boolean isEmpty(Collection<?> coll) {
return coll == null || coll.isEmpty();
}
public static boolean isNotEmpty(Collection<?> coll) {
return !isEmpty(coll);
}
}
package com.chineseall.teachgoal.core;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* Created by zhangqing on 2018/9/11.
*/
public class DateUtil{
public static String getIndexDateTime() {
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmssSSS");
Date Now = new Date();
String NDate = formatter.format(Now);
return NDate;
}
/**
* 解析纯日期文本
* @param dateStr
* @return
*/
public static Date getDate(String dateStr) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try {
date = sdf.parse(dateStr);
return date;
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 设置日期起始时分秒
* @param date
* @return
*/
public static Date setBeginTime(Date date) {
Calendar cal1 = Calendar.getInstance();
cal1.setTime(date);
cal1.set(Calendar.HOUR_OF_DAY, 0);
cal1.set(Calendar.MINUTE, 00);
cal1.set(Calendar.SECOND, 00);
return cal1.getTime();
}
/**
* 设置日期结束时分秒
* @param date
* @return
*/
public static Date setFinishTime(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
return cal.getTime();
}
/**
* 获取时间时分秒字符串格式
* @param date
* @return
*/
public static String getStrDateTime(Date date){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String strDate = sdf.format(date);
return strDate;
}
}
package com.chineseall.teachgoal.core;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ExcelUtil {
public static Workbook getWorkbok(InputStream in,String suffix) throws IOException{
Workbook wb = null;
if(suffix.equals("xls")){ //Excel 2003
wb = new HSSFWorkbook(in);
}else if(suffix.equals("xlsx")){ // Excel 2007/2010
wb = new XSSFWorkbook(in);
}
return wb;
}
public static Map<String,Object> getExcelContent(InputStream in,String suffix){
Map<String,Object> map = new HashMap<>();
List<Map<Object,Object>> list = new ArrayList<>();
Map<Integer,Object> cloumnMap = new HashMap<>();
try {
// 同时支持Excel 2003、2007
Workbook workbook = getWorkbok(in,suffix);
//Workbook workbook = WorkbookFactory.create(is); // 这种方式 Excel2003/2007/2010都是可以处理的
/**
* 设置当前excel中sheet的下标:0开始
*/
Sheet sheet = workbook.getSheetAt(0);
// 为跳过第一行目录设置count
int count = 0;
for (Row row : sheet) {
Map<Object,Object> rowList = new HashMap<>();
try {
// 跳过第一和第二行的目录
// if(count < 2 ) {
// count++;
// continue;
// }
if(row.getCell(0) == null || row.getCell(0).toString().equals("")){
continue;
}
count ++;
int end = row.getLastCellNum();
for (int i = 0; i < end; i++) {
Cell cell = row.getCell(i);
Object obj = "";
if(cell == null) {
}else{
obj = getValue(cell);
}
if(count == 1){
if(obj != "" && obj != null){
if(obj !=null && !"".equals(obj.toString())) {
Pattern p = Pattern.compile("\\s*|\t|\r|\n");
Matcher m = p.matcher(obj.toString());
obj = m.replaceAll("");
}
cloumnMap.put(i,obj);
}
}else {
if(cloumnMap.get(i) != null){
rowList.put(cloumnMap.get(i),obj);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
if(count != 1) {
list.add(rowList);
}
}
} catch (Exception e) {
e.printStackTrace();
}
List<Object> cloumnList = new ArrayList<>();
Set<Integer> set = cloumnMap.keySet();
for (Integer integer:set
) {
cloumnList.add(cloumnMap.get(integer));
}
map.put("cloumns",cloumnList);
map.put("items",list);
return map;
}
public static Object getValue(Cell cell) {
Object obj = "";
if(cell.getCellType().equals(CellType.BOOLEAN)){
obj = cell.getBooleanCellValue();
}else if(cell.getCellType().equals(CellType.ERROR)){
obj = cell.getErrorCellValue();
}else if(cell.getCellType().equals(CellType.NUMERIC)){
obj = cell.getNumericCellValue();
}else if(cell.getCellType().equals(CellType.STRING)){
obj = cell.getStringCellValue();
}else if(cell.getCellType().equals(CellType.FORMULA)){
obj = cell.getCellFormula();
}
return obj;
}
}
package com.chineseall.teachgoal.core;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created by zhangqing on 2018/9/11.
*/
public class JavaBeanUtil{
private static Logger logger = LoggerFactory.getLogger(JavaBeanUtil.class);
/**
* 实体类转map
* @param obj
* @return
*/
public static Map<String, Object> convertBeanToMap(Object obj) {
if (obj == null) {
return null;
}
Map<String, Object> map = new HashMap<String, Object>();
try {
BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor property : propertyDescriptors) {
String key = property.getName();
// 过滤class属性
if (!key.equals("class")) {
// 得到property对应的getter方法
Method getter = property.getReadMethod();
Object value = getter.invoke(obj);
if(null==value){
map.put(key,"");
}else{
map.put(key,value);
}
}
}
} catch (Exception e) {
logger.error("convertBean2Map Error {}" ,e);
}
return map;
}
/**
* map 转实体类
* @param clazz
* @param map
* @param <T>
* @return
*/
public static <T> T convertMapToBean(Class<T> clazz, Map<String,Object> map) {
T obj = null;
try {
BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
obj = clazz.newInstance(); // 创建 JavaBean 对象
// 给 JavaBean 对象的属性赋值
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (int i = 0; i < propertyDescriptors.length; i++) {
PropertyDescriptor descriptor = propertyDescriptors[i];
String propertyName = descriptor.getName();
if (map.containsKey(propertyName)) {
// 下面一句可以 try 起来,这样当一个属性赋值失败的时候就不会影响其他属性赋值。
Object value = map.get(propertyName);
if ("".equals(value)) {
value = null;
}
Object[] args = new Object[1];
args[0] = value;
descriptor.getWriteMethod().invoke(obj, args);
}
}
} catch (IllegalAccessException e) {
logger.error("convertMapToBean 实例化JavaBean失败 Error{}" ,e);
} catch (IntrospectionException e) {
logger.error("convertMapToBean 分析类属性失败 Error{}" ,e);
} catch (IllegalArgumentException e) {
logger.error("convertMapToBean 映射错误 Error{}" ,e);
} catch (InstantiationException e) {
logger.error("convertMapToBean 实例化 JavaBean 失败 Error{}" ,e);
}catch (InvocationTargetException e){
logger.error("convertMapToBean字段映射失败 Error{}" ,e);
}catch (Exception e){
logger.error("convertMapToBean Error{}" ,e);
}
return (T) obj;
}
//将map通过反射转化为实体
public static Object MapToModel(Map<String,Object> map,Object o) throws Exception{
if (!map.isEmpty()) {
for (String k : map.keySet()) {
Object v =null;
if (!k.isEmpty()) {
v = map.get(k);
}
Field[] fields = null;
fields = o.getClass().getDeclaredFields();
String clzName = o.getClass().getSimpleName();
for (Field field : fields) {
int mod = field.getModifiers();
if (field.getName().toUpperCase().equals(k.toUpperCase())) {
field.setAccessible(true);
//region--进行类型判断
String type=field.getType().toString();
if (type.endsWith("String")){
if (v!=null){
v=v.toString();
}else {
v="";
}
}
if (type.endsWith("Date")){
v=new Date(v.toString());
}
if (type.endsWith("Boolean")){
v=Boolean.getBoolean(v.toString());
}
if (type.endsWith("int")){
v=new Integer(v.toString());
}
if (type.endsWith("Long")){
v=new Long(v.toString());
}
//endregion
field.set(o, v);
}
}
}
}
return o;
}
/**
* 实体对象转成Map
* @param obj 实体对象
* @return
*/
public static Map<String, Object> object2Map(Object obj) {
Map<String, Object> map = new HashMap<>();
if (obj == null) {
return map;
}
Class clazz = obj.getClass();
Field[] fields = clazz.getDeclaredFields();
try {
for (Field field : fields) {
field.setAccessible(true);
map.put(field.getName(), field.get(obj));
}
} catch (Exception e) {
e.printStackTrace();
}
return map;
}
/**
* Map转成实体对象
* @param map map实体对象包含属性
* @param clazz 实体对象类型
* @return
*/
public static Object map2Object(Map<String, Object> map, Class<?> clazz) {
if (map == null) {
return null;
}
Object obj = null;
try {
obj = clazz.newInstance();
Field[] fields = obj.getClass().getDeclaredFields();
for (Field field : fields) {
int mod = field.getModifiers();
if (Modifier.isStatic(mod) || Modifier.isFinal(mod)) {
continue;
}
field.setAccessible(true);
field.set(obj, map.get(field.getName()));
}
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
}
package com.chineseall.teachgoal.core;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Aspect
@Component
public class LogManage {
//匹配com.chineseall.web路径下所有以Controller结尾的类,所有匹配类中的方法都会进行记录
@Pointcut("execution(* com.chineseall.teachgoal.web.*Controller..*(..))")
public void executeService() {
}
private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* 前置通知:方法执行之前执行此操作,用来记录输入的参数信息
* @param joinPoint
*/
@Before("executeService()")
public void addBeforeLogger(JoinPoint joinPoint){
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
//获取参数
String[] paramNames = signature.getParameterNames();
StringBuilder nameStr = new StringBuilder();
Object[] objs = joinPoint.getArgs();
for (int i = 0; i < paramNames.length; i++) {
nameStr.append("{" + paramNames[i] + ":");
if (objs[i] != null) {
nameStr.append(objs[i].toString() + "},");
} else {
nameStr.append("null},");
}
}
logger.info(signature.toString());
logger.info("Args:" + nameStr);
}
/**
* 后置返回通知 方法结束后执行此操作,用来记录返回值信息
* 这里需要注意的是:
* 如果参数中的第一个参数为JoinPoint,则第二个参数为返回值的信息
* 如果参数中的第一个参数不为JoinPoint,则第一个参数为returning中对应的参数
* returning 限定了只有目标方法返回值与通知方法相应参数类型时才能执行后置返回通知,否则不执行,对于returning对应的通知方法参数为Object类型将匹配任何目标返回值
*/
@AfterReturning(value = "executeService()",returning = "result")
public void addAfterReturningLogger(JoinPoint joinPoint,Object result){
if (result != null) {
logger.info(joinPoint.getSignature().getName() + ".result:" + result.toString());
} else {
logger.info(joinPoint.getSignature().getName() + ".result:null");
}
}
/**
* 异常通知 当方法抛出异常后会执行此操作,记录异常信息
* @param joinPoint 切点
* @param ex 异常
*/
@AfterThrowing(value = "executeService()", throwing ="ex")
public void addAfterThrowingLogger(JoinPoint joinPoint,Exception ex){
logger.error(joinPoint.getSignature().getName() + ex.getMessage());
}
}
package com.chineseall.teachgoal.core;
import tk.mybatis.mapper.common.BaseMapper;
import tk.mybatis.mapper.common.ConditionMapper;
import tk.mybatis.mapper.common.IdsMapper;
import tk.mybatis.mapper.common.special.InsertListMapper;
/**
* 定制版MyBatis Mapper插件接口,如需其他接口参考官方文档自行添加。
*/
public interface Mapper<T>
extends
BaseMapper<T>,
ConditionMapper<T>,
IdsMapper<T>,
InsertListMapper<T> {
}
package com.chineseall.teachgoal.core;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;
import java.util.*;
import java.io.IOException;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.CopyObjectResult;
import com.aliyun.oss.model.ObjectMetadata;
//Created by zhangqing on 2018/9/11.
public class ObsClientUtil {
public static void upload(File tempFile, String objectName)throws IOException{
// Endpoint以杭州为例,其它Region请按实际情况填写。
String endpoint = "http://oss-cn-shanghai.aliyuncs.com";
// 云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用RAM子账号进行API访问或日常运维,请登录 https://ram.console.aliyun.com 创建。
String accessKeyId = "LTAIcnfFEMg0vX1B";
String accessKeySecret = "uZyZJ8cJPu190Z6Orz245fHBKNqaFO";
// 创建OSSClient实例。
OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
// 上传文件流。
InputStream inputStream = new FileInputStream(tempFile);
ossClient.putObject("press-annotation-file-test", objectName, inputStream);
// 关闭OSSClient。
ossClient.shutdown();
}
public static void uploadFile(String endpoint,
String accessKeyId,
String accessKeySecret,
String bucket,
String fileName,
File tempFile,
String objectName)throws IOException{
// Endpoint以杭州为例,其它Region请按实际情况填写。
//String endpoint = "http://oss-cn-shanghai.aliyuncs.com";
// 云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用RAM子账号进行API访问或日常运维,请登录 https://ram.console.aliyun.com 创建。
//String accessKeyId = "LTAIcnfFEMg0vX1B";
//String accessKeySecret = "uZyZJ8cJPu190Z6Orz245fHBKNqaFO";
// 创建上传Object的Metadata
ObjectMetadata meta = new ObjectMetadata();
meta.setContentDisposition("attachment;filename=\""+new String(fileName.getBytes(),"utf-8")+"\"");
//meta.setContentDisposition("attachment;filename=\""+URLEncoder.encode(fileName, "utf-8")+"\"");
// 创建OSSClient实例。
OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
// 上传文件流。
InputStream inputStream = new FileInputStream(tempFile);
ossClient.putObject(bucket, objectName, inputStream,meta);
// 关闭OSSClient。
ossClient.shutdown();
}
public static URL getDownLoadUrl(String endpoint,
String accessKeyId,
String accessKeySecret,
String bucketName,
String objectName) {
// 创建OSSClient实例。
OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
// 设置URL过期时间为1小时。
Date expiration = new Date(System.currentTimeMillis() + 3600 * 1000);
// 生成以GET方法访问的签名URL,访客可以直接通过浏览器访问相关内容。
URL url = ossClient.generatePresignedUrl(bucketName, objectName, expiration);
// 关闭OSSClient。
ossClient.shutdown();
return url;
}
public static void copyFile(String endpoint,
String accessKeyId,
String accessKeySecret,
String sourceBucketName,
String sourceObject,
String destinationBucketName,
String destinationObject)throws IOException{
// 创建OSSClient实例。
OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
// 拷贝文件。
CopyObjectResult result = ossClient.copyObject(sourceBucketName,sourceObject,destinationBucketName,destinationObject);
System.out.println("ETag: " + result.getETag() + " LastModified: " + result.getLastModified());
// AddBucketReplicationRequest request = new AddBucketReplicationRequest(sourceBucketName);
// request.setReplicationRuleID("");
// request.setTargetBucketName(destinationBucketName);
// // 目标Endpoint以北京为例。
// request.setTargetBucketLocation("oss-cn-shanghai");
// // 设置禁止同步历史数据。默认会同步历史数据。
// request.setEnableHistoricalObjectReplication(false);
// ossClient.addBucketReplication(request);
// 关闭OSSClient。
ossClient.shutdown();
}
}
package com.chineseall.teachgoal.core;
import com.chineseall.teachgoal.model.Client;
import com.chineseall.teachgoal.service.impl.client.ClientEService;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
public class OtherBaseController {
@Resource
private ClientEService clientEService;
protected String validClientId(HttpServletRequest request)
{
List<String> list = new ArrayList<>();
String clientCode = null;
Map<String, String> keyMap = new HashMap<String, String>();
Enumeration params = request.getParameterNames();
String timestamp = null;
while (params.hasMoreElements())
{
String key = (String) params.nextElement();
if (key.equals("sign")) continue;
String value = request.getParameter(key);
if (StringUtils.isNotEmpty(value))
{
list.add(key);
keyMap.put(key, value);
// System.out.println(key + "=" + value);
}
if (key.equals("clientCode"))
{
clientCode = value;
}
else if (key.equals("timestamp"))
{
timestamp = request.getParameter("timestamp");
}
}
Client client=clientEService.getByClientId(clientCode);
if(client==null) {
return "NOCLIENT";
}
if (StringUtils.isEmpty(timestamp))
{
// System.out.println("没有时间戳参数");
return "NOTIMESTAMP";
}
Collections.sort(list);
String sign1 = "";
for (int i = 0; i < list.size(); i++)
{
if (i > 0) sign1 += "&";
sign1 += list.get(i) + "=" + keyMap.get(list.get(i));
}
String sign = request.getParameter("sign");
//String key = "f67964c178b9402bacbsism09dlpwld";
sign1 += "&key=" + client.getClientKey();
System.out.println(sign1);
//sign1 = org.apache.commons.codec.digest.DigestUtils.md5Hex(sign1).toUpperCase();
sign1 =org.springframework.util.DigestUtils.md5DigestAsHex(sign1.getBytes()).toUpperCase();
System.out.println(sign1);
if (sign != null && sign.equals(sign1))
{
return "SUCCESS";
}
// System.out.println("签名错误");
return "SIGNFAIL";
}
}
package com.chineseall.teachgoal.core;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
import java.util.function.Function;
/**
* @author Qbit
*/
@ApiModel("分页查询返回")
public class PageOut<V> {
@ApiModelProperty("一页条数")
private int pageSize = 10;
@ApiModelProperty("当前页码")
private int pageNumber = 1;
@ApiModelProperty("记录总条数")
private long totalSize;
@ApiModelProperty("总页数")
private long totalPage;
@ApiModelProperty("数据列表")
private List<V> data;
public PageOut()
{
}
/**
* 把page helper返回的page对象 转换成 pageOut 只能 转换泛型 一致的
*
*
* @param page
* @author ming
* @date 2018-03-22 15:38
*/
public static <V> PageOut<V> convertPageToPageOut(Page<V> page) {
PageOut<V> voPageOut = new PageOut<>();
voPageOut.setPageSize(page.getPageSize());
voPageOut.setPageNumber(page.getPageNum());
voPageOut.setTotalSize((int) page.getTotal());
voPageOut.setData(page.getResult());
return voPageOut;
}
/**
* page 转换为pageOut 类型不一致 使用 function格式的lambda即可
*
* @param page
* @param function 将 o 转换为v 的lambda函数表达式
* @author ming
* @date 2018-05-23 09:11
*/
public static <O, V> PageOut<V> convertPageToPageOut(Page<O> page, Function<O, V> function) {
PageOut<V> voPageOut = new PageOut<>();
voPageOut.setPageSize(page.getPageSize());
voPageOut.setPageNumber(page.getPageNum());
voPageOut.setTotalSize((int) page.getTotal());
//转换 o -> v
List<V> resultList = Lists.newArrayList();
page.getResult().forEach(f -> {
resultList.add(function.apply(f));
});
voPageOut.setData(resultList);
return voPageOut;
}
/**
* PageInfo 对象 转换成 pageOut 只能 转换泛型 一致的
*
*
* @param pageInfo
* @author liupy
* @date 2018-06-07
*/
public static <V> PageOut<V> convertPageToPageOut(PageInfo<V> pageInfo) {
PageOut<V> voPageOut = new PageOut<>();
voPageOut.setPageSize(pageInfo.getPageSize());
voPageOut.setPageNumber(pageInfo.getPageNum());
voPageOut.setTotalSize((int) pageInfo.getTotal());
voPageOut.setData(pageInfo.getList());
return voPageOut;
}
/**
* page 转换为pageOut 类型不一致 使用 function格式的lambda即可
*
* @param pageInfo
* @param function 将 o 转换为v 的lambda函数表达式
* @author ming
* @date 2018-05-23 09:11
*/
public static <O, V> PageOut<V> convertPageToPageOut(PageInfo<O> pageInfo, Function<O, V> function) {
PageOut<V> voPageOut = new PageOut<>();
voPageOut.setPageSize(pageInfo.getPageSize());
voPageOut.setPageNumber(pageInfo.getPageNum());
voPageOut.setTotalSize((int) pageInfo.getTotal());
//转换 o -> v
List<V> resultList = Lists.newArrayList();
pageInfo.getList().forEach(f -> {
resultList.add(function.apply(f));
});
voPageOut.setData(resultList);
return voPageOut;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageNumber() {
return pageNumber;
}
public void setPageNumber(int pageNumber) {
this.pageNumber = pageNumber;
}
public long getTotalSize() {
return totalSize;
}
public void setTotalSize(long totalSize) {
this.totalSize = totalSize;
}
public long getTotalPage() {
return totalSize % pageSize == 0 ? totalSize / pageSize : (totalSize / pageSize + 1);
}
public List<V> getData() {
return data;
}
public void setData(List<V> data) {
this.data = data;
}
}
package com.chineseall.teachgoal.core;
/**
* 项目常量
*/
public final class ProjectConstant {
public static final String BASE_PACKAGE = "com.chineseall.teachgoal";//生成代码所在的基础包名称,可根据自己公司的项目修改(注意:这个配置修改之后需要手工修改src目录项目默认的包路径,使其保持一致,不然会找不到类)
public static final String MODEL_PACKAGE = BASE_PACKAGE + ".model";//生成的Model所在包
public static final String MAPPER_PACKAGE = BASE_PACKAGE + ".dao";//生成的Mapper所在包
public static final String SERVICE_PACKAGE = BASE_PACKAGE + ".service";//生成的Service所在包
public static final String SERVICE_IMPL_PACKAGE = SERVICE_PACKAGE + ".impl";//生成的ServiceImpl所在包
public static final String CONTROLLER_PACKAGE = BASE_PACKAGE + ".web";//生成的Controller所在包
public static final String MAPPER_INTERFACE_REFERENCE = BASE_PACKAGE + ".core.Mapper";//Mapper插件基础接口的完全限定名
}
package com.chineseall.teachgoal.core;
import com.alibaba.fastjson.JSON;
/**
* 统一API响应结果封装
*/
public class Result<T> {
private int code;
private String message;
private T data;
public Result setCode(ResultCode resultCode) {
this.code = resultCode.code();
return this;
}
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
public Result setMessage(String message) {
this.message = message;
return this;
}
public T getData() {
return data;
}
public Result setData(T data) {
this.data = data;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
package com.chineseall.teachgoal.core;
/**
* 响应码枚举,参考HTTP状态码的语义
*/
public enum ResultCode {
SUCCESS(0),//成功
FAIL(400),//失败
UNAUTHORIZED(401),//未认证(签名错误)
NOT_FOUND(404),//接口不存在
NOT_CLIENTID(9005),//接口不存在
NOT_SIGNFAIL(9006),//接口不存在接口不存在
INTERNAL_SERVER_ERROR(500);//服务器内部错误
private final int code;
ResultCode(int code) {
this.code = code;
}
public int code() {
return code;
}
}
package com.chineseall.teachgoal.core;
/**
* 响应结果生成工具
*/
public class ResultGenerator {
private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS";
private static final String LOGIN_SUCCESS_MESSAGE = "登录成功!";
public static Result genSuccessResult() {
return new Result()
.setCode(ResultCode.SUCCESS)
.setMessage(DEFAULT_SUCCESS_MESSAGE);
}
public static <T> Result<T> genSuccessResult(T data) {
return new Result()
.setCode(ResultCode.SUCCESS)
.setMessage(DEFAULT_SUCCESS_MESSAGE)
.setData(data);
}
public static <T> Result<T> genLoginSuccessResult(T data) {
return new Result()
.setCode(ResultCode.SUCCESS)
.setMessage(LOGIN_SUCCESS_MESSAGE)
.setData(data);
}
public static Result genFailResult(String message) {
return new Result()
.setCode(ResultCode.FAIL)
.setMessage(message);
}
public static Result genNoClientIdResult(String message) {
return new Result()
.setCode(ResultCode.NOT_CLIENTID)
.setMessage(message);
}
public static Result genSignFailResult(String message) {
return new Result()
.setCode(ResultCode.NOT_SIGNFAIL)
.setMessage(message);
}
}
package com.chineseall.teachgoal.core;
import sun.misc.BASE64Encoder;
/**
* Created by zhangqing on 2018/9/11.
*/
public class SecurityUtils{
/**
* BASE64加密
*
* @param key
* @return
* @throws Exception
*/
public static String encryptBASE64(String key) {
byte[] bt = key.getBytes();
return (new BASE64Encoder()).encodeBuffer(bt);
}
}
package com.chineseall.teachgoal.core;
import org.apache.ibatis.exceptions.TooManyResultsException;
import tk.mybatis.mapper.entity.Condition;
import java.util.List;
/**
* Service 层 基础接口,其他Service 接口 请继承该接口
*/
public interface Service<T> {
void save(T model);//持久化
void save(List<T> models);//批量持久化
void deleteById(Long id);//通过主鍵刪除
void deleteByIds(String ids);//批量刪除 eg:ids -> “1,2,3,4”
void update(T model);//更新
T findById(Long id);//通过ID查找
T findBy(String fieldName, Object value) throws TooManyResultsException; //通过Model中某个成员变量名称(非数据表中column的名称)查找,value需符合unique约束
List<T> findByIds(String ids);//通过多个ID查找//eg:ids -> “1,2,3,4”
List<T> findByCondition(Condition condition);//根据条件查找
List<T> findAll();//获取所有
}
package com.chineseall.teachgoal.core;
/**
* 服务(业务)异常如“ 账号或密码错误 ”,该异常只做INFO级别的日志记录 @see WebMvcConfigurer
*/
public class ServiceException extends RuntimeException {
public ServiceException() {
}
public ServiceException(String message) {
super(message);
}
public ServiceException(String message, Throwable cause) {
super(message, cause);
}
}
package com.chineseall.teachgoal.core;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* Created by zhangqing on 2018/11/30.
*/
public class SignUtils {
private static String UTF_8 = "UTF-8";
public static String sign(Map<String, String> paramValues, String secret) {
return sign(paramValues, null, secret);
}
public static String sign(Map<String, String> paramValues, List<String> ignoreParamNames, String secret) {
try {
StringBuilder sb = new StringBuilder();
List<String> paramNames = new ArrayList<String>(paramValues.size());
paramNames.addAll(paramValues.keySet());
if (ignoreParamNames != null && ignoreParamNames.size() > 0) {
for (String ignoreParamName : ignoreParamNames) {
paramValues.remove(ignoreParamName);
}
}
Collections.sort(paramNames);
for(int i = 0; i < paramNames.size(); i++) {
if (i > 0) {
sb.append("&");
}
sb.append(paramNames.get(i));
sb.append("=");
sb.append(paramValues.get(paramNames.get(i)));
}
sb.append("&key");
sb.append("=");
sb.append(secret);
byte[] MD5Digest = getMD5Digest(sb.toString());
return byte2hex(MD5Digest);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private static byte[] getMD5Digest(String data) throws IOException {
byte[] bytes = null;
try {
MessageDigest md = MessageDigest.getInstance("md5");
bytes = md.digest(data.getBytes(UTF_8));
} catch (GeneralSecurityException gse) {
throw new IOException(gse.getMessage());
}
return bytes;
}
/**
* 二进制转十六进制字符串
*
* @param bytes
* @return
*/
private static String byte2hex(byte[] bytes) {
StringBuilder sign = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {
String hex = Integer.toHexString(bytes[i] & 0xFF);
if (hex.length() == 1) {
sign.append("0");
}
sign.append(hex.toUpperCase());
}
return sign.toString();
}
}
package com.chineseall.teachgoal.core;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by zhangqing on 2018/9/11.
*/
public class StringUtils{
public static boolean isBlank(CharSequence cs) {
int strLen;
if(cs != null && (strLen = cs.length()) != 0) {
for(int i = 0; i < strLen; ++i) {
if(!Character.isWhitespace(cs.charAt(i))) {
return false;
}
}
return true;
} else {
return true;
}
}
public static boolean isNotBlank(CharSequence cs) {
return !isBlank(cs);
}
public static boolean isEmpty(CharSequence cs) {
return cs == null || cs.length() == 0;
}
public static boolean isNotEmpty(CharSequence cs) {
return !isEmpty(cs);
}
public static Date convertToDate(String strDate) throws Exception
{
SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //加上时间
return sDateFormat.parse(strDate);
}
}
package com.chineseall.teachgoal.core;
import java.util.*;
/**
* Created by Administrator on 2018/9/11.
*/
public class UuidGenerator {
public static String getUUID32(){
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
return uuid;
}
}
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.AliBucket;
public interface AliBucketMapper extends Mapper<AliBucket> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.model.AliBucket;
import org.apache.ibatis.annotations.Param;
public interface AliBucketMapperE {
AliBucket selectByCode(@Param("code") String code);
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.BasicData;
public interface BasicDataMapper extends Mapper<BasicData> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.model.VO.BasicDataVO;
import java.util.Date;
import java.util.List;
public interface BasicDataMapperE {
List<BasicDataVO> getDictByType(List list);
List<BasicDataVO> listDict(Date updateTime);
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.Client;
public interface ClientMapper extends Mapper<Client> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.model.VO.CourseStandardApiVO;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface CourseStandardApiMapperE {
List<CourseStandardApiVO> getCourseStandardList(@Param("standardCodeList") List<String> standardCodeList);
/**
* 根据最近更新日期获取课标列表
* @param lastUpdateTime
* @return
*/
List<CourseStandardApiVO> getCourseStandardListByLastUpdateTime(@Param("lastUpdateTime") Date lastUpdateTime);
List<CourseStandardApiVO> listCourseStandards(@Param("gmtModified") Date gmtModified);
}
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.CourseStandardList;
public interface CourseStandardListMapper extends Mapper<CourseStandardList> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.model.CourseStandardList;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CourseStandardListMapperE {
Long saveAndBackId(@Param("item") CourseStandardList list);
List<CourseStandardList> queryDrafts();
void deleteCourseStandard(@Param("id") Long id);
List<CourseStandardList> queryAll();
void addDrafts(@Param("id") Long id);
CourseStandardList findById(@Param("id") Long id);
CourseStandardList findLastOne();
void upperShelf(@Param("id") Long id);
Long findByCondition(@Param("studyStage") String studyStage,
@Param("curType") String curType,
@Param("subject") String subject);
List<CourseStandardList> queryTeachGoalByCondition(@Param("status") Integer status,
@Param("studyStage") String studyStage,
@Param("curType") String curType,
@Param("subject") String subject);
}
package com.chineseall.teachgoal.dao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExcelNameMapperE {
List<String> listGrade();
List<String> listSubject(@Param("grade") String grade);
List<String> listType(@Param("grade") String grade,
@Param("subject") String subject);
}
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.model.MathHighNationOne;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ImportMathMapperE {
// 高中数学excel导入
void saveHighNationOne(@Param("list") List<MathHighNationOne> list, @Param("id") Long id);
}
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.MathPrimaryCourseContent;
public interface MathPrimaryCourseContentMapper extends Mapper<MathPrimaryCourseContent> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.MathPrimaryCourseTarget;
public interface MathPrimaryCourseTargetMapper extends Mapper<MathPrimaryCourseTarget> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.MathPrimaryStageTarget;
public interface MathPrimaryStageTargetMapper extends Mapper<MathPrimaryStageTarget> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.MathPrimaryTeachTarget;
public interface MathPrimaryTeachTargetMapper extends Mapper<MathPrimaryTeachTarget> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.SysDict;
public interface SysDictMapper extends Mapper<SysDict> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.User;
public interface UserMapper extends Mapper<User> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao.client;
import com.chineseall.teachgoal.model.Client;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ClientEMapper {
List<Client> selectByClientId(@Param("clientId") String clientId);
Client getByCode(@Param("code") String code);
Client getByClientId(@Param("clientId") String clientId);
}
\ No newline at end of file
package com.chineseall.teachgoal.http;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.http.*;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class HttpAPIService {
@Autowired
private HttpClient httpClient;
@Autowired
private RequestConfig config;
/**
* 不带参数的get请求,如果状态码为200,则返回body,如果不为200,则返回null
*
* @param url
* @return
* @throws Exception
*/
public String doGet(String url) throws Exception {
// 声明 http get 请求
HttpGet httpGet = new HttpGet(url);
// 装载配置信息
httpGet.setConfig(config);
// 发起请求
HttpResponse response = this.httpClient.execute(httpGet);
// 判断状态码是否为200
if (response.getStatusLine().getStatusCode() == 200) {
// 返回响应体的内容
return EntityUtils.toString(response.getEntity(), "UTF-8");
}
return null;
}
/**
* 带参数的get请求,如果状态码为200,则返回body,如果不为200,则返回null
*
* @param url
* @return
* @throws Exception
*/
public String doGet(String url, Map<String, Object> map) throws Exception {
URIBuilder uriBuilder = new URIBuilder(url);
if (map != null) {
// 遍历map,拼接请求参数
for (Map.Entry<String, Object> entry : map.entrySet()) {
uriBuilder.setParameter(entry.getKey(), entry.getValue().toString());
}
}
// 调用不带参数的get请求
return this.doGet(uriBuilder.build().toString());
}
/**
* 带参数的post请求
*
* @param url
* @param map
* @return
* @throws Exception
*/
public HttpResult doPost(String url, Map<String, Object> map) throws Exception {
HttpResult result=null;
// 获取连接客户端工具
CloseableHttpClient httpClient = HttpClients.createDefault();
String entityStr = null;
CloseableHttpResponse response = null;
try {
// 创建POST请求对象
HttpPost httpPost = new HttpPost(url);
/*
* 添加请求参数
*/
// 判断map是否为空,不为空则进行遍历,封装from表单对象
if (map != null) {
List<NameValuePair> list = new ArrayList<NameValuePair>();
for (Map.Entry<String, Object> entry : map.entrySet()) {
list.add(new BasicNameValuePair(entry.getKey(), entry.getValue().toString()));
}
// 构造from表单对象
UrlEncodedFormEntity urlEncodedFormEntity = new UrlEncodedFormEntity(list, "UTF-8");
// 把表单放到post里
httpPost.setEntity(urlEncodedFormEntity);
// 浏览器表示
httpPost.addHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6)");
// 传输的类型
httpPost.addHeader("Content-Type", "application/json");
}
// 执行请求
response = httpClient.execute(httpPost);
// 获得响应的实体对象
HttpEntity entity = response.getEntity();
// 使用Apache提供的工具类进行转换成字符串
entityStr = EntityUtils.toString(entity, "UTF-8");
// System.out.println(Arrays.toString(response.getAllHeaders()));
return new HttpResult(response.getStatusLine().getStatusCode(), entityStr);
} catch (ClientProtocolException e) {
System.err.println("Http协议出现问题");
e.printStackTrace();
} catch (ParseException e) {
System.err.println("解析错误");
e.printStackTrace();
} catch (IOException e) {
System.err.println("IO异常");
e.printStackTrace();
} finally {
// 释放连接
if (null != response) {
try {
response.close();
httpClient.close();
} catch (IOException e) {
System.err.println("释放连接出错");
e.printStackTrace();
}
}
}
return result;
}
private static final String APPLICATION_JSON = "application/json";
private static final String CONTENT_TYPE_TEXT_JSON = "text/json";
public HttpResult doPost(String url, String json)throws Exception
{
// 将JSON进行UTF-8编码,以便传输中文
String encoderJson = URLEncoder.encode(json, "utf-8");
// 获取连接客户端工具
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON);
StringEntity se = new StringEntity(encoderJson);
se.setContentType(CONTENT_TYPE_TEXT_JSON);
se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON));
httpPost.setEntity(se);
CloseableHttpResponse response = null;
response =httpClient.execute(httpPost);
return new HttpResult(response.getStatusLine().getStatusCode(), EntityUtils.toString(response.getEntity(), "UTF-8"));
}
}
\ No newline at end of file
package com.chineseall.teachgoal.http;
public class HttpResult {
// 响应码
private Integer code;
// 响应体
private String body;
public HttpResult() {
super();
}
public HttpResult(Integer code, String body) {
super();
this.code = code;
this.body = body;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.http;
import org.apache.http.conn.HttpClientConnectionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class IdleConnectionEvictor extends Thread {
@Autowired
private HttpClientConnectionManager connMgr;
private volatile boolean shutdown;
public IdleConnectionEvictor() {
super();
super.start();
}
@Override
public void run() {
try {
while (!shutdown) {
synchronized (this) {
wait(5000);
// 关闭失效的连接
connMgr.closeExpiredConnections();
}
}
} catch (InterruptedException ex) {
// 结束
}
}
//关闭清理无效连接的线程
public void shutdown() {
shutdown = true;
synchronized (this) {
notifyAll();
}
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import java.util.Date;
import javax.persistence.*;
@Table(name = "ali_bucket")
public class AliBucket {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String region;
@Column(name = "access_key_id")
private String accessKeyId;
@Column(name = "access_key_secret")
private String accessKeySecret;
private String bucket;
@Column(name = "gmt_create")
private Date gmtCreate;
@Column(name = "gmt_modified")
private Date gmtModified;
private Long creator;
private String code;
@Column(name = "role_arn")
private String roleArn;
private String endpoint;
private String catalogue;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return region
*/
public String getRegion() {
return region;
}
/**
* @param region
*/
public void setRegion(String region) {
this.region = region;
}
/**
* @return access_key_id
*/
public String getAccessKeyId() {
return accessKeyId;
}
/**
* @param accessKeyId
*/
public void setAccessKeyId(String accessKeyId) {
this.accessKeyId = accessKeyId;
}
/**
* @return access_key_secret
*/
public String getAccessKeySecret() {
return accessKeySecret;
}
/**
* @param accessKeySecret
*/
public void setAccessKeySecret(String accessKeySecret) {
this.accessKeySecret = accessKeySecret;
}
/**
* @return bucket
*/
public String getBucket() {
return bucket;
}
/**
* @param bucket
*/
public void setBucket(String bucket) {
this.bucket = bucket;
}
/**
* @return gmt_create
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* @param gmtCreate
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* @return gmt_modified
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* @param gmtModified
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
/**
* @return creator
*/
public Long getCreator() {
return creator;
}
/**
* @param creator
*/
public void setCreator(Long creator) {
this.creator = creator;
}
/**
* @return code
*/
public String getCode() {
return code;
}
/**
* @param code
*/
public void setCode(String code) {
this.code = code;
}
/**
* @return role_arn
*/
public String getRoleArn() {
return roleArn;
}
/**
* @param roleArn
*/
public void setRoleArn(String roleArn) {
this.roleArn = roleArn;
}
/**
* @return endpoint
*/
public String getEndpoint() {
return endpoint;
}
/**
* @param endpoint
*/
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
/**
* @return catalogue
*/
public String getCatalogue() {
return catalogue;
}
/**
* @param catalogue
*/
public void setCatalogue(String catalogue) {
this.catalogue = catalogue;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import javax.persistence.*;
import java.util.Date;
@Table(name = "basic_data")
public class BasicData {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 全称
*/
private String title;
/**
* 简称
*/
@Column(name = "shortTitle")
private String shorttitle;
/**
* 编码
*/
private String code;
/**
* 排序
*/
@Column(name = "orderIndex")
private Integer orderindex;
/**
* 0:正常 1:停用
*/
private Integer status;
/**
* 类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*/
private String type;
/**
* 创建时间
*/
@Column(name = "createTime")
private Date createtime;
/**
* 更新时间
*/
@Column(name = "updateTime")
private Date updatetime;
private String remark;
@Column(name = "sheetName")
private String sheetname;
@Column(name = "excelPath")
private String excelpath;
@Column(name = "excelName")
private String excelname;
/**
* @return id
*/
public Integer getId() {
return id;
}
/**
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取全称
*
* @return title - 全称
*/
public String getTitle() {
return title;
}
/**
* 设置全称
*
* @param title 全称
*/
public void setTitle(String title) {
this.title = title;
}
/**
* 获取简称
*
* @return shortTitle - 简称
*/
public String getShorttitle() {
return shorttitle;
}
/**
* 设置简称
*
* @param shorttitle 简称
*/
public void setShorttitle(String shorttitle) {
this.shorttitle = shorttitle;
}
/**
* 获取编码
*
* @return code - 编码
*/
public String getCode() {
return code;
}
/**
* 设置编码
*
* @param code 编码
*/
public void setCode(String code) {
this.code = code;
}
/**
* 获取排序
*
* @return orderIndex - 排序
*/
public Integer getOrderindex() {
return orderindex;
}
/**
* 设置排序
*
* @param orderindex 排序
*/
public void setOrderindex(Integer orderindex) {
this.orderindex = orderindex;
}
/**
* 获取0:正常 1:停用
*
* @return status - 0:正常 1:停用
*/
public Integer getStatus() {
return status;
}
/**
* 设置0:正常 1:停用
*
* @param status 0:正常 1:停用
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* 获取类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*
* @return type - 类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*/
public String getType() {
return type;
}
/**
* 设置类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*
* @param type 类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*/
public void setType(String type) {
this.type = type;
}
/**
* 获取创建时间
*
* @return createTime - 创建时间
*/
public Date getCreatetime() {
return createtime;
}
/**
* 设置创建时间
*
* @param createtime 创建时间
*/
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
/**
* 获取更新时间
*
* @return updateTime - 更新时间
*/
public Date getUpdatetime() {
return updatetime;
}
/**
* 设置更新时间
*
* @param updatetime 更新时间
*/
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
/**
* @return remark
*/
public String getRemark() {
return remark;
}
/**
* @param remark
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* @return sheetName
*/
public String getSheetname() {
return sheetname;
}
/**
* @param sheetname
*/
public void setSheetname(String sheetname) {
this.sheetname = sheetname;
}
/**
* @return excelPath
*/
public String getExcelpath() {
return excelpath;
}
/**
* @param excelpath
*/
public void setExcelpath(String excelpath) {
this.excelpath = excelpath;
}
/**
* @return excelName
*/
public String getExcelname() {
return excelname;
}
/**
* @param excelname
*/
public void setExcelname(String excelname) {
this.excelname = excelname;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;
public class Client {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "client_name")
private String clientName;
private String code;
@Column(name = "gmt_create")
private Date gmtCreate;
@Column(name = "gmt_modified")
private Date gmtModified;
private Long creator;
@Column(name = "is_deleted")
private Boolean isDeleted;
@Column(name = "client_id")
private String clientId;
private Date expired;
@Column(name = "client_key")
private String clientKey;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return client_name
*/
public String getClientName() {
return clientName;
}
/**
* @param clientName
*/
public void setClientName(String clientName) {
this.clientName = clientName;
}
/**
* @return code
*/
public String getCode() {
return code;
}
/**
* @param code
*/
public void setCode(String code) {
this.code = code;
}
/**
* @return gmt_create
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* @param gmtCreate
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* @return gmt_modified
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* @param gmtModified
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
/**
* @return creator
*/
public Long getCreator() {
return creator;
}
/**
* @param creator
*/
public void setCreator(Long creator) {
this.creator = creator;
}
/**
* @return is_deleted
*/
public Boolean getIsDeleted() {
return isDeleted;
}
/**
* @param isDeleted
*/
public void setIsDeleted(Boolean isDeleted) {
this.isDeleted = isDeleted;
}
/**
* @return client_id
*/
public String getClientId() {
return clientId;
}
/**
* @param clientId
*/
public void setClientId(String clientId) {
this.clientId = clientId;
}
/**
* @return expired
*/
public Date getExpired() {
return expired;
}
/**
* @param expired
*/
public void setExpired(Date expired) {
this.expired = expired;
}
/**
* @return client_key
*/
public String getClientKey() {
return clientKey;
}
/**
* @param clientKey
*/
public void setClientKey(String clientKey) {
this.clientKey = clientKey;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import com.alibaba.fastjson.annotation.JSONField;
import javax.persistence.*;
import java.util.Date;
@Table(name = "course_standard_list")
public class CourseStandardList {
/**
* 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* uuid
*/
private String code;
/**
* 学段
*/
@Column(name = "study_stage")
private String studyStage;
/**
* 科目
*/
private String subject;
/**
* 课标类型
*/
@Column(name = "cur_type")
private String curType;
/**
* 状态
*/
private Boolean status;
/**
* 是否上架
*/
@Column(name = "upper_shelf")
private Boolean upperShelf;
/**
* 是否删除
*/
@Column(name = "is_delete")
private Boolean isDelete;
/**
* 创建时间
*/
@Column(name = "gmt_create")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date gmtCreate;
/**
* 修改时间
*/
@Column(name = "gmt_modified")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date gmtModified;
/**
* 获取主键
*
* @return id - 主键
*/
public Long getId() {
return id;
}
/**
* 设置主键
*
* @param id 主键
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取uuid
*
* @return code - uuid
*/
public String getCode() {
return code;
}
/**
* 设置uuid
*
* @param code uuid
*/
public void setCode(String code) {
this.code = code;
}
/**
* 获取学段
*
* @return study_stage - 学段
*/
public String getStudyStage() {
return studyStage;
}
/**
* 设置学段
*
* @param studyStage 学段
*/
public void setStudyStage(String studyStage) {
this.studyStage = studyStage;
}
/**
* 获取科目
*
* @return subject - 科目
*/
public String getSubject() {
return subject;
}
/**
* 设置科目
*
* @param subject 科目
*/
public void setSubject(String subject) {
this.subject = subject;
}
/**
* 获取课标类型
*
* @return cur_type - 课标类型
*/
public String getCurType() {
return curType;
}
/**
* 设置课标类型
*
* @param curType 课标类型
*/
public void setCurType(String curType) {
this.curType = curType;
}
/**
* 获取状态
*
* @return status - 状态
*/
public Boolean getStatus() {
return status;
}
/**
* 设置状态
*
* @param status 状态
*/
public void setStatus(Boolean status) {
this.status = status;
}
/**
* 获取是否删除
*
* @return is_delete - 是否删除
*/
public Boolean getIsDelete() {
return isDelete;
}
/**
* 设置是否删除
*
* @param isDelete 是否删除
*/
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
/**
* 获取创建时间
*
* @return gmt_create - 创建时间
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* 设置创建时间
*
* @param gmtCreate 创建时间
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* 获取修改时间
*
* @return gmt_modified - 修改时间
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* 设置修改时间
*
* @param gmtModified 修改时间
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
public Boolean getUpperShelf() {
return upperShelf;
}
public void setUpperShelf(Boolean upperShelf) {
this.upperShelf = upperShelf;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model.DTO;
import com.chineseall.teachgoal.model.AllExcelField;
import java.util.List;
public class UploadDTO {
private String studyStage;
private String subject;
private String curType;
private List<AllExcelField> list;
public String getStudyStage() {
return studyStage;
}
public void setStudyStage(String studyStage) {
this.studyStage = studyStage;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getCurType() {
return curType;
}
public void setCurType(String curType) {
this.curType = curType;
}
public List<AllExcelField> getList() {
return list;
}
public void setList(List<AllExcelField> list) {
this.list = list;
}
}
package com.chineseall.teachgoal.model;
import java.util.List;
public class DictTypeList {
private List<String> dictTypeList;
public List<String> getDictTypeList() {
return dictTypeList;
}
public void setDictTypeList(List<String> dictTypeList) {
this.dictTypeList = dictTypeList;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.model.AliBucket;
import com.chineseall.teachgoal.core.Service;
/**
* Created by guojw on 2020/04/08.
*/
public interface AliBucketService extends Service<AliBucket> {
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment