Commit 062dc7a0 by 邓实川 Committed by chenzg

客户管理权限设置更新

parent e4bc58f8
......@@ -7,24 +7,6 @@
*/
package cn.timer.api.bean.qyzx.auth;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p>
* Title: QyzxAuthAccount.java
......@@ -38,42 +20,42 @@ import lombok.NoArgsConstructor;
* @version 1.0
*/
@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "qyzx_auth_account")
@ApiModel("权限账号表")
public class QyzxAuthAccount extends Model<QyzxAuthAccount> {
private static final long serialVersionUID = -7906463769401403202L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "主键", example = "1")
private Integer id;
@ApiModelProperty(value = "员工id", example = "9688")
private Integer empNum;
@ApiModelProperty(value = "企业id", example = "117")
private Integer orgCode;
@ApiModelProperty(value = "头像url", example = "ossUrl")
private String headUrl;
@ApiModelProperty(value = "姓名", example = "tz")
private String name;
@ApiModelProperty(value = "主账号手机", example = "18711519125")
private String accountPhone;
@ApiModelProperty(value = "子账号最大数量", example = "10")
private Integer maxChildAccount;
@ApiModelProperty(value = "创建时间", example = "2020-05-20")
private Date createdTime;
}
//@Entity
//@Data
//@Builder
//@AllArgsConstructor
//@NoArgsConstructor
//@Table(name = "qyzx_auth_account")
//@ApiModel("权限账号表")
//public class QyzxAuthAccount extends Model<QyzxAuthAccount> {
//
// private static final long serialVersionUID = -7906463769401403202L;
//
// @Id
// @GeneratedValue
// @TableId(type = IdType.AUTO)
// @ApiModelProperty(value = "主键", example = "1")
// private Integer id;
//
// @ApiModelProperty(value = "员工id", example = "9688")
// private Integer empNum;
//
// @ApiModelProperty(value = "企业id", example = "117")
// private Integer orgCode;
//
// @ApiModelProperty(value = "头像url", example = "ossUrl")
// private String headUrl;
//
// @ApiModelProperty(value = "姓名", example = "tz")
// private String name;
//
// @ApiModelProperty(value = "主账号手机", example = "18711519125")
// private String accountPhone;
//
// @ApiModelProperty(value = "子账号最大数量", example = "10")
// private Integer maxChildAccount;
//
// @ApiModelProperty(value = "创建时间", example = "2020-05-20")
// private Date createdTime;
//
//}
......@@ -7,26 +7,6 @@
*/
package cn.timer.api.bean.qyzx.auth;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p>
* Title: QyzxAuthChild.java
......@@ -39,47 +19,47 @@ import lombok.NoArgsConstructor;
* @date 2020年5月19日
* @version 1.0
*/
@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "qyzx_auth_child")
@ApiModel("权限子账号表")
public class QyzxAuthChild extends Model<QyzxAuthChild> {
private static final long serialVersionUID = 3202868427965301934L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "主键", example = "1")
private Integer id;
@ApiModelProperty(value = "员工id", example = "9688")
private Integer empNum;
@ApiModelProperty(value = "企业id", example = "117")
private Integer orgCode;
@ApiModelProperty(value = "是否启用", example = "0-否 1-是")
private Integer isOpen;
@ApiModelProperty(value = "是否删除", example = "0-否 1-是")
private Integer isDel;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间", example = "2020-05-20")
private Date createdTime;
@ApiModelProperty(value = "创建人id", example = "9688")
private Integer createdUser;
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value = "修改时间", example = "2020-05-20")
private Date modifiedTime;
@ApiModelProperty(value = "修改人id", example = "9688")
private Integer modifiedUser;
}
//@Entity
//@Data
//@Builder
//@AllArgsConstructor
//@NoArgsConstructor
//@Table(name = "qyzx_auth_child")
//@ApiModel("权限子账号表")
//public class QyzxAuthChild extends Model<QyzxAuthChild> {
//
// private static final long serialVersionUID = 3202868427965301934L;
//
// @Id
// @GeneratedValue
// @TableId(type = IdType.AUTO)
// @ApiModelProperty(value = "主键", example = "1")
// private Integer id;
//
// @ApiModelProperty(value = "员工id", example = "9688")
// private Integer empNum;
//
// @ApiModelProperty(value = "企业id", example = "117")
// private Integer orgCode;
//
// @ApiModelProperty(value = "是否启用", example = "0-否 1-是")
// private Integer isOpen;
//
// @ApiModelProperty(value = "是否删除", example = "0-否 1-是")
// private Integer isDel;
//
// @TableField(fill = FieldFill.INSERT)
// @ApiModelProperty(value = "创建时间", example = "2020-05-20")
// private Date createdTime;
//
// @ApiModelProperty(value = "创建人id", example = "9688")
// private Integer createdUser;
//
// @TableField(fill = FieldFill.INSERT_UPDATE)
// @ApiModelProperty(value = "修改时间", example = "2020-05-20")
// private Date modifiedTime;
//
// @ApiModelProperty(value = "修改人id", example = "9688")
// private Integer modifiedUser;
//
//}
/**
* Title: CrmController.java
* Description:
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
package cn.timer.api.controller.crm;
import java.io.IOException;
......@@ -49,9 +42,11 @@ import cn.timer.api.bean.crm.CrmClientContacts;
import cn.timer.api.bean.crm.CrmClientData;
import cn.timer.api.bean.crm.CrmClientFollow;
import cn.timer.api.bean.crm.CrmSeaRule;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
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.crm.CrmClientContactsMapper;
import cn.timer.api.dao.crm.CrmClientDataMapper;
import cn.timer.api.dto.crm.CrmClientDataImportVo;
......@@ -221,10 +216,16 @@ public class CrmController {
Integer nowEmpNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean);
YgglMainEmp yg = YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
.eq(YgglMainEmp::getEmpNum, nowEmpNum).select(YgglMainEmp::getIsManager));
if (yg != null && yg.getIsManager() != null && (yg.getIsManager() == 1 || yg.getIsManager() == 2)) {
// YgglMainEmp yg = YgglMainEmp.builder().build()
// .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
// .eq(YgglMainEmp::getEmpNum, nowEmpNum).select(YgglMainEmp::getIsManager));
// TODO
QyzxEmpEntAsso qyzxEmpEntAsso = QyzxEmpEntAsso.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxEmpEntAsso>().eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.eq(QyzxEmpEntAsso::getEmpNum, nowEmpNum));
if (qyzxEmpEntAsso != null && qyzxEmpEntAsso.getUserType() != null
&& (qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_ADMIN.getType()
|| qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_C_ADMIN.getType())) {
List<CrmBusinessGroup> list = CrmBusinessGroup.builder().build()
.selectList(new QueryWrapper<CrmBusinessGroup>().lambda()
......@@ -284,10 +285,16 @@ public class CrmController {
Integer nowEmpNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean);
YgglMainEmp yg = YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
.eq(YgglMainEmp::getEmpNum, nowEmpNum).select(YgglMainEmp::getIsManager));
if (yg != null && yg.getIsManager() != null && (yg.getIsManager() == 1 || yg.getIsManager() == 2)) {
// YgglMainEmp yg = YgglMainEmp.builder().build()
// .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
// .eq(YgglMainEmp::getEmpNum, nowEmpNum).select(YgglMainEmp::getIsManager));
// if (yg != null && yg.getIsManager() != null && (yg.getIsManager() == 1 || yg.getIsManager() == 2)) {
QyzxEmpEntAsso qyzxEmpEntAsso = QyzxEmpEntAsso.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxEmpEntAsso>().eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.eq(QyzxEmpEntAsso::getEmpNum, nowEmpNum));
if (qyzxEmpEntAsso != null && qyzxEmpEntAsso.getUserType() != null
&& (qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_ADMIN.getType()
|| qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_C_ADMIN.getType())) {
List<CrmBusinessGroup> list = CrmBusinessGroup.builder().build()
.selectList(new LambdaQueryWrapper<CrmBusinessGroup>().eq(CrmBusinessGroup::getOrgCode, orgCode)
.select(CrmBusinessGroup::getName, CrmBusinessGroup::getId));
......@@ -574,11 +581,17 @@ public class CrmController {
Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean);
YgglMainEmp yg = YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
.eq(YgglMainEmp::getEmpNum, empNum).select(YgglMainEmp::getIsManager));
if (yg != null && yg.getIsManager() != null && (yg.getIsManager() == 1 || yg.getIsManager() == 2)) {
// YgglMainEmp yg = YgglMainEmp.builder().build()
// .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
// .eq(YgglMainEmp::getEmpNum, empNum).select(YgglMainEmp::getIsManager));
// if (yg != null && yg.getIsManager() != null && (yg.getIsManager() == 1 || yg.getIsManager() == 2)) {
QyzxEmpEntAsso qyzxEmpEntAsso = QyzxEmpEntAsso.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxEmpEntAsso>().eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.eq(QyzxEmpEntAsso::getEmpNum, empNum));
if (qyzxEmpEntAsso != null && qyzxEmpEntAsso.getUserType() != null
&& (qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_ADMIN.getType()
|| qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_C_ADMIN.getType())) {
List<CrmClientData> list = CrmClientData.builder().build()
.selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(CrmClientData::getBelongUser, 0)
......@@ -627,10 +640,17 @@ public class CrmController {
Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean);
YgglMainEmp yg = YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
.eq(YgglMainEmp::getEmpNum, empNum).select(YgglMainEmp::getIsManager));
if (yg != null && yg.getIsManager() != null && (yg.getIsManager() == 1 || yg.getIsManager() == 2)) {
// YgglMainEmp yg = YgglMainEmp.builder().build()
// .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
// .eq(YgglMainEmp::getEmpNum, empNum).select(YgglMainEmp::getIsManager));
// if (yg != null && yg.getIsManager() != null && (yg.getIsManager() == 1 || yg.getIsManager() == 2)) {
QyzxEmpEntAsso qyzxEmpEntAsso = QyzxEmpEntAsso.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxEmpEntAsso>().eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.eq(QyzxEmpEntAsso::getEmpNum, empNum));
if (qyzxEmpEntAsso != null && qyzxEmpEntAsso.getUserType() != null
&& (qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_ADMIN.getType()
|| qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_C_ADMIN.getType())) {
List<CrmClientData> datas = CrmClientData.builder().build()
.selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
......
......@@ -13,6 +13,7 @@ import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -25,7 +26,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.QyzxAuthChild;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
......@@ -53,9 +53,8 @@ import io.swagger.annotations.ApiOperation;
@Api(tags = "4.5企业中心(账号权限(新))")
@RequestMapping(value = "/Auth", produces = { "application/json" })
public class Auth {
// TODO
// @Value("${}")
// private Integer maxNum = 10;
@Value("${config-8timer.register-childAccount-max-num}")
private Integer maxNum;
private QyzxEmpEntAsso selectMain(Integer orgCode, Integer empNum) {
return QyzxEmpEntAsso.builder().build()
......@@ -67,13 +66,16 @@ public class Auth {
@PostMapping(value = "/addChildAccount")
@ApiOperation(value = "新增子账号", httpMethod = "POST", notes = "接口发布说明")
@Log(title = "新增-子账号", businessType = BusinessType.INSERT)
public Result<QyzxAuthChild> addChildAccount(@CurrentUser UserBean userBean, @RequestParam Integer childEmpNum) {
public Result<Void> addChildAccount(@CurrentUser UserBean userBean, @RequestParam Integer childEmpNum) {
Integer orgCode = userBean.getOrgCode();
Integer empNum = userBean.getEmpNum();
QyzxEmpEntAsso qyzxEmpEntAsso = selectMain(orgCode, empNum);
if (qyzxEmpEntAsso != null) {
// if ()
// return ResultUtil.error("子账号数量超过上限");
Integer num = QyzxEmpEntAsso.builder().build()
.selectCount(new LambdaQueryWrapper<QyzxEmpEntAsso>().eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.eq(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_C_ADMIN.getType()));
if (num >= maxNum)
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)))
......@@ -85,13 +87,11 @@ public class Auth {
@PostMapping(value = "/removeChildAccount")
@ApiOperation(value = "移除子账号", httpMethod = "POST", notes = "接口发布说明")
@Log(title = "移除-子账号", businessType = BusinessType.INSERT)
public Result<QyzxAuthChild> removeChildAccount(@CurrentUser UserBean userBean, @RequestParam Integer childEmpNum) {
public Result<Void> removeChildAccount(@CurrentUser UserBean userBean, @RequestParam Integer childEmpNum) {
Integer orgCode = userBean.getOrgCode();
Integer empNum = userBean.getEmpNum();
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)))
......
......@@ -7,20 +7,20 @@
*/
package cn.timer.api.dao.qyzx.auth;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.qyzx.auth.QyzxAuthAccount;
/**
* <p>Title: QyzxAuthChildMapper.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年5月19日
* @version 1.0
*/
@Repository
public interface QyzxAuthAccountMapper extends BaseMapper<QyzxAuthAccount>{
}
//import org.springframework.stereotype.Repository;
//
//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//
//import cn.timer.api.bean.qyzx.auth.QyzxAuthAccount;
//
///**
//* <p>Title: QyzxAuthChildMapper.java</p>
//* <p>Description: </p>
//* @author dsc
//* @date 2020年5月19日
//* @version 1.0
//*/
//@Repository
//public interface QyzxAuthAccountMapper extends BaseMapper<QyzxAuthAccount>{
//
//}
......@@ -7,20 +7,20 @@
*/
package cn.timer.api.dao.qyzx.auth;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.qyzx.auth.QyzxAuthChild;
/**
* <p>Title: QyzxAuthChildMapper.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年5月19日
* @version 1.0
*/
@Repository
public interface QyzxAuthChildMapper extends BaseMapper<QyzxAuthChild>{
}
//import org.springframework.stereotype.Repository;
//
//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//
//import cn.timer.api.bean.qyzx.auth.QyzxAuthChild;
//
///**
//* <p>Title: QyzxAuthChildMapper.java</p>
//* <p>Description: </p>
//* @author dsc
//* @date 2020年5月19日
//* @version 1.0
//*/
//@Repository
//public interface QyzxAuthChildMapper extends BaseMapper<QyzxAuthChild>{
//
//}
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