Commit 49b3823e by 邓实川

Crm客户管理

parent 36cc889f
/**
* <p>Title: IndustryClass.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
package cn.timer.api.bean.clazz;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
* Title: IndustryClass.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
public class IndustryClass extends Model<IndustryClass> {
private static final long serialVersionUID = -5008126674106880292L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "主键", example = "1")
private Integer id;
@ApiModelProperty(value = "行业名", example = "行业")
private String name;
}
/**
* Title: CrmBusinessGroup.java
* Description:
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
package cn.timer.api.bean.crm;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
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;
/**
* Title: CrmBusinessGroup.java
*
* @Description:
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "crm_business_group")
@ApiModel("业务组表")
public class CrmBusinessGroup extends Model<CrmBusinessGroup> {
private static final long serialVersionUID = -6502869518965155561L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
@ApiModelProperty(value = "公司内排序")
private Integer sort;
@ApiModelProperty(value = "业务组名称")
private String name;
@ApiModelProperty(value = "业务组管理员empNum")
private Integer manager;
@ApiModelProperty(value = "业务组管理员名称")
private String managerName;
// @ApiModelProperty(value = "回收规则id")
// private Integer ruleId;
@ApiModelProperty(value = "添加客户之后(one)天没有跟进 (以跟进记录为准)")
private Integer one;
@ApiModelProperty(value = "距上次跟进(two)天没有再次跟进 (以跟进记录为准)")
private Integer two;
@ApiModelProperty(value = "添加客户之后(three)天没有成交 (天数必须大于规则1)")
private Integer three;
@ApiModelProperty(value = "系统提前(four)天自动提醒业务员客户将被回收")
private Integer four;
@ApiModelProperty(value = "我的客户数量最多(five)人(合作中的不算)")
private Integer five;
@ApiModelProperty(value = "创建时间")
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "创建人")
private Integer createUser;
@ApiModelProperty(value = "修改时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date modifyTime;
@ApiModelProperty(value = "修改人")
private Integer modifyUser;
@ApiModelProperty(value = "企业id")
private Integer orgCode;
@Transient
@TableField(exist = false)
private Integer[] ids;
// @ApiModelProperty(value = "组成员empNum(字符串,分割)",example = "1,2,3")
// private String member;
//
// @ApiModelProperty(value = "组成员姓名")
// private String memberName;
}
/**
* Title: CrmBusinessGroupMember.java
* Description:
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
package cn.timer.api.bean.crm;
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;
/**
* Title: CrmBusinessGroupMember.java
* @Description:
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "crm_business_group_member")
@ApiModel("业务组成员表")
public class CrmBusinessGroupMember extends Model<CrmBusinessGroupMember>{
private static final long serialVersionUID = 3513845730484806330L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
@ApiModelProperty(value = "组id")
private Integer gid;
@ApiModelProperty(value = "员工id")
private Integer empNum;
}
/**
* <p>Title: CrmClientData.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
package cn.timer.api.bean.crm;
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: CrmClientContacts.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "crm_client_contacts")
@ApiModel("客户联系人表")
public class CrmClientContacts extends Model<CrmClientContacts>{
private static final long serialVersionUID = 7527532835555744270L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
@ApiModelProperty(value = "客户数据表id")
private Integer cid;
@ApiModelProperty(value = "联系人姓名")
private String name;
@ApiModelProperty(value = "性别 0-女 1-男")
private Integer gender;
@ApiModelProperty(value = "职位")
private String position;
@ApiModelProperty(value = "座机")
private String telephone;
@ApiModelProperty(value = "手机")
private String cellphone;
@ApiModelProperty(value = "客户邮箱")
private String email;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "企业id")
private Integer orgCode;
}
/**
* <p>Title: CrmClientData.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
package cn.timer.api.bean.crm;
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: CrmClientData.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "crm_client_data")
@ApiModel("客户数据表")
public class CrmClientData extends Model<CrmClientData>{
private static final long serialVersionUID = -5368056704790782780L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
@ApiModelProperty(value = "客户姓名")
private String clientName;
@ApiModelProperty(value = "客户手机号")
private String clientCellphone;
@ApiModelProperty(value = "客户座机")
private String clientTelephone;
@ApiModelProperty(value = "客户官网")
private String clientUrl;
@ApiModelProperty(value = "行业id(字典表)")
private Integer industry;
@ApiModelProperty(value = "行业名")
private String industryName;
@ApiModelProperty(value = "客户邮箱")
private String clientEmail;
@ApiModelProperty(value = "省")
private String province;
@ApiModelProperty(value = "市")
private String city;
@ApiModelProperty(value = "区")
private String district;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "邮编")
private String zipCode;
@ApiModelProperty(value = "客户类型")
private String clientType;
@ApiModelProperty(value = "客户来源")
private String clientSource;
@ApiModelProperty(value = "备注")
private String remarks;
@ApiModelProperty(value = "客户所属(创建人empNum)")
private Integer belongUser;
@ApiModelProperty(value = "客户所属人姓名")
private String belongUserName;
@ApiModelProperty(value = "协作人empNum")
private Integer associatesUser;
@ApiModelProperty(value = "协作人姓名")
private String associatesName;
@ApiModelProperty(value = "附件地址")
private String fileUrl;
@ApiModelProperty(value = "创建时间")
private Date createdTime;
@ApiModelProperty(value = "企业id")
private Integer orgCode;
}
/**
* Title: CrmSeaRule.java
* Description:
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
package cn.timer.api.bean.crm;
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;
/**
* Title: CrmSeaRule.java
*
* @Description:
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "crm_sea_rule")
@ApiModel("公海规则对应表")
public class CrmSeaRule extends Model<CrmSeaRule> {
private static final long serialVersionUID = 4427752422137750653L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
@ApiModelProperty(value = "组id")
private Integer gid;
@ApiModelProperty(value = "添加客户之后(one)天没有跟进 (以跟进记录为准)")
private Integer one;
@ApiModelProperty(value = "距上次跟进(two)天没有再次跟进 (以跟进记录为准)")
private Integer two;
@ApiModelProperty(value = "添加客户之后(three)天没有成交 (天数必须大于规则1)")
private Integer three;
@ApiModelProperty(value = "系统提前(four)天自动提醒业务员客户将被回收")
private Integer four;
@ApiModelProperty(value = "我的客户数量最多(five)人(合作中的不算)")
private Integer five;
}
......@@ -18,6 +18,8 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
log.info("start insert fill ....");
Date date = new Date();
this.strictInsertFill(metaObject, "createTime", Date.class, date); // 起始版本 3.3.0(推荐使用)
this.strictInsertFill(metaObject, "createdTime", Date.class, date); // 起始版本 3.3.0(推荐使用)
this.strictInsertFill(metaObject, "modifyTime", Date.class, date); // 起始版本 3.3.0(推荐使用)
this.strictInsertFill(metaObject, "lrsjTime", Date.class, date);
this.strictInsertFill(metaObject, "regTime", Date.class, date);
this.strictInsertFill(metaObject, "registerTime", Date.class, date);
......
......@@ -498,24 +498,26 @@ public class LoginController {
.operName(username).endTime(DateUtil.offsetDay(new Date(), offset))
.level(CommonEnum.LEVEL_PROBATION.getType()).build();
boolean b1 = qyzxEntInfoM.insert();
Integer qyId = qyzxEntInfoM.getId();
if (!b1) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultUtil.error("注册企业失败1");
}
if (login == null) {
System.err.println("kanxia");
// 员工信息
QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().phone(phone).pw(Md5.md5(pw))
.sts(CommonEnum.U_STS_ON.getType()).orgId(qyzxEntInfoM.getId()).regTime(DateUtil.date())
.sts(CommonEnum.U_STS_ON.getType()).orgId(qyId).regTime(DateUtil.date())
.build();
boolean b2 = qyzxEmpLogin.insert();
if (!b2) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultUtil.error("注册企业失败2");
}
login = qyzxEmpLogin;
}
boolean b4 = YgglMainEmp.builder().orgCode(qyzxEntInfoM.getId()).empNum(login.getId()).rzTime(new Date())
boolean b4 = YgglMainEmp.builder().orgCode(qyId).empNum(login.getId()).rzTime(new Date())
.isManager(SysRoleType.U_TYPE_ADMIN.getType()).name(username).phone(phone)
.jobType(YgJobType.QUANZHI.getType()).jobStatus(YgEnumInterface.jobStatus.ZHENSHI.getType()).build()
.insert();
......@@ -592,7 +594,6 @@ public class LoginController {
return ResultUtil.error("没有任何公司可以查看!");
qyzxEmpLogin1.setQys(qys);
QysDto ctrl = qys.get(0);
if (qyzxEmpLogin1.getOrgId() != null) {
......@@ -603,9 +604,8 @@ public class LoginController {
}
}
YgglMainEmp userInfo = ygglMainEmpMapper.selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.select(YgglMainEmp::getName,YgglMainEmp::getPhone,YgglMainEmp::getBmgwId)
.select(YgglMainEmp::getName, YgglMainEmp::getPhone, YgglMainEmp::getBmgwId)
.eq(YgglMainEmp::getEmpNum, qyzxEmpLogin1.getId())
.eq(YgglMainEmp::getOrgCode, qyzxEmpLogin1.getOrgId()));
if (userInfo == null) {
......
/**
* Title: CrmController.java
* Description:
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
package cn.timer.api.controller.crm;
import java.util.Date;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.timer.api.bean.crm.CrmBusinessGroup;
import cn.timer.api.bean.crm.CrmBusinessGroupMember;
import cn.timer.api.bean.crm.CrmClientData;
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.utils.Result;
import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* Title: CrmController.java
*
* @Description:
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
@RestController
@Api(tags = "6.1客户管理")
@Transactional
@RequestMapping(value = "/crm", produces = { "application/json" })
public class CrmController {
private Integer getEmpNum(UserBean userBean) {
return userBean.getEmpNum();
}
private Integer getOrgCode(UserBean userBean) {
return userBean.getOrgCode();
}
@PostMapping("addClient")
@ApiOperation(value = "新增客户", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> addClient(@CurrentUser UserBean userBean, @RequestBody CrmClientData crmClientData) {
crmClientData.setBelongUser(getEmpNum(userBean));
crmClientData.setOrgCode(getOrgCode(userBean));
crmClientData.setCreatedTime(new Date());
return null;
}
@PostMapping("addBusinessGroup")
@Transactional
@ApiOperation(value = "新增业务组", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> addBusinessGroup(@CurrentUser UserBean userBean,
@RequestBody CrmBusinessGroup crmBusinessGroup) {
Integer orgCode = getOrgCode(userBean);
Integer empNum = getEmpNum(userBean);
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getEmpNum, crmBusinessGroup.getManager()).select(YgglMainEmp::getName));
if (ygglMainEmp == null)
return ResultUtil.error("请确认添加的管理员是否存在");
String name = ygglMainEmp.getName();
CrmBusinessGroup crmBusinessGroupOld = CrmBusinessGroup.builder().build()
.selectOne(new QueryWrapper<CrmBusinessGroup>().lambda().eq(CrmBusinessGroup::getOrgCode, orgCode)
.select(CrmBusinessGroup::getSort).last("limit 1").orderByDesc(CrmBusinessGroup::getId));
if (crmBusinessGroupOld == null)
crmBusinessGroup.setSort(1);
else
crmBusinessGroup.setSort(crmBusinessGroupOld.getSort() + 1);// 排序
crmBusinessGroup.setManagerName(name); // 设置管理员姓名
crmBusinessGroup.setCreateUser(empNum); // 创建人
crmBusinessGroup.setModifyUser(empNum); // 修改人
crmBusinessGroup.setOrgCode(orgCode);
// crmBusinessGroup.setMember(member); // ,字符串拼接
boolean result = crmBusinessGroup.insert();
if (!result)
return ResultUtil.success("保存失败");
Integer gid = crmBusinessGroup.getId();
Integer[] ids = crmBusinessGroup.getIds();
for (Integer empId : ids) {
CrmBusinessGroupMember.builder().gid(gid).empNum(empId).build().insert();
}
return ResultUtil.success("保存成功");
}
@GetMapping("getBusinessGroup")
@ApiOperation(value = "获取业务组列表", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> getBusinessGroup(@CurrentUser UserBean userBean) {
return ResultUtil.data(CrmBusinessGroup.builder().build().selectList(
new QueryWrapper<CrmBusinessGroup>().lambda().eq(CrmBusinessGroup::getOrgCode, getOrgCode(userBean))),
"获取成功");
}
// TODO
}
......@@ -239,7 +239,12 @@ public class YgglController {
break;
case 1:
String[] strs = IdcardUtil.isValidCard10(zjNum);
isvalid = "澳门/香港".contains(strs[0]) && "true".equals(strs[2]);
if (strs == null) {
isvalid = false;
break;
}
String str2 = strs != null && strs.length > 2 ? strs[2] : "false";
isvalid = "澳门/香港".contains(strs[0]) && "true".equals(str2);
break;
case 2:
isvalid = IdcardUtil.isValidTWCard(zjNum);
......
/**
* Title: CrmBusinessGroupMapper.java
* Description:
* @author dsc
* @date 2020年6月6日
* @version 1.0
*/
package cn.timer.api.dao.crm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.crm.CrmBusinessGroup;
/**
* Title: CrmBusinessGroupMapper.java
*
* @Description:
* @author dsc
* @date 2020年6月6日
* @version 1.0
*/
public interface CrmBusinessGroupMapper extends BaseMapper<CrmBusinessGroup> {
}
/**
* Title: CrmBusinessGroupMemberMapper.java
* Description:
* @author dsc
* @date 2020年6月6日
* @version 1.0
*/
package cn.timer.api.dao.crm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.crm.CrmBusinessGroupMember;
/**
* Title: CrmBusinessGroupMemberMapper.java
*
* @Description:
* @author dsc
* @date 2020年6月6日
* @version 1.0
*/
public interface CrmBusinessGroupMemberMapper extends BaseMapper<CrmBusinessGroupMember> {
}
/**
* <p>Title: CrmClientContactsMapper.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
package cn.timer.api.dao.crm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.crm.CrmClientContacts;
/**
* <p>
* Title: CrmClientContactsMapper.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
public interface CrmClientContactsMapper extends BaseMapper<CrmClientContacts> {
}
/**
* <p>Title: CrmClientDataMapper.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
package cn.timer.api.dao.crm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.crm.CrmClientData;
/**
* Title: CrmClientDataMapper.java
* Description:
*
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
public interface CrmClientDataMapper extends BaseMapper<CrmClientData> {
}
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