微信模块迁移
This commit is contained in:
@ -54,6 +54,7 @@ public class YxStoreCombination implements Serializable {
|
||||
|
||||
// 参团人数
|
||||
@Column(name = "people",nullable = false)
|
||||
@NotNull(message = "拼团人数必填")
|
||||
@Min(value = 2,message = "拼团人数必须大于1")
|
||||
private Integer people;
|
||||
|
||||
@ -64,19 +65,23 @@ public class YxStoreCombination implements Serializable {
|
||||
|
||||
// 价格
|
||||
@Column(name = "price",nullable = false)
|
||||
@NotNull(message = "拼团价必填")
|
||||
@Min(value = 0,message = "拼团价必须大于0")
|
||||
private BigDecimal price;
|
||||
|
||||
// 排序
|
||||
@Column(name = "sort",nullable = false)
|
||||
@NotNull(message = "排序必填")
|
||||
private Integer sort;
|
||||
|
||||
// 销量
|
||||
@Column(name = "sales",nullable = false)
|
||||
@NotNull(message = "销量必填")
|
||||
private Integer sales;
|
||||
|
||||
// 库存
|
||||
@Column(name = "stock",nullable = false)
|
||||
@NotNull(message = "库存必填")
|
||||
private Integer stock;
|
||||
|
||||
// 添加时间
|
||||
@ -85,10 +90,12 @@ public class YxStoreCombination implements Serializable {
|
||||
|
||||
// 推荐
|
||||
@Column(name = "is_host",nullable = false)
|
||||
@NotNull(message = "推荐必须选择")
|
||||
private Integer isHost;
|
||||
|
||||
// 产品状态
|
||||
@Column(name = "is_show",nullable = false)
|
||||
@NotNull(message = "状态必须选择")
|
||||
private Integer isShow;
|
||||
|
||||
@Column(name = "is_del",nullable = false,insertable = false)
|
||||
@ -103,14 +110,17 @@ public class YxStoreCombination implements Serializable {
|
||||
|
||||
// 是否包邮1是0否
|
||||
@Column(name = "is_postage",nullable = false)
|
||||
@NotNull(message = "包邮状态必须选择")
|
||||
private Integer isPostage;
|
||||
|
||||
// 邮费
|
||||
@Column(name = "postage",nullable = false)
|
||||
@NotNull(message = "邮费必填")
|
||||
private BigDecimal postage;
|
||||
|
||||
// 拼团内容
|
||||
@Column(name = "description",nullable = false)
|
||||
@NotBlank(message = "拼团内容不能为空")
|
||||
private String description;
|
||||
|
||||
// 拼团开始时间
|
||||
|
@ -6,6 +6,7 @@ import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
@ -64,21 +65,25 @@ public class YxStoreProduct implements Serializable {
|
||||
|
||||
// 商品价格
|
||||
@Column(name = "price",nullable = false)
|
||||
@NotNull(message = "价格必填")
|
||||
@Min(value = 0)
|
||||
private BigDecimal price;
|
||||
|
||||
// 会员价格
|
||||
@Column(name = "vip_price",nullable = false)
|
||||
@NotNull(message = "会员价必填")
|
||||
@Min(value = 0)
|
||||
private BigDecimal vipPrice;
|
||||
|
||||
// 市场价
|
||||
@Column(name = "ot_price",nullable = false)
|
||||
@NotNull(message = "原价必填")
|
||||
@Min(value = 0)
|
||||
private BigDecimal otPrice;
|
||||
|
||||
// 邮费
|
||||
@Column(name = "postage",nullable = false)
|
||||
@NotNull(message = "邮费必填")
|
||||
@Min(value = 0)
|
||||
private BigDecimal postage;
|
||||
|
||||
@ -89,37 +94,45 @@ public class YxStoreProduct implements Serializable {
|
||||
|
||||
// 排序
|
||||
@Column(name = "sort",nullable = false)
|
||||
@NotNull(message = "排序必填")
|
||||
@Min(value = 0)
|
||||
private Integer sort;
|
||||
|
||||
// 销量
|
||||
@Column(name = "sales",nullable = false)
|
||||
@NotNull(message = "销量必填")
|
||||
@Min(value = 0)
|
||||
private Integer sales;
|
||||
|
||||
// 库存
|
||||
@Column(name = "stock",nullable = false)
|
||||
@NotNull(message = "库存必填")
|
||||
@Min(value = 0)
|
||||
private Integer stock;
|
||||
|
||||
// 状态(0:未上架,1:上架)
|
||||
@Column(name = "is_show",insertable = false)
|
||||
@NotNull(message = "状态必须选择")
|
||||
private Integer isShow;
|
||||
|
||||
// 是否热卖
|
||||
@Column(name = "is_hot",columnDefinition="int default 0")
|
||||
@Column(name = "is_hot")
|
||||
@NotNull(message = "热卖单品必须选择")
|
||||
private Integer isHot;
|
||||
|
||||
// 是否优惠
|
||||
@Column(name = "is_benefit",columnDefinition="int default 0")
|
||||
@Column(name = "is_benefit")
|
||||
@NotNull(message = "优惠推荐必须选择")
|
||||
private Integer isBenefit;
|
||||
|
||||
// 是否精品
|
||||
@Column(name = "is_best",columnDefinition="int default 0")
|
||||
@NotNull(message = "精品状态必须选择")
|
||||
private Integer isBest;
|
||||
|
||||
// 是否新品
|
||||
@Column(name = "is_new",columnDefinition="int default 0")
|
||||
@NotNull(message = "首发新品必须选择")
|
||||
private Integer isNew;
|
||||
|
||||
// 产品描述
|
||||
@ -133,6 +146,7 @@ public class YxStoreProduct implements Serializable {
|
||||
|
||||
// 是否包邮
|
||||
@Column(name = "is_postage")
|
||||
@NotNull(message = "包邮状态必须选择")
|
||||
private Integer isPostage;
|
||||
|
||||
// 是否删除
|
||||
@ -144,12 +158,14 @@ public class YxStoreProduct implements Serializable {
|
||||
private Integer merUse;
|
||||
|
||||
// 获得积分
|
||||
@Column(name = "give_integral",columnDefinition="int default 0")
|
||||
@Column(name = "give_integral")
|
||||
@NotNull(message = "奖励积分不能为空")
|
||||
@Min(value = 0)
|
||||
private BigDecimal giveIntegral;
|
||||
|
||||
// 成本价
|
||||
@Column(name = "cost",columnDefinition="int default 0")
|
||||
@Column(name = "cost")
|
||||
@NotNull(message = "成本价不能为空")
|
||||
@Min(value = 0)
|
||||
private BigDecimal cost;
|
||||
|
||||
|
@ -1,102 +0,0 @@
|
||||
package co.yixiang.modules.wechat.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-07
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="yx_article")
|
||||
public class YxArticle implements Serializable {
|
||||
|
||||
// 文章管理ID
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
|
||||
// 分类id
|
||||
@Column(name = "cid")
|
||||
private String cid;
|
||||
|
||||
// 文章标题
|
||||
@Column(name = "title",nullable = false)
|
||||
private String title;
|
||||
|
||||
// 文章作者
|
||||
@Column(name = "author")
|
||||
private String author;
|
||||
|
||||
@Column(name = "content")
|
||||
private String content;
|
||||
|
||||
// 文章图片
|
||||
@Column(name = "image_input",nullable = false)
|
||||
private String imageInput;
|
||||
|
||||
// 文章简介
|
||||
@Column(name = "synopsis")
|
||||
private String synopsis;
|
||||
|
||||
// 文章分享标题
|
||||
@Column(name = "share_title")
|
||||
private String shareTitle;
|
||||
|
||||
// 文章分享简介
|
||||
@Column(name = "share_synopsis")
|
||||
private String shareSynopsis;
|
||||
|
||||
// 浏览次数
|
||||
@Column(name = "visit")
|
||||
private String visit;
|
||||
|
||||
// 排序
|
||||
@Column(name = "sort",nullable = false)
|
||||
private Integer sort;
|
||||
|
||||
// 原文链接
|
||||
@Column(name = "url")
|
||||
private String url;
|
||||
|
||||
// 状态
|
||||
@Column(name = "status",nullable = false)
|
||||
private Integer status;
|
||||
|
||||
// 添加时间
|
||||
@Column(name = "add_time",nullable = false)
|
||||
private String addTime;
|
||||
|
||||
// 是否隐藏
|
||||
@Column(name = "hide",nullable = false)
|
||||
private Integer hide;
|
||||
|
||||
// 管理员id
|
||||
@Column(name = "admin_id",nullable = false)
|
||||
private Integer adminId;
|
||||
|
||||
// 商户id
|
||||
@Column(name = "mer_id")
|
||||
private Integer merId;
|
||||
|
||||
// 产品关联id
|
||||
@Column(name = "product_id",nullable = false)
|
||||
private Integer productId;
|
||||
|
||||
// 是否热门(小程序)
|
||||
@Column(name = "is_hot",nullable = false)
|
||||
private Integer isHot;
|
||||
|
||||
// 是否轮播图(小程序)
|
||||
@Column(name = "is_banner",nullable = false)
|
||||
private Integer isBanner;
|
||||
|
||||
public void copy(YxArticle source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package co.yixiang.modules.wechat.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-06
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="yx_cache")
|
||||
public class YxCache implements Serializable {
|
||||
|
||||
|
||||
@Id
|
||||
@Column(name = "`key`")
|
||||
private String key;
|
||||
|
||||
// 缓存数据
|
||||
@Column(name = "result")
|
||||
private String result;
|
||||
|
||||
// 缓存时间
|
||||
@Column(name = "add_time")
|
||||
private Integer addTime;
|
||||
|
||||
public void copy(YxCache source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package co.yixiang.modules.wechat.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-10
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="yx_wechat_reply")
|
||||
public class YxWechatReply implements Serializable {
|
||||
|
||||
// 微信关键字回复id
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
|
||||
// 关键字
|
||||
@Column(name = "`key`",unique = true,nullable = false)
|
||||
private String key;
|
||||
|
||||
// 回复类型
|
||||
@Column(name = "type",nullable = false)
|
||||
private String type;
|
||||
|
||||
// 回复数据
|
||||
@Column(name = "data",nullable = false)
|
||||
private String data;
|
||||
|
||||
// 0=不可用 1 =可用
|
||||
@Column(name = "status",nullable = false)
|
||||
private Integer status;
|
||||
|
||||
// 是否隐藏
|
||||
@Column(name = "hide",nullable = false)
|
||||
private Integer hide;
|
||||
|
||||
public void copy(YxWechatReply source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package co.yixiang.modules.wechat.repository;
|
||||
|
||||
import co.yixiang.modules.wechat.domain.YxArticle;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-07
|
||||
*/
|
||||
public interface YxArticleRepository extends JpaRepository<YxArticle, Integer>, JpaSpecificationExecutor {
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package co.yixiang.modules.wechat.repository;
|
||||
|
||||
import co.yixiang.modules.wechat.domain.YxCache;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-06
|
||||
*/
|
||||
public interface YxCacheRepository extends JpaRepository<YxCache, String>, JpaSpecificationExecutor {
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package co.yixiang.modules.wechat.repository;
|
||||
|
||||
import co.yixiang.modules.wechat.domain.YxWechatReply;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-10
|
||||
*/
|
||||
public interface YxWechatReplyRepository extends JpaRepository<YxWechatReply, Integer>, JpaSpecificationExecutor {
|
||||
|
||||
/**
|
||||
* findByKey
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
YxWechatReply findByKey(String key);
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
package co.yixiang.modules.wechat.rest;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import co.yixiang.modules.wechat.service.dto.YxArticleQueryCriteria;
|
||||
import co.yixiang.aop.log.Log;
|
||||
import co.yixiang.modules.wechat.domain.YxArticle;
|
||||
import co.yixiang.modules.wechat.service.YxArticleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-07
|
||||
*/
|
||||
@Api(tags = "YxArticle管理")
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class YxArticleController {
|
||||
|
||||
@Autowired
|
||||
private YxArticleService yxArticleService;
|
||||
|
||||
@Log("查询YxArticle")
|
||||
@ApiOperation(value = "查询YxArticle")
|
||||
@GetMapping(value = "/yxArticle")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_SELECT')")
|
||||
public ResponseEntity getYxArticles(YxArticleQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity(yxArticleService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增YxArticle")
|
||||
@ApiOperation(value = "新增YxArticle")
|
||||
@PostMapping(value = "/yxArticle")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody YxArticle resources){
|
||||
resources.setAddTime(DateUtil.now());
|
||||
return new ResponseEntity(yxArticleService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("修改YxArticle")
|
||||
@ApiOperation(value = "修改YxArticle")
|
||||
@PutMapping(value = "/yxArticle")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxArticle resources){
|
||||
yxArticleService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除YxArticle")
|
||||
@ApiOperation(value = "删除YxArticle")
|
||||
@DeleteMapping(value = "/yxArticle/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
yxArticleService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "发布文章")
|
||||
@GetMapping(value = "/yxArticle/publish/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_DELETE')")
|
||||
public ResponseEntity publish(@PathVariable Integer id){
|
||||
//todo
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
package co.yixiang.modules.wechat.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.modules.wechat.service.YxCacheService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import co.yixiang.aop.log.Log;
|
||||
import co.yixiang.modules.wechat.domain.YxCache;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import me.chanjar.weixin.common.bean.menu.WxMenu;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-06
|
||||
*/
|
||||
@Api(tags = "YxCache管理")
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class YxCacheController {
|
||||
|
||||
@Autowired
|
||||
private YxCacheService yxCacheService;
|
||||
|
||||
@Autowired
|
||||
private WxMpService wxService;
|
||||
|
||||
@Log("查询菜单")
|
||||
@ApiOperation(value = "查询菜单")
|
||||
@GetMapping(value = "/yxCache")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXCACHE_ALL','YXCACHE_SELECT')")
|
||||
public ResponseEntity getYxCaches(){
|
||||
return new ResponseEntity(yxCacheService.findById("wechat_menus"),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("创建菜单")
|
||||
@ApiOperation(value = "创建菜单")
|
||||
@PostMapping(value = "/yxCache")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXCACHE_ALL','YXCACHE_CREATE')")
|
||||
public ResponseEntity create( @RequestBody String jsonStr){
|
||||
//if(StrUtil.isNotEmpty(jsonStr)) throw new BadRequestException("演示环境禁止操作");
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
String jsonButton = jsonObject.get("buttons").toString();
|
||||
YxCache yxCache = new YxCache();
|
||||
Boolean isExist = yxCacheService.isExist("wechat_menus");
|
||||
WxMenu menu = JSONObject.parseObject(jsonStr,WxMenu.class);
|
||||
if(isExist){
|
||||
yxCache.setKey("wechat_menus");
|
||||
yxCache.setResult(jsonButton);
|
||||
yxCacheService.update(yxCache);
|
||||
}else {
|
||||
yxCache.setKey("wechat_menus");
|
||||
yxCache.setResult(jsonButton);
|
||||
yxCache.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||
yxCacheService.create(yxCache);
|
||||
}
|
||||
|
||||
|
||||
//创建菜单
|
||||
try {
|
||||
wxService.getMenuService().menuDelete();
|
||||
wxService.getMenuService().menuCreate(menu);
|
||||
} catch (WxErrorException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
package co.yixiang.modules.wechat.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import co.yixiang.aop.log.Log;
|
||||
import co.yixiang.modules.wechat.domain.YxWechatReply;
|
||||
import co.yixiang.modules.wechat.service.YxWechatReplyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-10
|
||||
*/
|
||||
@Api(tags = "YxWechatReply管理")
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class YxWechatReplyController {
|
||||
|
||||
@Autowired
|
||||
private YxWechatReplyService yxWechatReplyService;
|
||||
|
||||
@Log("查询")
|
||||
@ApiOperation(value = "查询")
|
||||
@GetMapping(value = "/yxWechatReply")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXWECHATREPLY_ALL','YXWECHATREPLY_SELECT')")
|
||||
public ResponseEntity getYxWechatReplys(){
|
||||
return new ResponseEntity(yxWechatReplyService.isExist("subscribe"),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增自动回复")
|
||||
@ApiOperation(value = "新增自动回复")
|
||||
@PostMapping(value = "/yxWechatReply")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXWECHATREPLY_ALL','YXWECHATREPLY_CREATE')")
|
||||
public ResponseEntity create(@RequestBody String jsonStr){
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
YxWechatReply yxWechatReply = new YxWechatReply();
|
||||
YxWechatReply isExist = yxWechatReplyService.isExist(jsonObject.get("key").toString());
|
||||
yxWechatReply.setKey(jsonObject.get("key").toString());
|
||||
yxWechatReply.setStatus(Integer.valueOf(jsonObject.get("status").toString()));
|
||||
yxWechatReply.setData(jsonObject.get("data").toString());
|
||||
yxWechatReply.setType(jsonObject.get("type").toString());
|
||||
if(ObjectUtil.isNull(isExist)){
|
||||
yxWechatReplyService.create(yxWechatReply);
|
||||
}else{
|
||||
yxWechatReply.setId(isExist.getId());
|
||||
yxWechatReplyService.update(yxWechatReply);
|
||||
}
|
||||
|
||||
return new ResponseEntity(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("修改YxWechatReply")
|
||||
@ApiOperation(value = "修改YxWechatReply")
|
||||
@PutMapping(value = "/yxWechatReply")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXWECHATREPLY_ALL','YXWECHATREPLY_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxWechatReply resources){
|
||||
yxWechatReplyService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除YxWechatReply")
|
||||
@ApiOperation(value = "删除YxWechatReply")
|
||||
@DeleteMapping(value = "/yxWechatReply/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXWECHATREPLY_ALL','YXWECHATREPLY_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
yxWechatReplyService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service;
|
||||
|
||||
import co.yixiang.modules.wechat.service.dto.YxArticleQueryCriteria;
|
||||
import co.yixiang.modules.wechat.domain.YxArticle;
|
||||
import co.yixiang.modules.wechat.service.dto.YxArticleDTO;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-07
|
||||
*/
|
||||
//@CacheConfig(cacheNames = "yxArticle")
|
||||
public interface YxArticleService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria
|
||||
* @param pageable
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable
|
||||
Map<String,Object> queryAll(YxArticleQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable
|
||||
List<YxArticleDTO> queryAll(YxArticleQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable(key = "#p0")
|
||||
YxArticleDTO findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
YxArticleDTO create(YxArticle resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
void update(YxArticle resources);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
void delete(Integer id);
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service;
|
||||
|
||||
import co.yixiang.modules.wechat.service.dto.YxCacheDTO;
|
||||
import co.yixiang.modules.wechat.service.dto.YxCacheQueryCriteria;
|
||||
import co.yixiang.modules.wechat.domain.YxCache;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-06
|
||||
*/
|
||||
//@CacheConfig(cacheNames = "yxCache")
|
||||
public interface YxCacheService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria
|
||||
* @param pageable
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable
|
||||
Map<String,Object> queryAll(YxCacheQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable
|
||||
List<YxCacheDTO> queryAll(YxCacheQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable(key = "#p0")
|
||||
YxCacheDTO findById(String key);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
YxCacheDTO create(YxCache resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
void update(YxCache resources);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param key
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
void delete(String key);
|
||||
|
||||
boolean isExist(String key);
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service;
|
||||
|
||||
import co.yixiang.modules.wechat.domain.YxWechatReply;
|
||||
import co.yixiang.modules.wechat.service.dto.YxWechatReplyDTO;
|
||||
import co.yixiang.modules.wechat.service.dto.YxWechatReplyQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-10
|
||||
*/
|
||||
//@CacheConfig(cacheNames = "yxWechatReply")
|
||||
public interface YxWechatReplyService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria
|
||||
* @param pageable
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable
|
||||
Map<String,Object> queryAll(YxWechatReplyQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable
|
||||
List<YxWechatReplyDTO> queryAll(YxWechatReplyQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable(key = "#p0")
|
||||
YxWechatReplyDTO findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
YxWechatReplyDTO create(YxWechatReply resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
void update(YxWechatReply resources);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
void delete(Integer id);
|
||||
|
||||
YxWechatReply isExist(String key);
|
||||
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-07
|
||||
*/
|
||||
@Data
|
||||
public class YxArticleDTO implements Serializable {
|
||||
|
||||
// 文章管理ID
|
||||
private Integer id;
|
||||
|
||||
// 分类id
|
||||
private String cid;
|
||||
|
||||
// 文章标题
|
||||
private String title;
|
||||
|
||||
// 文章作者
|
||||
private String author;
|
||||
|
||||
// 文章图片
|
||||
private String imageInput;
|
||||
|
||||
// 文章简介
|
||||
private String synopsis;
|
||||
|
||||
private String content;
|
||||
|
||||
// 文章分享标题
|
||||
private String shareTitle;
|
||||
|
||||
// 文章分享简介
|
||||
private String shareSynopsis;
|
||||
|
||||
// 浏览次数
|
||||
private String visit;
|
||||
|
||||
// 排序
|
||||
private Integer sort;
|
||||
|
||||
// 原文链接
|
||||
private String url;
|
||||
|
||||
// 状态
|
||||
private Integer status;
|
||||
|
||||
// 添加时间
|
||||
private String addTime;
|
||||
|
||||
// 是否隐藏
|
||||
private Integer hide;
|
||||
|
||||
// 管理员id
|
||||
private Integer adminId;
|
||||
|
||||
// 商户id
|
||||
private Integer merId;
|
||||
|
||||
// 产品关联id
|
||||
private Integer productId;
|
||||
|
||||
// 是否热门(小程序)
|
||||
private Integer isHot;
|
||||
|
||||
// 是否轮播图(小程序)
|
||||
private Integer isBanner;
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-07
|
||||
*/
|
||||
@Data
|
||||
public class YxArticleQueryCriteria{
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-06
|
||||
*/
|
||||
@Data
|
||||
public class YxCacheDTO implements Serializable {
|
||||
|
||||
private String key;
|
||||
|
||||
// 缓存数据
|
||||
private String result;
|
||||
|
||||
// 缓存时间
|
||||
private Integer addTime;
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-06
|
||||
*/
|
||||
@Data
|
||||
public class YxCacheQueryCriteria{
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-10
|
||||
*/
|
||||
@Data
|
||||
public class YxWechatReplyDTO implements Serializable {
|
||||
|
||||
// 微信关键字回复id
|
||||
private Integer id;
|
||||
|
||||
// 关键字
|
||||
private String key;
|
||||
|
||||
// 回复类型
|
||||
private String type;
|
||||
|
||||
// 回复数据
|
||||
private String data;
|
||||
|
||||
// 0=不可用 1 =可用
|
||||
private Integer status;
|
||||
|
||||
// 是否隐藏
|
||||
private Integer hide;
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-10
|
||||
*/
|
||||
@Data
|
||||
public class YxWechatReplyQueryCriteria{
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service.impl;
|
||||
|
||||
import co.yixiang.modules.wechat.repository.YxArticleRepository;
|
||||
import co.yixiang.modules.wechat.service.YxArticleService;
|
||||
import co.yixiang.modules.wechat.service.dto.YxArticleQueryCriteria;
|
||||
import co.yixiang.modules.wechat.domain.YxArticle;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import co.yixiang.utils.ValidationUtil;
|
||||
import co.yixiang.modules.wechat.service.dto.YxArticleDTO;
|
||||
import co.yixiang.modules.wechat.service.mapper.YxArticleMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import co.yixiang.utils.PageUtil;
|
||||
import co.yixiang.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-07
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class YxArticleServiceImpl implements YxArticleService {
|
||||
|
||||
@Autowired
|
||||
private YxArticleRepository yxArticleRepository;
|
||||
|
||||
@Autowired
|
||||
private YxArticleMapper yxArticleMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(YxArticleQueryCriteria criteria, Pageable pageable){
|
||||
Page<YxArticle> page = yxArticleRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(yxArticleMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<YxArticleDTO> queryAll(YxArticleQueryCriteria criteria){
|
||||
return yxArticleMapper.toDto(yxArticleRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxArticleDTO findById(Integer id) {
|
||||
Optional<YxArticle> yxArticle = yxArticleRepository.findById(id);
|
||||
ValidationUtil.isNull(yxArticle,"YxArticle","id",id);
|
||||
return yxArticleMapper.toDto(yxArticle.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public YxArticleDTO create(YxArticle resources) {
|
||||
resources.setAddTime(String.valueOf(OrderUtil.getSecondTimestampTwo()));
|
||||
return yxArticleMapper.toDto(yxArticleRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(YxArticle resources) {
|
||||
Optional<YxArticle> optionalYxArticle = yxArticleRepository.findById(resources.getId());
|
||||
ValidationUtil.isNull( optionalYxArticle,"YxArticle","id",resources.getId());
|
||||
YxArticle yxArticle = optionalYxArticle.get();
|
||||
yxArticle.copy(resources);
|
||||
yxArticleRepository.save(yxArticle);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Integer id) {
|
||||
yxArticleRepository.deleteById(id);
|
||||
}
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service.impl;
|
||||
|
||||
import co.yixiang.modules.wechat.service.dto.YxCacheDTO;
|
||||
import co.yixiang.modules.wechat.service.dto.YxCacheQueryCriteria;
|
||||
import co.yixiang.modules.wechat.domain.YxCache;
|
||||
import co.yixiang.utils.ValidationUtil;
|
||||
import co.yixiang.modules.wechat.repository.YxCacheRepository;
|
||||
import co.yixiang.modules.wechat.service.YxCacheService;
|
||||
import co.yixiang.modules.wechat.service.mapper.YxCacheMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import co.yixiang.utils.PageUtil;
|
||||
import co.yixiang.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-06
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class YxCacheServiceImpl implements YxCacheService {
|
||||
|
||||
@Autowired
|
||||
private YxCacheRepository yxCacheRepository;
|
||||
|
||||
@Autowired
|
||||
private YxCacheMapper yxCacheMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(YxCacheQueryCriteria criteria, Pageable pageable){
|
||||
Page<YxCache> page = yxCacheRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(yxCacheMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<YxCacheDTO> queryAll(YxCacheQueryCriteria criteria){
|
||||
return yxCacheMapper.toDto(yxCacheRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxCacheDTO findById(String key) {
|
||||
Optional<YxCache> yxCache = yxCacheRepository.findById(key);
|
||||
ValidationUtil.isNull(yxCache,"YxCache","key",key);
|
||||
return yxCacheMapper.toDto(yxCache.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExist(String key) {
|
||||
Optional<YxCache> yxCache = yxCacheRepository.findById(key);
|
||||
if(!yxCache.isPresent()){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public YxCacheDTO create(YxCache resources) {
|
||||
//resources.setKey(IdUtil.simpleUUID());
|
||||
return yxCacheMapper.toDto(yxCacheRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(YxCache resources) {
|
||||
Optional<YxCache> optionalYxCache = yxCacheRepository.findById(resources.getKey());
|
||||
ValidationUtil.isNull( optionalYxCache,"YxCache","id",resources.getKey());
|
||||
YxCache yxCache = optionalYxCache.get();
|
||||
yxCache.copy(resources);
|
||||
yxCacheRepository.save(yxCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(String key) {
|
||||
yxCacheRepository.deleteById(key);
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service.impl;
|
||||
|
||||
import co.yixiang.modules.wechat.repository.YxWechatReplyRepository;
|
||||
import co.yixiang.modules.wechat.service.YxWechatReplyService;
|
||||
import co.yixiang.modules.wechat.service.dto.YxWechatReplyDTO;
|
||||
import co.yixiang.modules.wechat.service.dto.YxWechatReplyQueryCriteria;
|
||||
import co.yixiang.modules.wechat.service.mapper.YxWechatReplyMapper;
|
||||
import co.yixiang.modules.wechat.domain.YxWechatReply;
|
||||
import co.yixiang.exception.EntityExistException;
|
||||
import co.yixiang.utils.ValidationUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import co.yixiang.utils.PageUtil;
|
||||
import co.yixiang.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-10
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class YxWechatReplyServiceImpl implements YxWechatReplyService {
|
||||
|
||||
@Autowired
|
||||
private YxWechatReplyRepository yxWechatReplyRepository;
|
||||
|
||||
@Autowired
|
||||
private YxWechatReplyMapper yxWechatReplyMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(YxWechatReplyQueryCriteria criteria, Pageable pageable){
|
||||
Page<YxWechatReply> page = yxWechatReplyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(yxWechatReplyMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<YxWechatReplyDTO> queryAll(YxWechatReplyQueryCriteria criteria){
|
||||
return yxWechatReplyMapper.toDto(yxWechatReplyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxWechatReplyDTO findById(Integer id) {
|
||||
Optional<YxWechatReply> yxWechatReply = yxWechatReplyRepository.findById(id);
|
||||
ValidationUtil.isNull(yxWechatReply,"YxWechatReply","id",id);
|
||||
return yxWechatReplyMapper.toDto(yxWechatReply.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public YxWechatReplyDTO create(YxWechatReply resources) {
|
||||
if(yxWechatReplyRepository.findByKey(resources.getKey()) != null){
|
||||
throw new EntityExistException(YxWechatReply.class,"key",resources.getKey());
|
||||
}
|
||||
return yxWechatReplyMapper.toDto(yxWechatReplyRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(YxWechatReply resources) {
|
||||
Optional<YxWechatReply> optionalYxWechatReply = yxWechatReplyRepository.findById(resources.getId());
|
||||
ValidationUtil.isNull( optionalYxWechatReply,"YxWechatReply","id",resources.getId());
|
||||
YxWechatReply yxWechatReply = optionalYxWechatReply.get();
|
||||
YxWechatReply yxWechatReply1 = null;
|
||||
yxWechatReply1 = yxWechatReplyRepository.findByKey(resources.getKey());
|
||||
if(yxWechatReply1 != null && !yxWechatReply1.getId().equals(yxWechatReply.getId())){
|
||||
throw new EntityExistException(YxWechatReply.class,"key",resources.getKey());
|
||||
}
|
||||
yxWechatReply.copy(resources);
|
||||
yxWechatReplyRepository.save(yxWechatReply);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Integer id) {
|
||||
yxWechatReplyRepository.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public YxWechatReply isExist(String key) {
|
||||
YxWechatReply yxWechatReply = yxWechatReplyRepository.findByKey(key);
|
||||
|
||||
return yxWechatReply;
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service.mapper;
|
||||
|
||||
import co.yixiang.mapper.EntityMapper;
|
||||
import co.yixiang.modules.wechat.domain.YxArticle;
|
||||
import co.yixiang.modules.wechat.service.dto.YxArticleDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-07
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface YxArticleMapper extends EntityMapper<YxArticleDTO, YxArticle> {
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service.mapper;
|
||||
|
||||
import co.yixiang.modules.wechat.service.dto.YxCacheDTO;
|
||||
import co.yixiang.mapper.EntityMapper;
|
||||
import co.yixiang.modules.wechat.domain.YxCache;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-06
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface YxCacheMapper extends EntityMapper<YxCacheDTO, YxCache> {
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package co.yixiang.modules.wechat.service.mapper;
|
||||
|
||||
import co.yixiang.mapper.EntityMapper;
|
||||
import co.yixiang.modules.wechat.domain.YxWechatReply;
|
||||
import co.yixiang.modules.wechat.service.dto.YxWechatReplyDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-10
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface YxWechatReplyMapper extends EntityMapper<YxWechatReplyDTO, YxWechatReply> {
|
||||
|
||||
}
|
Reference in New Issue
Block a user