Merge branch 'dev/feat/partner1.6_20231226' into pre
This commit is contained in:
@@ -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)) {
|
||||
return new HashMap<>(4);
|
||||
}
|
||||
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){
|
||||
|
||||
@@ -150,4 +150,11 @@ public class HyPartnerExhibitionDAO {
|
||||
}
|
||||
return hyPartnerExhibitionMapper.getCloseExhibitionLineIds(exhibitionIds);
|
||||
}
|
||||
|
||||
public List<ExhibitionLineDTO> getLineByExhibitionIds(List<Integer> exhibitionIds) {
|
||||
if (CollectionUtils.isEmpty(exhibitionIds)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return hyPartnerExhibitionMapper.getLineByExhibitionIds(exhibitionIds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public interface HyExhibitionMapper {
|
||||
@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);
|
||||
|
||||
|
||||
@@ -109,4 +109,11 @@ public interface HyPartnerExhibitionMapper {
|
||||
* @return
|
||||
*/
|
||||
List<Long> getCloseExhibitionLineIds(@Param("exhibitionIds") List<Integer> exhibitionIds);
|
||||
|
||||
/**
|
||||
* 根据展会 id 列表获取会销线索信息
|
||||
* @param exhibitionIds
|
||||
* @return
|
||||
*/
|
||||
List<ExhibitionLineDTO> getLineByExhibitionIds(List<Integer> exhibitionIds);
|
||||
}
|
||||
@@ -363,18 +363,18 @@
|
||||
|
||||
<select id="exhibitionStatistic" resultType="com.cool.store.dto.exhibition.ExhibitionStatisticsDTO">
|
||||
select
|
||||
exhibition_code as exhibitionCode,
|
||||
exhibition_id as exhibitionId,
|
||||
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 collection="list" item="id" open="and exhibition_id in (" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</where>
|
||||
group by exhibition_code
|
||||
group by exhibition_id
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@
|
||||
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
|
||||
<if test="exhibitionId != null and exhibitionId!=''">
|
||||
and hpe.exhibition_id = #{exhibitionId}
|
||||
</if>
|
||||
@@ -472,4 +473,21 @@
|
||||
)
|
||||
AND participation_status != 7
|
||||
</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>
|
||||
@@ -13,7 +13,7 @@ public class ExhibitionStatisticsDTO {
|
||||
/**
|
||||
* 展会code
|
||||
*/
|
||||
private String exhibitionCode;
|
||||
private String exhibitionId;
|
||||
|
||||
/**
|
||||
* 报名人数
|
||||
|
||||
@@ -7,6 +7,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/12/8 13:50
|
||||
* @version 1.0
|
||||
@@ -19,13 +21,25 @@ public class ExhibitionJob {
|
||||
private ExhibitionService exhibitionService;
|
||||
|
||||
@XxlJob("autoCloseExhibition")
|
||||
//每天 23:59:00 执行
|
||||
public void syncUserSourceJob() {
|
||||
XxlJobHelper.log("-------------------------------自动结束会销任务开始-------------------------------");
|
||||
log.info("-------------------------------自动结束会销任务开始-------------------------------");
|
||||
int res = exhibitionService.autoCloseExhibition();
|
||||
int res = exhibitionService.autoCloseExhibition(new Date());
|
||||
log.info("-------------------------------自动结束会销任务结束,共结束" + res + "个会销-------------------------------");
|
||||
XxlJobHelper.log("-------------------------------自动结束会销任务结束,共结束" + res + "个会销-------------------------------");
|
||||
XxlJobHelper.handleSuccess();
|
||||
}
|
||||
|
||||
@XxlJob("sendSMSToExhibitionApplicants")
|
||||
//每天 08:00 执行
|
||||
public void sendSMSToExhibitionApplicants() {
|
||||
XxlJobHelper.log("-------------------------------给被自动结束会销的参会人发送短信任务开始-------------------------------");
|
||||
log.info("-------------------------------给被自动结束会销的参会人发送短信任务开始-------------------------------");
|
||||
exhibitionService.sendSMSToExhibitionApplicants();
|
||||
log.info("-------------------------------给被自动结束会销的参会人发送短信任务结束-------------------------------");
|
||||
XxlJobHelper.log("-------------------------------给被自动结束会销的参会人发送短信任务结束-------------------------------");
|
||||
XxlJobHelper.handleSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.cool.store.vo.EnterInterviewVO;
|
||||
import com.cool.store.vo.exhibition.*;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -157,6 +158,11 @@ public interface ExhibitionService {
|
||||
/**
|
||||
* 自动结束会销
|
||||
*/
|
||||
int autoCloseExhibition();
|
||||
int autoCloseExhibition(Date now);
|
||||
|
||||
/**
|
||||
* 给被自动结束会销的参会人发短信通知
|
||||
*/
|
||||
void sendSMSToExhibitionApplicants();
|
||||
|
||||
}
|
||||
|
||||
@@ -259,9 +259,9 @@ public class ExhibitionServiceImpl implements ExhibitionService {
|
||||
List<MyExhibitionVO> list = new ArrayList<>();
|
||||
//查询协作人
|
||||
Set<String> collaboratorsSet = new HashSet();
|
||||
List<String> codeList = new ArrayList<>();
|
||||
List<Integer> codeList = new ArrayList<>();
|
||||
exhibitionList.forEach(x->{
|
||||
codeList.add(x.getExhibitionCode());
|
||||
codeList.add(x.getId());
|
||||
if (StringUtils.isNotEmpty(x.getCollaborators())){
|
||||
List<String> userIdList = Arrays.asList(x.getCollaborators().substring(1).split(Constants.COMMA));
|
||||
collaboratorsSet.addAll(userIdList);
|
||||
@@ -289,7 +289,7 @@ public class ExhibitionServiceImpl implements ExhibitionService {
|
||||
});
|
||||
myExhibitionVO.setCollaborators(coll);
|
||||
}
|
||||
ExhibitionStatisticsDTO statistics = StatisticsMap.getOrDefault(x.getExhibitionCode(), new ExhibitionStatisticsDTO());
|
||||
ExhibitionStatisticsDTO statistics = StatisticsMap.getOrDefault(x.getId(), new ExhibitionStatisticsDTO());
|
||||
myExhibitionVO.setSignUpCount(statistics.getSignUpCount());
|
||||
myExhibitionVO.setCheckInCount(statistics.getCheckInCount());
|
||||
myExhibitionVO.setFormFillCount(statistics.getFormFillCount());
|
||||
@@ -690,11 +690,11 @@ public class ExhibitionServiceImpl implements ExhibitionService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int autoCloseExhibition() {
|
||||
public int autoCloseExhibition(Date now) {
|
||||
//1. 查询需要关闭的会销
|
||||
HyExhibitionDO hyExhibitionDO = new HyExhibitionDO();
|
||||
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);
|
||||
List<HyExhibitionDO> hyExhibitionDOS = hyExhibitionDAO.querySelective(hyExhibitionDO);
|
||||
if (CollectionUtils.isEmpty(hyExhibitionDOS)) {
|
||||
@@ -724,6 +724,35 @@ public class ExhibitionServiceImpl implements ExhibitionService {
|
||||
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
|
||||
|
||||
@@ -6,6 +6,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/12/6 16:17
|
||||
* @version 1.0
|
||||
@@ -24,8 +26,13 @@ class ExhibitionServiceTest extends AbstractJUnit4SpringContextTests {
|
||||
|
||||
@Test
|
||||
void testAutoCloseExhibition() {
|
||||
int i = exhibitionService.autoCloseExhibition();
|
||||
int i = exhibitionService.autoCloseExhibition(new Date());
|
||||
log.info(i + "");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSendSMSToExhibitionApplicants() {
|
||||
exhibitionService.sendSMSToExhibitionApplicants();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user