Commit d21ab452 by 284718418@qq.com

修改BUG402 8小时现在缺少一个主账号替换的功能

parent 008e0e7f
...@@ -13,8 +13,10 @@ import java.util.Comparator; ...@@ -13,8 +13,10 @@ import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -145,7 +147,8 @@ public class Auth { ...@@ -145,7 +147,8 @@ public class Auth {
YgglMainEmp yg = YgglMainEmp.builder().build() YgglMainEmp yg = YgglMainEmp.builder().build()
.selectOne(new LambdaQueryWrapper<YgglMainEmp>().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()) .selectOne(new LambdaQueryWrapper<YgglMainEmp>().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
.eq(YgglMainEmp::getEmpNum, empNum) .eq(YgglMainEmp::getEmpNum, empNum)
.select(YgglMainEmp::getName, YgglMainEmp::getPhone, YgglMainEmp::getEmpNum)); .select(YgglMainEmp::getName, YgglMainEmp::getPhone, YgglMainEmp::getEmpNum, YgglMainEmp::getCustomNum));
QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().id(empNum).build().selectById();
QyzxEmpEntAsso qyzxEmpEntAsso = QyzxEmpEntAsso.builder().build() QyzxEmpEntAsso qyzxEmpEntAsso = QyzxEmpEntAsso.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxEmpEntAsso>() .selectOne(new LambdaQueryWrapper<QyzxEmpEntAsso>()
...@@ -154,7 +157,8 @@ public class Auth { ...@@ -154,7 +157,8 @@ public class Auth {
QyzxAuthDto dto = new QyzxAuthDto(); QyzxAuthDto dto = new QyzxAuthDto();
dto.setEmpNum(empNum); dto.setEmpNum(empNum);
dto.setName(yg.getName()); dto.setName(yg.getName());
dto.setPhone(yg.getPhone()); dto.setPhone(qyzxEmpLogin.getPhone());
dto.setCustomNum(yg.getCustomNum());
if (qyzxEmpEntAsso != null) if (qyzxEmpEntAsso != null)
dto.setUserType(qyzxEmpEntAsso.getUserType()); dto.setUserType(qyzxEmpEntAsso.getUserType());
if (yg != null) if (yg != null)
...@@ -164,4 +168,32 @@ public class Auth { ...@@ -164,4 +168,32 @@ public class Auth {
return ResultUtil.data(ygs, "查询成功"); return ResultUtil.data(ygs, "查询成功");
} }
@PostMapping(value = "/moveAdminEmp")
@ApiOperation(value = "超管转移", httpMethod = "POST", notes = "接口发布说明")
@Log(title = "修改-超管转移", businessType = BusinessType.INSERT)
public Result<Void> moveAdminEmp(@CurrentUser UserBean userBean, @RequestParam Integer childEmpNum) {
Integer orgCode = userBean.getOrgCode();
Integer empNum = userBean.getEmpNum();
QyzxEmpEntAsso currentQyzxEmpEntAsso = selectMain(orgCode, empNum);
if(StringUtils.isEmpty(currentQyzxEmpEntAsso) || !SysRoleType.U_TYPE_ADMIN.getType().equals(currentQyzxEmpEntAsso.getUserType())){
return ResultUtil.error("当前用户无权限操作");
}
QyzxEmpEntAsso qyzxEmpEntAsso = selectMain_(orgCode, childEmpNum);
if (qyzxEmpEntAsso != null) {
if (qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_ADMIN.getType()){
return ResultUtil.error("指定用户已是超管理员");
}
if (QyzxEmpEntAsso.builder().userType(SysRoleType.U_TYPE_ADMIN.getType()).build()
.update(new LambdaQueryWrapper<QyzxEmpEntAsso>().eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.eq(QyzxEmpEntAsso::getEmpNum, childEmpNum))){
//转移后自己成为普通员工
QyzxEmpEntAsso.builder().userType(SysRoleType.U_TYPE_EMP.getType()).build()
.update(new LambdaQueryWrapper<QyzxEmpEntAsso>().eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.eq(QyzxEmpEntAsso::getEmpNum, empNum));
return ResultUtil.success("转移成功");
}
}
return ResultUtil.error("当前用户无权限操作");
}
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
*/ */
package cn.timer.api.dto.qyzx; package cn.timer.api.dto.qyzx;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
...@@ -31,5 +32,7 @@ public class QyzxAuthDto { ...@@ -31,5 +32,7 @@ public class QyzxAuthDto {
private String name; private String name;
private String phone; private String phone;
private Integer userType; private Integer userType;
@ApiModelProperty(value="自定义工号",example="")
private String customNum;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment