|
@@ -5,13 +5,8 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.caimei365.user.components.RedisService;
|
|
|
import com.caimei365.user.mapper.*;
|
|
|
import com.caimei365.user.model.ResponseJson;
|
|
|
-import com.caimei365.user.model.dto.ClubUpdateDto;
|
|
|
-import com.caimei365.user.model.dto.SuperVipDto;
|
|
|
-import com.caimei365.user.model.po.SuperVipPo;
|
|
|
-import com.caimei365.user.model.dto.JsonParamsDto;
|
|
|
-import com.caimei365.user.model.po.ClubRemarksPo;
|
|
|
-import com.caimei365.user.model.po.UserBeansHistoryPo;
|
|
|
-import com.caimei365.user.model.po.UserPo;
|
|
|
+import com.caimei365.user.model.dto.*;
|
|
|
+import com.caimei365.user.model.po.*;
|
|
|
import com.caimei365.user.model.vo.*;
|
|
|
import com.caimei365.user.service.ClubService;
|
|
|
import com.caimei365.user.service.SellerService;
|
|
@@ -20,14 +15,19 @@ import com.caimei365.user.utils.MathUtil;
|
|
|
import com.caimei365.user.utils.OssUtil;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.text.NumberFormat;
|
|
|
+import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -140,6 +140,29 @@ public class ClubServiceImpl implements ClubService {
|
|
|
Map<String, Object> map = new HashMap(2);
|
|
|
map.put("club", club);
|
|
|
map.put("saleName", saleName);
|
|
|
+ // 是否失效 有效时间3天
|
|
|
+ String addTime = clubMapper.selAddTime(clubId);
|
|
|
+ if (StringUtils.isNotBlank(addTime)) {
|
|
|
+ //计算距今时长
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date date = null;
|
|
|
+ try {
|
|
|
+ date = dateFormat.parse(addTime);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(date);
|
|
|
+ long timeOld = calendar.getTime().getTime();
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ long timeNew = calendar.getTime().getTime();
|
|
|
+ int day = (int)(timeNew - timeOld) / 1000 / 60 / 60 / 24;
|
|
|
+ if (day > 3) {
|
|
|
+ map.put("lostType",1);
|
|
|
+ } else {
|
|
|
+ map.put("lostType",0);
|
|
|
+ }
|
|
|
+ }
|
|
|
return ResponseJson.success(map);
|
|
|
}
|
|
|
|
|
@@ -205,6 +228,12 @@ public class ClubServiceImpl implements ClubService {
|
|
|
}
|
|
|
// 更新机构用户信息
|
|
|
clubMapper.updateClubUserByUpdateInfo(user);
|
|
|
+ //添加操作日志
|
|
|
+ int type = insertOperationalLogs(club);
|
|
|
+
|
|
|
+ if (type == 1) {
|
|
|
+ club.setLastModify(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
|
+ }
|
|
|
// 更新机构信息
|
|
|
clubMapper.updateClubByUpdateInfo(club);
|
|
|
|
|
@@ -240,6 +269,381 @@ public class ClubServiceImpl implements ClubService {
|
|
|
return ResponseJson.success("修改机构资料成功", club);
|
|
|
}
|
|
|
|
|
|
+ private int insertOperationalLogs(ClubUpdateDto club) {
|
|
|
+ int type = 0;
|
|
|
+ log.info("====开始操作记录====");
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
+ OperationalLogsPo operationalLogsPo = new OperationalLogsPo();
|
|
|
+ ClubVo clubVo = clubMapper.selClubData(club.getClubId());
|
|
|
+ // 判断修改的内容
|
|
|
+ if (club.getClubId() != null) {
|
|
|
+
|
|
|
+ if (clubVo != null) {
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getName())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getName())) {
|
|
|
+ if (!club.getName().equals(clubVo.getName())) {
|
|
|
+ list.add("修改了机构名称");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了机构名称");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getName())) {
|
|
|
+ list.add("新增了机构名称");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getLinkMan())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getLinkMan())) {
|
|
|
+ if (!club.getLinkMan().equals(clubVo.getLinkMan())) {
|
|
|
+ list.add("修改了联系人");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了联系人");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getLinkMan())) {
|
|
|
+ list.add("新增了联系人");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (clubVo.getLinkManIdentity() != null) {
|
|
|
+ if (club.getLinkManIdentity() != null ) {
|
|
|
+ if (club.getLinkManIdentity().equals(clubVo.getLinkManIdentity())) {
|
|
|
+ list.add("修改了联系人身份");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了联系人身份");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (club.getLinkManIdentity() != null ) {
|
|
|
+ list.add("新增了联系人身份");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getContractEmail())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getContractEmail())) {
|
|
|
+ if (!club.getContractEmail().equals(clubVo.getContractEmail())) {
|
|
|
+ list.add("修改了联系邮箱");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了联系邮箱");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getContractEmail())) {
|
|
|
+ list.add("新增了联系邮箱");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getShortName())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getShortName())) {
|
|
|
+ if (!club.getShortName().equals(clubVo.getShortName())) {
|
|
|
+ list.add("修改了机构简称");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了机构简称");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getShortName())) {
|
|
|
+ list.add("新增了机构简称");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (clubVo.getProvinceId() != null || clubVo.getCityId() != null || clubVo.getTownId() != null || StringUtils.isNotBlank(clubVo.getAddress())) {
|
|
|
+ if (club.getProvinceId() != null || club.getCityId() != null || club.getTownId() != null || StringUtils.isNotBlank(club.getAddress())) {
|
|
|
+ if (!club.getProvinceId().equals(clubVo.getProvinceId()) || !club.getCityId().equals(clubVo.getCityId()) || !club.getTownId().equals(clubVo.getTownId()) || !club.getAddress().equals(clubVo.getAddress())) {
|
|
|
+ list.add("修改了详细地址");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了详细地址");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (club.getProvinceId() != null || club.getCityId() != null || club.getTownId() != null || StringUtils.isNotBlank(club.getAddress())) {
|
|
|
+ list.add("新增了详细地址");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+/*
|
|
|
+ if (clubVo.getCityId() != null) {
|
|
|
+ if (club.getCityId() != null) {
|
|
|
+ if (!club.getCityId().equals(clubVo.getCityId())) {
|
|
|
+ list.add("修改了详细地址");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了详细地址");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (club.getCityId() != null) {
|
|
|
+ list.add("新增了详细地址");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (clubVo.getTownId() != null) {
|
|
|
+ if (club.getTownId() != null) {
|
|
|
+ if (!club.getTownId().equals(clubVo.getTownId())) {
|
|
|
+ list.add("修改了详细地址");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了详细地址");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (club.getTownId() != null) {
|
|
|
+ list.add("新增了详细地址");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getAddress())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getAddress())) {
|
|
|
+ if (!club.getAddress().equals(clubVo.getAddress())) {
|
|
|
+ list.add("修改了详细地址");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了详细地址");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getAddress())) {
|
|
|
+ list.add("新增了详细地址");
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getSocialCreditCode())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getSocialCreditCode())) {
|
|
|
+ if (!club.getSocialCreditCode().equals(clubVo.getSocialCreditCode())) {
|
|
|
+ list.add("修改了营业执照编号");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了营业执照编号");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getSocialCreditCode())) {
|
|
|
+ list.add("新增了营业执照编号");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getBusinessLicense())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getBusinessLicense())) {
|
|
|
+ if (!club.getBusinessLicense().equals(clubVo.getBusinessLicense())) {
|
|
|
+ list.add("修改了营业执照");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了营业执照");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getBusinessLicense())) {
|
|
|
+ list.add("新增了营业执照");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getShopPhoto())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getShopPhoto())) {
|
|
|
+ if (!club.getShopPhoto().equals(clubVo.getShopPhoto())) {
|
|
|
+ list.add("修改了门头照");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了门头照");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getShopPhoto())) {
|
|
|
+ list.add("新增了门头照");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (clubVo.getFirstClubType() != null) {
|
|
|
+ if (club.getFirstClubType() != null) {
|
|
|
+ if (!club.getFirstClubType().equals(clubVo.getFirstClubType())) {
|
|
|
+ list.add("修改了机构类型分类");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了机构类型分类");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (club.getFirstClubType() != null) {
|
|
|
+ list.add("新增了机构类型分类");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (clubVo.getSecondClubType() != null) {
|
|
|
+ if (club.getSecondClubType() != null) {
|
|
|
+ if (!club.getSecondClubType().equals(clubVo.getSecondClubType())) {
|
|
|
+ list.add("修改了机构类型二级分类");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了机构类型二级分类");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (club.getSecondClubType() != null) {
|
|
|
+ list.add("新增了机构类型二级分类");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getDepartment())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getDepartment())) {
|
|
|
+ if (!club.getDepartment().equals(clubVo.getDepartment())) {
|
|
|
+ list.add("修改了科室");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了科室");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getDepartment())) {
|
|
|
+ list.add("新增了科室");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getMedicalPracticeLicense())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getMedicalPracticeLicense())) {
|
|
|
+ if (!club.getMedicalPracticeLicense().equals(clubVo.getMedicalPracticeLicense())) {
|
|
|
+ list.add("修改了医美分类必须上传医疗执业许可证");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了医美分类必须上传医疗执业许可证");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getMedicalPracticeLicense())) {
|
|
|
+ list.add("新增了医美分类必须上传医疗执业许可证");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getMainProduct())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getMainProduct())) {
|
|
|
+ if (!club.getMainProduct().equals(clubVo.getMainProduct())) {
|
|
|
+ list.add("修改了主打项目");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了主打项目");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getMainProduct())) {
|
|
|
+ list.add("新增了主打项目");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getFax())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getFax())) {
|
|
|
+ if (!club.getFax().equals(clubVo.getFax())) {
|
|
|
+ list.add("修改了传真");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了传真");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getFax())) {
|
|
|
+ list.add("新增了传真");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getContractPhone())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getContractPhone())) {
|
|
|
+ if (!club.getContractPhone().equals(clubVo.getContractPhone())) {
|
|
|
+ list.add("修改了固定电话");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了固定电话");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getContractPhone())) {
|
|
|
+ list.add("新增了固定电话");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getProfile())) {
|
|
|
+ if (StringUtils.isNotBlank(club.getProfile())) {
|
|
|
+ if (!club.getProfile().equals(clubVo.getProfile())) {
|
|
|
+ list.add("修改了公司简介");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.add("删除了公司简介");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(club.getProfile())) {
|
|
|
+ list.add("新增了公司简介");
|
|
|
+ type = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ operationalLogsPo.setInstitutionName(club.getName());
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(club.getLinkMan())) {
|
|
|
+ operationalLogsPo.setContact(club.getLinkMan());
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getLinkMan())) {
|
|
|
+ operationalLogsPo.setContact(club.getLinkMan());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ operationalLogsPo.setOperationType("编辑");
|
|
|
+ operationalLogsPo.setActionContent(StringUtils.strip(list.toString(),"[]"));
|
|
|
+
|
|
|
+ // 机构修改 机构联系人 为操作人
|
|
|
+ if (StringUtils.isNotBlank(club.getLinkMan())) {
|
|
|
+ operationalLogsPo.setOperator(club.getLinkMan());
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(clubVo.getLinkMan())) {
|
|
|
+ operationalLogsPo.setOperator(clubVo.getLinkMan());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 协销帮忙修改 取协销人员
|
|
|
+ if (club.getServiceProviderId() != 0) {
|
|
|
+ String spName = clubMapper.selSpName(club.getServiceProviderId());
|
|
|
+ operationalLogsPo.setOperator(spName);
|
|
|
+ }
|
|
|
+ operationalLogsPo.setOperationTime(new Date());
|
|
|
+
|
|
|
+ log.info("operationalLogsPo====="+operationalLogsPo);
|
|
|
+ clubMapper.insertOpLogs(operationalLogsPo);
|
|
|
+ return type;
|
|
|
+ }
|
|
|
+
|
|
|
private void saveUserBeans(UserVo user) {
|
|
|
//机构完善资料,送500采美豆
|
|
|
UserBeansHistoryPo beansHistory = new UserBeansHistoryPo();
|
|
@@ -483,6 +887,7 @@ public class ClubServiceImpl implements ClubService {
|
|
|
if (newRemarks) {
|
|
|
// 新增备注
|
|
|
clubMapper.insertRemarks(clubRemarksPo);
|
|
|
+ clubMapper.updateClubNewDeal(clubId);
|
|
|
} else {
|
|
|
// 修改备注
|
|
|
clubMapper.updateRemarks(clubRemarksPo);
|
|
@@ -1647,4 +2052,466 @@ public class ClubServiceImpl implements ClubService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResponseJson accessRecords(Integer clubId) {
|
|
|
+ List<CmRecordVo> data = new ArrayList<>();
|
|
|
+ ArrayList list = new ArrayList<>();
|
|
|
+ ArrayList<String> listYear = new ArrayList<>();
|
|
|
+ CmRecordVo cmRecordVo = new CmRecordVo();
|
|
|
+ List<RecordVo> records = clubMapper.accessRecords(clubId);
|
|
|
+ String substring = "";
|
|
|
+ if (records.size() > 0) {
|
|
|
+ for (RecordVo recordVo : records) {
|
|
|
+ substring = recordVo.getAccessDate().substring(0, 4);
|
|
|
+ if (!listYear.contains(substring)) {
|
|
|
+ listYear.add(substring);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (int i = 0; i < listYear.size() ; i++) {
|
|
|
+ for (RecordVo recordVo : records) {
|
|
|
+ if (listYear.get(i).equals(recordVo.getAccessDate().substring(0, 4))) {
|
|
|
+ recordVo.setMonthAndDay(recordVo.getAccessDate().substring(5));
|
|
|
+ list.add(recordVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cmRecordVo.setYear(listYear.get(i));
|
|
|
+ cmRecordVo.setData(list);
|
|
|
+ data.add(cmRecordVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResponseJson.success(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseJson recordDetail(Integer clubId, String accessDate, String ip, Integer pageNum, Integer pageSize) {
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ //访问详情数据
|
|
|
+ List<BehaviorRecodeVo> recordDetail = clubMapper.recordDetail(clubId, accessDate);
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+ List<BehaviorRecodeVo> region = clubMapper.selRegion(ip,accessDate);
|
|
|
+ String format = "";
|
|
|
+ for(BehaviorRecodeVo record: recordDetail) {
|
|
|
+ // 图片处理
|
|
|
+ if (StringUtils.isNotBlank(record.getProductImage())) {
|
|
|
+ record.setProductImage(ImageUtils.getImageURL("product", record.getProductImage(), 0, wwwDomain));
|
|
|
+ }
|
|
|
+ String time = calculationTime(record.getAccessDuration());
|
|
|
+ record.setAccessDuration(time);
|
|
|
+ record.setAccessNewTime(dateFormat.format(record.getAccessTime()));
|
|
|
+ String s = simpleDateFormat.format(record.getAccessTime());
|
|
|
+
|
|
|
+ // 访问来源
|
|
|
+ if (region.size() != 0) {
|
|
|
+ for (BehaviorRecodeVo behaviorRecord : region) {
|
|
|
+ format = simpleDateFormat.format(behaviorRecord.getAccessTime());
|
|
|
+ if (StringUtils.isNotBlank(record.getPageType()) && StringUtils.isNotBlank(behaviorRecord.getPageType())) {
|
|
|
+ if (record.getPageType().equals(behaviorRecord.getPageType()) && s.equals(format)) {
|
|
|
+ record.setAccessSource(behaviorRecord.getAccessSource());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ PageInfo<BehaviorRecodeVo> pageInfo = new PageInfo<>(recordDetail);
|
|
|
+ return ResponseJson.success(pageInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseJson selTotal(Integer clubId) {
|
|
|
+ // 查询机构画像总数据
|
|
|
+ CmPortraitDto cmPortraitDto = clubMapper.selTotal(clubId);
|
|
|
+ return ResponseJson.success(cmPortraitDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseJson dataList(CmPortraitDto cmPortrait) {
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date date = new Date();
|
|
|
+ String endTime = "";
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(date);
|
|
|
+ calendar.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
+ Date time = calendar.getTime();
|
|
|
+ endTime = dateFormat.format(time);
|
|
|
+ String time1 = "";
|
|
|
+ String time2 = "";
|
|
|
+ boolean expty = ObjectUtils.isEmpty(cmPortrait.getStartTime()) && ObjectUtils.isEmpty(cmPortrait.getEndTime());
|
|
|
+ if (expty) {
|
|
|
+ Date start = null;
|
|
|
+ String startTime = "";
|
|
|
+ cmPortrait.setEndTime(endTime);
|
|
|
+ // 日期参数为 日
|
|
|
+ if (0 == cmPortrait.getDateType() || 1 == cmPortrait.getDateType()) {
|
|
|
+// cmPortrait.setAccessDate(endTime);
|
|
|
+ cmPortrait.setStartTime(endTime);
|
|
|
+// cmPortrait.setEndTime(endTime);
|
|
|
+ }
|
|
|
+ if (1 == cmPortrait.getDateType()) {
|
|
|
+// cmPortrait.setEndTime(endTime);
|
|
|
+ calendar.setTime(time);
|
|
|
+ calendar.add(Calendar.MONTH, -1);
|
|
|
+ start = calendar.getTime();
|
|
|
+ startTime = dateFormat.format(start);
|
|
|
+ cmPortrait.setStartTime(startTime);
|
|
|
+ }
|
|
|
+ if (2 == cmPortrait.getDateType()) {
|
|
|
+// cmPortrait.setEndTime(endTime);
|
|
|
+ calendar.setTime(time);
|
|
|
+ calendar.add(Calendar.MONTH, -6);
|
|
|
+ start = calendar.getTime();
|
|
|
+ startTime = dateFormat.format(start);
|
|
|
+ cmPortrait.setStartTime(startTime);
|
|
|
+ }
|
|
|
+ if (3 == cmPortrait.getDateType()) {
|
|
|
+// cmPortrait.setEndTime(endTime);
|
|
|
+ calendar.setTime(time);
|
|
|
+ calendar.add(Calendar.YEAR, -1);
|
|
|
+ start = calendar.getTime();
|
|
|
+ startTime = dateFormat.format(start);
|
|
|
+ cmPortrait.setStartTime(startTime);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ time1 = cmPortrait.getStartTime();
|
|
|
+ time2 = cmPortrait.getEndTime();
|
|
|
+ }
|
|
|
+ // 机构订单
|
|
|
+ if (0 == cmPortrait.getType() || 4 == cmPortrait.getType()) {
|
|
|
+ if ((0 == cmPortrait.getDateType() || 1 == cmPortrait.getDateType()) && expty) {
|
|
|
+ cmPortrait.setEndTime(dateFormat.format(date));
|
|
|
+ }
|
|
|
+ if (cmPortrait.getEndTime().equals(endTime)) {
|
|
|
+ cmPortrait.setEndTime(dateFormat.format(date));
|
|
|
+ }
|
|
|
+ int ordinary = 0, secondHand = 0, rebate = 0, partialRefund = 0, fullRefund = 0, closed = 0,total = 0;
|
|
|
+ double orderScopeTotalFee = 0.0;
|
|
|
+ ArrayList<PortraitMap> orderPortraits = new ArrayList<>();
|
|
|
+ PortraitMap orderPortrait = new PortraitMap();
|
|
|
+ List<NewOrderPo> orderList = clubMapper.selOrderList(cmPortrait);
|
|
|
+ int length = orderList.size();
|
|
|
+ NumberFormat instance = NumberFormat.getInstance();
|
|
|
+ instance.setMaximumFractionDigits(2);
|
|
|
+ if (length != 0) {
|
|
|
+ for (NewOrderPo order : orderList) {
|
|
|
+ // 普通订单
|
|
|
+ if (("0".equals(order.getSecondHandOrderFlag()) || StringUtils.isEmpty(order.getSecondHandOrderFlag()))
|
|
|
+ && (!"1".equals(order.getRebateFlag()) || "".equals(order.getRebateFlag()) || StringUtils.isEmpty(order.getRebateFlag()))
|
|
|
+ && ((!"1".equals(order.getRefundType()) && !"2".equals(order.getRefundType())) || "".equals(order.getRefundType()) || StringUtils.isEmpty(order.getRefundType()))
|
|
|
+ && !"6".equals(order.getStatus())) {
|
|
|
+ ordinary++;
|
|
|
+ }
|
|
|
+ // 二手订单
|
|
|
+ if ("1".equals(order.getSecondHandOrderFlag()) && !"1".equals(order.getRebateFlag())
|
|
|
+ && (!"1".equals(order.getRefundType()) && !"2".equals(order.getRefundType())) && !"6".equals(order.getStatus())) {
|
|
|
+ secondHand++;
|
|
|
+ }
|
|
|
+ // 返佣订单
|
|
|
+ if ("1".equals(order.getRebateFlag()) &&
|
|
|
+ (!"1".equals(order.getRefundType()) && !"2".equals(order.getRefundType()) || StringUtils.isEmpty(order.getRefundType())) && !"6".equals(order.getStatus())) {
|
|
|
+ rebate++;
|
|
|
+ }
|
|
|
+ // 部分退款
|
|
|
+ if ("1".equals(order.getRefundType()) && !"6".equals(order.getStatus())) {
|
|
|
+ partialRefund++;
|
|
|
+ }
|
|
|
+ // 全部退款
|
|
|
+ if ("2".equals(order.getRefundType()) && !"6".equals(order.getStatus())) {
|
|
|
+ fullRefund++;
|
|
|
+ }
|
|
|
+ // 已关闭
|
|
|
+ if ("6".equals(order.getStatus()) || StringUtils.isEmpty(order.getStatus())) {
|
|
|
+ closed++;
|
|
|
+ }
|
|
|
+ if (null != order.getPayTotalFee()) {
|
|
|
+ orderScopeTotalFee += order.getPayTotalFee();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cmPortrait.setOrderTotal(length);
|
|
|
+ /*cmPortrait.setOrderTotalAmount(new BigDecimal(orderList.get(0).getTotalMoney()));*/
|
|
|
+ // 当前单位订单总额
|
|
|
+ cmPortrait.setOrderScopeTotalFee(Double.valueOf(String.format("%.2f", orderScopeTotalFee)));
|
|
|
+
|
|
|
+ orderPortrait.setValue(ordinary);
|
|
|
+ if (ordinary != 0) {
|
|
|
+ orderPortrait.setName("普通");
|
|
|
+ orderPortrait.setPer(instance.format((float)ordinary / (float) length * 100));
|
|
|
+ } else {
|
|
|
+ orderPortrait.setName("普通");
|
|
|
+ orderPortrait.setPer("0");
|
|
|
+ }
|
|
|
+ orderPortraits.add(orderPortrait);
|
|
|
+ orderPortrait = new PortraitMap();
|
|
|
+ orderPortrait.setValue(secondHand);
|
|
|
+ if (secondHand != 0) {
|
|
|
+ orderPortrait.setName("二手");
|
|
|
+ orderPortrait.setPer(instance.format((float)secondHand / (float) length * 100));
|
|
|
+ } else {
|
|
|
+ orderPortrait.setName("二手");
|
|
|
+ orderPortrait.setPer("0");
|
|
|
+ }
|
|
|
+ orderPortraits.add(orderPortrait);
|
|
|
+ orderPortrait = new PortraitMap();
|
|
|
+ orderPortrait.setValue(rebate);
|
|
|
+ if (rebate != 0) {
|
|
|
+ orderPortrait.setName("返佣");
|
|
|
+ orderPortrait.setPer(instance.format((float)rebate / (float) length * 100));
|
|
|
+ } else {
|
|
|
+ orderPortrait.setName("返佣");
|
|
|
+ orderPortrait.setPer("0");
|
|
|
+ }
|
|
|
+ orderPortraits.add(orderPortrait);
|
|
|
+ orderPortrait = new PortraitMap();
|
|
|
+ orderPortrait.setValue(partialRefund);
|
|
|
+ if (partialRefund != 0) {
|
|
|
+ orderPortrait.setName("部分退款");
|
|
|
+ orderPortrait.setPer(instance.format((float)partialRefund / (float) length * 100));
|
|
|
+ } else {
|
|
|
+ orderPortrait.setName("部分退款");
|
|
|
+ orderPortrait.setPer("0");
|
|
|
+ }
|
|
|
+ orderPortraits.add(orderPortrait);
|
|
|
+ orderPortrait = new PortraitMap();
|
|
|
+ orderPortrait.setValue(fullRefund);
|
|
|
+ if (fullRefund != 0) {
|
|
|
+ orderPortrait.setName("全部退款");
|
|
|
+ orderPortrait.setPer(instance.format((float)fullRefund / (float) length * 100));
|
|
|
+ } else {
|
|
|
+ orderPortrait.setName("全部退款");
|
|
|
+ orderPortrait.setPer("0");
|
|
|
+ }
|
|
|
+ orderPortraits.add(orderPortrait);
|
|
|
+ orderPortrait = new PortraitMap();
|
|
|
+ orderPortrait.setValue(closed);
|
|
|
+ if (closed != 0) {
|
|
|
+ orderPortrait.setName("已关闭");
|
|
|
+ orderPortrait.setPer(instance.format((float)closed / (float) length * 100));
|
|
|
+ } else {
|
|
|
+ orderPortrait.setName("已关闭");
|
|
|
+ orderPortrait.setPer("0");
|
|
|
+ }
|
|
|
+ orderPortraits.add(orderPortrait);
|
|
|
+ cmPortrait.setOrderPortrait(orderPortraits);
|
|
|
+ } else {
|
|
|
+ cmPortrait.setOrderTotalAmount(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ // 总量
|
|
|
+ total = ordinary + secondHand + rebate + partialRefund + fullRefund + closed;
|
|
|
+ cmPortrait.setOrderScopeNum(total);
|
|
|
+ calendar.setTime(date);
|
|
|
+ calendar.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
+ time = calendar.getTime();
|
|
|
+ endTime = dateFormat.format(time);
|
|
|
+ cmPortrait.setEndTime(endTime);
|
|
|
+ }
|
|
|
+ // 搜索关键词
|
|
|
+ if (1 == cmPortrait.getType() || 4 == cmPortrait.getType()) {
|
|
|
+ List<BehaviorRecodeVo> behaviorRecordList = clubMapper.selBehaviorList(cmPortrait);
|
|
|
+ int keywordsTotal = 0;
|
|
|
+ ArrayList<Integer> integers = new ArrayList<>();
|
|
|
+ ArrayList<String> strings = new ArrayList<>();
|
|
|
+ if (behaviorRecordList.size() != 0) {
|
|
|
+ for (BehaviorRecodeVo record : behaviorRecordList) {
|
|
|
+ keywordsTotal += record.getNumber();
|
|
|
+ integers.add(record.getNumber());
|
|
|
+ if (!ObjectUtils.isEmpty(record.getPageLabel())) {
|
|
|
+ strings.add(record.getPageLabel());
|
|
|
+ } else {
|
|
|
+ strings.add("未知");
|
|
|
+ }
|
|
|
+// cmPortrait.setTotalKeywords(behaviorRecordList.get(0).getNumbers());
|
|
|
+ cmPortrait.setBehaviorValue(integers);
|
|
|
+ cmPortrait.setBehaviorType(strings);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*else {
|
|
|
+ cmPortrait.setTotalKeywords(0);
|
|
|
+ }*/
|
|
|
+ cmPortrait.setKeyWordsScopeNum(keywordsTotal);
|
|
|
+ }
|
|
|
+ // 咨询记录
|
|
|
+ if (2 == cmPortrait.getType() || 4 == cmPortrait.getType()) {
|
|
|
+ if ((0 == cmPortrait.getDateType() || 1 == cmPortrait.getDateType()) && expty) {
|
|
|
+ cmPortrait.setEndTime(dateFormat.format(date));
|
|
|
+ }
|
|
|
+ if (cmPortrait.getEndTime().equals(endTime)) {
|
|
|
+ cmPortrait.setEndTime(dateFormat.format(date));
|
|
|
+ }
|
|
|
+ List<CmClubRemarksVo> remarksList = clubMapper.selRemarksList(cmPortrait);
|
|
|
+// int remarksTotal = 0;
|
|
|
+ ArrayList<Integer> integers = new ArrayList<>();
|
|
|
+ ArrayList<String> strings = new ArrayList<>();
|
|
|
+ ArrayList<String> strRemark = new ArrayList<>();
|
|
|
+ ArrayList<String> remarkAll = new ArrayList<>();
|
|
|
+ int number = 0;
|
|
|
+ if (remarksList.size() != 0) {
|
|
|
+ for (CmClubRemarksVo remarks: remarksList) {
|
|
|
+ String[] split = remarks.getRemarks().split(",");
|
|
|
+ for (String str : split) {
|
|
|
+ if (!strRemark.contains(str)) {
|
|
|
+ strRemark.add(str);
|
|
|
+ }
|
|
|
+ remarkAll.add(str);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (String str : strRemark) {
|
|
|
+ for (int i = 0;i < remarkAll.size(); i++) {
|
|
|
+ if (str.equals(remarkAll.get(i))) {
|
|
|
+ number++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ integers.add(number);
|
|
|
+// remarksTotal += number;
|
|
|
+ if (!ObjectUtils.isEmpty(str)) {
|
|
|
+ strings.add(str);
|
|
|
+ } else {
|
|
|
+ strings.add("未知");
|
|
|
+ }
|
|
|
+ number = 0;
|
|
|
+ }
|
|
|
+ // 数组根据出现次数排序
|
|
|
+ int temp = 0;
|
|
|
+ String strTemp = "";
|
|
|
+ for (int i = 0; i < integers.size() - 1; i++) {
|
|
|
+ for (int k = 0; k < integers.size() - 1 - i; k++) {
|
|
|
+ if (integers.get(k) > integers.get(k+1)) {
|
|
|
+ temp = integers.get(k);
|
|
|
+ integers.set(k,integers.get(k+1));
|
|
|
+ integers.set(k+1,temp);
|
|
|
+
|
|
|
+ strTemp = strings.get(k);
|
|
|
+ strings.set(k,strings.get(k+1));
|
|
|
+ strings.set(k+1,strTemp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// cmPortrait.setRemarksTotal(remarksList.get(0).getNumbers());
|
|
|
+ cmPortrait.setRemarksValue(integers);
|
|
|
+ cmPortrait.setRemarksType(strings);
|
|
|
+
|
|
|
+ cmPortrait.setRemarksScopeNum(remarksList.size());
|
|
|
+ } else {
|
|
|
+ cmPortrait.setRemarksScopeNum(0);
|
|
|
+// cmPortrait.setRemarksTotal(0);
|
|
|
+ }
|
|
|
+ calendar.setTime(date);
|
|
|
+ calendar.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
+ time = calendar.getTime();
|
|
|
+ endTime = dateFormat.format(time);
|
|
|
+ cmPortrait.setEndTime(endTime);
|
|
|
+ }
|
|
|
+ // 访问记录
|
|
|
+ if (3 == cmPortrait.getType() || 4 == cmPortrait.getType()) {
|
|
|
+ List<BehaviorRecodeVo> pageTypeList = clubMapper.selBehaviorPageTypeList(cmPortrait);
|
|
|
+ ArrayList<Integer> integers = new ArrayList<>();
|
|
|
+ ArrayList<String> strings = new ArrayList<>();
|
|
|
+ if (pageTypeList.size() != 0) {
|
|
|
+ for(BehaviorRecodeVo record : pageTypeList) {
|
|
|
+ integers.add(record.getNumbers());
|
|
|
+ strings.add(record.getPageLabel());
|
|
|
+ }
|
|
|
+ cmPortrait.setPageTypeValue(integers);
|
|
|
+ cmPortrait.setPageType(strings);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!expty) {
|
|
|
+ cmPortrait.setStartTime(time1);
|
|
|
+ if ((0 == cmPortrait.getDateType() || 1 == cmPortrait.getDateType()) && ObjectUtils.isEmpty(cmPortrait.getStartTime())) {
|
|
|
+ cmPortrait.setStartTime(time2);
|
|
|
+ }
|
|
|
+ cmPortrait.setEndTime(time2);
|
|
|
+ }
|
|
|
+ // 数据返回处理
|
|
|
+ Map<String, Object> map = Maps.newLinkedHashMap();
|
|
|
+ try {
|
|
|
+ ArrDateDto order = new ArrDateDto();
|
|
|
+ ArrDateDto behavior = new ArrDateDto();
|
|
|
+ ArrDateDto remarks = new ArrDateDto();
|
|
|
+ ArrDateDto pageType = new ArrDateDto();
|
|
|
+
|
|
|
+// ArrayList<OrderPortrait> orderPortrait = portrait.getOrderPortrait();
|
|
|
+ order.setOrderList(cmPortrait.getOrderPortrait());
|
|
|
+ if (cmPortrait.getOrderTotal() == null) {
|
|
|
+ cmPortrait.setOrderTotal(0);
|
|
|
+ }
|
|
|
+ order.setOrderTotalNum(cmPortrait.getOrderTotal());
|
|
|
+ order.setStartTime(cmPortrait.getStartTime());
|
|
|
+ order.setEndTime(cmPortrait.getEndTime());
|
|
|
+ if (order.getOrderTotalNum() == 0) {
|
|
|
+ map.put("order",null);
|
|
|
+ } else {
|
|
|
+ map.put("order",order);
|
|
|
+ }
|
|
|
+ behavior.setName(cmPortrait.getBehaviorType());
|
|
|
+ behavior.setValue(cmPortrait.getBehaviorValue());
|
|
|
+ behavior.setStartTime(cmPortrait.getStartTime());
|
|
|
+ behavior.setEndTime(cmPortrait.getEndTime());
|
|
|
+ if (ObjectUtils.isEmpty(behavior.getValue())) {
|
|
|
+ map.put("behavior",null);
|
|
|
+ } else {
|
|
|
+ map.put("behavior",behavior);
|
|
|
+ }
|
|
|
+ remarks.setName(cmPortrait.getRemarksType());
|
|
|
+ remarks.setValue(cmPortrait.getRemarksValue());
|
|
|
+ remarks.setStartTime(cmPortrait.getStartTime());
|
|
|
+ remarks.setEndTime(cmPortrait.getEndTime());
|
|
|
+ if (ObjectUtils.isEmpty(remarks.getValue())) {
|
|
|
+ map.put("remarks",null);
|
|
|
+ } else {
|
|
|
+ map.put("remarks",remarks);
|
|
|
+ }
|
|
|
+ pageType.setName(cmPortrait.getPageType());
|
|
|
+ pageType.setValue(cmPortrait.getPageTypeValue());
|
|
|
+ pageType.setStartTime(cmPortrait.getStartTime());
|
|
|
+ pageType.setEndTime(cmPortrait.getEndTime());
|
|
|
+ if (ObjectUtils.isEmpty(pageType.getValue())) {
|
|
|
+ map.put("pageType",null);
|
|
|
+ } else {
|
|
|
+ map.put("pageType",pageType);
|
|
|
+ }
|
|
|
+ map.put("portrait",cmPortrait);
|
|
|
+ map.put("code",0);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ map.put("code",-1);
|
|
|
+ }
|
|
|
+ return ResponseJson.success(map);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 时间计算
|
|
|
+ * @param recordTime
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String calculationTime(String recordTime){
|
|
|
+ double doc = Double.parseDouble(recordTime);
|
|
|
+ int num = (int)doc;
|
|
|
+ //小时
|
|
|
+ int HH = 0;
|
|
|
+ // 分钟
|
|
|
+ int mm = 0;
|
|
|
+ //秒
|
|
|
+ int ss = 0;
|
|
|
+ int item = num / 1000;
|
|
|
+ if ((item / 60) >0) {
|
|
|
+ mm = item / 60;
|
|
|
+ ss = item % 60;
|
|
|
+ } else {
|
|
|
+ ss = item;
|
|
|
+ }
|
|
|
+ if ((mm / 60) >0) {
|
|
|
+ HH = mm / 60;
|
|
|
+ mm = mm % 60;
|
|
|
+ }
|
|
|
+ String str= HH+":"+mm+":"+ss;
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
|
|
|
+ Date parse = null;
|
|
|
+ try {
|
|
|
+ parse = dateFormat.parse(str);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ String format = dateFormat.format(parse);
|
|
|
+ return format;
|
|
|
+ }
|
|
|
}
|