update:修改bug
This commit is contained in:
@@ -34,7 +34,7 @@ public class AdcDaBaseExceptionAdvice {
|
||||
log.error(exception.getMessage(), exception);
|
||||
// TODO 在数据库中记录程序异常,这个地方的异常是未处理的异常,需要管理员查看并进行处理以防重复出现
|
||||
if(exception.getStackTrace() != null){
|
||||
if(exception.getMessage().equals("token已过期")){
|
||||
if("token已过期".equals(exception.getMessage())){
|
||||
return Result.error(ResponseMessageCodeEnum.ERROR_TOKEN.getCode(), "token已过期,请重新登录");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.adc.da.common;
|
||||
|
||||
/**
|
||||
* @Author: qk
|
||||
* @Date: 2022/5/23 0023 14:28
|
||||
* @Version 1.0
|
||||
*/
|
||||
public enum NewsFeedEnum {
|
||||
GNWBZFG("GNWBZFG","国内外标准法规入库"),
|
||||
ZYBZFG("ZYBZFG","在研标准法规入库"),
|
||||
QYBZFB("QYBZFB","企业标准发布");
|
||||
|
||||
|
||||
|
||||
|
||||
private String value;
|
||||
private String lable;
|
||||
|
||||
private NewsFeedEnum(String value, String lable) {
|
||||
this.value = value;
|
||||
this.lable = lable;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.adc.da.slrs.NewsFeed.controller;
|
||||
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.http.PageInfo;
|
||||
import com.adc.da.slrs.NewsFeed.entity.NewsFeed;
|
||||
import com.adc.da.slrs.NewsFeed.page.NewsFeedPage;
|
||||
import com.adc.da.slrs.NewsFeed.service.Impl.NewsFeedServiceImpl;
|
||||
import com.adc.da.slrs.msgDynamicInfo.entity.MsgDynamicInfoEO;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: qk
|
||||
* @Date: 2022/5/23 0023 14:59
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/lawss/NewsFeed")
|
||||
@Api(description = "|NewsFeed|")
|
||||
public class NewsFeedController extends BaseController<NewsFeed> {
|
||||
|
||||
@Autowired
|
||||
private NewsFeedServiceImpl newsFeedService;
|
||||
|
||||
@GetMapping("/getNewsFeed")
|
||||
public ResponseMessage<IPage<NewsFeed>> NewFeedPage(NewsFeedPage page){
|
||||
IPage<NewsFeed> iPage = new Page<>();
|
||||
iPage.setSize(page.getPageSize());
|
||||
iPage.setTotal(page.getPage());
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq(StringUtils.isNotEmpty(page.getStandardId()),"STANDARD_ID",page.getStandardId());
|
||||
queryWrapper.eq(StringUtils.isNotEmpty(page.getStandardName()),"STANDARD_NAME",page.getStandardName());
|
||||
queryWrapper.eq("MESSAGE_TYPE",page.getMessageType());
|
||||
queryWrapper.orderByDesc("UPDATE_TIME");
|
||||
IPage<NewsFeed> newsFeedList = newsFeedService.page(iPage,queryWrapper);
|
||||
return Result.success(newsFeedList);
|
||||
}
|
||||
|
||||
@PostMapping("/insertNewsFeed")
|
||||
public void insertNewsFeed(@RequestBody NewsFeed newsFeed){
|
||||
newsFeedService.insertNewsFeed(newsFeed);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.adc.da.slrs.NewsFeed.dao;
|
||||
|
||||
import com.adc.da.slrs.NewsFeed.entity.NewsFeed;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @Author: qk
|
||||
* @Date: 2022/5/23 0023 14:59
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Repository
|
||||
public interface NewsFeedDao extends BaseMapper<NewsFeed> {
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.adc.da.slrs.NewsFeed.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: qk
|
||||
* @Date: 2022/5/23 0023 14:47
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="NewsFeed对象", description="")
|
||||
public class NewsFeed extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
@TableField("RESOURCE_TYPE")
|
||||
@ApiModelProperty(value = "资源类型")
|
||||
private String resourceType;
|
||||
|
||||
@TableField("MESSAGE_TYPE")
|
||||
@ApiModelProperty(value = "消息类型")
|
||||
private String messageType;
|
||||
|
||||
@TableField("STANDARD_ID")
|
||||
@ApiModelProperty(value = "标准ID")
|
||||
private String standardId;
|
||||
|
||||
@TableField("STANDARD")
|
||||
@ApiModelProperty(value = "标准号")
|
||||
private String standard;
|
||||
|
||||
@TableField("STANDARD_NAME")
|
||||
@ApiModelProperty(value = "标准名称")
|
||||
private String standardName;
|
||||
|
||||
@TableField("RELEASE_DATE")
|
||||
@ApiModelProperty(value = "发布日期")
|
||||
private String releaseDate;
|
||||
|
||||
@TableField("TEXT_STATE")
|
||||
@ApiModelProperty(value = "文本状态")
|
||||
private String textState;
|
||||
|
||||
@TableField("RENEW_TIME")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date renewTime;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.adc.da.slrs.NewsFeed.page;
|
||||
|
||||
import com.adc.da.sys.common.BasePage;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: qk
|
||||
* @Date: 2022/5/23 0023 15:36
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class NewsFeedPage {
|
||||
|
||||
private String id;
|
||||
private String resourceType;
|
||||
private String messageType;
|
||||
private String standardId;
|
||||
private String standard;
|
||||
private String standardName;
|
||||
private String releaseDate;
|
||||
private String textState;
|
||||
private Date renewTime;
|
||||
private Long page;
|
||||
private Long pageSize;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.adc.da.slrs.NewsFeed.service;
|
||||
|
||||
import com.adc.da.slrs.NewsFeed.entity.NewsFeed;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: qk
|
||||
* @Date: 2022/5/23 0023 15:01
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
public interface INewsFeedService extends IService<NewsFeed> {
|
||||
int insertNewsFeed(NewsFeed newsFeed);
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.adc.da.slrs.NewsFeed.service.Impl;
|
||||
|
||||
import com.adc.da.common.NewsFeedEnum;
|
||||
import com.adc.da.slrs.NewsFeed.dao.NewsFeedDao;
|
||||
import com.adc.da.slrs.NewsFeed.entity.NewsFeed;
|
||||
import com.adc.da.slrs.NewsFeed.service.INewsFeedService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @Author: qk
|
||||
* @Date: 2022/5/23 0023 15:02
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
||||
public class NewsFeedServiceImpl extends ServiceImpl<NewsFeedDao, NewsFeed> implements INewsFeedService {
|
||||
|
||||
|
||||
@Override
|
||||
public int insertNewsFeed(NewsFeed newsFeed) {
|
||||
switch (newsFeed.getMessageType()){
|
||||
case "0":
|
||||
newsFeed.setMessageType( NewsFeedEnum.GNWBZFG.getValue());
|
||||
break;
|
||||
case "1":
|
||||
newsFeed.setMessageType( NewsFeedEnum.ZYBZFG.getValue());
|
||||
break;
|
||||
case "2":
|
||||
newsFeed.setMessageType( NewsFeedEnum.QYBZFB.getValue());
|
||||
break;
|
||||
}
|
||||
this.save(newsFeed);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user