This commit is contained in:
esacpe
2024-07-17 21:00:42 +08:00
commit b80c560e87
1931 changed files with 163526 additions and 0 deletions

View File

@ -0,0 +1,31 @@
package com.mosty.wzzx;
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.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* 位置中心 微服务
* @author zengbo
* @date 2022/7/11 14:29 PM[
* @since 1.0.0
*/
@EnableTimeConsume
@EnableFeignClients(basePackages = "com.mosty.base.feign.service")
@MapperScan("com.mosty.wzzx.mapper")
@EnableDiscoveryClient
@EnableScheduling
@SpringBootApplication(exclude = MongoAutoConfiguration.class)
public class MostyWzzxApplication {
public static void main(String[] args) {
SpringApplication.run(MostyWzzxApplication.class, args);
}
}

View File

@ -0,0 +1,24 @@
package com.mosty.wzzx.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"));
}
}
}

View File

@ -0,0 +1,25 @@
package com.mosty.wzzx.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;
}

View File

@ -0,0 +1,60 @@
package com.mosty.wzzx.config.Listener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.index.IndexOperations;
import org.springframework.data.mongodb.core.index.IndexResolver;
import org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Slf4j
@Component
public class ApplicationEventListener implements ApplicationListener {
@Resource(name = "mostyMongoTemplate")
protected MongoTemplate adminMongoTemplate;
@Override
public void onApplicationEvent(ApplicationEvent event) {
if(event instanceof ContextClosedEvent) {
//监听应用关闭
}
}
@EventListener(ContextRefreshedEvent.class)
public void initIndicesAfterStartup() {
createIndex(adminMongoTemplate);
}
private void createIndex(MongoTemplate template) {
MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext = template
.getConverter().getMappingContext();
IndexResolver resolver = new MongoPersistentEntityIndexResolver(mappingContext);
// consider only entities that are annotated with @Document
mappingContext.getPersistentEntities()
.stream()
.filter(it -> it.isAnnotationPresent(Document.class))
.forEach(it -> {
try {
IndexOperations indexOps = template.indexOps(it.getType());
resolver.resolveIndexFor(it.getType()).forEach(indexOps::ensureIndex);
}catch (Exception e){
log.error("创建索引Ex:{}", e.getMessage());
}
});
}
}

View File

@ -0,0 +1,120 @@
package com.mosty.wzzx.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();
}
}

View File

@ -0,0 +1,17 @@
package com.mosty.wzzx.config.mongo;
import lombok.Data;
import org.springframework.data.mongodb.MongoDatabaseFactory;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoClientDatabaseFactory;
@Data
public abstract class AbstractMongoConfigure {
private String uri;
public MongoDatabaseFactory mongoDbFactory() {
return new SimpleMongoClientDatabaseFactory(uri);
}
abstract public MongoTemplate getMongoTemplate() throws Exception;
}

View File

@ -0,0 +1,19 @@
package com.mosty.wzzx.config.mongo;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
@Configuration
@EnableMongoRepositories(basePackages = {"com.mosty.wzzx.mongodb"}, mongoTemplateRef = "mostyMongoTemplate")
@ConfigurationProperties(prefix = "spring.data.mongodb")
public class AdminMongoConfigure extends AbstractMongoConfigure {
@Bean(name = "mostyMongoTemplate")
@Override
public MongoTemplate getMongoTemplate() throws Exception {
return new MongoTemplate(mongoDbFactory());
}
}

View File

@ -0,0 +1,133 @@
package com.mosty.wzzx.controller;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.entity.wzzx.TbWzSswz;
import com.mosty.base.utils.CoordinateTransform;
import com.mosty.base.utils.DateUtils;
import com.mosty.common.base.domain.BaseController;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.wzzx.service.LocationInfoService;
import com.mosty.wzzx.service.impl.TbWzSswzServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;
/**
* @author ydb
* 位置信息实体Controller
* @since 2022年4月21日
*/
@RestController
@AllArgsConstructor
@RequestMapping("/gxga/locationInfo")
@Api(tags = "位置信息实体", value = "位置信息实体")
public class LocationInfoController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(LocationInfoController.class);
private final TbWzSswzServiceImpl tbWzSswzService;
private final LocationInfoService locationInfoService;
@PostMapping("/now")
@ApiOperation(value = "根据条件获取当前最新一条位置信息", notes = "位置信息实体")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户ID", dataType = "String"),
@ApiImplicitParam(name = "accessNumber", value = "接入编号", dataType = "String")
})
public ResponseResult<TbWzSswz> getNowLoaction(String userId, String accessNumber) {
Map<String, Object> requestMap = Maps.newHashMap();
if (!StrUtil.isBlank(userId)) {
requestMap.put("USER_ID", userId);
}
if (!StrUtil.isBlank(accessNumber)) {
requestMap.put("ACCESS_NUMBER", accessNumber);
}
if (requestMap.isEmpty()) {
return ResponseResult.fail("请确保至少传入一个查询参数");
}
return ResponseResult.success(tbWzSswzService.querySswzNow(userId, accessNumber));
}
/**
* 获取位置信息实体详细信息
*/
@GetMapping(value = "/{id}")
@ApiImplicitParam(name = "id", value = "参数键名", dataTypeClass = String.class, required = true, paramType = "path")
@ApiOperation(value = "位置信息实体-详细信息", notes = "位置信息实体")
public ResponseResult<TbWzSswz> queryById(@PathVariable("id") String id) {
TbWzSswz sswz = this.tbWzSswzService.queryById(id);
return ResponseResult.success(sswz);
}
/**
* 新增位置信息实体
*/
@PostMapping(value = "add")
@ApiOperation(value = "新增位置信息实体", notes = "位置信息实体")
public ResponseResult<LocationInfo> add(@Validated @RequestBody LocationInfo locationInfo, BindingResult result) {
System.out.println(DateUtils.getQueryDateString(new Date(), "02") + "收到位置服务上报 {" + JSONObject.toJSONString(locationInfo) + "}");
if (result.hasErrors() && result.getFieldError() != null) {
return ResponseResult.fail(result.getFieldError().getDefaultMessage());
}
if (locationInfo.getLat() == 0 || locationInfo.getLng() == 0) {// 后台验证
return ResponseResult.fail("报送错误! 定位坐标信息不能为空!");
}
if (StringUtils.isBlank(locationInfo.getUserId())) {
return ResponseResult.fail("用户ID不存在该位置不上报");
}
locationInfo.setSourceName("移动设备");
locationInfo.setSourceCode("02");
// Long startTime = System.currentTimeMillis();
// 入库之前将坐标进行转换
locationInfo.setSourceLat(locationInfo.getLat());
locationInfo.setSourceLng(locationInfo.getLng());
double[] transfromPonint = CoordinateTransform.transformGCJ02ToWGS84(locationInfo.getLng(),
locationInfo.getLat());
// 只保留8位小数
BigDecimal reLngBd = BigDecimal.valueOf(transfromPonint[0]);
double reLngDouble = reLngBd.setScale(8, BigDecimal.ROUND_HALF_UP).doubleValue();
locationInfo.setLng(reLngDouble);
// 只保留8位小数
BigDecimal reLatBd = BigDecimal.valueOf(transfromPonint[1]);
double reLatDouble = reLatBd.setScale(8, BigDecimal.ROUND_HALF_UP).doubleValue();
locationInfo.setLat(reLatDouble);
//上传坐标转行
if (locationInfo.getLastLng() != null && locationInfo.getLastLat() != null) {
double[] lastTransfromPonint = CoordinateTransform.transformGCJ02ToWGS84(locationInfo.getLastLng(),
locationInfo.getLastLat());
// 只保留8位小数
BigDecimal lastReLngBd = BigDecimal.valueOf(lastTransfromPonint[0]);
double lastReLngDouble = lastReLngBd.setScale(8, BigDecimal.ROUND_HALF_UP).doubleValue();
locationInfo.setLastLng(lastReLngDouble);
// 只保留8位小数
BigDecimal lastReLatBd = BigDecimal.valueOf(lastTransfromPonint[1]);
double lastReLatDouble = lastReLatBd.setScale(8, BigDecimal.ROUND_HALF_UP).doubleValue();
locationInfo.setLastLat(lastReLatDouble);
}
if (locationInfo.getTime() == null) {
locationInfo.setTime(new Date());
}
//实时存储位置
locationInfoService.locationReceive(locationInfo);
Long endTime = System.currentTimeMillis();
// System.out.println("位置服务上报保存时长 {" + (endTime - startTime) + "}---用户{"+locationInfo.getUserId()+"}");
locationInfo.setLastLat(locationInfo.getLat());
locationInfo.setLastLng(locationInfo.getLng());
return ResponseResult.success("添加成功", locationInfo);
}
}

View File

@ -0,0 +1,120 @@
package com.mosty.wzzx.controller;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mosty.base.model.dto.wzzx.SswzQuery;
import com.mosty.base.model.entity.wzzx.TbWzRywz;
import com.mosty.base.model.entity.wzzx.TbWzSswz;
import com.mosty.base.model.entity.wzzx.TbWzXfwz;
import com.mosty.base.model.query.wzzx.TbWzRywzSearchDto;
import com.mosty.base.model.query.wzzx.TbWzSswzSearchDto;
import com.mosty.base.model.vo.base.DeptInfoVo;
import com.mosty.base.utils.Constant;
import com.mosty.base.utils.DateUtils;
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.core.business.entity.SysDept;
import com.mosty.common.redis.service.RedisService;
import com.mosty.common.token.JwtSysUser;
import com.mosty.common.token.UserInfo;
import com.mosty.common.token.UserInfoManager;
import com.mosty.wzzx.remote.TbBaseAdaptRemoteService;
import com.mosty.wzzx.service.TbWzSswzService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 位置-人员位置
*
* @author
* @since 2022-07-14 15:37:38
*/
@AllArgsConstructor
@RestController
@Api(tags = "人员位置相关接口")
@RequestMapping("/gxga/rywz")
public class TbWzRywzController {
private final RedisTemplate redisTemplate;
private final RedisService redisService;
private final TbWzSswzService tbWzSswzService;
@GetMapping("/list")
@ApiOperation(value = "人员位置redis数据列表")
@Log(title = "人员位置redis数据列表", businessType = BusinessType.OTHER)
@JwtSysUser
public ResponseResult<List<TbWzRywz>> getList(SswzQuery dto) {
List<TbWzRywz> list = new ArrayList<>();
String key = Constant.WZ_RYWZ + "*";
Set<String> sets = redisTemplate.keys(key);
if (!CollectionUtils.isEmpty(sets)) {
list = redisTemplate.opsForValue().multiGet(sets);
// 权限
UserInfo user = UserInfoManager.get();
String ids = "";
if (user != null && user.getUserPermissionsInfo() != null) {
ids = user.getUserPermissionsInfo().getIds();
}
if (!CollectionUtils.isEmpty(list)) {
if (!StringUtils.isEmpty(ids)) {
String finalIds = ids;
list = list.stream().filter(item -> finalIds.contains(item.getSsbmid())).collect(Collectors.toList());
}
// 关键字筛选
if (!StringUtils.isEmpty(dto.getKeyword())) {
list = list.stream().filter(item ->
(!StringUtils.isEmpty(item.getYhXm()) && item.getYhXm().contains(dto.getKeyword())) ||
(!StringUtils.isEmpty(item.getYhSfzh()) && item.getYhSfzh().contains(dto.getKeyword())) ||
(!StringUtils.isEmpty(item.getSsbm()) && item.getSsbm().contains(dto.getKeyword())) ||
(!StringUtils.isEmpty(item.getYhId()) && item.getYhId().contains(dto.getKeyword()))
).collect(Collectors.toList());
}
// 排序
list.sort((a, a1) -> (int) (a1.getXtCjsj().getTime() - a.getXtCjsj().getTime()));
list.forEach(item -> item.setZb(null));
}
}
return ResponseResult.success(list);
}
@GetMapping("/getRygj")
@ApiOperation(value = "获取redis中的人员的轨迹信息")
public ResponseResult<TbWzRywz> getXfgj(String sfzh) {
if (StringUtils.isEmpty(sfzh)) return null;
String redisKey = Constant.WZ_RYWZ + sfzh + "-"
+ DateUtils.getQueryDateString(new Date(), "01");
TbWzRywz rywz = redisService.getCacheObject(redisKey);
return ResponseResult.success(rywz);
}
@GetMapping("/getRygjList")
@ApiOperation(value = "获取时间段类的人员轨迹信息俩表")
public ResponseResult<IPage<TbWzSswz>> getRygjList(TbWzSswzSearchDto dto) {
return ResponseResult.success(this.tbWzSswzService.getRygjList(dto));
}
@GetMapping("/getRywz")
@ApiOperation(value = "查询某一天的人员位置信息")
public ResponseResult<TbWzRywz> getRywz(TbWzRywzSearchDto dto) {
return ResponseResult.success(this.tbWzSswzService.getRywz(dto));
}
}

View File

@ -0,0 +1,92 @@
package com.mosty.wzzx.controller;
import com.mosty.base.model.dto.wzzx.SswzQuery;
import com.mosty.base.model.entity.wzzx.TbWzRywz;
import com.mosty.base.model.entity.wzzx.TbWzSbsswz;
import com.mosty.base.utils.Constant;
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.redis.service.RedisService;
import com.mosty.common.token.JwtSysUser;
import com.mosty.common.token.UserInfo;
import com.mosty.common.token.UserInfoManager;
import com.mosty.wzzx.service.TbWzSblswzService;
import com.mosty.wzzx.service.TbWzSbsswzService;
import com.mosty.wzzx.udp.UdpLzEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 位置-巡防报备控制层
*
* @author
* @since 2022-07-14 15:37:38
*/
@RestController
@Api(tags = "设备实时位置相关接口")
@RequestMapping("/gxga/sbsswz")
public class TbWzSbsswzController {
@Resource
private RedisTemplate redisTemplate;
@Resource
private TbWzSbsswzService tbWzSbsswzService;
@Resource
private TbWzSblswzService tbWzSblswzService;
@PostMapping("/locationHandleLz")
@ApiOperation(value = "测试udp数据")
@JwtSysUser
public ResponseResult<Void> locationHandleLz(@RequestBody UdpLzEntity dto) {
TbWzSbsswz sswz = this.tbWzSbsswzService.saveSbsswz(dto);
this.tbWzSblswzService.saveSblswz(sswz);
return ResponseResult.success();
}
@GetMapping("/list")
@ApiOperation(value = "获取设备实时redis数据列表")
@Log(title = "获取设备实时redis数据列表", businessType = BusinessType.OTHER)
@JwtSysUser
public ResponseResult<List<TbWzSbsswz>> getList(SswzQuery dto) {
List<TbWzSbsswz> list = new ArrayList<>();
String key = Constant.WZ_SBWZ + "*";
Set<String> sets = redisTemplate.keys(key);
if (!CollectionUtils.isEmpty(sets)) {
list = redisTemplate.opsForValue().multiGet(sets);
if (!CollectionUtils.isEmpty(list)) {
// 关键字筛选
if (!StringUtils.isEmpty(dto.getKeyword())) {
list = list.stream().filter(item ->
(!StringUtils.isEmpty(item.getYhXm()) && item.getYhXm().contains(dto.getKeyword())) ||
(!StringUtils.isEmpty(item.getYhSfzh()) && item.getYhSfzh().contains(dto.getKeyword())) ||
(!StringUtils.isEmpty(item.getSsbm()) && item.getSsbm().contains(dto.getKeyword())) ||
(!StringUtils.isEmpty(item.getSbmc()) && item.getSbmc().contains(dto.getKeyword())) ||
(!StringUtils.isEmpty(item.getSbid()) && item.getSbid().contains(dto.getKeyword())) ||
(!StringUtils.isEmpty(item.getYhId()) && item.getYhId().contains(dto.getKeyword()))
).collect(Collectors.toList());
}
// 排序
list.sort((a, a1) -> (int) (a1.getXtCjsj().getTime() - a.getXtCjsj().getTime()));
list.forEach(item -> item.setZb(null));
}
}
return ResponseResult.success(list);
}
}

View File

@ -0,0 +1,76 @@
package com.mosty.wzzx.controller;
import com.mosty.base.model.entity.wzzx.TbWzXfwz;
import com.mosty.base.utils.Constant;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.redis.service.RedisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* 位置-巡防报备控制层
*
* @author
* @since 2022-07-14 15:37:38
*/
@AllArgsConstructor
@RestController
@Api(tags = "巡防位置相关接口")
@RequestMapping("/gxga/xfbb")
public class TbWzXfbbController {
private final RedisService redisService;
private final RedisTemplate redisTemplate;
@GetMapping("/remove")
@ApiImplicitParam(name = "bbid", value = "报备ID", dataTypeClass = String.class, required = true, paramType = "path")
@ApiOperation(value = "清除redis数据")
public ResponseResult<Boolean> locationReceive(String bbid) {
String redisKey = Constant.WZ_XFWZ + bbid;
redisService.deleteObject(redisKey);
return ResponseResult.success(true);
}
@GetMapping("/list")
@ApiOperation(value = "获取报备redis数据")
public ResponseResult<List<TbWzXfwz>> locationReceive() {
List<TbWzXfwz> array = new ArrayList<>();
String key = Constant.WZ_XFWZ + "*";
Set<String> sets = redisTemplate.keys(key);
if (!CollectionUtils.isEmpty(sets)) {
List<TbWzXfwz> list = redisTemplate.opsForValue().multiGet(sets);
if (!CollectionUtils.isEmpty(list)) {
list.forEach(item -> {
item.setZb(null);
array.add(item);
});
}
}
return ResponseResult.success(array);
}
@GetMapping("/getXfgj")
@ApiOperation(value = "获取redis中的巡组的巡防轨迹信息")
public ResponseResult<TbWzXfwz> getXfgj(String bbid) {
if (StringUtils.isEmpty(bbid)) return null;
String key = Constant.WZ_XFWZ + bbid;
TbWzXfwz xfwz = redisService.getCacheObject(key);
return ResponseResult.success(xfwz);
}
}

View File

@ -0,0 +1,106 @@
package com.mosty.wzzx.controller;
import com.mosty.base.model.query.wzzx.TbWzLswzSearchDto;
import com.mosty.base.model.query.wzzx.TbWzSbLswzSearchDto;
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.entity.wzzx.TbWzXfwz;
import com.mosty.base.model.dto.wzzx.AppLocationReceiveDto;
import com.mosty.wzzx.service.TbWzXfwzService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import javax.annotation.Resource;
@AllArgsConstructor
@RestController
@Api(tags = "巡防位置相关接口")
@RequestMapping("/tbWzXfwz")
public class TbWzXfwzController {
private final TbWzXfwzService tbWzXfwzService;
@GetMapping
@ApiOperation(value = "查询所有数据")
@JwtSysUser
public ResponseEntity<List> queryAll() {
return ResponseEntity.ok(this.tbWzXfwzService.queryAll());
}
@GetMapping("{id}")
@ApiOperation(value = "通过主键查询单条数据")
@JwtSysUser
public ResponseEntity<TbWzXfwz> queryById(@PathVariable("id") String id) {
return ResponseEntity.ok(this.tbWzXfwzService.queryById(id));
}
@PostMapping
@ApiOperation(value = "新增数据")
@JwtSysUser
public ResponseEntity<TbWzXfwz> add(TbWzXfwz tbWzXfwz) {
return ResponseEntity.ok(this.tbWzXfwzService.insert(tbWzXfwz));
}
@PutMapping
@ApiOperation(value = "编辑数据")
@JwtSysUser
public ResponseEntity<TbWzXfwz> edit(TbWzXfwz tbWzXfwz) {
return ResponseEntity.ok(this.tbWzXfwzService.update(tbWzXfwz));
}
@DeleteMapping
@ApiOperation(value = "删除数据")
@JwtSysUser
public ResponseEntity<Boolean> deleteById(String id) {
return ResponseEntity.ok(this.tbWzXfwzService.deleteById(id));
}
@PostMapping("/selectTrack")
@ApiOperation(value = "大屏-地图-轨迹回放")
@Log(title = "大屏-地图-轨迹回放", businessType = BusinessType.OTHER)
@JwtSysUser
public ResponseResult selectTrack(@RequestBody TbWzXfwz tbWzXfwz) {
return ResponseResult.success(tbWzXfwzService.selectTrack(tbWzXfwz));
}
@PostMapping("/selectLswz")
@ApiOperation(value = "历史位置轨迹回放")
@Log(title = "历史位置轨迹回放", businessType = BusinessType.OTHER)
@JwtSysUser
public ResponseResult selectLswz(@RequestBody TbWzLswzSearchDto dto) {
return ResponseResult.success(tbWzXfwzService.selectLswz(dto));
}
@PostMapping("/locationReceive")
@ApiOperation(value = "接收app端位置数据")
@Log(title = "接收app端位置数据", businessType = BusinessType.OTHER)
@JwtSysUser
public ResponseResult locationReceive(@RequestBody AppLocationReceiveDto receiveDto) {
return ResponseResult.success(this.tbWzXfwzService.locationReceive(receiveDto));
}
@PostMapping("/selectSbLswz")
@ApiOperation(value = "设备历史位置轨迹回放")
@Log(title = "设备历史位置轨迹回放", businessType = BusinessType.OTHER)
@JwtSysUser
public ResponseResult selectSbLswz(@RequestBody TbWzSbLswzSearchDto dto) {
return ResponseResult.success(tbWzXfwzService.selectSbLswz(dto));
}
@PostMapping("/selectSbLswzMo")
@ApiOperation(value = "设备历史位置轨迹回放mo")
@Log(title = "设备历史位置轨迹回放", businessType = BusinessType.OTHER)
@JwtSysUser
public ResponseResult selectSbLswzMo(@RequestBody TbWzSbLswzSearchDto dto) {
return ResponseResult.success(tbWzXfwzService.selectSbLswzMo(dto));
}
}

View File

@ -0,0 +1,57 @@
package com.mosty.wzzx.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.dto.wzzx.WzcxQuery;
import com.mosty.base.model.dto.wzzx.WztjQuery;
import com.mosty.common.base.domain.BaseController;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.token.JwtSysUser;
import com.mosty.wzzx.service.WztjService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@AllArgsConstructor
@RestController
@Api(tags = "位置查询--原magic接口")
@RequestMapping("/wzcx")
public class WzcxController extends BaseController {
private final WztjService wztjService;
@GetMapping("/bbgjcx")
@ApiOperation(value = "报备轨迹查询")
@JwtSysUser
public ResponseResult<List<Map<String, Object>>> bbgjcx(WzcxQuery dto) {
return ResponseResult.success(this.wztjService.bbgjcx(dto));
}
@GetMapping("/bbwzcx")
@ApiOperation(value = "报备位置查询")
@JwtSysUser
public ResponseResult<List<Map<String, Object>>> bbwzcx(WzcxQuery dto) {
return ResponseResult.success(this.wztjService.bbwzcx(dto));
}
@GetMapping("/mjgjcx")
@ApiOperation(value = "民警轨迹查询")
@JwtSysUser
public ResponseResult<List<Map<String, Object>>> mjgjcx(WzcxQuery dto) {
return ResponseResult.success(this.wztjService.mjgjcx(dto));
}
@GetMapping("/wbbwz")
@ApiOperation(value = "未报备位置查询")
@JwtSysUser
public ResponseResult<List<Map<String, Object>>> wbbwz(WzcxQuery dto) {
return ResponseResult.success(this.wztjService.wbbwz(dto));
}
}

View File

@ -0,0 +1,114 @@
package com.mosty.wzzx.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.dto.wzzx.WztjQuery;
import com.mosty.base.model.entity.wzzx.TbWzSblswz;
import com.mosty.base.model.entity.wzzx.TbWzXfwz;
import com.mosty.common.base.domain.BaseController;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.token.JwtSysUser;
import com.mosty.wzzx.service.WztjService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@AllArgsConstructor
@RestController
@Api(tags = "位置统计--原magic接口")
@RequestMapping("/wztj")
public class WztjController extends BaseController {
private final WztjService wztjService;
@GetMapping("/dt/rywz")
@ApiOperation(value = "人员位置")
@JwtSysUser
public ResponseResult<List<Map<String, Object>>> rywz(WztjQuery dto) {
return ResponseResult.success(this.wztjService.rywz(dto));
}
@GetMapping("/dt/xz")
@ApiOperation(value = "巡组位置")
@JwtSysUser
public ResponseResult<List<Map<String, Object>>> xz(WztjQuery dto) {
return ResponseResult.success(this.wztjService.xz(dto));
}
@GetMapping("/tj/jrlcs")
@ApiOperation(value = "里程数")
@JwtSysUser
public ResponseResult<List<Map<String, Object>>> jrlcs(WztjQuery dto) {
return ResponseResult.success(this.wztjService.jrlcs(dto));
}
@GetMapping("/tj/rslcxz")
@ApiOperation(value = "人数里程巡组整合")
@JwtSysUser
public ResponseResult<List<Map<String, Object>>> rslcxz(WztjQuery dto) {
return ResponseResult.success(this.wztjService.rslcxz(dto));
}
@GetMapping("/tj/jrwzrs")
@ApiOperation(value = "位置人数")
@JwtSysUser
public ResponseResult<List<Map<String, Object>>> jrwzrs(WztjQuery dto) {
return ResponseResult.success(this.wztjService.jrwzrs(dto));
}
@GetMapping("/tj/jrxzwzs")
@ApiOperation(value = "巡组位置数")
@JwtSysUser
public ResponseResult<List<Map<String, Object>>> jrxzwzs(WztjQuery dto) {
return ResponseResult.success(this.wztjService.jrxzwzs(dto));
}
@GetMapping("/wz/rywzlb")
@ApiOperation(value = "人员位置列表")
@JwtSysUser
public ResponseResult<IPage<Map<String, Object>>> rywzlb(WztjQuery dto) {
return ResponseResult.success(this.wztjService.rywzlb(dto));
}
@GetMapping("/tj/xfsltj")
@ApiOperation(value = "巡组数量统计")
@JwtSysUser
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "1.今天 2.7天 3.30天", required = true, dataType = "String"),
})
public ResponseResult<Map<String, Object>> xfsltj(String type) {
return ResponseResult.success(this.wztjService.xfsltj(type));
}
@GetMapping("/tj/rysltj")
@ApiOperation(value = "人员数量统计")
@JwtSysUser
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "1.今天 2.7天 3.30天", required = true, dataType = "String"),
})
public ResponseResult<Map<String, Object>> rysltj(String type) {
return ResponseResult.success(this.wztjService.rysltj(type));
}
@GetMapping("/tj/sblswz")
@ApiOperation(value = "设备数量统计")
@JwtSysUser
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "1.今天 2.7天 3.30天", required = true, dataType = "String"),
})
public ResponseResult<Map<String, Object>> sblswz(String type) {
return ResponseResult.success(this.wztjService.sblswz(type));
}
}

View File

@ -0,0 +1,28 @@
package com.mosty.wzzx.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.base.model.dto.wzzx.XfbbUpdateDto;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* 巡防报备表 Mapper 接口
* </p>
*
* @author zengbo
* @since 2022-06-27
*/
@Mapper
public interface TbQwXfbbMapper extends BaseMapper<TbQwXfbb> {
@ApiOperation("id查询")
TbQwXfbb queryById(@Param("id") String id);
@ApiOperation("修改巡防报备")
Integer updateXfbb(XfbbUpdateDto xfbbUpdateDto);
@ApiOperation("查询是否报备")
int getsfbb(String id);
}

View File

@ -0,0 +1,29 @@
package com.mosty.wzzx.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.base.model.entity.qwzx.TbQwZnzb;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 巡防排班或报备或值班-通讯装备表 Mapper 接口
* </p>
*
* @author zengbo
* @since 2022-06-27
*/
@Mapper
public interface TbQwZnzbMapper extends BaseMapper<TbQwZnzb> {
/**
* 根据 业务ID查询
*
* @param ywidList
* @return
*/
List<TbQwZnzb> queryListByYwid(@Param("list") List<String> ywidList);
}

View File

@ -0,0 +1,27 @@
package com.mosty.wzzx.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.base.model.dto.wzzx.SjCyjlUpdateDto;
import com.mosty.base.model.entity.sjzx.TbSjCyjl;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* 事件参与警力 Mapper 接口
* </p>
*
* @author zengbo
* @since 2022-06-27
*/
@Mapper
public interface TbSjCyjlMapper extends BaseMapper<TbSjCyjl> {
@ApiOperation("id查询")
TbSjCyjl queryBySfzh(@Param("sfzh") String sfzh);
@ApiOperation("修改参与警力坐标")
Integer updateZb(SjCyjlUpdateDto sjCyjlUpdateDto);
}

View File

@ -0,0 +1,22 @@
package com.mosty.wzzx.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.base.model.entity.wzzx.TbWzLswz;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 位置-历史位置表 Mapper 接口
* </p>
*
* @author zengbo
* @since 2022-08-29
*/
@Mapper
public interface TbWzLswzMapper extends BaseMapper<TbWzLswz> {
@ApiOperation("历史位置")
int insertEntity(TbWzLswz tbWzLswz);
}

View File

@ -0,0 +1,38 @@
package com.mosty.wzzx.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.base.model.entity.wzzx.TbWzRywz;
import com.mosty.base.model.query.wzzx.TbWzRywzSearchDto;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* <p>
* 位置-人员位置表 Mapper 接口
* </p>
*
* @author zengbo
* @since 2022-08-29
*/
@Mapper
public interface TbWzRywzMapper extends BaseMapper<TbWzRywz> {
@ApiOperation("添加人员位置信息")
int insertEntity(TbWzRywz tbWzRywz);
@ApiOperation("修改盘查车辆对象")
void updateEntity(TbWzRywz tbWzRywz);
TbWzRywz queryBySfzh(@Param("yhSfzh") String yhSfzh);
@ApiOperation("查询人员位置信息")
TbWzRywz selectBySfz(TbWzRywzSearchDto dto);
@ApiOperation("去重人员数量统计")
int getRysltjCount(@Param("kssj") String kssj,
@Param("jssj") String jssj,
@Param("useSql") String useSql);
}

View File

@ -0,0 +1,36 @@
package com.mosty.wzzx.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.base.model.entity.wzzx.TbWzSblswz;
import com.mosty.base.model.query.wzzx.TbWzSbLswzSearchDto;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* <p>
* 位置-设备历史位置表 Mapper 接口
* </p>
*
* @author zengbo
* @since 2022-08-29
*/
@Mapper
public interface TbWzSblswzMapper extends BaseMapper<TbWzSblswz> {
@ApiOperation("设备历史位置")
int insertEntity(TbWzSblswz tbWzSblswz);
@ApiOperation("去重设备数量统计")
int getSblswzCount(@Param("kssj") String kssj,
@Param("jssj") String jssj,
@Param("useSql") String useSql);
@ApiOperation("设备历史位置")
List<TbWzSblswz> selectSbLswz(TbWzSbLswzSearchDto dto);
}

View File

@ -0,0 +1,25 @@
package com.mosty.wzzx.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.base.model.entity.wzzx.TbWzSbsswz;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 位置-设备实时位置表 Mapper 接口
* </p>
*
* @author zengbo
* @since 2022-08-29
*/
@Mapper
public interface TbWzSbsswzMapper extends BaseMapper<TbWzSbsswz> {
@ApiOperation("设备实时位置")
Integer insertEntity(TbWzSbsswz tbWzSbsswz);
@ApiOperation("删除7日前的设备实时位置")
Integer delHistory();
}

View File

@ -0,0 +1,40 @@
package com.mosty.wzzx.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.base.model.entity.wzzx.TbWzSswz;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 位置-实时位置表只存7天数据 Mapper 接口
* </p>
*
* @author zengbo
* @since 2022-08-29
*/
@Mapper
public interface TbWzSswzMapper extends BaseMapper<TbWzSswz> {
@ApiOperation("添加实时位置表")
int insertEntity(TbWzSswz tbWzSswz);
@ApiOperation("根据ID查询实时位置")
TbWzSswz queryById(@Param("id") String id);
@ApiOperation("查询用户最新的位置")
TbWzSswz querySswzNow(@Param("yhId") String yhId, @Param("jrbh") String jrbh);
@ApiOperation("查询当日的实时位置")
List<TbWzSswz> querySswzToday(@Param("yhId") String yhId, @Param("jrbh") String jrbh);
@ApiOperation("查询当日的用户ID")
List<String> querySswzYhid();
@ApiOperation("删除7日前的实时位置")
Integer delHistory();
}

View File

@ -0,0 +1,48 @@
package com.mosty.wzzx.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.base.model.entity.wzzx.TbWzXfwz;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 位置-巡防位置表(TbWzXfwz)表数据库访问层
*
* @author zhangHaiJun
* @since 2022-07-14 15:37:38
*/
@Mapper
public interface TbWzXfwzMapper extends BaseMapper<TbWzXfwz> {
@ApiOperation("查询所有数据")
List<TbWzXfwz> queryAll();
@ApiOperation("通过ID查询单条数据")
TbWzXfwz queryById(String id);
@ApiOperation("统计总行数")
long count(TbWzXfwz tbWzXfwz);
@ApiOperation("新增数据")
int insert(TbWzXfwz tbWzXfwz);
@ApiOperation("批量新增数据MyBatis原生foreach方法")
int insertBatch(@Param("entities") List<TbWzXfwz> entities);
@ApiOperation("批量新增或按主键更新数据MyBatis原生foreach方法")
int insertOrUpdateBatch(@Param("entities") List<TbWzXfwz> entities);
@ApiOperation("修改数据")
int update(TbWzXfwz tbWzXfwz);
@ApiOperation("通过主键删除数据")
int deleteById(String id);
@ApiOperation("查询所有数据")
TbWzXfwz queryByBbid(@Param("bbid") String bbid);
}

View File

@ -0,0 +1,49 @@
package com.mosty.wzzx.mapper;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Mapper;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Mapper
public interface WztjMapper {
@ApiOperation("人员位置")
List<Map<String, Object>> jwzbmlbtj(Map<String, Object> map);
@ApiOperation("巡组位置")
List<Map<String, Object>> xz(Map<String, Object> map);
@ApiOperation("里程数")
List<Map<String, Object>> jrlcs(Map<String, Object> map);
@ApiOperation("人数里程巡组整合")
List<Map<String, Object>> rslcxz(Map<String, Object> map);
@ApiOperation("位置人数")
List<Map<String, Object>> jrwzrs(Map<String, Object> map);
@ApiOperation("巡组位置数")
List<Map<String, Object>> jrxzwzs(Map<String, Object> map);
@ApiOperation("人员位置数量")
int rywzlbCount(Map<String, Object> map);
@ApiOperation("人员位置列表")
List<Map<String, Object>> rywzlb(Map<String, Object> map);
@ApiOperation("报备轨迹查询")
List<Map<String, Object>> bbgjcx(Map<String, Object> map);
@ApiOperation("报备位置查询")
List<Map<String, Object>> bbwzcx(Map<String, Object> map);
@ApiOperation("民警轨迹查询")
List<Map<String, Object>> mjgjcx(Map<String, Object> map);
@ApiOperation("未报备位置查询")
List<Map<String, Object>> wbbwz(Map<String, Object> map);
}

View File

@ -0,0 +1,26 @@
package com.mosty.wzzx.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.common.core.business.entity.SysUser;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 用户服务dao层
* @author kevin
* @date 2022/2/12 10:10 PM
* @since 1.0.0
*/
@Mapper
public interface WzzxUserMapper extends BaseMapper<SysUser> {
@ApiOperation("分页查询用户信息")
List<SysUser> selectByPage();
}

View File

@ -0,0 +1,10 @@
package com.mosty.wzzx.mongodb;
import com.mosty.base.utils.mongo.core.sdk.EasyMongoService;
import com.mosty.wzzx.mongodb.entity.TbWzSblswzMo;
public interface TbWzSblswzMongoService extends EasyMongoService<String, TbWzSblswzMo> {
}

View File

@ -0,0 +1,261 @@
package com.mosty.wzzx.mongodb.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mosty.base.model.BaseEntity;
import com.vividsolutions.jts.geom.Point;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Date;
/**
* <p>
* 位置-历史位置表
* </p>
*
* @author zengbo
* @since 2022-08-29
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Document(collection = "tb_wz_sblswz")
@ApiModel(value = "TbWzLswz对象", description = "位置-历史位置表")
public class TbWzSblswzMo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "唯一标识ID")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@Id
private String id;
@ApiModelProperty(value = "数据来源名称")
private String sjly;
@ApiModelProperty(value = "--D_BZ_WZSJLY(位置数据来源)数据来源01 udp推送 02 移动设备)")
private String sjlydm;
@Indexed
@ApiModelProperty(value = "关联业务ID预留")
private String ywid;
@Indexed
@ApiModelProperty(value = "设备ID")
private String sbid;
@Indexed
@ApiModelProperty(value = "设备名称")
private String sbmc;
@Indexed
@Field("yh_id")
@ApiModelProperty(value = "用户ID")
private String yhId;
@Indexed
@Field("yh_xm")
@ApiModelProperty(value = "用户姓名")
private String yhXm;
@Indexed
@Field("yh_sfzh")
@ApiModelProperty(value = "用户身份证")
private String yhSfzh;
@Indexed
@Field("jz_id")
@ApiModelProperty(value = "警组ID")
private String jzId;
@Indexed
@Field("jz_mc")
@ApiModelProperty(value = "警组名称")
private String jzMc;
@ApiModelProperty(value = "定位日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date dwrq;
@ApiModelProperty(value = "定位时间")
private Date dwsj;
@ApiModelProperty(value = "地球经度")
private BigDecimal jd;
@ApiModelProperty(value = "地球维度")
private BigDecimal wd;
@ApiModelProperty(value = "坐标")
@TableField(exist = false)
@Transient
private Point zb;
@ApiModelProperty(value = "坐标hash值")
private String zbhash;
@ApiModelProperty(value = "--D_BZ_WZTGZ(位置提供者)位置提供者pgs PGIS定位 lbs 综合定位)")
private String wztgz;
@ApiModelProperty(value = "国家")
private String guo;
@ApiModelProperty(value = "")
private String sheng;
@ApiModelProperty(value = "")
private String shi;
@ApiModelProperty(value = "城市编码")
private String csbm;
@ApiModelProperty(value = "所属区县")
private String ssqx;
@ApiModelProperty(value = "区县编码")
private String qxbm;
@ApiModelProperty(value = "地址详址")
private String dzxz;
@ApiModelProperty(value = "地址简称")
private String dzjc;
@ApiModelProperty(value = "定位标志")
private String dwbz;
@ApiModelProperty(value = "巡防时长(与上一个点的时长)")
private Integer xfsc;
@ApiModelProperty(value = "巡防里程(米)(与上一个点的距离)")
private Integer xflc;
@ApiModelProperty(value = "所属部门id")
private String ssbmid;
@ApiModelProperty(value = "所属部门")
private String ssbm;
@ApiModelProperty(value = "所属部门代码")
private String ssbmdm;
@ApiModelProperty(value = "所属县公安局id")
private String ssxgajid;
@ApiModelProperty(value = "所属县公安局")
private String ssxgaj;
@ApiModelProperty(value = "所属县公安局代码")
private String ssxgajdm;
@ApiModelProperty(value = "所属市公安局id")
private String sssgajid;
@ApiModelProperty(value = "所属市公安局")
private String sssgaj;
@ApiModelProperty(value = "所属市公安局代码")
private String sssgajdm;
@ApiModelProperty(value = "数据来源1、PC2、手机端", name = "xtSjly")
@Field("xt_sjly")
@Indexed
private String xtSjly;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "数据状态0、注销1、正常-1、封存", name = "xtSjzt")
@Field("xt_sjzt")
@Indexed
private String xtSjzt;
@TableLogic
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "删除标识0、未删除1、已删除", name = "xtScbz")
@Field("xt_scbz")
@Indexed
private String xtScbz;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建IP", name = "xtCjip")
@Field("xt_cjip")
@Indexed
private String xtCjip;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间", name = "xtCjsj")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Field("xt_cjsj")
@Indexed
private Date xtCjsj;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建人ID", name = "xtCjrId")
@Field("xt_cjr_id")
private String xtCjrId;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建人名称", name = "xtCjr")
@Field("xt_cjr")
@Indexed
private String xtCjr;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建部门代码", name = "xtCjbmdm")
@Field("xt_cjbmdm")
private String xtCjbmdm;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建部门名称", name = "xtCjbmmc")
@Field("xt_cjbmmc")
private String xtCjbmmc;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "最后更新IP", name = "xtZhgxip")
@Field("xt_zhgxip")
private String xtZhgxip;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "最后更新时间", name = "xtZhgxsj")
@Field("xt_zhgxsj")
private Date xtZhgxsj;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "最后更新人ID", name = "xtZhgxrid")
@Field("xt_zhgxrid")
private String xtZhgxrid;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "最后更新人名称", name = "xtZhgxr")
@Field("xt_zhgxr")
private String xtZhgxr;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "最后更新部门代码", name = "xtZhgxbmdm")
@Field("xt_zhgxbmdm")
private String xtZhgxbmdm;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "最后更新部门名称", name = "xtZhgxbm")
@Field("xt_zhgxbm")
private String xtZhgxbm;
@ApiModelProperty(value = "备注", name = "bz")
@Field("bz")
public String bz;
}

View File

@ -0,0 +1,179 @@
package com.mosty.wzzx.mongodb.impl;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult;
import com.mosty.base.utils.mongo.core.entity.Page;
import com.mosty.base.utils.mongo.core.sdk.EasyMongoService;
import com.mosty.base.utils.mongo.core.wrapper.LambdaQueryWrapper;
import com.mosty.base.utils.mongo.utils.ClassUtil;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import javax.annotation.Resource;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
/**
* 默认的服务实现类
*
* @author esacpe
* @date 2024/4/15
*/
@SuppressWarnings("all")
public class EasyMongoServiceImpl<I extends Serializable, T> implements EasyMongoService<I, T> {
/**
* 服务类对应的mongo实体类
*/
private final Class<T> targetClass = (Class<T>) ClassUtil.getTClass(this);
@Resource
protected MongoTemplate mongoTemplate;
@Override
public T getOne(LambdaQueryWrapper<T> queryWrapper) {
Query query = QueryBuildUtils.buildQuery(queryWrapper);
return mongoTemplate.findOne(query, targetClass);
}
@Override
public boolean save(T entity) {
return Objects.nonNull(mongoTemplate.save(entity));
}
@Override
public boolean saveBatch(Collection<T> entityList) {
entityList.forEach(item -> mongoTemplate.save(item));
return true;
}
@Override
public boolean removeById(I id) {
Criteria criteria = Criteria.where("_id").is(id);
Query query = new Query(criteria);
DeleteResult deleteResult = mongoTemplate.remove(query, targetClass);
return deleteResult.getDeletedCount() > 0;
}
@Override
public boolean remove(LambdaQueryWrapper<T> queryWrapper) {
Query query = QueryBuildUtils.buildQuery(queryWrapper);
DeleteResult remove = mongoTemplate.remove(query, targetClass);
return remove.getDeletedCount() > 0;
}
@Override
public boolean updateById(T entity) {
Criteria criteria = Criteria.where("_id").is(ClassUtil.getId(entity));
Query query = new Query(criteria);
Update update = getUpdate(entity);
UpdateResult updateResult = mongoTemplate.updateFirst(query, update, targetClass);
return updateResult.getModifiedCount() > 0;
}
/**
* 通过反射获取需要更新的字段
*/
private Update getUpdate(T entity) {
Update update = new Update();
for (Field field : entity.getClass().getDeclaredFields()) {
try {
field.setAccessible(true);
Object result = field.get(entity);
if (Objects.nonNull(result)) {
update.set(field.getName(), result);
}
} catch (Exception ignore) {
}
}
return update;
}
@Override
public boolean update(T entity, LambdaQueryWrapper<T> queryWrapper) {
Query query = QueryBuildUtils.buildQuery(queryWrapper);
Update update = getUpdate(entity);
UpdateResult updateResult = mongoTemplate.updateFirst(query, update, targetClass);
return updateResult.getModifiedCount() > 0;
}
@Override
public T getById(I id) {
Criteria criteria = Criteria.where("_id").is(id);
Query query = new Query(criteria);
return mongoTemplate.findOne(query, targetClass);
}
@Override
public Collection<T> listByIds(Collection<I> idList) {
Criteria criteria = Criteria.where("_id").in(idList);
Query query = new Query(criteria);
return mongoTemplate.find(query, targetClass);
}
@Override
public long count(LambdaQueryWrapper<T> queryWrapper) {
Query query = QueryBuildUtils.buildQuery(queryWrapper);
return mongoTemplate.count(query, targetClass);
}
@Override
public List<T> list(LambdaQueryWrapper<T> queryWrapper) {
Query query = QueryBuildUtils.buildQuery(queryWrapper);
return mongoTemplate.find(query, targetClass);
}
@Override
public Page<T> page(LambdaQueryWrapper<T> queryWrapper, int pageNo, int pageSize) {
Query query = QueryBuildUtils.buildQuery(queryWrapper);
Page<T> page = new Page<>();
page.setPageSize(pageSize);
page.setPageNum(pageNo);
long total = mongoTemplate.count(query, targetClass);
page.setTotal(total);
if (total <= 0) {
return page;
}
query.skip((long) (pageNo - 1) * pageSize).limit(pageSize);
List<T> list = mongoTemplate.find(query, targetClass);
page.setRecords(list);
return page;
}
@Override
public boolean exist(LambdaQueryWrapper<T> queryWrapper) {
Query query = QueryBuildUtils.buildQuery(queryWrapper);
return mongoTemplate.exists(query, targetClass);
}
}

View File

@ -0,0 +1,251 @@
package com.mosty.wzzx.mongodb.impl;
import com.mosty.base.utils.mongo.core.constant.ECompare;
import com.mosty.base.utils.mongo.core.constant.EConditionType;
import com.mosty.base.utils.mongo.core.constant.ESortType;
import com.mosty.base.utils.mongo.core.entity.Condition;
import com.mosty.base.utils.mongo.core.entity.SortCondition;
import com.mosty.base.utils.mongo.core.wrapper.ConditionWrapper;
import com.mosty.base.utils.mongo.core.wrapper.LambdaQueryWrapper;
import com.mosty.base.utils.mongo.utils.ExceptionUtils;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Field;
import org.springframework.data.mongodb.core.query.Query;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 查询工具构建工具
*
* @author esacpe
* @date 2024/4/15
*/
public class QueryBuildUtils {
private static final Map<ECompare, Function<Condition, Criteria>> HANDLERS = new ConcurrentHashMap<>();
static {
HANDLERS.put(ECompare.EQ, QueryBuildUtils::eqHandle);
HANDLERS.put(ECompare.NE, QueryBuildUtils::neHandle);
HANDLERS.put(ECompare.LE, QueryBuildUtils::leHandle);
HANDLERS.put(ECompare.LT, QueryBuildUtils::ltHandle);
HANDLERS.put(ECompare.GE, QueryBuildUtils::geHandle);
HANDLERS.put(ECompare.GT, QueryBuildUtils::gtHandle);
HANDLERS.put(ECompare.BW, QueryBuildUtils::bwHandle);
HANDLERS.put(ECompare.IN, QueryBuildUtils::inHandle);
HANDLERS.put(ECompare.NIN, QueryBuildUtils::ninHandle);
}
/**
* 使用条件构建器构建查询条件
*
* @param queryWrapper 条件构建器
* @return 查询条件
*/
public static Query buildQuery(LambdaQueryWrapper<?> queryWrapper) {
return buildQuery(queryWrapper.getCondition());
}
/**
* 使用条件构建器构建查询条件
*
* @param arg 条件构建器封装的真实条件参数
* @return 查询条件
*/
private static Query buildQuery(ConditionWrapper arg) {
Criteria criteria = new Criteria();
// 01 构建查询参数
criteria.andOperator(buildCondition(arg));
Query query = new Query(criteria);
List<SortCondition> sortConditions = arg.getSortConditions();
// 02 构建排序参数
if (Objects.nonNull(sortConditions)) {
query.with(Sort.by(buildSort(sortConditions)));
}
// 03 构建分页参数
if (Objects.nonNull(arg.getSkip())) {
query.skip(arg.getSkip());
}
if (Objects.nonNull(arg.getLimit())) {
query.limit(arg.getLimit());
}
// 04 构建查询列
if (Objects.nonNull(arg.getFields()) && arg.getFields().size() > 0) {
Field fields = query.fields();
arg.getFields().forEach(item -> fields.include(item.getCol()));
}
return query;
}
/**
* 构建排序信息
*
* @param sortConditions 排序条件
* @return 排序信息
*/
private static List<Sort.Order> buildSort(List<SortCondition> sortConditions) {
return sortConditions.stream().map(item -> {
if (item.getSortType() == ESortType.ASC) {
return Sort.Order.asc(item.getCol());
} else {
return Sort.Order.desc(item.getCol());
}
}).collect(Collectors.toList());
}
/**
* 构建查询条件
*
* @param arg 条件构造器中的条件参数
* @return 查询条件
*/
private static Criteria[] buildCondition(ConditionWrapper arg) {
Criteria criteria = new Criteria();
if (Objects.isNull(arg) || Objects.isNull(arg.getConditions()) || arg.getConditions().size() == 0) {
return new Criteria[]{criteria};
}
List<Condition> conditions = arg.getConditions();
boolean isOr = false;
Criteria[] critters = new Criteria[conditions.size()];
for (int index = 0; index < conditions.size(); index++) {
Condition condition = conditions.get(index);
if (Objects.nonNull(condition.getConditionWrapper()) && Objects.isNull(condition.getCol()) && condition.getConditionWrapper().getConditions().size() > 0) {
Criteria curCriteria = new Criteria();
Condition first = condition.getConditionWrapper().getConditions().get(0);
if (first.getConditionType() == EConditionType.OR) {
curCriteria.orOperator(buildCondition(condition.getConditionWrapper()));
} else {
curCriteria.andOperator(buildCondition(condition.getConditionWrapper()));
}
critters[index] = curCriteria;
continue;
}
ECompare type = condition.getType();
if (condition.getConditionType() == EConditionType.OR) {
isOr = true;
}
Function<Condition, Criteria> handler = HANDLERS.get(type);
if (Objects.isNull(handler)) {
throw ExceptionUtils.mpe(String.format("buildQuery error not have queryType %s", type));
}
Criteria curCriteria = handler.apply(condition);
critters[index] = curCriteria;
}
if (isOr) {
criteria.orOperator(critters);
} else {
criteria.andOperator(critters);
}
return critters;
}
/**
* eq 处理器
*
* @param condition 条件参数
* @return 构建好的查询条件
*/
private static Criteria eqHandle(Condition condition) {
return Criteria.where(condition.getCol()).is(condition.getArgs().get(0));
}
/**
* ne 处理器
*
* @param condition 条件参数
* @return 构建好的查询条件
*/
private static Criteria neHandle(Condition condition) {
return Criteria.where(condition.getCol()).ne(condition.getArgs().get(0));
}
/**
* le 处理器
*
* @param condition 条件参数
* @return 构建好的查询条件
*/
private static Criteria leHandle(Condition condition) {
return Criteria.where(condition.getCol()).lte(condition.getArgs().get(0));
}
/**
* lt 处理器
*
* @param condition 条件参数
* @return 构建好的查询条件
*/
private static Criteria ltHandle(Condition condition) {
return Criteria.where(condition.getCol()).lt(condition.getArgs().get(0));
}
/**
* ge 处理器
*
* @param condition 条件参数
* @return 构建好的查询条件
*/
private static Criteria geHandle(Condition condition) {
return Criteria.where(condition.getCol()).gte(condition.getArgs().get(0));
}
/**
* gt 处理器
*
* @param condition 条件参数
* @return 构建好的查询条件
*/
private static Criteria gtHandle(Condition condition) {
return Criteria.where(condition.getCol()).gt(condition.getArgs().get(0));
}
/**
* between 处理器
*
* @param condition 条件参数
* @return 构建好的查询条件
*/
private static Criteria bwHandle(Condition condition) {
return Criteria.where(condition.getCol()).lte(condition.getArgs().get(0)).gt(condition.getArgs().get(1));
}
/**
* in 处理器
*
* @param condition 条件参数
* @return 构建好的查询条件
*/
private static Criteria inHandle(Condition condition) {
List<Object> args = (List<Object>) condition.getArgs().get(0);
return Criteria.where(condition.getCol()).in(args.toArray());
}
/**
* notIn 处理器
*
* @param condition 条件参数
* @return 构建好的查询条件
*/
private static Criteria ninHandle(Condition condition) {
List<Object> args = (List<Object>) condition.getArgs().get(0);
return Criteria.where(condition.getCol()).nin(args.toArray());
}
}

View File

@ -0,0 +1,11 @@
package com.mosty.wzzx.mongodb.impl;
import com.mosty.wzzx.mongodb.TbWzSblswzMongoService;
import com.mosty.wzzx.mongodb.entity.TbWzSblswzMo;
import org.springframework.stereotype.Service;
@Service
public class TbWzSblswzMongoServiceImpl extends EasyMongoServiceImpl<String, TbWzSblswzMo> implements TbWzSblswzMongoService {
}

View File

@ -0,0 +1,117 @@
package com.mosty.wzzx.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);
}
}
}

View File

@ -0,0 +1,29 @@
package com.mosty.wzzx.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.wzzx.mapper")
public class MybatisPlusConfig {
/**
* 元对象字段填充控制器
* https://baomidou.com/guide/auto-fill-metainfo.html
*/
@Bean
public MetaObjectHandler metaObjectHandler() {
return new CreateAndUpdateMetaObjectHandler();
}
}

View File

@ -0,0 +1,105 @@
package com.mosty.wzzx.remote;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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.base.model.vo.base.DeptInfoVo;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.exception.BusinessException;
import com.mosty.common.core.business.entity.SysUser;
import com.mosty.common.core.business.entity.vo.SysUserVO;
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;
// 根据部门编码查询部门信息
public DeptInfoVo getOrgByDeptId(String deptId) {
if (StringUtils.isBlank(deptId)) {
return null;
}
ResponseResult<DeptInfoVo> responseResult = mostyBaseFeignService.getOrgByDeptId(deptId);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("调用部门编码查询部门信息异常 responseResult = {}", JSON.toJSONString(responseResult));
throw new BusinessException("调用部门编码查询部门信息异常");
}
return responseResult.getData();
}
// 根据经纬度获取地址信息
public JSONObject getAddress(String jd,String wd) {
if (StringUtils.isBlank(jd) || StringUtils.isBlank(wd)) {
return null;
}
ResponseResult<JSONObject> responseResult = mostyBaseFeignService.getAddress(jd,wd);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("调用部门编码查询部门信息异常 responseResult = {}", JSON.toJSONString(responseResult));
throw new BusinessException("调用部门编码查询部门信息异常");
}
return responseResult.getData();
}
// 根据经纬度获取地址信息
public JSONObject getLzAddress(String jd,String wd) {
if (StringUtils.isBlank(jd) || StringUtils.isBlank(wd)) {
return null;
}
ResponseResult<JSONObject> responseResult = mostyBaseFeignService.getLzAddress(jd,wd);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("根据经纬度获取地址信息异常 responseResult = {}", JSON.toJSONString(responseResult));
throw new BusinessException("根据经纬度获取地址信息异常");
}
return responseResult.getData();
}
// 获取用户部门信息
public DeptInfoVo getDeptInfoByUserId(String userId) {
if (StringUtils.isBlank(userId)) {
return null;
}
ResponseResult<DeptInfoVo> responseResult = mostyBaseFeignService.getDeptInfoByUserId(userId);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("获取用户部门信息异常 responseResult = {}", JSON.toJSONString(responseResult));
throw new BusinessException("获取用户部门信息异常");
}
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();
}
// 获取用户信息
public SysUser getUserInfoBySfzh(String sfzh) {
ResponseResult<SysUser> responseResult = mostyBaseFeignService.getUserInfoBySfzh(sfzh);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("获取用户信息失败, responseResult = {}", JSON.toJSONString(responseResult));
throw new BusinessException("获取用户信息失败");
}
return responseResult.getData();
}
}

View File

@ -0,0 +1,56 @@
package com.mosty.wzzx.remote;
import com.alibaba.fastjson.JSON;
import com.mosty.base.feign.service.MostyQwzxFeignService;
import com.mosty.base.model.dto.qwzx.TbQwJlDto;
import com.mosty.base.model.dto.qwzx.TbQwXfbbVo;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.exception.BusinessException;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 勤务中心远程调用
*/
@Slf4j
@Service
@AllArgsConstructor
public class TbQwzxAdaptRemoteService {
private final MostyQwzxFeignService mostyQwzxFeignService;
// 根据设备ID查询该设备所在的巡组
public List<TbQwXfbb> getBbList(String sbid) {
ResponseResult<List<TbQwXfbb>> responseResult = mostyQwzxFeignService.getBbList(sbid);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("获取巡组信息 失败 responseResult = {}", JSON.toJSONString(responseResult));
throw new BusinessException("获取巡组信息异常!");
}
return responseResult.getData();
}
// 根据设备ID查询该设备所在的巡组
public List<TbQwXfbb> getClBbList(String sbid) {
ResponseResult<List<TbQwXfbb>> responseResult = mostyQwzxFeignService.getClBbList(sbid);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("获取巡组信息 失败 responseResult = {}", JSON.toJSONString(responseResult));
throw new BusinessException("获取巡组信息异常!");
}
return responseResult.getData();
}
// 查询报备信息
public TbQwXfbb getBbxxInfo(String id) {
ResponseResult<TbQwXfbb> responseResult = mostyQwzxFeignService.getBbxxInfo(id);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("查询报备信息 失败 responseResult = {}", JSON.toJSONString(responseResult));
throw new BusinessException("查询报备信息异常!");
}
return responseResult.getData();
}
}

View File

@ -0,0 +1,33 @@
package com.mosty.wzzx.remote;
import com.alibaba.fastjson.JSON;
import com.mosty.base.feign.service.MostyWebSocketFeignService;
import com.mosty.base.model.dto.websocket.WebSocketObject;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @author dw
* @since 2022/7/23
* websocket外部调用基础管理接口
**/
@Service
@Slf4j
public class TbWebSocketAdaptRemoteService {
@Resource
private MostyWebSocketFeignService mostyWebSocketFeignService;
// 发送报备数据websocket信息
public void sendBbMessage(WebSocketObject obj) {
ResponseResult<Void> responseResult = this.mostyWebSocketFeignService.sendBbMessage(obj);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("发送报备数据websocket信息 异常 Result = {}", JSON.toJSONString(responseResult));
throw new BusinessException("发送报备数据websocket信息 异常");
}
}
}

View File

@ -0,0 +1,39 @@
package com.mosty.wzzx.remote;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mosty.base.feign.service.MostyQwzxFeignService;
import com.mosty.common.base.domain.ResponseResult;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* Created by
*
* @ClassName TbXfbbAdaptRemoteService
*/
@Slf4j
@Service
@AllArgsConstructor
public class TbXfbbAdaptRemoteService {
private final MostyQwzxFeignService mostyQwzxFeignService;
/**
* 查询预警信息
* @param id 内容
* @return 部门信息
*/
public JSONObject getBbxx(String id) {
ResponseResult responseResult = mostyQwzxFeignService.getBbInfo(id);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("查询报备信息异常Result = {}", JSON.toJSONString(responseResult));
return null;
}
return JSONObject.parseObject(JSONObject.toJSONString(responseResult.getData()));
}
}

View File

@ -0,0 +1,60 @@
package com.mosty.wzzx.remote;
import com.alibaba.fastjson.JSON;
import com.mosty.base.feign.service.MostyYjzlFeignService;
import com.mosty.base.model.dto.yjzl.TbZlxxInsertDto;
import com.mosty.base.model.entity.wzzx.TbWzSbsswz;
import com.mosty.base.model.vo.wzzx.TbWzSblswzVo;
import com.mosty.base.model.vo.yjzl.TbFzJlVo;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @author dw
* @since 2022/12/9
* 外部调用预警指令要素接口
**/
@Service
@Slf4j
public class TbYjzlAdaptRemoteService {
@Resource
private MostyYjzlFeignService mostyYjzlFeignService;
// 添加指令信息
public void addZl(TbZlxxInsertDto dto) {
ResponseResult<Void> responseResult = this.mostyYjzlFeignService.addZl(dto);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("添加指令信息失败 responseResult = {}", JSON.toJSONString(responseResult));
throw new BusinessException("添加指令信息失败");
}
}
// 修改预警信息是否发送指令
public void updateYjxxSffszl(String id) {
ResponseResult<Void> responseResult = this.mostyYjzlFeignService.updateYjxxSffszl(id);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("修改预警信息是否发送指令失败 responseResult = {}", JSON.toJSONString(responseResult));
throw new BusinessException("修改预警信息是否发送指令失败");
}
}
// 通过设备位置新增犯罪预测巡逻记录
public void addBySbwz(TbFzJlVo vo) {
if (ObjectUtils.isNotEmpty(vo)) {
ResponseResult<Void> responseResult = this.mostyYjzlFeignService.addBySbwz(vo);
if (responseResult == null || !responseResult.isSuccess()) {
log.error("通过设备位置新增犯罪预测巡逻记录失败 responseResult = {}", JSON.toJSONString(responseResult));
throw new BusinessException("通过设备位置新增犯罪预测巡逻记录");
}
}
}
}

View File

@ -0,0 +1,19 @@
package com.mosty.wzzx.service;
import com.mosty.base.model.dto.wzzx.AppLocationReceiveDto;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.base.model.entity.wzzx.TbWzRywz;
import io.swagger.annotations.ApiOperation;
public interface LocationInfoService {
@ApiOperation("位置接收")
void locationReceive(LocationInfo locationInfo);
@ApiOperation("保存人员位置")
TbWzRywz saveRywz(LocationInfo locationInfo);
@ApiOperation("保存巡防位置")
Integer saveXfwz(TbQwXfbb bb, LocationInfo locationInfo, TbWzRywz rywz);
}

View File

@ -0,0 +1,22 @@
package com.mosty.wzzx.service;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.base.model.entity.wzzx.TbWzRywz;
import com.mosty.base.model.entity.wzzx.TbWzSbsswz;
import io.swagger.annotations.ApiOperation;
public interface TbQwXfbbService {
@ApiOperation("根据ID更新")
Integer updateXfbb(TbQwXfbb bb,LocationInfo locationInfo, TbWzRywz rywz,Integer lc);
@ApiOperation("根据ID更新")
Integer updateById(String id, LocationInfo locationInfo);
@ApiOperation("udp更新报备位置")
void updateXfbbUdp(TbQwXfbb bb, TbWzSbsswz sbsswz,Integer lc);
@ApiOperation("查询是否报备")
int getsfbb(String id);
}

View File

@ -0,0 +1,14 @@
package com.mosty.wzzx.service;
import com.mosty.base.model.entity.qwzx.TbQwZnzb;
import io.swagger.annotations.ApiOperation;
import java.util.List;
public interface TbQwZnzbService {
@ApiOperation("根据业务ID查询智能装备")
List<TbQwZnzb> queryListByYwid(List<String> ywidList);
}

View File

@ -0,0 +1,24 @@
package com.mosty.wzzx.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.dto.wzzx.SjCyjlUpdateDto;
import com.mosty.base.model.entity.sjzx.TbSjCyjl;
import com.mosty.base.utils.GeoHashKit;
import com.mosty.base.utils.JtsUtils;
import com.mosty.wzzx.mapper.TbSjCyjlMapper;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
public interface TbSjCyjlService {
@ApiOperation("更新事件参与警力坐标")
Integer updateJlZb(LocationInfo locationInfo);
}

View File

@ -0,0 +1,11 @@
package com.mosty.wzzx.service;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.entity.wzzx.TbWzRywz;
import io.swagger.annotations.ApiOperation;
public interface TbWzLswzService{
@ApiOperation("保存历史记录")
void saveLswz(LocationInfo locationInfo, TbWzRywz rywz);
}

View File

@ -0,0 +1,11 @@
package com.mosty.wzzx.service;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.entity.wzzx.TbWzSbsswz;
import io.swagger.annotations.ApiOperation;
public interface TbWzSblswzService {
@ApiOperation("保存设备历史位置记录")
void saveSblswz(TbWzSbsswz sbsswz);
}

View File

@ -0,0 +1,14 @@
package com.mosty.wzzx.service;
import com.mosty.base.model.entity.wzzx.TbWzSbsswz;
import com.mosty.wzzx.udp.UdpLzEntity;
import io.swagger.annotations.ApiOperation;
public interface TbWzSbsswzService{
@ApiOperation("删除历史数据")
void delHistory();
@ApiOperation("保存泸州设备实时位置")
TbWzSbsswz saveSbsswz(UdpLzEntity lzEntity);
}

View File

@ -0,0 +1,38 @@
package com.mosty.wzzx.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.entity.wzzx.TbWzRywz;
import com.mosty.base.model.entity.wzzx.TbWzSswz;
import com.mosty.base.model.query.wzzx.TbWzRywzSearchDto;
import com.mosty.base.model.query.wzzx.TbWzSswzSearchDto;
import io.swagger.annotations.ApiOperation;
import java.util.List;
public interface TbWzSswzService {
@ApiOperation("保存实时记录")
void saveSswz(LocationInfo locationInfo, TbWzRywz rywz);
@ApiOperation("添加位置")
TbWzSswz insert(LocationInfo locationInfo);
@ApiOperation("添加位置")
TbWzSswz insertEntity(TbWzSswz sswz);
@ApiOperation("根据ID查询")
TbWzSswz queryById(String id);
@ApiOperation("")
TbWzSswz querySswzNow(String yhid, String jrbh);
@ApiOperation("删除历史数据")
void delHistory();
@ApiOperation("获取时间段类的人员轨迹信息俩表")
IPage<TbWzSswz> getRygjList(TbWzSswzSearchDto dto);
@ApiOperation("查询某一天的人员位置信息")
TbWzRywz getRywz(TbWzRywzSearchDto dto);
}

View File

@ -0,0 +1,47 @@
package com.mosty.wzzx.service;
import com.mosty.base.model.entity.wzzx.TbWzXfwz;
import com.mosty.base.model.dto.wzzx.AppLocationReceiveDto;
import com.mosty.base.model.query.wzzx.TbWzLswzSearchDto;
import com.mosty.base.model.query.wzzx.TbWzSbLswzSearchDto;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* 位置-巡防位置表(TbWzXfwz)表服务接口
*/
public interface TbWzXfwzService {
@ApiOperation("查询所有数据")
List<TbWzXfwz> queryAll();
@ApiOperation("通过ID查询单条数据")
TbWzXfwz queryById(String id);
@ApiOperation("新增数据")
TbWzXfwz insert(TbWzXfwz tbWzXfwz);
@ApiOperation("修改数据")
TbWzXfwz update(TbWzXfwz tbWzXfwz);
@ApiOperation("通过主键删除数据")
boolean deleteById(String id);
@ApiOperation("大屏-地图-轨迹回放")
Object selectTrack(TbWzXfwz tbWzXfwz);
@ApiOperation("历史位置轨迹回放")
Object selectLswz(TbWzLswzSearchDto dto);
@ApiOperation("位置接收")
Boolean locationReceive(AppLocationReceiveDto receiveDto);
@ApiOperation("设备历史位置轨迹回放")
Object selectSbLswz(TbWzSbLswzSearchDto dto);
@ApiOperation("设备历史位置轨迹回放")
Object selectSbLswzMo(TbWzSbLswzSearchDto dto);
}

View File

@ -0,0 +1,55 @@
package com.mosty.wzzx.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.dto.wzzx.WzcxQuery;
import com.mosty.base.model.dto.wzzx.WztjQuery;
import com.mosty.base.model.entity.wzzx.TbWzXfwz;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import java.util.Map;
public interface WztjService {
@ApiOperation("人员位置")
List<Map<String,Object>> rywz(WztjQuery dto);
@ApiOperation("巡组位置")
List<Map<String,Object>> xz(WztjQuery dto);
@ApiOperation("里程数")
List<Map<String,Object>> jrlcs(WztjQuery dto);
@ApiOperation("人数里程巡组整合")
List<Map<String,Object>> rslcxz(WztjQuery dto);
@ApiOperation("位置人数")
List<Map<String,Object>> jrwzrs(WztjQuery dto);
@ApiOperation("巡组位置数")
List<Map<String,Object>> jrxzwzs(WztjQuery dto);
@ApiOperation("人员位置列表")
IPage<Map<String,Object>> rywzlb(WztjQuery dto);
@ApiOperation("报备轨迹查询")
List<Map<String,Object>> bbgjcx(WzcxQuery dto);
@ApiOperation("报备位置查询")
List<Map<String,Object>> bbwzcx(WzcxQuery dto);
@ApiOperation("民警轨迹查询")
List<Map<String,Object>> mjgjcx(WzcxQuery dto);
@ApiOperation("未报备位置查询")
List<Map<String,Object>> wbbwz(WzcxQuery dto);
@ApiOperation("巡组数量统计")
Map<String, Object> xfsltj(String type);
@ApiOperation("人员数量统计")
Map<String, Object> rysltj(String type);
@ApiOperation("设备数量统计")
Map<String, Object> sblswz(String type);
}

View File

@ -0,0 +1,13 @@
package com.mosty.wzzx.service;
import com.mosty.common.core.business.entity.SysUser;
import io.swagger.annotations.ApiOperation;
import java.util.List;
public interface WzzxSysUserService {
@ApiOperation("添加位置")
List<SysUser> queryList();
}

View File

@ -0,0 +1,413 @@
package com.mosty.wzzx.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.base.model.dto.qwzx.TbQwXfbbVo;
import com.mosty.base.model.dto.wzzx.AppLocationReceiveDto;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.dto.yjzl.TbZlxxInsertDto;
import com.mosty.base.model.dto.yjzl.TbZlxxZxrDtoInsertDto;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.base.model.entity.wzzx.TbWzRywz;
import com.mosty.base.model.entity.wzzx.TbWzSswz;
import com.mosty.base.model.entity.wzzx.TbWzXfwz;
import com.mosty.base.model.entity.yjzl.TbYjxx;
import com.mosty.base.model.vo.base.DeptInfoVo;
import com.mosty.base.utils.*;
import com.mosty.common.core.util.http.HttpUtils;
import com.mosty.common.redis.service.RedisService;
import com.mosty.wzzx.mapper.TbWzRywzMapper;
import com.mosty.wzzx.mapper.TbWzXfwzMapper;
import com.mosty.wzzx.remote.TbBaseAdaptRemoteService;
import com.mosty.wzzx.remote.TbQwzxAdaptRemoteService;
import com.mosty.wzzx.remote.TbYjzlAdaptRemoteService;
import com.mosty.wzzx.service.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.C;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@Slf4j
public class LocationInfoServiceImpl extends ServiceImpl<TbWzXfwzMapper, TbWzXfwz> implements LocationInfoService {
private final TbWzRywzMapper tbWzRywzMapper;
private final TbQwXfbbService tbQwXfbbService;
private final TbWzSswzService tbWzSswzService;
private final TbWzLswzService tbWzLswzService;
private final TbSjCyjlService tbSjCyjlService;
private final RedisService redisService;
private final TbBaseAdaptRemoteService tbBaseAdaptRemoteService;
private final TbQwzxAdaptRemoteService tbQwzxAdaptRemoteService;
private final TbYjzlAdaptRemoteService tbYjzlAdaptRemoteService;
public void locationReceive(LocationInfo locationInfo) {
long startTime = System.currentTimeMillis();
long rytime = 0;
long bbtime = 0;
long xftime = 0;
long sswzTime = 0;
long lswzTime = 0;
long xfbbTime = 0;
//经度、纬度为空不接收数据
try {
if (locationInfo.getLng() == null && locationInfo.getLat() == null) {
return;
}
// 绵阳存在问题 后台结束报备以后 app没有更新报备id 一直上传位置
if (StringUtils.isNotEmpty(locationInfo.getBbid()) || !"null".equals(locationInfo.getBbid())) {
int getsfbb = tbQwXfbbService.getsfbb(locationInfo.getBbid());
if (getsfbb < 1) {
locationInfo.setBbid(null);
}
}
if (StringUtils.isBlank(locationInfo.getBbid()) || "null".equals(locationInfo.getBbid())) {
locationInfo.setBbid(null);
locationInfo.setJzid(null);
locationInfo.setJzmc(null);
//保存人员位置
TbWzRywz oldRywz = this.saveRywz(locationInfo);
// 保存实时位置
this.tbWzSswzService.saveSswz(locationInfo, oldRywz);
// 保存历史位置
this.tbWzLswzService.saveLswz(locationInfo, oldRywz);
} else {
String bbid, jzid, jzmc;
String[] bbidList = locationInfo.getBbid().split("\\(__\\)");
String[] jzidList = null;
String[] jzmcList = null;
if (StringUtils.isNoneBlank(locationInfo.getJzid())) {
jzidList = locationInfo.getJzid().split("\\(__\\)");
}
if (StringUtils.isNoneBlank(locationInfo.getJzmc())) {
jzmcList = locationInfo.getJzmc().split("\\(__\\)");
}
for (int i = 0; i < bbidList.length; i++) {
bbid = bbidList[i];
if (jzidList != null) {
jzid = jzidList[i];
locationInfo.setJzid(jzid);
}
if (jzmcList != null) {
jzmc = jzmcList[i];
locationInfo.setJzmc(jzmc);
}
locationInfo.setBbid(bbid);
// 保存人员位置
TbWzRywz oldRywz = this.saveRywz(locationInfo);
rytime = System.currentTimeMillis() - startTime;
//警务通采集经纬度为辅
TbQwXfbb bb = this.tbQwzxAdaptRemoteService.getBbxxInfo(locationInfo.getBbid());
bbtime = System.currentTimeMillis() - startTime;
// 保存巡防位置
Integer lc = this.saveXfwz(bb, locationInfo, oldRywz);
xftime = System.currentTimeMillis() - startTime;
// log.info("TbQwXfbb {}", System.currentTimeMillis() - startTime);
// 查询巡组实时位置,如果5分钟没有GPS信号则保存设备的位置信息 直接判断bb是否在线 在线不添加 不在线 写入数据)
// if (bb.getXfzt().equals("2")) {
// 保存实时位置
tbWzSswzService.saveSswz(locationInfo, oldRywz);
sswzTime = System.currentTimeMillis() - startTime;
// 保存历史位置
tbWzLswzService.saveLswz(locationInfo, oldRywz);
lswzTime = System.currentTimeMillis() - startTime;
// 修改巡防报备的坐标
tbQwXfbbService.updateXfbb(bb, locationInfo, oldRywz, lc);
xfbbTime = System.currentTimeMillis() - startTime;
}
}
long zsc = System.currentTimeMillis() - startTime;
if (zsc > 1000) {
System.out.println("位置服务上报保存时长{" + zsc + "}----保存人员位置{" + rytime + "}---" +
"报备查询{" + bbtime + "}---保存巡防位置{" + xftime + "}-----用户{" + locationInfo.getUserId() + "}----" +
"保存实时位置{" + sswzTime + "}---保存历史位置{" + lswzTime + "}---修改巡防报备的坐标{" + xfbbTime + "}-----用户{" + locationInfo.getUserId() + "}");
}
} catch (Exception e) {
e.printStackTrace();
}
}
// 生成指令信息
private void createdZl(LocationInfo item, TbQwXfbb bb) {
String key = Constant.LZYJ_DATA_QKSD;
List<TbYjxx> yjxxList = this.redisService.getCacheList(key);
if (yjxxList != null && yjxxList.size() > 0) {
// 依图人像(脸)
List<TbYjxx> ytList = yjxxList.stream().filter(yjxx -> {
// 判断相似度大于等于95%
if (yjxx.getXsd() == null) return false;
int a = yjxx.getXsd().compareTo(new BigDecimal("95"));
if (a < 0) return false;
// 预警时间半小时之内
if (new Date().getTime() - yjxx.getYjSj().getTime() > 30 * 60 * 1000) return false;
// 当前位置500米范围内
double jl = Kit.getDistance(item.getLng(), item.getLat(), yjxx.getJd().doubleValue(), yjxx.getWd().doubleValue());
return !(jl >= 500.0);
}).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(ytList)) {
// 发送指令到巡组
this.sendZl(ytList, bb);
}
// 旅店网吧
List<TbYjxx> ldList = yjxxList.stream().filter(yjxx -> {
if (yjxx.getXsd() != null) return false;
// 预警时间两小时之内
if (new Date().getTime() - yjxx.getYjSj().getTime() > 120 * 60 * 1000) return false;
// 当前位置2000米范围内
double jl = Kit.getDistance(item.getLng(), item.getLat(), yjxx.getJd().doubleValue(), yjxx.getWd().doubleValue());
return !(jl >= 2000);
}).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(ldList)) {
// 发送指令到巡组
this.sendZl(ldList, bb);
}
}
}
// 发送指令到巡组
private void sendZl(List<TbYjxx> yjxxList, TbQwXfbb bb) {
if (bb != null) {
yjxxList.forEach(yjxx -> {
TbZlxxInsertDto zl = new TbZlxxInsertDto();
zl.setId(UUIDGenerator.getUUID()).setYwId(yjxx.getId()).setZllx("02").setZlly("02").setZlzxlx("1")
.setZlbt("请核查" + yjxx.getYjBt()).setZlnr(yjxx.getYjNr() + "请核查!")
.setZldj(yjxx.getYjJb()).setJd(yjxx.getJd()).setWd(yjxx.getWd()).setZlfsddxzqh(yjxx.getYjDzXzqh())
.setZlfsdd(yjxx.getYjDz()).setZltp(yjxx.getYjTp());
zl.setZljsdx("03");
zl.setSsbmid(bb.getSsbmid());
List<TbZlxxZxrDtoInsertDto> zxrDtoList = new ArrayList<>();
TbZlxxZxrDtoInsertDto zxr = new TbZlxxZxrDtoInsertDto();
zxr.setZlId(zl.getId()).setZxrLx("03").setZxrXzid(bb.getId());
zxrDtoList.add(zxr);
yjxx.setBz("范围内500米查询到巡组《" + bb.getJzMc() + "》,已下发");
zl.setZxrDtoList(zxrDtoList);
this.tbYjzlAdaptRemoteService.addZl(zl);
// 修改预警信息相关信息
this.tbYjzlAdaptRemoteService.updateYjxxSffszl(yjxx.getId());
});
}
}
public TbWzRywz saveRywz(LocationInfo locationInfo) {
BigDecimal jd = BigDecimal.valueOf(locationInfo.getLng());
BigDecimal wd = BigDecimal.valueOf(locationInfo.getLat());
String redisKey = Constant.WZ_RYWZ + locationInfo.getUserId() + "-"
+ DateUtils.getQueryDateString(new Date(), "01");
TbWzRywz rywz = redisService.getCacheObject(redisKey);
// TbWzRywz oldRywz = redisService.getCacheObject(redisKey);
if (rywz == null) {
rywz = new TbWzRywz();
}
rywz.setYhId(locationInfo.getYhid());
rywz.setYhXm(locationInfo.getUserName());
rywz.setYhSfzh(locationInfo.getUserId());
List<BigDecimal[]> list = rywz.getZbList();
if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>();
}
Date oldTime = null;
if (locationInfo.getLastTime() != null) {
oldTime = locationInfo.getLastTime();
}
Integer lc = DistanceUtils.getLc(rywz.getLc(), rywz.getJd(), rywz.getWd(), jd, wd);
Integer sc = DistanceUtils.getSc(oldTime);
BigDecimal[] decimals = new BigDecimal[2];
decimals[0] = jd;
decimals[1] = wd;
list.add(decimals);
if (list.size() == 1) {
list.add(decimals);
}
if (list.size() >= 3) {
BigDecimal[] decimal0 = list.get(0);
BigDecimal[] decimal1 = list.get(1);
if (decimal0 == decimal1) {
list.remove(0);
}
}
rywz.setLc(lc);
rywz.setSc(sc);
rywz.setZb(JtsUtils.createLine(list));
rywz.setZbsl(list.size());
rywz.setJd(jd);
rywz.setWd(wd);
rywz.setXtSjly("1");
if (StringUtils.isBlank(rywz.getSsbm())) {
DeptInfoVo dept = this.tbBaseAdaptRemoteService.getOrgByDeptId(locationInfo.getDeptId());
if (dept != null) {
rywz.setSsbm(dept.getDeptname());
rywz.setSsbmdm(dept.getDeptcode());
rywz.setSsbmid(dept.getDeptid());
rywz.setSsxgaj(dept.getFxjname());
rywz.setSsxgajid(dept.getFxjid());
rywz.setSsxgajdm(dept.getFxjcode());
rywz.setSssgajid(dept.getDszid());
rywz.setSssgaj(dept.getDszname());
rywz.setSssgajdm(dept.getDszcode());
}
}
if (StringUtils.isBlank(rywz.getId())) {
rywz.setKssj(new Date());
rywz.setDwrq(new Date());
tbWzRywzMapper.insertEntity(rywz);
} else {
tbWzRywzMapper.updateEntity(rywz);
}
rywz.setZb(null);
rywz.setZbList(list);
redisService.setCacheObject(redisKey, rywz);
return rywz;
}
public Integer saveXfwz(TbQwXfbb bb, LocationInfo locationInfo, TbWzRywz rywz) {
if (ObjectUtils.isEmpty(locationInfo) && ObjectUtils.isEmpty(rywz) && ObjectUtils.isEmpty(rywz.getJd()))
return 0;
String redisKey = Constant.WZ_XFWZ + locationInfo.getBbid();
//直接去redis存在问题 20240307
TbWzXfwz xfwz = redisService.getCacheObject(redisKey);
Integer lc = 0;
// TbWzXfwz xfwz = this.baseMapper.queryByBbid(locationInfo.getBbid());
if (ObjectUtils.isEmpty(xfwz)) {
xfwz = new TbWzXfwz();
}
// else {
// List<BigDecimal[]> list = JtsUtils.getz(xfwz.getZb());
// if (CollectionUtils.isEmpty(list)) {
// list = new ArrayList<>();
// }
// if (list.size() >= 3) {
// BigDecimal[] decimal0 = list.get(0);
// BigDecimal[] decimal1 = list.get(1);
// if (decimal0 == decimal1) {
// list.remove(0);
// }
// }
// xfwz.setZb(null);
// xfwz.setZbList(list);
//
// }
// 查询位置人员是否为改报备巡组的报备人员,
// 如果是则直接添加修改位置
// 查询巡防位置
// TbQwXfbb bb = this.tbQwzxAdaptRemoteService.getBbxxInfo(locationInfo.getBbid());
boolean flag = false;
if ((bb != null && bb.getFzrSfzh().equals(locationInfo.getUserId()))) {
// 是报备负责人
flag = true;
} else {
// 如果redis中没得数据则直接添加数据
if (xfwz.getKssj() == null) {
flag = true;
} else {
// 不是报备本人。需要判断之前的时间是否超过5分钟超过就更新位置数据不超过
// 就不需要更新
Date kssj = xfwz.getKssj();
if (new Date().getTime() - kssj.getTime() > 5 * 60 * 1000) {
flag = true;
}
}
}
if (flag) {
BigDecimal jd = BigDecimal.valueOf(locationInfo.getLng());
BigDecimal wd = BigDecimal.valueOf(locationInfo.getLat());
lc = DistanceUtils.getLc(bb.getXflc(), xfwz.getJd(), xfwz.getWd(), jd, wd);
xfwz.setBbId(locationInfo.getBbid());
xfwz.setYhId(locationInfo.getYhid());
xfwz.setYhSfzh(locationInfo.getUserId());
xfwz.setYhXm(locationInfo.getUserName());
xfwz.setJzId(locationInfo.getJzid());
xfwz.setJzMc(locationInfo.getJzmc());
xfwz.setSc(rywz.getSc());
xfwz.setLc(rywz.getLc());
List<BigDecimal[]> list = new ArrayList<>();
if (!CollectionUtils.isEmpty(xfwz.getZbList())) {
list = xfwz.getZbList();
}
BigDecimal[] decimals = new BigDecimal[2];
decimals[0] = jd;
decimals[1] = wd;
list.add(decimals);
if (list.size() == 1) {
list.add(decimals);
}
if (list.size() >= 3) {
BigDecimal[] decimal0 = list.get(0);
BigDecimal[] decimal1 = list.get(1);
if (decimal0 == decimal1) {
list.remove(0);
}
}
xfwz.setZb(JtsUtils.createLine(list));
xfwz.setZbsl(list.size());
xfwz.setDwrq(new Date());
xfwz.setKssj(new Date());
xfwz.setJd(jd);
xfwz.setWd(wd);
xfwz.setZhgxsj(new Date());
xfwz.setXtSjly("1");
if (ObjectUtils.isNotEmpty(rywz)) {
xfwz.setSsbm(rywz.getSsbm());
xfwz.setSsbmdm(rywz.getSsbmdm());
xfwz.setSsbmid(rywz.getSsbmid());
xfwz.setSsxgaj(rywz.getSsxgaj());
xfwz.setSsxgajid(rywz.getSsxgajid());
xfwz.setSsxgajdm(rywz.getSsxgajdm());
xfwz.setSssgajid(rywz.getSssgajid());
xfwz.setSssgaj(rywz.getSssgaj());
xfwz.setSssgajdm(rywz.getSssgajdm());
} else {
DeptInfoVo dept = this.tbBaseAdaptRemoteService.getOrgByDeptId(locationInfo.getDeptId());
if (dept != null) {
xfwz.setSsbm(dept.getDeptname());
xfwz.setSsbmdm(dept.getDeptcode());
xfwz.setSsbmid(dept.getDeptid());
xfwz.setSsxgaj(dept.getFxjname());
xfwz.setSsxgajid(dept.getFxjid());
xfwz.setSsxgajdm(dept.getFxjcode());
xfwz.setSssgajid(dept.getDszid());
xfwz.setSssgaj(dept.getDszname());
xfwz.setSssgajdm(dept.getDszcode());
}
}
xfwz.setZxzt("1");
if (StringUtils.isBlank(xfwz.getId())) {
xfwz.setId(UUIDGenerator.getUUID());
this.baseMapper.insert(xfwz);
} else {
this.baseMapper.update(xfwz);
}
xfwz.setZb(null);
xfwz.setZbList(list);
redisService.setCacheObject(redisKey, xfwz);
}
return lc;
}
}

View File

@ -0,0 +1,207 @@
package com.mosty.wzzx.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.base.model.dto.websocket.WebSocketObject;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.dto.wzzx.XfbbUpdateDto;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.base.model.entity.wzzx.TbWzLswz;
import com.mosty.base.model.entity.wzzx.TbWzRywz;
import com.mosty.base.model.entity.wzzx.TbWzSbsswz;
import com.mosty.base.model.vo.yjzl.TbFzJlVo;
import com.mosty.base.utils.DistanceUtils;
import com.mosty.base.utils.GeoHashKit;
import com.mosty.base.utils.JtsUtils;
import com.mosty.base.utils.UUIDGenerator;
import com.mosty.common.core.business.entity.SysUser;
import com.mosty.common.core.util.http.HttpUtils;
import com.mosty.wzzx.mapper.TbQwXfbbMapper;
import com.mosty.wzzx.mapper.TbWzLswzMapper;
import com.mosty.wzzx.remote.TbBaseAdaptRemoteService;
import com.mosty.wzzx.remote.TbQwzxAdaptRemoteService;
import com.mosty.wzzx.remote.TbWebSocketAdaptRemoteService;
import com.mosty.wzzx.remote.TbYjzlAdaptRemoteService;
import com.mosty.wzzx.service.TbQwXfbbService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Service
@RequiredArgsConstructor
public class TbQwXfbbServiceImpl extends ServiceImpl<TbQwXfbbMapper, TbQwXfbb> implements TbQwXfbbService {
@Resource
private TbBaseAdaptRemoteService tbBaseAdaptRemoteService;
@Resource
private TbQwzxAdaptRemoteService tbQwzxAdaptRemoteService;
@Resource
private TbWebSocketAdaptRemoteService tbWebSocketAdaptRemoteService;
@Resource
private TbYjzlAdaptRemoteService tbYjzlAdaptRemoteService;
@Resource
private TbWzLswzMapper tbWzLswzMapper;
public Integer updateXfbb(TbQwXfbb xfbb, LocationInfo locationInfo, TbWzRywz oldRywz, Integer lc) {
if (StringUtils.isBlank(locationInfo.getBbid())) {
return 0;
}
XfbbUpdateDto dto = new XfbbUpdateDto();
BigDecimal jd = BigDecimal.valueOf(locationInfo.getLng());
BigDecimal wd = BigDecimal.valueOf(locationInfo.getLat());
dto.setId(locationInfo.getBbid());
dto.setJd(jd);
dto.setWd(wd);
dto.setZb(JtsUtils.getPoint(jd, wd));
dto.setZbhash(GeoHashKit.encode(jd, wd));
//计算位置
dto.setDqwz(locationInfo.getAddress());
dto.setZbsj(new Date());
//计算巡防里程
// Integer lc = DistanceUtils.getLc(xfbb.getXflc(), xfbb.getJd(), xfbb.getWd(), jd, wd);
dto.setXflc(lc);
dto.setXfzt("0");
// dto.setXfsc(oldRywz.getSc());
this.baseMapper.updateXfbb(dto);
// 推送位置信息给前端
// TbQwXfbb xfbb = this.tbQwzxAdaptRemoteService.getBbxxInfo(locationInfo.getBbid());
if (xfbb != null) {
xfbb.setZb(null);
xfbb.setXfzt("0");
if (StringUtils.isNotBlank(xfbb.getFzrSfzh())) {
SysUser user1 = this.tbBaseAdaptRemoteService.getUserInfoBySfzh(xfbb.getFzrSfzh());
xfbb.setLx(user1.getType());
}
WebSocketObject obj = new WebSocketObject("04", xfbb, null);
this.tbWebSocketAdaptRemoteService.sendBbMessage(obj);
}
new Thread(new Runnable() {
@Override
public void run() {
long startTime = System.currentTimeMillis();
TbFzJlVo vo = new TbFzJlVo();
BeanUtils.copyProperties(xfbb, vo);
String xzmc = xfbb.getJzMc();
if (StringUtils.isEmpty(xzmc)) {
xzmc = xfbb.getFzrXm() + "警组";
}
vo.setBbid(xfbb.getId());
vo.setXzmc(xzmc);
vo.setJd(jd);
vo.setWd(wd);
tbYjzlAdaptRemoteService.addBySbwz(vo);
System.out.println("犯罪线程结束----->"+(System.currentTimeMillis() - startTime));
}
}).start();
return 1;
}
@Override
public void updateXfbbUdp(TbQwXfbb bb, TbWzSbsswz sbsswz, Integer lc) {
XfbbUpdateDto dto = new XfbbUpdateDto();
BigDecimal jd = sbsswz.getJd();
BigDecimal wd = sbsswz.getWd();
dto.setId(bb.getId());
dto.setJd(jd);
dto.setWd(wd);
dto.setZb(JtsUtils.getPoint(jd, wd));
dto.setZbhash(GeoHashKit.encode(jd, wd));
dto.setZbsj(new Date());
dto.setXflc(lc);
dto.setXfzt("0");
// 保存犯罪数据
bb.setZb(null);
TbFzJlVo vo = new TbFzJlVo();
BeanUtils.copyProperties(vo, bb);
String xzmc = bb.getJzMc();
if (StringUtils.isEmpty(xzmc)) {
xzmc = bb.getFzrXm() + "警组";
}
vo.setBbid(bb.getId());
vo.setXzmc(xzmc);
vo.setJd(jd);
vo.setWd(wd);
this.tbYjzlAdaptRemoteService.addBySbwz(vo);
this.baseMapper.updateXfbb(dto);
TbWzLswz lswz = new TbWzLswz();
lswz.setId(UUIDGenerator.getUUID());
lswz.setSjly("UDP推送" + sbsswz.getSbmc());
lswz.setSjlydm("01");
lswz.setYwid(bb.getId());
lswz.setYhId(bb.getFzrId());
lswz.setYhXm(bb.getFzrXm());
lswz.setYhSfzh(bb.getFzrSfzh());
lswz.setJzId(bb.getJzId());
lswz.setJzMc(bb.getJzMc());
lswz.setDwrq(new Date());
lswz.setDwsj(new Date());
lswz.setJd(jd);
lswz.setWd(wd);
lswz.setZb(JtsUtils.getPoint(jd, wd));
lswz.setZbhash(GeoHashKit.encode(jd, wd));
lswz.setWztgz("01");
lswz.setSsbm(bb.getSsbm());
lswz.setSsbmdm(bb.getSsbmdm());
lswz.setSsbmid(bb.getSsbmid());
lswz.setSsxgaj(bb.getSsxgaj());
lswz.setSsxgajid(bb.getSsxgajid());
lswz.setSsxgajdm(bb.getSsxgajdm());
lswz.setSssgajid(bb.getSssgajid());
lswz.setSssgaj(bb.getSssgaj());
lswz.setSssgajdm(bb.getSssgajdm());
lswz.setDwbz("UDP");
lswz.setDzxz(sbsswz.getDzxz());
this.tbWzLswzMapper.insertEntity(lswz);
// 推送位置信息给前端
TbQwXfbb xfbb = this.tbQwzxAdaptRemoteService.getBbxxInfo(bb.getId());
if (xfbb != null) {
xfbb.setZb(null);
xfbb.setXfzt("0");
if (StringUtils.isNotBlank(xfbb.getFzrSfzh())) {
SysUser user1 = this.tbBaseAdaptRemoteService.getUserInfoBySfzh(xfbb.getFzrSfzh());
xfbb.setLx(user1.getType());
}
WebSocketObject obj = new WebSocketObject("04", xfbb, null);
this.tbWebSocketAdaptRemoteService.sendBbMessage(obj);
}
}
@Override
public int getsfbb(String id) {
return this.baseMapper.getsfbb(id);
}
public Integer updateById(String id, LocationInfo locationInfo) {
TbQwXfbb xfbb = this.baseMapper.queryById(id);
if (xfbb == null) {
return 0;
}
XfbbUpdateDto dto = new XfbbUpdateDto();
BigDecimal jd = BigDecimal.valueOf(locationInfo.getLng());
BigDecimal wd = BigDecimal.valueOf(locationInfo.getLat());
Integer lc = DistanceUtils.getLc(xfbb.getXflc(), xfbb.getJd(), xfbb.getWd(), jd, wd);
Integer sc = DistanceUtils.getSc(xfbb.getBbkssj());
dto.setId(xfbb.getId());
dto.setJd(jd);
dto.setWd(wd);
dto.setZb(JtsUtils.getPoint(jd, wd));
dto.setZbhash(GeoHashKit.encode(jd, wd));
dto.setZbsj(new Date());
dto.setXflc(lc);
// dto.setXfsc(sc);
return this.baseMapper.updateXfbb(dto);
}
}

View File

@ -0,0 +1,21 @@
package com.mosty.wzzx.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.base.model.entity.qwzx.TbQwZnzb;
import com.mosty.wzzx.mapper.TbQwZnzbMapper;
import com.mosty.wzzx.service.TbQwZnzbService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
@RequiredArgsConstructor
public class TbQwZnzbServiceImpl extends ServiceImpl<TbQwZnzbMapper, TbQwZnzb> implements TbQwZnzbService {
public List<TbQwZnzb> queryListByYwid(List<String> ywidList) {
return this.baseMapper.queryListByYwid(ywidList);
}
}

View File

@ -0,0 +1,52 @@
package com.mosty.wzzx.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.dto.wzzx.SjCyjlUpdateDto;
import com.mosty.base.model.entity.sjzx.TbSjCyjl;
import com.mosty.base.utils.GeoHashKit;
import com.mosty.base.utils.JtsUtils;
import com.mosty.wzzx.mapper.TbSjCyjlMapper;
import com.mosty.wzzx.remote.TbBaseAdaptRemoteService;
import com.mosty.wzzx.service.TbSjCyjlService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
@Service
@RequiredArgsConstructor
public class TbSjCyjlServiceImpl extends ServiceImpl<TbSjCyjlMapper, TbSjCyjl> implements TbSjCyjlService {
@Resource
private TbBaseAdaptRemoteService tbBaseAdaptRemoteService;
public Integer updateJlZb(LocationInfo locationInfo) {
if (StringUtils.isBlank(locationInfo.getUserId())) {
return 0;
}
TbSjCyjl cyjl = this.baseMapper.queryBySfzh(locationInfo.getUserId());
if (cyjl != null) {
SjCyjlUpdateDto dto = new SjCyjlUpdateDto();
BigDecimal jd = BigDecimal.valueOf(locationInfo.getLng());
BigDecimal wd = BigDecimal.valueOf(locationInfo.getLat());
dto.setId(cyjl.getId());
dto.setJd(jd);
dto.setWd(wd);
JSONObject json = this.tbBaseAdaptRemoteService.getAddress(jd.toString(),wd.toString());
if(json != null){
dto.setDqwz(json.getString("address"));
}
dto.setZb(JtsUtils.getPoint(jd, wd));
dto.setZbhash(GeoHashKit.encode(jd, wd));
dto.setZbsj(new Date());
return this.baseMapper.updateZb(dto);
}
return 0;
}
}

View File

@ -0,0 +1,114 @@
package com.mosty.wzzx.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.entity.wzzx.TbWzLswz;
import com.mosty.base.model.entity.wzzx.TbWzRywz;
import com.mosty.base.model.entity.wzzx.TbWzSswz;
import com.mosty.base.model.vo.base.DeptInfoVo;
import com.mosty.base.utils.DistanceUtils;
import com.mosty.base.utils.GeoHashKit;
import com.mosty.base.utils.JtsUtils;
import com.mosty.base.utils.UUIDGenerator;
import com.mosty.wzzx.mapper.TbWzLswzMapper;
import com.mosty.wzzx.mapper.TbWzSswzMapper;
import com.mosty.wzzx.remote.TbBaseAdaptRemoteService;
import com.mosty.wzzx.service.TbWzLswzService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import sun.util.resources.sq.LocaleNames_sq;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Date;
@Service
@RequiredArgsConstructor
public class TbWzLswzServiceImpl extends ServiceImpl<TbWzSswzMapper, TbWzSswz> implements TbWzLswzService {
private final TbWzLswzMapper tbWzLswzMapper;
private final TbBaseAdaptRemoteService tbBaseAdaptRemoteService;
public void saveLswz(LocationInfo locationInfo, TbWzRywz oldRywz) {
BigDecimal jd = BigDecimal.valueOf(locationInfo.getLng());
BigDecimal wd = BigDecimal.valueOf(locationInfo.getLat());
BigDecimal oldJd = null;
BigDecimal oldWd = null;
Date oldTime = null;
if (oldRywz != null) {
oldJd = oldRywz.getJd();
oldWd = oldRywz.getWd();
// oldTime = oldRywz.getJssj();
}
if (locationInfo.getLastTime() != null) {
oldTime = locationInfo.getLastTime();
}
TbWzLswz lswz = new TbWzLswz();
Integer lc = DistanceUtils.getLc(0, oldJd, oldWd, jd, wd);
Integer sc = DistanceUtils.getSc(oldTime);
String sjly = "移动设备";
if (StringUtils.isNotBlank(locationInfo.getUserName())) {
sjly = sjly + "-" + locationInfo.getUserName();
}
if (StringUtils.isNotBlank(locationInfo.getUserId())) {
sjly = sjly + "-" + locationInfo.getUserId();
}
lswz.setSjly(sjly);
lswz.setSjlydm("02");
lswz.setYwid(locationInfo.getBbid());
lswz.setJzId(locationInfo.getJzid());
lswz.setJzMc(locationInfo.getJzmc());
lswz.setDwrq(new Date());
lswz.setDwsj(new Date());
lswz.setJd(jd);
lswz.setWd(wd);
lswz.setXfsc(sc);
lswz.setXflc(lc);
lswz.setZb(JtsUtils.getPoint(jd, wd));
lswz.setZbhash(GeoHashKit.encode(jd, wd));
lswz.setYhId(locationInfo.getYhid());
lswz.setYhXm(locationInfo.getUserName());
lswz.setYhSfzh(locationInfo.getUserId());
lswz.setWztgz("02");//综合定位
lswz.setXtSjly("1");
if (ObjectUtils.isNotEmpty(oldRywz)) {
lswz.setSsbm(oldRywz.getSsbm());
lswz.setSsbmdm(oldRywz.getSsbmdm());
lswz.setSsbmid(oldRywz.getSsbmid());
lswz.setSsxgaj(oldRywz.getSsxgaj());
lswz.setSsxgajid(oldRywz.getSsxgajid());
lswz.setSsxgajdm(oldRywz.getSsxgajdm());
lswz.setSssgajid(oldRywz.getSssgajid());
lswz.setSssgaj(oldRywz.getSssgaj());
lswz.setSssgajdm(oldRywz.getSssgajdm());
} else {
DeptInfoVo dept = this.tbBaseAdaptRemoteService.getOrgByDeptId(locationInfo.getDeptId());
if (dept != null) {
lswz.setSsbm(dept.getDeptname());
lswz.setSsbmdm(dept.getDeptcode());
lswz.setSsbmid(dept.getDeptid());
lswz.setSsxgaj(dept.getFxjname());
lswz.setSsxgajid(dept.getFxjid());
lswz.setSsxgajdm(dept.getFxjcode());
lswz.setSssgajid(dept.getDszid());
lswz.setSssgaj(dept.getDszname());
lswz.setSssgajdm(dept.getDszcode());
}
}
lswz.setGuo(locationInfo.getCountry());
lswz.setSheng(locationInfo.getProvinc());
lswz.setShi(locationInfo.getCity());
lswz.setCsbm(locationInfo.getCityCode());
lswz.setSsqx(locationInfo.getDistrict());
lswz.setQxbm(locationInfo.getAdCode());
lswz.setDzxz(locationInfo.getAddress());
lswz.setDzjc(locationInfo.getPoiName());
lswz.setDwbz(locationInfo.getZbly());
tbWzLswzMapper.insertEntity(lswz);
}
}

View File

@ -0,0 +1,47 @@
package com.mosty.wzzx.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.entity.wzzx.TbWzLswz;
import com.mosty.base.model.entity.wzzx.TbWzSblswz;
import com.mosty.base.model.entity.wzzx.TbWzSbsswz;
import com.mosty.base.utils.GeoHashKit;
import com.mosty.base.utils.JtsUtils;
import com.mosty.base.utils.UUIDGenerator;
import com.mosty.wzzx.mapper.TbWzSblswzMapper;
import com.mosty.wzzx.mongodb.TbWzSblswzMongoService;
import com.mosty.wzzx.mongodb.entity.TbWzSblswzMo;
import com.mosty.wzzx.remote.TbBaseAdaptRemoteService;
import com.mosty.wzzx.service.TbWzSblswzService;
import com.mosty.wzzx.service.TbWzSbsswzService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.sql.Timestamp;
@Service
public class TbWzSblswzServiceImpl extends ServiceImpl<TbWzSblswzMapper, TbWzSblswz>
implements TbWzSblswzService {
@Resource
private TbWzSblswzMongoService tbWzSblswzMongoService;
public void saveSblswz(TbWzSbsswz sbsswz) {
if (ObjectUtils.isNotEmpty(sbsswz)) {
TbWzSblswz wz = new TbWzSblswz();
BeanUtils.copyProperties(sbsswz, wz);
wz.setZb(JtsUtils.getPoint(wz.getJd(), wz.getWd()));
this.baseMapper.insertEntity(wz);
TbWzSblswzMo mo = new TbWzSblswzMo();
BeanUtils.copyProperties(wz, mo);
this.tbWzSblswzMongoService.save(mo);
}
}
}

View File

@ -0,0 +1,244 @@
package com.mosty.wzzx.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.base.model.entity.wzzx.TbWzRywz;
import com.mosty.base.model.entity.wzzx.TbWzSbsswz;
import com.mosty.base.model.entity.wzzx.TbWzXfwz;
import com.mosty.base.model.vo.base.DeptInfoVo;
import com.mosty.base.model.vo.jcgl.TbJcglSbdwVo;
import com.mosty.base.model.vo.yjzl.TbFzJlVo;
import com.mosty.base.model.vo.yjzl.TbFzycPzVo;
import com.mosty.base.utils.*;
import com.mosty.common.core.util.http.HttpUtils;
import com.mosty.common.redis.service.RedisService;
import com.mosty.wzzx.mapper.TbWzSbsswzMapper;
import com.mosty.wzzx.mapper.TbWzXfwzMapper;
import com.mosty.wzzx.remote.TbBaseAdaptRemoteService;
import com.mosty.wzzx.remote.TbQwzxAdaptRemoteService;
import com.mosty.wzzx.remote.TbWebSocketAdaptRemoteService;
import com.mosty.wzzx.remote.TbYjzlAdaptRemoteService;
import com.mosty.wzzx.service.TbQwXfbbService;
import com.mosty.wzzx.service.TbWzSbsswzService;
import com.mosty.wzzx.udp.UdpLzEntity;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.*;
@Service
@RequiredArgsConstructor
public class TbWzSbsswzServiceImpl extends ServiceImpl<TbWzSbsswzMapper, TbWzSbsswz> implements TbWzSbsswzService {
private final RedisService redisService;
private final TbQwzxAdaptRemoteService tbQwzxAdaptRemoteService;
private final TbWzXfwzMapper tbWzXfwzMapper;
private final TbYjzlAdaptRemoteService tbYjzlAdaptRemoteService;
private final TbQwXfbbService tbQwXfbbService;
// 查询巡组实时位置,如果5分钟没有GPS信号则保存设备的位置信息
private void saveXzwz(TbQwXfbb bb, TbWzSbsswz sbsswz) {
String redisKey = Constant.WZ_XFWZ + sbsswz.getYwid();
TbWzXfwz xfwz = redisService.getCacheObject(redisKey);
// TbWzXfwz xfwz = this.tbWzXfwzMapper.queryByBbid(bb.getId());
if (ObjectUtils.isNotEmpty(xfwz)) {
Integer lc = DistanceUtils.getLc(bb.getXflc(), xfwz.getJd(), xfwz.getWd(), sbsswz.getJd(), sbsswz.getWd());
List<BigDecimal[]> list = xfwz.getZbList();
// if (sbsswz.getDwsj().getTime() - xfwz.getZhgxsj().getTime() >= 5 * 60 * 1000) {
xfwz.setJd(sbsswz.getJd());
xfwz.setWd(sbsswz.getWd());
xfwz.setZhgxsj(new Date());
if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>();
}
BigDecimal[] decimals = new BigDecimal[2];
decimals[0] = sbsswz.getJd();
decimals[1] = sbsswz.getWd();
list.add(decimals);
if (list.size() == 1) {
list.add(decimals);
}
if (list.size() >= 3) {
BigDecimal[] decimal0 = list.get(0);
BigDecimal[] decimal1 = list.get(1);
if (decimal0 == decimal1) {
list.remove(0);
}
}
xfwz.setZb(JtsUtils.createLine(list));
xfwz.setZbsl(list.size());
xfwz.setZbList(list);
xfwz.setZxzt("1");
this.tbWzXfwzMapper.update(xfwz);
xfwz.setZb(null);
//修改数据 报备数据
this.tbQwXfbbService.updateXfbbUdp(bb, sbsswz, lc);
redisService.setCacheObject(redisKey, xfwz);
// }
} else {
xfwz = new TbWzXfwz();
xfwz.setJd(sbsswz.getJd());
xfwz.setWd(sbsswz.getWd());
xfwz.setZhgxsj(new Date());
List<BigDecimal[]> list = new ArrayList<>();
BigDecimal[] decimals = new BigDecimal[2];
decimals[0] = sbsswz.getJd();
decimals[1] = sbsswz.getWd();
list.add(decimals);
if (list.size() == 1) {
list.add(decimals);
}
if (list.size() >= 3) {
BigDecimal[] decimal0 = list.get(0);
BigDecimal[] decimal1 = list.get(1);
if (decimal0 == decimal1) {
list.remove(0);
}
}
xfwz.setZb(JtsUtils.createLine(list));
xfwz.setZbsl(list.size());
xfwz.setZxzt("1");
xfwz.setZbList(list);
xfwz.setBbId(bb.getId());
xfwz.setYhId(bb.getFzrId());
xfwz.setYhSfzh(bb.getFzrSfzh());
xfwz.setYhXm(bb.getFzrXm());
xfwz.setJzId(bb.getJzId());
xfwz.setJzMc(bb.getJzId());
xfwz.setId(UUIDGenerator.getUUID());
xfwz.setZbsl(list.size());
xfwz.setDwrq(new Date());
xfwz.setKssj(new Date());
xfwz.setXtSjly("1");
xfwz.setSsbm(bb.getSsbm());
xfwz.setSsbmdm(bb.getSsbmdm());
xfwz.setSsbmid(bb.getSsbmid());
xfwz.setSsxgaj(bb.getSsxgaj());
xfwz.setSsxgajid(bb.getSsxgajid());
xfwz.setSsxgajdm(bb.getSsxgajdm());
xfwz.setSssgajid(bb.getSssgajid());
xfwz.setSssgaj(bb.getSssgaj());
xfwz.setSssgajdm(bb.getSssgajdm());
this.tbWzXfwzMapper.insert(xfwz);
xfwz.setZb(null);
//修改数据 报备数据
this.tbQwXfbbService.updateXfbbUdp(bb, sbsswz, 0);
redisService.setCacheObject(redisKey, xfwz);
}
}
@Override
public TbWzSbsswz saveSbsswz(UdpLzEntity lzEntity) {
TbJcglSbdwVo sbdwVo = redisService.getCacheObject(Constant.PGIS_SB + lzEntity.getPgisId());
//udp数量太多 如果设备里面没有数据 udp数据就先不保存
if (ObjectUtils.isNotEmpty(sbdwVo)) {
String redisKey = Constant.WZ_SBWZ + lzEntity.getPgisId() + "-" +
DateUtils.getQueryDateString(new Date(), "01");
BigDecimal jd = BigDecimal.valueOf(lzEntity.getLng());
BigDecimal wd = BigDecimal.valueOf(lzEntity.getLat());
TbWzSbsswz oldSbsswz = redisService.getCacheObject(redisKey);
BigDecimal oldJd = null;
BigDecimal oldWd = null;
Timestamp oldTime = null;
if (oldSbsswz != null) {
oldJd = oldSbsswz.getJd();
oldWd = oldSbsswz.getWd();
oldTime = new Timestamp(oldSbsswz.getDwsj().getTime());
}
TbWzSbsswz sbsswz = new TbWzSbsswz();
Integer lc = DistanceUtils.getLc(0, oldJd, oldWd, jd, wd);
Integer sc = DistanceUtils.getSc(oldTime);
sbsswz.setSbid(lzEntity.getPgisId());
sbsswz.setSbmc("LZ-" + lzEntity.getPgisId());
sbsswz.setSjly("UDP推送位置信息");
sbsswz.setSjlydm("86");
sbsswz.setDwrq(lzEntity.getTime());
sbsswz.setDwsj(lzEntity.getTime());
sbsswz.setJd(jd);
sbsswz.setWd(wd);
sbsswz.setXfsc(sc);
sbsswz.setXflc(lc);
sbsswz.setZb(JtsUtils.getPoint(jd, wd));
sbsswz.setZbhash(GeoHashKit.encode(jd, wd));
sbsswz.setWztgz("03");
sbsswz.setXtSjly("1");
sbsswz.setDwbz("03");
sbsswz.setSsbm("四川省德阳市公安局");
sbsswz.setSsbmdm("510600000000");
sbsswz.setSsbmid("44015");
sbsswz.setSsxgaj("四川省德阳市公安局");
sbsswz.setSsxgajid("44015");
sbsswz.setSsxgajdm("510600000000");
sbsswz.setSssgajid("44015");
sbsswz.setSssgaj("四川省德阳市公安局");
sbsswz.setSssgajdm("510600000000");
List<TbQwXfbb> bbList = new ArrayList<>();
if (ObjectUtils.isNotEmpty(sbdwVo)) {
sbsswz.setSbmc(sbdwVo.getSbmc());
sbsswz.setSjlydm(sbdwVo.getScode());
sbsswz.setSsbm(sbdwVo.getSsbm());
sbsswz.setSsbmdm(sbdwVo.getSsbmdm());
sbsswz.setSsbmid(sbdwVo.getSsbmid());
sbsswz.setSsxgaj(sbdwVo.getSsxgaj());
sbsswz.setSsxgajid(sbdwVo.getSsxgajid());
sbsswz.setSsxgajdm(sbdwVo.getSsxgajdm());
sbsswz.setSssgajid(sbdwVo.getSssgajid());
sbsswz.setSssgaj(sbdwVo.getSssgaj());
sbsswz.setSssgajdm(sbdwVo.getSssgajdm());
}
// 查询是否有该设备的报备信息
if (StringUtils.isNotEmpty(sbsswz.getSjlydm()) && sbsswz.getSjlydm().equals("05")) {
bbList = this.tbQwzxAdaptRemoteService.getClBbList(lzEntity.getPgisId());
} else {
bbList = this.tbQwzxAdaptRemoteService.getBbList(lzEntity.getPgisId());
}
if (!CollectionUtils.isEmpty(bbList)) {
for (TbQwXfbb bb : bbList) {
// TbQwXfbb bb = bbList.get(0);
sbsswz.setYhId(bb.getFzrId());
sbsswz.setYhXm(bb.getFzrXm());
sbsswz.setYhSfzh(bb.getFzrSfzh());
sbsswz.setJzId(bb.getJzId());
sbsswz.setJzMc(bb.getJzMc());
sbsswz.setYwid(bb.getId());
sbsswz.setSsbm(bb.getSsbm());
sbsswz.setSsbmdm(bb.getSsbmdm());
sbsswz.setSsbmid(bb.getSsbmid());
sbsswz.setSssgaj(bb.getSssgaj());
sbsswz.setSssgajdm(bb.getSssgajdm());
sbsswz.setSssgajid(bb.getSssgajid());
// 查询巡组实时位置,如果5分钟没有GPS信号则保存设备的位置信息 直接判断bb是否在线 在线不添加 不在线 写入数据)
if (bb.getXfzt().equals("2")) {
this.saveXzwz(bb, sbsswz);
}
}
}
this.baseMapper.insertEntity(sbsswz);
sbsswz.setZb(null);
redisService.setCacheObject(redisKey, sbsswz);
return sbsswz;
}
return null;
}
public void delHistory() {
this.baseMapper.delHistory();
}
}

View File

@ -0,0 +1,228 @@
package com.mosty.wzzx.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.entity.wzzx.TbWzLswz;
import com.mosty.base.model.entity.wzzx.TbWzRywz;
import com.mosty.base.model.entity.wzzx.TbWzSswz;
import com.mosty.base.model.query.wzzx.TbWzRywzSearchDto;
import com.mosty.base.model.query.wzzx.TbWzSswzSearchDto;
import com.mosty.base.model.vo.base.DeptInfoVo;
import com.mosty.base.utils.*;
import com.mosty.wzzx.mapper.TbWzLswzMapper;
import com.mosty.wzzx.mapper.TbWzRywzMapper;
import com.mosty.wzzx.mapper.TbWzSswzMapper;
import com.mosty.wzzx.remote.TbBaseAdaptRemoteService;
import com.mosty.wzzx.service.TbWzSswzService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
@RequiredArgsConstructor
public class TbWzSswzServiceImpl extends ServiceImpl<TbWzSswzMapper, TbWzSswz> implements TbWzSswzService {
private final TbBaseAdaptRemoteService tbBaseAdaptRemoteService;
private final TbWzLswzMapper tbWzLswzMapper;
private final TbWzRywzMapper tbWzRywzMapper;
public void saveSswz(LocationInfo locationInfo, TbWzRywz oldRywz) {
BigDecimal jd = BigDecimal.valueOf(locationInfo.getLng());
BigDecimal wd = BigDecimal.valueOf(locationInfo.getLat());
BigDecimal oldJd = null;
BigDecimal oldWd = null;
Date oldTime = null;
if (oldRywz != null) {
oldJd = oldRywz.getJd();
oldWd = oldRywz.getWd();
}
if (locationInfo.getLastTime() != null) {
oldTime = locationInfo.getLastTime();
}
TbWzSswz sswz = new TbWzSswz();
Integer lc = DistanceUtils.getLc(0, oldJd, oldWd, jd, wd);
Integer sc = DistanceUtils.getSc(oldTime);
sswz.setSjlydm("02");
String sjly = "移动设备";
if (StringUtils.isNotBlank(locationInfo.getUserName())) {
sjly = sjly + "-" + locationInfo.getUserName();
}
if (StringUtils.isNotBlank(locationInfo.getUserId())) {
sjly = sjly + "-" + locationInfo.getUserId();
}
sswz.setSjly(sjly);
sswz.setYwid(locationInfo.getBbid());
sswz.setJzId(locationInfo.getJzid());
sswz.setJzMc(locationInfo.getJzmc());
sswz.setDwrq(new Date());
sswz.setDwsj(new Date());
sswz.setJd(jd);
sswz.setWd(wd);
sswz.setXfsc(sc);
sswz.setXflc(lc);
sswz.setZb(JtsUtils.getPoint(jd, wd));
sswz.setZbhash(GeoHashKit.encode(jd, wd));
sswz.setYhId(locationInfo.getYhid());
sswz.setYhXm(locationInfo.getUserName());
sswz.setYhSfzh(locationInfo.getUserId());
sswz.setJrbh(locationInfo.getAccessNumber());
sswz.setWztgz("02");//综合定位
if (ObjectUtils.isNotEmpty(oldRywz)) {
sswz.setSsbm(oldRywz.getSsbm());
sswz.setSsbmdm(oldRywz.getSsbmdm());
sswz.setSsbmid(oldRywz.getSsbmid());
sswz.setSsxgaj(oldRywz.getSsxgaj());
sswz.setSsxgajid(oldRywz.getSsxgajid());
sswz.setSsxgajdm(oldRywz.getSsxgajdm());
sswz.setSssgajid(oldRywz.getSssgajid());
sswz.setSssgaj(oldRywz.getSssgaj());
sswz.setSssgajdm(oldRywz.getSssgajdm());
} else {
DeptInfoVo dept = this.tbBaseAdaptRemoteService.getOrgByDeptId(locationInfo.getDeptId());
if (dept != null) {
sswz.setSsbm(dept.getDeptname());
sswz.setSsbmdm(dept.getDeptcode());
sswz.setSsbmid(dept.getDeptid());
sswz.setSsxgaj(dept.getFxjname());
sswz.setSsxgajid(dept.getFxjid());
sswz.setSsxgajdm(dept.getFxjcode());
sswz.setSssgajid(dept.getDszid());
sswz.setSssgaj(dept.getDszname());
sswz.setSssgajdm(dept.getDszcode());
}
}
sswz.setGuo(locationInfo.getCountry());
sswz.setSheng(locationInfo.getProvinc());
sswz.setShi(locationInfo.getCity());
sswz.setCsbm(locationInfo.getCityCode());
sswz.setSsqx(locationInfo.getDistrict());
sswz.setQxbm(locationInfo.getAdCode());
sswz.setDzxz(locationInfo.getAddress());
sswz.setDzjc(locationInfo.getPoiName());
sswz.setDwbz(locationInfo.getZbly());
this.baseMapper.insertEntity(sswz);
}
public TbWzSswz insert(LocationInfo locationInfo) {
TbWzSswz fronSswz = this.baseMapper.querySswzNow(locationInfo.getUserId(), null);
TbWzSswz sswz = new TbWzSswz();
BigDecimal jd = BigDecimal.valueOf(locationInfo.getLng());
BigDecimal wd = BigDecimal.valueOf(locationInfo.getLat());
Integer lc = 0;
Integer sc = 0;
if (fronSswz != null) {
lc = DistanceUtils.getLc(0, fronSswz.getJd(), fronSswz.getWd(), jd, wd);
sc = DistanceUtils.getSc(fronSswz.getDwsj());
}
sswz.setYhId(locationInfo.getUserId());
sswz.setYhXm(locationInfo.getUserName());
sswz.setYhSfzh(locationInfo.getUserId());
String sjly = "移动设备";
if (StringUtils.isNotBlank(locationInfo.getUserName())) {
sjly = sjly + "-" + locationInfo.getUserName();
}
if (StringUtils.isNotBlank(locationInfo.getUserId())) {
sjly = sjly + "-" + locationInfo.getUserId();
}
sswz.setSjly(sjly);
sswz.setSjlydm("02");
sswz.setDwrq(new Date());
sswz.setDwsj(new Date());
sswz.setJd(jd);
sswz.setWd(wd);
sswz.setZb(JtsUtils.getPoint(jd, wd));
sswz.setZbhash(GeoHashKit.encode(jd, wd));
sswz.setJrbh(locationInfo.getAccessNumber());
sswz.setWztgz("02");//综合定位
sswz.setXtSjly("1");
sswz.setId(UUIDGenerator.getUUID());
sswz.setGuo(locationInfo.getCountry());
sswz.setSheng(locationInfo.getProvinc());
sswz.setShi(locationInfo.getCity());
sswz.setQxbm(locationInfo.getCityCode());
sswz.setDzxz(locationInfo.getAddress());
sswz.setDzjc(locationInfo.getPoiName());
sswz.setYwid(locationInfo.getBbid());
DeptInfoVo dept = this.tbBaseAdaptRemoteService.getOrgByDeptId(locationInfo.getDeptId());
if (dept != null) {
sswz.setSsbm(dept.getDeptname());
sswz.setSsbmdm(dept.getDeptcode());
sswz.setSsbmid(dept.getDeptid());
sswz.setSsxgaj(dept.getFxjname());
sswz.setSsxgajid(dept.getFxjid());
sswz.setSsxgajdm(dept.getFxjcode());
sswz.setSssgajid(dept.getDszid());
sswz.setSssgaj(dept.getDszname());
sswz.setSssgajdm(dept.getDszcode());
}
sswz.setXfsc(sc);
sswz.setXflc(lc);
this.baseMapper.insertEntity(sswz);
return sswz;
}
public TbWzSswz insertEntity(TbWzSswz sswz) {
this.baseMapper.insertEntity(sswz);
return sswz;
}
public TbWzSswz queryById(String id) {
return this.baseMapper.queryById(id);
}
public TbWzSswz querySswzNow(String yhid, String jrbh) {
return this.baseMapper.querySswzNow(yhid, jrbh);
}
public void delHistory() {
this.baseMapper.delHistory();
}
@Override
public IPage<TbWzSswz> getRygjList(TbWzSswzSearchDto dto) {
IPage<TbWzLswz> page = this.tbWzLswzMapper.selectPage(
new Page<>(dto.getPageCurrent(), dto.getPageSize()),
new LambdaQueryWrapper<TbWzLswz>()
.eq(TbWzLswz::getYhSfzh, dto.getSfzh())
.eq(TbWzLswz::getXtSjzt, "1")
.ge(TbWzLswz::getDwrq, dto.getDwrq())
);
IPage<TbWzSswz> resPage = new Page<>(dto.getPageCurrent(), dto.getPageSize());
List<TbWzSswz> resList = new ArrayList<>();
if (!CollectionUtils.isEmpty(page.getRecords())) {
page.getRecords().forEach(item -> {
TbWzSswz sswz = new TbWzSswz();
BeanUtils.copyProperties(item, sswz);
sswz.setZb(null);
resList.add(sswz);
});
resPage.setRecords(resList);
resPage.setTotal(page.getTotal());
}
return resPage;
}
@Override
public TbWzRywz getRywz(TbWzRywzSearchDto dto) {
TbWzRywz wz = this.tbWzRywzMapper.selectBySfz(dto);
if (wz != null) {
wz.setZbList(JtsUtils.decodeLineString(wz.getZb()));
wz.setZb(null);
}
return wz;
}
}

View File

@ -0,0 +1,338 @@
package com.mosty.wzzx.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.base.model.dto.wzzx.AppLocationReceiveDto;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.base.model.entity.wzzx.*;
import com.mosty.base.model.query.wzzx.TbWzLswzSearchDto;
import com.mosty.base.model.query.wzzx.TbWzSbLswzSearchDto;
import com.mosty.base.utils.*;
import com.mosty.base.utils.mongo.core.wrapper.Wrappers;
import com.mosty.common.base.exception.BusinessException;
import com.mosty.common.core.util.http.HttpUtils;
import com.mosty.wzzx.mapper.*;
import com.mosty.wzzx.mongodb.TbWzSblswzMongoService;
import com.mosty.wzzx.mongodb.entity.TbWzSblswzMo;
import com.mosty.wzzx.service.TbWzXfwzService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.*;
@Service
@RequiredArgsConstructor
public class TbWzXfwzServiceImpl extends ServiceImpl<TbWzXfwzMapper, TbWzXfwz> implements TbWzXfwzService {
private final TbWzRywzMapper tbWzRywzMapper;
private final TbWzSswzMapper tbWzSswzMapper;
private final TbWzLswzMapper tbWzLswzMapper;
private final TbQwXfbbMapper tbQwXfbbMapper;
private final TbWzSblswzMapper tbWzSblswzMapper;
private final TbWzSblswzMongoService tbWzSblswzMongoService;
public List<TbWzXfwz> queryAll() {
return this.baseMapper.queryAll();
}
public TbWzXfwz queryById(String id) {
return this.baseMapper.queryById(id);
}
public TbWzXfwz insert(TbWzXfwz tbWzXfwz) {
this.baseMapper.insert(tbWzXfwz);
return tbWzXfwz;
}
public TbWzXfwz update(TbWzXfwz tbWzXfwz) {
this.baseMapper.update(tbWzXfwz);
return this.queryById(tbWzXfwz.getId());
}
public boolean deleteById(String id) {
return this.baseMapper.deleteById(id) > 0;
}
public Object selectTrack(TbWzXfwz tbWzXfwz) {
TbWzXfwz xfwz = this.baseMapper.queryByBbid(tbWzXfwz.getBbId());
if (ObjectUtils.isNotEmpty(xfwz)) {
List<BigDecimal[]> list = JtsUtils.decodeLineString(xfwz.getZb());
/* if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>();
}
if (list.size() >= 3) {
BigDecimal[] decimal0 = list.get(0);
BigDecimal[] decimal1 = list.get(1);
if (decimal0 == decimal1) {
list.remove(0);
}
}*/
xfwz.setZb(null);
xfwz.setZbList(list);
}
return xfwz;
}
@Override
public Object selectLswz(TbWzLswzSearchDto dto) {
if (StringUtils.isEmpty(dto.getBbId())) throw new BusinessException("报备业务ID为空");
if (StringUtils.isEmpty(dto.getKssj())) {
dto.setKssj(DateUtils.getSystemDateString());
}
List<TbWzLswz> tbWzLswzs = this.tbWzLswzMapper.selectList(new LambdaQueryWrapper<TbWzLswz>()
.eq(StringUtils.isNotBlank(dto.getBbId()), TbWzLswz::getYwid, dto.getBbId())
.ge(StringUtils.isNotBlank(dto.getKssj()), TbWzLswz::getDwsj, dto.getKssj())
.le(StringUtils.isNotBlank(dto.getJssj()), TbWzLswz::getDwsj, dto.getJssj())
.orderByAsc(TbWzLswz::getDwsj)
);
return tbWzLswzs;
}
@Override
public Object selectSbLswz(TbWzSbLswzSearchDto dto) {
if (StringUtils.isEmpty(dto.getGpsId())) throw new BusinessException("设备id为空");
if (StringUtils.isEmpty(dto.getKssj())) {
dto.setKssj(DateUtils.getSystemDateString());
}
List<TbWzSblswz> tbWzLswzs = this.tbWzSblswzMapper.selectList(new LambdaQueryWrapper<TbWzSblswz>()
.eq(StringUtils.isNotBlank(dto.getGpsId()), TbWzSblswz::getSbid, dto.getGpsId())
.ge(StringUtils.isNotBlank(dto.getKssj()), TbWzSblswz::getXtCjsj, dto.getKssj())
.le(StringUtils.isNotBlank(dto.getJssj()), TbWzSblswz::getXtCjsj, dto.getJssj())
.orderByAsc(TbWzSblswz::getXtCjsj)
);
return tbWzLswzs;
}
@Override
public Object selectSbLswzMo(TbWzSbLswzSearchDto dto) {
if (StringUtils.isEmpty(dto.getGpsId())) throw new BusinessException("设备id为空");
if (StringUtils.isEmpty(dto.getKssj())) {
dto.setKssj(DateUtils.getSystemDateString() + " 00:00:00");
}
com.mosty.base.utils.mongo.core.wrapper.LambdaQueryWrapper<TbWzSblswzMo> query = Wrappers.<TbWzSblswzMo>lambdaQuery()
.eq(StringUtils.isNotBlank(dto.getGpsId()), TbWzSblswzMo::getSbid, dto.getGpsId())
.ge(StringUtils.isNotBlank(dto.getKssj()), TbWzSblswzMo::getXtCjsj, DateUtils.dateToISODate(dto.getKssj()));
if (StringUtils.isNotBlank(dto.getJssj())) {
query.le(TbWzSblswzMo::getXtCjsj, DateUtils.dateToISODate(dto.getJssj()));
}
query.orderByAsc(TbWzSblswzMo::getXtCjsj);
List<TbWzSblswzMo> list = tbWzSblswzMongoService.list(query);
return list;
}
public Boolean locationReceive(AppLocationReceiveDto receiveDto) {
//经度、纬度为空不接收数据
if (receiveDto.getJd() == null && receiveDto.getWd() == null) {
return false;
}
//保存人员预警
TbWzRywz rywz = saveRywz(receiveDto);
TbQwXfbb bbxx = null;
if (StringUtils.isNotBlank(receiveDto.getBbid())) {
bbxx = tbQwXfbbMapper.queryById(receiveDto.getBbid());
}
saveSsjl(receiveDto, bbxx, rywz);
saveLsjl(receiveDto, bbxx, rywz);
if (bbxx != null) {
saveXfwz(receiveDto, bbxx, rywz);
}
return true;
}
public TbWzRywz saveRywz(AppLocationReceiveDto receiveDto) {
TbWzRywz rywz = tbWzRywzMapper.queryBySfzh(receiveDto.getYhSfzh());
if (rywz == null) {
rywz = new TbWzRywz();
}
rywz.setYhId(receiveDto.getYhid());
rywz.setYhXm(receiveDto.getYhxm());
rywz.setYhSfzh(receiveDto.getYhSfzh());
rywz.setXtZhgxsj(new Timestamp(System.currentTimeMillis()));
List<BigDecimal[]> list = JtsUtils.decodeLineString(rywz.getZb());
if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>();
}
Integer lc = DistanceUtils.getLc(rywz.getLc(), rywz.getJd(), rywz.getWd(), receiveDto.getJd(),
receiveDto.getWd());
Integer sc = DistanceUtils.getSc(rywz.getZhgxsj());
BigDecimal[] decimals = new BigDecimal[2];
decimals[0] = receiveDto.getJd();
decimals[1] = receiveDto.getWd();
list.add(decimals);
if (list.size() == 1) {
list.add(decimals);
}
if (list.size() >= 3) {
BigDecimal[] decimal0 = list.get(0);
BigDecimal[] decimal1 = list.get(1);
if (decimal0 == decimal1) {
list.remove(0);
}
}
rywz.setLc(lc);
rywz.setSc(sc);
rywz.setZb(JtsUtils.createLine(list));
rywz.setZbsl(list.size());
rywz.setJd(receiveDto.getJd());
rywz.setWd(receiveDto.getWd());
rywz.setZhgxsj(new Timestamp(System.currentTimeMillis()));
rywz.setXtSjly("1");
rywz.setJd(receiveDto.getJd());
rywz.setWd(receiveDto.getWd());
rywz.setSsxgajdm("510109000000");
rywz.setSsxgajid("1");
rywz.setSsxgaj("高新区分局");
rywz.setSssgaj("成都市公安局");
rywz.setSssgajdm("510100000000");
rywz.setSssgajid("10001");
if (StringUtils.isBlank(rywz.getId())) {
rywz.setId(UUIDGenerator.getUUID());
rywz.setKssj(new Date());
rywz.setDwrq(new Date());
rywz.setXtCjsj(new Timestamp(System.currentTimeMillis()));
tbWzRywzMapper.insertEntity(rywz);
} else {
tbWzRywzMapper.updateEntity(rywz);
}
return rywz;
}
public void saveXfwz(AppLocationReceiveDto receiveDto, TbQwXfbb bbxx, TbWzRywz rywz) {
TbWzXfwz xfwz = this.baseMapper.queryByBbid(receiveDto.getBbid());
if (xfwz == null) {
xfwz = new TbWzXfwz();
}
Integer lc = DistanceUtils.getLc(rywz.getLc(), rywz.getJd(), rywz.getWd(), receiveDto.getJd(),
receiveDto.getWd());
Integer sc = DistanceUtils.getSc(rywz.getZhgxsj());
xfwz.setBbId(receiveDto.getBbid());
xfwz.setYhId(receiveDto.getYhid());
xfwz.setYhSfzh(receiveDto.getYhSfzh());
xfwz.setYhXm(receiveDto.getYhxm());
xfwz.setJzId(bbxx.getJzId());
xfwz.setJzMc(bbxx.getJzMc());
xfwz.setSc(sc);
xfwz.setLc(lc);
List<BigDecimal[]> list = JtsUtils.decodeLineString(xfwz.getZb());
if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>();
}
BigDecimal[] decimals = new BigDecimal[2];
decimals[0] = receiveDto.getJd();
decimals[1] = receiveDto.getWd();
list.add(decimals);
if (list.size() == 1) {
list.add(decimals);
}
if (list.size() >= 3) {
BigDecimal[] decimal0 = list.get(0);
BigDecimal[] decimal1 = list.get(1);
if (decimal0 == decimal1) {
list.remove(0);
}
}
xfwz.setZb(JtsUtils.createLine(list));
xfwz.setZbsl(list.size());
xfwz.setDwrq(new Date());
xfwz.setKssj(new Date());
xfwz.setJd(receiveDto.getJd());
xfwz.setWd(receiveDto.getWd());
xfwz.setZhgxsj(new Date());
xfwz.setXtSjly("1");
xfwz.setSsxgajdm("510109000000");
xfwz.setSsxgajid("1");
xfwz.setSsxgaj("高新区分局");
xfwz.setSssgaj("成都市公安局");
xfwz.setSssgajdm("510100000000");
xfwz.setSssgajid("10001");
if (StringUtils.isBlank(xfwz.getId())) {
xfwz.setId(UUIDGenerator.getUUID());
xfwz.setXtCjsj(new Timestamp(System.currentTimeMillis()));
this.baseMapper.insert(xfwz);
} else {
xfwz.setJssj(new Date());
this.baseMapper.update(xfwz);
}
}
public void saveSsjl(AppLocationReceiveDto receiveDto, TbQwXfbb bbxx, TbWzRywz rywz) {
TbWzSswz sswz = new TbWzSswz();
Integer lc = DistanceUtils.getLc(0, rywz.getJd(), rywz.getWd(), receiveDto.getJd(), receiveDto.getWd());
Integer sc = DistanceUtils.getSc(rywz.getZhgxsj());
BeanUtils.copyProperties(receiveDto, sswz);
sswz.setSjly("移动设备-" + receiveDto.getYhxm() + "-" + receiveDto.getYhSfzh());
sswz.setSjlydm("02");
sswz.setYwid(receiveDto.getBbid());
if (bbxx != null) {
sswz.setJzId(bbxx.getJzId());
sswz.setJzMc(bbxx.getJzMc());
}
sswz.setDwrq(new Date());
sswz.setDwsj(new Date());
sswz.setJd(receiveDto.getJd());
sswz.setWd(receiveDto.getWd());
sswz.setXfsc(sc);
sswz.setXflc(lc);
if (receiveDto.getJd() != null && receiveDto.getWd() != null) {
sswz.setZb(JtsUtils.getPoint(receiveDto.getJd(), receiveDto.getWd()));
sswz.setZbhash(GeoHashKit.encode(receiveDto.getJd(), receiveDto.getWd()));
}
sswz.setYhId(receiveDto.getYhid());
sswz.setYhXm(receiveDto.getYhxm());
sswz.setJrbh(receiveDto.getJrbh());
sswz.setWztgz("02");//综合定位
sswz.setXtSjly("1");
sswz.setSsxgajdm("510109000000");
sswz.setSsxgajid("1");
sswz.setSsxgaj("高新区分局");
sswz.setSssgaj("成都市公安局");
sswz.setSssgajdm("510100000000");
sswz.setSssgajid("10001");
tbWzSswzMapper.insertEntity(sswz);
}
public void saveLsjl(AppLocationReceiveDto receiveDto, TbQwXfbb bbxx, TbWzRywz rywz) {
TbWzLswz lswz = new TbWzLswz();
BeanUtils.copyProperties(receiveDto, lswz);
Integer lc = DistanceUtils.getLc(0, rywz.getJd(), rywz.getWd(), receiveDto.getJd(), receiveDto.getWd());
Integer sc = DistanceUtils.getSc(rywz.getZhgxsj());
lswz.setSjly("移动设备" + receiveDto.getYhxm() + "-" + receiveDto.getYhSfzh());
lswz.setSjlydm("02");
lswz.setYwid(receiveDto.getBbid());
if (bbxx != null) {
lswz.setJzId(bbxx.getJzId());
lswz.setJzMc(bbxx.getJzMc());
}
lswz.setDwrq(new Date());
lswz.setDwsj(new Date());
lswz.setJd(receiveDto.getJd());
lswz.setWd(receiveDto.getWd());
lswz.setXfsc(sc);
lswz.setXflc(lc);
if (receiveDto.getJd() != null && receiveDto.getWd() != null) {
lswz.setZb(JtsUtils.getPoint(receiveDto.getJd(), receiveDto.getWd()));
lswz.setZbhash(GeoHashKit.encode(receiveDto.getJd(), receiveDto.getWd()));
}
lswz.setYhId(receiveDto.getYhid());
lswz.setYhXm(receiveDto.getYhxm());
lswz.setWztgz("02");//综合定位
lswz.setXtSjly("1");
lswz.setSsxgajdm("510109000000");
lswz.setSsxgajid("1");
lswz.setSsxgaj("高新区分局");
lswz.setSssgaj("成都市公安局");
lswz.setSssgajdm("510100000000");
lswz.setSssgajid("10001");
tbWzLswzMapper.insertEntity(lswz);
}
}

View File

@ -0,0 +1,265 @@
package com.mosty.wzzx.service.impl;
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.mosty.base.model.dto.wzzx.WzcxQuery;
import com.mosty.base.model.dto.wzzx.WztjQuery;
import com.mosty.base.model.entity.qwzx.TbQwXfBxfsq;
import com.mosty.base.model.entity.wzzx.TbWzRywz;
import com.mosty.base.model.entity.wzzx.TbWzSblswz;
import com.mosty.base.model.entity.wzzx.TbWzXfwz;
import com.mosty.base.utils.DateUtils;
import com.mosty.common.token.UserInfo;
import com.mosty.common.token.UserInfoManager;
import com.mosty.common.util.PermissionsUtil;
import com.mosty.wzzx.mapper.TbWzRywzMapper;
import com.mosty.wzzx.mapper.TbWzSblswzMapper;
import com.mosty.wzzx.mapper.TbWzXfwzMapper;
import com.mosty.wzzx.mapper.WztjMapper;
import com.mosty.wzzx.remote.TbBaseAdaptRemoteService;
import com.mosty.wzzx.service.WztjService;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
@AllArgsConstructor
public class WztjServiceImpl implements WztjService {
private final WztjMapper wztjMapper;
private final TbWzXfwzMapper tbWzXfwzMapper;
private final TbWzRywzMapper tbWzRywzMapper;
private final TbWzSblswzMapper tbWzSblswzMapper;
private final TbBaseAdaptRemoteService tbBaseAdaptRemoteService;
@Override
public List<Map<String, Object>> rywz(WztjQuery dto) {
Map<String, Object> map = new HashMap<>();
UserInfo user = UserInfoManager.get();
map.put("useSql", PermissionsUtil.createSql("", user));
map.put("dto", dto);
return this.wztjMapper.jwzbmlbtj(map);
}
@Override
public List<Map<String, Object>> xz(WztjQuery dto) {
Map<String, Object> map = new HashMap<>();
UserInfo user = UserInfoManager.get();
map.put("useSql", PermissionsUtil.createSql("", user));
map.put("dto", dto);
return this.wztjMapper.xz(map);
}
@Override
public List<Map<String, Object>> jrlcs(WztjQuery dto) {
Map<String, Object> map = new HashMap<>();
UserInfo user = UserInfoManager.get();
map.put("useSql", PermissionsUtil.createSql("", user));
map.put("dto", dto);
return this.wztjMapper.jrlcs(map);
}
@Override
public List<Map<String, Object>> rslcxz(WztjQuery dto) {
Map<String, Object> map = new HashMap<>();
UserInfo user = UserInfoManager.get();
map.put("useSql", PermissionsUtil.createSql("", user));
map.put("dto", dto);
return this.wztjMapper.rslcxz(map);
}
@Override
public List<Map<String, Object>> jrwzrs(WztjQuery dto) {
Map<String, Object> map = new HashMap<>();
UserInfo user = UserInfoManager.get();
map.put("useSql", PermissionsUtil.createSql("", user));
map.put("dto", dto);
return this.wztjMapper.jrwzrs(map);
}
@Override
public List<Map<String, Object>> jrxzwzs(WztjQuery dto) {
Map<String, Object> map = new HashMap<>();
UserInfo user = UserInfoManager.get();
map.put("useSql", PermissionsUtil.createSql("", user));
map.put("dto", dto);
return this.wztjMapper.jrxzwzs(map);
}
@Override
public IPage<Map<String, Object>> rywzlb(WztjQuery dto) {
Map<String, Object> map = new HashMap<>();
UserInfo user = UserInfoManager.get();
map.put("pageIndex", (dto.getPageCurrent() - 1) * dto.getPageSize());
map.put("pageSize", dto.getPageSize());
map.put("useSql", PermissionsUtil.createSql("", user));
map.put("dto", dto);
int count = this.wztjMapper.rywzlbCount(map);
List<Map<String, Object>> list = this.wztjMapper.rywzlb(map);
IPage<Map<String, Object>> page = new Page<>(dto.getPageCurrent(), dto.getPageSize());
page.setTotal(count);
page.setRecords(list);
return page;
}
@Override
public List<Map<String, Object>> bbgjcx(WzcxQuery dto) {
Map<String, Object> map = new HashMap<>();
UserInfo user = UserInfoManager.get();
map.put("useSql", PermissionsUtil.createSql("", user));
map.put("dto", dto);
return this.wztjMapper.bbgjcx(map);
}
@Override
public List<Map<String, Object>> bbwzcx(WzcxQuery dto) {
Map<String, Object> map = new HashMap<>();
UserInfo user = UserInfoManager.get();
map.put("useSql", PermissionsUtil.createSql("", user));
map.put("dto", dto);
return this.wztjMapper.bbwzcx(map);
}
@Override
public List<Map<String, Object>> mjgjcx(WzcxQuery dto) {
Map<String, Object> map = new HashMap<>();
UserInfo user = UserInfoManager.get();
map.put("useSql", PermissionsUtil.createSql("", user));
map.put("dto", dto);
return this.wztjMapper.mjgjcx(map);
}
@Override
public List<Map<String, Object>> wbbwz(WzcxQuery dto) {
Map<String, Object> map = new HashMap<>();
UserInfo user = UserInfoManager.get();
map.put("useSql", PermissionsUtil.createSql("", user));
map.put("dto", dto);
return this.wztjMapper.wbbwz(map);
}
@Override
public Map<String, Object> xfsltj(String type) {
String kssj = null, jssj = null, startTime = null, endTime = null;
if ("1".equals(type)) { // 类型如果为 1 说明是当天
kssj = DateUtils.getQueryDateString(new Date(), "01");
jssj = DateUtils.getQueryDateString(new Date(), "01");
// 当天的环比
startTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -1), "01");
endTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -1), "01");
} else if ("2".equals(type)) { // 7天
kssj = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -7), "01");
jssj = DateUtils.getQueryDateString(new Date(), "01");
// 环比7天的 开始时间,结束时间
startTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -14), "01");
endTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -7), "01");
} else if ("3".equals(type)) { // 30天
kssj = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -30), "01");
jssj = DateUtils.getQueryDateString(new Date(), "01");
// 环比的30天开始时间结束时间
startTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -60), "01");
endTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -30), "01");
}
// UserInfo user = UserInfoManager.get(); // 获取登陆信息
QueryWrapper<TbWzXfwz> qw = new QueryWrapper<>(); // mybatisplus
// PermissionsUtil.queryWrapperUtil(qw, user); // mybatisplus
String ssbm = this.tbBaseAdaptRemoteService.getSsbm(null, null);
qw.likeRight(StringUtils.isNotBlank(ssbm), "ssbmdm", ssbm);
Map<String, Object> map = new HashMap<>();
int nowCount = this.tbWzXfwzMapper.selectCount( // 近期的count计数 lambda遍历 根据日期开始时间结束时间计数 比较ge大于开始时间le小于结束时间
qw.lambda().ge(TbWzXfwz::getDwrq, kssj)
.le(TbWzXfwz::getDwrq, jssj)
);
// 近期的count
map.put("nowCount", nowCount);
// 上一期的数量
int prevCount = this.tbWzXfwzMapper.selectCount(
qw.lambda().ge(TbWzXfwz::getDwrq, startTime)
.le(TbWzXfwz::getDwrq, endTime)
);
map.put("prevCount", prevCount);
map.put("hb", prevCount != 0 ? ( // 环比, 三目, 保存两位小数, BigDecimal
new BigDecimal((nowCount - prevCount)).divide(new BigDecimal(prevCount), BigDecimal.ROUND_HALF_UP, 4)
) : 0);
map.put("hbCount", nowCount - prevCount); // 环比计数 近期的count - 上期的count
return map;
}
@Override
public Map<String, Object> rysltj(String type) {
String kssj = null, jssj = null, startTime = null, endTime = null;
if ("1".equals(type)) {
kssj = DateUtils.getQueryDateString(new Date(), "01");
jssj = DateUtils.getQueryDateString(new Date(), "01");
startTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -1), "01");
endTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -1), "01");
} else if ("2".equals(type)) {
kssj = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -7), "01");
jssj = DateUtils.getQueryDateString(new Date(), "01");
startTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -14), "01");
endTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -7), "01");
} else if ("3".equals(type)) {
kssj = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -30), "01");
jssj = DateUtils.getQueryDateString(new Date(), "01");
startTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -60), "01");
endTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -30), "01");
}
UserInfo user = UserInfoManager.get();
String useSql = PermissionsUtil.createSql("",user);
Map<String, Object> map = new HashMap<>();
int nowCount = tbWzRywzMapper.getRysltjCount(kssj,jssj,useSql); // 需要去重
// 近期
map.put("nowCount", nowCount);
// 上一期的数量
int prevCount = tbWzRywzMapper.getRysltjCount(startTime,endTime,useSql);
map.put("prevCount", prevCount);
map.put("hb", prevCount != 0 ? (
new BigDecimal((nowCount - prevCount)).divide(new BigDecimal(prevCount), BigDecimal.ROUND_HALF_UP, 4)
) : 0);
map.put("hbCount", nowCount - prevCount); // 环比计数 近期的count - 上期的count
return map;
}
@Override
public Map<String, Object> sblswz(String type) {
String kssj = null, jssj = null, startTime = null, endTime = null;
if ("1".equals(type)) {
kssj = DateUtils.getQueryDateString(new Date(), "01");
jssj = DateUtils.getQueryDateString(new Date(), "01");
startTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -1), "01");
endTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -1), "01");
} else if ("2".equals(type)) {
kssj = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -7), "01");
jssj = DateUtils.getQueryDateString(new Date(), "01");
startTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -14), "01");
endTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -7), "01");
} else if ("3".equals(type)) {
kssj = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -30), "01");
jssj = DateUtils.getQueryDateString(new Date(), "01");
startTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -60), "01");
endTime = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -30), "01");
}
UserInfo user = UserInfoManager.get();
String useSql = PermissionsUtil.createSql("",user);
Map<String, Object> map = new HashMap<>();
int nowCount = tbWzSblswzMapper.getSblswzCount(kssj,jssj,useSql);
// 近期
map.put("nowCount", nowCount);
// 上一期的数量
int prevCount = tbWzSblswzMapper.getSblswzCount(startTime,endTime,useSql);
map.put("prevCount", prevCount);
map.put("hb", prevCount != 0 ? (
new BigDecimal((nowCount - prevCount)).divide(new BigDecimal(prevCount), BigDecimal.ROUND_HALF_UP, 4)
) : 0);
map.put("hbCount", nowCount - prevCount);
return map;
}
}

View File

@ -0,0 +1,22 @@
package com.mosty.wzzx.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.common.core.business.entity.SysUser;
import com.mosty.wzzx.mapper.WzzxUserMapper;
import com.mosty.wzzx.service.WzzxSysUserService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
@RequiredArgsConstructor
public class WzzxSysUserServiceImpl extends ServiceImpl<WzzxUserMapper, SysUser> implements WzzxSysUserService {
public List<SysUser> queryList() {
return this.baseMapper.selectByPage();
}
}

View File

@ -0,0 +1,113 @@
package com.mosty.wzzx.task;
import com.mosty.base.model.entity.qwzx.TbQwZnzb;
import com.mosty.base.model.entity.wzzx.TbWzSbsswz;
import com.mosty.base.model.entity.wzzx.TbWzXfwz;
import com.mosty.base.utils.Constant;
import com.mosty.base.utils.DistanceUtils;
import com.mosty.base.utils.JtsUtils;
import com.mosty.common.redis.service.RedisService;
import com.mosty.wzzx.service.TbWzXfwzService;
import com.mosty.wzzx.service.impl.TbQwZnzbServiceImpl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.*;
import java.util.stream.Collectors;
/**
* 位置定时器
*/
@Slf4j
@Component
@AllArgsConstructor
public class LocationCenterTask {
private final RedisService redisService;
private final RedisTemplate redisTemplate;
private final TbWzXfwzService tbWzXfwzService;
private final TbQwZnzbServiceImpl tbQwZnzbService;
// @Scheduled(cron = "0 0/2 * * * ? ")
public void locationCompletion() {
System.out.println("开始执行位置定时器补全坐标位置");
//巡防位置
String key = Constant.WZ_XFWZ + "*";
Set<String> sets = redisTemplate.keys(key);
if (!CollectionUtils.isEmpty(sets)) {
List<TbWzXfwz> zfwzList = redisTemplate.opsForValue().multiGet(sets);
//设备实时位置
String sbwzKey = Constant.WZ_SBWZ + "*";
Set<String> sbwzSets = redisTemplate.keys(sbwzKey);
if (!CollectionUtils.isEmpty(sbwzSets)) {
List<TbWzSbsswz> sbwzList = redisTemplate.opsForValue().multiGet(sbwzSets);
if (!CollectionUtils.isEmpty(zfwzList) && !CollectionUtils.isEmpty(sbwzList)) {
List<String> bbList = zfwzList.stream().map(TbWzXfwz::getBbId).collect(Collectors.toList());
List<TbQwZnzb> znnbList = tbQwZnzbService.queryListByYwid(bbList);
for (TbWzXfwz xfwz : zfwzList) {
Date zhgxsj = xfwz.getZhgxsj();
//上报时长
long sbsc = System.currentTimeMillis() - zhgxsj.getTime();
if (sbsc >= 60000) {//超过1分钟离线
xfwz.setZxzt("0");
if (!CollectionUtils.isEmpty(znnbList)) {
//获取当前报备的智能装备
List<TbQwZnzb> bbzbList =
znnbList.stream().filter(item -> item.getYwid().equals(xfwz.getBbId())).collect(Collectors.toList());
//获取报备装备呼号
List<String> hhList = bbzbList.stream().map(TbQwZnzb::getHh).collect(Collectors.toList());
//获取缓存报备装备位置
List<TbWzSbsswz> bbSbwzList =
sbwzList.stream().filter(entity -> hhList.contains(entity.getSbid())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(bbSbwzList)) {
//对报备装备根据定位时间排序
bbSbwzList.stream().sorted(Comparator.comparing(TbWzSbsswz::getDwsj).reversed());
TbWzSbsswz sswz = bbSbwzList.get(0);
//如果实时位置最新坐标的时间大于
if (sswz.getDwsj().getTime() > xfwz.getZhgxsj().getTime()) {
//更新巡防位置坐标
BigDecimal jd = sswz.getJd();
BigDecimal wd = sswz.getWd();
Integer lc = DistanceUtils.getLc(xfwz.getLc(), xfwz.getJd(), xfwz.getWd(), jd,
wd);
Integer sc = DistanceUtils.getSc(xfwz.getZhgxsj());
xfwz.setSc(sc);
xfwz.setLc(lc);
List<BigDecimal[]> list = JtsUtils.decodeLineString(xfwz.getZb());
if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>();
}
BigDecimal[] decimals = new BigDecimal[2];
decimals[0] = jd;
decimals[1] = wd;
list.add(decimals);
if (list.size() == 1) {
list.add(decimals);
}
xfwz.setZb(JtsUtils.createLine(list));
xfwz.setZbsl(list.size());
xfwz.setDwrq(sswz.getDwrq());
xfwz.setJd(jd);
xfwz.setWd(wd);
xfwz.setZhgxsj(sswz.getXtZhgxsj());
}
}
}
tbWzXfwzService.update(xfwz);
String redisKey = Constant.WZ_XFWZ + xfwz.getBbId();
redisService.setCacheObject(redisKey, xfwz);
}
}
}
}
}
}
}

View File

@ -0,0 +1,60 @@
package com.mosty.wzzx.task;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.mosty.base.utils.Constant;
import com.mosty.base.utils.DateUtils;
import com.mosty.wzzx.service.TbWzSbsswzService;
import com.mosty.wzzx.service.TbWzSswzService;
import com.mosty.wzzx.service.impl.TbWzSbsswzServiceImpl;
import com.mosty.wzzx.service.impl.TbWzSswzServiceImpl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Set;
@Slf4j
@Component
@AllArgsConstructor
public class LocationClearTask {
private final RedisTemplate redisTemplate;
private final TbWzSbsswzService tbWzSbsswzService;
private final TbWzSswzService tbWzSswzService;
//每天凌晨执行删除redis数据删除实时位置的7天前的数据
@Scheduled(cron = "0 0 1 * * ? ")
public void locationClear() {
System.out.println("开始执行位置定时器位置清理");
//清除人员位置
String key = Constant.WZ_RYWZ + "*";
Set<String> ryKeys = redisTemplate.keys(key);
if (CollectionUtils.isNotEmpty(ryKeys)) {
ryKeys.forEach(v -> {
if (!v.contains(DateUtils.getSystemDateString())) {
redisTemplate.delete(v);
}
});
}
//清除设备位置
String sbwzKey = Constant.WZ_SBWZ + "*";
Set<String> sbKeys = redisTemplate.keys(sbwzKey);
if (CollectionUtils.isNotEmpty(sbKeys)) {
sbKeys.forEach(v -> {
if (!v.contains(DateUtils.getSystemDateString())) {
redisTemplate.delete(v);
}
});
}
//删除实时位置7天前数据
tbWzSswzService.delHistory();
//删除设备实时位置7天前数据
tbWzSbsswzService.delHistory();
}
}

View File

@ -0,0 +1,201 @@
package com.mosty.wzzx.udp;
import com.alibaba.fastjson.JSON;
import com.mosty.base.utils.DateUtils;
import lombok.Data;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
/**
* 泸州udp转换
*
* @author esacpe
*/
@Data
public class UdpLzEntity {
/**
* pgisId
*/
private String pgisId;
/**
* 经度,单位度
*/
private Double lng;
/**
* 纬度,单位度
*/
private Double lat;
/**
* 高程,单位米
*/
private Integer altitude;
/**
* 速度单位Km/h
*/
private Integer speed;
/**
* 方向0-359正北为0顺时针
*/
private Integer direction;
/**
* 定位时间
*/
private Date time;
/**
* 精度
*/
private Integer precision;
//解析
public boolean parseLz(byte[] data) {
return parseLz(data, data.length);
}
private int destPos = 0;
public boolean parseLz(byte[] data, int dataLength) {
if (data == null || dataLength < 10 || dataLength > data.length) {
return false;
}
if (data[0] == 0xAA) {
return false;
}
byte[] bytes3 = new byte[20];
// System.arraycopy(data, 10, bytes3, 0, 20);
//
// pgisId = new String(bytes3, Charset.forName("UTF-8"));
// pgisId = new String(bytes3, Charset.forName("UTF-8"));
destPos = 10;
pgisId = (new String(arraycopy(data, destPos, 20,20), Charset.forName("UTF-8"))).trim();
// byte[] jdbt=new byte[8];
// System.arraycopy(data, 30, jdbt, 0, 8);
// lng = bytes2Double(jdbt);
lng = bytes2Double(arraycopy(data, destPos, 8,8));
// byte[] wdbt=new byte[8];
// System.arraycopy(data, 38, wdbt, 0, 8);
// lat = bytes2Double(wdbt);
lat = bytes2Double(arraycopy(data, destPos, 8,8));
// byte[] dspeedbyte=new byte[8];
// System.arraycopy(data, 46, dspeedbyte, 0, 2);
// speed = byte2int(dspeedbyte);
speed = byte2int(arraycopy(data, destPos, 2,4));
// byte[] dirsbyte=new byte[8];
// System.arraycopy(data, 48, dirsbyte, 0, 2);
// direction = byte2int(dirsbyte);
direction = byte2int(arraycopy(data, destPos, 2,4));
altitude = byte2int(arraycopy(data, destPos, 2,4));
precision = byte2int(arraycopy(data, destPos, 2,4));
Integer year = byte2int(arraycopyYear(data, destPos, 2,4));
Integer month = byte2int(arraycopy(data, destPos, 1,4));
Integer day = byte2int(arraycopy(data, destPos, 1,4));
Integer hours = byte2int(arraycopy(data, destPos, 1,4));
Integer minutes = byte2int(arraycopy(data, destPos, 1,4));
Integer seconds = byte2int(arraycopy(data, destPos, 1,4));
try {
time = DateUtils.stringToDate(year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds, "yyyy-MM-dd HH:mm:ss");
} catch (Exception e) {
e.printStackTrace();
}
return time != null;
}
/**
* 加密有问题 把54 55单独替换位置
* @param arr
* @param dest
* @param len
* @param end
* @return
*/
private byte[] arraycopyYear(byte[] arr, int dest, int len,int end) {
byte[] copy = new byte[end];
System.arraycopy(arr, 55, copy, 0, 1);
System.arraycopy(arr, 54, copy, 1, 1);
destPos = dest + len;
return copy;
}
private byte[] arraycopy(byte[] arr, int dest, int len,int end) {
byte[] copy = new byte[end];
System.arraycopy(arr, dest, copy, 0, len);
destPos = dest + len;
return copy;
}
private double bytes2Double(byte[] arr) {
long value = 0;
for (int i = 0; i < 8; i++) {
value |= ((long) (arr[i] & 0xff)) << (8 * i);
}
return Double.longBitsToDouble(value);
}
public int byte2int(byte[] res) {
int targets = (res[0] & 0xff) | ((res[1] << 8) & 0xff00) | ((res[2] << 24) >>> 8) | (res[3] << 24);
return targets;
}
public static byte[] hexStringToByte(String hexstr) {
if (hexstr == null)
return null;
byte[] b = new byte[hexstr.length() / 2];
int j = 0;
for (int i = 0; i < b.length; i++) {
char c0 = hexstr.charAt(j++);
char c1 = hexstr.charAt(j++);
b[i] = ((byte) (charToInt(c0) << 4 | charToInt(c1)));
}
return b;
}
// char转换成int
public static int charToInt(char c) {
if (c >= 'a') {
return c - 'a' + 10 & 0xF;
}
if (c >= 'A') {
return c - 'A' + 10 & 0xF;
}
return c - '0' & 0xF;
}
public static String byteArrayToString(byte[] data) {
StringBuilder sb = new StringBuilder();
for (byte b : data) {
sb.append(String.format("%02X", b));
}
return sb.toString();
}
public static void main(String[] args) {
UdpLzEntity lzEntity = new UdpLzEntity();
byte[] bytes2 = UdpLzEntity.hexStringToByte("AAAACCCC002200000033313334303430313837343700000000000000000016A6EF3504305A403BC43F6CE9BD3F400000000001E4000007E8040B100402");
lzEntity.parseLz(bytes2);
System.out.println(JSON.toJSONString(lzEntity));
}
}

View File

@ -0,0 +1,115 @@
package com.mosty.wzzx.udp;
import com.mosty.base.model.entity.wzzx.TbWzSbsswz;
import com.mosty.wzzx.service.TbWzSblswzService;
import com.mosty.wzzx.service.TbWzSbsswzService;
import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.integration.annotation.Filter;
import org.springframework.integration.annotation.Router;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.annotation.Transformer;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
import org.springframework.integration.ip.dsl.Udp;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.Map;
/**
* esacpe
* 泸州udp
* 2023-01-10
*/
@Component
public class UdpServerForLz {
private static final Logger logger = LoggerFactory.getLogger(UdpServerForLz.class);
@Value("${custom.udp.LzUdpPort}")
private Integer bureauPort;
@Resource
private TbWzSbsswzService tbWzSbsswzService;
@Resource
private TbWzSblswzService tbWzSblswzService;
// UDP服务
@Bean(name = "integrationLzUdp")
public IntegrationFlow integrationFlow() {
logger.info("UDP-UDP-启动成功,端口号为: {}", bureauPort);
return IntegrationFlows.from(Udp.inboundAdapter(bureauPort)).channel("udpChannelLz").get();
}
// 数据转换器
@Transformer(inputChannel = "udpChannelLz", outputChannel = "udpFilterLz")
public UdpLzEntity transformer(@Payload byte[] payload) {
// logger.info("UDP-定位接收服务-开始转换数据");
UdpLzEntity lzEntity = new UdpLzEntity();
try {
String s = UdpLzEntity.byteArrayToString(payload);
// logger.info("UDP推送信息---》", s);
if (lzEntity.parseLz(payload)) {
if (ObjectUtils.isNotEmpty(lzEntity)) {
// long time = new Date().getTime();
// long i = time - lzEntity.getTime().getTime();
// if (i > 300000) {
// logger.info("UDP-定位接收服务-返回位置信息异常 : {}", s);
// }
lzEntity.setPgisId(lzEntity.getPgisId().replace("000", ""));
}
return lzEntity;
}
} catch (Exception e) {
e.printStackTrace();
}
return new UdpLzEntity();
}
// 过滤器
@Filter(inputChannel = "udpFilterLz", outputChannel = "udpRouterLz")
public boolean filter(@Headers Map<String, Object> headers) {
String id = headers.get("id").toString();
String ip = headers.get("ip_address").toString();
String port = headers.get("ip_port").toString();
// System.err.println("filter-id : " + id + "filter-ip : " + ip + ",filter-port : " + port);
return true;
}
// 路由分发处理器 - 可根据消息或者headers数据进行分发处理
@Router(inputChannel = "udpRouterLz")
public String router(UdpLzEntity lzEntity) {
if (null == lzEntity.getLat() || lzEntity.getLat() == 0
|| null == lzEntity.getLng() || lzEntity.getLng() == 0) {
return "locationExceptionHandleLz";
}
return "locationHandleLz";
}
// 位置信息处理方法
@ServiceActivator(inputChannel = "locationHandleLz")
public void locationHandleLz(UdpLzEntity lzEntity) {
// logger.info("UDP-定位接收服务-获取到正常位置信息 : {}", lzEntity.toString());
TbWzSbsswz sswz = this.tbWzSbsswzService.saveSbsswz(lzEntity);
this.tbWzSblswzService.saveSblswz(sswz);
}
// 位置信息解析异常处理方法
@ServiceActivator(inputChannel = "locationExceptionHandleLz")
public void locationExceptionHandleLz(UdpLzEntity lzEntity) {
logger.error("UDP-定位接收服务-获取到解析异常位置信息 : {} ", lzEntity.toString());
}
}

View File

@ -0,0 +1,93 @@
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_wzzx?autoReconnect=true&failOverReadOnly=false&useUnicode=true&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: 20000000
jedis:
pool:
max-active: 1000
data:
mongodb:
uri: mongodb://admin:mosty888@80.93.7.13:35620/mosty-wzzx?authSource=admin&serverTimezone=UTC
table: mosty-wzzx
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.nologging.NoLoggingImpl
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/**
custom:
#POINAME分组位置信息默偏移天数
userTrackPoiNameOffset: -15
#启动是否清空实时位置数据
isCleanRealTime: true
udp:
#UDP 泸州位置接收服务
LzUdpPort: 18004
LzUdpTest: false
config:
orgCode: 510600000000
logging:
level:
root: error

View File

@ -0,0 +1,39 @@
server:
port: 51822
servlet:
context-path: /mosty-wzzx/
spring:
application:
name: mosty-wzzx
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

View 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>

View File

@ -0,0 +1,147 @@
<?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.mosty.wzzx.mapper.TbQwXfbbMapper">
<resultMap id="BaseResultMap" type="com.mosty.base.model.entity.qwzx.TbQwXfbb">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="xfpb_id" property="xfpbId"/>
<result column="qwdj_id" property="qwdjId"/>
<result column="qwdj" property="qwdj"/>
<result column="qwbc_id" property="qwbcId"/>
<result column="jz_id" property="jzId"/>
<result column="jz_mc" property="jzMc"/>
<result column="xfbm" property="xfbm"/>
<result column="xfbmdm" property="xfbmdm"/>
<result column="fzr_sfzh" property="fzrSfzh"/>
<result column="fzr_xm" property="fzrXm"/>
<result column="fzr_id" property="fzrId"/>
<result column="fzr_lxdh" property="fzrLxdh"/>
<result column="xfrq" property="xfrq"/>
<result column="kssj" property="kssj"/>
<result column="jssj" property="jssj"/>
<result column="zqsc" property="zqsc"/>
<result column="jgts" property="jgts"/>
<result column="mjsl" property="mjsl"/>
<result column="pbmj" property="pbmj"/>
<result column="fjsl" property="fjsl"/>
<result column="pbfj" property="pbfj"/>
<result column="jcsl" property="jcsl"/>
<result column="pbcl" property="pbcl"/>
<result column="txzbsl" property="txzbsl"/>
<result column="txzb" property="txzb"/>
<result column="jyqxsl" property="jyqxsl"/>
<result column="jyqx" property="jyqx"/>
<result column="wzlx" property="wzlx"/>
<result column="zzlx" property="zzlx"/>
<result column="xlfs" property="xlfs"/>
<result column="xfzt" property="xfzt"/>
<result column="bbkssj" property="bbkssj"/>
<result column="bbjssj" property="bbjssj"/>
<result column="bbzt" property="bbzt"/>
<result column="dqwz" property="dqwz"/>
<result column="jd" property="jd"/>
<result column="wd" property="wd"/>
<result column="zb" property="zb" typeHandler="com.mosty.base.feign.handle.PointTypeHandler"/>
<result column="zbhash" property="zbhash"/>
<result column="zbsj" property="zbsj"/>
<result column="xfsc" property="xfsc"/>
<result column="xflc" property="xflc"/>
<result column="xffwlx" property="xffwlx"/>
<result column="xffwid" property="xffwid"/>
<result column="ssbm" property="ssbm"/>
<result column="ssbmid" property="ssbmid"/>
<result column="ssbmdm" property="ssbmdm"/>
<result column="ssxgaj" property="ssxgaj"/>
<result column="ssxgajid" property="ssxgajid"/>
<result column="ssxgajdm" property="ssxgajdm"/>
<result column="sssgaj" property="sssgaj"/>
<result column="sssgajid" property="sssgajid"/>
<result column="sssgajdm" property="sssgajdm"/>
<result column="bz" property="bz"/>
<result property="xtSjly" column="xt_sjly" jdbcType="VARCHAR"/>
<result property="xtSjzt" column="xt_sjzt" jdbcType="VARCHAR"/>
<result property="xtScbz" column="xt_scbz" jdbcType="VARCHAR"/>
<result property="xtCjip" column="xt_cjip" jdbcType="VARCHAR"/>
<result property="xtCjsj" column="xt_cjsj" jdbcType="TIMESTAMP"/>
<result property="xtCjrId" column="xt_cjr_id" jdbcType="VARCHAR"/>
<result property="xtCjr" column="xt_cjr" jdbcType="VARCHAR"/>
<result property="xtCjbmdm" column="xt_cjbmdm" jdbcType="VARCHAR"/>
<result property="xtCjbmmc" column="xt_cjbmmc" jdbcType="VARCHAR"/>
<result property="xtZhgxip" column="xt_zhgxip" jdbcType="VARCHAR"/>
<result property="xtZhgxsj" column="xt_zhgxsj" jdbcType="TIMESTAMP"/>
<result property="xtZhgxrid" column="xt_zhgxrid" jdbcType="VARCHAR"/>
<result property="xtZhgxr" column="xt_zhgxr" jdbcType="VARCHAR"/>
<result property="xtZhgxbmdm" column="xt_zhgxbmdm" jdbcType="VARCHAR"/>
<result property="xtZhgxbm" column="xt_zhgxbm" jdbcType="VARCHAR"/>
</resultMap>
<sql id="base_column_list">
id, xfpb_id, qwdj_id, qwdj, qwbc_id, jz_id, jz_mc,
xfbm, xfbmdm, fzr_sfzh, fzr_xm, fzr_id, fzr_lxdh, xfrq, kssj, jssj,
zqsc, jgts, mjsl, pbmj, fjsl, pbfj, jcsl, pbcl, txzbsl, txzb, jyqxsl,
jyqx, wzlx, zzlx, xlfs, xfzt, bbkssj, bbjssj, bbzt, dqwz, jd, wd,
zbhash, zbsj, xfsc, xflc, xffwlx, xffwid, ssbm, ssbmdm, ssxgaj, ssxgajdm,ssbmid,ssxgajid,sssgajid,
sssgaj, sssgajdm, bz, xt_sjly, xt_sjzt, xt_scbz, xt_cjip,
xt_cjsj, xt_cjr_id, xt_cjr, xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj, xt_zhgxrid,
xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm
</sql>
<sql id="zb_sql">
ST_ASWKT
(zb)
as zb
</sql>
<!--id查询-->
<select id="queryById" resultMap="BaseResultMap">
select
<include refid="base_column_list"/>,
<include refid="zb_sql"/>
from mosty_qwgl.tb_qw_xfbb
where xt_scbz = '0' and id = #{id,jdbcType=VARCHAR}
</select>
<!-- gx_mosty_qwgl.-->
<!--更新报备坐标-->
<update id="updateXfbb">
update mosty_qwgl.tb_qw_xfbb
<set>
<if test="jd != null">
jd = #{jd},
</if>
<if test="wd != null">
wd = #{wd},
</if>
<if test="zb != null">
zb = ST_GEOMFROMTEXT(#{zb,typeHandler=com.mosty.base.feign.handle.PointTypeHandler}),
</if>
<if test="zbhash != null and zbhash != ''">
zbhash = #{zbhash},
</if>
<if test="dqwz != null and dqwz != ''">
dqwz = #{dqwz},
</if>
<if test="zbsj != null">
zbsj = #{zbsj},
</if>
<!-- <if test="xfsc != null">-->
<!-- xfsc = #{xfsc},-->
<!-- </if>-->
<if test="xflc != null">
xflc = #{xflc},
</if>
<if test="xfzt != null and xfzt != ''">
xfzt = #{xfzt},
</if>
<if test="bz != null and bz != ''">
bz = #{bz}
</if>
</set>
where id = #{id}
</update>
<select id="getsfbb" resultType="java.lang.Integer">
SELECT COUNT(1) FROM mosty_qwgl.tb_qw_xfbb where xt_scbz = '0' and bbzt = '0'
<if test="id != null and id != ''">
and id = #{id}
</if>
</select>
</mapper>

View File

@ -0,0 +1,16 @@
<?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.mosty.wzzx.mapper.TbQwZnzbMapper">
<select id="queryListByYwid" resultType="com.mosty.base.model.entity.qwzx.TbQwZnzb">
select a.* from mosty_qwgl.tb_qw_znzb a
where a.xt_scbz = '0'
and a.ywid in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>

View File

@ -0,0 +1,104 @@
<?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.mosty.wzzx.mapper.TbSjCyjlMapper">
<resultMap id="BaseResultMap" type="com.mosty.base.model.entity.sjzx.TbSjCyjl">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="sj_id" property="sjId"/>
<result column="bb_id" property="bbId"/>
<result column="jl_id" property="jlId"/>
<result column="jl_sfzh" property="jlSfzh"/>
<result column="jl_xm" property="jlXm"/>
<result column="jl_lxdh" property="jlLxdh"/>
<result column="sdzlsj" property="sdzlsj"/>
<result column="qszlsj" property="qszlsj"/>
<result column="ddxcsj" property="ddxcsj"/>
<result column="jssj" property="jssj"/>
<result column="mjfj" property="mjfj"/>
<result column="sfzyjz" property="sfzyjz"/>
<result column="zybqdm" property="zybqdm"/>
<result column="zybq" property="zybq"/>
<result column="dqwz" property="dqwz"/>
<result column="jd" property="jd"/>
<result column="wd" property="wd"/>
<result column="zb" property="zb" typeHandler="com.mosty.base.feign.handle.PointTypeHandler"/>
<result column="zbhash" property="zbhash"/>
<result column="jlzt" property="jlzt"/>
<result column="tp_id" property="tpId"/>
<result column="ssbm" property="ssbm"/>
<result column="ssbmdm" property="ssbmdm"/>
<result column="ssxgaj" property="ssxgaj"/>
<result column="ssxgajdm" property="ssxgajdm"/>
<result column="sssgaj" property="sssgaj"/>
<result column="sssgajdm" property="sssgajdm"/>
<result property="sssgajid" column="sssgajid" jdbcType="VARCHAR"/>
<result property="ssxgajid" column="ssxgajid" jdbcType="VARCHAR"/>
<result property="ssbmid" column="ssbmid" jdbcType="VARCHAR"/>
<result column="bz" property="bz"/>
<result property="xtSjly" column="xt_sjly" jdbcType="VARCHAR"/>
<result property="xtSjzt" column="xt_sjzt" jdbcType="VARCHAR"/>
<result property="xtScbz" column="xt_scbz" jdbcType="VARCHAR"/>
<result property="xtCjip" column="xt_cjip" jdbcType="VARCHAR"/>
<result property="xtCjsj" column="xt_cjsj" jdbcType="TIMESTAMP"/>
<result property="xtCjrId" column="xt_cjr_id" jdbcType="VARCHAR"/>
<result property="xtCjr" column="xt_cjr" jdbcType="VARCHAR"/>
<result property="xtCjbmdm" column="xt_cjbmdm" jdbcType="VARCHAR"/>
<result property="xtCjbmmc" column="xt_cjbmmc" jdbcType="VARCHAR"/>
<result property="xtZhgxip" column="xt_zhgxip" jdbcType="VARCHAR"/>
<result property="xtZhgxsj" column="xt_zhgxsj" jdbcType="TIMESTAMP"/>
<result property="xtZhgxrid" column="xt_zhgxrid" jdbcType="VARCHAR"/>
<result property="xtZhgxr" column="xt_zhgxr" jdbcType="VARCHAR"/>
<result property="xtZhgxbmdm" column="xt_zhgxbmdm" jdbcType="VARCHAR"/>
<result property="xtZhgxbm" column="xt_zhgxbm" jdbcType="VARCHAR"/>
<result property="bz" column="bz" jdbcType="VARCHAR"/>
</resultMap>
<sql id="base_column_list">
id, sj_id, bb_id, jl_id, jl_sfzh, jl_xm, jl_lxdh, sdzlsj, qszlsj, ddxcsj,
jssj, mjfj, sfzyjz, zybqdm, zybq, dqwz, jd, wd, zbhash, zbsj, jlzt, tp_id,
ssbm, ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm, bz, xt_sjly, xt_sjzt, xt_scbz,
xt_cjip, xt_cjsj, xt_cjr_id, xt_cjr, xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj,
xt_zhgxrid, xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm,ssbmid,ssxgajid,sssgajid,bz
</sql>
<sql id="zb_sql">
ST_ASWKT
(zb) as zb
</sql>
<!--身份证号码查询-->
<select id="queryBySfzh" resultMap="BaseResultMap">
select
<include refid="base_column_list"/>,
<include refid="zb_sql"/>
from mosty_sjzx.tb_sj_cyjl
where xt_scbz = '0' and jssj is null and jl_sfzh = #{sfzh,jdbcType=VARCHAR}
</select>
<!--更新坐标-->
<update id="updateZb">
update mosty_sjzx.tb_sj_cyjl
<set>
<if test="jd != null">
jd = #{jd},
</if>
<if test="wd != null">
wd = #{wd},
</if>
<if test="zb != null">
zb = ST_GEOMFROMTEXT(#{zb,typeHandler = com.mosty.base.feign.handle.PointTypeHandler}),
</if>
<if test="zbhash != null and zbhash != ''">
zbhash = #{zbhash},
</if>
<if test="dqwz != null and dqwz != ''">
dqwz = #{dqwz},
</if>
<if test="zbsj != null">
zbsj = #{zbsj},
</if>
</set>
where id = #{id}
</update>
</mapper>

View File

@ -0,0 +1,25 @@
<?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.mosty.wzzx.mapper.TbWzLswzMapper">
<insert id="insertEntity" parameterType="com.mosty.base.model.entity.wzzx.TbWzLswz">
insert into tb_wz_lswz (id,sjly,sjlydm,ywid,yh_id,yh_xm,
yh_sfzh,jz_id,jz_mc,dwrq,dwsj,jd,wd,zb,
zbhash,wztgz,guo,sheng,shi,csbm,ssqx,
qxbm,dzxz,dzjc,dwbz,xfsc,xflc,
ssbm, ssbmdm, ssxgaj, ssxgajdm,ssbmid,ssxgajid,sssgajid,
sssgaj, sssgajdm, xt_sjly, xt_sjzt, xt_scbz, xt_cjip, xt_cjsj, xt_cjr_id, xt_cjr,
xt_cjbmdm, xt_cjbmmc, xt_zhgxip,
xt_zhgxsj, xt_zhgxrid, xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz)
values (#{id},#{sjly},#{sjlydm},#{ywid},#{yhId}, #{yhXm},
#{yhSfzh},#{jzId},#{jzMc},#{dwrq},#{dwsj},#{jd},#{wd},
ST_GEOMFROMTEXT(#{zb, typeHandler = com.mosty.base.feign.handle.PointTypeHandler}),
#{zbhash},#{wztgz},#{guo},#{sheng},#{shi},#{csbm},#{ssqx},
#{qxbm},#{dzxz},#{dzjc},#{dwbz},#{xfsc},#{xflc},
#{ssbm}, #{ssbmdm}, #{ssxgaj}, #{ssxgajdm},#{ssbmid},#{ssxgajid},#{sssgajid},
#{sssgaj}, #{sssgajdm}, #{xtSjly}, #{xtSjzt}, #{xtScbz}, #{xtCjip}, #{xtCjsj}, #{xtCjrId}, #{xtCjr},
#{xtCjbmdm}, #{xtCjbmmc}, #{xtZhgxip},
#{xtZhgxsj}, #{xtZhgxrid}, #{xtZhgxr}, #{xtZhgxbmdm}, #{xtZhgxbm}, #{bz})
</insert>
</mapper>

View File

@ -0,0 +1,236 @@
<?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.mosty.wzzx.mapper.TbWzRywzMapper">
<resultMap type="com.mosty.base.model.entity.wzzx.TbWzRywz" id="BaseResultMap">
<result property="id" column="id"/>
<result property="yhId" column="yh_id"/>
<result property="yhSfzh" column="yh_sfzh"/>
<result property="yhXm" column="yh_xm"/>
<result property="zb" column="zb" typeHandler="com.mosty.base.feign.handle.LineStringTypeHandler"/>
<result property="zbsl" column="zbsl"/>
<result property="dwrq" column="dwrq"/>
<result property="kssj" column="kssj"/>
<result property="sc" column="sc"/>
<result property="lc" column="lc"/>
<result property="jd" column="jd"/>
<result property="wd" column="wd"/>
<result property="zhgxsj" column="zhgxsj"/>
<result property="ssbm" column="ssbm"/>
<result property="ssbmid" column="ssbmid"/>
<result property="ssbmdm" column="ssbmdm"/>
<result property="ssxgaj" column="ssxgaj"/>
<result property="ssxgajid" column="ssxgajid"/>
<result property="ssxgajdm" column="ssxgajdm"/>
<result property="sssgajid" column="sssgajid"/>
<result property="sssgaj" column="sssgaj"/>
<result property="sssgajdm" column="sssgajdm"/>
<result property="xtSjly" column="xt_sjly"/>
<result property="xtSjzt" column="xt_sjzt"/>
<result property="xtScbz" column="xt_scbz"/>
<result property="xtCjip" column="xt_cjip"/>
<result property="xtCjsj" column="xt_cjsj"/>
<result property="xtCjrId" column="xt_cjr_id"/>
<result property="xtCjr" column="xt_cjr"/>
<result property="xtCjbmdm" column="xt_cjbmdm"/>
<result property="xtCjbmmc" column="xt_cjbmmc"/>
<result property="xtZhgxip" column="xt_zhgxip"/>
<result property="xtZhgxsj" column="xt_zhgxsj"/>
<result property="xtZhgxrid" column="xt_zhgxrid"/>
<result property="xtZhgxr" column="xt_zhgxr"/>
<result property="xtZhgxbmdm" column="xt_zhgxbmdm"/>
<result property="xtZhgxbm" column="xt_zhgxbm"/>
<result property="bz" column="bz"/>
</resultMap>
<sql id="base_column_list">
id, yh_id, yh_sfzh, yh_xm,
zbsl, dwrq, kssj, jssj, sc, lc, jd, wd, zhgxsj,
ssbm, ssbmdm, ssxgaj, ssxgajdm,ssbmid,ssxgajid,sssgajid,
sssgaj, sssgajdm, xt_sjly, xt_sjzt, xt_scbz, xt_cjip, xt_cjsj, xt_cjr_id, xt_cjr,
xt_cjbmdm, xt_cjbmmc, xt_zhgxip,
xt_zhgxsj, xt_zhgxrid, xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz
</sql>
<sql id="zb_sql">
ST_ASWKT
(zb)
as zb
</sql>
<!--保存必巡线信息-->
<insert id="insertEntity" parameterType="com.mosty.base.model.entity.wzzx.TbWzRywz">
insert into tb_wz_rywz (id, yh_id, yh_sfzh, yh_xm,
zb,
zbsl, dwrq, kssj, jssj, sc, lc, jd, wd, zhgxsj,
ssbm, ssbmdm, ssxgaj, ssxgajdm, ssbmid, ssxgajid, sssgajid,
sssgaj, sssgajdm, xt_sjly, xt_sjzt, xt_scbz, xt_cjip, xt_cjsj, xt_cjr_id, xt_cjr,
xt_cjbmdm, xt_cjbmmc, xt_zhgxip,
xt_zhgxsj, xt_zhgxrid, xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz)
values (#{id}, #{yhId}, #{yhSfzh}, #{yhXm},
ST_GEOMFROMTEXT(#{zb,typeHandler = com.mosty.base.feign.handle.LineStringTypeHandler}),
#{zbsl}, #{dwrq}, #{kssj}, #{jssj}, #{sc}, #{lc}, #{jd}, #{wd}, #{zhgxsj},
#{ssbm}, #{ssbmdm}, #{ssxgaj}, #{ssxgajdm}, #{ssbmid}, #{ssxgajid}, #{sssgajid},
#{sssgaj}, #{sssgajdm}, #{xtSjly}, #{xtSjzt}, #{xtScbz}, #{xtCjip}, #{xtCjsj}, #{xtCjrId}, #{xtCjr},
#{xtCjbmdm}, #{xtCjbmmc}, #{xtZhgxip},
#{xtZhgxsj}, #{xtZhgxrid}, #{xtZhgxr}, #{xtZhgxbmdm}, #{xtZhgxbm}, #{bz})
</insert>
<!--修改-->
<update id="updateEntity" parameterType="com.mosty.base.model.entity.wzzx.TbWzRywz">
update tb_wz_rywz
<set>
<if test="yhId != null and yhId != ''">
yh_id = #{yhId},
</if>
<if test="yhSfzh != null and yhSfzh != ''">
yh_sfzh = #{yhSfzh},
</if>
<if test="yhXm != null and yhXm != ''">
yh_xm = #{yhXm},
</if>
<if test="zb != null">
zb = ST_GEOMFROMTEXT(#{zb,typeHandler = com.mosty.base.feign.handle.LineStringTypeHandler}),
</if>
<if test="zbsl != null and zbsl != ''">
zbsl = #{zbsl},
</if>
<if test="dwrq != null">
dwrq = #{dwrq},
</if>
<if test="kssj != null">
kssj = #{kssj},
</if>
<if test="jssj != null and jssj != ''">
jssj = #{jssj},
</if>
<if test="sc != null and sc != ''">
sc = #{sc},
</if>
<if test="lc != null and lc != ''">
lc = #{lc},
</if>
<if test="jd != null and jd != ''">
jd = #{jd},
</if>
<if test="wd != null and wd != ''">
wd = #{wd},
</if>
<if test="zhgxsj != null">
zhgxsj = #{zhgxsj},
</if>
<if test="ssbm != null and ssbm != ''">
ssbm = #{ssbm},
</if>
<if test="ssbmid != null and ssbmid != ''">
ssbmid = #{ssbmid},
</if>
<if test="ssbmdm != null and ssbmdm != ''">
ssbmdm = #{ssbmdm},
</if>
<if test="ssxgaj != null and ssxgaj != ''">
ssxgaj = #{ssxgaj},
</if>
<if test="ssxgajid != null and ssxgajid != ''">
ssxgajid = #{ssxgajid},
</if>
<if test="ssxgajdm != null and ssxgajdm != ''">
ssxgajdm = #{ssxgajdm},
</if>
<if test="sssgaj != null and sssgaj != ''">
sssgaj = #{sssgaj},
</if>
<if test="sssgajid != null and sssgajid != ''">
sssgajid = #{sssgajid},
</if>
<if test="sssgajdm != null and sssgajdm != ''">
sssgajdm = #{sssgajdm},
</if>
<if test="xtSjly != null and xtSjly != ''">
xt_sjly = #{xtSjly},
</if>
<if test="xtSjzt != null and xtSjzt != ''">
xt_sjzt = #{xtSjzt},
</if>
<if test="xtScbz != null and xtScbz != ''">
xt_scbz = #{xtScbz},
</if>
<if test="xtCjip != null and xtCjip != ''">
xt_cjip = #{xtCjip},
</if>
<if test="xtCjsj != null">
xt_cjsj = #{xtCjsj},
</if>
<if test="xtCjrId != null and xtCjrId != ''">
xt_cjr_id = #{xtCjrId},
</if>
<if test="xtCjr != null and xtCjr != ''">
xt_cjr = #{xtCjr},
</if>
<if test="xtCjbmdm != null and xtCjbmdm != ''">
xt_cjbmdm = #{xtCjbmdm},
</if>
<if test="xtCjbmmc != null and xtCjbmmc != ''">
xt_cjbmmc = #{xtCjbmmc},
</if>
<if test="xtZhgxip != null and xtZhgxip != ''">
xt_zhgxip = #{xtZhgxip},
</if>
<if test="xtZhgxsj != null">
xt_zhgxsj = #{xtZhgxsj},
</if>
<if test="xtZhgxrid != null and xtZhgxrid != ''">
xt_zhgxrid = #{xtZhgxrid},
</if>
<if test="xtZhgxr != null and xtZhgxr != ''">
xt_zhgxr = #{xtZhgxr},
</if>
<if test="xtZhgxbmdm != null and xtZhgxbmdm != ''">
xt_zhgxbmdm = #{xtZhgxbmdm},
</if>
<if test="xtZhgxbm != null and xtZhgxbm != ''">
xt_zhgxbm = #{xtZhgxbm},
</if>
<if test="bz != null and bz != ''">
bz = #{bz}
</if>
</set>
where id = #{id}
</update>
<select id="queryBySfzh" resultMap="BaseResultMap">
select
<include refid="base_column_list"/>,
<include refid="zb_sql"/>
from tb_wz_rywz
where xt_scbz = '0'
and yh_sfzh = #{yhSfzh,jdbcType=VARCHAR}
and TO_DAYS(dwrq) = TO_DAYS(NOW())
</select>
<select id="selectBySfz" resultMap="BaseResultMap">
select
<include refid="base_column_list"/>,
<include refid="zb_sql"/>
from tb_wz_rywz
where xt_scbz = '0' and xt_sjzt = '1'
<if test="sfzh != null and sfzh != ''">
and yh_sfzh = #{sfzh}
</if>
<if test="dwrq != null and dwrq != ''">
and dwrq = #{dwrq}
</if>
limit 1
</select>
<select id="getRysltjCount" resultType="java.lang.Integer">
select count(DISTINCT yh_id) from tb_wz_rywz where xt_scbz = '0' and xt_sjzt = '1'
<if test="kssj != null and kssj != ''">
and dwrq >= #{kssj}
</if>
<if test="jssj != null and jssj != ''">
and dwrq &lt;= #{jssj}
</if>
${useSql}
</select>
</mapper>

View File

@ -0,0 +1,50 @@
<?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.mosty.wzzx.mapper.TbWzSblswzMapper">
<insert id="insertEntity" parameterType="com.mosty.base.model.entity.wzzx.TbWzSblswz">
insert into tb_wz_sblswz (id, sjly, sjlydm, ywid, sbid, sbmc, yh_id, yh_xm,
yh_sfzh, jz_id, jz_mc, dwrq, dwsj, jd, wd, zb,
zbhash, wztgz, guo, sheng, shi, csbm, ssqx,
qxbm, dzxz, dzjc, dwbz, xfsc, xflc,
ssbm, ssbmdm, ssxgaj, ssxgajdm,ssbmid,ssxgajid,sssgajid,
sssgaj, sssgajdm, xt_sjly, xt_sjzt, xt_scbz, xt_cjip, xt_cjsj, xt_cjr_id, xt_cjr,
xt_cjbmdm, xt_cjbmmc, xt_zhgxip,
xt_zhgxsj, xt_zhgxrid, xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz)
values (#{id}, #{sjly}, #{sjlydm}, #{ywid}, #{sbid}, #{sbmc}, #{yhId}, #{yhXm},
#{yhSfzh},#{jzId},#{jzMc},#{dwrq},#{dwsj},#{jd},#{wd},
ST_GEOMFROMTEXT(#{zb, typeHandler = com.mosty.base.feign.handle.PointTypeHandler}),
#{zbhash},#{wztgz},#{guo},#{sheng},#{shi},#{csbm},#{ssqx},
#{qxbm},#{dzxz},#{dzjc},#{dwbz},#{xfsc},#{xflc},
#{ssbm}, #{ssbmdm}, #{ssxgaj}, #{ssxgajdm},#{ssbmid},#{ssxgajid},#{sssgajid},
#{sssgaj}, #{sssgajdm}, #{xtSjly}, #{xtSjzt}, #{xtScbz}, #{xtCjip}, #{xtCjsj}, #{xtCjrId}, #{xtCjr},
#{xtCjbmdm}, #{xtCjbmmc}, #{xtZhgxip},
#{xtZhgxsj}, #{xtZhgxrid}, #{xtZhgxr}, #{xtZhgxbmdm}, #{xtZhgxbm}, #{bz})
</insert>
<select id="getSblswzCount" resultType="java.lang.Integer">
select count(DISTINCT sbid) from tb_wz_sblswz where xt_scbz = '0' and xt_sjzt = '1'
<if test="kssj != null and kssj != ''">
and dwrq >= #{kssj}
</if>
<if test="jssj != null and jssj != ''">
and dwrq &lt;= #{jssj}
</if>
${useSql}
</select>
<select id="selectSbLswz" resultType="com.mosty.base.model.entity.wzzx.TbWzSblswz">
SELECT jd,wd FROM `tb_wz_sblswz` where
<if test="gpsId != null and gpsId != ''">
and sbid >= #{gpsId}
</if>
<if test="kssj != null and kssj != ''">
and xt_cjsj >= #{kssj}
</if>
<if test="jssj != null and jssj != ''">
and xt_cjsj &lt;= #{jssj}
</if>
</select>
</mapper>

View File

@ -0,0 +1,30 @@
<?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.mosty.wzzx.mapper.TbWzSbsswzMapper">
<insert id="insertEntity" parameterType="com.mosty.base.model.entity.wzzx.TbWzSbsswz">
insert into tb_wz_sbsswz (id, sjly, sjlydm, ywid, sbid, sbmc, yh_id, yh_xm,
yh_sfzh, jz_id, jz_mc, dwrq, dwsj, jd, wd, zb,
zbhash, wztgz, guo, sheng, shi, csbm, ssqx,
qxbm, dzxz, dzjc, dwbz, xfsc, xflc,
ssbm, ssbmdm, ssxgaj, ssxgajdm,ssbmid,ssxgajid,sssgajid,
sssgaj, sssgajdm, xt_sjly, xt_sjzt, xt_scbz, xt_cjip, xt_cjsj, xt_cjr_id, xt_cjr,
xt_cjbmdm, xt_cjbmmc, xt_zhgxip,
xt_zhgxsj, xt_zhgxrid, xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz)
values (#{id}, #{sjly}, #{sjlydm}, #{ywid}, #{sbid}, #{sbmc}, #{yhId}, #{yhXm},
#{yhSfzh}, #{jzId}, #{jzMc}, #{dwrq}, #{dwsj}, #{jd}, #{wd},
ST_GEOMFROMTEXT(#{zb, typeHandler = com.mosty.base.feign.handle.PointTypeHandler}),
#{zbhash},#{wztgz},#{guo},#{sheng},#{shi},#{csbm},#{ssqx},
#{qxbm},#{dzxz},#{dzjc},#{dwbz},#{xfsc},#{xflc},
#{ssbm}, #{ssbmdm}, #{ssxgaj}, #{ssxgajdm},#{ssbmid},#{ssxgajid},#{sssgajid},
#{sssgaj}, #{sssgajdm}, #{xtSjly}, #{xtSjzt}, #{xtScbz}, #{xtCjip}, #{xtCjsj}, #{xtCjrId}, #{xtCjr},
#{xtCjbmdm}, #{xtCjbmmc}, #{xtZhgxip},
#{xtZhgxsj}, #{xtZhgxrid}, #{xtZhgxr}, #{xtZhgxbmdm}, #{xtZhgxbm}, #{bz})
</insert>
<!--删除7日前数据-->
<delete id="delHistory" parameterType="java.lang.String">
delete from tb_wz_sbsswz where DATE(dwsj) &lt;= DATE(DATE_SUB(NOW(),INTERVAL 7 DAY));
</delete>
</mapper>

View File

@ -0,0 +1,158 @@
<?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.mosty.wzzx.mapper.TbWzSswzMapper">
<resultMap type="com.mosty.base.model.entity.wzzx.TbWzSswz" id="BaseResultMap">
<result property="id" column="id"/>
<result property="sjly" column="sjly"/>
<result property="sjlydm" column="sjlydm"/>
<result property="ywid" column="ywid"/>
<result property="yhId" column="yh_id"/>
<result property="yhXm" column="yh_xm"/>
<result property="yhSfzh" column="yh_sfzh"/>
<result property="jzId" column="jz_id"/>
<result property="jzMc" column="jz_mc"/>
<result property="dwrq" column="dwrq"/>
<result property="dwsj" column="dwsj"/>
<result property="jd" column="jd"/>
<result property="wd" column="wd"/>
<result property="zb" column="zb" typeHandler="com.mosty.base.feign.handle.PointTypeHandler"/>
<result property="zbhash" column="zbhash"/>
<result property="wztgz" column="wztgz"/>
<result property="guo" column="guo"/>
<result property="sheng" column="sheng"/>
<result property="shi" column="shi"/>
<result property="csbm" column="csbm"/>
<result property="ssqx" column="ssqx"/>
<result property="qxbm" column="qxbm"/>
<result property="dzxz" column="dzxz"/>
<result property="dzjc" column="dzjc"/>
<result property="dwbz" column="dwbz"/>
<result property="xfsc" column="xfsc"/>
<result property="xflc" column="xflc"/>
<result property="jrbh" column="jrbh"/>
<result property="ssbm" column="ssbm"/>
<result property="ssbmdm" column="ssbmdm" />
<result property="ssbmid" column="ssbmid" />
<result property="ssxgaj" column="ssxgaj" />
<result property="ssxgajid" column="ssxgajid" />
<result property="ssxgajdm" column="ssxgajdm" />
<result property="sssgaj" column="sssgaj" />
<result property="sssgajid" column="sssgajid" />
<result property="sssgajdm" column="sssgajdm" />
<result property="xtSjly" column="xt_sjly" />
<result property="xtSjzt" column="xt_sjzt" />
<result property="xtScbz" column="xt_scbz" />
<result property="xtCjip" column="xt_cjip" />
<result property="xtCjsj" column="xt_cjsj" />
<result property="xtCjrId" column="xt_cjr_id" />
<result property="xtCjr" column="xt_cjr" />
<result property="xtCjbmdm" column="xt_cjbmdm" />
<result property="xtCjbmmc" column="xt_cjbmmc" />
<result property="xtZhgxip" column="xt_zhgxip" />
<result property="xtZhgxsj" column="xt_zhgxsj" />
<result property="xtZhgxrid" column="xt_zhgxrid" />
<result property="xtZhgxr" column="xt_zhgxr" />
<result property="xtZhgxbmdm" column="xt_zhgxbmdm" />
<result property="xtZhgxbm" column="xt_zhgxbm" />
<result property="bz" column="bz" />
</resultMap>
<sql id="base_column_list">
id, sjly, sjlydm, ywid, yh_id, yh_xm, yh_sfzh, jz_id, jz_mc,
dwrq, dwsj, jd, wd, zbhash, wztgz, guo, sheng, shi,
csbm, ssqx, qxbm, dzxz, dzjc, dwbz, xfsc, xflc, jrbh,
ssbm, ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm,ssbmid,ssxgajid,sssgajid, xt_sjly,
xt_sjzt, xt_scbz, xt_cjip, xt_cjsj, xt_cjr_id, xt_cjr,
xt_cjbmdm, xt_cjbmmc, xt_zhgxip,
xt_zhgxsj, xt_zhgxrid, xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz
</sql>
<sql id="zb_sql">
ST_ASWKT
(zb) as zb
</sql>
<insert id="insertEntity" parameterType="com.mosty.base.model.entity.wzzx.TbWzSswz">
insert into tb_wz_sswz (id,sjly,sjlydm,ywid,yh_id,yh_xm,
yh_sfzh,jz_id,jz_mc,dwrq,dwsj,jd,wd,zb,
zbhash, wztgz, guo, sheng, shi, csbm, ssqx,
qxbm, dzxz, dzjc, dwbz, xfsc, xflc, jrbh,
ssbm, ssbmdm, ssxgaj, ssxgajdm,ssbmid,ssxgajid,sssgajid,
sssgaj, sssgajdm, xt_sjly, xt_sjzt, xt_scbz, xt_cjip, xt_cjsj, xt_cjr_id, xt_cjr,
xt_cjbmdm, xt_cjbmmc, xt_zhgxip,
xt_zhgxsj, xt_zhgxrid, xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz)
values (#{id},#{sjly},#{sjlydm},#{ywid},#{yhId}, #{yhXm},
#{yhSfzh},#{jzId},#{jzMc},#{dwrq},#{dwsj},#{jd},#{wd},
ST_GEOMFROMTEXT(#{zb, typeHandler = com.mosty.base.feign.handle.PointTypeHandler}),
#{zbhash}, #{wztgz}, #{guo}, #{sheng}, #{shi}, #{csbm}, #{ssqx},
#{qxbm}, #{dzxz}, #{dzjc}, #{dwbz}, #{xfsc}, #{xflc}, #{jrbh},
#{ssbm}, #{ssbmdm}, #{ssxgaj}, #{ssxgajdm},#{ssbmid},#{ssxgajid},#{sssgajid},
#{sssgaj}, #{sssgajdm}, #{xtSjly}, #{xtSjzt}, #{xtScbz}, #{xtCjip}, #{xtCjsj}, #{xtCjrId}, #{xtCjr},
#{xtCjbmdm}, #{xtCjbmmc}, #{xtZhgxip},
#{xtZhgxsj}, #{xtZhgxrid}, #{xtZhgxr}, #{xtZhgxbmdm}, #{xtZhgxbm}, #{bz})
</insert>
<!--id查询-->
<select id="queryById" resultMap="BaseResultMap">
select
<include refid="base_column_list"/>,
<include refid="zb_sql"/>
from tb_wz_sswz
where xt_scbz = '0' and id = #{id,jdbcType=VARCHAR}
</select>
<!--查询用户最新的位置-->
<select id="querySswzNow" resultMap="BaseResultMap">
SELECT
<include refid="base_column_list"/>,
<include refid="zb_sql"/>
FROM `tb_wz_sswz`
where xt_scbz = '0'
<if test="yhId != null and yhId != ''">
and yh_id = #{yhId}
</if>
<if test="jrbh != null and jrbh != ''">
and jrbh = #{jrbh}
</if>
order by dwsj desc limit 0,1
</select>
<!--查询用户最新的位置-->
<select id="querySswzToday" resultMap="BaseResultMap">
SELECT
<include refid="base_column_list"/>,
<include refid="zb_sql"/>
FROM `tb_wz_sswz`
where xt_scbz = '0'
and to_days(dwsj) = to_days(now());
<if test="yhId != null and yhId != ''">
and yh_id = #{yhId}
</if>
<if test="jrbh != null and jrbh != ''">
and jrbh = #{jrbh}
</if>
order by dwsj desc
</select>
<!--根据用户ID查询-->
<select id="querySswzYhid" resultType="java.lang.String">
SELECT
yh_id
FROM
tb_wz_sswz
WHERE
xt_scbz = '0'
AND yh_id IS NOT NULL
AND to_days( dwsj ) = to_days(
now())
GROUP BY
yh_id
</select>
<!--删除7日前数据-->
<delete id="delHistory" parameterType="java.lang.String">
delete from tb_wz_sswz where DATE(dwsj) &lt;= DATE(DATE_SUB(NOW(),INTERVAL 7 DAY));
</delete>
</mapper>

View File

@ -0,0 +1,559 @@
<?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.mosty.wzzx.mapper.TbWzXfwzMapper">
<resultMap type="com.mosty.base.model.entity.wzzx.TbWzXfwz" id="TbWzXfwzMap">
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="bbId" column="bb_id" jdbcType="VARCHAR"/>
<result property="yhId" column="yh_id" jdbcType="VARCHAR"/>
<result property="yhSfzh" column="yh_sfzh" jdbcType="VARCHAR"/>
<result property="yhXm" column="yh_xm" jdbcType="VARCHAR"/>
<result property="jzId" column="jz_id" jdbcType="VARCHAR"/>
<result property="jzMc" column="jz_mc" jdbcType="VARCHAR"/>
<result property="zb" column="zb" typeHandler="com.mosty.base.feign.handle.LineStringTypeHandler"/>
<result property="zbsl" column="zbsl" jdbcType="INTEGER"/>
<result property="dwrq" column="dwrq" jdbcType="TIMESTAMP"/>
<result property="kssj" column="kssj" jdbcType="TIMESTAMP"/>
<result property="jssj" column="jssj" jdbcType="TIMESTAMP"/>
<result property="sc" column="sc" jdbcType="INTEGER"/>
<result property="lc" column="lc" jdbcType="INTEGER"/>
<result property="jd" column="jd" jdbcType="NUMERIC"/>
<result property="wd" column="wd" jdbcType="NUMERIC"/>
<result property="zhgxsj" column="zhgxsj" jdbcType="TIMESTAMP"/>
<result property="ssbm" column="ssbm" jdbcType="VARCHAR"/>
<result property="ssbmid" column="ssbmid" jdbcType="VARCHAR"/>
<result property="ssbmdm" column="ssbmdm" jdbcType="VARCHAR"/>
<result property="ssxgaj" column="ssxgaj" jdbcType="VARCHAR"/>
<result property="ssxgajid" column="ssxgajid" jdbcType="VARCHAR"/>
<result property="ssxgajdm" column="ssxgajdm" jdbcType="VARCHAR"/>
<result property="sssgaj" column="sssgaj" jdbcType="VARCHAR"/>
<result property="sssgajid" column="sssgajid" jdbcType="VARCHAR"/>
<result property="sssgajdm" column="sssgajdm" jdbcType="VARCHAR"/>
<result property="xtSjly" column="xt_sjly" jdbcType="VARCHAR"/>
<result property="xtSjzt" column="xt_sjzt" jdbcType="VARCHAR"/>
<result property="xtScbz" column="xt_scbz" jdbcType="VARCHAR"/>
<result property="xtCjip" column="xt_cjip" jdbcType="VARCHAR"/>
<result property="xtCjsj" column="xt_cjsj" jdbcType="TIMESTAMP"/>
<result property="xtCjrId" column="xt_cjr_id" jdbcType="VARCHAR"/>
<result property="xtCjr" column="xt_cjr" jdbcType="VARCHAR"/>
<result property="xtCjbmdm" column="xt_cjbmdm" jdbcType="VARCHAR"/>
<result property="xtCjbmmc" column="xt_cjbmmc" jdbcType="VARCHAR"/>
<result property="xtZhgxip" column="xt_zhgxip" jdbcType="VARCHAR"/>
<result property="xtZhgxsj" column="xt_zhgxsj" jdbcType="TIMESTAMP"/>
<result property="xtZhgxrid" column="xt_zhgxrid" jdbcType="VARCHAR"/>
<result property="xtZhgxr" column="xt_zhgxr" jdbcType="VARCHAR"/>
<result property="xtZhgxbmdm" column="xt_zhgxbmdm" jdbcType="VARCHAR"/>
<result property="xtZhgxbm" column="xt_zhgxbm" jdbcType="VARCHAR"/>
<result property="bz" column="bz" jdbcType="VARCHAR"/>
</resultMap>
<sql id="base_column_list">
id, bb_id, yh_id, yh_sfzh, yh_xm, jz_id, jz_mc,
zbsl, dwrq, kssj, jssj, sc, lc, jd, wd, zhgxsj,
ssbm, ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm,ssbmid,ssxgajid,sssgajid, xt_sjly, xt_sjzt, xt_scbz, xt_cjip,
xt_cjsj, xt_cjr_id, xt_cjr, xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj, xt_zhgxrid,
xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz
</sql>
<sql id="zb_sql">
ST_ASWKT
(zb) as zb
</sql>
<!--查询所有-->
<select id="queryAll" resultMap="TbWzXfwzMap">
select
<include refid="base_column_list"/>,
<include refid="zb_sql"/>
from tb_wz_xfwz
where xt_scbz = '0'
</select>
<!--查询单个-->
<select id="queryById" resultMap="TbWzXfwzMap">
select
<include refid="base_column_list"/>,
<include refid="zb_sql"/>
from tb_wz_xfwz
where xt_scbz = '0'
and id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="TbWzXfwzMap">
select
id, bb_id, yh_id, yh_sfzh, yh_xm, jz_id, jz_mc, zb, zbsl, dwrq, kssj, jssj, sc, lc,
ssbm, ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm,ssbmid,ssxgajid,sssgajid, xt_sjly, xt_sjzt, xt_scbz, xt_cjip,
xt_cjsj, xt_cjr_id, xt_cjr, xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj, xt_zhgxrid,
xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz
from tb_wz_xfwz
<where>
<if test="id != null and id != ''">
and id = #{id}
</if>
<if test="bbId != null and bbId != ''">
and bb_id = #{bbId}
</if>
<if test="yhId != null and yhId != ''">
and yh_id = #{yhId}
</if>
<if test="yhSfzh != null and yhSfzh != ''">
and yh_sfzh = #{yhSfzh}
</if>
<if test="yhXm != null and yhXm != ''">
and yh_xm = #{yhXm}
</if>
<if test="jzId != null and jzId != ''">
and jz_id = #{jzId}
</if>
<if test="jzMc != null and jzMc != ''">
and jz_mc = #{jzMc}
</if>
<if test="zb != null and zb != ''">
and zb = #{zb}
</if>
<if test="zbsl != null">
and zbsl = #{zbsl}
</if>
<if test="dwrq != null">
and dwrq = #{dwrq}
</if>
<if test="kssj != null">
and kssj = #{kssj}
</if>
<if test="jssj != null">
and jssj = #{jssj}
</if>
<if test="sc != null">
and sc = #{sc}
</if>
<if test="lc != null">
and lc = #{lc}
</if>
<if test="ssbm != null and ssbm != ''">
and ssbm = #{ssbm}
</if>
<if test="ssbmid != null and ssbmid != ''">
and ssbmid = #{ssbmid}
</if>
<if test="ssbmdm != null and ssbmdm != ''">
and ssbmdm = #{ssbmdm}
</if>
<if test="ssxgaj != null and ssxgaj != ''">
and ssxgaj = #{ssxgaj}
</if>
<if test="ssxgajid != null and ssxgajid != ''">
and ssxgajid = #{ssxgajid}
</if>
<if test="ssxgajdm != null and ssxgajdm != ''">
and ssxgajdm = #{ssxgajdm}
</if>
<if test="sssgaj != null and sssgaj != ''">
and sssgaj = #{sssgaj}
</if>
<if test="sssgajid != null and sssgajid != ''">
and sssgajid = #{sssgajid}
</if>
<if test="sssgajdm != null and sssgajdm != ''">
and sssgajdm = #{sssgajdm}
</if>
<if test="xtSjly != null and xtSjly != ''">
and xt_sjly = #{xtSjly}
</if>
<if test="xtSjzt != null and xtSjzt != ''">
and xt_sjzt = #{xtSjzt}
</if>
<if test="xtScbz != null and xtScbz != ''">
and xt_scbz = #{xtScbz}
</if>
<if test="xtCjip != null and xtCjip != ''">
and xt_cjip = #{xtCjip}
</if>
<if test="xtCjsj != null">
and xt_cjsj = #{xtCjsj}
</if>
<if test="xtCjrId != null and xtCjrId != ''">
and xt_cjr_id = #{xtCjrId}
</if>
<if test="xtCjr != null and xtCjr != ''">
and xt_cjr = #{xtCjr}
</if>
<if test="xtCjbmdm != null and xtCjbmdm != ''">
and xt_cjbmdm = #{xtCjbmdm}
</if>
<if test="xtCjbmmc != null and xtCjbmmc != ''">
and xt_cjbmmc = #{xtCjbmmc}
</if>
<if test="xtZhgxip != null and xtZhgxip != ''">
and xt_zhgxip = #{xtZhgxip}
</if>
<if test="xtZhgxsj != null">
and xt_zhgxsj = #{xtZhgxsj}
</if>
<if test="xtZhgxrid != null and xtZhgxrid != ''">
and xt_zhgxrid = #{xtZhgxrid}
</if>
<if test="xtZhgxr != null and xtZhgxr != ''">
and xt_zhgxr = #{xtZhgxr}
</if>
<if test="xtZhgxbmdm != null and xtZhgxbmdm != ''">
and xt_zhgxbmdm = #{xtZhgxbmdm}
</if>
<if test="xtZhgxbm != null and xtZhgxbm != ''">
and xt_zhgxbm = #{xtZhgxbm}
</if>
<if test="bz != null and bz != ''">
and bz = #{bz}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from tb_wz_xfwz
<where>
<if test="id != null and id != ''">
and id = #{id}
</if>
<if test="bbId != null and bbId != ''">
and bb_id = #{bbId}
</if>
<if test="yhId != null and yhId != ''">
and yh_id = #{yhId}
</if>
<if test="yhSfzh != null and yhSfzh != ''">
and yh_sfzh = #{yhSfzh}
</if>
<if test="yhXm != null and yhXm != ''">
and yh_xm = #{yhXm}
</if>
<if test="jzId != null and jzId != ''">
and jz_id = #{jzId}
</if>
<if test="jzMc != null and jzMc != ''">
and jz_mc = #{jzMc}
</if>
<if test="zb != null and zb != ''">
and zb = #{zb}
</if>
<if test="zbsl != null">
and zbsl = #{zbsl}
</if>
<if test="dwrq != null">
and dwrq = #{dwrq}
</if>
<if test="kssj != null">
and kssj = #{kssj}
</if>
<if test="jssj != null">
and jssj = #{jssj}
</if>
<if test="sc != null">
and sc = #{sc}
</if>
<if test="lc != null">
and lc = #{lc}
</if>
<if test="ssbm != null and ssbm != ''">
and ssbm = #{ssbm}
</if>
<if test="ssbmid != null and ssbmid != ''">
and ssbmid = #{ssbmid}
</if>
<if test="ssbmdm != null and ssbmdm != ''">
and ssbmdm = #{ssbmdm}
</if>
<if test="ssxgaj != null and ssxgaj != ''">
and ssxgaj = #{ssxgaj}
</if>
<if test="ssxgajid != null and ssxgajid != ''">
and ssxgajid = #{ssxgajid}
</if>
<if test="ssxgajdm != null and ssxgajdm != ''">
and ssxgajdm = #{ssxgajdm}
</if>
<if test="sssgaj != null and sssgaj != ''">
and sssgaj = #{sssgaj}
</if>
<if test="sssgajid != null and sssgajid != ''">
and sssgajid = #{sssgajid}
</if>
<if test="sssgajdm != null and sssgajdm != ''">
and sssgajdm = #{sssgajdm}
</if>
<if test="xtSjly != null and xtSjly != ''">
and xt_sjly = #{xtSjly}
</if>
<if test="xtSjzt != null and xtSjzt != ''">
and xt_sjzt = #{xtSjzt}
</if>
<if test="xtScbz != null and xtScbz != ''">
and xt_scbz = #{xtScbz}
</if>
<if test="xtCjip != null and xtCjip != ''">
and xt_cjip = #{xtCjip}
</if>
<if test="xtCjsj != null">
and xt_cjsj = #{xtCjsj}
</if>
<if test="xtCjrId != null and xtCjrId != ''">
and xt_cjr_id = #{xtCjrId}
</if>
<if test="xtCjr != null and xtCjr != ''">
and xt_cjr = #{xtCjr}
</if>
<if test="xtCjbmdm != null and xtCjbmdm != ''">
and xt_cjbmdm = #{xtCjbmdm}
</if>
<if test="xtCjbmmc != null and xtCjbmmc != ''">
and xt_cjbmmc = #{xtCjbmmc}
</if>
<if test="xtZhgxip != null and xtZhgxip != ''">
and xt_zhgxip = #{xtZhgxip}
</if>
<if test="xtZhgxsj != null">
and xt_zhgxsj = #{xtZhgxsj}
</if>
<if test="xtZhgxrid != null and xtZhgxrid != ''">
and xt_zhgxrid = #{xtZhgxrid}
</if>
<if test="xtZhgxr != null and xtZhgxr != ''">
and xt_zhgxr = #{xtZhgxr}
</if>
<if test="xtZhgxbmdm != null and xtZhgxbmdm != ''">
and xt_zhgxbmdm = #{xtZhgxbmdm}
</if>
<if test="xtZhgxbm != null and xtZhgxbm != ''">
and xt_zhgxbm = #{xtZhgxbm}
</if>
<if test="bz != null and bz != ''">
and bz = #{bz}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into tb_wz_xfwz(id, bb_id, yh_id, yh_sfzh, yh_xm, jz_id, jz_mc,
zb,
zbsl, dwrq, kssj, jssj, sc, lc, jd, wd, zhgxsj,ssbmid,ssxgajid,sssgajid,
ssbm, ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm, xt_sjly, xt_sjzt, xt_scbz, xt_cjip,
xt_cjsj, xt_cjr_id, xt_cjr, xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj, xt_zhgxrid,
xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz)
values (#{id}, #{bbId}, #{yhId}, #{yhSfzh}, #{yhXm}, #{jzId}, #{jzMc},
ST_GEOMFROMTEXT(#{zb,typeHandler = com.mosty.base.feign.handle.LineStringTypeHandler}),
#{zbsl}, #{dwrq}, #{kssj}, #{jssj}, #{sc}, #{lc}, #{jd}, #{wd}, #{zhgxsj},#{ssbmid},#{ssxgajid},#{sssgajid},
#{ssbm}, #{ssbmdm}, #{ssxgaj}, #{ssxgajdm}, #{sssgaj}, #{sssgajdm}, #{xtSjly}, #{xtSjzt}, #{xtScbz},
#{xtCjip}, #{xtCjsj}, #{xtCjrId}, #{xtCjr}, #{xtCjbmdm}, #{xtCjbmmc}, #{xtZhgxip}, #{xtZhgxsj},
#{xtZhgxrid}, #{xtZhgxr}, #{xtZhgxbmdm}, #{xtZhgxbm}, #{bz})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into tb_wz_xfwz(bb_id, yh_id, yh_sfzh, yh_xm, jz_id, jz_mc, zb, zbsl, dwrq, kssj, jssj, sc, lc, jd, wd, zhgxsj, ssbm,
ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm, xt_sjly, xt_sjzt, xt_scbz, xt_cjip, xt_cjsj, xt_cjr_id, xt_cjr,
xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj, xt_zhgxrid, xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.bbId}, #{entity.yhId}, #{entity.yhSfzh}, #{entity.yhXm}, #{entity.jzId}, #{entity.jzMc},
#{entity.zb}, #{entity.zbsl}, #{entity.dwrq}, #{entity.kssj}, #{entity.jssj}, #{entity.sc}, #{entity.lc},
#{jd}, #{wd}, #{zhgxsj}, #{entity.ssbm}, #{entity.ssbmdm}, #{entity.ssxgaj}, #{entity.ssxgajdm},
#{entity.sssgaj}, #{entity.sssgajdm}, #{entity.xtSjly}, #{entity.xtSjzt}, #{entity.xtScbz}, #{entity.xtCjip}, #{entity.xtCjsj}, #{entity.xtCjrId}, #{entity.xtCjr}, #{entity.xtCjbmdm}, #{entity.xtCjbmmc}, #{entity.xtZhgxip}, #{entity.xtZhgxsj}, #{entity.xtZhgxrid}, #{entity.xtZhgxr}, #{entity.xtZhgxbmdm}, #{entity.xtZhgxbm}, #{entity.bz})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into tb_wz_xfwz(bb_id, yh_id, yh_sfzh, yh_xm, jz_id, jz_mc, zb, zbsl, dwrq, kssj, jssj, sc, lc, jd, wd, zhgxsj,
ssbm, ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm, xt_sjly, xt_sjzt, xt_scbz, xt_cjip,
xt_cjsj, xt_cjr_id, xt_cjr, xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj, xt_zhgxrid, xt_zhgxr, xt_zhgxbmdm,
xt_zhgxbm, bz)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.bbId}, #{entity.yhId}, #{entity.yhSfzh}, #{entity.yhXm}, #{entity.jzId}, #{entity.jzMc},
#{entity.zb}, #{entity.zbsl}, #{entity.dwrq}, #{entity.kssj}, #{entity.jssj}, #{entity.sc},
#{entity.lc}, #{jd}, #{wd}, #{zhgxsj},
#{entity.ssbm}, #{entity.ssbmdm}, #{entity.ssxgaj}, #{entity.ssxgajdm}, #{entity.sssgaj},
#{entity.sssgajdm}, #{entity.xtSjly}, #{entity.xtSjzt}, #{entity.xtScbz}, #{entity.xtCjip},
#{entity.xtCjsj}, #{entity.xtCjrId}, #{entity.xtCjr}, #{entity.xtCjbmdm}, #{entity.xtCjbmmc}, #{entity.xtZhgxip}, #{entity.xtZhgxsj}, #{entity.xtZhgxrid}, #{entity.xtZhgxr}, #{entity.xtZhgxbmdm}, #{entity.xtZhgxbm}, #{entity.bz})
</foreach>
on duplicate key update
bb_id = values(bb_id),
yh_id = values(yh_id),
yh_sfzh = values(yh_sfzh),
yh_xm = values(yh_xm),
jz_id = values(jz_id),
jz_mc = values(jz_mc),
zb = values(zb),
zbsl = values(zbsl),
dwrq = values(dwrq),
kssj = values(kssj),
jssj = values(jssj),
sc = values(sc),
lc = values(lc),
jd = values(jd),
wd = values(wd),
zhgxsj = values(zhgxsj),
ssbm = values(ssbm),
ssbmdm = values(ssbmdm),
ssxgaj = values(ssxgaj),
ssxgajdm = values(ssxgajdm),
sssgaj = values(sssgaj),
sssgajdm = values(sssgajdm),
xt_sjly = values(xt_sjly),
xt_sjzt = values(xt_sjzt),
xt_scbz = values(xt_scbz),
xt_cjip = values(xt_cjip),
xt_cjsj = values(xt_cjsj),
xt_cjr_id = values(xt_cjr_id),
xt_cjr = values(xt_cjr),
xt_cjbmdm = values(xt_cjbmdm),
xt_cjbmmc = values(xt_cjbmmc),
xt_zhgxip = values(xt_zhgxip),
xt_zhgxsj = values(xt_zhgxsj),
xt_zhgxrid = values(xt_zhgxrid),
xt_zhgxr = values(xt_zhgxr),
xt_zhgxbmdm = values(xt_zhgxbmdm),
xt_zhgxbm = values(xt_zhgxbm),
bz = values(bz)
</insert>
<!--通过主键修改数据-->
<update id="update">
update tb_wz_xfwz
<set>
<if test="bbId != null and bbId != ''">
bb_id = #{bbId},
</if>
<if test="yhId != null and yhId != ''">
yh_id = #{yhId},
</if>
<if test="yhSfzh != null and yhSfzh != ''">
yh_sfzh = #{yhSfzh},
</if>
<if test="yhXm != null and yhXm != ''">
yh_xm = #{yhXm},
</if>
<if test="jzId != null and jzId != ''">
jz_id = #{jzId},
</if>
<if test="jzMc != null and jzMc != ''">
jz_mc = #{jzMc},
</if>
<if test="zb != null">
zb = ST_GEOMFROMTEXT(#{zb,typeHandler = com.mosty.base.feign.handle.LineStringTypeHandler}),
</if>
<if test="zbsl != null">
zbsl = #{zbsl},
</if>
<if test="dwrq != null">
dwrq = #{dwrq},
</if>
<if test="kssj != null">
kssj = #{kssj},
</if>
<if test="jssj != null">
jssj = #{jssj},
</if>
<if test="sc != null">
sc = #{sc},
</if>
<if test="lc != null">
lc = #{lc},
</if>
<if test="jd != null and jd != ''">
jd = #{jd},
</if>
<if test="wd != null and wd != ''">
wd = #{wd},
</if>
<if test="zhgxsj != null">
zhgxsj = #{zhgxsj},
</if>
<if test="ssbm != null and ssbm != ''">
ssbm = #{ssbm},
</if>
<if test="ssbmdm != null and ssbmdm != ''">
ssbmdm = #{ssbmdm},
</if>
<if test="ssxgaj != null and ssxgaj != ''">
ssxgaj = #{ssxgaj},
</if>
<if test="ssxgajdm != null and ssxgajdm != ''">
ssxgajdm = #{ssxgajdm},
</if>
<if test="sssgaj != null and sssgaj != ''">
sssgaj = #{sssgaj},
</if>
<if test="sssgajdm != null and sssgajdm != ''">
sssgajdm = #{sssgajdm},
</if>
<if test="xtSjly != null and xtSjly != ''">
xt_sjly = #{xtSjly},
</if>
<if test="xtSjzt != null and xtSjzt != ''">
xt_sjzt = #{xtSjzt},
</if>
<if test="xtScbz != null and xtScbz != ''">
xt_scbz = #{xtScbz},
</if>
<if test="xtCjip != null and xtCjip != ''">
xt_cjip = #{xtCjip},
</if>
<if test="xtCjsj != null">
xt_cjsj = #{xtCjsj},
</if>
<if test="xtCjrId != null and xtCjrId != ''">
xt_cjr_id = #{xtCjrId},
</if>
<if test="xtCjr != null and xtCjr != ''">
xt_cjr = #{xtCjr},
</if>
<if test="xtCjbmdm != null and xtCjbmdm != ''">
xt_cjbmdm = #{xtCjbmdm},
</if>
<if test="xtCjbmmc != null and xtCjbmmc != ''">
xt_cjbmmc = #{xtCjbmmc},
</if>
<if test="xtZhgxip != null and xtZhgxip != ''">
xt_zhgxip = #{xtZhgxip},
</if>
<if test="xtZhgxsj != null">
xt_zhgxsj = #{xtZhgxsj},
</if>
<if test="xtZhgxrid != null and xtZhgxrid != ''">
xt_zhgxrid = #{xtZhgxrid},
</if>
<if test="xtZhgxr != null and xtZhgxr != ''">
xt_zhgxr = #{xtZhgxr},
</if>
<if test="xtZhgxbmdm != null and xtZhgxbmdm != ''">
xt_zhgxbmdm = #{xtZhgxbmdm},
</if>
<if test="xtZhgxbm != null and xtZhgxbm != ''">
xt_zhgxbm = #{xtZhgxbm},
</if>
<if test="bz != null and bz != ''">
bz = #{bz},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from tb_wz_xfwz where id = #{id}
</delete>
<select id="queryByBbid" resultMap="TbWzXfwzMap">
select
<include refid="base_column_list"/>,
<include refid="zb_sql"/>
from tb_wz_xfwz
where xt_scbz = '0'
and bb_id = #{bbid,jdbcType=VARCHAR} limit 1
</select>
</mapper>

View File

@ -0,0 +1,295 @@
<?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.mosty.wzzx.mapper.WztjMapper">
<select id="jwzbmlbtj" resultType="java.util.Map">
select id, yh_id, yh_sfzh, yh_xm, zb, zbsl, dwrq, kssj, jssj, sc, lc, jd, wd, zhgxsj, ssbm, ssbmdm
from mosty_wzzx.tb_wz_rywz where xt_sjzt='1' and xt_scbz='0'
<if test="dto.ksrq != null and dto.ksrq != ''">
and dwrq >= #{dto.ksrq}
</if>
<if test="dto.jsrq != null and dto.jsrq != ''">
and dwrq &lt;= #{dto.jsrq}
</if>
<if test="dto.ksrq == null and dto.ksrq == '' and dto.jsrq == null and dto.jsrq == ''">
and TO_DAYS(dwrq) = TO_DAYS(NOW())
</if>
<if test="dto.yhxm != null and dto.yhxm != ''">
and yh_xm like concat('%',#{dto.yhxm},'%')
</if>
<if test="dto.kslc != null and dto.kslc != ''">
and lc >= #{dto.kslc}
</if>
<if test="dto.jslc != null and dto.jslc != ''">
and lc &lt;= #{dto.jslc}
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
</select>
<select id="xz" resultType="java.util.Map">
select id, bb_id as bbId, yh_id as yhId, yh_sfzh as yhSfzh, yh_xm as yhXm,jz_id as jzId, jz_mc as jcMc, zb,
zbsl, dwrq, kssj, jssj, sc, lc, jd, wd, zhgxsj, ssbm, ssbmdm
from mosty_wzzx.tb_wz_xfwz where xt_sjzt='1' and xt_scbz='0'
<if test="dto.ksrq != null and dto.ksrq != ''">
and dwrq >= #{dto.ksrq}
</if>
<if test="dto.jsrq != null and dto.jsrq != ''">
and dwrq &lt;= #{dto.jsrq}
</if>
<if test="dto.ksrq == null and dto.ksrq == '' and dto.jsrq == null and dto.jsrq == ''">
and TO_DAYS(dwrq) = TO_DAYS(NOW())
</if>
<if test="dto.yhxm != null and dto.yhxm != ''">
and yh_xm like concat('%',#{dto.yhxm},'%')
</if>
<if test="dto.kslc != null and dto.kslc != ''">
and lc >= #{dto.kslc}
</if>
<if test="dto.jslc != null and dto.jslc != ''">
and lc &lt;= #{dto.jslc}
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
</select>
<select id="jrlcs" resultType="java.util.Map">
select COALESCE(sum(lc), 0) as lcs from mosty_wzzx.tb_wz_rywz where xt_sjzt='1' and xt_scbz='0'
<if test="dto.ksrq != null and dto.ksrq != ''">
and dwrq >= #{dto.ksrq}
</if>
<if test="dto.jsrq != null and dto.jsrq != ''">
and dwrq &lt;= #{jsrq}
</if>
<if test="dto.ksrq == null and dto.ksrq == '' and dto.jsrq == null and dto.jsrq == ''">
and TO_DAYS(dwrq) = TO_DAYS(NOW())
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
</select>
<select id="rslcxz" resultType="java.util.Map">
select a.sl as wzrs,b.lcs as lcs,c.wzs as wzs from
(
select count(1) as sl from mosty_wzzx.tb_wz_rywz where xt_sjzt='1' and xt_scbz='0'
<if test="dto.ksrq != null and dto.ksrq != ''">
and dwrq >= #{dto.ksrq}
</if>
<if test="dto.jsrq != null and dto.jsrq != ''">
and dwrq &lt;= #{dto.jsrq}
</if>
<if test="dto.ksrq == null and dto.ksrq == '' and dto.jsrq == null and dto.jsrq == ''">
and TO_DAYS(dwrq) = TO_DAYS(NOW())
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
) a,
(
select COALESCE(sum(lc), 0) as lcs from mosty_wzzx.tb_wz_rywz where xt_sjzt='1' and xt_scbz='0'
<if test="dto.ksrq != null and dto.ksrq != ''">
and dwrq >= #{dto.ksrq}
</if>
<if test="dto.jsrq != null and dto.jsrq != ''">
and dwrq &lt;= #{dto.jsrq}
</if>
<if test="dto.ksrq == null and dto.ksrq == '' and dto.jsrq == null and dto.jsrq == ''">
and TO_DAYS(dwrq) = TO_DAYS(NOW())
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
) b,
(
select count(1) as wzs from mosty_wzzx.tb_wz_xfwz where xt_sjzt='1' and xt_scbz='0' and bb_id is not null
<if test="dto.ksrq != null and dto.ksrq != ''">
and dwrq >= #{dto.ksrq}
</if>
<if test="dto.jsrq != null and dto.jsrq != ''">
and dwrq &lt;= #{dto.jsrq}
</if>
<if test="dto.ksrq == null and dto.ksrq == '' and dto.jsrq == null and dto.jsrq == ''">
and TO_DAYS(dwrq) = TO_DAYS(NOW())
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
) c
</select>
<select id="jrwzrs" resultType="java.util.Map">
select count(1) as sl from mosty_wzzx.tb_wz_rywz where xt_sjzt='1' and xt_scbz='0'
<if test="dto.ksrq != null and dto.ksrq != ''">
and dwrq >= #{dto.ksrq}
</if>
<if test="dto.jsrq != null and dto.jsrq != ''">
and dwrq &lt;= #{dto.jsrq}
</if>
<if test="dto.ksrq == null and dto.ksrq == '' and dto.jsrq == null and dto.jsrq == ''">
and TO_DAYS(dwrq) = TO_DAYS(NOW())
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
</select>
<select id="jrxzwzs" resultType="java.util.Map">
select count(1) as wzs from mosty_wzzx.tb_wz_xfwz where xt_sjzt='1' and xt_scbz='0' and bb_id is not null
<if test="dto.ksrq != null and dto.ksrq != ''">
and dwrq >= #{dto.ksrq}
</if>
<if test="dto.jsrq != null and dto.jsrq != ''">
and dwrq &lt;= #{dto.jsrq}
</if>
<if test="dto.ksrq == null and dto.ksrq == '' and dto.jsrq == null and dto.jsrq == ''">
and TO_DAYS(dwrq) = TO_DAYS(NOW())
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
</select>
<select id="rywzlbCount" resultType="int">
select count(1) from mosty_wzzx.tb_wz_rywz where xt_sjzt='1' and xt_scbz='0'
<if test="dto.ksrq != null and dto.ksrq != ''">
and dwrq >= #{dto.ksrq}
</if>
<if test="dto.jsrq != null and dto.jsrq != ''">
and dwrq &lt;= #{dto.jsrq}
</if>
<if test="dto.ksrq == null and dto.ksrq == '' and dto.jsrq == null and dto.jsrq == ''">
and TO_DAYS(dwrq) = TO_DAYS(NOW())
</if>
<if test="dto.yhxm != null and dto.yhxm != ''">
and yh_xm like concat('%',#{dto.yhxm},'%')
</if>
<if test="dto.kslc != null and dto.kslc != ''">
and lc >= #{dto.kslc}
</if>
<if test="dto.jslc != null and dto.jslc != ''">
and lc &lt;= #{dto.jslc}
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
</select>
<select id="rywzlb" resultType="java.util.Map">
select id, yh_id, yh_sfzh,yh_xm,zb,zbsl,dwrq,kssj,jssj,sc,lc,ssbm,ssbmdm,ssbmid
from mosty_wzzx.tb_wz_rywz where xt_sjzt='1' and xt_scbz='0'
<if test="dto.ksrq != null and dto.ksrq != ''">
and dwrq >= #{dto.ksrq}
</if>
<if test="dto.jsrq != null and dto.jsrq != ''">
and dwrq &lt;= #{dto.jsrq}
</if>
<if test="dto.ksrq == null and dto.ksrq == '' and dto.jsrq == null and dto.jsrq == ''">
and TO_DAYS(dwrq) = TO_DAYS(NOW())
</if>
<if test="dto.yhxm != null and dto.yhxm != ''">
and yh_xm like concat('%',#{dto.yhxm},'%')
</if>
<if test="dto.kslc != null and dto.kslc != ''">
and lc >= #{dto.kslc}
</if>
<if test="dto.jslc != null and dto.jslc != ''">
and lc &lt;= #{dto.jslc}
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
limit #{pageIndex},#{pageSize}
</select>
<select id="bbgjcx" resultType="java.util.Map">
select * from mosty_wzzx.tb_wz_xfwz where xt_sjzt='1' and xt_scbz='0'
<if test="dto.bbid != null and dto.bbid != ''">
and bb_id = #{dto.bbid}
</if>
<if test="dto.yhid != null and dto.yhid != ''">
and yh_id = #{dto.yhid}
</if>
<if test="dto.yhsfzh != null and dto.yhsfzh != ''">
and yh_sfzh = #{dto.yhsfzh}
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
order by xt_cjsj desc
</select>
<select id="bbwzcx" resultType="java.util.Map">
select * from mosty_wzzx.tb_wz_xfwz where xt_sjzt='1' and xt_scbz='0'
<if test="dto.bbid != null and dto.bbid != ''">
and bb_id = #{dto.bbid}
</if>
<if test="dto.yhid != null and dto.yhid != ''">
and yh_id = #{dto.yhid}
</if>
<if test="dto.yhsfzh != null and dto.yhsfzh != ''">
and yh_sfzh = #{dto.yhsfzh}
</if>
<if test="dto.kssj != null and dto.kssj != ''">
and dwrq >= #{dto.kssj}
</if>
<if test="dto.jssj != null and dto.jssj != ''">
and dwrq &lt;= #{dto.jssj}
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
order by xt_cjsj desc
</select>
<select id="mjgjcx" resultType="java.util.Map">
select * from mosty_wzzx.tb_wz_rywz where xt_sjzt='1' and xt_scbz='0'
<if test="dto.yhid != null and dto.yhid != ''">
and yh_id = #{dto.yhid}
</if>
<if test="dto.yhsfzh != null and dto.yhsfzh != ''">
and yh_sfzh = #{dto.yhsfzh}
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
order by xt_cjsj desc
</select>
<select id="wbbwz" resultType="java.util.Map">
select * from mosty_wzzx.tb_wz_rywz where xt_sjzt='1' and xt_scbz='0'
<if test="dto.yhid != null and dto.yhid != ''">
and yh_id = #{dto.yhid}
</if>
<if test="dto.yhsfzh != null and dto.yhsfzh != ''">
and yh_sfzh = #{dto.yhsfzh}
</if>
<if test="dto.kssj != null and dto.kssj != ''">
and dwrq >= #{dto.kssj}
</if>
<if test="dto.jssj != null and dto.jssj != ''">
and dwrq &lt;= #{dto.jssj}
</if>
<if test="dto.ssbmid != null and dto.ssbmid != ''">
and ssbmid = #{dto.ssbmid}
</if>
${useSql}
order by xt_cjsj desc
</select>
</mapper>

View File

@ -0,0 +1,44 @@
<?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.mosty.wzzx.mapper.WzzxUserMapper">
<resultMap id="BaseResultMap" type="com.mosty.common.core.business.entity.SysUser">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="positionId" column="position_id" jdbcType="BIGINT"/>
<result property="positionName" column="position_name" jdbcType="VARCHAR"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="loginName" column="login_name" jdbcType="VARCHAR"/>
<result property="mobile" column="mobile" jdbcType="VARCHAR"/>
<result property="telePhone" column="tele_phone" jdbcType="VARCHAR"/>
<result property="idEntityCard" column="id_entity_card" jdbcType="VARCHAR"/>
<result property="inDustRialId" column="in_dust_rial_id" jdbcType="VARCHAR"/>
<result property="sex" column="sex" jdbcType="VARCHAR"/>
<result property="xtLrsj" column="xt_lrsj" jdbcType="TIMESTAMP"/>
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
<result property="deptCode" column="dept_code" jdbcType="VARCHAR"/>
<result property="deptName" column="dept_name" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,position_id,position_name,
user_name,login_name,mobile,tele_phone,
id_entity_card,in_dust_rial_id,sex,
xt_lrsj,dept_id,dept_code,
dept_name
</sql>
<select id="selectByPage" resultType="com.mosty.common.core.business.entity.SysUser">
select a.id, a.position_id, a.position_name,
a.user_name, a.login_name, a.mobile, a.tele_phone,
a.id_entity_card, a.in_dust_rial_id, a.sex,
a.xt_lrsj, c.id as dept_id, c.org_code as dept_code,
c.org_name as dept_name
from mosty_base.sys_user a
LEFT JOIN mosty_base.sys_user_dept b on a.id = b.user_id
LEFT JOIN mosty_base.sys_dept c on b.dept_id = c.id
where a.xt_zxbz = 0
</select>
</mapper>

View 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-wzzx</id>
<classpath>
<dir name="E:/project/rs/mosty-dyga-cloud/mosty-wzzx/target/classes">
</dir>
</classpath>
</application>