diff --git a/poster.jpg b/poster.jpg new file mode 100644 index 00000000..7687578a Binary files /dev/null and b/poster.jpg differ diff --git a/simsunb.ttf b/simsunb.ttf new file mode 100644 index 00000000..1c14f7fa Binary files /dev/null and b/simsunb.ttf differ diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index f620d1ef..eaf1860f 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -244,7 +244,7 @@ dubbo: bxg: shop: # API_URL: http://192.168.10.113:48080/bxgApp - API_URL: https://8d9e-27-19-79-216.jp.ngrok.io + API_URL: https://5361-27-19-79-51.jp.ngrok.io SITE_URL: http://192.168.10.113:48080/bxgApp UNI_SITE_URL: http://192.168.10.113:48080/bxgApp ADMIN_API_URL: http://192.168.10.113:48080/bxg diff --git a/zsw-bxg/pom.xml b/zsw-bxg/pom.xml index 463454cd..f7930a76 100644 --- a/zsw-bxg/pom.xml +++ b/zsw-bxg/pom.xml @@ -164,6 +164,11 @@ fastjson 1.2.50 + + org.apache.httpcomponents + httpclient + 4.5.12 + diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/banner/Banner.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/banner/Banner.java new file mode 100644 index 00000000..f266183e --- /dev/null +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/banner/Banner.java @@ -0,0 +1,18 @@ +package co.yixiang.app.modules.banner; + +import lombok.Data; + +@Data +public class Banner { + //首页标题 + private String name; + //id + private String id; + //排序 + private String sort; + //url链接 + private String url; + //type + private Integer type; + +} diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/entry/rest/AppStoreEntryController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/entry/rest/AppStoreEntryController.java index f93abd9f..27e331c9 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/entry/rest/AppStoreEntryController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/entry/rest/AppStoreEntryController.java @@ -36,11 +36,23 @@ public class AppStoreEntryController { * 查询词条讲解 */ @AnonymousAccess - @GetMapping("/entry{id}") - @ApiOperation(value = "词条查询",notes = "词条") + @GetMapping("/entry/{id}") + @ApiOperation(value = "词条id查询词条",notes = "词条") public ApiResult getYxEntry(@PathVariable int id){ EntryDTO entryDTO=yxStoreEntryService.getEntry(id); return ApiResult.ok(entryDTO); } + /** + * 查询词条讲解 + */ + @AnonymousAccess + @GetMapping("/entryByName") + @ApiOperation(value = "根据词条名查询词条",notes = "词条") + public ApiResult getEntryByName(String name){ + + EntryDTO entryDTO=yxStoreEntryService.getEntryByName(name); + return ApiResult.ok(entryDTO); + } + } \ No newline at end of file diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/rest/AppStoreEvaluationController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/rest/AppStoreEvaluationController.java index 94a30601..b8f28412 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/rest/AppStoreEvaluationController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/rest/AppStoreEvaluationController.java @@ -66,7 +66,8 @@ public class AppStoreEvaluationController { @GetMapping("/evaluation/{id}") @ApiOperation(value = "评测查询",notes = "产品评测") public ApiResult getYxEvaluation(@PathVariable int id){ - EvaluationDTO evaluationDTO=yxEvaluationService.getEvaluationById(id); + long uid = LocalUser.getUidByToken(); + EvaluationDTO evaluationDTO=yxEvaluationService.getEvaluationById(uid,id); return ApiResult.ok(evaluationDTO); } diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java index ee5b0dc3..19a9ff4d 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java @@ -222,10 +222,6 @@ public class AppStoreOrderController { orderSupplyService.goPay(map, orderId, uid, param.getPaytype(), param.getFrom(), orderDTO); - //这里判断是否支付成功 - if (map!=null){ - sendMsgService.inform(Long.valueOf(orderId)); - } return ApiResult.ok(map); } @@ -237,7 +233,7 @@ public class AppStoreOrderController { @AuthCheck @GetMapping("/order/list") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "商品状态,-1全部 默认为0未支付 1待发货 2待收货 3待评价 4已完成 5退款中 6已退款 7退款", + @ApiImplicitParam(name = "type", value = "商品状态,-1全部 默认为0未支付 1待发货 2待收货 3待评价 4已完成 5退款中 6已退款 7退款 8已取消", paramType = "query", dataType = "int",dataTypeClass = Integer.class), @ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class), @ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class) @@ -382,7 +378,6 @@ public class AppStoreOrderController { list.add("收到商品损坏了"); list.add("未按预定时间发货"); list.add("其它原因"); - return ApiResult.ok(list); } diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/LetterAppUserController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/LetterAppUserController.java index 5f2fe42a..271efb28 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/LetterAppUserController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/LetterAppUserController.java @@ -18,7 +18,7 @@ import co.yixiang.logging.aop.log.AppLog; import co.yixiang.constant.ShopConstants; import co.yixiang.enums.BillInfoEnum; import co.yixiang.modules.evaluation.service.YxEvaluationRelationService; -import co.yixiang.modules.evaluation.service.vo.YxStoreEvaluationRelationQueryVo; +import co.yixiang.modules.evaluation.vo.YxStoreEvaluationRelationQueryVo; import co.yixiang.modules.order.service.YxStoreOrderService; import co.yixiang.modules.order.vo.UserOrderCountVo; import co.yixiang.modules.product.service.YxStoreProductRelationService; @@ -31,6 +31,7 @@ import co.yixiang.modules.user.service.YxUserService; import co.yixiang.modules.user.service.YxUserSignService; import co.yixiang.modules.user.vo.SignVo; import co.yixiang.modules.user.vo.YxUserQueryVo; +import com.alibaba.fastjson.JSONObject; import com.google.common.collect.Maps; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -40,12 +41,9 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -98,8 +96,48 @@ public class LetterAppUserController { return ApiResult.ok(map); } + /** + * 获取各类轮播图 + */ + @GetMapping("/menu/banner/{type}") + @ApiOperation(value = "获取各种轮播图(0:首页 1:品牌馆 2:优惠券 3:活动专区)",notes = "获取轮播图") + public ApiResult> bannerMenu(@PathVariable Integer type){ + Map map = new LinkedHashMap<>(); +// map.put("banner",systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_BANNER)); + List list=systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_BANNER); + ArrayList bannerList=new ArrayList<>(); + list.forEach(item->{ + if(item.get("type")==type){ + bannerList.add(item); + } + }); + map.put("banner",bannerList); + return ApiResult.ok(map); + } + /** + * 获取常见问答 + */ + @GetMapping("/menu/problem") + @ApiOperation(value = "获取常见问答",notes = "获取常见问答") + public ApiResult> problem(){ + Map map = new LinkedHashMap<>(); + map.put("routine_problem",systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_PROBLEM)); + return ApiResult.ok(map); + } + + /** + * 获取关于我们 + */ + @GetMapping("/menu/aboutUs") + @ApiOperation(value = "获取关于我们",notes = "获取关于我们") + public ApiResult> aboutUs(){ + Map map = new LinkedHashMap<>(); + map.put("routine_aboutUs",systemConfigService.getData(ShopConstants.ZSW_HOME_ABOUTUS)); + return ApiResult.ok(map); + } + /** * 订单统计数据 */ diff --git a/zsw-bxg/src/main/java/co/yixiang/constant/ShopConstants.java b/zsw-bxg/src/main/java/co/yixiang/constant/ShopConstants.java index 8476ca47..6b14b53a 100644 --- a/zsw-bxg/src/main/java/co/yixiang/constant/ShopConstants.java +++ b/zsw-bxg/src/main/java/co/yixiang/constant/ShopConstants.java @@ -91,6 +91,16 @@ public interface ShopConstants { * 首页banner */ String ZSW_HOME_BANNER = "zsw_home_banner"; + + /** + * 常见问答 + */ + String ZSW_HOME_PROBLEM = "zsw_home_problem"; + + /** + * 关于我们 + */ + String ZSW_HOME_ABOUTUS = "aboutUS"; /** * 首页菜单 */ diff --git a/zsw-bxg/src/main/java/co/yixiang/constant/SystemConfigConstants.java b/zsw-bxg/src/main/java/co/yixiang/constant/SystemConfigConstants.java index be39605e..1c79ed90 100644 --- a/zsw-bxg/src/main/java/co/yixiang/constant/SystemConfigConstants.java +++ b/zsw-bxg/src/main/java/co/yixiang/constant/SystemConfigConstants.java @@ -1,6 +1,7 @@ package co.yixiang.constant; public class SystemConfigConstants { + public final static String ROBOT_URL="robotUrl"; //地址配置 public final static String API="api"; public final static String API_URL="api_url"; diff --git a/zsw-bxg/src/main/java/co/yixiang/enums/OrderInfoEnum.java b/zsw-bxg/src/main/java/co/yixiang/enums/OrderInfoEnum.java index d9d4e586..0d30267f 100644 --- a/zsw-bxg/src/main/java/co/yixiang/enums/OrderInfoEnum.java +++ b/zsw-bxg/src/main/java/co/yixiang/enums/OrderInfoEnum.java @@ -24,7 +24,7 @@ public enum OrderInfoEnum { STATUS_1(1,"待收货"), STATUS_2(2,"已收货"), STATUS_3(3,"已完成"), - + STATUS_8(3,"已取消"), PAY_STATUS_0(0,"未支付"), PAY_STATUS_1(1,"已支付"), diff --git a/zsw-bxg/src/main/java/co/yixiang/enums/OrderStatusEnum.java b/zsw-bxg/src/main/java/co/yixiang/enums/OrderStatusEnum.java index 6fc04fd9..e184149d 100644 --- a/zsw-bxg/src/main/java/co/yixiang/enums/OrderStatusEnum.java +++ b/zsw-bxg/src/main/java/co/yixiang/enums/OrderStatusEnum.java @@ -24,6 +24,7 @@ public enum OrderStatusEnum { STATUS_2(2,"待收货"), STATUS_3(3,"待评价"), STATUS_4(4,"已完成"), + STATUS_8(8,"已取消"), STATUS_MINUS_1(-1,"退款中"), STATUS_MINUS_2(-2,"已退款"), STATUS_MINUS_3(-3,"退款"); diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/cart/domain/YxStoreBrandCart.java b/zsw-bxg/src/main/java/co/yixiang/modules/cart/domain/YxStoreBrandCart.java index f37e6394..daefdbf3 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/cart/domain/YxStoreBrandCart.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/cart/domain/YxStoreBrandCart.java @@ -12,6 +12,6 @@ public class YxStoreBrandCart{ private Map brand; //购物车品牌下的有效的商品列表 private List validProductList; - //购物车品牌下的有效的商品列表 - private List invalidProductList; +// //购物车品牌下的无效的商品列表 +// private List invalidProductList; } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/cart/service/impl/YxStoreCartServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/cart/service/impl/YxStoreCartServiceImpl.java index d2104191..92f668a1 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/cart/service/impl/YxStoreCartServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/cart/service/impl/YxStoreCartServiceImpl.java @@ -42,6 +42,7 @@ import co.yixiang.modules.store.service.mapper.YxStoreBrandMapper; import co.yixiang.modules.user.service.YxUserService; import co.yixiang.utils.FileUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; @@ -168,7 +169,7 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl carts = yxStoreCartMapper.selectList(wrapper); List valid = new ArrayList<>(); - List invalid = new ArrayList<>(); + ArrayList invalid = new ArrayList<>(); for (YxStoreCart storeCart : carts) { YxStoreProductQueryVo storeProduct = null; @@ -257,16 +258,10 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl(); //获取不重复的品牌id数组 LinkedHashSet BrandIdList = new LinkedHashSet<>(); - //有效商品 valid.forEach(item->{ YxStoreProduct storeProduct = storeProductMapper.selectById(item.getProductId()); BrandIdList.add(storeProduct.getBrandId()); }); - //无效商品 - invalid.forEach(item->{ - YxStoreProduct storeProduct = storeProductMapper.selectById(item.getProductId()); - BrandIdList.add(storeProduct.getBrandId()); - }); BrandIdList.forEach(item->{ YxStoreBrand yxStoreBrand=yxStoreBrandMapper.selectById(item); Map list = new LinkedHashMap<>(); @@ -274,9 +269,8 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl validProductList = new ArrayList<>(); - List invalidProductList = new ArrayList<>(); valid.forEach(item1->{ YxStoreProduct yxStoreProduct= storeProductMapper.selectById(item1.getProductId());; // //商品品牌id相等 @@ -284,20 +278,12 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl{ - YxStoreProduct yxStoreProduct= storeProductMapper.selectById(item1.getProductId());; - //商品品牌id相等 - if (item.equals(yxStoreProduct.getBrandId())){ - invalidProductList.add(item1); - } - }); - yxStoreBrandCart.setValidProductList(validProductList); - yxStoreBrandCart.setInvalidProductList(invalidProductList); - cartList.add(yxStoreBrandCart); + yxStoreBrandCart.setValidProductList(validProductList); + cartList.add(yxStoreBrandCart); }); -// map.put("valid", valid); -// map.put("invalid", invalid); + //将所有品牌的失效商品筛选出来 map.put("cartList",cartList); + map.put("invalidProductList",invalid); return map; } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/entry/service/YxStoreEntryService.java b/zsw-bxg/src/main/java/co/yixiang/modules/entry/service/YxStoreEntryService.java index 82944309..cc26195d 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/entry/service/YxStoreEntryService.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/entry/service/YxStoreEntryService.java @@ -50,4 +50,6 @@ public interface YxStoreEntryService extends BaseService { void download(List all, HttpServletResponse response) throws IOException; EntryDTO getEntry(int id); + + EntryDTO getEntryByName(String name); } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/entry/service/impl/YxStoreEntryServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/entry/service/impl/YxStoreEntryServiceImpl.java index ad9108f7..c1414897 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/entry/service/impl/YxStoreEntryServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/entry/service/impl/YxStoreEntryServiceImpl.java @@ -8,6 +8,7 @@ */ package co.yixiang.modules.entry.service.impl; +import cn.iocoder.yudao.framework.common.exception.YshopException; import co.yixiang.common.service.impl.BaseServiceImpl; import co.yixiang.common.utils.QueryHelpPlus; import co.yixiang.domain.PageResult; @@ -99,5 +100,23 @@ public class YxStoreEntryServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreEntry::getIsDel, CommonEnum.DEL_STATUS_0.getValue()).eq(YxStoreEntry::getEntryName,name); + YxStoreEntry yxStoreEntry=yxStoreEntryMapper.selectOne(wrapper); + if (yxStoreEntry==null){ + throw new YshopException("没有这个词条"); + } + EntryDTO entryDTO=new EntryDTO(); + //取出需要的属性 + entryDTO.setEntryName(yxStoreEntry.getEntryName()); + entryDTO.setEntryInfo(yxStoreEntry.getEntryInfo()); + return entryDTO; + } + } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/YxEvaluationRelationService.java b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/YxEvaluationRelationService.java index 09a063da..ae66d334 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/YxEvaluationRelationService.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/YxEvaluationRelationService.java @@ -1,13 +1,13 @@ package co.yixiang.modules.evaluation.service; +import co.yixiang.common.service.BaseService; import co.yixiang.domain.PageResult; import co.yixiang.modules.evaluation.domain.YxStoreEvaluationRelation; import co.yixiang.modules.evaluation.service.dto.YxStoreEvaluationRelationDto; -import co.yixiang.modules.evaluation.service.vo.YxStoreEvaluationRelationQueryVo; +import co.yixiang.modules.evaluation.vo.YxStoreEvaluationRelationQueryVo; import co.yixiang.modules.product.service.dto.YxStoreProductRelationQueryCriteria; import org.springframework.data.domain.Pageable; - import java.util.List; /** @@ -18,7 +18,7 @@ import java.util.List; * @author hupeng * @since 2019-10-23 */ -public interface YxEvaluationRelationService { +public interface YxEvaluationRelationService extends BaseService { /** * 是否收藏 * @param evaluationId 评测ID diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/YxEvaluationService.java b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/YxEvaluationService.java index 93458549..744367de 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/YxEvaluationService.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/YxEvaluationService.java @@ -50,16 +50,16 @@ public interface YxEvaluationService extends BaseService { void download(List all, HttpServletResponse response) throws IOException; /*** - * app首页获取评测列表 + * 后台首页获取评测列表 */ List getList(); /** - * 后台获取评测列表 + * 小程序首页获取评测列表 * @return */ List getList(int page, int limit); - EvaluationDTO getEvaluationById(int id); + EvaluationDTO getEvaluationById(Long uid,int id); } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationRelationServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationRelationServiceImpl.java index 2ce3a58c..9c15473a 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationRelationServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationRelationServiceImpl.java @@ -11,7 +11,7 @@ import co.yixiang.modules.evaluation.service.YxEvaluationRelationService; import co.yixiang.modules.evaluation.service.YxEvaluationService; import co.yixiang.modules.evaluation.service.dto.YxStoreEvaluationRelationDto; import co.yixiang.modules.evaluation.service.mapper.YxEvaluationRelationMapper; -import co.yixiang.modules.evaluation.service.vo.YxStoreEvaluationRelationQueryVo; +import co.yixiang.modules.evaluation.vo.YxStoreEvaluationRelationQueryVo; import co.yixiang.modules.product.service.dto.YxStoreProductRelationQueryCriteria; import co.yixiang.modules.user.service.YxUserService; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -56,7 +56,7 @@ public class YxEvaluationRelationServiceImpl extends BaseServiceImpllambdaQuery() .eq(YxStoreEvaluationRelation::getUid,uid) - .eq(YxStoreEvaluationRelation::getType,"collect") + .eq(YxStoreEvaluationRelation::getIsDel,0) .eq(YxStoreEvaluationRelation::getEvaluationId,evaluationId)); if(count > 0) { return true; @@ -96,6 +96,7 @@ public class YxEvaluationRelationServiceImpl extends BaseServiceImpl userCollectEvaluation(int page, int limit, Long uid, String type) { Page pageModel = new Page<>(page, limit); - List list = yxEvaluationRelationMapper.selectRelationList(pageModel,uid,type); + List list = yxEvaluationRelationMapper.selectRelationList(pageModel,uid); return list; } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java index 6fe923a1..dc1919c2 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java @@ -19,6 +19,7 @@ import co.yixiang.enums.ShopCommonEnum; import co.yixiang.exception.ErrorRequestException; import co.yixiang.modules.entry.domain.YxStoreEntry; import co.yixiang.modules.evaluation.domain.YxEvaluation; +import co.yixiang.modules.evaluation.service.YxEvaluationRelationService; import co.yixiang.modules.evaluation.service.YxEvaluationService; import co.yixiang.modules.evaluation.service.dto.YxEvaluationDto; import co.yixiang.modules.evaluation.service.dto.YxEvaluationQueryCriteria; @@ -50,19 +51,23 @@ import java.io.IOException; import java.util.*; /** -* @author hupeng -* @date 2022-09-21 +* @author sj +* @date 2022-10-21 */ @Service -@AllArgsConstructor -//@CacheConfig(cacheNames = "yxEvaluation") -@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public class YxEvaluationServiceImpl extends BaseServiceImpl implements YxEvaluationService { - private final IGenerator generator; + @Autowired + private IGenerator generator; + @Autowired private YxEvaluationMapper yxEvaluationMapper; + @Autowired private StoreProductMapper storeProductMapper; - private final YxStoreProductService yxStoreProductService; + @Autowired + private YxStoreProductService yxStoreProductService; + @Autowired + private YxEvaluationRelationService yxEvaluationRelationService; @Override //@Cacheable @@ -154,19 +159,24 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl { - @Select("select B.id pid,A.type as category,B.home_image as homeImage,A.id id," + - "B.is_show as isShow" + - " from yx_evaluation_relation A left join yx_evaluation B " + - "on A.evaluation_id = B.id where A.type=#{type} and A.uid=#{uid} and A.is_del = 0 and B.is_del = 0 order by A.create_time desc") - List selectRelationList(Page page, @Param("uid") Long uid, @Param("type") String type); + @Select("select B.id,B.home_image as homeImage" + + " from yx_store_evaluation_relation A left join yx_evaluation B " + + "on A.evaluation_id = B.id where A.uid=#{uid} and A.is_del = 0 and B.is_del = 0 order by A.create_time desc") + List selectRelationList(Page page, @Param("uid") Long uid); } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/vo/YxStoreEvaluationRelationQueryVo.java b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/vo/YxStoreEvaluationRelationQueryVo.java similarity index 92% rename from zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/vo/YxStoreEvaluationRelationQueryVo.java rename to zsw-bxg/src/main/java/co/yixiang/modules/evaluation/vo/YxStoreEvaluationRelationQueryVo.java index 0964de15..2b06a8b0 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/vo/YxStoreEvaluationRelationQueryVo.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/vo/YxStoreEvaluationRelationQueryVo.java @@ -1,4 +1,4 @@ -package co.yixiang.modules.evaluation.service.vo; +package co.yixiang.modules.evaluation.vo; import io.swagger.annotations.ApiModelProperty; diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/inform/service/SendMsgService.java b/zsw-bxg/src/main/java/co/yixiang/modules/inform/service/SendMsgService.java index 8ab483bf..5ce96251 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/inform/service/SendMsgService.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/inform/service/SendMsgService.java @@ -1,5 +1,6 @@ package co.yixiang.modules.inform.service; public interface SendMsgService { - String inform(long orderId); + //type:0 支付 1:申请退款 + String inform(long orderId,int type); } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/inform/service/impl/SendMsgServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/inform/service/impl/SendMsgServiceImpl.java index c721c858..89214def 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/inform/service/impl/SendMsgServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/inform/service/impl/SendMsgServiceImpl.java @@ -1,10 +1,14 @@ package co.yixiang.modules.inform.service.impl; +import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; +import cn.iocoder.yudao.framework.common.exception.YshopException; +import co.yixiang.constant.SystemConfigConstants; import co.yixiang.modules.inform.domin.*; import co.yixiang.modules.inform.service.SendMsgService; import co.yixiang.modules.order.service.YxStoreOrderService; import co.yixiang.modules.order.service.dto.YxStoreOrderDto; +import co.yixiang.modules.shop.service.YxSystemConfigService; import com.alibaba.fastjson.JSONObject; import lombok.SneakyThrows; import org.apache.http.HttpStatus; @@ -30,16 +34,21 @@ public class SendMsgServiceImpl implements SendMsgService { @Autowired private TemplateCard templateCard; + @Autowired + private YxSystemConfigService systemConfigService; @SneakyThrows @Override - public String inform(long orderId) { + public String inform(long orderId,int type) { CloseableHttpClient httpClient = HttpClients.createDefault();//实例化对象 - String webhook_url="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=a2f0f8c9-e406-4f6b-86e4-d6ac9e4df88e"; +// String webhook_url="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=a2f0f8c9-e406-4f6b-86e4-d6ac9e4df88e"; + String webhook_url = systemConfigService.getData(SystemConfigConstants.ROBOT_URL); + if(StrUtil.isBlank(webhook_url)){ + throw new YshopException("未配置企业微信群机器人"); + } HttpPost httpPost=new HttpPost(webhook_url); httpPost.addHeader("Content-Type", "application/json; charset=utf-8"); - - TemplateCard templateCard=this.creatTemplatecard(orderId); + TemplateCard templateCard=this.creatTemplatecard(orderId,type); Map param = new HashMap<>(); param.put("msgtype", "template_card"); param.put("template_card", JSONObject.parseObject(JSONUtil.toJsonStr(templateCard))); @@ -62,11 +71,18 @@ public class SendMsgServiceImpl implements SendMsgService { return "发送微信机器人消息失败"; } - public TemplateCard creatTemplatecard(long orderId){ + //创建订单消息 + public TemplateCard creatTemplatecard(long orderId,int type){ YxStoreOrderDto yxStoreOrderDto=yxStoreOrderService.getOrderDetailByOrderId(orderId); + String mainTitle; + if (type==0){//支付时候 + mainTitle="有新的在线订单来啦"; + }else { + mainTitle="有新的退款申请"; + } templateCard.setCard_type("text_notice"); templateCard.setSource(new Souce().setDesc("眼界甄选").setIcon_url("https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0").setDesc_color(0)); - templateCard.setMain_title(new MainTitle().setTitle("有新的在线订单来啦").setDesc("订单号:"+orderId)); + templateCard.setMain_title(new MainTitle().setTitle(mainTitle).setDesc("订单号:"+orderId)); templateCard.setEmphasis_content(new EmphasisContent().setTitle(yxStoreOrderDto.getPayPrice().toString()).setDesc("订单总金额")); // templateCard.setQuote_area(new QuoteArea().setType(0).setUrl("").setAppid("APPID").setTitle("订单详情").setQuote_text("眼镜*1 0.01")); templateCard.setSub_title_text("订单类型:"+yxStoreOrderDto.getPinkName());//订单类型 @@ -82,4 +98,5 @@ public class SendMsgServiceImpl implements SendMsgService { templateCard.setCard_action(new CardAction().setType(1).setUrl("https://work.weixin.qq.com/?from=openApi")); return templateCard; } + } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/order/domain/YxStoreOrder.java b/zsw-bxg/src/main/java/co/yixiang/modules/order/domain/YxStoreOrder.java index ec3a6da2..1bd1cf00 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/order/domain/YxStoreOrder.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/order/domain/YxStoreOrder.java @@ -8,9 +8,8 @@ package co.yixiang.modules.order.domain; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDomain; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; @@ -237,6 +236,9 @@ public class YxStoreOrder extends BaseDomain { private Integer isSystemDel; + @TableField(fill= FieldFill.INSERT) + private Integer isDel; + @ApiModelProperty(value = "实际支付积分") private BigDecimal payIntegral; diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java index 878c7906..e471b13e 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java @@ -39,6 +39,7 @@ import co.yixiang.modules.cart.domain.YxStoreCart; import co.yixiang.modules.cart.service.YxStoreCartService; import co.yixiang.modules.cart.service.mapper.StoreCartMapper; import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; +import co.yixiang.modules.inform.service.SendMsgService; import co.yixiang.modules.order.domain.YxExpress; import co.yixiang.modules.order.domain.YxStoreOrder; import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; @@ -186,6 +187,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl cartGroup = yxStoreCartService.getUserProductCartList(uid, cartIds, ShopConstants.ZSW_ONE_NUM); List list = new ArrayList<>(); - + if (ObjectUtil.isNotEmpty(cartGroup.get("invalidProductList"))) { + throw new YshopException("有失效的商品请重新提交"); + }; cartGroup.get("cartList").forEach(item->{ YxStoreBrandCart yxStoreBrandCart=(YxStoreBrandCart)item; - if (ObjectUtil.isNotEmpty(yxStoreBrandCart.getInvalidProductList())) { - throw new YshopException("有失效的商品请重新提交"); - } if (ObjectUtil.isEmpty(yxStoreBrandCart.getValidProductList())) { throw new YshopException("请提交购买的商品"); } list.addAll(yxStoreBrandCart.getValidProductList()); -// Class jsonClass = item.getClass();//通过item,获取运行时类的对象 -// Field invalidProductList = null; -// Field validProductList = null; -// try { -// //获取item中的invalidProductList属性 -// if (ObjectUtil.isNotEmpty(item.getClass().getDeclaredField("invalidProductList"))) { -// throw new YshopException("有失效的商品请重新提交"); -// } -// if (ObjectUtil.isEmpty(item.getClass().getDeclaredField("validProductList"))) { -// throw new YshopException("请提交购买的商品"); -// } -// } catch (NoSuchFieldException e) { -// e.printStackTrace(); -// } }); OtherDto other = new OtherDto(); other.setIntegralRatio(systemConfigService.getData(SystemConfigConstants.INTERGRAL_RATIO)); @@ -932,7 +920,13 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreOrder::getOrderId, orderId); + YxStoreOrder storeOrder = new YxStoreOrder(); + storeOrder.setStatus(OrderStatusEnum.STATUS_8.getValue()); + yxStoreOrderMapper.update(storeOrder, wrapper); +// yxStoreOrderMapper.deleteById(order.getId()); } @@ -1102,7 +1096,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl=0){ +// throw new YshopException("999999.99"); +// } yxUserService.saveOrUpdate(resources); return new ResponseEntity(HttpStatus.NO_CONTENT); } diff --git a/zsw-bxg/src/main/java/co/yixiang/utils/EvaluationDTO.java b/zsw-bxg/src/main/java/co/yixiang/utils/EvaluationDTO.java index 1d271636..8fad5a66 100644 --- a/zsw-bxg/src/main/java/co/yixiang/utils/EvaluationDTO.java +++ b/zsw-bxg/src/main/java/co/yixiang/utils/EvaluationDTO.java @@ -31,6 +31,8 @@ public class EvaluationDTO implements Serializable { @TableId private Integer id; + /** 在列表里面的首页图 */ + private Boolean isCollect; /** 在列表里面的首页图 */ private String homeImage;