修复文章时间戳等问题

This commit is contained in:
hupeng
2020-02-02 17:11:27 +08:00
parent fd182495fb
commit daedd43e43
6 changed files with 20 additions and 18 deletions

View File

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>yshop-api</artifactId> <artifactId>yshop-api</artifactId>
<name>API模块</name> <name>移动端模块</name>
<properties> <properties>
<jjwt.version>0.10.6</jjwt.version> <jjwt.version>0.10.6</jjwt.version>

View File

@ -6,7 +6,7 @@ spring:
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://localhost:3306/yshop?serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:log4jdbc:mysql://localhost:3306/yshop?serverTimezone=Asia/Shanghai&useSSL=false
username: yshop username: yshop
password: password:
# 初始化配置 # 初始化配置
initial-size: 3 initial-size: 3

View File

@ -22,13 +22,6 @@ spring:
redis: redis:
repositories: repositories:
enabled: false enabled: false
#配置rocketmq
rocketmq:
nameServer: localhost:9876
producer:
group: yshop-group
sendMessageTimeout: 300000
#配置 Jpa #配置 Jpa
jpa: jpa:
properties: properties:
@ -36,6 +29,13 @@ rocketmq:
dialect: org.hibernate.dialect.MySQL5InnoDBDialect dialect: org.hibernate.dialect.MySQL5InnoDBDialect
open-in-view: true open-in-view: true
#配置rocketmq
rocketmq:
nameServer: localhost:9876
producer:
group: yshop-group
sendMessageTimeout: 300000
#七牛云 #七牛云

View File

@ -17,11 +17,13 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Date;
/** /**
* @author hupeng * @author hupeng
* @date 2019-10-07 * @date 2019-10-07
*/ */
@Api(tags = "YxArticle管理") @Api(tags = "图文管理")
@RestController @RestController
@RequestMapping("api") @RequestMapping("api")
public class YxArticleController { public class YxArticleController {
@ -30,7 +32,7 @@ public class YxArticleController {
private YxArticleService yxArticleService; private YxArticleService yxArticleService;
@ApiOperation(value = "查询YxArticle") @ApiOperation(value = "查询")
@GetMapping(value = "/yxArticle") @GetMapping(value = "/yxArticle")
@PreAuthorize("@el.check('admin','YXARTICLE_ALL','YXARTICLE_SELECT')") @PreAuthorize("@el.check('admin','YXARTICLE_ALL','YXARTICLE_SELECT')")
public ResponseEntity getYxArticles(YxArticleQueryCriteria criteria, Pageable pageable){ public ResponseEntity getYxArticles(YxArticleQueryCriteria criteria, Pageable pageable){
@ -38,16 +40,16 @@ public class YxArticleController {
} }
@ApiOperation(value = "新增YxArticle") @ApiOperation(value = "新增")
@PostMapping(value = "/yxArticle") @PostMapping(value = "/yxArticle")
@PreAuthorize("@el.check('admin','YXARTICLE_ALL','YXARTICLE_CREATE')") @PreAuthorize("@el.check('admin','YXARTICLE_ALL','YXARTICLE_CREATE')")
public ResponseEntity create(@Validated @RequestBody YxArticle resources){ public ResponseEntity create(@Validated @RequestBody YxArticle resources){
resources.setAddTime(DateUtil.now()); resources.setAddTime(DateUtil.format(new Date(),"yyyy-MM-dd HH:mm"));
return new ResponseEntity(yxArticleService.create(resources),HttpStatus.CREATED); return new ResponseEntity(yxArticleService.create(resources),HttpStatus.CREATED);
} }
@ApiOperation(value = "修改YxArticle") @ApiOperation(value = "修改")
@PutMapping(value = "/yxArticle") @PutMapping(value = "/yxArticle")
@PreAuthorize("@el.check('admin','YXARTICLE_ALL','YXARTICLE_EDIT')") @PreAuthorize("@el.check('admin','YXARTICLE_ALL','YXARTICLE_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxArticle resources){ public ResponseEntity update(@Validated @RequestBody YxArticle resources){
@ -56,7 +58,7 @@ public class YxArticleController {
} }
@ApiOperation(value = "删除YxArticle") @ApiOperation(value = "删除")
@DeleteMapping(value = "/yxArticle/{id}") @DeleteMapping(value = "/yxArticle/{id}")
@PreAuthorize("@el.check('admin','YXARTICLE_ALL','YXARTICLE_DELETE')") @PreAuthorize("@el.check('admin','YXARTICLE_ALL','YXARTICLE_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){ public ResponseEntity delete(@PathVariable Integer id){

View File

@ -81,7 +81,7 @@ public class YxArticleServiceImpl implements YxArticleService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public YxArticleDTO create(YxArticle resources) { public YxArticleDTO create(YxArticle resources) {
resources.setAddTime(String.valueOf(OrderUtil.getSecondTimestampTwo())); //resources.setAddTime(String.valueOf(OrderUtil.getSecondTimestampTwo()));
return yxArticleMapper.toDto(yxArticleRepository.save(resources)); return yxArticleMapper.toDto(yxArticleRepository.save(resources));
} }

View File

@ -47,7 +47,7 @@ spring:
database: 0 database: 0
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379
password: password:
#连接超时时间 #连接超时时间
timeout: 5000 timeout: 5000
@ -81,7 +81,7 @@ swagger:
enabled: true enabled: true
title: yshop商城管理后台API title: yshop商城管理后台API
serverUrl: http://localhost:8000 serverUrl: http://localhost:8000
version: 1.8 version: 1.9
# 文件存储路径 # 文件存储路径
file: file: