|
@@ -11,10 +11,7 @@ import org.springframework.stereotype.Service;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.text.NumberFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* Description
|
|
@@ -50,10 +47,109 @@ public class ClubPortraitService {
|
|
|
type += "-" + clubStatistics.getClassify();
|
|
|
}
|
|
|
clubStatistics.setClubType(type);
|
|
|
+ setClubNum(clubStatistics);
|
|
|
+ // 设置机构信息
|
|
|
+ CmClubRemarks clubRemarksInfo = cmPortraitDao.getClubRemarksInfo(clubID);
|
|
|
+ if (null != clubRemarksInfo) {
|
|
|
+ clubStatistics.setCustomerSource(clubRemarksInfo.getCustomerSource() != null ? clubRemarksInfo.getCustomerSource() : 4);
|
|
|
+ clubStatistics.setGroupAddition(clubRemarksInfo.getGroupAddition() != null ? clubRemarksInfo.getGroupAddition() : 1);
|
|
|
+ clubStatistics.setWxReach(1);
|
|
|
+ if (null != clubRemarksInfo.getCommunicationMethods() && (0 == clubRemarksInfo.getCommunicationMethods() || 2 == clubRemarksInfo.getCommunicationMethods())) {
|
|
|
+ clubStatistics.setWxReach(0);
|
|
|
+ }
|
|
|
+ clubStatistics.setMobileReach(1);
|
|
|
+ if (null != clubRemarksInfo.getCommunicationMethods() && (0 == clubRemarksInfo.getCommunicationMethods() || 1 == clubRemarksInfo.getCommunicationMethods())) {
|
|
|
+ clubStatistics.setMobileReach(0);
|
|
|
+ }
|
|
|
+ clubStatistics.setSex(clubRemarksInfo.getCustomerGender() != null ? clubRemarksInfo.getGroupAddition() : null);
|
|
|
+ clubStatistics.setAge(clubRemarksInfo.getCustomerGender() != null ? clubRemarksInfo.getGroupAddition() : null);
|
|
|
+ clubStatistics.setFillTime(clubRemarksInfo.getAddTime().toString());
|
|
|
+ }
|
|
|
}
|
|
|
return clubStatistics;
|
|
|
}
|
|
|
|
|
|
+ public Map<String, Object> getDemand(Integer clubId, Integer dataType, String demandStart, String demandEnd) {
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date date = new Date();
|
|
|
+ String endTime = "";
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(date);
|
|
|
+ calendar.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
+ Date time = calendar.getTime();
|
|
|
+ calendar.setTime(time);
|
|
|
+ boolean expty = ObjectUtils.isEmpty(demandStart) && ObjectUtils.isEmpty(demandEnd);
|
|
|
+ if (expty) {
|
|
|
+ Date start = null;
|
|
|
+ String startTime = "";
|
|
|
+ demandEnd = endTime;
|
|
|
+ // 日期参数为 日
|
|
|
+ if (1 == dataType || 1 == dataType) {
|
|
|
+ demandStart = endTime;
|
|
|
+ }
|
|
|
+ if (2 == dataType) {
|
|
|
+ calendar.setTime(time);
|
|
|
+ calendar.add(Calendar.MONTH, -1);
|
|
|
+ start = calendar.getTime();
|
|
|
+ startTime = dateFormat.format(start);
|
|
|
+ demandStart = startTime;
|
|
|
+ }
|
|
|
+ if (3 == dataType) {
|
|
|
+ calendar.setTime(time);
|
|
|
+ calendar.add(Calendar.MONTH, -6);
|
|
|
+ start = calendar.getTime();
|
|
|
+ startTime = dateFormat.format(start);
|
|
|
+ demandStart = startTime;
|
|
|
+ }
|
|
|
+ if (4 == dataType) {
|
|
|
+ calendar.setTime(time);
|
|
|
+ calendar.add(Calendar.YEAR, -1);
|
|
|
+ start = calendar.getTime();
|
|
|
+ startTime = dateFormat.format(start);
|
|
|
+ demandStart = startTime;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<String> demandList = new ArrayList<>();
|
|
|
+ List<String> clubRemarks = cmPortraitDao.getClubRemarks(clubId, demandStart, demandEnd);
|
|
|
+ if (clubRemarks.size() > 0) {
|
|
|
+ for (String clubRemark : clubRemarks) {
|
|
|
+ if (clubRemark.contains(",")) {
|
|
|
+ String[] split = clubRemark.split(",");
|
|
|
+ for (String s : split) {
|
|
|
+ if (demandList.size() <= 10) {
|
|
|
+ demandList.add(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (demandList.size() <= 10) {
|
|
|
+ demandList.add(clubRemark);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<String> clubBehaviors = cmPortraitDao.getClubBehavior(clubId, demandStart, demandEnd);
|
|
|
+ if (clubBehaviors.size() > 0) {
|
|
|
+ for (String clubBehavior : clubBehaviors) {
|
|
|
+ if (clubBehavior.contains(",")) {
|
|
|
+ String[] split = clubBehavior.split(",");
|
|
|
+ for (String s : split) {
|
|
|
+ if (demandList.size() <= 10) {
|
|
|
+ demandList.add(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (demandList.size() <= 10) {
|
|
|
+ demandList.add(clubBehavior);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("startTime", demandStart);
|
|
|
+ map.put("endTime", demandEnd);
|
|
|
+ map.put("demandList", demandList);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
/**
|
|
|
* 查询机构画像数据
|
|
|
*
|
|
@@ -325,6 +421,7 @@ public class ClubPortraitService {
|
|
|
}
|
|
|
cmPortrait.setPageTypeValue(integers);
|
|
|
cmPortrait.setPageType(strings);
|
|
|
+ cmPortrait.setVisitNum(pageTypeList.size());
|
|
|
}
|
|
|
}
|
|
|
if (!expty) {
|
|
@@ -336,4 +433,59 @@ public class ClubPortraitService {
|
|
|
}
|
|
|
return cmPortrait;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置机构资料完整度
|
|
|
+ * @param clubStatistics
|
|
|
+ */
|
|
|
+ public void setClubNum(ClubStatistics clubStatistics) {
|
|
|
+ Integer number = 0;
|
|
|
+ if (null != clubStatistics) {
|
|
|
+ // 计算资料完整度
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getName())) {
|
|
|
+ number += 10;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getLinkMan())) {
|
|
|
+ number += 10;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getContractMobile())) {
|
|
|
+ number += 10;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getLinkManIdentity())) {
|
|
|
+ number += 10;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getAddress())) {
|
|
|
+ number += 10;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getBusinessLicenseImage())) {
|
|
|
+ number += 10;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getUserIdentity())) {
|
|
|
+ number += 10;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getSname())) {
|
|
|
+ number += 3;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getContractEmail())) {
|
|
|
+ number += 5;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getContractPhone())) {
|
|
|
+ number += 4;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getFax())) {
|
|
|
+ number += 3;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getHeadpic())) {
|
|
|
+ number += 5;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getSocialCreditCode())) {
|
|
|
+ number += 5;
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(clubStatistics.getInfo())) {
|
|
|
+ number += 5;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ clubStatistics.setNumber(number);
|
|
|
+ clubStatistics.setClubDataIntegrity(number + "%");
|
|
|
+ }
|
|
|
}
|