微信模块迁移

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
*/
@Slf4j
@Service
//@Service
@Transactional(rollbackFor = Exception.class)
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.exception.ErrorRequestException;
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.vo.YxArticleQueryVo;
import io.swagger.annotations.Api;
@ -32,7 +32,7 @@ import javax.validation.Valid;
public class ArticleController extends BaseController {
@Autowired
private YxArticleService yxArticleService;
private ArticleService articleService;
/**
@ -41,8 +41,8 @@ public class ArticleController extends BaseController {
@GetMapping("/details/{id}")
@ApiOperation(value = "文章详情",notes = "文章详情",response = YxArticleQueryVo.class)
public ApiResult<YxArticleQueryVo> getYxArticle(@PathVariable Integer id) throws Exception{
YxArticleQueryVo yxArticleQueryVo = yxArticleService.getYxArticleById(id);
yxArticleService.incVisitNum(id);
YxArticleQueryVo yxArticleQueryVo = articleService.getYxArticleById(id);
articleService.incVisitNum(id);
return ApiResult.ok(yxArticleQueryVo);
}
@ -59,7 +59,7 @@ public class ArticleController extends BaseController {
YxArticleQueryParam yxArticleQueryParam = new YxArticleQueryParam();
yxArticleQueryParam.setCurrent(page);
yxArticleQueryParam.setSize(limit);
Paging<YxArticleQueryVo> paging = yxArticleService.getYxArticlePageList(yxArticleQueryParam);
Paging<YxArticleQueryVo> paging = articleService.getYxArticlePageList(yxArticleQueryParam);
return ApiResult.ok(paging.getRecords());
}

View File

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

View File

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

View File

@ -23,6 +23,11 @@
<artifactId>wx-java-pay-spring-boot-starter</artifactId>
<version>3.5.0</version>
</dependency>
<dependency>
<groupId>co.yixiang</groupId>
<artifactId>yshop-common</artifactId>
<version>1.3</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.github.binarywang</groupId>-->
<!-- <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 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 co.yixiang.mp.domain.YxArticle;
import co.yixiang.mp.service.YxArticleService;
import co.yixiang.mp.service.dto.YxArticleQueryCriteria;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@ -12,7 +13,6 @@ 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
@ -26,7 +26,7 @@ public class YxArticleController {
@Autowired
private YxArticleService yxArticleService;
@Log("查询YxArticle")
@ApiOperation(value = "查询YxArticle")
@GetMapping(value = "/yxArticle")
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_SELECT')")
@ -34,7 +34,7 @@ public class YxArticleController {
return new ResponseEntity(yxArticleService.queryAll(criteria,pageable),HttpStatus.OK);
}
@Log("新增YxArticle")
@ApiOperation(value = "新增YxArticle")
@PostMapping(value = "/yxArticle")
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_CREATE')")
@ -43,7 +43,7 @@ public class YxArticleController {
return new ResponseEntity(yxArticleService.create(resources),HttpStatus.CREATED);
}
@Log("修改YxArticle")
@ApiOperation(value = "修改YxArticle")
@PutMapping(value = "/yxArticle")
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_EDIT')")
@ -52,7 +52,7 @@ public class YxArticleController {
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除YxArticle")
@ApiOperation(value = "删除YxArticle")
@DeleteMapping(value = "/yxArticle/{id}")
@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.exception.BadRequestException;
import co.yixiang.modules.wechat.service.YxCacheService;
import co.yixiang.mp.domain.YxCache;
import co.yixiang.mp.service.YxCacheService;
import co.yixiang.utils.OrderUtil;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import me.chanjar.weixin.common.bean.menu.WxMenu;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
@ -17,7 +16,6 @@ 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
@ -34,7 +32,7 @@ public class YxCacheController {
@Autowired
private WxMpService wxService;
@Log("查询菜单")
@ApiOperation(value = "查询菜单")
@GetMapping(value = "/yxCache")
@PreAuthorize("hasAnyRole('ADMIN','YXCACHE_ALL','YXCACHE_SELECT')")
@ -42,7 +40,7 @@ public class YxCacheController {
return new ResponseEntity(yxCacheService.findById("wechat_menus"),HttpStatus.OK);
}
@Log("创建菜单")
@ApiOperation(value = "创建菜单")
@PostMapping(value = "/yxCache")
@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 co.yixiang.mp.domain.YxWechatReply;
import co.yixiang.mp.service.YxWechatReplyService;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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
@ -26,7 +26,7 @@ public class YxWechatReplyController {
@Autowired
private YxWechatReplyService yxWechatReplyService;
@Log("查询")
@ApiOperation(value = "查询")
@GetMapping(value = "/yxWechatReply")
@PreAuthorize("hasAnyRole('ADMIN','YXWECHATREPLY_ALL','YXWECHATREPLY_SELECT')")
@ -34,7 +34,7 @@ public class YxWechatReplyController {
return new ResponseEntity(yxWechatReplyService.isExist("subscribe"),HttpStatus.OK);
}
@Log("新增自动回复")
@ApiOperation(value = "新增自动回复")
@PostMapping(value = "/yxWechatReply")
@PreAuthorize("hasAnyRole('ADMIN','YXWECHATREPLY_ALL','YXWECHATREPLY_CREATE')")
@ -56,21 +56,8 @@ public class YxWechatReplyController {
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.copier.CopyOptions;
import lombok.Data;
import javax.persistence.*;
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.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;
/**

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.copier.CopyOptions;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;

View File

@ -1,7 +1,13 @@
package co.yixiang.mp.handler;
import java.io.UnsupportedEncodingException;
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 co.yixiang.mp.builder.TextBuilder;
@ -16,14 +22,35 @@ import me.chanjar.weixin.mp.bean.result.WxMpUser;
@Component
public class SubscribeHandler extends AbstractHandler {
@Autowired
private YxWechatReplyService yxWechatReplyService;
@Override
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
Map<String, Object> context, WxMpService weixinService,
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 {
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) {
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.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.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.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.modules.wechat.service.dto.YxArticleDTO;
import co.yixiang.mp.domain.YxArticle;
import co.yixiang.mp.service.dto.YxArticleDTO;
import co.yixiang.mp.service.dto.YxArticleQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.util.Map;
/**
* @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.modules.wechat.domain.YxCache;
import co.yixiang.mp.domain.YxCache;
import co.yixiang.mp.service.dto.YxCacheDTO;
import co.yixiang.mp.service.dto.YxCacheQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.util.Map;
/**
* @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.modules.wechat.service.dto.YxWechatReplyQueryCriteria;
import co.yixiang.mp.domain.YxWechatReply;
import co.yixiang.mp.service.dto.YxWechatReplyDTO;
import co.yixiang.mp.service.dto.YxWechatReplyQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.util.Map;
/**
* @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 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;

View File

@ -1,6 +1,7 @@
package co.yixiang.modules.wechat.service.dto;
package co.yixiang.mp.service.dto;
import lombok.Data;
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;

View File

@ -1,6 +1,7 @@
package co.yixiang.modules.wechat.service.dto;
package co.yixiang.mp.service.dto;
import lombok.Data;
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;

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.modules.wechat.service.dto.YxArticleQueryCriteria;
import co.yixiang.modules.wechat.domain.YxArticle;
import co.yixiang.mp.domain.YxArticle;
import co.yixiang.mp.repository.YxArticleRepository;
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.PageUtil;
import co.yixiang.utils.QueryHelp;
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.data.domain.Page;
import org.springframework.data.domain.Pageable;
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;
import java.util.Optional;
/**
* @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.modules.wechat.domain.YxCache;
import co.yixiang.mp.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.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.data.domain.Page;
import org.springframework.data.domain.Pageable;
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;
import java.util.Optional;
/**
* @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.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 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.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;
import java.util.Optional;
/**
* @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.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.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.modules.wechat.domain.YxCache;
import co.yixiang.mp.domain.YxCache;
import co.yixiang.mp.service.dto.YxCacheDTO;
import org.mapstruct.Mapper;
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.modules.wechat.domain.YxWechatReply;
import co.yixiang.modules.wechat.service.dto.YxWechatReplyDTO;
import co.yixiang.mp.domain.YxWechatReply;
import co.yixiang.mp.service.dto.YxWechatReplyDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;

View File

@ -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;
// 拼团开始时间

View File

@ -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;