diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 42513e2..adf2ac0 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -16,6 +16,11 @@ + + cn.hutool + hutool-all + 5.8.23 + org.jsoup jsoup diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/component/TimingRemindImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/component/TimingRemindImpl.java new file mode 100644 index 0000000..741fad9 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/component/TimingRemindImpl.java @@ -0,0 +1,92 @@ +package com.ruoyi.docking.component; + +import cn.hutool.core.util.CreditCodeUtil; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.docking.entity.SmartDeclaration; +import com.ruoyi.docking.service.SmartDeclarationService; +import com.ruoyi.system.mapper.SysUserMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 企业或者政务自定义定时提醒组件 + * + * @author du + * @since 2024/7/18 9:55 + */ +@Service("timingRemind") +public class TimingRemindImpl implements TimingRemindService { + + private static final Logger log = LoggerFactory.getLogger(TimingRemindImpl.class); + /** + * 智能提醒关联表 + */ + @Resource + private SmartDeclarationService smartDeclarationService; + + /** + * 人员 + */ + @Resource + private SysUserMapper sysUserMapper; + + + /** + * 企业端要定时新增数据,并且还要发短信 + */ + public void enterpriseTiming(String t, Long id) { + //模拟企业人员数据 + //给所有的企业都要添加一条智能提醒数据 + List allEnterprise = new ArrayList<>(); + allEnterprise.add("9144030071526726XG"); + List listAdd = new ArrayList<>(); + allEnterprise.forEach(x -> { + SmartDeclaration sd = new SmartDeclaration(); + sd.setAlertTime(LocalDateTime.parse(t)); + sd.setIsRead(1); + sd.setSmartRemindersId(id); + sd.setTyshxydm(x); + listAdd.add(sd); + }); + smartDeclarationService.saveBatch(listAdd); + log.info("提醒成功!"); + } + + + /** + * 政务端要定时新增数据,并且还要发短信 + */ + public void chiefTiming(String t, Long id, String pid) { + List listAdd = new ArrayList<>(); + //给所有政务人员发通知和短信 + //添加用户进表的时候手机号已经经过处理 + SysUser user = new SysUser(); + List sysUsers = sysUserMapper.selectUserList(user); + //获取到所有的符合条件的政务用户 + List collect = sysUsers.stream().filter(x -> "0".equals(x.getDelFlag()) && "0".equals(x.getStatus())) + .filter(y -> !CreditCodeUtil.isCreditCode(y.getUserName())) + .collect(Collectors.toList()); + for (SysUser x : collect) { + SmartDeclaration sd = new SmartDeclaration(); + 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()); + listAdd.add(sd); + } + smartDeclarationService.saveBatch(listAdd); + log.info("提醒成功!"); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/component/TimingRemindService.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/component/TimingRemindService.java new file mode 100644 index 0000000..1fdf450 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/component/TimingRemindService.java @@ -0,0 +1,20 @@ +package com.ruoyi.docking.component; + +/** + * 企业或者政务自定义定时提醒组件 + * + * @author du + * @since 2024/7/19 9:50 + */ +public interface TimingRemindService { + + /** + * 企业端要定时新增数据 + */ + void enterpriseTiming(String t, Long id); + + /** + * 政务端要定时新增数据 + */ + void chiefTiming(String t, Long id, String pid); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/controller/SmartRemindersController.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/controller/SmartRemindersController.java new file mode 100644 index 0000000..00f7123 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/controller/SmartRemindersController.java @@ -0,0 +1,155 @@ +package com.ruoyi.docking.controller; + +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.docking.component.TimingRemindService; +import com.ruoyi.docking.entity.SmartReminders; +import com.ruoyi.docking.entity.request.JAddJobSmart; +import com.ruoyi.docking.entity.request.SREnterRequest; +import com.ruoyi.docking.entity.request.SmartRemindersPageRequest; +import com.ruoyi.docking.service.SmartRemindersService; +import com.ruoyi.gysl.regular.NoticeTiming; +import com.ruoyi.gysl.service.NoticeService; +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.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.io.Serializable; + +/** + * 智能提醒(j_smart_reminders)表控制层 + * + * @author du + * @since 2024/7/1 13:33 + */ +@RestController +@RequestMapping("/gysl/jSmartReminders") +@Api(tags = "智能提醒") +public class SmartRemindersController extends BaseController { + + @Resource + private SmartRemindersService smartRemindersService; + + + @Autowired + private ISysJobService jobService; + + @Resource + private NoticeTiming noticeService; + + /** + * 定时器更新不定期提醒数据(暂存) + * + * @return 所有数据 + */ +// @PreAuthorize("@ss.hasAnyRoles('admin')") + @ApiOperation(value = "定时器更新不定期提醒数据(暂存)") + @GetMapping("/updateNoRegularReminders") + public AjaxResult updateNoRegularReminders() { + noticeService.changeNdq(); + return success(); + } + + /** + * 分页查询智能提醒规则数据 + * + * @param page 分页对象 + * @param smartReminders 查询实体 + * @return 所有数据 + */ +// @PreAuthorize("@ss.hasAnyRoles('admin,common')") + @ApiOperation(value = "分页查询智能提醒规则数据", response = SmartReminders.class) + @GetMapping + public AjaxResult selectAll(Page page, SmartRemindersPageRequest smartReminders) { + return success(smartRemindersService.page(page, smartReminders)); + } + + /** + * 通过主键查询单条智能提醒规则数据 + * + * @param id 主键 + * @return 单条数据 + */ +// @PreAuthorize("@ss.hasAnyRoles('admin,common')") + @ApiOperation(value = "通过主键查询单条智能提醒规则数据", response = SmartReminders.class) + @GetMapping("/{id}") + public AjaxResult selectOneSmart(@PathVariable Serializable id) { + return success(smartRemindersService.getById(id)); + } + + /** + * 新增定期提醒数据(政务端和企业端) + * + * @param jSmartRemindersDq 实体对象 + * @return 新增结果 + */ +// @PreAuthorize("@ss.hasAnyRoles('admin,common')") + @ApiOperation(value = "新增定期提醒") + @PostMapping("/add") + public AjaxResult insertDs(@RequestBody @Valid SREnterRequest jSmartRemindersDq) throws SchedulerException, TaskException { + if (jSmartRemindersDq.getProjectId() != null) { + jSmartRemindersDq.setAlertType(4); + } else { + jSmartRemindersDq.setAlertType(1); + } + return success(smartRemindersService.add(jSmartRemindersDq)); + } + + /** + * 修改定期提醒数据和不定期提醒数据 + * + * @param dq 实体对象 + * @return 修改结果 + */ +// @PreAuthorize("@ss.hasAnyRoles('admin,common')") + @ApiOperation(value = "修改定期提醒数据和不定期提醒数据") + @PostMapping("/updateDq") + public AjaxResult updateDq(@RequestBody @Valid SmartReminders dq) throws SchedulerException, TaskException { + if (dq.getAlertType() == 2 || dq.getAlertType() == 3) { + if (dq.getAlertManner() == 1) { + smartRemindersService.updateAndAdd(dq,false); + }else { + throw new ServiceException("参数错误!"); + } + }else { + if (dq.getAlertManner() == 2) { + smartRemindersService.updateById(dq); + }else { + throw new ServiceException("参数错误!"); + } + } + return success(); + } + + /** + * 删除数据 + * + * @param id 主键结合 + * @return 删除结果 + */ +// @PreAuthorize("@ss.hasAnyRoles('admin,common')") + @ApiOperation(value = "删除数据") + @PostMapping("/delete/{id}") + public AjaxResult delete(@PathVariable Long id) throws SchedulerException { + SmartReminders js = smartRemindersService.getById(id); + if (js.getAlertManner() == 2) { + throw new ServiceException("不定期提醒不允许删除"); + } + JAddJobSmart jAddJobSmart = smartRemindersService.selectJobSmart(id); + if (jAddJobSmart.getJobId() != null) { + SysJob sysJob = new SysJob(); + sysJob.setJobId(jAddJobSmart.getJobId()); + jobService.deleteJob(sysJob); + } + return success(smartRemindersService.removeById(id)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/SmartDeclaration.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/SmartDeclaration.java new file mode 100644 index 0000000..2e52fd7 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/SmartDeclaration.java @@ -0,0 +1,60 @@ +package com.ruoyi.docking.entity; + + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * 智能提醒关联表(SmartDeclaration)表实体类 + * + * @author makejava + * @since 2025-03-31 14:57:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("smart_declaration") +@ApiModel(value="智能提醒关联表",description = "智能提醒") +public class SmartDeclaration { + + @TableId(value = "id", type = IdType.AUTO) + @ApiModelProperty("Id") + private Long id; + + + @ApiModelProperty(value ="智能提醒id" ) + private Long smartRemindersId; + + + @ApiModelProperty(value ="1未读 2已读" ) + private Integer isRead; + + + @ApiModelProperty(value ="统一社会信用代码" ) + private String tyshxydm; + + + @ApiModelProperty(value ="项目id" ) + private Long projectId; + + + @ApiModelProperty(value ="提醒时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime alertTime; + + + @ApiModelProperty(value ="政务用户id" ) + private Long zwId; +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/SmartReminders.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/SmartReminders.java new file mode 100644 index 0000000..140c724 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/SmartReminders.java @@ -0,0 +1,88 @@ +package com.ruoyi.docking.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.gysl.entity.baseModel.BaseModel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 智能提醒(smart_reminders)表实体类 + * + * @author du + * @since 2024/7/1 13:33 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@ApiModel("智能提醒") +@TableName(value = "smart_reminders") +public class SmartReminders extends BaseModel implements Serializable { + + /** + * Id + */ + @TableId(value = "id", type = IdType.AUTO) + @ApiModelProperty("Id") + private Long id; + + /** + * 提醒名称 + */ + @ApiModelProperty("提醒名称") + private String rulesName; + + + /** + * 提醒对象 1.企业用户 2政务用户 + */ + @ApiModelProperty("提醒对象 1.企业用户 2政务用户") + private Integer alertRecipients; + + /** + * 提醒方式 1.定时提醒 2.不定时提醒 + */ + @ApiModelProperty("提醒方式 1.定期提醒 2.不定期提醒") + private Integer alertManner; + + /** + * 提醒时间 + */ + @ApiModelProperty("提醒时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime alertTime; + + /** + * 提醒分类 1.全局自定义通知 2.项目即将结束(企业) 3.项目即将建设完成(政务) 4.项目自定义通知 + */ + @ApiModelProperty("提醒分类 1.全局自定义通知 2.项目即将结束(企业) 3.项目即将建设完成(政务) 4.项目自定义通知") + private Integer alertType; + + /** + * 提前天数提醒 + */ + @ApiModelProperty("提前天数提醒") + private Integer daysAdvance; + + /** + * 项目id + */ + @ApiModelProperty("项目id") + private Long projectId; + + + /** + * 提醒内容 + */ + @ApiModelProperty("提醒内容") + private String alertContent; + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/request/JAddJobSmart.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/request/JAddJobSmart.java new file mode 100644 index 0000000..7d75ad2 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/request/JAddJobSmart.java @@ -0,0 +1,26 @@ +package com.ruoyi.docking.entity.request; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 定时任务和定时提醒关联新增 + * + * @author du + * @since 2024/7/18 17:14 + */ +@Data +public class JAddJobSmart { + + /** + * 定时提醒id + */ + @ApiModelProperty("定时提醒id") + private Long smartId; + + /** + * 定时任务id + */ + @ApiModelProperty("定时任务id") + private Long jobId; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/request/SREnterRequest.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/request/SREnterRequest.java new file mode 100644 index 0000000..e2f2b70 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/request/SREnterRequest.java @@ -0,0 +1,55 @@ +package com.ruoyi.docking.entity.request; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +/** + * 新增定期提醒数据 + * @author du + * @since 2025/3/31 11:01 + */ +@Data +public class SREnterRequest { + + /** + * 提醒名称 + */ + @ApiModelProperty("提醒名称") + private String rulesName; + + /** + * 提醒对象 1.企业用户 2政务用户 + */ + @ApiModelProperty("提醒对象 1.企业用户 2政务用户") + private Integer alertRecipients; + + /** + * 提醒时间 + */ + @ApiModelProperty("提醒时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime alertTime; + + /** + * 提醒分类 1.全局自定义通知 2.申报任务即将结束(企业) 3.项目即将建设完成(政务) 4.项目自定义通知 + */ + @ApiModelProperty("提醒分类 1.全局自定义通知 2.申报任务即将结束(企业) 3.项目即将建设完成(政务) 4.项目自定义通知") + private Integer alertType; + + /** + * 项目id 非必传 + */ + @ApiModelProperty("项目id 非必传") + private Long projectId; + + /** + * 提醒内容 + */ + @ApiModelProperty("提醒内容") + private String alertContent; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/request/SmartRemindersPageRequest.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/request/SmartRemindersPageRequest.java new file mode 100644 index 0000000..11c5935 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/entity/request/SmartRemindersPageRequest.java @@ -0,0 +1,25 @@ +package com.ruoyi.docking.entity.request; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 智能提醒分页请求类 + * @author du + * @since 2025/3/31 10:33 + */ +@Data +public class SmartRemindersPageRequest { + + /** + * 提醒名称 + */ + @ApiModelProperty("提醒名称") + private String rulesName; + + /** + * 提醒分类 1.全局自定义通知 2.项目即将结束(企业) 3.项目即将建设完成(政务) 4.项目自定义通知 + */ + @ApiModelProperty("提醒分类 1.全局自定义通知 2.项目即将结束(企业) 3.项目即将建设完成(政务) 4.项目自定义通知") + private Integer alertType; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/mapper/SmartDeclarationMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/mapper/SmartDeclarationMapper.java new file mode 100644 index 0000000..326190a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/mapper/SmartDeclarationMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.docking.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.docking.entity.SmartDeclaration; + +/** + * 智能提醒关联表(SmartDeclaration)表数据库访问层 + * + * @author makejava + * @since 2025-03-31 14:57:53 + */ +public interface SmartDeclarationMapper extends BaseMapper { + +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/mapper/SmartRemindersMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/mapper/SmartRemindersMapper.java new file mode 100644 index 0000000..e650119 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/mapper/SmartRemindersMapper.java @@ -0,0 +1,38 @@ +package com.ruoyi.docking.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.docking.entity.SmartReminders; +import com.ruoyi.docking.entity.request.JAddJobSmart; +import com.ruoyi.docking.entity.request.SmartRemindersPageRequest; +import org.apache.ibatis.annotations.Param; + +/** + * 智能提醒(j_smart_reminders)表数据访问层 + * + * @author makejava + * @since 2024-03-25 11:49:34 + */ +public interface SmartRemindersMapper extends BaseMapper { + + /** + * 分页查询所有数据 + * + * @param page 分页对象 + * @param smartReminders 查询实体 + * @return 所有数据 + */ + Page page(Page page, @Param("req") SmartRemindersPageRequest smartReminders); + + /** + * 新增数据到定时任务与定时提醒关联表 + */ + void addJobSmart(@Param("req") JAddJobSmart ja); + + + /** + * 根据智能提醒id查询定时任务 + */ + JAddJobSmart selectJobSmart(@Param("id") Long id); +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/service/SmartDeclarationService.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/service/SmartDeclarationService.java new file mode 100644 index 0000000..6c23846 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/service/SmartDeclarationService.java @@ -0,0 +1,15 @@ +package com.ruoyi.docking.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.docking.entity.SmartDeclaration; + +/** + * 智能提醒关联表(SmartDeclaration)表服务接口 + * + * @author makejava + * @since 2025-03-31 14:57:57 + */ +public interface SmartDeclarationService extends IService { + +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/service/SmartRemindersService.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/service/SmartRemindersService.java new file mode 100644 index 0000000..d35509d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/service/SmartRemindersService.java @@ -0,0 +1,56 @@ +package com.ruoyi.docking.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.docking.entity.SmartReminders; +import com.ruoyi.docking.entity.request.JAddJobSmart; +import com.ruoyi.docking.entity.request.SREnterRequest; +import com.ruoyi.docking.entity.request.SmartRemindersPageRequest; +import org.quartz.SchedulerException; + +import java.time.LocalDateTime; + + +/** + * 智能提醒(j_smart_reminders)表业务层 + * + * @author du + * @since 2024/7/1 13:33 + */ +public interface SmartRemindersService extends IService { + /** + * 分页查询所有数据 + * + * @param page 分页对象 + * @param smartReminders 查询实体 + * @return 所有数据 + */ + Page page(Page page, SmartRemindersPageRequest smartReminders); + + /** + * 生成cron表达式 + * + * @return cron表达式 + */ + String generateCron(LocalDateTime time); + + /** + * 新增定期提醒数据(政务端和企业端) + * + * @param jSmartRemindersDq 实体对象 + * @return 新增结果 + */ + Long add(SREnterRequest jSmartRemindersDq) throws SchedulerException, TaskException; + + /** + * 修改定期提醒或者不定期提醒数据(政务端) + */ + void updateAndAdd(SmartReminders jSmartReminders, Boolean flag) throws SchedulerException, TaskException; + + /** + * 根据智能提醒id查询定时任务 + */ + JAddJobSmart selectJobSmart(Long id); +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/service/impl/SmartDeclarationServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/service/impl/SmartDeclarationServiceImpl.java new file mode 100644 index 0000000..544eb77 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/service/impl/SmartDeclarationServiceImpl.java @@ -0,0 +1,19 @@ +package com.ruoyi.docking.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.docking.mapper.SmartDeclarationMapper; +import com.ruoyi.docking.entity.SmartDeclaration; +import com.ruoyi.docking.service.SmartDeclarationService; +import org.springframework.stereotype.Service; + +/** + * 智能提醒关联表(SmartDeclaration)表服务实现类 + * + * @author makejava + * @since 2025-03-31 14:57:57 + */ +@Service("smartDeclarationService") +public class SmartDeclarationServiceImpl extends ServiceImpl implements SmartDeclarationService { + +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/docking/service/impl/SmartRemindersServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/docking/service/impl/SmartRemindersServiceImpl.java new file mode 100644 index 0000000..f7dd554 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/docking/service/impl/SmartRemindersServiceImpl.java @@ -0,0 +1,133 @@ +package com.ruoyi.docking.service.impl; + +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.constant.ScheduleConstants; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.exception.job.TaskException; +import com.ruoyi.docking.entity.SmartReminders; +import com.ruoyi.docking.entity.request.JAddJobSmart; +import com.ruoyi.docking.entity.request.SREnterRequest; +import com.ruoyi.docking.entity.request.SmartRemindersPageRequest; +import com.ruoyi.docking.mapper.SmartRemindersMapper; +import com.ruoyi.docking.service.SmartRemindersService; +import com.ruoyi.quartz.domain.SysJob; +import com.ruoyi.quartz.service.ISysJobService; +import org.quartz.SchedulerException; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDateTime; + +/** + * 智能提醒(j_smart_reminders)表业务实现层 + * + * @author du + * @since 2024/7/1 13:33 + */ +@Service +public class SmartRemindersServiceImpl extends ServiceImpl implements SmartRemindersService { + + @Resource + private ISysJobService jobService; + + + /** + * 分页查询所有数据 + * + * @param page 分页对象 + * @param smartReminders 查询实体 + * @return 所有数据 + */ + @Override + public Page page(Page page, SmartRemindersPageRequest smartReminders) { + return baseMapper.page(page, smartReminders); + } + + /** + * 生成cron表达式 + * + * @return cron表达式 + */ + @Override + public String generateCron(LocalDateTime localDateTime) { + int second = 0; // 固定为0秒 + int minute = localDateTime.getMinute(); + int hour = localDateTime.getHour(); + int dayOfMonth = localDateTime.getDayOfMonth(); + int month = localDateTime.getMonthValue(); + String dayOfWeek = "?"; + // 构造 Cron 表达式 + return String.format("%d %d %d %d %d %s", + second, minute, hour, dayOfMonth, month, dayOfWeek); + } + + + /** + * 新增定期提醒数据(政务端和企业端) + * + * @param srEnterRequest 实体对象 + * @return 新增结果 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public Long add(SREnterRequest srEnterRequest) throws SchedulerException, TaskException { + LocalDateTime nt = LocalDateTime.now().plusMinutes(5); + if (srEnterRequest.getAlertTime().isBefore(nt)) { + throw new ServiceException("提醒时间必须在当前时间5分钟后!"); + } + //新增定期提醒到智能提醒 + SmartReminders sr = new SmartReminders(); + BeanUtil.copyProperties(srEnterRequest, sr); + sr.setAlertManner(1); + save(sr); + updateAndAdd(sr,true); + return sr.getId(); + } + + /** + * 修改或者新增定时任务 + */ + @Override + public void updateAndAdd(SmartReminders jSmartReminders, Boolean flag) throws SchedulerException, TaskException { + SysJob sysJob = new SysJob(); + sysJob.setConcurrent("1");//不允许并发执行 + sysJob.setCronExpression(generateCron(jSmartReminders.getAlertTime()));//生成cron表达式 + if (jSmartReminders.getAlertRecipients() == 1) { + //如果是企业的定时提醒(调用这个方法) + sysJob.setInvokeTarget("timingRemind.enterpriseTiming(" + "'" + jSmartReminders.getAlertTime() + "'" + "," + jSmartReminders.getId() + "L" + ")"); + } else { + //如果是政务端的定时提醒 + sysJob.setInvokeTarget("timingRemind.chiefTiming(" + "'" + jSmartReminders.getAlertTime() + "'" + "," + jSmartReminders.getId() + "L," + "'" + jSmartReminders.getProjectId() + "'" + ")"); + } + sysJob.setJobGroup("DEFAULT"); + sysJob.setJobName(jSmartReminders.getRulesName()); + sysJob.setMisfirePolicy("3"); + sysJob.setStatus(ScheduleConstants.Status.NORMAL.getValue()); + if (flag) { + //新增定时任务 + jobService.insertJob(sysJob); + JAddJobSmart ja = new JAddJobSmart(); + ja.setSmartId(jSmartReminders.getId()); + ja.setJobId(sysJob.getJobId()); + //新增定时任务和智能提醒关联数据 + baseMapper.addJobSmart(ja); + } else { + //修改 + JAddJobSmart jAddJobSmart = baseMapper.selectJobSmart(jSmartReminders.getId()); + sysJob.setJobId(jAddJobSmart.getJobId()); + jobService.updateJob(sysJob); + } + } + + /** + * 根据智能提醒id查询定时任务 + */ + @Override + public JAddJobSmart selectJobSmart(Long id) { + return baseMapper.selectJobSmart(id); + } +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/EnterpriseController.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/EnterpriseController.java index 60566af..3e02cd3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/EnterpriseController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/EnterpriseController.java @@ -1,32 +1,34 @@ package com.ruoyi.gysl.controller; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.utils.poi.ExcelUtil; import com.ruoyi.gysl.entity.Enterprise; +import com.ruoyi.gysl.entity.request.ZwIdPageReq; import com.ruoyi.gysl.service.EnterpriseService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; import java.io.Serializable; import java.util.List; /** - * 企业基本信息(Enterprise)表控制层 + * 入驻企业基本信息(Enterprise)表控制层 * * @author makejava * @since 2025-02-24 11:26:49 */ -@Api(tags = "企业基本信息") +@Api(tags = "入驻企业") @RestController @RequestMapping("/gysl/enterprise") -@PreAuthorize("@ss.hasAnyRoles('admin,common')") public class EnterpriseController extends BaseController { /** * 服务对象 @@ -35,16 +37,16 @@ public class EnterpriseController extends BaseController { private EnterpriseService enterpriseService; /** - * 分页查询所有数据 + * 根据项目id分页查询入驻企业 * * @param page 分页对象 * @param enterprise 查询实体 * @return 所有数据 */ @GetMapping("/page") - @ApiOperation(value = "分页查询所有数据",response =Enterprise.class ) - public AjaxResult selectAll(Page page, Enterprise enterprise) { - return success(enterpriseService.page(page, new QueryWrapper<>(enterprise))); + @ApiOperation(value = "根据项目id分页查询入驻企业", response = Enterprise.class) + public AjaxResult selectAll(Page page, ZwIdPageReq enterprise) { + return success(enterpriseService.page(page, enterprise)); } /** @@ -54,22 +56,11 @@ public class EnterpriseController extends BaseController { * @return 单条数据 */ @GetMapping("{id}") - @ApiOperation(value = "通过主键查询单条数据",response =Enterprise.class ) + @ApiOperation(value = "通过主键查询单条数据", response = Enterprise.class) public AjaxResult selectOne(@PathVariable Serializable id) { return success(enterpriseService.getById(id)); } - /** - * 新增数据 - * - * @param enterprise 实体对象 - * @return 新增结果 - */ - @PostMapping("/add") - @ApiOperation("新增数据") - public AjaxResult insert(@RequestBody Enterprise enterprise) { - return success(enterpriseService.save(enterprise)); - } /** * 修改数据 @@ -94,5 +85,36 @@ public class EnterpriseController extends BaseController { public AjaxResult delete(@RequestParam("idList") List idList) { return success(enterpriseService.removeByIds(idList)); } + + /** + * 导入入驻企业信息 + */ + @ApiOperation(value = "导入入驻企业信息") + @PostMapping(value = "/importEnterprise", consumes = "multipart/form-data") + public AjaxResult importTemplateProject(@RequestPart("file") MultipartFile file, @RequestParam Long xmId) throws Exception { + ExcelUtil util = new ExcelUtil<>(Enterprise.class); + List proList = util.importExcel(file.getInputStream()); + StringBuilder successMsg = new StringBuilder(); + if (proList == null || proList.isEmpty()) { + throw new ServiceException("入驻企业信息数据不能为空"); + } else { + proList.forEach(x->{ + x.setXmId(xmId); + }); + enterpriseService.saveBatch(proList); + successMsg.append("导入成功"); + } + return AjaxResult.success(successMsg); + } + + /** + * 模板信息 + */ + @ApiOperation("导出基本信息模板") + @PostMapping("/importTemplate") + public void importTemplate(HttpServletResponse response) { + ExcelUtil util = new ExcelUtil<>(Enterprise.class); + util.importTemplateExcel(response, "企业模板"); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/XmpjqdController.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/XmpjqdController.java index 632dd22..bbdf9ca 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/XmpjqdController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/XmpjqdController.java @@ -24,7 +24,7 @@ import java.util.List; * @author makejava * @since 2025-03-22 09:22:33 */ -@Api(tags ="项目评价清单" ) +@Api(tags ="项目评价清单(包括详情页)" ) @RestController @RequestMapping("/gysl/xmpjqd") @PreAuthorize("@ss.hasAnyRoles('admin,common')") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/entity/BasicInformation.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/entity/BasicInformation.java index 4b205b5..49f7230 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/entity/BasicInformation.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/entity/BasicInformation.java @@ -14,6 +14,7 @@ import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; import java.math.BigDecimal; +import java.time.LocalDate; import java.util.Date; /** @@ -81,13 +82,13 @@ public class BasicInformation extends BaseModel { @Excel(name = "建设开始时间", dateFormat = "yyyy-MM-dd", sort = 5) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8") @DateTimeFormat(pattern = "yyyy-MM-dd") - private Date begainTime; + private LocalDate begainTime; @ApiModelProperty("建设结束时间") @Excel(name = "建设结束时间", dateFormat = "yyyy-MM-dd", sort = 6) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8") @DateTimeFormat(pattern = "yyyy-MM-dd") - private Date endTime; + private LocalDate endTime; @NotBlank @Excel(name = "现状分类", sort = 3, dictType = "xzfl", comboReadDict = true) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/entity/Enterprise.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/entity/Enterprise.java index 1a372b9..eaf54ee 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/entity/Enterprise.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/entity/Enterprise.java @@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.gysl.entity.baseModel.BaseModel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -15,7 +17,7 @@ import java.io.Serializable; import java.time.LocalDateTime; /** - * 企业基本信息(Enterprise)实体类 + * 入驻企业基本信息(Enterprise)实体类 * * @author makejava * @since 2025-02-24 11:26:49 @@ -23,8 +25,8 @@ import java.time.LocalDateTime; @Data @EqualsAndHashCode(callSuper = false) @TableName("enterprise") -@ApiModel(value = "Enterprise", description = "企业基本信息") -public class Enterprise implements Serializable { +@ApiModel(value = "Enterprise", description = "入驻企业基本信息") +public class Enterprise extends BaseModel implements Serializable { /** @@ -32,20 +34,21 @@ public class Enterprise implements Serializable { */ @ApiModelProperty(value = "主键id") @TableId(value = "id", type = IdType.AUTO) - private Integer id; + private Long id; /** * 项目id */ @ApiModelProperty(value = "项目id") @TableField("xm_id") - private Integer xmId; + private Long xmId; /** * 企业名称 */ @ApiModelProperty(value = "企业名称") @TableField("name") + @Excel(name = "企业名称") private String name; /** @@ -53,6 +56,7 @@ public class Enterprise implements Serializable { */ @ApiModelProperty(value = "统一社会信用代码") @TableField("code") + @Excel(name = "统一社会信用代码") private String code; /** @@ -60,6 +64,7 @@ public class Enterprise implements Serializable { */ @ApiModelProperty(value = "所属行业 ") @TableField("sshy") + @Excel(name = "所属行业") private String sshy; /** @@ -67,51 +72,6 @@ public class Enterprise implements Serializable { */ @ApiModelProperty(value = "租金价格") @TableField("zjjg") + @Excel(name = "租金价格") private Integer zjjg; - - /** - * 创建者id - */ - @ApiModelProperty(value = "创建者id") - @TableField("create_id") - private Integer createId; - - /** - * 创建时间 - */ - @ApiModelProperty(value = "创建时间") - @TableField("create_time") - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - /** - * 创建者 - */ - @ApiModelProperty(value = "创建者") - @TableField("create_by") - private String createBy; - - /** - * 更新者ID - */ - @ApiModelProperty(value = "更新者ID") - @TableField("update_id") - private Long updateId; - - /** - * 更新者 - */ - @ApiModelProperty(value = "更新者") - @TableField("update_by") - private String updateBy; - - /** - * 更新时间 - */ - @ApiModelProperty(value = "更新时间") - @TableField("update_time") - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/entity/Xfcygl.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/entity/Xfcygl.java index a9315f3..3e0ef82 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/entity/Xfcygl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/entity/Xfcygl.java @@ -20,7 +20,7 @@ import java.io.Serializable; */ @EqualsAndHashCode(callSuper = true) @Data -@TableName("xmpjqd") +@TableName("xfcygl") public class Xfcygl extends BaseModel implements Serializable { @ApiModelProperty(value = "主键id") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/mapper/EnterpriseMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/mapper/EnterpriseMapper.java index 3a8293a..d0286d3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/mapper/EnterpriseMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/mapper/EnterpriseMapper.java @@ -1,7 +1,10 @@ package com.ruoyi.gysl.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.gysl.entity.Enterprise; +import com.ruoyi.gysl.entity.request.ZwIdPageReq; +import org.apache.ibatis.annotations.Param; /** * 企业基本信息(Enterprise)表数据库访问层 @@ -11,5 +14,13 @@ import com.ruoyi.gysl.entity.Enterprise; */ public interface EnterpriseMapper extends BaseMapper { + /** + * 根据项目id分页查询入驻企业 + * + * @param page 分页对象 + * @param req 查询实体 + * @return 所有数据 + */ + Page page(Page page,@Param("req") ZwIdPageReq req); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/regular/NoticeTiming.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/regular/NoticeTiming.java index 2b2a69a..e3ad58b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/regular/NoticeTiming.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/regular/NoticeTiming.java @@ -1,26 +1,36 @@ package com.ruoyi.gysl.regular; -import com.ruoyi.docking.entity.Project; -import com.ruoyi.docking.entity.ProjectProgress; +import cn.hutool.core.util.CreditCodeUtil; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.docking.entity.SmartDeclaration; +import com.ruoyi.docking.entity.SmartReminders; import com.ruoyi.docking.service.ProjectProgressService; import com.ruoyi.docking.service.ProjectService; -import com.ruoyi.gysl.entity.Notice; +import com.ruoyi.docking.service.SmartDeclarationService; +import com.ruoyi.docking.service.SmartRemindersService; +import com.ruoyi.gysl.entity.BasicInformation; +import com.ruoyi.gysl.service.BasicInformationService; import com.ruoyi.gysl.service.NoticeService; +import com.ruoyi.system.mapper.SysUserMapper; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.time.LocalDate; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * 每月固定时间定时任务 * @author du * @since 2025/3/23 16:35 */ -@Configuration -@EnableScheduling +//@Configuration +//@EnableScheduling + @Component public class NoticeTiming { @Resource @@ -32,33 +42,91 @@ public class NoticeTiming { @Resource private ProjectService projectService; + @Resource + private SmartRemindersService smartRemindersService; + + @Resource + private SmartDeclarationService smartDeclarationService; + + @Resource + private BasicInformationService basicInformationService; + + /** + * 人员 + */ + @Resource + private SysUserMapper sysUserMapper; /** * 每个月固定发一次政务通知 */ - @Scheduled(cron = "0 0 0 1 * ?") - private void configureTasks() { - Notice notice = new Notice(); - notice.setType(1); - notice.setContent(LocalDate.now().getYear() + - "年"+ - LocalDate.now().getMonth().getValue()+ - "月"+ - "项目进展未填写"); - noticeService.save(notice); - } +// @Scheduled(cron = "0 0 0 1 * ?") +// private void configureTasks() { +// Notice notice = new Notice(); +// notice.setType(1); +// notice.setContent(LocalDate.now().getYear() + +// "年"+ +// LocalDate.now().getMonth().getValue()+ +// "月"+ +// "项目进展未填写"); +// noticeService.save(notice); +// } /** * 每个月1号的2点进行上个月的项目月度信息查询并进行新增 */ - @Scheduled(cron = "0 0 2 1 * ?") // 每月1号 2:00:00 执行 - private void changeProgress() { - List pList = projectProgressService.djList(); - //修改该progressId为空 - pList.forEach(x-> x.setProgressId(null)); - //批量新增 - projectProgressService.saveBatch(pList); +// @Scheduled(cron = "0 0 2 1 * ?") // 每月1号 2:00:00 执行 +// private void changeProgress() { +// List pList = projectProgressService.djList(); +// //修改该progressId为空 +// pList.forEach(x-> x.setProgressId(null)); +// //批量新增 +// projectProgressService.saveBatch(pList); +// +// List pjList = projectService.djList(); +// projectService.saveBatch(pjList); +// } + /** + * 定时不定期提醒 + */ +// @Scheduled(cron = "0 40 1 * * *") + public void changeNdq() { + //获取企业的不定时提醒 + SmartReminders qy = smartRemindersService.getById(1); + //获取政务的不定时提醒 + SmartReminders zw = smartRemindersService.getById(2); + List smdList =new ArrayList<>(); + //获取所有的项目 + List list = basicInformationService.list(); + List list1 = basicInformationService.list(); + //如果当前时间在该项目的结束时间前自定义的提前天数之前,就去掉 + list.removeIf(x -> + !(LocalDate.now().equals(x.getEndTime().minusDays(qy.getDaysAdvance()))) + ); + list.forEach(x->{ + SmartDeclaration smartDeclaration = new SmartDeclaration(); + smartDeclaration.setSmartRemindersId(1L); + smartDeclaration.setTyshxydm(x.getTyshxydm()); + smartDeclaration.setAlertTime(x.getEndTime().atStartOfDay()); + smdList.add(smartDeclaration); + }); + list1.removeIf(x -> + !(LocalDate.now().equals(x.getEndTime().minusDays(zw.getDaysAdvance()))) + ); + //获取到所有的符合条件的政务用户 - List pjList = projectService.djList(); - projectService.saveBatch(pjList); + List sysUsers = sysUserMapper.selectUserList(new SysUser()); + List collect = sysUsers.stream().filter(x -> "0".equals(x.getDelFlag()) && "0".equals(x.getStatus())) + .filter(y -> !CreditCodeUtil.isCreditCode(y.getUserName())) + .collect(Collectors.toList()); + list1.forEach(x->{ + for (SysUser y : collect) { + SmartDeclaration sd = new SmartDeclaration(); + sd.setAlertTime(x.getEndTime().atStartOfDay()); + sd.setSmartRemindersId(2L); + sd.setZwId(y.getUserId()); + smdList.add(sd); + } + }); + smartDeclarationService.saveBatch(smdList); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/EnterpriseService.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/EnterpriseService.java index 0c7d9b8..d805447 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/EnterpriseService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/EnterpriseService.java @@ -1,7 +1,9 @@ package com.ruoyi.gysl.service; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.gysl.entity.Enterprise; +import com.ruoyi.gysl.entity.request.ZwIdPageReq; /** * 企业基本信息(Enterprise)表服务接口 @@ -11,5 +13,14 @@ import com.ruoyi.gysl.entity.Enterprise; */ public interface EnterpriseService extends IService { + + /** + * 根据项目id分页查询入驻企业 + * + * @param page 分页对象 + * @param req 查询实体 + * @return 所有数据 + */ + Page page(Page page, ZwIdPageReq req); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/EnterpriseServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/EnterpriseServiceImpl.java index c8826e0..5778a26 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/EnterpriseServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/EnterpriseServiceImpl.java @@ -1,6 +1,8 @@ package com.ruoyi.gysl.service.impl; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.gysl.entity.request.ZwIdPageReq; import com.ruoyi.gysl.mapper.EnterpriseMapper; import com.ruoyi.gysl.entity.Enterprise; import com.ruoyi.gysl.service.EnterpriseService; @@ -15,5 +17,17 @@ import org.springframework.stereotype.Service; @Service("enterpriseService") public class EnterpriseServiceImpl extends ServiceImpl implements EnterpriseService { + + /** + * 根据项目id分页查询入驻企业 + * + * @param page 分页对象 + * @param req 查询实体 + * @return 所有数据 + */ + @Override + public Page page(Page page, ZwIdPageReq req) { + return baseMapper.page(page,req); + } } diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 019a6eb..35a6a96 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -95,7 +95,7 @@ token: # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) - expireTime: 30 + expireTime: 60 # MyBatis配置 mybatis-plus: diff --git a/ruoyi-admin/src/main/resources/mapper/EnterpriseMapper.xml b/ruoyi-admin/src/main/resources/mapper/EnterpriseMapper.xml new file mode 100644 index 0000000..d9bf7a5 --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/EnterpriseMapper.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/ruoyi-admin/src/main/resources/mapper/SmartDeclarationMapper.xml b/ruoyi-admin/src/main/resources/mapper/SmartDeclarationMapper.xml new file mode 100644 index 0000000..49ad742 --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/SmartDeclarationMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + insert into gysl.smart_declaration(smart_reminders_idis_readtyshxydmproject_idalert_timezw_id) + values + + (#{entity.smartRemindersId}#{entity.isRead}#{entity.tyshxydm}#{entity.projectId}#{entity.alertTime}#{entity.zwId}) + + + + + insert into gysl.smart_declaration(smart_reminders_idis_readtyshxydmproject_idalert_timezw_id) + values + + (#{entity.smartRemindersId}#{entity.isRead}#{entity.tyshxydm}#{entity.projectId}#{entity.alertTime}#{entity.zwId}) + + on duplicate key update +smart_reminders_id = values(smart_reminders_id) is_read = values(is_read) tyshxydm = values(tyshxydm) project_id = values(project_id) alert_time = values(alert_time) zw_id = values(zw_id) + + + diff --git a/ruoyi-admin/src/main/resources/mapper/SmartRemindersMapper.xml b/ruoyi-admin/src/main/resources/mapper/SmartRemindersMapper.xml new file mode 100644 index 0000000..b8c083b --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/SmartRemindersMapper.xml @@ -0,0 +1,25 @@ + + + + + + insert into job_smart (smart_id,job_id) values (#{req.smartId},#{req.jobId}) + + + diff --git a/ruoyi-admin/src/main/resources/mapper/ZwStatsMapper.xml b/ruoyi-admin/src/main/resources/mapper/ZwStatsMapper.xml index 77e277c..f73017e 100644 --- a/ruoyi-admin/src/main/resources/mapper/ZwStatsMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/ZwStatsMapper.xml @@ -41,11 +41,11 @@ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java index a685e06..71f90c3 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java @@ -1,12 +1,5 @@ package com.ruoyi.common.core.controller; -import java.beans.PropertyEditorSupport; -import java.util.Date; -import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.ruoyi.common.constant.HttpStatus; @@ -20,6 +13,14 @@ import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.sql.SqlUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; + +import java.beans.PropertyEditorSupport; +import java.util.Date; +import java.util.List; /** * web层通用数据处理