优化
This commit is contained in:
@ -1,19 +1,15 @@
|
||||
package com.ruoyi.web.controller.common;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import com.ruoyi.bgt.service.IBgtUserService;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.Area;
|
||||
import com.ruoyi.common.core.domain.entity.BgtUser;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.AreaNodeRespVO;
|
||||
import com.ruoyi.common.core.domain.model.BgtLoginBody;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.util.DataUtil;
|
||||
import com.ruoyi.common.utils.AreaUtils;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.framework.web.service.AppLoginService;
|
||||
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||
@ -137,14 +133,6 @@ public class AppLoginController
|
||||
return AjaxResult.success(data);
|
||||
}
|
||||
|
||||
@GetMapping("/tree")
|
||||
@ApiOperation("获得地区树")
|
||||
public AjaxResult<List<AreaNodeRespVO>> getAreaTree() {
|
||||
Area area = AreaUtils.getArea(Area.ID_CHINA);
|
||||
Assert.notNull(area, "获取不到中国");
|
||||
return AjaxResult.success(AreaUtils.toBean(area.getChildren(), AreaNodeRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 获取用户信息
|
||||
|
@ -0,0 +1,38 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.domain.vo.SysAreaVO;
|
||||
import com.ruoyi.system.service.ISysAreaService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 区域Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
@Api(value = "区域控制器", tags = {"区域管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/system/area")
|
||||
public class SysAreaController extends BaseController {
|
||||
|
||||
private final ISysAreaService iSysAreaService;
|
||||
|
||||
|
||||
@GetMapping("/tree")
|
||||
@ApiOperation("获得地区树")
|
||||
public AjaxResult<List<SysAreaVO>> getAreaTree() {
|
||||
return AjaxResult.success(iSysAreaService.getAllArea());
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.ruoyi.common.core.domain.model;
|
||||
package com.ruoyi.common.core.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
@ApiModel("地区节点 Response VO")
|
||||
@Data
|
||||
public class AreaNodeRespVO {
|
||||
public class AreaNode {
|
||||
|
||||
@ApiModelProperty("编号")
|
||||
private Integer id;
|
||||
@ -19,6 +19,6 @@ public class AreaNodeRespVO {
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
private List<AreaNodeRespVO> children;
|
||||
private List<AreaNode> children;
|
||||
|
||||
}
|
@ -1,20 +1,8 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.text.csv.CsvRow;
|
||||
import cn.hutool.core.text.csv.CsvUtil;
|
||||
import com.ruoyi.common.core.domain.Area;
|
||||
import com.ruoyi.common.enums.AreaType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 区域工具类
|
||||
*
|
||||
@ -24,167 +12,167 @@ import java.util.stream.Collectors;
|
||||
@Component
|
||||
public class AreaUtils {
|
||||
|
||||
/**
|
||||
* 初始化 SEARCHER
|
||||
*/
|
||||
@SuppressWarnings("InstantiationOfUtilityClass")
|
||||
private final static AreaUtils INSTANCE = new AreaUtils();
|
||||
|
||||
/**
|
||||
* Area 内存缓存,提升访问速度
|
||||
*/
|
||||
private static Map<Integer, Area> areas;
|
||||
|
||||
private AreaUtils() {
|
||||
long now = System.currentTimeMillis();
|
||||
areas = new HashMap<>();
|
||||
areas.put(Area.ID_GLOBAL, new Area(Area.ID_GLOBAL, "全球", 0, null, new ArrayList<>()));
|
||||
|
||||
try {
|
||||
List<CsvRow> rows = CsvUtil.getReader().read(ResourceUtil.getUtf8Reader("area.csv")).getRows();
|
||||
if (!rows.isEmpty()) {
|
||||
rows.remove(0); // 删除 header
|
||||
for (CsvRow row : rows) {
|
||||
// 创建 Area 对象
|
||||
Area area = new Area(Integer.valueOf(row.get(0)), row.get(1), Integer.valueOf(row.get(2)),
|
||||
null, new ArrayList<>());
|
||||
// 添加到 areas 中
|
||||
areas.put(area.getId(), area);
|
||||
|
||||
// 构建父子关系
|
||||
int parentId = Integer.valueOf(row.get(3));
|
||||
Area parent = areas.get(parentId);
|
||||
if (parent != null) {
|
||||
Assert.isTrue(area != parent, "{}:父子节点相同", area.getName());
|
||||
area.setParent(parent);
|
||||
parent.getChildren().add(area);
|
||||
} else {
|
||||
log.warn("区域 {} 的父区域 ID {} 无效", area.getName(), parentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("加载区域数据时发生错误", e);
|
||||
}
|
||||
|
||||
log.info("启动加载 AreaUtils 成功,耗时 ({}) 毫秒", System.currentTimeMillis() - now);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得指定编号对应的区域
|
||||
*
|
||||
* @param id 区域编号
|
||||
* @return 区域
|
||||
*/
|
||||
public static Area getArea(Integer id) {
|
||||
return areas.get(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有节点的全路径名称如:河南省/石家庄市/新华区
|
||||
*
|
||||
* @param areas 地区树
|
||||
* @return 所有节点的全路径名称
|
||||
*/
|
||||
public static List<String> getAreaNodePathList(List<Area> areas) {
|
||||
List<String> paths = new ArrayList<>();
|
||||
areas.forEach(area -> getAreaNodePathList(area, "", paths));
|
||||
return paths;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建一棵树的所有节点的全路径名称,并将其存储为 "祖先/父级/子级" 的形式
|
||||
*
|
||||
* @param node 父节点
|
||||
* @param path 全路径名称
|
||||
* @param paths 全路径名称列表,省份/城市/地区
|
||||
*/
|
||||
private static void getAreaNodePathList(Area node, String path, List<String> paths) {
|
||||
if (node == null) {
|
||||
return;
|
||||
}
|
||||
// 构建当前节点的路径
|
||||
String currentPath = path.isEmpty() ? node.getName() : path + "/" + node.getName();
|
||||
paths.add(currentPath);
|
||||
// 递归遍历子节点
|
||||
for (Area child : node.getChildren()) {
|
||||
getAreaNodePathList(child, currentPath, paths);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化区域
|
||||
*
|
||||
* @param id 区域编号
|
||||
* @return 格式化后的区域
|
||||
*/
|
||||
public static String format(Integer id) {
|
||||
return format(id, " ");
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化区域
|
||||
*
|
||||
* 例如说:
|
||||
* 1. id = “静安区”时:上海 上海市 静安区
|
||||
* 2. id = “上海市”时:上海 上海市
|
||||
* 3. id = “上海”时:上海
|
||||
* 4. id = “美国”时:美国
|
||||
* 当区域在中国时,默认不显示中国
|
||||
*
|
||||
* @param id 区域编号
|
||||
* @param separator 分隔符
|
||||
* @return 格式化后的区域
|
||||
*/
|
||||
public static String format(Integer id, String separator) {
|
||||
// 获得区域
|
||||
Area area = areas.get(id);
|
||||
if (area == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 格式化
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < AreaType.values().length; i++) { // 避免死循环
|
||||
sb.insert(0, area.getName());
|
||||
// “递归”父节点
|
||||
area = area.getParent();
|
||||
if (area == null
|
||||
||
|
||||
AreaType.getSkipType().contains(area.getId())) { // 跳过父节点为中国的情况
|
||||
break;
|
||||
}
|
||||
sb.insert(0, separator);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static AreaUtils getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public static <S, T> List<T> toBean(List<S> source, Class<T> targetType) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
return convertList(source, s -> toBean(s, targetType));
|
||||
}
|
||||
|
||||
public static <T> T toBean(Object source, Class<T> targetClass) {
|
||||
return BeanUtil.toBean(source, targetClass);
|
||||
}
|
||||
|
||||
public static <T, U> List<U> convertList(Collection<T> from, Function<T, U> func) {
|
||||
if (CollUtil.isEmpty(from)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return from.stream().map(func).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 初始化 SEARCHER
|
||||
// */
|
||||
// @SuppressWarnings("InstantiationOfUtilityClass")
|
||||
// private final static AreaUtils INSTANCE = new AreaUtils();
|
||||
//
|
||||
// /**
|
||||
// * Area 内存缓存,提升访问速度
|
||||
// */
|
||||
// private static Map<Integer, Area> areas;
|
||||
//
|
||||
// private AreaUtils() {
|
||||
// long now = System.currentTimeMillis();
|
||||
// areas = new HashMap<>();
|
||||
// areas.put(Area.ID_GLOBAL, new Area(Area.ID_GLOBAL, "全球", 0, null, new ArrayList<>()));
|
||||
//
|
||||
// try {
|
||||
// List<CsvRow> rows = CsvUtil.getReader().read(ResourceUtil.getUtf8Reader("area.csv")).getRows();
|
||||
// if (!rows.isEmpty()) {
|
||||
// rows.remove(0); // 删除 header
|
||||
// for (CsvRow row : rows) {
|
||||
// // 创建 Area 对象
|
||||
// Area area = new Area(Integer.valueOf(row.get(0)), row.get(1), Integer.valueOf(row.get(2)),
|
||||
// null, new ArrayList<>());
|
||||
// // 添加到 areas 中
|
||||
// areas.put(area.getId(), area);
|
||||
//
|
||||
// // 构建父子关系
|
||||
// int parentId = Integer.valueOf(row.get(3));
|
||||
// Area parent = areas.get(parentId);
|
||||
// if (parent != null) {
|
||||
// Assert.isTrue(area != parent, "{}:父子节点相同", area.getName());
|
||||
// area.setParent(parent);
|
||||
// parent.getChildren().add(area);
|
||||
// } else {
|
||||
// log.warn("区域 {} 的父区域 ID {} 无效", area.getName(), parentId);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("加载区域数据时发生错误", e);
|
||||
// }
|
||||
//
|
||||
// log.info("启动加载 AreaUtils 成功,耗时 ({}) 毫秒", System.currentTimeMillis() - now);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获得指定编号对应的区域
|
||||
// *
|
||||
// * @param id 区域编号
|
||||
// * @return 区域
|
||||
// */
|
||||
// public static Area getArea(Integer id) {
|
||||
// return areas.get(id);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取所有节点的全路径名称如:河南省/石家庄市/新华区
|
||||
// *
|
||||
// * @param areas 地区树
|
||||
// * @return 所有节点的全路径名称
|
||||
// */
|
||||
// public static List<String> getAreaNodePathList(List<Area> areas) {
|
||||
// List<String> paths = new ArrayList<>();
|
||||
// areas.forEach(area -> getAreaNodePathList(area, "", paths));
|
||||
// return paths;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 构建一棵树的所有节点的全路径名称,并将其存储为 "祖先/父级/子级" 的形式
|
||||
// *
|
||||
// * @param node 父节点
|
||||
// * @param path 全路径名称
|
||||
// * @param paths 全路径名称列表,省份/城市/地区
|
||||
// */
|
||||
// private static void getAreaNodePathList(Area node, String path, List<String> paths) {
|
||||
// if (node == null) {
|
||||
// return;
|
||||
// }
|
||||
// // 构建当前节点的路径
|
||||
// String currentPath = path.isEmpty() ? node.getName() : path + "/" + node.getName();
|
||||
// paths.add(currentPath);
|
||||
// // 递归遍历子节点
|
||||
// for (Area child : node.getChildren()) {
|
||||
// getAreaNodePathList(child, currentPath, paths);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 格式化区域
|
||||
// *
|
||||
// * @param id 区域编号
|
||||
// * @return 格式化后的区域
|
||||
// */
|
||||
// public static String format(Integer id) {
|
||||
// return format(id, " ");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 格式化区域
|
||||
// *
|
||||
// * 例如说:
|
||||
// * 1. id = “静安区”时:上海 上海市 静安区
|
||||
// * 2. id = “上海市”时:上海 上海市
|
||||
// * 3. id = “上海”时:上海
|
||||
// * 4. id = “美国”时:美国
|
||||
// * 当区域在中国时,默认不显示中国
|
||||
// *
|
||||
// * @param id 区域编号
|
||||
// * @param separator 分隔符
|
||||
// * @return 格式化后的区域
|
||||
// */
|
||||
// public static String format(Integer id, String separator) {
|
||||
// // 获得区域
|
||||
// Area area = areas.get(id);
|
||||
// if (area == null) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// // 格式化
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// for (int i = 0; i < AreaType.values().length; i++) { // 避免死循环
|
||||
// sb.insert(0, area.getName());
|
||||
// // “递归”父节点
|
||||
// area = area.getParent();
|
||||
// if (area == null
|
||||
// ||
|
||||
// AreaType.getSkipType().contains(area.getId())) { // 跳过父节点为中国的情况
|
||||
// break;
|
||||
// }
|
||||
// sb.insert(0, separator);
|
||||
// }
|
||||
// return sb.toString();
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// public static AreaUtils getInstance() {
|
||||
// return INSTANCE;
|
||||
// }
|
||||
//
|
||||
// public static <S, T> List<T> toBean(List<S> source, Class<T> targetType) {
|
||||
// if (source == null) {
|
||||
// return null;
|
||||
// }
|
||||
// return convertList(source, s -> toBean(s, targetType));
|
||||
// }
|
||||
//
|
||||
// public static <T> T toBean(Object source, Class<T> targetClass) {
|
||||
// return BeanUtil.toBean(source, targetClass);
|
||||
// }
|
||||
//
|
||||
// public static <T, U> List<U> convertList(Collection<T> from, Function<T, U> func) {
|
||||
// if (CollUtil.isEmpty(from)) {
|
||||
// return new ArrayList<>();
|
||||
// }
|
||||
// return from.stream().map(func).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
|
||||
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
||||
// 过滤请求
|
||||
.authorizeRequests()
|
||||
// 对于登录login 验证码captchaImage 允许匿名访问
|
||||
.antMatchers("/login", "/app/login", "/captchaImage","/demo/tress/all","/test","/testGet").anonymous()
|
||||
.antMatchers("/login", "/app/login", "/captchaImage","/demo/tress/all").anonymous()
|
||||
.antMatchers("/app/login","/wgz/app/wgzRegister").permitAll()
|
||||
.antMatchers(
|
||||
HttpMethod.GET,
|
||||
|
@ -54,6 +54,9 @@ public class BgtProjectRecruitApplyVO implements Serializable {
|
||||
@ApiModelProperty("工种")
|
||||
private String typeOfWork;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String identityCard;
|
||||
|
||||
@ApiModelProperty("招工ID")
|
||||
private Long recruitId;
|
||||
|
||||
|
@ -36,7 +36,6 @@ import com.ruoyi.wgz.domain.WgzUser;
|
||||
import com.ruoyi.wgz.service.IWgzMessageService;
|
||||
import com.ruoyi.wgz.service.IWgzScoreRecordService;
|
||||
import com.ruoyi.wgz.service.IWgzUserService;
|
||||
import com.ruoyi.wgz.service.impl.WgzMessageServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
@ -224,6 +223,7 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
Map<String, String> map = bgtMessage(mp, BGT_TYPE_SIGN_UP, true);
|
||||
WgzMessage wgzMessage = new WgzMessage()
|
||||
.setSenderType(USERTYPE_BGT)
|
||||
.setSenderId(SecurityUtils.getAppUserId())
|
||||
.setRecipientType(USERTYPE_WGZ)
|
||||
.setRecipientId(recruitApply.getUserId())
|
||||
.setHeadline(map.get(HEADLINE))
|
||||
@ -367,6 +367,7 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
Map<String, String> map = bgtMessage(mp, BGT_TYPE_EXIT, true);
|
||||
WgzMessage wgzMessage = new WgzMessage()
|
||||
.setSenderType(USERTYPE_BGT)
|
||||
.setSenderId(SecurityUtils.getAppUserId())
|
||||
.setRecipientType(USERTYPE_WGZ)
|
||||
.setRecipientId(recruitApply.getUserId())
|
||||
.setHeadline(map.get(HEADLINE))
|
||||
@ -395,6 +396,7 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
Map<String, String> map = bgtMessage(mp, BGT_TYPE_CANSEL, true);
|
||||
WgzMessage wgzMessage = new WgzMessage()
|
||||
.setSenderType(USERTYPE_BGT)
|
||||
.setSenderId(SecurityUtils.getAppUserId())
|
||||
.setRecipientType(USERTYPE_WGZ)
|
||||
.setRecipientId(recruitApply.getUserId())
|
||||
.setHeadline(map.get(HEADLINE))
|
||||
@ -432,6 +434,7 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
Map<String, String> map = bgtMessage(mp, BGT_TYPE_EXIT, false);
|
||||
WgzMessage wgzMessage = new WgzMessage()
|
||||
.setSenderType(USERTYPE_BGT)
|
||||
.setSenderId(SecurityUtils.getAppUserId())
|
||||
.setRecipientType(USERTYPE_WGZ)
|
||||
.setRecipientId(vo.getUserId())
|
||||
.setHeadline(map.get(HEADLINE))
|
||||
|
@ -50,6 +50,9 @@ public class AppTaskVO {
|
||||
@ApiModelProperty("项目名")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("任务图片")
|
||||
private String taskImg;
|
||||
|
||||
@ApiModelProperty("任务开始时间")
|
||||
private String taskBeginTime;
|
||||
|
||||
|
@ -0,0 +1,48 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 区域对象 sys_area
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("sys_area")
|
||||
@ApiModel("区域视图对象")
|
||||
public class SysArea implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty("编码")
|
||||
private Integer adCode;
|
||||
|
||||
@ApiModelProperty("父编码")
|
||||
private Integer parentId;
|
||||
|
||||
@ApiModelProperty("城市代码")
|
||||
private String cityCode;
|
||||
|
||||
@ApiModelProperty("级别")
|
||||
private String level;
|
||||
|
||||
@ApiModelProperty("名字")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("坐标")
|
||||
private String center;
|
||||
|
||||
@ApiModelProperty("是否最后")
|
||||
private String isLast;
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 区域对象 sys_area
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
@Data
|
||||
public class SysAreaVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty("编码")
|
||||
private Integer adCode;
|
||||
|
||||
@ApiModelProperty("父编码")
|
||||
private Integer parentId;
|
||||
|
||||
@ApiModelProperty("城市代码")
|
||||
private String cityCode;
|
||||
|
||||
@ApiModelProperty("级别")
|
||||
private String level;
|
||||
|
||||
@ApiModelProperty("名字")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("坐标")
|
||||
private String center;
|
||||
|
||||
@ApiModelProperty("是否最后")
|
||||
private String isLast;
|
||||
|
||||
@ApiModelProperty("子集")
|
||||
private List<SysAreaVO> children;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.system.domain.SysArea;
|
||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||
import org.apache.ibatis.annotations.CacheNamespace;
|
||||
|
||||
/**
|
||||
* 区域Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象
|
||||
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
||||
public interface SysAreaMapper extends BaseMapperPlus<SysArea> {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||
import com.ruoyi.system.domain.SysArea;
|
||||
import com.ruoyi.system.domain.vo.SysAreaVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 区域Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
public interface ISysAreaService extends IServicePlus<SysArea> {
|
||||
|
||||
|
||||
List<SysAreaVO> getAllArea();
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.ruoyi.system.domain.SysArea;
|
||||
import com.ruoyi.system.domain.vo.SysAreaVO;
|
||||
import com.ruoyi.system.mapper.SysAreaMapper;
|
||||
import com.ruoyi.system.service.ISysAreaService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 区域Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
@Service
|
||||
public class SysAreaServiceImpl extends ServicePlusImpl<SysAreaMapper, SysArea> implements ISysAreaService {
|
||||
|
||||
@Override
|
||||
public List<SysAreaVO> getAllArea() {
|
||||
List<SysArea> list = list(Wrappers.<SysArea>lambdaQuery().ne(SysArea::getAdCode, 10000).orderByAsc(SysArea::getAdCode));
|
||||
return buildTree(list);
|
||||
}
|
||||
|
||||
|
||||
// 构建树形结构
|
||||
public static List<SysAreaVO> buildTree(List<SysArea> areas) {
|
||||
// 用于快速查找每个节点
|
||||
Map<Integer, SysAreaVO> areaMap = new HashMap<>();
|
||||
List<SysAreaVO> rootNodes = new ArrayList<>();
|
||||
|
||||
// 先将所有 SysArea 转换为 SysAreaVO 并存储到 map 中
|
||||
for (SysArea area : areas) {
|
||||
SysAreaVO vo = BeanUtil.copyProperties(area, SysAreaVO.class);
|
||||
areaMap.put(vo.getAdCode(), vo);
|
||||
}
|
||||
|
||||
// 构建树形结构
|
||||
for (SysArea area : areas) {
|
||||
Integer adCode = area.getAdCode();
|
||||
Integer parentId = area.getParentId();
|
||||
SysAreaVO currentVO = areaMap.get(adCode);
|
||||
|
||||
if (parentId == 100000) {
|
||||
// 顶级节点
|
||||
rootNodes.add(currentVO);
|
||||
} else {
|
||||
// 非顶级节点,找到其父节点并添加到父节点的 children 列表中
|
||||
SysAreaVO parentVO = areaMap.get(parentId);
|
||||
if (parentVO != null) {
|
||||
if (parentVO.getChildren() == null) {
|
||||
parentVO.setChildren(new ArrayList<>());
|
||||
}
|
||||
parentVO.getChildren().add(currentVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rootNodes;
|
||||
}
|
||||
}
|
@ -224,6 +224,7 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl<WgzLeaveMapper, WgzLeav
|
||||
Map<String, String> map = bgtMessage(mp, BGT_TYPE_LEAVE, AuditStatus.PASS.getCode().equals(dto.getAuditorType()));
|
||||
WgzMessage wgzMessage = new WgzMessage()
|
||||
.setSenderType(USERTYPE_BGT)
|
||||
.setSenderId(SecurityUtils.getAppUserId())
|
||||
.setRecipientType(USERTYPE_WGZ)
|
||||
.setRecipientId(wgzLeave.getUserId())
|
||||
.setHeadline(map.get(HEADLINE))
|
||||
|
@ -290,6 +290,7 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
Map<String, String> map = bgtMessage(mp, BGT_TYPE_PAY, AuditStatus.PASS.getCode().equals(dto.getAuditorType()));
|
||||
WgzMessage wgzMessage = new WgzMessage()
|
||||
.setSenderType(USERTYPE_BGT)
|
||||
.setSenderId(SecurityUtils.getAppUserId())
|
||||
.setRecipientType(USERTYPE_WGZ)
|
||||
.setRecipientId(payCalculation.getUserId())
|
||||
.setHeadline(map.get(HEADLINE))
|
||||
|
@ -274,6 +274,7 @@ public class WgzReissueacardServiceImpl extends ServicePlusImpl<WgzReissueacardM
|
||||
Map<String, String> map = bgtMessage(mp, BGT_TYPE_MAKE_UP, true);
|
||||
WgzMessage wgzMessage = new WgzMessage()
|
||||
.setSenderType(USERTYPE_BGT)
|
||||
.setSenderId(SecurityUtils.getAppUserId())
|
||||
.setRecipientType(USERTYPE_WGZ)
|
||||
.setRecipientId(byId.getUserId())
|
||||
.setHeadline(map.get(HEADLINE))
|
||||
|
@ -208,6 +208,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
wu.score,
|
||||
wu.avatar_name,
|
||||
wu.username,
|
||||
wu.identity_card,
|
||||
bpra.status,
|
||||
wu.type_of_work,
|
||||
bpr.recruit_name,
|
||||
|
@ -36,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
fpt.section_id,
|
||||
fpt.sub_id,
|
||||
fpt.task_name,
|
||||
fpt.task_img,
|
||||
fpt.task_staff_num,
|
||||
fpt.task_amount,
|
||||
fpt.task_begin_time,
|
||||
|
BIN
ruoyi/uploadPath/appResource/taskDefault.png
Normal file
BIN
ruoyi/uploadPath/appResource/taskDefault.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 MiB |
Reference in New Issue
Block a user