会销组+会销
This commit is contained in:
@@ -81,6 +81,7 @@ public class CommonConstants {
|
||||
|
||||
public static final long ZERO_LONG = 0L;
|
||||
|
||||
public static final int MINUS_ONE = -1;
|
||||
public static final int ZERO = 0;
|
||||
public static final int ONE = 1;
|
||||
public static final int TWO = 2;
|
||||
@@ -105,6 +106,8 @@ public class CommonConstants {
|
||||
public static final int ONE_THOUSAND = 1000;
|
||||
public static final int FIFTY_FIVE = 55;
|
||||
public static final int SIXTY_FIVE = 65;
|
||||
public static final int MIN_CODE = 10000000;
|
||||
public static final int MAX_CODE = 89999999;
|
||||
|
||||
|
||||
public static final String ONE_STR = "1";
|
||||
@@ -121,6 +124,12 @@ public class CommonConstants {
|
||||
public static final String FOLLOW = "follow";
|
||||
public static final String PENDING = "pending";
|
||||
|
||||
|
||||
public static final String CLOSE = "close";
|
||||
public static final String OPEN = "open";
|
||||
|
||||
|
||||
|
||||
public static final String ALLOCATION = "allocation";
|
||||
|
||||
public static final String TRANSFER = "transfer";
|
||||
|
||||
@@ -119,6 +119,13 @@ public enum ErrorCodeEnum {
|
||||
LABEL_GROUP_IN_USE(120001, "该标签组下存在标签,不可删除;请确保该标签组下标签数量为0后再进行删除", null),
|
||||
LABEL_GROUP_EXIST(120002, "该标签组已存在,请重新输入", null),
|
||||
LABEL_EXIST(120003, "该标签已存在,请重新输入", null),
|
||||
|
||||
|
||||
|
||||
//会销相关异常 106*** 106开头
|
||||
EXHIBITION_GROUP_NOT_NULL(106001, "会销组中必须添加至少一个会销", null),
|
||||
EXHIBITION_GROUP_NOT_EXIST(106002, "会销组不存在或被删除", null),
|
||||
EXHIBITION_NOT_EXIST(106003, "会销不存在或被删除", null),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ public enum FeiShuNoticeMsgEnum {
|
||||
INTENTION_APPLY("加盟意向申请", "您有一个【加盟意向申请】待审核,申请人 {0} 手机号 {1} 于 {2} 提交加盟意向申请,请及时处理", "img_v2_c909097d-67d1-4c11-a911-a2584b67ca6g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||
FOLLOW_TASK("线索跟进任务", "{0}", "img_v2_1960b7ef-8c4e-4c3d-8b67-3d918a85578g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||
INTERVIEW_APPOINTMENT("面试预约申请", "您有一个【面试预约申请】待处理,预约人 {0} 手机号 {1} ,预约面试时间 {2} ","img_v2_107bb06b-2a7a-43e1-a6ae-e5d2f2dae17g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||
EXHIBITION_COLLABORATOR("会销协作通知", "{0} 已将您添加为【{1}】的会销协作人,日期为 {2},地点为“{3}” ","img_v2_107bb06b-2a7a-43e1-a6ae-e5d2f2dae17g", "1567d83b966f2d312fd7fcd2e72dbce9"),
|
||||
;
|
||||
|
||||
private String title;
|
||||
|
||||
@@ -18,6 +18,7 @@ public enum SMSMsgEnum {
|
||||
|
||||
SMS_INVATE("短信邀约", "【沪上阿姨】感谢您对沪上阿姨品牌的关注与支持,您可通过链接登记加盟申请信息,我们的客户经理将在第一时间与您联系。{$var}", "d7772108bb7d9767494818bcd39d2ec1"),
|
||||
|
||||
EXHIBITION_INFO_UPDATE("展会信息变更","【沪上阿姨】亲爱的伙伴,您好!您近期报名的加盟推介会信息有更新。名称为{$var},日期为{$var},地址为{$var}。感谢您的关注,期待早日与您合作!{$var}","d7772108bb7d9767494818bcd39d2ec1")
|
||||
;
|
||||
|
||||
private String title;
|
||||
|
||||
@@ -79,8 +79,8 @@ public class CoolDateUtils {
|
||||
}
|
||||
|
||||
|
||||
public static final Date parseDate(String dateString ){
|
||||
DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_SEC);
|
||||
public static final Date parseDate(String dateString ,String format){
|
||||
DateFormat dateFormat = new SimpleDateFormat(format);
|
||||
Date date = null;
|
||||
try {
|
||||
date = dateFormat.parse(dateString);
|
||||
@@ -91,4 +91,5 @@ public class CoolDateUtils {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,10 +12,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -52,6 +49,15 @@ public class EnterpriseUserDAO {
|
||||
return feishuUserIdsByUserIds.stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, EnterpriseUserDO::getFeishuUserId));
|
||||
}
|
||||
|
||||
public List<String> getFeishuUserIdListByUserIds(List<String> userIdList){
|
||||
if(CollectionUtils.isEmpty(userIdList)){
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
List<EnterpriseUserDO> feishuUserIdsByUserIds = enterpriseUserMapper.getFeishuUserIdsByUserIds(userIdList);
|
||||
return feishuUserIdsByUserIds.stream().map(EnterpriseUserDO::getFeishuUserId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
public void batchInsertOrUpdate(List<EnterpriseUserDO> insertOrUpdateList) {
|
||||
if(CollectionUtils.isEmpty(insertOrUpdateList)){
|
||||
return;
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.dto.exhibition.ExhibitionDTO;
|
||||
import com.cool.store.dto.exhibition.ExhibitionStatisticsDTO;
|
||||
import com.cool.store.entity.HyExhibitionDO;
|
||||
import com.cool.store.mapper.HyExhibitionMapper;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
@@ -30,7 +41,7 @@ public class HyExhibitionDAO {
|
||||
*/
|
||||
public HyExhibitionDO selectByPrimaryKey(Integer id){
|
||||
if (id == null){
|
||||
return new HyExhibitionDO();
|
||||
return null;
|
||||
}
|
||||
return hyExhibitionMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
@@ -58,4 +69,43 @@ public class HyExhibitionDAO {
|
||||
}
|
||||
return hyExhibitionMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public int batchInsert(List<HyExhibitionDO> records){
|
||||
if (CollectionUtils.isEmpty(records)){
|
||||
return -1;
|
||||
}
|
||||
return hyExhibitionMapper.batchInsert(records);
|
||||
}
|
||||
|
||||
public int batchUpdate(List<HyExhibitionDO> records){
|
||||
if (CollectionUtils.isEmpty(records)){
|
||||
return -1;
|
||||
}
|
||||
return hyExhibitionMapper.batchUpdate(records);
|
||||
}
|
||||
|
||||
|
||||
public List<HyExhibitionDO> getExhibitionListByUserId(String userId, String startDate, Integer closedType){
|
||||
if (StringUtil.isEmpty(userId)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return hyExhibitionMapper.getExhibitionListByUserId(userId,startDate,closedType);
|
||||
}
|
||||
|
||||
|
||||
public Map<String,ExhibitionStatisticsDTO> exhibitionStatisticsMap(List<String> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new HashMap<>(4);
|
||||
}
|
||||
List<ExhibitionStatisticsDTO> result = hyExhibitionMapper.exhibitionStatistic(list);
|
||||
return result.stream().collect(Collectors.toMap(ExhibitionStatisticsDTO::getExhibitionCode, date -> date));
|
||||
}
|
||||
|
||||
public List<ExhibitionDTO> listByExhibitionGroupIds(List<Integer> exhibitionGroupIdList){
|
||||
if (CollectionUtils.isEmpty(exhibitionGroupIdList)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return hyExhibitionMapper.listByExhibitionGroupIds(exhibitionGroupIdList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.dto.exhibition.MyExhibitionGroupDTO;
|
||||
import com.cool.store.entity.HyExhibitionGroupDO;
|
||||
import com.cool.store.mapper.HyExhibitionGroupMapper;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
@@ -18,7 +22,7 @@ public class HyExhibitionGroupDAO {
|
||||
HyExhibitionGroupMapper hyExhibitionGroupMapper;
|
||||
|
||||
public int insertSelective(HyExhibitionGroupDO record){
|
||||
if (record.getId() == null){
|
||||
if (record == null){
|
||||
return -1;
|
||||
}
|
||||
return hyExhibitionGroupMapper.insertSelective(record);
|
||||
@@ -31,7 +35,7 @@ public class HyExhibitionGroupDAO {
|
||||
*/
|
||||
public HyExhibitionGroupDO selectByPrimaryKey(Integer id){
|
||||
if (id == null){
|
||||
return new HyExhibitionGroupDO();
|
||||
return null;
|
||||
}
|
||||
return hyExhibitionGroupMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
@@ -59,4 +63,13 @@ public class HyExhibitionGroupDAO {
|
||||
}
|
||||
return hyExhibitionGroupMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public List<MyExhibitionGroupDTO> listByCreator(String userId){
|
||||
if (StringUtil.isEmpty(userId)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return hyExhibitionGroupMapper.listByCreator(userId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.dto.exhibition.ExhibitionLineDTO;
|
||||
import com.cool.store.entity.HyPartnerExhibitionDO;
|
||||
import com.cool.store.mapper.HyPartnerExhibitionMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
@@ -58,4 +61,11 @@ public class HyPartnerExhibitionDAO {
|
||||
}
|
||||
return hyPartnerExhibitionMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public List<ExhibitionLineDTO> getExhibitionLine(String exhibitionCode){
|
||||
if (exhibitionCode == null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return hyPartnerExhibitionMapper.getExhibitionLine(exhibitionCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.dto.exhibition.MyExhibitionGroupDTO;
|
||||
import com.cool.store.entity.HyExhibitionGroupDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @date 2023-11-30 11:55
|
||||
@@ -37,4 +40,6 @@ public interface HyExhibitionGroupMapper {
|
||||
* dateTime:2023-11-30 01:36
|
||||
*/
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
List<MyExhibitionGroupDTO> listByCreator(String userId);
|
||||
}
|
||||
@@ -1,9 +1,14 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.dto.exhibition.ExhibitionDTO;
|
||||
import com.cool.store.dto.exhibition.ExhibitionStatisticsDTO;
|
||||
import com.cool.store.entity.HyExhibitionDO;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @date 2023-11-30 11:47
|
||||
@@ -37,4 +42,17 @@ public interface HyExhibitionMapper {
|
||||
* dateTime:2023-11-30 01:38
|
||||
*/
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int batchInsert(@Param("records") List<HyExhibitionDO> records);
|
||||
|
||||
int batchUpdate(@Param("records") List<HyExhibitionDO> records);
|
||||
|
||||
List<HyExhibitionDO> getExhibitionListByUserId(@Param("userId") String userId,
|
||||
@Param("startDate") String startDate,
|
||||
@Param("closedType") Integer closedType);
|
||||
|
||||
|
||||
List<ExhibitionStatisticsDTO> exhibitionStatistic(@Param("list") List<String> exhibitionCodeList);
|
||||
|
||||
List<ExhibitionDTO> listByExhibitionGroupIds(@Param("list") List<Integer> exhibitionGroupIdList);
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.dto.exhibition.ExhibitionLineDTO;
|
||||
import com.cool.store.entity.HyPartnerExhibitionDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @date 2023-11-30 11:55
|
||||
@@ -37,4 +40,12 @@ public interface HyPartnerExhibitionMapper {
|
||||
* dateTime:2023-11-30 01:39
|
||||
*/
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 展会参与线索信息
|
||||
* @param exhibitionCode
|
||||
* @return
|
||||
*/
|
||||
List<ExhibitionLineDTO> getExhibitionLine(String exhibitionCode);
|
||||
}
|
||||
@@ -20,15 +20,33 @@
|
||||
<include refid="Base_Column_List" />
|
||||
from hy_exhibition_group
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
and deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="listByCreator" resultType="com.cool.store.dto.exhibition.MyExhibitionGroupDTO">
|
||||
select
|
||||
eg.id as id ,
|
||||
eg.exhibition_group_name as exhibitionGroupName,
|
||||
eg.closed as closed,
|
||||
eg.creator as createId,
|
||||
eu.name as createName,
|
||||
eu.mobile as mobile
|
||||
from hy_exhibition_group eg
|
||||
left join enterprise_user eu on eg.creator = eu.user_id
|
||||
where eg.deleted = 0
|
||||
<if test="userId!=null and userId!=''">
|
||||
and eg.creator = #{userId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
order by eg.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from hy_exhibition_group
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insertSelective" parameterType="com.cool.store.entity.HyExhibitionGroupDO">
|
||||
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
<insert id="insertSelective" parameterType="com.cool.store.entity.HyExhibitionGroupDO" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into hy_exhibition_group
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="exhibitionGroupName != null">
|
||||
|
||||
@@ -125,6 +125,34 @@
|
||||
#{collaborators,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsert" keyColumn="id" keyProperty="records.id" useGeneratedKeys="true">
|
||||
insert into hy_exhibition
|
||||
(
|
||||
exhibition_group_id,
|
||||
exhibition_code,
|
||||
exhibition_name,
|
||||
start_date,
|
||||
location,
|
||||
collaborators,
|
||||
creator
|
||||
)
|
||||
values
|
||||
<foreach collection="records" item="record" separator=",">
|
||||
(
|
||||
#{record.exhibitionGroupId},
|
||||
#{record.exhibitionCode},
|
||||
#{record.exhibitionName},
|
||||
#{record.startDate},
|
||||
#{record.location},
|
||||
#{record.collaborators},
|
||||
#{record.creator}
|
||||
)
|
||||
</foreach>
|
||||
|
||||
|
||||
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.cool.store.entity.HyExhibitionDO">
|
||||
update hy_exhibition
|
||||
@@ -171,6 +199,102 @@
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="batchUpdate">
|
||||
update hy_exhibition
|
||||
set
|
||||
exhibition_name = CASE id
|
||||
<foreach collection="records" item="record">
|
||||
WHEN #{record.id} THEN #{record.exhibitionName}
|
||||
</foreach>
|
||||
END,
|
||||
location = CASE id
|
||||
<foreach collection="records" item="record">
|
||||
WHEN #{record.id} THEN #{record.location}
|
||||
</foreach>
|
||||
END,
|
||||
updater = CASE id
|
||||
<foreach collection="records" item="record">
|
||||
WHEN #{record.id} THEN #{record.updater}
|
||||
</foreach>
|
||||
END,
|
||||
collaborators = CASE id
|
||||
<foreach collection="records" item="record">
|
||||
WHEN #{record.id} THEN #{record.collaborators}
|
||||
</foreach>
|
||||
END
|
||||
where id in
|
||||
<foreach collection="records" item="record" open="(" separator="," close=")">
|
||||
#{record.id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<select id="getExhibitionListByUserId" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
,
|
||||
TIMESTAMPDIFF(second,now(),start_date) AS tst
|
||||
from hy_exhibition
|
||||
<where>
|
||||
<if test="startDate != null and startDate!='' ">
|
||||
and start_date = #{startDate}
|
||||
</if>
|
||||
<if test="closedType != null and closedType==0 ">
|
||||
and closed_type = #{closedType}
|
||||
</if>
|
||||
<if test="closedType != null and closedType==1 ">
|
||||
and closed_type in (1,2)
|
||||
</if>
|
||||
<if test="userId != null and userId!='' ">
|
||||
and (creator = #{userId} or collaborators like CONCAT('%,', #{userId} ,',%'))
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
if(tst >= 0, 0, 1),
|
||||
if(tst <![CDATA[ < ]]> 0, abs(tst), tst ),id desc
|
||||
</select>
|
||||
|
||||
<select id="listByExhibitionGroupIds" resultType="com.cool.store.dto.exhibition.ExhibitionDTO">
|
||||
select
|
||||
id as id ,
|
||||
exhibition_group_id as exhibitionGroupId,
|
||||
start_date as startDate,
|
||||
close_time as closeTime,
|
||||
location as location,
|
||||
exhibition_name as exhibitionName,
|
||||
collaborators as collaboratorStr
|
||||
from hy_exhibition
|
||||
<where>
|
||||
<foreach collection="list" item="groupId" open="and exhibition_group_id in (" separator="," close=")">
|
||||
#{groupId}
|
||||
</foreach>
|
||||
</where>
|
||||
order by id asc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="exhibitionStatistic" resultType="com.cool.store.dto.exhibition.ExhibitionStatisticsDTO">
|
||||
select
|
||||
exhibition_code as exhibitionCode,
|
||||
COALESCE(count(1),0) as signUpCount,
|
||||
COALESCE(sum( CASE WHEN participation_status = 1 THEN 1 ELSE 0 END ),0) as checkInCount,
|
||||
COALESCE(sum( CASE WHEN participation_status = 2 THEN 1 ELSE 0 END ),0) as formFillCount,
|
||||
COALESCE(sum( CASE WHEN participation_status in (3,4,5,6) THEN 1 ELSE 0 END ),0) as interviewCount
|
||||
from hy_partner_exhibition
|
||||
<where>
|
||||
<foreach collection="list" item="code" open="and exhibition_code in (" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</where>
|
||||
group by exhibition_code
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<sql id="dynamicQuery">
|
||||
<trim prefix="WHERE" prefixOverrides="AND | OR">
|
||||
<if test="null != id">
|
||||
|
||||
@@ -33,6 +33,20 @@
|
||||
delete from hy_partner_exhibition
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
|
||||
<select id="getExhibitionLine" resultType="com.cool.store.dto.exhibition.ExhibitionLineDTO">
|
||||
select
|
||||
hpe.partner_id as partnerId,
|
||||
hpe.exhibition_code as exhibitionCode,
|
||||
pu.username as partnerName,
|
||||
pu.mobile as mobile
|
||||
from hy_partner_exhibition hpe left join hy_partner_user_info pu on hpe.partner_id = pu.partner_id
|
||||
where hpe.participation_status != 7
|
||||
<if test="exhibitionCode != null and exhibitionCode!=''">
|
||||
and hpe.exhibition_code = #{exhibitionCode}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insertSelective" parameterType="com.cool.store.entity.HyPartnerExhibitionDO">
|
||||
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
|
||||
SELECT LAST_INSERT_ID()
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.cool.store.dto.exhibition;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -18,6 +19,14 @@ public class ExhibitionDTO {
|
||||
|
||||
private String startDate;
|
||||
|
||||
private List<CollaboratorDTO> collaboratorS;
|
||||
private Integer id;
|
||||
|
||||
private Date closeTime;
|
||||
|
||||
private Integer exhibitionGroupId;
|
||||
|
||||
private String collaboratorStr;
|
||||
|
||||
private List<CollaboratorDTO> collaborators;
|
||||
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ import java.util.List;
|
||||
@Data
|
||||
public class ExhibitionGroupDTO {
|
||||
|
||||
private Integer exhibitionGroupId;
|
||||
|
||||
private String exhibitionGroupName;
|
||||
|
||||
private List<ExhibitionDTO> exhibitionList;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.cool.store.dto.exhibition;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/12/6 17:13
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ExhibitionLineDTO {
|
||||
|
||||
private String partnerId;
|
||||
|
||||
private String partnerName;
|
||||
|
||||
private String mobile;
|
||||
|
||||
private String exhibitionCode;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.cool.store.dto.exhibition;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/12/5 16:53
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ExhibitionStatisticsDTO {
|
||||
|
||||
/**
|
||||
* 展会code
|
||||
*/
|
||||
private String exhibitionCode;
|
||||
|
||||
/**
|
||||
* 报名人数
|
||||
*/
|
||||
private Integer signUpCount;
|
||||
|
||||
/**
|
||||
* 签到人数
|
||||
*/
|
||||
private Integer checkInCount;
|
||||
|
||||
/**
|
||||
*
|
||||
* 意向申请填写人数
|
||||
*/
|
||||
private Integer formFillCount;
|
||||
|
||||
/**
|
||||
* 面试人数
|
||||
*/
|
||||
private Integer interviewCount;
|
||||
|
||||
public ExhibitionStatisticsDTO(){
|
||||
this.checkInCount = 0;
|
||||
this.signUpCount = 0;
|
||||
this.formFillCount = 0;
|
||||
this.interviewCount = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.cool.store.dto.exhibition;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/12/5 20:16
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class MyExhibitionGroupDTO {
|
||||
|
||||
/**
|
||||
* 会销组名称
|
||||
*/
|
||||
private String exhibitionGroupName;
|
||||
|
||||
/**
|
||||
* 会销组ID
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private String createId;
|
||||
|
||||
/**
|
||||
* 创建人名称
|
||||
*/
|
||||
private String createName;
|
||||
|
||||
/**
|
||||
* 创建人手机号
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 是否结束
|
||||
*/
|
||||
private Integer closed;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.cool.store.vo.exhibition;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/11/30 15:30
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class CollaboratorVO {
|
||||
|
||||
private String collaborateId;
|
||||
|
||||
private String collaborateName;
|
||||
|
||||
public CollaboratorVO(String collaborateId, String collaborateName) {
|
||||
this.collaborateId = collaborateId;
|
||||
this.collaborateName = collaborateName;
|
||||
}
|
||||
|
||||
public CollaboratorVO() {
|
||||
this.collaborateId = collaborateId;
|
||||
this.collaborateName = collaborateName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.cool.store.vo.exhibition;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/12/6 16:05
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ExhibitionDetailVO extends ExhibitionVO{
|
||||
|
||||
private String createTime;
|
||||
|
||||
private String closeTime;
|
||||
|
||||
private String createId;
|
||||
|
||||
private String createName;
|
||||
|
||||
private String mobile;
|
||||
|
||||
private Integer closedType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.cool.store.vo.exhibition;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/12/6 10:03
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ExhibitionGroupDetailVO {
|
||||
|
||||
private String exhibitionGroupName;
|
||||
|
||||
private Integer id;
|
||||
|
||||
private List<ExhibitionVO> exhibitionList;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.cool.store.vo.exhibition;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/11/30 15:57
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ExhibitionGroupVO {
|
||||
|
||||
private Integer exhibitionGroupId;
|
||||
|
||||
private String exhibitionGroupName;
|
||||
|
||||
private List<ExhibitionVO> exhibitionList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.cool.store.vo.exhibition;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/11/30 15:33
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ExhibitionVO {
|
||||
|
||||
private String exhibitionName;
|
||||
|
||||
private String location;
|
||||
|
||||
private String startDate;
|
||||
|
||||
private Integer id;
|
||||
|
||||
private List<CollaboratorVO> collaborators;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.cool.store.vo.exhibition;
|
||||
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/12/5 20:20
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class MyExhibitionGroupVO {
|
||||
|
||||
/**
|
||||
* 会销组名称
|
||||
*/
|
||||
private String exhibitionGroupName;
|
||||
|
||||
/**
|
||||
* 失效时间
|
||||
*/
|
||||
private String expiresTime;
|
||||
|
||||
/**
|
||||
* 会销组ID
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private String createId;
|
||||
|
||||
/**
|
||||
* 创建人名称
|
||||
*/
|
||||
private String createName;
|
||||
|
||||
/**
|
||||
* 创建人手机号
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 是否结束
|
||||
*/
|
||||
private Integer closed;
|
||||
|
||||
/**
|
||||
* 会销 列表
|
||||
*/
|
||||
private List<ExhibitionVO> exhibitionList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.cool.store.vo.exhibition;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/12/5 10:41
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class MyExhibitionVO extends ExhibitionVO{
|
||||
|
||||
|
||||
/**
|
||||
* 结束类型 0-未结算 1-自动结束 2-手动结束
|
||||
*/
|
||||
private Integer closedType;
|
||||
|
||||
/**
|
||||
* 报名人数
|
||||
*/
|
||||
private Integer signUpCount;
|
||||
|
||||
/**
|
||||
* 签到人数
|
||||
*/
|
||||
private Integer checkInCount;
|
||||
|
||||
/**
|
||||
*
|
||||
* 意向申请填写人数
|
||||
*/
|
||||
private Integer formFillCount;
|
||||
|
||||
/**
|
||||
* 面试人数
|
||||
*/
|
||||
private Integer interviewCount;
|
||||
|
||||
}
|
||||
@@ -1,8 +1,77 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.context.LoginUserInfo;
|
||||
import com.cool.store.dto.exhibition.ExhibitionDTO;
|
||||
import com.cool.store.dto.exhibition.ExhibitionGroupDTO;
|
||||
import com.cool.store.dto.exhibition.MyExhibitionGroupDTO;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.vo.exhibition.*;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.models.auth.In;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/11/30 14:42
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface ExhibitionService {
|
||||
|
||||
/**
|
||||
* 新增会销组
|
||||
* xin
|
||||
* @param exhibitionGroupDTO
|
||||
* @param userInfo
|
||||
* @return
|
||||
* @throws ApiException
|
||||
*/
|
||||
Boolean addExhibitionGroup(ExhibitionGroupDTO exhibitionGroupDTO, LoginUserInfo userInfo) throws ApiException;
|
||||
|
||||
|
||||
/**
|
||||
* 编辑会销组
|
||||
* x
|
||||
* @param exhibitionGroupDTO
|
||||
* @param userInfo
|
||||
* @return
|
||||
*/
|
||||
Boolean editExhibitionGroup(ExhibitionGroupDTO exhibitionGroupDTO, LoginUserInfo userInfo) throws ApiException;
|
||||
|
||||
|
||||
/**
|
||||
* 我的会销
|
||||
* x
|
||||
* @param userId 用户ID
|
||||
* @param pageSize 分页大小
|
||||
* @param pageNum 页码
|
||||
* @return
|
||||
*/
|
||||
PageInfo<MyExhibitionVO> getMyExhibitionList(String userId,String startDate,String closedType,Integer pageSize,Integer pageNum);
|
||||
|
||||
/**
|
||||
* 我创建的会销组
|
||||
* @param userId
|
||||
* @param pageSize
|
||||
* @param pageNum
|
||||
* @return
|
||||
*/
|
||||
PageInfo<MyExhibitionGroupVO> getMyExhibitionGroupList(String userId,Integer pageSize,Integer pageNum);
|
||||
|
||||
|
||||
/**
|
||||
* 会销组详情
|
||||
* @param exhibitionGroupId
|
||||
* @return
|
||||
*/
|
||||
ExhibitionGroupDetailVO getExhibitionGroupDetail(Integer exhibitionGroupId);
|
||||
|
||||
/**
|
||||
* 会销详情
|
||||
* @param exhibitionId
|
||||
* @return
|
||||
*/
|
||||
ExhibitionDetailVO getExhibitionDetail(Integer exhibitionId);
|
||||
|
||||
Boolean editExhibition(ExhibitionDTO exhibitionDTO,LoginUserInfo userInfo) ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class DeskServiceImpl implements DeskService {
|
||||
if (StringUtils.isEmpty(userId)||selectedData==null){
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
|
||||
}
|
||||
Date dateTime = CoolDateUtils.parseDate(selectedData);
|
||||
Date dateTime = CoolDateUtils.parseDate(selectedData,CoolDateUtils.DATE_FORMAT_SEC);
|
||||
|
||||
InterviewScheduleInfoVO interviewScheduleInfoVO = new InterviewScheduleInfoVO();
|
||||
//查询面试数量
|
||||
|
||||
@@ -1,20 +1,419 @@
|
||||
package com.cool.store.service.impl.exhibition;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.excel.util.DateUtils;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.context.LoginUserInfo;
|
||||
import com.cool.store.dao.EnterpriseUserDAO;
|
||||
import com.cool.store.dao.HyExhibitionDAO;
|
||||
import com.cool.store.dao.HyExhibitionGroupDAO;
|
||||
import com.cool.store.dao.HyPartnerExhibitionDAO;
|
||||
import com.cool.store.entity.HyPartnerExhibitionDO;
|
||||
import com.cool.store.dto.exhibition.*;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.FeiShuNoticeMsgEnum;
|
||||
import com.cool.store.enums.SMSMsgEnum;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.http.EventCenterHttpRequest;
|
||||
import com.cool.store.mapper.HyPartnerExhibitionMapper;
|
||||
import com.cool.store.service.ExhibitionService;
|
||||
import com.cool.store.service.WechatMiniAppService;
|
||||
import com.cool.store.utils.CoolDateUtils;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import com.cool.store.utils.poi.StringUtils;
|
||||
import com.cool.store.utils.poi.constant.Constants;
|
||||
import com.cool.store.vo.exhibition.*;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/11/30 14:42
|
||||
* @version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ExhibitionServiceImpl implements ExhibitionService {
|
||||
|
||||
@Autowired
|
||||
private HyPartnerExhibitionDAO exhibitionDAO;
|
||||
@Autowired
|
||||
private HyExhibitionGroupDAO hyExhibitionGroupDAO;
|
||||
@Autowired
|
||||
private HyExhibitionDAO hyExhibitionDAO;
|
||||
@Autowired
|
||||
private EventCenterHttpRequest eventCenterHttpRequest;
|
||||
@Resource
|
||||
EnterpriseUserDAO enterpriseUserDAO;
|
||||
@Resource
|
||||
HyPartnerExhibitionDAO hyPartnerExhibitionDAO;
|
||||
@Resource
|
||||
WechatMiniAppService wechatMiniAppService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addExhibitionGroup(ExhibitionGroupDTO exhibitionGroupDTO, LoginUserInfo userInfo) throws ApiException {
|
||||
checkExhibitionGroup(exhibitionGroupDTO);
|
||||
//新增会销组信息
|
||||
HyExhibitionGroupDO hyExhibitionGroupDO = new HyExhibitionGroupDO();
|
||||
hyExhibitionGroupDO.setExhibitionGroupName(exhibitionGroupDTO.getExhibitionGroupName());
|
||||
hyExhibitionGroupDO.setCreator(userInfo.getUserId());
|
||||
hyExhibitionGroupDAO.insertSelective(hyExhibitionGroupDO);
|
||||
|
||||
//新增会销信息
|
||||
List<HyExhibitionDO> insertList = new ArrayList<>();
|
||||
for (ExhibitionDTO exhibitionDTO : exhibitionGroupDTO.getExhibitionList()){
|
||||
HyExhibitionDO hyExhibitionDO = new HyExhibitionDO();
|
||||
hyExhibitionDO.setExhibitionName(exhibitionDTO.getExhibitionName());
|
||||
if (CollectionUtils.isNotEmpty(exhibitionDTO.getCollaborators())){
|
||||
String collaborators = exhibitionDTO.getCollaborators().stream().map(CollaboratorDTO::getCollaborateId).collect(Collectors.joining(Constants.COMMA));
|
||||
hyExhibitionDO.setCollaborators(String.format("%s%s%s", Constants.COMMA, collaborators, Constants.COMMA));
|
||||
}
|
||||
hyExhibitionDO.setExhibitionCode(String.valueOf(CommonConstants.MIN_CODE+new Random().nextInt(CommonConstants.MAX_CODE)));
|
||||
hyExhibitionDO.setCreator(userInfo.getUserId());
|
||||
hyExhibitionDO.setLocation(exhibitionDTO.getLocation());
|
||||
hyExhibitionDO.setExhibitionGroupId(hyExhibitionGroupDO.getId());
|
||||
hyExhibitionDO.setStartDate(CoolDateUtils.parseDate(exhibitionDTO.getStartDate(),CoolDateUtils.DATE_FORMAT_SEC_2));
|
||||
insertList.add(hyExhibitionDO);
|
||||
}
|
||||
//批量新增会销
|
||||
batchInsertExhibition(exhibitionGroupDTO,insertList,userInfo);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean editExhibitionGroup(ExhibitionGroupDTO exhibitionGroupDTO, LoginUserInfo userInfo) throws ApiException {
|
||||
checkExhibitionGroup(exhibitionGroupDTO);
|
||||
//编辑 ID不能为空
|
||||
if (exhibitionGroupDTO.getExhibitionGroupId() == null){
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
|
||||
}
|
||||
HyExhibitionGroupDO hyExhibitionGroupDO = hyExhibitionGroupDAO.selectByPrimaryKey(exhibitionGroupDTO.getExhibitionGroupId());
|
||||
//会销组不存在
|
||||
if (hyExhibitionGroupDO== null){
|
||||
throw new ServiceException(ErrorCodeEnum.EXHIBITION_GROUP_NOT_EXIST);
|
||||
}
|
||||
// TODO: 2023/12/4 关闭的会销组是否能修改?
|
||||
hyExhibitionGroupDO.setExhibitionGroupName(exhibitionGroupDTO.getExhibitionGroupName());
|
||||
hyExhibitionGroupDO.setUpdater(userInfo.getUserId());
|
||||
hyExhibitionGroupDAO.updateByPrimaryKeySelective(hyExhibitionGroupDO);
|
||||
|
||||
List<HyExhibitionDO> batchInsertList = new ArrayList<>();
|
||||
List<HyExhibitionDO> batchUpdateList = new ArrayList<>();
|
||||
exhibitionGroupDTO.getExhibitionList().forEach(exhibitionDTO->{
|
||||
HyExhibitionDO hyExhibitionDO = new HyExhibitionDO();
|
||||
hyExhibitionDO.setExhibitionGroupId(hyExhibitionGroupDO.getId());
|
||||
hyExhibitionDO.setExhibitionName(exhibitionDTO.getExhibitionName());
|
||||
hyExhibitionDO.setLocation(exhibitionDTO.getLocation());
|
||||
if (CollectionUtils.isNotEmpty(exhibitionDTO.getCollaborators())){
|
||||
String collaborators = exhibitionDTO.getCollaborators().stream().map(CollaboratorDTO::getCollaborateId).collect(Collectors.joining(Constants.COMMA));
|
||||
hyExhibitionDO.setCollaborators(String.format("%s%s%s", Constants.COMMA, collaborators, Constants.COMMA));
|
||||
}
|
||||
|
||||
if (exhibitionDTO.getId()== null){
|
||||
hyExhibitionDO.setCreator(userInfo.getUserId());
|
||||
hyExhibitionDO.setExhibitionCode(String.valueOf(CommonConstants.MIN_CODE+new Random().nextInt(CommonConstants.MAX_CODE)));
|
||||
hyExhibitionDO.setStartDate(CoolDateUtils.parseDate(exhibitionDTO.getStartDate(),CoolDateUtils.DATE_FORMAT_DAY_2));
|
||||
batchInsertList.add(hyExhibitionDO);
|
||||
}else {
|
||||
hyExhibitionDO.setUpdater(userInfo.getUserId());
|
||||
hyExhibitionDO.setId(exhibitionDTO.getId());
|
||||
if (CollectionUtils.isEmpty(exhibitionDTO.getCollaborators())){
|
||||
hyExhibitionDO.setCollaborators("");
|
||||
}
|
||||
batchUpdateList.add(hyExhibitionDO);
|
||||
}
|
||||
});
|
||||
//batchInsertList 不为空 批量新增
|
||||
if (CollectionUtils.isNotEmpty(batchInsertList)){
|
||||
batchInsertExhibition(exhibitionGroupDTO,batchInsertList,userInfo);
|
||||
}
|
||||
//batchUpdateList 不为空 批量更新
|
||||
if (CollectionUtils.isNotEmpty(batchUpdateList)){
|
||||
hyExhibitionDAO.batchUpdate(batchUpdateList);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<MyExhibitionVO> getMyExhibitionList(String userId,String startDate,String closedType,Integer pageSize,Integer pageNum) {
|
||||
Integer type = CommonConstants.MINUS_ONE;
|
||||
if (StringUtils.isNotEmpty(closedType)){
|
||||
type = CommonConstants.CLOSE.equals(closedType)?CommonConstants.ONE:CommonConstants.ZERO;
|
||||
}
|
||||
PageHelper.startPage(pageNum,pageSize);
|
||||
List<HyExhibitionDO> exhibitionList = hyExhibitionDAO.getExhibitionListByUserId(userId, startDate, type);
|
||||
PageInfo hyExhibitionDOPage = new PageInfo<>(exhibitionList);
|
||||
if (CollectionUtils.isEmpty(exhibitionList)){
|
||||
return hyExhibitionDOPage;
|
||||
}
|
||||
List<MyExhibitionVO> list = new ArrayList<>();
|
||||
//查询协作人
|
||||
Set<String> collaboratorsSet = new HashSet();
|
||||
List<String> codeList = new ArrayList<>();
|
||||
exhibitionList.forEach(x->{
|
||||
codeList.add(x.getExhibitionCode());
|
||||
if (StringUtils.isNotEmpty(x.getCollaborators())){
|
||||
List<String> userIdList = Arrays.asList(x.getCollaborators().substring(1).split(Constants.COMMA));
|
||||
collaboratorsSet.addAll(userIdList);
|
||||
}
|
||||
});
|
||||
List<EnterpriseUserDO> userInfoList = enterpriseUserDAO.getUserInfoByUserIds(new ArrayList<>(collaboratorsSet));
|
||||
Map<String, CollaboratorVO> resultMap = userInfoList.stream()
|
||||
.collect(Collectors.toMap(EnterpriseUserDO::getUserId,
|
||||
u -> new CollaboratorVO(u.getUserId(), u.getName())));
|
||||
|
||||
Map<String, ExhibitionStatisticsDTO> StatisticsMap = hyExhibitionDAO.exhibitionStatisticsMap(codeList);
|
||||
|
||||
exhibitionList.forEach(x->{
|
||||
MyExhibitionVO myExhibitionVO = new MyExhibitionVO();
|
||||
myExhibitionVO.setExhibitionName(x.getExhibitionName());
|
||||
myExhibitionVO.setLocation(x.getLocation());
|
||||
myExhibitionVO.setId(x.getId());
|
||||
myExhibitionVO.setClosedType(x.getClosedType());
|
||||
myExhibitionVO.setStartDate(DateUtils.format(x.getStartDate(),DateUtils.DATE_FORMAT_10));
|
||||
if (StringUtils.isNotEmpty(x.getCollaborators())){
|
||||
List<String> userIdList = Arrays.asList(x.getCollaborators().substring(1).split(Constants.COMMA));
|
||||
List<CollaboratorVO> coll = new ArrayList<>();
|
||||
userIdList.forEach(userIds->{
|
||||
coll.add(resultMap.get(userIds));
|
||||
});
|
||||
myExhibitionVO.setCollaborators(coll);
|
||||
}
|
||||
ExhibitionStatisticsDTO statistics = StatisticsMap.getOrDefault(x.getExhibitionCode(), new ExhibitionStatisticsDTO());
|
||||
myExhibitionVO.setSignUpCount(statistics.getSignUpCount());
|
||||
myExhibitionVO.setCheckInCount(statistics.getCheckInCount());
|
||||
myExhibitionVO.setFormFillCount(statistics.getFormFillCount());
|
||||
myExhibitionVO.setInterviewCount(statistics.getInterviewCount());
|
||||
list.add(myExhibitionVO);
|
||||
});
|
||||
hyExhibitionDOPage.setList(list);
|
||||
return hyExhibitionDOPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<MyExhibitionGroupVO> getMyExhibitionGroupList(String userId, Integer pageSize, Integer pageNum) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<MyExhibitionGroupDTO> myExhibitionGroupDTOS = hyExhibitionGroupDAO.listByCreator(userId);
|
||||
PageInfo myExhibitionGroupDTOPage = new PageInfo<>(myExhibitionGroupDTOS);
|
||||
if (CollectionUtils.isEmpty(myExhibitionGroupDTOS)){
|
||||
return myExhibitionGroupDTOPage;
|
||||
}
|
||||
List<Integer> groupIds = myExhibitionGroupDTOS.stream().map(MyExhibitionGroupDTO::getId).collect(Collectors.toList());
|
||||
List<ExhibitionDTO> exhibitionDTOS = hyExhibitionDAO.listByExhibitionGroupIds(groupIds);
|
||||
Map<Integer, List<ExhibitionDTO>> groupMap = exhibitionDTOS.stream().collect(Collectors.groupingBy(ExhibitionDTO::getExhibitionGroupId));
|
||||
|
||||
List<MyExhibitionGroupVO> result = new ArrayList<>();
|
||||
myExhibitionGroupDTOS.forEach(x->{
|
||||
MyExhibitionGroupVO myExhibitionGroupVO = new MyExhibitionGroupVO();
|
||||
myExhibitionGroupVO.setExhibitionGroupName(x.getExhibitionGroupName());
|
||||
myExhibitionGroupVO.setId(x.getId());
|
||||
myExhibitionGroupVO.setClosed(x.getClosed());
|
||||
myExhibitionGroupVO.setCreateId(x.getCreateId());
|
||||
myExhibitionGroupVO.setCreateName(x.getCreateName());
|
||||
myExhibitionGroupVO.setMobile(x.getMobile());
|
||||
List<ExhibitionDTO> list = groupMap.get(x.getId());
|
||||
List<ExhibitionVO> exhibitionVOS = new ArrayList<>();
|
||||
Date date = null;
|
||||
if (CollectionUtils.isNotEmpty(list)){
|
||||
//根据ID排序
|
||||
list.sort(Comparator.comparing(ExhibitionDTO::getId));
|
||||
list.forEach(exhibitionDTO->{
|
||||
ExhibitionVO exhibitionVO = new ExhibitionVO();
|
||||
exhibitionVO.setExhibitionName(exhibitionDTO.getExhibitionName());
|
||||
exhibitionVO.setStartDate(exhibitionDTO.getStartDate());
|
||||
exhibitionVO.setId(exhibitionDTO.getId());
|
||||
exhibitionVOS.add(exhibitionVO);
|
||||
});
|
||||
//是否所有的不为空 所有不为空表示 会销组结束
|
||||
Boolean flag = list.stream().map(ExhibitionDTO::getCloseTime).allMatch(closeTime -> closeTime != null);
|
||||
if(flag){
|
||||
date = list.stream().map(ExhibitionDTO::getCloseTime).filter(closeTime -> closeTime != null).max(Date::compareTo).orElse(null);
|
||||
}
|
||||
}
|
||||
myExhibitionGroupVO.setExhibitionList(exhibitionVOS);
|
||||
if (date!=null){
|
||||
myExhibitionGroupVO.setExpiresTime(DateUtils.format(date, DateUtils.DATE_FORMAT_19_FORWARD_SLASH));
|
||||
}
|
||||
result.add(myExhibitionGroupVO);
|
||||
});
|
||||
myExhibitionGroupDTOPage.setList(result);
|
||||
return myExhibitionGroupDTOPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExhibitionGroupDetailVO getExhibitionGroupDetail(Integer exhibitionGroupId) {
|
||||
//查询标签组
|
||||
HyExhibitionGroupDO hyExhibitionGroupDO = hyExhibitionGroupDAO.selectByPrimaryKey(exhibitionGroupId);
|
||||
if (ObjectUtils.isEmpty(hyExhibitionGroupDO)){
|
||||
throw new ServiceException(ErrorCodeEnum.EXHIBITION_GROUP_NOT_EXIST);
|
||||
}
|
||||
ExhibitionGroupDetailVO exhibitionGroupDetailVO = new ExhibitionGroupDetailVO();
|
||||
exhibitionGroupDetailVO.setExhibitionGroupName(hyExhibitionGroupDO.getExhibitionGroupName());
|
||||
exhibitionGroupDetailVO.setId(hyExhibitionGroupDO.getId());
|
||||
List<ExhibitionDTO> exhibitionDTOS = hyExhibitionDAO.listByExhibitionGroupIds(Arrays.asList(exhibitionGroupId));
|
||||
List<ExhibitionVO> exhibitionVOS = new ArrayList<>();
|
||||
//会销对应的会销协作人map
|
||||
Map<String, CollaboratorVO> resultMap = getExhibitionCollaboratorMap(exhibitionDTOS);
|
||||
|
||||
exhibitionDTOS.forEach(exhibitionDTO->{
|
||||
ExhibitionVO exhibitionVO = new ExhibitionVO();
|
||||
exhibitionVO.setExhibitionName(exhibitionDTO.getExhibitionName());
|
||||
exhibitionVO.setStartDate(exhibitionDTO.getStartDate());
|
||||
exhibitionVO.setLocation(exhibitionDTO.getLocation());
|
||||
exhibitionVO.setId(exhibitionDTO.getId());
|
||||
if (StringUtils.isNotEmpty(exhibitionDTO.getCollaboratorStr())){
|
||||
List<String> userIdList = Arrays.asList(exhibitionDTO.getCollaboratorStr().substring(1).split(Constants.COMMA));
|
||||
List<CollaboratorVO> coll = new ArrayList<>();
|
||||
userIdList.forEach(userIds->{
|
||||
coll.add(resultMap.get(userIds));
|
||||
});
|
||||
exhibitionVO.setCollaborators(coll);
|
||||
}
|
||||
exhibitionVOS.add(exhibitionVO);
|
||||
});
|
||||
exhibitionGroupDetailVO.setExhibitionList(exhibitionVOS);
|
||||
return exhibitionGroupDetailVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExhibitionDetailVO getExhibitionDetail(Integer exhibitionId) {
|
||||
HyExhibitionDO hyExhibitionDO = hyExhibitionDAO.selectByPrimaryKey(exhibitionId);
|
||||
if (hyExhibitionDO==null){
|
||||
throw new ServiceException(ErrorCodeEnum.EXHIBITION_NOT_EXIST);
|
||||
}
|
||||
ExhibitionDetailVO exhibitionDetailVO = new ExhibitionDetailVO();
|
||||
exhibitionDetailVO.setExhibitionName(hyExhibitionDO.getExhibitionName());
|
||||
exhibitionDetailVO.setId(hyExhibitionDO.getId());
|
||||
exhibitionDetailVO.setLocation(hyExhibitionDO.getLocation());
|
||||
exhibitionDetailVO.setStartDate(DateUtil.format(hyExhibitionDO.getStartDate(), CoolDateUtils.DATE_FORMAT_DAY_2));
|
||||
exhibitionDetailVO.setClosedType(hyExhibitionDO.getClosedType());
|
||||
exhibitionDetailVO.setCreateTime(DateUtil.format(hyExhibitionDO.getCreateTime(), CoolDateUtils.DATE_FORMAT_SEC_7));
|
||||
exhibitionDetailVO.setCloseTime(DateUtil.format(hyExhibitionDO.getCloseTime(), CoolDateUtils.DATE_FORMAT_SEC_7));
|
||||
if (StringUtils.isNotEmpty(hyExhibitionDO.getCollaborators())) {
|
||||
List<String> userIdList = Arrays.asList(hyExhibitionDO.getCollaborators().substring(1).split(Constants.COMMA));
|
||||
List<EnterpriseUserDO> userInfoList = enterpriseUserDAO.getUserInfoByUserIds(userIdList);
|
||||
List<CollaboratorVO> collaboratorVOS = userInfoList.stream().map(u -> new CollaboratorVO(u.getUserId(), u.getName())).collect(Collectors.toList());
|
||||
exhibitionDetailVO.setCollaborators(collaboratorVOS);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(hyExhibitionDO.getCreator())){
|
||||
EnterpriseUserDO user = enterpriseUserDAO.getUserInfoById(hyExhibitionDO.getCreator());
|
||||
exhibitionDetailVO.setCreateId(user.getUserId());
|
||||
exhibitionDetailVO.setMobile(user.getMobile());
|
||||
exhibitionDetailVO.setCreateName(user.getName());
|
||||
}
|
||||
return exhibitionDetailVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean editExhibition(ExhibitionDTO exhibitionDTO, LoginUserInfo userInfo) {
|
||||
if (exhibitionDTO == null || exhibitionDTO.getId()==null){
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
|
||||
}
|
||||
//查询会销
|
||||
HyExhibitionDO hyExhibitionDO = hyExhibitionDAO.selectByPrimaryKey(exhibitionDTO.getId());
|
||||
if (hyExhibitionDO == null){
|
||||
throw new ServiceException(ErrorCodeEnum.EXHIBITION_NOT_EXIST);
|
||||
}
|
||||
hyExhibitionDO.setExhibitionName(exhibitionDTO.getExhibitionName());
|
||||
hyExhibitionDO.setLocation(exhibitionDTO.getLocation());
|
||||
if (CollectionUtils.isNotEmpty(exhibitionDTO.getCollaborators())){
|
||||
String collaborators = exhibitionDTO.getCollaborators().stream().map(CollaboratorDTO::getCollaborateId).collect(Collectors.joining(Constants.COMMA));
|
||||
hyExhibitionDO.setCollaborators(String.format("%s%s%s", Constants.COMMA, collaborators, Constants.COMMA));
|
||||
}else {
|
||||
//如果协助人没有 则需要置空
|
||||
hyExhibitionDO.setCollaborators("");
|
||||
}
|
||||
hyExhibitionDO.setUpdater(userInfo.getName());
|
||||
hyExhibitionDAO.updateByPrimaryKeySelective(hyExhibitionDO);
|
||||
//发送通知 给报名的人员
|
||||
//查询报名了该会销的线索
|
||||
List<ExhibitionLineDTO> exhibitionLine = hyPartnerExhibitionDAO.getExhibitionLine(hyExhibitionDO.getExhibitionCode());
|
||||
exhibitionLine.forEach(x->{
|
||||
try {
|
||||
eventCenterHttpRequest.sendSmsVariable(x.getMobile(), SMSMsgEnum.EXHIBITION_INFO_UPDATE,hyExhibitionDO.getExhibitionName(),
|
||||
DateUtils.format(hyExhibitionDO.getStartDate(),CoolDateUtils.DATE_FORMAT_DAY_2),hyExhibitionDO.getLocation(),wechatMiniAppService.getMiniAppUrl());
|
||||
} catch (ApiException e) {
|
||||
log.info("发送短信通知失败,mobile:{},ex:{}",x.getMobile(),e);
|
||||
}
|
||||
});
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 协作人处理
|
||||
* @param exhibitionList
|
||||
* @return
|
||||
*/
|
||||
private Map<String, CollaboratorVO> getExhibitionCollaboratorMap(List<ExhibitionDTO> exhibitionList){
|
||||
Set<String> collaboratorsSet = new HashSet();
|
||||
Map<String, CollaboratorVO> resultMap = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(exhibitionList)) {
|
||||
exhibitionList.forEach(x -> {
|
||||
if (StringUtils.isNotEmpty(x.getCollaboratorStr())) {
|
||||
List<String> userIdList = Arrays.asList(x.getCollaboratorStr().substring(1).split(Constants.COMMA));
|
||||
collaboratorsSet.addAll(userIdList);
|
||||
}
|
||||
});
|
||||
List<EnterpriseUserDO> userInfoList = enterpriseUserDAO.getUserInfoByUserIds(new ArrayList<>(collaboratorsSet));
|
||||
resultMap = userInfoList.stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId,
|
||||
u -> new CollaboratorVO(u.getUserId(), u.getName())));
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
* @param insertList
|
||||
*/
|
||||
private void batchInsertExhibition(ExhibitionGroupDTO exhibitionGroupDTO,List<HyExhibitionDO> insertList,LoginUserInfo userInfo) throws ApiException {
|
||||
hyExhibitionDAO.batchInsert(insertList);
|
||||
//新增之后 发送消息通知 防止通知已发送 数据出现回滚
|
||||
for (ExhibitionDTO exhibitionDTO : exhibitionGroupDTO.getExhibitionList()){
|
||||
//更新不需要 发送工作通知
|
||||
if (exhibitionDTO.getId()!=null){
|
||||
continue;
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(exhibitionDTO.getCollaborators())){
|
||||
List<String> userIds = exhibitionDTO.getCollaborators().stream().map(CollaboratorDTO::getCollaborateId).collect(Collectors.toList());
|
||||
List<String> userIdsByUserIds = enterpriseUserDAO.getFeishuUserIdListByUserIds(userIds);
|
||||
eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.EXHIBITION_COLLABORATOR, userIdsByUserIds,userInfo.getName(),
|
||||
exhibitionDTO.getExhibitionName(),exhibitionDTO.getStartDate(),exhibitionDTO.getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验一下会销组
|
||||
* @param exhibitionGroupDTO
|
||||
*/
|
||||
private void checkExhibitionGroup(ExhibitionGroupDTO exhibitionGroupDTO) {
|
||||
if (exhibitionGroupDTO == null|| StringUtils.isEmpty(exhibitionGroupDTO.getExhibitionGroupName())){
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
|
||||
}
|
||||
//会销组中必须添加至少一个会销
|
||||
if (CollectionUtils.isEmpty(exhibitionGroupDTO.getExhibitionList())){
|
||||
throw new ServiceException(ErrorCodeEnum.EXHIBITION_GROUP_NOT_NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
package com.cool.store.controller;
|
||||
|
||||
import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.context.LoginUserInfo;
|
||||
import com.cool.store.dto.exhibition.ExhibitionDTO;
|
||||
import com.cool.store.dto.exhibition.ExhibitionGroupDTO;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.ExhibitionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/11/30 14:44
|
||||
@@ -20,4 +27,56 @@ public class ExhibitionController {
|
||||
@Autowired
|
||||
private ExhibitionService exhibitionService;
|
||||
|
||||
|
||||
@PostMapping(value = "/addExhibitionGroup")
|
||||
@ApiOperation("添加会销组")
|
||||
public ResponseResult addExhibitionGroup(@RequestBody ExhibitionGroupDTO exhibitionGroupDTO) throws ApiException {
|
||||
return ResponseResult.success(exhibitionService.addExhibitionGroup(exhibitionGroupDTO, CurrentUserHolder.getUser()));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/editExhibitionGroup")
|
||||
@ApiOperation("编辑会销组")
|
||||
public ResponseResult editExhibitionGroup(@RequestBody ExhibitionGroupDTO exhibitionGroupDTO) throws ApiException {
|
||||
return ResponseResult.success(exhibitionService.editExhibitionGroup(exhibitionGroupDTO, CurrentUserHolder.getUser()));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getMyExhibitionList")
|
||||
@ApiOperation("我的会销")
|
||||
public ResponseResult getMyExhibitionList(@RequestParam(required = false,value = "closedTye") String closedTye,
|
||||
@RequestParam(required = false,value = "startDate") String startDate,
|
||||
@RequestParam(required = false,value = "pageNum") Integer pageNum,
|
||||
@RequestParam(required = false,value = "pageSize") Integer pageSize) {
|
||||
LoginUserInfo user = CurrentUserHolder.getUser();
|
||||
return ResponseResult.success(exhibitionService.getMyExhibitionList(user.getUserId(),closedTye,startDate,pageSize,pageNum));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getMyExhibitionGroupList")
|
||||
@ApiOperation("我的会销组")
|
||||
public ResponseResult getMyExhibitionGroupList(@RequestParam(required = false,value = "pageNum") Integer pageNum,
|
||||
@RequestParam(required = false,value = "pageSize") Integer pageSize) {
|
||||
LoginUserInfo user = CurrentUserHolder.getUser();
|
||||
return ResponseResult.success(exhibitionService.getMyExhibitionGroupList(user.getUserId(),pageSize,pageNum));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/getExhibitionGroupDetail")
|
||||
@ApiOperation("会销组详情")
|
||||
public ResponseResult getExhibitionGroupDetail(@RequestParam(required = false,value = "exhibitionGroupId") Integer exhibitionGroupId) {
|
||||
return ResponseResult.success(exhibitionService.getExhibitionGroupDetail(exhibitionGroupId));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/exhibitionDetail")
|
||||
@ApiOperation("会销详情")
|
||||
public ResponseResult getExhibitionDetail(@RequestParam(required = false,value = "exhibitionId") Integer exhibitionId) {
|
||||
return ResponseResult.success(exhibitionService.getExhibitionDetail(exhibitionId));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/editExhibition")
|
||||
@ApiOperation("编辑会销")
|
||||
public ResponseResult editExhibition(@RequestBody ExhibitionDTO exhibitionDTO) {
|
||||
return ResponseResult.success(exhibitionService.editExhibition(exhibitionDTO, CurrentUserHolder.getUser()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user