Merge branch 'dev/feat/partner1.6_20231226' into pre

This commit is contained in:
苏竹红
2023-12-19 16:37:10 +08:00
11 changed files with 104 additions and 16 deletions

View File

@@ -91,12 +91,12 @@ public class HyExhibitionDAO {
} }
public Map<String,ExhibitionStatisticsDTO> exhibitionStatisticsMap(List<String> list) { public Map<String,ExhibitionStatisticsDTO> exhibitionStatisticsMap(List<Integer> list) {
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return new HashMap<>(4); return new HashMap<>(4);
} }
List<ExhibitionStatisticsDTO> result = hyExhibitionMapper.exhibitionStatistic(list); List<ExhibitionStatisticsDTO> result = hyExhibitionMapper.exhibitionStatistic(list);
return result.stream().collect(Collectors.toMap(ExhibitionStatisticsDTO::getExhibitionCode, date -> date)); return result.stream().collect(Collectors.toMap(ExhibitionStatisticsDTO::getExhibitionId, date -> date));
} }
public List<ExhibitionDTO> listByExhibitionGroupIds(List<Integer> exhibitionGroupIdList,Boolean filterCloseExhibition){ public List<ExhibitionDTO> listByExhibitionGroupIds(List<Integer> exhibitionGroupIdList,Boolean filterCloseExhibition){

View File

@@ -150,4 +150,11 @@ public class HyPartnerExhibitionDAO {
} }
return hyPartnerExhibitionMapper.getCloseExhibitionLineIds(exhibitionIds); return hyPartnerExhibitionMapper.getCloseExhibitionLineIds(exhibitionIds);
} }
public List<ExhibitionLineDTO> getLineByExhibitionIds(List<Integer> exhibitionIds) {
if (CollectionUtils.isEmpty(exhibitionIds)){
return new ArrayList<>();
}
return hyPartnerExhibitionMapper.getLineByExhibitionIds(exhibitionIds);
}
} }

View File

@@ -52,7 +52,7 @@ public interface HyExhibitionMapper {
@Param("closedType") Integer closedType); @Param("closedType") Integer closedType);
List<ExhibitionStatisticsDTO> exhibitionStatistic(@Param("list") List<String> exhibitionCodeList); List<ExhibitionStatisticsDTO> exhibitionStatistic(@Param("list") List<Integer> exhibitionIdList);
List<ExhibitionDTO> listByExhibitionGroupIds(@Param("list") List<Integer> exhibitionGroupIdList, @Param("filterCloseExhibition") Boolean filterCloseExhibition); List<ExhibitionDTO> listByExhibitionGroupIds(@Param("list") List<Integer> exhibitionGroupIdList, @Param("filterCloseExhibition") Boolean filterCloseExhibition);

View File

@@ -109,4 +109,11 @@ public interface HyPartnerExhibitionMapper {
* @return * @return
*/ */
List<Long> getCloseExhibitionLineIds(@Param("exhibitionIds") List<Integer> exhibitionIds); List<Long> getCloseExhibitionLineIds(@Param("exhibitionIds") List<Integer> exhibitionIds);
/**
* 根据展会 id 列表获取会销线索信息
* @param exhibitionIds
* @return
*/
List<ExhibitionLineDTO> getLineByExhibitionIds(List<Integer> exhibitionIds);
} }

View File

@@ -363,18 +363,18 @@
<select id="exhibitionStatistic" resultType="com.cool.store.dto.exhibition.ExhibitionStatisticsDTO"> <select id="exhibitionStatistic" resultType="com.cool.store.dto.exhibition.ExhibitionStatisticsDTO">
select select
exhibition_code as exhibitionCode, exhibition_id as exhibitionId,
COALESCE(count(1),0) as signUpCount, 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 = 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 = 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 COALESCE(sum( CASE WHEN participation_status in (3,4,5,6) THEN 1 ELSE 0 END ),0) as interviewCount
from hy_partner_exhibition from hy_partner_exhibition
<where> <where>
<foreach collection="list" item="code" open="and exhibition_code in (" separator="," close=")"> <foreach collection="list" item="id" open="and exhibition_id in (" separator="," close=")">
#{code} #{id}
</foreach> </foreach>
</where> </where>
group by exhibition_code group by exhibition_id
</select> </select>

View File

@@ -150,6 +150,7 @@
pu.mobile as mobile pu.mobile as mobile
from hy_partner_exhibition hpe left join hy_partner_user_info pu on hpe.partner_id = pu.partner_id from hy_partner_exhibition hpe left join hy_partner_user_info pu on hpe.partner_id = pu.partner_id
where hpe.participation_status != 7 where hpe.participation_status != 7
and hpe.deleted = 0
<if test="exhibitionId != null and exhibitionId!=''"> <if test="exhibitionId != null and exhibitionId!=''">
and hpe.exhibition_id = #{exhibitionId} and hpe.exhibition_id = #{exhibitionId}
</if> </if>
@@ -472,4 +473,21 @@
) )
AND participation_status != 7 AND participation_status != 7
</select> </select>
<select id="getLineByExhibitionIds" resultType="com.cool.store.dto.exhibition.ExhibitionLineDTO">
select distinct
hpe.partner_id as partnerId,
hpe.partner_line_id as lineId,
hpe.exhibition_id as exhibitionId,
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
and hpe.deleted = 0
and hpe.exhibition_id in (
<foreach collection="exhibitionIds" item="exhibitionId" separator=",">
#{exhibitionId}
</foreach>
)
</select>
</mapper> </mapper>

View File

@@ -13,7 +13,7 @@ public class ExhibitionStatisticsDTO {
/** /**
* 展会code * 展会code
*/ */
private String exhibitionCode; private String exhibitionId;
/** /**
* 报名人数 * 报名人数

View File

@@ -7,6 +7,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date;
/** /**
* @author Fun Li 2023/12/8 13:50 * @author Fun Li 2023/12/8 13:50
* @version 1.0 * @version 1.0
@@ -19,13 +21,25 @@ public class ExhibitionJob {
private ExhibitionService exhibitionService; private ExhibitionService exhibitionService;
@XxlJob("autoCloseExhibition") @XxlJob("autoCloseExhibition")
//每天 23:59:00 执行
public void syncUserSourceJob() { public void syncUserSourceJob() {
XxlJobHelper.log("-------------------------------自动结束会销任务开始-------------------------------"); XxlJobHelper.log("-------------------------------自动结束会销任务开始-------------------------------");
log.info("-------------------------------自动结束会销任务开始-------------------------------"); log.info("-------------------------------自动结束会销任务开始-------------------------------");
int res = exhibitionService.autoCloseExhibition(); int res = exhibitionService.autoCloseExhibition(new Date());
log.info("-------------------------------自动结束会销任务结束,共结束" + res + "个会销-------------------------------"); log.info("-------------------------------自动结束会销任务结束,共结束" + res + "个会销-------------------------------");
XxlJobHelper.log("-------------------------------自动结束会销任务结束,共结束" + res + "个会销-------------------------------"); XxlJobHelper.log("-------------------------------自动结束会销任务结束,共结束" + res + "个会销-------------------------------");
XxlJobHelper.handleSuccess(); XxlJobHelper.handleSuccess();
} }
@XxlJob("sendSMSToExhibitionApplicants")
//每天 08:00 执行
public void sendSMSToExhibitionApplicants() {
XxlJobHelper.log("-------------------------------给被自动结束会销的参会人发送短信任务开始-------------------------------");
log.info("-------------------------------给被自动结束会销的参会人发送短信任务开始-------------------------------");
exhibitionService.sendSMSToExhibitionApplicants();
log.info("-------------------------------给被自动结束会销的参会人发送短信任务结束-------------------------------");
XxlJobHelper.log("-------------------------------给被自动结束会销的参会人发送短信任务结束-------------------------------");
XxlJobHelper.handleSuccess();
}
} }

View File

@@ -10,6 +10,7 @@ import com.cool.store.vo.EnterInterviewVO;
import com.cool.store.vo.exhibition.*; import com.cool.store.vo.exhibition.*;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@@ -157,6 +158,11 @@ public interface ExhibitionService {
/** /**
* 自动结束会销 * 自动结束会销
*/ */
int autoCloseExhibition(); int autoCloseExhibition(Date now);
/**
* 给被自动结束会销的参会人发短信通知
*/
void sendSMSToExhibitionApplicants();
} }

View File

@@ -259,9 +259,9 @@ public class ExhibitionServiceImpl implements ExhibitionService {
List<MyExhibitionVO> list = new ArrayList<>(); List<MyExhibitionVO> list = new ArrayList<>();
//查询协作人 //查询协作人
Set<String> collaboratorsSet = new HashSet(); Set<String> collaboratorsSet = new HashSet();
List<String> codeList = new ArrayList<>(); List<Integer> codeList = new ArrayList<>();
exhibitionList.forEach(x->{ exhibitionList.forEach(x->{
codeList.add(x.getExhibitionCode()); codeList.add(x.getId());
if (StringUtils.isNotEmpty(x.getCollaborators())){ if (StringUtils.isNotEmpty(x.getCollaborators())){
List<String> userIdList = Arrays.asList(x.getCollaborators().substring(1).split(Constants.COMMA)); List<String> userIdList = Arrays.asList(x.getCollaborators().substring(1).split(Constants.COMMA));
collaboratorsSet.addAll(userIdList); collaboratorsSet.addAll(userIdList);
@@ -289,7 +289,7 @@ public class ExhibitionServiceImpl implements ExhibitionService {
}); });
myExhibitionVO.setCollaborators(coll); myExhibitionVO.setCollaborators(coll);
} }
ExhibitionStatisticsDTO statistics = StatisticsMap.getOrDefault(x.getExhibitionCode(), new ExhibitionStatisticsDTO()); ExhibitionStatisticsDTO statistics = StatisticsMap.getOrDefault(x.getId(), new ExhibitionStatisticsDTO());
myExhibitionVO.setSignUpCount(statistics.getSignUpCount()); myExhibitionVO.setSignUpCount(statistics.getSignUpCount());
myExhibitionVO.setCheckInCount(statistics.getCheckInCount()); myExhibitionVO.setCheckInCount(statistics.getCheckInCount());
myExhibitionVO.setFormFillCount(statistics.getFormFillCount()); myExhibitionVO.setFormFillCount(statistics.getFormFillCount());
@@ -690,11 +690,11 @@ public class ExhibitionServiceImpl implements ExhibitionService {
@Override @Override
@Transactional @Transactional
public int autoCloseExhibition() { public int autoCloseExhibition(Date now) {
//1. 查询需要关闭的会销 //1. 查询需要关闭的会销
HyExhibitionDO hyExhibitionDO = new HyExhibitionDO(); HyExhibitionDO hyExhibitionDO = new HyExhibitionDO();
hyExhibitionDO.setClosedType(0); hyExhibitionDO.setClosedType(0);
hyExhibitionDO.setStartDateStr(DateUtil.format(new Date(), CoolDateUtils.DATE_FORMAT_DAY)); hyExhibitionDO.setStartDateStr(DateUtil.format(now, CoolDateUtils.DATE_FORMAT_DAY));
hyExhibitionDO.setDeleted(Boolean.FALSE); hyExhibitionDO.setDeleted(Boolean.FALSE);
List<HyExhibitionDO> hyExhibitionDOS = hyExhibitionDAO.querySelective(hyExhibitionDO); List<HyExhibitionDO> hyExhibitionDOS = hyExhibitionDAO.querySelective(hyExhibitionDO);
if (CollectionUtils.isEmpty(hyExhibitionDOS)) { if (CollectionUtils.isEmpty(hyExhibitionDOS)) {
@@ -724,6 +724,35 @@ public class ExhibitionServiceImpl implements ExhibitionService {
return res; return res;
} }
@Override
public void sendSMSToExhibitionApplicants() {
//1. 查询昨晚被自动结束的会销
HyExhibitionDO hyExhibitionDO = new HyExhibitionDO();
hyExhibitionDO.setClosedType(2);
String startDayStr = DateUtil.format(DateUtil.offsetDay(new Date(), -1), CoolDateUtils.DATE_FORMAT_DAY);
hyExhibitionDO.setStartDateStr(startDayStr);
hyExhibitionDO.setDeleted(Boolean.FALSE);
List<HyExhibitionDO> hyExhibitionDOS = hyExhibitionDAO.querySelective(hyExhibitionDO);
if (CollectionUtils.isEmpty(hyExhibitionDOS)) {
return;
}
//2. 昨晚结束的会销关联的线索
List<ExhibitionLineDTO> exhibitionLine = hyPartnerExhibitionDAO.getLineByExhibitionIds(hyExhibitionDOS.stream().map(HyExhibitionDO::getId).collect(Collectors.toList()));
if (CollectionUtils.isEmpty(exhibitionLine)){
return;
}
//3. 短信通知
exhibitionLine.stream().forEach(x->{
try {
eventCenterHttpRequest.sendSmsVariable(x.getMobile(), SMSMsgEnum.EXHIBITION_CLOSE);
} catch (ApiException e) {
log.info("closeExhibition 发送短信通知失败,mobile:{}, exhibitionId:{}", x.getMobile(), hyExhibitionDO.getId());
}
});
}
/** /**
* 计算是否会销中 * 计算是否会销中
* @param lineId * @param lineId

View File

@@ -6,6 +6,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
import java.util.Date;
/** /**
* @author Fun Li 2023/12/6 16:17 * @author Fun Li 2023/12/6 16:17
* @version 1.0 * @version 1.0
@@ -24,8 +26,13 @@ class ExhibitionServiceTest extends AbstractJUnit4SpringContextTests {
@Test @Test
void testAutoCloseExhibition() { void testAutoCloseExhibition() {
int i = exhibitionService.autoCloseExhibition(); int i = exhibitionService.autoCloseExhibition(new Date());
log.info(i + ""); log.info(i + "");
} }
@Test
void testSendSMSToExhibitionApplicants() {
exhibitionService.sendSMSToExhibitionApplicants();
}
} }