@@ -0,0 +1,14 @@ | |||||
package com.ningdatech.kqapi.scheduler.contants; | |||||
/** | |||||
* @author PoffyZhang | |||||
* @Classname TaskContant | |||||
* @Description | |||||
* @Date 2023/1/18 11:00 | |||||
*/ | |||||
public interface TaskContant { | |||||
public static final String DEV = "dev"; | |||||
public static final String PRE = "pre"; | |||||
public static final String PROD = "prod"; | |||||
} |
@@ -0,0 +1,51 @@ | |||||
package com.ningdatech.kqapi.scheduler.controller; | |||||
import com.ningdatech.kqapi.scheduler.manage.SynManage; | |||||
import com.ningdatech.kqapi.scheduler.task.RemoveMattersTask; | |||||
import com.ningdatech.kqapi.zzsfw.entity.vo.MatterTopVO; | |||||
import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO; | |||||
import com.ningdatech.kqapi.zzsfw.manage.MatterManage; | |||||
import io.swagger.annotations.Api; | |||||
import io.swagger.annotations.ApiOperation; | |||||
import lombok.RequiredArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.validation.annotation.Validated; | |||||
import org.springframework.web.bind.annotation.GetMapping; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
import java.net.UnknownHostException; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author ZPF | |||||
* @since 2023-10-27 | |||||
*/ | |||||
@Slf4j | |||||
@Validated | |||||
@RestController | |||||
@RequestMapping("/api/v1/task/") | |||||
@Api(value = "TaskController", tags = "柯桥-定时控制器") | |||||
@RequiredArgsConstructor | |||||
public class TaskController { | |||||
private final RemoveMattersTask removeMattersTask; | |||||
private final SynManage synManage; | |||||
@ApiOperation(value = "主动调删除数据", notes = "主动调删除数据") | |||||
@GetMapping("/remove-matters") | |||||
public void removeMatters() throws UnknownHostException { | |||||
removeMattersTask.doTask(); | |||||
} | |||||
@ApiOperation(value = "主动同步三表", notes = "主动同步三表") | |||||
@GetMapping("/syn-data") | |||||
public void synData() throws UnknownHostException { | |||||
synManage.synData(); | |||||
} | |||||
} |
@@ -0,0 +1,71 @@ | |||||
package com.ningdatech.kqapi.scheduler.manage; | |||||
import cn.hutool.core.bean.BeanUtil; | |||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.alibaba.fastjson.JSON; | |||||
import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMattersDeduplicateDTO; | |||||
import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMenuDTO; | |||||
import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwPolicyDTO; | |||||
import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMattersDeduplicate; | |||||
import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMenu; | |||||
import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwPolicy; | |||||
import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwMatterDeduplicateService; | |||||
import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwMenuService; | |||||
import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwPolicyService; | |||||
import lombok.RequiredArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.http.ResponseEntity; | |||||
import org.springframework.stereotype.Component; | |||||
import org.springframework.web.client.RestTemplate; | |||||
import java.util.List; | |||||
/** | |||||
* @Classname SynManage | |||||
* @Description | |||||
* @Date 2023/12/20 15:18 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
@Component | |||||
@Slf4j | |||||
@RequiredArgsConstructor | |||||
public class SynManage { | |||||
private final INdKqZzsfwMatterDeduplicateService deduplicateService; | |||||
private final INdKqZzsfwMenuService menuService; | |||||
private final INdKqZzsfwPolicyService policyService; | |||||
private final RestTemplate restTemplate; | |||||
public void synData() { | |||||
log.info("同步数据开始"); | |||||
//1.去重数据 | |||||
List<NdKqZzsfwMattersDeduplicate> dups = deduplicateService.list(); | |||||
for(NdKqZzsfwMattersDeduplicate dup : dups){ | |||||
NdKqZzsfwMattersDeduplicateDTO dto = BeanUtil.copyProperties(dup,NdKqZzsfwMattersDeduplicateDTO.class); | |||||
ResponseEntity<String> stringResponseEntity = restTemplate.postForEntity( | |||||
"localhost:33061/kq/api/v1/zzsfw/save-dup", dto, String.class); | |||||
log.info("结果:{}", JSON.toJSONString(stringResponseEntity)); | |||||
} | |||||
//2.菜单数据 | |||||
List<NdKqZzsfwMenu> menus = menuService.list(); | |||||
for(NdKqZzsfwMenu menu : menus){ | |||||
NdKqZzsfwMenuDTO dto = BeanUtil.copyProperties(menu,NdKqZzsfwMenuDTO.class); | |||||
ResponseEntity<String> stringResponseEntity = restTemplate.postForEntity( | |||||
"localhost:33061/kq/api/v1/zzsfw/save", dto, String.class); | |||||
log.info("结果:{}", JSON.toJSONString(stringResponseEntity)); | |||||
} | |||||
//3.其它数据 | |||||
List<NdKqZzsfwPolicy> policies = policyService.list(); | |||||
for(NdKqZzsfwPolicy policy : policies){ | |||||
NdKqZzsfwPolicyDTO dto = BeanUtil.copyProperties(policy,NdKqZzsfwPolicyDTO.class); | |||||
ResponseEntity<String> stringResponseEntity = restTemplate.postForEntity( | |||||
"localhost:33061/kq/api/v1/poclicy/save", dto, String.class); | |||||
log.info("结果:{}", JSON.toJSONString(stringResponseEntity)); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,63 @@ | |||||
package com.ningdatech.kqapi.scheduler.task; | |||||
import cn.hutool.core.date.StopWatch; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.kqapi.scheduler.contants.TaskContant; | |||||
import com.ningdatech.kqapi.zzsfw.entity.entity.DscSxAdsShareItemQltQlsxCommonIDVKq; | |||||
import com.ningdatech.kqapi.zzsfw.service.IDscSxAdsShareItemQltQlsxCommonIDVKqService; | |||||
import lombok.RequiredArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.beans.factory.annotation.Value; | |||||
import org.springframework.scheduling.annotation.Scheduled; | |||||
import org.springframework.stereotype.Component; | |||||
import java.net.InetAddress; | |||||
import java.net.UnknownHostException; | |||||
/** | |||||
* @author ZPF | |||||
* @since 2023/08/31 18:16 | |||||
*/ | |||||
@Component | |||||
@Slf4j | |||||
@RequiredArgsConstructor | |||||
public class RemoveMattersTask { | |||||
@Value("${hostname}") | |||||
public String HOST; | |||||
@Value("${spring.profiles.active}") | |||||
public String active; | |||||
@Autowired | |||||
private IDscSxAdsShareItemQltQlsxCommonIDVKqService kqService; | |||||
/** | |||||
* 每天 | |||||
*/ | |||||
@Scheduled(cron = "0 0 10 * * ?") | |||||
public void doTask() throws UnknownHostException { | |||||
if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { | |||||
log.info("定时器没开启或者host不对! {}:{}", | |||||
HOST,InetAddress.getLocalHost().getHostName()); | |||||
return; | |||||
} | |||||
if(!TaskContant.PROD.equals(active)){ | |||||
log.info("非正式环境不用删除!"); | |||||
return; | |||||
} | |||||
StopWatch stopWatch = new StopWatch(); | |||||
stopWatch.start(); | |||||
log.info("删除事项表 所有数据 等待新数据推上来"); | |||||
// if(kqService.remove(Wrappers.lambdaQuery(DscSxAdsShareItemQltQlsxCommonIDVKq.class))){ | |||||
// log.info("删除成功"); | |||||
// } | |||||
log.info("当前表里还有数据 :{}条",kqService.count()); | |||||
stopWatch.stop(); | |||||
log.info("数据同步任务结束====={}s",stopWatch.getTotalTimeSeconds()); | |||||
} | |||||
} |
@@ -0,0 +1,43 @@ | |||||
package com.ningdatech.kqapi.scheduler.task.model; | |||||
import lombok.Data; | |||||
@Data | |||||
public class CommonLog { | |||||
/** | |||||
* 用户id | |||||
*/ | |||||
private String userId; | |||||
/** | |||||
* 用户角色(群众、企业、政府工作人员、第三方) | |||||
*/ | |||||
private String userRole; | |||||
/** | |||||
* 地区编码 | |||||
*/ | |||||
private String areaCode; | |||||
/** | |||||
* 操作类型(1-登录 2-离开 3-办事开始 4-办事结束) | |||||
*/ | |||||
private Integer actionType; | |||||
/** | |||||
* 操作标识 | |||||
*/ | |||||
private String actionId; | |||||
/** | |||||
* 操作时间 | |||||
*/ | |||||
private String actionTime; | |||||
/** | |||||
* 操作时长 | |||||
*/ | |||||
private Long actionDuration; | |||||
/** | |||||
* 操作状态(0-成功 1-失败) | |||||
*/ | |||||
private Integer actionStatus; | |||||
/** | |||||
* 应用编码 | |||||
*/ | |||||
private String appCode; | |||||
} |
@@ -0,0 +1,37 @@ | |||||
package com.ningdatech.kqapi.scheduler.utils; | |||||
import java.time.LocalDateTime; | |||||
import java.time.ZoneId; | |||||
import java.util.Calendar; | |||||
import java.util.Date; | |||||
import java.util.Objects; | |||||
/** | |||||
* @Classname DateUtil | |||||
* @Description | |||||
* @Date 2023/8/31 15:36 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
public class DateUtil { | |||||
public static Date getTodayTime(int hour){ | |||||
// 获取当前日期时间 | |||||
Calendar calendar = Calendar.getInstance(); | |||||
// 将时间设置为凌晨 | |||||
calendar.set(Calendar.HOUR_OF_DAY, hour); | |||||
calendar.set(Calendar.MINUTE, 0); | |||||
calendar.set(Calendar.SECOND, 0); | |||||
// 获取凌晨时间 | |||||
Date date = calendar.getTime(); | |||||
return date; | |||||
} | |||||
public static LocalDateTime convertDateToLocal(Date date){ | |||||
if(Objects.isNull(date)){ | |||||
return null; | |||||
} | |||||
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); | |||||
} | |||||
} |
@@ -2,6 +2,8 @@ package com.ningdatech.kqapi.zzsfw.controller; | |||||
import com.ningdatech.basic.model.ApiResponse; | import com.ningdatech.basic.model.ApiResponse; | ||||
import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMattersDeduplicateDTO; | |||||
import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMenuDTO; | |||||
import com.ningdatech.kqapi.zzsfw.entity.vo.MatterTopVO; | import com.ningdatech.kqapi.zzsfw.entity.vo.MatterTopVO; | ||||
import com.ningdatech.kqapi.zzsfw.entity.vo.MattersVO; | import com.ningdatech.kqapi.zzsfw.entity.vo.MattersVO; | ||||
import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO; | import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO; | ||||
@@ -11,9 +13,7 @@ import io.swagger.annotations.ApiOperation; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||
import org.springframework.web.bind.annotation.GetMapping; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
import org.springframework.web.bind.annotation.*; | |||||
import java.util.List; | import java.util.List; | ||||
@@ -45,4 +45,28 @@ public class NdKqZzsfwMenuController { | |||||
public List<MatterTopVO> topTen() { | public List<MatterTopVO> topTen() { | ||||
return matterManage.topTen(); | return matterManage.topTen(); | ||||
} | } | ||||
@ApiOperation(value = "政务事项数据保存", notes = "政务事项数据保存") | |||||
@PostMapping("/save") | |||||
public String save(@RequestBody NdKqZzsfwMenuDTO dto) { | |||||
return matterManage.save(dto); | |||||
} | |||||
@ApiOperation(value = "政务事项数据清空", notes = "政务事项数据清空") | |||||
@GetMapping("/remove-all") | |||||
public String removeAll() { | |||||
return matterManage.removeAll(); | |||||
} | |||||
@ApiOperation(value = "政务事项去重保存", notes = "政务事项去重保存") | |||||
@PostMapping("/save-dup") | |||||
public String saveDup(@RequestBody NdKqZzsfwMattersDeduplicateDTO dto) { | |||||
return matterManage.saveDup(dto); | |||||
} | |||||
@ApiOperation(value = "政务事项数据清空", notes = "政务事项数据清空") | |||||
@GetMapping("/remove-all-dup") | |||||
public String removeAllDup() { | |||||
return matterManage.removeAllDup(); | |||||
} | |||||
} | } |
@@ -1,6 +1,7 @@ | |||||
package com.ningdatech.kqapi.zzsfw.controller; | package com.ningdatech.kqapi.zzsfw.controller; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwPolicyDTO; | |||||
import com.ningdatech.kqapi.zzsfw.entity.vo.NdKqZzsfwPolicyVO; | import com.ningdatech.kqapi.zzsfw.entity.vo.NdKqZzsfwPolicyVO; | ||||
import com.ningdatech.kqapi.zzsfw.manage.PolicyManage; | import com.ningdatech.kqapi.zzsfw.manage.PolicyManage; | ||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
@@ -8,10 +9,7 @@ import io.swagger.annotations.ApiOperation; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||
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 org.springframework.web.bind.annotation.*; | |||||
/** | /** | ||||
* @Classname PolicyRegulationsController | * @Classname PolicyRegulationsController | ||||
@@ -33,4 +31,16 @@ public class PolicyRegulationsController { | |||||
public PageVo<NdKqZzsfwPolicyVO> list(@RequestParam(defaultValue = "1") long pageNumber, @RequestParam(defaultValue = "10") long pageSize) { | public PageVo<NdKqZzsfwPolicyVO> list(@RequestParam(defaultValue = "1") long pageNumber, @RequestParam(defaultValue = "10") long pageSize) { | ||||
return policyManage.list(pageNumber,pageSize); | return policyManage.list(pageNumber,pageSize); | ||||
} | } | ||||
@ApiOperation(value = "政策条例保存", notes = "政策条例保存") | |||||
@PostMapping("/save") | |||||
public String save(@RequestBody NdKqZzsfwPolicyDTO dto) { | |||||
return policyManage.save(dto); | |||||
} | |||||
@ApiOperation(value = "政务事项数据清空", notes = "政务事项数据清空") | |||||
@GetMapping("/remove-all") | |||||
public String removeAll() { | |||||
return policyManage.removeAll(); | |||||
} | |||||
} | } |
@@ -0,0 +1,35 @@ | |||||
package com.ningdatech.kqapi.zzsfw.entity.dto; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author ZPF | |||||
* @since 2023-10-27 | |||||
*/ | |||||
@Data | |||||
@ApiModel(value = "NdKqZzsfwMattersDeduplicate", description = "") | |||||
public class NdKqZzsfwMattersDeduplicateDTO implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty("数据同步时间") | |||||
private LocalDateTime createOn; | |||||
@ApiModelProperty("事项名称") | |||||
private String qlName; | |||||
@ApiModelProperty("链接") | |||||
private String webapplyurl; | |||||
@ApiModelProperty("重复数") | |||||
private Integer countNum; | |||||
} |
@@ -0,0 +1,50 @@ | |||||
package com.ningdatech.kqapi.zzsfw.entity.dto; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author ZPF | |||||
* @since 2023-10-27 | |||||
*/ | |||||
@Data | |||||
@ApiModel(value = "NdKqZzsfwMenu对象", description = "") | |||||
public class NdKqZzsfwMenuDTO implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty("数据同步时间") | |||||
private LocalDateTime createOn; | |||||
@ApiModelProperty("社区名") | |||||
private String zoneName; | |||||
@ApiModelProperty("窗口") | |||||
private String window; | |||||
@ApiModelProperty("部门") | |||||
private String department; | |||||
@ApiModelProperty("事项名称") | |||||
private String itemName; | |||||
@ApiModelProperty("事项在政务中心的rowid") | |||||
private String itemRowid; | |||||
@ApiModelProperty("排序") | |||||
private Integer sort; | |||||
@ApiModelProperty("链接") | |||||
private String webapplyurl; | |||||
@ApiModelProperty("是否在政务中心查到url") | |||||
private Integer hasUrl; | |||||
} |
@@ -0,0 +1,56 @@ | |||||
package com.ningdatech.kqapi.zzsfw.entity.dto; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author ZPF | |||||
* @since 2023-11-02 | |||||
*/ | |||||
@Data | |||||
@ApiModel(value = "NdKqZzsfwPolicyDTO", description = "") | |||||
public class NdKqZzsfwPolicyDTO implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty("数据同步时间") | |||||
private LocalDateTime createOn; | |||||
@ApiModelProperty("抬头") | |||||
private String header; | |||||
@ApiModelProperty("标题") | |||||
private String title; | |||||
@ApiModelProperty("二级标题") | |||||
private String secondTitle; | |||||
@ApiModelProperty("适用地区") | |||||
private String regionName; | |||||
@ApiModelProperty("责任部门") | |||||
private String department; | |||||
@ApiModelProperty("发文日期") | |||||
private String issueDate; | |||||
@ApiModelProperty("状态") | |||||
private String status; | |||||
@ApiModelProperty("申报时间") | |||||
private String applyTime; | |||||
@ApiModelProperty("在线咨询url") | |||||
private String onlineConsultationUrl; | |||||
@ApiModelProperty("排序") | |||||
private Integer sort; | |||||
} |
@@ -5,8 +5,11 @@ import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.ningdatech.kqapi.common.enumeration.CommonEnum; | import com.ningdatech.kqapi.common.enumeration.CommonEnum; | ||||
import com.ningdatech.kqapi.zzsfw.constants.ZzsfwMenuConstant; | import com.ningdatech.kqapi.zzsfw.constants.ZzsfwMenuConstant; | ||||
import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMattersDeduplicateDTO; | |||||
import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMenuDTO; | |||||
import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMattersDeduplicate; | import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMattersDeduplicate; | ||||
import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMenu; | import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMenu; | ||||
import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwPolicy; | |||||
import com.ningdatech.kqapi.zzsfw.entity.vo.MatterTopVO; | import com.ningdatech.kqapi.zzsfw.entity.vo.MatterTopVO; | ||||
import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO; | import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO; | ||||
import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwMatterDeduplicateService; | import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwMatterDeduplicateService; | ||||
@@ -107,4 +110,40 @@ public class MatterManage { | |||||
return vo; | return vo; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
} | } | ||||
public String save(NdKqZzsfwMenuDTO dto) { | |||||
if(Objects.isNull(dto)){ | |||||
return "保存失败 传入为空"; | |||||
} | |||||
NdKqZzsfwMenu entity = BeanUtil.copyProperties(dto,NdKqZzsfwMenu.class); | |||||
if(menuService.save(entity)){ | |||||
return "保存成功 :" + entity; | |||||
}else{ | |||||
return "保存失败"; | |||||
} | |||||
} | |||||
public String saveDup(NdKqZzsfwMattersDeduplicateDTO dto) { | |||||
if(Objects.isNull(dto)){ | |||||
return "保存失败 传入为空"; | |||||
} | |||||
NdKqZzsfwMattersDeduplicate entity = BeanUtil.copyProperties(dto,NdKqZzsfwMattersDeduplicate.class); | |||||
if(matterDeduplicateService.save(entity)){ | |||||
return "保存成功 :" + entity; | |||||
}else{ | |||||
return "保存失败"; | |||||
} | |||||
} | |||||
public String removeAll() { | |||||
menuService.remove(Wrappers.lambdaQuery(NdKqZzsfwMenu.class)); | |||||
return "删除成功"; | |||||
} | |||||
public String removeAllDup() { | |||||
matterDeduplicateService.remove(Wrappers.lambdaQuery(NdKqZzsfwMattersDeduplicate.class)); | |||||
return "删除成功"; | |||||
} | |||||
} | } |
@@ -5,6 +5,8 @@ import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwPolicyDTO; | |||||
import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwMenu; | |||||
import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwPolicy; | import com.ningdatech.kqapi.zzsfw.entity.entity.NdKqZzsfwPolicy; | ||||
import com.ningdatech.kqapi.zzsfw.entity.vo.NdKqZzsfwPolicyVO; | import com.ningdatech.kqapi.zzsfw.entity.vo.NdKqZzsfwPolicyVO; | ||||
import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwPolicyService; | import com.ningdatech.kqapi.zzsfw.service.INdKqZzsfwPolicyService; | ||||
@@ -13,6 +15,7 @@ import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Objects; | |||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
/** | /** | ||||
@@ -42,4 +45,22 @@ public class PolicyManage { | |||||
.collect(Collectors.toList()); | .collect(Collectors.toList()); | ||||
return PageVo.of(res,pageRes.getTotal()); | return PageVo.of(res,pageRes.getTotal()); | ||||
} | } | ||||
public String save(NdKqZzsfwPolicyDTO dto) { | |||||
if(Objects.isNull(dto)){ | |||||
return "保存失败 传入为空"; | |||||
} | |||||
NdKqZzsfwPolicy entity = BeanUtil.copyProperties(dto,NdKqZzsfwPolicy.class); | |||||
if(policyService.save(entity)){ | |||||
return "保存成功 :" + entity; | |||||
}else{ | |||||
return "保存失败"; | |||||
} | |||||
} | |||||
public String removeAll() { | |||||
policyService.remove(Wrappers.lambdaQuery(NdKqZzsfwPolicy.class)); | |||||
return "删除成功"; | |||||
} | |||||
} | } |
@@ -61,7 +61,7 @@ spring: | |||||
# 配置从池返回的连接的默认自动提交行为。默认值为true。 | # 配置从池返回的连接的默认自动提交行为。默认值为true。 | ||||
auto-commit: true | auto-commit: true | ||||
# 开启连接监测泄露 | # 开启连接监测泄露 | ||||
leak-detection-threshold: 10000 | |||||
leak-detection-threshold: 500000 | |||||
# 测试连接数据库 | # 测试连接数据库 | ||||
connection-test-query: SELECT 1 | connection-test-query: SELECT 1 | ||||
#设置上传 单个文件的大小 | #设置上传 单个文件的大小 | ||||
@@ -61,7 +61,7 @@ spring: | |||||
# 配置从池返回的连接的默认自动提交行为。默认值为true。 | # 配置从池返回的连接的默认自动提交行为。默认值为true。 | ||||
auto-commit: true | auto-commit: true | ||||
# 开启连接监测泄露 | # 开启连接监测泄露 | ||||
leak-detection-threshold: 5000 | |||||
leak-detection-threshold: 500000 | |||||
# 测试连接数据库 | # 测试连接数据库 | ||||
connection-test-query: SELECT 1 | connection-test-query: SELECT 1 | ||||
#设置上传 单个文件的大小 | #设置上传 单个文件的大小 | ||||
@@ -1,5 +1,5 @@ | |||||
server: | server: | ||||
port: 33060 | |||||
port: 33061 | |||||
servlet: | servlet: | ||||
context-path: /kq | context-path: /kq | ||||
@@ -43,9 +43,9 @@ spring: | |||||
datasource: | datasource: | ||||
type: com.zaxxer.hikari.HikariDataSource | type: com.zaxxer.hikari.HikariDataSource | ||||
driver-class-name: com.mysql.cj.jdbc.Driver | driver-class-name: com.mysql.cj.jdbc.Driver | ||||
url: jdbc:mysql://47.98.125.47:3306/kqzzsfw?serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false | |||||
url: jdbc:mysql://10.42.248.27:3306/kqzzsfw?serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false | |||||
username: root | username: root | ||||
password: NingdaKeji123! | |||||
password: Nd@20231116 | |||||
# 数据源 | # 数据源 | ||||
hikari: | hikari: | ||||
# 是客户端等待连接池连接的最大毫秒数 | # 是客户端等待连接池连接的最大毫秒数 | ||||
@@ -61,7 +61,7 @@ spring: | |||||
# 配置从池返回的连接的默认自动提交行为。默认值为true。 | # 配置从池返回的连接的默认自动提交行为。默认值为true。 | ||||
auto-commit: true | auto-commit: true | ||||
# 开启连接监测泄露 | # 开启连接监测泄露 | ||||
leak-detection-threshold: 5000 | |||||
leak-detection-threshold: 500000 | |||||
# 测试连接数据库 | # 测试连接数据库 | ||||
connection-test-query: SELECT 1 | connection-test-query: SELECT 1 | ||||
#设置上传 单个文件的大小 | #设置上传 单个文件的大小 | ||||
@@ -118,6 +118,6 @@ log: | |||||
swagger: | swagger: | ||||
enabled: true | enabled: true | ||||
hostname: iZbp13nwyvib53j4j1p2xoZ | |||||
hostname: iZut201mqskxt0mwme4tjfZ | |||||
@@ -43,9 +43,9 @@ spring: | |||||
datasource: | datasource: | ||||
type: com.zaxxer.hikari.HikariDataSource | type: com.zaxxer.hikari.HikariDataSource | ||||
driver-class-name: com.mysql.cj.jdbc.Driver | driver-class-name: com.mysql.cj.jdbc.Driver | ||||
url: jdbc:mysql://47.98.125.47:3306/kqzzsfw?serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false | |||||
url: jdbc:mysql://10.42.248.27:3306/kqzzsfw?serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false | |||||
username: root | username: root | ||||
password: NingdaKeji123! | |||||
password: Nd@20231116 | |||||
# 数据源 | # 数据源 | ||||
hikari: | hikari: | ||||
# 是客户端等待连接池连接的最大毫秒数 | # 是客户端等待连接池连接的最大毫秒数 | ||||
@@ -61,7 +61,7 @@ spring: | |||||
# 配置从池返回的连接的默认自动提交行为。默认值为true。 | # 配置从池返回的连接的默认自动提交行为。默认值为true。 | ||||
auto-commit: true | auto-commit: true | ||||
# 开启连接监测泄露 | # 开启连接监测泄露 | ||||
leak-detection-threshold: 5000 | |||||
leak-detection-threshold: 500000 | |||||
# 测试连接数据库 | # 测试连接数据库 | ||||
connection-test-query: SELECT 1 | connection-test-query: SELECT 1 | ||||
#设置上传 单个文件的大小 | #设置上传 单个文件的大小 | ||||
@@ -118,6 +118,6 @@ log: | |||||
swagger: | swagger: | ||||
enabled: true | enabled: true | ||||
hostname: iZbp13nwyvib53j4j1p2xoZ | |||||
hostname: iZut201mqskxt0mwme4tjfZ | |||||
@@ -1,3 +1,3 @@ | |||||
spring: | spring: | ||||
profiles: | profiles: | ||||
active: dev | |||||
active: prod |