微信模块迁移

This commit is contained in:
hupeng
2019-11-24 21:49:15 +08:00
parent 6afcb7083a
commit 8c4c9b0387
34 changed files with 290 additions and 136 deletions

View File

@ -0,0 +1,37 @@
package co.yixiang.modules.shop.service;
import co.yixiang.common.service.BaseService;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.modules.shop.entity.YxArticle;
import co.yixiang.modules.shop.web.param.YxArticleQueryParam;
import co.yixiang.modules.shop.web.vo.YxArticleQueryVo;
import java.io.Serializable;
/**
* <p>
* 文章管理表 服务类
* </p>
*
* @author hupeng
* @since 2019-10-02
*/
public interface ArticleService extends BaseService<YxArticle> {
void incVisitNum(int id);
/**
* 根据ID获取查询对象
* @param id
* @return
*/
YxArticleQueryVo getYxArticleById(Serializable id) throws Exception;
/**
* 获取分页对象
* @param yxArticleQueryParam
* @return
*/
Paging<YxArticleQueryVo> getYxArticlePageList(YxArticleQueryParam yxArticleQueryParam);
}

View File

@ -0,0 +1,53 @@
package co.yixiang.modules.shop.service.impl;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.modules.shop.entity.YxArticle;
import co.yixiang.modules.shop.mapper.YxArticleMapper;
import co.yixiang.modules.shop.service.ArticleService;
import co.yixiang.modules.shop.web.param.YxArticleQueryParam;
import co.yixiang.modules.shop.web.vo.YxArticleQueryVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
/**
* <p>
* 文章管理表 服务实现类
* </p>
*
* @author hupeng
* @since 2019-10-02
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class ArticleServiceImpl extends BaseServiceImpl<YxArticleMapper, YxArticle> implements ArticleService {
@Autowired
private YxArticleMapper yxArticleMapper;
@Override
public YxArticleQueryVo getYxArticleById(Serializable id) throws Exception{
return yxArticleMapper.getYxArticleById(id);
}
@Override
public Paging<YxArticleQueryVo> getYxArticlePageList(YxArticleQueryParam yxArticleQueryParam){
Page page = setPageParam(yxArticleQueryParam,OrderItem.desc("add_time"));
IPage<YxArticleQueryVo> iPage = yxArticleMapper.getYxArticlePageList(page,yxArticleQueryParam);
return new Paging(iPage);
}
@Override
public void incVisitNum(int id) {
yxArticleMapper.incVisitNum(id);
}
}

View File

@ -27,7 +27,7 @@ import java.io.Serializable;
* @since 2019-10-02 * @since 2019-10-02
*/ */
@Slf4j @Slf4j
@Service //@Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class YxArticleServiceImpl extends BaseServiceImpl<YxArticleMapper, YxArticle> implements YxArticleService { public class YxArticleServiceImpl extends BaseServiceImpl<YxArticleMapper, YxArticle> implements YxArticleService {

View File

@ -6,7 +6,7 @@ import co.yixiang.common.web.param.IdParam;
import co.yixiang.common.web.vo.Paging; import co.yixiang.common.web.vo.Paging;
import co.yixiang.exception.ErrorRequestException; import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.shop.entity.YxArticle; import co.yixiang.modules.shop.entity.YxArticle;
import co.yixiang.modules.shop.service.YxArticleService; import co.yixiang.modules.shop.service.ArticleService;
import co.yixiang.modules.shop.web.param.YxArticleQueryParam; import co.yixiang.modules.shop.web.param.YxArticleQueryParam;
import co.yixiang.modules.shop.web.vo.YxArticleQueryVo; import co.yixiang.modules.shop.web.vo.YxArticleQueryVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -32,7 +32,7 @@ import javax.validation.Valid;
public class ArticleController extends BaseController { public class ArticleController extends BaseController {
@Autowired @Autowired
private YxArticleService yxArticleService; private ArticleService articleService;
/** /**
@ -41,8 +41,8 @@ public class ArticleController extends BaseController {
@GetMapping("/details/{id}") @GetMapping("/details/{id}")
@ApiOperation(value = "文章详情",notes = "文章详情",response = YxArticleQueryVo.class) @ApiOperation(value = "文章详情",notes = "文章详情",response = YxArticleQueryVo.class)
public ApiResult<YxArticleQueryVo> getYxArticle(@PathVariable Integer id) throws Exception{ public ApiResult<YxArticleQueryVo> getYxArticle(@PathVariable Integer id) throws Exception{
YxArticleQueryVo yxArticleQueryVo = yxArticleService.getYxArticleById(id); YxArticleQueryVo yxArticleQueryVo = articleService.getYxArticleById(id);
yxArticleService.incVisitNum(id); articleService.incVisitNum(id);
return ApiResult.ok(yxArticleQueryVo); return ApiResult.ok(yxArticleQueryVo);
} }
@ -59,7 +59,7 @@ public class ArticleController extends BaseController {
YxArticleQueryParam yxArticleQueryParam = new YxArticleQueryParam(); YxArticleQueryParam yxArticleQueryParam = new YxArticleQueryParam();
yxArticleQueryParam.setCurrent(page); yxArticleQueryParam.setCurrent(page);
yxArticleQueryParam.setSize(limit); yxArticleQueryParam.setSize(limit);
Paging<YxArticleQueryVo> paging = yxArticleService.getYxArticlePageList(yxArticleQueryParam); Paging<YxArticleQueryVo> paging = articleService.getYxArticlePageList(yxArticleQueryParam);
return ApiResult.ok(paging.getRecords()); return ApiResult.ok(paging.getRecords());
} }

View File

@ -36,7 +36,6 @@ public class IndexController {
private final YxSystemGroupDataService systemGroupDataService; private final YxSystemGroupDataService systemGroupDataService;
private final YxSystemConfigService systemConfigService; private final YxSystemConfigService systemConfigService;
private final YxStoreProductService storeProductService; private final YxStoreProductService storeProductService;
private final YxArticleService articleService;
@GetMapping("/index") @GetMapping("/index")
@ApiOperation(value = "首页数据",notes = "首页数据") @ApiOperation(value = "首页数据",notes = "首页数据")

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&characterEncoding=utf8&useSSL=false url: jdbc:log4jdbc:mysql://localhost:3306/yshop?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
username: yshop username: yshop
password: password:
# 初始化配置 # 初始化配置
initial-size: 3 initial-size: 3

View File

@ -23,6 +23,11 @@
<artifactId>wx-java-pay-spring-boot-starter</artifactId> <artifactId>wx-java-pay-spring-boot-starter</artifactId>
<version>3.5.0</version> <version>3.5.0</version>
</dependency> </dependency>
<dependency>
<groupId>co.yixiang</groupId>
<artifactId>yshop-common</artifactId>
<version>1.3</version>
</dependency>
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>com.github.binarywang</groupId>--> <!-- <groupId>com.github.binarywang</groupId>-->
<!-- <artifactId>wx-java-miniapp-spring-boot-starter</artifactId>--> <!-- <artifactId>wx-java-miniapp-spring-boot-starter</artifactId>-->

View File

@ -1,10 +1,11 @@
package co.yixiang.modules.wechat.rest; package co.yixiang.mp.controller;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import co.yixiang.modules.wechat.service.dto.YxArticleQueryCriteria; import co.yixiang.mp.domain.YxArticle;
import co.yixiang.aop.log.Log; import co.yixiang.mp.service.YxArticleService;
import co.yixiang.modules.wechat.domain.YxArticle; import co.yixiang.mp.service.dto.YxArticleQueryCriteria;
import co.yixiang.modules.wechat.service.YxArticleService; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@ -12,7 +13,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize; 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 io.swagger.annotations.*;
/** /**
* @author hupeng * @author hupeng
@ -26,7 +26,7 @@ public class YxArticleController {
@Autowired @Autowired
private YxArticleService yxArticleService; private YxArticleService yxArticleService;
@Log("查询YxArticle")
@ApiOperation(value = "查询YxArticle") @ApiOperation(value = "查询YxArticle")
@GetMapping(value = "/yxArticle") @GetMapping(value = "/yxArticle")
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_SELECT')") @PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_SELECT')")
@ -34,7 +34,7 @@ public class YxArticleController {
return new ResponseEntity(yxArticleService.queryAll(criteria,pageable),HttpStatus.OK); return new ResponseEntity(yxArticleService.queryAll(criteria,pageable),HttpStatus.OK);
} }
@Log("新增YxArticle")
@ApiOperation(value = "新增YxArticle") @ApiOperation(value = "新增YxArticle")
@PostMapping(value = "/yxArticle") @PostMapping(value = "/yxArticle")
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_CREATE')") @PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_CREATE')")
@ -43,7 +43,7 @@ public class YxArticleController {
return new ResponseEntity(yxArticleService.create(resources),HttpStatus.CREATED); return new ResponseEntity(yxArticleService.create(resources),HttpStatus.CREATED);
} }
@Log("修改YxArticle")
@ApiOperation(value = "修改YxArticle") @ApiOperation(value = "修改YxArticle")
@PutMapping(value = "/yxArticle") @PutMapping(value = "/yxArticle")
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_EDIT')") @PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_EDIT')")
@ -52,7 +52,7 @@ public class YxArticleController {
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
} }
@Log("删除YxArticle")
@ApiOperation(value = "删除YxArticle") @ApiOperation(value = "删除YxArticle")
@DeleteMapping(value = "/yxArticle/{id}") @DeleteMapping(value = "/yxArticle/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_DELETE')") @PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_DELETE')")

View File

@ -1,14 +1,13 @@
package co.yixiang.modules.wechat.rest; package co.yixiang.mp.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import co.yixiang.mp.domain.YxCache;
import co.yixiang.exception.BadRequestException; import co.yixiang.mp.service.YxCacheService;
import co.yixiang.modules.wechat.service.YxCacheService; import co.yixiang.utils.OrderUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import co.yixiang.aop.log.Log; import io.swagger.annotations.Api;
import co.yixiang.modules.wechat.domain.YxCache; import io.swagger.annotations.ApiOperation;
import co.yixiang.utils.OrderUtil;
import me.chanjar.weixin.common.bean.menu.WxMenu; import me.chanjar.weixin.common.bean.menu.WxMenu;
import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
@ -17,7 +16,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
/** /**
* @author hupeng * @author hupeng
@ -34,7 +32,7 @@ public class YxCacheController {
@Autowired @Autowired
private WxMpService wxService; private WxMpService wxService;
@Log("查询菜单")
@ApiOperation(value = "查询菜单") @ApiOperation(value = "查询菜单")
@GetMapping(value = "/yxCache") @GetMapping(value = "/yxCache")
@PreAuthorize("hasAnyRole('ADMIN','YXCACHE_ALL','YXCACHE_SELECT')") @PreAuthorize("hasAnyRole('ADMIN','YXCACHE_ALL','YXCACHE_SELECT')")
@ -42,7 +40,7 @@ public class YxCacheController {
return new ResponseEntity(yxCacheService.findById("wechat_menus"),HttpStatus.OK); return new ResponseEntity(yxCacheService.findById("wechat_menus"),HttpStatus.OK);
} }
@Log("创建菜单")
@ApiOperation(value = "创建菜单") @ApiOperation(value = "创建菜单")
@PostMapping(value = "/yxCache") @PostMapping(value = "/yxCache")
@PreAuthorize("hasAnyRole('ADMIN','YXCACHE_ALL','YXCACHE_CREATE')") @PreAuthorize("hasAnyRole('ADMIN','YXCACHE_ALL','YXCACHE_CREATE')")

View File

@ -1,18 +1,18 @@
package co.yixiang.modules.wechat.rest; package co.yixiang.mp.controller;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import co.yixiang.mp.domain.YxWechatReply;
import co.yixiang.mp.service.YxWechatReplyService;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import co.yixiang.aop.log.Log; import io.swagger.annotations.Api;
import co.yixiang.modules.wechat.domain.YxWechatReply; import io.swagger.annotations.ApiOperation;
import co.yixiang.modules.wechat.service.YxWechatReplyService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize; 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 io.swagger.annotations.*;
/** /**
* @author hupeng * @author hupeng
@ -26,7 +26,7 @@ public class YxWechatReplyController {
@Autowired @Autowired
private YxWechatReplyService yxWechatReplyService; private YxWechatReplyService yxWechatReplyService;
@Log("查询")
@ApiOperation(value = "查询") @ApiOperation(value = "查询")
@GetMapping(value = "/yxWechatReply") @GetMapping(value = "/yxWechatReply")
@PreAuthorize("hasAnyRole('ADMIN','YXWECHATREPLY_ALL','YXWECHATREPLY_SELECT')") @PreAuthorize("hasAnyRole('ADMIN','YXWECHATREPLY_ALL','YXWECHATREPLY_SELECT')")
@ -34,7 +34,7 @@ public class YxWechatReplyController {
return new ResponseEntity(yxWechatReplyService.isExist("subscribe"),HttpStatus.OK); return new ResponseEntity(yxWechatReplyService.isExist("subscribe"),HttpStatus.OK);
} }
@Log("新增自动回复")
@ApiOperation(value = "新增自动回复") @ApiOperation(value = "新增自动回复")
@PostMapping(value = "/yxWechatReply") @PostMapping(value = "/yxWechatReply")
@PreAuthorize("hasAnyRole('ADMIN','YXWECHATREPLY_ALL','YXWECHATREPLY_CREATE')") @PreAuthorize("hasAnyRole('ADMIN','YXWECHATREPLY_ALL','YXWECHATREPLY_CREATE')")
@ -56,21 +56,8 @@ public class YxWechatReplyController {
return new ResponseEntity(HttpStatus.CREATED); 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);
}
} }

View File

@ -1,8 +1,9 @@
package co.yixiang.modules.wechat.domain; package co.yixiang.mp.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Data;
import javax.persistence.*; import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,9 +1,13 @@
package co.yixiang.modules.wechat.domain; package co.yixiang.mp.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*; import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable; import java.io.Serializable;
/** /**

View File

@ -1,8 +1,9 @@
package co.yixiang.modules.wechat.domain; package co.yixiang.mp.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Data;
import javax.persistence.*; import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,7 +1,13 @@
package co.yixiang.mp.handler; package co.yixiang.mp.handler;
import java.io.UnsupportedEncodingException;
import java.util.Map; import java.util.Map;
import cn.hutool.core.util.ObjectUtil;
import co.yixiang.mp.domain.YxWechatReply;
import co.yixiang.mp.service.YxWechatReplyService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import co.yixiang.mp.builder.TextBuilder; import co.yixiang.mp.builder.TextBuilder;
@ -16,14 +22,35 @@ import me.chanjar.weixin.mp.bean.result.WxMpUser;
@Component @Component
public class SubscribeHandler extends AbstractHandler { public class SubscribeHandler extends AbstractHandler {
@Autowired
private YxWechatReplyService yxWechatReplyService;
@Override @Override
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
Map<String, Object> context, WxMpService weixinService, Map<String, Object> context, WxMpService weixinService,
WxSessionManager sessionManager) throws WxErrorException { WxSessionManager sessionManager) throws WxErrorException {
//System.out.println("wxMessage:"+wxMessage);
//System.out.println("context:"+context);
YxWechatReply wechatReply = yxWechatReplyService.isExist("subscribe");
if(ObjectUtil.isNull(wechatReply)){
}
String str = JSONObject.parseObject(wechatReply.getData()).getString("content");
try { try {
return new TextBuilder().build("hello yshop", wxMessage, weixinService); //String str = new String(wechatReply.getData().getBytes(),"utf-8");
WxMpXmlOutMessage msg= WxMpXmlOutMessage.TEXT()
.content(str)
.fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.build();
//System.out.println(msg);
return msg;
//return new TextBuilder().build(str, wxMessage, weixinService);
} catch (Exception e) { } catch (Exception e) {
this.logger.error(e.getMessage(), e); this.logger.error(e.getMessage(), e);
} }

View File

@ -1,6 +1,7 @@
package co.yixiang.modules.wechat.repository; package co.yixiang.mp.repository;
import co.yixiang.modules.wechat.domain.YxArticle;
import co.yixiang.mp.domain.YxArticle;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

View File

@ -1,6 +1,7 @@
package co.yixiang.modules.wechat.repository; package co.yixiang.mp.repository;
import co.yixiang.modules.wechat.domain.YxCache;
import co.yixiang.mp.domain.YxCache;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

View File

@ -1,6 +1,6 @@
package co.yixiang.modules.wechat.repository; package co.yixiang.mp.repository;
import co.yixiang.modules.wechat.domain.YxWechatReply; import co.yixiang.mp.domain.YxWechatReply;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

View File

@ -1,11 +1,13 @@
package co.yixiang.modules.wechat.service; package co.yixiang.mp.service;
import co.yixiang.modules.wechat.service.dto.YxArticleQueryCriteria;
import co.yixiang.modules.wechat.domain.YxArticle; import co.yixiang.mp.domain.YxArticle;
import co.yixiang.modules.wechat.service.dto.YxArticleDTO; import co.yixiang.mp.service.dto.YxArticleDTO;
import co.yixiang.mp.service.dto.YxArticleQueryCriteria;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author hupeng * @author hupeng

View File

@ -1,11 +1,13 @@
package co.yixiang.modules.wechat.service; package co.yixiang.mp.service;
import co.yixiang.modules.wechat.service.dto.YxCacheDTO;
import co.yixiang.modules.wechat.service.dto.YxCacheQueryCriteria; import co.yixiang.mp.domain.YxCache;
import co.yixiang.modules.wechat.domain.YxCache; import co.yixiang.mp.service.dto.YxCacheDTO;
import co.yixiang.mp.service.dto.YxCacheQueryCriteria;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author hupeng * @author hupeng

View File

@ -1,11 +1,13 @@
package co.yixiang.modules.wechat.service; package co.yixiang.mp.service;
import co.yixiang.modules.wechat.domain.YxWechatReply;
import co.yixiang.modules.wechat.service.dto.YxWechatReplyDTO; import co.yixiang.mp.domain.YxWechatReply;
import co.yixiang.modules.wechat.service.dto.YxWechatReplyQueryCriteria; import co.yixiang.mp.service.dto.YxWechatReplyDTO;
import co.yixiang.mp.service.dto.YxWechatReplyQueryCriteria;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author hupeng * @author hupeng

View File

@ -1,6 +1,7 @@
package co.yixiang.modules.wechat.service.dto; package co.yixiang.mp.service.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package co.yixiang.modules.wechat.service.dto; package co.yixiang.mp.service.dto;
import lombok.Data; import lombok.Data;

View File

@ -1,6 +1,7 @@
package co.yixiang.modules.wechat.service.dto; package co.yixiang.mp.service.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package co.yixiang.modules.wechat.service.dto; package co.yixiang.mp.service.dto;
import lombok.Data; import lombok.Data;

View File

@ -1,6 +1,7 @@
package co.yixiang.modules.wechat.service.dto; package co.yixiang.mp.service.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package co.yixiang.modules.wechat.service.dto; package co.yixiang.mp.service.dto;
import lombok.Data; import lombok.Data;

View File

@ -1,24 +1,26 @@
package co.yixiang.modules.wechat.service.impl; package co.yixiang.mp.service.impl;
import co.yixiang.modules.wechat.repository.YxArticleRepository;
import co.yixiang.modules.wechat.service.YxArticleService; import co.yixiang.mp.domain.YxArticle;
import co.yixiang.modules.wechat.service.dto.YxArticleQueryCriteria; import co.yixiang.mp.repository.YxArticleRepository;
import co.yixiang.modules.wechat.domain.YxArticle; import co.yixiang.mp.service.YxArticleService;
import co.yixiang.mp.service.dto.YxArticleDTO;
import co.yixiang.mp.service.dto.YxArticleQueryCriteria;
import co.yixiang.mp.service.mapper.YxArticleMapper;
import co.yixiang.utils.OrderUtil; import co.yixiang.utils.OrderUtil;
import co.yixiang.utils.PageUtil;
import co.yixiang.utils.QueryHelp;
import co.yixiang.utils.ValidationUtil; 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.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; 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.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
/** /**
* @author hupeng * @author hupeng

View File

@ -1,24 +1,25 @@
package co.yixiang.modules.wechat.service.impl; package co.yixiang.mp.service.impl;
import co.yixiang.modules.wechat.service.dto.YxCacheDTO;
import co.yixiang.modules.wechat.service.dto.YxCacheQueryCriteria; import co.yixiang.mp.domain.YxCache;
import co.yixiang.modules.wechat.domain.YxCache; import co.yixiang.mp.repository.YxCacheRepository;
import co.yixiang.mp.service.YxCacheService;
import co.yixiang.mp.service.dto.YxCacheDTO;
import co.yixiang.mp.service.dto.YxCacheQueryCriteria;
import co.yixiang.mp.service.mapper.YxCacheMapper;
import co.yixiang.utils.PageUtil;
import co.yixiang.utils.QueryHelp;
import co.yixiang.utils.ValidationUtil; 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.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; 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.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
/** /**
* @author hupeng * @author hupeng

View File

@ -1,24 +1,25 @@
package co.yixiang.modules.wechat.service.impl; package co.yixiang.mp.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.exception.EntityExistException;
import co.yixiang.mp.domain.YxWechatReply;
import co.yixiang.mp.repository.YxWechatReplyRepository;
import co.yixiang.mp.service.YxWechatReplyService;
import co.yixiang.mp.service.dto.YxWechatReplyDTO;
import co.yixiang.mp.service.dto.YxWechatReplyQueryCriteria;
import co.yixiang.mp.service.mapper.YxWechatReplyMapper;
import co.yixiang.utils.PageUtil;
import co.yixiang.utils.QueryHelp;
import co.yixiang.utils.ValidationUtil; import co.yixiang.utils.ValidationUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; 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.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
/** /**
* @author hupeng * @author hupeng

View File

@ -1,8 +1,9 @@
package co.yixiang.modules.wechat.service.mapper; package co.yixiang.mp.service.mapper;
import co.yixiang.mapper.EntityMapper; import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.wechat.domain.YxArticle;
import co.yixiang.modules.wechat.service.dto.YxArticleDTO; import co.yixiang.mp.domain.YxArticle;
import co.yixiang.mp.service.dto.YxArticleDTO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy; import org.mapstruct.ReportingPolicy;

View File

@ -1,8 +1,8 @@
package co.yixiang.modules.wechat.service.mapper; package co.yixiang.mp.service.mapper;
import co.yixiang.modules.wechat.service.dto.YxCacheDTO;
import co.yixiang.mapper.EntityMapper; import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.wechat.domain.YxCache; import co.yixiang.mp.domain.YxCache;
import co.yixiang.mp.service.dto.YxCacheDTO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy; import org.mapstruct.ReportingPolicy;

View File

@ -1,8 +1,8 @@
package co.yixiang.modules.wechat.service.mapper; package co.yixiang.mp.service.mapper;
import co.yixiang.mapper.EntityMapper; import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.wechat.domain.YxWechatReply; import co.yixiang.mp.domain.YxWechatReply;
import co.yixiang.modules.wechat.service.dto.YxWechatReplyDTO; import co.yixiang.mp.service.dto.YxWechatReplyDTO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy; import org.mapstruct.ReportingPolicy;

View File

@ -54,6 +54,7 @@ public class YxStoreCombination implements Serializable {
// 参团人数 // 参团人数
@Column(name = "people",nullable = false) @Column(name = "people",nullable = false)
@NotNull(message = "拼团人数必填")
@Min(value = 2,message = "拼团人数必须大于1") @Min(value = 2,message = "拼团人数必须大于1")
private Integer people; private Integer people;
@ -64,19 +65,23 @@ public class YxStoreCombination implements Serializable {
// 价格 // 价格
@Column(name = "price",nullable = false) @Column(name = "price",nullable = false)
@NotNull(message = "拼团价必填")
@Min(value = 0,message = "拼团价必须大于0") @Min(value = 0,message = "拼团价必须大于0")
private BigDecimal price; private BigDecimal price;
// 排序 // 排序
@Column(name = "sort",nullable = false) @Column(name = "sort",nullable = false)
@NotNull(message = "排序必填")
private Integer sort; private Integer sort;
// 销量 // 销量
@Column(name = "sales",nullable = false) @Column(name = "sales",nullable = false)
@NotNull(message = "销量必填")
private Integer sales; private Integer sales;
// 库存 // 库存
@Column(name = "stock",nullable = false) @Column(name = "stock",nullable = false)
@NotNull(message = "库存必填")
private Integer stock; private Integer stock;
// 添加时间 // 添加时间
@ -85,10 +90,12 @@ public class YxStoreCombination implements Serializable {
// 推荐 // 推荐
@Column(name = "is_host",nullable = false) @Column(name = "is_host",nullable = false)
@NotNull(message = "推荐必须选择")
private Integer isHost; private Integer isHost;
// 产品状态 // 产品状态
@Column(name = "is_show",nullable = false) @Column(name = "is_show",nullable = false)
@NotNull(message = "状态必须选择")
private Integer isShow; private Integer isShow;
@Column(name = "is_del",nullable = false,insertable = false) @Column(name = "is_del",nullable = false,insertable = false)
@ -103,14 +110,17 @@ public class YxStoreCombination implements Serializable {
// 是否包邮1是0否 // 是否包邮1是0否
@Column(name = "is_postage",nullable = false) @Column(name = "is_postage",nullable = false)
@NotNull(message = "包邮状态必须选择")
private Integer isPostage; private Integer isPostage;
// 邮费 // 邮费
@Column(name = "postage",nullable = false) @Column(name = "postage",nullable = false)
@NotNull(message = "邮费必填")
private BigDecimal postage; private BigDecimal postage;
// 拼团内容 // 拼团内容
@Column(name = "description",nullable = false) @Column(name = "description",nullable = false)
@NotBlank(message = "拼团内容不能为空")
private String description; private String description;
// 拼团开始时间 // 拼团开始时间

View File

@ -6,6 +6,7 @@ import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.io.Serializable; import java.io.Serializable;
@ -64,21 +65,25 @@ public class YxStoreProduct implements Serializable {
// 商品价格 // 商品价格
@Column(name = "price",nullable = false) @Column(name = "price",nullable = false)
@NotNull(message = "价格必填")
@Min(value = 0) @Min(value = 0)
private BigDecimal price; private BigDecimal price;
// 会员价格 // 会员价格
@Column(name = "vip_price",nullable = false) @Column(name = "vip_price",nullable = false)
@NotNull(message = "会员价必填")
@Min(value = 0) @Min(value = 0)
private BigDecimal vipPrice; private BigDecimal vipPrice;
// 市场价 // 市场价
@Column(name = "ot_price",nullable = false) @Column(name = "ot_price",nullable = false)
@NotNull(message = "原价必填")
@Min(value = 0) @Min(value = 0)
private BigDecimal otPrice; private BigDecimal otPrice;
// 邮费 // 邮费
@Column(name = "postage",nullable = false) @Column(name = "postage",nullable = false)
@NotNull(message = "邮费必填")
@Min(value = 0) @Min(value = 0)
private BigDecimal postage; private BigDecimal postage;
@ -89,37 +94,45 @@ public class YxStoreProduct implements Serializable {
// 排序 // 排序
@Column(name = "sort",nullable = false) @Column(name = "sort",nullable = false)
@NotNull(message = "排序必填")
@Min(value = 0) @Min(value = 0)
private Integer sort; private Integer sort;
// 销量 // 销量
@Column(name = "sales",nullable = false) @Column(name = "sales",nullable = false)
@NotNull(message = "销量必填")
@Min(value = 0) @Min(value = 0)
private Integer sales; private Integer sales;
// 库存 // 库存
@Column(name = "stock",nullable = false) @Column(name = "stock",nullable = false)
@NotNull(message = "库存必填")
@Min(value = 0) @Min(value = 0)
private Integer stock; private Integer stock;
// 状态0未上架1上架 // 状态0未上架1上架
@Column(name = "is_show",insertable = false) @Column(name = "is_show",insertable = false)
@NotNull(message = "状态必须选择")
private Integer isShow; private Integer isShow;
// 是否热卖 // 是否热卖
@Column(name = "is_hot",columnDefinition="int default 0") @Column(name = "is_hot")
@NotNull(message = "热卖单品必须选择")
private Integer isHot; private Integer isHot;
// 是否优惠 // 是否优惠
@Column(name = "is_benefit",columnDefinition="int default 0") @Column(name = "is_benefit")
@NotNull(message = "优惠推荐必须选择")
private Integer isBenefit; private Integer isBenefit;
// 是否精品 // 是否精品
@Column(name = "is_best",columnDefinition="int default 0") @Column(name = "is_best",columnDefinition="int default 0")
@NotNull(message = "精品状态必须选择")
private Integer isBest; private Integer isBest;
// 是否新品 // 是否新品
@Column(name = "is_new",columnDefinition="int default 0") @Column(name = "is_new",columnDefinition="int default 0")
@NotNull(message = "首发新品必须选择")
private Integer isNew; private Integer isNew;
// 产品描述 // 产品描述
@ -133,6 +146,7 @@ public class YxStoreProduct implements Serializable {
// 是否包邮 // 是否包邮
@Column(name = "is_postage") @Column(name = "is_postage")
@NotNull(message = "包邮状态必须选择")
private Integer isPostage; private Integer isPostage;
// 是否删除 // 是否删除
@ -144,12 +158,14 @@ public class YxStoreProduct implements Serializable {
private Integer merUse; private Integer merUse;
// 获得积分 // 获得积分
@Column(name = "give_integral",columnDefinition="int default 0") @Column(name = "give_integral")
@NotNull(message = "奖励积分不能为空")
@Min(value = 0) @Min(value = 0)
private BigDecimal giveIntegral; private BigDecimal giveIntegral;
// 成本价 // 成本价
@Column(name = "cost",columnDefinition="int default 0") @Column(name = "cost")
@NotNull(message = "成本价不能为空")
@Min(value = 0) @Min(value = 0)
private BigDecimal cost; private BigDecimal cost;