Commit 00462547 by lal

Merge branch 'develop' of develop-gitlab.youlingrc.com:8timerv2/8timerapiv200 into lal

parents ad2105de 5cbb7c39
/**
* <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.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p>
* Title: CilentSourceClass.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("客户来源字典表(1.0)")
public class ClientSourceClass extends Model<ClientSourceClass> {
private static final long serialVersionUID = 2504935692833727870L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "主键", example = "1")
private Integer id;
@ApiModelProperty(value = "来源名", example = "行业")
private String name;
@ApiModelProperty(value = "企业id", example = "企业")
private Integer orgCode;
}
/**
* <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.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p>
* Title: CilentTypeClass.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("客户类型字典表(1.0)")
public class ClientTypeClass extends Model<ClientTypeClass> {
private static final long serialVersionUID = 4910747953236931117L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "主键", example = "1")
private Integer id;
@ApiModelProperty(value = "类型名", example = "行业")
private String name;
@ApiModelProperty(value = "企业id", example = "企业")
private Integer orgCode;
}
/**
* <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.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p>
* Title: IndustryClass.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("行业字典表(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;
@ApiModelProperty(value = "企业id", example = "企业")
private Integer orgCode;
}
......@@ -52,7 +52,7 @@ public class SysRegion extends Model<SysRegion>{
private String regionName;
@ApiModelProperty(value = "区域编码", example = "1")
private String regionCode;
private Integer regionCode;
@ApiModelProperty(value = "地名简称", example = "1")
private String simpleName;
......
/**
* Title: CrmBusinessGroup.java
* Description:
* @author dsc
* @date 2020年6月5日
* @version 1.0
*/
package cn.timer.api.bean.crm;
import java.util.Date;
import java.util.List;
import java.util.Map;
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 = "创建时间")
@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)
@ApiModelProperty(value = "组管理员信息")
private List<Map<String, Object>> managers;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "组管理员id")
private Integer[] managerIds;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "组管理员信息")
private List<Map<String, Object>> members;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "组成员id")
private Integer[] memberIds;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "回收规则")
private CrmSeaRule crmSeaRules;
// @ApiModelProperty(value = "组成员empNum(字符串,分割)",example = "1,2,3")
// private String member;
//
// @ApiModelProperty(value = "组成员姓名")
// private String memberName;
// @ApiModelProperty(value = "业务组管理员empNum")
// private Integer manager;
//
// @ApiModelProperty(value = "业务组管理员名称")
// private String managerName;
}
/**
* 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;
@ApiModelProperty(value = "0-普通成员 1-管理员")
private Integer type;
@ApiModelProperty(value = "企业id")
private Integer orgCode;
}
/**
* Title: CrmClientAssociates.java
* Description:
* @author dsc
* @date 2020年6月8日
* @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: CrmClientAssociates.java
*
* @Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "crm_client_associate")
@ApiModel("客户协作人表")
public class CrmClientAssociate extends Model<CrmClientAssociate> {
private static final long serialVersionUID = 6199712192983127587L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
@ApiModelProperty(value = "客户数据id")
private Integer cid;
@ApiModelProperty(value = "协作人id")
private Integer associateId;
@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 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 = "公司")
private String company;
@ApiModelProperty(value = "备注")
private String remark;
// @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 java.util.List;
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;
/**
* <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 = "省id")
private Integer provinceId;
@ApiModelProperty(value = "市")
private String city;
@ApiModelProperty(value = "市")
private Integer cityId;
@ApiModelProperty(value = "区")
private String district;
@ApiModelProperty(value = "区编号")
private Integer districtId;
@ApiModelProperty(value = "邮编")
private String zipCode;
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "客户类型id")
private Integer clientType;
@ApiModelProperty(value = "客户类型名")
private String clientTypeName;
@ApiModelProperty(value = "客户来源id")
private Integer clientSource;
@ApiModelProperty(value = "客户来源名")
private String clientSourceName;
@ApiModelProperty(value = "备注")
private String remarks;
@ApiModelProperty(value = "客户所属(创建人empNum) 0-进入客户公海")
private Integer belongUser;
@ApiModelProperty(value = "客户所属人姓名")
private String belongUserName;
@ApiModelProperty(value = "客户所属业务组id")
private Integer belongGroup;
@ApiModelProperty(value = "客户所属业务组名")
private String belongGroupName;
@ApiModelProperty(value = "客户数据状态 0-无 1-潜在 2-意向 3-签约 4-合作中 5-已封档")
private Integer clientStatus;
@ApiModelProperty(value = "附件地址")
private String fileUrl;
@ApiModelProperty(value = "客户联系人数量")
private Integer contactsNum;
@ApiModelProperty(value = "收藏关注 0-否 1-是")
private Integer star;
@ApiModelProperty(value = "创建人")
private Integer createUser;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "修改人")
private Integer modifyUser;
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value = "修改时间")
private Date modifyTime;
@ApiModelProperty(value = "最近跟进时间")
private Date lastFollowTime;
@ApiModelProperty(value = "企业id")
private Integer orgCode;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "协作人id")
private Integer[] ids;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "客户联系人数据列表")
private List<CrmClientContacts> CrmClientContacts;
}
/**
* Title: CrmClientFollow.java
* Description:
* @author dsc
* @date 2020年6月8日
* @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.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: CrmClientFollow.java
*
* @Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "crm_client_follow")
@ApiModel("客户数据跟进表")
public class CrmClientFollow extends Model<CrmClientFollow> {
private static final long serialVersionUID = -7362549097557018582L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
@ApiModelProperty(value = "客户数据id")
private Integer cid;
@ApiModelProperty(value = "跟进内容")
private Integer content;
@ApiModelProperty(value = "客户数据状态 0-无 1-潜在 2-意向 3-签约 4-合作中 5-已封档")
private String clientStatus;
@ApiModelProperty(value = "联系人姓名")
private String name;
@ApiModelProperty(value = "联系人公司")
private String company;
@ApiModelProperty(value = "联系人职位")
private String position;
@ApiModelProperty(value = "联系人手机号")
private String cellphone;
@ApiModelProperty(value = "创建人")
private Integer createUser;
@ApiModelProperty(value = "企业id")
private Integer orgCode;
@ApiModelProperty(value = "创建人姓名")
private String createUserName;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间")
private Date createTime;
}
/**
* 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.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
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 com.baomidou.mybatisplus.core.toolkit.StringUtils;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.timer.api.bean.clazz.ClientSourceClass;
import cn.timer.api.bean.clazz.ClientTypeClass;
import cn.timer.api.bean.clazz.IndustryClass;
import cn.timer.api.bean.clazz.SysRegion;
import cn.timer.api.bean.crm.CrmBusinessGroup;
import cn.timer.api.bean.crm.CrmBusinessGroupMember;
import cn.timer.api.bean.crm.CrmClientAssociate;
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.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dao.crm.CrmClientDataMapper;
import cn.timer.api.utils.CheckUtil;
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 {
@Autowired
private CrmClientDataMapper crmClientDataMapper;
private Integer getEmpNum(UserBean userBean) {
return userBean.getEmpNum();
}
private Integer getOrgCode(UserBean userBean) {
return userBean.getOrgCode();
}
private YgglMainEmp getYg(Integer orgCode, Integer empNum) {
return YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, empNum)
.eq(YgglMainEmp::getOrgCode, orgCode).select(YgglMainEmp::getName, YgglMainEmp::getHeadUrl));
}
private String getEmpName(Integer orgCode, Integer empNum) {
return getYg(orgCode, empNum).getName();
}
@GetMapping("getIndustry")
@ApiOperation(value = "获取行业列表", httpMethod = "GET", notes = "接口发布说明")
public Result<List<IndustryClass>> getIndustry(@CurrentUser UserBean userBean) {
return ResultUtil.data(IndustryClass.builder().build().selectAll());
}
@GetMapping("getClientType")
@ApiOperation(value = "获取客户类型", httpMethod = "GET", notes = "接口发布说明")
public Result<List<ClientTypeClass>> getClientType(@CurrentUser UserBean userBean) {
return ResultUtil.data(ClientTypeClass.builder().build().selectAll());
}
@GetMapping("getClientSource")
@ApiOperation(value = "获取客户来源", httpMethod = "GET", notes = "接口发布说明")
public Result<List<ClientSourceClass>> getClientSource(@CurrentUser UserBean userBean) {
return ResultUtil.data(ClientSourceClass.builder().build().selectAll());
}
@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);
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(getEmpName(orgCode, empNum)); // 设置管理员姓名
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[] memberIds = crmBusinessGroup.getMemberIds();
for (Integer empId : memberIds) {
CrmBusinessGroupMember.builder().gid(gid).empNum(empId).orgCode(orgCode).type(0).build().insert();
}
Integer[] managerIds = crmBusinessGroup.getManagerIds();
for (Integer empId : managerIds) {
CrmBusinessGroupMember.builder().gid(gid).empNum(empId).orgCode(orgCode).type(1).build().insert();
}
CrmSeaRule crmSeaRule = crmBusinessGroup.getCrmSeaRules();
crmSeaRule.setGid(gid);
crmSeaRule.insert();
return ResultUtil.success("新增业务组成功");
}
@GetMapping("getBusinessGroup")
@ApiOperation(value = "获取业务组列表", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getBusinessGroup(@CurrentUser UserBean userBean) {
List<CrmBusinessGroup> list = CrmBusinessGroup.builder().build()
.selectList(new QueryWrapper<CrmBusinessGroup>().lambda()
.eq(CrmBusinessGroup::getOrgCode, getOrgCode(userBean)).select(CrmBusinessGroup::getId,
CrmBusinessGroup::getSort, CrmBusinessGroup::getName, CrmBusinessGroup::getModifyTime));
for (CrmBusinessGroup crmBusinessGroup : list) {
Integer gid = crmBusinessGroup.getId();
List<CrmBusinessGroupMember> crmBusinessGroupManagers = CrmBusinessGroupMember.builder().build().selectList(
new QueryWrapper<CrmBusinessGroupMember>().lambda().eq(CrmBusinessGroupMember::getGid, gid)
.eq(CrmBusinessGroupMember::getType, 1).select(CrmBusinessGroupMember::getEmpNum));
List<CrmBusinessGroupMember> crmBusinessGroupMembers = CrmBusinessGroupMember.builder().build().selectList(
new QueryWrapper<CrmBusinessGroupMember>().lambda().eq(CrmBusinessGroupMember::getGid, gid)
.eq(CrmBusinessGroupMember::getType, 0).select(CrmBusinessGroupMember::getEmpNum));
List<Map<String, Object>> managers = new ArrayList<Map<String, Object>>();
for (CrmBusinessGroupMember crmBusinessGroupManager : crmBusinessGroupManagers) {
Integer empNum = crmBusinessGroupManager.getEmpNum();
String name = getEmpName(getOrgCode(userBean), empNum);
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", name);
managers.add(map);
}
crmBusinessGroup.setManagers(managers);
List<Map<String, Object>> members = new ArrayList<Map<String, Object>>();
for (CrmBusinessGroupMember crmBusinessGroupManager : crmBusinessGroupMembers) {
Integer empNum = crmBusinessGroupManager.getEmpNum();
String name = getEmpName(getOrgCode(userBean), empNum);
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", name);
members.add(map);
}
crmBusinessGroup.setMembers(members);
CrmSeaRule crmSeaRules = CrmSeaRule.builder().build()
.selectOne(new QueryWrapper<CrmSeaRule>().lambda().eq(CrmSeaRule::getGid, gid));
crmBusinessGroup.setCrmSeaRules(crmSeaRules);
}
return ResultUtil.data(list, "获取成功");
}
// @GetMapping("getBusinessGroupMembers")
// @ApiOperation(value = "获取业务组列表成员", httpMethod = "GET", notes = "接口发布说明")
// public Result<Object> getBusinessGroupMembers(@CurrentUser UserBean userBean, @RequestParam Integer gid) {
// List<CrmBusinessGroupMember> crmBusinessGroupMembers = CrmBusinessGroupMember.builder().build()
// .selectList(new QueryWrapper<CrmBusinessGroupMember>().lambda().eq(CrmBusinessGroupMember::getGid, gid)
// .eq(CrmBusinessGroupMember::getType, 0));
// List<YgglMainEmp> ygglMainEmps = new ArrayList<YgglMainEmp>();
// for (CrmBusinessGroupMember crmBusinessGroupMember : crmBusinessGroupMembers) {
// ygglMainEmps.add(getYg(getOrgCode(userBean), crmBusinessGroupMember.getEmpNum()));
// }
// List<CrmBusinessGroupMember> crmBusinessGroupManagers = CrmBusinessGroupMember.builder().build()
// .selectList(new QueryWrapper<CrmBusinessGroupMember>().lambda().eq(CrmBusinessGroupMember::getGid, gid)
// .eq(CrmBusinessGroupMember::getType, 1));
// List<YgglMainEmp> ygglMainEmps2 = new ArrayList<YgglMainEmp>();
// for (CrmBusinessGroupMember crmBusinessGroupManager : crmBusinessGroupManagers) {
// ygglMainEmps2.add(getYg(getOrgCode(userBean), crmBusinessGroupManager.getEmpNum()));
// }
// return ResultUtil.datas(ygglMainEmps2,ygglMainEmps, "获取成功");
// }
// @GetMapping("getBusinessGroupRules") // TODO 扫描规则进行回收操作
// @ApiOperation(value = "获取业务组公海规则", httpMethod = "GET", notes = "接口发布说明")
// public Result<Object> getBusinessGroupRules(@RequestParam Integer gid) {
// List<CrmSeaRule> crmSeaRules = CrmSeaRule.builder().build()
// .selectList(new QueryWrapper<CrmSeaRule>().lambda().eq(CrmSeaRule::getGid, gid));
// return ResultUtil.data(crmSeaRules, "获取成功");
// }
private SysRegion getSysRegion(Integer keyId) {
return SysRegion.builder().build()
.selectOne(new QueryWrapper<SysRegion>().lambda().eq(SysRegion::getKeyId, keyId).select(
SysRegion::getRegionName, SysRegion::getKeyId, SysRegion::getZipCode,
SysRegion::getRegionCode));
}
@PostMapping("addClient")
@Transactional
@ApiOperation(value = "新增客户", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> addClient(@CurrentUser UserBean userBean, @RequestBody CrmClientData crmClientData) {
Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean);
crmClientData.setCreateUser(empNum);
SysRegion district = getSysRegion(crmClientData.getDistrictId());
// crmClientData.setZipCode(district.getZipCode());
crmClientData.setDistrict(district.getRegionName());
SysRegion city = getSysRegion(district.getRegionCode());
crmClientData.setCity(city.getRegionName());
crmClientData.setCityId(city.getKeyId());
SysRegion province = getSysRegion(city.getRegionCode());
crmClientData.setProvinceId(province.getKeyId());
crmClientData.setProvince(province.getRegionName());
crmClientData.setBelongUserName(getEmpName(orgCode, crmClientData.getBelongUser()));
crmClientData.setOrgCode(getOrgCode(userBean));
Integer belongGroup = crmClientData.getBelongGroup();
String belongGroupName = CrmBusinessGroup.builder().id(belongGroup).build().selectById().getName();
crmClientData.setBelongGroupName(belongGroupName);
String clientSourceName = ClientSourceClass.builder().id(crmClientData.getClientSource()).build().selectById()
.getName(); // 客户来源
String clientTypeName = ClientTypeClass.builder().id(crmClientData.getClientType()).build().selectById()
.getName(); // 客户类型
String industryName = IndustryClass.builder().id(crmClientData.getIndustry()).build().selectById().getName();// 行业名
crmClientData.setClientSourceName(clientSourceName);
crmClientData.setClientTypeName(clientTypeName);
crmClientData.setIndustryName(industryName);
if (!crmClientData.insert())
return ResultUtil.error("新增失败");
Integer crmDataId = crmClientData.getId();
Integer[] ids = crmClientData.getIds();
for (Integer id : ids) {
CrmClientAssociate.builder().cid(crmDataId).associateId(id).orgCode(getOrgCode(userBean)).build().insert();
}
List<CrmClientContacts> crmClientContacts = crmClientData.getCrmClientContacts();
for (CrmClientContacts crmClientContact : crmClientContacts) {
crmClientContact.setCid(crmDataId);
crmClientContact.insert();
}
crmClientData.setContactsNum(crmClientContacts.size());
crmClientData.updateById();
return ResultUtil.success("新增成功");
}
@PostMapping("editClient")
@Transactional
@ApiOperation(value = "编辑客户", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> editClient(@CurrentUser UserBean userBean, @RequestBody CrmClientData crmClientData) {
Integer cid = crmClientData.getId();
if (cid == null)
return ResultUtil.error("请传入id再试");
CrmClientData oldData = CrmClientData.builder().id(cid).build().selectById();
if (oldData == null)
return ResultUtil.error("请确认该客户数据是否存在");
if (oldData.getClientStatus() == 5)
return ResultUtil.error("请解封后继续编辑操作");
List<CrmClientContacts> crmClientContacts = crmClientData.getCrmClientContacts();
for (CrmClientContacts crmClientContact : crmClientContacts) {
crmClientContact.updateById();
}
List<CrmClientAssociate> oldAssociates = CrmClientAssociate.builder().build()
.selectList(new QueryWrapper<CrmClientAssociate>().lambda().eq(CrmClientAssociate::getCid, cid));
List<Integer> oldIdsList = oldAssociates.stream().map(CrmClientAssociate::getAssociateId)
.collect(Collectors.toList()); // 旧协助人list
Integer[] ids = crmClientData.getIds();
List<Integer> newIdsList = CollUtil.newArrayList(ids); // 新协助人list
List<Integer> delList = CheckUtil.reduce(oldIdsList, newIdsList); // 要删的协助人
for (Integer id : delList) {
CrmClientAssociate.builder().build().delete(new QueryWrapper<CrmClientAssociate>().lambda()
.eq(CrmClientAssociate::getCid, cid).eq(CrmClientAssociate::getAssociateId, id));
}
List<Integer> addList = CheckUtil.reduce(newIdsList, oldIdsList); // 要加的协助人
for (Integer id : addList) {
CrmClientAssociate.builder().cid(cid).associateId(id).build().insert();
}
crmClientData.setModifyUser(getEmpNum(userBean));
if (crmClientData.updateById())
return ResultUtil.success("编辑成功");
return ResultUtil.error("编辑失败");
}
@GetMapping("getClientAssociate")
@ApiOperation(value = "获取协作人列表", httpMethod = "GET", notes = "接口发布说明")
public Result<List<Map<String, Object>>> getClientAssociate(@CurrentUser UserBean userBean,
@RequestParam Integer cid) {
List<CrmClientAssociate> crmClientAssociates = CrmClientAssociate.builder().build()
.selectList(new QueryWrapper<CrmClientAssociate>().lambda().eq(CrmClientAssociate::getCid, cid));
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
for (CrmClientAssociate crmClientAssociate : crmClientAssociates) {
Integer orgCode = crmClientAssociate.getOrgCode();
Integer empNum = crmClientAssociate.getAssociateId();
YgglMainEmp ygglMainEmp = getYg(orgCode, empNum);
String name = ygglMainEmp.getName();
String headUrl = ygglMainEmp.getHeadUrl();
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", name);
map.put("empNum", empNum);
map.put("headUrl", headUrl);
list.add(map);
}
return ResultUtil.data(list, "获取成功");
}
// 归属我的客户
private List<CrmClientData> getMyCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status,
String like) {
return CrmClientData.builder().build()
.selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(CrmClientData::getBelongUser, empNum)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like)
.orderByDesc(CrmClientData::getCreateTime));
}
// 我协作的客户
private List<CrmClientData> getMyAssociateCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status,
String like) {
List<CrmClientAssociate> crmClientAssociates = CrmClientAssociate.builder().build().selectList(
new QueryWrapper<CrmClientAssociate>().lambda().eq(CrmClientAssociate::getAssociateId, empNum)
.eq(CrmClientAssociate::getOrgCode, orgCode).select(CrmClientAssociate::getCid));
List<CrmClientData> myCrmClientAssociates = new ArrayList<CrmClientData>();
for (CrmClientAssociate crmClientAssociate : crmClientAssociates) {
Integer cid = crmClientAssociate.getCid();
CrmClientData crmClientData = CrmClientData.builder().build()
.selectOne(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getId, cid)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like));
myCrmClientAssociates.add(crmClientData);
}
return myCrmClientAssociates;
}
// 我的全部客户
private List<CrmClientData> getMyTotalCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status,
String like) {
return CheckUtil.distinct(getMyCilent(empNum, orgCode, groupId, status, like),
getMyAssociateCilent(empNum, orgCode, groupId, status, like), true);
}
// 我关注的客户
private List<CrmClientData> getMyStarCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status) {
return getMyTotalCilent(empNum, orgCode, groupId, status, null).stream()
.filter(item -> item.getStar().equals(1)).collect(Collectors.toList());
}
// 七天未跟进的客户
private List<CrmClientData> getCilentFollowOvertime(Integer empNum, Integer orgCode, Integer groupId,
Integer status) {
return getMyTotalCilent(empNum, orgCode, groupId, status, null).stream()
.filter(item -> item.getLastFollowTime() != null
&& item.getLastFollowTime().before(DateUtil.offsetDay(new Date(), -7)))
.collect(Collectors.toList());
}
@GetMapping("getMyCilentTotal")
@ApiOperation(value = "获取我的客户列表(全)", httpMethod = "GET", notes = "接口发布说明")
public Result<List<CrmClientData>> getMyCilentTotal(@CurrentUser UserBean userBean,
@RequestParam(required = false, defaultValue = "0") Integer type,
@RequestParam(required = false) Integer groupId, @RequestParam(required = false) Integer status,
@RequestParam(required = false) String like) {
Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean);
List<CrmClientData> crmClientDatas = null;
if (type == null || type == 0) // 全部客户(去重)
crmClientDatas = CheckUtil.distinct(getMyCilent(empNum, orgCode, groupId, status, like),
getMyAssociateCilent(empNum, orgCode, groupId, status, like), true);
else if (type == 1) // 我负责的客户
crmClientDatas = getMyCilent(empNum, orgCode, groupId, status, like);
else if (type == 2) // 我协作的客户
crmClientDatas = getMyAssociateCilent(empNum, orgCode, groupId, status, like);
else if (type == 3) // 我关注的客户
crmClientDatas = getMyStarCilent(empNum, orgCode, groupId, status);
else if (type == 4) // 七天未跟进的客户
crmClientDatas = getCilentFollowOvertime(empNum, orgCode, groupId, status);
else
return ResultUtil.error("查询失败");
Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序
return ResultUtil.data(crmClientDatas, "查询成功");
}
private List<Integer> MyJoinGroup(Integer empNum, Integer orgCode) {
List<CrmBusinessGroupMember> members = CrmBusinessGroupMember.builder().build()
.selectList(new QueryWrapper<CrmBusinessGroupMember>().lambda()
.eq(CrmBusinessGroupMember::getEmpNum, empNum).eq(CrmBusinessGroupMember::getOrgCode, orgCode));
return members.stream().map(CrmBusinessGroupMember::getGid).collect(Collectors.toList());
}
private List<Integer> MyManageGroup(Integer empNum, Integer orgCode) {
List<CrmBusinessGroupMember> managers = CrmBusinessGroupMember.builder().build()
.selectList(new QueryWrapper<CrmBusinessGroupMember>().lambda()
.eq(CrmBusinessGroupMember::getEmpNum, empNum).eq(CrmBusinessGroupMember::getOrgCode, orgCode)
.eq(CrmBusinessGroupMember::getType, 1));
return managers.stream().map(CrmBusinessGroupMember::getGid).collect(Collectors.toList());
}
@GetMapping("getSeaCilentTotal")
@ApiOperation(value = "获取公海客户列表(全)", httpMethod = "GET", notes = "接口发布说明")
public Result<List<CrmClientData>> getSeaCilentTotal(@CurrentUser UserBean userBean,
@RequestParam(required = false) Integer type, @RequestParam(required = false) Integer groupId,
@RequestParam(required = false) Integer status, @RequestParam(required = false) String like) {
Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean);
// 当前用户加入的组
List<Integer> gids1 = MyJoinGroup(empNum, orgCode);
// 当前用户管理的组
List<Integer> gids2 = MyManageGroup(empNum, orgCode);
List<Integer> myGids = CheckUtil.distinct(gids1, gids2, true); // 当前用户所有业务组id
List<CrmClientData> crmClientDatas = new ArrayList<CrmClientData>();
for (Integer gid : myGids) {
List<CrmClientData> datas = CrmClientData.builder().build()
.selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getBelongGroup, gid)
.eq(CrmClientData::getBelongUser, 0)
.eq(type != null && type >= 0, CrmClientData::getClientType, type)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like));
for (CrmClientData data : datas)
crmClientDatas.add(data);
}
return ResultUtil.data(crmClientDatas, "查询成功");
}
@GetMapping("getAllCilentTotal")
@ApiOperation(value = "获取所有客户列表(全)", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getAllCilentTotal(@CurrentUser UserBean userBean,
@RequestParam(required = false) Integer type, @RequestParam(required = false) Integer groupId,
@RequestParam(required = false) Integer status, @RequestParam(required = false) String like,
@RequestParam(required = false) String startCreateTime,
@RequestParam(required = false) String endCreateTime,
@RequestParam(required = false) String startFollowTime,
@RequestParam(required = false) String endFollowTime) {
Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean);
// 当前用户管理的组
List<Integer> gids = MyManageGroup(empNum, orgCode);
List<Object> crmClientDatas = new ArrayList<Object>();
for (Integer gid : gids) {
List<CrmClientData> datas = CrmClientData.builder().build()
.selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getBelongGroup, gid)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(type != null && type >= 0, CrmClientData::getClientType, type)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)
.ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getCreateTime, startFollowTime)
.le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getCreateTime, endFollowTime)
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like));
for (CrmClientData data : datas)
crmClientDatas.add(data);
}
return ResultUtil.data(crmClientDatas, "查询成功");
}
@PostMapping("addCilentLinkMan")
@Transactional
@ApiOperation(value = "新增/编辑客户联系人", httpMethod = "POST", notes = "接口发布说明")
public Result<Void> addCilentLinkMan(@CurrentUser UserBean userBean, CrmClientContacts crmClientContacts) {
if (crmClientContacts.getId() == null) {
Integer num = CrmClientData.builder().build().selectById().getContactsNum();
CrmClientData.builder().id(crmClientContacts.getCid()).contactsNum(++num).build().updateById();
}
if (crmClientContacts.insertOrUpdate())
return ResultUtil.success("新增/编辑成功");
return ResultUtil.success("新增/编辑失败");
}
@DeleteMapping("delCilentLinkMan")
@Transactional
@ApiOperation(value = "删除客户联系人", httpMethod = "DELETE", notes = "接口发布说明")
public Result<Void> delCilentLinkMan(@CurrentUser UserBean userBean, CrmClientContacts crmClientContacts) {
Integer num = CrmClientData.builder().build().selectById().getContactsNum();
CrmClientData.builder().id(crmClientContacts.getCid()).contactsNum(--num).build().updateById();
if (crmClientContacts.deleteById())
return ResultUtil.success("删除成功");
return ResultUtil.success("删除失败");
}
@GetMapping("getCilentLinkMan")
@ApiOperation(value = "获取客户联系人列表", httpMethod = "GET", notes = "接口发布说明")
public Result<List<CrmClientContacts>> getCilentLinkMan(@CurrentUser UserBean userBean, Integer cid) {
return ResultUtil.data(CrmClientContacts.builder().build()
.selectList(new QueryWrapper<CrmClientContacts>().lambda().eq(CrmClientContacts::getCid, cid)), "获取成功");
}
@PostMapping("addOrCancelClientStar")
@ApiOperation(value = "新增客户收藏/取消收藏(仅归属人)", httpMethod = "POST", notes = "接口发布说明")
public Result<Void> addOrCancelClientStar(@CurrentUser UserBean userBean, @RequestParam Integer cid) {
Integer empNum = getEmpNum(userBean);
CrmClientData crmClientData = CrmClientData.builder().id(cid).build().selectById();
if (crmClientData == null)
return ResultUtil.error("请确认该客户是否存在");
if (!crmClientData.getBelongUser().equals(empNum))
return ResultUtil.error("不是当前客户归属人");
Integer star = crmClientData.getStar();
if (star == null || star == 0) {
crmClientData.setStar(1);
crmClientData.updateById();
return ResultUtil.success("收藏成功");
} else if (star == 1) {
crmClientData.setStar(0);
crmClientData.updateById();
return ResultUtil.success("取消收藏成功");
} else
return ResultUtil.error("失败");
}
@PostMapping("addClientFollow")
@Transactional
@ApiOperation(value = "新增跟进记录", httpMethod = "POST", notes = "接口发布说明")
public Result<Void> addClientFollow(@CurrentUser UserBean userBean, @RequestBody CrmClientFollow crmClientFollow) {
Integer cid = crmClientFollow.getCid();
if (cid == null)
return ResultUtil.error("请传入id再试");
CrmClientData oldData = CrmClientData.builder().id(cid).build().selectById();
if (oldData == null)
return ResultUtil.error("请确认该客户数据是否存在");
if (oldData.getClientStatus() == 5)
return ResultUtil.error("请解封后继续编辑操作");
Integer orgCode = getOrgCode(userBean);
Integer empNum = getEmpNum(userBean);
CrmClientData.builder().id(crmClientFollow.getCid()).lastFollowTime(new Date()).build().updateById(); // 更新客户最近跟进时间
crmClientFollow.setOrgCode(orgCode);
crmClientFollow.setCreateUserName(getEmpName(orgCode, empNum));
if (crmClientFollow.insert())
return ResultUtil.success("新增成功");
return ResultUtil.error("新增失败");
}
@GetMapping("getCilentFollow")
@ApiOperation(value = "获取跟进记录", httpMethod = "GET", notes = "接口发布说明")
public Result<List<CrmClientFollow>> getCilentFollow(@CurrentUser UserBean userBean, @RequestParam Integer cid) {
Integer orgCode = getOrgCode(userBean);
return ResultUtil.data(CrmClientFollow.builder().build().selectList(new QueryWrapper<CrmClientFollow>().lambda()
.eq(CrmClientFollow::getOrgCode, orgCode).eq(CrmClientFollow::getCid, cid)), "获取成功");
}
// 根据组id和员工号查询组管理员
private CrmBusinessGroupMember getGroupManager(Integer groupId, Integer empNum) {
return CrmBusinessGroupMember.builder().build().selectOne(
new QueryWrapper<CrmBusinessGroupMember>().lambda().eq(CrmBusinessGroupMember::getGid, groupId)
.eq(CrmBusinessGroupMember::getEmpNum, empNum).eq(CrmBusinessGroupMember::getType, 1));
}
@PostMapping("addClientArchive")
@ApiOperation(value = "客户封档/解封", httpMethod = "POST", notes = "接口发布说明")
public Result<Void> addClientArchive(@CurrentUser UserBean userBean, @RequestParam Integer cid) {
Integer empNum = getEmpNum(userBean);
CrmClientData crmClientData = CrmClientData.builder().id(cid).build().selectById();
if (crmClientData == null)
return ResultUtil.error("请确认该客户是否存在");
if (!crmClientData.getBelongUser().equals(empNum)
&& getGroupManager(crmClientData.getBelongGroup(), empNum) == null)
return ResultUtil.error("不是当前客户归属人或组管理员");
Integer status = crmClientData.getClientStatus();
if (status != null && status != 5) {
crmClientData.setClientStatus(5);
crmClientData.updateById();
return ResultUtil.success("封档成功");
} else if (status == 5) {
crmClientData.setClientStatus(0); // 解封后默认无状态
crmClientData.updateById();
return ResultUtil.success("解封成功");
} else
return ResultUtil.error("失败");
}
@PostMapping("designateClientBelonger")
@ApiOperation(value = "指派客户归属人", httpMethod = "POST", notes = "接口发布说明")
public Result<Void> designateClientBelonger(@CurrentUser UserBean userBean, @RequestParam Integer cid,
@RequestParam Integer belongUser) {
Integer empNum = getEmpNum(userBean);
if (cid == null)
return ResultUtil.error("请传入id再试");
CrmClientData oldData = CrmClientData.builder().id(cid).build().selectById();
if (oldData == null)
return ResultUtil.error("请确认该客户数据是否存在");
if (!oldData.getBelongUser().equals(empNum) && getGroupManager(oldData.getBelongGroup(), empNum) == null)
return ResultUtil.error("不是当前客户归属人或组管理员");
if (oldData.getClientStatus() == 5)
return ResultUtil.error("请解封后继续编辑操作");
Integer belongGroup = oldData.getBelongGroup();
CrmBusinessGroupMember crmBusinessGroupMember = CrmBusinessGroupMember.builder().build()
.selectOne(new QueryWrapper<CrmBusinessGroupMember>().lambda()
.eq(CrmBusinessGroupMember::getGid, belongGroup)
.eq(CrmBusinessGroupMember::getEmpNum, belongUser));
if (crmBusinessGroupMember == null)
return ResultUtil.error("指派失败,该用户不是本组成员");
if (CrmClientData.builder().id(cid).belongUser(belongUser)
.belongUserName(getEmpName(getOrgCode(userBean), belongUser)).build().updateById())
return ResultUtil.success("指派成功");
return ResultUtil.error("指派失败");
}
@PostMapping("freeClientToSea")
@Transactional
@ApiOperation(value = "释放客户到公海", httpMethod = "POST", notes = "接口发布说明")
public Result<Void> freeClientToSea(@CurrentUser UserBean userBean, @RequestParam Integer cid) {
Integer empNum = getEmpNum(userBean);
if (cid == null)
return ResultUtil.error("请传入id再试");
CrmClientData oldData = CrmClientData.builder().id(cid).build().selectById();
if (oldData == null)
return ResultUtil.error("请确认该客户数据是否存在");
if (oldData.getBelongUser() == 0)
return ResultUtil.error("该客户已在公海列表");
if ((!oldData.getOrgCode().equals(getOrgCode(userBean)) || !oldData.getBelongUser().equals(empNum))
&& getGroupManager(oldData.getBelongGroup(), empNum) == null)
return ResultUtil.error("不是当前客户归属人或组管理员");
if (oldData.getClientStatus() == 5)
return ResultUtil.error("请解封后继续编辑操作");
oldData.setBelongUser(0); // 0-进入客户公海
oldData.setBelongUserName(null);
// 删除协作人列表
CrmClientAssociate.builder().build()
.delete(new QueryWrapper<CrmClientAssociate>().lambda().eq(CrmClientAssociate::getCid, cid));
if (oldData.updateById())
return ResultUtil.success("释放成功");
return ResultUtil.error("释放失败");
}
@PostMapping("receiveSeaClient")
@ApiOperation(value = "接收公海客户", httpMethod = "POST", notes = "接口发布说明")
public Result<Void> receiveSeaClient(@CurrentUser UserBean userBean, @RequestParam Integer cid) {
Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean);
if (cid == null)
return ResultUtil.error("请传入id再试");
CrmClientData oldData = CrmClientData.builder().id(cid).build().selectById();
if (oldData == null)
return ResultUtil.error("请确认该客户数据是否存在");
// 当前用户所有组id
List<Integer> myGids = CheckUtil.distinct(MyJoinGroup(empNum, orgCode), MyManageGroup(empNum, orgCode), true);
if (!myGids.contains(oldData.getBelongGroup()))
return ResultUtil.error("不是当前业务组成员");
oldData.setBelongUser(empNum);
oldData.setBelongUserName(getEmpName(orgCode, empNum));
if (oldData.updateById())
return ResultUtil.success("接收成功");
return ResultUtil.error("接收失败");
}
@Transactional
@PostMapping("designateClientBelongers")
@ApiOperation(value = "转移客户归属人(批量客户)", httpMethod = "POST", notes = "接口发布说明")
public Result<Void> designateClientBelongers(@CurrentUser UserBean userBean, @RequestParam List<Integer> cids,
@RequestParam Integer belonger) {
// 所选的客户列表
List<CrmClientData> crmClientDatas = crmClientDataMapper.selectBatchIds(cids);
// 业务组id列表
List<Integer> gids = crmClientDatas.stream().map(CrmClientData::getBelongGroup).collect(Collectors.toList());
Integer gid = gids.get(0);
// 当前操作人是否管理员
CrmBusinessGroupMember nowManager = CrmBusinessGroupMember.builder().build()
.selectOne(new QueryWrapper<CrmBusinessGroupMember>().lambda().eq(CrmBusinessGroupMember::getGid, gid)
.eq(CrmBusinessGroupMember::getEmpNum, getEmpNum(userBean))
.eq(CrmBusinessGroupMember::getType, 1));
if (nowManager == null)
return ResultUtil.error("没有操作权限,请联系组管理员进行操作");
// 是否有不同组的客户
if (gids.stream().distinct().count() > 1)
return ResultUtil.error("请确认是否同一业务组客户");
// 转移人业务组信息
CrmBusinessGroupMember crmBusinessGroupMember = CrmBusinessGroupMember.builder().build()
.selectOne(new QueryWrapper<CrmBusinessGroupMember>().lambda().eq(CrmBusinessGroupMember::getGid, gid)
.eq(CrmBusinessGroupMember::getEmpNum, belonger));
if (crmBusinessGroupMember == null)
return ResultUtil.error("请确认转移目标是当前业务组成员");
for (CrmClientData crmClientData : crmClientDatas) {
crmClientData.setBelongUser(belonger);
crmClientData.setBelongUserName(getEmpName(getOrgCode(userBean), belonger));
crmClientData.updateById();
}
return ResultUtil.success("转移成功");
}
/**
*
* @param userBean
* @param type 统计图类型(暂时不要)
* @param groupId 业务组id
* @param memberId 业务员id
* @param startCreateTime 创建时间-开始时间
* @param endCreateTime 创建时间-结束时间
* @return 对应客户数据count
*/
@GetMapping("getAllCartogram")
@ApiOperation(value = "获取统计图(全)", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getAllCartogram(@CurrentUser UserBean userBean,
@RequestParam(required = false) Integer groupId, @RequestParam(required = false) Integer belonger,
@RequestParam(required = false) String startCreateTime,
@RequestParam(required = false) String endCreateTime) {
Integer orgCode = getOrgCode(userBean);
List<Object> listAll = new ArrayList<Object>();
listAll.add(cartogram(orgCode, groupId, 1, belonger, startCreateTime, endCreateTime));// 图1
listAll.add(cartogram(orgCode, groupId, 2, belonger, startCreateTime, endCreateTime));// 图2
listAll.add(cartogram(orgCode, groupId, 3, belonger, startCreateTime, endCreateTime));// 图3
listAll.add(cartogram(orgCode, groupId, 4, belonger, startCreateTime, endCreateTime));// 图4
List<Map<String, Object>> cartogram5 = new ArrayList<Map<String, Object>>();// 图5
List<ClientTypeClass> typeClasses = ClientTypeClass.builder().build().selectAll();
for (ClientTypeClass clientTypeClass : typeClasses) {
Integer type = clientTypeClass.getId();
Map<String, Object> map = cartogram2(orgCode, groupId, type, belonger, startCreateTime, endCreateTime);
if ((Integer) map.get("num") > 0) {
cartogram5.add(map);
}
}
listAll.add(cartogram5);
List<Map<String, Object>> cartogram6 = new ArrayList<Map<String, Object>>(); // 图6
for (Integer keyId : getKeyIdList()) {
Map<String, Object> map = cartogram3(orgCode, groupId, keyId, belonger, startCreateTime, endCreateTime);
if ((Integer) map.get("num") > 0) {
cartogram6.add(map);
}
}
listAll.add(cartogram6);
return ResultUtil.data(listAll, "获取成功");
}
// 获取省份id
private List<Integer> getKeyIdList() {
List<SysRegion> list = SysRegion.builder().build()
.selectList(new LambdaQueryWrapper<SysRegion>().eq(SysRegion::getLevel, 1).select(SysRegion::getKeyId));
return list.stream().map(SysRegion::getKeyId).collect(Collectors.toList());
}
// 获取公司全部业务员
private List<Integer> getAllBusinessGroupMember(Integer orgCode, Integer groupId) {
List<CrmBusinessGroupMember> list = CrmBusinessGroupMember.builder().build()
.selectList(new QueryWrapper<CrmBusinessGroupMember>().lambda()
.eq(CrmBusinessGroupMember::getOrgCode, orgCode)
.eq(groupId != null && groupId >= 0, CrmBusinessGroupMember::getGid, groupId));
return list.stream().map(CrmBusinessGroupMember::getEmpNum).collect(Collectors.toList()).stream().distinct()
.collect(Collectors.toList());
// list.stream().filter(CheckUtil.distinctByKey(CrmBusinessGroupMember::getEmpNum)).collect(Collectors.toList());
}
// 封装条形图数据Map
private Map<String, Object> selectMap(Integer orgCode, Integer belonger, Integer status, String startCreateTime,
String endCreateTime) {
Map<String, Object> map = new HashMap<String, Object>();
Integer num = CrmClientData.builder().build()
.selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(CrmClientData::getClientStatus, status).eq(CrmClientData::getBelongUser, belonger)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime));
String name = getEmpName(orgCode, belonger);
map.put("name", name);
map.put("num", num);
return map;
}
/**
* 统计图1,2,3,4
*
* @param orgCode 企业id(必填)
* @param groupId 组id (可不填)
* @param status 分类 1 2 3 4 (必填)
* @param belonger 业务员id (可不填)
* @return
*/
private List<Map<String, Object>> cartogram(Integer orgCode, Integer groupId, Integer status, Integer belonger,
String startCreateTime, String endCreateTime) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
if (belonger == null) {
List<Integer> members = getAllBusinessGroupMember(orgCode, groupId);
for (Integer memberId : members) {
Map<String, Object> map = selectMap(orgCode, memberId, status, startCreateTime, endCreateTime);
if ((Integer) map.get("num") > 0) {
list.add(map);
}
}
} else {
Map<String, Object> map = selectMap(orgCode, belonger, status, startCreateTime, endCreateTime);
if ((Integer) map.get("num") > 0) {
list.add(map);
}
}
return list;
}
/**
* 统计图5
*
* @param orgCode 企业id(必填)
* @param groupId 组id (可不填)
* @param level 客户等级分类 (必填)
* @param belonger 业务员id (可不填)
* @return
*/
private Map<String, Object> cartogram2(Integer orgCode, Integer groupId, Integer level, Integer belonger,
String startCreateTime, String endCreateTime) {
Map<String, Object> map = new HashMap<String, Object>();
Integer num = 0;
if (belonger == null) {
List<Integer> members = getAllBusinessGroupMember(orgCode, groupId);
for (Integer memberId : members) {
num += CrmClientData.builder().build()
.selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(CrmClientData::getClientType, level).eq(CrmClientData::getBelongUser, memberId)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime,
startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime,
endCreateTime));
}
map.put("level", level);
String name = ClientTypeClass.builder().id(level).build().selectById().getName();
map.put("name", name);
map.put("num", num);
} else {
num = CrmClientData.builder().build()
.selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(CrmClientData::getClientType, level).eq(CrmClientData::getBelongUser, belonger)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime));
map.put("level", level);
String name = ClientTypeClass.builder().id(level).build().selectById().getName();
map.put("name", name);
map.put("num", num);
}
return map;
}
/**
* 统计图6
*
* @param orgCode 企业id(必填)
* @param groupId 组id (可不填)
* @param level 客户等级分类 (必填)
* @param belonger 业务员id (可不填)
* @return
*/
private Map<String, Object> cartogram3(Integer orgCode, Integer groupId, Integer provinceId, Integer belonger,
String startCreateTime, String endCreateTime) {
Map<String, Object> map = new HashMap<String, Object>();
Integer num = 0;
if (belonger == null) {
List<Integer> members = getAllBusinessGroupMember(orgCode, groupId);
for (Integer memberId : members) {
num += CrmClientData.builder().build()
.selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(CrmClientData::getProvinceId, provinceId).eq(CrmClientData::getBelongUser, memberId)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime,
startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime,
endCreateTime));
}
map.put("provinceId", provinceId);
String name = SysRegion.builder().build().selectOne(new QueryWrapper<SysRegion>().lambda()
.eq(SysRegion::getLevel, 1).eq(SysRegion::getKeyId, provinceId).select(SysRegion::getRegionName))
.getRegionName();
map.put("provinceName", name);
map.put("num", num);
} else {
num = CrmClientData.builder().build()
.selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(CrmClientData::getProvinceId, provinceId).eq(CrmClientData::getBelongUser, belonger)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime));
map.put("provinceId", provinceId);
String name = SysRegion.builder().build().selectOne(new QueryWrapper<SysRegion>().lambda()
.eq(SysRegion::getLevel, 1).eq(SysRegion::getKeyId, provinceId).select(SysRegion::getRegionName))
.getRegionName();
map.put("provinceName", name);
map.put("num", num);
}
return map;
}
}
......@@ -156,8 +156,7 @@ public class YgglController {
Integer empNum = userBean.getEmpNum();
Integer orgCode = userBean.getOrgCode();
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getOrgCode, orgCode)
.eq(YgglMainEmp::getEmpNum, empNum));
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum));
Date rz = ygglMainEmp.getRzTime();
if (rz != null) {
ygglMainEmp.setWorkTime(DateUtil.formatBetween(rz, new Date(), Level.DAY));
......@@ -172,8 +171,7 @@ public class YgglController {
public Result<YgglMainEmp> selectygda(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
Integer orgCode = userBean.getOrgCode();
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getOrgCode, orgCode)
.eq(YgglMainEmp::getEmpNum, empNum));
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum));
Date rz = ygglMainEmp.getRzTime();
if (rz != null) {
ygglMainEmp.setWorkTime(DateUtil.formatBetween(ygglMainEmp.getRzTime(), new Date(), Level.DAY));
......@@ -195,19 +193,16 @@ public class YgglController {
return ResultUtil.data("岗位不存在");
}
Integer orgCode = userBean.getOrgCode();
ZzglBmgwM zzglBmgwM = ZzglBmgwM.builder().build().selectOne(new QueryWrapper<ZzglBmgwM>().lambda()
.eq(ZzglBmgwM::getOrgCode, orgCode)
.eq(ZzglBmgwM::getId, gwid));
ZzglBmgwM zzglBmgwM = ZzglBmgwM.builder().build().selectOne(
new QueryWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getOrgCode, orgCode).eq(ZzglBmgwM::getId, gwid));
String gw = null;
Integer bmid = null;
if (zzglBmgwM != null) {
gw = zzglBmgwM.getName();
bmid = zzglBmgwM.getUpId();
}
ZzglBmgwM z = ZzglBmgwM.builder().build()
.selectOne(new QueryWrapper<ZzglBmgwM>().lambda()
.eq(ZzglBmgwM::getOrgCode, orgCode)
.eq(ZzglBmgwM::getId, bmid));
ZzglBmgwM z = ZzglBmgwM.builder().build().selectOne(
new QueryWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getOrgCode, orgCode).eq(ZzglBmgwM::getId, bmid));
String bm = null;
if (z != null) {
bm = z.getName();
......@@ -226,7 +221,8 @@ public class YgglController {
@PostMapping(value = "/addygda")
@ApiOperation(value = "4.添加员工档案", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 4)
public Result<Object> addygda(@CurrentUser UserBean userBean, @Validated @RequestBody AddygdaDto addygdaDto) throws Exception {
public Result<Object> addygda(@CurrentUser UserBean userBean, @Validated @RequestBody AddygdaDto addygdaDto)
throws Exception {
Integer orgCode = userBean.getOrgCode();
String name = addygdaDto.getName();
String phone = addygdaDto.getPhone();
......@@ -239,7 +235,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);
......@@ -276,15 +277,11 @@ public class YgglController {
.eq(YgglMainEmp::getPhone, phone).eq(YgglMainEmp::getOrgCode, orgCode));
if (ygglMainEmp == null) {
QyzxEmpEntAsso.builder()
.empNum(login.getId()).orgCode(orgCode).userType(SysRoleType.U_TYPE_EMP.getType()).status(CommonEnum.U_STS_ON.getType())
.build()
.insert();
ygglMainEmp = YgglMainEmp.builder()
.name(name).phone(phone).zjType(zjType).zjNum(zjNum).jobType(jobType)
.jobStatus(YgEnumInterface.jobStatus.SHIYONG.getType()).rzTime(rzTime)
.syq(syq).sex(sex).empNum(login.getId()).orgCode(orgCode).bmgwId(bmgwId)
.build();
QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(orgCode).userType(SysRoleType.U_TYPE_EMP.getType())
.status(CommonEnum.U_STS_ON.getType()).build().insert();
ygglMainEmp = YgglMainEmp.builder().name(name).phone(phone).zjType(zjType).zjNum(zjNum).jobType(jobType)
.jobStatus(YgEnumInterface.jobStatus.SHIYONG.getType()).rzTime(rzTime).syq(syq).sex(sex)
.empNum(login.getId()).orgCode(orgCode).bmgwId(bmgwId).build();
ygglMainEmp.insert();
return ResultUtil.data(ygglMainEmp, "添加员工成功!");
......@@ -306,15 +303,15 @@ public class YgglController {
public Result<Object> updateygda(@CurrentUser UserBean userBean, @RequestBody YgglMainEmp ygglMainEmp)
throws Exception {
if (ObjectUtil.isAllNotEmpty(ygglMainEmp.getRzTime(),ygglMainEmp.getZzTime()) &&
!DateFormatUtils.getCompareDate(ygglMainEmp.getRzTime(), ygglMainEmp.getZzTime())) {
if (ObjectUtil.isAllNotEmpty(ygglMainEmp.getRzTime(), ygglMainEmp.getZzTime())
&& !DateFormatUtils.getCompareDate(ygglMainEmp.getRzTime(), ygglMainEmp.getZzTime())) {
ResultUtil.error("入职日期 不可以大于 转正日期");
}
if (ygglMainEmp.getEmpNum() != null) {
ygglMainEmp.update(new UpdateWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
ygglMainEmp
.update(new UpdateWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
.eq(YgglMainEmp::getEmpNum, ygglMainEmp.getEmpNum()));
return ResultUtil.data(ygglMainEmp, "修改成功");
......@@ -322,8 +319,6 @@ public class YgglController {
return ResultUtil.data(ygglMainEmp, "修改成功");
}
/**
* 员工搜索
*
......@@ -349,9 +344,11 @@ public class YgglController {
ygQueryDto.getTotalPage() == null ? 10 : ygQueryDto.getTotalPage());
QueryWrapper<YgglMainEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda()
.select(YgglMainEmp::getName, YgglMainEmp::getEmpNum, YgglMainEmp::getBmgwId, YgglMainEmp::getRzTime, YgglMainEmp::getJobType, YgglMainEmp::getPhone, YgglMainEmp::getJobStatus)
.ne(YgglMainEmp::getJobStatus, YgEnumInterface.jobStatus.YILIZHI.getType()).eq(YgglMainEmp::getOrgCode, orgCode)
.eq(t != null && t > -1, YgglMainEmp::getJobType, t).eq(j != null && j > -1, YgglMainEmp::getJobStatus, j)
.select(YgglMainEmp::getName, YgglMainEmp::getEmpNum, YgglMainEmp::getBmgwId, YgglMainEmp::getRzTime,
YgglMainEmp::getJobType, YgglMainEmp::getPhone, YgglMainEmp::getJobStatus)
.ne(YgglMainEmp::getJobStatus, YgEnumInterface.jobStatus.YILIZHI.getType())
.eq(YgglMainEmp::getOrgCode, orgCode).eq(t != null && t > -1, YgglMainEmp::getJobType, t)
.eq(j != null && j > -1, YgglMainEmp::getJobStatus, j)
.in(!bList.isEmpty(), YgglMainEmp::getBmgwId, bList)
.and(!StrUtil.hasBlank(q), wq -> wq.like(YgglMainEmp::getName, q).or().like(YgglMainEmp::getPhone, q));
......@@ -368,8 +365,8 @@ public class YgglController {
@PostMapping(value = "/import_emp_record")
@ApiOperation(value = "7.导入员工档案", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 7)
public Result<JSONObject> importEmpRecord(
@CurrentUser UserBean userBean ,@Validated @RequestBody ValidList<AddygdaDto> listAddygdaDto ) throws Exception {
public Result<JSONObject> importEmpRecord(@CurrentUser UserBean userBean,
@Validated @RequestBody ValidList<AddygdaDto> listAddygdaDto) throws Exception {
Integer orgCode = userBean.getOrgCode();
// 查询所有员工手机号
......@@ -377,14 +374,12 @@ public class YgglController {
// .selectList(new QueryWrapper<QyzxEmpLogin>().lambda()
// .select(QyzxEmpLogin::getPhone));
List<YgglMainEmp> listMe = ygglMainEmpMapper
.selectList(new QueryWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getOrgCode, orgCode)
.select(YgglMainEmp::getPhone,YgglMainEmp::getZjNum));
List<YgglMainEmp> listMe = ygglMainEmpMapper.selectList(new QueryWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getOrgCode, orgCode).select(YgglMainEmp::getPhone, YgglMainEmp::getZjNum));
listMe = listMe != null ? listMe.stream()
.filter(o -> o != null && o.getPhone() != null).collect(Collectors.toList()) : null;
listMe = listMe != null
? listMe.stream().filter(o -> o != null && o.getPhone() != null).collect(Collectors.toList())
: null;
// 抽取 登录表 的phone的集合
List<String> listPhone = listMe.stream().map(YgglMainEmp::getPhone).collect(Collectors.toList());
......@@ -395,7 +390,8 @@ public class YgglController {
// 过滤掉 导入数据中, listPhone已存在 的 phone 的对象集合
List<AddygdaDto> list = listAddygdaDto.stream()
.filter(o -> o != null && !listPhone.contains(o.getPhone()) && !listzjNum.contains(o.getZjNum())).collect(Collectors.toList());
.filter(o -> o != null && !listPhone.contains(o.getPhone()) && !listzjNum.contains(o.getZjNum()))
.collect(Collectors.toList());
// 过滤出 导入数据中, listPhone已存在 的 phone 的对象集合
List<AddygdaDto> phoneRepetitions = listAddygdaDto.stream()
......@@ -445,24 +441,22 @@ public class YgglController {
.eq(!StrUtil.hasBlank(phone), QyzxEmpLogin::getPhone, phone).one();
if (login == null) {
// 初始化密码 pwd
login = QyzxEmpLogin.builder().phone(phone).pw(Md5.md5(pwd))
.sts(CommonEnum.U_STS_ON.getType()).orgId(userBean.getOrgCode()).username(name).build();
login = QyzxEmpLogin.builder().phone(phone).pw(Md5.md5(pwd)).sts(CommonEnum.U_STS_ON.getType())
.orgId(userBean.getOrgCode()).username(name).build();
if (!login.insert()) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultUtil.error("添加员工登录表失败,请检查输入信息");
}
}
QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(orgCode)
.userType(SysRoleType.U_TYPE_EMP.getType()).status(CommonEnum.U_STS_ON.getType()).build().insert();// usertype2普通员工 status1正常
yme = YgglMainEmp.builder()
.name(name).phone(phone).zjType(zjType).zjNum(zjNum).jobType(jobType)
.jobStatus(YgEnumInterface.jobStatus.SHIYONG.getType()).rzTime(rzTime)
.syq(syq).sex(sex).empNum(login.getId()).orgCode(orgCode).bmgwId(bmgwId)
.build();
QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(orgCode).userType(SysRoleType.U_TYPE_EMP.getType())
.status(CommonEnum.U_STS_ON.getType()).build().insert();// usertype2普通员工 status1正常
yme = YgglMainEmp.builder().name(name).phone(phone).zjType(zjType).zjNum(zjNum).jobType(jobType)
.jobStatus(YgEnumInterface.jobStatus.SHIYONG.getType()).rzTime(rzTime).syq(syq).sex(sex)
.empNum(login.getId()).orgCode(orgCode).bmgwId(bmgwId).build();
if (yme.insert()) {
listYmp.add(yme);
}else {
} else {
// 存放 插入失败的 数据
insertErrors.add(yme);
}
......@@ -475,7 +469,8 @@ public class YgglController {
obj.set("idCardRepetitions", idCardRepetitions);
obj.set("insertErrors", insertErrors);
//listEl.stream().filter(i -> i != null).collect(Collectors.<QyzxEmpLogin>toList());
// listEl.stream().filter(i -> i !=
// null).collect(Collectors.<QyzxEmpLogin>toList());
return ResultUtil.data(obj, "导入员工档案成功!");
}
......@@ -490,25 +485,20 @@ public class YgglController {
@ApiOperation(value = "8.获取导入模板", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 8)
public Result<Object> getImpoetTemplate(HttpServletResponse response) throws IOException {
ImportEmpDto ied = ImportEmpDto.builder()
.name("张三")
.phone("15219671123")
ImportEmpDto ied = ImportEmpDto.builder().name("张三").phone("15219671123")
// 证件类型 0:身份证;1:港澳居民来往内地通行证;2:台湾居民来往大陆通行证;3:外国护照;4:其他
.zjType(0)
.zjNum("445381199611063586")
.zjType(0).zjNum("445381199611063586")
// 工作性质 0全职、1实习生、2兼职、3劳务派遣、4劳务、5派遣、6外包、7退休返聘
.jobType(0)
.rzTime("2010-10-10 10:10:10")
.jobType(0).rzTime("2010-10-10 10:10:10")
// 试用期 0:无试用期;1:1个月;2:2个月;3:3个月;4:4个月;5:5个月;6:6个月(有试用期显示选项)
.syq(1)
// 性别 0:男;1:女
.sex(0)
.build();
.sex(0).build();
List<ImportEmpDto> listAd = CollUtil.newArrayList(ied);
// 通过工具类创建writer
ExcelWriter writer = ExcelUtil.getWriter(true);
//自定义标题别名
// 自定义标题别名
writer.addHeaderAlias("name", "姓名");
writer.addHeaderAlias("phone", "手机号");
writer.addHeaderAlias("sex", "性别");
......@@ -528,13 +518,13 @@ public class YgglController {
writer.write(listAd, true);
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
response.setHeader("Content-Disposition","attachment;filename=8timer_emp_import.xlsx");
response.setHeader("Content-Disposition", "attachment;filename=8timer_emp_import.xlsx");
ServletOutputStream out = response.getOutputStream();
writer.flush(out, true);
// 关闭writer,释放内存
writer.close();
//此处记得关闭输出Servlet流
// 此处记得关闭输出Servlet流
IoUtil.close(out);
return ResultUtil.data(null, "获取模板成功");
......@@ -552,7 +542,7 @@ public class YgglController {
@ApiOperationSupport(order = 9)
public Result<List<YgglMainEmp>> selectygdas(@CurrentUser UserBean userBean) {
List<YgglMainEmp> list = new LambdaQueryChainWrapper<YgglMainEmp>(ygglMainEmpMapper)
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).in(YgglMainEmp::getJobStatus, 1,2,3).list();
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).in(YgglMainEmp::getJobStatus, 1, 2, 3).list();
return ResultUtil.data(list, "导出员工成功");
}
......@@ -566,10 +556,9 @@ public class YgglController {
@ApiOperation(value = "10.获取员工教育经历表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 10)
public Result<List<YgglAttaJyjlb>> selectjyjlb(@CurrentUser UserBean userBean) {
List<YgglAttaJyjlb> ygglAttaJyjlbss = YgglAttaJyjlb.builder().build()
.selectList(new QueryWrapper<YgglAttaJyjlb>().lambda()
.eq(YgglAttaJyjlb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaJyjlb::getEmpNum,userBean.getEmpNum()));
List<YgglAttaJyjlb> ygglAttaJyjlbss = YgglAttaJyjlb.builder().build().selectList(
new QueryWrapper<YgglAttaJyjlb>().lambda().eq(YgglAttaJyjlb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaJyjlb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaJyjlbss);
}
......@@ -578,10 +567,9 @@ public class YgglController {
@ApiOperation(value = "11.获取员工教育经历表(管)", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 11)
public Result<List<YgglAttaJyjlb>> selectjyjlb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
List<YgglAttaJyjlb> ygglAttaJyjlbs = YgglAttaJyjlb.builder().build().selectList(
new QueryWrapper<YgglAttaJyjlb>().lambda()
.eq(YgglAttaJyjlb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaJyjlb::getEmpNum, empNum));
List<YgglAttaJyjlb> ygglAttaJyjlbs = YgglAttaJyjlb.builder().build()
.selectList(new QueryWrapper<YgglAttaJyjlb>().lambda()
.eq(YgglAttaJyjlb::getOrgCode, userBean.getOrgCode()).eq(YgglAttaJyjlb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaJyjlbs);
}
......@@ -612,10 +600,8 @@ public class YgglController {
@ApiOperationSupport(order = 13)
public Result<Boolean> deljyjlb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
Integer orgCode = userBean.getOrgCode();
return ResultUtil.data(YgglAttaJyjlb.builder().build()
.delete(new QueryWrapper<YgglAttaJyjlb>().lambda()
.eq(YgglAttaJyjlb::getOrgCode, orgCode)
.eq(YgglAttaJyjlb::getId, id)), "删除员工教育经历表成功");
return ResultUtil.data(YgglAttaJyjlb.builder().build().delete(new QueryWrapper<YgglAttaJyjlb>().lambda()
.eq(YgglAttaJyjlb::getOrgCode, orgCode).eq(YgglAttaJyjlb::getId, id)), "删除员工教育经历表成功");
}
/**
......@@ -640,10 +626,9 @@ public class YgglController {
@ApiOperation(value = "15.获取员工培训经历信息表(管)", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 15)
public Result<List<YgglAttaPxjlxxb>> selectpxjlxxb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
List<YgglAttaPxjlxxb> ygglAttaPxjlxxbs = YgglAttaPxjlxxb.builder().build().selectList(
new QueryWrapper<YgglAttaPxjlxxb>().lambda()
.eq(YgglAttaPxjlxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaPxjlxxb::getEmpNum, empNum));
List<YgglAttaPxjlxxb> ygglAttaPxjlxxbs = YgglAttaPxjlxxb.builder().build()
.selectList(new QueryWrapper<YgglAttaPxjlxxb>().lambda()
.eq(YgglAttaPxjlxxb::getOrgCode, userBean.getOrgCode()).eq(YgglAttaPxjlxxb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaPxjlxxbs);
}
......@@ -675,10 +660,8 @@ public class YgglController {
@ApiOperationSupport(order = 17)
public Result<Boolean> delpxjlxxb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
Integer orgCode = userBean.getOrgCode();
return ResultUtil.data(YgglAttaPxjlxxb.builder().build()
.delete(new QueryWrapper<YgglAttaPxjlxxb>().lambda()
.eq(YgglAttaPxjlxxb::getOrgCode, orgCode)
.eq(YgglAttaPxjlxxb::getId, id)), "删除员工培训经历信息表成功");
return ResultUtil.data(YgglAttaPxjlxxb.builder().build().delete(new QueryWrapper<YgglAttaPxjlxxb>().lambda()
.eq(YgglAttaPxjlxxb::getOrgCode, orgCode).eq(YgglAttaPxjlxxb::getId, id)), "删除员工培训经历信息表成功");
}
/**
......@@ -691,9 +674,8 @@ public class YgglController {
@ApiOperation(value = "18.获取员工工作经历表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 18)
public Result<List<YgglAttaGzjlb>> selectgzjlb(@CurrentUser UserBean userBean) {
List<YgglAttaGzjlb> ygglAttaGzjlbs = YgglAttaGzjlb.builder().build()
.selectList(new QueryWrapper<YgglAttaGzjlb>().lambda()
.eq(YgglAttaGzjlb::getOrgCode, userBean.getOrgCode())
List<YgglAttaGzjlb> ygglAttaGzjlbs = YgglAttaGzjlb.builder().build().selectList(
new QueryWrapper<YgglAttaGzjlb>().lambda().eq(YgglAttaGzjlb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaGzjlb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaGzjlbs);
}
......@@ -703,10 +685,9 @@ public class YgglController {
@ApiOperation(value = "19.获取员工工作经历表(管)", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 19)
public Result<List<YgglAttaGzjlb>> selectgzjlb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
List<YgglAttaGzjlb> ygglAttaGzjlbs = YgglAttaGzjlb.builder().build().selectList(
new QueryWrapper<YgglAttaGzjlb>().lambda()
.eq(YgglAttaGzjlb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaGzjlb::getEmpNum, empNum));
List<YgglAttaGzjlb> ygglAttaGzjlbs = YgglAttaGzjlb.builder().build()
.selectList(new QueryWrapper<YgglAttaGzjlb>().lambda()
.eq(YgglAttaGzjlb::getOrgCode, userBean.getOrgCode()).eq(YgglAttaGzjlb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaGzjlbs);
}
......@@ -737,10 +718,8 @@ public class YgglController {
@ApiOperationSupport(order = 21)
public Result<Boolean> delgzjlb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
Integer orgCode = userBean.getOrgCode();
return ResultUtil.data(YgglAttaGzjlb.builder().build()
.delete(new QueryWrapper<YgglAttaGzjlb>().lambda()
.eq(YgglAttaGzjlb::getOrgCode, orgCode)
.eq(YgglAttaGzjlb::getId, id)), "删除员工工作经历表成功");
return ResultUtil.data(YgglAttaGzjlb.builder().build().delete(new QueryWrapper<YgglAttaGzjlb>().lambda()
.eq(YgglAttaGzjlb::getOrgCode, orgCode).eq(YgglAttaGzjlb::getId, id)), "删除员工工作经历表成功");
}
/**
......@@ -753,9 +732,8 @@ public class YgglController {
@ApiOperation(value = "22.获取员工职称信息表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 22)
public Result<List<YgglAttaZcxxb>> selectzcxxb(@CurrentUser UserBean userBean) {
List<YgglAttaZcxxb> ygglAttaZcxxbs = YgglAttaZcxxb.builder().build()
.selectList(new QueryWrapper<YgglAttaZcxxb>().lambda()
.eq(YgglAttaZcxxb::getOrgCode, userBean.getOrgCode())
List<YgglAttaZcxxb> ygglAttaZcxxbs = YgglAttaZcxxb.builder().build().selectList(
new QueryWrapper<YgglAttaZcxxb>().lambda().eq(YgglAttaZcxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaZcxxb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaZcxxbs);
}
......@@ -765,10 +743,9 @@ public class YgglController {
@ApiOperation(value = "23.获取员工职称信息表(管)", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 23)
public Result<List<YgglAttaZcxxb>> selectzcxxb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
List<YgglAttaZcxxb> ygglAttaZcxxbs = YgglAttaZcxxb.builder().build().selectList(
new QueryWrapper<YgglAttaZcxxb>().lambda()
.eq(YgglAttaZcxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaZcxxb::getEmpNum, empNum));
List<YgglAttaZcxxb> ygglAttaZcxxbs = YgglAttaZcxxb.builder().build()
.selectList(new QueryWrapper<YgglAttaZcxxb>().lambda()
.eq(YgglAttaZcxxb::getOrgCode, userBean.getOrgCode()).eq(YgglAttaZcxxb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaZcxxbs);
}
......@@ -799,10 +776,8 @@ public class YgglController {
@ApiOperationSupport(order = 25)
public Result<Boolean> delzcxxb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
Integer orgCode = userBean.getOrgCode();
return ResultUtil.data(YgglAttaZcxxb.builder().build()
.delete(new QueryWrapper<YgglAttaZcxxb>().lambda()
.eq(YgglAttaZcxxb::getOrgCode, orgCode)
.eq(YgglAttaZcxxb::getId, id)), "删除员工职称信息表成功");
return ResultUtil.data(YgglAttaZcxxb.builder().build().delete(new QueryWrapper<YgglAttaZcxxb>().lambda()
.eq(YgglAttaZcxxb::getOrgCode, orgCode).eq(YgglAttaZcxxb::getId, id)), "删除员工职称信息表成功");
}
/**
......@@ -815,10 +790,9 @@ public class YgglController {
@ApiOperation(value = "26.获取员工证书证件表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 26)
public Result<List<YgglAttaZszjb>> selectzszjb(@CurrentUser UserBean userBean) {
List<YgglAttaZszjb> ygglAttaZszjbs = YgglAttaZszjb.builder().build()
.selectList(new QueryWrapper<YgglAttaZszjb>().lambda()
.eq(YgglAttaZszjb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaZszjb::getEmpNum,userBean.getEmpNum()));
List<YgglAttaZszjb> ygglAttaZszjbs = YgglAttaZszjb.builder().build().selectList(
new QueryWrapper<YgglAttaZszjb>().lambda().eq(YgglAttaZszjb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaZszjb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaZszjbs);
}
......@@ -827,10 +801,9 @@ public class YgglController {
@ApiOperation(value = "27.获取员工证书证件表(管)", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 27)
public Result<List<YgglAttaZszjb>> selectzszjb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
List<YgglAttaZszjb> ygglAttaZszjbs = YgglAttaZszjb.builder().build().selectList(
new QueryWrapper<YgglAttaZszjb>().lambda()
.eq(YgglAttaZszjb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaZszjb::getEmpNum, empNum));
List<YgglAttaZszjb> ygglAttaZszjbs = YgglAttaZszjb.builder().build()
.selectList(new QueryWrapper<YgglAttaZszjb>().lambda()
.eq(YgglAttaZszjb::getOrgCode, userBean.getOrgCode()).eq(YgglAttaZszjb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaZszjbs);
}
......@@ -861,10 +834,8 @@ public class YgglController {
@ApiOperationSupport(order = 29)
public Result<Boolean> delzszjb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
Integer orgCode = userBean.getOrgCode();
return ResultUtil.data(YgglAttaZszjb.builder().build()
.delete(new QueryWrapper<YgglAttaZszjb>().lambda()
.eq(YgglAttaZszjb::getOrgCode, orgCode)
.eq(YgglAttaZszjb::getId, id)), "删除员工证书证件表成功");
return ResultUtil.data(YgglAttaZszjb.builder().build().delete(new QueryWrapper<YgglAttaZszjb>().lambda()
.eq(YgglAttaZszjb::getOrgCode, orgCode).eq(YgglAttaZszjb::getId, id)), "删除员工证书证件表成功");
}
/**
......@@ -877,9 +848,8 @@ public class YgglController {
@ApiOperation(value = "30.获取员工联系信息表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 30)
public Result<List<YgglAttaLxxxb>> selectlxxxb(@CurrentUser UserBean userBean) {
List<YgglAttaLxxxb> ygglAttaLxxxbs = YgglAttaLxxxb.builder().build()
.selectList(new QueryWrapper<YgglAttaLxxxb>().lambda()
.eq(YgglAttaLxxxb::getOrgCode, userBean.getOrgCode())
List<YgglAttaLxxxb> ygglAttaLxxxbs = YgglAttaLxxxb.builder().build().selectList(
new QueryWrapper<YgglAttaLxxxb>().lambda().eq(YgglAttaLxxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaLxxxb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaLxxxbs);
}
......@@ -889,10 +859,9 @@ public class YgglController {
@ApiOperation(value = "31.获取员工联系信息表(管)", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 31)
public Result<List<YgglAttaLxxxb>> selectlxxxb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
List<YgglAttaLxxxb> ygglAttaLxxxbs = YgglAttaLxxxb.builder().build().selectList(
new QueryWrapper<YgglAttaLxxxb>().lambda()
.eq(YgglAttaLxxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaLxxxb::getEmpNum, empNum));
List<YgglAttaLxxxb> ygglAttaLxxxbs = YgglAttaLxxxb.builder().build()
.selectList(new QueryWrapper<YgglAttaLxxxb>().lambda()
.eq(YgglAttaLxxxb::getOrgCode, userBean.getOrgCode()).eq(YgglAttaLxxxb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaLxxxbs);
}
......@@ -923,10 +892,8 @@ public class YgglController {
@ApiOperationSupport(order = 33)
public Result<Boolean> dellxxxb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
Integer orgCode = userBean.getOrgCode();
return ResultUtil.data(YgglAttaLxxxb.builder().build()
.delete(new QueryWrapper<YgglAttaLxxxb>().lambda()
.eq(YgglAttaLxxxb::getOrgCode, orgCode)
.eq(YgglAttaLxxxb::getId, id)), "删除员工联系信息表成功");
return ResultUtil.data(YgglAttaLxxxb.builder().build().delete(new QueryWrapper<YgglAttaLxxxb>().lambda()
.eq(YgglAttaLxxxb::getOrgCode, orgCode).eq(YgglAttaLxxxb::getId, id)), "删除员工联系信息表成功");
}
/**
......@@ -939,9 +906,8 @@ public class YgglController {
@ApiOperation(value = "34.获取员工紧急联系人表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 34)
public Result<List<YgglAttaJjlxr>> selectjjlxr(@CurrentUser UserBean userBean) {
List<YgglAttaJjlxr> ygglAttaJjlxrs = YgglAttaJjlxr.builder().build()
.selectList(new QueryWrapper<YgglAttaJjlxr>().lambda()
.eq(YgglAttaJjlxr::getOrgCode, userBean.getOrgCode())
List<YgglAttaJjlxr> ygglAttaJjlxrs = YgglAttaJjlxr.builder().build().selectList(
new QueryWrapper<YgglAttaJjlxr>().lambda().eq(YgglAttaJjlxr::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaJjlxr::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaJjlxrs);
}
......@@ -951,10 +917,9 @@ public class YgglController {
@ApiOperation(value = "35.获取员工紧急联系人表(管)", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 35)
public Result<List<YgglAttaJjlxr>> selectjjlxr(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
List<YgglAttaJjlxr> ygglAttaJjlxrs = YgglAttaJjlxr.builder().build().selectList(
new QueryWrapper<YgglAttaJjlxr>().lambda()
.eq(YgglAttaJjlxr::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaJjlxr::getEmpNum, empNum));
List<YgglAttaJjlxr> ygglAttaJjlxrs = YgglAttaJjlxr.builder().build()
.selectList(new QueryWrapper<YgglAttaJjlxr>().lambda()
.eq(YgglAttaJjlxr::getOrgCode, userBean.getOrgCode()).eq(YgglAttaJjlxr::getEmpNum, empNum));
return ResultUtil.data(ygglAttaJjlxrs);
}
......@@ -985,10 +950,8 @@ public class YgglController {
@ApiOperationSupport(order = 37)
public Result<Boolean> deljjlxr(@CurrentUser UserBean userBean, @PathVariable Integer id) {
Integer orgCode = userBean.getOrgCode();
return ResultUtil.data(YgglAttaJjlxr.builder().build()
.delete(new QueryWrapper<YgglAttaJjlxr>().lambda()
.eq(YgglAttaJjlxr::getOrgCode, orgCode)
.eq(YgglAttaJjlxr::getId, id)), "删除员工紧急联系人表成功");
return ResultUtil.data(YgglAttaJjlxr.builder().build().delete(new QueryWrapper<YgglAttaJjlxr>().lambda()
.eq(YgglAttaJjlxr::getOrgCode, orgCode).eq(YgglAttaJjlxr::getId, id)), "删除员工紧急联系人表成功");
}
// 获取工资卡信息
......@@ -1003,8 +966,7 @@ public class YgglController {
@ApiOperationSupport(order = 38)
public Result<List<YgglAttaGzk>> selectgzk(@CurrentUser UserBean userBean) {
List<YgglAttaGzk> ygglAttaGzks = YgglAttaGzk.builder().build()
.selectList(new QueryWrapper<YgglAttaGzk>().lambda()
.eq(YgglAttaGzk::getOrgCode, userBean.getOrgCode())
.selectList(new QueryWrapper<YgglAttaGzk>().lambda().eq(YgglAttaGzk::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaGzk::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaGzks);
}
......@@ -1014,10 +976,8 @@ public class YgglController {
@ApiOperation(value = "39.获取员工工资卡信息(管)", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 39)
public Result<List<YgglAttaGzk>> selectgzk(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
List<YgglAttaGzk> ygglAttaGzks = YgglAttaGzk.builder().build().selectList(
new QueryWrapper<YgglAttaGzk>().lambda()
.eq(YgglAttaGzk::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaGzk::getEmpNum, empNum));
List<YgglAttaGzk> ygglAttaGzks = YgglAttaGzk.builder().build().selectList(new QueryWrapper<YgglAttaGzk>()
.lambda().eq(YgglAttaGzk::getOrgCode, userBean.getOrgCode()).eq(YgglAttaGzk::getEmpNum, empNum));
return ResultUtil.data(ygglAttaGzks);
}
......@@ -1048,10 +1008,8 @@ public class YgglController {
@ApiOperationSupport(order = 41)
public Result<Boolean> delgzk(@CurrentUser UserBean userBean, @PathVariable Integer id) {
Integer orgCode = userBean.getOrgCode();
return ResultUtil.data(YgglAttaGzk.builder().build()
.delete(new QueryWrapper<YgglAttaGzk>().lambda()
.eq(YgglAttaGzk::getOrgCode, orgCode)
.eq(YgglAttaGzk::getId, id)), "删除工资卡信息成功");
return ResultUtil.data(YgglAttaGzk.builder().build().delete(new QueryWrapper<YgglAttaGzk>().lambda()
.eq(YgglAttaGzk::getOrgCode, orgCode).eq(YgglAttaGzk::getId, id)), "删除工资卡信息成功");
}
/**
......@@ -1064,9 +1022,8 @@ public class YgglController {
@ApiOperation(value = "42.获取员工合同信息表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 42)
public Result<List<YgglAttaHtxxb>> selecthtxxb(@CurrentUser UserBean userBean) {
List<YgglAttaHtxxb> ygglAttaHtxxbs = YgglAttaHtxxb.builder().build()
.selectList(new QueryWrapper<YgglAttaHtxxb>().lambda()
.eq(YgglAttaHtxxb::getOrgCode, userBean.getOrgCode())
List<YgglAttaHtxxb> ygglAttaHtxxbs = YgglAttaHtxxb.builder().build().selectList(
new QueryWrapper<YgglAttaHtxxb>().lambda().eq(YgglAttaHtxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaHtxxb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaHtxxbs);
}
......@@ -1076,10 +1033,9 @@ public class YgglController {
@ApiOperation(value = "43.获取员工合同信息表(管)", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 43)
public Result<List<YgglAttaHtxxb>> selecthtxxb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
List<YgglAttaHtxxb> ygglAttaHtxxbs = YgglAttaHtxxb.builder().build().selectList(
new QueryWrapper<YgglAttaHtxxb>().lambda()
.eq(YgglAttaHtxxb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaHtxxb::getEmpNum, empNum));
List<YgglAttaHtxxb> ygglAttaHtxxbs = YgglAttaHtxxb.builder().build()
.selectList(new QueryWrapper<YgglAttaHtxxb>().lambda()
.eq(YgglAttaHtxxb::getOrgCode, userBean.getOrgCode()).eq(YgglAttaHtxxb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaHtxxbs);
}
......@@ -1110,10 +1066,8 @@ public class YgglController {
@ApiOperationSupport(order = 45)
public Result<Boolean> delhtxxb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
Integer orgCode = userBean.getOrgCode();
return ResultUtil.data(YgglAttaHtxxb.builder().build()
.delete(new QueryWrapper<YgglAttaHtxxb>().lambda()
.eq(YgglAttaHtxxb::getOrgCode, orgCode)
.eq(YgglAttaHtxxb::getId, id)), "删除员工合同信息表成功");
return ResultUtil.data(YgglAttaHtxxb.builder().build().delete(new QueryWrapper<YgglAttaHtxxb>().lambda()
.eq(YgglAttaHtxxb::getOrgCode, orgCode).eq(YgglAttaHtxxb::getId, id)), "删除员工合同信息表成功");
}
/**
......@@ -1126,9 +1080,8 @@ public class YgglController {
@ApiOperation(value = "46.获取员工材料附件表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 46)
public Result<List<YgglAttaClfjb>> selectclfjb(@CurrentUser UserBean userBean) {
List<YgglAttaClfjb> ygglAttaClfjbs = YgglAttaClfjb.builder().build()
.selectList(new QueryWrapper<YgglAttaClfjb>().lambda()
.eq(YgglAttaClfjb::getOrgCode, userBean.getOrgCode())
List<YgglAttaClfjb> ygglAttaClfjbs = YgglAttaClfjb.builder().build().selectList(
new QueryWrapper<YgglAttaClfjb>().lambda().eq(YgglAttaClfjb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaClfjb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaClfjbs);
}
......@@ -1138,10 +1091,9 @@ public class YgglController {
@ApiOperation(value = "47.获取员工材料附件表(管)", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 47)
public Result<List<YgglAttaClfjb>> selectclfjb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
List<YgglAttaClfjb> ygglAttaClfjbs = YgglAttaClfjb.builder().build().selectList(
new QueryWrapper<YgglAttaClfjb>().lambda()
.eq(YgglAttaClfjb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaClfjb::getEmpNum, empNum));
List<YgglAttaClfjb> ygglAttaClfjbs = YgglAttaClfjb.builder().build()
.selectList(new QueryWrapper<YgglAttaClfjb>().lambda()
.eq(YgglAttaClfjb::getOrgCode, userBean.getOrgCode()).eq(YgglAttaClfjb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaClfjbs);
}
......@@ -1172,10 +1124,8 @@ public class YgglController {
@ApiOperationSupport(order = 49)
public Result<Boolean> delclfjb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
Integer orgCode = userBean.getOrgCode();
return ResultUtil.data(YgglAttaClfjb.builder().build()
.delete(new QueryWrapper<YgglAttaClfjb>().lambda()
.eq(YgglAttaClfjb::getOrgCode, orgCode)
.eq(YgglAttaClfjb::getId, id)), "删除员工材料附件表成功");
return ResultUtil.data(YgglAttaClfjb.builder().build().delete(new QueryWrapper<YgglAttaClfjb>().lambda()
.eq(YgglAttaClfjb::getOrgCode, orgCode).eq(YgglAttaClfjb::getId, id)), "删除员工材料附件表成功");
}
/**
......@@ -1188,9 +1138,8 @@ public class YgglController {
@ApiOperation(value = "50.获取成长记录表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 50)
public Result<List<YgglAttaCzjlb>> selectczjlb(@CurrentUser UserBean userBean) {
List<YgglAttaCzjlb> ygglAttaCzjlbs = YgglAttaCzjlb.builder().build()
.selectList(new QueryWrapper<YgglAttaCzjlb>().lambda()
.eq(YgglAttaCzjlb::getOrgCode, userBean.getOrgCode())
List<YgglAttaCzjlb> ygglAttaCzjlbs = YgglAttaCzjlb.builder().build().selectList(
new QueryWrapper<YgglAttaCzjlb>().lambda().eq(YgglAttaCzjlb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaCzjlb::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaCzjlbs);
}
......@@ -1200,10 +1149,9 @@ public class YgglController {
@ApiOperation(value = "51.获取成长记录表(管)", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 51)
public Result<List<YgglAttaCzjlb>> selectczjlb(@CurrentUser UserBean userBean, @PathVariable Integer empNum) {
List<YgglAttaCzjlb> ygglAttaCzjlbs = YgglAttaCzjlb.builder().build().selectList(
new QueryWrapper<YgglAttaCzjlb>().lambda()
.eq(YgglAttaCzjlb::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaCzjlb::getEmpNum, empNum));
List<YgglAttaCzjlb> ygglAttaCzjlbs = YgglAttaCzjlb.builder().build()
.selectList(new QueryWrapper<YgglAttaCzjlb>().lambda()
.eq(YgglAttaCzjlb::getOrgCode, userBean.getOrgCode()).eq(YgglAttaCzjlb::getEmpNum, empNum));
return ResultUtil.data(ygglAttaCzjlbs);
}
......@@ -1250,8 +1198,8 @@ public class YgglController {
public Result<Void> ygzz(@CurrentUser UserBean userBean, @RequestBody YgzzDto ygzzDto) {
YgglMainEmp.builder().jobStatus(jobStatus.ZHENSHI.getType()).zzTime(ygzzDto.getZzTime()).sjzzTime(new Date())
.zzRemark(ygzzDto.getZzRemark()).build().update(new UpdateWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getEmpNum, ygzzDto.getEmpNum()));
.zzRemark(ygzzDto.getZzRemark()).build()
.update(new UpdateWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, ygzzDto.getEmpNum()));
return ResultUtil.success("转正成功!");
}
......@@ -1269,19 +1217,18 @@ public class YgglController {
Integer empNum = lzygQueryDto.getEmpNum();
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getEmpNum, empNum)
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
.eq(YgglMainEmp::getEmpNum, empNum).eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
YgglMainLzb ygglMainLzb = YgglMainLzb.builder().empNum(lzygQueryDto.getEmpNum()).build();
// 移动员工表数据到离职表
BeanUtil.copyProperties(ygglMainEmp, ygglMainLzb,"before_leaving_sts");
BeanUtil.copyProperties(ygglMainEmp, ygglMainLzb, "before_leaving_sts");
ygglMainLzb.insert();
YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).beforeLeavingSts(ygglMainEmp.getJobStatus())
.build().update(new UpdateWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, empNum));
YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType())
.beforeLeavingSts(ygglMainEmp.getJobStatus()).build()
.update(new UpdateWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, empNum));
YgglMainLzb.builder().jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).lzTime(lzygQueryDto.getLzTime())
.lzyy(lzygQueryDto.getLzyy()).lzbz(lzygQueryDto.getLzbz()).build().update(new UpdateWrapper<YgglMainLzb>().lambda().eq(YgglMainLzb::getEmpNum, empNum));
.lzyy(lzygQueryDto.getLzyy()).lzbz(lzygQueryDto.getLzbz()).build()
.update(new UpdateWrapper<YgglMainLzb>().lambda().eq(YgglMainLzb::getEmpNum, empNum));
return ResultUtil.data(ygglMainLzb, "添加待离职员工成功");
}
......@@ -1303,7 +1250,8 @@ public class YgglController {
YgglMainLzb.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).sjlzTime(new Date())
.build().update(new UpdateWrapper<YgglMainLzb>().lambda().eq(YgglMainLzb::getEmpNum, empNum));
LambdaQueryWrapper<QyzxEmpEntAsso> queryWrapper = new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getEmpNum, empNum);
LambdaQueryWrapper<QyzxEmpEntAsso> queryWrapper = new QueryWrapper<QyzxEmpEntAsso>().lambda()
.eq(QyzxEmpEntAsso::getEmpNum, empNum);
// 确认离职 删除员工关联表
qyzxEmpEntAssoMapper.delete(queryWrapper);
......@@ -1332,18 +1280,15 @@ public class YgglController {
@ApiOperationSupport(order = 57)
public Result<Void> fqlz(@CurrentUser UserBean userBean, @RequestBody LzygQueryDto lzygQueryDto) {
YgglMainEmp ygglMainEmp = ygglMainEmpMapper.selectOne(
new QueryWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getEmpNum, lzygQueryDto.getEmpNum())
YgglMainEmp ygglMainEmp = ygglMainEmpMapper
.selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, lzygQueryDto.getEmpNum())
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
YgglMainEmp.builder().jobStatus(ygglMainEmp.getBeforeLeavingSts()).build().update(new UpdateWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getEmpNum, lzygQueryDto.getEmpNum()));
YgglMainEmp.builder().jobStatus(ygglMainEmp.getBeforeLeavingSts()).build()
.update(new UpdateWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, lzygQueryDto.getEmpNum()));
// 删除离职表
YgglMainLzb.builder().id(lzygQueryDto.getEmpNum()).build().delete(new QueryWrapper<YgglMainLzb>().lambda()
.eq(YgglMainLzb::getEmpNum, lzygQueryDto.getEmpNum()));
YgglMainLzb.builder().id(lzygQueryDto.getEmpNum()).build()
.delete(new QueryWrapper<YgglMainLzb>().lambda().eq(YgglMainLzb::getEmpNum, lzygQueryDto.getEmpNum()));
return ResultUtil.success("放弃成功");
}
......@@ -1354,8 +1299,8 @@ public class YgglController {
public Result<YgglMainLzb> tzlzyy(@CurrentUser UserBean userBean, @RequestBody YgglMainLzb ygglMainLzb) {
if (ygglMainLzb.getEmpNum() != null) {
ygglMainLzb.update(new UpdateWrapper<YgglMainLzb>().lambda()
.eq(YgglMainLzb::getOrgCode, userBean.getOrgCode())
ygglMainLzb
.update(new UpdateWrapper<YgglMainLzb>().lambda().eq(YgglMainLzb::getOrgCode, userBean.getOrgCode())
.eq(YgglMainLzb::getEmpNum, ygglMainLzb.getEmpNum()));
return ResultUtil.data(ygglMainLzb, "修改成功");
}
......@@ -1570,8 +1515,8 @@ public class YgglController {
@ApiOperation(value = "65.获取员工社保公积金", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 65)
public Result<List<YgglAttaSbgjj>> selectygsbgjj(@CurrentUser UserBean userBean) {
List<YgglAttaSbgjj> ygglAttaSbgjj = YgglAttaSbgjj.builder().build().selectList(new QueryWrapper<YgglAttaSbgjj>().lambda()
.eq(YgglAttaSbgjj::getOrgCode, userBean.getOrgCode())
List<YgglAttaSbgjj> ygglAttaSbgjj = YgglAttaSbgjj.builder().build().selectList(
new QueryWrapper<YgglAttaSbgjj>().lambda().eq(YgglAttaSbgjj::getOrgCode, userBean.getOrgCode())
.eq(YgglAttaSbgjj::getEmpNum, userBean.getEmpNum()));
return ResultUtil.data(ygglAttaSbgjj);
}
......@@ -1629,10 +1574,8 @@ public class YgglController {
@ApiOperationSupport(order = 68)
public Result<Boolean> delygsbgjj(@CurrentUser UserBean userBean, @PathVariable Integer id) {
Integer orgCode = userBean.getOrgCode();
return ResultUtil.data(YgglAttaSbgjj.builder().build()
.delete(new QueryWrapper<YgglAttaSbgjj>().lambda()
.eq(YgglAttaSbgjj::getOrgCode, orgCode)
.eq(YgglAttaSbgjj::getId, id)));
return ResultUtil.data(YgglAttaSbgjj.builder().build().delete(new QueryWrapper<YgglAttaSbgjj>().lambda()
.eq(YgglAttaSbgjj::getOrgCode, orgCode).eq(YgglAttaSbgjj::getId, id)));
}
@GetMapping(value = "/sysRegion")
......@@ -1640,7 +1583,7 @@ public class YgglController {
public Result<List<Tree<String>>> sysRegion() {
List<SysRegion> nodeList = SysRegion.builder().build()
.selectList(new LambdaQueryWrapper<SysRegion>().select(SysRegion::getKeyId, SysRegion::getRegionCode,
SysRegion::getRegionName, SysRegion::getMerName, SysRegion::getLevel));
SysRegion::getRegionName, SysRegion::getMerName, SysRegion::getLevel, SysRegion::getZipCode));
// 配置
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
......@@ -1652,10 +1595,11 @@ public class YgglController {
List<Tree<String>> treeNodes = TreeUtil.build(nodeList, "0", treeNodeConfig, (treeNode, tree) -> {
tree.setId(treeNode.getKeyId().toString());
tree.setParentId(treeNode.getRegionCode());
tree.setParentId(treeNode.getRegionCode().toString());
tree.setName(treeNode.getRegionName());
// 扩展属性 ...
tree.putExtra("mer_name", treeNode.getMerName());
tree.putExtra("zip_code", treeNode.getZipCode());
});
return ResultUtil.data(treeNodes);
......
/**
* Title: CilentSourceClassMapper.java
* Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
package cn.timer.api.dao.clazz;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.clazz.ClientSourceClass;
/**
* Title: CilentSourceClassMapper.java
*
* @Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
public interface ClientSourceClassMapper extends BaseMapper<ClientSourceClass> {
}
/**
* Title: CilentSourceClassMapper.java
* Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
package cn.timer.api.dao.clazz;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.clazz.ClientTypeClass;
/**
* Title: CilentTypeClassMapper.java
*
* @Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
public interface ClientTypeClassMapper extends BaseMapper<ClientTypeClass> {
}
/**
* Title: IndustryMapper.java
* Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
package cn.timer.api.dao.clazz;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.clazz.IndustryClass;
/**
* Title: IndustryClassMapper.java
*
* @Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
public interface IndustryClassMapper extends BaseMapper<IndustryClass> {
}
/**
* 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> {
}
/**
* Title: CrmClientAssociatesMapper.java
* Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
package cn.timer.api.dao.crm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.crm.CrmClientAssociate;
/**
* Title: CrmClientAssociatesMapper.java
*
* @Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
public interface CrmClientAssociatesMapper extends BaseMapper<CrmClientAssociate> {
}
/**
* <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> {
}
/**
* Title: CrmClientFollowMapper.java
* Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
package cn.timer.api.dao.crm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.crm.CrmClientFollow;
/**
* Title: CrmClientFollowMapper.java
*
* @Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
public interface CrmClientFollowMapper extends BaseMapper<CrmClientFollow> {
}
/**
* Title: CrmSeaRuleMapper.java
* Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
package cn.timer.api.dao.crm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.crm.CrmSeaRule;
/**
* Title: CrmSeaRuleMapper.java
*
* @Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
public interface CrmSeaRuleMapper extends BaseMapper<CrmSeaRule> {
}
......@@ -9,6 +9,10 @@ package cn.timer.api.utils;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
......@@ -87,6 +91,17 @@ public class CheckUtil {
return list1.stream().distinct().collect(Collectors.toList());
}
/**
* 字段条件去重
* @param <T>
* @param keyExtractor
* @return
*/
public static <T> Predicate<T> distinctByKey(Function<? super T, Object> keyExtractor) {
Map<Object, Boolean> seen = new ConcurrentHashMap<>();
return object -> seen.putIfAbsent(keyExtractor.apply(object), Boolean.TRUE) == null;
}
// public static void main(String[] args) {
// List<String> list1 = new ArrayList<String>();
// list1.add("a");
......
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