修改中台用户管理增加和修改的bug
This commit is contained in:
parent
289b04f406
commit
1a5bb54d36
@ -46,7 +46,7 @@ export function addUser(data) {
|
||||
// 修改用户
|
||||
export function updateUser(data) {
|
||||
return request({
|
||||
url: '/system/user',
|
||||
url: '/backendApi/account/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
|
@ -1029,11 +1029,13 @@
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
// this.form.roleIds = [this.form.roleIds]
|
||||
if (this.form.userId !== undefined) {
|
||||
// if (this.form.userId !== undefined) {
|
||||
if (this.form.acctId) {
|
||||
updateUser(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.initPage()
|
||||
|
||||
});
|
||||
} else {
|
||||
this.form.deptId = this.queryParams.deptId
|
||||
@ -1041,7 +1043,7 @@
|
||||
addUser(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.initPage()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -271,6 +271,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
@Resource
|
||||
LJGoodsService ljGoodsService;
|
||||
@Override
|
||||
@Transactional
|
||||
public IntegralOrders checkTheStatusOfYourPaymentByIntegral(String orderNo) {
|
||||
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
@ -301,9 +302,12 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
cardExchangeRecord.setName(ljUserVos.getName());
|
||||
cardExchangeRecord.setMobile(ljUserVos.getMobile());
|
||||
cardExchangeRecord.setPhoto(ljUserVos.getAvatar());
|
||||
cardExchangeRecord.setMtStaffId(ljStaff.getId());
|
||||
cardExchangeRecord.setRealName(ljStaff.getRealName());
|
||||
cardExchangeRecord.setStaffMobile(ljStaff.getMobile());
|
||||
if (ObjectUtil.isNotEmpty(ljStaff)) {
|
||||
cardExchangeRecord.setMtStaffId(ljStaff.getId());
|
||||
cardExchangeRecord.setRealName(ljStaff.getRealName());
|
||||
cardExchangeRecord.setStaffMobile(ljStaff.getMobile());
|
||||
}
|
||||
|
||||
cardExchangeRecord.setStatus("0");
|
||||
cardExchangeRecord.setExchangeFrom("积分兑换");
|
||||
cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord);
|
||||
|
@ -121,4 +121,6 @@ public class LJStaff extends BaseEntity implements Serializable {
|
||||
|
||||
@ApiModelProperty("员工码")
|
||||
private String staffCode;
|
||||
|
||||
private String ifDelete;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import com.fuint.framework.pagination.PaginationResponse;
|
||||
import com.fuint.repository.model.TAccount;
|
||||
import com.fuint.system.role.entity.TDuty;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 后台账号接口
|
||||
@ -45,6 +46,20 @@ public interface AccountService extends IService<TAccount> {
|
||||
*/
|
||||
TAccount getAccountInfoById(Integer id);
|
||||
|
||||
/**
|
||||
* 新增账户
|
||||
*
|
||||
* @return 新增账户
|
||||
*/
|
||||
boolean doCreate(Map<String, Object> param);
|
||||
/**
|
||||
* 修改账户信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean update(Map<String, Object> param);
|
||||
|
||||
|
||||
/**
|
||||
* 创建账号信息
|
||||
*
|
||||
|
@ -6,12 +6,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.member.entity.LJStaff;
|
||||
import com.fuint.business.member.mapper.LJStaffMapper;
|
||||
import com.fuint.business.member.service.ILJStaffService;
|
||||
import com.fuint.business.store.entity.MtStore;
|
||||
import com.fuint.business.store.mapper.MtStoreMapper;
|
||||
import com.fuint.common.dto.AccountDto;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.service.AccountService;
|
||||
import com.fuint.common.service.StaffService;
|
||||
import com.fuint.common.util.CommonUtil;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.framework.annoation.OperationServiceLog;
|
||||
import com.fuint.framework.exception.BusinessCheckException;
|
||||
@ -24,8 +28,10 @@ import com.fuint.system.dept.entity.SysDept;
|
||||
import com.fuint.system.dept.service.ISysDeptService;
|
||||
import com.fuint.system.role.entity.TDuty;
|
||||
import com.fuint.system.role.mapper.TDutyMapper;
|
||||
import com.fuint.system.role.service.DutyService;
|
||||
import com.fuint.utils.Digests;
|
||||
import com.fuint.utils.Encodes;
|
||||
import com.fuint.utils.StringUtil;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@ -64,6 +70,16 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
|
||||
@Resource
|
||||
private MtStoreMapper mtStoreMapper;
|
||||
|
||||
/**
|
||||
* 角色接口
|
||||
*/
|
||||
@Resource
|
||||
private DutyService tDutyService;
|
||||
/**
|
||||
* 员工接口
|
||||
*/
|
||||
@Resource
|
||||
LJStaffMapper ljStaffMapper;
|
||||
/**
|
||||
* 员工接口
|
||||
*/
|
||||
@ -186,6 +202,226 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
|
||||
return tAccount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean doCreate(Map<String, Object> param){
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
if (ObjectUtil.isEmpty(nowAccountInfo)) {
|
||||
throw new RuntimeException("请先登录!");
|
||||
}
|
||||
|
||||
// List<Integer> roleIds = (List) param.get("roleIds");
|
||||
String roleId = param.get("roleIds").toString();
|
||||
String accountName = param.get("accountName").toString();
|
||||
String accountStatus = param.get("accountStatus").toString();
|
||||
String realName = param.get("realName").toString();
|
||||
String password = param.get("password").toString();
|
||||
|
||||
// String roleIds = param.get("roleIds").toString();
|
||||
String storeId = param.get("storeId") == null ? "0" : param.get("storeId").toString();
|
||||
String merchantId = param.get("merchantId") == null ? "0" : param.get("merchantId").toString();
|
||||
String staffId = param.get("staffId") == null ? "0" : param.get("staffId").toString();
|
||||
String deptId = param.get("deptId") == null ? "0" : param.get("deptId").toString();
|
||||
|
||||
// 获取角色code
|
||||
String code = param.get("code") == null ? "0" : param.get("code").toString();
|
||||
// 所属的连锁店类型
|
||||
String deptType = param.get("deptType") == null ? "0" : param.get("deptType").toString();
|
||||
|
||||
// 判断是否能创建站长 z001为站长的枚举值 后期需要创建一个角色的枚举类
|
||||
if (!"3".equals(deptType) && "z001".equals(code) ) {
|
||||
throw new RuntimeException("用户角色与组织架构不匹配!");
|
||||
}
|
||||
MtStore mtStore = new MtStore();
|
||||
if ("3".equals(deptType)) {
|
||||
// 查出storeId
|
||||
LambdaQueryWrapper<MtStore> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.eq(MtStore::getContractDeptId,deptId);
|
||||
mtStore = mtStoreMapper.selectOne(lambdaQueryWrapper);
|
||||
|
||||
}
|
||||
|
||||
AccountInfo accountInfo = getAccountByName(accountName);
|
||||
if (accountInfo != null) {
|
||||
throw new RuntimeException("该用户名已存在!");
|
||||
|
||||
}
|
||||
|
||||
// 处理角色 remark:当前为一个账号对应一个角色,,,后续可能修改为一对多。现在有一个中间表
|
||||
List<TDuty> duties = new ArrayList<>();
|
||||
String[] ids = new String[1];
|
||||
ids[0] = roleId;
|
||||
duties = tDutyService.findDatasByIds(ids);
|
||||
if (ObjectUtil.isEmpty(duties)) {
|
||||
throw new RuntimeException("您分配的角色不存在!");
|
||||
}
|
||||
|
||||
TAccount tAccount = new TAccount();
|
||||
tAccount.setAccountKey(CommonUtil.createAccountKey());
|
||||
tAccount.setRealName(realName);
|
||||
tAccount.setAccountName(accountName);
|
||||
tAccount.setAccountStatus(Integer.parseInt(accountStatus));
|
||||
tAccount.setPassword(password);
|
||||
tAccount.setIsActive(1);
|
||||
tAccount.setLocked(0);
|
||||
if (ObjectUtil.isEmpty(mtStore)) mtStore.setId(0);
|
||||
tAccount.setStoreId(mtStore.getId());
|
||||
tAccount.setMerchantId(Integer.parseInt(merchantId));
|
||||
tAccount.setStaffId(Integer.parseInt(staffId));
|
||||
tAccount.setDeptId(Long.parseLong(deptId));
|
||||
tAccount.setRoleIds(roleId);
|
||||
|
||||
TAccount resAccountInfo = createAccountInfo(tAccount, duties);
|
||||
|
||||
TAccount editTAccount = getAccountInfoById(resAccountInfo.getAcctId());
|
||||
LJStaff staff = new LJStaff();
|
||||
staff.setStoreId(mtStore.getId());
|
||||
staff.setRealName(realName);
|
||||
staff.setStatus("qy");
|
||||
staff.setRoleId(roleId);
|
||||
staff.setMobile(param.get("mobile").toString());
|
||||
|
||||
// 查询手机号是否存在
|
||||
LambdaQueryWrapper<LJStaff> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
// 查询手机号是否存在
|
||||
lambdaQueryWrapper.eq(LJStaff::getMobile,param.get("mobile").toString());
|
||||
lambdaQueryWrapper.eq(LJStaff::getIfDelete,0);
|
||||
List list = ljStaffMapper.selectList(lambdaQueryWrapper);
|
||||
if (list.size()>0) {
|
||||
throw new RuntimeException("手机号重复!");
|
||||
|
||||
}
|
||||
ljStaffMapper.insert(staff);
|
||||
LJStaff staff1 = ljStaffMapper.selectById(staff.getId());
|
||||
if (ObjectUtil.isNotEmpty(staff1)){
|
||||
editTAccount.setStaffId(staff1.getId());
|
||||
updateAccount(editTAccount);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(Map<String, Object> param) {
|
||||
|
||||
// List<Integer> roleIds = (List) param.get("roleIds");
|
||||
String realName = param.get("realName").toString();
|
||||
String accountName = param.get("accountName").toString();
|
||||
String accountStatus = param.get("accountStatus").toString();
|
||||
String storeId = param.get("storeId") == null ? "" : param.get("storeId").toString();
|
||||
String staffId = param.get("staffId") == null ? "" : param.get("staffId").toString();
|
||||
String merchantId = param.get("merchantId") == null ? "" : param.get("merchantId").toString();
|
||||
String roleId = param.get("roleIds") == null ? "" : param.get("roleIds").toString();
|
||||
|
||||
|
||||
Long id = Long.parseLong(param.get("acctId").toString());
|
||||
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
if (ObjectUtil.isEmpty(nowAccountInfo)) {
|
||||
throw new RuntimeException("请先登录!");
|
||||
}
|
||||
|
||||
TAccount tAccount = getAccountInfoById(id.intValue());
|
||||
tAccount.setAcctId(id.intValue());
|
||||
tAccount.setRealName(realName);
|
||||
|
||||
if (StringUtil.isNotEmpty(accountName)) {
|
||||
tAccount.setAccountName(accountName);
|
||||
}
|
||||
if (StringUtil.isNotEmpty(accountStatus)) {
|
||||
tAccount.setAccountStatus(Integer.parseInt(accountStatus));
|
||||
}
|
||||
if (StringUtil.isNotEmpty(storeId)) {
|
||||
tAccount.setStoreId(Integer.parseInt(storeId));
|
||||
}
|
||||
if (StringUtil.isNotEmpty(staffId)) {
|
||||
tAccount.setStaffId(Integer.parseInt(staffId));
|
||||
}
|
||||
if (StringUtil.isNotEmpty(merchantId)) {
|
||||
tAccount.setMerchantId(Integer.parseInt(merchantId));
|
||||
}
|
||||
|
||||
AccountInfo accountInfo = getAccountByName(accountName);
|
||||
if (accountInfo != null && accountInfo.getId() != id.intValue()) {
|
||||
throw new RuntimeException("该用户名已存在!");
|
||||
|
||||
}
|
||||
List<TDuty> duties = new ArrayList<>();
|
||||
|
||||
if (StringUtil.isNotEmpty(roleId)) {
|
||||
// 处理角色 remark:当前为一个账号对应一个角色,,,后续可能修改为一对多。现在有一个中间表
|
||||
String[] ids = new String[1];
|
||||
ids[0] = roleId;
|
||||
duties = tDutyService.findDatasByIds(ids);
|
||||
if (ObjectUtil.isEmpty(duties)) {
|
||||
throw new RuntimeException("您分配的角色不存在!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// List<TDuty> duties = null;
|
||||
// if (roleIds.size() > 0) {
|
||||
// Integer[] roles = roleIds.toArray(new Integer[roleIds.size()]);
|
||||
// String[] ids = new String[roles.length];
|
||||
// for (int i = 0; i < roles.length; i++) {
|
||||
// ids[i] = roles[i].toString();
|
||||
// }
|
||||
// duties = tDutyService.findDatasByIds(ids);
|
||||
// if (duties.size() < roleIds.size()) {
|
||||
// throw new RuntimeException("您分配的角色不存在!");
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
try {
|
||||
editAccount(tAccount, duties);
|
||||
|
||||
if(ObjectUtil.isNotEmpty(staffId)) {
|
||||
LJStaff ljStaff = ljStaffMapper.selectById(staffId);
|
||||
|
||||
// 修改对应的员工账号
|
||||
ljStaff.setRealName(realName);
|
||||
ljStaff.setStoreId(Integer.parseInt(storeId));
|
||||
|
||||
ljStaff.setRoleId(roleId);
|
||||
|
||||
boolean flag = false;
|
||||
if (ObjectUtil.isNotEmpty(param.get("mobile"))) {
|
||||
if (param.get("mobile").toString().equals(ljStaff.getMobile())) {
|
||||
flag = true;
|
||||
} else {
|
||||
ljStaff.setMobile(param.get("mobile").toString());
|
||||
}
|
||||
|
||||
}else {
|
||||
throw new RuntimeException("请输入手机号!");
|
||||
}
|
||||
LambdaQueryWrapper<LJStaff> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
if (!flag) {
|
||||
// 查询手机号是否存在
|
||||
lambdaQueryWrapper.eq(LJStaff::getMobile,param.get("mobile").toString());
|
||||
lambdaQueryWrapper.eq(LJStaff::getIfDelete,0);
|
||||
|
||||
List list = ljStaffMapper.selectList(lambdaQueryWrapper);
|
||||
if (list.size()>0) {
|
||||
throw new RuntimeException("手机号重复!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ljStaffMapper.updateById(ljStaff);
|
||||
|
||||
}
|
||||
} catch (BusinessCheckException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建账号信息
|
||||
*
|
||||
@ -289,8 +525,9 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
|
||||
}
|
||||
}
|
||||
if (tAccount.getStaffId() != null && tAccount.getStaffId() > 0) {
|
||||
MtStaff mtStaff = staffService.queryStaffById(tAccount.getStaffId());
|
||||
if (mtStaff == null) {
|
||||
|
||||
LJStaff ljStaff = ljStaffMapper.selectById(tAccount.getStaffId());
|
||||
if (ljStaff == null) {
|
||||
tAccount.setStaffId(0);
|
||||
}
|
||||
}
|
||||
|
@ -766,6 +766,7 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
|
||||
mtUser.setOpenId(openId);
|
||||
|
||||
mtUser.setMobile(mobile);
|
||||
mtUser.setName("("+mobile+")微信自动注册用户");
|
||||
mtUser.setCreateTime(new Date());
|
||||
mtUser.setUpdateTime(new Date());
|
||||
mtUser.setDescription("微信登录自动注册");
|
||||
@ -851,9 +852,7 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(inviterId) && inviterId !="") {
|
||||
mtInvitation.setInviterId(Integer.parseInt(inviterId));
|
||||
|
||||
}
|
||||
|
||||
mtInvitationMapper.insert(mtInvitation);
|
||||
}
|
||||
}
|
||||
|
@ -174,19 +174,6 @@ public class BackendAccountController extends BaseController {
|
||||
return getSuccessResult(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
TAccountDutyMapper tAccountDutyMapper;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private ILJStaffService staffService;
|
||||
|
||||
@Resource
|
||||
MtStoreMapper mtStoreMapper;
|
||||
/**
|
||||
* 新增账户
|
||||
*
|
||||
@ -196,104 +183,10 @@ public class BackendAccountController extends BaseController {
|
||||
@ApiOperation(value = "新增账户")
|
||||
@RequestMapping(value = "/doCreate", method = RequestMethod.POST)
|
||||
@CrossOrigin
|
||||
// @Transactional
|
||||
public ResponseObject doCreate(HttpServletRequest request, @RequestBody Map<String, Object> param) {
|
||||
String token = request.getHeader("Access-Token");
|
||||
AccountInfo loginAccount = TokenUtil.getAccountInfoByToken(token);
|
||||
if (loginAccount == null) {
|
||||
return getFailureResult(1001, "请先登录");
|
||||
}
|
||||
boolean flag = tAccountService.doCreate(param);
|
||||
|
||||
// List<Integer> roleIds = (List) param.get("roleIds");
|
||||
String roleId = param.get("roleIds").toString();
|
||||
String accountName = param.get("accountName").toString();
|
||||
String accountStatus = param.get("accountStatus").toString();
|
||||
String realName = param.get("realName").toString();
|
||||
String password = param.get("password").toString();
|
||||
|
||||
// String roleIds = param.get("roleIds").toString();
|
||||
String storeId = param.get("storeId") == null ? "0" : param.get("storeId").toString();
|
||||
String merchantId = param.get("merchantId") == null ? "0" : param.get("merchantId").toString();
|
||||
String staffId = param.get("staffId") == null ? "0" : param.get("staffId").toString();
|
||||
String deptId = param.get("deptId") == null ? "0" : param.get("deptId").toString();
|
||||
|
||||
// 获取角色code
|
||||
String code = param.get("code") == null ? "0" : param.get("code").toString();
|
||||
// 所属的连锁店类型
|
||||
String deptType = param.get("deptType") == null ? "0" : param.get("deptType").toString();
|
||||
|
||||
if (!"3".equals(deptType) && "z001".equals(code) ) {
|
||||
return getFailureResult(201, "用户角色与组织架构不匹配");
|
||||
|
||||
}
|
||||
MtStore mtStore = new MtStore();
|
||||
if ("3".equals(deptType)) {
|
||||
// 查出storeId
|
||||
LambdaQueryWrapper<MtStore> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.eq(MtStore::getContractDeptId,deptId);
|
||||
mtStore = mtStoreMapper.selectOne(lambdaQueryWrapper);
|
||||
|
||||
}
|
||||
|
||||
AccountInfo accountInfo = tAccountService.getAccountByName(accountName);
|
||||
if (accountInfo != null) {
|
||||
return getFailureResult(201, "该用户名已存在");
|
||||
}
|
||||
|
||||
List<TDuty> duties = new ArrayList<>();
|
||||
String[] ids = new String[1];
|
||||
ids[0] = roleId;
|
||||
duties = tDutyService.findDatasByIds(ids);
|
||||
if (ObjectUtil.isEmpty(duties)) {
|
||||
return getFailureResult(201, "您分配的角色不存在");
|
||||
}
|
||||
|
||||
// if (roleIds.size() > 0) {
|
||||
// Integer[] roles = roleIds.toArray(new Integer[roleIds.size()]);
|
||||
// String[] ids = new String[roles.length];
|
||||
//// for (int i = 0; i < roles.length; i++) {
|
||||
//// ids[i] = roles[i].toString();
|
||||
//// }
|
||||
// duties = tDutyService.findDatasByIds(ids);
|
||||
// if (duties.size() < roleIds.size()) {
|
||||
// return getFailureResult(201, "您分配的角色不存在");
|
||||
// }
|
||||
// }
|
||||
|
||||
// 查询角色是否存在
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TAccount tAccount = new TAccount();
|
||||
tAccount.setAccountKey(CommonUtil.createAccountKey());
|
||||
tAccount.setRealName(realName);
|
||||
tAccount.setAccountName(accountName);
|
||||
tAccount.setAccountStatus(Integer.parseInt(accountStatus));
|
||||
tAccount.setPassword(password);
|
||||
tAccount.setIsActive(1);
|
||||
tAccount.setLocked(0);
|
||||
if (ObjectUtil.isEmpty(mtStore)) mtStore.setId(0);
|
||||
tAccount.setStoreId(mtStore.getId());
|
||||
tAccount.setMerchantId(Integer.parseInt(merchantId));
|
||||
tAccount.setStaffId(Integer.parseInt(staffId));
|
||||
tAccount.setDeptId(Long.parseLong(deptId));
|
||||
tAccount.setRoleIds(roleId);
|
||||
|
||||
tAccountService.createAccountInfo(tAccount, duties);
|
||||
|
||||
TAccount tAccount1 = tAccountService.selectAccountByName(accountName);
|
||||
LJStaff staff = new LJStaff();
|
||||
staff.setStoreId(mtStore.getId());
|
||||
staff.setRealName(realName);
|
||||
staff.setStatus("qy");
|
||||
staff.setRoleId(roleId);
|
||||
staff.setMobile(param.get("mobile").toString());
|
||||
staffService.addStaff(staff,tAccount1);
|
||||
|
||||
return getSuccessResult(true);
|
||||
return getSuccessResult(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -303,64 +196,10 @@ public class BackendAccountController extends BaseController {
|
||||
* @throws BusinessCheckException
|
||||
*/
|
||||
@ApiOperation(value = "修改账户信息")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/update", method = RequestMethod.PUT)
|
||||
@CrossOrigin
|
||||
public ResponseObject update(HttpServletRequest request, @RequestBody Map<String, Object> param) throws BusinessCheckException {
|
||||
String token = request.getHeader("Access-Token");
|
||||
|
||||
List<Integer> roleIds = (List) param.get("roleIds");
|
||||
String realName = param.get("realName").toString();
|
||||
String accountName = param.get("accountName").toString();
|
||||
String accountStatus = param.get("accountStatus").toString();
|
||||
String storeId = param.get("storeId") == null ? "" : param.get("storeId").toString();
|
||||
String staffId = param.get("staffId") == null ? "" : param.get("staffId").toString();
|
||||
String merchantId = param.get("merchantId") == null ? "" : param.get("merchantId").toString();
|
||||
Long id = Long.parseLong(param.get("id").toString());
|
||||
|
||||
AccountInfo loginAccount = TokenUtil.getAccountInfoByToken(token);
|
||||
if (loginAccount == null) {
|
||||
return getFailureResult(1001, "请先登录");
|
||||
}
|
||||
|
||||
TAccount tAccount = tAccountService.getAccountInfoById(id.intValue());
|
||||
tAccount.setAcctId(id.intValue());
|
||||
tAccount.setRealName(realName);
|
||||
|
||||
if (StringUtil.isNotEmpty(accountName)) {
|
||||
tAccount.setAccountName(accountName);
|
||||
}
|
||||
if (StringUtil.isNotEmpty(accountStatus)) {
|
||||
tAccount.setAccountStatus(Integer.parseInt(accountStatus));
|
||||
}
|
||||
if (StringUtil.isNotEmpty(storeId)) {
|
||||
tAccount.setStoreId(Integer.parseInt(storeId));
|
||||
}
|
||||
if (StringUtil.isNotEmpty(staffId)) {
|
||||
tAccount.setStaffId(Integer.parseInt(staffId));
|
||||
}
|
||||
if (StringUtil.isNotEmpty(merchantId)) {
|
||||
tAccount.setMerchantId(Integer.parseInt(merchantId));
|
||||
}
|
||||
|
||||
AccountInfo accountInfo = tAccountService.getAccountByName(accountName);
|
||||
if (accountInfo != null && accountInfo.getId() != id.intValue()) {
|
||||
return getFailureResult(201, "该用户名已存在");
|
||||
}
|
||||
|
||||
List<TDuty> duties = null;
|
||||
if (roleIds.size() > 0) {
|
||||
Integer[] roles = roleIds.toArray(new Integer[roleIds.size()]);
|
||||
String[] ids = new String[roles.length];
|
||||
for (int i = 0; i < roles.length; i++) {
|
||||
ids[i] = roles[i].toString();
|
||||
}
|
||||
duties = tDutyService.findDatasByIds(ids);
|
||||
if (duties.size() < roleIds.size()) {
|
||||
return getFailureResult(201, "您分配的角色不存在");
|
||||
}
|
||||
}
|
||||
|
||||
tAccountService.editAccount(tAccount, duties);
|
||||
tAccountService.update(param);
|
||||
return getSuccessResult(true);
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,11 @@ mybatis-plus.configuration.intercepts=com.example.MyInterceptor
|
||||
# \u9ED8\u8BA4\u65F6\u95F4\u683C\u5F0F
|
||||
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
||||
|
||||
#logging.level.com.fuint.business.*.mapper:DEBUG
|
||||
#logging.level.org.springframework.web:DEBUG
|
||||
#logging.level.java.sql:DEBUG
|
||||
#logging.level.org.mybatis.spring:DEBUG
|
||||
|
||||
##rocketmq????
|
||||
#??????????
|
||||
#rocketmq.producer.isOnOff=on
|
||||
|
@ -26,10 +26,11 @@
|
||||
|
||||
<select id="listAccount" resultType="com.fuint.repository.model.TAccount">
|
||||
SELECT
|
||||
ta.*,sd.dept_name
|
||||
ta.*,sd.dept_name, ms.mobile
|
||||
FROM
|
||||
`t_account` ta
|
||||
left join sys_dept sd on sd.dept_id = ta.dept_id
|
||||
left join mt_staff ms on ta.staff_id = ms.id
|
||||
where account_status != -1
|
||||
|
||||
<if test="accountInfo.realName != null and accountInfo.realName != ''">
|
||||
|
Loading…
Reference in New Issue
Block a user