1
This commit is contained in:
@ -0,0 +1,29 @@
|
||||
package com.mosty.spxl;
|
||||
|
||||
import com.mosty.common.base.timeconsume.EnableTimeConsume;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* 视频巡逻 微服务
|
||||
* @author zengbo
|
||||
* @date 2022/7/11 14:29 PM[
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@EnableTimeConsume
|
||||
//@ComponentScan("com.mosty")
|
||||
@EnableFeignClients(basePackages = "com.mosty.base.feign.service")
|
||||
@MapperScan("com.mosty.spxl.mapper")
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
public class MostySpxlApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
SpringApplication.run(MostySpxlApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.mosty.spxl.config;
|
||||
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Configuration
|
||||
public class FeignConfig implements RequestInterceptor {
|
||||
|
||||
@Override
|
||||
public void apply(RequestTemplate requestTemplate) {
|
||||
ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if (attr != null) {
|
||||
HttpServletRequest request = attr.getRequest();
|
||||
// 添加token
|
||||
requestTemplate.header("Authorization", request.getHeader("Authorization"));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.mosty.spxl.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 全局配置
|
||||
* @author kevin
|
||||
* @date 2022/5/25 1:56 上午
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties("exclude.path-patterns")
|
||||
public class GlobalYmlConfig {
|
||||
|
||||
/**
|
||||
* swagger 静态文件的放行列表
|
||||
*/
|
||||
private List<String> swagger;
|
||||
|
||||
}
|
120
mosty-spxl/src/main/java/com/mosty/spxl/config/WebMvcConfig.java
Normal file
120
mosty-spxl/src/main/java/com/mosty/spxl/config/WebMvcConfig.java
Normal file
@ -0,0 +1,120 @@
|
||||
package com.mosty.spxl.config;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||
import com.mosty.common.token.SysUserInterceptor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.servlet.config.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 单体服务拦截器
|
||||
* @author kevin
|
||||
* @date 2022/3/21 11:17 PM
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class WebMvcConfig implements WebMvcConfigurer, InitializingBean {
|
||||
|
||||
private static final String DEFAULT_TIME_FORMAT = "HH:mm:ss";
|
||||
private static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd";
|
||||
private static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
@Value("${server.servlet.context-path:/}")
|
||||
private String contextPath;
|
||||
|
||||
@Autowired
|
||||
private GlobalYmlConfig globalYmlConfig;
|
||||
|
||||
@Override
|
||||
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
|
||||
ObjectMapper objectMapper = converter.getObjectMapper();
|
||||
// 生成JSON时,将所有Long转换成String
|
||||
SimpleModule simpleModule = new SimpleModule();
|
||||
//日期格式化
|
||||
simpleModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT)));
|
||||
simpleModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)));
|
||||
simpleModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT)));
|
||||
simpleModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT)));
|
||||
simpleModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)));
|
||||
simpleModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT)));
|
||||
objectMapper.registerModule(simpleModule);
|
||||
// 时间格式化
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
objectMapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
|
||||
objectMapper.configure(JsonGenerator.Feature.IGNORE_UNKNOWN, true);
|
||||
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
||||
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||
// 设置格式化内容
|
||||
converter.setObjectMapper(objectMapper);
|
||||
converters.add(0, converter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
log.info("当前服务的 contextPath={}", contextPath);
|
||||
log.info("当前服务的 swaggerExcludePathPatterns={}", JSON.toJSONString(globalYmlConfig.getSwagger()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addViewControllers(ViewControllerRegistry registry) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
||||
configurer.defaultContentType(MediaType.APPLICATION_JSON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(userInfoInterceptor()).addPathPatterns("/**")
|
||||
.excludePathPatterns(globalYmlConfig.getSwagger());
|
||||
log.info("初始化WebMvcConfig 监控拦截器SysUserInterceptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
if (!registry.hasMappingForPattern("/template/**")) {
|
||||
registry.addResourceHandler("/template/**").addResourceLocations("classpath:/template/");
|
||||
}
|
||||
registry.addResourceHandler("swagger-ui.html")
|
||||
.addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("docs.html")
|
||||
.addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**")
|
||||
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
WebMvcConfigurer.super.addResourceHandlers(registry);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SysUserInterceptor userInfoInterceptor() {
|
||||
log.info("初始化WebMvcConfig 拦截器SysUserInterceptor");
|
||||
return new SysUserInterceptor();
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.mosty.spxl.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.mosty.common.base.domain.ResponseResult;
|
||||
import com.mosty.common.base.entity.log.BusinessType;
|
||||
import com.mosty.common.base.entity.log.Log;
|
||||
import com.mosty.common.token.JwtSysUser;
|
||||
import com.mosty.base.model.dto.spxl.TbSpxlSpxlfaUpdateDto;
|
||||
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfa;
|
||||
import com.mosty.base.model.query.spxl.TbSpxlSpxlfaQuery;
|
||||
import com.mosty.spxl.service.TbSpxlSpxlfaService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dw
|
||||
* @since 2022/7/11
|
||||
**/
|
||||
@Api(tags = "视频巡逻方案接口")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/tbSpxlSpxlfa")
|
||||
public class TbSpxlSpxlfaController {
|
||||
|
||||
private final TbSpxlSpxlfaService tbSpxlSpxlfaService;
|
||||
|
||||
@ApiOperation("新增视频巡逻方案")
|
||||
@JwtSysUser
|
||||
@PostMapping
|
||||
@Log(title = "新增视频巡逻方案", businessType = BusinessType.INSERT)
|
||||
public ResponseResult<Integer> addEntity(@RequestBody TbSpxlSpxlfa fa) {
|
||||
return ResponseResult.success(this.tbSpxlSpxlfaService.addEntity(fa));
|
||||
}
|
||||
|
||||
@ApiOperation("删除视频巡逻方案")
|
||||
@JwtSysUser
|
||||
@DeleteMapping
|
||||
@Log(title = "删除视频巡逻方案", businessType = BusinessType.UPDATE)
|
||||
public ResponseResult<Integer> delEntity(@RequestBody List<String> ids) {
|
||||
return ResponseResult.success(this.tbSpxlSpxlfaService.delEntity(ids));
|
||||
}
|
||||
|
||||
@ApiOperation("修改视频巡逻方案")
|
||||
@JwtSysUser
|
||||
@PutMapping
|
||||
@Log(title = "修改视频巡逻方案", businessType = BusinessType.UPDATE)
|
||||
public ResponseResult<Integer> updateEntity(@RequestBody TbSpxlSpxlfaUpdateDto dto) {
|
||||
return ResponseResult.success(this.tbSpxlSpxlfaService.updateEntity(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("查询视频方案分页列表")
|
||||
@JwtSysUser
|
||||
@GetMapping("queryPage")
|
||||
public ResponseResult<IPage<TbSpxlSpxlfa>> queryPage(TbSpxlSpxlfaQuery dto) {
|
||||
return ResponseResult.success(this.tbSpxlSpxlfaService.queryPage(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("查询视频方案详情")
|
||||
@JwtSysUser
|
||||
@GetMapping("{id}")
|
||||
public ResponseResult<TbSpxlSpxlfa> getInfo(@PathVariable("id") String id) {
|
||||
return ResponseResult.success(this.tbSpxlSpxlfaService.getInfo(id));
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.mosty.spxl.controller;
|
||||
|
||||
import com.mosty.common.base.domain.ResponseResult;
|
||||
import com.mosty.common.base.entity.log.BusinessType;
|
||||
import com.mosty.common.base.entity.log.Log;
|
||||
import com.mosty.common.token.JwtSysUser;
|
||||
import com.mosty.base.model.dto.spxl.TbSpxlSpxlfaInsertDto;
|
||||
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfa;
|
||||
import com.mosty.spxl.service.TbSpxlSpxlfaSxtService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author dw
|
||||
* @since 2022/7/11
|
||||
**/
|
||||
@Api(tags = "视频巡逻方案-摄像头接口")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/tbSpxlSpxlfaSxt")
|
||||
public class TbSpxlSpxlfaSxtController {
|
||||
|
||||
private final TbSpxlSpxlfaSxtService tbSpxlSpxlfaSxtService;
|
||||
|
||||
@ApiOperation("添加摄像头配置信息")
|
||||
@JwtSysUser
|
||||
@Log(title = "添加摄像头配置信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public ResponseResult<Integer> insertEntity(@RequestBody TbSpxlSpxlfaInsertDto dto) {
|
||||
return ResponseResult.success(this.tbSpxlSpxlfaSxtService.insertEntity(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("修改摄像头配置信息")
|
||||
@JwtSysUser
|
||||
@Log(title = "修改摄像头配置信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public ResponseResult<Integer> updateSxtPz(@RequestBody TbSpxlSpxlfaInsertDto dto) {
|
||||
return ResponseResult.success(this.tbSpxlSpxlfaSxtService.updateSxtPz(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("查询摄像头配置信息")
|
||||
@JwtSysUser
|
||||
@GetMapping
|
||||
public ResponseResult<TbSpxlSpxlfa> pzInfo(String faid) {
|
||||
return ResponseResult.success(this.tbSpxlSpxlfaSxtService.pzInfo(faid));
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.mosty.spxl.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfa;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author dw
|
||||
* @since 2022/7/11
|
||||
* 视频巡逻方案mapper
|
||||
**/
|
||||
@Mapper
|
||||
public interface TbSpxlSpxlfaMapper extends BaseMapper<TbSpxlSpxlfa> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.mosty.spxl.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfaSxt;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author dw
|
||||
* @since 2022/7/11
|
||||
**/
|
||||
@Mapper
|
||||
public interface TbSpxlSpxlfaSxtMapper extends BaseMapper<TbSpxlSpxlfaSxt> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.mosty.spxl.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfaSxtPz;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author dw
|
||||
* @since 2022/7/11
|
||||
**/
|
||||
@Mapper
|
||||
public interface TbSpxlSpxlfaSxtPzMapper extends BaseMapper<TbSpxlSpxlfaSxtPz> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.mosty.spxl.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfaSxtz;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author dw
|
||||
* @since 2022/7/11
|
||||
**/
|
||||
@Mapper
|
||||
public interface TbSpxlSpxlfaSxtzMapper extends BaseMapper<TbSpxlSpxlfaSxtz> {
|
||||
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
package com.mosty.spxl.mybatisplus;
|
||||
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import com.mosty.common.base.exception.BusinessException;
|
||||
import com.mosty.common.base.util.IpUtil;
|
||||
import com.mosty.common.token.UserInfo;
|
||||
import com.mosty.common.token.UserInfoManager;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* MybatisPlus注入处理器
|
||||
*
|
||||
* @author Lhh
|
||||
* @date 2021/4/25
|
||||
*/
|
||||
public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler {
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
try {
|
||||
UserInfo userInfo = UserInfoManager.getUser();
|
||||
//根据属性名字设置要填充的值
|
||||
if (metaObject.hasGetter("xtCjip")) {
|
||||
if (metaObject.getValue("xtCjip") == null) {
|
||||
this.strictInsertFill(metaObject, "xtCjip", String.class, IpUtil.getIpAddress());
|
||||
}
|
||||
}
|
||||
//根据属性名字设置要填充的值
|
||||
if (metaObject.hasGetter("xtSjzt")) {
|
||||
if (metaObject.getValue("xtSjzt") == null) {
|
||||
this.strictInsertFill(metaObject, "xtSjzt", String.class, "1");
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtScbz")) {
|
||||
if (metaObject.getValue("xtScbz") == null) {
|
||||
this.strictInsertFill(metaObject, "xtScbz", String.class, "0");
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtCjsj")) {
|
||||
if (metaObject.getValue("xtCjsj") == null) {
|
||||
this.strictInsertFill(metaObject, "xtCjsj", Timestamp.class, new Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
}
|
||||
if (Objects.nonNull(userInfo)) {
|
||||
if (metaObject.hasGetter("xtCjrId")) {
|
||||
if (metaObject.getValue("xtCjrId") == null) {
|
||||
this.strictInsertFill(metaObject, "xtCjrId", String.class, String.valueOf(userInfo.userId));
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtCjr")) {
|
||||
if (metaObject.getValue("xtCjr") == null) {
|
||||
this.strictInsertFill(metaObject, "xtCjr", String.class, String.valueOf(userInfo.userName));
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtCjbmdm")) {
|
||||
if (metaObject.getValue("xtCjbmdm") == null) {
|
||||
this.strictInsertFill(metaObject, "xtCjbmdm", String.class, String.valueOf(userInfo.getDeptId()));
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtCjbmmc")) {
|
||||
if (metaObject.getValue("xtCjbmmc") == null) {
|
||||
this.strictInsertFill(metaObject, "xtCjbmmc", String.class, userInfo.getDeptName());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
try {
|
||||
UserInfo userInfo = UserInfoManager.getUser();
|
||||
if (metaObject.hasGetter("xtZhgxip")) {
|
||||
if (metaObject.getValue("xtZhgxip") == null) {
|
||||
this.strictUpdateFill(metaObject, "xtZhgxip", String.class, IpUtil.getIpAddress());
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtZhgxsj")) {
|
||||
if (metaObject.getValue("xtZhgxsj") == null) {
|
||||
this.strictUpdateFill(metaObject, "xtZhgxsj", Timestamp.class, new Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
}
|
||||
if (Objects.nonNull(userInfo)) {
|
||||
if (metaObject.hasGetter("xtZhgxrid")) {
|
||||
if (metaObject.getValue("xtZhgxrid") == null) {
|
||||
this.strictUpdateFill(metaObject, "xtZhgxrid", String.class, String.valueOf(userInfo.userId));
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtZhgxr")) {
|
||||
if (metaObject.getValue("xtZhgxr") == null) {
|
||||
this.strictUpdateFill(metaObject, "xtZhgxr", String.class, userInfo.userName);
|
||||
}
|
||||
}
|
||||
|
||||
if (metaObject.hasGetter("xtZhgxbmdm")) {
|
||||
if (metaObject.getValue("xtZhgxbmdm") == null) {
|
||||
this.strictUpdateFill(metaObject, "xtZhgxbmdm", String.class, String.valueOf(userInfo.getDeptId()));
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtZhgxbm")) {
|
||||
if (metaObject.getValue("xtZhgxbm") == null) {
|
||||
this.strictUpdateFill(metaObject, "xtZhgxbm", String.class, userInfo.getDeptName());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.mosty.spxl.mybatisplus;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
* mybatis-plus配置类
|
||||
*
|
||||
* @author Lhh
|
||||
*/
|
||||
@EnableTransactionManagement(proxyTargetClass = true)
|
||||
@Configuration
|
||||
@MapperScan("com.mosty.wqzx.mapper")
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
/**
|
||||
* 元对象字段填充控制器
|
||||
* https://baomidou.com/guide/auto-fill-metainfo.html
|
||||
*/
|
||||
@Bean
|
||||
public MetaObjectHandler metaObjectHandler() {
|
||||
return new CreateAndUpdateMetaObjectHandler();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.mosty.spxl.remote;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.mosty.base.model.dto.base.GetSsbmDto;
|
||||
import com.mosty.base.model.dto.base.SysDeptDTO;
|
||||
import com.mosty.base.feign.service.MostyBaseFeignService;
|
||||
import com.mosty.common.base.domain.ResponseResult;
|
||||
import com.mosty.common.base.exception.BusinessException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 调用部门信息远程适配层
|
||||
* @author kevin
|
||||
* @date 2022/7/6 10:37 上午
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class TbBaseAdaptRemoteService {
|
||||
|
||||
|
||||
private final MostyBaseFeignService mostyBaseFeignService;
|
||||
|
||||
/**
|
||||
* 根据部门编码查询部门信息
|
||||
* @param orgCode 部门编码
|
||||
* @return 部门信息
|
||||
*/
|
||||
public SysDeptDTO getDeptByOrgCode(String orgCode) {
|
||||
if (StringUtils.isBlank(orgCode)) {
|
||||
return null;
|
||||
}
|
||||
ResponseResult<SysDeptDTO> responseResult = mostyBaseFeignService.getDeptByOrgCode(orgCode);
|
||||
if (responseResult == null || !responseResult.isSuccess()) {
|
||||
log.error("调用部门编码查询部门信息异常 responseResult = {}", JSON.toJSONString(responseResult));
|
||||
return null;
|
||||
}
|
||||
return responseResult.getData();
|
||||
}
|
||||
// 获取权限查询条件
|
||||
public String getSsbm(String ssbmdm, String isChild) {
|
||||
GetSsbmDto dto = new GetSsbmDto(ssbmdm, isChild);
|
||||
ResponseResult<String> responseResult = mostyBaseFeignService.getSsbm(dto);
|
||||
if (responseResult == null || !responseResult.isSuccess()) {
|
||||
log.error("获取权限查询条件异常 responseResult = {}", JSON.toJSONString(responseResult));
|
||||
throw new BusinessException("获取权限查询条件异常");
|
||||
}
|
||||
return responseResult.getData();
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.mosty.spxl.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.mosty.base.model.dto.spxl.TbSpxlSpxlfaUpdateDto;
|
||||
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfa;
|
||||
import com.mosty.base.model.query.spxl.TbSpxlSpxlfaQuery;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dw
|
||||
* @since 2022/7/11
|
||||
* 视频巡逻方案服务类
|
||||
**/
|
||||
public interface TbSpxlSpxlfaService {
|
||||
|
||||
@ApiOperation("添加视频巡逻方案")
|
||||
int addEntity(TbSpxlSpxlfa fa);
|
||||
|
||||
@ApiOperation("删除视频巡逻方案")
|
||||
int delEntity(List<String> ids);
|
||||
|
||||
@ApiOperation("修改视频巡逻方案")
|
||||
int updateEntity(TbSpxlSpxlfaUpdateDto dto);
|
||||
|
||||
@ApiOperation("分页查询视频巡逻方案")
|
||||
IPage<TbSpxlSpxlfa> queryPage(TbSpxlSpxlfaQuery dto);
|
||||
|
||||
@ApiOperation("获取方案详细信息")
|
||||
TbSpxlSpxlfa getInfo(String id);
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.mosty.spxl.service;
|
||||
|
||||
import com.mosty.base.model.dto.spxl.TbSpxlSpxlfaInsertDto;
|
||||
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfa;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* @author dw
|
||||
* @since 2022/7/11
|
||||
* 视频巡逻方案-摄像头服务
|
||||
**/
|
||||
public interface TbSpxlSpxlfaSxtService {
|
||||
|
||||
@ApiOperation("添加摄像头配置信息")
|
||||
int insertEntity(TbSpxlSpxlfaInsertDto dto);
|
||||
|
||||
@ApiOperation("修改摄像头配置信息")
|
||||
int updateSxtPz(TbSpxlSpxlfaInsertDto dto);
|
||||
|
||||
@ApiOperation("删除方案的所有的配置信息")
|
||||
void deleteFaPz(String faid);
|
||||
|
||||
@ApiOperation("查询摄像头配置信息")
|
||||
TbSpxlSpxlfa pzInfo(String faid);
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package com.mosty.spxl.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mosty.common.base.exception.BusinessException;
|
||||
import com.mosty.common.token.UserInfo;
|
||||
import com.mosty.common.token.UserInfoManager;
|
||||
import com.mosty.base.model.dto.spxl.TbSpxlSpxlfaUpdateDto;
|
||||
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfa;
|
||||
import com.mosty.base.model.query.spxl.TbSpxlSpxlfaQuery;
|
||||
import com.mosty.common.util.PermissionsUtil;
|
||||
import com.mosty.spxl.mapper.TbSpxlSpxlfaMapper;
|
||||
import com.mosty.spxl.remote.TbBaseAdaptRemoteService;
|
||||
import com.mosty.spxl.service.TbSpxlSpxlfaService;
|
||||
import com.mosty.spxl.service.TbSpxlSpxlfaSxtService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dw
|
||||
* @since 2022/7/11
|
||||
* 视频巡逻方案服务实现类
|
||||
**/
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class TbSpxlSpxlfaServiceImpl extends ServiceImpl<TbSpxlSpxlfaMapper, TbSpxlSpxlfa>
|
||||
implements TbSpxlSpxlfaService {
|
||||
|
||||
private final TbSpxlSpxlfaSxtService tbSpxlSpxlfaSxtService;
|
||||
private final TbBaseAdaptRemoteService tbBaseAdaptRemoteService;
|
||||
@Override
|
||||
public int addEntity(TbSpxlSpxlfa fa) {
|
||||
UserInfo user = UserInfoManager.get();
|
||||
if (user != null) {
|
||||
fa.setCjrid(String.valueOf(user.getUserId()));
|
||||
fa.setCjrsfzh(user.getIdEntityCard());
|
||||
fa.setCjrxm(user.getUserName());
|
||||
fa.setSsbm(user.getDeptName());
|
||||
fa.setSsbmid(String.valueOf(user.getDeptId()));
|
||||
fa.setSsbmdm(user.getDeptCode());
|
||||
fa.setSsxgaj(user.getFxjDeptName());
|
||||
fa.setSsxgajid(String.valueOf(user.getFxjDeptId()));
|
||||
fa.setSsxgajdm(user.getFxjDeptCode());
|
||||
fa.setSssgaj(user.getDszDeptName());
|
||||
fa.setSssgajid(String.valueOf(user.getDszDeptId()));
|
||||
fa.setSssgajdm(user.getDszDeptCode());
|
||||
}
|
||||
fa.setXtSjly("1");
|
||||
return this.baseMapper.insert(fa);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int delEntity(List<String> ids) {
|
||||
return this.baseMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateEntity(TbSpxlSpxlfaUpdateDto dto) {
|
||||
TbSpxlSpxlfa fa = this.baseMapper.selectOne(
|
||||
new LambdaQueryWrapper<TbSpxlSpxlfa>()
|
||||
.eq(TbSpxlSpxlfa::getXtSjzt, "1")
|
||||
.eq(TbSpxlSpxlfa::getXtScbz, "0")
|
||||
.eq(TbSpxlSpxlfa::getId, dto.getId())
|
||||
);
|
||||
if (fa == null) {
|
||||
throw new BusinessException("方案不存在或已被删除");
|
||||
}
|
||||
TbSpxlSpxlfa entity = new TbSpxlSpxlfa();
|
||||
BeanUtils.copyProperties(dto, entity);
|
||||
return this.baseMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<TbSpxlSpxlfa> queryPage(TbSpxlSpxlfaQuery dto) {
|
||||
QueryWrapper<TbSpxlSpxlfa> queryWrapper = new QueryWrapper<>();
|
||||
// UserInfo userInfo = UserInfoManager.get();
|
||||
// PermissionsUtil.queryWrapperUtil(queryWrapper, userInfo);
|
||||
dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
|
||||
return this.baseMapper.selectPage(
|
||||
new Page<>(dto.getPageNum(), dto.getPageSize()),
|
||||
queryWrapper.lambda()
|
||||
.likeRight(StringUtils.isNotBlank(dto.getSsbmdm()), TbSpxlSpxlfa::getSsbmdm, dto.getSsbmdm())
|
||||
.like(StringUtils.isNotBlank(dto.getFamc()), TbSpxlSpxlfa::getFamc, dto.getFamc())
|
||||
.eq(StringUtils.isNotBlank(dto.getFalx()), TbSpxlSpxlfa::getFalx, dto.getFalx())
|
||||
.eq(StringUtils.isNotBlank(dto.getFps()), TbSpxlSpxlfa::getFps, dto.getFps())
|
||||
.le(StringUtils.isNotBlank(dto.getJssj()), TbSpxlSpxlfa::getJssj, dto.getJssj())
|
||||
.le(StringUtils.isNotBlank(dto.getSsbmid()), TbSpxlSpxlfa::getSsbmid, dto.getSsbmid())
|
||||
.ge(StringUtils.isNotBlank(dto.getKssj()), TbSpxlSpxlfa::getKssj, dto.getKssj())
|
||||
.orderByDesc(TbSpxlSpxlfa::getXtCjsj)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbSpxlSpxlfa getInfo(String id) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,188 @@
|
||||
package com.mosty.spxl.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mosty.base.utils.DateUtils;
|
||||
import com.mosty.common.base.exception.BusinessException;
|
||||
import com.mosty.base.model.dto.spxl.TbSpxlSpxlfaInsertDto;
|
||||
import com.mosty.base.model.dto.spxl.TbSpxlSpxlfaSxtDto;
|
||||
import com.mosty.base.model.dto.spxl.TbSpxlSpxlfaSxtzDto;
|
||||
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfa;
|
||||
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfaSxt;
|
||||
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfaSxtPz;
|
||||
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfaSxtz;
|
||||
import com.mosty.spxl.mapper.TbSpxlSpxlfaMapper;
|
||||
import com.mosty.spxl.mapper.TbSpxlSpxlfaSxtMapper;
|
||||
import com.mosty.spxl.mapper.TbSpxlSpxlfaSxtPzMapper;
|
||||
import com.mosty.spxl.mapper.TbSpxlSpxlfaSxtzMapper;
|
||||
import com.mosty.spxl.service.TbSpxlSpxlfaSxtService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @author dw
|
||||
* @since 2022/7/11
|
||||
* 视频巡逻方案-摄像头-服务-实现
|
||||
**/
|
||||
@Service
|
||||
public class TbSpxlSpxlfaSxtServiceImpl extends ServiceImpl<TbSpxlSpxlfaSxtMapper, TbSpxlSpxlfaSxt>
|
||||
implements TbSpxlSpxlfaSxtService {
|
||||
|
||||
@Resource
|
||||
private TbSpxlSpxlfaMapper tbSpxlSpxlfaMapper;
|
||||
|
||||
@Resource
|
||||
private TbSpxlSpxlfaSxtzMapper tbSpxlSpxlfaSxtzMapper;
|
||||
|
||||
@Resource
|
||||
private TbSpxlSpxlfaSxtPzMapper tbSpxlSpxlfaSxtPzMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertEntity(TbSpxlSpxlfaInsertDto dto) {
|
||||
TbSpxlSpxlfa fa = this.tbSpxlSpxlfaMapper.selectById(dto.getFaid());
|
||||
if (fa == null) {
|
||||
throw new BusinessException("方案不存在,或已经删除");
|
||||
}
|
||||
List<TbSpxlSpxlfaSxtzDto> sxtzList = dto.getSxtzList();
|
||||
if (CollectionUtils.isEmpty(sxtzList)) {
|
||||
throw new BusinessException("请至少添加一个摄像头组");
|
||||
}
|
||||
AtomicInteger a = new AtomicInteger(1);
|
||||
sxtzList.forEach(newSxtz -> {
|
||||
// 添加摄像头组
|
||||
TbSpxlSpxlfaSxtz sxtz = new TbSpxlSpxlfaSxtz();
|
||||
BeanUtils.copyProperties(newSxtz, sxtz);
|
||||
if (StringUtils.isBlank(sxtz.getSxtzmc())) {
|
||||
sxtz.setSxtzmc("摄像头组" + a.getAndIncrement());
|
||||
}
|
||||
sxtz.setFaid(fa.getId());
|
||||
sxtz.setFamc(fa.getFamc());
|
||||
sxtz.setXtSjly("1");
|
||||
this.tbSpxlSpxlfaSxtzMapper.insert(sxtz);
|
||||
// 添加摄像头
|
||||
List<TbSpxlSpxlfaSxtDto> sxtList = newSxtz.getSxtList();
|
||||
if (CollectionUtils.isEmpty(sxtList)) {
|
||||
throw new BusinessException("每个组至少添加一个摄像头");
|
||||
}
|
||||
sxtList.forEach(newSxt -> {
|
||||
// 查询是否存在该摄像头已经被其他单位配置,并且在同一时段内
|
||||
TbSpxlSpxlfaSxt temp = this.baseMapper.selectOne(
|
||||
new LambdaQueryWrapper<TbSpxlSpxlfaSxt>()
|
||||
.eq(TbSpxlSpxlfaSxt::getSxtid, newSxt.getSxtid())
|
||||
.eq(TbSpxlSpxlfaSxt::getXtScbz, "0")
|
||||
.eq(TbSpxlSpxlfaSxt::getXtSjzt, "1")
|
||||
.last(" limit 1")
|
||||
);
|
||||
if (temp != null) {
|
||||
TbSpxlSpxlfa faTemp = this.tbSpxlSpxlfaMapper.selectOne(
|
||||
new LambdaQueryWrapper<TbSpxlSpxlfa>()
|
||||
.eq(TbSpxlSpxlfa::getId, temp.getFaid())
|
||||
.eq(TbSpxlSpxlfa::getXtScbz, "0")
|
||||
.eq(TbSpxlSpxlfa::getXtSjzt, "1")
|
||||
);
|
||||
if (faTemp != null) {
|
||||
Date faStartTime = DateUtils.strToDate(fa.getKssj(), "09");
|
||||
Date faEndTime = DateUtils.strToDate(fa.getJssj(), "09");
|
||||
Date faTempStartTime = DateUtils.strToDate(faTemp.getJssj(), "09");
|
||||
Date faTempEndTime = DateUtils.strToDate(faTemp.getJssj(), "09");
|
||||
if (faTempStartTime.getTime() > faStartTime.getTime() || faTempEndTime.getTime() < faEndTime.getTime()) {
|
||||
throw new BusinessException("该摄像头在该时段有其他方案正在运行中,请选择其他摄像头,或修改之前配置。");
|
||||
}
|
||||
}
|
||||
}
|
||||
TbSpxlSpxlfaSxt sxt = new TbSpxlSpxlfaSxt();
|
||||
BeanUtils.copyProperties(newSxt, sxt);
|
||||
sxt.setFaid(fa.getId());
|
||||
sxt.setFamc(fa.getFamc());
|
||||
sxt.setSxtzid(sxtz.getId());
|
||||
sxt.setXtSjly("1");
|
||||
this.baseMapper.insert(sxt);
|
||||
// 获取摄像头配置信息
|
||||
TbSpxlSpxlfaSxtPz pz = newSxt.getSxtPz();
|
||||
if (pz == null && "2".equals(fa.getFalx())) {
|
||||
throw new BusinessException("请配置每一个摄像头");
|
||||
}
|
||||
if (pz != null) {
|
||||
pz.setFaid(fa.getId());
|
||||
pz.setFamc(fa.getFamc());
|
||||
pz.setSxtzid(sxtz.getId());
|
||||
pz.setSxtid(sxt.getId());
|
||||
pz.setXtSjly("1");
|
||||
this.tbSpxlSpxlfaSxtPzMapper.insert(pz);
|
||||
}
|
||||
});
|
||||
});
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateSxtPz(TbSpxlSpxlfaInsertDto dto) {
|
||||
// 删除该方案配置的所有的信息
|
||||
this.deleteFaPz(dto.getFaid());
|
||||
// 重新添加方案配置信息
|
||||
return this.insertEntity(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteFaPz(String faid) {
|
||||
// 删除摄像头组
|
||||
this.tbSpxlSpxlfaSxtzMapper.delete(
|
||||
new LambdaQueryWrapper<TbSpxlSpxlfaSxtz>()
|
||||
.eq(TbSpxlSpxlfaSxtz::getFaid, faid)
|
||||
);
|
||||
// 删除摄像头
|
||||
this.baseMapper.delete(
|
||||
new LambdaQueryWrapper<TbSpxlSpxlfaSxt>()
|
||||
.eq(TbSpxlSpxlfaSxt::getFaid, faid)
|
||||
);
|
||||
// 删除摄像头配置
|
||||
this.tbSpxlSpxlfaSxtPzMapper.delete(
|
||||
new LambdaQueryWrapper<TbSpxlSpxlfaSxtPz>()
|
||||
.eq(TbSpxlSpxlfaSxtPz::getFaid, faid)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbSpxlSpxlfa pzInfo(String faid) {
|
||||
TbSpxlSpxlfa fa = this.tbSpxlSpxlfaMapper.selectById(faid);
|
||||
if (fa == null) {
|
||||
throw new BusinessException("方案不存在,或已经被删除");
|
||||
}
|
||||
// 查询摄像头组
|
||||
List<TbSpxlSpxlfaSxtz> sxtzList = this.tbSpxlSpxlfaSxtzMapper.selectList(
|
||||
new LambdaQueryWrapper<TbSpxlSpxlfaSxtz>()
|
||||
.eq(TbSpxlSpxlfaSxtz::getFaid, faid)
|
||||
);
|
||||
sxtzList.forEach(sxtz -> {
|
||||
// 查询摄像头
|
||||
List<TbSpxlSpxlfaSxt> sxtList = this.baseMapper.selectList(
|
||||
new LambdaQueryWrapper<TbSpxlSpxlfaSxt>()
|
||||
.eq(TbSpxlSpxlfaSxt::getFaid, faid)
|
||||
.eq(TbSpxlSpxlfaSxt::getSxtzid, sxtz.getId())
|
||||
);
|
||||
sxtList.forEach(sxt -> {
|
||||
// 查询摄像头配置
|
||||
TbSpxlSpxlfaSxtPz pz = this.tbSpxlSpxlfaSxtPzMapper.selectOne(
|
||||
new LambdaQueryWrapper<TbSpxlSpxlfaSxtPz>()
|
||||
.eq(TbSpxlSpxlfaSxtPz::getFaid, faid)
|
||||
.eq(TbSpxlSpxlfaSxtPz::getSxtid, sxt.getId())
|
||||
);
|
||||
sxt.setPz(pz);
|
||||
});
|
||||
sxtz.setSxtList(sxtList);
|
||||
});
|
||||
fa.setSxtzList(sxtzList);
|
||||
return fa;
|
||||
}
|
||||
}
|
74
mosty-spxl/src/main/resources/application.yml
Normal file
74
mosty-spxl/src/main/resources/application.yml
Normal file
@ -0,0 +1,74 @@
|
||||
ribbon:
|
||||
ReadTimeout: 600000
|
||||
ConnectTimeout: 600000
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
jackson:
|
||||
serialization:
|
||||
write-dates-as-timestamps: false
|
||||
# # 格式化返回时间 yyyy-MM-dd HH:mm:ss
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.200.131:3306/mosty_spxl?autoReconnect=true&failOverReadOnly=false&useUnicode=tr&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: mosty888
|
||||
hikari:
|
||||
minimum-idle: 10 # ??????????10???0???maximum-pool-size??????maximum-pool-size
|
||||
maximum-pool-size: 20 # ??????????0????????10??????1?????minimum-idle??
|
||||
idle-timeout: 500000 # ????????????600000?10????????max-lifetime?max-lifetime>0??????0????0???10???????10??
|
||||
max-lifetime: 540000 # ????????????0???30??????????30??.?????mysql????????
|
||||
connection-timeout: 60000 # ????????????250????????????30?
|
||||
connection-test-query: SELECT 1 # ???????????????
|
||||
# Redis数据库索引(默认为0)
|
||||
redis:
|
||||
database: 8
|
||||
# Redis服务器地址
|
||||
host: 192.168.200.131
|
||||
# Redis服务器连接端口
|
||||
port: 6379
|
||||
# Redis服务器连接密码(默认为空)
|
||||
password: mosty888
|
||||
# 连接超时时间(毫秒)
|
||||
timeout: 2000
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 50
|
||||
swagger:
|
||||
host: 80.155.0.84
|
||||
port: 8010
|
||||
|
||||
mybatis-plus:
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
magic-api:
|
||||
web: /magic/web
|
||||
#配置文件存储位置。当以classpath开头时,为只读模式
|
||||
resource:
|
||||
# location: /data/magic-api
|
||||
type: database
|
||||
table-name: magic_api # 数据库中的表名
|
||||
prefix: /magic-api # 前缀
|
||||
datasource:
|
||||
response-code:
|
||||
success: 10000
|
||||
exclude:
|
||||
pathPatterns:
|
||||
swagger:
|
||||
- /swagger-resources/**
|
||||
- /webjars/**
|
||||
- /v2/**
|
||||
- /swagger-ui.html/**
|
||||
- /docs.html/**
|
||||
|
||||
config:
|
||||
orgCode: 510600000000
|
39
mosty-spxl/src/main/resources/bootstrap.yml
Normal file
39
mosty-spxl/src/main/resources/bootstrap.yml
Normal file
@ -0,0 +1,39 @@
|
||||
server:
|
||||
port: 8012
|
||||
servlet:
|
||||
context-path: /mosty-spxl/
|
||||
spring:
|
||||
application:
|
||||
name: mosty-spxl
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
namespace: 657d1843-b590-41ac-b5e7-5d261bf00de9
|
||||
server-addr: 192.168.200.131:8848
|
||||
register-enabled: true # 是否将自己注册到配置中心,让其他服务发现调用(本地调试使用)
|
||||
|
||||
|
||||
# 开启健康监控
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
auditevents:
|
||||
enabled: true
|
||||
|
||||
#swagger:
|
||||
# enable: true
|
||||
# title: 基础微服务
|
||||
# version: 1.0.0
|
||||
# name: 基础微服务
|
||||
# url: ''
|
||||
# email: ''
|
||||
|
||||
# 日志
|
||||
#logging:
|
||||
# file: /application/applogs/admin.log
|
||||
|
114
mosty-spxl/src/main/resources/logback-spring.xml
Normal file
114
mosty-spxl/src/main/resources/logback-spring.xml
Normal file
@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<jmxConfigurator/>
|
||||
<property name="PROJECT_NAME" value="msxf-retail-sort" />
|
||||
<property name="LOG_FILE_INFO" value="${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/msxf-retail-sort-info.log" />
|
||||
<property name="LOG_FILE_WARN" value="${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/msxf-retail-sort-warn.log" />
|
||||
<property name="LOG_FILE_ERR" value="${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/msxf-retail-sort-error.log" />
|
||||
<property name="LOG_BUSINESS" value="${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/business/business-2de.log"/>
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
|
||||
<contextName>${PROJECT_NAME}</contextName>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<appender name="LOG_FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
|
||||
</encoder>
|
||||
<file>${LOG_FILE_INFO}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_FILE_INFO}-7de.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy
|
||||
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>1024MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<appender name="LOG_FILE_WARN"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>WARN</level>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
|
||||
</encoder>
|
||||
<file>${LOG_FILE_WARN}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_FILE_WARN}-30de.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy
|
||||
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>1024MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<appender name="LOG_FILE_ERROR"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
|
||||
</encoder>
|
||||
<file>${LOG_FILE_ERR}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_FILE_ERR}.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy
|
||||
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>512MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<!--添加监控日志 -->
|
||||
<appender name="business-log-appender"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>info</level>
|
||||
</filter>
|
||||
<file>${LOG_BUSINESS}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_BUSINESS}.%d{yyyy-MM-dd}.%i
|
||||
</fileNamePattern>
|
||||
<maxFileSize>1024MB</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="business-log" additivity="false" level="info">
|
||||
<appender-ref ref="business-log-appender"/>
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</logger>
|
||||
<!-- show parameters for hibernate sql 专为 Hibernate 定制 -->
|
||||
<logger name="logging.level.jdbc" level="INFO" />
|
||||
<logger name="logging.level.jdbc.sqlonly" level="INFO" />
|
||||
<logger name="org.springframework" level="INFO" additivity="true" />
|
||||
<Logger name="jdbc.sqlonly" level="info" />
|
||||
<Logger name="jdbc.sqltiming" level="warn" />
|
||||
<Logger name="jdbc.audit" level="warn" />
|
||||
<Logger name="jdbc.resultset" level="warn" />
|
||||
<Logger name="jdbc.resultsettable" level="warn" />
|
||||
<logger name="jdbc.connection" level="warn" />
|
||||
<Logger name="log4jdbc.debug" level="warn" />
|
||||
<Logger name="org.apache.kafka.clients.NetworkClient" level="ERROR" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
<appender-ref ref="LOG_FILE_INFO" />
|
||||
<appender-ref ref="LOG_FILE_WARN" />
|
||||
<appender-ref ref="LOG_FILE_ERROR" />
|
||||
</root>
|
||||
</configuration>
|
16
mosty-spxl/src/main/resources/rebel.xml
Normal file
16
mosty-spxl/src/main/resources/rebel.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
|
||||
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
|
||||
-->
|
||||
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
|
||||
|
||||
<id>mosty-spxl</id>
|
||||
|
||||
<classpath>
|
||||
<dir name="E:/project/rs/mosty-dyga-cloud/mosty-spxl/target/classes">
|
||||
</dir>
|
||||
</classpath>
|
||||
|
||||
</application>
|
Reference in New Issue
Block a user