feat():企业id存放进redis
parent
5a003b84bf
commit
7379139e25
|
@ -77,7 +77,7 @@ public class SysLoginService {
|
|||
}
|
||||
|
||||
LoginUser userInfo = userResult.getData();
|
||||
SysUser user = userResult.getData().getSysUser();
|
||||
SysUser user = userInfo.getSysUser();
|
||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
||||
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
||||
|
|
|
@ -41,6 +41,10 @@ public class SecurityConstants {
|
|||
*/
|
||||
public static final String LOGIN_USER = "login_user";
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
public static final String SYS_USER = "sys_user";
|
||||
/**
|
||||
* 角色权限
|
||||
*/
|
||||
|
|
|
@ -34,5 +34,6 @@
|
|||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.Map;
|
|||
@AllArgsConstructor
|
||||
public class ManyDataSource {
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
new Thread(()->{
|
||||
|
@ -39,9 +40,9 @@ public class ManyDataSource {
|
|||
DruidDataSourceFactory druidDataSourceFactory= SpringUtils.getBean(DruidDataSourceFactory.class);
|
||||
DynamicDataSource dynamicDataSource= SpringUtils.getBean(DynamicDataSource.class);
|
||||
EnterPriseInfo enterPriseInfo = EnterPriseInfo.builder()
|
||||
.entCode("liu_42")
|
||||
.entCode("liu_45")
|
||||
.ip("192.168.116.129")
|
||||
.port(3348)
|
||||
.port(3351)
|
||||
.build();
|
||||
|
||||
DataSourceInfo dataSourceInfo = DataSourceInfo.hostAndPortBuild(enterPriseInfo.getEntCode(), enterPriseInfo.getIp(), enterPriseInfo.getPort());
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.muyu.common.core.utils.uuid.IdUtils;
|
|||
import com.muyu.common.redis.service.RedisService;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -48,6 +49,7 @@ public class TokenService {
|
|||
loginUser.setUserid(userId);
|
||||
loginUser.setUsername(userName);
|
||||
loginUser.setIpaddr(IpUtils.getIpAddr());
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
refreshToken(loginUser);
|
||||
|
||||
// Jwt存储信息
|
||||
|
|
|
@ -138,8 +138,20 @@ public class SysUser extends BaseEntity {
|
|||
*/
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 企业id
|
||||
*/
|
||||
private Integer enterpriseId;
|
||||
|
||||
|
||||
public Integer getEnterpriseId() {
|
||||
return enterpriseId;
|
||||
}
|
||||
|
||||
public void setEnterpriseId(Integer enterpriseId) {
|
||||
this.enterpriseId = enterpriseId;
|
||||
}
|
||||
|
||||
public SysUser (Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
@ -326,6 +338,8 @@ public class SysUser extends BaseEntity {
|
|||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("dept", getDept())
|
||||
.append("enterpriseId", getEnterpriseId())
|
||||
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
package com.muyu.customer.business.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.muyu.common.core.utils.ServletUtils;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.customer.business.mapper.VehicleMapper;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
|
@ -40,6 +36,8 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
|||
public class VehicleController extends BaseController {
|
||||
@Autowired
|
||||
private VehicleService vehicleService;
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
/**
|
||||
* 查询车辆录入列表
|
||||
|
@ -50,6 +48,7 @@ public class VehicleController extends BaseController {
|
|||
public Result<TableDataInfo<Vehicle>> list(VehicleQueryReq vehicleQueryReq) {
|
||||
startPage();
|
||||
List<Vehicle> list = vehicleService.list(Vehicle.queryBuild(vehicleQueryReq));
|
||||
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,10 +99,11 @@ public class EnterpriseController extends BaseController {
|
|||
if(sysDept!=null){
|
||||
return Result.error("部门名称重复");
|
||||
}
|
||||
enterpriseService.addEnterprise(enterpriseSaveReq);
|
||||
addDept(enterpriseSaveReq, sysUser);
|
||||
addUser(enterpriseSaveReq,sysUser);
|
||||
|
||||
return toAjax(enterpriseService.save(Enterprise.saveBuild(enterpriseSaveReq)));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,6 +137,7 @@ public class EnterpriseController extends BaseController {
|
|||
.userName(enterpriseSaveReq.getEbterpriseName())
|
||||
.nickName(enterpriseSaveReq.getEbterpriseName())
|
||||
.password("123456")
|
||||
.enterpriseId(Integer.valueOf(enterpriseSaveReq.getId()))
|
||||
.deptId(sysDept.getDeptId())
|
||||
.email(enterpriseSaveReq.getEmail())
|
||||
.phonenumber(enterpriseSaveReq.getContactPhone())
|
||||
|
@ -185,6 +187,7 @@ public class EnterpriseController extends BaseController {
|
|||
|
||||
/**
|
||||
* 完善企业信息
|
||||
*
|
||||
* @param id
|
||||
* @param enterpriseEditReq
|
||||
* @return
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.net.working.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.net.working.domain.Enterprise;
|
||||
import com.muyu.net.working.domain.req.EnterpriseSaveReq;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
|
@ -16,4 +17,6 @@ public interface EnterpriseMapper extends BaseMapper<Enterprise> {
|
|||
Enterprise selectByName(@Param("name") String name);
|
||||
|
||||
void authentication(Enterprise enterprise);
|
||||
|
||||
void addEnterprise(EnterpriseSaveReq enterpriseSaveReq);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.net.working.domain.Enterprise;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.net.working.domain.req.EnterpriseSaveReq;
|
||||
|
||||
/**
|
||||
* 车辆运营平台Service接口
|
||||
|
@ -24,4 +25,6 @@ public interface EnterpriseService extends IService<Enterprise> {
|
|||
Enterprise selectByName(String name);
|
||||
|
||||
void authentication(Enterprise enterprise);
|
||||
|
||||
void addEnterprise(EnterpriseSaveReq enterpriseSaveReq);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Map;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.ObjUtils;
|
||||
import com.muyu.net.working.domain.req.EnterpriseSaveReq;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -122,6 +123,11 @@ public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper, Enterpr
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEnterprise(EnterpriseSaveReq enterpriseSaveReq) {
|
||||
enterpriseMapper.addEnterprise(enterpriseSaveReq);
|
||||
}
|
||||
|
||||
public static void postTest(Enterprise enterprise) throws Exception {
|
||||
// 1.请求URL
|
||||
String postUrl = "http://192.168.116.129:10006/webhook/%E6%96%B0%E5%BB%BA%E4%BC%81%E4%B8%9A%E7%AE%A1%E7%90%86";
|
||||
|
|
|
@ -31,6 +31,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<sql id="selectEnterpriseVo">
|
||||
select id, ebterprise_name, legal_person, business_lincense_number, estabiness_date, business_scope, address, contact_phone, email, enterprise_status, registration_date, certification_id, authentication_date, service_level, open_server_id, add_server_id, create_by, create_time, update_by, update_time, remark from enterprise
|
||||
</sql>
|
||||
<insert id="addEnterprise" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into enterprise (id,ebterprise_name, legal_person, business_lincense_number, estabiness_date, business_scope, address, contact_phone, email, enterprise_status, registration_date, certification_id, authentication_date, service_level, open_server_id, add_server_id, create_by, create_time, update_by, update_time, remark)
|
||||
values (#{id},#{ebterpriseName}, #{legalPerson}, #{businessLincenseNumber}, #{estabinessDate}, #{businessScope}, #{address}, #{contactPhone}, #{email}, #{enterpriseStatus}, #{registrationDate}, #{certificationId}, #{authenticationDate}, #{serviceLevel}, #{openServerId}, #{addServerId}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{remark})
|
||||
</insert>
|
||||
<update id="authentication">
|
||||
update enterprise set enterprise_status = 'N' where id = #{id}
|
||||
</update>
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="enterpriseId" column="enterprise_id"/>
|
||||
<association property="dept" javaType="com.muyu.common.system.domain.SysDept" resultMap="deptResult"/>
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
|
||||
</resultMap>
|
||||
|
@ -51,6 +52,7 @@
|
|||
u.dept_id,
|
||||
u.user_name,
|
||||
u.nick_name,
|
||||
u.enterprise_id,
|
||||
u.email,
|
||||
u.avatar,
|
||||
u.phonenumber,
|
||||
|
@ -198,7 +200,8 @@
|
|||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
create_time
|
||||
create_time,
|
||||
enterprise_id
|
||||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||
|
@ -212,7 +215,8 @@
|
|||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
sysdate()
|
||||
|
||||
sysdate(),#{enterpriseId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
|
Loading…
Reference in New Issue