Commit eee83665 by 邓实川

子账号权限-新增、移除、列表

parent e013d8e9
......@@ -33,9 +33,6 @@ public class QyzxEmpEntAsso extends Model<QyzxEmpEntAsso> {
@ApiModelProperty(value="用户状态",example="1")
private Integer status;
@ApiModelProperty(value="最大数量",example="10")
private Integer maxNum;
@ApiModelProperty(value="为0的id",example="0")
private Integer id;
// @ApiModelProperty(value="为0的id",example="0")
// private Integer id;
}
\ No newline at end of file
......@@ -21,92 +21,92 @@ import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Tang 2019-11-11
*/
* @author Tang 2019-11-11
*/
@Entity
@Data
@Builder(toBuilder=true)
@Builder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor
@Table(name="qyzx_ent_info_m")
@Table(name = "qyzx_ent_info_m")
@ApiModel("企业信息")
public class QyzxEntInfoM extends Model<QyzxEntInfoM> {
private static final long serialVersionUID = -8183022357750431045L;
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="组织机构代码 组织机构代码",example="4")
private Integer id;
@ApiModelProperty(value="企业名称 ",example="优领人才")
private String name;
@ApiModelProperty(value="认证名 ",example="广东优领人才科技服务有限公司")
private String attestName;
@ApiModelProperty(value="简介",example="公司福利好")
private String intro;
@ApiModelProperty(value="法人 ",example="刘德华")
private String operName;
@ApiModelProperty(value="企业规模 0:10人以下、1:10-19人、2:20-99人、3:100-500人、4:500人以上",example="3")
private Integer size;
@ApiModelProperty(value="电话号码 ",example="18712345678")
private String phone;
@ApiModelProperty(value="所在地区",example="广东省广州市白云区")
private String area;
@ApiModelProperty(value="办公地址 ",example="广从一路5号柏曼酒店3楼")
private String workAddress;
@ApiModelProperty(value="企业简写 ",example=" 例:YLZYCS(YL:优领简写;ZY:版本;CS:账户公司简称)")
private String codes;
@ApiModelProperty(value="企业LOGO ",example="企业LOGO")
private String logoUrl;
@ApiModelProperty(value="行业类型 1:农、林、牧、渔业、2:采矿业、3:制造业、4:电力、燃气及水的生产和供应业、5:建筑业、6:交通运输、仓储和邮政业、7:信息传输、计算机服务和软件业、8:批发和零售业、9:住宿和餐饮业、10:金融业、11:房地产业、12:租赁和商务服务业、13:科学研究、技术服务和地质勘查业、14:水利、环境和公共设施管理业、15:居民服务和其他服务业",example="101")
private Integer industryType;
@ApiModelProperty(value="开通渠道 1直属、2总代理、3独家代理、4一般代理商、5区域代理商 ",example="101")
private Integer openChannel;
@ApiModelProperty(value="联系人",example="刘德华")
private String linkMan;
@ApiModelProperty(value="联系人电话 ",example="18712345678")
private String linkManPhone;
@ApiModelProperty(value="统一社会信用代码 ",example="统一社会信用代码")
private String creditCode;
@ApiModelProperty(value="是否上市 0:否 1:是",example="101")
private Integer isOnStock;
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "组织机构代码 组织机构代码", example = "4")
private Integer id;
@ApiModelProperty(value = "企业名称 ", example = "优领人才")
private String name;
@ApiModelProperty(value = "认证名 ", example = "广东优领人才科技服务有限公司")
private String attestName;
@ApiModelProperty(value = "简介", example = "公司福利好")
private String intro;
@ApiModelProperty(value = "法人 ", example = "刘德华")
private String operName;
@ApiModelProperty(value = "企业规模 0:10人以下、1:10-19人、2:20-99人、3:100-500人、4:500人以上", example = "3")
private Integer size;
@ApiModelProperty(value = "电话号码 ", example = "18712345678")
private String phone;
@ApiModelProperty(value = "所在地区", example = "广东省广州市白云区")
private String area;
@ApiModelProperty(value = "办公地址 ", example = "广从一路5号柏曼酒店3楼")
private String workAddress;
@ApiModelProperty(value = "企业简写 ", example = " 例:YLZYCS(YL:优领简写;ZY:版本;CS:账户公司简称)")
private String codes;
@ApiModelProperty(value = "企业LOGO ", example = "企业LOGO")
private String logoUrl;
@ApiModelProperty(value = "行业类型 1:农、林、牧、渔业、2:采矿业、3:制造业、4:电力、燃气及水的生产和供应业、5:建筑业、6:交通运输、仓储和邮政业、7:信息传输、计算机服务和软件业、8:批发和零售业、9:住宿和餐饮业、10:金融业、11:房地产业、12:租赁和商务服务业、13:科学研究、技术服务和地质勘查业、14:水利、环境和公共设施管理业、15:居民服务和其他服务业", example = "101")
private Integer industryType;
@ApiModelProperty(value = "开通渠道 1直属、2总代理、3独家代理、4一般代理商、5区域代理商 ", example = "101")
private Integer openChannel;
@ApiModelProperty(value = "联系人", example = "刘德华")
private String linkMan;
@ApiModelProperty(value = "联系人电话 ", example = "18712345678")
private String linkManPhone;
@ApiModelProperty(value = "统一社会信用代码 ", example = "统一社会信用代码")
private String creditCode;
@ApiModelProperty(value = "是否上市 0:否 1:是", example = "101")
private Integer isOnStock;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value="企业注册时间 ",example="企业注册时间")
private Date registerTime;
@ApiModelProperty(value="营业执照 ",example="营业执照url ")
private String licenseUrl;
@ApiModelProperty(value="认证状态 ",example="0未认证,1 认证中,2认证成功,3认证失败 ")
private Integer attestStatus;
@ApiModelProperty(value="认证时间 ",example="2019-12-12 08:00:00")
private Date attestTime;
@ApiModelProperty(value="认证通过时间 ",example="2019-12-12 08:00:00")
private Date attestPassTime;
@ApiModelProperty(value="到期时间 ",example="2039-12-12 08:00:00")
@ApiModelProperty(value = "企业注册时间 ", example = "企业注册时间")
private Date registerTime;
@ApiModelProperty(value = "营业执照 ", example = "营业执照url ")
private String licenseUrl;
@ApiModelProperty(value = "认证状态 ", example = "0未认证,1 认证中,2认证成功,3认证失败 ")
private Integer attestStatus;
@ApiModelProperty(value = "认证时间 ", example = "2019-12-12 08:00:00")
private Date attestTime;
@ApiModelProperty(value = "认证通过时间 ", example = "2019-12-12 08:00:00")
private Date attestPassTime;
@ApiModelProperty(value = "到期时间 ", example = "2039-12-12 08:00:00")
private Date endTime;
@ApiModelProperty(value="企业版本,0试用,1标准,2专业, ",example="0")
private Integer level;
@ApiModelProperty(value = "企业版本,0试用,1标准,2专业, ", example = "0")
private Integer level;
}
\ No newline at end of file
......@@ -531,7 +531,7 @@ public class LoginController {
// 员工企业关联表 // 主账号权限
QyzxEmpEntAsso qyzxEmpEntAsso = QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(qyzxEntInfoM.getId())
.maxNum(10).status(1).userType(SysRoleType.U_TYPE_ADMIN.getType()).build();
.status(1).userType(SysRoleType.U_TYPE_ADMIN.getType()).build();
boolean b3 = qyzxEmpEntAsso.insert();
if (!b3) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
......
......@@ -8,37 +8,27 @@
package cn.timer.api.controller.qyzx;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections4.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.timer.api.aspect.lang.annotation.Log;
import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.auth.QyzxAuthAccount;
import cn.timer.api.bean.qyzx.auth.QyzxAuthChild;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enums.SysRoleType;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api;
......@@ -61,6 +51,9 @@ import io.swagger.annotations.ApiOperation;
@Api(tags = "4.5企业中心(账号权限(新))")
@RequestMapping(value = "/Auth", produces = { "application/json" })
public class Auth {
// TODO
// @Value("${}")
// private Integer maxNum = 10;
private QyzxEmpEntAsso selectMain(Integer orgCode, Integer empNum) {
return QyzxEmpEntAsso.builder().build()
......@@ -69,7 +62,6 @@ public class Auth {
.eq(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_ADMIN.getType()));
}
@Transactional
@PostMapping(value = "/addChildAccount")
@ApiOperation(value = "新增子账号", httpMethod = "POST", notes = "接口发布说明")
@Log(title = "新增-子账号", businessType = BusinessType.INSERT)
......@@ -77,35 +69,33 @@ public class Auth {
Integer orgCode = userBean.getOrgCode();
Integer empNum = userBean.getEmpNum();
QyzxEmpEntAsso qyzxEmpEntAsso = selectMain(orgCode, empNum);
System.err.println(qyzxEmpEntAsso);
if (qyzxEmpEntAsso != null) {
if (QyzxEmpEntAsso.builder().build()
.selectCount(new LambdaQueryWrapper<QyzxEmpEntAsso>().eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.eq(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_C_ADMIN.getType())) >= qyzxEmpEntAsso
.getMaxNum())
return ResultUtil.error("子账号数量超过上限");
if (QyzxEmpEntAsso.builder().empNum(childEmpNum).orgCode(orgCode)
.userType(SysRoleType.U_TYPE_C_ADMIN.getType()).build().insert())
// if ()
// return ResultUtil.error("子账号数量超过上限");
if (QyzxEmpEntAsso.builder().userType(SysRoleType.U_TYPE_C_ADMIN.getType()).build()
.update(new LambdaQueryWrapper<QyzxEmpEntAsso>().eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.eq(QyzxEmpEntAsso::getEmpNum, childEmpNum)))
return ResultUtil.success("添加成功");
}
return ResultUtil.error("暂无添加权限");
}
@Transactional
@DeleteMapping(value = "/delChildAccount/{childEmpNum}")
@ApiOperation(value = "删除子账号", httpMethod = "DELETE", notes = "接口发布说明")
@Log(title = "删除-子账号", businessType = BusinessType.DELETE)
public Result<String> delChildAccount(@CurrentUser UserBean userBean, @PathVariable Integer childEmpNum) {
@PostMapping(value = "/removeChildAccount")
@ApiOperation(value = "移除子账号", httpMethod = "POST", notes = "接口发布说明")
@Log(title = "移除-子账号", businessType = BusinessType.INSERT)
public Result<QyzxAuthChild> removeChildAccount(@CurrentUser UserBean userBean, @RequestParam Integer childEmpNum) {
Integer orgCode = userBean.getOrgCode();
Integer empNum = userBean.getEmpNum();
if (selectMain(orgCode, empNum) != null) {
if (QyzxEmpEntAsso.builder().build()
.delete(new LambdaQueryWrapper<QyzxEmpEntAsso>().eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.eq(QyzxEmpEntAsso::getEmpNum, childEmpNum)
.eq(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_C_ADMIN.getType())))
return ResultUtil.success("删除成功");
QyzxEmpEntAsso qyzxEmpEntAsso = selectMain(orgCode, empNum);
if (qyzxEmpEntAsso != null) {
// if ()
// return ResultUtil.error("子账号数量超过上限");
if (QyzxEmpEntAsso.builder().userType(SysRoleType.U_TYPE_EMP.getType()).build()
.update(new LambdaQueryWrapper<QyzxEmpEntAsso>().eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.eq(QyzxEmpEntAsso::getEmpNum, childEmpNum)))
return ResultUtil.success("添加成功");
}
return ResultUtil.error("暂无删除权限");
return ResultUtil.error("暂无操作权限");
}
// @PostMapping(value = "/modifyMaxChild")
......
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