Merge #43 into master from cc_20251208_visit
拜访记录和铺位导出
* cc_20251208_visit: (37 commits squashed)
- feat:拜访记录
- fix:拜访详情接口新增字段
- fix:新增状态转义字段
- fix:惩处单查询提供惩处待处理、惩处已处理状态筛选
- fix
- fix:管理员能查看所有加盟商
- fix:去掉部分字段非空校验
- fix:空校验
- Merge branch 'master' into cc_20251208_visit
# Conflicts:
#	coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java
#	coolstore-partner-dao/src/main/java/com/cool/store/dao/store/StoreMasterSignerInfoDAO.java
#	coolstore-partner-service/src/main/java/com/cool/store/service/impl/UserAuthMappingServiceImpl.java
- fix
- fix:拜访记录失效延时消息
- fix:拜访记录统计
- fix:拜访记录统计新增筛选条件
- fix:字段转义
- feat:拜访调整
- feat:拜访调整_过滤我的
- feat:拜访调整_过滤我的
- feat:拜访字段调整
- feat:拜访字段调整
- Merge branch 'master' into cc_20251208_visit
- fix:拜访我的加盟商取消管辖权限过滤
- Merge branch 'master' into cc_20251208_visit
- fix:新增已分配招商经理的线索查询接口;拜访记录列表接口新增字段
- fix:新增字段
- fix:新老加盟商判断逻辑修复;统计接口新增筛选条件
- fix:过滤未分配招商经理的线索
- Merge branch 'master' into cc_20251208_visit
# Conflicts:
#	coolstore-partner-dao/src/main/resources/mapper/LineInfoMapper.xml
- Merge branch 'master' into cc_20251208_visit
- Merge branch 'master' into cc_20251208_visit
- fix:拜访记录导出
- fix:拜访记录导出限制
- fix:拜访记录导出限制
- fix:铺位导出
- fix:铺位及拜访记录导出加锁时机修改
- fix:铺位导出新增字段
- fix:铺位导出新增字段
- fix
Signed-off-by: 王非凡 <accounts_67eba0c5fee9c49c80c8e2b4@mail.teambition.com>
Merged-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>
CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/43
This commit is contained in:
@@ -40,6 +40,8 @@ public class CommonConstants {
|
||||
|
||||
public static final int MAX_EXPORT_SIZE = 10000;
|
||||
|
||||
public static final int MAX_EXPORT_SIZE_PRO = 100000;
|
||||
|
||||
public static final int INT_MAX_VALUE = 2147483647;
|
||||
/**
|
||||
* 跟进任务通知缓存时间 1小时
|
||||
|
||||
@@ -341,4 +341,14 @@ public class RedisConstant {
|
||||
* 十二分导入锁
|
||||
*/
|
||||
public static final String TP_PENALTY_APPLY_IMPORT_LOCK = "tp_penalty_apply_import_lock";
|
||||
|
||||
/**
|
||||
* 拜访记录导出锁
|
||||
*/
|
||||
public static final String VISIT_RECORD_EXPORT_LOCK = "visit_record_export_lock";
|
||||
|
||||
/**
|
||||
* 全部铺位导出锁
|
||||
*/
|
||||
public static final String POINT_EXPORT_LOCK = "point_export_lock";
|
||||
}
|
||||
|
||||
@@ -271,6 +271,7 @@ public enum ErrorCodeEnum {
|
||||
|
||||
BANK_EXIST(151007,"当前银行已存在,请直接选择!",null),
|
||||
EXPORT_LIMIT_5000(151008,"导出数据不能超过5000条,请增加筛选条件,减少导出数量",null),
|
||||
EXPORT_LIMIT_100000(151009, "导出数据超过10w条,请增加筛选条件,减少导出数量", null),
|
||||
REGION_INTERSECTION_IS_NULL(151011,"所选所属大区/分公司,不在所选集团下",null),
|
||||
CHECK_PAYER_ERROR(151012,"缴费人必须是签约人,请重新填写!",null),
|
||||
STORE_INFO_INSUFFICIENT(151013,"门店信息不全,无法前往猎聘注册门店!",null),
|
||||
@@ -379,6 +380,7 @@ public enum ErrorCodeEnum {
|
||||
VISIT_RECORD_INVALID(1820003, "拜访记录已失效", null),
|
||||
VISIT_RECORD_NOT_YOUR_OWN(1820004, "非拜访人,无法操作", null),
|
||||
VISIT_RECORD_COMPLETE(1820005, "已完成拜访", null),
|
||||
EXPORT_TASK_LIMIT(1830006, "导出任务数量达上限,请稍后再试", null),
|
||||
CITY_PLANNING_EXISTS(1820001, "同年份同季度同省市已存在规划,不能重复添加", null),
|
||||
;
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ public enum FileTypeEnum {
|
||||
PRE_FRY_QUALIFICATION_APPLY_EXPORT("preFryQualificationApplyExport", "预炸品资质申请导出"),
|
||||
TP_PENALTY_IMPORT("tpPenaltyImport", "十二分惩处申请单导入"),
|
||||
TP_PENALTY_ERROR_EXPORT("tpPenaltyErrorExport", "十二分惩处申请单导入错误列表"),
|
||||
VISIT_RECORD_EXPORT("visitRecordExport", "拜访记录列表"),
|
||||
POINT_EXPORT("pointExport", "铺位管理列表"),
|
||||
;
|
||||
private String fileType;
|
||||
private String desc;
|
||||
|
||||
@@ -33,4 +33,13 @@ public enum PointStatusEnum {
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public static String getDescByCode(Integer code) {
|
||||
for (PointStatusEnum value : PointStatusEnum.values()) {
|
||||
if (value.getCode().equals(code)) {
|
||||
return value.getDesc();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import cn.hutool.core.collection.CollStreamUtil;
|
||||
import com.cool.store.entity.PointFinancialDataDO;
|
||||
import com.cool.store.mapper.PointFinancialDataMapper;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -44,6 +50,14 @@ public class PointFinancialDataDAO {
|
||||
return pointFinancialDataDOMapper.selectByPointId(pointId);
|
||||
}
|
||||
|
||||
|
||||
public Map<Long, PointFinancialDataDO> getMapByPointIds(List<Long> pointIds) {
|
||||
if (CollectionUtils.isEmpty(pointIds)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
Example example = new Example(PointFinancialDataDO.class);
|
||||
example.createCriteria().andIn("pointId", pointIds);
|
||||
List<PointFinancialDataDO> list = pointFinancialDataDOMapper.selectByExample(example);
|
||||
return CollStreamUtil.toMap(list, PointFinancialDataDO::getPointId, v -> v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -129,6 +129,10 @@ public class PointInfoDAO {
|
||||
return pointInfoMapper.getTeamPointPage(eid,request);
|
||||
}
|
||||
|
||||
public Long getTeamPointCount(String eid, AllPointPageRequest request) {
|
||||
return pointInfoMapper.getTeamPointCount(eid, request);
|
||||
}
|
||||
|
||||
public List<PointMapVO> getAllPointList(String eid, PointMapRequest request) {
|
||||
return pointInfoMapper.getAllPointList(eid,request);
|
||||
}
|
||||
|
||||
@@ -108,6 +108,15 @@ public class VisitRecordDAO {
|
||||
return visitRecordMapper.getVisitRecordList(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拜访记录数量
|
||||
* @param request 拜访记录查询Request
|
||||
* @return 数量
|
||||
*/
|
||||
public Long getVisitRecordCount(VisitRecordQueryRequest request) {
|
||||
return visitRecordMapper.getVisitRecordCount(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据线索id查询已完成拜访数量
|
||||
* @param lineId 线索id
|
||||
|
||||
@@ -70,6 +70,13 @@ public interface PointInfoMapper extends Mapper<PointInfoDO> {
|
||||
*/
|
||||
Page<PCPointListDTO> getTeamPointPage(@Param("eid")String eid,@Param("request") AllPointPageRequest request);
|
||||
|
||||
/**
|
||||
* 获取团队铺位数量
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
Long getTeamPointCount(@Param("eid")String eid, @Param("request") AllPointPageRequest request);
|
||||
|
||||
/**
|
||||
* 获取所有的铺位 地图
|
||||
* @param eid
|
||||
|
||||
@@ -29,6 +29,11 @@ public interface VisitRecordMapper extends Mapper<VisitRecordDO> {
|
||||
*/
|
||||
List<VisitRecordListVO> getVisitRecordList(@Param("request") VisitRecordQueryRequest request);
|
||||
|
||||
/**
|
||||
* 拜访记录数量
|
||||
*/
|
||||
Long getVisitRecordCount(@Param("request") VisitRecordQueryRequest request);
|
||||
|
||||
/**
|
||||
* 查询拜访加盟商线索id
|
||||
* @param regionIds 加盟商所属大区id
|
||||
|
||||
@@ -238,6 +238,50 @@
|
||||
order by a.id desc
|
||||
</select>
|
||||
|
||||
<select id="getTeamPointCount" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from xfsg_point_info a
|
||||
left join xfsg_shop_info b on a.shop_id = b.id
|
||||
left join store_${eid} c on b.shop_code = c.store_num
|
||||
where a.deleted = 0 and a.point_status in (4,5,6,7)
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
and (a.point_code like concat('%', #{request.keyword}, '%') or a.point_name like concat('%',
|
||||
#{request.keyword},
|
||||
'%'))
|
||||
</if>
|
||||
<if test="request.developmentManager != null and request.developmentManager != ''">
|
||||
and a.development_manager = #{request.developmentManager}
|
||||
</if>
|
||||
<if test="request.pointStatus != null and request.pointStatus != ''">
|
||||
and a.point_status = #{request.pointStatus}
|
||||
</if>
|
||||
<if test="request.createStartTime != null and request.createStartTime != ''">
|
||||
and a.create_time >= #{request.createStartTime}
|
||||
</if>
|
||||
<if test="request.createEndTime != null and request.createEndTime != ''">
|
||||
<![CDATA[and a.create_time <= #{request.createEndTime}]]>
|
||||
</if>
|
||||
<if test="request.regionIds != null and request.regionIds.size() > 0">
|
||||
and a.region_id in
|
||||
<foreach collection="request.regionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.authRegionIds != null and request.authRegionIds.size() > 0">
|
||||
and a.region_id in
|
||||
<foreach collection="request.authRegionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.storageStatus != null ">
|
||||
and a.storage_status = #{request.storageStatus}
|
||||
</if>
|
||||
<if test="request.areaCode!=null and request.areaCode!=''">
|
||||
and (a.province_code = #{request.areaCode} or a.city_code = #{request.areaCode} or a.district_code =
|
||||
#{request.areaCode})
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getAllPointList" resultType="com.cool.store.vo.point.PointMapVO">
|
||||
select
|
||||
|
||||
@@ -28,6 +28,39 @@
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Visit_Record_Query">
|
||||
<if test="request.visitUserId!=null and request.visitUserId!=''">
|
||||
and a.user_id = #{request.visitUserId}
|
||||
</if>
|
||||
<if test="request.lineId != null">
|
||||
AND a.line_id = #{request.lineId}
|
||||
</if>
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
AND (b.mobile LIKE CONCAT('%', #{request.keyword}, '%') OR b.username LIKE CONCAT('%', #{request.keyword}, '%'))
|
||||
</if>
|
||||
<if test="request.visitNo != null and request.visitNo != ''">
|
||||
AND a.visit_no LIKE CONCAT('%', #{request.visitNo}, '%')
|
||||
</if>
|
||||
<if test="request.visitStartDate != null">
|
||||
AND a.visit_date >= #{request.visitStartDate}
|
||||
</if>
|
||||
<if test="request.visitEndDate != null">
|
||||
AND a.visit_date <= #{request.visitEndDate}
|
||||
</if>
|
||||
<if test="request.status != null">
|
||||
AND a.status = #{request.status}
|
||||
</if>
|
||||
<if test="request.userId != null">
|
||||
AND a.user_id = #{request.userId}
|
||||
</if>
|
||||
<if test="request.desire != null and request.desire != ''">
|
||||
AND a.desire = #{request.desire}
|
||||
</if>
|
||||
<if test="request.investRegionId != null">
|
||||
AND b.invest_region_id = #{request.investRegionId}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getPartnerList" resultType="com.cool.store.vo.visit.VisitPartnerListVO">
|
||||
SELECT a.line_id, a.visit_num, b.username name, b.mobile
|
||||
<if test="userId != null and userId != ''">
|
||||
@@ -66,40 +99,20 @@
|
||||
FROM zxjp_visit_record a
|
||||
INNER JOIN xfsg_line_info b ON a.line_id = b.id AND b.deleted = 0
|
||||
<where>
|
||||
<if test="request.visitUserId!=null and request.visitUserId!=''">
|
||||
and a.user_id = #{request.visitUserId}
|
||||
</if>
|
||||
<if test="request.lineId != null">
|
||||
AND a.line_id = #{request.lineId}
|
||||
</if>
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
AND (b.mobile LIKE CONCAT('%', #{request.keyword}, '%') OR b.username LIKE CONCAT('%', #{request.keyword}, '%'))
|
||||
</if>
|
||||
<if test="request.visitNo != null and request.visitNo != ''">
|
||||
AND a.visit_no LIKE CONCAT('%', #{request.visitNo}, '%')
|
||||
</if>
|
||||
<if test="request.visitStartDate != null">
|
||||
AND a.visit_date >= #{request.visitStartDate}
|
||||
</if>
|
||||
<if test="request.visitEndDate != null">
|
||||
AND a.visit_date <= #{request.visitEndDate}
|
||||
</if>
|
||||
<if test="request.status != null">
|
||||
AND a.status = #{request.status}
|
||||
</if>
|
||||
<if test="request.userId != null">
|
||||
AND a.user_id = #{request.userId}
|
||||
</if>
|
||||
<if test="request.desire != null and request.desire != ''">
|
||||
AND a.desire = #{request.desire}
|
||||
</if>
|
||||
<if test="request.investRegionId != null">
|
||||
AND b.invest_region_id = #{request.investRegionId}
|
||||
</if>
|
||||
<include refid="Visit_Record_Query"/>
|
||||
</where>
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getVisitRecordCount" resultType="java.lang.Long">
|
||||
SELECT COUNT(1)
|
||||
FROM zxjp_visit_record a
|
||||
INNER JOIN xfsg_line_info b ON a.line_id = b.id AND b.deleted = 0
|
||||
<where>
|
||||
<include refid="Visit_Record_Query"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getPartnerLineId" resultType="java.lang.Long">
|
||||
SELECT DISTINCT a.line_id
|
||||
FROM zxjp_visit_record a
|
||||
@@ -147,36 +160,7 @@
|
||||
FROM zxjp_visit_record a
|
||||
INNER JOIN xfsg_line_info b ON a.line_id = b.id AND b.deleted = 0
|
||||
<where>
|
||||
<if test="request.visitUserId!=null and request.visitUserId!=''">
|
||||
and a.user_id = #{request.visitUserId}
|
||||
</if>
|
||||
<if test="request.lineId != null">
|
||||
AND a.line_id = #{request.lineId}
|
||||
</if>
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
AND (b.mobile LIKE CONCAT('%', #{request.keyword}, '%') OR b.username LIKE CONCAT('%', #{request.keyword}, '%'))
|
||||
</if>
|
||||
<if test="request.visitNo != null and request.visitNo != ''">
|
||||
AND a.visit_no LIKE CONCAT('%', #{request.visitNo}, '%')
|
||||
</if>
|
||||
<if test="request.visitStartDate != null">
|
||||
AND a.visit_date >= #{request.visitStartDate}
|
||||
</if>
|
||||
<if test="request.visitEndDate != null">
|
||||
AND a.visit_date <= #{request.visitEndDate}
|
||||
</if>
|
||||
<if test="request.status != null">
|
||||
AND a.status = #{request.status}
|
||||
</if>
|
||||
<if test="request.userId != null">
|
||||
AND a.user_id = #{request.userId}
|
||||
</if>
|
||||
<if test="request.desire != null and request.desire != ''">
|
||||
AND a.desire = #{request.desire}
|
||||
</if>
|
||||
<if test="request.investRegionId != null">
|
||||
AND b.invest_region_id = #{request.investRegionId}
|
||||
</if>
|
||||
<include refid="Visit_Record_Query"/>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,259 @@
|
||||
package com.cool.store.vo.point;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 铺位导出VO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/2/10
|
||||
*/
|
||||
@Data
|
||||
public class PointExportVO {
|
||||
@ApiModelProperty("店铺id")
|
||||
@ExcelIgnore
|
||||
private Long pointId;
|
||||
|
||||
@ApiModelProperty("铺位名称")
|
||||
@ExcelProperty(value = "铺位名称", order = 2)
|
||||
@ColumnWidth(30)
|
||||
private String pointName;
|
||||
|
||||
@ApiModelProperty("铺位编号")
|
||||
@ExcelProperty(value = "铺位编号", order = 1)
|
||||
@ColumnWidth(30)
|
||||
private String pointCode;
|
||||
|
||||
@ApiModelProperty("所属站区")
|
||||
@ExcelProperty(value = "所属大区", order = 5)
|
||||
@ColumnWidth(30)
|
||||
private String regionNodeName;
|
||||
|
||||
@ExcelProperty(value = "铺位状态", order = 6)
|
||||
@ColumnWidth(30)
|
||||
private String pointStatusName;
|
||||
|
||||
@ApiModelProperty("拓展专员")
|
||||
@ExcelProperty(value = "选址人员", order = 4)
|
||||
@ColumnWidth(30)
|
||||
private String developmentManagerUsername;
|
||||
|
||||
@ApiModelProperty("铺位地址")
|
||||
@ExcelProperty(value = "铺位地址", order = 3)
|
||||
@ColumnWidth(30)
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
@ExcelProperty(value = "创建时间", order = 11)
|
||||
@ColumnWidth(30)
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
@ExcelProperty(value = "最近更新时间", order = 10)
|
||||
@ColumnWidth(30)
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty("成功开店")
|
||||
@ExcelProperty(value = "成功开店", order = 7)
|
||||
@ColumnWidth(30)
|
||||
private String openShopName;
|
||||
|
||||
@ApiModelProperty("所属机会点编码")
|
||||
@ExcelProperty(value = "所属机会点编码", order = 8)
|
||||
@ColumnWidth(30)
|
||||
private String opportunityPointCode;
|
||||
@ApiModelProperty("所属机会点名称")
|
||||
@ExcelProperty(value = "所属机会点", order = 9)
|
||||
@ColumnWidth(30)
|
||||
private String opportunityPointName;
|
||||
|
||||
@ApiModelProperty("设备费")
|
||||
@ExcelProperty(value = "设备费", order = 12)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal equipmentCost;
|
||||
|
||||
@ApiModelProperty("装修费")
|
||||
@ExcelProperty(value = "装修费", order = 13)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal decorationCost;
|
||||
|
||||
@ApiModelProperty("加盟费")
|
||||
@ExcelProperty(value = "加盟费", order = 14)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal franchiseFee;
|
||||
|
||||
@ApiModelProperty("管理费")
|
||||
@ExcelProperty(value = "管理费", order = 15)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal managementFee;
|
||||
|
||||
@ApiModelProperty("设计费")
|
||||
@ExcelProperty(value = "设计费", order = 16)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal designFee;
|
||||
|
||||
@ApiModelProperty("首批进货成本")
|
||||
@ExcelProperty(value = "首批进货成本", order = 17)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal firstInventoryCost;
|
||||
|
||||
@ApiModelProperty("押金")
|
||||
@ExcelProperty(value = "押金", order = 18)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal deposit;
|
||||
|
||||
@ApiModelProperty("初始投资额")
|
||||
@ExcelProperty(value = "初始投资额合计", order = 19)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal initialInvestment;
|
||||
|
||||
@ApiModelProperty("日均订单量")
|
||||
@ExcelProperty(value = "日均订单量", order = 20)
|
||||
@ColumnWidth(20)
|
||||
private Integer avgDailyOrders;
|
||||
|
||||
@ApiModelProperty("日均单价")
|
||||
@ExcelProperty(value = "日均单价", order = 21)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal avgOrderPrice;
|
||||
|
||||
@ApiModelProperty("每年运营天数")
|
||||
@ExcelProperty(value = "每年运营天数", order = 22)
|
||||
@ColumnWidth(20)
|
||||
private Integer operatingDaysPerYear;
|
||||
|
||||
@ApiModelProperty("每日销售额")
|
||||
@ExcelProperty(value = "每日销售额", order = 23)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal dailySales;
|
||||
|
||||
@ApiModelProperty("全年GMV")
|
||||
@ExcelProperty(value = "全年GMV", order = 24)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal annualGmv;
|
||||
|
||||
@ApiModelProperty("每月销售额")
|
||||
@ExcelProperty(value = "每月销售额", order = 25)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal monthlySales;
|
||||
|
||||
@ApiModelProperty("门店产品毛利率")
|
||||
@ExcelProperty(value = "门店产品毛利率(%)", order = 26)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal grossMarginRate;
|
||||
|
||||
@ApiModelProperty("正新货品年收入")
|
||||
@ExcelProperty(value = "正新货品年收入", order = 27)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal annualIncome;
|
||||
|
||||
@ApiModelProperty("材料成本")
|
||||
@ExcelProperty(value = "材料成本(元/年)", order = 28)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal materialCostAnnual;
|
||||
|
||||
@ApiModelProperty("材料成本")
|
||||
@ExcelProperty(value = "材料成本(元/月)", order = 29)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal materialCostMonthly;
|
||||
|
||||
@ApiModelProperty("材料成本占收入")
|
||||
@ExcelProperty(value = "材料成本占收入%", order = 30)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal materialCostRate;
|
||||
|
||||
@ApiModelProperty("人员数量")
|
||||
@ExcelProperty(value = "人员数量", order = 31)
|
||||
@ColumnWidth(20)
|
||||
private Integer staffCount;
|
||||
|
||||
@ApiModelProperty("平均工资")
|
||||
@ExcelProperty(value = "平均工资", order = 32)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal avgSalary;
|
||||
|
||||
@ApiModelProperty("员工成本")
|
||||
@ExcelProperty(value = "员工成本(元/年)", order = 33)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal staffCostAnnual;
|
||||
|
||||
@ApiModelProperty("员工成本占收入")
|
||||
@ExcelProperty(value = "员工成本占收入%", order = 34)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal staffCostRate;
|
||||
|
||||
@ApiModelProperty("租金成本(元/年)")
|
||||
@ExcelProperty(value = "租金成本(元/年)", order = 35)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal rentCostAnnual;
|
||||
|
||||
@ApiModelProperty("租金成本占收入%")
|
||||
@ExcelProperty(value = "租金成本占收入%", order = 36)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal rentCostRate;
|
||||
|
||||
@ApiModelProperty("外卖占总营业额")
|
||||
@ExcelProperty(value = "外卖占总营业额%", order = 37)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal takeawayRate;
|
||||
|
||||
@ApiModelProperty("外卖抽点比例")
|
||||
@ExcelProperty(value = "外卖抽点比例(%)", order = 38)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal platformCommissionRate;
|
||||
|
||||
@ApiModelProperty("外卖抽点")
|
||||
@ExcelProperty(value = "外卖抽点", order = 39)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal platformCommission;
|
||||
|
||||
@ApiModelProperty("水电开支")
|
||||
@ExcelProperty(value = "水电开支", order = 40)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal utilityCost;
|
||||
|
||||
@ApiModelProperty("水电开支占收入")
|
||||
@ExcelProperty(value = "水电开支占收入%", order = 41)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal utilityCostRate;
|
||||
|
||||
@ApiModelProperty("其他")
|
||||
@ExcelProperty(value = "其他(含配送费用)", order = 42)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal otherCost;
|
||||
|
||||
@ApiModelProperty("其他占收入")
|
||||
@ExcelProperty(value = "其他占收入%", order = 43)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal otherCostRate;
|
||||
|
||||
@ApiModelProperty("门店经营利润")
|
||||
@ExcelProperty(value = "门店经营利润", order = 44)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal operatingProfit;
|
||||
|
||||
@ApiModelProperty("门店经营利润率")
|
||||
@ExcelProperty(value = "门店经营利润率(%)", order = 45)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal operatingProfitRate;
|
||||
|
||||
@ApiModelProperty("回报期 - 年")
|
||||
@ExcelProperty(value = "回报期(年)", order = 46)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal paybackPeriodYears;
|
||||
|
||||
@ApiModelProperty("回报期 - 月")
|
||||
@ExcelProperty(value = "回报期(月)", order = 47)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal paybackPeriodMonths;
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cool.store.vo.point;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.cool.store.dto.PCPointListDTO;
|
||||
import com.cool.store.entity.PointInfoDO;
|
||||
import com.cool.store.enums.point.PointStatusEnum;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -34,6 +34,9 @@ public class PointPageVO {
|
||||
@ApiModelProperty("铺位状态 1.采集中、2.已评估、3.待审核、5.已审核、6.已签约、7.已失效")
|
||||
private Integer pointStatus;
|
||||
|
||||
@ExcelProperty(value = "铺位状态", order = 6)
|
||||
private String pointStatusName;
|
||||
|
||||
@ApiModelProperty("铺位得分")
|
||||
private Integer pointScore;
|
||||
|
||||
@@ -68,6 +71,9 @@ public class PointPageVO {
|
||||
@ApiModelProperty("所属机会点名称")
|
||||
private String opportunityPointName;
|
||||
|
||||
public String getPointStatusName() {
|
||||
return PointStatusEnum.getDescByCode(this.pointStatus);
|
||||
}
|
||||
|
||||
public static List<PointPageVO> convertVO(List<PCPointListDTO> pointList, Map<String, String> usernameMap, Map<Long, String> regionNameMap) {
|
||||
if(CollectionUtils.isEmpty(pointList)){
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
package com.cool.store.vo.visit;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.converters.Converter;
|
||||
import com.alibaba.excel.enums.CellDataTypeEnum;
|
||||
import com.alibaba.excel.metadata.CellData;
|
||||
import com.alibaba.excel.metadata.GlobalConfiguration;
|
||||
import com.alibaba.excel.metadata.property.ExcelContentProperty;
|
||||
import com.cool.store.annotation.DictField;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.enums.visit.VisitStatusEnum;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -18,79 +27,161 @@ import java.util.Date;
|
||||
@Data
|
||||
public class VisitRecordListVO {
|
||||
@ApiModelProperty("id")
|
||||
@ExcelIgnore
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "线索id", hidden = true)
|
||||
@ExcelIgnore
|
||||
private Long lineId;
|
||||
|
||||
@ApiModelProperty("加盟商姓名")
|
||||
@ExcelProperty(value = "加盟商姓名", order = 1)
|
||||
@ColumnWidth(30)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("加盟商手机号")
|
||||
@ExcelProperty(value = "加盟商手机号", order = 2)
|
||||
@ColumnWidth(30)
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty("拜访编号")
|
||||
@ExcelProperty(value = "拜访编号", order = 7)
|
||||
@ColumnWidth(30)
|
||||
private String visitNo;
|
||||
|
||||
@ApiModelProperty("拜访日期")
|
||||
@ExcelProperty(value = "拜访日期", order = 8)
|
||||
@ColumnWidth(30)
|
||||
private Date visitDate;
|
||||
|
||||
@ApiModelProperty("签到地址")
|
||||
@ExcelProperty(value = "拜访地址", order = 9)
|
||||
@ColumnWidth(30)
|
||||
private String signInAddress;
|
||||
|
||||
@ApiModelProperty("开新店意愿")
|
||||
@ExcelIgnore
|
||||
private String desire;
|
||||
|
||||
@ApiModelProperty("开新店意愿名称")
|
||||
@DictField
|
||||
@ExcelProperty(value = "开新店意愿", order = 10)
|
||||
@ColumnWidth(30)
|
||||
private String desireName;
|
||||
|
||||
@ApiModelProperty("意向开店城市")
|
||||
@ExcelIgnore
|
||||
private String desireCity;
|
||||
|
||||
@ApiModelProperty("意向开店城市名称")
|
||||
@ExcelProperty(value = "意向开店城市", order = 11)
|
||||
@ColumnWidth(30)
|
||||
private String desireCityName;
|
||||
|
||||
@ApiModelProperty("具体区域")
|
||||
@ExcelIgnore
|
||||
private String desireDistrict;
|
||||
|
||||
@ApiModelProperty("具体区域名称")
|
||||
@ExcelProperty(value = "具体区域", order = 15)
|
||||
@ColumnWidth(30)
|
||||
private String desireDistrictName;
|
||||
|
||||
@ApiModelProperty("是否对应现有铺位")
|
||||
@ExcelIgnore
|
||||
private Integer existingShopPoint;
|
||||
|
||||
@ApiModelProperty("是否对应现有铺位")
|
||||
@ExcelProperty(value = "是否对应现有铺位", order = 16)
|
||||
@ColumnWidth(30)
|
||||
private String existingShopPointConvert;
|
||||
|
||||
@ApiModelProperty("加盟商合影图片列表")
|
||||
@ExcelProperty(value = "加盟商合影", order = 18)
|
||||
@ColumnWidth(30)
|
||||
private String photos;
|
||||
|
||||
@ApiModelProperty("拜访状态")
|
||||
@ExcelIgnore
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("拜访状态名称")
|
||||
@ExcelProperty(value = "状态", order = 17)
|
||||
@ColumnWidth(30)
|
||||
private String statusName;
|
||||
|
||||
@ApiModelProperty("新老加盟商,0新 1老")
|
||||
@ExcelIgnore
|
||||
private Integer isVeteran;
|
||||
|
||||
@ApiModelProperty("新老加盟商")
|
||||
@ExcelProperty(value = "新老加盟商", order = 5)
|
||||
@ColumnWidth(30)
|
||||
private String isVeteranConvert;
|
||||
|
||||
@ApiModelProperty("拜访人userId")
|
||||
@ExcelIgnore
|
||||
private String visitUserId;
|
||||
|
||||
@ApiModelProperty("拜访人")
|
||||
@ExcelProperty(value = "拜访人", order = 6)
|
||||
@ColumnWidth(30)
|
||||
private String visitUserName;
|
||||
|
||||
@ApiModelProperty("招商所属大区ID")
|
||||
@ExcelIgnore
|
||||
private Long investRegionId;
|
||||
|
||||
@ApiModelProperty("招商所属大区名称")
|
||||
@ExcelProperty(value = "招商所属大区", order = 3)
|
||||
@ColumnWidth(30)
|
||||
private String investRegionName;
|
||||
|
||||
@ApiModelProperty("招商经理")
|
||||
@ExcelIgnore
|
||||
public String investmentManager;
|
||||
|
||||
|
||||
@ApiModelProperty("招商经理名称")
|
||||
@ExcelProperty(value = "招商经理", order = 4)
|
||||
@ColumnWidth(30)
|
||||
private String investmentManagerName;
|
||||
|
||||
public String getStatusName() {
|
||||
return VisitStatusEnum.getDescByStatus(status);
|
||||
}
|
||||
|
||||
public String getExistingShopPointConvert() {
|
||||
return CommonConstants.INDEX_ONE.equals(existingShopPoint) ? "是" : "否";
|
||||
}
|
||||
|
||||
public String getIsVeteranConvert() {
|
||||
return CommonConstants.INDEX_ONE.equals(isVeteran) ? "老" : "新";
|
||||
}
|
||||
|
||||
public static class VeteranConverter implements Converter<Integer> {
|
||||
|
||||
@Override
|
||||
public Class<?> supportJavaTypeKey() {
|
||||
return Integer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CellDataTypeEnum supportExcelTypeKey() {
|
||||
return CellDataTypeEnum.STRING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
|
||||
String value = cellData.getStringValue();
|
||||
return "新".equals(value) ? 0 : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CellData<?> convertToExcelData(Integer isVeteran, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
|
||||
if (isVeteran == null) {
|
||||
return new CellData<>("");
|
||||
}
|
||||
return new CellData<>(CommonConstants.INDEX_ZERO.equals(isVeteran) ? "新" : "老");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import com.cool.store.dto.pre.fry.ApplyManagementDTO;
|
||||
import com.cool.store.entity.ImportTaskDO;
|
||||
import com.cool.store.entity.LineInfoDO;
|
||||
import com.cool.store.entity.PointInfoDO;
|
||||
import com.cool.store.request.AllPointPageRequest;
|
||||
import com.cool.store.request.FranchiseReportRequest;
|
||||
import com.cool.store.request.visit.VisitRecordQueryRequest;
|
||||
import com.cool.store.response.BranchShopResponse;
|
||||
import com.cool.store.response.FranchiseReportResponse;
|
||||
import com.cool.store.response.ShopReportResponse;
|
||||
@@ -33,4 +35,11 @@ public interface ExportRealizeService {
|
||||
|
||||
void exportZxjpOpenShopReportPage(List<ShopReportResponse> list, ImportTaskDO importTaskDO, FranchiseReportRequest request);
|
||||
void exportPreFryQualificationApply(List<ApplyManagementDTO> list, ImportTaskDO importTaskDO);
|
||||
|
||||
/**
|
||||
* 拜访记录导出
|
||||
*/
|
||||
void exportVisitRecord(VisitRecordQueryRequest request, ImportTaskDO importTaskDO);
|
||||
|
||||
void exportPoint(AllPointPageRequest request, ImportTaskDO importTaskDO);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.cool.store.context.LoginUserInfo;
|
||||
import com.cool.store.dto.pre.fry.ApplyManagementQueryDTO;
|
||||
import com.cool.store.enums.FileTypeEnum;
|
||||
import com.cool.store.request.*;
|
||||
import com.cool.store.request.visit.VisitRecordQueryRequest;
|
||||
|
||||
/**
|
||||
* @Author: WangShuo
|
||||
@@ -44,4 +45,19 @@ public interface ExportService {
|
||||
*/
|
||||
Long exportPreFryQualificationApply(ApplyManagementQueryDTO request, LoginUserInfo user);
|
||||
|
||||
/**
|
||||
* 拜访记录导出
|
||||
* @param request 拜访记录查询Request
|
||||
* @param user 当前用户
|
||||
* @return 记录总数
|
||||
*/
|
||||
Long exportVisitRecord(VisitRecordQueryRequest request, LoginUserInfo user);
|
||||
|
||||
/**
|
||||
* 全部铺位导出
|
||||
* @param request 查询Request
|
||||
* @param user 当前用户
|
||||
* @return 记录总数
|
||||
*/
|
||||
Long pointExport(AllPointPageRequest request, LoginUserInfo user);
|
||||
}
|
||||
|
||||
@@ -169,6 +169,13 @@ public interface PointService {
|
||||
*/
|
||||
PageInfo<PointPageVO> getTeamPointPage(AllPointPageRequest request);
|
||||
|
||||
/**
|
||||
* 获取团队铺位数量
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
Long getTeamPointCount(AllPointPageRequest request);
|
||||
|
||||
/**
|
||||
* 地图功能 查询所有的铺位
|
||||
* @param request
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import cn.hutool.core.collection.CollStreamUtil;
|
||||
import com.cool.store.constants.RedisConstant;
|
||||
import com.cool.store.dao.*;
|
||||
|
||||
import com.cool.store.dto.*;
|
||||
import com.cool.store.dto.Preparation.PreparationDTO;
|
||||
import com.cool.store.dto.Preparation.ScheduleDTO;
|
||||
|
||||
import com.cool.store.dto.pre.fry.ApplyManagementDTO;
|
||||
import com.cool.store.entity.*;
|
||||
@@ -15,26 +12,27 @@ import com.cool.store.enums.*;
|
||||
import com.cool.store.enums.point.*;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.*;
|
||||
import com.cool.store.request.AllPointPageRequest;
|
||||
import com.cool.store.request.FranchiseReportRequest;
|
||||
import com.cool.store.request.InitiatingRequest;
|
||||
import com.cool.store.request.visit.VisitRecordQueryRequest;
|
||||
import com.cool.store.response.BranchShopResponse;
|
||||
import com.cool.store.response.FranchiseReportResponse;
|
||||
import com.cool.store.response.ShopReportResponse;
|
||||
import com.cool.store.service.*;
|
||||
import com.cool.store.service.visit.VisitRecordService;
|
||||
import com.cool.store.utils.BeanUtil;
|
||||
import com.cool.store.utils.JSONUtils;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import com.cool.store.utils.easyExcel.EasyExcelUtil;
|
||||
import com.cool.store.utils.poi.DateUtils;
|
||||
import com.cool.store.utils.poi.StringUtils;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.cool.store.vo.point.PointExportVO;
|
||||
import com.cool.store.vo.point.PointPageVO;
|
||||
import com.cool.store.vo.visit.VisitRecordListVO;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@@ -45,10 +43,6 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.text.MessageFormat;
|
||||
import java.text.ParseException;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -117,6 +111,12 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
|
||||
|
||||
@Resource
|
||||
private InvoicingDAO invoicingDAO;
|
||||
@Resource
|
||||
private VisitRecordService visitRecordService;
|
||||
@Resource
|
||||
private PointService pointService;
|
||||
@Resource
|
||||
private PointFinancialDataDAO pointFinancialDataDAO;
|
||||
|
||||
@Override
|
||||
@Async
|
||||
@@ -733,6 +733,59 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async("generalThreadPool")
|
||||
public void exportVisitRecord(VisitRecordQueryRequest request, ImportTaskDO importTaskDO) {
|
||||
String url = "";
|
||||
try {
|
||||
url = easyExcelUtil.exportExcelInBatches(VisitRecordListVO.class,
|
||||
(pageNum, pageSize) -> {
|
||||
request.setPageNum(pageNum);
|
||||
request.setPageSize(pageSize);
|
||||
return visitRecordService.recordList(request).getList();
|
||||
},
|
||||
FileTypeEnum.VISIT_RECORD_EXPORT.getDesc(),
|
||||
FileTypeEnum.VISIT_RECORD_EXPORT.getDesc());
|
||||
importTaskDO.setStatus(ImportStatusEnum.success.getCode());
|
||||
} catch (Exception e) {
|
||||
log.error("拜访记录导出失败", e);
|
||||
importTaskDO.setStatus(ImportStatusEnum.fail.getCode());
|
||||
} finally {
|
||||
importTaskDO.setFileUrl(url);
|
||||
importTaskMapper.update(eid, importTaskDO);
|
||||
redisUtilPool.delKey(RedisConstant.VISIT_RECORD_EXPORT_LOCK);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async("generalThreadPool")
|
||||
public void exportPoint(AllPointPageRequest request, ImportTaskDO importTaskDO) {
|
||||
String url = "";
|
||||
try {
|
||||
url = easyExcelUtil.exportExcelInBatches(PointExportVO.class,
|
||||
(pageNum, pageSize) -> {
|
||||
request.setPageNum(pageNum);
|
||||
request.setPageSize(pageSize);
|
||||
List<PointPageVO> list = pointService.getTeamPointPage(request).getList();
|
||||
List<Long> pointIds = CollStreamUtil.toList(list, PointPageVO::getPointId);
|
||||
Map<Long, PointFinancialDataDO> pointMap = pointFinancialDataDAO.getMapByPointIds(pointIds);
|
||||
List<PointExportVO> result = BeanUtil.toList(list, PointExportVO.class);
|
||||
result.forEach(v -> BeanUtil.copyPropertiesIgnoreId(pointMap.get(v.getPointId()), v));
|
||||
return result;
|
||||
},
|
||||
FileTypeEnum.POINT_EXPORT.getDesc(),
|
||||
FileTypeEnum.POINT_EXPORT.getDesc());
|
||||
importTaskDO.setStatus(ImportStatusEnum.success.getCode());
|
||||
} catch (Exception e) {
|
||||
log.error("拜访记录导出失败", e);
|
||||
importTaskDO.setStatus(ImportStatusEnum.fail.getCode());
|
||||
} finally {
|
||||
importTaskDO.setFileUrl(url);
|
||||
importTaskMapper.update(eid, importTaskDO);
|
||||
redisUtilPool.delKey(RedisConstant.POINT_EXPORT_LOCK);
|
||||
}
|
||||
}
|
||||
|
||||
private String toString(Object o) {
|
||||
if (o == null) {
|
||||
return "";
|
||||
|
||||
@@ -2,34 +2,31 @@ package com.cool.store.service.impl;
|
||||
|
||||
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.constants.RedisConstant;
|
||||
import com.cool.store.context.LoginUserInfo;
|
||||
import com.cool.store.dao.HyOpenAreaInfoDAO;
|
||||
import com.cool.store.dao.LineInfoDAO;
|
||||
import com.cool.store.dao.PreFryQualificationApplyDAO;
|
||||
import com.cool.store.dao.ShopInfoDAO;
|
||||
import com.cool.store.dto.Preparation.PreparationDTO;
|
||||
import com.cool.store.dto.Preparation.ScheduleDTO;
|
||||
import com.cool.store.dao.visit.VisitRecordDAO;
|
||||
import com.cool.store.dto.pre.fry.ApplyManagementDTO;
|
||||
import com.cool.store.dto.pre.fry.ApplyManagementQueryDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.FileTypeEnum;
|
||||
import com.cool.store.enums.ImportStatusEnum;
|
||||
import com.cool.store.enums.point.PointStatusEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.ImportTaskMapper;
|
||||
import com.cool.store.mapper.PointInfoMapper;
|
||||
import com.cool.store.request.*;
|
||||
import com.cool.store.request.visit.VisitRecordQueryRequest;
|
||||
import com.cool.store.response.BranchShopResponse;
|
||||
import com.cool.store.response.FranchiseReportResponse;
|
||||
import com.cool.store.response.ShopReportResponse;
|
||||
import com.cool.store.service.*;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import com.cool.store.utils.easyExcel.EasyExcelUtil;
|
||||
import com.cool.store.utils.poi.DateUtils;
|
||||
import com.cool.store.utils.poi.StringUtils;
|
||||
import com.cool.store.vo.Preparation.PreparationScheduleVO;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
@@ -40,7 +37,6 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: WangShuo
|
||||
@@ -80,6 +76,12 @@ public class ExportServiceImpl implements ExportService {
|
||||
private FranchiseReportService franchiseReportService;
|
||||
@Resource
|
||||
private PreFryQualificationApplyDAO preFryQualificationApplyDAO;
|
||||
@Resource
|
||||
private VisitRecordDAO visitRecordDAO;
|
||||
@Resource
|
||||
private RedisUtilPool redisUtilPool;
|
||||
@Resource
|
||||
private PointService pointService;
|
||||
|
||||
|
||||
|
||||
@@ -210,5 +212,60 @@ public class ExportServiceImpl implements ExportService {
|
||||
return (long) list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long exportVisitRecord(VisitRecordQueryRequest request, LoginUserInfo user) {
|
||||
Long count = visitRecordDAO.getVisitRecordCount(request);
|
||||
if (count.intValue() > CommonConstants.MAX_EXPORT_SIZE_PRO) {
|
||||
throw new ServiceException(ErrorCodeEnum.EXPORT_LIMIT_100000);
|
||||
}
|
||||
if (Long.valueOf(0).equals(count)) {
|
||||
log.error("导出数据为空");
|
||||
return 0L;
|
||||
}
|
||||
boolean lock = redisUtilPool.setNxExpire(RedisConstant.VISIT_RECORD_EXPORT_LOCK, RedisConstant.VISIT_RECORD_EXPORT_LOCK, 30 * 60 * 1000);
|
||||
if (!lock) {
|
||||
throw new ServiceException(ErrorCodeEnum.EXPORT_TASK_LIMIT);
|
||||
}
|
||||
ImportTaskDO importTaskDO = new ImportTaskDO();
|
||||
importTaskDO.setStatus(ImportStatusEnum.Ongoing.getCode());
|
||||
importTaskDO.setFileName(FileTypeEnum.VISIT_RECORD_EXPORT.getDesc() + DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_1, new Date()));
|
||||
importTaskDO.setIsImport(Boolean.FALSE);
|
||||
importTaskDO.setFileType(FileTypeEnum.VISIT_RECORD_EXPORT.getFileType());
|
||||
importTaskDO.setCreateUserId(user.getUserId());
|
||||
importTaskDO.setCreateTime(new Date().getTime());
|
||||
importTaskDO.setCreateName(user.getName());
|
||||
importTaskMapper.insert(eid, importTaskDO);
|
||||
exportRealizeService.exportVisitRecord(request, importTaskDO);
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long pointExport(AllPointPageRequest request, LoginUserInfo user) {
|
||||
request.setCurUserId(user.getUserId());
|
||||
Long count = pointService.getTeamPointCount(request);
|
||||
if (count.intValue() > CommonConstants.MAX_EXPORT_SIZE_PRO) {
|
||||
throw new ServiceException(ErrorCodeEnum.EXPORT_LIMIT_100000);
|
||||
}
|
||||
if (Long.valueOf(0).equals(count)) {
|
||||
log.error("导出数据为空");
|
||||
return 0L;
|
||||
}
|
||||
boolean lock = redisUtilPool.setNxExpire(RedisConstant.POINT_EXPORT_LOCK, RedisConstant.POINT_EXPORT_LOCK, 30 * 60 * 1000);
|
||||
if (!lock) {
|
||||
throw new ServiceException(ErrorCodeEnum.EXPORT_TASK_LIMIT);
|
||||
}
|
||||
ImportTaskDO importTaskDO = new ImportTaskDO();
|
||||
importTaskDO.setStatus(ImportStatusEnum.Ongoing.getCode());
|
||||
importTaskDO.setFileName(FileTypeEnum.POINT_EXPORT.getDesc() + DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_1, new Date()));
|
||||
importTaskDO.setIsImport(Boolean.FALSE);
|
||||
importTaskDO.setFileType(FileTypeEnum.POINT_EXPORT.getFileType());
|
||||
importTaskDO.setCreateUserId(user.getUserId());
|
||||
importTaskDO.setCreateTime(new Date().getTime());
|
||||
importTaskDO.setCreateName(user.getName());
|
||||
importTaskMapper.insert(eid, importTaskDO);
|
||||
exportRealizeService.exportPoint(request, importTaskDO);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -710,6 +710,21 @@ public class PointServiceImpl implements PointService {
|
||||
return resultPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getTeamPointCount(AllPointPageRequest request) {
|
||||
if (!sysRoleService.checkIsAdmin(request.getCurUserId())) {
|
||||
request.setAuthRegionIds(userAuthMappingService.getAuthRegionIdAndSubRegionIdByUserId(request.getCurUserId()));
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(request.getRegionIds())) {
|
||||
if (request.getRegionIds().contains(CommonConstants.ROOT_DEPT_ID_STR)) {
|
||||
request.setRegionIds(null);
|
||||
} else {
|
||||
request.setRegionIds(regionService.getSubRegionIdsByRegionIds(request.getRegionIds()));
|
||||
}
|
||||
}
|
||||
return pointInfoDAO.getTeamPointCount(enterpriseId, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PointMapVO> getAllPointList(PointMapRequest request) {
|
||||
if (!sysRoleService.checkIsAdmin(request.getCurrentUserId())) {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.cool.store.utils.easyExcel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 批量数据提供接口
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/2/7
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface BatchDataProvider<T> {
|
||||
|
||||
/**
|
||||
* 获取下一批次数据
|
||||
* @param pageNo 当前页码(从1开始)
|
||||
* @param pageSize 每页大小
|
||||
* @return 数据列表,返回空列表或 null 表示结束
|
||||
*/
|
||||
List<T> nextBatch(int pageNo, int pageSize);
|
||||
}
|
||||
@@ -2,8 +2,12 @@ package com.cool.store.utils.easyExcel;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.util.CollectionUtils;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.excel.write.style.row.SimpleRowHeightStyleStrategy;
|
||||
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.handler.CenterAlignHandler;
|
||||
import com.cool.store.handler.ImplProgressReportSheetWriteHandler;
|
||||
import com.cool.store.mapper.ImportTaskMapper;
|
||||
@@ -21,6 +25,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@Slf4j
|
||||
@@ -98,5 +103,57 @@ public class EasyExcelUtil {
|
||||
String time = DateUtil.format(new Date(), "yyMM");
|
||||
return "eid" + "/" + eid + "/" + time + "/";
|
||||
}
|
||||
|
||||
/**
|
||||
* 分批次导出并上传 OSS
|
||||
*
|
||||
* @param head 数据模型类
|
||||
* @param provider 数据提供者回调
|
||||
* @param sheetName Sheet名称
|
||||
* @param fileName 文件名称
|
||||
* @return OSS URL
|
||||
*/
|
||||
public <T> String exportExcelInBatches(Class<T> head, BatchDataProvider<T> provider, String sheetName, String fileName) throws Exception {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
InputStream is = null;
|
||||
ExcelWriter excelWriter;
|
||||
try {
|
||||
excelWriter = EasyExcel.write(outputStream, head)
|
||||
.autoCloseStream(false) // 手动控制流
|
||||
.registerWriteHandler(new SimpleRowHeightStyleStrategy((short) 25, (short) 25))
|
||||
.build();
|
||||
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(sheetName).build();
|
||||
|
||||
int pageNum = 1, pageSize = CommonConstants.BATCH_SIZE;
|
||||
boolean hasNext = true;
|
||||
while (hasNext) {
|
||||
List<T> data = provider.nextBatch(pageNum, pageSize);
|
||||
if (CollectionUtils.isEmpty(data)) {
|
||||
break;
|
||||
}
|
||||
hasNext = data.size() == pageSize;
|
||||
excelWriter.write(data, writeSheet);
|
||||
log.info("Excel批次导出:已写入第 {} 页,本页 {} 条数据", pageNum, data.size());
|
||||
|
||||
pageNum++;
|
||||
}
|
||||
excelWriter.finish();
|
||||
|
||||
byte[] bytes = outputStream.toByteArray();
|
||||
is = new ByteArrayInputStream(bytes);
|
||||
|
||||
if (StringUtils.isNotBlank(fileName) && fileName.contains(".")) {
|
||||
fileName = fileName.substring(0, fileName.lastIndexOf("."));
|
||||
}
|
||||
String file = getUploadPath(eid) + fileName + "_" + UUIDUtils.get32UUID() + EXCEL_SUFFIX;
|
||||
return ossClientService.putObject(file, is, (long) bytes.length, CONTENT_TYPE);
|
||||
} finally {
|
||||
outputStream.close();
|
||||
if (Objects.nonNull(is)) {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.dto.pre.fry.ApplyManagementQueryDTO;
|
||||
import com.cool.store.enums.FileTypeEnum;
|
||||
import com.cool.store.request.*;
|
||||
import com.cool.store.request.visit.VisitRecordQueryRequest;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.ExportService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -75,4 +76,16 @@ public class ExportController {
|
||||
public ResponseResult preFryQualificationApply(@RequestBody ApplyManagementQueryDTO request) {
|
||||
return ResponseResult.success(exportService.exportPreFryQualificationApply(request, CurrentUserHolder.getUser()));
|
||||
}
|
||||
|
||||
@PostMapping("/visitRecordExport")
|
||||
@ApiOperation("拜访记录导出")
|
||||
public ResponseResult<Long> visitRecordExport(@RequestBody VisitRecordQueryRequest request) {
|
||||
return ResponseResult.success(exportService.exportVisitRecord(request, CurrentUserHolder.getUser()));
|
||||
}
|
||||
|
||||
@PostMapping("/pointExport")
|
||||
@ApiOperation("铺位导出")
|
||||
public ResponseResult<Long> pointExport(@RequestBody AllPointPageRequest request) {
|
||||
return ResponseResult.success(exportService.pointExport(request, CurrentUserHolder.getUser()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user