杜函宇 1 month ago
parent 1785e1238b
commit 04bca1e9a1

@ -16,6 +16,11 @@
</description>
<dependencies>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.23</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>

@ -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<String> allEnterprise = new ArrayList<>();
allEnterprise.add("9144030071526726XG");
List<SmartDeclaration> 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<SmartDeclaration> listAdd = new ArrayList<>();
//给所有政务人员发通知和短信
//添加用户进表的时候手机号已经经过处理
SysUser user = new SysUser();
List<SysUser> sysUsers = sysUserMapper.selectUserList(user);
//获取到所有的符合条件的政务用户
List<SysUser> 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("提醒成功!");
}
}

@ -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);
}

@ -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<SmartReminders> 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));
}
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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<SmartDeclaration> {
}

@ -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<SmartReminders> {
/**
*
*
* @param page
* @param smartReminders
* @return
*/
Page<SmartReminders> page(Page<SmartReminders> page, @Param("req") SmartRemindersPageRequest smartReminders);
/**
*
*/
void addJobSmart(@Param("req") JAddJobSmart ja);
/**
* id
*/
JAddJobSmart selectJobSmart(@Param("id") Long id);
}

@ -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<SmartDeclaration> {
}

@ -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<SmartReminders> {
/**
*
*
* @param page
* @param smartReminders
* @return
*/
Page<SmartReminders> page(Page<SmartReminders> 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);
}

@ -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<SmartDeclarationMapper, SmartDeclaration> implements SmartDeclarationService {
}

@ -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<SmartRemindersMapper, SmartReminders> implements SmartRemindersService {
@Resource
private ISysJobService jobService;
/**
*
*
* @param page
* @param smartReminders
* @return
*/
@Override
public Page<SmartReminders> page(Page<SmartReminders> 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);
}
}

@ -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<Enterprise> page, Enterprise enterprise) {
return success(enterpriseService.page(page, new QueryWrapper<>(enterprise)));
@ApiOperation(value = "根据项目id分页查询入驻企业", response = Enterprise.class)
public AjaxResult selectAll(Page<Enterprise> 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<Long> 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<Enterprise> util = new ExcelUtil<>(Enterprise.class);
List<Enterprise> 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<Enterprise> util = new ExcelUtil<>(Enterprise.class);
util.importTemplateExcel(response, "企业模板");
}
}

@ -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')")

@ -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)

@ -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;
}

@ -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")

@ -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<Enterprise> {
/**
* id
*
* @param page
* @param req
* @return
*/
Page<Enterprise> page(Page<Enterprise> page,@Param("req") ZwIdPageReq req);
}

@ -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);
// }
/**
* 12
*/
@Scheduled(cron = "0 0 2 1 * ?") // 每月1号 2:00:00 执行
private void changeProgress() {
List<ProjectProgress> 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<ProjectProgress> pList = projectProgressService.djList();
// //修改该progressId为空
// pList.forEach(x-> x.setProgressId(null));
// //批量新增
// projectProgressService.saveBatch(pList);
//
// List<Project> 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<SmartDeclaration> smdList =new ArrayList<>();
//获取所有的项目
List<BasicInformation> list = basicInformationService.list();
List<BasicInformation> 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<Project> pjList = projectService.djList();
projectService.saveBatch(pjList);
List<SysUser> sysUsers = sysUserMapper.selectUserList(new SysUser());
List<SysUser> 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);
}
}

@ -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<Enterprise> {
/**
* id
*
* @param page
* @param req
* @return
*/
Page<Enterprise> page(Page<Enterprise> page, ZwIdPageReq req);
}

@ -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<EnterpriseMapper, Enterprise> implements EnterpriseService {
/**
* id
*
* @param page
* @param req
* @return
*/
@Override
public Page<Enterprise> page(Page<Enterprise> page, ZwIdPageReq req) {
return baseMapper.page(page,req);
}
}

@ -95,7 +95,7 @@ token:
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟
expireTime: 30
expireTime: 60
# MyBatis配置
mybatis-plus:

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.gysl.mapper.EnterpriseMapper">
<select id="page" resultType="com.ruoyi.gysl.entity.Enterprise">
select * from enterprise
<where>
<if test="req.xmId != null and req.xmId != ''">
AND xm_id = #{req.xmId}
</if>
</where>
</select>
</mapper>

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.docking.mapper.SmartDeclarationMapper">
<resultMap type="com.ruoyi.docking.entity.SmartDeclaration" id="SmartDeclarationMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="smartRemindersId" column="smart_reminders_id" jdbcType="INTEGER"/>
<result property="isRead" column="is_read" jdbcType="INTEGER"/>
<result property="tyshxydm" column="tyshxydm" jdbcType="VARCHAR"/>
<result property="projectId" column="project_id" jdbcType="INTEGER"/>
<result property="alertTime" column="alert_time" jdbcType="TIMESTAMP"/>
<result property="zwId" column="zw_id" jdbcType="INTEGER"/>
</resultMap>
<!-- 批量插入 -->
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into gysl.smart_declaration(smart_reminders_idis_readtyshxydmproject_idalert_timezw_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.smartRemindersId}#{entity.isRead}#{entity.tyshxydm}#{entity.projectId}#{entity.alertTime}#{entity.zwId})
</foreach>
</insert>
<!-- 批量插入或按主键更新 -->
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into gysl.smart_declaration(smart_reminders_idis_readtyshxydmproject_idalert_timezw_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.smartRemindersId}#{entity.isRead}#{entity.tyshxydm}#{entity.projectId}#{entity.alertTime}#{entity.zwId})
</foreach>
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) </insert>
</mapper>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.docking.mapper.SmartRemindersMapper">
<select id="page" resultType="com.ruoyi.docking.entity.SmartReminders">
select a.*
from smart_reminders a
<where>
<if test="req.rulesName != null and req.rulesName != '' ">
and a.rules_name = #{req.rulesName}
</if>
<if test="req.alertType != null and req.alertType != '' ">
and a.alert_type = #{req.alertType}
</if>
</where>
order by a.create_time desc
</select>
<insert id="addJobSmart">
insert into job_smart (smart_id,job_id) values (#{req.smartId},#{req.jobId})
</insert>
<select id="selectJobSmart" resultType="com.ruoyi.docking.entity.request.JAddJobSmart">
select * from job_smart where smart_id = #{id}
</select>
</mapper>

@ -41,11 +41,11 @@
</select>
<select id="zwNotice" resultType="com.ruoyi.gysl.entity.Notice">
select * from notice
where type = 1
where type = 1 and is_read = 0
</select>
<select id="zwNoticeCount" resultType="java.lang.Integer">
select count(*) from notice
where type = 1
where type = 1 and is_read = 0
</select>
</mapper>

@ -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

Loading…
Cancel
Save