警保联动平台接口对接

This commit is contained in:
luozhun 2024-10-18 17:25:19 +08:00
parent 5730b81782
commit 001b6cc7de
19 changed files with 528 additions and 27 deletions

View File

@ -3,7 +3,7 @@
<view class="swiperDemo"> <view class="swiperDemo">
<nut-swiper ref="swiperRef" pagination-visible pagination-color="#e53e31" :auto-play="3000" :init-page="0"> <nut-swiper ref="swiperRef" pagination-visible pagination-color="#e53e31" :auto-play="3000" :init-page="0">
<nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 180px"> <nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 180px">
<image src="@/assets/images/01.png" alt="" style="height: 100%; width: 100%" draggable="false"/> <image :src="item" alt="" style="height: 100%; width: 100%" draggable="false"/>
</nut-swiper-item> </nut-swiper-item>
</nut-swiper> </nut-swiper>
</view> </view>
@ -30,7 +30,7 @@ import Taro from "@tarojs/taro";
import icon from '@/assets/images/project.png' import icon from '@/assets/images/project.png'
import './index.scss' import './index.scss'
const list = ref(['https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg',]) const list = ref(['/assets/images/01.png',])
const swiperRef = ref() // const swiperRef = ref() //
const subModuleList = ref([ const subModuleList = ref([
{ {

View File

@ -0,0 +1,17 @@
package com.changhu.common.annotation;
import com.changhu.common.enums.OpenApiType;
import java.lang.annotation.*;
/**
* @author 20252
* @createTime 2024/10/9 下午5:14
* @desc 检查openApi
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface CheckOpenApi {
OpenApiType value();
}

View File

@ -0,0 +1,21 @@
package com.changhu.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
/**
* @author 20252
* @createTime 2024/10/9 下午5:10
* @desc OpenApiType...
*/
@Getter
@AllArgsConstructor
public enum OpenApiType {
Information_on_enterprises_and_institutions("获取企事业单位信息", Arrays.asList("1fe0aaf3-45a4-4be3-a989-75e914a3f36e", "1fe0aaf3-45a4-a989-75e914a3f36e"));
private final String desc;
private final List<String> openApiKeys;
}

View File

@ -52,8 +52,16 @@ public class JavaClassToTsUtil {
* @return ts类型 * @return ts类型
*/ */
private static String convertJavaTypeToTS(Class<?> type) { private static String convertJavaTypeToTS(Class<?> type) {
Set<Class<?>> stringList = Set.of(String.class); Set<Class<?>> stringList = Set.of(
Set<Class<?>> boolList = Set.of(Boolean.class, boolean.class); String.class,
LocalDateTime.class,
LocalDate.class,
LocalTime.class
);
Set<Class<?>> boolList = Set.of(
Boolean.class,
boolean.class
);
Set<Class<?>> numberList = Set.of( Set<Class<?>> numberList = Set.of(
Integer.class, int.class, Integer.class, int.class,
Double.class, double.class, Double.class, double.class,
@ -63,15 +71,12 @@ public class JavaClassToTsUtil {
BigDecimal.class, BigDecimal.class,
Byte.class, byte.class Byte.class, byte.class
); );
Set<Class<?>> dateList = Set.of(LocalDateTime.class, LocalDate.class, LocalTime.class);
if (stringList.contains(type)) { if (stringList.contains(type)) {
return "string"; return "string";
} else if (boolList.contains(type)) { } else if (boolList.contains(type)) {
return "boolean"; return "boolean";
} else if (numberList.contains(type)) { } else if (numberList.contains(type)) {
return "number"; return "number";
} else if (dateList.contains(type)) {
return "Dayjs";
} else { } else {
return "unsupported"; return "unsupported";
} }

View File

@ -3,9 +3,11 @@ package com.changhu.config;
import cn.dev33.satoken.interceptor.SaInterceptor; import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import com.changhu.support.interceptor.JsonBodyInterceptor; import com.changhu.support.interceptor.JsonBodyInterceptor;
import com.changhu.support.interceptor.OpenApiInterceptor;
import com.changhu.support.interceptor.UserTypeInterceptor; import com.changhu.support.interceptor.UserTypeInterceptor;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ -25,6 +27,7 @@ public class WebConfig implements WebMvcConfigurer {
public WebConfig() { public WebConfig() {
whiteList.add("/common/**"); whiteList.add("/common/**");
whiteList.add("/open/**");
whiteList.add("/test/**"); whiteList.add("/test/**");
whiteList.add("/login"); whiteList.add("/login");
whiteList.add("/logout"); whiteList.add("/logout");
@ -55,6 +58,20 @@ public class WebConfig implements WebMvcConfigurer {
registry.addInterceptor(new JsonBodyInterceptor()); registry.addInterceptor(new JsonBodyInterceptor());
// 注册clientType 拦截器 用于校验当前用户是否匹配操作客户端 // 注册clientType 拦截器 用于校验当前用户是否匹配操作客户端
registry.addInterceptor(new UserTypeInterceptor()); registry.addInterceptor(new UserTypeInterceptor());
// 注册开放接口 拦截器 用于校验第三方是否携带指定apiKey
registry.addInterceptor(new OpenApiInterceptor())
.addPathPatterns("/open/**");
}
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowedMethods("GET", "POST", "OPTION", "PUT", "DELETE")
.allowedHeaders("Content-Type", "X-Requested-With", "accept", "Origin", "Access-Control-Request-Method",
"Access-Control-Request-Headers", "Authorization","Token","*")
.allowCredentials(true)
.maxAge(3600);
} }
@Override @Override

View File

@ -0,0 +1,47 @@
package com.changhu.controller;
import cn.hutool.core.util.IdUtil;
import com.changhu.common.annotation.CheckOpenApi;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.enums.OpenApiType;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.pojo.dto.EnterprisesUnitDetailDTO;
import com.changhu.service.OpenApiService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author 20252
* @createTime 2024/10/9 下午5:02
* @desc 可以给第三方对接的controller
*/
@Tag(name = "开放接口")
@JsonBody
@RequestMapping("/open")
public class OpenController {
@Autowired
private OpenApiService openApiService;
@Operation(summary = "获取企事业单位列表")
@CheckOpenApi(value = OpenApiType.Information_on_enterprises_and_institutions)
@GetMapping("/getEnterprisesUnit")
public List<SelectNodeVo<Long>> getEnterprisesUnit(@Schema(description = "行政区划代码") @RequestParam String code,
@Schema(description = "行政区划等级") @RequestParam Integer level) {
return openApiService.getEnterprisesUnit(code, level);
}
@Operation(summary = "企事业单位详情")
@CheckOpenApi(value = OpenApiType.Information_on_enterprises_and_institutions)
@GetMapping("/enterprisesUnitDetailById")
public EnterprisesUnitDetailDTO enterprisesUnitDetailById(@Schema(description = "企事业单位id") @RequestParam Long enterprisesUnitId) {
return openApiService.enterprisesUnitDetailById(enterprisesUnitId);
}
}

View File

@ -6,6 +6,8 @@ import com.changhu.module.management.pojo.entity.ServiceProject;
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams; import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo; import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.pojo.dto.EnterprisesUnitDetailDTO;
import com.changhu.pojo.dto.ServiceProjectDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -36,4 +38,12 @@ public interface ServiceProjectMapper extends BaseMapper<ServiceProject> {
*/ */
List<IndexServiceProjectListVo> getServiceProjectList(@Param("policeUnitId") Long policeUnitId, List<IndexServiceProjectListVo> getServiceProjectList(@Param("policeUnitId") Long policeUnitId,
@Param("projectManagerMiniProgramUserId") Long projectManagerMiniProgramUserId); @Param("projectManagerMiniProgramUserId") Long projectManagerMiniProgramUserId);
/**
* 获取企事业单位下的服务项目
*
* @param enterprisesUnitId 企事业单位id
* @return 服务项目列表
*/
List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(@Param("enterprisesUnitId") Long enterprisesUnitId);
} }

View File

@ -6,8 +6,12 @@ import com.changhu.module.management.pojo.entity.ServiceProject;
import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams; import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams; import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo; import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
import com.changhu.pojo.dto.EnterprisesUnitDetailDTO;
import com.changhu.pojo.dto.ServiceProjectDTO;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
import java.util.List;
/** /**
* service_project (服务项目) 服务类 * service_project (服务项目) 服务类
* author: luozhun * author: luozhun
@ -29,4 +33,12 @@ public interface ServiceProjectService extends IService<ServiceProject> {
* @param params 参数 * @param params 参数
*/ */
void saveOrUpdate(ServiceProjectSaveOrUpdateParams params); void saveOrUpdate(ServiceProjectSaveOrUpdateParams params);
/**
* 获取企事业单位下的服务项目
*
* @param enterprisesUnitId 企事业单位id
* @return 服务项目列表
*/
List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(Long enterprisesUnitId);
} }

View File

@ -11,9 +11,13 @@ import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParam
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams; import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo; import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
import com.changhu.module.management.service.ServiceProjectService; import com.changhu.module.management.service.ServiceProjectService;
import com.changhu.pojo.dto.EnterprisesUnitDetailDTO;
import com.changhu.pojo.dto.ServiceProjectDTO;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* service_project (服务项目) 服务实现类 * service_project (服务项目) 服务实现类
* author: luozhun * author: luozhun
@ -36,4 +40,9 @@ public class ServiceProjectServiceImpl extends ServiceImpl<ServiceProjectMapper,
throw new MessageException(); throw new MessageException();
} }
} }
@Override
public List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(Long enterprisesUnitId) {
return baseMapper.getServiceProjectByEnterprisesUnitId(enterprisesUnitId);
}
} }

View File

@ -3,6 +3,7 @@ package com.changhu.module.miniProgram.pojo.entity;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import com.changhu.common.db.enums.Sex;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -56,7 +57,7 @@ public class SecurityUser extends BaseEntity implements Serializable {
/** /**
* 性别 * 性别
*/ */
private Integer sex; private Sex sex;
/** /**
* 籍贯 * 籍贯

View File

@ -0,0 +1,43 @@
package com.changhu.pojo.dto;
import cn.hutool.core.util.DesensitizedUtil;
import com.changhu.common.annotation.Desensitized;
import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.ServiceProjectType;
import com.changhu.common.db.enums.Sex;
import com.changhu.module.management.pojo.model.ContactPersonInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author 20252
* @createTime 2024/10/10 上午9:13
* @desc EnterprisesUnitDetailDTO...
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class EnterprisesUnitDetailDTO {
@Schema(description = "企事业单位id")
private Long snowFlakeId;
@Schema(description = "名字")
private String name;
@Schema(description = "地址")
private String address;
@Schema(description = "联系人")
private ContactPersonInfo contactPersonInfo;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "服务项目列表")
private List<ServiceProjectDTO> serviceProjectList;
}

View File

@ -0,0 +1,110 @@
package com.changhu.pojo.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.ServiceProjectType;
import com.changhu.common.db.enums.Sex;
import com.changhu.module.management.pojo.model.LegalPersonInfo;
import com.changhu.support.fastjson2.serializer.MinioPrefixSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author 20252
* @createTime 2024/10/10 上午9:35
* @desc ServiceProjectDTO...
*/
@Data
public class ServiceProjectDTO {
@Schema(description = "服务项目id")
private Long snowFlakeId;
@Schema(description = "项目经理信息")
private ProjectManagerInfo projectManagerInfo;
@Schema(description = "保安单位信息")
private SecurityUnitInfo securityUnitInfo;
@Schema(description = "名字")
private String name;
@Schema(description = "类型")
private ServiceProjectType type;
@Schema(description = "是否自招保安")
private IsOrNot isRecruitSecurity;
@Schema(description = "保安证号")
private String idNumber;
@Schema(description = "服务面积")
private Double serviceArea;
@Schema(description = "楼栋数量")
private Integer buildingTotal;
@Schema(description = "户数")
private Integer houseTotal;
@Schema(description = "工作人员数量")
private Integer staffTotal;
@Schema(description = "保安人员数量")
private Integer securityUserTotal;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "保安人员列表")
private List<SecurityUserInfo> securityUserList;
@Data
static class SecurityUnitInfo {
@Schema(description = "保安单位名称")
private String name;
@Schema(description = "统一社会编码")
private String socialCode;
@JSONField(serializeUsing = MinioPrefixSerializer.class)
@Schema(description = "营业执照")
private String businessLicense;
@Schema(description = "法人信息")
private LegalPersonInfo legalPersonInfo;
@Schema(description = "详细地址")
private String address;
@Schema(description = "公司性质")
private String nature;
}
@Data
static class ProjectManagerInfo {
@Schema(description = "名称")
private String name;
@Schema(description = "性别")
private Sex sex;
@Schema(description = "手机号")
private String telephone;
@Schema(description = "身份证")
private String idCard;
}
@Data
static class SecurityUserInfo {
@Schema(description = "id")
private Long snowFlakeId;
@Schema(description = "名字")
private String name;
@Schema(description = "手机号")
private String telephone;
@Schema(description = "工作岗位")
private String workPost;
@Schema(description = "性别")
private Sex sex;
@Schema(description = "户籍地")
private String nativePlace;
@Schema(description = "身份证")
private String idCard;
@Schema(description = "出身日期")
private java.time.LocalDate dateOfBirth;
@Schema(description = "保安证号")
private String securityNumber;
@Schema(description = "家庭住址")
private String homeAddress;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
private String createTime;
}
}

View File

@ -0,0 +1,30 @@
package com.changhu.service;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.pojo.dto.EnterprisesUnitDetailDTO;
import java.util.List;
/**
* @author 20252
* @createTime 2024/10/9 下午5:28
* @desc 开放接口
*/
public interface OpenApiService {
/**
* 获取企事业单位列表
*
* @param code 行政区划代码
* @param level 行政区划等级
* @return 企事业单位列表
*/
List<SelectNodeVo<Long>> getEnterprisesUnit(String code, Integer level);
/**
* 企事业单位详情
*
* @param enterprisesUnitId 单位id
* @return 企事业单位详情
*/
EnterprisesUnitDetailDTO enterprisesUnitDetailById(Long enterprisesUnitId);
}

View File

@ -0,0 +1,60 @@
package com.changhu.service.impl;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.exception.MessageException;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.management.pojo.entity.EnterprisesUnit;
import com.changhu.module.management.service.ServiceProjectService;
import com.changhu.pojo.dto.EnterprisesUnitDetailDTO;
import com.changhu.pojo.dto.ServiceProjectDTO;
import com.changhu.service.OpenApiService;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author 20252
* @createTime 2024/10/9 下午5:29
* @desc OpenApiServiceImpl...
*/
@Service
public class OpenApiServiceImpl implements OpenApiService {
@Autowired
private ServiceProjectService serviceProjectService;
@Override
public List<SelectNodeVo<Long>> getEnterprisesUnit(String code, Integer level) {
return Db.lambdaQuery(EnterprisesUnit.class)
.eq(level == 1, EnterprisesUnit::getProvince, code)
.eq(level == 2, EnterprisesUnit::getCity, code)
.eq(level == 3, EnterprisesUnit::getDistricts, code)
.eq(level == 4, EnterprisesUnit::getStreet, code)
.list()
.stream()
.map(item -> SelectNodeVo.<Long>builder()
.value(item.getSnowFlakeId())
.label(item.getName())
.build())
.toList();
}
@Override
public EnterprisesUnitDetailDTO enterprisesUnitDetailById(Long enterprisesUnitId) {
return Db.lambdaQuery(EnterprisesUnit.class)
.eq(BaseEntity::getSnowFlakeId, enterprisesUnitId)
.oneOpt()
.map(item -> EnterprisesUnitDetailDTO.builder()
.snowFlakeId(item.getSnowFlakeId())
.name(item.getName())
.address(item.getAddress())
.contactPersonInfo(item.getContactPersonInfo())
.remark(item.getRemark())
.serviceProjectList(serviceProjectService.getServiceProjectByEnterprisesUnitId(item.getSnowFlakeId()))
.createTime(item.getCreateTime())
.build())
.orElseThrow(() -> new MessageException("企事业单位不存在"));
}
}

View File

@ -0,0 +1,27 @@
package com.changhu.support.fastjson2.serializer;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson2.JSONWriter;
import com.alibaba.fastjson2.writer.ObjectWriter;
import java.lang.reflect.Type;
/**
* @author 20252
* @createTime 2024/10/10 下午3:19
* @desc MinioPrefixSerializer...
*/
public class MinioPrefixSerializer implements ObjectWriter<String> {
private final String minioPrefix = SpringUtil.getProperty("minio.url");
public static final MinioPrefixSerializer instance = new MinioPrefixSerializer();
private MinioPrefixSerializer() {
}
@Override
public void write(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features) {
jsonWriter.writeString(minioPrefix + object);
}
}

View File

@ -0,0 +1,38 @@
package com.changhu.support.interceptor;
import com.changhu.common.annotation.CheckOpenApi;
import com.changhu.common.exception.MessageException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author 20252
* @createTime 2024/10/9 下午5:05
* @desc OpenApiInterceptor...
*/
@Slf4j
public class OpenApiInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler) {
String header = request.getHeader("X-API-KEY");
log.info("apiKey:{} {} 请求:{}", header, LocalDateTime.now(), request.getRequestURI());
if (handler instanceof HandlerMethod handlerMethod) {
CheckOpenApi methodAnnotation = handlerMethod.getMethodAnnotation(CheckOpenApi.class);
if (methodAnnotation != null) {
List<String> openApiKeys = methodAnnotation.value().getOpenApiKeys();
if (!openApiKeys.contains(header)) {
throw new MessageException("openApiKey error!");
}
}
}
return true;
}
}

View File

@ -23,7 +23,7 @@ knife4j:
spring: spring:
application: application:
# 服务名称 # 服务名称
name: managementDevServer name: policeSecurityDevServer
servlet: servlet:
multipart: multipart:
# 设置单个文件最大大小为500MB # 设置单个文件最大大小为500MB
@ -116,7 +116,7 @@ logging:
config: classpath:conf/log4j2.xml config: classpath:conf/log4j2.xml
minio: minio:
url: http://118.253.177.137:9000 url: https://www.hnjinglian.cn:9000
accessKey: admin accessKey: admin
secretKey: lonsung301 secretKey: lonsung301
bucketName: police-security-dev bucketName: police-security-dev

View File

@ -1,5 +1,5 @@
server: server:
port: 8090 port: 8765
springdoc: springdoc:
swagger-ui: swagger-ui:
@ -23,10 +23,7 @@ knife4j:
spring: spring:
application: application:
# 服务名称 # 服务名称
name: managementProdServer name: policeSecurityProdServer
mvc:
# 如果找不到对应的handler 就抛出404异常
throw-exception-if-no-handler-found: true
servlet: servlet:
multipart: multipart:
# 设置单个文件最大大小为500MB # 设置单个文件最大大小为500MB
@ -42,9 +39,9 @@ spring:
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://172.10.10.238:3306/management_prod?serverTimezone=Asia/Shanghai&allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false url: jdbc:mysql://118.253.177.137:3306/police_security_dev?serverTimezone=Asia/Shanghai&allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: management_prod username: police_security_dev
password: lonsung301 password: GejDeCNj3ZBSNxSP
# druid 连接池管理 # druid 连接池管理
druid: druid:
# 初始化时建立物理连接的个数 # 初始化时建立物理连接的个数
@ -91,17 +88,12 @@ spring:
cache: cache:
type: redis type: redis
cache-names: common cache-names: common
mail:
host: smtp.qq.com
port: 587
username: 2025254074@qq.com
password: vgkvmhlwfogucbfd
data: data:
redis: redis:
database: 0 database: 0
password: lonsung301 password: redis_csPDNr
port: 6380 port: 6380
host: 172.10.10.238 host: 118.253.177.137
timeout: 10s timeout: 10s
lettuce: lettuce:
pool: pool:
@ -124,10 +116,10 @@ logging:
config: classpath:conf/log4j2.xml config: classpath:conf/log4j2.xml
minio: minio:
url: http://172.10.10.238:9000 url: https://www.hnjinglian.cn:9000
accessKey: admin accessKey: admin
secretKey: lonsung301 secretKey: lonsung301
bucketName: management-prod bucketName: police-security-dev
sa-token: sa-token:
# token 名称(同时也是 cookie 名称) # token 名称(同时也是 cookie 名称)
@ -146,6 +138,16 @@ sa-token:
is-log: true is-log: true
# 是否尝试从 cookie 里读取 token # 是否尝试从 cookie 里读取 token
is-read-cookie: false is-read-cookie: false
# jwt秘钥
jwt-secret-key: a29216f8-cd60-4e96-89c5-ab6012159052
wx:
miniapp:
#微信小程序的appid
appid: wx0acd1c4fcf94bdd3
#微信小程序的Secret
secret: 4b700dbacb42ef258537ddc61d964a17
msgDataFormat: JSON
project: project:
env: prod env: prod

View File

@ -82,4 +82,56 @@
group by eu.snow_flake_id group by eu.snow_flake_id
order by any_value(sp.create_time) desc; order by any_value(sp.create_time) desc;
</select> </select>
<resultMap id="ServiceProjectDTOResultMap" type="com.changhu.pojo.dto.ServiceProjectDTO">
<result
column="projectManagerInfo"
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
property="projectManagerInfo"/>
<result
column="securityUnitInfo"
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
property="securityUnitInfo" />
<result
column="securityUserList"
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
property="securityUserList" />
</resultMap>
<select id="getServiceProjectByEnterprisesUnitId" resultMap="ServiceProjectDTOResultMap">
SELECT
sp.*,
IF(mpu.snow_flake_id IS NOT NULL,json_object( 'name', mpu.NAME, 'sex', mpu.sex, 'telephone', mpu.telephone, 'idCard', mpu.id_card ),NULL) AS 'projectManagerInfo',
json_object(
'name',su1.name,
'socialCode',su1.social_code,
'businessLicense',su1.business_license,
'legalPersonInfo',su1.legal_person_info,
'address',su1.address,
'nature',su1.nature
) as 'securityUnitInfo',
if(COUNT(su.snow_flake_id)>0,JSON_ARRAYAGG(json_object(
'snowFlakeId',su.snow_flake_id,
'name',su.name,
'telephone',su.telephone,
'workPost',su.work_post,
'sex',su.sex,
'nativePlace',su.native_place,
'idCard',su.id_card,
'dateOfBirth',su.date_of_birth,
'securityNumber',su.security_number,
'homeAddress',su.home_address,
'remark',su.remark,
'createTime',su.create_time
)),JSON_ARRAY()) as 'securityUserList'
FROM
service_project sp
left join security_unit su1 on sp.security_unit_id = su1.snow_flake_id
LEFT JOIN mini_program_user mpu ON sp.project_manager_mini_program_user_id = mpu.snow_flake_id AND mpu.identity = 'project_manager'
left join security_user su on su.service_project_id = sp.snow_flake_id and su.delete_flag = 0
WHERE
sp.delete_flag = 0
AND sp.enterprises_unit_id = #{enterprisesUnitId}
group by sp.snow_flake_id
ORDER BY
sp.create_time DESC
</select>
</mapper> </mapper>