This commit is contained in:
13405411873 2023-10-19 17:32:43 +08:00
parent c3aeb3eec4
commit 4e88af4a80
17 changed files with 62 additions and 149 deletions

View File

@ -289,18 +289,8 @@ public class BackendStoreController extends BaseController {
@ApiOperation(value = "获取店铺详情") @ApiOperation(value = "获取店铺详情")
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET) @RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
@CrossOrigin @CrossOrigin
public ResponseObject getStoreInfo(HttpServletRequest request, @PathVariable("id") Integer id) throws BusinessCheckException { public ResponseObject getStoreInfo( @PathVariable("id") Integer id) throws BusinessCheckException {
String token = request.getHeader("Access-Token");
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
if (accountInfo == null) {
return getFailureResult(1001, "请先登录");
}
StoreDto storeInfo = storeService.queryStoreDtoById(id); StoreDto storeInfo = storeService.queryStoreDtoById(id);
return getSuccessResult(storeInfo);
Map<String, Object> result = new HashMap<>();
result.put("storeInfo", storeInfo);
return getSuccessResult(result);
} }
} }

View File

@ -11,7 +11,7 @@ public enum StatusEnum {
ENABLED("A", "启用"), ENABLED("A", "启用"),
EXPIRED("C", "过期"), EXPIRED("C", "过期"),
DISABLE("D", "删除"), DISABLE("D", "删除"),
FORBIDDEN("N", "禁用"), FORBIDDEN("jy", "禁用"),
UnAudited("U", "待审核"); UnAudited("U", "待审核");
private String key; private String key;

View File

@ -9,7 +9,7 @@ import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.framework.pagination.PaginationRequest; import com.fuint.framework.pagination.PaginationRequest;
import com.fuint.framework.pagination.PaginationResponse; import com.fuint.framework.pagination.PaginationResponse;
import com.fuint.repository.model.TAccount; import com.fuint.repository.model.TAccount;
import com.fuint.repository.model.TDuty; import com.fuint.system.role.entity.TDuty;
import java.util.List; import java.util.List;
/** /**

View File

@ -20,6 +20,8 @@ import com.fuint.repository.mapper.*;
import com.fuint.repository.model.*; import com.fuint.repository.model.*;
import com.fuint.system.dept.entity.SysDept; import com.fuint.system.dept.entity.SysDept;
import com.fuint.system.dept.service.ISysDeptService; import com.fuint.system.dept.service.ISysDeptService;
import com.fuint.system.role.entity.TDuty;
import com.fuint.system.role.mapper.TDutyMapper;
import com.fuint.utils.Digests; import com.fuint.utils.Digests;
import com.fuint.utils.Encodes; import com.fuint.utils.Encodes;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;

View File

@ -14,8 +14,9 @@ import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject; import com.fuint.framework.web.ResponseObject;
import com.fuint.module.backendApi.response.LoginResponse; import com.fuint.module.backendApi.response.LoginResponse;
import com.fuint.repository.model.TAccount; import com.fuint.repository.model.TAccount;
import com.fuint.repository.model.TDuty; import com.fuint.system.role.entity.TDuty;
import com.fuint.repository.model.TSource; import com.fuint.repository.model.TSource;
import com.fuint.system.role.service.DutyService;
import com.fuint.utils.StringUtil; import com.fuint.utils.StringUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;

View File

@ -2,95 +2,8 @@
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.system.dept.mapper.SysDeptMapper"> <mapper namespace="com.fuint.system.config.mapper.SysConfigMapper">
<select id="selectDeptList" resultType="com.fuint.system.dept.entity.SysDept">
select *
from sys_dept d
where 1=1
<if test="dept.deptId != null and dept.deptId != 0">
AND dept_id = #{dept.deptId}
</if>
<if test="dept.parentId != null and dept.parentId != 0">
AND parent_id = #{dept.parentId}
</if>
<if test="dept.deptName != null and dept.deptName != ''">
AND dept_name like concat('%', #{dept.deptName}, '%')
</if>
<if test="dept.status != null and dept.status != ''">
AND status = #{dept.status}
</if>
<!-- 数据范围过滤 -->
<if test="ownDeptStr != null and ownDeptStr!=''">
AND ancestors like concat (#{ownDeptStr},'%')
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id
from sys_dept d
left join sys_role_dept rd on d.dept_id = rd.dept_id
where rd.role_id = #{roleId}
<if test="deptCheckStrictly">
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptById" parameterType="Long" resultType="com.fuint.system.dept.entity.SysDept">
select d.*,
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
from sys_dept d
where d.dept_id = #{deptId}
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from t_account where dept_id = #{deptId}
</select>
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from sys_dept
where parent_id = #{deptId} limit 1
</select>
<select id="selectChildrenDeptById" resultType="com.fuint.system.dept.entity.SysDept">
select * from sys_dept where find_in_set(#{deptId}, ancestors)
</select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_dept where status = 0 and find_in_set(#{deptId}, ancestors)
</select>
<select id="checkDeptNameUnique" resultType="com.fuint.system.dept.entity.SysDept">
select *
from sys_dept
where dept_name=#{deptName} and parent_id = #{parentId} limit 1
</select>
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors}
</foreach>
where dept_id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.deptId}
</foreach>
</update>
<update id="updateDeptStatusNormal" parameterType="Long">
update sys_dept set status = '0' where dept_id in
<foreach collection="array" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</update>
</mapper> </mapper>

View File

@ -3,6 +3,7 @@ package com.fuint.system.dept.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuint.framework.entity.BaseEntity; import com.fuint.framework.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
@ -13,6 +14,7 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -38,7 +40,7 @@ public class SysDept extends BaseEntity
/** 部门名称 */ /** 部门名称 */
private String deptName; private String deptName;
//节点类型:1代理商2连锁店3基本门店 //节点类型:1代理商2连锁店3基本门店4三方机构
private String deptType; private String deptType;
@ -52,6 +54,12 @@ public class SysDept extends BaseEntity
private String leaderName; private String leaderName;
private String leaderPhone; private String leaderPhone;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date validStartTime;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date validEndTime;
//有效次数
private Integer validNum;
/** 子部门 */ /** 子部门 */
@TableField(exist = false) @TableField(exist = false)
private List<SysDept> children = new ArrayList<SysDept>(); private List<SysDept> children = new ArrayList<SysDept>();

View File

@ -81,11 +81,10 @@ public interface SysDeptMapper extends BaseMapper<SysDept>
/** /**
* 修改所在部门正常状态 * 修改所在部门状态
* *
* @param deptIds 部门ID组
*/ */
public void updateDeptStatusNormal(Long[] deptIds); public void updateDeptStatusNormal(String ancestor);
/** /**
* 修改子元素关系 * 修改子元素关系

View File

@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int"> <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_dept where status = 0 and find_in_set(#{deptId}, ancestors) select count(*) from sys_dept where status = 'jy' and find_in_set(#{deptId}, ancestors)
</select> </select>
<select id="checkDeptNameUnique" resultType="com.fuint.system.dept.entity.SysDept"> <select id="checkDeptNameUnique" resultType="com.fuint.system.dept.entity.SysDept">
@ -86,10 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<update id="updateDeptStatusNormal" parameterType="Long"> <update id="updateDeptStatusNormal" parameterType="Long">
update sys_dept set status = '0' where dept_id in update sys_dept set status = 'jy' where ancestors like concat(#{ancestor},'%')
<foreach collection="array" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</update> </update>

View File

@ -224,7 +224,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
}else if(dept.getDeptType().equals("2")){ }else if(dept.getDeptType().equals("2")){
//连锁店 //连锁店
SysDept parentDept = this.getById(dept.getParentId()); SysDept parentDept = this.getById(dept.getParentId());
if (parentDept.getDeptType().equals("1")){ if (parentDept.getDeptType().equals("1")||parentDept.getDeptType().equals("4")){
ChainStoreInfo chainStoreInfo = new ChainStoreInfo(); ChainStoreInfo chainStoreInfo = new ChainStoreInfo();
chainStoreInfo.setStoreName(dept.getDeptName()); chainStoreInfo.setStoreName(dept.getDeptName());
chainStoreInfo.setContractDeptId(dept.getDeptId()); chainStoreInfo.setContractDeptId(dept.getDeptId());
@ -233,7 +233,13 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
throw new Exception("请在正确的节点类型下创建连锁店"); throw new Exception("请在正确的节点类型下创建连锁店");
} }
} }
}else { }else if(dept.getDeptType().equals("4")){
//第三方机构
SysDept parentDept = this.getById(dept.getParentId());
if (!parentDept.getDeptType().equals("1")){
throw new Exception("请在正确的节点类型下创建第三方机构");
}
} else {
//代理商 //代理商
dept.setDeptType("1"); dept.setDeptType("1");
} }
@ -275,10 +281,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
storeService.updateById(store); storeService.updateById(store);
} }
int result = baseMapper.updateById(dept); int result = baseMapper.updateById(dept);
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors()) if (UserConstants.DEPT_DISABLE.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors()))
&& !StringUtils.equals("0", dept.getAncestors()))
{ {
// 如果该部门是启用状态则启用该部门的所有上级部门 // 如果该部门是停用状态则停用该部门的所有下级部门
updateParentDeptStatusNormal(dept); updateParentDeptStatusNormal(dept);
} }
return result; return result;
@ -291,9 +296,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
*/ */
private void updateParentDeptStatusNormal(SysDept dept) private void updateParentDeptStatusNormal(SysDept dept)
{ {
String ancestors = dept.getAncestors(); baseMapper.updateDeptStatusNormal(dept.getAncestors());
Long[] deptIds = Convert.toLongArray(ancestors);
baseMapper.updateDeptStatusNormal(deptIds);
} }
/** /**

View File

@ -1,11 +1,11 @@
package com.fuint.module.backendApi.controller; package com.fuint.system.role.controller;
import com.fuint.common.util.Constants; import com.fuint.common.util.Constants;
import com.fuint.common.dto.AccountDto; import com.fuint.common.dto.AccountDto;
import com.fuint.common.dto.AccountInfo; import com.fuint.common.dto.AccountInfo;
import com.fuint.common.dto.RoleDto; import com.fuint.common.dto.RoleDto;
import com.fuint.common.enums.AdminRoleEnum; import com.fuint.common.enums.AdminRoleEnum;
import com.fuint.common.service.DutyService; import com.fuint.system.role.service.DutyService;
import com.fuint.common.service.SourceService; import com.fuint.common.service.SourceService;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import com.fuint.framework.exception.BusinessCheckException; import com.fuint.framework.exception.BusinessCheckException;
@ -15,7 +15,7 @@ import com.fuint.framework.pagination.PaginationResponse;
import com.fuint.framework.web.BaseController; import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject; import com.fuint.framework.web.ResponseObject;
import com.fuint.module.backendApi.request.DutyStatusRequest; import com.fuint.module.backendApi.request.DutyStatusRequest;
import com.fuint.repository.model.TDuty; import com.fuint.system.role.entity.TDuty;
import com.fuint.repository.model.TSource; import com.fuint.repository.model.TSource;
import com.fuint.utils.StringUtil; import com.fuint.utils.StringUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -145,7 +145,7 @@ public class BackendDutyController extends BaseController {
} }
TDuty tDuty = new TDuty(); TDuty tDuty = new TDuty();
tDuty.setMerchantId(accountInfo.getMerchantId()); tDuty.setStoreId(accountInfo.getMerchantId());
tDuty.setDutyName(name); tDuty.setDutyName(name);
tDuty.setDutyType(type); tDuty.setDutyType(type);
tDuty.setStatus(status); tDuty.setStatus(status);
@ -181,7 +181,7 @@ public class BackendDutyController extends BaseController {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
RoleDto roleInfo = new RoleDto(); RoleDto roleInfo = new RoleDto();
roleInfo.setMerchantId(htDuty.getMerchantId()); roleInfo.setMerchantId(htDuty.getStoreId());
roleInfo.setId(htDuty.getDutyId().longValue()); roleInfo.setId(htDuty.getDutyId().longValue());
roleInfo.setName(htDuty.getDutyName()); roleInfo.setName(htDuty.getDutyName());
roleInfo.setType(htDuty.getDutyType()); roleInfo.setType(htDuty.getDutyType());
@ -225,7 +225,7 @@ public class BackendDutyController extends BaseController {
} }
TDuty duty = tDutyService.getRoleById(Long.parseLong(id)); TDuty duty = tDutyService.getRoleById(Long.parseLong(id));
if (!duty.getMerchantId().equals(accountInfo.getMerchantId()) && accountInfo.getMerchantId() > 0) { if (!duty.getStoreId().equals(accountInfo.getMerchantId()) && accountInfo.getMerchantId() > 0) {
return getFailureResult(201, "抱歉,您没有修改权限"); return getFailureResult(201, "抱歉,您没有修改权限");
} }

View File

@ -1,4 +1,4 @@
package com.fuint.repository.model; package com.fuint.system.role.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
@ -31,7 +31,7 @@ public class TDuty extends BaseEntity implements Serializable {
private Integer dutyId; private Integer dutyId;
@ApiModelProperty("商户ID") @ApiModelProperty("商户ID")
private Integer merchantId; private Integer storeId;
@ApiModelProperty("角色名称") @ApiModelProperty("角色名称")
private String dutyName; private String dutyName;

View File

@ -1,7 +1,7 @@
package com.fuint.repository.mapper; package com.fuint.system.role.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.repository.model.TDuty; import com.fuint.system.role.entity.TDuty;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;

View File

@ -1,8 +1,8 @@
<?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.fuint.repository.mapper.TDutyMapper"> <mapper namespace="com.fuint.system.role.mapper.TDutyMapper">
<select id="findByStatus" resultType="com.fuint.repository.model.TDuty"> <select id="findByStatus" resultType="com.fuint.system.role.entity.TDuty">
select * from t_duty u select * from t_duty u
where u.status = #{status} where u.status = #{status}
<if test="merchantId != null and merchantId > 0"> <if test="merchantId != null and merchantId > 0">
@ -10,7 +10,7 @@
</if> </if>
</select> </select>
<select id="findByName" resultType="com.fuint.repository.model.TDuty"> <select id="findByName" resultType="com.fuint.system.role.entity.TDuty">
select * from t_duty u select * from t_duty u
where u.DUTY_NAME = #{name} where u.DUTY_NAME = #{name}
<if test="merchantId != null and merchantId > 0"> <if test="merchantId != null and merchantId > 0">
@ -18,7 +18,7 @@
</if> </if>
</select> </select>
<select id="findByIdIn" resultType="com.fuint.repository.model.TDuty"> <select id="findByIdIn" resultType="com.fuint.system.role.entity.TDuty">
select * from t_duty where duty_id in select * from t_duty where duty_id in
<foreach collection="ids" item="id" separator="," open="(" close=")"> <foreach collection="ids" item="id" separator="," open="(" close=")">
#{id} #{id}

View File

@ -1,11 +1,11 @@
package com.fuint.common.service; package com.fuint.system.role.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.framework.exception.BusinessCheckException; import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.framework.pagination.PaginationRequest; import com.fuint.framework.pagination.PaginationRequest;
import com.fuint.framework.pagination.PaginationResponse; import com.fuint.framework.pagination.PaginationResponse;
import com.fuint.module.backendApi.request.DutyStatusRequest; import com.fuint.module.backendApi.request.DutyStatusRequest;
import com.fuint.repository.model.TDuty; import com.fuint.system.role.entity.TDuty;
import com.fuint.repository.model.TSource; import com.fuint.repository.model.TSource;
import com.fuint.common.domain.TreeNode; import com.fuint.common.domain.TreeNode;
import java.util.List; import java.util.List;

View File

@ -1,10 +1,10 @@
package com.fuint.common.service.impl; package com.fuint.system.role.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.common.enums.StatusEnum; import com.fuint.common.enums.StatusEnum;
import com.fuint.common.service.DutyService; import com.fuint.system.role.service.DutyService;
import com.fuint.framework.annoation.OperationServiceLog; import com.fuint.framework.annoation.OperationServiceLog;
import com.fuint.framework.exception.BusinessCheckException; import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.common.domain.TreeNode; import com.fuint.common.domain.TreeNode;
@ -12,9 +12,9 @@ import com.fuint.framework.exception.BusinessRuntimeException;
import com.fuint.framework.pagination.PaginationRequest; import com.fuint.framework.pagination.PaginationRequest;
import com.fuint.framework.pagination.PaginationResponse; import com.fuint.framework.pagination.PaginationResponse;
import com.fuint.module.backendApi.request.DutyStatusRequest; import com.fuint.module.backendApi.request.DutyStatusRequest;
import com.fuint.repository.mapper.TDutyMapper; import com.fuint.system.role.mapper.TDutyMapper;
import com.fuint.repository.mapper.TDutySourceMapper; import com.fuint.repository.mapper.TDutySourceMapper;
import com.fuint.repository.model.TDuty; import com.fuint.system.role.entity.TDuty;
import com.fuint.repository.model.TDutySource; import com.fuint.repository.model.TDutySource;
import com.fuint.repository.model.TSource; import com.fuint.repository.model.TSource;
import com.fuint.utils.ArrayUtil; import com.fuint.utils.ArrayUtil;
@ -82,7 +82,7 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
@OperationServiceLog(description = "删除后台角色") @OperationServiceLog(description = "删除后台角色")
public void deleteDuty(Integer merchantId, long dutyId) { public void deleteDuty(Integer merchantId, long dutyId) {
TDuty tDuty = getRoleById(dutyId); TDuty tDuty = getRoleById(dutyId);
if (!merchantId.equals(tDuty.getMerchantId()) && merchantId > 0) { if (!merchantId.equals(tDuty.getStoreId()) && merchantId > 0) {
throw new BusinessRuntimeException("抱歉,您没有删除的权限"); throw new BusinessRuntimeException("抱歉,您没有删除的权限");
} }
try { try {
@ -106,7 +106,7 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
public void updateStatus(Integer merchantId, DutyStatusRequest dutyStatusRequest) throws BusinessCheckException { public void updateStatus(Integer merchantId, DutyStatusRequest dutyStatusRequest) throws BusinessCheckException {
TDuty tDuty = tDutyMapper.selectById(dutyStatusRequest.getRoleId()); TDuty tDuty = tDutyMapper.selectById(dutyStatusRequest.getRoleId());
if (!merchantId.equals(tDuty.getMerchantId()) && merchantId > 0) { if (!merchantId.equals(tDuty.getStoreId()) && merchantId > 0) {
throw new BusinessRuntimeException("抱歉,您没有操作的权限"); throw new BusinessRuntimeException("抱歉,您没有操作的权限");
} }
@ -132,7 +132,7 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
throw new BusinessCheckException("角色不存在."); throw new BusinessCheckException("角色不存在.");
} }
if (!StringUtil.equals(tduty.getDutyName(), existsDuty.getDutyName())) { if (!StringUtil.equals(tduty.getDutyName(), existsDuty.getDutyName())) {
TDuty tDuty = findByName(existsDuty.getMerchantId(), tduty.getDutyName()); TDuty tDuty = findByName(existsDuty.getStoreId(), tduty.getDutyName());
if (tDuty != null) { if (tDuty != null) {
throw new BusinessCheckException("角色名已存在."); throw new BusinessCheckException("角色名已存在.");
} }
@ -188,7 +188,7 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@OperationServiceLog(description = "新增后台角色") @OperationServiceLog(description = "新增后台角色")
public void saveDuty(TDuty duty, List<TSource> sources) throws BusinessCheckException { public void saveDuty(TDuty duty, List<TSource> sources) throws BusinessCheckException {
TDuty existsDuty = tDutyMapper.findByName(duty.getMerchantId(), duty.getDutyName()); TDuty existsDuty = tDutyMapper.findByName(duty.getStoreId(), duty.getDutyName());
if (existsDuty != null) { if (existsDuty != null) {
throw new BusinessCheckException("角色名称已经存在."); throw new BusinessCheckException("角色名称已经存在.");
} }
@ -224,9 +224,9 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
String merchantId = paginationRequest.getSearchParams().get("merchantId") == null ? "" : paginationRequest.getSearchParams().get("merchantId").toString(); String merchantId = paginationRequest.getSearchParams().get("merchantId") == null ? "" : paginationRequest.getSearchParams().get("merchantId").toString();
if (StringUtils.isNotBlank(merchantId)) { if (StringUtils.isNotBlank(merchantId)) {
lambdaQueryWrapper.and(wq -> wq lambdaQueryWrapper.and(wq -> wq
.eq(TDuty::getMerchantId, 0) .eq(TDuty::getStoreId, 0)
.or() .or()
.eq(TDuty::getMerchantId, merchantId)); .eq(TDuty::getStoreId, merchantId));
} }
lambdaQueryWrapper.orderByDesc(TDuty::getDutyId); lambdaQueryWrapper.orderByDesc(TDuty::getDutyId);

View File

@ -7,7 +7,7 @@ import com.fuint.common.dto.AccountInfo;
import com.fuint.common.dto.RoleDto; import com.fuint.common.dto.RoleDto;
import com.fuint.common.enums.StatusEnum; import com.fuint.common.enums.StatusEnum;
import com.fuint.common.service.AccountService; import com.fuint.common.service.AccountService;
import com.fuint.common.service.DutyService; import com.fuint.system.role.service.DutyService;
import com.fuint.common.service.MerchantService; import com.fuint.common.service.MerchantService;
import com.fuint.business.store.service.StoreService; import com.fuint.business.store.service.StoreService;
import com.fuint.common.util.CommonUtil; import com.fuint.common.util.CommonUtil;
@ -18,7 +18,7 @@ import com.fuint.framework.web.ResponseObject;
import com.fuint.repository.model.MtMerchant; import com.fuint.repository.model.MtMerchant;
import com.fuint.business.store.entity.MtStore; import com.fuint.business.store.entity.MtStore;
import com.fuint.repository.model.TAccount; import com.fuint.repository.model.TAccount;
import com.fuint.repository.model.TDuty; import com.fuint.system.role.entity.TDuty;
import com.fuint.utils.StringUtil; import com.fuint.utils.StringUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;