Browse Source

Merge branch 'develop' of gitadmin/tuoheng_freeway into release

tags/v1.0.0^2
chengwang 2 years ago
parent
commit
0197e7109e
43 changed files with 1664 additions and 161 deletions
  1. +9
    -0
      tuoheng-common/tuoheng-common-core/src/main/java/com/tuoheng/common/core/utils/JsonResult.java
  2. +23
    -0
      tuoheng-service/tuoheng-admin/pom.xml
  3. +25
    -25
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/config/AdminMvcConfig.java
  4. +73
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/DeptController.java
  5. +73
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/RoadInformationController.java
  6. +83
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/SectionController.java
  7. +18
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/StructureController.java
  8. +64
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Dept.java
  9. +35
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/RoadDept.java
  10. +70
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/RoadInformation.java
  11. +68
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Section.java
  12. +33
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/SectionDept.java
  13. +61
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Structure.java
  14. +42
    -42
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/interceptor/UserInterceptor.java
  15. +63
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/DeptMapper.java
  16. +13
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/RoadInformationMapper.java
  17. +11
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/SectionMapper.java
  18. +11
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/StructureMapper.java
  19. +13
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/query/RoadInformationQuery.java
  20. +14
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/query/SectionQuery.java
  21. +43
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/dept/AddDeptRequest.java
  22. +60
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/dept/EditDeptRequest.java
  23. +29
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/dept/RoadSection.java
  24. +20
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/ISectionService.java
  25. +11
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IStructureService.java
  26. +19
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/RoadInformationService.java
  27. +102
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/DeptServiceImpl.java
  28. +65
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/IDeptService.java
  29. +78
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/add/AddDeptService.java
  30. +116
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/RoadInformationServiceImpl.java
  31. +119
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/SectionServiceImpl.java
  32. +15
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/StructureServiceImpl.java
  33. +61
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/SectionInfoVo.java
  34. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/application-dev.yml
  35. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/application-local.yml
  36. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/application-prod.yml
  37. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/application-test.yml
  38. +116
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/DeptMapper.xml
  39. +0
    -86
      tuoheng-service/tuoheng-api/src/main/java/com/tuoheng/api/filter/AuthenticationFilter.java
  40. +1
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-dev.yml
  41. +1
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-local.yml
  42. +1
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-prod.yml
  43. +1
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-test.yml

+ 9
- 0
tuoheng-common/tuoheng-common-core/src/main/java/com/tuoheng/common/core/utils/JsonResult.java View File

@@ -96,4 +96,13 @@ public class JsonResult<T> implements Serializable {
this.data = data;
}


@Override
public String toString() {
return "JsonResult{" +
"code=" + code +
", msg='" + msg + '\'' +
", data=" + data +
'}';
}
}

+ 23
- 0
tuoheng-service/tuoheng-admin/pom.xml View File

@@ -32,6 +32,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<!-- Springboot test依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<!-- MySql驱动 -->
<dependency>
<groupId>mysql</groupId>
@@ -104,6 +112,21 @@
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/aliyun-java-vod-upload-1.4.14.jar</systemPath>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

</dependencies>


+ 25
- 25
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/config/AdminMvcConfig.java View File

@@ -1,7 +1,7 @@

package com.tuoheng.admin.config;

import com.tuoheng.admin.interceptor.UserInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -16,27 +16,27 @@ import java.nio.charset.StandardCharsets;
* @Date 2022/10/31 14:06
*/
//web相关配置
@Configuration
public class AdminMvcConfig implements WebMvcConfigurer {
@Bean
public UserInterceptor setBean(){
//System.out.println("注入了handler");
return new UserInterceptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
//添加拦截器
registry.addInterceptor(setBean())
//设置拦截的请求
.addPathPatterns("/**")
//排除拦截的请求
.excludePathPatterns(
"/user/login", //登录
"/user/loginout", //退出
"/error" //springBoot异常处理的默认请求
);
}
}
//@Configuration
//public class AdminMvcConfig implements WebMvcConfigurer {
//
// @Bean
// public UserInterceptor setBean(){
// //System.out.println("注入了handler");
// return new UserInterceptor();
// }
//
// @Override
// public void addInterceptors(InterceptorRegistry registry) {
// //添加拦截器
// registry.addInterceptor(setBean())
// //设置拦截的请求
// .addPathPatterns("/**")
// //排除拦截的请求
// .excludePathPatterns(
// "/user/login", //登录
// "/user/loginout", //退出
// "/error" //springBoot异常处理的默认请求
//
// );
// }
//}

+ 73
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/DeptController.java View File

@@ -0,0 +1,73 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.request.dept.AddDeptRequest;
import com.tuoheng.admin.service.dept.IDeptService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
* 部门前端控制器
*
* @author wanjing
* @team tuoheng
* @date 2022-11-16
*/
@Slf4j
@RestController
@RequestMapping("/dept")
public class DeptController {

@Autowired
private IDeptService deptService;

/**
* 查询部门列表
*/
@GetMapping("/list/tree")
public JsonResult getListTree(Dept dept) {
log.info("进入获取部门列表接口");
return deptService.selectListTree(dept);
}

/**
* 获取部门详细信息
*/
@GetMapping(value = "/{id}")
public JsonResult getInfo(@PathVariable("id") Integer id) {
log.info("进入获取部门信息接口");
return deptService.selectOne(id);
}

/**
* 新增部门
*/
@PostMapping
public JsonResult add(@RequestBody AddDeptRequest addDeptRequest) {
log.info("进入新增部门接口");
return deptService.insert(addDeptRequest);
}

/**
* 修改部门
*/
@PutMapping
public JsonResult edit(@RequestBody Dept dept) {
log.info("进入修改部门接口");
return deptService.update(dept);
}

/**
* 删除部门
*/
@DeleteMapping("/{id}")
public JsonResult delete(@PathVariable String id) {
log.info("进入删除部门接口");
return deptService.deleteById(id);
}
}

+ 73
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/RoadInformationController.java View File

@@ -0,0 +1,73 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.entity.RoadInformation;
import com.tuoheng.admin.query.RoadInformationQuery;
import com.tuoheng.admin.service.RoadInformationService;
import com.tuoheng.common.core.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
@RestController
@RequestMapping("/roadInformation")
public class RoadInformationController {

@Autowired
private RoadInformationService roadInformationService;

/**
* 获取公路信息列表(分页)
* @param query
* @return
*/
@GetMapping("/index")
public JsonResult index(RoadInformationQuery query){
return roadInformationService.queryPage(query);
}

/**
* 获取公路信息列表
* @param query
* @return
*/
@GetMapping("/getList")
public JsonResult getList(RoadInformationQuery query){
return roadInformationService.getListInfo(query);
}

/**
* 公路新增
* @param entity
* @return
*/
@PostMapping("/add")
public JsonResult add(@RequestBody RoadInformation entity){
return roadInformationService.editInfo(entity);
}

/**
* 编辑公路
* @param entity
* @return
*/
@PutMapping("/edit")
public JsonResult edit(@RequestBody RoadInformation entity){
return roadInformationService.editInfo(entity);
}

/**
* 删除公路
* @param ids
* @return
*/
@DeleteMapping("/delete/{ids}")
public JsonResult delete(@PathVariable("ids") String[] ids){
return roadInformationService.deleteByIds(ids);
}



}

+ 83
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/SectionController.java View File

@@ -0,0 +1,83 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.entity.Section;
import com.tuoheng.admin.query.SectionQuery;
import com.tuoheng.admin.service.ISectionService;
import com.tuoheng.common.core.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
@RestController
@RequestMapping("/section")
public class SectionController {

@Autowired
private ISectionService sectionService;

/**
* 获取路段列表(分页)
* @param query
* @return
*/
@GetMapping("/index")
public JsonResult index(SectionQuery query){
return sectionService.queryPage(query);
}

/**
* 获取路段列表
* @param query
* @return
*/
@GetMapping("/getList")
public JsonResult getList(SectionQuery query){
return sectionService.getListInfo(query);
}

/**
* 根据id获取路段详情
* @param sectionId
* @return
*/
@GetMapping("/info/{sectionId}")
public JsonResult info(@PathVariable("sectionId") String sectionId){
return sectionService.getSectionInfo(sectionId);
}

/**
* 新增路段
* @param entity
* @return
*/
@PostMapping("/add")
public JsonResult add(@RequestBody Section entity){
return sectionService.editInfo(entity);
}

/**
* 编辑路段
* @param section
* @return
*/
@PutMapping("/edit")
public JsonResult edit(@RequestBody Section section){
return sectionService.editInfo(section);
}

/**
* 删除路段
* @param ids
* @return
*/
@DeleteMapping("/delete/{ids}")
public JsonResult delete(@PathVariable("ids") String[] ids){
return sectionService.deleteByIds(ids);
}



}

+ 18
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/StructureController.java View File

@@ -0,0 +1,18 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.service.IStructureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
@RestController
@RequestMapping("/structure")
public class StructureController {

@Autowired
private IStructureService structureService;
}

+ 64
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Dept.java View File

@@ -0,0 +1,64 @@
package com.tuoheng.admin.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 部门对象
*
* @author wanjing
* @team tuoheng
* @date 2022-11-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_dept")
public class Dept extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 租户ID
*/
private Integer tenantId;
/**
* 部门名称
*/
private String name;
/**
* 部门编码
*/
private String code;
/**
* 部门全称
*/
private String fullname;
/**
* 类型:1公司 2子公司 3部门 4小组
*/
private Integer type;
/**
* 上级ID
*/
private Integer pid;
/**
* 排序
*/
private Integer sort;
/**
* 备注说明
*/
private String note;
}

+ 35
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/RoadDept.java View File

@@ -0,0 +1,35 @@
package com.tuoheng.admin.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("th_road_dept")
public class RoadDept {
private static final long serialVersionUID = 1L;

/**
* 租户id
*/
private String tenantId;

/**
* 公路id
*/
private String roadId;

/**
* 部门id
*/
private String deptId;


}

+ 70
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/RoadInformation.java View File

@@ -0,0 +1,70 @@
package com.tuoheng.admin.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
* @Author ChengWang
* @Date 2022/11/16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_road")
public class RoadInformation extends BaseEntity {
private static final long serialVersionUID = 1L;

/**
* 租户id
*/
private String tenantId;

/**
* 公路名称
*/
private String name;

/**
* 公路代号
*/
private String code;

/**
* 起点经度
*/
private String startLongitude;

/**
* 起点纬度
*/
private String startLatitude;

/**
* 终点经度
*/
private String endLongitude;

/**
* 终点纬度
*/
private String endLatitude;

/**
* 备注
*/
private String remark;

/**
* 是否关联路段 true:关联 false:未关联
*/
@TableField(exist = false)
private boolean relation;




}

+ 68
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Section.java View File

@@ -0,0 +1,68 @@
package com.tuoheng.admin.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
* @Author ChengWang
* @Date 2022/11/16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_section")
public class Section extends BaseEntity {
private static final long serialVersionUID = 1L;

/**
* 租户id
*/
private String tenantId;

/**
* 公路id
*/
private String roadId;

/**
* 路段范围
*/
private String sectionRange;

/**
* 起点经度
*/
private String startLongitude;

/**
* 起点纬度
*/
private String startLatitude;

/**
* 终点经度
*/
private String endLongitude;

/**
* 终点纬度
*/
private String endLatitude;

/**
* 备注
*/
private String remark;

/**
* 是否绑定部门 true:绑定 false:未绑定
*/
@TableField(exist = false)
private boolean relation;


}

+ 33
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/SectionDept.java View File

@@ -0,0 +1,33 @@
package com.tuoheng.admin.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("th_section_dept")
public class SectionDept {
private static final long serialVersionUID = 1L;

/**
* 租户id
*/
private String tenantId;

/**
* 路段id
*/
private String sectionId;

/**
* 部门id
*/
private String deptId;
}

+ 61
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Structure.java View File

@@ -0,0 +1,61 @@
package com.tuoheng.admin.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
* @Author ChengWang
* @Date 2022/11/16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_structure")
public class Structure extends BaseEntity {
private static final long serialVersionUID = 1L;

/**
* 租户id
*/
private String tenantId;

/**
* 构造物种类 1桥梁 2涵洞 3通道 4互通 5服务区 6收费站 7匝道 8机场
*/
private Integer structureType;

/**
* 构造物名称
*/
private String structureName;

/**
* 公路id
*/
private String roadId;

/**
* 路段id
*/
private String sectionId;

/**
* 经度
*/
private String longitude;

/**
* 纬度
*/
private String latitude;

/**
* 构造物图片,多个用,拼接
*/
private String imageUrl;


}

+ 42
- 42
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/interceptor/UserInterceptor.java View File

@@ -20,46 +20,46 @@ import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Component
@Slf4j
public class UserInterceptor implements HandlerInterceptor {
@Autowired
private IUserService userService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
log.info("开始执行过滤器");
String username = SecurityUserUtils.username();
if (StringUtils.isEmpty(username)) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"username不能为空");
}
if(userService==null){
log.info("userService is null!!!");
BeanFactory factory = WebApplicationContextUtils
.getRequiredWebApplicationContext(request.getServletContext());
userService = (IUserService) factory
.getBean("UserServiceImpl");
}
User user = userService.getOne(Wrappers.<User>lambdaQuery()
.eq(User::getMark, 1)
.eq(User::getStatus, 1)
.eq(StringUtils.isNotEmpty(username), User::getUsername, username));
if (StringUtils.isNull(user)) {
log.error("用户信息不存在:{}", user);
return false;
}
ThreadLocalUtil.set(user);
log.info("执行完毕");
return true;
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//结束方法清理内存
ThreadLocalUtil.remove();
log.info("清理ThreadLocal内存完毕");
}
}
//@Component
//@Slf4j
//public class UserInterceptor implements HandlerInterceptor {
//
// @Autowired
// private IUserService userService;
//
// @Override
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// log.info("开始执行过滤器");
// String username = SecurityUserUtils.username();
//
// if (StringUtils.isEmpty(username)) {
// throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"username不能为空");
// }
//
// if(userService==null){
// log.info("userService is null!!!");
// BeanFactory factory = WebApplicationContextUtils
// .getRequiredWebApplicationContext(request.getServletContext());
// userService = (IUserService) factory
// .getBean("UserServiceImpl");
// }
// User user = userService.getOne(Wrappers.<User>lambdaQuery()
// .eq(User::getMark, 1)
// .eq(User::getStatus, 1)
// .eq(StringUtils.isNotEmpty(username), User::getUsername, username));
// if (StringUtils.isNull(user)) {
// log.error("用户信息不存在:{}", user);
// return false;
// }
// ThreadLocalUtil.set(user);
// log.info("执行完毕");
// return true;
// }
// @Override
// public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
// //结束方法清理内存
// ThreadLocalUtil.remove();
// log.info("清理ThreadLocal内存完毕");
// }
//}


+ 63
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/DeptMapper.java View File

@@ -0,0 +1,63 @@
package com.tuoheng.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.admin.entity.Dept;

import java.util.List;

/**
* 部门接口
*
* @author wanjing
* @team tuoheng
* @date 2022-11-16
*/
public interface DeptMapper extends BaseMapper<Dept> {
/**
* 查询部门
*
* @param id 部门主键
* @return 部门
*/
Dept selectOne(Integer id);

/**
* 查询部门列表
*
* @param dept 部门
* @return 部门集合
*/
List<Dept> selectList(Dept dept);

/**
* 新增部门
*
* @param dept 部门
* @return 结果
*/
int insert(Dept dept);

/**
* 修改部门
*
* @param dept 部门
* @return 结果
*/
int update(Dept dept);

/**
* 删除部门
*
* @param id 部门主键
* @return 结果
*/
int deleteById(String id);

/**
* 批量删除部门
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteByIds(String[] ids);
}

+ 13
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/RoadInformationMapper.java View File

@@ -0,0 +1,13 @@
package com.tuoheng.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.admin.entity.RoadInformation;

/**
* @Author ChengWang
* @Date 2022/11/16
*/
public interface RoadInformationMapper extends BaseMapper<RoadInformation> {


}

+ 11
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/SectionMapper.java View File

@@ -0,0 +1,11 @@
package com.tuoheng.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.admin.entity.Section;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
public interface SectionMapper extends BaseMapper<Section> {
}

+ 11
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/StructureMapper.java View File

@@ -0,0 +1,11 @@
package com.tuoheng.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.admin.entity.Structure;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
public interface StructureMapper extends BaseMapper<Structure> {
}

+ 13
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/query/RoadInformationQuery.java View File

@@ -0,0 +1,13 @@
package com.tuoheng.admin.query;

import com.tuoheng.common.core.common.BaseQuery;
import lombok.Data;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
@Data
public class RoadInformationQuery extends BaseQuery {

}

+ 14
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/query/SectionQuery.java View File

@@ -0,0 +1,14 @@
package com.tuoheng.admin.query;


import com.tuoheng.common.core.common.BaseQuery;
import lombok.Data;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
@Data
public class SectionQuery extends BaseQuery {

}

+ 43
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/dept/AddDeptRequest.java View File

@@ -0,0 +1,43 @@
package com.tuoheng.admin.request.dept;

import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
* 新增部门请求参数
*
* @author wanjing
* @team tuoheng
* @date 2022-11-17
*/
@Data
public class AddDeptRequest {

private static final long serialVersionUID = 1L;

/**
* 部门id
*/
private Integer pid;

/**
*部门编号
*/
private String code;

/**
* 部门名称
*/
@NotBlank(message = "部门名称不能为空!")
private String name;

/**
* 公路,路段数据
*/
private List<RoadSection> roadSectionList;


}

+ 60
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/dept/EditDeptRequest.java View File

@@ -0,0 +1,60 @@
package com.tuoheng.admin.request.dept;

import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
* 修改部门请求参数
*
* @author wanjing
* @team tuoheng
* @date 2022-11-17
*/
@Data
public class EditDeptRequest {

private static final long serialVersionUID = 1L;

/**
* 部门id
*/
private Integer id;

/**
* 部门编号
*/
private String code;

/**
* 部门名称
*/
@NotBlank(message = "部门名称不能为空!")
private String name;

/**
* 部门全称名称
*/
@NotBlank(message = "部门全称不能为空!")
private String fullname;

/**
* 巡检任务类型 1 常规;2 日常
*/
@NotNull(message = "巡检任务类型不能为空!")
private Integer type;

/**
* 巡检方式 1 无人机
*/
@NotNull(message = "巡检方式不能为空!")
private Integer inspectionType;

/**
* 挂载设备名称(多选逗号","分隔)
*/
private String equipmentMountName;


}

+ 29
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/dept/RoadSection.java View File

@@ -0,0 +1,29 @@
package com.tuoheng.admin.request.dept;

import com.tuoheng.admin.entity.RoadInformation;
import com.tuoheng.admin.entity.Section;
import lombok.Data;

import java.util.List;

/**
* 公路路段对应
*
* @author wanjing
* @team tuoheng
* @date 2022-11-17
*/
@Data
public class RoadSection {

/**
* 公路
*/
private RoadInformation road;

/**
* 路段
*/
private List<Section> sectionList;

}

+ 20
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/ISectionService.java View File

@@ -0,0 +1,20 @@
package com.tuoheng.admin.service;

import com.tuoheng.admin.entity.Section;
import com.tuoheng.admin.query.SectionQuery;
import com.tuoheng.common.core.common.IBaseService;
import com.tuoheng.common.core.utils.JsonResult;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
public interface ISectionService extends IBaseService<Section> {
JsonResult queryPage(SectionQuery query);

JsonResult getListInfo(SectionQuery query);

JsonResult editInfo(Section entity);

JsonResult getSectionInfo(String sectionId);
}

+ 11
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IStructureService.java View File

@@ -0,0 +1,11 @@
package com.tuoheng.admin.service;

import com.tuoheng.admin.entity.Structure;
import com.tuoheng.common.core.common.IBaseService;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
public interface IStructureService extends IBaseService<Structure> {
}

+ 19
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/RoadInformationService.java View File

@@ -0,0 +1,19 @@
package com.tuoheng.admin.service;

import com.tuoheng.admin.entity.RoadInformation;
import com.tuoheng.admin.query.RoadInformationQuery;
import com.tuoheng.common.core.common.IBaseService;
import com.tuoheng.common.core.utils.JsonResult;


/**
* @Author ChengWang
* @Date 2022/11/16
*/
public interface RoadInformationService extends IBaseService<RoadInformation> {
JsonResult queryPage(RoadInformationQuery query);

JsonResult getListInfo(RoadInformationQuery query);

JsonResult editInfo(RoadInformation entity);
}

+ 102
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/DeptServiceImpl.java View File

@@ -0,0 +1,102 @@
package com.tuoheng.admin.service.dept;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.request.dept.AddDeptRequest;
import com.tuoheng.admin.service.dept.add.AddDeptService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 部门业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-11-16
*/
@Slf4j
@Service
public class DeptServiceImpl implements IDeptService {
@Autowired
private DeptMapper deptMapper;
@Autowired
private AddDeptService addDeptService;
/**
* 查询部门
*
* @param id 部门主键
* @return 部门
*/
@Override
public JsonResult selectOne(Integer id) {
deptMapper.selectOne(id);
return JsonResult.success();
}
/**
* 查询部门列表
*
* @param dept 部门
* @return 部门
*/
@Override
public JsonResult selectListTree(Dept dept) {
deptMapper.selectList(dept);
return JsonResult.success();
}
/**
* 新增部门
*
* @param addDeptRequest 部门
* @return 结果
*/
@Override
public JsonResult insert(AddDeptRequest addDeptRequest) {
return addDeptService.add(addDeptRequest);
}
/**
* 修改部门
*
* @param dept 部门
* @return 结果
*/
@Override
public JsonResult update(Dept dept) {
deptMapper.update(dept);
return JsonResult.success();
}
/**
* 批量删除部门
*
* @param ids 需要删除的部门主键
* @return 结果
*/
@Override
public JsonResult deleteByIds(String[] ids) {
deptMapper.deleteByIds(ids);
return JsonResult.success();
}
/**
* 删除部门信息
*
* @param id 部门主键
* @return 结果
*/
@Override
public JsonResult deleteById(String id) {
deptMapper.deleteById(id);
return JsonResult.success();
}
}

+ 65
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/IDeptService.java View File

@@ -0,0 +1,65 @@
package com.tuoheng.admin.service.dept;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.request.dept.AddDeptRequest;
import com.tuoheng.common.core.utils.JsonResult;
import java.util.List;
/**
* 部门Service接口
*
* @author wanjing
* @team tuoheng
* @date 2022-11-16
*/
public interface IDeptService {
/**
* 查询部门
*
* @param id 部门主键
* @return 部门
*/
JsonResult selectOne(Integer id);
/**
* 查询部门列表
*
* @param dept 部门
* @return 部门集合
*/
JsonResult selectListTree(Dept dept);
/**
* 新增部门
*
* @param addDeptRequest 部门
* @return 结果
*/
JsonResult insert(AddDeptRequest addDeptRequest);
/**
* 修改部门
*
* @param dept 部门
* @return 结果
*/
JsonResult update(Dept dept);
/**
* 批量删除部门
*
* @param ids 需要删除的部门主键集合
* @return 结果
*/
JsonResult deleteByIds(String[] ids);
/**
* 删除部门信息
*
* @param id 部门主键
* @return 结果
*/
JsonResult deleteById(String id);
}

+ 78
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/add/AddDeptService.java View File

@@ -0,0 +1,78 @@
package com.tuoheng.admin.service.dept.add;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.request.dept.AddDeptRequest;
import com.tuoheng.admin.request.dept.RoadSection;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 添加部门业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-11-17
*/
@Slf4j
@Service
public class AddDeptService {

@Autowired
private DeptMapper deptMapper;

public JsonResult add(AddDeptRequest addDeptRequest) {
// Integer tenantId = ShiroUtils.getTenantId();
// dept.setTenantId(tenantId);

// 判断是否已存在该部门编号
Integer count = deptMapper.selectCount(new LambdaQueryWrapper<Dept>()
// .eq(Dept::getTenantId, tenantId)
.eq(Dept::getCode, addDeptRequest.getCode())
.eq(Dept::getMark, 1));

// 系统中已存在
if (count > 0) {
return JsonResult.error(2000, "系统中已存在相同的角色编码");
}

Dept dept = new Dept();
dept.setCode(addDeptRequest.getCode());
dept.setName(addDeptRequest.getName());
dept.setFullname(addDeptRequest.getName());
dept.setPid(addDeptRequest.getPid());

// dept.setCreateUser(ShiroUtils.getUserId());
dept.setCreateTime(DateUtils.now());

Integer result = deptMapper.insert(dept);
log.info("新增部门, 返回结果: {}", result);

return JsonResult.success("新增部门成功");
}

private void addRoadAndSectionToDept(int deptId, List<RoadSection> roadSectionList) {
RoadInformation road;
List<Section> sectionList;
for (RoadSection roadSection : roadSectionList) {
road = roadSection.getRoad();
sectionList = roadSection.getSectionList();
}
}

private void addRoadToDept(int deptId, RoadInformation roadInformation) {

}

private void addSectionToDept(int deptId, List<Section> sectionList) {
SectionDept sectionDept = new SectionDept();

}

}

+ 116
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/RoadInformationServiceImpl.java View File

@@ -0,0 +1,116 @@
package com.tuoheng.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.entity.RoadInformation;
import com.tuoheng.admin.entity.Section;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.mapper.RoadInformationMapper;
import com.tuoheng.admin.mapper.SectionMapper;
import com.tuoheng.admin.query.RoadInformationQuery;
import com.tuoheng.admin.service.RoadInformationService;
import com.tuoheng.common.core.common.BaseServiceImpl;
import com.tuoheng.common.core.enums.ServiceExceptionEnum;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import com.tuoheng.common.core.utils.ThreadLocalUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
@Service
public class RoadInformationServiceImpl extends BaseServiceImpl<RoadInformationMapper, RoadInformation> implements RoadInformationService {

@Autowired
private RoadInformationMapper roadInformationMapper;

@Autowired
private SectionMapper sectionMapper;

@Override
public JsonResult queryPage(RoadInformationQuery query) {
if(query.getLimit()==null && query.getPage()==null){
return JsonResult.error(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
//获取登录人信息id
//Long userId = SecurityUserUtils.getLoginUser().getUserId();
//获取分页数据
IPage<RoadInformation> page = new Page<>(query.getPage(),query.getLimit());
IPage<RoadInformation> pageData = roadInformationMapper.selectPage(page, Wrappers.<RoadInformation>lambdaQuery()
.eq(RoadInformation::getMark, 1)
.eq(RoadInformation::getTenantId, 1)
.orderByDesc(RoadInformation::getCreateTime));
List<RoadInformation> records = pageData.getRecords();
List<RoadInformation> list = new ArrayList<>();
for (RoadInformation record : records) {
//判断公路关联路段信息
RoadRelation(record);
list.add(record);
}
pageData.setRecords(list);

return JsonResult.success(pageData);
}

@Override
public JsonResult getListInfo(RoadInformationQuery query) {
//当前租户下所有公路信息
List<RoadInformation> roadInformationList = roadInformationMapper.selectList(new LambdaQueryWrapper<RoadInformation>()
.eq(RoadInformation::getMark, 1)
.eq(RoadInformation::getTenantId, 1));
List<RoadInformation> list = new ArrayList<>();
for (RoadInformation roadInformation : roadInformationList) {
RoadRelation(roadInformation);
list.add(roadInformation);
}

return JsonResult.success(list);
}

@Override
public JsonResult editInfo(RoadInformation entity) {
// User user = (User) ThreadLocalUtil.get();
// if (StringUtils.isNull(user)) {
// return JsonResult.error("获取不到用户信息");
// }
if(StringUtils.isEmpty(entity.getId())){
//新增
entity.setCreateUser("cw");
entity.setCreateTime(DateUtils.now());
}else {
//更新
entity.setUpdateUser("cw");
entity.setUpdateTime(DateUtils.now());
}
super.edit(entity);

return JsonResult.success();
}

/**
* 判断公路是否关联路段
* @param roadInformation
*/
private void RoadRelation(RoadInformation roadInformation) {
List<Section> sectionList = sectionMapper.selectList(new LambdaQueryWrapper<Section>()
.eq(Section::getMark, 1)
.eq(Section::getTenantId, 1)
.eq(Section::getRoadId, roadInformation.getId()));
if(StringUtils.isNotEmpty(sectionList)){
//公路绑定路段,关联字段设置为true
roadInformation.setRelation(true);
}else {
//公路未绑定路段,关联字段设置为false
roadInformation.setRelation(false);
}
}
}

+ 119
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/SectionServiceImpl.java View File

@@ -0,0 +1,119 @@
package com.tuoheng.admin.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.entity.RoadInformation;
import com.tuoheng.admin.entity.Section;

import com.tuoheng.admin.mapper.RoadInformationMapper;
import com.tuoheng.admin.mapper.SectionMapper;
import com.tuoheng.admin.query.SectionQuery;
import com.tuoheng.admin.service.ISectionService;
import com.tuoheng.admin.vo.SectionInfoVo;
import com.tuoheng.common.core.common.BaseServiceImpl;
import com.tuoheng.common.core.enums.ServiceExceptionEnum;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
* @Author ChengWang
* @Date 2022/11/17
*/
@Service
public class SectionServiceImpl extends BaseServiceImpl<SectionMapper, Section> implements ISectionService {

@Autowired
private SectionMapper sectionMapper;

@Autowired
private RoadInformationMapper roadInformationMapper;


@Override
public JsonResult queryPage(SectionQuery query) {
if(null==query.getLimit() && null == query.getPage()){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
//获取分页数据
IPage<Section> page = new Page<>(query.getPage(),query.getLimit());
IPage<Section> pageData = sectionMapper.selectPage(page, Wrappers.<Section>lambdaQuery()
.eq(Section::getMark, 1)
.eq(Section::getTenantId, 1)
.orderByDesc(Section::getCreateTime));
return JsonResult.success(pageData);
}

@Override
public JsonResult getListInfo(SectionQuery query) {
List<Section> sectionList = sectionMapper.selectList(new LambdaQueryWrapper<Section>()
.eq(Section::getMark, 1)
.eq(Section::getTenantId, 1)
.orderByDesc(Section::getCreateTime));

return JsonResult.success(sectionList);
}

@Override
public JsonResult editInfo(Section entity) {
// User user = (User) ThreadLocalUtil.get();
// if (StringUtils.isNull(user)) {
// return JsonResult.error("获取不到用户信息");
// }
if(StringUtils.isEmpty(entity.getId())){
//新增
entity.setCreateTime(DateUtils.now());
entity.setCreateUser("ca");
}else {
//更新
entity.setUpdateTime(DateUtils.now());
entity.setUpdateUser("ca");
}
super.edit(entity);

return JsonResult.success();
}

@Override
public JsonResult getSectionInfo(String sectionId) {
if(StringUtils.isEmpty(sectionId)){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
//根据id查询路段
Section section = sectionMapper.selectOne(Wrappers.<Section>lambdaQuery()
.eq(Section::getMark, 1).eq(Section::getId, sectionId));
String roadId = section.getRoadId();
if(StringUtils.isEmpty(roadId)){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
//根据roadId查询对应的公路
RoadInformation roadInformation = roadInformationMapper.selectOne(new LambdaQueryWrapper<RoadInformation>()
.eq(RoadInformation::getId, roadId)
.eq(RoadInformation::getMark, 1));
//获取公路代号
if(StringUtils.isNull(roadInformation)){
return JsonResult.error("对应的公路为空");
}
String code = roadInformation.getCode();
if(StringUtils.isEmpty(code)){
return JsonResult.error("公路代号为空");
}
SectionInfoVo sectionInfoVo = new SectionInfoVo();
BeanUtils.copyProperties(section,sectionInfoVo);
sectionInfoVo.setCode(code);

return JsonResult.success(sectionInfoVo);
}


}

+ 15
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/StructureServiceImpl.java View File

@@ -0,0 +1,15 @@
package com.tuoheng.admin.service.impl;

import com.tuoheng.admin.entity.Structure;
import com.tuoheng.admin.mapper.StructureMapper;
import com.tuoheng.admin.service.IStructureService;
import com.tuoheng.common.core.common.BaseServiceImpl;
import org.springframework.stereotype.Service;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
@Service
public class StructureServiceImpl extends BaseServiceImpl<StructureMapper, Structure> implements IStructureService {
}

+ 61
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/SectionInfoVo.java View File

@@ -0,0 +1,61 @@
package com.tuoheng.admin.vo;


import lombok.Data;

/**
* @Author ChengWang
* @Date 2022/11/17
*/
@Data
public class SectionInfoVo {

/**
* 租户id
*/
private String tenantId;

/**
* 公路id
*/
private String roadId;

/**
* 路段范围
*/
private String sectionRange;

/**
* 起点经度
*/
private String startLongitude;

/**
* 起点纬度
*/
private String startLatitude;

/**
* 终点经度
*/
private String endLongitude;

/**
* 终点纬度
*/
private String endLatitude;

/**
* 备注
*/
private String remark;

/**
* 公路代号
*/
private String code;




}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/resources/application-dev.yml View File

@@ -112,7 +112,7 @@ tuoheng:
#静态资源对外暴露的访问路径
staticAccessPath: /**
#静态资源实际存储路径
uploadFolder: /data/java/tuoheng_paas/uploads/
uploadFolder: /data/java/tuoheng_freeway/uploads/

#阿里云
aliyuncsVod:

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/resources/application-local.yml View File

@@ -117,7 +117,7 @@ tuoheng:
#静态资源对外暴露的访问路径
staticAccessPath: /**
#静态资源实际存储路径
uploadFolder: /data/java/tuoheng_paas/uploads/
uploadFolder: /data/java/tuoheng_freeway/uploads/

#阿里云
aliyuncsVod:

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/resources/application-prod.yml View File

@@ -112,7 +112,7 @@ tuoheng:
#静态资源对外暴露的访问路径
staticAccessPath: /**
#静态资源实际存储路径
uploadFolder: /data/java/tuoheng_paas/uploads/
uploadFolder: /data/java/tuoheng_freeway/uploads/

#阿里云
aliyuncsVod:

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/resources/application-test.yml View File

@@ -114,7 +114,7 @@ tuoheng:
#静态资源对外暴露的访问路径
staticAccessPath: /**
#静态资源实际存储路径
uploadFolder: /data/java/tuoheng_paas/uploads/
uploadFolder: /data/java/tuoheng_freeway/uploads/

#阿里云
aliyuncsVod:

+ 116
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/DeptMapper.xml View File

@@ -0,0 +1,116 @@
<?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.tuoheng.admin.mapper.DeptMapper">
<resultMap type="com.tuoheng.admin.entity.Dept" id="DeptResult">
<result property="id" column="id" />
<result property="tenantId" column="tenant_id" />
<result property="name" column="name" />
<result property="code" column="code" />
<result property="fullname" column="fullname" />
<result property="type" column="type" />
<result property="pid" column="pid" />
<result property="sort" column="sort" />
<result property="note" column="note" />
<result property="createUser" column="create_user" />
<result property="createTime" column="create_time" />
<result property="updateUser" column="update_user" />
<result property="updateTime" column="update_time" />
<result property="mark" column="mark" />
</resultMap>
<sql id="selectThDeptVo">
select id, tenant_id, name, code, fullname, type, pid, sort, note, create_user, create_time, update_user, update_time, mark from th_dept
</sql>
<select id="selectList" parameterType="com.tuoheng.admin.entity.Dept" resultMap="DeptResult">
<include refid="selectThDeptVo"/>
<where>
<if test="tenantId != null and tenantId != ''"> and tenant_id = #{tenantId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="fullname != null and fullname != ''"> and fullname like concat('%', #{fullname}, '%')</if>
<if test="type != null "> and type = #{type}</if>
<if test="pid != null and pid != ''"> and pid = #{pid}</if>
<if test="sort != null "> and sort = #{sort}</if>
<if test="note != null and note != ''"> and note = #{note}</if>
<if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if>
<if test="updateUser != null and updateUser != ''"> and update_user = #{updateUser}</if>
<if test="mark != null "> and mark = #{mark}</if>
</where>
</select>
<select id="selectOne" parameterType="Integer" resultMap="DeptResult">
<include refid="selectThDeptVo"/>
where id = #{id}
</select>
<insert id="insert" parameterType="com.tuoheng.admin.entity.Dept"
keyColumn="id" keyProperty="id" useGeneratedKeys="true">
insert into th_dept
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="code != null">code,</if>
<if test="fullname != null">fullname,</if>
<if test="type != null">type,</if>
<if test="pid != null and pid != ''">pid,</if>
<if test="sort != null">sort,</if>
<if test="note != null">note,</if>
<if test="createUser != null and createUser != ''">create_user,</if>
<if test="createTime != null">create_time,</if>
<if test="updateUser != null">update_user,</if>
<if test="updateTime != null">update_time,</if>
<if test="mark != null">mark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="code != null">#{code},</if>
<if test="fullname != null">#{fullname},</if>
<if test="type != null">#{type},</if>
<if test="pid != null and pid != ''">#{pid},</if>
<if test="sort != null">#{sort},</if>
<if test="note != null">#{note},</if>
<if test="createUser != null and createUser != ''">#{createUser},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateUser != null">#{updateUser},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="mark != null">#{mark},</if>
</trim>
</insert>
<update id="update" parameterType="com.tuoheng.admin.entity.Dept">
update th_dept
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="code != null">code = #{code},</if>
<if test="fullname != null">fullname = #{fullname},</if>
<if test="type != null">type = #{type},</if>
<if test="pid != null and pid != ''">pid = #{pid},</if>
<if test="sort != null">sort = #{sort},</if>
<if test="note != null">note = #{note},</if>
<if test="createUser != null and createUser != ''">create_user = #{createUser},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateUser != null">update_user = #{updateUser},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="mark != null">mark = #{mark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteById" parameterType="String">
delete from th_dept where id = #{id}
</delete>
<delete id="deleteByIds" parameterType="String">
delete from th_dept where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

+ 0
- 86
tuoheng-service/tuoheng-api/src/main/java/com/tuoheng/api/filter/AuthenticationFilter.java View File

@@ -1,86 +0,0 @@
package com.tuoheng.api.filter;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.tuoheng.common.core.constant.SecurityHeadConstant;
import com.tuoheng.common.core.entity.UserEntity;
import com.tuoheng.common.core.utils.EncryptUtil;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.system.feign.feign.UserClient;
import com.tuoheng.system.feign.vo.UserInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
* @Author: 吴彬
* @CreateTime: 2022-09-13 08:40
* @Description: 获取gateway携带的身份信息前置过滤器
* @Version: 1.0
*/
@Component
@Slf4j
public class AuthenticationFilter extends OncePerRequestFilter {

@Autowired
private UserClient userClient;

@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
FilterChain filterChain) throws ServletException, IOException {
String token = request.getHeader(SecurityHeadConstant.JSON_TOKEN);
if (StringUtils.isNotBlank(token)){
String json = EncryptUtil.decodeUTF8StringBase64(token);
JSONObject jsonObject = JSON.parseObject(json);
Object principal = jsonObject.getObject("principal",Object.class);
//获取用户身份信息、权限信息
UserEntity user = null;
String[] authorities = null;
/**
* 判断携带的身份信息是用户实体还是client_id
*/
if(principal instanceof UserEntity){//用户实体
//获取用户身份信息、权限信息
user = (UserEntity)principal;
JSONArray tempJsonArray = jsonObject.getJSONArray("authorities");
authorities = tempJsonArray.toArray(new String[0]);
}else{//client_id
//根据client_id调用system服务获取用户实体信息
JsonResult<UserInfo> result = userClient.getInfoByClientId(principal.toString());
if (result.getCode() != JsonResult.SUCCESS || result.getData() == null || result.getData().getUserEntity() == null) {
log.error("未获取到【{}】对应的用户信息",principal.toString());
//解决response中writer乱码方案
response.setHeader("Content-Type", "application/json;charset=utf-8");
response.getWriter().print(JSON.toJSONString(result, SerializerFeature.WriteMapNullValue));
response.getWriter().flush();
return;
}
user = result.getData().getUserEntity();
authorities = result.getData().getPermissions().toArray(new String[0]);
}
//身份信息、权限信息填充到用户身份token对象中
UsernamePasswordAuthenticationToken authenticationToken=new UsernamePasswordAuthenticationToken(user,null,
AuthorityUtils.createAuthorityList(authorities));
//创建details
authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
//将authenticationToken填充到安全上下文
SecurityContextHolder.getContext().setAuthentication(authenticationToken);
}
filterChain.doFilter(request,response);
}

}

+ 1
- 1
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-dev.yml View File

@@ -84,7 +84,7 @@ tuoheng:
#静态资源对外暴露的访问路径
staticAccessPath: /**
#静态资源实际存储路径
uploadFolder: /data/java/tuoheng_paas/uploads/
uploadFolder: /data/java/tuoheng_freeway/uploads/
xxl:
enable: true
job:

+ 1
- 1
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-local.yml View File

@@ -84,7 +84,7 @@ tuoheng:
#静态资源对外暴露的访问路径
staticAccessPath: /**
#静态资源实际存储路径
uploadFolder: /data/java/tuoheng_paas/uploads/
uploadFolder: /data/java/tuoheng_freeway/uploads/
xxl:
enable: true
job:

+ 1
- 1
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-prod.yml View File

@@ -84,7 +84,7 @@ tuoheng:
#静态资源对外暴露的访问路径
staticAccessPath: /**
#静态资源实际存储路径
uploadFolder: /data/java/tuoheng_paas/uploads/
uploadFolder: /data/java/tuoheng_freeway/uploads/
xxl:
enable: true
job:

+ 1
- 1
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-test.yml View File

@@ -84,7 +84,7 @@ tuoheng:
#静态资源对外暴露的访问路径
staticAccessPath: /**
#静态资源实际存储路径
uploadFolder: /data/java/tuoheng_paas/uploads/
uploadFolder: /data/java/tuoheng_freeway/uploads/
xxl:
enable: true
job:

Loading…
Cancel
Save