From a10c4398603e0bc5a1809c1b7e156f80ce4350b2 Mon Sep 17 00:00:00 2001 From: du <1725534722@qq.com> Date: Fri, 19 Jul 2024 13:52:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E7=AB=AF=E5=8F=91=E9=80=81?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E5=8F=8A=E5=A4=A7=E5=B1=8F=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/TimingRemindImpl.java | 133 ++++++++++++++++++ .../component/TimingRemindService.java | 24 ++++ .../BmsTemplateRecordController.java | 2 +- .../vo/BmsDeclarationRecordsQueryVo.java | 4 + .../declaration/regular/SmsEnterChange.java | 75 ++++++++++ .../jjh/declaration/regular/TimeChange.java | 67 +++------ .../BmsDeclarationRecordsServiceImpl.java | 20 ++- .../impl/BmsTemplateRecordServiceImpl.java | 44 +++--- .../service/impl/SingleLoginServiceImpl.java | 13 ++ .../ent/controller/JDataScreenController.java | 57 ++++++++ .../JEnterpriseContactController.java | 13 ++ .../controller/JSmartRemindersController.java | 40 +++--- .../jjh/ent/entity/request/JAddJobSmart.java | 27 ++++ .../ent/entity/response/HonorResponse.java | 77 ++++++++++ .../response/ProjectTrackingResponse.java | 46 ++++++ .../jjh/ent/mapper/JDataScreenMapper.java | 29 ++++ .../jjh/ent/mapper/JSmartRemindersMapper.java | 11 ++ .../jjh/ent/service/JDataScreenService.java | 26 ++++ .../ent/service/JSmartRemindersService.java | 19 ++- .../jjh/ent/service/SmsAlertsService.java | 31 ++++ .../jjh/ent/service/impl/JDataScreenImpl.java | 68 +++++++++ .../impl/JSmartRemindersServiceImpl.java | 86 +++++++++-- .../service/impl/SmsAlertsServiceImpl.java | 108 ++++++++++++++ .../src/main/resources/application-druid.yml | 17 ++- .../main/resources/application-internet.yml | 17 ++- .../BmsDeclarationRecordsMapper.xml | 1 + .../mapper/jjh/ent/JDataScreenMapper.xml | 69 +++++++++ .../mapper/jjh/ent/JSmartRemindersMapper.xml | 9 ++ .../com/ruoyi/common/constant/Constants.java | 2 +- .../service/impl/SysJobServiceImpl.java | 2 +- 30 files changed, 1036 insertions(+), 101 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/component/TimingRemindImpl.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/component/TimingRemindService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/regular/SmsEnterChange.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JDataScreenController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/entity/request/JAddJobSmart.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/entity/response/HonorResponse.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/entity/response/ProjectTrackingResponse.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/mapper/JDataScreenMapper.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/JDataScreenService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/SmsAlertsService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/impl/JDataScreenImpl.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/impl/SmsAlertsServiceImpl.java create mode 100644 ruoyi-admin/src/main/resources/mapper/jjh/ent/JDataScreenMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/component/TimingRemindImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/component/TimingRemindImpl.java new file mode 100644 index 0000000..e6e081f --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/component/TimingRemindImpl.java @@ -0,0 +1,133 @@ +package com.ruoyi.jjh.declaration.component; + +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.jjh.declaration.service.IBmsEnterpriseBasicInfoService; +import com.ruoyi.jjh.ent.entity.JEnterpriseContact; +import com.ruoyi.jjh.ent.entity.JSmartDeclaration; +import com.ruoyi.jjh.ent.service.JEnterpriseContactService; +import com.ruoyi.jjh.ent.service.JSmartDeclarationService; +import com.ruoyi.jjh.ent.service.SmsAlertsService; +import com.ruoyi.system.mapper.SysUserMapper; +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 javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +/** + * 企业或者政务自定义定时提醒组件 + * + * @author du + * @since 2024/7/18 9:55 + */ +@Component("TimingRemind") +public class TimingRemindImpl implements TimingRemindService{ + + private static final Logger log = LoggerFactory.getLogger(TimingRemindImpl.class); + /** + * 智能提醒关联表 + */ + @Resource + private JSmartDeclarationService jSmartDeclarationService; + /** + * 企业信息 + */ + @Autowired + private IBmsEnterpriseBasicInfoService bmsEnterpriseBasicInfoService; + /** + * 企业常用联系人 + */ + @Resource + private JEnterpriseContactService jEnterpriseContactService; + + /** + * 是否是正式环境 + */ + @Value("${isTiming}") + private Boolean isTiming; + + /** + * 短信 + */ + @Resource + private SmsAlertsService smsAlertsService; + + + /** + * 人员 + */ + @Resource + private SysUserMapper sysUserMapper; + + /** + * 企业端要定时新增数据,并且还要发短信 + */ + public void enterpriseTiming(String t, Long id) { + List listAdd = new ArrayList<>(); + //给所有的企业都要添加一条智能提醒数据 + //要给每个企业端对应的所有常用联系人发短信 + bmsEnterpriseBasicInfoService.list().forEach(x -> { + JSmartDeclaration sd = new JSmartDeclaration(); + sd.setAlertTime(LocalDateTime.parse(t)); + sd.setIsRead(1); + sd.setSmartRemindersId(id); + sd.setTyshxydm(x.getTyshxydm()); + listAdd.add(sd); + getContact( x.getTyshxydm(), "您有1个全局自定义通知,请前往系统首页查看"); + }); + jSmartDeclarationService.saveBatch(listAdd); + } + + /** + * 根据企业名称和企业信用代码获取该企业的常用联系人并且发送短信 + */ + public void getContact(String code, String s) { + if (isTiming) { + List list1 = jEnterpriseContactService.lambdaQuery().eq(JEnterpriseContact::getEnterpriseCode, code).list(); + list1.forEach(y -> { + //先添加工单再发送短信 + //可在导入或者新增的时候将该常用联系人的手机号添加进工单 + smsAlertsService.enterSms(y.getEnterpriseName(), s, y.getContactPhone()); + log.info(y.getEnterpriseName() + "发送短信成功!"); + }); + } + } + + /** + * 政务端要定时新增数据,并且还要发短信 + */ + public void chiefTiming(String t, Long id, String pid) { + List listAdd = new ArrayList<>(); + //给所有政务人员发通知和短信 + //添加用户进表的时候手机号已经经过处理 + SysUser user = new SysUser(); + user.setUserType("02"); + sysUserMapper.selectUserList(user).forEach(x -> { + JSmartDeclaration sd = new JSmartDeclaration(); + sd.setIsRead(1); + sd.setAlertTime(LocalDateTime.parse(t)); + sd.setSmartRemindersId(id); + if ("null".equals(pid)) { + sd.setProjectId(null); + } else { + sd.setProjectId(Long.valueOf(pid)); + } + sd.setZwId(x.getUserId()); + if (isTiming) { + if (sd.getProjectId() != null & !x.getPhonenumber().isEmpty()) { + smsAlertsService.enterSms("政府人员-" + x.getNickName(), "您有1个项目自定义通知,请前往工作台查看", x.getPhonenumber()); + } + if (!x.getPhonenumber().isEmpty() & sd.getProjectId() == null) { + smsAlertsService.enterSms("政府人员-" + x.getNickName(), "您有1个全局自定义通知,请前往工作台查看", x.getPhonenumber()); + } + } + listAdd.add(sd); + }); + jSmartDeclarationService.saveBatch(listAdd); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/component/TimingRemindService.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/component/TimingRemindService.java new file mode 100644 index 0000000..62493fe --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/component/TimingRemindService.java @@ -0,0 +1,24 @@ +package com.ruoyi.jjh.declaration.component; + +/** + * 企业或者政务自定义定时提醒组件 + * @author du + * @since 2024/7/19 9:50 + */ +public interface TimingRemindService { + + /** + * 企业端要定时新增数据,并且还要发短信 + */ + void enterpriseTiming(String t, Long id); + + /** + * 根据企业名称和企业信用代码获取该企业的常用联系人并且发送短信 + */ + void getContact(String code, String s); + + /** + * 政务端要定时新增数据,并且还要发短信 + */ + void chiefTiming(String t, Long id, String pid); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/controller/BmsTemplateRecordController.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/controller/BmsTemplateRecordController.java index bdbdcd1..27bddc3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/controller/BmsTemplateRecordController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/controller/BmsTemplateRecordController.java @@ -100,7 +100,7 @@ public class BmsTemplateRecordController extends BaseController { * 新增在线模板 */ @ApiOperation(value = "新增在线模板") - @PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov')") + @PreAuthorize("@ss.hasAnyRoles('admin,other-gov')") @Log(title = "在线模板", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody BmsTemplateRecordAddDto bmsTemplateRecordAddDto) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/entity/vo/BmsDeclarationRecordsQueryVo.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/entity/vo/BmsDeclarationRecordsQueryVo.java index 44824e4..c2a5554 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/entity/vo/BmsDeclarationRecordsQueryVo.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/entity/vo/BmsDeclarationRecordsQueryVo.java @@ -45,6 +45,10 @@ public class BmsDeclarationRecordsQueryVo implements Serializable { @Excel(name = "申报单位") private String enterpriseName; + @ApiModelProperty(value = "项目小类") + @Excel(name = "项目小类") + private Integer projectSmallType; + @ApiModelProperty(value = "级别 0:本级,1:省级") @Excel(name = "级别", readConverterExp = "0=本级,1=省级") private Long level; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/regular/SmsEnterChange.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/regular/SmsEnterChange.java new file mode 100644 index 0000000..09963bf --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/regular/SmsEnterChange.java @@ -0,0 +1,75 @@ +package com.ruoyi.jjh.declaration.regular; + +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords; +import com.ruoyi.jjh.declaration.service.IBmsDeclarationRecordsService; +import com.ruoyi.jjh.ent.service.SmsAlertsService; +import com.ruoyi.system.mapper.SysUserMapper; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 发送短信定时任务 + * @author du + * @since 2024/7/17 10:30 + */ +@Configuration +@EnableScheduling +public class SmsEnterChange { + + @Resource + private SysUserMapper sysUserMapper; + + @Resource + private IBmsDeclarationRecordsService iBmsDeclarationRecordsService; + + @Resource + private SmsAlertsService smsAlertsService; + + @Value("${isTiming}") + private Boolean isTiming; + // 每三小时执行一次 + @Scheduled(cron = "0 0 */3 * * *") + private void runTask() { + if(isTiming){ + //查询初审的所有用户 + SysUser user = new SysUser(); + user.setDeptId(105L); + Long count = iBmsDeclarationRecordsService.lambdaQuery().eq(BmsDeclarationRecords::getStatus, 1).count(); + if(count>0){ + List list1 = sysUserMapper.selectUserList(user); + list1.removeIf(x-> x.getPhonenumber().isEmpty()); + for (SysUser items : list1) { + smsAlertsService.enterSms("政府人员-"+items.getNickName(),"您有"+count+"个新的申报审核任务[待初审]",items.getPhonenumber()); + } + } + //查询复审的所有用户 + SysUser user1 = new SysUser(); + user.setDeptId(101L); + Long count1 = iBmsDeclarationRecordsService.lambdaQuery().eq(BmsDeclarationRecords::getStatus, 2).count(); + if(count1>0){ + List list2 = sysUserMapper.selectUserList(user1); + list2.removeIf(x-> x.getPhonenumber().isEmpty()); + for (SysUser items : list2) { + smsAlertsService.enterSms("政府人员-"+items.getNickName(),"您有"+count1+"个新的申报审核任务[待复审]",items.getPhonenumber()); + } + } + //查询终审的所有用户 + SysUser user2 = new SysUser(); + user.setDeptId(103L); + Long count2 = iBmsDeclarationRecordsService.lambdaQuery().eq(BmsDeclarationRecords::getStatus, 3).count(); + if(count2>0){ + List list3 = sysUserMapper.selectUserList(user2); + list3.removeIf(x-> x.getPhonenumber().isEmpty()); + for (SysUser items : list3) { + smsAlertsService.enterSms("政府人员-"+items.getNickName(),"您有"+count2+"个新的申报审核任务[待终审]",items.getPhonenumber()); + } + } + } + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/regular/TimeChange.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/regular/TimeChange.java index de18aee..870689f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/regular/TimeChange.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/regular/TimeChange.java @@ -1,13 +1,12 @@ package com.ruoyi.jjh.declaration.regular; -import cn.hutool.core.bean.BeanUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; -import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.jjh.declaration.component.TimingRemindService; import com.ruoyi.jjh.declaration.entity.BmsEnterpriseBasicInfo; import com.ruoyi.jjh.declaration.entity.BmsTemplateInfo; import com.ruoyi.jjh.declaration.entity.BmsTemplateRecord; @@ -19,10 +18,8 @@ import com.ruoyi.jjh.ent.entity.JContacts; import com.ruoyi.jjh.ent.entity.JProject; import com.ruoyi.jjh.ent.entity.JSmartDeclaration; import com.ruoyi.jjh.ent.entity.JSmartReminders; -import com.ruoyi.jjh.ent.service.JContactsService; -import com.ruoyi.jjh.ent.service.JProjectService; -import com.ruoyi.jjh.ent.service.JSmartDeclarationService; -import com.ruoyi.jjh.ent.service.JSmartRemindersService; +import com.ruoyi.jjh.ent.service.*; +import com.ruoyi.quartz.service.ISysJobService; import com.ruoyi.system.mapper.SysUserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -32,13 +29,12 @@ import org.springframework.scheduling.annotation.Scheduled; import javax.annotation.Resource; import java.time.LocalDate; -import java.time.LocalDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; /** - * 定时任务 + * 每天固定时间定时任务 * * @author du * @since 2024/5/20 10:59 @@ -53,6 +49,8 @@ public class TimeChange { @Value("${isTiming}") private Boolean isTiming; + @Autowired + private ISysJobService jobService; /** * 申报模板 */ @@ -95,6 +93,11 @@ public class TimeChange { @Resource private IBmsDeclarationRecordsService bmsDeclarationRecordsService; + /** + * 短信 + */ + @Resource + private SmsAlertsService smsAlertsService; /** * 人员 @@ -102,6 +105,9 @@ public class TimeChange { @Resource private SysUserMapper sysUserMapper; + @Resource + private TimingRemindService timingRemindImpl; + /** * 根据每天的日期修改模板的状态 */ @@ -234,42 +240,6 @@ public class TimeChange { } - /** - * 定时定期提醒 - */ - @Scheduled(cron = "0 20 1 * * *") - public void changeDq() { - //定时提醒 - List list = jSmartRemindersService.lambdaQuery().eq(JSmartReminders::getAlertManner, 1).list(); - List listAdd = new ArrayList<>(); - //删除不在今天的定时提醒 - list.removeIf(x -> !(LocalDate.now().equals(x.getAlertTime().toLocalDate()))); - list.forEach(y -> { - if (y.getAlertRecipients() == 1) { - bmsEnterpriseBasicInfoService.list().forEach(x -> { - JSmartDeclaration sd = new JSmartDeclaration(); - sd.setAlertTime(y.getAlertTime()); - sd.setIsRead(1); - sd.setSmartRemindersId(y.getId()); - sd.setTyshxydm(x.getTyshxydm()); - listAdd.add(sd); - }); - } else if (y.getAlertRecipients() == 2) { - SysUser user = new SysUser(); - user.setUserType("02"); - sysUserMapper.selectUserList(user).forEach(x -> { - JSmartDeclaration sd = new JSmartDeclaration(); - sd.setIsRead(1); - sd.setAlertTime(y.getAlertTime()); - sd.setSmartRemindersId(y.getId()); - sd.setProjectId(y.getProjectId()); - sd.setZwId(x.getUserId()); - listAdd.add(sd); - }); - } - }); - jSmartDeclarationService.saveBatch(listAdd); - } /** * 定时不定期提醒 @@ -291,6 +261,12 @@ public class TimeChange { y.setSmartRemindersId(1L); y.setIsRead(1); y.setAlertTime(y.getEndTime().minusDays(qy.getDaysAdvance())); + if(y.getTyshxydm()!=null){ + if(isTiming){ + //发送短信 + timingRemindImpl.getContact(y.getTyshxydm(),"您有1个申报任务即将结束,请前往系统首页查看"); + } + } }); //可以优化 @@ -309,6 +285,9 @@ public class TimeChange { y.setProjectId(x.getId()); y.setZwId(o.getUserId()); bmsDeclarationRecords.add(y); + if(isTiming){ + smsAlertsService.enterSms("政府人员-" + o.getNickName(), "您有1个项目即将建设完成,请前往工作台查看。", o.getPhonenumber()); + } }); }); jSmartDeclarationService.saveBatch(bmsDeclarationRecords); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/service/impl/BmsDeclarationRecordsServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/service/impl/BmsDeclarationRecordsServiceImpl.java index f3f3ba8..6afd127 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/service/impl/BmsDeclarationRecordsServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/service/impl/BmsDeclarationRecordsServiceImpl.java @@ -8,9 +8,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.context.SecurityContextHolder; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.jjh.declaration.component.TimingRemindService; import com.ruoyi.jjh.declaration.entity.*; import com.ruoyi.jjh.declaration.entity.dto.*; -import com.ruoyi.jjh.ent.entity.JSmartDeclaration; import com.ruoyi.jjh.declaration.entity.vo.ApprovalDeclarationRecordsQueryVo; import com.ruoyi.jjh.declaration.entity.vo.BmsDeclarationRecordsQueryVo; import com.ruoyi.jjh.declaration.entity.vo.BmsMunicipalBureauReviewQueryVo; @@ -18,6 +18,7 @@ import com.ruoyi.jjh.declaration.entity.vo.DeclarationRecordsVo; import com.ruoyi.jjh.declaration.mapper.BmsDeclarationRecordsMapper; import com.ruoyi.jjh.declaration.service.*; import com.ruoyi.jjh.ent.entity.JProject; +import com.ruoyi.jjh.ent.entity.JSmartDeclaration; import com.ruoyi.jjh.ent.service.JProjectService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -25,7 +26,10 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; import java.util.stream.Collectors; @@ -123,6 +127,12 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl list = enterpriseDirectoryService.lambdaQuery().eq(BmsEnterpriseDirectory::getTemplateRecordId, bmsTemplateRecordAddDto.getId()).list(); + for (BmsEnterpriseDirectory x : list) { + timingRemindImpl.getContact(x.getCreditCode(),"您有1个新的申报任务[待填报]"); + } + } return num; } -// /** -// * 假如给该企业已经加了申报任务指定申报模板,就不能再给这个企业加该申报模板的申报任务(所有的企业) -// * -// * @param list -// */ -// private void judgement(List bm, List list) { -// List str1 = new ArrayList<>(); -// bm.forEach(x -> { -// list.forEach(y -> { -// if (Objects.equals(x.getEnterpriseId(), y.getId())) { -// str1.add(y.getEnterpriseName()); -// } -// }); -// }); -// throw new ServiceException(StringUtils.join(str1, ",") + "已经分配该模板任务"); -// } private void getDeclarationRecordsList(BmsTemplateRecord bmsTemplateRecordAddDto, List drlist, String creditCode, Long items) { BmsDeclarationRecords drItems = new BmsDeclarationRecords(); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/single/service/impl/SingleLoginServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/single/service/impl/SingleLoginServiceImpl.java index 1dd6b59..3d9a13e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/single/service/impl/SingleLoginServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/declaration/single/service/impl/SingleLoginServiceImpl.java @@ -12,7 +12,9 @@ import com.ruoyi.framework.manager.factory.AsyncFactory; import com.ruoyi.framework.security.context.AuthenticationContextHolder; import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.jjh.declaration.single.service.SingleLoginService; +import com.ruoyi.jjh.ent.service.SmsAlertsService; import com.ruoyi.system.service.ISysUserService; +import org.springframework.beans.factory.annotation.Value; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -29,6 +31,9 @@ import java.util.Map; @Service public class SingleLoginServiceImpl implements SingleLoginService { + @Resource + private SmsAlertsService smsAlertsService; + @Resource private AuthenticationManager authenticationManager; @@ -38,6 +43,9 @@ public class SingleLoginServiceImpl implements SingleLoginService { @Resource private ISysUserService userService; + @Value("${isTiming}") + private Boolean isTiming; + @Override public String singleLogin(String userName, String nickName, Long id, String userType,String phone) { // 用户验证 @@ -66,6 +74,11 @@ public class SingleLoginServiceImpl implements SingleLoginService { { user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); userService.insertUser(user); + if("02".equals(userType)&isTiming){ + if(user.getPhonenumber()!=null){ + smsAlertsService.addSsmPhone(user.getPhonenumber()); + } + } } //新增user账号密码 UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(userName, "admin123"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JDataScreenController.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JDataScreenController.java new file mode 100644 index 0000000..fd29308 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JDataScreenController.java @@ -0,0 +1,57 @@ +package com.ruoyi.jjh.ent.controller; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.jjh.ent.entity.response.HonorResponse; +import com.ruoyi.jjh.ent.entity.response.ProjectTrackingResponse; +import com.ruoyi.jjh.ent.service.JDataScreenService; +import com.ruoyi.jjh.ent.service.SmsAlertsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * 数据大屏控制层 + * + * @author du + * @since 2024/7/15 14:54 + */ +@RestController +@RequestMapping("/jjh/dataScreen") +@Api(tags = "数据大屏") +public class JDataScreenController extends BaseController { + + @Resource + private JDataScreenService jDataScreenService; + + @Resource + private SmsAlertsService sms; + /** + * 荣誉情况 + * @return 所有数据 + */ + @PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov')") + @ApiOperation(value = "荣誉情况") + @GetMapping("/honor") + public AjaxResult getHonor(HonorResponse a) { + return success(jDataScreenService.getHonor()); + } + + /** + * 项目追踪情况 + * @return 所有数据 + */ + @PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov')") + @ApiOperation(value = "项目追踪情况") + @GetMapping("/projectTracking") + public AjaxResult getProjectTracking(ProjectTrackingResponse a) { + return success(jDataScreenService.getProjectTracking()); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JEnterpriseContactController.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JEnterpriseContactController.java index 5496bce..f9ee72e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JEnterpriseContactController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JEnterpriseContactController.java @@ -8,8 +8,10 @@ import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.jjh.ent.entity.JEnterpriseContact; import com.ruoyi.jjh.ent.entity.request.JEnterpriseContactRequest; import com.ruoyi.jjh.ent.service.JEnterpriseContactService; +import com.ruoyi.jjh.ent.service.SmsAlertsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Value; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -31,6 +33,11 @@ public class JEnterpriseContactController extends BaseController { @Resource private JEnterpriseContactService jEnterpriseContactService; + @Value("${isTiming}") + private Boolean isTiming; + + @Resource + private SmsAlertsService smsAlertsService; /** * 分页查询所有数据 * @@ -87,6 +94,9 @@ public class JEnterpriseContactController extends BaseController { @ApiOperation(value = "新增数据") @PostMapping public AjaxResult insert(@RequestBody JEnterpriseContact jEnterpriseContact) { + if(isTiming){ + smsAlertsService.addSsmPhone(jEnterpriseContact.getContactPhone()); + } return success(jEnterpriseContactService.save(jEnterpriseContact)); } @@ -100,6 +110,9 @@ public class JEnterpriseContactController extends BaseController { @ApiOperation(value = "修改数据") @PostMapping("/edit") public AjaxResult update(@RequestBody JEnterpriseContact jEnterpriseContact) { + if(isTiming){ + smsAlertsService.addSsmPhone(jEnterpriseContact.getContactPhone()); + } return success(jEnterpriseContactService.updateById(jEnterpriseContact)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JSmartRemindersController.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JSmartRemindersController.java index 3f93d34..1f664f3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JSmartRemindersController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JSmartRemindersController.java @@ -4,16 +4,23 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.exception.job.TaskException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.jjh.declaration.regular.TimeChange; import com.ruoyi.jjh.ent.entity.JSmartDeclaration; import com.ruoyi.jjh.ent.entity.JSmartReminders; +import com.ruoyi.jjh.ent.entity.request.JAddJobSmart; import com.ruoyi.jjh.ent.entity.request.JSmartRemindersDq; import com.ruoyi.jjh.ent.entity.request.JSmartRemindersNDq; +import com.ruoyi.jjh.ent.mapper.JSmartRemindersMapper; import com.ruoyi.jjh.ent.service.JSmartDeclarationService; import com.ruoyi.jjh.ent.service.JSmartRemindersService; +import com.ruoyi.quartz.domain.SysJob; +import com.ruoyi.quartz.service.ISysJobService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.quartz.SchedulerException; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -35,6 +42,13 @@ public class JSmartRemindersController extends BaseController { @Resource private JSmartRemindersService jSmartRemindersService; + + @Autowired + private ISysJobService jobService; + + @Resource + private JSmartRemindersMapper jSmartRemindersMapper; + /** * 智能提醒关联表 */ @@ -45,18 +59,6 @@ public class JSmartRemindersController extends BaseController { @Resource private TimeChange timeChange; - /** - * 定时器更新定期提醒数据(暂存) - * - * @return 所有数据 - */ - @PreAuthorize("@ss.hasAnyRoles('admin')") - @ApiOperation(value = "定时器更新定期提醒数据(暂存)") - @GetMapping("/updateRegularReminders") - public AjaxResult updateRegularReminders() { - timeChange.changeDq(); - return success(); - } /** * 定时器更新不定期提醒数据(暂存) * @@ -167,10 +169,10 @@ public class JSmartRemindersController extends BaseController { * @param jSmartRemindersDq 实体对象 * @return 新增结果 */ - @PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov,ent')") + @PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov')") @ApiOperation(value = "新增定期提醒数据(政务端和企业端)") @PostMapping - public AjaxResult insertDs(@RequestBody @Valid JSmartRemindersDq jSmartRemindersDq) { + public AjaxResult insertDs(@RequestBody @Valid JSmartRemindersDq jSmartRemindersDq) throws SchedulerException, TaskException { if(jSmartRemindersDq.getProjectId()!=null){ jSmartRemindersDq.setAlertType(4); }else { @@ -189,7 +191,7 @@ public class JSmartRemindersController extends BaseController { @PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov')") @ApiOperation(value = "修改定期提醒数据") @PostMapping("/updateDq") - public AjaxResult updateDq(@RequestBody @Valid JSmartRemindersDq dq) { + public AjaxResult updateDq(@RequestBody @Valid JSmartRemindersDq dq) throws SchedulerException, TaskException { if(dq.getAlertType() == 1 || dq.getAlertType()==4){ return success(jSmartRemindersService.updateDq(dq)); }else { @@ -224,11 +226,17 @@ public class JSmartRemindersController extends BaseController { @PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov')") @ApiOperation(value = "删除数据") @PostMapping("/{id}") - public AjaxResult delete( @PathVariable Long id) { + public AjaxResult delete( @PathVariable Long id) throws SchedulerException { JSmartReminders js = jSmartRemindersService.getById(id); if (js.getAlertManner() == 2) { throw new ServiceException("不定期提醒不允许删除"); } + JAddJobSmart jAddJobSmart = jSmartRemindersMapper.selectJobSmart(id); + if(jAddJobSmart.getJobId()!=null){ + SysJob sysJob = new SysJob(); + sysJob.setJobId(jAddJobSmart.getJobId()); + jobService.deleteJob(sysJob); + } return success(jSmartRemindersService.removeById(id)); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/entity/request/JAddJobSmart.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/entity/request/JAddJobSmart.java new file mode 100644 index 0000000..69912b3 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/entity/request/JAddJobSmart.java @@ -0,0 +1,27 @@ +package com.ruoyi.jjh.ent.entity.request; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * 定时任务和定时提醒关联新增 + * @author du + * @since 2024/7/18 17:14 + */ +@Data +public class JAddJobSmart { + + /** + * 定时提醒id + */ + @ApiModelProperty("统一社会信用代码") + private Long smartId; + + /** + * 定时任务id + */ + @ApiModelProperty("统一社会信用代码") + private Long jobId; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/entity/response/HonorResponse.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/entity/response/HonorResponse.java new file mode 100644 index 0000000..2ef937e --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/entity/response/HonorResponse.java @@ -0,0 +1,77 @@ +package com.ruoyi.jjh.ent.entity.response; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 荣誉情况返回体 + * @author du + * @since 2024/7/15 15:04 + */ +@Data +@ApiModel("荣誉情况返回体") +public class HonorResponse { + + /** + * 项目大类名字 + */ + @ApiModelProperty("项目大类名字") + private String projectBigName; + + /** + * 项目大类 + */ + @ApiModelProperty("项目大类") + private Integer projectBigType; + + /** + * 大类数量 + */ + @ApiModelProperty("大类数量") + private Integer count1; + + /** + * 项目中类名字 + */ + @ApiModelProperty("项目中类名字") + private String projectMiddleName; + + + /** + * 项目中类 + */ + @ApiModelProperty("项目中类") + private Integer projectMiddleType; + + /** + * 中类数量 + */ + @ApiModelProperty("中类数量") + private Integer count2; + + /** + * 项目小类名字 + */ + @ApiModelProperty("项目小类名字") + private String projectSmallName; + + /** + * 项目小类 + */ + @ApiModelProperty("项目小类") + private Integer projectSmallType; + + /** + * 小类数量 + */ + @ApiModelProperty("小类数量") + private Integer count3; + + /** + * 当前年增加项目数量 + */ + @ApiModelProperty("当前年增加项目数量") + private Integer currentYearAdd; + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/entity/response/ProjectTrackingResponse.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/entity/response/ProjectTrackingResponse.java new file mode 100644 index 0000000..5ee9eea --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/entity/response/ProjectTrackingResponse.java @@ -0,0 +1,46 @@ +package com.ruoyi.jjh.ent.entity.response; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDate; + +/** + * 项目追踪情况返回体 + * @author du + * @since 2024/7/16 9:15 + */ +@Data +@ApiModel("项目追踪情况返回体") +public class ProjectTrackingResponse { + + + /** + * + */ + @ApiModelProperty("项目大类名字") + private String enterpriseDirectory; + + /** + * 填报开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "填报开始时间", width = 30, dateFormat = "yyyy-MM-dd") + private LocalDate startTime; + + /** + * 填报结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "填报结束时间", width = 30, dateFormat = "yyyy-MM-dd") + private LocalDate endTime; + + /** + * 数量 + */ + @ApiModelProperty("数量") + private Integer count; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/mapper/JDataScreenMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/mapper/JDataScreenMapper.java new file mode 100644 index 0000000..fc68477 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/mapper/JDataScreenMapper.java @@ -0,0 +1,29 @@ +package com.ruoyi.jjh.ent.mapper; + +import com.ruoyi.jjh.ent.entity.response.HonorResponse; +import com.ruoyi.jjh.ent.entity.response.ProjectTrackingResponse; + +import java.util.List; + +/** + * 数据大屏数据层 + * + * @author du + * @since 2024/7/15 13:57 + */ +public interface JDataScreenMapper { + + /** + * 荣誉情况 + * + * @return 所有数据 + */ + List getHonor(); + + /** + * 项目追踪情况 + * + * @return 所有数据 + */ + List getProjectTracking(); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/mapper/JSmartRemindersMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/mapper/JSmartRemindersMapper.java index 3b8f7f7..11a1888 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/mapper/JSmartRemindersMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/mapper/JSmartRemindersMapper.java @@ -3,6 +3,7 @@ package com.ruoyi.jjh.ent.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.jjh.ent.entity.JSmartReminders; +import com.ruoyi.jjh.ent.entity.request.JAddJobSmart; import org.apache.ibatis.annotations.Param; import java.io.Serializable; @@ -34,5 +35,15 @@ public interface JSmartRemindersMapper extends BaseMapper { * @return 单条数据 */ JSmartReminders selectOneSmart(Serializable id); + + /** + * 新增定时任务和定时提醒关联 + */ + void addJobSmart(@Param("req") JAddJobSmart s); + + /** + * 查询单条定时任务和定时提醒关联数据 + */ + JAddJobSmart selectJobSmart(Long smartId); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/JDataScreenService.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/JDataScreenService.java new file mode 100644 index 0000000..6721fc6 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/JDataScreenService.java @@ -0,0 +1,26 @@ +package com.ruoyi.jjh.ent.service; + +import com.ruoyi.jjh.ent.entity.response.HonorResponse; +import com.ruoyi.jjh.ent.entity.response.ProjectTrackingResponse; + +import java.util.List; + +/** + * 数据大屏业务层 + * @author du + * @since 2024/5/13 9:58 + */ +public interface JDataScreenService { + + /** + * 荣誉情况 + * @return 所有数据 + */ + List getHonor(); + + /** + * 项目追踪情况 + * @return 所有数据 + */ + List getProjectTracking(); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/JSmartRemindersService.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/JSmartRemindersService.java index be8088b..ec94dbb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/JSmartRemindersService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/JSmartRemindersService.java @@ -2,11 +2,14 @@ package com.ruoyi.jjh.ent.service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.exception.job.TaskException; import com.ruoyi.jjh.ent.entity.JSmartReminders; import com.ruoyi.jjh.ent.entity.request.JSmartRemindersDq; import com.ruoyi.jjh.ent.entity.request.JSmartRemindersNDq; +import org.quartz.SchedulerException; import java.io.Serializable; +import java.time.LocalDateTime; /** @@ -30,7 +33,18 @@ public interface JSmartRemindersService extends IService { * @param jSmartRemindersDq 实体对象 * @return 新增结果 */ - Long add(JSmartRemindersDq jSmartRemindersDq); + Long add(JSmartRemindersDq jSmartRemindersDq) throws SchedulerException, TaskException; + + /** + * 生成cron表达式 + * @return cron表达式 + */ + String generateCron(LocalDateTime time); + + /** + * 修改或者新增定时任务 + */ + void updateAndAdd(JSmartReminders s,Boolean a) throws SchedulerException, TaskException; /** * 修改定期提醒数据 @@ -38,7 +52,7 @@ public interface JSmartRemindersService extends IService { * @param dq 实体对象 * @return 修改结果 */ - Long updateDq(JSmartRemindersDq dq); + Long updateDq(JSmartRemindersDq dq) throws SchedulerException, TaskException; /** @@ -57,5 +71,6 @@ public interface JSmartRemindersService extends IService { * @return 单条数据 */ JSmartReminders selectOneSmart(Serializable id); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/SmsAlertsService.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/SmsAlertsService.java new file mode 100644 index 0000000..cb0b367 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/SmsAlertsService.java @@ -0,0 +1,31 @@ +package com.ruoyi.jjh.ent.service; + +import java.util.HashMap; + +/** + * 短信提醒业务层 + * @author du + * @since 2024/7/16 13:27 + */ +public interface SmsAlertsService { + + /** + * 生成短信接口统一的请求头 + * @return 请求头 + */ + HashMap getMap(); + + /** + * 发送短信 + * @param param1 + * @param param2 + * @return + */ + String enterSms(String param1,String param2,String numbers); + + /** + * 短信接收人号码新增 + * @return 所有数据 + */ + String addSsmPhone(String nums); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/impl/JDataScreenImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/impl/JDataScreenImpl.java new file mode 100644 index 0000000..5965807 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/impl/JDataScreenImpl.java @@ -0,0 +1,68 @@ +package com.ruoyi.jjh.ent.service.impl; + +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.jjh.declaration.entity.BmsFundingDetail; +import com.ruoyi.jjh.ent.entity.JProject; +import com.ruoyi.jjh.ent.entity.response.HonorResponse; +import com.ruoyi.jjh.ent.entity.response.ProjectTrackingResponse; +import com.ruoyi.jjh.ent.mapper.JDataScreenMapper; +import com.ruoyi.jjh.ent.service.JDataScreenService; +import com.ruoyi.jjh.ent.service.JProjectService; +import com.ruoyi.jjh.ent.service.SmsAlertsService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 数据大屏业务处理层 + * @author du + * @since 2024/5/13 9:58 + */ +@Service +public class JDataScreenImpl implements JDataScreenService { + + @Resource + private JDataScreenMapper jDataScreenMapper; + + @Resource + private JProjectService jProjectService; + + + + /** + * 荣誉情况 + * @return 所有数据 + */ + @Override + public List getHonor() { + int x = 0; + for (JProject jp : jProjectService.lambdaQuery().eq(JProject::getProjectMiddleType,4).list()) { + if("否".equals(JSONObject.parseObject(jp.getOtherJson()).get("是否通过2022年度“331”评价"))){ + x+=1; + } + } + List honor = jDataScreenMapper.getHonor(); + for (HonorResponse y : honor) { + if(y.getProjectBigType()==4){ + y.setCount1(y.getCount1()-x); + } + if(y.getProjectMiddleType()==4){ + y.setCount2(y.getCount2()-x); + } + if(y.getProjectSmallType()==6){ + y.setCount3(y.getCount3()-x); + } + } + return honor; + } + + /** + * 项目追踪情况 + * @return 所有数据 + */ + @Override + public List getProjectTracking() { + return jDataScreenMapper.getProjectTracking(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/impl/JSmartRemindersServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/impl/JSmartRemindersServiceImpl.java index d245689..842c9cd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/impl/JSmartRemindersServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/service/impl/JSmartRemindersServiceImpl.java @@ -4,17 +4,26 @@ import cn.hutool.core.bean.BeanUtil; 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.common.exception.job.TaskException; import com.ruoyi.jjh.declaration.service.IBmsDeclarationRecordsService; import com.ruoyi.jjh.ent.entity.JSmartReminders; +import com.ruoyi.jjh.ent.entity.request.JAddJobSmart; import com.ruoyi.jjh.ent.entity.request.JSmartRemindersDq; import com.ruoyi.jjh.ent.entity.request.JSmartRemindersNDq; import com.ruoyi.jjh.ent.mapper.JSmartRemindersMapper; import com.ruoyi.jjh.ent.service.JSmartRemindersService; +import com.ruoyi.quartz.domain.SysJob; +import com.ruoyi.quartz.service.ISysJobService; +import org.quartz.SchedulerException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.io.Serializable; import java.time.LocalDate; +import java.time.LocalDateTime; /** * 智能提醒(j_smart_reminders)表业务实现层 @@ -25,7 +34,11 @@ import java.time.LocalDate; @Service public class JSmartRemindersServiceImpl extends ServiceImpl implements JSmartRemindersService { + @Autowired + private ISysJobService jobService; + @Value("${isTiming}") + private Boolean isTiming; @Resource private IBmsDeclarationRecordsService bmsDeclarationRecordsService; @@ -47,21 +60,70 @@ public class JSmartRemindersServiceImpl extends ServiceImpl getMap() { + Digester sha256 = new Digester(DigestAlgorithm.SHA256); + String timestamp = String.valueOf(Instant.now().getEpochSecond()); + String str = RandomUtil.randomString(30); + //请求头 + HashMap headers = new HashMap<>();//存放请求头,可以存放多个请求头 + headers.put("x-tif-paasid", paaSID); + headers.put("x-tif-signature", sha256.digestHex(timestamp+smsToken+str+timestamp).toUpperCase()); + headers.put("x-tif-timestamp", timestamp); + headers.put("x-tif-nonce", str); + return headers; + } + + /** + * 发送短信 + * @param param1 + * @param param2 + * @return + */ + @Override + public String enterSms(String param1,String param2,String numbers) { + JSONObject jsonObject = new JSONObject();//存放参数 + //请求体 + JSONObject params = new JSONObject();//存放参数 + params.set("param1",param1); + params.set("param2",param2); + jsonObject.set("type", paramType); + jsonObject.set("empowerCode", smsV); + jsonObject.set("numbers", numbers); + jsonObject.set("params", params); + HttpResponse response = HttpRequest.post(smsSend) + .addHeaders(getMap()) + .body(jsonObject.toString()) + .execute(); + JSONObject jsonObj = JSONUtil.parseObj(response.body()); + return String.valueOf(jsonObj.get("msg")); + } + + + /** + * 短信接收人号码新增 + * @return 所有数据 + */ + @Override + public String addSsmPhone(String nums) { + Map js1 = new HashMap<>();//存放参数 + js1.put("orderId", code); + js1.put("nums", nums); + HttpResponse response = HttpRequest.post(smsPhoneAdd) + .addHeaders(getMap()) + .form(js1) + .execute(); + JSONObject jsonObj = JSONUtil.parseObj(response.body()); + return String.valueOf(jsonObj.get("msg")); + } +} diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 1b307af..c1d3ee8 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -88,4 +88,19 @@ server: #企业端单点登陆url url: https://qytt.sipac.gov.cn/api/usercenter/User/ssoLogin #企业端用户信息url -infoUrl: https://qytt.sipac.gov.cn/api/usercenter/User/getInfo \ No newline at end of file +infoUrl: https://qytt.sipac.gov.cn/api/usercenter/User/getInfo + +#短信发送接口 +smsSend: http://zwyyone.sipac.gov.cn/ebus/szyqznzs/dx +#短信接收人号码新增 +smsPhoneAdd: http://zwyyone.sipac.gov.cn/ebus/szyqznzs/dxhm +#测试类型 +paramType: cs +#测试授权码 +smsV: oVFPU1y1wYJIatvqrGoTAE5ycguUyjaY +#工单编号 +code: SC24071600001 +#PaaSID +paaSID: xdfwy +#短信token +smsToken: iM89cd4b0cGNVYAqKu7jl7EONyHgTa0N \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application-internet.yml b/ruoyi-admin/src/main/resources/application-internet.yml index c345617..235082b 100644 --- a/ruoyi-admin/src/main/resources/application-internet.yml +++ b/ruoyi-admin/src/main/resources/application-internet.yml @@ -117,4 +117,19 @@ isTiming: true #企业端单点登陆url url: https://qytt.sipac.gov.cn/api/usercenter/User/ssoLogin #企业端用户信息url -infoUrl: https://qytt.sipac.gov.cn/api/usercenter/User/getInfo \ No newline at end of file +infoUrl: https://qytt.sipac.gov.cn/api/usercenter/User/getInfo + +#短信发送接口 +smsSend: http://zwyyone.sipac.gov.cn/ebus/szyqznzs/dx +#短信接收人号码新增 +smsPhoneAdd: http://zwyyone.sipac.gov.cn/ebus/szyqznzs/dxhm +#测试类型 +paramType: zs +#测试授权码 +smsV: 3b3jaDmYcf87Mk7NqEmzis=3AaaFeYmV4DIf +#工单编号 +code: SC24071600001 +#PaaSID +paaSID: xdfwy +#短信token +smsToken: iM89cd4b0cGNVYAqKu7jl7EONyHgTa0N \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mapper/jjh/declaration/BmsDeclarationRecordsMapper.xml b/ruoyi-admin/src/main/resources/mapper/jjh/declaration/BmsDeclarationRecordsMapper.xml index fd2e43d..f7b302e 100644 --- a/ruoyi-admin/src/main/resources/mapper/jjh/declaration/BmsDeclarationRecordsMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/jjh/declaration/BmsDeclarationRecordsMapper.xml @@ -232,6 +232,7 @@ a.credit_code, b.id as enterpriseId, c.LEVEL, + c.project_small_type as projectSmallType, a.YEAR, a.template_record_id, a.template_id, diff --git a/ruoyi-admin/src/main/resources/mapper/jjh/ent/JDataScreenMapper.xml b/ruoyi-admin/src/main/resources/mapper/jjh/ent/JDataScreenMapper.xml new file mode 100644 index 0000000..8cda1dd --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/jjh/ent/JDataScreenMapper.xml @@ -0,0 +1,69 @@ + + + + + + + + diff --git a/ruoyi-admin/src/main/resources/mapper/jjh/ent/JSmartRemindersMapper.xml b/ruoyi-admin/src/main/resources/mapper/jjh/ent/JSmartRemindersMapper.xml index cd5e009..edf992a 100644 --- a/ruoyi-admin/src/main/resources/mapper/jjh/ent/JSmartRemindersMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/jjh/ent/JSmartRemindersMapper.xml @@ -4,6 +4,11 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + INSERT INTO sys_job_smart (smart_id, job_id) + VALUES (#{req.smartId}, #{req.jobId}); + + + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index 0ef86bf..325f204 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -172,7 +172,7 @@ public class Constants /** * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加) */ - public static final String[] JOB_WHITELIST_STR = { "com.ruoyi.quartz.task" }; + public static final String[] JOB_WHITELIST_STR = { "com.ruoyi.quartz.task","com.ruoyi.jjh.declaration.component" }; /** * 定时任务违规的字符 diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java index 77fdbb5..b381c8c 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java @@ -201,7 +201,7 @@ public class SysJobServiceImpl implements ISysJobService @Transactional(rollbackFor = Exception.class) public int insertJob(SysJob job) throws SchedulerException, TaskException { - job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); +// job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); int rows = jobMapper.insertJob(job); if (rows > 0) {