@@ -31,7 +31,7 @@ public class CommonConstant { | |||
/** | |||
* 河长等级 | |||
*/ | |||
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(2, "河长等级2"); |
@@ -1,13 +1,11 @@ | |||
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.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.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.validation.BindingResult; | |||
@@ -24,7 +22,7 @@ import javax.validation.Valid; | |||
* @since 2020-04-01 | |||
*/ | |||
@RestController | |||
@RequestMapping("/front/lsadmin") | |||
@RequestMapping("/lsadmin") | |||
public class LsAdminController extends BaseController { | |||
@Autowired |
@@ -1,12 +1,11 @@ | |||
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.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.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.validation.BindingResult; | |||
@@ -21,7 +20,7 @@ import org.springframework.web.bind.annotation.*; | |||
* @since 2020-04-01 | |||
*/ | |||
@RestController | |||
@RequestMapping("/front/lsauthgroup") | |||
@RequestMapping("/lsauthgroup") | |||
public class LsAuthGroupController extends BaseController { | |||
@Autowired |
@@ -1,10 +1,8 @@ | |||
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.constant.PermissionConstants; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
@@ -13,7 +11,7 @@ import org.springframework.validation.BindingResult; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
import java.util.List; | |||
import java.math.BigInteger; | |||
/** | |||
* <p> | |||
@@ -25,10 +23,10 @@ import java.util.List; | |||
*/ | |||
@RestController | |||
@RequestMapping("/agency") | |||
public class TauvAgencyController { | |||
public class TauvCityController { | |||
@Autowired | |||
private ITauvAgencyService tauvAgencyService; | |||
private ITauvCityService tauvAgencyService; | |||
@Autowired | |||
private Response response; | |||
@@ -38,13 +36,12 @@ public class TauvAgencyController { | |||
/** | |||
* 获取机构列表 | |||
* | |||
* @param query 查询条件 | |||
* @return | |||
*/ | |||
@PostMapping("/index") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) | |||
public Response index(@RequestBody(required = false) AgencyQuery query) { | |||
return tauvAgencyService.getList(query); | |||
public Response index() { | |||
return tauvAgencyService.getList(); | |||
} | |||
/** | |||
@@ -56,7 +53,7 @@ public class TauvAgencyController { | |||
*/ | |||
@PostMapping("/add") | |||
@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()) { | |||
String message = bindingResult.getFieldError().getDefaultMessage(); | |||
return response.failure(message); | |||
@@ -72,7 +69,7 @@ public class TauvAgencyController { | |||
*/ | |||
@GetMapping("/info") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response info(Integer id) { | |||
public Response info(BigInteger id) { | |||
return tauvAgencyService.info(id); | |||
} | |||
@@ -85,7 +82,7 @@ public class TauvAgencyController { | |||
*/ | |||
@PostMapping("/edit") | |||
@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()) { | |||
String message = bindingResult.getFieldError().getDefaultMessage(); | |||
return response.failure(message); | |||
@@ -101,7 +98,7 @@ public class TauvAgencyController { | |||
*/ | |||
@PostMapping("/drop") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION) | |||
public Response delete(Integer id) { | |||
public Response delete(BigInteger id) { | |||
return tauvAgencyService.delete(id); | |||
} | |||
@@ -113,20 +110,19 @@ public class TauvAgencyController { | |||
*/ | |||
@PostMapping("/setStatus") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION) | |||
public Response setStatus(@RequestBody TauvAgency entity) { | |||
public Response setStatus(@RequestBody SysCity entity) { | |||
return tauvAgencyService.setStatus(entity); | |||
} | |||
/** | |||
* 获取机构列表 | |||
* 获取子级城市列表 | |||
* | |||
* @param pid 上级ID | |||
* @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); | |||
} | |||
} |
@@ -1,17 +1,17 @@ | |||
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.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.hibernate.validator.constraints.Length; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* <p> | |||
@@ -24,16 +24,10 @@ import javax.validation.constraints.NotNull; | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
public class LsAdmin implements Serializable { | |||
public class LsAdmin extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* ID | |||
*/ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private Integer id; | |||
/** | |||
* 姓名 | |||
*/ | |||
@@ -74,7 +68,12 @@ public class LsAdmin implements Serializable { | |||
/** | |||
* 河长等级 | |||
*/ | |||
private String riverGrade; | |||
private Integer level; | |||
/** | |||
* 区划ID | |||
*/ | |||
private BigInteger driverArea; | |||
/** | |||
* 职务 | |||
@@ -97,11 +96,6 @@ public class LsAdmin implements Serializable { | |||
*/ | |||
private String note; | |||
/** | |||
* 状态:1正常 2关闭 3未审核 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 登录次数 | |||
*/ | |||
@@ -115,37 +109,13 @@ public class LsAdmin implements Serializable { | |||
/** | |||
* 上次登录时间 | |||
*/ | |||
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 createUser; | |||
/** | |||
* 更新人 | |||
*/ | |||
private Integer updateUser; | |||
/** | |||
* 创建时间 | |||
*/ | |||
private Integer createTime; | |||
/** | |||
* 更新时间 | |||
*/ | |||
private Integer updateTime; | |||
/** | |||
* 有效标记 | |||
*/ | |||
private Integer mark; | |||
} |
@@ -1,10 +1,5 @@ | |||
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 lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
@@ -12,7 +7,7 @@ import lombok.experimental.Accessors; | |||
/** | |||
* <p> | |||
* 用户组表 | |||
* 外部用户角色表 | |||
* </p> | |||
* | |||
* @author dyg | |||
@@ -21,14 +16,10 @@ import lombok.experimental.Accessors; | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
public class TauvAgency extends Entity { | |||
public class LsAuthGroup extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 父级ID | |||
*/ | |||
private Integer pid; | |||
/** | |||
* 用户组中文名称 | |||
@@ -36,14 +27,9 @@ public class TauvAgency extends Entity { | |||
private String name; | |||
/** | |||
* 有无子级:1有 2无 | |||
*/ | |||
private Integer hasChild; | |||
/** | |||
* 层级 | |||
* 数据权限:1查看自己区划数据 2查看所有区划数据 3查看指定区划数据 | |||
*/ | |||
private Integer level; | |||
private Integer authData; | |||
/** | |||
* 备注 |
@@ -11,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.hibernate.validator.constraints.Length; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
/** | |||
@@ -78,7 +79,7 @@ public class SysCity implements Serializable { | |||
/** | |||
* 有无子级:1有 2无 | |||
*/ | |||
private Boolean hasChild; | |||
private Integer hasChild; | |||
/** | |||
* 显示顺序 | |||
@@ -90,6 +91,12 @@ public class SysCity implements Serializable { | |||
*/ | |||
private Integer status; | |||
/** | |||
* 备注 | |||
*/ | |||
@Length(max = 255, message = "备注最大长度为255") | |||
private String note; | |||
/** | |||
* 创建人 | |||
*/ |
@@ -1,6 +1,6 @@ | |||
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; | |||
/** |
@@ -1,5 +1,5 @@ | |||
<?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.front.mapper.LsAdminMapper"> | |||
<mapper namespace="com.taauav.admin.mapper.LsAdminMapper"> | |||
</mapper> |
@@ -1,6 +1,6 @@ | |||
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; | |||
/** |
@@ -1,5 +1,5 @@ | |||
<?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.front.mapper.LsAuthGroupMapper"> | |||
<mapper namespace="com.taauav.admin.mapper.LsAuthGroupMapper"> | |||
</mapper> |
@@ -1,16 +0,0 @@ | |||
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> { | |||
} |
@@ -1,5 +0,0 @@ | |||
<?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> |
@@ -1,17 +0,0 @@ | |||
package com.taauav.admin.query; | |||
import com.taauav.common.core.mps.BaseQuery; | |||
import lombok.Data; | |||
/** | |||
* 机构查询条件 | |||
*/ | |||
@Data | |||
public class AgencyQuery extends BaseQuery { | |||
/** | |||
* 机构名称 | |||
*/ | |||
private String name; | |||
} |
@@ -1,4 +1,4 @@ | |||
package com.taauav.front.query; | |||
package com.taauav.admin.query; | |||
import com.taauav.common.core.mps.BaseQuery; | |||
import lombok.Data; |
@@ -1,4 +1,4 @@ | |||
package com.taauav.front.query; | |||
package com.taauav.admin.query; | |||
import com.taauav.common.core.mps.BaseQuery; | |||
import lombok.Data; |
@@ -1,9 +1,10 @@ | |||
package com.taauav.front.service; | |||
package com.taauav.admin.service; | |||
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.taauav.front.query.LsAdminQuery; | |||
import com.taauav.admin.query.LsAdminQuery; | |||
import com.taauav.common.service.IBaseService; | |||
import java.util.Map; | |||
@@ -15,7 +16,7 @@ import java.util.Map; | |||
* @author dyg | |||
* @since 2020-04-01 | |||
*/ | |||
public interface ILsAdminService extends IService<LsAdmin> { | |||
public interface ILsAdminService extends IBaseService<LsAdmin> { | |||
/** | |||
* 获取用户列表 |
@@ -1,9 +1,11 @@ | |||
package com.taauav.front.service; | |||
package com.taauav.admin.service; | |||
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> | |||
@@ -13,7 +15,7 @@ import com.taauav.front.query.LsAuthGroupQuery; | |||
* @author dyg | |||
* @since 2020-04-01 | |||
*/ | |||
public interface ILsAuthGroupService extends IService<LsAuthGroup> { | |||
public interface ILsAuthGroupService extends IBaseService<LsAuthGroup> { | |||
/** | |||
* 获取角色列表 | |||
@@ -70,4 +72,12 @@ public interface ILsAuthGroupService extends IService<LsAuthGroup> { | |||
*/ | |||
Response getAuthGroupList(); | |||
/** | |||
* 获取外部角色 | |||
* | |||
* @param authGroupIds | |||
* @return | |||
*/ | |||
String getAuthGroupName(String authGroupIds); | |||
} |
@@ -1,12 +1,10 @@ | |||
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.service.IBaseService; | |||
import java.util.List; | |||
import java.math.BigInteger; | |||
/** | |||
* <p> | |||
@@ -16,15 +14,14 @@ import java.util.List; | |||
* @author dyg | |||
* @since 2020-04-01 | |||
*/ | |||
public interface ITauvAgencyService extends IBaseService<TauvAgency> { | |||
public interface ITauvCityService extends IService<SysCity> { | |||
/** | |||
* 获取机构列表 | |||
* | |||
* @param query 查询条件 | |||
* @return | |||
*/ | |||
Response getList(AgencyQuery query); | |||
Response getList(); | |||
/** | |||
* 添加机构 | |||
@@ -32,7 +29,7 @@ public interface ITauvAgencyService extends IBaseService<TauvAgency> { | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
Response add(TauvAgency entity); | |||
Response add(SysCity entity); | |||
/** | |||
* 获取机构详情 | |||
@@ -40,7 +37,7 @@ public interface ITauvAgencyService extends IBaseService<TauvAgency> { | |||
* @param id 机构ID | |||
* @return | |||
*/ | |||
Response info(Integer id); | |||
Response info(BigInteger id); | |||
/** | |||
* 编辑机构 | |||
@@ -48,7 +45,7 @@ public interface ITauvAgencyService extends IBaseService<TauvAgency> { | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
Response edit(TauvAgency entity); | |||
Response edit(SysCity entity); | |||
/** | |||
* 删除机构 | |||
@@ -56,7 +53,7 @@ public interface ITauvAgencyService extends IBaseService<TauvAgency> { | |||
* @param id 机构ID | |||
* @return | |||
*/ | |||
Response delete(Integer id); | |||
Response delete(BigInteger id); | |||
/** | |||
* 设置状态 | |||
@@ -64,14 +61,22 @@ public interface ITauvAgencyService extends IBaseService<TauvAgency> { | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
Response setStatus(TauvAgency entity); | |||
Response setStatus(SysCity entity); | |||
/** | |||
* 获取机构列表 | |||
* 获取子级城市 | |||
* | |||
* @param pid 上级ID | |||
* @return | |||
*/ | |||
List<TauvAgencyListVo> getAgencyList(Integer pid); | |||
Response getChildCityList(BigInteger pid); | |||
// /** | |||
// * 获取机构列表 | |||
// * | |||
// * @param pid 上级ID | |||
// * @return | |||
// */ | |||
// List<TauvAgencyListVo> getAgencyList(BigInteger pid); | |||
} |
@@ -1,23 +1,25 @@ | |||
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.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
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.service.impl.BaseServiceImpl; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.common.util.ShiroUtils; | |||
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.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.math.BigInteger; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
@@ -32,7 +34,7 @@ import java.util.Map; | |||
* @since 2020-04-01 | |||
*/ | |||
@Service | |||
public class LsAdminServiceImpl extends ServiceImpl<LsAdminMapper, LsAdmin> implements ILsAdminService { | |||
public class LsAdminServiceImpl extends BaseServiceImpl<LsAdminMapper, LsAdmin> implements ILsAdminService { | |||
@Autowired | |||
private LsAdminMapper lsAdminMapper; | |||
@@ -40,6 +42,12 @@ public class LsAdminServiceImpl extends ServiceImpl<LsAdminMapper, LsAdmin> impl | |||
@Autowired | |||
private Response response; | |||
@Autowired | |||
private ISysCityService cityService; | |||
@Autowired | |||
private ILsAuthGroupService authGroupService; | |||
/** | |||
* 获取数据列表 | |||
* | |||
@@ -67,6 +75,12 @@ public class LsAdminServiceImpl extends ServiceImpl<LsAdminMapper, LsAdmin> impl | |||
LsAdminListVo lsAdminListVo = new 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); | |||
}); | |||
} | |||
@@ -88,16 +102,14 @@ public class LsAdminServiceImpl extends ServiceImpl<LsAdminMapper, LsAdmin> impl | |||
*/ | |||
@Override | |||
public Response add(LsAdmin entity) { | |||
entity.setCreateUser(ShiroUtils.getAdminId()); | |||
entity.setCreateTime(FunctionUtils.getCurrentTime()); | |||
if (StringUtils.isEmpty(entity.getPassword())) { | |||
// 初始密码:123456 | |||
entity.setPassword(FunctionUtils.password("123456")); | |||
} else { | |||
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.success("添加成功"); | |||
@@ -132,14 +144,12 @@ public class LsAdminServiceImpl extends ServiceImpl<LsAdminMapper, LsAdmin> impl | |||
if (entity.getId() == null || entity.getId() <= 0) { | |||
return response.failure("用户ID不存在"); | |||
} | |||
entity.setUpdateUser(ShiroUtils.getAdminId()); | |||
entity.setUpdateTime(FunctionUtils.getCurrentTime()); | |||
// 设置密码并加密 | |||
if (!StringUtils.isEmpty(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.success("编辑成功"); | |||
@@ -160,11 +170,8 @@ public class LsAdminServiceImpl extends ServiceImpl<LsAdminMapper, LsAdmin> impl | |||
if (entity == null) { | |||
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.success("删除成功"); | |||
@@ -184,10 +191,8 @@ public class LsAdminServiceImpl extends ServiceImpl<LsAdminMapper, LsAdmin> impl | |||
if (entity.getStatus() == null || entity.getStatus() <= 0) { | |||
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.success("设置成功"); | |||
@@ -206,8 +211,8 @@ public class LsAdminServiceImpl extends ServiceImpl<LsAdminMapper, LsAdmin> impl | |||
} | |||
// 重置密码: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.success("重置成功"); | |||
@@ -220,8 +225,9 @@ public class LsAdminServiceImpl extends ServiceImpl<LsAdminMapper, LsAdmin> impl | |||
*/ | |||
@Override | |||
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; | |||
} | |||
} |
@@ -1,19 +1,16 @@ | |||
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.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.taauav.admin.constant.CommonConstant; | |||
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.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.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@@ -32,7 +29,7 @@ import java.util.Map; | |||
* @since 2020-04-01 | |||
*/ | |||
@Service | |||
public class LsAuthGroupServiceImpl extends ServiceImpl<LsAuthGroupMapper, LsAuthGroup> implements ILsAuthGroupService { | |||
public class LsAuthGroupServiceImpl extends BaseServiceImpl<LsAuthGroupMapper, LsAuthGroup> implements ILsAuthGroupService { | |||
@Autowired | |||
private LsAuthGroupMapper lsAuthGroupMapper; | |||
@@ -88,10 +85,11 @@ public class LsAuthGroupServiceImpl extends ServiceImpl<LsAuthGroupMapper, LsAut | |||
*/ | |||
@Override | |||
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.success("添加成功"); | |||
@@ -123,10 +121,8 @@ public class LsAuthGroupServiceImpl extends ServiceImpl<LsAuthGroupMapper, LsAut | |||
if (entity.getId() == null || entity.getId() <= 0) { | |||
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.success("编辑成功"); | |||
@@ -147,11 +143,8 @@ public class LsAuthGroupServiceImpl extends ServiceImpl<LsAuthGroupMapper, LsAut | |||
if (entity == null) { | |||
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.success("删除成功"); | |||
@@ -171,8 +164,8 @@ public class LsAuthGroupServiceImpl extends ServiceImpl<LsAuthGroupMapper, LsAut | |||
if (entity.getStatus() == null || entity.getStatus() <= 0) { | |||
return response.failure("角色状态不能为空"); | |||
} | |||
int result = lsAuthGroupMapper.updateById(entity); | |||
if (result == 0) { | |||
boolean result = this.editData(entity); | |||
if (!result) { | |||
return response.failure("设置失败"); | |||
} | |||
return response.success("设置成功"); | |||
@@ -196,4 +189,35 @@ public class LsAuthGroupServiceImpl extends ServiceImpl<LsAuthGroupMapper, LsAut | |||
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(), " "); | |||
} | |||
} |
@@ -2,7 +2,6 @@ package com.taauav.admin.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.taauav.admin.vo.TauvAgencyListVo; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysAdmin; | |||
import com.taauav.admin.entity.SysCity; | |||
@@ -10,10 +9,8 @@ import com.taauav.admin.mapper.SysAdminMapper; | |||
import com.taauav.admin.mapper.SysCityMapper; | |||
import com.taauav.admin.mapper.TauvDriverMapper; | |||
import com.taauav.admin.service.ISysCityService; | |||
import com.taauav.common.service.impl.BaseServiceImpl; | |||
import com.taauav.common.util.ShiroUtils; | |||
import com.taauav.common.util.StringUtils; | |||
import io.netty.util.internal.StringUtil; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@@ -1,249 +0,0 @@ | |||
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; | |||
} | |||
} |
@@ -0,0 +1,222 @@ | |||
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; | |||
// } | |||
} |
@@ -1,30 +1,26 @@ | |||
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 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 | |||
public class LsAdminListVo { | |||
/** | |||
* ID | |||
* 人员ID | |||
*/ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private Integer id; | |||
/** | |||
* 姓名 | |||
*/ | |||
@NotBlank(message = "姓名不能为空") | |||
@Length(min = 2, max = 20, message = "姓名长度为2-20") | |||
private String realname; | |||
/** | |||
@@ -60,7 +56,22 @@ public class LsAdminListVo { | |||
/** | |||
* 河长等级 | |||
*/ | |||
private String riverGrade; | |||
private Integer level; | |||
/** | |||
* 河长等级描述 | |||
*/ | |||
private String levelName; | |||
/** | |||
* 区划ID | |||
*/ | |||
private BigInteger driverArea; | |||
/** | |||
* 区划描述 | |||
*/ | |||
private String driverAreaName; | |||
/** | |||
* 职务 | |||
@@ -70,7 +81,6 @@ public class LsAdminListVo { | |||
/** | |||
* 角色编号 | |||
*/ | |||
@NotBlank(message = "角色编号不能为空") | |||
private String authGroup; | |||
/** | |||
@@ -88,11 +98,6 @@ public class LsAdminListVo { | |||
*/ | |||
private String note; | |||
/** | |||
* 状态:1正常 2关闭 3未审核 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 登录次数 | |||
*/ | |||
@@ -106,7 +111,14 @@ public class LsAdminListVo { | |||
/** | |||
* 上次登录时间 | |||
*/ | |||
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; | |||
/** | |||
* 排序 | |||
@@ -126,11 +138,15 @@ public class LsAdminListVo { | |||
/** | |||
* 创建时间 | |||
*/ | |||
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; | |||
} |
@@ -1,12 +1,15 @@ | |||
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 org.hibernate.validator.constraints.Length; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
import java.util.Date; | |||
/** | |||
* | |||
@@ -17,20 +20,16 @@ public class LsAuthGroupListVo { | |||
/** | |||
* ID | |||
*/ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private Integer id; | |||
/** | |||
* 用户组中文名称 | |||
*/ | |||
@NotBlank(message = "角色名称不能为空") | |||
@Length(min = 2, max = 20, message = "角色名称长度为2-20") | |||
private String name; | |||
/** | |||
* 数据权限:1查看自己区划数据 2查看所有区划数据 3查看指定区划数据 | |||
*/ | |||
@NotNull(message = "请选择数据权限") | |||
private Integer authData; | |||
/** | |||
@@ -41,7 +40,6 @@ public class LsAuthGroupListVo { | |||
/** | |||
* 状态:1正常 2禁用 | |||
*/ | |||
@NotNull(message = "状态不能为空") | |||
private Integer status; | |||
/** | |||
@@ -62,11 +60,15 @@ public class LsAuthGroupListVo { | |||
/** | |||
* 创建时间 | |||
*/ | |||
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; | |||
} |
@@ -2,7 +2,6 @@ package com.taauav.admin.vo; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.taauav.admin.entity.TauvAgency; | |||
import lombok.Data; | |||
import java.util.ArrayList; | |||
@@ -12,7 +11,7 @@ import java.util.List; | |||
* 机构列表Vo | |||
*/ | |||
@Data | |||
public class TauvAgencyListVo { | |||
public class TauvCityListVo { | |||
/** | |||
* ID | |||
@@ -78,6 +77,6 @@ public class TauvAgencyListVo { | |||
/** | |||
* 获取子级机构 | |||
*/ | |||
List<TauvAgencyListVo> children = new ArrayList<>(); | |||
List<TauvCityListVo> children = new ArrayList<>(); | |||
} |
@@ -1,82 +0,0 @@ | |||
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; | |||
} |
@@ -1,12 +1,7 @@ | |||
package com.taauav.front.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.front.dto.LoginDto; | |||
import com.taauav.front.entity.LsAdmin; | |||
import com.taauav.front.query.LsAdminQuery; | |||
import java.util.Map; | |||
/** | |||
* <p> |
@@ -1,30 +1,19 @@ | |||
package com.taauav.front.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.constant.CommonConstant; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.common.util.JwtUtil; | |||
import com.taauav.common.util.ShiroUtils; | |||
import com.taauav.common.util.StringUtils; | |||
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.vo.LsAdminListVo; | |||
import io.jsonwebtoken.Claims; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** |