bug
This commit is contained in:
parent
613995dd4e
commit
c4dda44f15
@ -234,9 +234,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
|
||||
String staffId = param.get("staffId") == null ? "0" : param.get("staffId").toString();
|
||||
String deptId = param.get("deptId") == null ? "0" : param.get("deptId").toString();
|
||||
|
||||
ChainStoreInfo chainStoreInfo = chainStoreInfoService.selectChainStoreByDeptId(Long.valueOf(deptId));
|
||||
if (ObjectUtil.isNotEmpty(chainStoreInfo) && ObjectUtil.isNotEmpty(chainStoreInfo.getId()))
|
||||
merchantId = String.valueOf(chainStoreInfo.getId());
|
||||
|
||||
|
||||
// 获取角色code
|
||||
String code = param.get("code") == null ? "0" : param.get("code").toString();
|
||||
@ -257,6 +255,12 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
|
||||
mtStore = mtStoreMapper.selectOne(lambdaQueryWrapper);
|
||||
|
||||
}
|
||||
if ("2".equals(deptType)) {
|
||||
// 查出storeId
|
||||
ChainStoreInfo chainStoreInfo = chainStoreInfoService.selectChainStoreByDeptId(Long.valueOf(deptId));
|
||||
if (ObjectUtil.isNotEmpty(chainStoreInfo) && ObjectUtil.isNotEmpty(chainStoreInfo.getId()))
|
||||
merchantId = String.valueOf(chainStoreInfo.getId());
|
||||
}
|
||||
|
||||
AccountInfo accountInfo = getAccountByName(accountName);
|
||||
if (accountInfo != null) {
|
||||
@ -283,6 +287,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
|
||||
tAccount.setLocked(0);
|
||||
if (ObjectUtil.isEmpty(mtStore)) mtStore.setId(0);
|
||||
tAccount.setStoreId(mtStore.getId());
|
||||
merchantId = ObjectUtil.isNotEmpty(mtStore) ? String.valueOf(mtStore.getChainStoreId()) : merchantId;
|
||||
tAccount.setMerchantId(Integer.parseInt(merchantId));
|
||||
tAccount.setStaffId(Integer.parseInt(staffId));
|
||||
tAccount.setDeptId(Long.parseLong(deptId));
|
||||
@ -373,9 +378,15 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
|
||||
tAccount.setStaffId(Integer.parseInt(staffId));
|
||||
}
|
||||
|
||||
ChainStoreInfo chainStoreInfo = chainStoreInfoService.selectChainStoreByDeptId(tAccount.getDeptId());
|
||||
if (ObjectUtil.isNotEmpty(chainStoreInfo) && ObjectUtil.isNotEmpty(chainStoreInfo.getId()))
|
||||
merchantId = String.valueOf(chainStoreInfo.getId());
|
||||
if (param.get("deptType").equals("3")) {
|
||||
MtStore store = mtStoreMapper.selectById(Integer.valueOf(param.get("storeId").toString()));
|
||||
if (ObjectUtil.isNotEmpty(store)) merchantId = String.valueOf(store.getChainStoreId());
|
||||
}
|
||||
if (param.get("deptType").equals("2")){
|
||||
ChainStoreInfo chainStoreInfo = chainStoreInfoService.selectChainStoreByDeptId(tAccount.getDeptId());
|
||||
if (ObjectUtil.isNotEmpty(chainStoreInfo) && ObjectUtil.isNotEmpty(chainStoreInfo.getId()))
|
||||
merchantId = String.valueOf(chainStoreInfo.getId());
|
||||
}
|
||||
|
||||
if (StringUtil.isNotEmpty(merchantId)) {
|
||||
tAccount.setMerchantId(Integer.parseInt(merchantId));
|
||||
|
@ -4,7 +4,11 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.enums.StatusEnum;
|
||||
import com.fuint.common.service.AccountService;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.repository.model.TAccount;
|
||||
import com.fuint.system.role.service.DutyService;
|
||||
import com.fuint.framework.annoation.OperationServiceLog;
|
||||
import com.fuint.framework.exception.BusinessCheckException;
|
||||
@ -23,6 +27,7 @@ import com.fuint.utils.StringUtil;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -47,6 +52,10 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
|
||||
@Resource
|
||||
private TDutySourceMapper tDutySourceMapper;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private AccountService accountService;
|
||||
|
||||
@Override
|
||||
public List<TDuty> getAvailableRoles(Integer merchantId) {
|
||||
List<TDuty> result = tDutyMapper.findByStatus(merchantId, StatusEnum.ENABLED.getKey());
|
||||
@ -145,12 +154,18 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
|
||||
existsDuty.setDutyName(tduty.getDutyName());
|
||||
existsDuty.setStatus(tduty.getStatus());
|
||||
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
TAccount byId = accountService.getById(nowAccountInfo.getId());
|
||||
Integer chainStoreId = null;
|
||||
if (ObjectUtil.isNotEmpty(byId)) chainStoreId = byId.getMerchantId();
|
||||
|
||||
if (sources != null && sources.size() > 0) {
|
||||
tDutySourceMapper.deleteSourcesByDutyId(tduty.getDutyId());
|
||||
for (TSource tSource : sources) {
|
||||
TDutySource dutySource = new TDutySource();
|
||||
dutySource.setDutyId(tduty.getDutyId());
|
||||
dutySource.setSourceId(tSource.getSourceId());
|
||||
dutySource.setChainStoreId(chainStoreId);
|
||||
tDutySourceMapper.insert(dutySource);
|
||||
}
|
||||
}
|
||||
@ -195,11 +210,16 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
|
||||
throw new BusinessCheckException("角色名称已经存在.");
|
||||
}
|
||||
this.tDutyMapper.insert(duty);
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
TAccount byId = accountService.getById(nowAccountInfo.getId());
|
||||
Integer chainStoreId = null;
|
||||
if (ObjectUtil.isNotEmpty(byId)) chainStoreId = byId.getMerchantId();
|
||||
if (sources != null && sources.size() > 0) {
|
||||
for (TSource tSource : sources) {
|
||||
TDutySource dutySource = new TDutySource();
|
||||
dutySource.setDutyId(duty.getDutyId());
|
||||
dutySource.setSourceId(tSource.getSourceId());
|
||||
dutySource.setChainStoreId(chainStoreId);
|
||||
tDutySourceMapper.insert(dutySource);
|
||||
}
|
||||
}
|
||||
|
@ -34,8 +34,14 @@
|
||||
left join t_duty td ON ta.role_ids = td.duty_id
|
||||
where account_status != -1
|
||||
|
||||
<if test="accountInfo.accountName != null and accountInfo.accountName != ''">
|
||||
AND ta.account_name like concat('%',#{accountInfo.accountName},'%')
|
||||
</if>
|
||||
<if test="accountInfo.accountStatus != null">
|
||||
AND ta.account_status = #{accountInfo.accountStatus}
|
||||
</if>
|
||||
<if test="accountInfo.realName != null and accountInfo.realName != ''">
|
||||
AND ta.real_name = like concat('%',#{accountInfo.realName},'%')
|
||||
AND ta.real_name like concat('%',#{accountInfo.realName},'%')
|
||||
</if>
|
||||
<if test="accountInfo.deptId != null">
|
||||
AND (ta.dept_id = #{accountInfo.deptId} or FIND_IN_SET(#{accountInfo.deptId}, sd.ancestors))
|
||||
|
Loading…
Reference in New Issue
Block a user