Commit 145ea0ef authored by jay's avatar jay

云迹需求提交

parent 8f98789e
package com.house365.beans.entity; package com.house365.beans.entity;
import com.house365.beans.system.DomainObject; import com.house365.beans.system.DomainObject;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 云迹活动实体类 * 云迹活动实体类
...@@ -23,6 +25,32 @@ public class CloudActivityEntity extends DomainObject { ...@@ -23,6 +25,32 @@ public class CloudActivityEntity extends DomainObject {
private Date createTime; private Date createTime;
private int isDelete; private int isDelete;
private int totalPriceMin;
private int totalPriceMax;
private int areaMin;
private int areaMax;
private String block;
private String blockName;
private String district;
private String districtName;
private String channel;
private String channelName;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date seeStartTime;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date seeEndTime;
private String seeProjectName;
private int seeCount;
private int type;
private String projectId;
private String projectName;
private List<String> blockList;
private List<String> districtList;
private String startTime;
private String endTime;
public String getName() { public String getName() {
return name; return name;
} }
...@@ -94,4 +122,172 @@ public class CloudActivityEntity extends DomainObject { ...@@ -94,4 +122,172 @@ public class CloudActivityEntity extends DomainObject {
public void setIsDelete(int isDelete) { public void setIsDelete(int isDelete) {
this.isDelete = isDelete; this.isDelete = isDelete;
} }
public int getTotalPriceMin() {
return totalPriceMin;
}
public void setTotalPriceMin(int totalPriceMin) {
this.totalPriceMin = totalPriceMin;
}
public int getTotalPriceMax() {
return totalPriceMax;
}
public void setTotalPriceMax(int totalPriceMax) {
this.totalPriceMax = totalPriceMax;
}
public int getAreaMin() {
return areaMin;
}
public void setAreaMin(int areaMin) {
this.areaMin = areaMin;
}
public int getAreaMax() {
return areaMax;
}
public void setAreaMax(int areaMax) {
this.areaMax = areaMax;
}
public String getBlock() {
return block;
}
public void setBlock(String block) {
this.block = block;
}
public String getBlockName() {
return blockName;
}
public void setBlockName(String blockName) {
this.blockName = blockName;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getDistrictName() {
return districtName;
}
public void setDistrictName(String districtName) {
this.districtName = districtName;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public String getChannelName() {
return channelName;
}
public void setChannelName(String channelName) {
this.channelName = channelName;
}
public Date getSeeStartTime() {
return seeStartTime;
}
public void setSeeStartTime(Date seeStartTime) {
this.seeStartTime = seeStartTime;
}
public Date getSeeEndTime() {
return seeEndTime;
}
public void setSeeEndTime(Date seeEndTime) {
this.seeEndTime = seeEndTime;
}
public String getSeeProjectName() {
return seeProjectName;
}
public void setSeeProjectName(String seeProjectName) {
this.seeProjectName = seeProjectName;
}
public int getSeeCount() {
return seeCount;
}
public void setSeeCount(int seeCount) {
this.seeCount = seeCount;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public List<String> getBlockList() {
return blockList;
}
public void setBlockList(List<String> blockList) {
this.blockList = blockList;
}
public List<String> getDistrictList() {
return districtList;
}
public void setDistrictList(List<String> districtList) {
this.districtList = districtList;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
} }
package com.house365.web.controller; package com.house365.web.controller;
import com.google.common.base.Joiner;
import com.house365.beans.entity.*; import com.house365.beans.entity.*;
import com.house365.beans.system.Page; import com.house365.beans.system.Page;
import com.house365.beans.vo.CloudRuleVo; import com.house365.beans.vo.CloudRuleVo;
import com.house365.commons.system.HttpClientUtil; import com.house365.commons.system.HttpClientUtil;
import com.house365.rest.parameter.House365RestObject;
import com.house365.web.cached.RedisUtilsInterface;
import com.house365.web.system.controller.BaseController; import com.house365.web.system.controller.BaseController;
import com.house365.web.util.SessionConstants; import com.house365.web.util.SessionConstants;
import com.house365.ws.beans.request.MapListRequest; import com.house365.ws.beans.request.MapListRequest;
...@@ -12,24 +15,26 @@ import com.house365.ws.beans.response.DepartmentResponse; ...@@ -12,24 +15,26 @@ import com.house365.ws.beans.response.DepartmentResponse;
import com.house365.ws.beans.response.MapListResponse; import com.house365.ws.beans.response.MapListResponse;
import com.house365.ws.beans.response.ProjectListResponse; import com.house365.ws.beans.response.ProjectListResponse;
import com.house365.ws.beans.util.HResult; import com.house365.ws.beans.util.HResult;
import com.house365.ws.interfaces.server.ICloudActivityInterface; import com.house365.ws.interfaces.server.*;
import com.house365.ws.interfaces.server.ICloudRuleInterface;
import com.house365.ws.interfaces.server.IDepartment;
import com.house365.ws.interfaces.server.IProject;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.commons.collections.map.ListOrderedMap;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.http.NameValuePair; import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair; import org.apache.http.message.BasicNameValuePair;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springside.modules.web.Servlets; import org.springside.modules.web.Servlets;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/** /**
...@@ -43,6 +48,14 @@ public class CloudActivityController extends BaseController { ...@@ -43,6 +48,14 @@ public class CloudActivityController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(CloudActivityController.class); private static final Logger logger = LoggerFactory.getLogger(CloudActivityController.class);
@Value("${CRM.TRANSLATE.URL}")
private String crmTranslateUrl;
@Value("${CLOUD.PULL.URL}")
private String cloudPullUrl;
@Autowired
private RedisUtilsInterface redisUtil;
@Autowired @Autowired
private ICloudActivityInterface activityInterface; private ICloudActivityInterface activityInterface;
@Autowired @Autowired
...@@ -51,6 +64,8 @@ public class CloudActivityController extends BaseController { ...@@ -51,6 +64,8 @@ public class CloudActivityController extends BaseController {
private IDepartment department; private IDepartment department;
@Autowired @Autowired
private ICloudRuleInterface ruleInterface; private ICloudRuleInterface ruleInterface;
@Autowired
private IUser iUser;
/** /**
* 云迹活动列表 * 云迹活动列表
...@@ -84,6 +99,38 @@ public class CloudActivityController extends BaseController { ...@@ -84,6 +99,38 @@ public class CloudActivityController extends BaseController {
return getAutoUrl(); return getAutoUrl();
} }
/**
* 云迹主动拉取数据列表
* @param number
* @param model
* @param request
* @return
*/
@RequestMapping(value = "/pullList")
public String pullList(Integer number, Model model, HttpServletRequest request) {
try {
DepartmentEntity dept = (DepartmentEntity) request.getSession().getAttribute(SessionConstants.SESSION_CURRNET_DEPT_KEY);
UserEntity userEntity = (UserEntity) request.getSession().getAttribute(SessionConstants.THREAD_USER_KEY);
Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");
String city = dept.getDescripition();
searchParams.put("city", city);
searchParams.put("userId", userEntity.getId());
Page page = new Page(50);
if (null != number) {
page.setCurrentPage(number);
}
MapListRequest listRequest = new MapListRequest();
listRequest.setPaging(page);
listRequest.setSearchParams(searchParams);
MapListResponse response = activityInterface.pullList(listRequest);
model.addAttribute("page", response.getPaging());
model.addAttribute("dataList", response.getObjectList());
} catch (Exception e) {
logger.error("查询云迹拉取列表失败", e);
}
return getAutoUrl();
}
@RequestMapping(value = "/setCloudCount") @RequestMapping(value = "/setCloudCount")
@ResponseBody @ResponseBody
public String setCloudCount() { public String setCloudCount() {
...@@ -371,4 +418,242 @@ public class CloudActivityController extends BaseController { ...@@ -371,4 +418,242 @@ public class CloudActivityController extends BaseController {
return result; return result;
} }
/**
* 跳转新增云迹活动
*
* @return 结果视图
*/
@RequestMapping(value = "toAdd")
public String toAdd(Model model, HttpServletRequest request) {
UserEntity userEntity = (UserEntity) request.getSession().getAttribute(SessionConstants.THREAD_USER_KEY);
DepartmentEntity departmentEntity = (DepartmentEntity) request.getSession().getAttribute(SessionConstants.SESSION_CURRNET_DEPT_KEY);
String cityId = departmentEntity.getCityID();
DepartmentResponse departmentResponse = department.getDepartmentById(Integer.valueOf(cityId));
DepartmentEntity city = departmentResponse.getEntity();
String cityCode = "zb".equalsIgnoreCase(city.getDescripition()) ? "nj" : city.getDescripition();
List<DictionaryEntity> blocks = new ArrayList<>();
List<DictionaryEntity> districts = new ArrayList<>();
try {
List<NameValuePair> blockParam = new ArrayList<>();
blockParam.add(new BasicNameValuePair("city", cityCode));
blockParam.add(new BasicNameValuePair("type", "block"));
String blockResult = HttpClientUtil.doGet(crmTranslateUrl, blockParam);
JSONObject block = JSONObject.fromObject(blockResult);
for (Object obj : block.entrySet()) {
DictionaryEntity dictionaryEntity = new DictionaryEntity();
dictionaryEntity.setDicKey("block");
dictionaryEntity.setDicValue(String.valueOf(((ListOrderedMap.Entry) obj).getKey()));
dictionaryEntity.setDicName((String) ((ListOrderedMap.Entry) obj).getValue());
dictionaryEntity.setCity(cityCode);
blocks.add(dictionaryEntity);
}
blockParam.remove(new BasicNameValuePair("type", "block"));
blockParam.add(new BasicNameValuePair("type", "district"));
String districtResult = HttpClientUtil.doGet(crmTranslateUrl, blockParam);
JSONObject district = JSONObject.fromObject(districtResult);
for (Object obj : district.entrySet()) {
DictionaryEntity dictionaryEntity = new DictionaryEntity();
dictionaryEntity.setDicKey("district");
dictionaryEntity.setDicValue(String.valueOf(((ListOrderedMap.Entry) obj).getKey()));
dictionaryEntity.setDicName((String) ((ListOrderedMap.Entry) obj).getValue());
dictionaryEntity.setCity(cityCode);
districts.add(dictionaryEntity);
}
} catch (Exception e) {
e.printStackTrace();
logger.error("获取crm板块接口失败");
}
List<DutyStaffEntity> dutyList = iUser.getOndutyById(userEntity.getId());
model.addAttribute("limitDate", "1");
if (CollectionUtils.isNotEmpty(dutyList)) {
if ("1".equals(dutyList.get(0).getOnduty())) {
//名单内:值班不限制时间选择范围
model.addAttribute("limitDate", "0");
}
}
model.addAttribute("districts", districts);
model.addAttribute("blocks", blocks);
return getAutoUrl("addcloud");
}
/**
* 新增云迹活动
*
* @return
*/
@RequestMapping(value = "/addCloud", method = RequestMethod.POST)
@ResponseBody
public HResult addCloud(HttpServletRequest request, @RequestBody CloudActivityEntity entity) {
HResult result = new HResult();
try {
DepartmentEntity departmentEntity = (DepartmentEntity) request.getSession().getAttribute(SessionConstants.SESSION_CURRNET_DEPT_KEY);
UserEntity userEntity = (UserEntity) request.getSession().getAttribute(SessionConstants.THREAD_USER_KEY);
String cityId = departmentEntity.getCityID();
DepartmentResponse departmentResponse = department.getDepartmentById(Integer.valueOf(cityId));
DepartmentEntity city = departmentResponse.getEntity();
String cityCode = city.getDescripition();
//调取云迹接口
List<NameValuePair> pairList = new ArrayList<>();
Map<String, String> dataMap = wrapMap(entity, pairList, city.getName());
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String startTime = entity.getStartTime();
String endTime = entity.getEndTime();
String seeResult = HttpClientUtil.doPost(cloudPullUrl, pairList);
int count = 0;
if (seeResult != null) {
JSONObject json = JSONObject.fromObject(seeResult);
Number code = (Number) json.get("retCode");
if (code.intValue() == 0) {
JSONObject dataJson = (JSONObject) json.get("data");
JSONArray array = (JSONArray) dataJson.get("userVisitInfo");
count = array.size();
} else {
List<String> params = new ArrayList<>();
for (NameValuePair pair : pairList) {
params.add(pair.getName() + "=" + pair.getValue());
}
logger.error("浏览云迹接口URL:[{}] ", cloudPullUrl + Joiner.on("&").join(params));
result.setErrorMessage("调用云迹查询接口出错!请稍后再试!");
result.setStatus(-1);
return result;
}
logger.info("浏览云迹接口返回数据:", seeResult);
}
Date now = new Date();
entity.setCity(cityCode);
entity.setCreateId(userEntity.getId());
entity.setCreateName(userEntity.getName());
entity.setCustomerCount(0);
entity.setWaitCount(0);
entity.setSentCount(0);
//先设为无效,导入数据成功后置为有效
entity.setIsDelete(1);
//新增字段赋值
entity.setBlock(dataMap.get("block"));
entity.setDistrict(dataMap.get("district"));
entity.setSeeStartTime(formatter.parse(startTime));
entity.setSeeEndTime(formatter.parse(endTime));
entity.setCreateTime(now);
entity.setSeeProjectName(entity.getProjectName());
entity.setType(1);
int id = activityInterface.save(entity);
Map<String, Object> map = new HashMap<>(10);
map.put("id", id);
map.put("total", count);
result.setData(map);
} catch (Exception e) {
result.setStatus(500);
result.setErrorMessage("新增云迹活动失败");
logger.error("新增云迹活动失败");
}
return result;
}
@RequestMapping(value = "/import/{id}", method = {RequestMethod.POST})
@ResponseBody
public Object importData(HttpServletRequest request, @PathVariable int id) {
String result = "fail";
DepartmentEntity departmentEntity = (DepartmentEntity) request.getSession().getAttribute(SessionConstants.SESSION_CURRNET_DEPT_KEY);
String cityId = departmentEntity.getCityID();
DepartmentResponse departmentResponse = department.getDepartmentById(Integer.valueOf(cityId));
DepartmentEntity city = departmentResponse.getEntity();
try {
activityInterface.importCustomers(id, city);
result = "success";
} catch (Exception e) {
e.printStackTrace();
logger.error("导入云迹客户失败", e);
}
return result;
}
@RequestMapping(value = "/getLoad/{activeId}/{total}", method = {RequestMethod.GET})
@ResponseBody
public Object getLoad(@PathVariable(value = "activeId") String activeId, @PathVariable(value = "total") String total) {
House365RestObject restObject = new House365RestObject();
//cloud:process 是否执行完毕 1 是 0 否
//cloud:done 完成多少条
//cloud:protect 保护条数
String completePercent = "0";
int completed = 0;
int done = 0;
int protect = 0;
if (StringUtils.isNotBlank(activeId)) {
protect = redisUtil.hasKey("cloud:protect:" + activeId) ? redisUtil.getIntegerByKey("cloud:protect:" + activeId) : 0;
done = redisUtil.hasKey("cloud:done:" + activeId) ? redisUtil.getIntegerByKey("cloud:done:" + activeId) : 0;
completed = done + protect;
logger.warn("redis log : [" + "cloud:process:" + activeId + "_" + redisUtil.hasKey(
"cloud:process:" + activeId) + "_" + redisUtil.getValByKey("cloud:process:" + activeId) + "]");
logger.warn("redis log : [" + "cloud:done:" + activeId + "_" + redisUtil.hasKey(
"cloud:done:" + activeId) + "_" + redisUtil.getValByKey("cloud:done:" + activeId) + "]");
logger.warn("redis log : [" + "cloud:protect:" + activeId + "_" + redisUtil.hasKey(
"cloud:protect:" + activeId) + "_" + redisUtil.getValByKey("cloud:protect:" + activeId) + "]");
if (redisUtil.hasKey("cloud:process:" + activeId) && 1 == redisUtil.getIntegerByKey("cloud:process:" + activeId)) {
completePercent = "100";
} else {
int totalNum = Integer.parseInt(total);
int percent = new BigDecimal(completed).divide(new BigDecimal(totalNum), 2,
BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).intValue();
completePercent = String.valueOf(percent);
}
}
Map<String, String> pam = new HashMap<>(10);
pam.put("protectCount", "" + protect);
restObject.setTotal(String.valueOf(done));
restObject.setEntity(completePercent);
restObject.setParaMap(pam);
return restObject;
}
/**
* 填充接口参数
*
* @param entity
* @param pairList
*/
private Map<String, String> wrapMap(CloudActivityEntity entity, List<NameValuePair> pairList, String cityName) {
Map<String, String> map = new HashMap<>(10);
String projectName = entity.getProjectName();
pairList.add(new BasicNameValuePair("project_name_array", projectName));
String startTime = entity.getStartTime();
String endTime = entity.getEndTime();
pairList.add(new BasicNameValuePair("city_name", cityName));
pairList.add(new BasicNameValuePair("start_date", startTime));
pairList.add(new BasicNameValuePair("end_date", endTime));
pairList.add(new BasicNameValuePair("visit_count", String.valueOf(entity.getSeeCount())));
if (entity.getTotalPriceMin() > 0 && entity.getTotalPriceMax() > 0) {
pairList.add(new BasicNameValuePair("total_price_from", String.valueOf(entity.getTotalPriceMin())));
pairList.add(new BasicNameValuePair("total_price_to", String.valueOf(entity.getTotalPriceMax())));
}
if (entity.getAreaMin() > 0 && entity.getAreaMax() > 0) {
pairList.add(new BasicNameValuePair("area_from", String.valueOf(entity.getAreaMin())));
pairList.add(new BasicNameValuePair("area_to", String.valueOf(entity.getAreaMax())));
}
StringBuilder blockBuilder = new StringBuilder();
StringBuilder districtBuilder = new StringBuilder();
if (CollectionUtils.isNotEmpty(entity.getBlockList())) {
entity.getBlockList().forEach(e -> blockBuilder.append(e).append(","));
String blocks = blockBuilder.toString();
pairList.add(new BasicNameValuePair("plate_id_array", blocks));
}
if (CollectionUtils.isNotEmpty(entity.getDistrictList())) {
entity.getDistrictList().forEach(e -> districtBuilder.append(e).append(","));
String districts = districtBuilder.toString();
pairList.add(new BasicNameValuePair("district_id_array", districts));
}
if (StringUtils.isNotBlank(entity.getChannel())) {
pairList.add(new BasicNameValuePair("info_type", entity.getChannel()));
}
map.put("block", blockBuilder.toString());
map.put("district", districtBuilder.toString());
return map;
}
} }
...@@ -520,45 +520,6 @@ public class MarketingActivityController extends BaseController { ...@@ -520,45 +520,6 @@ public class MarketingActivityController extends BaseController {
return result; return result;
} }
int count = 0;
List<Map<String, Object>> seeList = new ArrayList<>();
List<Map<String, Object>> crmList = new ArrayList<>();
if (vo.getSeeStartTime() != null && vo.getSeeEndTime() != null) {
String cityName = city.getName();
List<NameValuePair> pairList = new ArrayList<>();
String projectName = vo.getProjectName();
String[] projectNames = projectName.split(",");
for (int i = 0; i < projectNames.length; i++) {
String name = projectNames[i].split("\\(")[0];
pairList.add(new BasicNameValuePair("items[]", name));
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String startTime = formatter.format(vo.getSeeStartTime());
String endTime = formatter.format(vo.getSeeEndTime());
pairList.add(new BasicNameValuePair("city_name", cityName));
pairList.add(new BasicNameValuePair("from", startTime));
pairList.add(new BasicNameValuePair("to", endTime));
pairList.add(new BasicNameValuePair("lower", String.valueOf(vo.getSeeCount())));
pairList.add(new BasicNameValuePair("has_login_account", "true"));
pairList.add(new BasicNameValuePair("limit", "2000"));
String seeResult = HttpClientUtil.doGet(crmSeeUrl, pairList);
if (seeResult != null) {
JSONArray jsonarray = JSONArray.fromObject(seeResult);
seeList = (List) JSONArray.toCollection(jsonarray, Map.class);
count = seeList.size();
activityLogger.info("浏览轨迹接口返回数据:", seeResult);
} else {
List<String> params = new ArrayList<>();
for (NameValuePair pair : pairList) {
params.add(pair.getName() + "=" + pair.getValue());
}
activityLogger.error("浏览轨迹接口URL:[{}] ", crmSeeUrl + Joiner.on("&").join(params));
result.setErrorMessage("调用轨迹查询接口出错!请稍后再试!");
result.setStatus(-1);
return result;
}
}
if (entity.getApplyStartTime() != null && entity.getApplyEndTime() != null) { if (entity.getApplyStartTime() != null && entity.getApplyEndTime() != null) {
if (vo.getSeeStartTime() != null && vo.getSeeEndTime() != null) { if (vo.getSeeStartTime() != null && vo.getSeeEndTime() != null) {
nameValuePairList.add(new BasicNameValuePair("page", "1")); nameValuePairList.add(new BasicNameValuePair("page", "1"));
...@@ -571,7 +532,6 @@ public class MarketingActivityController extends BaseController { ...@@ -571,7 +532,6 @@ public class MarketingActivityController extends BaseController {
JSONObject jsonObject = JSONObject.fromObject(preResult); JSONObject jsonObject = JSONObject.fromObject(preResult);
if (jsonObject.containsKey("total")) { if (jsonObject.containsKey("total")) {
total = String.valueOf(jsonObject.get("total")); total = String.valueOf(jsonObject.get("total"));
crmList = (List) jsonObject.get("docs");
} else { } else {
List<String> params = new ArrayList<>(); List<String> params = new ArrayList<>();
for (NameValuePair pair : nameValuePairList) { for (NameValuePair pair : nameValuePairList) {
...@@ -586,34 +546,7 @@ public class MarketingActivityController extends BaseController { ...@@ -586,34 +546,7 @@ public class MarketingActivityController extends BaseController {
} }
Map<String, Integer> map = new HashMap<>(10); Map<String, Integer> map = new HashMap<>(10);
map.put("activeId", entity.getId()); map.put("activeId", entity.getId());
if (entity.getApplyStartTime() != null && entity.getApplyEndTime() != null) { restObject.setTotal(String.valueOf(total));
//当满足两种条件时,取集合的交集
if (vo.getSeeStartTime() != null && vo.getSeeEndTime() != null) {
if (CollectionUtils.isNotEmpty(crmList)) {
List<Map<String, Object>> newList = new ArrayList<>();
for (Map<String, Object> m : crmList) {
String phone = m.get("phone").toString();
if (CollectionUtils.isNotEmpty(seeList)) {
for (Map<String, Object> o : seeList) {
if (o.get("login_account").equals(phone)) {
newList.add(m);
}
}
} else {
restObject.setTotal("0");
}
}
int newCount = newList.size();
restObject.setTotal(String.valueOf(newCount));
} else {
restObject.setTotal("0");
}
} else {
restObject.setTotal(total);
}
} else {
restObject.setTotal(String.valueOf(count));
}
restObject.setParaMap(map); restObject.setParaMap(map);
result.setData(restObject); result.setData(restObject);
...@@ -776,8 +709,6 @@ public class MarketingActivityController extends BaseController { ...@@ -776,8 +709,6 @@ public class MarketingActivityController extends BaseController {
restObject.setTotal(String.valueOf(vo.getEntity().getExpectExtractCount())); restObject.setTotal(String.valueOf(vo.getEntity().getExpectExtractCount()));
restObject.setEntity(vo.getEntity().getId()); restObject.setEntity(vo.getEntity().getId());
marketingActivity.importCustomers(restObject, city); marketingActivity.importCustomers(restObject, city);
} else {
marketingActivity.importCustomerNew(vo, paraMap, city);
} }
final Integer acid = entity.getId(); final Integer acid = entity.getId();
......
...@@ -607,8 +607,8 @@ public class PlatformManagementController extends BaseController { ...@@ -607,8 +607,8 @@ public class PlatformManagementController extends BaseController {
UserUtil.showCreateSource(customerEntity); UserUtil.showCreateSource(customerEntity);
} }
Map<String, Object> tmpMap = new HashMap<>(10); Map<String, Object> tmpMap = new HashMap<>(10);
List<CustomerProjectEntity> cpList = new ArrayList<>(); List<CustomerProjectEntity> cpList;
List<CustomerCallbackLogEntity> backLogList = new ArrayList<>(); List<CustomerCallbackLogEntity> backLogList;
if (StringUtils.isNotEmpty(String.valueOf(customerEntity.getManagerId()))) { if (StringUtils.isNotEmpty(String.valueOf(customerEntity.getManagerId()))) {
//约看项目 //约看项目
cpList = doCustomerProject(userEntity, customerIdList); cpList = doCustomerProject(userEntity, customerIdList);
...@@ -879,7 +879,6 @@ public class PlatformManagementController extends BaseController { ...@@ -879,7 +879,6 @@ public class PlatformManagementController extends BaseController {
* *
* @param model * @param model
* @param request * @param request
* @param
* @return * @return
*/ */
@RequestMapping(value = "saveRule", method = RequestMethod.GET) @RequestMapping(value = "saveRule", method = RequestMethod.GET)
......
...@@ -540,6 +540,18 @@ public class UserController extends BaseController { ...@@ -540,6 +540,18 @@ public class UserController extends BaseController {
entity.getRealName()) && !tmpEntity.getRealName().equals(entity.getRealName())) { entity.getRealName()) && !tmpEntity.getRealName().equals(entity.getRealName())) {
customer.updateManager(entity.getId(), entity.getRealName()); customer.updateManager(entity.getId(), entity.getRealName());
} }
//改变用户名需要同步给im
String env = MemoryPropertyPlaceholderConfigurer.getContextProperty("system.env");
if ("production".equalsIgnoreCase(env) && !oldEntity.getRealName().equals(entity.getRealName())) {
if(org.apache.commons.lang.StringUtils.isNotBlank(oldEntity.getAccId())){
String token = getImToken();
List<NameValuePair> cornetInParam = new ArrayList<>();
cornetInParam.add(new BasicNameValuePair("accid", oldEntity.getAccId()));
cornetInParam.add(new BasicNameValuePair("username", entity.getRealName()));
String updateResult = HttpUtil.doPostWithHeader("http://yunxinim.house365.com/api/5b9235bea9f88", cornetInParam, token, "");
logger.info("******SYNC_TO_CRM_RESULT*******" + updateResult);
}
}
user.updateUserAndSyncToWechat(request); user.updateUserAndSyncToWechat(request);
redirectAttributes.addAttribute("message", "更新成功"); redirectAttributes.addAttribute("message", "更新成功");
...@@ -1020,4 +1032,44 @@ public class UserController extends BaseController { ...@@ -1020,4 +1032,44 @@ public class UserController extends BaseController {
return result; return result;
} }
private String getImToken() {
String accessToken = "";
try {
String deciceId = com.house365.web.util.StringUtils.getRandomNumber(10);
String randStr = com.house365.web.util.StringUtils.getRandomChars(13);
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
String signature = HttpUtil.getSignature2(deciceId, randStr, timestamp);
//获取accesstoken
HashMap<String, String> accesstokenMap = new HashMap<>(5);
accesstokenMap.put("version", "v3.0");
//获取acceToken接口URl
String getAccessTokenUrl = "http://yunxinim.house365.com/api/5b0cc34464a64";
List<NameValuePair> tokenInParam = new ArrayList<>();
tokenInParam.add(new BasicNameValuePair("app_id", "89962055"));
tokenInParam.add(new BasicNameValuePair("app_secret", "pMHTUWAoOGSjaToIhHKwmQJKWZcAAvjN"));
tokenInParam.add(new BasicNameValuePair("device_id", deciceId));
tokenInParam.add(new BasicNameValuePair("rand_str", randStr));
tokenInParam.add(new BasicNameValuePair("timestamp", timestamp));
tokenInParam.add(new BasicNameValuePair("signature", signature));
List<String> newTokenParams = new ArrayList<>();
for (NameValuePair pair : tokenInParam) {
newTokenParams.add(pair.getName() + "=" + pair.getValue());
}
String newTokenUrl = getAccessTokenUrl + "?" + Joiner.on("&").join(newTokenParams);
String tokenResult = "";
tokenResult = HttpUtil.getHttpRequest(newTokenUrl, accesstokenMap, 100000, "utf-8");
if (Strings.isNullOrEmpty(tokenResult)) {
throw new ServiceException("get token failed");
}
JSONObject json = JSONObject.fromObject(tokenResult);
JSONObject jo = json.getJSONObject("data");
accessToken = jo.getString("access_token");
logger.info("******SYNC_TO_CRM_RESULT ACCESS_TOKEN*******" + accessToken);
} catch (Exception e) {
e.printStackTrace();
}
return accessToken;
}
} }
...@@ -28,7 +28,8 @@ projects.server.url=http://oms.house365.com/test/adminpack/index.php ...@@ -28,7 +28,8 @@ projects.server.url=http://oms.house365.com/test/adminpack/index.php
news.server.url=http://mapi.house365.com/cms/mobile_news.php news.server.url=http://mapi.house365.com/cms/mobile_news.php
CRM.CUSTOMERQUERY.URL=http://crmtest.house365.com/api/hgs/query CRM.CUSTOMERQUERY.URL=http://crmtest.house365.com/api/hgs/query
#CRM.CUSTOMERQUERY.URL=http://crm.house365.com/api/hgs/query #CRM.CUSTOMERQUERY.URL=http://crm.house365.com/api/hgs/query
CRM.TRANSLATE.URL=http://crmtest.house365.com/api/hgs/translate #CRM.TRANSLATE.URL=http://crmtest.house365.com/api/hgs/translate
CRM.TRANSLATE.URL=http://crm.house365.com/api/hgs/translate
CRM.SEEQUERY.URL=http://192.168.111.1/statqueryforhgs/v0/itemnames CRM.SEEQUERY.URL=http://192.168.111.1/statqueryforhgs/v0/itemnames
...@@ -70,3 +71,5 @@ WECHAT.IM.SECRET=eu6lRJtqPqSC4NGVNTuJcEhhUgJFSGUp4HZLCAzv5O0 ...@@ -70,3 +71,5 @@ WECHAT.IM.SECRET=eu6lRJtqPqSC4NGVNTuJcEhhUgJFSGUp4HZLCAzv5O0
get.pay.url = https://mtsapi.house365.com get.pay.url = https://mtsapi.house365.com
#云信im同步地址 #云信im同步地址
IM.SYNC.URL = http://www.test.yunxin.com IM.SYNC.URL = http://www.test.yunxin.com
#云迹拉取新接口地址
CLOUD.PULL.URL = http://192.168.105.121:8083/user/hgs/loginaccountinfo
\ No newline at end of file
...@@ -71,6 +71,8 @@ WECHAT.IM.SECRET=eu6lRJtqPqSC4NGVNTuJcEhhUgJFSGUp4HZLCAzv5O0 ...@@ -71,6 +71,8 @@ WECHAT.IM.SECRET=eu6lRJtqPqSC4NGVNTuJcEhhUgJFSGUp4HZLCAzv5O0
get.pay.url = https://mtsapi.house365.com get.pay.url = https://mtsapi.house365.com
#云信im同步地址 #云信im同步地址
IM.SYNC.URL = http://yunxinim.house365.com IM.SYNC.URL = http://yunxinim.house365.com
#云迹拉取新接口地址
CLOUD.PULL.URL = http://192.168.105.121:8083/user/hgs/loginaccountinfo
......
...@@ -71,5 +71,7 @@ WECHAT.IM.SECRET=eu6lRJtqPqSC4NGVNTuJcEhhUgJFSGUp4HZLCAzv5O0 ...@@ -71,5 +71,7 @@ WECHAT.IM.SECRET=eu6lRJtqPqSC4NGVNTuJcEhhUgJFSGUp4HZLCAzv5O0
get.pay.url = https://mtsapi.house365.com get.pay.url = https://mtsapi.house365.com
#云信im同步地址 #云信im同步地址
IM.SYNC.URL = http://www.test.yunxin.com IM.SYNC.URL = http://www.test.yunxin.com
#云迹拉取新接口地址
CLOUD.PULL.URL = http://192.168.105.121:8083/user/hgs/loginaccountinfo
...@@ -165,6 +165,9 @@ ...@@ -165,6 +165,9 @@
<shiro:hasPermission name="CLOUDACTIVITY"> <shiro:hasPermission name="CLOUDACTIVITY">
<li><a href="${ctx}/cloudactivity/list">云迹数据</a></li> <li><a href="${ctx}/cloudactivity/list">云迹数据</a></li>
</shiro:hasPermission> </shiro:hasPermission>
<shiro:hasPermission name="CLOUDPULL">
<li><a href="${ctx}/cloudactivity/pullList">云迹拉取数据</a></li>
</shiro:hasPermission>
<shiro:hasPermission name="EXTERNALCUS"> <shiro:hasPermission name="EXTERNALCUS">
<li><a href="${ctx}/externalCustomer/list">外部客户</a></li> <li><a href="${ctx}/externalCustomer/list">外部客户</a></li>
</shiro:hasPermission> </shiro:hasPermission>
......
<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
<title>新增云迹活动</title>
</head>
<body>
<link rel="stylesheet" type="text/css" href="${static_common}/jquery-ui/jquery-ui.min.css"/>
<form id="input_form" class="form-horizontal valid" action="${ctx}/cloudactivity/addCloud" method="post">
<!-- 面包屑 begin -->
<div class="row-fluid">
<div class="span12">
<ul class="breadcrumb">
<li>
<span class="divider" style="color:#26a0da;font-weight:bold;">/</span>
<a href="${ctx}/cloudactivity/list">云迹活动列表</a>
</li>
<li class="active">
<span class="divider" style="color:#26a0da;font-weight:bold;">/</span>
<span class="inline">新增</span>
</li>
</ul>
</div>
</div>
<!-- 面包屑 end -->
<house365:flushMessage/>
<div class="row${fluid}">
<div class="span12">
<div class="form-horizontal house365Page">
<div class="house365Border">
<!-- 片段头 begin -->
<div class="sectionTitle">
<h5>输入数据提取条件</h5>
</div>
<div class="alert">
<p>受CRM系统查询影响,单次获取的客户数量最多为999个,活动周期为30天</p>
</div>
<input id="total" name="total" type="hidden"/>
<input id="activeId" name="activeId" type="hidden"/>
</div>
<div class="house365Border">
<div class="sectionTitle">
<h5>基本信息</h5>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label"><span style="color: red">*</span>活动名称:</label>
<div class="controls">
<input type="text" class="span3" id="name" name="name"/>
</div>
</div>
</div>
</div>
<div class="house365Border">
<div class="sectionTitle">
<h5>意向条件</h5>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">总价范围:</label>
<div class="controls">
<input type="text" id="totalPriceMin" name="entity.totalPriceMin"
class="span3 number digits">
<input type="text" id="totalPriceMax" name="entity.totalPriceMax"
class="span3 number digits ">(万元)
</div>
</div>
<div class="span6 control-group">
<label class="control-label">面积范围:</label>
<div class="controls">
<input type="text" id="areaMin" name="entity.areaMin"
class="span3 number digits ">
<input type="text" id="areaMax" name="entity.areaMax"
class="span3 number digits ">(㎡)
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">板块:</label>
<div class="controls">
<input name="entity.blockName" id="blockName" type="hidden" value="${entity.block}"/>
<select id="block" name="entity.block" class="selectpicker show-tick form-control"
multiple data-live-search="false">
<c:forEach items="${blocks}" var="block">
<option value="${block.dicValue}">${block.dicName}</option>
</c:forEach>
</select>
</div>
</div>
<div class="span6 control-group">
<label class="control-label">区域:</label>
<div class="controls">
<input name="entity.districtName" id="districtName" type="hidden"
value="${entity.district}"/>
<select id="district" name="entity.district" class="selectpicker show-tick form-control"
multiple data-live-search="false">
<c:forEach items="${districts}" var="district">
<option value="${district.dicValue}">${district.dicName}</option>
</c:forEach>
</select>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">物业类型:</label>
<div class="controls">
<input name="entity.channelName" id="channelName" type="hidden"
value="${entity.channel}"/>
<select id="channel" name="entity.channel" onchange="setchannel()">
<option value="">--请选择--</option>
<c:forEach items="${fns:getDictList('crm_property_type')}" var="dict">
<option value="${dict.dicValue}">${dict.dicName}</option>
</c:forEach>
</select>
</div>
</div>
</div>
</div>
<div class="house365Border">
<div class="sectionTitle">
<h5>浏览轨迹条件</h5>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<label class="control-label">浏览项目:</label>
<div class="controls">
<input type="hidden" id="projectId" name="projectId"/>
<input type="text" id="projectName" name="projectName" class=" span12"
onclick="assignProject(500)"/>
</div>
</div>
<div class="span4 control-group">
<label class="control-label">访问时间:</label>
<div class="controls">
<input type="hidden" id="seeStartTime" name="seeStartTime"/>
<input type="hidden" id="seeEndTime" name="seeEndTime"/>
<input type="text" id="signTimeNew" name="signTimeNew" class="form-control span12">
<a href="javascript:void(0)" class="btn blue" onclick="cleanVisitTime()">
清空
</a>
</div>
<div style="margin-left: 180px;">报名时间与访问时间至少选一个。由于CRM限制,访问时间暂时仅限近10天</div>
</div>
</div>
<div class="row-fluid">
<label class="control-label">浏览次数:</label>
<div class="controls">
<select id="seeCount" name="seeCount">
<option value="0" selected>--请选择--</option>
<option value="5">>5</option>
<option value="10">>10</option>
<option value="20">>20</option>
<option value="30">>30</option>
</select>
</div>
</div>
<div class="row-fluid">
<div class="span1 control-group">
</div>
<div class="span6 control-group" style="margin-left: 50%;margin-top: 10px;">
<a href="javascript:void(0)" class="btn blue" onclick="checkForm()">
<i class="icon-save"></i>&nbsp;下一步
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<div id="confirmDialog" style="display: none" title="">
</div>
<div id="loadingDialog" style="display: none;">
<div class="progress" id="prog_out">
<div class="bar" style="width: 0%;" id="prog_in"></div>
</div>
已导入<span id="complete">0</span>
</div>
<script src="${static_common}/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="${static_common }/script/jquery/bootstrap-select.min.js" type="text/javascript"></script>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/css/bootstrap-select.min.css">
<script href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/js/i18n/defaults-*.min.js"></script>
<script type="text/javascript">
var $form = $("#input_form");
function setchannel() {
var name = $("#channel").find("option:selected").text();
$("#channelName").val(name);
}
function cleanVisitTime() {
$("#seeStartTime").val("");
$("#seeEndTime").val("");
return false;
}
function doImport() {
$("#loadingDialog").dialog({
dialogClass: "no-close",
autoOpen: false,
width: 1000,
modal: true,
show: {
effect: "blind",
duration: 100
},
hide: {
effect: "explode",
duration: 100
}
}).dialog("open");
var sitv = setInterval(function () {
var prog_url = "${ctx}/cloudactivity/getLoad/" + $("#activeId").val() + "/" + $("#total").val();
$.getJSON(prog_url, function (res) {
$('#prog_in').width(res.entity + '%'); //改变进度条进度,注意这里是内层的div,res是后台返回的进度
$('#complete').text(res.total);
if (res.entity == 100) {
$("#loadingDialog").dialog("close");
clearInterval(sitv);
$("#ui-id-1").text("加入成功");
$("#confirmDialog").text(res.total + "组数据已进入待派列表,其中" + res.paraMap.protectCount + "条数据处于保护未显示");
$("#confirmDialog").dialog({
dialogClass: "no-close",
autoOpen: false,
modal: true,
show: {
effect: "blind",
duration: 100
},
hide: {
effect: "explode",
duration: 100
},
buttons: [
{
text: "确认",
click: function () {
$(this).dialog("close");
window.open("/house365-hgs-web/cloudcustomer/list/" + $("#activeId").val(), "_blank");
return true;
}
}
]
}).dialog("open");
// $(".ui-dialog-titlebar").hide();
}
});
}, 900);
$.ajax({
url: "${ctx}/cloudactivity/import/" + $("#activeId").val(),
type: "POST",
async: true,
data: $form.serialize(),
success: function (response) {
}
});
}
function assignBuilding(maxCount) {
House365Util.createRemoteModal("选择楼盘", "${ctx}/customer/assignBuilding?maxCount=" + maxCount
+ "&departmentNames=" + $("#buildingName").val() + "&departmentIds=" + $("#buildingId").val(), null, function () {
var buildIds = "", buildNames = "";
$("[name='buildId']").each(function () {
buildIds = buildIds + $(this).val() + ",";
});
$("[name='buildName']").each(function () {
buildNames = buildNames + $(this).val() + ",";
});
$("#buildingId").val(buildIds);
$("#buildingName").val(buildNames);
return true;
});
}
function assignProject(maxCount) {
House365Util.createRemoteModal("选择楼盘", "${ctx}/customer/assignBuildingNew?maxCount=" + maxCount
+ "&departmentNames=" + $("#projectName").val() + "&departmentIds=" + $("#projectId").val(), null, function () {
var projectIds = "", projectNames = "";
$("[name='prtId']").each(function () {
projectIds = projectIds + $(this).val() + ",";
});
$("[name='prtName']").each(function () {
projectNames = projectNames + $(this).val() + ",";
});
$("#projectId").val(projectIds);
$("#projectName").val(projectNames);
return true;
});
}
function checkForm() {
debugger;
var name = $("#name").val();
var seeStartTime = $("#seeStartTime").val();
var seeEndTime = $("#seeEndTime").val();
var seeCount = $("#seeCount").val();
var projectName = $("#projectName").val();
var totalPriceMin = parseInt($("#totalPriceMin").val(), 10) || 0;
var totalPriceMax = parseInt($("#totalPriceMax").val(), 10) || 0;
var areaMin = parseInt($("#areaMin").val(), 10) || 0;
var areaMax = parseInt($("#areaMax").val(), 10) || 0;
var block = $("#block").val();
var district = $("#district").val();
var channel = $("#channel").val();
var blockName = $("#block").find("option:selected").text();
var districtName = $("#district").find("option:selected").text();
var channelName = $("#channelName").val();
if (name == null || name == '') {
alert("请填写活动名称");
return;
}
if (seeStartTime == '') {
alert("访问时间不能为空");
return;
}
if (seeStartTime != '') {
var projectId = $('#projectId').val();
if (projectId == null || projectId == '') {
alert("请填写浏览项目");
return;
}
var date = new Date(new Date().getTime() - (3000 * 60 * 60 * 24 * 30));
var seperator = "-";
var year = date.getFullYear();
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var dateNew = year + seperator + month + seperator + strDate + " 00:00:00";
if (seeStartTime < dateNew) {
alert("仅限近30天的数据");
return;
}
}
if ($("#totalPriceMin").val() && !$("#totalPriceMax").val()) {
alert("请填写完整总价范围");
return;
}
if ($("#areaMin").val() && !$("#areaMax").val()) {
alert("请填写完整面积范围");
return;
}
var data = {
name: name,
totalPriceMin: parseInt(totalPriceMin),
totalPriceMax: parseInt(totalPriceMax),
areaMin: parseInt(areaMin),
areaMax: parseInt(areaMax),
blockList: block,
districtList: district,
channel: channel,
blockName: blockName,
districtName: districtName,
channelName: channelName,
projectName: projectName,
startTime: seeStartTime,
endTime: seeEndTime,
seeCount: parseInt(seeCount)
};
data = JSON.stringify(data);
console.log(data);
var validValue = $form.valid();
if (validValue) {
$.ajax({
url: '${ctx}/cloudactivity/addCloud',
type: 'POST',
contentType: 'application/json',
data: data,
dataType: 'json',
cache: false,
success: function (response) {
if (0 == response.status) {
var total = response.data.total;
var activeId = response.data.id;
$("#total").val(total);
$("#activeId").val(activeId);
if (total > 3000) {
alert("数据量超过3000条,请缩小范围");
0
return false;
}
$("#confirmDialog").attr("title", "查询确认");
$("#confirmDialog").text("根据条件查询到" + total + "组客户数据\n" + "是否加入到活动中?");
$("#confirmDialog").dialog({
dialogClass: "no-close",
autoOpen: false,
width: 600,
height: 150,
modal: true,
show: {
effect: "blind",
duration: 100
},
hide: {
effect: "explode",
duration: 100
},
buttons: [
{
text: "确认",
click: function () {
$("#confirmDialog").dialog("close");
doImport();
return true;
}
},
{
text: "取消",
click: function () {
$(this).dialog("close");
return false;
}
}
]
}).dialog("open");
} else {
alert(response.errorMessage);
return false;
}
}
});
}
}
$(document).ready(function () {
var curDate;
var limitDate = "${limitDate}";
var maxDate;
if (1 == limitDate) {
curDate = moment(new Date().getTime() - 3 * 24 * 60 * 60 * 1000);
maxDate = moment(new Date() - 3 * 24 * 60 * 60 * 1000);
} else {
curDate = new Date();
maxDate = new Date(curDate.getTime() + 60 * 24 * 60 * 60 * 1000);
}
$.ajaxSetup({
async: false
});
var options = {
"showWeekNumbers": true,
"showISOWeekNumbers": true,
"startDate": curDate,
"endDate": new Date(curDate + 60 * 24 * 60 * 60 * 1000),
"maxDate": maxDate,
"timePickerSeconds": true,
"autoApply": true,
"locale": {
"direction": "ltr",
"format": "YYYY年MM月DD日",
"separator": " 至 ",
"applyLabel": "确定",
"cancelLabel": "取消",
"fromLabel": "从",
"toLabel": "至",
"customRangeLabel": "Custom",
"daysOfWeek": [
"日",
"一",
"二",
"三",
"四",
"五",
"六"
],
"monthNames": [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月"
],
"firstDay": 1
},
weekendDis: false,
"alwaysShowCalendars": true
};
$('#signTimeNew').daterangepicker(options, function (start, end, label) {
// console.log("New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')");
$("#seeStartTime").val(start.format('YYYY-MM-DD 00:00:00'));
$("#seeEndTime").val(end.format('YYYY-MM-DD 00:00:00'));
});
$("#signTimeNew").val("");
});
</script>
</body>
</html>
...@@ -29,9 +29,10 @@ ...@@ -29,9 +29,10 @@
class="m-wrap small" placeholder="活动名称">&nbsp;&nbsp;&nbsp;&nbsp; class="m-wrap small" placeholder="活动名称">&nbsp;&nbsp;&nbsp;&nbsp;
<a class="btn" onclick="btnSubmit();">搜索</a> <a class="btn" onclick="btnSubmit();">搜索</a>
</div> </div>
<div style="margin-left: 90%"> <div style="margin-left: 80%">
<button type="button" class="btn btn-default" onclick="toAddCloud()">创建活动</button>
<shiro:hasPermission name="FUNC:CUSTOMCLOUD"> <shiro:hasPermission name="FUNC:CUSTOMCLOUD">
<button type="button" class="btn btn-default" onclick="showModalNew()">定制云迹数据</button> <button type="button" class="btn btn-default" onclick="showModalNew()" style="margin-left: 10px">定制云迹数据</button>
</shiro:hasPermission> </shiro:hasPermission>
</div> </div>
</form> </form>
...@@ -239,6 +240,10 @@ ...@@ -239,6 +240,10 @@
$("#cloudModal").modal('show'); $("#cloudModal").modal('show');
}; };
var toAddCloud = function () {
window.open("/house365-hgs-web/cloudactivity/toAdd", "_blank");
};
var checkNum = 0; var checkNum = 0;
function checkAll(btn) { function checkAll(btn) {
var that = btn; var that = btn;
......
<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
<title>云迹拉取数据</title>
</head>
<body>
<!-- 面包屑 begin -->
<div class="row-fluid">
<div class="span12">
<ul class="breadcrumb">
<li><a href="/house365-hgs-web/">首页</a>
<span class="divider" style="color:#26a0da;font-weight:bold;"> / </span>客户管理
<span class="divider" style="color:#26a0da;font-weight:bold;"> / </span>云迹拉取数据
</li>
</ul>
</div>
</div>
<div class="page-container">
<div class="row${fluid}">
<form id="filterForm" name="filterForm" class="form-inline filterForm"
action="${ctx}/cloudactivity/pullList" method="get">
<div style="margin-top:10px;">
活动名称:<input type="text" id="search_name" style="border: 1px solid #d5d5d5;" name="search_name"
value="${param['search_name']}"
class="m-wrap small" placeholder="活动名称">&nbsp;&nbsp;&nbsp;&nbsp;
<a class="btn" onclick="btnSubmit();">搜索</a>
</div>
</form>
<table class="table table-bordered table-advance table-hover">
<tr class="info">
<td width="100" style="text-align:center">序号</td>
<td width="100" style="text-align:center">名称</td>
<td width="100" style="text-align:center">总数</td>
<td width="100" style="text-align:center">待派</td>
<td width="100" style="text-align:center">已派</td>
<td width="100" style="text-align:center">创建人</td>
<td width="100" style="text-align:center">创建时间</td>
<td width="100" style="text-align:center">操作</td>
</tr>
<c:if test="${not empty dataList}">
<c:forEach items="${dataList}" var="item" varStatus="i">
<tr>
<td nowrap="nowrap" style="text-align:center;">
${i.index+1}
</td>
<td nowrap="nowrap" style="text-align:center;">
${item.name}
</td>
<td nowrap="nowrap" style="text-align:center;">
${item.customerCount}
</td>
<td nowrap="nowrap" style="text-align:center;">
${item.waitCount}
</td>
<td nowrap="nowrap" style="text-align:center;">
${item.sentCount}
</td>
<td nowrap="nowrap" style="text-align:center;">
${item.createName}
</td>
<td nowrap="nowrap" style="text-align:center;">
<c:if test="${null ne item.createTime && '' ne item.createTime}">
<f:formatDate value='${item.createTime}'
pattern='yyyy-MM-dd HH:mm:ss'/>
</c:if>
<c:if test="${null eq item.createTime || '' eq item.createTime}">
-
</c:if>
</td>
<td nowrap="nowrap" style="text-align:center;">
<button onclick="geDetail(${item.id})">详情</button>
</td>
</tr>
</c:forEach>
</c:if>
<c:if test="${ empty dataList}">
<tr>
<td colspan="15" style="text-align: center">暂未找到与条件相关的数据,请重新搜索</td>
</tr>
</c:if>
</table>
<div class="row${fluid}">
<house365:pagination page="${page}"/>
</div>
</div>
</div>
<link rel="stylesheet" href="${static_common }/script/bootstrap/css/bootstrap-multiselect.css" type="text/css">
<script type="text/javascript" src="${static_common }/script/bootstrap/js/bootstrap-multiselect.js"></script>
<script type="text/javascript">
function btnSubmit() {
$('#filterForm').submit();
}
$(document).keydown(function (event) {
if (event.keyCode == "13") {
//回车执行查询
$('#filterForm').submit();
}
});
function geDetail(id) {
window.open("/house365-hgs-web/cloudcustomer/list/" + id, "_blank");
}
</script>
</body>
</html>
...@@ -276,71 +276,70 @@ ...@@ -276,71 +276,70 @@
</div> </div>
</div> </div>
<%--<div class="row-fluid">--%>
<%--<div class="span1 control-group">--%>
<%--</div>--%>
<%--<div class="span6 control-group">--%>
<%--<a href="javascript:void(0)" class="btn blue" onclick="checkForm()">--%>
<%--<i class="icon-save"></i>&nbsp;下一步--%>
<%--</a>--%>
<%--&lt;%&ndash;<a href="${ctx}/marketingactivity/step1/${entity.id}?action=edit" class="btn gray"><i class="icon-mail-reply"></i>&nbsp;返回</a>&ndash;%&gt;--%>
<%--</div>--%>
<%--</div>--%>
</div>
<div class="house365Border">
<div class="sectionTitle">
<h5>浏览轨迹条件</h5>
</div>
<div class="row-fluid"> <div class="row-fluid">
<div class="span6 control-group"> <div class="span1 control-group"></div>
<label class="control-label">浏览项目:</label>
<div class="controls">
<input type="hidden" id="projectId" name="projectId"/>
<input type="text" id="projectName" name="projectName" class=" span12"
onclick="assignProject(500)"/>
</div>
</div>
<div class="span4 control-group">
<label class="control-label">访问时间:</label>
<div class="controls">
<input type="hidden" id="seeStartTime" name="seeStartTime"/>
<input type="hidden" id="seeEndTime" name="seeEndTime"/>
<input type="text" id="signTimeNew" name="signTimeNew" class="form-control span12">
<a href="javascript:void(0)" class="btn blue" onclick="cleanVisitTime()">
清空
</a>
</div>
<div style="margin-left: 180px;">报名时间与访问时间至少选一个。由于CRM限制,访问时间暂时仅限近10天</div>
</div>
</div>
<div class="row-fluid">
<label class="control-label">浏览次数:</label>
<div class="controls">
<select id="seeCount" name="seeCount">
<option value="0" selected>--请选择--</option>
<option value="5">>5</option>
<option value="10">>10</option>
<option value="20">>20</option>
<option value="30">>30</option>
</select>
</div>
</div>
<div class="row-fluid">
<div class="span1 control-group">
</div>
<div class="span6 control-group" style="margin-left: 50%;margin-top: 10px;"> <div class="span6 control-group" style="margin-left: 50%;margin-top: 10px;">
<a href="javascript:void(0)" class="btn blue" onclick="checkForm()"> <a href="javascript:void(0)" class="btn blue" onclick="checkForm()">
<i class="icon-save"></i>&nbsp;下一步 <i class="icon-save"></i>&nbsp;下一步
</a> </a>
<%--<a href="${ctx}/marketingactivity/step1/${entity.id}?action=edit" class="btn gray"><i class="icon-mail-reply"></i>&nbsp;返回</a>--%>
</div> </div>
</div> </div>
</div> </div>
<%--<div class="house365Border">--%>
<%--<div class="sectionTitle">--%>
<%--<h5>浏览轨迹条件</h5>--%>
<%--</div>--%>
<%--<div class="row-fluid">--%>
<%--<div class="span6 control-group">--%>
<%--<label class="control-label">浏览项目:</label>--%>
<%--<div class="controls">--%>
<%--<input type="hidden" id="projectId" name="projectId"/>--%>
<%--<input type="text" id="projectName" name="projectName" class=" span12"--%>
<%--onclick="assignProject(500)"/>--%>
<%--</div>--%>
<%--</div>--%>
<%--<div class="span4 control-group">--%>
<%--<label class="control-label">访问时间:</label>--%>
<%--<div class="controls">--%>
<%--<input type="hidden" id="seeStartTime" name="seeStartTime"/>--%>
<%--<input type="hidden" id="seeEndTime" name="seeEndTime"/>--%>
<%--<input type="text" id="signTimeNew" name="signTimeNew" class="form-control span12">--%>
<%--<a href="javascript:void(0)" class="btn blue" onclick="cleanVisitTime()">--%>
<%--清空--%>
<%--</a>--%>
<%--</div>--%>
<%--<div style="margin-left: 180px;">报名时间与访问时间至少选一个。由于CRM限制,访问时间暂时仅限近10天</div>--%>
<%--</div>--%>
<%--</div>--%>
<%--<div class="row-fluid">--%>
<%--<label class="control-label">浏览次数:</label>--%>
<%--<div class="controls">--%>
<%--<select id="seeCount" name="seeCount">--%>
<%--<option value="0" selected>--请选择--</option>--%>
<%--<option value="5">>5</option>--%>
<%--<option value="10">>10</option>--%>
<%--<option value="20">>20</option>--%>
<%--<option value="30">>30</option>--%>
<%--</select>--%>
<%--</div>--%>
<%--</div>--%>
<%--<div class="row-fluid">--%>
<%--<div class="span1 control-group">--%>
<%--</div>--%>
<%--<div class="span6 control-group" style="margin-left: 50%;margin-top: 10px;">--%>
<%--<a href="javascript:void(0)" class="btn blue" onclick="checkForm()">--%>
<%--<i class="icon-save"></i>&nbsp;下一步--%>
<%--</a>--%>
<%--</div>--%>
<%--</div>--%>
<%--</div>--%>
</div> </div>
</div> </div>
</div> </div>
...@@ -425,7 +424,6 @@ ...@@ -425,7 +424,6 @@
}); });
} }
function doImport() { function doImport() {
$("#loadingDialog").dialog({ $("#loadingDialog").dialog({
...@@ -532,37 +530,37 @@ ...@@ -532,37 +530,37 @@
function checkForm() { function checkForm() {
var applyStartTime = $("#applyStartTime").val(); var applyStartTime = $("#applyStartTime").val();
var applyEndTime = $("#applyEndTime").val(); var applyEndTime = $("#applyEndTime").val();
var seeStartTime = $("#seeStartTime").val(); // var seeStartTime = $("#seeStartTime").val();
var seeEndTime = $("#seeEndTime").val(); // var seeEndTime = $("#seeEndTime").val();
var seeCount = $("#seeCount").val(); // var seeCount = $("#seeCount").val();
if (applyStartTime == '' && seeStartTime == '') { if (applyStartTime == '' ) {
alert("报名时间与访问时间至少选一个"); alert("报名时间不能为空");
return; return;
} }
if (seeStartTime != '') { // if (seeStartTime != '') {
var projectId = $('#projectId').val(); // var projectId = $('#projectId').val();
if (projectId == null || projectId == '') { // if (projectId == null || projectId == '') {
alert("请填写浏览项目"); // alert("请填写浏览项目");
return; // return;
} // }
var date = new Date(new Date().getTime() - (1000 * 60 * 60 * 24 * 30)); // var date = new Date(new Date().getTime() - (1000 * 60 * 60 * 24 * 30));
var seperator = "-"; // var seperator = "-";
var year = date.getFullYear(); // var year = date.getFullYear();
var month = date.getMonth() + 1; // var month = date.getMonth() + 1;
var strDate = date.getDate(); // var strDate = date.getDate();
if (month >= 1 && month <= 9) { // if (month >= 1 && month <= 9) {
month = "0" + month; // month = "0" + month;
} // }
if (strDate >= 0 && strDate <= 9) { // if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate; // strDate = "0" + strDate;
} // }
var dateNew = year + seperator + month + seperator + strDate + " 00:00:00"; // var dateNew = year + seperator + month + seperator + strDate + " 00:00:00";
//
if (seeStartTime < dateNew) { // if (seeStartTime < dateNew) {
alert("仅限近10天的数据"); // alert("仅限近10天的数据");
return; // return;
} // }
} // }
if ($("#totalPriceLower").val() && !$("#totalPriceHigher").val()) { if ($("#totalPriceLower").val() && !$("#totalPriceHigher").val()) {
alert("请填写完整总价范围"); alert("请填写完整总价范围");
return; return;
...@@ -596,7 +594,7 @@ ...@@ -596,7 +594,7 @@
success: function (response) { success: function (response) {
if (0 == response.status) { if (0 == response.status) {
var total = response.data.total; var total = response.data.total;
if(total > 3000){ if (total > 3000) {
alert("数据量超过3000条,请缩小范围"); alert("数据量超过3000条,请缩小范围");
return false; return false;
} }
...@@ -651,10 +649,10 @@ ...@@ -651,10 +649,10 @@
var curDate; var curDate;
var limitDate = "${limitDate}"; var limitDate = "${limitDate}";
var maxDate; var maxDate;
if(1 == limitDate){ if (1 == limitDate) {
curDate = moment(new Date().getTime()-3* 24 * 60 * 60 * 1000); curDate = moment(new Date().getTime() - 3 * 24 * 60 * 60 * 1000);
maxDate = moment(new Date()-3* 24 * 60 * 60 * 1000); maxDate = moment(new Date() - 3 * 24 * 60 * 60 * 1000);
}else{ } else {
curDate = new Date(); curDate = new Date();
maxDate = new Date(curDate.getTime() + 60 * 24 * 60 * 60 * 1000); maxDate = new Date(curDate.getTime() + 60 * 24 * 60 * 60 * 1000);
} }
......
...@@ -2,8 +2,11 @@ package com.house365.ws.interfaces.server; ...@@ -2,8 +2,11 @@ package com.house365.ws.interfaces.server;
import com.house365.beans.entity.CloudActivityEntity; import com.house365.beans.entity.CloudActivityEntity;
import com.house365.beans.entity.CloudCountEntity; import com.house365.beans.entity.CloudCountEntity;
import com.house365.beans.entity.DepartmentEntity;
import com.house365.rest.parameter.House365RestObject;
import com.house365.ws.beans.request.MapListRequest; import com.house365.ws.beans.request.MapListRequest;
import com.house365.ws.beans.response.MapListResponse; import com.house365.ws.beans.response.MapListResponse;
import org.apache.http.NameValuePair;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -13,14 +16,20 @@ import java.util.Map; ...@@ -13,14 +16,20 @@ import java.util.Map;
*/ */
public interface ICloudActivityInterface { public interface ICloudActivityInterface {
int save(CloudActivityEntity entity);
MapListResponse list(MapListRequest listRequest); MapListResponse list(MapListRequest listRequest);
MapListResponse pullList(MapListRequest listRequest);
List<CloudCountEntity> reportList(Map<String, Object> map); List<CloudCountEntity> reportList(Map<String, Object> map);
MapListResponse reportDetailList(MapListRequest listRequest, int countId); MapListResponse reportDetailList(MapListRequest listRequest, int countId);
List<CloudActivityEntity> queryByConditions(Map<String, Object> map); List<CloudActivityEntity> queryByConditions(Map<String, Object> map);
void importCustomers(int id, DepartmentEntity city);
void setCloudCount(); void setCloudCount();
void startBackNoVisitToSea(); void startBackNoVisitToSea();
......
...@@ -87,7 +87,5 @@ public interface IMarketingActivity extends IService { ...@@ -87,7 +87,5 @@ public interface IMarketingActivity extends IService {
Integer queryCustomerCountByActive(Integer id); Integer queryCustomerCountByActive(Integer id);
void importCustomerNew(MarketingActivityVo vo, Map<String, Object> paraMap, DepartmentEntity city);
void putOvertimeWaitCallToOcean(); void putOvertimeWaitCallToOcean();
} }
...@@ -12,10 +12,12 @@ import java.util.Map; ...@@ -12,10 +12,12 @@ import java.util.Map;
@Repository @Repository
public interface CloudActivityMapper { public interface CloudActivityMapper {
void save(CloudActivityEntity entity); int save(CloudActivityEntity entity);
CloudActivityEntity getById(int id); CloudActivityEntity getById(int id);
CloudActivityEntity getByIdAndDel(int id);
List<CloudActivityEntity> queryByConditions(Map<String, Object> map); List<CloudActivityEntity> queryByConditions(Map<String, Object> map);
void updateCount(CloudActivityEntity entity); void updateCount(CloudActivityEntity entity);
...@@ -23,4 +25,6 @@ public interface CloudActivityMapper { ...@@ -23,4 +25,6 @@ public interface CloudActivityMapper {
List<Map<String, Object>> queryList(Map<String, Object> map); List<Map<String, Object>> queryList(Map<String, Object> map);
int queryCount(Map<String, Object> map); int queryCount(Map<String, Object> map);
void updateStatus(Map<String, Object> map);
} }
package com.house365.ws.interfaces.impl; package com.house365.ws.interfaces.impl;
import com.house365.beans.entity.CloudActivityEntity; import com.google.common.base.Joiner;
import com.house365.beans.entity.CloudCountEntity; import com.house365.beans.entity.*;
import com.house365.beans.entity.CloudCustomerEntity; import com.house365.commons.system.HttpClientUtil;
import com.house365.web.util.DateTimeUtils; import com.house365.web.util.DateTimeUtils;
import com.house365.ws.beans.request.MapListRequest; import com.house365.ws.beans.request.MapListRequest;
import com.house365.ws.beans.response.MapListResponse; import com.house365.ws.beans.response.MapListResponse;
import com.house365.ws.cached.RedisUtilsInterface; import com.house365.ws.cached.RedisUtilsInterface;
import com.house365.ws.dao.mapper.CloudActivityMapper; import com.house365.ws.dao.mapper.*;
import com.house365.ws.dao.mapper.CloudCountMapper;
import com.house365.ws.dao.mapper.CloudCustomerMapper;
import com.house365.ws.dao.mapper.UserMapper;
import com.house365.ws.interfaces.server.ICloudActivityInterface; import com.house365.ws.interfaces.server.ICloudActivityInterface;
import com.house365.ws.service.interfaces.ICheckNoCallCustomerNoLimit; import com.house365.ws.service.interfaces.ICheckNoCallCustomerNoLimit;
import com.house365.ws.service.interfaces.IStaffDuty; import com.house365.ws.service.interfaces.IStaffDuty;
import com.house365.ws.system.ReturnResult; import com.house365.ws.system.ReturnResult;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import static com.house365.ws.service.impl.StaffDuty.getMonthDate; import static com.house365.ws.service.impl.StaffDuty.getMonthDate;
...@@ -49,6 +53,17 @@ public class CloudActivityImpl implements ICloudActivityInterface { ...@@ -49,6 +53,17 @@ public class CloudActivityImpl implements ICloudActivityInterface {
private UserMapper userMapper; private UserMapper userMapper;
@Autowired @Autowired
private CloudCountMapper cloudCountMapper; private CloudCountMapper cloudCountMapper;
@Autowired
private CustomerMergeMapper mergeMapper;
@Value("${CLOUD.PULL.URL}")
private String cloudPullUrl;
@Override
public int save(CloudActivityEntity entity) {
mapper.save(entity);
int id = entity.getId();
return id;
}
@Override @Override
public MapListResponse list(MapListRequest request) { public MapListResponse list(MapListRequest request) {
...@@ -65,7 +80,7 @@ public class CloudActivityImpl implements ICloudActivityInterface { ...@@ -65,7 +80,7 @@ public class CloudActivityImpl implements ICloudActivityInterface {
if (userId != 1) { if (userId != 1) {
map.put("createId", userId); map.put("createId", userId);
} }
map.put("type", 0);
List<Map<String, Object>> list = mapper.queryList(map); List<Map<String, Object>> list = mapper.queryList(map);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
for (Map<String, Object> m : list) { for (Map<String, Object> m : list) {
...@@ -160,6 +175,53 @@ public class CloudActivityImpl implements ICloudActivityInterface { ...@@ -160,6 +175,53 @@ public class CloudActivityImpl implements ICloudActivityInterface {
return response; return response;
} }
@Override
public MapListResponse pullList(MapListRequest request) {
MapListResponse response = new MapListResponse();
try {
Map<String, Object> map = new HashMap<>(10);
Map<String, Object> searchParams = request.getSearchParams();
int start = 50 * (request.getPaging().getCurrentPage() - 1);
map.put("city", searchParams.get("city"));
map.put("start", start);
map.put("limit", 50);
map.put("name", searchParams.get("name"));
int userId = Integer.parseInt(searchParams.get("userId").toString());
if (userId != 1) {
map.put("createId", userId);
}
map.put("type", 1);
List<Map<String, Object>> list = mapper.queryList(map);
if (CollectionUtils.isNotEmpty(list)) {
for (Map<String, Object> m : list) {
int activeId = Integer.parseInt(m.get("id").toString());
Map<String, Object> searchMap = new HashMap<>(10);
searchMap.put("activeId", activeId);
List<CloudCustomerEntity> count = cloudCustomerMapper.queryByConditions(searchMap);
m.put("customerCount", count.size());
searchMap.put("type", 1);
List<CloudCustomerEntity> waitCountList = cloudCustomerMapper.queryByConditions(searchMap);
m.put("waitCount", waitCountList.size());
searchMap.put("type", 2);
List<CloudCustomerEntity> sentCountList = cloudCustomerMapper.queryByConditions(searchMap);
m.put("sentCount", sentCountList.size());
}
}
int count = mapper.queryCount(map);
request.getPaging().setRecords(count);
response.setPaging(request.getPaging());
response.setObjectList(list);
response.setResultCode(ReturnResult.SUCCESS.getResultCode());
response.setResultMessage(ReturnResult.SUCCESS.getResultMessage());
} catch (Exception e) {
logger.error(e.getMessage(), e);
response.setResultCode(ReturnResult.FAIL.getResultCode());
response.setResultMessage(e.getMessage());
}
return response;
}
// @Override // @Override
// public List<CloudCountEntity> reportList(Map<String, Object> searchParams) { // public List<CloudCountEntity> reportList(Map<String, Object> searchParams) {
// List<CloudCountEntity> list = new ArrayList<>(); // List<CloudCountEntity> list = new ArrayList<>();
...@@ -209,9 +271,6 @@ public class CloudActivityImpl implements ICloudActivityInterface { ...@@ -209,9 +271,6 @@ public class CloudActivityImpl implements ICloudActivityInterface {
endTime = time.split(",")[1]; endTime = time.split(",")[1];
} }
if (StringUtils.isBlank(startTime)) { if (StringUtils.isBlank(startTime)) {
// Map<String, String> monthMap = getMonthDate(date);
// startTime = monthMap.get("first");
// endTime = monthMap.get("last");
return list; return list;
} }
Map<String, Object> map = new HashMap<>(10); Map<String, Object> map = new HashMap<>(10);
...@@ -334,6 +393,96 @@ public class CloudActivityImpl implements ICloudActivityInterface { ...@@ -334,6 +393,96 @@ public class CloudActivityImpl implements ICloudActivityInterface {
return Collections.emptyList(); return Collections.emptyList();
} }
@Override
public void importCustomers(int activeId, DepartmentEntity city) {
try {
CloudActivityEntity activityEntity = mapper.getByIdAndDel(activeId);
List<NameValuePair> pairList = new ArrayList<>();
wrapMap(activityEntity, pairList, city.getName());
String seeResult = HttpClientUtil.doPost(cloudPullUrl, pairList);
if (seeResult != null) {
JSONObject json = JSONObject.fromObject(seeResult);
Number code = (Number) json.get("retCode");
if (code.intValue() == 0) {
JSONObject dataJson = (JSONObject) json.get("data");
JSONArray array = (JSONArray) dataJson.get("userVisitInfo");
List<Map<String, Object>> seeList = (List) JSONArray.toCollection(array, Map.class);
//mark assess is end
redisUtil.setValueExpireNew("cloud:process:" + activeId, "0", 1, TimeUnit.HOURS);
redisUtil.addKeyVal("cloud:total:" + activeId, String.valueOf(seeList.size()));
if (redisUtil.hasKey("cloud:protect:" + activeId)) {
redisUtil.deleteByKeyNew("cloud:protect:" + activeId);
}
if (redisUtil.hasKey("cloud:done:" + activeId)) {
redisUtil.deleteByKeyNew("cloud:done:" + activeId);
}
//调取接口获取数据
if (CollectionUtils.isNotEmpty(seeList)) {
int total = seeList.size();
for (int i = 0; i < seeList.size(); i++) {
Map<String, Object> s = seeList.get(i);
//数据保护机制 只过滤私客存在的客户
String phone = s.get("loginAccount").toString();
String houseName = s.get("projectName").toString();
Map<String, Object> queryMap = new HashMap<>(5);
queryMap.put("phone", phone);
List<CustomerEntity> cusList = mergeMapper.queryByConditions(queryMap);
if (CollectionUtils.isNotEmpty(cusList)) {
Long count = increaseProtectKey(activeId);
logger.warn("protect " + phone + " count :" + count + " total:" + getFinishCount(activeId));
continue;
} else {
Long count = increaseDoneKey(activeId);
logger.warn("线程:" + "-" + total + " done count:" + count + " total:" + getFinishCount(activeId));
CloudCustomerEntity entity = getCloudCustomer(phone, houseName, city);
entity.setActiveId(activeId);
entity.setIsOvertime(0);
cloudCustomerMapper.save(entity);
}
decreaseKey(activeId);
redisUtil.addKeyVal("cloud:process:" + activeId, "1");
}
}
//更新云迹活动字段
Map<String, Object> updateMap = new HashMap<>(5);
updateMap.put("id", activityEntity.getId());
updateMap.put("isDelete", 0);
mapper.updateStatus(updateMap);
} else {
List<String> params = new ArrayList<>();
for (NameValuePair pair : pairList) {
params.add(pair.getName() + "=" + pair.getValue());
}
logger.error("浏览云迹接口URL:[{}] ", cloudPullUrl + Joiner.on("&").join(params));
}
logger.info("浏览云迹接口返回数据:", seeResult);
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage(), e);
}
}
private synchronized Integer getFinishCount(Integer activeId) {
return redisUtil.getIntegerByKey("cloud:done:" + activeId) + redisUtil.getIntegerByKey(
"cloud:protect:" + activeId);
}
private synchronized Long increaseProtectKey(Integer activeId) {
return redisUtil.increaseByKey("cloud:protect:" + activeId);
}
private synchronized void decreaseKey(Integer activeId) {
redisUtil.decreaseByKey("cloud:total:" + activeId);
}
private synchronized Long increaseDoneKey(Integer activeId) {
return redisUtil.increaseByKey("cloud:done:" + activeId);
}
@Override @Override
public void setCloudCount() { public void setCloudCount() {
staffDuty.setCloudCount(); staffDuty.setCloudCount();
...@@ -406,4 +555,113 @@ public class CloudActivityImpl implements ICloudActivityInterface { ...@@ -406,4 +555,113 @@ public class CloudActivityImpl implements ICloudActivityInterface {
putMap.put("successCount", 0); putMap.put("successCount", 0);
putMap.put("successRate", ""); putMap.put("successRate", "");
} }
private List<Map<String, Object>> dealList(List<CustomerEntity> list, List<Map<String, Object>> listNew) {
if (CollectionUtils.isNotEmpty(list)) {
for (CustomerEntity c : list) {
Iterator<Map<String, Object>> iterator = listNew.iterator();
while (iterator.hasNext()) {
Map<String, Object> iterMap = iterator.next();
if (iterMap.get("login_account").toString().equals(c.getPhone())) {
iterator.remove();
}
}
}
}
return listNew;
}
private synchronized CloudCustomerEntity getCloudCustomer(String phone, String houseName, DepartmentEntity city) {
CloudCustomerEntity entity = new CloudCustomerEntity();
entity.setName("");
entity.setPhone(phone);
entity.setBakPhone1("");
entity.setBakPhone2("");
entity.setBakPhone3("");
entity.setSex(2);
entity.setCustomerType(1);
entity.setActSource("");
entity.setFirstSource("");
entity.setLatestSource("");
entity.setCrmLatestCall("");
entity.setCrmLatestCallResult("");
entity.setStatus(0);
entity.setCreateTime(new Date());
entity.setCreater("云迹拉取");
entity.setUpdater("云迹拉取");
entity.setUpdateTime(new Date());
entity.setBuyIntention("");
entity.setLastCallTime(null);
entity.setManagerId(0);
entity.setManagerName("");
entity.setCityCode(city.getDescripition());
entity.setCityName(city.getName());
entity.setBizPort("");
entity.setCrmId("");
entity.setActSourceId(0);
entity.setRemark("");
entity.setTraceStatus(1);
entity.setCrmSync("1");
entity.setHotlineCallTime(null);
entity.setHotlineCallSpend("");
entity.setOceanDate(null);
entity.setIsDelete(0);
entity.setLastManager("");
entity.setBindTime(null);
entity.setCustomerId(0);
entity.setSignupTime("");
entity.setSignupHouseId("");
entity.setSignupHouseName(houseName);
entity.setSignupSourceId("");
entity.setSignupSourceName("");
entity.setOverTimeCount(0);
entity.setVisitBackCount(0);
entity.setWaitVisitCount(0);
entity.setBoughtCount(0);
entity.setIsabandon(0);
entity.setAbandonLogId(0);
entity.setAbandonTime(null);
entity.setCreateSource("云迹拉取");
return entity;
}
private void wrapMap(CloudActivityEntity entity, List<NameValuePair> pairList, String cityName) {
String projectName = entity.getSeeProjectName();
pairList.add(new BasicNameValuePair("project_name_array", projectName));
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String startTime = formatter.format(entity.getSeeStartTime());
String endTime = formatter.format(entity.getSeeEndTime());
pairList.add(new BasicNameValuePair("city_name", cityName));
pairList.add(new BasicNameValuePair("start_date", startTime));
pairList.add(new BasicNameValuePair("end_date", endTime));
pairList.add(new BasicNameValuePair("visit_count", String.valueOf(entity.getSeeCount())));
if (entity.getTotalPriceMin() > 0 && entity.getTotalPriceMax() > 0) {
pairList.add(new BasicNameValuePair("total_price_from", String.valueOf(entity.getTotalPriceMin())));
pairList.add(new BasicNameValuePair("total_price_to", String.valueOf(entity.getTotalPriceMax())));
}
if (entity.getAreaMin() > 0 && entity.getAreaMax() > 0) {
pairList.add(new BasicNameValuePair("area_from", String.valueOf(entity.getAreaMin())));
pairList.add(new BasicNameValuePair("area_to", String.valueOf(entity.getAreaMax())));
}
StringBuilder blockBuilder = new StringBuilder();
StringBuilder districtBuilder = new StringBuilder();
if (CollectionUtils.isNotEmpty(entity.getBlockList())) {
entity.getBlockList().forEach(e -> blockBuilder.append(e).append(","));
String blocks = blockBuilder.toString();
pairList.add(new BasicNameValuePair("plate_id_array", blocks));
}
if (CollectionUtils.isNotEmpty(entity.getDistrictList())) {
entity.getDistrictList().forEach(e -> districtBuilder.append(e).append(","));
String districts = districtBuilder.toString();
pairList.add(new BasicNameValuePair("district_id_array", districts));
}
if (org.apache.commons.lang.StringUtils.isNotBlank(entity.getChannel())) {
pairList.add(new BasicNameValuePair("info_type", entity.getChannel()));
}
}
} }
...@@ -371,213 +371,7 @@ public class MarketingActivityImpl implements IMarketingActivity { ...@@ -371,213 +371,7 @@ public class MarketingActivityImpl implements IMarketingActivity {
} }
} }
@Override
public void importCustomerNew(MarketingActivityVo vo, Map<String, Object> paraMap, DepartmentEntity city) {
try {
Integer total = vo.getEntity().getExpectExtractCount();
Integer activeId = vo.getEntity().getId();
List<NameValuePair> nameValuePairList = new ArrayList<>();
for (Map.Entry entry : paraMap.entrySet()) {
nameValuePairList.add(
new BasicNameValuePair(String.valueOf(entry.getKey()), String.valueOf(entry.getValue())));
}
//mark assess is end
redisUtils.setValueExpireNew("active:process:" + activeId, "0", 1, TimeUnit.HOURS);
redisUtils.addKeyVal("active:total:" + activeId, String.valueOf(total));
if (redisUtils.hasKey("active:protect:" + activeId)) {
redisUtils.deleteByKeyNew("active:protect:" + activeId);
}
if (redisUtils.hasKey("active:done:" + activeId)) {
redisUtils.deleteByKeyNew("active:done:" + activeId);
}
List<Map<String, Object>> seeList = new ArrayList<>();
List<Map<String, Object>> crmList = new ArrayList<>();
Map<String, Object> dicMap = new HashMap<>(10);
dicMap.put("city", city.getDescripition());
dicMap.put("dicKey", "customer.protect.day");
List<DictionaryEntity> dictionaryList = dictionaryMapper.getNoApproximateConfig(dicMap);
//获取浏览轨迹的list
String cityName = city.getName();
List<NameValuePair> pairList = new ArrayList<>();
String projectName = vo.getProjectName();
String[] projectNames = projectName.split(",");
for (int j = 0; j < projectNames.length; j++) {
String name = projectNames[j].split("\\(")[0];
pairList.add(new BasicNameValuePair("items[]", name));
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String startTime = formatter.format(vo.getSeeStartTime());
String endTime = formatter.format(vo.getSeeEndTime());
pairList.add(new BasicNameValuePair("city_name", cityName));
pairList.add(new BasicNameValuePair("from", startTime));
pairList.add(new BasicNameValuePair("to", endTime));
pairList.add(new BasicNameValuePair("lower", String.valueOf(vo.getSeeCount())));
pairList.add(new BasicNameValuePair("has_login_account", "true"));
pairList.add(new BasicNameValuePair("limit", "2000"));
String seeResult = HttpClientUtil.doGet(crmSeeUrl, pairList);
if (seeResult != null) {
JSONArray jsonarray = JSONArray.fromObject(seeResult);
seeList = (List) JSONArray.toCollection(jsonarray, Map.class);
LOGGER.info("浏览轨迹接口返回数据:", seeResult);
} else {
List<String> params = new ArrayList<>();
for (NameValuePair pair : pairList) {
params.add(pair.getName() + "=" + pair.getValue());
}
LOGGER.error("浏览轨迹接口URL:[{}] ", crmSeeUrl + Joiner.on("&").join(params));
}
//获取浏览轨迹的list结束
if (vo.getEntity().getApplyStartTime() != null && vo.getEntity().getApplyEndTime() != null) {
nameValuePairList.add(new BasicNameValuePair("page", "1"));
nameValuePairList.add(new BasicNameValuePair("limit", "1000"));
String preResult = HttpClientUtil.doGet(crmQueryUrl, nameValuePairList);
JSONObject jsonObject = JSONObject.fromObject(preResult);
if (jsonObject.containsKey("total")) {
crmList = (List) jsonObject.get("docs");
}
}
//判断取两个list的交集
if (vo.getEntity().getApplyStartTime() != null && vo.getEntity().getApplyEndTime() != null) {
if (CollectionUtils.isNotEmpty(crmList)) {
List<Map<String, Object>> newList = new ArrayList<>();
for (Map<String, Object> m : crmList) {
String phone = m.get("phone").toString();
if (CollectionUtils.isNotEmpty(seeList)) {
for (Map<String, Object> o : seeList) {
if (o.get("login_account").equals(phone)) {
newList.add(m);
}
}
}
}
if (CollectionUtils.isNotEmpty(newList)) {
if (CollectionUtils.isNotEmpty(dictionaryList) && !"0".equals(dictionaryList.get(0).getDicValue())) {
//过滤400已跟踪的数据
Map<String, Object> hotMap = new HashMap<>(10);
hotMap.put("status", 0);
hotMap.put("createSource", "HOTLINE");
hotMap.put("isProtect", dictionaryList.get(0).getDicValue());
hotMap.put("isAdd", 1);
hotMap.put("city", city.getDescripition());
List<CustomerEntity> list = customerMapper.queryForAddHot(hotMap);
if (CollectionUtils.isNotEmpty(list)) {
dealList(list, newList, 2);
}
}
for (Map<String, Object> m : newList) {
MarketCustomerEntity customerEntity = MarketingActivityImpl.getCustomer(m);
customerEntity.setActiveId(activeId);
if (marketCustomer.queryProtectCount(customerEntity.getPhone()) > 0) {
increaseProtectKey(activeId);
} else {
increaseDoneKey(activeId);
setSignSourceName(customerEntity);
marketCustomer.save(customerEntity);
}
decreaseKey(activeId);
}
}
//通知CRM所使用的数据
MarketCustomerEntity mce = new MarketCustomerEntity();
mce.setActiveId(activeId);
List<MarketCustomerEntity> uselist = marketCustomer.getUseMarketingActivity(mce);
if (uselist != null && uselist.size() > 0) {
String confirmUrl = MemoryPropertyPlaceholderConfigurer.getContextProperty("CRM.CONFIRM.URL");
List<NameValuePair> inParam = new ArrayList<>();
inParam.add(new BasicNameValuePair("city", city.getDescripition()));
inParam.add(new BasicNameValuePair("timestamp", String.valueOf(System.currentTimeMillis() / 1000)));
JSONArray array = new JSONArray();
for (int k = 0; k < uselist.size(); k++) {
JSONObject jo = new JSONObject();
jo.put("phone", uselist.get(k).getPhone());
jo.put("crm_id", uselist.get(k).getCrmId());
array.add(jo);
}
inParam.add(new BasicNameValuePair("data", array.toString()));
String confirmresult = HttpClientUtil.doPost(confirmUrl, inParam);
LOGGER.info("******通知CRM营销拉取客户信息返回结果:" + confirmresult);
}
}
} else {
//判断只取浏览轨迹的list
if (CollectionUtils.isNotEmpty(seeList)) {
if (CollectionUtils.isNotEmpty(dictionaryList) && !"0".equals(dictionaryList.get(0).getDicValue())) {
//过滤400已跟踪的数据
Map<String, Object> hotMap = new HashMap<>(10);
hotMap.put("status", 0);
hotMap.put("createSource", "HOTLINE");
hotMap.put("isProtect", dictionaryList.get(0).getDicValue());
hotMap.put("isAdd", 1);
hotMap.put("city", city.getDescripition());
List<CustomerEntity> list = customerMapper.queryForAddHot(hotMap);
if (CollectionUtils.isNotEmpty(list)) {
dealList(list, seeList, 1);
}
}
for (Map<String, Object> m : seeList) {
Map<String, Object> map = new HashMap<>(5);
map.put("phone", m.get("login_account"));
MarketCustomerEntity customerEntity = MarketingActivityImpl.getCustomer(map);
customerEntity.setActiveId(activeId);
customerEntity.setCityCode(city.getDescripition());
customerEntity.setCityName(city.getName());
customerEntity.setCrmSync("0");
if (marketCustomer.queryProtectCount(customerEntity.getPhone()) > 0) {
increaseProtectKey(activeId);
} else {
increaseDoneKey(activeId);
//同时获取signupSourceName
setSignSourceName(customerEntity);
marketCustomer.save(customerEntity);
}
decreaseKey(activeId);
}
}
}
redisUtils.addKeyVal("active:process:" + activeId, "1");
// marketCustomer.updateSignupSourceName();
MarketingActivityRequest request = new MarketingActivityRequest();
MarketingActivityEntity entity = marketingActivityService.getById(activeId);
entity.setGainCount(redisUtils.getIntegerByKey("active:done:" + activeId));
entity.setProtectCount(redisUtils.getIntegerByKey("active:protect:" + activeId));
request.setEntity(entity);
updateMarketingActivity(request);
} catch (Exception e) {
e.printStackTrace();
LOGGER.error(e.getMessage(), e);
LOGGER.error("营销活动导入失败", e);
}
}
private List<Map<String, Object>> dealList(List<CustomerEntity> list, List<Map<String, Object>> listNew, int type) {
if (CollectionUtils.isNotEmpty(list)) {
for (CustomerEntity c : list) {
Iterator<Map<String, Object>> iterator = listNew.iterator();
while (iterator.hasNext()) {
Map<String, Object> iterMap = iterator.next();
if (type == 1) {
if (iterMap.get("login_account").toString().equals(c.getPhone())) {
iterator.remove();
}
} else if (type == 2) {
if (iterMap.get("phone").toString().equals(c.getPhone())) {
iterator.remove();
}
}
}
}
}
return listNew;
}
@Override @Override
public Integer queryCustomerCountByActive(Integer id) { public Integer queryCustomerCountByActive(Integer id) {
......
...@@ -128,7 +128,6 @@ public class PropertyReportImpl implements IPropertyReportInterface { ...@@ -128,7 +128,6 @@ public class PropertyReportImpl implements IPropertyReportInterface {
List<ReportHouseEntity> list = vo.getList(); List<ReportHouseEntity> list = vo.getList();
mapper.save(entity); mapper.save(entity);
int id = entity.getId(); int id = entity.getId();
// String url = "http://m.house365.com/H5/dist/index.html#/?id=" + id;
String url = "http://report.house365.com/index.html#/?id=" + id; String url = "http://report.house365.com/index.html#/?id=" + id;
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("id", id); map.put("id", id);
......
...@@ -58,7 +58,7 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer { ...@@ -58,7 +58,7 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer {
@Autowired @Autowired
private CustomerMergeMapper customermergemapper; private CustomerMergeMapper customermergemapper;
public static void main(String[] args){ public static void main(String[] args) {
System.out.println(MemoryPropertyPlaceholderConfigurer.getContextProperty("tangfanghui.server.url")); System.out.println(MemoryPropertyPlaceholderConfigurer.getContextProperty("tangfanghui.server.url"));
} }
...@@ -587,11 +587,11 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer { ...@@ -587,11 +587,11 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer {
customerMe.setManagerPhone(userEntity2.getMobile()); customerMe.setManagerPhone(userEntity2.getMobile());
Integer sendNum = 0; Integer sendNum = 0;
String customermsg = "感谢您咨询365淘房房博士,根据您的置业需求,我们将安排安家顾问[" + customerEntity.getManagerName() + "],电话[" + userEntity2.getMobile() + "],在您合适的时间给您回电,请注意接听,谢谢支持"; String customermsg = "感谢您咨询365淘房房博士,根据您的置业需求,我们将安排安家顾问[" + customerEntity.getManagerName() + "],电话[" + userEntity2.getMobile() + "],在您合适的时间给您回电,请注意接听,谢谢支持";
// customermsg = URLEncoder.encode(customermsg);
smUrl = smUrl + customerEntity.getCityCode() + "/" + "mobileno/" + customerEntity.getPhone(); smUrl = smUrl + customerEntity.getCityCode() + "/" + "mobileno/" + customerEntity.getPhone();
List<NameValuePair> params = new ArrayList<>(); List<NameValuePair> params = new ArrayList<>();
params.add(new BasicNameValuePair("msg", customermsg)); params.add(new BasicNameValuePair("msg", customermsg));
String sendresult = HttpClientUtil.doGet(smUrl, params, null);//发送客户 //发送客户
String sendresult = HttpClientUtil.doGet(smUrl, params, null);
customerMe.setRequestType("6"); customerMe.setRequestType("6");
if (sendresult != null) { if (sendresult != null) {
customerMe.setCustomerStatus("1"); customerMe.setCustomerStatus("1");
...@@ -601,7 +601,8 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer { ...@@ -601,7 +601,8 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer {
} }
String time = sdf.format(newdate); String time = sdf.format(newdate);
String managermsg = ""; String managermsg = "";
if (isProtected) {//在保护期内=非第一次IM咨询 //在保护期内=非第一次IM咨询
if (isProtected) {
managermsg = "你好,客户[" + customerEntity.getName() + "]再次咨询,咨询时间[" + time + "],请登录全链条后台查看."; managermsg = "你好,客户[" + customerEntity.getName() + "]再次咨询,咨询时间[" + time + "],请登录全链条后台查看.";
} else { } else {
managermsg = "你好,你在[" + time + "]有一条新的用户咨询需要处理,用户手机[" + customerEntity.getPhone() + "]请登录全链条后台查看."; managermsg = "你好,你在[" + time + "]有一条新的用户咨询需要处理,用户手机[" + customerEntity.getPhone() + "]请登录全链条后台查看.";
...@@ -648,10 +649,11 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer { ...@@ -648,10 +649,11 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer {
/** /**
* 非客户转移-处理合并最新回访时间 * 非客户转移-处理合并最新回访时间
*
* @param currentCustomer * @param currentCustomer
* @return * @return
*/ */
private CustomerEntity handleCustomerMerge(CustomerEntity currentCustomer){ private CustomerEntity handleCustomerMerge(CustomerEntity currentCustomer) {
//先去查询该客户的所有id //先去查询该客户的所有id
List<CustomerEntity> customerIdList = customer.getCustomerIds(currentCustomer.getId(), currentCustomer.getCityCode()); List<CustomerEntity> customerIdList = customer.getCustomerIds(currentCustomer.getId(), currentCustomer.getCityCode());
//再获取所有id的回访记录 //再获取所有id的回访记录
...@@ -663,7 +665,7 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer { ...@@ -663,7 +665,7 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer {
idsMap.put("ids", ids); idsMap.put("ids", ids);
if (ids.size() > 0) { if (ids.size() > 0) {
List<CustomerCallbackLogEntity> callbacklist = customer.getCallBackList(idsMap); List<CustomerCallbackLogEntity> callbacklist = customer.getCallBackList(idsMap);
if(callbacklist != null && callbacklist.size()>0){ if (callbacklist != null && callbacklist.size() > 0) {
currentCustomer.setLastCallTime(callbacklist.get(0).getCreateTime()); currentCustomer.setLastCallTime(callbacklist.get(0).getCreateTime());
} }
} }
...@@ -672,11 +674,12 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer { ...@@ -672,11 +674,12 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer {
/** /**
* 客户转移-处理合并客户最近回访时间 * 客户转移-处理合并客户最近回访时间
*
* @param currentCustomer * @param currentCustomer
* @param * @param
* @return * @return
*/ */
public CustomerEntity handleCustomerMerge(CustomerEntity currentCustomer, Date lastjoinvisittime){ public CustomerEntity handleCustomerMerge(CustomerEntity currentCustomer, Date lastjoinvisittime) {
//先去查询该客户的所有id //先去查询该客户的所有id
List<CustomerEntity> customerIdList = customer.getCustomerIds(currentCustomer.getId(), currentCustomer.getCityCode()); List<CustomerEntity> customerIdList = customer.getCustomerIds(currentCustomer.getId(), currentCustomer.getCityCode());
//再获取所有id的回访记录 //再获取所有id的回访记录
...@@ -688,9 +691,9 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer { ...@@ -688,9 +691,9 @@ public class AddPromoteCustomerImpl implements IAddPromoteCustomer {
idsMap.put("ids", ids); idsMap.put("ids", ids);
if (ids.size() > 0) { if (ids.size() > 0) {
List<CustomerCallbackLogEntity> callbacklist = customer.getCallBackList(idsMap); List<CustomerCallbackLogEntity> callbacklist = customer.getCallBackList(idsMap);
if(callbacklist != null && callbacklist.size()>0 && lastjoinvisittime.before(callbacklist.get(0).getCreateTime())){ if (callbacklist != null && callbacklist.size() > 0 && lastjoinvisittime.before(callbacklist.get(0).getCreateTime())) {
currentCustomer.setLastCallTime(callbacklist.get(0).getCreateTime()); currentCustomer.setLastCallTime(callbacklist.get(0).getCreateTime());
}else{ } else {
currentCustomer.setLastCallTime(lastjoinvisittime); currentCustomer.setLastCallTime(lastjoinvisittime);
} }
} }
......
...@@ -45,7 +45,7 @@ public class GetNewUserInfoImpl implements IGetNewUserInfo { ...@@ -45,7 +45,7 @@ public class GetNewUserInfoImpl implements IGetNewUserInfo {
* 对于纯新咨询的客户,随机分配给一位在线IM房博士;  * 对于纯新咨询的客户,随机分配给一位在线IM房博士; 
* 对于非全新咨询的客户,每次咨询时需判断下上次咨询的人员账号是否在线,如在线直接分配上回的人员,如不在线,随机分配给其他在线人员; * 对于非全新咨询的客户,每次咨询时需判断下上次咨询的人员账号是否在线,如在线直接分配上回的人员,如不在线,随机分配给其他在线人员;
* 若所有组员都不在线时,默认分配给组长,保证有人接待客户; * 若所有组员都不在线时,默认分配给组长,保证有人接待客户;
* 组长使用原新房房博士的账号,accid是qlt_527 * 组长使用原新房房博士的账号,accid是qlt_527
* *
* @param parameter 服务输入,不包含服务配置和控制信息 * @param parameter 服务输入,不包含服务配置和控制信息
* @return * @return
...@@ -75,8 +75,8 @@ public class GetNewUserInfoImpl implements IGetNewUserInfo { ...@@ -75,8 +75,8 @@ public class GetNewUserInfoImpl implements IGetNewUserInfo {
//查询在线客服list //查询在线客服list
Map<String, Object> queryMap = new HashMap<>(5); Map<String, Object> queryMap = new HashMap<>(5);
//测试临时新加部门,上线需要调整 //测试临时新加部门,上线需要调整
// queryMap.put("deptId", 568); queryMap.put("deptId", 568);
queryMap.put("deptId", 557); // queryMap.put("deptId", 557);
queryMap.put("onlineStatus", 1); queryMap.put("onlineStatus", 1);
List<UserEntity> userList = userMapper.queryByConditions(queryMap); List<UserEntity> userList = userMapper.queryByConditions(queryMap);
...@@ -121,11 +121,9 @@ public class GetNewUserInfoImpl implements IGetNewUserInfo { ...@@ -121,11 +121,9 @@ public class GetNewUserInfoImpl implements IGetNewUserInfo {
response.setData(data); response.setData(data);
response.setResult(ReturnAppResult.APP_SUCCESS.getResultCode()); response.setResult(ReturnAppResult.APP_SUCCESS.getResultCode());
response.setMsg("查询成功"); response.setMsg("查询成功");
//todo 1、查询成功同时添加日志(请求url返回result) 2、聊天机制废除,查询的同时触发新增信息接口 //1、查询成功同时添加日志(请求url返回result) 2、聊天机制废除,查询的同时触发新增信息接口
ExecutorService executor = Executors.newCachedThreadPool(); ExecutorService executor = Executors.newCachedThreadPool();
executor.execute(new Runnable() { executor.execute(() -> {
@Override
public void run() {
try { try {
Date now = new Date(); Date now = new Date();
if (!"qlt_527".equals(accId)) { if (!"qlt_527".equals(accId)) {
...@@ -156,9 +154,7 @@ public class GetNewUserInfoImpl implements IGetNewUserInfo { ...@@ -156,9 +154,7 @@ public class GetNewUserInfoImpl implements IGetNewUserInfo {
} catch (Exception e) { } catch (Exception e) {
logger.error("同步IM信息失败", e); logger.error("同步IM信息失败", e);
} }
}
}); });
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
logger.error("查询用户信息失败", e); logger.error("查询用户信息失败", e);
......
...@@ -164,13 +164,11 @@ public class StaffDuty implements IStaffDuty { ...@@ -164,13 +164,11 @@ public class StaffDuty implements IStaffDuty {
CloudActivityEntity entity = new CloudActivityEntity(); CloudActivityEntity entity = new CloudActivityEntity();
String name = "云迹数据" + date; String name = "云迹数据" + date;
entity.setName(name); entity.setName(name);
entity.setCustomerCount(0);
entity.setWaitCount(0);
entity.setSentCount(0);
entity.setCity(city); entity.setCity(city);
entity.setCreateId(Integer.valueOf(staffEntity.getUserId())); entity.setCreateId(Integer.valueOf(staffEntity.getUserId()));
entity.setCreateName(staffEntity.getName()); entity.setCreateName(staffEntity.getName());
entity.setCreateTime(now); entity.setCreateTime(now);
setData(entity);
activityMapper.save(entity); activityMapper.save(entity);
} }
} else { } else {
...@@ -183,13 +181,11 @@ public class StaffDuty implements IStaffDuty { ...@@ -183,13 +181,11 @@ public class StaffDuty implements IStaffDuty {
CloudActivityEntity entity = new CloudActivityEntity(); CloudActivityEntity entity = new CloudActivityEntity();
String name = "云迹数据" + date; String name = "云迹数据" + date;
entity.setName(name); entity.setName(name);
entity.setCustomerCount(0);
entity.setWaitCount(0);
entity.setSentCount(0);
entity.setCity(city); entity.setCity(city);
entity.setCreateId(staffEntity.getUserId()); entity.setCreateId(staffEntity.getUserId());
entity.setCreateName(staffEntity.getName()); entity.setCreateName(staffEntity.getName());
entity.setCreateTime(now); entity.setCreateTime(now);
setData(entity);
activityMapper.save(entity); activityMapper.save(entity);
} }
} }
...@@ -207,6 +203,29 @@ public class StaffDuty implements IStaffDuty { ...@@ -207,6 +203,29 @@ public class StaffDuty implements IStaffDuty {
} }
} }
private void setData(CloudActivityEntity entity) {
entity.setCustomerCount(0);
entity.setWaitCount(0);
entity.setSentCount(0);
entity.setIsDelete(0);
//新增字段赋值
entity.setTotalPriceMin(0);
entity.setTotalPriceMax(0);
entity.setAreaMin(0);
entity.setAreaMax(0);
entity.setBlock("");
entity.setBlockName("");
entity.setDistrict("");
entity.setDistrictName("");
entity.setChannel("");
entity.setChannelName("");
entity.setSeeProjectName("");
entity.setSeeStartTime(null);
entity.setSeeEndTime(null);
entity.setSeeCount(0);
entity.setType(0);
}
/** /**
* 定时新增定制云迹活动 * 定时新增定制云迹活动
*/ */
...@@ -236,13 +255,12 @@ public class StaffDuty implements IStaffDuty { ...@@ -236,13 +255,12 @@ public class StaffDuty implements IStaffDuty {
CloudActivityEntity entity = new CloudActivityEntity(); CloudActivityEntity entity = new CloudActivityEntity();
String name = "定制云迹数据" + date; String name = "定制云迹数据" + date;
entity.setName(name); entity.setName(name);
entity.setCustomerCount(0);
entity.setWaitCount(0);
entity.setSentCount(0);
entity.setCity(c.getCityCode()); entity.setCity(c.getCityCode());
entity.setCreateId(c.getUserId()); entity.setCreateId(c.getUserId());
entity.setCreateName(c.getCreateName()); entity.setCreateName(c.getCreateName());
entity.setCreateTime(now); entity.setCreateTime(now);
//新增字段赋值
setData(entity);
activityMapper.save(entity); activityMapper.save(entity);
} }
} }
...@@ -335,6 +353,7 @@ public class StaffDuty implements IStaffDuty { ...@@ -335,6 +353,7 @@ public class StaffDuty implements IStaffDuty {
long seconds = 100; long seconds = 100;
if (redisUtil.setNX(key, value, seconds)) { if (redisUtil.setNX(key, value, seconds)) {
Map<String, Object> map = new HashMap<>(10); Map<String, Object> map = new HashMap<>(10);
map.put("type", 0);
List<CloudActivityEntity> list = activityMapper.queryByConditions(map); List<CloudActivityEntity> list = activityMapper.queryByConditions(map);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
for (CloudActivityEntity c : list) { for (CloudActivityEntity c : list) {
...@@ -711,6 +730,7 @@ public class StaffDuty implements IStaffDuty { ...@@ -711,6 +730,7 @@ public class StaffDuty implements IStaffDuty {
map.put("group", 1); map.put("group", 1);
map.put("startTime", startTime); map.put("startTime", startTime);
map.put("endTime", endTime); map.put("endTime", endTime);
map.put("type", 0);
List<CloudActivityEntity> activeList1 = activityMapper.queryByConditions(map); List<CloudActivityEntity> activeList1 = activityMapper.queryByConditions(map);
if (CollectionUtils.isNotEmpty(activeList1)) { if (CollectionUtils.isNotEmpty(activeList1)) {
final List<CloudActivityEntity> activeList = activeList1; final List<CloudActivityEntity> activeList = activeList1;
......
...@@ -15,9 +15,31 @@ ...@@ -15,9 +15,31 @@
<result property="createName" column="create_name"/> <result property="createName" column="create_name"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="isDelete" column="is_delete"/> <result property="isDelete" column="is_delete"/>
<result property="totalPriceMin" column="total_price_min"/>
<result property="totalPriceMax" column="total_price_max"/>
<result property="areaMin" column="area_min"/>
<result property="areaMax" column="area_max"/>
<result property="block" column="block"/>
<result property="blockName" column="block_name"/>
<result property="district" column="district"/>
<result property="districtName" column="district_name"/>
<result property="channel" column="channel"/>
<result property="channelName" column="channel_name"/>
<result property="seeProjectName" column="see_project_name"/>
<result property="seeStartTime" column="see_start_time"/>
<result property="seeEndTime" column="see_end_time"/>
<result property="seeCount" column="see_count"/>
<result property="type" column="type"/>
</resultMap> </resultMap>
<insert id="save" parameterType="com.house365.beans.entity.CloudActivityEntity"> <sql id="sqlId">
id,name,customer_count,wait_count,sent_count,city,create_id,create_name,create_time,is_delete,total_price_min,total_price_max,
area_min,area_max,block,block_name,district,district_name,channel,channel_name,see_project_name,see_start_time,
see_end_time,see_count,type
</sql>
<insert id="save" useGeneratedKeys="true" keyProperty="id" parameterType="com.house365.beans.entity.CloudActivityEntity">
INSERT INTO cloud_activity ( INSERT INTO cloud_activity (
name, name,
customer_count, customer_count,
...@@ -27,7 +49,22 @@ ...@@ -27,7 +49,22 @@
create_id, create_id,
create_name, create_name,
create_time, create_time,
is_delete is_delete,
total_price_min,
total_price_max,
area_min,
area_max,
block,
block_name,
district,
district_name,
channel,
channel_name,
see_project_name,
see_start_time,
see_end_time,
see_count,
type
) )
VALUES ( VALUES (
#{name}, #{name},
...@@ -38,21 +75,44 @@ ...@@ -38,21 +75,44 @@
#{createId}, #{createId},
#{createName}, #{createName},
#{createTime}, #{createTime},
#{isDelete} #{isDelete},
#{totalPriceMin},
#{totalPriceMax},
#{areaMin},
#{areaMax},
#{block},
#{blockName},
#{district},
#{districtName},
#{channel},
#{channelName},
#{seeProjectName},
#{seeStartTime},
#{seeEndTime},
#{seeCount},
#{type}
) )
</insert> </insert>
<select id="getById" resultMap="infoMap" parameterType="map"> <select id="getById" resultMap="infoMap" parameterType="map">
SELECT SELECT
* <include refid="sqlId"/>
FROM FROM
cloud_activity cloud_activity
where is_delete = 0 AND id = #{id} where is_delete = 0 AND id = #{id}
</select> </select>
<select id="getByIdAndDel" resultMap="infoMap" parameterType="map">
SELECT
<include refid="sqlId"/>
FROM
cloud_activity
where id = #{id}
</select>
<select id="queryByConditions" resultMap="infoMap" parameterType="map"> <select id="queryByConditions" resultMap="infoMap" parameterType="map">
SELECT SELECT
* <include refid="sqlId"/>
FROM FROM
cloud_activity cloud_activity
where is_delete = 0 where is_delete = 0
...@@ -77,6 +137,9 @@ ...@@ -77,6 +137,9 @@
<if test="id != null and id > 0 "> <if test="id != null and id > 0 ">
AND id = #{id} AND id = #{id}
</if> </if>
<if test="type != null and type >= 0 ">
AND type = #{type}
</if>
<if test="group != null and group > 0 "> <if test="group != null and group > 0 ">
group BY create_id group BY create_id
</if> </if>
...@@ -103,7 +166,8 @@ ...@@ -103,7 +166,8 @@
AND name LIKE CONCAT('%',#{name},'%') AND name LIKE CONCAT('%',#{name},'%')
</if> </if>
<if test="createId != null and createId > 0 "> <if test="createId != null and createId > 0 ">
AND (create_id = #{createId} OR create_id IN (SELECT id FROM user WHERE depturlpath LIKE (SELECT CONCAT(depturlpath,'/%') FROM user WHERE id = #{createId}))) AND (create_id = #{createId} OR create_id IN (SELECT id FROM user WHERE depturlpath LIKE (SELECT
CONCAT(depturlpath,'/%') FROM user WHERE id = #{createId})))
</if> </if>
<if test="createName != null and createName != ''"> <if test="createName != null and createName != ''">
AND create_name = #{createName} AND create_name = #{createName}
...@@ -114,6 +178,9 @@ ...@@ -114,6 +178,9 @@
<if test="city != null and city != ''"> <if test="city != null and city != ''">
AND city = #{city} AND city = #{city}
</if> </if>
<if test="type != null and type >= 0 ">
AND type = #{type}
</if>
ORDER BY id DESC ORDER BY id DESC
<if test="start != null and start >= 0 "> <if test="start != null and start >= 0 ">
limit #{start},#{limit} limit #{start},#{limit}
...@@ -128,7 +195,8 @@ ...@@ -128,7 +195,8 @@
AND name LIKE CONCAT('%',#{name},'%') AND name LIKE CONCAT('%',#{name},'%')
</if> </if>
<if test="createId != null and createId > 0 "> <if test="createId != null and createId > 0 ">
AND (create_id = #{createId} OR create_id IN (SELECT id FROM user WHERE depturlpath LIKE (SELECT CONCAT(depturlpath,'/%') FROM user WHERE id = #{createId}))) AND (create_id = #{createId} OR create_id IN (SELECT id FROM user WHERE depturlpath LIKE (SELECT
CONCAT(depturlpath,'/%') FROM user WHERE id = #{createId})))
</if> </if>
<if test="createName != null and createName != ''"> <if test="createName != null and createName != ''">
AND create_name = #{createName} AND create_name = #{createName}
...@@ -139,6 +207,16 @@ ...@@ -139,6 +207,16 @@
<if test="city != null and city != ''"> <if test="city != null and city != ''">
AND city = #{city} AND city = #{city}
</if> </if>
<if test="type != null and type >= 0 ">
AND type = #{type}
</if>
</select> </select>
<update id="updateStatus" parameterType="map">
UPDATE cloud_activity
SET
is_delete = #{isDelete}
WHERE id = #{id}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -68,3 +68,5 @@ crm.track.url = http://crm.house365.com/api/qlt/getImportantJoins ...@@ -68,3 +68,5 @@ crm.track.url = http://crm.house365.com/api/qlt/getImportantJoins
projects.server.url=http://oms.house365.com/test/adminpack/index.php projects.server.url=http://oms.house365.com/test/adminpack/index.php
#推广部同步用户url #推广部同步用户url
promote.url = http://365tgb.house365.com/api/app/syncUserFromApp promote.url = http://365tgb.house365.com/api/app/syncUserFromApp
#云迹拉取新接口地址
CLOUD.PULL.URL = http://192.168.105.121:8083/user/hgs/loginaccountinfo
...@@ -15,9 +15,31 @@ ...@@ -15,9 +15,31 @@
<result property="createName" column="create_name"/> <result property="createName" column="create_name"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="isDelete" column="is_delete"/> <result property="isDelete" column="is_delete"/>
<result property="totalPriceMin" column="total_price_min"/>
<result property="totalPriceMax" column="total_price_max"/>
<result property="areaMin" column="area_min"/>
<result property="areaMax" column="area_max"/>
<result property="block" column="block"/>
<result property="blockName" column="block_name"/>
<result property="district" column="district"/>
<result property="districtName" column="district_name"/>
<result property="channel" column="channel"/>
<result property="channelName" column="channel_name"/>
<result property="seeProjectName" column="see_project_name"/>
<result property="seeStartTime" column="see_start_time"/>
<result property="seeEndTime" column="see_end_time"/>
<result property="seeCount" column="see_count"/>
<result property="type" column="type"/>
</resultMap> </resultMap>
<insert id="save" parameterType="com.house365.beans.entity.CloudActivityEntity"> <sql id="sqlId">
id,name,customer_count,wait_count,sent_count,city,create_id,create_name,create_time,is_delete,total_price_min,total_price_max,
area_min,area_max,block,block_name,district,district_name,channel,channel_name,see_project_name,see_start_time,
see_end_time,see_count,type
</sql>
<insert id="save" useGeneratedKeys="true" keyProperty="id" parameterType="com.house365.beans.entity.CloudActivityEntity">
INSERT INTO cloud_activity ( INSERT INTO cloud_activity (
name, name,
customer_count, customer_count,
...@@ -27,7 +49,22 @@ ...@@ -27,7 +49,22 @@
create_id, create_id,
create_name, create_name,
create_time, create_time,
is_delete is_delete,
total_price_min,
total_price_max,
area_min,
area_max,
block,
block_name,
district,
district_name,
channel,
channel_name,
see_project_name,
see_start_time,
see_end_time,
see_count,
type
) )
VALUES ( VALUES (
#{name}, #{name},
...@@ -38,21 +75,44 @@ ...@@ -38,21 +75,44 @@
#{createId}, #{createId},
#{createName}, #{createName},
#{createTime}, #{createTime},
#{isDelete} #{isDelete},
#{totalPriceMin},
#{totalPriceMax},
#{areaMin},
#{areaMax},
#{block},
#{blockName},
#{district},
#{districtName},
#{channel},
#{channelName},
#{seeProjectName},
#{seeStartTime},
#{seeEndTime},
#{seeCount},
#{type}
) )
</insert> </insert>
<select id="getById" resultMap="infoMap" parameterType="map"> <select id="getById" resultMap="infoMap" parameterType="map">
SELECT SELECT
* <include refid="sqlId"/>
FROM FROM
cloud_activity cloud_activity
where is_delete = 0 AND id = #{id} where is_delete = 0 AND id = #{id}
</select> </select>
<select id="getByIdAndDel" resultMap="infoMap" parameterType="map">
SELECT
<include refid="sqlId"/>
FROM
cloud_activity
where id = #{id}
</select>
<select id="queryByConditions" resultMap="infoMap" parameterType="map"> <select id="queryByConditions" resultMap="infoMap" parameterType="map">
SELECT SELECT
* <include refid="sqlId"/>
FROM FROM
cloud_activity cloud_activity
where is_delete = 0 where is_delete = 0
...@@ -77,6 +137,9 @@ ...@@ -77,6 +137,9 @@
<if test="id != null and id > 0 "> <if test="id != null and id > 0 ">
AND id = #{id} AND id = #{id}
</if> </if>
<if test="type != null and type >= 0 ">
AND type = #{type}
</if>
<if test="group != null and group > 0 "> <if test="group != null and group > 0 ">
group BY create_id group BY create_id
</if> </if>
...@@ -103,7 +166,8 @@ ...@@ -103,7 +166,8 @@
AND name LIKE CONCAT('%',#{name},'%') AND name LIKE CONCAT('%',#{name},'%')
</if> </if>
<if test="createId != null and createId > 0 "> <if test="createId != null and createId > 0 ">
AND (create_id = #{createId} OR create_id IN (SELECT id FROM user WHERE depturlpath LIKE (SELECT CONCAT(depturlpath,'/%') FROM user WHERE id = #{createId}))) AND (create_id = #{createId} OR create_id IN (SELECT id FROM user WHERE depturlpath LIKE (SELECT
CONCAT(depturlpath,'/%') FROM user WHERE id = #{createId})))
</if> </if>
<if test="createName != null and createName != ''"> <if test="createName != null and createName != ''">
AND create_name = #{createName} AND create_name = #{createName}
...@@ -114,6 +178,9 @@ ...@@ -114,6 +178,9 @@
<if test="city != null and city != ''"> <if test="city != null and city != ''">
AND city = #{city} AND city = #{city}
</if> </if>
<if test="type != null and type >= 0 ">
AND type = #{type}
</if>
ORDER BY id DESC ORDER BY id DESC
<if test="start != null and start >= 0 "> <if test="start != null and start >= 0 ">
limit #{start},#{limit} limit #{start},#{limit}
...@@ -128,7 +195,8 @@ ...@@ -128,7 +195,8 @@
AND name LIKE CONCAT('%',#{name},'%') AND name LIKE CONCAT('%',#{name},'%')
</if> </if>
<if test="createId != null and createId > 0 "> <if test="createId != null and createId > 0 ">
AND (create_id = #{createId} OR create_id IN (SELECT id FROM user WHERE depturlpath LIKE (SELECT CONCAT(depturlpath,'/%') FROM user WHERE id = #{createId}))) AND (create_id = #{createId} OR create_id IN (SELECT id FROM user WHERE depturlpath LIKE (SELECT
CONCAT(depturlpath,'/%') FROM user WHERE id = #{createId})))
</if> </if>
<if test="createName != null and createName != ''"> <if test="createName != null and createName != ''">
AND create_name = #{createName} AND create_name = #{createName}
...@@ -139,6 +207,16 @@ ...@@ -139,6 +207,16 @@
<if test="city != null and city != ''"> <if test="city != null and city != ''">
AND city = #{city} AND city = #{city}
</if> </if>
<if test="type != null and type >= 0 ">
AND type = #{type}
</if>
</select> </select>
<update id="updateStatus" parameterType="map">
UPDATE cloud_activity
SET
is_delete = #{isDelete}
WHERE id = #{id}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -69,4 +69,6 @@ crm.track.url = http://crm.house365.com/api/qlt/getImportantJoins ...@@ -69,4 +69,6 @@ crm.track.url = http://crm.house365.com/api/qlt/getImportantJoins
projects.server.url=http://oms.house365.com/tpp/adminpack/index.php projects.server.url=http://oms.house365.com/tpp/adminpack/index.php
#推广部同步用户url #推广部同步用户url
promote.url = http://365tgb.house365.com/api/app/syncUserFromApp promote.url = http://365tgb.house365.com/api/app/syncUserFromApp
#云迹拉取新接口地址
CLOUD.PULL.URL = http://192.168.105.121:8083/user/hgs/loginaccountinfo
...@@ -15,9 +15,31 @@ ...@@ -15,9 +15,31 @@
<result property="createName" column="create_name"/> <result property="createName" column="create_name"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="isDelete" column="is_delete"/> <result property="isDelete" column="is_delete"/>
<result property="totalPriceMin" column="total_price_min"/>
<result property="totalPriceMax" column="total_price_max"/>
<result property="areaMin" column="area_min"/>
<result property="areaMax" column="area_max"/>
<result property="block" column="block"/>
<result property="blockName" column="block_name"/>
<result property="district" column="district"/>
<result property="districtName" column="district_name"/>
<result property="channel" column="channel"/>
<result property="channelName" column="channel_name"/>
<result property="seeProjectName" column="see_project_name"/>
<result property="seeStartTime" column="see_start_time"/>
<result property="seeEndTime" column="see_end_time"/>
<result property="seeCount" column="see_count"/>
<result property="type" column="type"/>
</resultMap> </resultMap>
<insert id="save" parameterType="com.house365.beans.entity.CloudActivityEntity"> <sql id="sqlId">
id,name,customer_count,wait_count,sent_count,city,create_id,create_name,create_time,is_delete,total_price_min,total_price_max,
area_min,area_max,block,block_name,district,district_name,channel,channel_name,see_project_name,see_start_time,
see_end_time,see_count,type
</sql>
<insert id="save" useGeneratedKeys="true" keyProperty="id" parameterType="com.house365.beans.entity.CloudActivityEntity">
INSERT INTO cloud_activity ( INSERT INTO cloud_activity (
name, name,
customer_count, customer_count,
...@@ -27,7 +49,22 @@ ...@@ -27,7 +49,22 @@
create_id, create_id,
create_name, create_name,
create_time, create_time,
is_delete is_delete,
total_price_min,
total_price_max,
area_min,
area_max,
block,
block_name,
district,
district_name,
channel,
channel_name,
see_project_name,
see_start_time,
see_end_time,
see_count,
type
) )
VALUES ( VALUES (
#{name}, #{name},
...@@ -38,21 +75,44 @@ ...@@ -38,21 +75,44 @@
#{createId}, #{createId},
#{createName}, #{createName},
#{createTime}, #{createTime},
#{isDelete} #{isDelete},
#{totalPriceMin},
#{totalPriceMax},
#{areaMin},
#{areaMax},
#{block},
#{blockName},
#{district},
#{districtName},
#{channel},
#{channelName},
#{seeProjectName},
#{seeStartTime},
#{seeEndTime},
#{seeCount},
#{type}
) )
</insert> </insert>
<select id="getById" resultMap="infoMap" parameterType="map"> <select id="getById" resultMap="infoMap" parameterType="map">
SELECT SELECT
* <include refid="sqlId"/>
FROM FROM
cloud_activity cloud_activity
where is_delete = 0 AND id = #{id} where is_delete = 0 AND id = #{id}
</select> </select>
<select id="getByIdAndDel" resultMap="infoMap" parameterType="map">
SELECT
<include refid="sqlId"/>
FROM
cloud_activity
where id = #{id}
</select>
<select id="queryByConditions" resultMap="infoMap" parameterType="map"> <select id="queryByConditions" resultMap="infoMap" parameterType="map">
SELECT SELECT
* <include refid="sqlId"/>
FROM FROM
cloud_activity cloud_activity
where is_delete = 0 where is_delete = 0
...@@ -77,6 +137,9 @@ ...@@ -77,6 +137,9 @@
<if test="id != null and id > 0 "> <if test="id != null and id > 0 ">
AND id = #{id} AND id = #{id}
</if> </if>
<if test="type != null and type >= 0 ">
AND type = #{type}
</if>
<if test="group != null and group > 0 "> <if test="group != null and group > 0 ">
group BY create_id group BY create_id
</if> </if>
...@@ -103,7 +166,8 @@ ...@@ -103,7 +166,8 @@
AND name LIKE CONCAT('%',#{name},'%') AND name LIKE CONCAT('%',#{name},'%')
</if> </if>
<if test="createId != null and createId > 0 "> <if test="createId != null and createId > 0 ">
AND (create_id = #{createId} OR create_id IN (SELECT id FROM user WHERE depturlpath LIKE (SELECT CONCAT(depturlpath,'/%') FROM user WHERE id = #{createId}))) AND (create_id = #{createId} OR create_id IN (SELECT id FROM user WHERE depturlpath LIKE (SELECT
CONCAT(depturlpath,'/%') FROM user WHERE id = #{createId})))
</if> </if>
<if test="createName != null and createName != ''"> <if test="createName != null and createName != ''">
AND create_name = #{createName} AND create_name = #{createName}
...@@ -114,6 +178,9 @@ ...@@ -114,6 +178,9 @@
<if test="city != null and city != ''"> <if test="city != null and city != ''">
AND city = #{city} AND city = #{city}
</if> </if>
<if test="type != null and type >= 0 ">
AND type = #{type}
</if>
ORDER BY id DESC ORDER BY id DESC
<if test="start != null and start >= 0 "> <if test="start != null and start >= 0 ">
limit #{start},#{limit} limit #{start},#{limit}
...@@ -128,7 +195,8 @@ ...@@ -128,7 +195,8 @@
AND name LIKE CONCAT('%',#{name},'%') AND name LIKE CONCAT('%',#{name},'%')
</if> </if>
<if test="createId != null and createId > 0 "> <if test="createId != null and createId > 0 ">
AND (create_id = #{createId} OR create_id IN (SELECT id FROM user WHERE depturlpath LIKE (SELECT CONCAT(depturlpath,'/%') FROM user WHERE id = #{createId}))) AND (create_id = #{createId} OR create_id IN (SELECT id FROM user WHERE depturlpath LIKE (SELECT
CONCAT(depturlpath,'/%') FROM user WHERE id = #{createId})))
</if> </if>
<if test="createName != null and createName != ''"> <if test="createName != null and createName != ''">
AND create_name = #{createName} AND create_name = #{createName}
...@@ -139,6 +207,16 @@ ...@@ -139,6 +207,16 @@
<if test="city != null and city != ''"> <if test="city != null and city != ''">
AND city = #{city} AND city = #{city}
</if> </if>
<if test="type != null and type >= 0 ">
AND type = #{type}
</if>
</select> </select>
<update id="updateStatus" parameterType="map">
UPDATE cloud_activity
SET
is_delete = #{isDelete}
WHERE id = #{id}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -69,4 +69,6 @@ crm.track.url = http://crm.house365.com/api/qlt/getImportantJoins ...@@ -69,4 +69,6 @@ crm.track.url = http://crm.house365.com/api/qlt/getImportantJoins
projects.server.url=http://oms.house365.com/test/adminpack/index.php projects.server.url=http://oms.house365.com/test/adminpack/index.php
#推广部同步用户url #推广部同步用户url
promote.url = http://365tgb.house365.com/api/app/syncUserFromApp promote.url = http://365tgb.house365.com/api/app/syncUserFromApp
#云迹拉取新接口地址
CLOUD.PULL.URL = http://192.168.105.121:8083/user/hgs/loginaccountinfo
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