Browse Source

Merge branch 'master' of gitee.com:ccsens_s/ccsenscloud

master
zhangye 6 years ago
parent
commit
3679597217
  1. 133
      cloudutil/src/main/java/com/ccsens/cloudutil/aspect/LogAspect.java
  2. 27
      cloudutil/src/main/java/com/ccsens/cloudutil/bean/tall/dto/LogDto.java
  3. 14
      cloudutil/src/main/java/com/ccsens/cloudutil/feign/TallFeignClient.java
  4. 31
      cloudutil/src/main/java/com/ccsens/cloudutil/interceptor/LogInterceptor.java
  5. 3
      cloudutil/src/main/resources/application-util-dev.yml
  6. 8
      ht/src/main/java/com/ccsens/ht/api/DoctorController.java
  7. 10
      ht/src/main/java/com/ccsens/ht/api/PatientController.java
  8. 13
      ht/src/main/java/com/ccsens/ht/api/PatientReportController.java
  9. 8
      ht/src/main/java/com/ccsens/ht/api/PositionController.java
  10. 6
      ht/src/main/java/com/ccsens/ht/api/QuestionController.java
  11. 9
      ht/src/main/java/com/ccsens/ht/aspect/MustLoginAspect.java
  12. 4
      ht/src/main/java/com/ccsens/ht/bean/dto/DoctorDto.java
  13. 7
      ht/src/main/java/com/ccsens/ht/bean/dto/QueryDto.java
  14. 3
      ht/src/main/java/com/ccsens/ht/service/DoctorService.java
  15. 196
      ht/src/main/resources/logback-spring.xml
  16. 5
      tall/src/main/java/com/ccsens/tall/TallApplication.java
  17. 106
      tall/src/main/java/com/ccsens/tall/bean/po/SysLog.java
  18. 721
      tall/src/main/java/com/ccsens/tall/bean/po/SysLogExample.java
  19. 30
      tall/src/main/java/com/ccsens/tall/persist/mapper/SysLogMapper.java
  20. 44
      tall/src/main/java/com/ccsens/tall/web/LogController.java
  21. 2
      tall/src/main/resources/logback-spring.xml
  22. 258
      tall/src/main/resources/mapper_raw/SysLogMapper.xml
  23. 28
      util/src/test/java/com/ccsens/util/ZipTest.java

133
cloudutil/src/main/java/com/ccsens/cloudutil/aspect/LogAspect.java

@ -0,0 +1,133 @@
package com.ccsens.cloudutil.aspect;
import cn.hutool.core.util.ZipUtil;
import com.ccsens.cloudutil.bean.tall.dto.LogDto;
import com.ccsens.cloudutil.feign.TallFeignClient;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.UploadFileUtil_Servlet3;
import com.ccsens.util.WebConstant;
import com.ccsens.util.exception.BaseException;
import io.jsonwebtoken.Claims;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.Part;
import java.lang.reflect.Method;
/**
* @description:
* @author: wuHuiJuan
* @create: 2019/12/10 10:06
*/
@Order(1)
@Slf4j
@Aspect
@Component
public class LogAspect {
@Autowired
private TallFeignClient tallFeignClient;
@Pointcut("execution(* com.ccsens.tall.web..*(..)) || execution(* com.ccsens.ht.api..*(..))")
public void logAdvice(){
}
@Around("logAdvice()")
public Object around(ProceedingJoinPoint pjp){
LogDto logDto = initLog(pjp);
Object result;
try {
result = pjp.proceed();
} catch (Throwable throwable) {
log.error("方法运行异常", throwable);
if (logDto != null) {
String message = throwable.getMessage();
logDto.setResult(message.length() > 1000 ? message.substring(0,1000) : message);
tallFeignClient.log(logDto);
}
throw new BaseException(CodeEnum.SYS_ERROR);
}
if (logDto != null) {
String message = result == null ? null : result.toString().length() > 1000 ? result.toString().substring(0, 1000) : result.toString();
logDto.setResult(message);
tallFeignClient.log(logDto);
}
return result;
}
/**
* 获取方法路径描述参数
* @param pjp
* @return
*/
private LogDto initLog(ProceedingJoinPoint pjp) {
//路径
HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest();
String url = request.getServletPath();
System.out.println("url:" + url);
String logUrl = "/log/operation";
if (logUrl.equalsIgnoreCase(url)){
log.info("保存日志,不进行记录");
return null;
}
LogDto dto = new LogDto();
dto.setUrl(url);
//参数
Object[] args = pjp.getArgs();
StringBuilder param = new StringBuilder();
//方法注解
Class<?>[] argTypes = new Class[args.length];
for (int i = 0; i < args.length; i++) {
//参数类型
argTypes[i] = args[i].getClass();
//参数值
if (args[i] instanceof ServletResponse) {
continue;
} else if (args[i] instanceof ServletRequest) {
Object claims = request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS);
String userId = claims == null ? null : ((Claims) claims).getSubject();
if (userId != null) {
param.append("userId:").append(userId).append("--");
}
} else if (args[i] instanceof Part) {
param.append("file:").append(UploadFileUtil_Servlet3.getFileNameByPart((Part)args[i])).append("--");
}else {
param.append(args[i]).append("--");
}
}
dto.setParams(param.length() > 1000 ? param.substring(0, 1000) : param.toString());
try {
Method method = pjp.getTarget().getClass().getMethod(pjp.getSignature().getName(), argTypes);
ApiOperation annotation = method.getAnnotation(ApiOperation.class);
dto.setMethodDesc(annotation == null ? "" : annotation.value());
} catch (Exception e) {
log.error("获取方法时异常",e);
}
return dto;
}
}

27
cloudutil/src/main/java/com/ccsens/cloudutil/bean/tall/dto/LogDto.java

@ -0,0 +1,27 @@
package com.ccsens.cloudutil.bean.tall.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @description:
* @author: wuHuiJuan
* @create: 2019/12/09 18:01
*/
@Data
@ApiModel
public class LogDto {
private Long id;
@ApiModelProperty("接口地址")
private String url;
@ApiModelProperty("接口参数")
private String params;
@ApiModelProperty("接口描述")
private String methodDesc;
@ApiModelProperty("接口返回值(或异常)")
private String result;
}

14
cloudutil/src/main/java/com/ccsens/cloudutil/feign/TallFeignClient.java

@ -1,6 +1,7 @@
package com.ccsens.cloudutil.feign; package com.ccsens.cloudutil.feign;
import com.ccsens.cloudutil.bean.QueryParam; import com.ccsens.cloudutil.bean.QueryParam;
import com.ccsens.cloudutil.bean.tall.dto.LogDto;
import com.ccsens.cloudutil.bean.tall.dto.MemberRoleDto; import com.ccsens.cloudutil.bean.tall.dto.MemberRoleDto;
import com.ccsens.cloudutil.bean.tall.dto.UserDto; import com.ccsens.cloudutil.bean.tall.dto.UserDto;
import com.ccsens.cloudutil.bean.tall.vo.UserVo; import com.ccsens.cloudutil.bean.tall.vo.UserVo;
@ -64,7 +65,13 @@ public interface TallFeignClient {
@GetMapping("users/token") @GetMapping("users/token")
JsonResponse getUserIdByToken(@RequestParam(required = true, name = "token") String token); JsonResponse getUserIdByToken(@RequestParam(required = true, name = "token") String token);
/**
* 记录操作日志
* @param logDto
* @return
*/
@RequestMapping("/log/operation")
JsonResponse log(LogDto logDto);
} }
@Slf4j @Slf4j
@ -102,6 +109,11 @@ class TallFeignClientFallBack implements FallbackFactory<TallFeignClient> {
public JsonResponse getUserIdByToken(String token) { public JsonResponse getUserIdByToken(String token) {
return JsonResponse.newInstance().fail(); return JsonResponse.newInstance().fail();
} }
@Override
public JsonResponse log(LogDto logDto) {
return JsonResponse.newInstance().fail();
}
}; };
} }

31
cloudutil/src/main/java/com/ccsens/cloudutil/interceptor/LogInterceptor.java

@ -0,0 +1,31 @@
package com.ccsens.cloudutil.interceptor;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @description:
* @author: wuHuiJuan
* @create: 2019/12/09 18:24
*/
public class LogInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//路径
String path = request.getContextPath();
return false;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
}
}

3
cloudutil/src/main/resources/application-util-dev.yml

@ -30,6 +30,9 @@ eureka:
home-page-url-path: ${server.servlet.context-path}/ home-page-url-path: ${server.servlet.context-path}/
status-page-url-path: ${server.servlet.context-path}/actuator/info status-page-url-path: ${server.servlet.context-path}/actuator/info
health-check-url-path: ${server.servlet.context-path}/actuator/health health-check-url-path: ${server.servlet.context-path}/actuator/health
ribbon:
ConnectTimeout: 5000
ReadTimeout: 5000
feign: feign:
client: client:
config: config:

8
ht/src/main/java/com/ccsens/ht/api/DoctorController.java

@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
/** /**
* @program: ptpro * @program: ptpro
* @description: * @description:
@ -39,7 +41,7 @@ public class DoctorController {
@ApiImplicitParam(name = "json", value = "医生基本信息", required = true) @ApiImplicitParam(name = "json", value = "医生基本信息", required = true)
}) })
@RequestMapping(value = "/doctorSubmit", method = RequestMethod.POST) @RequestMapping(value = "/doctorSubmit", method = RequestMethod.POST)
public JsonResponse doctorSubmit(@RequestBody @ApiParam @Validated QueryDto<DoctorDto.Submit> params) { public JsonResponse doctorSubmit(@RequestBody @ApiParam @Valid QueryDto<DoctorDto.Submit> params) {
log.info("资格认证参数:{}", params); log.info("资格认证参数:{}", params);
DoctorDto.Submit submit = params.getParam(); DoctorDto.Submit submit = params.getParam();
return doctorService.doctorSubmit(submit, params.getUserId()); return doctorService.doctorSubmit(submit, params.getUserId());
@ -53,7 +55,7 @@ public class DoctorController {
@ApiImplicitParam(name = "json", value = "医生查询条件", required = true) @ApiImplicitParam(name = "json", value = "医生查询条件", required = true)
}) })
@RequestMapping(value = "/queryDoctors", method = RequestMethod.POST) @RequestMapping(value = "/queryDoctors", method = RequestMethod.POST)
public JsonResponse queryDoctors(@RequestBody @ApiParam @Validated QueryDto<DoctorDto.Query> params) { public JsonResponse queryDoctors(@RequestBody @ApiParam @Valid QueryDto<DoctorDto.Query> params) {
log.info("资格认证列表:{}", params); log.info("资格认证列表:{}", params);
PageInfo<DoctorVo.Query> dtos = doctorService.queryDoctors(params.getParam(), params.getUserId()); PageInfo<DoctorVo.Query> dtos = doctorService.queryDoctors(params.getParam(), params.getUserId());
return JsonResponse.newInstance().ok(CodeEnum.SUCCESS, dtos); return JsonResponse.newInstance().ok(CodeEnum.SUCCESS, dtos);
@ -66,7 +68,7 @@ public class DoctorController {
@ApiImplicitParam(name = "json", value = "医生基本信息", required = true) @ApiImplicitParam(name = "json", value = "医生基本信息", required = true)
}) })
@RequestMapping(value = "/doctorAudit", method = RequestMethod.POST) @RequestMapping(value = "/doctorAudit", method = RequestMethod.POST)
public JsonResponse doctorAudit(@RequestBody @ApiParam @Validated QueryDto<DoctorDto.Audit> params) throws Exception { public JsonResponse doctorAudit(@RequestBody @ApiParam @Valid QueryDto<DoctorDto.Audit> params) throws Exception {
log.info("资格审核:{}", params); log.info("资格审核:{}", params);
DoctorDto.Audit audit = params.getParam(); DoctorDto.Audit audit = params.getParam();

10
ht/src/main/java/com/ccsens/ht/api/PatientController.java

@ -15,12 +15,12 @@ import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List; import java.util.List;
/** /**
@ -51,7 +51,7 @@ public class PatientController {
@ApiImplicitParam(name = "json", value = "病友基础信息", required = true) @ApiImplicitParam(name = "json", value = "病友基础信息", required = true)
}) })
@RequestMapping(value="/queryPatient", method = RequestMethod.POST) @RequestMapping(value="/queryPatient", method = RequestMethod.POST)
public JsonResponse query(@RequestBody @ApiParam @Validated QueryDto<PatientDto.Query> params) { public JsonResponse query(@RequestBody @ApiParam @Valid QueryDto<PatientDto.Query> params) {
log.info("病友信息查询:{}", params); log.info("病友信息查询:{}", params);
PatientDto.Query patient = params.getParam(); PatientDto.Query patient = params.getParam();
@ -75,7 +75,7 @@ public class PatientController {
@ApiImplicitParam(name = "json", value = "病友基础信息", required = true) @ApiImplicitParam(name = "json", value = "病友基础信息", required = true)
}) })
@RequestMapping(value="/editPatient", method = RequestMethod.POST) @RequestMapping(value="/editPatient", method = RequestMethod.POST)
public JsonResponse edit(@RequestBody @ApiParam @Validated QueryDto<PatientDto.Edit>params) { public JsonResponse edit(@RequestBody @ApiParam @Valid QueryDto<PatientDto.Edit>params) {
log.info("病友信息编辑:{}", params); log.info("病友信息编辑:{}", params);
PatientDto.Edit patient = params.getParam(); PatientDto.Edit patient = params.getParam();
if(StringUtils.isEmpty(patient.getMobile()) || StringUtils.isEmpty(patient.getName())) { if(StringUtils.isEmpty(patient.getMobile()) || StringUtils.isEmpty(patient.getName())) {
@ -113,7 +113,7 @@ public class PatientController {
@ApiImplicitParam(name = "json", value = "病友其他信息查询", required = true) @ApiImplicitParam(name = "json", value = "病友其他信息查询", required = true)
}) })
@RequestMapping(value="/queryPatientOtherMsg", method = RequestMethod.POST) @RequestMapping(value="/queryPatientOtherMsg", method = RequestMethod.POST)
public JsonResponse queryPatientOtherMsg(@RequestBody @ApiParam @Validated QueryDto<PatientDto.QueryOtherMsg> params) { public JsonResponse queryPatientOtherMsg(@RequestBody @ApiParam @Valid QueryDto<PatientDto.QueryOtherMsg> params) {
log.info("查询其他信息请求参数:{}", params); log.info("查询其他信息请求参数:{}", params);
List list = patientService.queryPatientOtherMsg(params.getParam(), params.getUserId()); List list = patientService.queryPatientOtherMsg(params.getParam(), params.getUserId());
return JsonResponse.newInstance().ok(list); return JsonResponse.newInstance().ok(list);
@ -126,7 +126,7 @@ public class PatientController {
@ApiImplicitParam(name = "json", value = "编辑其他病友信息", required = true) @ApiImplicitParam(name = "json", value = "编辑其他病友信息", required = true)
}) })
@RequestMapping(value="/editPatientOtherMsg", method = RequestMethod.POST) @RequestMapping(value="/editPatientOtherMsg", method = RequestMethod.POST)
public JsonResponse editPatientOtherMsg(@RequestBody @ApiParam @Validated QueryDto<PatientDto.EditOtherMsg> params) { public JsonResponse editPatientOtherMsg(@RequestBody @ApiParam @Valid QueryDto<PatientDto.EditOtherMsg> params) {
log.info("查询其他信息请求参数:{}", params); log.info("查询其他信息请求参数:{}", params);
CodeEnum codeEnum = patientService.editPatientOtherMsg(params.getParam(), params.getUserId()); CodeEnum codeEnum = patientService.editPatientOtherMsg(params.getParam(), params.getUserId());
return JsonResponse.newInstance().ok(codeEnum); return JsonResponse.newInstance().ok(codeEnum);

13
ht/src/main/java/com/ccsens/ht/api/PatientReportController.java

@ -13,12 +13,13 @@ import com.github.pagehelper.PageInfo;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
/** /**
* @program: ptpro * @program: ptpro
* @description:病人报告单 * @description:病人报告单
@ -40,7 +41,7 @@ public class PatientReportController {
@ApiImplicitParam(name = "json", value = "报告单信息", required = true) @ApiImplicitParam(name = "json", value = "报告单信息", required = true)
}) })
@RequestMapping(value="/generatePatientReport", method = RequestMethod.POST) @RequestMapping(value="/generatePatientReport", method = RequestMethod.POST)
public JsonResponse generate(@RequestBody @ApiParam @Validated QueryDto<PatientReportDto.Generate> dto){ public JsonResponse generate(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.Generate> dto){
log.info("生成报告单请求参数:{}", dto); log.info("生成报告单请求参数:{}", dto);
PatientReportDto.Generate patientReport = dto.getParam(); PatientReportDto.Generate patientReport = dto.getParam();
if (patientReport == null || patientReport.getPatientId() == null || patientReport.getPatientId() == 0) { if (patientReport == null || patientReport.getPatientId() == null || patientReport.getPatientId() == 0) {
@ -58,7 +59,7 @@ public class PatientReportController {
@ApiImplicitParam(name = "json", value = "编辑报告单信息", required = true) @ApiImplicitParam(name = "json", value = "编辑报告单信息", required = true)
}) })
@RequestMapping(value="/editPatientReport", method = RequestMethod.POST) @RequestMapping(value="/editPatientReport", method = RequestMethod.POST)
public JsonResponse edit(@RequestBody @ApiParam @Validated QueryDto<PatientReportDto.Edit> param){ public JsonResponse edit(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.Edit> param){
//编辑报告单信息 //编辑报告单信息
log.info("编辑报告单:{}", param); log.info("编辑报告单:{}", param);
@ -73,7 +74,7 @@ public class PatientReportController {
@ApiImplicitParam(name = "json", value = "编辑报告单信息", required = true) @ApiImplicitParam(name = "json", value = "编辑报告单信息", required = true)
}) })
@RequestMapping(value="/queryReports", method = RequestMethod.POST) @RequestMapping(value="/queryReports", method = RequestMethod.POST)
public JsonResponse queryReports(@RequestBody @ApiParam @Validated QueryDto<PatientReportDto.QueryReports> param){ public JsonResponse queryReports(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.QueryReports> param){
//编辑报告单信息 //编辑报告单信息
log.info("查询报告单列表:{}", param); log.info("查询报告单列表:{}", param);
@ -87,7 +88,7 @@ public class PatientReportController {
@ApiImplicitParam(name = "json", value = "查询报告单详情", required = true) @ApiImplicitParam(name = "json", value = "查询报告单详情", required = true)
}) })
@RequestMapping(value="/queryReportDetail", method = RequestMethod.POST) @RequestMapping(value="/queryReportDetail", method = RequestMethod.POST)
public JsonResponse queryReportDetail(@RequestBody @ApiParam @Validated QueryDto<PatientReportDto.QueryDetail> param){ public JsonResponse queryReportDetail(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.QueryDetail> param){
//查询报告单信息 //查询报告单信息
log.info("查询报告单详情:{}", param); log.info("查询报告单详情:{}", param);
PatientReportVo.ReprotDetail detail = patientReportService.queryReportDetail(param.getParam(), param.getUserId()); PatientReportVo.ReprotDetail detail = patientReportService.queryReportDetail(param.getParam(), param.getUserId());
@ -101,7 +102,7 @@ public class PatientReportController {
@ApiImplicitParam(name = "json", value = "报告单ID", required = true) @ApiImplicitParam(name = "json", value = "报告单ID", required = true)
}) })
@RequestMapping(value="/queryAuthority", method = RequestMethod.POST) @RequestMapping(value="/queryAuthority", method = RequestMethod.POST)
public JsonResponse queryAuthority(@RequestBody @ApiParam @Validated QueryDto<PatientReportDto.Authority> param){ public JsonResponse queryAuthority(@RequestBody @ApiParam @Valid QueryDto<PatientReportDto.Authority> param){
//查询报告单信息 //查询报告单信息
log.info("查询医生对报告单的权限:{}", param); log.info("查询医生对报告单的权限:{}", param);
PatientReportVo.Authority authority = patientReportService.queryReportAuthority(param.getParam(), param.getUserId()); PatientReportVo.Authority authority = patientReportService.queryReportAuthority(param.getParam(), param.getUserId());

8
ht/src/main/java/com/ccsens/ht/api/PositionController.java

@ -9,12 +9,12 @@ import com.ccsens.util.JsonResponse;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List; import java.util.List;
/** /**
@ -36,7 +36,7 @@ public class PositionController {
@ApiImplicitParam(name = "json", value = "医院/部门/职务查询", required = true) @ApiImplicitParam(name = "json", value = "医院/部门/职务查询", required = true)
}) })
@RequestMapping(value="/queryPosition", method = RequestMethod.POST) @RequestMapping(value="/queryPosition", method = RequestMethod.POST)
public JsonResponse queryPosition(@RequestBody @ApiParam @Validated QueryDto<PositionDto.Position> params){ public JsonResponse queryPosition(@RequestBody @ApiParam @Valid QueryDto<PositionDto.Position> params){
log.info("查询职务:{}", params); log.info("查询职务:{}", params);
List<PositionVo.Position> positions = positionService.queryPosition(params.getParam(), params.getUserId()); List<PositionVo.Position> positions = positionService.queryPosition(params.getParam(), params.getUserId());
return JsonResponse.newInstance().ok(positions); return JsonResponse.newInstance().ok(positions);
@ -48,8 +48,8 @@ public class PositionController {
@ApiImplicitParam(name = "json", value = "职称查询", required = true) @ApiImplicitParam(name = "json", value = "职称查询", required = true)
}) })
@RequestMapping(value="/queryTitle", method = RequestMethod.POST) @RequestMapping(value="/queryTitle", method = RequestMethod.POST)
public JsonResponse queryTitle(@RequestBody @ApiParam @Validated QueryDto params){ public JsonResponse queryTitle(){
log.info("查询职称:{}", params); log.info("查询职称");
List<PositionVo.Title> titles = positionService.queryTitles(); List<PositionVo.Title> titles = positionService.queryTitles();
return JsonResponse.newInstance().ok(titles); return JsonResponse.newInstance().ok(titles);
} }

6
ht/src/main/java/com/ccsens/ht/api/QuestionController.java

@ -13,12 +13,12 @@ import com.ccsens.util.NotSupportedFileTypeException;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
/** /**
@ -41,7 +41,7 @@ public class QuestionController {
@ApiImplicitParam(name = "json", value = "测评试题查询信息", required = true) @ApiImplicitParam(name = "json", value = "测评试题查询信息", required = true)
}) })
@RequestMapping(value="/queryQuestion", method = RequestMethod.POST) @RequestMapping(value="/queryQuestion", method = RequestMethod.POST)
public JsonResponse query(@RequestBody @ApiParam @Validated QueryDto<QuestionDto.Query> queryDto){ public JsonResponse query(@RequestBody @ApiParam @Valid QueryDto<QuestionDto.Query> queryDto){
log.info("查询试题:{}", queryDto); log.info("查询试题:{}", queryDto);
QuestionVo.Query query = questionService.queryQuestion(queryDto.getParam(), queryDto.getUserId()); QuestionVo.Query query = questionService.queryQuestion(queryDto.getParam(), queryDto.getUserId());
log.info("查询试题结果:{}", query); log.info("查询试题结果:{}", query);
@ -55,7 +55,7 @@ public class QuestionController {
@ApiImplicitParam(name = "json", value = "试题得分情况", required = true) @ApiImplicitParam(name = "json", value = "试题得分情况", required = true)
}) })
@RequestMapping(value="/saveScore", method = RequestMethod.POST) @RequestMapping(value="/saveScore", method = RequestMethod.POST)
public JsonResponse saveScore(@RequestBody @ApiParam @Validated QueryDto<QuestionDto.Score> queryDto) throws IOException, NotSupportedFileTypeException { public JsonResponse saveScore(@RequestBody @ApiParam @Valid QueryDto<QuestionDto.Score> queryDto) throws IOException, NotSupportedFileTypeException {
log.info("保存试题得分:{}", queryDto); log.info("保存试题得分:{}", queryDto);
CodeEnum codeEnum = questionService.saveScore(queryDto.getParam(), queryDto.getUserId()); CodeEnum codeEnum = questionService.saveScore(queryDto.getParam(), queryDto.getUserId());
log.info("保存试题得分结果:{}", codeEnum); log.info("保存试题得分结果:{}", codeEnum);

9
ht/src/main/java/com/ccsens/ht/aspect/MustLoginAspect.java

@ -29,7 +29,7 @@ import java.util.Arrays;
* @author: wuHuiJuan * @author: wuHuiJuan
* @create: 2019/12/09 09:54 * @create: 2019/12/09 09:54
*/ */
@Order(1) @Order(0)
@Slf4j @Slf4j
@Aspect @Aspect
@Component @Component
@ -48,8 +48,7 @@ public class MustLoginAspect {
final String authHeader = request.getHeader(WebConstant.HEADER_KEY_TOKEN); final String authHeader = request.getHeader(WebConstant.HEADER_KEY_TOKEN);
Object[] args = pjp.getArgs(); Object[] args = pjp.getArgs();
QueryDto dto = (QueryDto) args[0]; QueryDto dto = args == null || args.length < 1 ? null : (QueryDto) args[0];
// final String authHeader = dto.getToken();
JsonResponse response = tallFeignClient.getUserIdByToken(authHeader); JsonResponse response = tallFeignClient.getUserIdByToken(authHeader);
log.info("{}获取userId:{}", authHeader, response); log.info("{}获取userId:{}", authHeader, response);
@ -65,8 +64,10 @@ public class MustLoginAspect {
return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN); return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN);
} }
if (dto != null) {
dto.setUserId(userId);
}
dto.setUserId(userId);
Object result; Object result;
try { try {
result = pjp.proceed(); result = pjp.proceed();

4
ht/src/main/java/com/ccsens/ht/bean/dto/DoctorDto.java

@ -24,10 +24,10 @@ public class DoctorDto {
@NotNull @NotNull
private Long positionId; private Long positionId;
@ApiModelProperty("职称ID") @ApiModelProperty("职称ID")
@NotNull @NotNull()
private Long titleId; private Long titleId;
@ApiModelProperty("姓名") @ApiModelProperty("姓名")
@NotNull @NotNull(message = "姓名不能为空")
private String name; private String name;
@ApiModelProperty("性别(0:男 1:女)") @ApiModelProperty("性别(0:男 1:女)")
@NotNull @NotNull

7
ht/src/main/java/com/ccsens/ht/bean/dto/QueryDto.java

@ -3,6 +3,10 @@ package com.ccsens.ht.bean.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
/** /**
* @program: ptpro * @program: ptpro
@ -14,9 +18,8 @@ import lombok.Data;
@Data @Data
public class QueryDto<T> { public class QueryDto<T> {
@ApiModelProperty("真正的请求参数") @ApiModelProperty("真正的请求参数")
@Valid
private T param; private T param;
@ApiModelProperty("登录用户ID 前端不为userId赋值") @ApiModelProperty("登录用户ID 前端不为userId赋值")
private Long userId; private Long userId;
@ApiModelProperty("token")
private String token;
} }

3
ht/src/main/java/com/ccsens/ht/service/DoctorService.java

@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -93,7 +94,7 @@ public class DoctorService implements IDoctorService {
htDoctor.setUserId(userId); htDoctor.setUserId(userId);
htDoctor.setAuditorId((long)Constant.Ht.NUMBER_DEFAULT); htDoctor.setAuditorId((long)Constant.Ht.NUMBER_DEFAULT);
htDoctor.setAuditState(Constant.Ht.Doctor.CHECK_WAIT); htDoctor.setAuditState(Constant.Ht.Doctor.CHECK_WAIT);
htDoctorMapper.insert(htDoctor); htDoctorMapper.insertSelective(htDoctor);
} }

196
ht/src/main/resources/logback-spring.xml

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 -->
<!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true -->
<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
<configuration scan="true" scanPeriod="10 seconds">
<!--<include resource="org/springframework/boot/logging/logback/base.xml" />-->
<contextName>logback</contextName>
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
<property name="log.path" value="/home/cloud/ht/log/" />
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!--输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>info</level>
</filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<!-- 设置字符集 -->
<charset>UTF-8</charset>
</encoder>
</appender>
<!--输出到文件-->
<!-- 时间滚动输出 level为 DEBUG 日志 -->
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_debug.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志归档 -->
<fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 INFO 日志 -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_info.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 WARN 日志 -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_warn.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 ERROR 日志 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_error.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!--
<logger>用来设置某一个包或者具体的某一个类的日志打印级别、
以及指定<appender><logger>仅有一个name属性,
一个可选的level和一个可选的addtivity属性。
name:用来指定受此logger约束的某一个包或者具体的某一个类。
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。
如果未设置此属性,那么当前logger将会继承上级的级别。
addtivity:是否向上级logger传递打印信息。默认是true。
-->
<!--<logger name="org.springframework.web" level="info"/>-->
<!--<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>-->
<!--
使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作:
第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息
第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别:
-->
<!--
root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
不能设置为INHERITED或者同义词NULL。默认是DEBUG
可以包含零个或多个元素,标识这个appender将会添加到这个logger。
-->
<!--开发环境:打印控制台-->
<springProfile name="dev">
<logger name="com.ccsens.ptpro.persist.*" level="debug"/>
</springProfile>
<root level="info">
<appender-ref ref="CONSOLE" />
<appender-ref ref="DEBUG_FILE" />
<appender-ref ref="INFO_FILE" />
<appender-ref ref="WARN_FILE" />
<appender-ref ref="ERROR_FILE" />
</root>
<!--生产环境:输出到文件-->
<!--<springProfile name="pro">-->
<!--<root level="info">-->
<!--<appender-ref ref="CONSOLE" />-->
<!--<appender-ref ref="DEBUG_FILE" />-->
<!--<appender-ref ref="INFO_FILE" />-->
<!--<appender-ref ref="ERROR_FILE" />-->
<!--<appender-ref ref="WARN_FILE" />-->
<!--</root>-->
<!--</springProfile>-->
</configuration>

5
tall/src/main/java/com/ccsens/tall/TallApplication.java

@ -6,6 +6,8 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import java.io.File; import java.io.File;
@ -18,6 +20,9 @@ import java.io.File;
@MapperScan(basePackages = {"com.ccsens.tall.persist.*"}) @MapperScan(basePackages = {"com.ccsens.tall.persist.*"})
@ServletComponentScan @ServletComponentScan
@EnableAsync @EnableAsync
//开启断路器功能
@EnableCircuitBreaker
@EnableFeignClients(basePackages = "com.ccsens.cloudutil.feign")
@SpringBootApplication(scanBasePackages = "com.ccsens") @SpringBootApplication(scanBasePackages = "com.ccsens")
public class TallApplication implements CommandLineRunner { public class TallApplication implements CommandLineRunner {
public static void main(String[] args) { public static void main(String[] args) {

106
tall/src/main/java/com/ccsens/tall/bean/po/SysLog.java

@ -0,0 +1,106 @@
package com.ccsens.tall.bean.po;
import java.io.Serializable;
import java.util.Date;
public class SysLog implements Serializable {
private Long id;
private String url;
private String methodDesc;
private String params;
private String result;
private Date createdAt;
private Date updatedAt;
private Byte recStatus;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url == null ? null : url.trim();
}
public String getMethodDesc() {
return methodDesc;
}
public void setMethodDesc(String methodDesc) {
this.methodDesc = methodDesc == null ? null : methodDesc.trim();
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params == null ? null : params.trim();
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result == null ? null : result.trim();
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public Byte getRecStatus() {
return recStatus;
}
public void setRecStatus(Byte recStatus) {
this.recStatus = recStatus;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", url=").append(url);
sb.append(", methodDesc=").append(methodDesc);
sb.append(", params=").append(params);
sb.append(", result=").append(result);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);
sb.append("]");
return sb.toString();
}
}

721
tall/src/main/java/com/ccsens/tall/bean/po/SysLogExample.java

@ -0,0 +1,721 @@
package com.ccsens.tall.bean.po;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SysLogExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public SysLogExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUrlIsNull() {
addCriterion("url is null");
return (Criteria) this;
}
public Criteria andUrlIsNotNull() {
addCriterion("url is not null");
return (Criteria) this;
}
public Criteria andUrlEqualTo(String value) {
addCriterion("url =", value, "url");
return (Criteria) this;
}
public Criteria andUrlNotEqualTo(String value) {
addCriterion("url <>", value, "url");
return (Criteria) this;
}
public Criteria andUrlGreaterThan(String value) {
addCriterion("url >", value, "url");
return (Criteria) this;
}
public Criteria andUrlGreaterThanOrEqualTo(String value) {
addCriterion("url >=", value, "url");
return (Criteria) this;
}
public Criteria andUrlLessThan(String value) {
addCriterion("url <", value, "url");
return (Criteria) this;
}
public Criteria andUrlLessThanOrEqualTo(String value) {
addCriterion("url <=", value, "url");
return (Criteria) this;
}
public Criteria andUrlLike(String value) {
addCriterion("url like", value, "url");
return (Criteria) this;
}
public Criteria andUrlNotLike(String value) {
addCriterion("url not like", value, "url");
return (Criteria) this;
}
public Criteria andUrlIn(List<String> values) {
addCriterion("url in", values, "url");
return (Criteria) this;
}
public Criteria andUrlNotIn(List<String> values) {
addCriterion("url not in", values, "url");
return (Criteria) this;
}
public Criteria andUrlBetween(String value1, String value2) {
addCriterion("url between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andUrlNotBetween(String value1, String value2) {
addCriterion("url not between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andMethodDescIsNull() {
addCriterion("method_desc is null");
return (Criteria) this;
}
public Criteria andMethodDescIsNotNull() {
addCriterion("method_desc is not null");
return (Criteria) this;
}
public Criteria andMethodDescEqualTo(String value) {
addCriterion("method_desc =", value, "methodDesc");
return (Criteria) this;
}
public Criteria andMethodDescNotEqualTo(String value) {
addCriterion("method_desc <>", value, "methodDesc");
return (Criteria) this;
}
public Criteria andMethodDescGreaterThan(String value) {
addCriterion("method_desc >", value, "methodDesc");
return (Criteria) this;
}
public Criteria andMethodDescGreaterThanOrEqualTo(String value) {
addCriterion("method_desc >=", value, "methodDesc");
return (Criteria) this;
}
public Criteria andMethodDescLessThan(String value) {
addCriterion("method_desc <", value, "methodDesc");
return (Criteria) this;
}
public Criteria andMethodDescLessThanOrEqualTo(String value) {
addCriterion("method_desc <=", value, "methodDesc");
return (Criteria) this;
}
public Criteria andMethodDescLike(String value) {
addCriterion("method_desc like", value, "methodDesc");
return (Criteria) this;
}
public Criteria andMethodDescNotLike(String value) {
addCriterion("method_desc not like", value, "methodDesc");
return (Criteria) this;
}
public Criteria andMethodDescIn(List<String> values) {
addCriterion("method_desc in", values, "methodDesc");
return (Criteria) this;
}
public Criteria andMethodDescNotIn(List<String> values) {
addCriterion("method_desc not in", values, "methodDesc");
return (Criteria) this;
}
public Criteria andMethodDescBetween(String value1, String value2) {
addCriterion("method_desc between", value1, value2, "methodDesc");
return (Criteria) this;
}
public Criteria andMethodDescNotBetween(String value1, String value2) {
addCriterion("method_desc not between", value1, value2, "methodDesc");
return (Criteria) this;
}
public Criteria andParamsIsNull() {
addCriterion("params is null");
return (Criteria) this;
}
public Criteria andParamsIsNotNull() {
addCriterion("params is not null");
return (Criteria) this;
}
public Criteria andParamsEqualTo(String value) {
addCriterion("params =", value, "params");
return (Criteria) this;
}
public Criteria andParamsNotEqualTo(String value) {
addCriterion("params <>", value, "params");
return (Criteria) this;
}
public Criteria andParamsGreaterThan(String value) {
addCriterion("params >", value, "params");
return (Criteria) this;
}
public Criteria andParamsGreaterThanOrEqualTo(String value) {
addCriterion("params >=", value, "params");
return (Criteria) this;
}
public Criteria andParamsLessThan(String value) {
addCriterion("params <", value, "params");
return (Criteria) this;
}
public Criteria andParamsLessThanOrEqualTo(String value) {
addCriterion("params <=", value, "params");
return (Criteria) this;
}
public Criteria andParamsLike(String value) {
addCriterion("params like", value, "params");
return (Criteria) this;
}
public Criteria andParamsNotLike(String value) {
addCriterion("params not like", value, "params");
return (Criteria) this;
}
public Criteria andParamsIn(List<String> values) {
addCriterion("params in", values, "params");
return (Criteria) this;
}
public Criteria andParamsNotIn(List<String> values) {
addCriterion("params not in", values, "params");
return (Criteria) this;
}
public Criteria andParamsBetween(String value1, String value2) {
addCriterion("params between", value1, value2, "params");
return (Criteria) this;
}
public Criteria andParamsNotBetween(String value1, String value2) {
addCriterion("params not between", value1, value2, "params");
return (Criteria) this;
}
public Criteria andResultIsNull() {
addCriterion("result is null");
return (Criteria) this;
}
public Criteria andResultIsNotNull() {
addCriterion("result is not null");
return (Criteria) this;
}
public Criteria andResultEqualTo(String value) {
addCriterion("result =", value, "result");
return (Criteria) this;
}
public Criteria andResultNotEqualTo(String value) {
addCriterion("result <>", value, "result");
return (Criteria) this;
}
public Criteria andResultGreaterThan(String value) {
addCriterion("result >", value, "result");
return (Criteria) this;
}
public Criteria andResultGreaterThanOrEqualTo(String value) {
addCriterion("result >=", value, "result");
return (Criteria) this;
}
public Criteria andResultLessThan(String value) {
addCriterion("result <", value, "result");
return (Criteria) this;
}
public Criteria andResultLessThanOrEqualTo(String value) {
addCriterion("result <=", value, "result");
return (Criteria) this;
}
public Criteria andResultLike(String value) {
addCriterion("result like", value, "result");
return (Criteria) this;
}
public Criteria andResultNotLike(String value) {
addCriterion("result not like", value, "result");
return (Criteria) this;
}
public Criteria andResultIn(List<String> values) {
addCriterion("result in", values, "result");
return (Criteria) this;
}
public Criteria andResultNotIn(List<String> values) {
addCriterion("result not in", values, "result");
return (Criteria) this;
}
public Criteria andResultBetween(String value1, String value2) {
addCriterion("result between", value1, value2, "result");
return (Criteria) this;
}
public Criteria andResultNotBetween(String value1, String value2) {
addCriterion("result not between", value1, value2, "result");
return (Criteria) this;
}
public Criteria andCreatedAtIsNull() {
addCriterion("created_at is null");
return (Criteria) this;
}
public Criteria andCreatedAtIsNotNull() {
addCriterion("created_at is not null");
return (Criteria) this;
}
public Criteria andCreatedAtEqualTo(Date value) {
addCriterion("created_at =", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotEqualTo(Date value) {
addCriterion("created_at <>", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtGreaterThan(Date value) {
addCriterion("created_at >", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) {
addCriterion("created_at >=", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtLessThan(Date value) {
addCriterion("created_at <", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtLessThanOrEqualTo(Date value) {
addCriterion("created_at <=", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtIn(List<Date> values) {
addCriterion("created_at in", values, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotIn(List<Date> values) {
addCriterion("created_at not in", values, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtBetween(Date value1, Date value2) {
addCriterion("created_at between", value1, value2, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotBetween(Date value1, Date value2) {
addCriterion("created_at not between", value1, value2, "createdAt");
return (Criteria) this;
}
public Criteria andUpdatedAtIsNull() {
addCriterion("updated_at is null");
return (Criteria) this;
}
public Criteria andUpdatedAtIsNotNull() {
addCriterion("updated_at is not null");
return (Criteria) this;
}
public Criteria andUpdatedAtEqualTo(Date value) {
addCriterion("updated_at =", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotEqualTo(Date value) {
addCriterion("updated_at <>", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtGreaterThan(Date value) {
addCriterion("updated_at >", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) {
addCriterion("updated_at >=", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtLessThan(Date value) {
addCriterion("updated_at <", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtLessThanOrEqualTo(Date value) {
addCriterion("updated_at <=", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtIn(List<Date> values) {
addCriterion("updated_at in", values, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotIn(List<Date> values) {
addCriterion("updated_at not in", values, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtBetween(Date value1, Date value2) {
addCriterion("updated_at between", value1, value2, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotBetween(Date value1, Date value2) {
addCriterion("updated_at not between", value1, value2, "updatedAt");
return (Criteria) this;
}
public Criteria andRecStatusIsNull() {
addCriterion("rec_status is null");
return (Criteria) this;
}
public Criteria andRecStatusIsNotNull() {
addCriterion("rec_status is not null");
return (Criteria) this;
}
public Criteria andRecStatusEqualTo(Byte value) {
addCriterion("rec_status =", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotEqualTo(Byte value) {
addCriterion("rec_status <>", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusGreaterThan(Byte value) {
addCriterion("rec_status >", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) {
addCriterion("rec_status >=", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusLessThan(Byte value) {
addCriterion("rec_status <", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusLessThanOrEqualTo(Byte value) {
addCriterion("rec_status <=", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusIn(List<Byte> values) {
addCriterion("rec_status in", values, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotIn(List<Byte> values) {
addCriterion("rec_status not in", values, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusBetween(Byte value1, Byte value2) {
addCriterion("rec_status between", value1, value2, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotBetween(Byte value1, Byte value2) {
addCriterion("rec_status not between", value1, value2, "recStatus");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

30
tall/src/main/java/com/ccsens/tall/persist/mapper/SysLogMapper.java

@ -0,0 +1,30 @@
package com.ccsens.tall.persist.mapper;
import com.ccsens.tall.bean.po.SysLog;
import com.ccsens.tall.bean.po.SysLogExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SysLogMapper {
long countByExample(SysLogExample example);
int deleteByExample(SysLogExample example);
int deleteByPrimaryKey(Long id);
int insert(SysLog record);
int insertSelective(SysLog record);
List<SysLog> selectByExample(SysLogExample example);
SysLog selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") SysLog record, @Param("example") SysLogExample example);
int updateByExample(@Param("record") SysLog record, @Param("example") SysLogExample example);
int updateByPrimaryKeySelective(SysLog record);
int updateByPrimaryKey(SysLog record);
}

44
tall/src/main/java/com/ccsens/tall/web/LogController.java

@ -0,0 +1,44 @@
package com.ccsens.tall.web;
import cn.hutool.core.lang.Snowflake;
import com.ccsens.cloudutil.bean.tall.dto.LogDto;
import com.ccsens.tall.bean.po.SysLog;
import com.ccsens.tall.persist.mapper.SysLogMapper;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.JsonResponse;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @description:
* @author: wuHuiJuan
* @create: 2019/12/09 18:04
*/
@Slf4j
@Api(tags = "接口调用日志" )
@RestController
public class LogController {
@Autowired
private SysLogMapper sysLogMapper;
@Autowired
private Snowflake snowflake;
@RequestMapping("/log/operation")
public JsonResponse log(@RequestBody LogDto logDto) {
SysLog log = new SysLog();
BeanUtils.copyProperties(logDto, log);
log.setId(snowflake.nextId());
sysLogMapper.insertSelective(log);
return JsonResponse.newInstance().ok();
}
}

2
tall/src/main/resources/logback-spring.xml

@ -9,7 +9,7 @@
<contextName>logback</contextName> <contextName>logback</contextName>
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 --> <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
<property name="log.path" value="/home/tall/log/" /> <property name="log.path" value="/home/cloud/tall/log/" />
<!-- 彩色日志 --> <!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 --> <!-- 彩色日志依赖的渲染类 -->

258
tall/src/main/resources/mapper_raw/SysLogMapper.xml

@ -0,0 +1,258 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.tall.persist.mapper.SysLogMapper">
<resultMap id="BaseResultMap" type="com.ccsens.tall.bean.po.SysLog">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="method_desc" jdbcType="VARCHAR" property="methodDesc" />
<result column="params" jdbcType="VARCHAR" property="params" />
<result column="result" jdbcType="VARCHAR" property="result" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, url, method_desc, params, result, created_at, updated_at, rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.tall.bean.po.SysLogExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_sys_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_sys_log
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_sys_log
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.ccsens.tall.bean.po.SysLogExample">
delete from t_sys_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.tall.bean.po.SysLog">
insert into t_sys_log (id, url, method_desc,
params, result, created_at,
updated_at, rec_status)
values (#{id,jdbcType=BIGINT}, #{url,jdbcType=VARCHAR}, #{methodDesc,jdbcType=VARCHAR},
#{params,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP},
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.tall.bean.po.SysLog">
insert into t_sys_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="url != null">
url,
</if>
<if test="methodDesc != null">
method_desc,
</if>
<if test="params != null">
params,
</if>
<if test="result != null">
result,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="url != null">
#{url,jdbcType=VARCHAR},
</if>
<if test="methodDesc != null">
#{methodDesc,jdbcType=VARCHAR},
</if>
<if test="params != null">
#{params,jdbcType=VARCHAR},
</if>
<if test="result != null">
#{result,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.tall.bean.po.SysLogExample" resultType="java.lang.Long">
select count(*) from t_sys_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_sys_log
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.url != null">
url = #{record.url,jdbcType=VARCHAR},
</if>
<if test="record.methodDesc != null">
method_desc = #{record.methodDesc,jdbcType=VARCHAR},
</if>
<if test="record.params != null">
params = #{record.params,jdbcType=VARCHAR},
</if>
<if test="record.result != null">
result = #{record.result,jdbcType=VARCHAR},
</if>
<if test="record.createdAt != null">
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
</if>
<if test="record.updatedAt != null">
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="record.recStatus != null">
rec_status = #{record.recStatus,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_sys_log
set id = #{record.id,jdbcType=BIGINT},
url = #{record.url,jdbcType=VARCHAR},
method_desc = #{record.methodDesc,jdbcType=VARCHAR},
params = #{record.params,jdbcType=VARCHAR},
result = #{record.result,jdbcType=VARCHAR},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.tall.bean.po.SysLog">
update t_sys_log
<set>
<if test="url != null">
url = #{url,jdbcType=VARCHAR},
</if>
<if test="methodDesc != null">
method_desc = #{methodDesc,jdbcType=VARCHAR},
</if>
<if test="params != null">
params = #{params,jdbcType=VARCHAR},
</if>
<if test="result != null">
result = #{result,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
rec_status = #{recStatus,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.tall.bean.po.SysLog">
update t_sys_log
set url = #{url,jdbcType=VARCHAR},
method_desc = #{methodDesc,jdbcType=VARCHAR},
params = #{params,jdbcType=VARCHAR},
result = #{result,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

28
util/src/test/java/com/ccsens/util/ZipTest.java

@ -0,0 +1,28 @@
package com.ccsens.util;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.ZipUtil;
import org.junit.Test;
import java.io.UnsupportedEncodingException;
/**
* @description:
* @author: wuHuiJuan
* @create: 2019/12/10 15:44
*/
public class ZipTest {
@Test
public void gzip() throws UnsupportedEncodingException {
String content = "QueryDto(param=DoctorDto.Submit(positionId=1204239831257976832, titleId=1204239838740615168, name=李院长, sex=0, age=38), userId=1202064120040525824, token=null)--";
System.out.println("content长度" + content.length());
byte[] gzip = ZipUtil.gzip(content, "UTF-8");
String encode = Base64.encode(gzip);
System.out.println("encode长度:" + encode.length());
String zipContent = new String(gzip);
System.out.println(zipContent);
byte[] bytes = ZipUtil.unGzip(Base64.decode(encode));
System.out.println("ungzip:" + new String(bytes, "UTF-8") );
System.out.println("length:" + new String(bytes, "UTF-8").length());
}
}
Loading…
Cancel
Save