Merge remote-tracking branch 'hsayi/dev/feat/partner1.6_20231226' into dev/feat/partner1.6_20231226
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
@@ -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