master
杜函宇 2 months ago
parent 1d818f74da
commit 03d35e0d8b

@ -1,7 +1,9 @@
package com.ruoyi.jjh.declaration.component;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseBasicInfoService;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseDirectoryService;
import com.ruoyi.jjh.ent.entity.JContacts;
import com.ruoyi.jjh.ent.entity.JEnterpriseContact;
import com.ruoyi.jjh.ent.entity.JSmartDeclaration;
@ -14,7 +16,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
@ -28,7 +31,7 @@ import java.util.Objects;
* @author du
* @since 2024/7/18 9:55
*/
@Component("TimingRemind")
@Service
public class TimingRemindImpl implements TimingRemindService {
private static final Logger log = LoggerFactory.getLogger(TimingRemindImpl.class);
@ -75,6 +78,9 @@ public class TimingRemindImpl implements TimingRemindService {
@Resource
private SysUserMapper sysUserMapper;
@Autowired
private IBmsEnterpriseDirectoryService enterpriseDirectoryService;
/**
*
*/
@ -97,32 +103,37 @@ public class TimingRemindImpl implements TimingRemindService {
/**
*
*/
@Async("chrisThreadPool")
public void getContact(String code, String s) {
if (isTiming) {
List<JEnterpriseContact> list1 = jEnterpriseContactService.lambdaQuery().eq(JEnterpriseContact::getEnterpriseCode, code).list();
if (list1 != null && !list1.isEmpty()) {
list1.forEach(y -> {
//先添加工单再发送短信
//可在导入或者新增的时候将该常用联系人的手机号添加进工单
smsAlertsService.enterSms(y.getEnterpriseName(), s, y.getContactPhone());
log.info(y.getEnterpriseName() + "发送短信成功!");
//发送邮件
emailEnterService.toEnter(y.getEnterpriseName(), s + "此邮件为系统自动发送,无需回复!", y.getContactEmail());
log.info(y.getEnterpriseName() + "发送邮件成功!");
});
} else {
List<JContacts> list = jContactsService.lambdaQuery().eq(JContacts::getTyshxydm, code)
.eq(JContacts::getDefaultcontact, "1").list();
list.forEach(y -> {
//先添加工单再发送短信
smsAlertsService.addSsmPhone(y.getYddh());
//可在导入或者新增的时候将该常用联系人的手机号添加进工单
smsAlertsService.enterSms(y.getQymc(), s, y.getYddh());
log.info(y.getQymc() + "发送短信成功!");
//发送邮件
emailEnterService.toEnter(y.getQymc(), s + "此邮件为系统自动发送,无需回复!", y.getDzyx());
log.info(y.getQymc() + "发送邮件成功!");
});
try {
List<JEnterpriseContact> list1 = jEnterpriseContactService.lambdaQuery().eq(JEnterpriseContact::getEnterpriseCode, code).list();
if (list1 != null && !list1.isEmpty()) {
list1.forEach(y -> {
//先添加工单再发送短信
//可在导入或者新增的时候将该常用联系人的手机号添加进工单
smsAlertsService.enterSms(y.getEnterpriseName(), s, y.getContactPhone());
log.info(y.getEnterpriseName() + "发送短信成功!");
//发送邮件
emailEnterService.toEnter(y.getEnterpriseName(), s + "此邮件为系统自动发送,无需回复!", y.getContactEmail());
log.info(y.getEnterpriseName() + "发送邮件成功!");
});
} else {
List<JContacts> list = jContactsService.lambdaQuery().eq(JContacts::getTyshxydm, code)
.eq(JContacts::getDefaultcontact, "1").list();
list.forEach(y -> {
//先添加工单再发送短信
smsAlertsService.addSsmPhone(y.getYddh());
//可在导入或者新增的时候将该常用联系人的手机号添加进工单
smsAlertsService.enterSms(y.getQymc(), s, y.getYddh());
log.info(y.getQymc() + "发送短信成功!");
//发送邮件
emailEnterService.toEnter(y.getQymc(), s + "此邮件为系统自动发送,无需回复!", y.getDzyx());
log.info(y.getQymc() + "发送邮件成功!");
});
}
} catch (Exception e) {
throw new ServiceException(code + "发送邮件失败!");
}
}
}
@ -151,14 +162,14 @@ public class TimingRemindImpl implements TimingRemindService {
if (isTiming) {
if (sd.getProjectId() != null && x.getPhonenumber() != null) {
smsAlertsService.enterSms("政府人员-" + x.getNickName(), "您有1个项目自定义通知,请前往工作台查看," + "登录网址为:https://idp.sipac.gov.cn/bms/#/login", x.getPhonenumber());
if(!Objects.equals(x.getEmail(), "") &&x.getEmail()!=null){
if (!Objects.equals(x.getEmail(), "") && x.getEmail() != null) {
//发送邮件
emailEnterService.toEnter("政府人员-" + x.getNickName(), "您有1个项目自定义通知,请前往工作台查看," + "登录网址为:https://idp.sipac.gov.cn/bms/#/login" + "此邮件为系统自动发送,无需回复!", x.getEmail());
}
}
if (x.getPhonenumber() != null && sd.getProjectId() == null) {
smsAlertsService.enterSms("政府人员-" + x.getNickName(), "您有1个全局自定义通知,请前往工作台查看," + "登录网址为:https://idp.sipac.gov.cn/bms/#/login", x.getPhonenumber());
if(!Objects.equals(x.getEmail(), "") &&x.getEmail()!=null) {
if (!Objects.equals(x.getEmail(), "") && x.getEmail() != null) {
//发送邮件
emailEnterService.toEnter("政府人员-" + x.getNickName(), "您有1个全局自定义通知,请前往工作台查看," + "登录网址为:https://idp.sipac.gov.cn/bms/#/login" + "此邮件为系统自动发送,无需回复!", x.getEmail());
}

@ -13,6 +13,7 @@ public interface TimingRemindService {
*/
void enterpriseTiming(String t, Long id);
/**
*
*/

@ -0,0 +1,29 @@
package com.ruoyi.jjh.declaration.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
/**
* @author du
* @since 2025/1/7 15:49
*/
@Configuration
@EnableAsync
public class AsyncConfig {
@Bean(name ="chrisThreadPool")
public Executor taskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(10);
executor.setMaxPoolSize(50);
executor.setQueueCapacity(100);
executor.setThreadNamePrefix("chrisThread-");
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
executor.initialize();
return executor;
}
}

@ -5,11 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.jjh.declaration.component.TimingRemindService;
import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseBasicInfo;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseDirectory;
import com.ruoyi.jjh.declaration.entity.BmsTemplateInfo;
import com.ruoyi.jjh.declaration.entity.BmsTemplateRecord;
import com.ruoyi.jjh.declaration.entity.*;
import com.ruoyi.jjh.declaration.entity.dto.BmsTemplateRecordAddDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsTemplateRecordQueryDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsTemplateRecordUpdateDto;
@ -17,11 +13,7 @@ import com.ruoyi.jjh.declaration.entity.vo.BmsTemplateRecordQueryVo;
import com.ruoyi.jjh.declaration.entity.vo.BmsTemplateRecordVo;
import com.ruoyi.jjh.declaration.mapper.BmsTemplateRecordMapper;
import com.ruoyi.jjh.declaration.regular.TimeChange;
import com.ruoyi.jjh.declaration.service.IBmsDeclarationRecordsService;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseBasicInfoService;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseDirectoryService;
import com.ruoyi.jjh.declaration.service.IBmsTemplateInfoService;
import com.ruoyi.jjh.declaration.service.IBmsTemplateRecordService;
import com.ruoyi.jjh.declaration.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -30,9 +22,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.Year;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/**
@ -260,12 +251,22 @@ public class BmsTemplateRecordServiceImpl extends ServiceImpl<BmsTemplateRecordM
//获取每个企业对应的常用联系人
if (isTiming) {
List<BmsEnterpriseDirectory> list = enterpriseDirectoryService.lambdaQuery().eq(BmsEnterpriseDirectory::getTemplateRecordId, bmsTemplateRecordAddDto.getId()).list();
for (BmsEnterpriseDirectory x : list) {
timingRemindImpl.getContact(x.getCreditCode(), "各重点企业现开展生产性服务业企业或项目支撑新型工业化的相关案例征集详情请登录金鸡湖现代服务业品牌管理系统https://idp.sipac.gov.cn/bms/#/login 首页查看待办事项,感谢支持!");
List<CompletableFuture<Void>> list2 = new ArrayList<>();
int batchSize = 49; // 每批处理的数据量
for (int i = 0; i < list.size(); i += batchSize) {
final List<BmsEnterpriseDirectory> batch = list.subList(i, Math.min(i + batchSize, list.size()));
list2.add(CompletableFuture.runAsync(() -> {
batch.forEach(data -> {
// 处理每条数据
timingRemindImpl.getContact(data.getCreditCode(), "【问卷调研】尊敬的企业人员您好苏州工业园区经发委现开展2025年度现代服务业发展调研活动诚邀您提出宝贵意见和建议烦请花费1分钟通过问卷星链接 https://www.wjx.cn/vm/wBmJsmc.aspx# 提交反馈截止日期1月12日。感谢您的宝贵时间顺祝新年快乐万事顺利。【园区经发委】");
});
}));
}
}
System.out.println("主进程结束!");
return num;
}
/**
* 线
*/

@ -16,8 +16,8 @@ ruoyi:
# 日志配置
logging:
level:
com.ruoyi: error
org.springframework: error
com.ruoyi: info
org.springframework: info
# 用户配置
user:

@ -6,30 +6,32 @@
<select id="servicesDevelop" resultType="com.ruoyi.jjh.ent.entity.response.JServicesDevelopResponse">
SELECT
a.develop_year,
a.quarterly AS quarterly,
IFNULL( a.value_added, 0 ) AS valueAdded,
IFNULL( a.increase_speed, 0 ) AS increaseSpeed,
IFNULL( a.gdp_proportion, 0 ) AS gdpProportion
IFNULL(a.develop_year, YEAR(NOW()) - 1) AS develop_year,
IFNULL(a.quarterly, 0) AS quarterly,
IFNULL(a.value_added, 0) AS valueAdded,
IFNULL(a.increase_speed, 0) AS increaseSpeed,
IFNULL(a.gdp_proportion, 0) AS gdpProportion
FROM
j_services_develop a
WHERE
YEAR (
NOW()) - 1 = a.develop_year
AND a.quarterly IS NULL UNION
(SELECT 1) AS temp
LEFT JOIN j_services_develop a
ON YEAR(NOW()) - 1 = a.develop_year
AND a.quarterly IS NULL
UNION
(
SELECT
c.develop_year,
c.quarterly AS quarterly,
IFNULL( c.value_added, 0 ) AS valueAdded,
IFNULL( c.increase_speed, 0 ) AS increaseSpeed,
IFNULL( c.gdp_proportion, 0 ) AS gdpProportion
IFNULL(c.develop_year, YEAR(NOW())) AS develop_year,
IFNULL(c.quarterly, 0) AS quarterly,
IFNULL(c.value_added, 0) AS valueAdded,
IFNULL(c.increase_speed, 0) AS increaseSpeed,
IFNULL(c.gdp_proportion, 0) AS gdpProportion
FROM
j_services_develop c
WHERE
YEAR (
NOW()) = c.develop_year
AND c.quarterly IS NOT NULL
(SELECT 1) AS temp
LEFT JOIN j_services_develop c
ON YEAR(NOW()) = c.develop_year
AND c.quarterly IS NOT NULL
ORDER BY
c.quarterly DESC
LIMIT 1)
@ -49,10 +51,10 @@
and a.project_name != '区级总部'
</if>
<if test="req.yearsChange == 1 ">
and a.appropriation_time like concat('%',YEAR(NOW())-1,'%')
and a.appropriation_time like concat('%',YEAR(NOW()),'%')
</if>
<if test="req.yearsChange != 1 ">
and SUBSTRING(a.appropriation_time, 1, 4) BETWEEN YEAR(DATE_SUB(CURDATE(), INTERVAL 3 YEAR)) AND YEAR(NOW())-1
and SUBSTRING(a.appropriation_time, 1, 4) BETWEEN YEAR(DATE_SUB(CURDATE(), INTERVAL 3 YEAR)) AND YEAR(NOW())
</if>
</where>
group by

@ -95,12 +95,29 @@ order by a.alert_time desc
<select id="getIndustryDepth" resultType="com.ruoyi.jjh.ent.entity.response.JIndustryDepthResponse">
SELECT a.years,
a.industry_categories,
IFNULL(ROUND(a.year_revenue / 10000, 1), '-') AS yearRevenue,
IFNULL(ROUND(a.add_value, 1) , '-') AS addValue,
IFNULL(ROUND(a.growth, 1), '-') AS growth,
IFNULL(ROUND(a.year_revenue / 10000, 1), '-') AS yearRevenue,
IFNULL(ROUND(a.add_value, 1), '-') AS addValue,
IFNULL(ROUND(a.growth, 1), '-') AS growth,
IFNULL(ROUND(a.gdp_proportion, 2), '-') AS gdpProportion
FROM j_industry_depth a
WHERE a.years = YEAR(NOW()) - 1
UNION ALL
SELECT a.years,
a.industry_categories,
IFNULL(ROUND(a.year_revenue / 10000, 1), '-') AS yearRevenue,
IFNULL(ROUND(a.add_value, 1), '-') AS addValue,
IFNULL(ROUND(a.growth, 1), '-') AS growth,
IFNULL(ROUND(a.gdp_proportion, 2), '-') AS gdpProportion
FROM j_industry_depth a
WHERE a.years = YEAR(NOW()) - 2
AND NOT EXISTS (
SELECT 1
FROM j_industry_depth b
WHERE b.years = YEAR(NOW()) - 1
)
</select>
<select id="getMiddleIndustry"
resultType="com.ruoyi.jjh.ent.entity.response.JBigMiddleIndustryResponse">

@ -67,21 +67,56 @@
# GROUP BY
# a.type,
# b.qyCount
SELECT
IFNULL( ROUND( a.revenue / 100000, 1 ), '-' ) AS allRevenue,
IFNULL( ROUND( a.add_value, 1 ), '-' ) AS addValue,
a.type AS servicesType,
CASE
WHEN a.type = 3 THEN
( SELECT COUNT(*) FROM bms_enterprise_basic_info WHERE type = 1 ) ELSE b.qyCount
END AS qyCount
-- 使用外部查询进行排序
SELECT * FROM (
-- 查询 YEAR(NOW()) - 1 数据
SELECT
IFNULL(ROUND(a.revenue / 100000, 1), '-') AS allRevenue,
IFNULL(ROUND(a.add_value, 1), '-') AS addValue,
a.type AS servicesType,
CASE
WHEN a.type = 3 THEN
(SELECT COUNT(*) FROM bms_enterprise_basic_info WHERE type = 1)
ELSE b.qyCount
END AS qyCount
FROM
j_total_revenue a
LEFT JOIN (
SELECT a.services_type, COUNT(*) AS qyCount
FROM j_services_list a
GROUP BY a.services_type
) AS b ON a.type = b.services_type
WHERE
a.years = YEAR(NOW()) - 1
FROM
j_total_revenue a
LEFT JOIN ( SELECT a.services_type, COUNT(*) AS qyCount FROM j_services_list a GROUP BY a.services_type ) AS b ON a.type = b.services_type
WHERE
a.years = YEAR (NOW()) - 1
ORDER BY FIELD(a.type, 3, 1, 2, 4);
-- 使用 UNION ALL 查询 YEAR(NOW()) - 2 数据,仅当 YEAR(NOW()) - 1 数据为空时执行
UNION ALL
SELECT
IFNULL(ROUND(a.revenue / 100000, 1), '-') AS allRevenue,
IFNULL(ROUND(a.add_value, 1), '-') AS addValue,
a.type AS servicesType,
CASE
WHEN a.type = 3 THEN
(SELECT COUNT(*) FROM bms_enterprise_basic_info WHERE type = 1)
ELSE b.qyCount
END AS qyCount
FROM
j_total_revenue a
LEFT JOIN (
SELECT a.services_type, COUNT(*) AS qyCount
FROM j_services_list a
GROUP BY a.services_type
) AS b ON a.type = b.services_type
WHERE
a.years = YEAR(NOW()) - 2
AND NOT EXISTS (
SELECT 1
FROM j_total_revenue a1
WHERE a1.years = YEAR(NOW()) - 1
)
) AS result
ORDER BY FIELD(result.servicesType, 3, 1, 2, 4);
</select>

Loading…
Cancel
Save