瀏覽代碼

内外部协销

zhijiezhao 1 年之前
父節點
當前提交
a50e57ae93

+ 5 - 636
src/main/java/com/caimei/modules/user/entity/NewCmSp.java

@@ -1,22 +1,17 @@
 package com.caimei.modules.user.entity;
 
 import com.thinkgem.jeesite.common.persistence.DataEntity;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.NotNull;
-import java.beans.Transient;
+import lombok.Data;
 import java.math.BigDecimal;
 import java.util.List;
 
-/**
- * 用户模块重构-协销人员管理Entity
- * @author liwentao
- * @version 2018-06-05
- */
+@Data
 public class NewCmSp extends DataEntity<NewCmSp> {
 
 	private static final long serialVersionUID = 1L;
-	private Integer serviceProviderID;		// serviceProviderID
+
+	private Integer insiderFlag;//内外部协销标记 0内部协销,1外部协销
+	private Integer serviceProviderID;
 	private Integer userID;		// 对应的userId
 	private String name;		// 名称
 	private String linkMan;		// 联系人(默认联系人)
@@ -37,48 +32,6 @@ public class NewCmSp extends DataEntity<NewCmSp> {
 	private Integer nolivelyClub;
 	private BigDecimal livelyClubProportion;
 	private BigDecimal nolivelyClubProportion;
-//	private String nameEn;		// 英文名
-//	private String site;		// 网址
-//	private String logo;		// 头像
-//	private String halfBodyImage;		// 半身照
-//	private String legalPerson;		// 法人代表
-//	private Integer townID;		// 所在县区Id
-//	private String address;		// 地址
-//
-//
-//
-//	private String fax;		// fax
-//	private String zipCode;		// 邮编
-//	private String registeredCapital;		// 注册资金
-//	private String turnover;		// turnover
-//	private String count;		// 团队人数
-//	private String count2;		// count2
-//
-//
-//	private String contractPhone;		// 联系人固定电话
-//	private String contractMobile;		// 联系人手机
-//	private String contractQQ;		// 联系人QQ
-//	private String wechat;		// 联系人微信
-//
-//	private String linkMan2;		// 联系人2
-//	private String duty2;		// 联系人2职务
-//	private String contractPhone2;		// 联系人2固定电话
-//	private String contractMobile2;		// 联系人2手机
-//	private String contractQQ2;		// 联系人2QQ
-//	private String wechat2;		// 联系人2微信
-//	private String contractEmail2;		// 联系人2邮箱
-//	private String info;		// 团队介绍
-//	private Double commissionRate;		// commissionRate
-//	private String provinceIDs;		// 服务区域Id
-//	private String provinceNames;		// 服务区域名称
-//	private Integer level;		// level
-//	private String payFlag;		// payFlag
-//	private String businessLicenseImage;		// 营业执照
-//	private String taxCertificateImage;		// 税务登记证
-//
-//	private Integer serviceLevelID;		// serviceLevelID
-//	private Integer typeID;		// typeID
-
 	private String businessScope;		// 专业领域
 	private String companyImage;		// 形象展示
 	private String cashDeposit;		// cashDeposit
@@ -89,588 +42,4 @@ public class NewCmSp extends DataEntity<NewCmSp> {
 	private String spIdentity; //前台身份展示
 	private String spStatusName; //前台状态展示
 	private String position; //职位 0=协销员工 =协销经理
-
-	public NewCmSp() {
-		super();
-	}
-
-	public NewCmSp(String id){
-		super(id);
-	}
-
-	public List<CmSaleMan> getTeams() {
-		return teams;
-	}
-
-	public Integer getLivelyClub() {
-		return livelyClub;
-	}
-
-	public void setLivelyClub(Integer livelyClub) {
-		this.livelyClub = livelyClub;
-	}
-
-	public Integer getNolivelyClub() {
-		return nolivelyClub;
-	}
-
-	public void setNolivelyClub(Integer nolivelyClub) {
-		this.nolivelyClub = nolivelyClub;
-	}
-
-	public BigDecimal getLivelyClubProportion() {
-		return livelyClubProportion;
-	}
-
-	public void setLivelyClubProportion(BigDecimal livelyClubProportion) {
-		this.livelyClubProportion = livelyClubProportion;
-	}
-
-	public BigDecimal getNolivelyClubProportion() {
-		return nolivelyClubProportion;
-	}
-
-	public void setNolivelyClubProportion(BigDecimal nolivelyClubProportion) {
-		this.nolivelyClubProportion = nolivelyClubProportion;
-	}
-
-	public void setTeams(List<CmSaleMan> teams) {
-		this.teams = teams;
-	}
-
-	@NotNull(message="serviceProviderID不能为空")
-	public Integer getServiceProviderID() {
-		return serviceProviderID;
-	}
-
-	public void setServiceProviderID(Integer serviceProviderID) {
-		this.serviceProviderID = serviceProviderID;
-	}
-
-	public Integer getUserID() {
-		return userID;
-	}
-
-	public void setUserID(Integer userID) {
-		this.userID = userID;
-	}
-
-	@Length(min=0, max=50, message="名称长度必须介于 0 和 50 之间")
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-//	@Length(min=0, max=00, message="英文名长度必须介于 0 和 00 之间")
-//	public String getNameEn() {
-//		return nameEn;
-//	}
-//
-//	public void setNameEn(String nameEn) {
-//		this.nameEn = nameEn;
-//	}
-//
-//	@Length(min=0, max=200, message="网址长度必须介于 0 和 200 之间")
-//	public String getSite() {
-//		return site;
-//	}
-//
-//	public void setSite(String site) {
-//		this.site = site;
-//	}
-//
-//	@Length(min=0, max=200, message="头像长度必须介于 0 和 200 之间")
-//	public String getLogo() {
-//		return logo;
-//	}
-//
-//	public void setLogo(String logo) {
-//		this.logo = logo;
-//	}
-//
-//	@Length(min=0, max=255, message="半身照长度必须介于 0 和 255 之间")
-//	public String getHalfBodyImage() {
-//		return halfBodyImage;
-//	}
-//
-//	public void setHalfBodyImage(String halfBodyImage) {
-//		this.halfBodyImage = halfBodyImage;
-//	}
-//
-//	@Length(min=0, max=20, message="法人代表长度必须介于 0 和 20 之间")
-//	public String getLegalPerson() {
-//		return legalPerson;
-//	}
-//
-//	public void setLegalPerson(String legalPerson) {
-//		this.legalPerson = legalPerson;
-//	}
-//
-//	public Integer getTownID() {
-//		return townID;
-//	}
-//
-//	public void setTownID(Integer townID) {
-//		this.townID = townID;
-//	}
-//
-//	@Length(min=0, max=00, message="地址长度必须介于 0 和 00 之间")
-//	public String getAddress() {
-//		return address;
-//	}
-//
-//	public void setAddress(String address) {
-//		this.address = address;
-//	}
-//
-//	@Length(min=0, max=50, message="联系电话长度必须介于 0 和 50 之间")
-//	public String getContractPhone() {
-//		return contractPhone;
-//	}
-//
-//	public void setContractPhone(String contractPhone) {
-//		this.contractPhone = contractPhone;
-//	}
-//
-//	@Length(min=0, max=20, message="联系手机长度必须介于 0 和 20 之间")
-//	public String getContractMobile() {
-//		return contractMobile;
-//	}
-//
-//	public void setContractMobile(String contractMobile) {
-//		this.contractMobile = contractMobile;
-//	}
-//
-//	@Length(min=0, max=50, message="fax长度必须介于 0 和 50 之间")
-//	public String getFax() {
-//		return fax;
-//	}
-//
-//	public void setFax(String fax) {
-//		this.fax = fax;
-//	}
-//
-//	@Length(min=0, max=0, message="邮编长度必须介于 0 和 0 之间")
-//	public String getZipCode() {
-//		return zipCode;
-//	}
-//
-//	public void setZipCode(String zipCode) {
-//		this.zipCode = zipCode;
-//	}
-//
-//	public String getRegisteredCapital() {
-//		return registeredCapital;
-//	}
-//
-//	public void setRegisteredCapital(String registeredCapital) {
-//		this.registeredCapital = registeredCapital;
-//	}
-//
-//	public String getTurnover() {
-//		return turnover;
-//	}
-//
-//	public void setTurnover(String turnover) {
-//		this.turnover = turnover;
-//	}
-//
-//	@Length(min=0, max=1, message="团队人数长度必须介于 0 和  之间")
-//	public String getCount() {
-//		return count;
-//	}
-//
-//	public void setCount(String count) {
-//		this.count = count;
-//	}
-//
-//	@Length(min=0, max=1, message="count2长度必须介于 0 和  之间")
-//	public String getCount2() {
-//		return count2;
-//	}
-//
-//	public void setCount2(String count2) {
-//		this.count2 = count2;
-//	}
-
-	@Length(min=0, max=50, message="联系人(默认联系人)长度必须介于 0 和 50 之间")
-	public String getLinkMan() {
-		return linkMan;
-	}
-
-	public void setLinkMan(String linkMan) {
-		this.linkMan = linkMan;
-	}
-
-	@Length(min=0, max=50, message="联系人职务长度必须介于 0 和 50 之间")
-	public String getDuty() {
-		return duty;
-	}
-
-	public void setDuty(String duty) {
-		this.duty = duty;
-	}
-
-//	@Length(min=0, max=50, message="联系人固定电话长度必须介于 0 和 50 之间")
-//	public String getContractPhone() {
-//		return contractPhone;
-//	}
-//
-//	public void setContractPhone(String contractPhone) {
-//		this.contractPhone = contractPhone;
-//	}
-//
-//	@Length(min=0, max=20, message="联系人手机长度必须介于 0 和 20 之间")
-//	public String getContractMobile() {
-//		return contractMobile;
-//	}
-//
-//	public void setContractMobile(String contractMobile) {
-//		this.contractMobile = contractMobile;
-//	}
-//
-//	@Length(min=0, max=20, message="联系人QQ长度必须介于 0 和 20 之间")
-//	public String getContractQQ() {
-//		return contractQQ;
-//	}
-//
-//	public void setContractQQ(String contractQQ) {
-//		this.contractQQ = contractQQ;
-//	}
-//
-//	@Length(min=0, max=50, message="联系人微信长度必须介于 0 和 50 之间")
-//	public String getWechat() {
-//		return wechat;
-//	}
-//
-//	public void setWechat(String wechat) {
-//		this.wechat = wechat;
-//	}
-
-	@Length(min=0, max=50, message="联系人邮箱长度必须介于 0 和 50 之间")
-	public String getContractEmail() {
-		return contractEmail;
-	}
-
-	public void setContractEmail(String contractEmail) {
-		this.contractEmail = contractEmail;
-	}
-
-//	@Length(min=0, max=50, message="联系人2长度必须介于 0 和 50 之间")
-//	public String getLinkMan2() {
-//		return linkMan2;
-//	}
-//
-//	public void setLinkMan2(String linkMan2) {
-//		this.linkMan2 = linkMan2;
-//	}
-//
-//	@Length(min=0, max=50, message="联系人2职务长度必须介于 0 和 50 之间")
-//	public String getDuty2() {
-//		return duty2;
-//	}
-//
-//	public void setDuty2(String duty2) {
-//		this.duty2 = duty2;
-//	}
-//
-//	@Length(min=0, max=50, message="联系人2固定电话长度必须介于 0 和 50 之间")
-//	public String getContractPhone2() {
-//		return contractPhone2;
-//	}
-//
-//	public void setContractPhone2(String contractPhone2) {
-//		this.contractPhone2 = contractPhone2;
-//	}
-//
-//	@Length(min=0, max=20, message="联系人2手机长度必须介于 0 和 20 之间")
-//	public String getContractMobile2() {
-//		return contractMobile2;
-//	}
-//
-//	public void setContractMobile2(String contractMobile2) {
-//		this.contractMobile2 = contractMobile2;
-//	}
-//
-//	@Length(min=0, max=20, message="联系人2QQ长度必须介于 0 和 20 之间")
-//	public String getContractQQ2() {
-//		return contractQQ2;
-//	}
-//
-//	public void setContractQQ2(String contractQQ2) {
-//		this.contractQQ2 = contractQQ2;
-//	}
-//
-//	@Length(min=0, max=50, message="联系人2微信长度必须介于 0 和 50 之间")
-//	public String getWechat2() {
-//		return wechat2;
-//	}
-//
-//	public void setWechat2(String wechat2) {
-//		this.wechat2 = wechat2;
-//	}
-//
-//	@Length(min=0, max=50, message="联系人2邮箱长度必须介于 0 和 50 之间")
-//	public String getContractEmail2() {
-//		return contractEmail2;
-//	}
-//
-//	public void setContractEmail2(String contractEmail2) {
-//		this.contractEmail2 = contractEmail2;
-//	}
-//
-//	@Length(min=0, max=500, message="团队介绍长度必须介于 0 和 500 之间")
-//	public String getInfo() {
-//		return info;
-//	}
-//
-//	public void setInfo(String info) {
-//		this.info = info;
-//	}
-//
-//	public Double getCommissionRate() {
-//		return commissionRate;
-//	}
-//
-//	public void setCommissionRate(Double commissionRate) {
-//		this.commissionRate = commissionRate;
-//	}
-//
-//	@Length(min=0, max=300, message="服务区域Id长度必须介于 0 和 300 之间")
-//	public String getProvinceIDs() {
-//		return provinceIDs;
-//	}
-//
-//	public void setProvinceIDs(String provinceIDs) {
-//		this.provinceIDs = provinceIDs;
-//	}
-//
-//	@Length(min=0, max=300, message="服务区域名称长度必须介于 0 和 300 之间")
-//	public String getProvinceNames() {
-//		return provinceNames;
-//	}
-//
-//	public void setProvinceNames(String provinceNames) {
-//		this.provinceNames = provinceNames;
-//	}
-//
-//	public Integer getLevel() {
-//		return level;
-//	}
-//
-//	public void setLevel(Integer level) {
-//		this.level = level;
-//	}
-//
-//	@Length(min=0, max=1, message="payFlag长度必须介于 0 和  之间")
-//	public String getPayFlag() {
-//		return payFlag;
-//	}
-//
-//	public void setPayFlag(String payFlag) {
-//		this.payFlag = payFlag;
-//	}
-//
-//	@Length(min=0, max=200, message="营业执照长度必须介于 0 和 200 之间")
-//	public String getBusinessLicenseImage() {
-//		return businessLicenseImage;
-//	}
-//
-//	public void setBusinessLicenseImage(String businessLicenseImage) {
-//		this.businessLicenseImage = businessLicenseImage;
-//	}
-//
-//	@Length(min=0, max=200, message="税务登记证长度必须介于 0 和 200 之间")
-//	public String getTaxCertificateImage() {
-//		return taxCertificateImage;
-//	}
-//
-//	public void setTaxCertificateImage(String taxCertificateImage) {
-//		this.taxCertificateImage = taxCertificateImage;
-//	}
-
-	@Length(min=0, max=1, message="审核状态长度必须介于 0 和  之间")
-	public String getAuditStatus() {
-		return auditStatus;
-	}
-
-	public void setAuditStatus(String auditStatus) {
-		this.auditStatus = auditStatus;
-	}
-
-	@Length(min=0, max=9, message="审核时间长度必须介于 0 和 9 之间")
-	public String getAuditTime() {
-		return auditTime;
-	}
-
-	public void setAuditTime(String auditTime) {
-		this.auditTime = auditTime;
-	}
-
-	@Length(min=0, max=00, message="审核信息长度必须介于 0 和 00 之间")
-	public String getAuditNote() {
-		return auditNote;
-	}
-
-	public void setAuditNote(String auditNote) {
-		this.auditNote = auditNote;
-	}
-
-	@Length(min=0, max=1, message="是否可用 可用长度必须介于 0 和  之间")
-	public String getValidFlag() {
-		return validFlag;
-	}
-
-	public void setValidFlag(String validFlag) {
-		this.validFlag = validFlag;
-	}
-
-	public Integer getStatus() {
-		return status;
-	}
-
-	public void setStatus(Integer status) {
-		this.status = status;
-	}
-
-	@Length(min=0, max=9, message="创建时间长度必须介于 0 和 9 之间")
-	public String getAddTime() {
-		return addTime;
-	}
-
-	public void setAddTime(String addTime) {
-		this.addTime = addTime;
-	}
-
-//	public Integer getServiceLevelID() {
-//		return serviceLevelID;
-//	}
-//
-//	public void setServiceLevelID(Integer serviceLevelID) {
-//		this.serviceLevelID = serviceLevelID;
-//	}
-//
-//	public Integer getTypeID() {
-//		return typeID;
-//	}
-//
-//	public void setTypeID(Integer typeID) {
-//		this.typeID = typeID;
-//	}
-
-	public Integer getMainServiceProviderID() {
-		return mainServiceProviderID;
-	}
-
-	public void setMainServiceProviderID(Integer mainServiceProviderID) {
-		this.mainServiceProviderID = mainServiceProviderID;
-	}
-
-	@Length(min=0, max=255, message="专业领域长度必须介于 0 和 255 之间")
-	public String getBusinessScope() {
-		return businessScope;
-	}
-
-	public void setBusinessScope(String businessScope) {
-		this.businessScope = businessScope;
-	}
-
-	@Length(min=0, max=255, message="形象展示长度必须介于 0 和 255 之间")
-	public String getCompanyImage() {
-		return companyImage;
-	}
-
-	public void setCompanyImage(String companyImage) {
-		this.companyImage = companyImage;
-	}
-
-	public String getCashDeposit() {
-		return cashDeposit;
-	}
-
-	public void setCashDeposit(String cashDeposit) {
-		this.cashDeposit = cashDeposit;
-	}
-
-	@Length(min=0, max=1, message="experience长度必须介于 0 和  之间")
-	public String getExperience() {
-		return experience;
-	}
-
-	public void setExperience(String experience) {
-		this.experience = experience;
-	}
-
-	@Length(min=0, max=255, message="serviceItem长度必须介于 0 和 255 之间")
-	public String getServiceItem() {
-		return serviceItem;
-	}
-
-	public void setServiceItem(String serviceItem) {
-		this.serviceItem = serviceItem;
-	}
-
-	@Length(min=0, max=255, message="topPerformance长度必须介于 0 和 255 之间")
-	public String getTopPerformance() {
-		return topPerformance;
-	}
-
-	public void setTopPerformance(String topPerformance) {
-		this.topPerformance = topPerformance;
-	}
-
-	@Length(min=0, max=000, message="服务案例长度必须介于 0 和 000 之间")
-	public String getServiceCase() {
-		return serviceCase;
-	}
-
-	public void setServiceCase(String serviceCase) {
-		this.serviceCase = serviceCase;
-	}
-
-	@Transient
-	public String getSpIdentity() {
-		return spIdentity;
-	}
-
-	public void setSpIdentity(String spIdentity) {
-		this.spIdentity = spIdentity;
-	}
-	@Transient
-	public String getSpStatusName() {
-		return spStatusName;
-	}
-
-	public void setSpStatusName(String spStatusName) {
-		this.spStatusName = spStatusName;
-	}
-	@Transient
-	public String getPosition() {
-		return position;
-	}
-
-	public void setPosition(String position) {
-		this.position = position;
-	}
-
-	@Length(min=0, max=50, message="电话长度必须介于 0 和 50 之间")
-	public String getContractPhone() {
-		return contractPhone;
-	}
-
-	public void setContractPhone(String contractPhone) {
-		this.contractPhone = contractPhone;
-	}
-
-	@Length(min=0, max=50, message="电话长度必须介于 0 和 50 之间")
-	public String getContractMobile() {
-		return contractMobile;
-	}
-
-	public void setContractMobile(String contractMobile) {
-		this.contractMobile = contractMobile;
-	}
 }

+ 25 - 57
src/main/java/com/caimei/modules/user/web/newUser/SpController.java

@@ -196,58 +196,20 @@ public class SpController extends BaseController {
 
                             //站内信
                             MessageModel<InsideMessage> insideMessageMessageModel = new MessageModel<>();
-                            insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE)
-                                    .mqInfo(new MqInfo().topic("MessageLine").delay(1).async(1))
-                                    .info(new InsideMessage()
-                                            .userType(3)
-                                            .messageType(3)
-                                            .shopTieredType(2)
-                                            .name(newCmClub.getName())
-                                            .userName(newCmClub.getLinkMan())
-                                            .mobile(newCmClub.getContractMobile())
-                                            .superUserName(oldServiceprovider.getName())
-                                            .thisId(serviceProvider.getServiceProviderID())
-                                            .clubId(newCmClub.getClubID())
-                                    );
+                            insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE).mqInfo(new MqInfo().topic("MessageLine").delay(1).async(1)).info(new InsideMessage().userType(3).messageType(3).shopTieredType(2).name(newCmClub.getName()).userName(newCmClub.getLinkMan()).mobile(newCmClub.getContractMobile()).superUserName(oldServiceprovider.getName()).thisId(serviceProvider.getServiceProviderID()).clubId(newCmClub.getClubID()));
                             MessageUtil.sendMessage(insideMessageMessageModel);
-                            if(1342!=serviceProvider.getServiceProviderID()){
-                                insideMessageMessageModel.info(new InsideMessage()
-                                        .userType(3)
-                                        .messageType(3)
-                                        .shopTieredType(3)
-                                        .name(newCmClub.getName())
-                                        .userName(newCmClub.getLinkMan())
-                                        .mobile(newCmClub.getContractMobile())
-                                        .superUserName(serviceProvider.getName())
-                                        .thisId(oldServiceprovider.getServiceProviderID())
-                                        .clubId(newCmClub.getClubID())
-                                );
+                            if (1342 != serviceProvider.getServiceProviderID()) {
+                                insideMessageMessageModel.info(new InsideMessage().userType(3).messageType(3).shopTieredType(3).name(newCmClub.getName()).userName(newCmClub.getLinkMan()).mobile(newCmClub.getContractMobile()).superUserName(serviceProvider.getName()).thisId(oldServiceprovider.getServiceProviderID()).clubId(newCmClub.getClubID()));
                                 MessageUtil.sendMessage(insideMessageMessageModel);
-                                insideMessageMessageModel.info(new InsideMessage()
-                                        .userType(1)
-                                        .messageType(3)
-                                        .shopTieredType(6)
-                                        .userName(serviceProvider.getName())
-                                        .mobile(serviceProvider.getContractMobile())
-                                        .clubId(newCmClub.getClubID())
-                                );
+                                insideMessageMessageModel.info(new InsideMessage().userType(1).messageType(3).shopTieredType(6).userName(serviceProvider.getName()).mobile(serviceProvider.getContractMobile()).clubId(newCmClub.getClubID()));
                                 MessageUtil.sendMessage(insideMessageMessageModel);
                                 SMSUtils.sendSms(4, newCmClub.getContractMobile(), "【采美365】因公司内部人员调整需要,采美平台已为您更换客户经理。客户经理【" + serviceProvider.getName() + "】,手机号【" + serviceProvider.getContractMobile() + "】。");
                                 SMSUtils.sendSms(4, serviceProvider.getContractMobile(), "【采美365】系统已为你分配机构客户,请及时跟进。机构名称【" + newCmClub.getName() + "】,联系人【" + newCmClub.getLinkMan() + "】,手机号【" + newCmClub.getContractMobile() + "】,上一任销售【" + oldServiceprovider.getName() + "】。");
                                 SMSUtils.sendSms(4, oldServiceprovider.getContractMobile(), "【采美365】系统已将你的机构客户转移给其他销售人员,你已无权管理该客户。机构名称【" + newCmClub.getName() + "】,联系人【" + newCmClub.getLinkMan() + "】,手机号【" + newCmClub.getContractMobile() + "】,下一任销售【" + serviceProvider.getName() + "】。");
-                            }else {
-                                insideMessageMessageModel.info(new InsideMessage()
-                                        .userType(3)
-                                        .messageType(3)
-                                        .shopTieredType(8)
-                                        .name(newCmClub.getName())
-                                        .userName(newCmClub.getLinkMan())
-                                        .mobile(newCmClub.getContractMobile())
-                                        .thisId(oldServiceprovider.getServiceProviderID())
-                                        .clubId(newCmClub.getClubID())
-                                );
+                            } else {
+                                insideMessageMessageModel.info(new InsideMessage().userType(3).messageType(3).shopTieredType(8).name(newCmClub.getName()).userName(newCmClub.getLinkMan()).mobile(newCmClub.getContractMobile()).thisId(oldServiceprovider.getServiceProviderID()).clubId(newCmClub.getClubID()));
                                 MessageUtil.sendMessage(insideMessageMessageModel);
-                                SMSUtils.sendSms(4, oldServiceprovider.getContractMobile(), "【采美365】系统已将你的机构客户进行回收,你已无权管理该客户。机构名称【" + newCmClub.getName() + "】,联系人【"+ newCmClub.getLinkMan() +"】,手机号【"+ newCmClub.getContractMobile() +"】。");
+                                SMSUtils.sendSms(4, oldServiceprovider.getContractMobile(), "【采美365】系统已将你的机构客户进行回收,你已无权管理该客户。机构名称【" + newCmClub.getName() + "】,联系人【" + newCmClub.getLinkMan() + "】,手机号【" + newCmClub.getContractMobile() + "】。");
                             }
                             // 分配协销发送微信模板消息
                             List<String> openidList = newShopOrderDao.getOpenidListByPermission(serviceProvider.getUnionId());
@@ -351,12 +313,12 @@ public class SpController extends BaseController {
     public String cmSpLivelyClubList(NewCmSp newCmSp, HttpServletRequest request, HttpServletResponse response, Model model) {
         newCmSp.setStatus(90);
         Page<NewCmSp> page = cmSpService.findPage(new Page<NewCmSp>(request, response), newCmSp);
-        page.getList().forEach(s->{
+        page.getList().forEach(s -> {
             Map<String, Object> spUserLoginSum = cmSpService.findSpUserLoginSum(s.getServiceProviderID().toString());
             Integer loginSum = Integer.valueOf(spUserLoginSum.get("loginSum").toString());
             Integer not_loginSum = Integer.valueOf(spUserLoginSum.get("not_loginSum").toString());
             //        机构活跃与不活跃占比计算方法,例如:机构活跃数/机构活跃数+机构不活跃数(60/(60+30)=0.666...),保留小数点后2位,四舍五入,0.67;
-            BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ?(double) loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
+            BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ? (double) loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
             s.setLivelyClub(loginSum);
             s.setNolivelyClub(not_loginSum);
             s.setLivelyClubProportion(livelyClubProportion);
@@ -366,7 +328,7 @@ public class SpController extends BaseController {
         Integer loginSum = Integer.valueOf(spUserLoginSum.get("loginSum").toString());
         Integer not_loginSum = Integer.valueOf(spUserLoginSum.get("not_loginSum").toString());
         //        机构活跃与不活跃占比计算方法,例如:机构活跃数/机构活跃数+机构不活跃数(60/(60+30)=0.666...),保留小数点后2位,四舍五入,0.67;
-        BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ?(double) loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
+        BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ? (double) loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
         model.addAttribute("livelyClub", loginSum);
         model.addAttribute("nolivelyClub", not_loginSum);
         model.addAttribute("livelyClubProportion", livelyClubProportion);
@@ -376,7 +338,6 @@ public class SpController extends BaseController {
     }
 
 
-
     /**
      * 功能描述: 机构活跃分析查看详情
      *
@@ -389,7 +350,7 @@ public class SpController extends BaseController {
      */
     @RequestMapping(value = {"cmSpLivelyClubFrom"})
     public String cmSpLivelyClubFrom(NewCmClub newCmClub, HttpServletRequest request, HttpServletResponse response, Model model) {
-        if (StringUtils.isBlank(newCmClub.getStartLoginTime())&&StringUtils.isBlank(newCmClub.getEndLoginTime())) {
+        if (StringUtils.isBlank(newCmClub.getStartLoginTime()) && StringUtils.isBlank(newCmClub.getEndLoginTime())) {
             Calendar calendar = Calendar.getInstance();
             calendar.add(Calendar.MONTH, -6);
             newCmClub.setStartLoginTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime()));
@@ -400,7 +361,7 @@ public class SpController extends BaseController {
         Integer loginSum = Integer.valueOf(spUserLoginSum.get("loginSum").toString());
         Integer not_loginSum = Integer.valueOf(spUserLoginSum.get("not_loginSum").toString());
         //        机构活跃与不活跃占比计算方法,例如:机构活跃数/机构活跃数+机构不活跃数(60/(60+30)=0.666...),保留小数点后2位,四舍五入,0.67;
-        BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ? (double)loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
+        BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ? (double) loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
         model.addAttribute("livelyClub", loginSum);
         model.addAttribute("nolivelyClub", not_loginSum);
         model.addAttribute("livelyClubProportion", livelyClubProportion);
@@ -411,7 +372,6 @@ public class SpController extends BaseController {
     }
 
 
-
     /**
      * 添加协销人员
      *
@@ -482,6 +442,9 @@ public class SpController extends BaseController {
             cmSp.setDuty(com.caimei.constants.UserType.SERVICEPROVIDER.getDesc());
             cmUser.setRegisterUserTypeID(com.caimei.constants.UserType.SERVICEEMPLOYEE.getCode() + "");
         } else {
+            // 0内部协销,2外部协销,user表身份都存协销,外部协销额外字段进行区分
+            Integer flag = "2".equals(duty) ? 1 : 0;
+            cmSp.setInsiderFlag(flag);
             cmSp.setDuty(com.caimei.constants.UserType.SERVICEEMPLOYEE.getDesc());
             cmUser.setRegisterUserTypeID(UserType.SERVICEEMPLOYEE.getCode() + "");
         }
@@ -594,10 +557,11 @@ public class SpController extends BaseController {
         }
         if (cmUser.getRegisterUserTypeID().equals(UserType.SERVICEEMPLOYEE.getCode() + "")) {
             newCmSp.setPosition("0");
+            if (1 == newCmSp.getInsiderFlag()) {
+                newCmSp.setPosition("2");
+            }
         }
         model.addAttribute("newCmSp", newCmSp);
-        positionMap.put("0", UserType.SERVICEEMPLOYEE.getDesc());
-        model.addAttribute("positionMap", positionMap);
         return "modules/userNew/cmSpEdit";
     }
 
@@ -621,11 +585,15 @@ public class SpController extends BaseController {
                 addMessage(model, "已经存在协销经理了");
                 return "redirect:" + Global.getAdminPath() + "/new/user/cmSp/cmSpList/?repage";
             }
-            cmUser.setRegisterUserTypeID(UserType.SERVICEPROVIDER.getCode() + ""); // 设置为协销经理
+            // 设置为协销经理
+            cmUser.setRegisterUserTypeID(UserType.SERVICEPROVIDER.getCode() + "");
         }
 
-        if ("0".equals(newCmSp.getPosition())) {
-            cmUser.setRegisterUserTypeID(UserType.SERVICEEMPLOYEE.getCode() + ""); // 设置为协销员工
+        if ("0".equals(newCmSp.getPosition()) || "2".equals(newCmSp.getPosition())) {
+            // 设置为协销员工
+            cmUser.setRegisterUserTypeID(UserType.SERVICEEMPLOYEE.getCode() + "");
+            Integer flag = "2".equals(newCmSp.getPosition()) ? 1 : 0;
+            newCmSp.setInsiderFlag(flag);
         }
         newCmSp.setName(newCmSp.getLinkMan());
         cmUser.setMobile(newCmSp.getContractMobile());

+ 4 - 0
src/main/resources/mappings/modules/user/CmSpMapper.xml

@@ -17,6 +17,7 @@
 		a.validFlag AS "validFlag",
 		a.status AS "status",
 		a.addTime AS "addTime",
+		a.insiderFlag as "insiderFlag",
 		a.mainServiceProviderID AS "mainServiceProviderID"
 	</sql>
 
@@ -103,6 +104,7 @@
 		validFlag,
 		status,
 		addTime,
+		insiderFlag,
 		mainServiceProviderID
 		) VALUES (
 		#{userID},
@@ -118,6 +120,7 @@
 		#{validFlag},
 		#{status},
 		#{addTime},
+		#{insiderFlag},
 		#{mainServiceProviderID}
 		)
 	</insert>
@@ -138,6 +141,7 @@
 		validFlag = #{validFlag},
 		status = #{status},
 		addTime = #{addTime},
+		insiderFlag = #{insiderFlag},
 		mainServiceProviderID = #{mainServiceProviderID}
 		WHERE serviceProviderID = #{serviceProviderID}
 	</update>

+ 2 - 1
src/main/webapp/WEB-INF/views/modules/userNew/cmSpEdit.jsp

@@ -56,7 +56,8 @@
 			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>身份:</label>
 			<div class="controls">
 				<form:select path="position" itemLabel="key" itemValue="value" htmlEscape="false">
-                    <form:options items="${positionMap}" />
+				  	    <form:option value="0" label="内部协销"/>
+				  	    <form:option value="2" label="外部协销"/>
                 </form:select>
             </div>
 		</div>

+ 3 - 1
src/main/webapp/WEB-INF/views/modules/userNew/cmSpForm.jsp

@@ -92,7 +92,9 @@
 			<div class="controls">
 				<%--<input name="duty" htmlEscape="false" maxlength="11" class="input-xlarge required"/>--%>
 				<select name="duty">
-				        <option value="0">协销员工</option>
+				        
+					<option value="0">内部协销</option>
+					<option value="2">外部协销</option>
 						<c:if test="${hasManager}==0">
 							<option value="1">协销经理</option>
 						</c:if>