Compare commits

...

3 Commits

Author SHA1 Message Date
nmy f768a5b3f6 Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	zlpt-modules/zlpt-system/src/main/java/com/bonus/zlpt/system/controller/BaseAddressController.java
2023-12-08 10:17:06 +08:00
nmy f4db2442b3 【更新】代码修改 2023-12-08 10:16:45 +08:00
nmy 86b39ad494 【更新】新增字段 2023-12-07 10:17:40 +08:00
23 changed files with 298 additions and 44 deletions

View File

@ -140,6 +140,12 @@ public class BmCompanyInfo implements Serializable {
@Excel(name = "被授权人身份证国徽面")
private String idNationUrl;
/**
* 被授权人邮箱
*/
@Excel(name = "被授权人邮箱")
private String authEmail;
/**
* 创建时间
*/

View File

@ -11,9 +11,6 @@ public class BmCompanyVo {
//企业信息
private BmCompanyInfo bmCompanyInfo;
@Excel(name = "被授权人邮箱")
private String authEmail;
//企业开户行信息
private BmCoBank bmCoBank;

View File

@ -1,4 +1,4 @@
package com.bonus.zlpt.company.api.domain;
package com.bonus.zlpt.system.api.domain;
import com.bonus.zlpt.common.core.annotation.Excel;
import com.bonus.zlpt.common.core.web.domain.BaseEntity;

View File

@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.zlpt.common.core.annotation.Excel;
import com.bonus.zlpt.common.core.annotation.Excel.ColumnType;
import com.bonus.zlpt.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
/**
* 系统访问记录表 sys_logininfor
@ -16,6 +17,7 @@ public class SysLogininfor extends BaseEntity
private static final long serialVersionUID = 1L;
/** ID */
@Excel(name = "序号", cellType = ColumnType.NUMERIC)
private Long infoId;

View File

@ -3,11 +3,10 @@ package com.bonus.zlpt.auth.controller;
import javax.servlet.http.HttpServletRequest;
import com.bonus.zlpt.auth.form.RegisterBody;
import com.bonus.zlpt.common.core.enums.UserStatus;
import com.bonus.zlpt.system.api.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.bonus.zlpt.auth.form.LoginBody;
import com.bonus.zlpt.auth.service.SysLoginService;
import com.bonus.zlpt.common.core.domain.R;
@ -18,6 +17,8 @@ import com.bonus.zlpt.common.security.service.TokenService;
import com.bonus.zlpt.common.security.utils.SecurityUtils;
import com.bonus.zlpt.system.api.model.LoginUser;
import java.util.Date;
/**
* token 控制
*
@ -76,4 +77,36 @@ public class TokenController
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
return R.ok();
}
/**
* 用户注销
* @param
* @return
*/
@PostMapping ("logOff")
public R<?> logOff(@RequestBody SysUser user)
{
user.setLoginDate(new Date());
user.setDelFlag(UserStatus.DELETED.getCode());
sysLoginService.logOff(user);
return R.ok();
}
/**
* 用户注销
* @param
* @return
*/
@PostMapping ("revokeLogOff")
public R<?> revokeLogOff(@RequestBody SysUser user)
{
user.setLoginDate(new Date());
user.setDelFlag(UserStatus.OK.getCode());
sysLoginService.logOff(user);
return R.ok();
}
}

View File

@ -1,5 +1,7 @@
package com.bonus.zlpt.auth.service;
import com.bonus.zlpt.common.core.utils.DateUtils;
import io.micrometer.core.instrument.util.TimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.bonus.zlpt.common.core.constant.CacheConstants;
@ -18,6 +20,9 @@ import com.bonus.zlpt.system.api.RemoteUserService;
import com.bonus.zlpt.system.api.domain.SysUser;
import com.bonus.zlpt.system.api.model.LoginUser;
import java.time.LocalDateTime;
import java.util.Date;
/**
* 登录校验方法
*
@ -86,8 +91,13 @@ public class SysLoginService
LoginUser userInfo = userResult.getData();
SysUser user = userResult.getData().getSysUser();
if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
//新增逻辑 如果用户点击账户注销 那么修改用户账号状态为已删除并设置最后的登录时间 一周之内可以登录并且可以撤销注销状态如果一周之内没有撤销那么将该账号数据物理删除
Date loginDate = DateUtils.addDays(user.getLoginDate(), 7);
//如果是删除状态并且超出一周
if (UserStatus.DELETED.getCode().equals(user.getDelFlag()) && loginDate.after(new Date()))
{
//删除用户
removeUser(user.getUserId());
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
}
@ -140,4 +150,26 @@ public class SysLoginService
}
recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功");
}
/**
* 根据用户id删除用户
* @param id
*/
public void removeUser(Long id){
remoteUserService.remove(new Long[]{id});
}
/**
* 用户注销或者撤销注销
* @param user
*/
public void logOff(SysUser user) {
remoteUserService.edit(user);
}
}

View File

@ -30,5 +30,10 @@
<version>${swagger.fox.version}</version>
</dependency>
<dependency>
<groupId>com.bonus.zlpt</groupId>
<artifactId>zlpt-common-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,103 @@
package com.bonus.zlpt.common.swagger;
import com.bonus.zlpt.common.core.annotation.Excel;
import com.fasterxml.classmate.ResolvedType;
import com.fasterxml.classmate.TypeResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.StringUtils;
import springfox.documentation.service.AllowableListValues;
import springfox.documentation.service.AllowableRangeValues;
import springfox.documentation.service.AllowableValues;
import springfox.documentation.spring.web.DescriptionResolver;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class ApiModelPropertiesExtend {
private static final Logger LOGGER = LoggerFactory.getLogger(ApiModelPropertiesExtend.class);
private static final Pattern RANGE_PATTERN = Pattern.compile("range([\\[(])(.*),(.*)([])])$");
private ApiModelPropertiesExtend() {
throw new UnsupportedOperationException();
}
static Function<Excel, AllowableValues> toAllowableValues() {
return null;
}
public static AllowableValues allowableValueFromString(String allowableValueString) {
AllowableValues allowableValues = new AllowableListValues(new ArrayList(), "LIST");
String trimmed = allowableValueString.trim();
Matcher matcher = RANGE_PATTERN.matcher(trimmed.replaceAll(" ", ""));
if (matcher.matches()) {
if (matcher.groupCount() != 4) {
LOGGER.warn("Unable to parse range specified {} correctly", trimmed);
} else {
allowableValues = new AllowableRangeValues(matcher.group(2).contains("infinity") ? null : matcher.group(2), matcher.group(1).equals("("), matcher.group(3).contains("infinity") ? null : matcher.group(3), matcher.group(4).equals(")"));
}
} else {
List singleVal;
if (trimmed.contains(",")) {
singleVal = (List) Stream.of(trimmed.split(",")).map(String::trim).filter((item) -> {
return !item.isEmpty();
}).collect(Collectors.toList());
allowableValues = new AllowableListValues(singleVal, "LIST");
} else if (StringUtils.hasText(trimmed)) {
singleVal = Collections.singletonList(trimmed);
allowableValues = new AllowableListValues(singleVal, "LIST");
}
}
return (AllowableValues)allowableValues;
}
static Function<Excel, String> toDescription(final DescriptionResolver descriptions) {
return (annotation) -> {
String description = "";
if (!StringUtils.isEmpty(annotation.name())) {
description = annotation.name();
}
return descriptions.resolve(description);
};
}
static Function<Excel, ResolvedType> toType(final TypeResolver resolver) {
return (annotation) -> {
return resolver.resolve(Object.class, new Type[0]);
};
}
public static Optional<Excel> findApiModePropertyAnnotation(AnnotatedElement annotated) {
Optional<Excel> annotation = Optional.empty();
if (annotated instanceof Method) {
annotation = Optional.ofNullable((Excel) AnnotationUtils.findAnnotation((Method)annotated, Excel.class));
}
return (Optional)annotation.map(Optional::of).orElse(Optional.ofNullable((Excel) AnnotationUtils.getAnnotation(annotated, Excel.class)));
}
static Function<Excel, String> toExample() {
return (annotation) -> {
String example = "";
return example;
};
}
}

View File

@ -0,0 +1,59 @@
package com.bonus.zlpt.common.swagger;
import com.bonus.zlpt.common.core.annotation.Excel;
import com.fasterxml.classmate.ResolvedType;
import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import springfox.documentation.schema.Annotations;
import springfox.documentation.schema.ModelSpecification;
import springfox.documentation.schema.property.ModelSpecificationFactory;
import springfox.documentation.service.AllowableValues;
import springfox.documentation.spi.schema.contexts.ModelPropertyContext;
import springfox.documentation.spring.web.DescriptionResolver;
import springfox.documentation.swagger.schema.ApiModelPropertyPropertyBuilder;
import java.lang.reflect.AnnotatedElement;
import java.util.Optional;
/**
* swagger扩展
*/
//@Component
//@Order(-2147482649)
public class ApiModelPropertyPropertyBuilderExtend extends ApiModelPropertyPropertyBuilder {
private final DescriptionResolver descriptions;
private final ModelSpecificationFactory modelSpecifications;
public ApiModelPropertyPropertyBuilderExtend(DescriptionResolver descriptions, ModelSpecificationFactory modelSpecifications, DescriptionResolver descriptions1, ModelSpecificationFactory modelSpecifications1) {
super(descriptions, modelSpecifications);
this.descriptions = descriptions1;
this.modelSpecifications = modelSpecifications1;
}
@Override
public void apply(ModelPropertyContext context) {
System.err.println("开始加载");
Optional<Excel> annotation = Optional.empty();
if (context.getAnnotatedElement().isPresent()) {
System.err.println("1");
annotation = (Optional)annotation.map(Optional::of).orElse(ApiModelPropertiesExtend.findApiModePropertyAnnotation((AnnotatedElement)context.getAnnotatedElement().get()));
}
if (context.getBeanPropertyDefinition().isPresent()) {
System.err.println("2");
annotation = (Optional)annotation.map(Optional::of).orElse(Annotations.findPropertyAnnotation((BeanPropertyDefinition)context.getBeanPropertyDefinition().get(), Excel.class));
}
if (annotation.isPresent()) {
ModelSpecification modelSpecification = (ModelSpecification)annotation.map((a) -> {
return !a.defaultValue().isEmpty() ? this.modelSpecifications.create(context.getOwner(), (ResolvedType)ApiModelPropertiesExtend.toType(context.getResolver()).apply(a)) : null;
}).orElse(null);
context.getSpecificationBuilder().description((String)annotation.map(ApiModelPropertiesExtend.toDescription(this.descriptions)).orElse(null));
context.getBuilder().allowableValues((AllowableValues)annotation.map(ApiModelPropertiesExtend.toAllowableValues()).orElse(null));
}
}
}

View File

@ -1,3 +1,4 @@
# config.com.bonus.zlpt.common.swagger.SwaggerAutoConfiguration
# config.com.bonus.zlpt.common.swagger.SwaggerWebConfiguration
# config.com.bonus.zlpt.common.swagger.SwaggerBeanPostProcessor
# com.bonus.zlpt.common.swagger.ApiModelPropertyPropertyBuilderExtend

View File

@ -14,12 +14,14 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: zlpt_cloud_dev
# server-addr: 192.168.0.14:8848
server-addr: 10.40.92.74:8848
# namespace: zlpt_cloud_dev
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: zlpt_cloud_dev
# server-addr: 192.168.0.14:8848
server-addr: 10.40.92.74:8848
# namespace: zlpt_cloud_dev
# 配置文件格式
file-extension: yml
# 共享配置
@ -35,7 +37,8 @@ spring:
datasource:
ds1:
nacos:
server-addr: 192.168.0.14:8848
# server-addr: 192.168.0.14:8848
server-addr: 10.40.92.74:8848
dataId: sentinel-zlpt-gateway
groupId: DEFAULT_GROUP
data-type: json

View File

@ -103,13 +103,10 @@ public class BmCompanyInfoServiceImpl implements BmCompanyInfoService {
//根据id查询企业详情
BmCompanyInfo bmCompanyInfo = bmCompanyInfoMapper.selectByPrimaryKey(id);
//获取被授权人手机号
Integer userId = bmCompanyInfo.getCreator();
//根据手机号查询被授权人邮箱
SysUser sysUser = remoteUserService.selectUserById(userId.longValue()).getData();
BmCompanyVo bmCompanyVo = new BmCompanyVo();
bmCompanyVo.setBmCompanyInfo(bmCompanyInfo);
bmCompanyVo.setAuthEmail(sysUser.getEmail());
bmCompanyVo.setBmCoBank(bmCoBankMapper.selectByCompanyId(bmCompanyInfo.getCompanyId()));
return bmCompanyVo;

View File

@ -10,16 +10,19 @@ spring:
profiles:
# 环境配置
active: zlpt_cloud_dev
# active: default
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: zlpt_cloud_dev
# server-addr: 192.168.0.14:8848
server-addr: 10.40.92.74:8848
# namespace: zlpt_cloud_dev
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: zlpt_cloud_dev
# server-addr: 192.168.0.14:8848
server-addr: 10.40.92.74:8848
# namespace: zlpt_cloud_dev
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -24,6 +24,7 @@
<result column="auth_document" jdbcType="VARCHAR" property="authDocument" />
<result column="id_face_url" jdbcType="VARCHAR" property="idFaceUrl" />
<result column="id_nation_url" jdbcType="VARCHAR" property="idNationUrl" />
<result column="auth_email" jdbcType="VARCHAR" property="authEmail" />
<result column="create_time" jdbcType="VARCHAR" property="createTime" />
<result column="creator" jdbcType="INTEGER" property="creator" />
<result column="auditor" jdbcType="INTEGER" property="auditor" />
@ -41,7 +42,7 @@
company_id, company_name, company_type, company_ltd, credit_code, register_address,
operate_address, certificateType, id_number, business_license, legal_person, invitation_code,
invitation_co_name, business_scope, auth_person, auth_id_number, auth_phone, auth_document,
id_face_url, id_nation_url, create_time, creator, auditor, audit_time, audit_remark,
id_face_url, id_nation_url, auth_email,create_time, creator, auditor, audit_time, audit_remark,
`status`, logo_url,update_time,legal_face_url,legal_nation_url
</sql>
@ -53,7 +54,7 @@
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
update bm_company_info set status = '2'
update bm_company_info set status = '4'
where company_id = #{companyId,jdbcType=INTEGER}
</delete>
@ -65,7 +66,7 @@
legal_person, invitation_code, invitation_co_name,
business_scope, auth_person, auth_id_number,
auth_phone, auth_document, id_face_url,
id_nation_url, create_time, creator,
id_nation_url,auth_email, create_time, creator,
auditor, audit_time, audit_remark,
`status`,logo_url update_time,legal_face_url,legal_nation_url)
values (#{companyName,jdbcType=VARCHAR}, #{companyType,jdbcType=VARCHAR}, #{companyLtd,jdbcType=VARCHAR},
@ -74,7 +75,7 @@
#{legalPerson,jdbcType=VARCHAR}, #{invitationCode,jdbcType=VARCHAR}, #{invitationCoName,jdbcType=VARCHAR},
#{businessScope,jdbcType=VARCHAR}, #{authPerson,jdbcType=VARCHAR}, #{authIdNumber,jdbcType=VARCHAR},
#{authPhone,jdbcType=VARCHAR}, #{authDocument,jdbcType=VARCHAR}, #{idFaceUrl,jdbcType=VARCHAR},
#{idNationUrl,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{creator,jdbcType=INTEGER},
#{idNationUrl,jdbcType=VARCHAR},#{authEmail,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{creator,jdbcType=INTEGER},
#{auditor,jdbcType=INTEGER}, #{auditTime,jdbcType=VARCHAR}, #{auditRemark,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR},#{logoUrl,jdbcType=VARCHAR}, #{updateTime,jdbcType=VARCHAR},#{legalFaceUrl},#{legalNationUrl})
</insert>
@ -140,6 +141,9 @@
<if test="idNationUrl != null and idNationUrl != ''">
id_nation_url,
</if>
<if test="authEmail != null and authEmail != ''">
auth_email,
</if>
<if test="createTime != null and createTime != ''">
create_time,
</if>
@ -229,6 +233,9 @@
<if test="idNationUrl != null and idNationUrl != ''">
#{idNationUrl,jdbcType=VARCHAR},
</if>
<if test="authEmail != null and authEmail != ''">
#{auth_email,jdbcType=VARCHAR},
</if>
<if test="createTime != null and createTime != ''">
#{createTime,jdbcType=VARCHAR},
</if>
@ -323,6 +330,9 @@
<if test="idNationUrl != null and idNationUrl != ''">
id_nation_url = #{idNationUrl,jdbcType=VARCHAR},
</if>
<if test="authEmail != null and authEmail != ''">
auth_email = #{authEmail,jdbcType=VARCHAR},
</if>
<if test="createTime != null and createTime != ''">
create_time = #{createTime,jdbcType=VARCHAR},
</if>
@ -379,6 +389,7 @@
auth_document = #{authDocument,jdbcType=VARCHAR},
id_face_url = #{idFaceUrl,jdbcType=VARCHAR},
id_nation_url = #{idNationUrl,jdbcType=VARCHAR},
auth_email = #{authEmail,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=VARCHAR},
creator = #{creator,jdbcType=INTEGER},
auditor = #{auditor,jdbcType=INTEGER},

View File

@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
@Api(tags = "装备数据接口")
@RestController
@RequestMapping("/dev")
@Api(value = "设备信息",tags = "设备管理")
public class DevInfoController extends BaseController
{
@Autowired

View File

@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: zlpt_cloud_dev
server-addr: 10.40.92.74:8848
# namespace: zlpt_cloud_dev
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: zlpt_cloud_dev
server-addr: 10.40.92.74:8848
# namespace: zlpt_cloud_dev
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -3,6 +3,7 @@ package com.bonus.zlpt.order;
import com.bonus.zlpt.common.security.annotation.EnableCustomConfig;
import com.bonus.zlpt.common.security.annotation.EnableRyFeignClients;
import com.bonus.zlpt.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.aop.framework.AopContext;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

View File

@ -1,6 +1,6 @@
package com.bonus.zlpt.company.mapper;
package com.bonus.zlpt.system.mapper;
import com.bonus.zlpt.company.api.domain.BaseAddress;
import com.bonus.zlpt.system.api.domain.BaseAddress;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

View File

@ -1,8 +1,8 @@
package com.bonus.zlpt.company.service;
package com.bonus.zlpt.system.service;
import com.bonus.zlpt.company.api.domain.BaseAddress;
import com.bonus.zlpt.system.api.domain.BaseAddress;
import java.util.List;

View File

@ -1,11 +1,11 @@
package com.bonus.zlpt.company.service.impl;
package com.bonus.zlpt.system.service.impl;
import com.bonus.zlpt.company.api.domain.BaseAddress;
import com.bonus.zlpt.company.mapper.BaseAddressMapper;
import com.bonus.zlpt.company.service.BaseAddressService;
import com.bonus.zlpt.system.api.domain.BaseAddress;
import com.bonus.zlpt.system.mapper.BaseAddressMapper;
import com.bonus.zlpt.system.service.BaseAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service

View File

@ -1,13 +1,13 @@
<?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.bonus.zlpt.company.mapper.BaseAddressMapper">
<mapper namespace="com.bonus.zlpt.system.mapper.BaseAddressMapper">
<select id="selectEconomizeAddress" resultType="com.bonus.zlpt.company.api.domain.BaseAddress">
<select id="selectEconomizeAddress" resultType="com.bonus.zlpt.system.api.domain.BaseAddress">
select * from base_address where level = 1
</select>
<select id="selectAddress" resultType="com.bonus.zlpt.company.api.domain.BaseAddress">
<select id="selectAddress" resultType="com.bonus.zlpt.system.api.domain.BaseAddress">
select * from base_address where parent_code = #{code}
</select>

View File

@ -193,7 +193,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="password != null and password != ''">password = #{password},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
<if test="loginDate != null">login_date = #{loginDate},</if>
<!-- <if test="loginDate != null">login_date = #{loginDate},</if>-->
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()