shop模块代码规范调整

This commit is contained in:
hupeng
2020-02-23 19:57:00 +08:00
parent 83997c7c34
commit 68b3d42f4d
30 changed files with 222 additions and 283 deletions

View File

@ -12,8 +12,8 @@ import co.yixiang.modules.shop.domain.YxUserBill;
import co.yixiang.modules.shop.service.YxUserBillService;
import co.yixiang.modules.shop.service.YxUserService;
import co.yixiang.modules.shop.service.dto.YxUserDTO;
import co.yixiang.modules.wechat.service.YxWechatUserService;
import co.yixiang.modules.wechat.service.dto.YxWechatUserDTO;
import co.yixiang.modules.shop.service.YxWechatUserService;
import co.yixiang.modules.shop.service.dto.YxWechatUserDTO;
import co.yixiang.utils.OrderUtil;
import co.yixiang.utils.RedisUtil;
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;

View File

@ -1,4 +1,4 @@
package co.yixiang.modules.wechat.domain;
package co.yixiang.modules.shop.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;

View File

@ -1,4 +1,4 @@
package co.yixiang.modules.wechat.domain;
package co.yixiang.modules.shop.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;

View File

@ -1,6 +1,6 @@
package co.yixiang.modules.wechat.repository;
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.wechat.domain.YxSystemConfig;
import co.yixiang.modules.shop.domain.YxSystemConfig;
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.modules.shop.repository;
import co.yixiang.modules.wechat.domain.YxWechatUser;
import co.yixiang.modules.shop.domain.YxWechatUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

View File

@ -1,14 +1,11 @@
package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.StrUtil;
import co.yixiang.aop.log.Log;
import co.yixiang.exception.BadRequestException;
import co.yixiang.modules.shop.domain.YxExpress;
import co.yixiang.modules.shop.service.YxExpressService;
import co.yixiang.modules.shop.service.dto.YxExpressQueryCriteria;
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;
import org.springframework.http.ResponseEntity;
@ -20,13 +17,17 @@ import org.springframework.web.bind.annotation.*;
* @author hupeng
* @date 2019-12-12
*/
@Api(tags = "快递管理")
@Api(tags = "商城:快递管理")
@RestController
@RequestMapping("api")
public class YxExpressController {
public class ExpressController {
@Autowired
private YxExpressService yxExpressService;
private final YxExpressService yxExpressService;
public ExpressController(YxExpressService yxExpressService) {
this.yxExpressService = yxExpressService;
}
@Log("查询快递")
@ApiOperation(value = "查询快递")

View File

@ -6,30 +6,26 @@ import co.yixiang.modules.shop.domain.YxMaterial;
import co.yixiang.modules.shop.service.YxMaterialService;
import co.yixiang.modules.shop.service.dto.YxMaterialQueryCriteria;
import co.yixiang.utils.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @author hupeng
* @date 2020-01-09
*/
@Api(tags = "素材管理管理")
@Api(tags = "商城:素材管理管理")
@RestController
@RequestMapping("/api/material")
public class YxMaterialController {
public class MaterialController {
private final YxMaterialService yxMaterialService;
public YxMaterialController(YxMaterialService yxMaterialService) {
public MaterialController(YxMaterialService yxMaterialService) {
this.yxMaterialService = yxMaterialService;
}

View File

@ -4,28 +4,26 @@ import co.yixiang.aop.log.Log;
import co.yixiang.modules.shop.domain.YxMaterialGroup;
import co.yixiang.modules.shop.service.YxMaterialGroupService;
import co.yixiang.modules.shop.service.dto.YxMaterialGroupQueryCriteria;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @author hupeng
* @date 2020-01-09
*/
@Api(tags = "素材分组管理")
@Api(tags = "商城:素材分组管理")
@RestController
@RequestMapping("/api/materialgroup")
public class YxMaterialGroupController {
public class MaterialGroupController {
private final YxMaterialGroupService yxMaterialGroupService;
public YxMaterialGroupController(YxMaterialGroupService yxMaterialGroupService) {
public MaterialGroupController(YxMaterialGroupService yxMaterialGroupService) {
this.yxMaterialGroupService = yxMaterialGroupService;
}

View File

@ -1,19 +1,16 @@
package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import co.yixiang.aop.log.Log;
import co.yixiang.exception.BadRequestException;
import co.yixiang.modules.shop.domain.YxUser;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.shop.service.YxUserService;
import co.yixiang.modules.shop.service.dto.UserMoneyDTO;
import co.yixiang.modules.shop.service.dto.YxUserQueryCriteria;
import co.yixiang.modules.wechat.service.YxSystemConfigService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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;
import org.springframework.http.ResponseEntity;
@ -25,16 +22,18 @@ import org.springframework.web.bind.annotation.*;
* @author hupeng
* @date 2019-10-06
*/
@Api(tags = "用户管理")
@Api(tags = "商城:会员管理")
@RestController
@RequestMapping("api")
public class YxUserController {
public class MemberController {
@Autowired
private YxUserService yxUserService;
private final YxUserService yxUserService;
private final YxSystemConfigService yxSystemConfigService;
@Autowired
private YxSystemConfigService yxSystemConfigService;
public MemberController(YxUserService yxUserService, YxSystemConfigService yxSystemConfigService) {
this.yxUserService = yxUserService;
this.yxSystemConfigService = yxSystemConfigService;
}
@Log("查询用户")
@ApiOperation(value = "查询用户")
@ -86,7 +85,6 @@ public class YxUserController {
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
JSONObject jsonObject = JSON.parseObject(jsonStr);
int status = Integer.valueOf(jsonObject.get("status").toString());
//System.out.println(status);
yxUserService.onStatus(id,status);
return new ResponseEntity(HttpStatus.OK);
}
@ -95,7 +93,6 @@ public class YxUserController {
@PostMapping(value = "/yxUser/money")
@PreAuthorize("@el.check('admin','YXUSER_ALL','YXUSER_EDIT')")
public ResponseEntity updatePrice(@Validated @RequestBody UserMoneyDTO param){
yxUserService.updateMoney(param);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}

View File

@ -10,7 +10,6 @@ import co.yixiang.modules.shop.service.dto.YxStoreCategoryQueryCriteria;
import co.yixiang.utils.OrderUtil;
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;
import org.springframework.http.ResponseEntity;
@ -26,17 +25,19 @@ import java.util.List;
* @author hupeng
* @date 2019-10-03
*/
@Api(tags = "商品分类管理")
@Api(tags = "城:商品分类管理")
@RestController
@RequestMapping("api")
public class YxStoreCategoryController {
@Autowired
private YxStoreCategoryService yxStoreCategoryService;
public class StoreCategoryController {
private final YxStoreCategoryService yxStoreCategoryService;
public StoreCategoryController(YxStoreCategoryService yxStoreCategoryService) {
this.yxStoreCategoryService = yxStoreCategoryService;
}
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/yxStoreCategory/download")
@ -51,7 +52,6 @@ public class YxStoreCategoryController {
@GetMapping(value = "/yxStoreCategory")
@PreAuthorize("@el.check('admin','YXSTORECATEGORY_ALL','YXSTORECATEGORY_SELECT')")
public ResponseEntity getYxStoreCategorys(YxStoreCategoryQueryCriteria criteria, Pageable pageable){
List<YxStoreCategoryDTO> categoryDTOList = yxStoreCategoryService.queryAll(criteria);
return new ResponseEntity(yxStoreCategoryService.buildTree(categoryDTOList),HttpStatus.OK);

View File

@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.aop.log.Log;
import co.yixiang.exception.BadRequestException;
import co.yixiang.modules.shop.domain.YxStoreOrder;
@ -14,8 +15,8 @@ import co.yixiang.modules.shop.service.YxStoreOrderStatusService;
import co.yixiang.modules.shop.service.dto.YxExpressDTO;
import co.yixiang.modules.shop.service.dto.YxStoreOrderDTO;
import co.yixiang.modules.shop.service.dto.YxStoreOrderQueryCriteria;
import co.yixiang.modules.wechat.service.YxWechatUserService;
import co.yixiang.modules.wechat.service.dto.YxWechatUserDTO;
import co.yixiang.modules.shop.service.YxWechatUserService;
import co.yixiang.modules.shop.service.dto.YxWechatUserDTO;
import co.yixiang.mp.domain.YxWechatTemplate;
import co.yixiang.mp.service.WxMpTemplateMessageService;
import co.yixiang.mp.service.YxWechatTemplateService;
@ -24,7 +25,6 @@ import co.yixiang.utils.RedisUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -36,59 +36,59 @@ import java.util.HashMap;
import java.util.Map;
/**
* @author hupeng
* @date 2019-10-14
*/
@Api(tags = "订单管理")
* @author hupeng
* @date 2019-10-14
*/
@Api(tags = "商城:订单管理")
@RestController
@RequestMapping("api")
@Slf4j
public class YxStoreOrderController {
public class StoreOrderController {
@Autowired
private YxStoreOrderService yxStoreOrderService;
@Autowired
private YxStoreOrderStatusService yxStoreOrderStatusService;
@Autowired
private YxExpressService yxExpressService;
@Autowired
private YxWechatUserService wechatUserService;
@Autowired
private WxMpTemplateMessageService templateMessageService;
@Autowired
private YxWechatTemplateService yxWechatTemplateService;
private final YxStoreOrderService yxStoreOrderService;
private final YxStoreOrderStatusService yxStoreOrderStatusService;
private final YxExpressService yxExpressService;
private final YxWechatUserService wechatUserService;
private final WxMpTemplateMessageService templateMessageService;
private final YxWechatTemplateService yxWechatTemplateService;
public StoreOrderController(YxStoreOrderService yxStoreOrderService, YxStoreOrderStatusService yxStoreOrderStatusService,
YxExpressService yxExpressService, YxWechatUserService wechatUserService, WxMpTemplateMessageService templateMessageService,
YxWechatTemplateService yxWechatTemplateService) {
this.yxStoreOrderService = yxStoreOrderService;
this.yxStoreOrderStatusService = yxStoreOrderStatusService;
this.yxExpressService = yxExpressService;
this.wechatUserService = wechatUserService;
this.templateMessageService = templateMessageService;
this.yxWechatTemplateService = yxWechatTemplateService;
}
@GetMapping(value = "/data/count")
//@PreAuthorize("@el.check('admin','YXSTOREORDER_ALL','YXSTOREORDER_SELECT')")
public ResponseEntity getCount(){
return new ResponseEntity(yxStoreOrderService.getOrderTimeData(),HttpStatus.OK);
@AnonymousAccess
public ResponseEntity getCount() {
return new ResponseEntity(yxStoreOrderService.getOrderTimeData(), HttpStatus.OK);
}
@GetMapping(value = "/data/chart")
//@PreAuthorize("@el.check('admin','YXSTOREORDER_ALL','YXSTOREORDER_SELECT')")
public ResponseEntity getChart(){
return new ResponseEntity(yxStoreOrderService.chartCount(),HttpStatus.OK);
@AnonymousAccess
public ResponseEntity getChart() {
return new ResponseEntity(yxStoreOrderService.chartCount(), HttpStatus.OK);
}
@ApiOperation(value = "查询订单")
@GetMapping(value = "/yxStoreOrder")
@PreAuthorize("@el.check('admin','YXSTOREORDER_ALL','YXSTOREORDER_SELECT')")
public ResponseEntity getYxStoreOrders(YxStoreOrderQueryCriteria criteria,
Pageable pageable,
@RequestParam(name = "orderStatus") String orderStatus,
@RequestParam(name = "orderType") String orderType){
@RequestParam(name = "orderType") String orderType) {
if(StrUtil.isNotEmpty(orderStatus)){
switch (orderStatus){
//订单状态查询
if (StrUtil.isNotEmpty(orderStatus)) {
switch (orderStatus) {
case "0":
criteria.setIsDel(0);
criteria.setPaid(0);
@ -134,8 +134,9 @@ public class YxStoreOrderController {
break;
}
}
if(StrUtil.isNotEmpty(orderType)){
switch (orderType){
//订单类型查询
if (StrUtil.isNotEmpty(orderType)) {
switch (orderType) {
case "1":
criteria.setBargainId(0);
criteria.setCombinationId(0);
@ -153,22 +154,19 @@ public class YxStoreOrderController {
}
}
return new ResponseEntity(yxStoreOrderService.queryAll(criteria,pageable),HttpStatus.OK);
return new ResponseEntity(yxStoreOrderService.queryAll(criteria, pageable), HttpStatus.OK);
}
@ApiOperation(value = "发货")
@PutMapping(value = "/yxStoreOrder")
@PreAuthorize("@el.check('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreOrder resources){
if(StrUtil.isBlank(resources.getDeliveryName())) throw new BadRequestException("请选择快递公司");
if(StrUtil.isBlank(resources.getDeliveryId())) throw new BadRequestException("快递单号不能为空");
public ResponseEntity update(@Validated @RequestBody YxStoreOrder resources) {
if (StrUtil.isBlank(resources.getDeliveryName())) throw new BadRequestException("请选择快递公司");
if (StrUtil.isBlank(resources.getDeliveryId())) throw new BadRequestException("快递单号不能为空");
YxExpressDTO expressDTO = yxExpressService.findById(Integer.valueOf(resources
.getDeliveryName()));
if(ObjectUtil.isNull(expressDTO)){
if (ObjectUtil.isNull(expressDTO)) {
throw new BadRequestException("请先添加快递公司");
}
resources.setStatus(1);
@ -181,35 +179,35 @@ public class YxStoreOrderController {
YxStoreOrderStatus storeOrderStatus = new YxStoreOrderStatus();
storeOrderStatus.setOid(resources.getId());
storeOrderStatus.setChangeType("delivery_goods");
storeOrderStatus.setChangeMessage("已发货 快递公司:"+resources.getDeliveryName()
+" 快递单号:"+resources.getDeliveryId());
storeOrderStatus.setChangeMessage("已发货 快递公司:" + resources.getDeliveryName()
+ " 快递单号:" + resources.getDeliveryId());
storeOrderStatus.setChangeTime(OrderUtil.getSecondTimestampTwo());
yxStoreOrderStatusService.create(storeOrderStatus);
//模板消息通知
String siteUrl = RedisUtil.get("site_url");
try{
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
if(ObjectUtil.isNotNull(wechatUser)){
if(StrUtil.isNotBlank(wechatUser.getOpenid())){
try {
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
if (ObjectUtil.isNotNull(wechatUser)) {
if (StrUtil.isNotBlank(wechatUser.getOpenid())) {
YxWechatTemplate WechatTemplate = yxWechatTemplateService
.findByTempkey("OPENTM200565259");
Map<String,String> map = new HashMap<>();
map.put("first","亲,宝贝已经启程了,好想快点来到你身边。");
map.put("keyword1",resources.getOrderId());//订单号
map.put("keyword2",expressDTO.getName());
map.put("keyword3",resources.getDeliveryId());
map.put("remark","yshop电商系统为你服务");
templateMessageService.sendWxMpTemplateMessage( wechatUser.getOpenid()
,WechatTemplate.getTempid(),
siteUrl+"/order/detail/"+resources.getOrderId(),map);
}else if(StrUtil.isNotBlank(wechatUser.getRoutineOpenid())){
Map<String, String> map = new HashMap<>();
map.put("first", "亲,宝贝已经启程了,好想快点来到你身边。");
map.put("keyword1", resources.getOrderId());//订单号
map.put("keyword2", expressDTO.getName());
map.put("keyword3", resources.getDeliveryId());
map.put("remark", "yshop电商系统为你服务");
templateMessageService.sendWxMpTemplateMessage(wechatUser.getOpenid()
, WechatTemplate.getTempid(),
siteUrl + "/order/detail/" + resources.getOrderId(), map);
} else if (StrUtil.isNotBlank(wechatUser.getRoutineOpenid())) {
//todo 小程序通知
}
}
}catch (Exception e){
} catch (Exception e) {
log.info("当前用户不是微信用户不能发送模板消息哦!");
}
@ -221,32 +219,32 @@ public class YxStoreOrderController {
@ApiOperation(value = "退款")
@PostMapping(value = "/yxStoreOrder/refund")
@PreAuthorize("@el.check('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity refund(@Validated @RequestBody YxStoreOrder resources){
public ResponseEntity refund(@Validated @RequestBody YxStoreOrder resources) {
yxStoreOrderService.refund(resources);
//模板消息通知
String siteUrl = RedisUtil.get("site_url");
try{
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
if(ObjectUtil.isNotNull(wechatUser)){
if(StrUtil.isNotBlank(wechatUser.getOpenid())){
try {
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
if (ObjectUtil.isNotNull(wechatUser)) {
if (StrUtil.isNotBlank(wechatUser.getOpenid())) {
YxWechatTemplate WechatTemplate = yxWechatTemplateService
.findByTempkey("OPENTM410119152");
Map<String,String> map = new HashMap<>();
map.put("first","您在yshop的订单退款申请被通过钱款将很快还至您的支付账户。");
map.put("keyword1",resources.getOrderId());//订单号
map.put("keyword2",resources.getPayPrice().toString());
Map<String, String> map = new HashMap<>();
map.put("first", "您在yshop的订单退款申请被通过钱款将很快还至您的支付账户。");
map.put("keyword1", resources.getOrderId());//订单号
map.put("keyword2", resources.getPayPrice().toString());
map.put("keyword3", OrderUtil.stampToDate(resources.getAddTime().toString()));
map.put("remark","yshop电商系统为你服务");
templateMessageService.sendWxMpTemplateMessage( wechatUser.getOpenid()
,WechatTemplate.getTempid(),
siteUrl+"/order/detail/"+resources.getOrderId(),map);
}else if(StrUtil.isNotBlank(wechatUser.getRoutineOpenid())){
map.put("remark", "yshop电商系统为你服务");
templateMessageService.sendWxMpTemplateMessage(wechatUser.getOpenid()
, WechatTemplate.getTempid(),
siteUrl + "/order/detail/" + resources.getOrderId(), map);
} else if (StrUtil.isNotBlank(wechatUser.getRoutineOpenid())) {
//todo 小程序通知
}
}
}catch (Exception e){
} catch (Exception e) {
log.info("当前用户不是微信用户不能发送模板消息哦!");
}
@ -259,28 +257,27 @@ public class YxStoreOrderController {
@ApiOperation(value = "删除")
@DeleteMapping(value = "/yxStoreOrder/{id}")
@PreAuthorize("@el.check('admin','YXSTOREORDER_ALL','YXSTOREORDER_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
public ResponseEntity delete(@PathVariable Integer id) {
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
yxStoreOrderService.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
@Log("修改订单")
@ApiOperation(value = "修改订单")
@PostMapping(value = "/yxStoreOrder/edit")
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity editOrder(@RequestBody YxStoreOrder resources){
if(ObjectUtil.isNull(resources.getPayPrice())) throw new BadRequestException("请输入支付金额");
if(resources.getPayPrice().doubleValue() < 0) throw new BadRequestException("金额不能低于0");
public ResponseEntity editOrder(@RequestBody YxStoreOrder resources) {
if (ObjectUtil.isNull(resources.getPayPrice())) throw new BadRequestException("请输入支付金额");
if (resources.getPayPrice().doubleValue() < 0) throw new BadRequestException("金额不能低于0");
YxStoreOrderDTO storeOrder = yxStoreOrderService.findById(resources.getId());
//判断金额是否有变动,生成一个额外订单号去支付
int res = NumberUtil.compare(storeOrder.getPayPrice().doubleValue(),resources.getPayPrice().doubleValue());
if(res != 0){
String orderSn = IdUtil.getSnowflake(0,0).nextIdStr();
int res = NumberUtil.compare(storeOrder.getPayPrice().doubleValue(), resources.getPayPrice().doubleValue());
if (res != 0) {
String orderSn = IdUtil.getSnowflake(0, 0).nextIdStr();
resources.setExtendOrderId(orderSn);
}
@ -290,7 +287,7 @@ public class YxStoreOrderController {
YxStoreOrderStatus storeOrderStatus = new YxStoreOrderStatus();
storeOrderStatus.setOid(resources.getId());
storeOrderStatus.setChangeType("order_edit");
storeOrderStatus.setChangeMessage("修改订单价格为:"+resources.getPayPrice());
storeOrderStatus.setChangeMessage("修改订单价格为:" + resources.getPayPrice());
storeOrderStatus.setChangeTime(OrderUtil.getSecondTimestampTwo());
yxStoreOrderStatusService.create(storeOrderStatus);
@ -301,8 +298,8 @@ public class YxStoreOrderController {
@ApiOperation(value = "修改订单备注")
@PostMapping(value = "/yxStoreOrder/remark")
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity editOrderRemark(@RequestBody YxStoreOrder resources){
if(StrUtil.isBlank(resources.getRemark())) throw new BadRequestException("请输入备注");
public ResponseEntity editOrderRemark(@RequestBody YxStoreOrder resources) {
if (StrUtil.isBlank(resources.getRemark())) throw new BadRequestException("请输入备注");
yxStoreOrderService.update(resources);
return new ResponseEntity(HttpStatus.OK);
}

View File

@ -3,7 +3,6 @@ package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import co.yixiang.aop.log.Log;
import co.yixiang.exception.BadRequestException;
import co.yixiang.modules.shop.domain.YxStoreProduct;
import co.yixiang.modules.shop.service.YxStoreProductService;
import co.yixiang.modules.shop.service.dto.YxStoreProductQueryCriteria;
@ -12,7 +11,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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;
import org.springframework.http.ResponseEntity;
@ -26,13 +24,16 @@ import java.math.BigDecimal;
* @author hupeng
* @date 2019-10-04
*/
@Api(tags = "商品管理")
@Api(tags = "城:商品管理")
@RestController
@RequestMapping("api")
public class YxStoreProductController {
public class StoreProductController {
@Autowired
private YxStoreProductService yxStoreProductService;
private final YxStoreProductService yxStoreProductService;
public StoreProductController(YxStoreProductService yxStoreProductService) {
this.yxStoreProductService = yxStoreProductService;
}
@Log("查询商品")
@ApiOperation(value = "查询商品")
@ -82,7 +83,7 @@ public class YxStoreProductController {
return new ResponseEntity(HttpStatus.OK);
}
@ApiOperation(value = "商品上架下架")
@ApiOperation(value = "商品上架/下架")
@PostMapping(value = "/yxStoreProduct/onsale/{id}")
public ResponseEntity onSale(@PathVariable Integer id,@RequestBody String jsonStr){
JSONObject jsonObject = JSON.parseObject(jsonStr);

View File

@ -1,14 +1,11 @@
package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.StrUtil;
import co.yixiang.aop.log.Log;
import co.yixiang.exception.BadRequestException;
import co.yixiang.modules.shop.domain.YxStoreProductReply;
import co.yixiang.modules.shop.service.YxStoreProductReplyService;
import co.yixiang.modules.shop.service.dto.YxStoreProductReplyQueryCriteria;
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;
import org.springframework.http.ResponseEntity;
@ -20,13 +17,17 @@ import org.springframework.web.bind.annotation.*;
* @author hupeng
* @date 2019-11-03
*/
@Api(tags = "评论管理")
@Api(tags = "商城:评论管理")
@RestController
@RequestMapping("api")
public class YxStoreProductReplyController {
public class StoreProductReplyController {
@Autowired
private YxStoreProductReplyService yxStoreProductReplyService;
private final YxStoreProductReplyService yxStoreProductReplyService;
public StoreProductReplyController(YxStoreProductReplyService yxStoreProductReplyService) {
this.yxStoreProductReplyService = yxStoreProductReplyService;
}
@Log("查询")
@ApiOperation(value = "查询")

View File

@ -1,19 +1,16 @@
package co.yixiang.modules.wechat.rest;
package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import co.yixiang.aop.log.Log;
import co.yixiang.exception.BadRequestException;
import co.yixiang.modules.wechat.domain.YxSystemConfig;
import co.yixiang.modules.wechat.service.YxSystemConfigService;
import co.yixiang.modules.wechat.service.dto.YxSystemConfigQueryCriteria;
import co.yixiang.modules.shop.domain.YxSystemConfig;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.shop.service.dto.YxSystemConfigQueryCriteria;
import co.yixiang.mp.config.WxMpConfiguration;
import co.yixiang.utils.RedisUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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;
import org.springframework.http.ResponseEntity;
@ -24,13 +21,16 @@ import org.springframework.web.bind.annotation.*;
* @author hupeng
* @date 2019-10-10
*/
@Api(tags = "配置管理")
@Api(tags = "商城:配置管理")
@RestController
@RequestMapping("api")
public class YxSystemConfigController {
public class SystemConfigController {
@Autowired
private YxSystemConfigService yxSystemConfigService;
private final YxSystemConfigService yxSystemConfigService;
public SystemConfigController(YxSystemConfigService yxSystemConfigService) {
this.yxSystemConfigService = yxSystemConfigService;
}
@Log("查询")
@ApiOperation(value = "查询")

View File

@ -25,13 +25,16 @@ import org.springframework.web.bind.annotation.*;
* @author hupeng
* @date 2019-10-18
*/
@Api(tags = "数据配置管理")
@Api(tags = "商城:数据配置管理")
@RestController
@RequestMapping("api")
public class YxSystemGroupDataController {
public class SystemGroupDataController {
@Autowired
private YxSystemGroupDataService yxSystemGroupDataService;
private final YxSystemGroupDataService yxSystemGroupDataService;
public SystemGroupDataController(YxSystemGroupDataService yxSystemGroupDataService) {
this.yxSystemGroupDataService = yxSystemGroupDataService;
}
@Log("查询数据配置")
@ApiOperation(value = "查询数据配置")
@ -40,7 +43,7 @@ public class YxSystemGroupDataController {
public ResponseEntity getYxSystemGroupDatas(YxSystemGroupDataQueryCriteria criteria,
Pageable pageable){
Sort sort = new Sort(Sort.Direction.DESC, "sort");
Pageable pageableT = new PageRequest(pageable.getPageNumber(),
Pageable pageableT = PageRequest.of(pageable.getPageNumber(),
pageable.getPageSize(),
sort);
return new ResponseEntity(yxSystemGroupDataService.queryAll(criteria,pageableT),HttpStatus.OK);

View File

@ -1,15 +1,12 @@
package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.StrUtil;
import co.yixiang.aop.log.Log;
import co.yixiang.exception.BadRequestException;
import co.yixiang.modules.shop.domain.YxSystemUserLevel;
import co.yixiang.modules.shop.service.YxSystemUserLevelService;
import co.yixiang.modules.shop.service.dto.YxSystemUserLevelQueryCriteria;
import co.yixiang.utils.OrderUtil;
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;
import org.springframework.http.ResponseEntity;
@ -21,13 +18,16 @@ import org.springframework.web.bind.annotation.*;
* @author hupeng
* @date 2019-12-04
*/
@Api(tags = "用户等级管理")
@Api(tags = "商城:用户等级管理")
@RestController
@RequestMapping("api")
public class YxSystemUserLevelController {
public class SystemUserLevelController {
@Autowired
private YxSystemUserLevelService yxSystemUserLevelService;
private final YxSystemUserLevelService yxSystemUserLevelService;
public SystemUserLevelController(YxSystemUserLevelService yxSystemUserLevelService) {
this.yxSystemUserLevelService = yxSystemUserLevelService;
}
@Log("查询")
@ApiOperation(value = "查询")

View File

@ -1,8 +1,6 @@
package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.StrUtil;
import co.yixiang.aop.log.Log;
import co.yixiang.exception.BadRequestException;
import co.yixiang.modules.shop.domain.YxSystemUserTask;
import co.yixiang.modules.shop.service.YxSystemUserTaskService;
import co.yixiang.modules.shop.service.dto.YxSystemUserTaskQueryCriteria;
@ -22,13 +20,16 @@ import org.springframework.web.bind.annotation.*;
* @author hupeng
* @date 2019-12-04
*/
@Api(tags = "用户任务管理")
@Api(tags = "商城:用户任务管理")
@RestController
@RequestMapping("api")
public class YxSystemUserTaskController {
public class SystemUserTaskController {
@Autowired
private YxSystemUserTaskService yxSystemUserTaskService;
private final YxSystemUserTaskService yxSystemUserTaskService;
public SystemUserTaskController(YxSystemUserTaskService yxSystemUserTaskService) {
this.yxSystemUserTaskService = yxSystemUserTaskService;
}
@Log("查询")
@ApiOperation(value = "查询")
@ -37,7 +38,7 @@ public class YxSystemUserTaskController {
public ResponseEntity getYxSystemUserTasks(YxSystemUserTaskQueryCriteria criteria,
Pageable pageable){
Sort sort = new Sort(Sort.Direction.ASC, "levelId");
Pageable pageableT = new PageRequest(pageable.getPageNumber(),
Pageable pageableT = PageRequest.of(pageable.getPageNumber(),
pageable.getPageSize(),
sort);
return new ResponseEntity(yxSystemUserTaskService.queryAll(criteria,pageableT),

View File

@ -5,7 +5,6 @@ import co.yixiang.modules.shop.service.YxUserBillService;
import co.yixiang.modules.shop.service.dto.YxUserBillQueryCriteria;
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;
import org.springframework.http.ResponseEntity;
@ -18,13 +17,16 @@ import org.springframework.web.bind.annotation.RestController;
* @author hupeng
* @date 2019-11-06
*/
@Api(tags = "用户账单管理")
@Api(tags = "商城:用户账单管理")
@RestController
@RequestMapping("api")
public class YxUserBillController {
public class UserBillController {
@Autowired
private YxUserBillService yxUserBillService;
private final YxUserBillService yxUserBillService;
public UserBillController(YxUserBillService yxUserBillService) {
this.yxUserBillService = yxUserBillService;
}
@Log("查询")
@ApiOperation(value = "查询")

View File

@ -1,8 +1,8 @@
package co.yixiang.modules.wechat.service;
package co.yixiang.modules.shop.service;
import co.yixiang.modules.wechat.domain.YxSystemConfig;
import co.yixiang.modules.wechat.service.dto.YxSystemConfigDTO;
import co.yixiang.modules.wechat.service.dto.YxSystemConfigQueryCriteria;
import co.yixiang.modules.shop.domain.YxSystemConfig;
import co.yixiang.modules.shop.service.dto.YxSystemConfigDTO;
import co.yixiang.modules.shop.service.dto.YxSystemConfigQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;

View File

@ -1,8 +1,8 @@
package co.yixiang.modules.wechat.service;
package co.yixiang.modules.shop.service;
import co.yixiang.modules.wechat.domain.YxWechatUser;
import co.yixiang.modules.wechat.service.dto.YxWechatUserDTO;
import co.yixiang.modules.wechat.service.dto.YxWechatUserQueryCriteria;
import co.yixiang.modules.shop.domain.YxWechatUser;
import co.yixiang.modules.shop.service.dto.YxWechatUserDTO;
import co.yixiang.modules.shop.service.dto.YxWechatUserQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;

View File

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

View File

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

View File

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

View File

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

View File

@ -29,11 +29,14 @@ import java.util.Optional;
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxExpressServiceImpl implements YxExpressService {
@Autowired
private YxExpressRepository yxExpressRepository;
private final YxExpressRepository yxExpressRepository;
@Autowired
private YxExpressMapper yxExpressMapper;
private final YxExpressMapper yxExpressMapper;
public YxExpressServiceImpl(YxExpressRepository yxExpressRepository, YxExpressMapper yxExpressMapper) {
this.yxExpressRepository = yxExpressRepository;
this.yxExpressMapper = yxExpressMapper;
}
@Override
public Map<String,Object> queryAll(YxExpressQueryCriteria criteria, Pageable pageable){

View File

@ -1,11 +1,11 @@
package co.yixiang.modules.wechat.service.impl;
package co.yixiang.modules.shop.service.impl;
import co.yixiang.modules.wechat.domain.YxSystemConfig;
import co.yixiang.modules.wechat.repository.YxSystemConfigRepository;
import co.yixiang.modules.wechat.service.YxSystemConfigService;
import co.yixiang.modules.wechat.service.dto.YxSystemConfigDTO;
import co.yixiang.modules.wechat.service.dto.YxSystemConfigQueryCriteria;
import co.yixiang.modules.wechat.service.mapper.YxSystemConfigMapper;
import co.yixiang.modules.shop.domain.YxSystemConfig;
import co.yixiang.modules.shop.repository.YxSystemConfigRepository;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.shop.service.dto.YxSystemConfigDTO;
import co.yixiang.modules.shop.service.dto.YxSystemConfigQueryCriteria;
import co.yixiang.modules.shop.service.mapper.YxSystemConfigMapper;
import co.yixiang.utils.PageUtil;
import co.yixiang.utils.QueryHelp;
import co.yixiang.utils.ValidationUtil;

View File

@ -1,11 +1,11 @@
package co.yixiang.modules.wechat.service.impl;
package co.yixiang.modules.shop.service.impl;
import co.yixiang.modules.wechat.domain.YxWechatUser;
import co.yixiang.modules.wechat.repository.YxWechatUserRepository;
import co.yixiang.modules.wechat.service.YxWechatUserService;
import co.yixiang.modules.wechat.service.dto.YxWechatUserDTO;
import co.yixiang.modules.wechat.service.dto.YxWechatUserQueryCriteria;
import co.yixiang.modules.wechat.service.mapper.YxWechatUserMapper;
import co.yixiang.modules.shop.domain.YxWechatUser;
import co.yixiang.modules.shop.repository.YxWechatUserRepository;
import co.yixiang.modules.shop.service.YxWechatUserService;
import co.yixiang.modules.shop.service.dto.YxWechatUserDTO;
import co.yixiang.modules.shop.service.dto.YxWechatUserQueryCriteria;
import co.yixiang.modules.shop.service.mapper.YxWechatUserMapper;
import co.yixiang.utils.PageUtil;
import co.yixiang.utils.QueryHelp;
import co.yixiang.utils.ValidationUtil;

View File

@ -1,8 +1,8 @@
package co.yixiang.modules.wechat.service.mapper;
package co.yixiang.modules.shop.service.mapper;
import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.wechat.domain.YxSystemConfig;
import co.yixiang.modules.wechat.service.dto.YxSystemConfigDTO;
import co.yixiang.modules.shop.domain.YxSystemConfig;
import co.yixiang.modules.shop.service.dto.YxSystemConfigDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;

View File

@ -1,8 +1,8 @@
package co.yixiang.modules.wechat.service.mapper;
package co.yixiang.modules.shop.service.mapper;
import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.wechat.domain.YxWechatUser;
import co.yixiang.modules.wechat.service.dto.YxWechatUserDTO;
import co.yixiang.modules.shop.domain.YxWechatUser;
import co.yixiang.modules.shop.service.dto.YxWechatUserDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;

View File

@ -1,61 +0,0 @@
package co.yixiang.modules.wechat.rest;//package co.yixiang.modules.wechat.rest;
//
//import co.yixiang.aop.log.Log;
//import co.yixiang.modules.wechat.domain.YxWechatUser;
//import co.yixiang.modules.wechat.service.YxWechatUserService;
//import co.yixiang.modules.wechat.service.dto.YxWechatUserQueryCriteria;
//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-12-13
//*/
//@Api(tags = "YxWechatUser管理")
//@RestController
//@RequestMapping("api")
//public class YxWechatUserController {
//
// @Autowired
// private YxWechatUserService yxWechatUserService;
//
// @Log("查询YxWechatUser")
// @ApiOperation(value = "查询YxWechatUser")
// @GetMapping(value = "/yxWechatUser")
// @PreAuthorize("@el.check('admin','YXWECHATUSER_ALL','YXWECHATUSER_SELECT')")
// public ResponseEntity getYxWechatUsers(YxWechatUserQueryCriteria criteria, Pageable pageable){
// return new ResponseEntity(yxWechatUserService.queryAll(criteria,pageable),HttpStatus.OK);
// }
//
// @Log("新增YxWechatUser")
// @ApiOperation(value = "新增YxWechatUser")
// @PostMapping(value = "/yxWechatUser")
// @PreAuthorize("@el.check('admin','YXWECHATUSER_ALL','YXWECHATUSER_CREATE')")
// public ResponseEntity create(@Validated @RequestBody YxWechatUser resources){
// return new ResponseEntity(yxWechatUserService.create(resources),HttpStatus.CREATED);
// }
//
// @Log("修改YxWechatUser")
// @ApiOperation(value = "修改YxWechatUser")
// @PutMapping(value = "/yxWechatUser")
// @PreAuthorize("@el.check('admin','YXWECHATUSER_ALL','YXWECHATUSER_EDIT')")
// public ResponseEntity update(@Validated @RequestBody YxWechatUser resources){
// yxWechatUserService.update(resources);
// return new ResponseEntity(HttpStatus.NO_CONTENT);
// }
//
// @Log("删除YxWechatUser")
// @ApiOperation(value = "删除YxWechatUser")
// @DeleteMapping(value = "/yxWechatUser/{uid}")
// @PreAuthorize("@el.check('admin','YXWECHATUSER_ALL','YXWECHATUSER_DELETE')")
// public ResponseEntity delete(@PathVariable Integer uid){
// yxWechatUserService.delete(uid);
// return new ResponseEntity(HttpStatus.OK);
// }
//}