Browse Source

微信登录修复及品牌评测优化

zyj
sj 2 years ago
parent
commit
f46f56e5b0
  1. 2
      yudao-server/src/main/resources/application-local.yaml
  2. 2
      zsw-bxg/src/main/java/co/yixiang/app/common/interceptor/PermissionInterceptor.java
  3. 2
      zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java
  4. 12
      zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreBrandController.java
  5. 23
      zsw-bxg/src/main/java/co/yixiang/app/modules/services/AppAuthService.java
  6. 8
      zsw-bxg/src/main/java/co/yixiang/app/modules/wechat/rest/controller/WxMaUserController.java
  7. 4
      zsw-bxg/src/main/java/co/yixiang/app/modules/wechat/rest/param/WxPhoneParam.java
  8. 6
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java
  9. 4
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponIssueMapper.java
  10. 18
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/EditableTabs.java
  11. 7
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/YxEvaluation.java
  12. 4
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/dto/YxEvaluationDto.java
  13. 86
      zsw-bxg/src/main/java/co/yixiang/modules/inform/SendMsgService.java
  14. 6
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/CardAction.java
  15. 6
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/EmphasisContent.java
  16. 6
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/MainTitle.java
  17. 6
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/Souce.java
  18. 7
      zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/TemplateCard.java
  19. 6
      zsw-bxg/src/main/java/co/yixiang/modules/inform/service/SendMsgService.java
  20. 8
      zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java
  21. 11
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java
  22. 4
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java
  23. 6
      zsw-bxg/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java
  24. 2
      zsw-bxg/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java
  25. 4
      zsw-bxg/src/main/java/co/yixiang/modules/store/service/YxStoreBrandService.java
  26. 20
      zsw-bxg/src/main/java/co/yixiang/modules/store/service/dto/YxStoreBrandNameDto.java
  27. 5
      zsw-bxg/src/main/java/co/yixiang/modules/store/service/dto/YxStoreBrandSamllDto.java
  28. 177
      zsw-bxg/src/main/java/co/yixiang/modules/store/service/impl/Sort.java
  29. 48
      zsw-bxg/src/main/java/co/yixiang/modules/store/service/impl/YxStoreBrandServiceImpl.java
  30. 2
      zsw-bxg/src/main/java/co/yixiang/modules/user/domain/YxUser.java
  31. 4
      zsw-bxg/src/main/java/co/yixiang/utils/EvaluationDTO.java

2
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://5361-27-19-79-51.jp.ngrok.io
API_URL: https://eeca-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

2
zsw-bxg/src/main/java/co/yixiang/app/common/interceptor/PermissionInterceptor.java

@ -74,7 +74,7 @@ public class PermissionInterceptor implements HandlerInterceptor {
Map<String, Claim> map = optionalMap
.orElseThrow(() -> new UnAuthenticatedException(ApiCode.UNAUTHORIZED));
String uName = map.get("uName").asString();
// String uName = map.get("uName").asString();
boolean valid = this.hasPermission(authCheck.get(), map);

2
zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java

@ -22,7 +22,7 @@ import co.yixiang.app.modules.services.OrderSupplyService;
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
import co.yixiang.enums.*;
import co.yixiang.logging.aop.log.AppLog;
import co.yixiang.modules.inform.service.SendMsgService;
import co.yixiang.modules.inform.SendMsgService;
import co.yixiang.modules.mp.domain.YxWechatTemplate;
import co.yixiang.modules.mp.service.WeixinPayService;
import co.yixiang.modules.mp.service.YxWechatTemplateService;

12
zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreBrandController.java

@ -3,6 +3,7 @@ package co.yixiang.app.modules.product.rest;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.modules.store.service.YxStoreBrandService;
import co.yixiang.modules.store.service.dto.YxStoreBrandNameDto;
import co.yixiang.utils.BrandDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* <p>
@ -41,6 +43,16 @@ public class AppStoreBrandController {
return ApiResult.ok(yxStoreBrandService.getList());
}
/**
* 商品品牌列表按首字母分类
*/
@AnonymousAccess
@GetMapping("/brandByName")
@ApiOperation(value = "商品品牌列表",notes = "商品品牌列表")
public ApiResult<Map<String,List<YxStoreBrandNameDto>>> getListByName(){
return ApiResult.ok(yxStoreBrandService.getListByName());
}
/**
* 商品品牌列表
*/

23
zsw-bxg/src/main/java/co/yixiang/app/modules/services/AppAuthService.java

@ -141,15 +141,23 @@ public class AppAuthService {
log.info("appId:{},secret:{}",appId,secret);
WxMaService wxMaService = WxMaConfiguration.getWxMaService();
WxMaJscode2SessionResult session = wxMaService.getUserService().getSessionInfo(code);
WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService()
WxMaPhoneNumberInfo phoneNoInfo=new WxMaPhoneNumberInfo();
//防止仅有code时候调用解密方法报错
if (StringUtils.isBlank(encryptedData)&StringUtils.isBlank(iv)){
}else {
phoneNoInfo= wxMaService.getUserService()
.getPhoneNoInfo(session.getSessionKey(), encryptedData, iv);
YxUser yxUser = this.userService.getOne(Wrappers.<YxUser>lambdaQuery()
.eq(YxUser::getPhone, phoneNoInfo.getPhoneNumber()), false);
}
YxUser yxUser ;
//手机号会员
yxUser=this.userService.getOne(Wrappers.<YxUser>lambdaQuery()
.eq(YxUser::getPhone,phoneNoInfo.getPhoneNumber()), false);
//openid会员
if (ObjectUtil.isNull(yxUser)){
yxUser = this.userService.getOne(Wrappers.<YxUser>lambdaQuery()
.eq(YxUser::getOpenId,session.getOpenid()),false);
}
if (ObjectUtil.isNull(yxUser)) {
//兼容旧系统
yxUser = this.userService.getOne(Wrappers.<YxUser>lambdaQuery()
.eq(YxUser::getUsername, session.getOpenid()), false);
@ -161,6 +169,7 @@ public class AppAuthService {
.username(phoneNoInfo.getPhoneNumber())
.phone(phoneNoInfo.getPhoneNumber())
.addIp(ip)
.openId(session.getOpenid())
.lastIp(ip)
.userType(AppFromEnum.ROUNTINE.getValue())
.build();

8
zsw-bxg/src/main/java/co/yixiang/app/modules/wechat/rest/controller/WxMaUserController.java

@ -9,6 +9,7 @@
package co.yixiang.app.modules.wechat.rest.controller;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
@ -94,10 +95,13 @@ public class WxMaUserController {
WxMaService wxMaService = WxMaConfiguration.getWxMaService();
String phone = "";
try {
String sessionKey = systemConfigService.getData(ShopConstants.ZSW_MINI_SESSION_KET + user.getUid());
// String sessionKey = systemConfigService.getData(ShopConstants.ZSW_MINI_SESSION_KET + user.getUid());
WxMaJscode2SessionResult session = wxMaService.getUserService()
.getSessionInfo(param.getCode());
WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService()
.getPhoneNoInfo(sessionKey, param.getEncryptedData(), param.getIv());
.getPhoneNoInfo(session.getSessionKey(), param.getEncryptedData(), param.getIv());
phone = phoneNoInfo.getPhoneNumber();
user.setPhone(phone);
userService.updateById(user);
} catch (Exception e) {

4
zsw-bxg/src/main/java/co/yixiang/app/modules/wechat/rest/param/WxPhoneParam.java

@ -15,6 +15,10 @@ import javax.validation.constraints.NotBlank;
@Setter
public class WxPhoneParam {
@NotBlank(message = "code参数缺失")
@ApiModelProperty(value = "小程序登陆code")
private String code;
@ApiModelProperty(value = "小程序完整用户信息的加密数据")
private String encryptedData;

6
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java

@ -222,15 +222,15 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
// Date now = new Date();
// Date endTime = DateUtil.offsetDay(now,storeCoupon.getCouponTime());
DateTime endTime =new DateTime(storeCoupon.getUseEndTime());
// DateTime endTime =new DateTime(storeCoupon.getUseEndTime());
YxStoreCouponUser storeCouponUser = YxStoreCouponUser.builder()
.cid(storeCoupon.getId())
.uid(uid)
.couponPrice(storeCoupon.getCouponPrice())
.couponTitle(storeCoupon.getTitle())
.useMinPrice(storeCoupon.getUseMinPrice())
.useStartTime(new Date(storeCoupon.getUseStartTime()))
.useEndTime(new Date(storeCoupon.getUseEndTime()))
.useStartTime(new DateTime(storeCoupon.getUseStartTime()))
.useEndTime(new DateTime(storeCoupon.getUseEndTime()))
.type(CouponGetEnum.GET.getValue())
.build();

4
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponIssueMapper.java

@ -25,7 +25,7 @@ import java.util.List;
*/
@Repository
public interface YxStoreCouponIssueMapper extends CoreMapper<YxStoreCouponIssue> {
@Select("<script>select A.cid,A.use_end_time as endTime,A.start_time as startTime,A.cname,A.ctype," +
@Select("<script>select A.cid,A.end_time as endTime,A.start_time as startTime,A.cname,A.ctype," +
"A.is_permanent as isPermanent,A.remain_count as remainCount," +
"A.total_count as totalCount,A.id,B.coupon_price as couponPrice," +
"B.use_min_price as useMinPrice" +
@ -33,7 +33,7 @@ public interface YxStoreCouponIssueMapper extends CoreMapper<YxStoreCouponIssue>
"on A.cid = B.id " +
"where A.status =1 <if test='type == 1'> AND B.type = #{type} AND FIND_IN_SET(#{productId},product_id)</if> " +
"<if test='type == 0'> AND B.type in (0,1)</if>" +
" AND ( A.start_time &lt; now() AND A.use_end_time &gt; now() ) " +
" AND ( A.start_time &lt; now() AND A.end_time &gt; now() ) " +
" AND A.is_del = 0 AND " +
"( A.remain_count > 0 OR A.is_permanent = 1 ) ORDER BY B.sort DESC</script>")
List<YxStoreCouponIssueQueryVo> selecCoupontList(Page page,@Param("type") Integer type,

18
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/EditableTabs.java

@ -0,0 +1,18 @@
package co.yixiang.modules.evaluation.domain;
import lombok.Data;
@Data
public class EditableTabs {
// {title: '初始栏',
// name: '0',
// content: '产品展示栏',
// configuration:'富文本框'
//}
private String title;
private String name;
private String content;
private String configuration;
}

7
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/YxEvaluation.java

@ -11,6 +11,7 @@ import co.yixiang.modules.product.domain.YxStoreProduct;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.TableName;
import cn.hutool.core.bean.BeanUtil;
@ -18,13 +19,14 @@ import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.ArrayList;
/**
* @author ssj
* @date 2022-09-21
*/
@Data
@TableName("yx_evaluation")
@TableName(value ="yx_evaluation", autoResultMap = true)
public class YxEvaluation implements Serializable {
/** 评测ID */
@ -48,6 +50,9 @@ public class YxEvaluation implements Serializable {
@NotNull
private String product;
/** 图文配置*/
@TableField(typeHandler = JacksonTypeHandler.class)
private ArrayList<EditableTabs> editableTabs;
/** 评测总结 */
private String summary;

4
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/dto/YxEvaluationDto.java

@ -8,10 +8,12 @@
*/
package co.yixiang.modules.evaluation.service.dto;
import co.yixiang.modules.evaluation.domain.EditableTabs;
import co.yixiang.modules.product.domain.YxStoreProduct;
import lombok.Data;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.ArrayList;
/**
* @author hupeng
@ -35,6 +37,8 @@ public class YxEvaluationDto implements Serializable {
/** 关联商品信息*/
private String product;
/** 图文配置*/
private ArrayList<EditableTabs> editableTabs;
/** 评测总结 */
private String summary;

86
zsw-bxg/src/main/java/co/yixiang/modules/inform/service/impl/SendMsgServiceImpl.java → zsw-bxg/src/main/java/co/yixiang/modules/inform/SendMsgService.java

@ -1,11 +1,10 @@
package co.yixiang.modules.inform.service.impl;
package co.yixiang.modules.inform;
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;
@ -20,7 +19,8 @@ import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.jsoup.nodes.Element;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
@ -28,39 +28,35 @@ import java.util.Map;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
@Service
public class SendMsgServiceImpl implements SendMsgService {
@Component
public class SendMsgService {
@Autowired
private YxStoreOrderService yxStoreOrderService;
@Autowired
private TemplateCard templateCard;
@Autowired
private YxSystemConfigService systemConfigService;
@SneakyThrows
@Override
public String inform(long orderId,int type) {
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 = systemConfigService.getData(SystemConfigConstants.ROBOT_URL);
if(StrUtil.isBlank(webhook_url)){
if (StrUtil.isBlank(webhook_url)) {
throw new YshopException("未配置企业微信群机器人");
}
HttpPost httpPost=new HttpPost(webhook_url);
HttpPost httpPost = new HttpPost(webhook_url);
httpPost.addHeader("Content-Type", "application/json; charset=utf-8");
TemplateCard templateCard=this.creatTemplatecard(orderId,type);
TemplateCard templateCard = this.creatTemplatecard(orderId, type);
Map<String, Object> param = new HashMap<>();
param.put("msgtype", "template_card");
param.put("template_card", JSONObject.parseObject(JSONUtil.toJsonStr(templateCard)));
String jsonParam = JSONObject.toJSONString(param);
StringEntity stringEntity=new StringEntity(jsonParam, "utf-8");
StringEntity stringEntity = new StringEntity(jsonParam, "utf-8");
httpPost.setEntity(stringEntity);
CloseableHttpResponse response=httpClient.execute(httpPost);
CloseableHttpResponse response = httpClient.execute(httpPost);
// 发送成功接收返回值
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
String result = EntityUtils.toString(response.getEntity(), "utf-8");
@ -76,45 +72,59 @@ public class SendMsgServiceImpl implements SendMsgService {
}
//创建订单消息
public TemplateCard creatTemplatecard(long orderId,int type){
YxStoreOrderDto yxStoreOrderDto=yxStoreOrderService.getOrderDetailByOrderId(orderId);
public TemplateCard creatTemplatecard(long orderId, int type) {
YxStoreOrderDto yxStoreOrderDto = yxStoreOrderService.getOrderDetailByOrderId(orderId);
String mainTitle;
ArrayList<HorizontalContent> arrayList=new ArrayList<>();
ArrayList<HorizontalContent> arrayList = new ArrayList<>();
arrayList.add(new HorizontalContent().setKeyname("会员名称").setValue(yxStoreOrderDto.getRealName()));
arrayList.add(new HorizontalContent().setKeyname("会员手机号").setValue(yxStoreOrderDto.getUserPhone()));
if (type==0){//支付时候
mainTitle="有新的在线订单来啦";
if (type == 0) {//支付时候
mainTitle = "有新的在线订单来啦";
arrayList.add(new HorizontalContent().setKeyname("下单地址").setValue(yxStoreOrderDto.getUserAddress()));
arrayList.add(new HorizontalContent().setKeyname("下单时间").setValue(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(yxStoreOrderDto.getCreateTime())));
}else {
mainTitle="有新的退款申请";
} else {
mainTitle = "有新的退款申请";
//获取Document模型
Document docDesc = Jsoup.parse(yxStoreOrderDto.getStatusName());
//获取span节点
ArrayList<Element> list=docDesc.getElementsByTag("span");
ArrayList<Element> list = docDesc.getElementsByTag("span");
//获取文本内容,并且截取只需要标题后面的
arrayList.add(new HorizontalContent().setKeyname("退款原因").setValue(list.get(0).text().substring(5)));
arrayList.add(new HorizontalContent().setKeyname("备注说明").setValue(list.get(1).text().substring(5).length()==0?list.get(1).text().substring(5):"本次退款无备注"));
arrayList.add(new HorizontalContent().setKeyname("备注说明").setValue(list.get(1).text().substring(5).length() == 0 ? list.get(1).text().substring(5) : "本次退款无备注"));
arrayList.add(new HorizontalContent().setKeyname("申请时间").setValue(list.get(2).text().substring(5)));
}
templateCard.setHorizontal_content_list(arrayList);
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(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());//订单类型
ArrayList<Jump> arrayList1=new ArrayList<>();
// templateCard.setHorizontal_content_list(arrayList);
// 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(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());//订单类型
// templateCard.setJump_list(arrayList1);
// templateCard.setCard_action(new CardAction().setType(1).setUrl(cardActionUrl));
ArrayList<Jump> arrayList1 = new ArrayList<>();
//机器人消息跳转地址
String cardActionUrl = systemConfigService.getData(SystemConfigConstants.CARD_ACTION_URL);
if(StrUtil.isBlank(cardActionUrl)){
if (StrUtil.isBlank(cardActionUrl)) {
// throw new YshopException("未配置企业微信群机器人跳转地址");
cardActionUrl="未配置跳转网址";
cardActionUrl = "未配置跳转网址";
}
arrayList1.add(new Jump().setType(1).setUrl(cardActionUrl).setTitle("前去处理订单"));
templateCard.setJump_list(arrayList1);
templateCard.setCard_action(new CardAction().setType(1).setUrl(cardActionUrl));
return templateCard;
return TemplateCard.builder()
.horizontalContentList(arrayList).card_type("text_notice")
.source(Souce.builder()
.desc("眼界甄选")
.icon_url("https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0")
.desc_color(0)
.build())
.main_title(MainTitle.builder().title(mainTitle).desc("订单号:" + orderId).build())
.emphasis_content(EmphasisContent.builder().title(yxStoreOrderDto.getPayPrice().toString()).desc("订单总金额").build())
.sub_title_text("订单类型:" + yxStoreOrderDto.getPinkName())
.jump_list(arrayList1)
.card_action(CardAction.builder().type(1).url(cardActionUrl).build())
.build();
}
}

6
zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/CardAction.java

@ -1,12 +1,18 @@
package co.yixiang.modules.inform.domin;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/****整体卡片的点击跳转事件text_notice模版卡片中该字段为必填项
* 卡片跳转类型1 代表跳转url2 代表打开小程序text_notice模版卡片中该字段取值范围为[1,2]
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CardAction {
/**代表跳转url,2 代表打开小程序*/

6
zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/EmphasisContent.java

@ -1,8 +1,14 @@
package co.yixiang.modules.inform.domin;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EmphasisContent {
/** 关键数据样式 "title":"100",
"desc":"数据含义"*/

6
zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/MainTitle.java

@ -1,8 +1,14 @@
package co.yixiang.modules.inform.domin;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MainTitle {
/** 模版卡片的主要内容 title:一级标题、desc:标题辅助信息*/
private String title;

6
zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/Souce.java

@ -1,9 +1,15 @@
package co.yixiang.modules.inform.domin;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Souce {
/**卡片来源信息模板 icon_url:来源图片url、desc:描述、desc_color:颜色 0(默认) 灰色,1 黑色,2 红色,3 绿色 */

7
zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/TemplateCard.java

@ -1,12 +1,11 @@
package co.yixiang.modules.inform.domin;
import co.yixiang.modules.inform.domin.*;
import lombok.Builder;
import lombok.Data;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@Data
@Service
@Builder
public class TemplateCard {
/** 模板卡片的模板类型*/
@ -37,7 +36,7 @@ public class TemplateCard {
/** 二级标题+文本列表 type:0或不填代表是普通文本1 代表跳转url2 代表下载附件3 代表@员工
keyname:二级标题value:内容url链接
* */
private ArrayList<HorizontalContent> horizontal_content_list;
private ArrayList<HorizontalContent> horizontalContentList;
/** {
"type":1,

6
zsw-bxg/src/main/java/co/yixiang/modules/inform/service/SendMsgService.java

@ -1,6 +0,0 @@
package co.yixiang.modules.inform.service;
public interface SendMsgService {
//type:0 支付 1:申请退款
String inform(long orderId,int type);
}

8
zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java

@ -7,14 +7,15 @@
* 一经发现盗用分享等行为将追究法律责任后果自负
*/
package co.yixiang.modules.order.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
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.api.BusinessException;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import co.yixiang.api.BusinessException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.constant.ShopConstants;
@ -39,7 +40,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.inform.SendMsgService;
import co.yixiang.modules.order.domain.YxExpress;
import co.yixiang.modules.order.domain.YxStoreOrder;
import co.yixiang.modules.order.domain.YxStoreOrderCartInfo;
@ -85,7 +86,6 @@ import co.yixiang.utils.OrderUtil;
import co.yixiang.utils.RedisUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -103,8 +103,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.TimeUnit;

11
zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java

@ -119,6 +119,8 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
@Autowired
private YxSystemConfigService systemConfigService;
@Autowired
private YxStoreBrandMapper yxStoreBrandMapper;
/**
* 增加库存 减少销量
@ -250,12 +252,12 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
}
//多字段模糊查询分类搜索
if (StrUtil.isNotBlank(productQueryParam.getSid()) &&
!ShopConstants.ZSW_ZERO.equals(productQueryParam.getBid())) {
!ShopConstants.ZSW_ZERO.equals(productQueryParam.getSid())) {
wrapper.eq(YxStoreProduct::getCateId, productQueryParam.getSid());
}
//品牌搜索
if (StrUtil.isNotBlank(productQueryParam.getBid()) &&
!ShopConstants.ZSW_ZERO.equals(productQueryParam.getSid())) {
!ShopConstants.ZSW_ZERO.equals(productQueryParam.getBid())) {
wrapper.eq(YxStoreProduct::getBrandId, productQueryParam.getBid());
}
//关键字搜索
@ -300,7 +302,10 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
IPage<YxStoreProduct> pageList = storeProductMapper.selectPage(pageModel, wrapper);
List<YxStoreProductQueryVo> list = generator.convert(pageList.getRecords(), YxStoreProductQueryVo.class);
list.forEach(item->{
item.setBrandName(yxStoreBrandMapper.selectById(item.getBrandId()).getBrandName());
item.setPic(yxStoreBrandMapper.selectById(item.getBrandId()).getPic());
});
return list;
}

4
zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java

@ -106,6 +106,8 @@ public interface StoreProductMapper extends CoreMapper<YxStoreProduct> {
void deleteForwardImg(@Param("id") Long id,@Param("name") String name);
@Override
@Select("SELECT id,spec_type,ot_price,mer_use,description,is_postage,is_sub,is_best,(sales+ficti) as sales,price,is_bargain,vip_price,store_name,stock,keyword,image,cost,is_good,unit_name,is_benefit,update_time,give_integral,is_new,sort,slider_image,is_show,bar_code,postage,code_path,create_time,cate_id,is_seckill,mer_id,temp_id,ficti,store_info,is_del,is_hot,is_integral,integral,browse FROM yx_store_product ${ew.customSqlSegment}")
@Select("SELECT id,spec_type,ot_price,mer_use,description,is_postage,is_sub,is_best,(sales+ficti) as sales,price,is_bargain,vip_price,store_name,stock," +
"keyword,image,cost,is_good,unit_name,is_benefit,update_time,give_integral,is_new,sort,slider_image,is_show,bar_code,postage,code_path,create_time," +
"cate_id,brand_id,is_seckill,mer_id,temp_id,ficti,store_info,is_del,is_hot,is_integral,integral,browse FROM yx_store_product ${ew.customSqlSegment}")
<E extends IPage<YxStoreProduct>> E selectPage(E page, @Param(Constants.WRAPPER) Wrapper<YxStoreProduct> queryWrapper);
}

6
zsw-bxg/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java

@ -82,6 +82,12 @@ public class YxStoreProductQueryVo implements Serializable {
@ApiModelProperty(value = "品牌id")
private String brandId;
@ApiModelProperty(value = "品牌名字")
private String brandName;
@ApiModelProperty(value = "品牌图标")
private String pic;
@ApiModelProperty(value = "商品价格")
@JsonSerialize(using = BigDecimalSerializer.class)
private BigDecimal price;

2
zsw-bxg/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java

@ -10,7 +10,7 @@ import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.cart.vo.YxStoreCartQueryVo;
import co.yixiang.modules.inform.service.SendMsgService;
import co.yixiang.modules.inform.SendMsgService;
import co.yixiang.modules.order.domain.YxStoreOrder;
import co.yixiang.modules.order.domain.YxStoreOrderCartInfo;
import co.yixiang.modules.order.service.mapper.StoreOrderCartInfoMapper;

4
zsw-bxg/src/main/java/co/yixiang/modules/store/service/YxStoreBrandService.java

@ -11,12 +11,14 @@ import co.yixiang.common.service.BaseService;
import co.yixiang.domain.PageResult;
import co.yixiang.modules.store.domain.YxStoreBrand;
import co.yixiang.modules.store.service.dto.YxStoreBrandDto;
import co.yixiang.modules.store.service.dto.YxStoreBrandNameDto;
import co.yixiang.modules.store.service.dto.YxStoreBrandQueryCriteria;
import co.yixiang.utils.BrandDTO;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.io.IOException;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
/**
* @author ssj
@ -26,7 +28,7 @@ public interface YxStoreBrandService extends BaseService<YxStoreBrand> {
List<BrandDTO> getList();
Map<String,List<YxStoreBrandNameDto>> getListByName();
/**
* 查询数据分页
* @param criteria 条件

20
zsw-bxg/src/main/java/co/yixiang/modules/store/service/dto/YxStoreBrandNameDto.java

@ -0,0 +1,20 @@
package co.yixiang.modules.store.service.dto;
import lombok.Data;
/**
* @author ssj
* @date 2022-10-26
*/
@Data
public class YxStoreBrandNameDto {
// 商品品牌表ID
private Integer id;
// 品牌名称
private String brandName;
// 品牌图标
private String pic;
}

5
zsw-bxg/src/main/java/co/yixiang/modules/store/service/dto/YxStoreBrandSamllDto.java

@ -6,7 +6,7 @@ import java.io.Serializable;
/**
* @author ssj
* @date 2019-9-17
* @date 2022-9-17
*/
@Data
public class YxStoreBrandSamllDto implements Serializable {
@ -14,8 +14,7 @@ public class YxStoreBrandSamllDto implements Serializable {
// 商品品牌表ID
private Integer id;
// 分类名称
// 品牌名称
private String brandName;
}

177
zsw-bxg/src/main/java/co/yixiang/modules/store/service/impl/Sort.java

@ -0,0 +1,177 @@
package co.yixiang.modules.store.service.impl;
/**
* 排序算法
* @author sj
* @creation date 2022-10-26
*/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** 首字母排序分类 **/
public class Sort {
/**
* 字母大小写标识 capital:大写
*/
private static final String Letter_flag_capital = "capital";
/**
* 排序的方法
* @param list 需要排序的List集合
* @return
*/
public Map<String, List<String>> sort(List<String> list){
Map<String,List<String>> map = new HashMap<String,List<String>>();
List<String> arraylist = new ArrayList<String>();
String[] alphatableb =
{
"A", "B", "C", "D", "E", "F", "G", "H", "I",
"J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
};
for(String a:alphatableb){
for(int i=0;i<list.size();i++){//为了排序都返回大写字母
if(a.equals(String2AlphaFirst(list.get(i).toString(),Letter_flag_capital))){
arraylist.add(list.get(i).toString());
}
}
map.put(a,arraylist);
arraylist=new ArrayList<String>();
}
return map;
}
//字母Z使用了两个标签,这里有27个值
//i, u, v都不做声母, 跟随前面的字母
private char[] chartable =
{
'啊', '芭', '擦', '搭', '蛾', '发', '噶', '哈', '哈',
'击', '喀', '垃', '妈', '拿', '哦', '啪', '期', '然',
'撒', '塌', '塌', '塌', '挖', '昔', '压', '匝', '座'
};
// 大写字母匹配数组
private char[] alphatableb =
{
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
};
// 小写字母匹配数组
private char[] alphatables =
{
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
};
private int[] table = new int[27]; //初始化
{
for (int i = 0; i < 27; ++i) {
table[i] = gbValue(chartable[i]);
}
}
/**
* 主函数,输入字符,得到他的声母,英文字母返回对应的大小写字母,英文字母返回对应的大小写字母
* @param ch 字符
* @param type 大小写类型标识
* @return
*/
public char Char2Alpha(char ch,String type) {
if (ch >= 'a' && ch <= 'z')
return (char) (ch - 'a' + 'A');//为了按字母排序先返回大写字母
if (ch >= 'A' && ch <= 'Z')
return ch;
int gb = gbValue(ch);
if (gb < table[0])
return '0';
int i;
for (i = 0; i < 26; ++i) {
if (match(i, gb))
break;
}
if (i >= 26){
return '0';}
else{
if(Letter_flag_capital.equals(type)){//大写
return alphatableb[i];
}else{//小写
return alphatables[i];
}
}
}
/**
* 根据一个包含汉字的字符串返回一个汉字拼音首字母的字符串
* @param SourceStr 目标字符串
* @param type 大小写类型
* @return
*/
public String String2Alpha(String SourceStr,String type) {
String Result = "";
int StrLength = SourceStr.length();
int i;
try {
for (i = 0; i < StrLength; i++) {
Result += Char2Alpha(SourceStr.charAt(i),type);
}
} catch (Exception e) {
Result = "";
}
return Result;
}
/**
* 根据一个包含汉字的字符串返回第一个汉字拼音首字母的字符串
* @param SourceStr 目标字符串
* @param type 大小写类型
* @return
*/
public String String2AlphaFirst(String SourceStr,String type) {
String Result = "";
try {
Result += Char2Alpha(SourceStr.charAt(0),type);
} catch (Exception e) {
Result = "";
}
return Result;
}
private boolean match(int i, int gb) {
if (gb < table[i])
return false;
int j = i + 1;
//字母Z使用了两个标签
while (j < 26 && (table[j] == table[i]))
++j;
if (j == 26)
return gb <= table[j];
else
return gb < table[j];
}
/**
* 取出汉字的编码
* @param ch
* @return
*/
private int gbValue(char ch) {
String str = new String();
str += ch;
try {
byte[] bytes = str.getBytes("GBK");
if (bytes.length < 2)
return 0;
return (bytes[0] << 8 & 0xff00) + (bytes[1] &
0xff);
} catch (Exception e) {
return 0;
}
}
}

48
zsw-bxg/src/main/java/co/yixiang/modules/store/service/impl/YxStoreBrandServiceImpl.java

@ -15,6 +15,7 @@ import co.yixiang.domain.PageResult;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.modules.store.domain.YxStoreBrand;
import co.yixiang.modules.store.service.dto.YxStoreBrandNameDto;
import co.yixiang.utils.FileUtil;
import co.yixiang.utils.BrandDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -33,12 +34,11 @@ import org.springframework.transaction.annotation.Transactional;
//import org.springframework.cache.annotation.CacheEvict;
//import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
/**
* @author ssj
* @date 2022-09-15
@ -53,7 +53,7 @@ public class YxStoreBrandServiceImpl extends BaseServiceImpl<YxStoreBrandMapper,
@Autowired
private YxStoreBrandMapper yxStoreBrandMapper;
/**
* 获取商家品牌树形列表
* 获取商家品牌并根据首字母排序
* @return List
*/
@Override
@ -66,6 +66,44 @@ public class YxStoreBrandServiceImpl extends BaseServiceImpl<YxStoreBrandMapper,
return list;
}
private static final String KEY_SPLIT = "!";
public Map<String,List<YxStoreBrandNameDto> > getListByName() {
ArrayList list=new ArrayList();
this.getList().forEach(item->{
list.add(item.getBrandName()+KEY_SPLIT+item.getId()+KEY_SPLIT+item.getPic());
});
Sort sort=new Sort();
Map<String,List<String>> map = sort.sort(list);
Map<String, List<YxStoreBrandNameDto>> resultMap = new HashMap<>();
// 遍历排序之后的集合
for (Map.Entry<String, List<String>> listEntry : map.entrySet()) {
for (String value : listEntry.getValue()) {
// map中的key是否包含品牌首字母,若存在则把数据处理之后存储到对象里面,然后添加到List里面,
// 否则新建key然后再把数据处理之后存储到对象里面,然后添加到List里面
if (resultMap.containsKey(listEntry.getKey())) {
YxStoreBrandNameDto brandNameDto = new YxStoreBrandNameDto();
String [] brandArray = value.split(KEY_SPLIT); // 按:把品牌信息分开
brandNameDto.setBrandName(brandArray[0]); // 品牌名称
brandNameDto.setId(Integer.valueOf(brandArray[1])); // 品牌id
brandNameDto.setPic(brandArray[2]); //品牌图标
// brandNameDto.setCarBrandFirstLetter(listEntry.getKey()); // 品牌名称首字母
resultMap.get(listEntry.getKey()).add(brandNameDto);
}else {
List<YxStoreBrandNameDto> list2 = new ArrayList<YxStoreBrandNameDto>();
YxStoreBrandNameDto brandNameDto = new YxStoreBrandNameDto();
String [] brandArray = value.split(KEY_SPLIT); // 按:把品牌名称和id分开
brandNameDto.setBrandName(brandArray[0]); // 品牌名称
brandNameDto.setId(Integer.valueOf(brandArray[1])); // 品牌id
brandNameDto.setPic(brandArray[2]); //品牌图标
// brandNameDto.setCarBrandFirstLetter(listEntry.getKey()); // 品牌名称首字母
list2.add(brandNameDto);
resultMap.put(listEntry.getKey(), list2);
}
}
}
return resultMap;
}
@Override
//@Cacheable
public PageResult<YxStoreBrandDto> queryAll(YxStoreBrandQueryCriteria criteria, Pageable pageable) {

2
zsw-bxg/src/main/java/co/yixiang/modules/user/domain/YxUser.java

@ -49,6 +49,8 @@ public class YxUser extends BaseDomain {
private String username;
/** 小程序微信openId */
private String openId;
/** 用户密码(跟pwd) */

4
zsw-bxg/src/main/java/co/yixiang/utils/EvaluationDTO.java

@ -1,5 +1,6 @@
package co.yixiang.utils;
import co.yixiang.modules.evaluation.domain.EditableTabs;
import co.yixiang.modules.product.domain.YxStoreProduct;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
@ -37,6 +38,9 @@ public class EvaluationDTO implements Serializable {
/** 在列表里面的首页图 */
private String homeImage;
/**图文配置**/
private ArrayList<EditableTabs> editableTabs;
/** 评测介绍 */
private String synopsis;

Loading…
Cancel
Save