Browse Source

整合外部角色、外部人员、组织架构

master
牧羊人 4 years ago
parent
commit
9c90ceaddd
30 changed files with 463 additions and 610 deletions
  1. +1
    -1
      src/main/java/com/taauav/admin/constant/CommonConstant.java
  2. +5
    -7
      src/main/java/com/taauav/admin/controller/LsAdminController.java
  3. +5
    -6
      src/main/java/com/taauav/admin/controller/LsAuthGroupController.java
  4. +17
    -21
      src/main/java/com/taauav/admin/controller/TauvCityController.java
  5. +16
    -46
      src/main/java/com/taauav/admin/entity/LsAdmin.java
  6. +4
    -18
      src/main/java/com/taauav/admin/entity/LsAuthGroup.java
  7. +8
    -1
      src/main/java/com/taauav/admin/entity/SysCity.java
  8. +2
    -2
      src/main/java/com/taauav/admin/mapper/LsAdminMapper.java
  9. +1
    -1
      src/main/java/com/taauav/admin/mapper/LsAdminMapper.xml
  10. +2
    -2
      src/main/java/com/taauav/admin/mapper/LsAuthGroupMapper.java
  11. +1
    -1
      src/main/java/com/taauav/admin/mapper/LsAuthGroupMapper.xml
  12. +0
    -16
      src/main/java/com/taauav/admin/mapper/TauvAgencyMapper.java
  13. +0
    -5
      src/main/java/com/taauav/admin/mapper/TauvAgencyMapper.xml
  14. +0
    -17
      src/main/java/com/taauav/admin/query/AgencyQuery.java
  15. +1
    -1
      src/main/java/com/taauav/admin/query/LsAdminQuery.java
  16. +1
    -1
      src/main/java/com/taauav/admin/query/LsAuthGroupQuery.java
  17. +5
    -4
      src/main/java/com/taauav/admin/service/ILsAdminService.java
  18. +15
    -5
      src/main/java/com/taauav/admin/service/ILsAuthGroupService.java
  19. +20
    -15
      src/main/java/com/taauav/admin/service/ITauvCityService.java
  20. +36
    -30
      src/main/java/com/taauav/admin/service/impl/LsAdminServiceImpl.java
  21. +50
    -26
      src/main/java/com/taauav/admin/service/impl/LsAuthGroupServiceImpl.java
  22. +0
    -3
      src/main/java/com/taauav/admin/service/impl/SysCityServiceImpl.java
  23. +0
    -249
      src/main/java/com/taauav/admin/service/impl/TauvAgencyServiceImpl.java
  24. +222
    -0
      src/main/java/com/taauav/admin/service/impl/TauvCityServiceImpl.java
  25. +37
    -21
      src/main/java/com/taauav/admin/vo/LsAdminListVo.java
  26. +10
    -8
      src/main/java/com/taauav/admin/vo/LsAuthGroupListVo.java
  27. +2
    -3
      src/main/java/com/taauav/admin/vo/TauvCityListVo.java
  28. +0
    -82
      src/main/java/com/taauav/front/entity/LsAuthGroup.java
  29. +0
    -5
      src/main/java/com/taauav/front/service/ILsLoginService.java
  30. +2
    -13
      src/main/java/com/taauav/front/service/impl/LsLoginServiceImpl.java

+ 1
- 1
src/main/java/com/taauav/admin/constant/CommonConstant.java View File

/** /**
* 河长等级 * 河长等级
*/ */
public static Map<Integer, String> LSADMIN_RIVER_GRADE_LIST = new HashMap<Integer, String>() {
public static Map<Integer, String> LSADMIN_LEVEL_LIST = new HashMap<Integer, String>() {
{ {
put(1, "河长等级1"); put(1, "河长等级1");
put(2, "河长等级2"); put(2, "河长等级2");

src/main/java/com/taauav/front/controller/LsAdminController.java → src/main/java/com/taauav/admin/controller/LsAdminController.java View File

package com.taauav.front.controller;
package com.taauav.admin.controller;




import com.taauav.admin.controller.BaseController;
import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.common.constant.PermissionConstants; import com.taauav.common.constant.PermissionConstants;
import com.taauav.front.entity.LsAdmin;
import com.taauav.front.entity.LsAuthGroup;
import com.taauav.front.query.LsAdminQuery;
import com.taauav.front.service.ILsAdminService;
import com.taauav.admin.entity.LsAdmin;
import com.taauav.admin.query.LsAdminQuery;
import com.taauav.admin.service.ILsAdminService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
* @since 2020-04-01 * @since 2020-04-01
*/ */
@RestController @RestController
@RequestMapping("/front/lsadmin")
@RequestMapping("/lsadmin")
public class LsAdminController extends BaseController { public class LsAdminController extends BaseController {


@Autowired @Autowired

src/main/java/com/taauav/front/controller/LsAuthGroupController.java → src/main/java/com/taauav/admin/controller/LsAuthGroupController.java View File

package com.taauav.front.controller;
package com.taauav.admin.controller;




import com.taauav.admin.controller.BaseController;
import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.common.constant.PermissionConstants; import com.taauav.common.constant.PermissionConstants;
import com.taauav.front.entity.LsAuthGroup;
import com.taauav.front.query.LsAuthGroupQuery;
import com.taauav.front.service.ILsAuthGroupService;
import com.taauav.admin.entity.LsAuthGroup;
import com.taauav.admin.query.LsAuthGroupQuery;
import com.taauav.admin.service.ILsAuthGroupService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
* @since 2020-04-01 * @since 2020-04-01
*/ */
@RestController @RestController
@RequestMapping("/front/lsauthgroup")
@RequestMapping("/lsauthgroup")
public class LsAuthGroupController extends BaseController { public class LsAuthGroupController extends BaseController {


@Autowired @Autowired

src/main/java/com/taauav/admin/controller/TauvAgencyController.java → src/main/java/com/taauav/admin/controller/TauvCityController.java View File

package com.taauav.admin.controller; package com.taauav.admin.controller;




import com.taauav.admin.entity.TauvAgency;
import com.taauav.admin.query.AgencyQuery;
import com.taauav.admin.service.ITauvAgencyService;
import com.taauav.admin.vo.TauvAgencyListVo;
import com.taauav.admin.entity.SysCity;
import com.taauav.admin.service.ITauvCityService;
import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.common.constant.PermissionConstants; import com.taauav.common.constant.PermissionConstants;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;


import javax.validation.Valid; import javax.validation.Valid;
import java.util.List;
import java.math.BigInteger;


/** /**
* <p> * <p>
*/ */
@RestController @RestController
@RequestMapping("/agency") @RequestMapping("/agency")
public class TauvAgencyController {
public class TauvCityController {


@Autowired @Autowired
private ITauvAgencyService tauvAgencyService;
private ITauvCityService tauvAgencyService;


@Autowired @Autowired
private Response response; private Response response;
/** /**
* 获取机构列表 * 获取机构列表
* *
* @param query 查询条件
* @return * @return
*/ */
@PostMapping("/index") @PostMapping("/index")
@RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) @RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION)
public Response index(@RequestBody(required = false) AgencyQuery query) {
return tauvAgencyService.getList(query);
public Response index() {
return tauvAgencyService.getList();
} }


/** /**
*/ */
@PostMapping("/add") @PostMapping("/add")
@RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) @RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION)
public Response add(@RequestBody @Valid TauvAgency entity, BindingResult bindingResult) {
public Response add(@RequestBody @Valid SysCity entity, BindingResult bindingResult) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
String message = bindingResult.getFieldError().getDefaultMessage(); String message = bindingResult.getFieldError().getDefaultMessage();
return response.failure(message); return response.failure(message);
*/ */
@GetMapping("/info") @GetMapping("/info")
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) @RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION)
public Response info(Integer id) {
public Response info(BigInteger id) {
return tauvAgencyService.info(id); return tauvAgencyService.info(id);
} }


*/ */
@PostMapping("/edit") @PostMapping("/edit")
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) @RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION)
public Response edit(@RequestBody @Valid TauvAgency entity, BindingResult bindingResult) {
public Response edit(@RequestBody @Valid SysCity entity, BindingResult bindingResult) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
String message = bindingResult.getFieldError().getDefaultMessage(); String message = bindingResult.getFieldError().getDefaultMessage();
return response.failure(message); return response.failure(message);
*/ */
@PostMapping("/drop") @PostMapping("/drop")
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION) @RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION)
public Response delete(Integer id) {
public Response delete(BigInteger id) {
return tauvAgencyService.delete(id); return tauvAgencyService.delete(id);
} }


*/ */
@PostMapping("/setStatus") @PostMapping("/setStatus")
@RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION) @RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION)
public Response setStatus(@RequestBody TauvAgency entity) {
public Response setStatus(@RequestBody SysCity entity) {
return tauvAgencyService.setStatus(entity); return tauvAgencyService.setStatus(entity);
} }



/** /**
* 获取机构列表
* 获取子级城市列表
* *
* @param pid 上级ID
* @return * @return
*/ */
@PostMapping("/getAgencyList")
public Response getAgencyList() {
List<TauvAgencyListVo> tauvAgencyListVoList = tauvAgencyService.getAgencyList(0);
return response.success(tauvAgencyListVoList);
@PostMapping("/getChildCityList")
public Response getChildCityList(BigInteger pid) {
return tauvAgencyService.getChildCityList(pid);
} }


} }

src/main/java/com/taauav/front/entity/LsAdmin.java → src/main/java/com/taauav/admin/entity/LsAdmin.java View File

package com.taauav.front.entity;
package com.taauav.admin.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.taauav.common.domain.Entity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;


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


/** /**
* <p> * <p>
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
public class LsAdmin implements Serializable {
public class LsAdmin extends Entity {


private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;


/**
* ID
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;

/** /**
* 姓名 * 姓名
*/ */
/** /**
* 河长等级 * 河长等级
*/ */
private String riverGrade;
private Integer level;

/**
* 区划ID
*/
private BigInteger driverArea;


/** /**
* 职务 * 职务
*/ */
private String note; private String note;


/**
* 状态:1正常 2关闭 3未审核
*/
private Integer status;

/** /**
* 登录次数 * 登录次数
*/ */
/** /**
* 上次登录时间 * 上次登录时间
*/ */
private Integer lastTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastTime;


/** /**
* 排序 * 排序
*/ */
private Integer sort; private Integer sort;


/**
* 创建人
*/
private Integer createUser;

/**
* 更新人
*/
private Integer updateUser;

/**
* 创建时间
*/
private Integer createTime;

/**
* 更新时间
*/
private Integer updateTime;

/**
* 有效标记
*/
private Integer mark;


} }

src/main/java/com/taauav/admin/entity/TauvAgency.java → src/main/java/com/taauav/admin/entity/LsAuthGroup.java View File

package com.taauav.admin.entity; package com.taauav.admin.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;

import com.taauav.common.domain.Entity; import com.taauav.common.domain.Entity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;


/** /**
* <p> * <p>
* 用户组
* 外部用户角色
* </p> * </p>
* *
* @author dyg * @author dyg
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
public class TauvAgency extends Entity {
public class LsAuthGroup extends Entity {


private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;


/**
* 父级ID
*/
private Integer pid;


/** /**
* 用户组中文名称 * 用户组中文名称
private String name; private String name;


/** /**
* 有无子级:1有 2无
*/
private Integer hasChild;

/**
* 层级
* 数据权限:1查看自己区划数据 2查看所有区划数据 3查看指定区划数据
*/ */
private Integer level;
private Integer authData;


/** /**
* 备注 * 备注

+ 8
- 1
src/main/java/com/taauav/admin/entity/SysCity.java View File

import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;


/** /**
/** /**
* 有无子级:1有 2无 * 有无子级:1有 2无
*/ */
private Boolean hasChild;
private Integer hasChild;


/** /**
* 显示顺序 * 显示顺序
*/ */
private Integer status; private Integer status;


/**
* 备注
*/
@Length(max = 255, message = "备注最大长度为255")
private String note;

/** /**
* 创建人 * 创建人
*/ */

src/main/java/com/taauav/front/mapper/LsAdminMapper.java → src/main/java/com/taauav/admin/mapper/LsAdminMapper.java View File

package com.taauav.front.mapper;
package com.taauav.admin.mapper;


import com.taauav.front.entity.LsAdmin;
import com.taauav.admin.entity.LsAdmin;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;


/** /**

src/main/java/com/taauav/front/mapper/LsAdminMapper.xml → src/main/java/com/taauav/admin/mapper/LsAdminMapper.xml View File

<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.taauav.front.mapper.LsAdminMapper">
<mapper namespace="com.taauav.admin.mapper.LsAdminMapper">


</mapper> </mapper>

src/main/java/com/taauav/front/mapper/LsAuthGroupMapper.java → src/main/java/com/taauav/admin/mapper/LsAuthGroupMapper.java View File

package com.taauav.front.mapper;
package com.taauav.admin.mapper;


import com.taauav.front.entity.LsAuthGroup;
import com.taauav.admin.entity.LsAuthGroup;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;


/** /**

src/main/java/com/taauav/front/mapper/LsAuthGroupMapper.xml → src/main/java/com/taauav/admin/mapper/LsAuthGroupMapper.xml View File

<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.taauav.front.mapper.LsAuthGroupMapper">
<mapper namespace="com.taauav.admin.mapper.LsAuthGroupMapper">


</mapper> </mapper>

+ 0
- 16
src/main/java/com/taauav/admin/mapper/TauvAgencyMapper.java View File

package com.taauav.admin.mapper;

import com.taauav.admin.entity.TauvAgency;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* 用户组表 Mapper 接口
* </p>
*
* @author dyg
* @since 2020-04-01
*/
public interface TauvAgencyMapper extends BaseMapper<TauvAgency> {

}

+ 0
- 5
src/main/java/com/taauav/admin/mapper/TauvAgencyMapper.xml View File

<?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.taauav.admin.mapper.TauvAgencyMapper">

</mapper>

+ 0
- 17
src/main/java/com/taauav/admin/query/AgencyQuery.java View File

package com.taauav.admin.query;

import com.taauav.common.core.mps.BaseQuery;
import lombok.Data;

/**
* 机构查询条件
*/
@Data
public class AgencyQuery extends BaseQuery {

/**
* 机构名称
*/
private String name;

}

src/main/java/com/taauav/front/query/LsAdminQuery.java → src/main/java/com/taauav/admin/query/LsAdminQuery.java View File

package com.taauav.front.query;
package com.taauav.admin.query;


import com.taauav.common.core.mps.BaseQuery; import com.taauav.common.core.mps.BaseQuery;
import lombok.Data; import lombok.Data;

src/main/java/com/taauav/front/query/LsAuthGroupQuery.java → src/main/java/com/taauav/admin/query/LsAuthGroupQuery.java View File

package com.taauav.front.query;
package com.taauav.admin.query;


import com.taauav.common.core.mps.BaseQuery; import com.taauav.common.core.mps.BaseQuery;
import lombok.Data; import lombok.Data;

src/main/java/com/taauav/front/service/ILsAdminService.java → src/main/java/com/taauav/admin/service/ILsAdminService.java View File

package com.taauav.front.service;
package com.taauav.admin.service;


import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.front.entity.LsAdmin;
import com.taauav.admin.entity.LsAdmin;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.taauav.front.query.LsAdminQuery;
import com.taauav.admin.query.LsAdminQuery;
import com.taauav.common.service.IBaseService;


import java.util.Map; import java.util.Map;


* @author dyg * @author dyg
* @since 2020-04-01 * @since 2020-04-01
*/ */
public interface ILsAdminService extends IService<LsAdmin> {
public interface ILsAdminService extends IBaseService<LsAdmin> {


/** /**
* 获取用户列表 * 获取用户列表

src/main/java/com/taauav/front/service/ILsAuthGroupService.java → src/main/java/com/taauav/admin/service/ILsAuthGroupService.java View File

package com.taauav.front.service;
package com.taauav.admin.service;


import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.front.entity.LsAuthGroup;
import com.baomidou.mybatisplus.extension.service.IService;
import com.taauav.front.query.LsAuthGroupQuery;
import com.taauav.admin.entity.LsAuthGroup;
import com.taauav.admin.query.LsAuthGroupQuery;
import com.taauav.common.service.IBaseService;

import java.util.List;


/** /**
* <p> * <p>
* @author dyg * @author dyg
* @since 2020-04-01 * @since 2020-04-01
*/ */
public interface ILsAuthGroupService extends IService<LsAuthGroup> {
public interface ILsAuthGroupService extends IBaseService<LsAuthGroup> {


/** /**
* 获取角色列表 * 获取角色列表
*/ */
Response getAuthGroupList(); Response getAuthGroupList();


/**
* 获取外部角色
*
* @param authGroupIds
* @return
*/
String getAuthGroupName(String authGroupIds);

} }

src/main/java/com/taauav/admin/service/ITauvAgencyService.java → src/main/java/com/taauav/admin/service/ITauvCityService.java View File

package com.taauav.admin.service; package com.taauav.admin.service;


import com.taauav.admin.entity.TauvAgency;
import com.taauav.admin.query.AgencyQuery;
import com.taauav.admin.vo.TauvAgencyListVo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.taauav.admin.entity.SysCity;
import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.common.service.IBaseService;


import java.util.List;
import java.math.BigInteger;


/** /**
* <p> * <p>
* @author dyg * @author dyg
* @since 2020-04-01 * @since 2020-04-01
*/ */
public interface ITauvAgencyService extends IBaseService<TauvAgency> {
public interface ITauvCityService extends IService<SysCity> {


/** /**
* 获取机构列表 * 获取机构列表
* *
* @param query 查询条件
* @return * @return
*/ */
Response getList(AgencyQuery query);
Response getList();


/** /**
* 添加机构 * 添加机构
* @param entity 实体对象 * @param entity 实体对象
* @return * @return
*/ */
Response add(TauvAgency entity);
Response add(SysCity entity);


/** /**
* 获取机构详情 * 获取机构详情
* @param id 机构ID * @param id 机构ID
* @return * @return
*/ */
Response info(Integer id);
Response info(BigInteger id);


/** /**
* 编辑机构 * 编辑机构
* @param entity 实体对象 * @param entity 实体对象
* @return * @return
*/ */
Response edit(TauvAgency entity);
Response edit(SysCity entity);


/** /**
* 删除机构 * 删除机构
* @param id 机构ID * @param id 机构ID
* @return * @return
*/ */
Response delete(Integer id);
Response delete(BigInteger id);


/** /**
* 设置状态 * 设置状态
* @param entity 实体对象 * @param entity 实体对象
* @return * @return
*/ */
Response setStatus(TauvAgency entity);
Response setStatus(SysCity entity);


/** /**
* 获取机构列表
* 获取子级城市
* *
* @param pid 上级ID * @param pid 上级ID
* @return * @return
*/ */
List<TauvAgencyListVo> getAgencyList(Integer pid);
Response getChildCityList(BigInteger pid);

// /**
// * 获取机构列表
// *
// * @param pid 上级ID
// * @return
// */
// List<TauvAgencyListVo> getAgencyList(BigInteger pid);


} }

src/main/java/com/taauav/front/service/impl/LsAdminServiceImpl.java → src/main/java/com/taauav/admin/service/impl/LsAdminServiceImpl.java View File

package com.taauav.front.service.impl;
package com.taauav.admin.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.taauav.admin.constant.CommonConstant; import com.taauav.admin.constant.CommonConstant;
import com.taauav.admin.service.ILsAuthGroupService;
import com.taauav.admin.service.ISysCityService;
import com.taauav.admin.vo.LsAdminListVo;
import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.common.service.impl.BaseServiceImpl;
import com.taauav.common.util.FunctionUtils; import com.taauav.common.util.FunctionUtils;
import com.taauav.common.util.ShiroUtils;
import com.taauav.common.util.StringUtils; import com.taauav.common.util.StringUtils;
import com.taauav.front.entity.LsAdmin;
import com.taauav.front.mapper.LsAdminMapper;
import com.taauav.front.query.LsAdminQuery;
import com.taauav.front.service.ILsAdminService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.taauav.front.vo.LsAdminListVo;
import com.taauav.admin.entity.LsAdmin;
import com.taauav.admin.mapper.LsAdminMapper;
import com.taauav.admin.query.LsAdminQuery;
import com.taauav.admin.service.ILsAdminService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
* @since 2020-04-01 * @since 2020-04-01
*/ */
@Service @Service
public class LsAdminServiceImpl extends ServiceImpl<LsAdminMapper, LsAdmin> implements ILsAdminService {
public class LsAdminServiceImpl extends BaseServiceImpl<LsAdminMapper, LsAdmin> implements ILsAdminService {


@Autowired @Autowired
private LsAdminMapper lsAdminMapper; private LsAdminMapper lsAdminMapper;
@Autowired @Autowired
private Response response; private Response response;


@Autowired
private ISysCityService cityService;

@Autowired
private ILsAuthGroupService authGroupService;

/** /**
* 获取数据列表 * 获取数据列表
* *
LsAdminListVo lsAdminListVo = new LsAdminListVo(); LsAdminListVo lsAdminListVo = new LsAdminListVo();
// 拷贝属性 // 拷贝属性
BeanUtils.copyProperties(item, lsAdminListVo); BeanUtils.copyProperties(item, lsAdminListVo);
// 区划描述
String cityName = cityService.getCityName(item.getDriverArea());
lsAdminListVo.setDriverAreaName(cityName);
// 角色描述
String authGroupName = authGroupService.getAuthGroupName(item.getAuthGroup());
lsAdminListVo.setAuthGroupName(authGroupName);
lsAdminListVoList.add(lsAdminListVo); lsAdminListVoList.add(lsAdminListVo);
}); });
} }
*/ */
@Override @Override
public Response add(LsAdmin entity) { public Response add(LsAdmin entity) {
entity.setCreateUser(ShiroUtils.getAdminId());
entity.setCreateTime(FunctionUtils.getCurrentTime());
if (StringUtils.isEmpty(entity.getPassword())) { if (StringUtils.isEmpty(entity.getPassword())) {
// 初始密码:123456 // 初始密码:123456
entity.setPassword(FunctionUtils.password("123456")); entity.setPassword(FunctionUtils.password("123456"));
} else { } else {
entity.setPassword(FunctionUtils.password(entity.getPassword())); entity.setPassword(FunctionUtils.password(entity.getPassword()));
} }
int result = lsAdminMapper.insert(entity);
if (result == 0) {
boolean result = this.addData(entity);
if (!result) {
return response.failure("添加失败"); return response.failure("添加失败");
} }
return response.success("添加成功"); return response.success("添加成功");
if (entity.getId() == null || entity.getId() <= 0) { if (entity.getId() == null || entity.getId() <= 0) {
return response.failure("用户ID不存在"); return response.failure("用户ID不存在");
} }
entity.setUpdateUser(ShiroUtils.getAdminId());
entity.setUpdateTime(FunctionUtils.getCurrentTime());
// 设置密码并加密 // 设置密码并加密
if (!StringUtils.isEmpty(entity.getPassword())) { if (!StringUtils.isEmpty(entity.getPassword())) {
entity.setPassword(FunctionUtils.password(entity.getPassword())); entity.setPassword(FunctionUtils.password(entity.getPassword()));
} }
int result = lsAdminMapper.updateById(entity);
if (result == 0) {
boolean result = this.editData(entity);
if (!result) {
return response.failure("编辑失败"); return response.failure("编辑失败");
} }
return response.success("编辑成功"); return response.success("编辑成功");
if (entity == null) { if (entity == null) {
return response.failure("用户信息不存在"); return response.failure("用户信息不存在");
} }
entity.setUpdateUser(ShiroUtils.getAdminId());
entity.setUpdateTime(FunctionUtils.getCurrentTime());
entity.setMark(0);
int result = lsAdminMapper.updateById(entity);
if (result == 0) {
boolean result = this.deleteById(id, entity);
if (!result) {
return response.failure("删除失败"); return response.failure("删除失败");
} }
return response.success("删除成功"); return response.success("删除成功");
if (entity.getStatus() == null || entity.getStatus() <= 0) { if (entity.getStatus() == null || entity.getStatus() <= 0) {
return response.failure("用户状态不能为空"); return response.failure("用户状态不能为空");
} }
entity.setUpdateUser(ShiroUtils.getAdminId());
entity.setUpdateTime(FunctionUtils.getCurrentTime());
int result = lsAdminMapper.updateById(entity);
if (result == 0) {
boolean result = this.editData(entity);
if (!result) {
return response.failure("设置失败"); return response.failure("设置失败");
} }
return response.success("设置成功"); return response.success("设置成功");
} }
// 重置密码:123456 // 重置密码:123456
entity.setPassword(FunctionUtils.password("123456")); entity.setPassword(FunctionUtils.password("123456"));
int result = lsAdminMapper.updateById(entity);
if (result == 0) {
boolean result = this.editData(entity);
if (!result) {
return response.failure("重置失败"); return response.failure("重置失败");
} }
return response.success("重置成功"); return response.success("重置成功");
*/ */
@Override @Override
public Map<String, Object> getBaseData() { public Map<String, Object> getBaseData() {
Map<String, Object> map = new HashMap<>(1);
map.put("river_grade_list", CommonConstant.LSADMIN_RIVER_GRADE_LIST);
Map<String, Object> map = new HashMap<>(2);
map.put("level_list", CommonConstant.LSADMIN_LEVEL_LIST);
map.put("area_list", cityService.getCityList(BigInteger.valueOf(Long.valueOf("320117")), true));
return map; return map;
} }
} }

src/main/java/com/taauav/front/service/impl/LsAuthGroupServiceImpl.java → src/main/java/com/taauav/admin/service/impl/LsAuthGroupServiceImpl.java View File

package com.taauav.front.service.impl;
package com.taauav.admin.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.taauav.admin.constant.CommonConstant;
import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.common.util.FunctionUtils;
import com.taauav.common.util.ShiroUtils;
import com.taauav.common.service.impl.BaseServiceImpl;
import com.taauav.common.util.StringUtils; import com.taauav.common.util.StringUtils;
import com.taauav.front.entity.LsAuthGroup;
import com.taauav.front.mapper.LsAuthGroupMapper;
import com.taauav.front.query.LsAuthGroupQuery;
import com.taauav.front.service.ILsAuthGroupService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.taauav.front.vo.LsAuthGroupListVo;
import com.taauav.admin.entity.LsAuthGroup;
import com.taauav.admin.mapper.LsAuthGroupMapper;
import com.taauav.admin.query.LsAuthGroupQuery;
import com.taauav.admin.service.ILsAuthGroupService;
import com.taauav.admin.vo.LsAuthGroupListVo;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
* @since 2020-04-01 * @since 2020-04-01
*/ */
@Service @Service
public class LsAuthGroupServiceImpl extends ServiceImpl<LsAuthGroupMapper, LsAuthGroup> implements ILsAuthGroupService {
public class LsAuthGroupServiceImpl extends BaseServiceImpl<LsAuthGroupMapper, LsAuthGroup> implements ILsAuthGroupService {


@Autowired @Autowired
private LsAuthGroupMapper lsAuthGroupMapper; private LsAuthGroupMapper lsAuthGroupMapper;
*/ */
@Override @Override
public Response add(LsAuthGroup entity) { public Response add(LsAuthGroup entity) {
entity.setCreateUser(ShiroUtils.getAdminId());
entity.setCreateTime(FunctionUtils.getCurrentTime());
int result = lsAuthGroupMapper.insert(entity);
if (result == 0) {
if (entity == null) {
return response.failure("角色信息不存在");
}
boolean result = this.addData(entity);
if (!result) {
return response.failure("添加失败"); return response.failure("添加失败");
} }
return response.success("添加成功"); return response.success("添加成功");
if (entity.getId() == null || entity.getId() <= 0) { if (entity.getId() == null || entity.getId() <= 0) {
return response.failure("角色ID不存在"); return response.failure("角色ID不存在");
} }
entity.setUpdateUser(ShiroUtils.getAdminId());
entity.setUpdateTime(FunctionUtils.getCurrentTime());
int result = lsAuthGroupMapper.updateById(entity);
if (result == 0) {
boolean result = this.editData(entity);
if (!result) {
return response.failure("编辑失败"); return response.failure("编辑失败");
} }
return response.success("编辑成功"); return response.success("编辑成功");
if (entity == null) { if (entity == null) {
return response.failure("角色信息不存在"); return response.failure("角色信息不存在");
} }
entity.setUpdateUser(ShiroUtils.getAdminId());
entity.setUpdateTime(FunctionUtils.getCurrentTime());
entity.setMark(0);
int result = lsAuthGroupMapper.updateById(entity);
if (result == 0) {
boolean result = this.deleteById(id, entity);
if (!result) {
return response.failure("删除失败"); return response.failure("删除失败");
} }
return response.success("删除成功"); return response.success("删除成功");
if (entity.getStatus() == null || entity.getStatus() <= 0) { if (entity.getStatus() == null || entity.getStatus() <= 0) {
return response.failure("角色状态不能为空"); return response.failure("角色状态不能为空");
} }
int result = lsAuthGroupMapper.updateById(entity);
if (result == 0) {
boolean result = this.editData(entity);
if (!result) {
return response.failure("设置失败"); return response.failure("设置失败");
} }
return response.success("设置成功"); return response.success("设置成功");
return response.success(lsAuthGroupList); return response.success(lsAuthGroupList);
} }


/**
* 获取外部角色
*
* @param authGroupIds 角色ID
* @return
*/
@Override
public String getAuthGroupName(String authGroupIds) {
// 查询条件
QueryWrapper<LsAuthGroup> queryWrapper = new QueryWrapper<>();
// 待分配任务
String arr[] = authGroupIds.split(",");
ArrayList arrayList = new ArrayList();
for (String s : arr) {
arrayList.add(s);
}
queryWrapper.in("id", arrayList);
queryWrapper.eq("status", 1);
queryWrapper.eq("mark", 1);
queryWrapper.orderByAsc("sort");

// 查询数据
List<LsAuthGroup> lsAuthGroupList = lsAuthGroupMapper.selectList(queryWrapper);
List<String> stringList = new ArrayList<>();
if (!lsAuthGroupList.isEmpty()) {
lsAuthGroupList.forEach(item -> {
stringList.add(item.getName());
});
}
return org.apache.commons.lang3.StringUtils.join(stringList.toArray(), " ");
}
} }

+ 0
- 3
src/main/java/com/taauav/admin/service/impl/SysCityServiceImpl.java View File



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.taauav.admin.vo.TauvAgencyListVo;
import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.admin.entity.SysAdmin; import com.taauav.admin.entity.SysAdmin;
import com.taauav.admin.entity.SysCity; import com.taauav.admin.entity.SysCity;
import com.taauav.admin.mapper.SysCityMapper; import com.taauav.admin.mapper.SysCityMapper;
import com.taauav.admin.mapper.TauvDriverMapper; import com.taauav.admin.mapper.TauvDriverMapper;
import com.taauav.admin.service.ISysCityService; import com.taauav.admin.service.ISysCityService;
import com.taauav.common.service.impl.BaseServiceImpl;
import com.taauav.common.util.ShiroUtils; import com.taauav.common.util.ShiroUtils;
import com.taauav.common.util.StringUtils; import com.taauav.common.util.StringUtils;
import io.netty.util.internal.StringUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;



+ 0
- 249
src/main/java/com/taauav/admin/service/impl/TauvAgencyServiceImpl.java View File

package com.taauav.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.taauav.admin.entity.TauvAgency;
import com.taauav.admin.mapper.TauvAgencyMapper;
import com.taauav.admin.query.AgencyQuery;
import com.taauav.admin.service.ITauvAgencyService;
import com.taauav.admin.vo.TauvAgencyListVo;
import com.taauav.common.bean.Response;
import com.taauav.common.domain.Entity;
import com.taauav.common.service.impl.BaseServiceImpl;
import com.taauav.common.util.FunctionUtils;
import com.taauav.common.util.ShiroUtils;
import com.taauav.common.util.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
* <p>
* 用户组表 服务实现类
* </p>
*
* @author dyg
* @since 2020-04-01
*/
@Service
public class TauvAgencyServiceImpl extends BaseServiceImpl<TauvAgencyMapper, TauvAgency> implements ITauvAgencyService {

@Autowired
private TauvAgencyMapper tauvAgencyMapper;

@Autowired
private Response response;

/**
* 获取机构列表
*
* @param query 查询条件
* @return
*/
@Override
public Response getList(AgencyQuery query) {
// 查询条件
QueryWrapper<TauvAgency> queryWrapper = new QueryWrapper<>();
// 机构名称
if (!StringUtils.isEmpty(query.getName())) {
queryWrapper.like("name", query.getName());
}
queryWrapper.eq("pid", 0);
queryWrapper.eq("mark", 1);
queryWrapper.orderByAsc("sort");

// 查询条件
IPage<TauvAgency> page = new Page<>(query.getPage(), query.getPageSize());
IPage<TauvAgency> data = tauvAgencyMapper.selectPage(page, queryWrapper);
List<TauvAgency> agencyList = data.getRecords();
List<TauvAgencyListVo> tauvAgencyListVoList = new ArrayList<>();
if (!agencyList.isEmpty()) {
agencyList.forEach(item -> {
TauvAgencyListVo tauvAgencyListVo = new TauvAgencyListVo();
// 拷贝属性
BeanUtils.copyProperties(item, tauvAgencyListVo);
// 获取子级
tauvAgencyListVo.setChildren(this.getChildAgencyList(item.getId()));
tauvAgencyListVoList.add(tauvAgencyListVo);
});
}
return response.success(tauvAgencyListVoList);
}

/**
* 获取子级机构
*
* @param pid 上级ID
* @return
*/
private List<TauvAgencyListVo> getChildAgencyList(Integer pid) {
QueryWrapper<TauvAgency> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("pid", pid);
queryWrapper.eq("mark", 1);
queryWrapper.orderByAsc("sort");

List<TauvAgencyListVo> agencyListVoList = new ArrayList<>();
List<TauvAgency> agencyList = tauvAgencyMapper.selectList(queryWrapper);
if (!agencyList.isEmpty()) {
agencyList.forEach(item -> {
// 菜单列表Vo
TauvAgencyListVo agencyListVo = new TauvAgencyListVo();
// 拷贝属性
BeanUtils.copyProperties(item, agencyListVo);
// 获取子级
List<TauvAgencyListVo> childAgencyList = this.getChildAgencyList(item.getId());
if (childAgencyList != null) {
agencyListVo.setChildren(childAgencyList);
}
agencyListVoList.add(agencyListVo);
});
}
return agencyListVoList;
}

/**
* 添加机构
*
* @param entity 实体对象
* @return
*/
@Override
public Response add(TauvAgency entity) {
if (entity == null) {
return response.failure("实体对象不能为空");
}
if (entity.getPid() == 0) {
entity.setLevel(1);
} else {
TauvAgency agency = tauvAgencyMapper.selectById(entity.getPid());
if (entity != null) {
entity.setLevel(agency.getLevel() + 1);
}
}
boolean result = this.addData(entity);
if (!result) {
return response.failure("添加失败");
}
return response.success("添加成功");
}

/**
* 获取机构详情
*
* @param id 机构ID
* @return
*/
@Override
public Response info(Integer id) {
if (id == null || id <= 0) {
return response.failure("机构ID不存在");
}
TauvAgency entity = this.getInfo(id);
if (entity == null) {
return response.failure("机构信息不存在");
}
return response.success(entity);
}

/**
* 编辑机构
*
* @param entity 实体对象
* @return
*/
@Override
public Response edit(TauvAgency entity) {
if (entity == null || entity.getId() == null) {
return response.failure("实体对象不能为空");
}
boolean result = this.editData(entity);
if (!result) {
return response.failure("编辑失败");
}
return response.success("编辑成功");
}

/**
* 删除机构
*
* @param id 机构ID
* @return
*/
@Override
public Response delete(Integer id) {
if (id == null || id <= 0) {
return response.failure("机构ID不存在");
}
TauvAgency entity = tauvAgencyMapper.selectById(id);
if (entity == null) {
return response.failure("机构信息不存在");
}
boolean result = this.deleteById(id, entity);
if (!result) {
return response.failure("删除失败");
}
return response.success("删除成功");
}

/**
* 设置状态
*
* @param entity 实体对象
* @return
*/
@Override
public Response setStatus(TauvAgency entity) {
if (entity.getId() == null || entity.getId() <= 0) {
return response.failure("设备ID不存在");
}
if (entity.getStatus() == null || entity.getStatus() <= 0) {
return response.failure("状态不存在");
}
int result = tauvAgencyMapper.updateById(entity);
if (result == 0) {
return response.failure("设置失败");
}
return response.success("设置成功");
}

/**
* 获取机构列表
*
* @param pid 上级ID
* @return
*/
@Override
public List<TauvAgencyListVo> getAgencyList(Integer pid) {
// 查询条件
QueryWrapper<TauvAgency> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("pid", pid);
queryWrapper.eq("status", 1);
queryWrapper.eq("mark", 1);
queryWrapper.orderByAsc("sort");

// 查询数据
List<TauvAgency> tauvAgencyList = tauvAgencyMapper.selectList(queryWrapper);
List<TauvAgencyListVo> tauvAgencyListVoList = new ArrayList<>();
if (!tauvAgencyList.isEmpty()) {
tauvAgencyList.forEach(item -> {
TauvAgencyListVo tauvAgencyListVo = new TauvAgencyListVo();
// 拷贝属性
BeanUtils.copyProperties(item, tauvAgencyListVo);
tauvAgencyListVoList.add(tauvAgencyListVo);
// 获取子级机构
List<TauvAgencyListVo> children = getAgencyList(item.getId());
if (!children.isEmpty()) {
children.forEach(subItem -> {
subItem.setName("|--" + subItem.getName());
tauvAgencyListVoList.add(subItem);
});
}
});
}
return tauvAgencyListVoList;
}
}

+ 222
- 0
src/main/java/com/taauav/admin/service/impl/TauvCityServiceImpl.java View File

package com.taauav.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.taauav.admin.entity.SysCity;
import com.taauav.admin.mapper.SysCityMapper;
import com.taauav.admin.service.ITauvCityService;
import com.taauav.admin.vo.TauvCityListVo;
import com.taauav.common.bean.Response;
import com.taauav.common.util.DateUtil;
import com.taauav.common.util.ShiroUtils;
import com.taauav.common.util.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;

/**
* <p>
* 用户组表 服务实现类
* </p>
*
* @author dyg
* @since 2020-04-01
*/
@Service
public class TauvCityServiceImpl extends ServiceImpl<SysCityMapper, SysCity> implements ITauvCityService {

@Autowired
private SysCityMapper sysCityMapper;

@Autowired
private Response response;

/**
* 获取机构列表
*
* @return
*/
@Override
public Response getList() {
// 查询条件
QueryWrapper<SysCity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", BigInteger.valueOf(320117));
queryWrapper.eq("mark", 1);
queryWrapper.orderByAsc("sort");

// 查询条件
List<SysCity> cityList = sysCityMapper.selectList(queryWrapper);
return response.success(cityList);
}

/**
* 获取子级城市列表
*
* @param pid 上级ID
* @return
*/
@Override
public Response getChildCityList(BigInteger pid) {
QueryWrapper<SysCity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("pid", pid);
queryWrapper.eq("mark", 1);
queryWrapper.orderByAsc("sort");
List<SysCity> agencyList = sysCityMapper.selectList(queryWrapper);
return response.success(agencyList);
}

/**
* 添加机构
*
* @param entity 实体对象
* @return
*/
@Override
public Response add(SysCity entity) {
if (entity == null) {
return response.failure("实体对象不能为空");
}
if (entity.getPid() == null) {
entity.setLevel(1);
} else {
SysCity agency = sysCityMapper.selectById(entity.getPid());
if (entity != null) {
entity.setLevel(agency.getLevel() + 1);
}
}
entity.setCreateTime(DateUtil.now());
entity.setCreateUser(ShiroUtils.getAdminId());
int result = sysCityMapper.insert(entity);
if (result == 0) {
return response.failure("添加失败");
}
return response.success("添加成功");
}

/**
* 获取机构详情
*
* @param id 机构ID
* @return
*/
@Override
public Response info(BigInteger id) {
if (id == null) {
return response.failure("机构ID不存在");
}
SysCity entity = this.getById(id);
if (entity == null) {
return response.failure("机构信息不存在");
}
return response.success(entity);
}

/**
* 编辑机构
*
* @param entity 实体对象
* @return
*/
@Override
public Response edit(SysCity entity) {
if (entity == null || entity.getId() == null) {
return response.failure("实体对象不能为空");
}
entity.setUpdateUser(ShiroUtils.getAdminId());
entity.setUpdateTime(DateUtil.now());
boolean result = this.updateById(entity);
if (!result) {
return response.failure("编辑失败");
}
return response.success("编辑成功");
}

/**
* 删除机构
*
* @param id 机构ID
* @return
*/
@Override
public Response delete(BigInteger id) {
if (id == null) {
return response.failure("机构ID不存在");
}
SysCity entity = sysCityMapper.selectById(id);
if (entity == null) {
return response.failure("机构信息不存在");
}
entity.setUpdateUser(ShiroUtils.getAdminId());
entity.setUpdateTime(DateUtil.now());
entity.setMark(0);
boolean result = this.updateById(entity);
if (!result) {
return response.failure("删除失败");
}
return response.success("删除成功");
}

/**
* 设置状态
*
* @param entity 实体对象
* @return
*/
@Override
public Response setStatus(SysCity entity) {
if (entity.getId() == null) {
return response.failure("设备ID不存在");
}
if (entity.getStatus() == null || entity.getStatus() <= 0) {
return response.failure("状态不存在");
}
int result = sysCityMapper.updateById(entity);
if (result == 0) {
return response.failure("设置失败");
}
return response.success("设置成功");
}

// /**
// * 获取机构列表
// *
// * @param pid 上级ID
// * @return
// */
// @Override
// public List<TauvAgencyListVo> getAgencyList(BigInteger pid) {
// // 查询条件
// QueryWrapper<SysCity> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("pid", pid);
// queryWrapper.eq("status", 1);
// queryWrapper.eq("mark", 1);
// queryWrapper.orderByAsc("sort");
//
// // 查询数据
// List<SysCity> tauvAgencyList = sysCityMapper.selectList(queryWrapper);
// List<TauvAgencyListVo> tauvAgencyListVoList = new ArrayList<>();
// if (!tauvAgencyList.isEmpty()) {
// tauvAgencyList.forEach(item -> {
// TauvAgencyListVo tauvAgencyListVo = new TauvAgencyListVo();
// // 拷贝属性
// BeanUtils.copyProperties(item, tauvAgencyListVo);
// tauvAgencyListVoList.add(tauvAgencyListVo);
// // 获取子级机构
// List<TauvAgencyListVo> children = getAgencyList(item.getId());
// if (!children.isEmpty()) {
// children.forEach(subItem -> {
// subItem.setName("|--" + subItem.getName());
// tauvAgencyListVoList.add(subItem);
// });
// }
// });
// }
// return tauvAgencyListVoList;
// }
}

src/main/java/com/taauav/front/vo/LsAdminListVo.java → src/main/java/com/taauav/admin/vo/LsAdminListVo.java View File

package com.taauav.front.vo;
package com.taauav.admin.vo;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;


import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigInteger;
import java.util.Date;


/** /**
* 用户列表Vo
* 外部人员列表Vo
*/ */
@Data @Data
public class LsAdminListVo { public class LsAdminListVo {


/** /**
* ID
* 人员ID
*/ */
@TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;


/** /**
* 姓名 * 姓名
*/ */
@NotBlank(message = "姓名不能为空")
@Length(min = 2, max = 20, message = "姓名长度为2-20")
private String realname; private String realname;


/** /**
/** /**
* 河长等级 * 河长等级
*/ */
private String riverGrade;
private Integer level;

/**
* 河长等级描述
*/
private String levelName;

/**
* 区划ID
*/
private BigInteger driverArea;

/**
* 区划描述
*/
private String driverAreaName;


/** /**
* 职务 * 职务
/** /**
* 角色编号 * 角色编号
*/ */
@NotBlank(message = "角色编号不能为空")
private String authGroup; private String authGroup;


/** /**
*/ */
private String note; private String note;


/**
* 状态:1正常 2关闭 3未审核
*/
private Integer status;

/** /**
* 登录次数 * 登录次数
*/ */
/** /**
* 上次登录时间 * 上次登录时间
*/ */
private Integer lastTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastTime;

/**
* 状态:1正常 2禁用
*/
private Integer status;


/** /**
* 排序 * 排序
/** /**
* 创建时间 * 创建时间
*/ */
private Integer createTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;


/** /**
* 更新时间 * 更新时间
*/ */
private Integer updateTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;


} }

src/main/java/com/taauav/front/vo/LsAuthGroupListVo.java → src/main/java/com/taauav/admin/vo/LsAuthGroupListVo.java View File

package com.taauav.front.vo;
package com.taauav.admin.vo;


import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;


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


/** /**
* *
/** /**
* ID * ID
*/ */
@TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;


/** /**
* 用户组中文名称 * 用户组中文名称
*/ */
@NotBlank(message = "角色名称不能为空")
@Length(min = 2, max = 20, message = "角色名称长度为2-20")
private String name; private String name;


/** /**
* 数据权限:1查看自己区划数据 2查看所有区划数据 3查看指定区划数据 * 数据权限:1查看自己区划数据 2查看所有区划数据 3查看指定区划数据
*/ */
@NotNull(message = "请选择数据权限")
private Integer authData; private Integer authData;


/** /**
/** /**
* 状态:1正常 2禁用 * 状态:1正常 2禁用
*/ */
@NotNull(message = "状态不能为空")
private Integer status; private Integer status;


/** /**
/** /**
* 创建时间 * 创建时间
*/ */
private Integer createTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;


/** /**
* 更新时间 * 更新时间
*/ */
private Integer updateTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;


} }

src/main/java/com/taauav/admin/vo/TauvAgencyListVo.java → src/main/java/com/taauav/admin/vo/TauvCityListVo.java View File



import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.taauav.admin.entity.TauvAgency;
import lombok.Data; import lombok.Data;


import java.util.ArrayList; import java.util.ArrayList;
* 机构列表Vo * 机构列表Vo
*/ */
@Data @Data
public class TauvAgencyListVo {
public class TauvCityListVo {


/** /**
* ID * ID
/** /**
* 获取子级机构 * 获取子级机构
*/ */
List<TauvAgencyListVo> children = new ArrayList<>();
List<TauvCityListVo> children = new ArrayList<>();


} }

+ 0
- 82
src/main/java/com/taauav/front/entity/LsAuthGroup.java View File

package com.taauav.front.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
* <p>
* 外部用户角色表
* </p>
*
* @author dyg
* @since 2020-04-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class LsAuthGroup implements Serializable {

private static final long serialVersionUID = 1L;

/**
* ID
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;

/**
* 用户组中文名称
*/
private String name;

/**
* 数据权限:1查看自己区划数据 2查看所有区划数据 3查看指定区划数据
*/
private Integer authData;

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

/**
* 状态:1正常 2禁用
*/
private Integer status;

/**
* 排序
*/
private Integer sort;

/**
* 创建人
*/
private Integer createUser;

/**
* 更新人
*/
private Integer updateUser;

/**
* 创建时间
*/
private Integer createTime;

/**
* 更新时间
*/
private Integer updateTime;

/**
* 有效标记
*/
private Integer mark;


}

+ 0
- 5
src/main/java/com/taauav/front/service/ILsLoginService.java View File

package com.taauav.front.service; package com.taauav.front.service;


import com.baomidou.mybatisplus.extension.service.IService;
import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.front.dto.LoginDto; import com.taauav.front.dto.LoginDto;
import com.taauav.front.entity.LsAdmin;
import com.taauav.front.query.LsAdminQuery;

import java.util.Map;


/** /**
* <p> * <p>

+ 2
- 13
src/main/java/com/taauav/front/service/impl/LsLoginServiceImpl.java View File

package com.taauav.front.service.impl; package com.taauav.front.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.taauav.admin.constant.CommonConstant;
import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.common.util.FunctionUtils; import com.taauav.common.util.FunctionUtils;
import com.taauav.common.util.JwtUtil; import com.taauav.common.util.JwtUtil;
import com.taauav.common.util.ShiroUtils;
import com.taauav.common.util.StringUtils; import com.taauav.common.util.StringUtils;
import com.taauav.front.dto.LoginDto; import com.taauav.front.dto.LoginDto;
import com.taauav.front.entity.LsAdmin;
import com.taauav.front.mapper.LsAdminMapper;
import com.taauav.front.query.LsAdminQuery;
import com.taauav.front.service.ILsAdminService;
import com.taauav.admin.entity.LsAdmin;
import com.taauav.admin.mapper.LsAdminMapper;
import com.taauav.front.service.ILsLoginService; import com.taauav.front.service.ILsLoginService;
import com.taauav.front.vo.LsAdminListVo;
import io.jsonwebtoken.Claims;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;


/** /**

Loading…
Cancel
Save