diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index eaf1860f..7097d95e 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://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 diff --git a/zsw-bxg/src/main/java/co/yixiang/app/common/interceptor/PermissionInterceptor.java b/zsw-bxg/src/main/java/co/yixiang/app/common/interceptor/PermissionInterceptor.java index 3b16b51a..41b6fc90 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/common/interceptor/PermissionInterceptor.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/common/interceptor/PermissionInterceptor.java @@ -74,7 +74,7 @@ public class PermissionInterceptor implements HandlerInterceptor { Map 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); 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 19a9ff4d..e0465f81 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 @@ -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; diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreBrandController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreBrandController.java index e4e8c986..0f032beb 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreBrandController.java +++ b/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; /** *

@@ -41,6 +43,16 @@ public class AppStoreBrandController { return ApiResult.ok(yxStoreBrandService.getList()); } + /** + * 商品品牌列表按首字母分类 + */ + @AnonymousAccess + @GetMapping("/brandByName") + @ApiOperation(value = "商品品牌列表",notes = "商品品牌列表") + public ApiResult>> getListByName(){ + return ApiResult.ok(yxStoreBrandService.getListByName()); + } + /** * 商品品牌列表 */ diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/services/AppAuthService.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/services/AppAuthService.java index 3ab44bff..c416594d 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/services/AppAuthService.java +++ b/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() - .getPhoneNoInfo(session.getSessionKey(), encryptedData, iv); - - YxUser yxUser = this.userService.getOne(Wrappers.lambdaQuery() - .eq(YxUser::getPhone, phoneNoInfo.getPhoneNumber()), false); - + WxMaPhoneNumberInfo phoneNoInfo=new WxMaPhoneNumberInfo(); + //防止仅有code时候调用解密方法报错 + if (StringUtils.isBlank(encryptedData)&StringUtils.isBlank(iv)){ + }else { + phoneNoInfo= wxMaService.getUserService() + .getPhoneNoInfo(session.getSessionKey(), encryptedData, iv); + } + YxUser yxUser ; + //手机号会员 + yxUser=this.userService.getOne(Wrappers.lambdaQuery() + .eq(YxUser::getPhone,phoneNoInfo.getPhoneNumber()), false); + //openid会员 + if (ObjectUtil.isNull(yxUser)){ + yxUser = this.userService.getOne(Wrappers.lambdaQuery() + .eq(YxUser::getOpenId,session.getOpenid()),false); + } if (ObjectUtil.isNull(yxUser)) { - //兼容旧系统 yxUser = this.userService.getOne(Wrappers.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(); diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/wechat/rest/controller/WxMaUserController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/wechat/rest/controller/WxMaUserController.java index faec4803..898645c3 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/wechat/rest/controller/WxMaUserController.java +++ b/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) { diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/wechat/rest/param/WxPhoneParam.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/wechat/rest/param/WxPhoneParam.java index 730fb18c..8998daba 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/wechat/rest/param/WxPhoneParam.java +++ b/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; diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java index a7421ea2..0cbdca79 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java @@ -222,15 +222,15 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl { - @Select("") List selecCoupontList(Page page,@Param("type") Integer type, diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/EditableTabs.java b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/EditableTabs.java new file mode 100644 index 00000000..b63b85ee --- /dev/null +++ b/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; + +} diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/YxEvaluation.java b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/YxEvaluation.java index a26b79bc..1163d1d2 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/YxEvaluation.java +++ b/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; /** 评测总结 */ private String summary; diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/dto/YxEvaluationDto.java b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/dto/YxEvaluationDto.java index 8b7e84e7..6457779c 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/dto/YxEvaluationDto.java +++ b/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; /** 评测总结 */ private String summary; 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/SendMsgService.java similarity index 56% rename from zsw-bxg/src/main/java/co/yixiang/modules/inform/service/impl/SendMsgServiceImpl.java rename to zsw-bxg/src/main/java/co/yixiang/modules/inform/SendMsgService.java index 8d8697d8..f99462c1 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/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 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 arrayList=new ArrayList<>(); + ArrayList 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 list=docDesc.getElementsByTag("span"); + ArrayList 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 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 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(); } } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/CardAction.java b/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/CardAction.java index f037b025..a1549683 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/CardAction.java +++ b/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 代表跳转url,2 代表打开小程序。text_notice模版卡片中该字段取值范围为[1,2] */ @Data +@Builder +@NoArgsConstructor +@AllArgsConstructor public class CardAction { /**代表跳转url,2 代表打开小程序*/ diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/EmphasisContent.java b/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/EmphasisContent.java index 3bf00cd5..315468a1 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/EmphasisContent.java +++ b/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":"数据含义"*/ diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/MainTitle.java b/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/MainTitle.java index 80d89cce..c1ec3b3b 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/MainTitle.java +++ b/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; diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/Souce.java b/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/Souce.java index 5930a63c..248b68c2 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/Souce.java +++ b/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 绿色 */ diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/TemplateCard.java b/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/TemplateCard.java index 7c96f218..ac8b35f4 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/inform/domin/TemplateCard.java +++ b/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 代表跳转url,2 代表下载附件,3 代表@员工 keyname:二级标题、value:内容、url:链接 * */ - private ArrayList horizontal_content_list; + private ArrayList horizontalContentList; /** { "type":1, 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 deleted file mode 100644 index 5ce96251..00000000 --- a/zsw-bxg/src/main/java/co/yixiang/modules/inform/service/SendMsgService.java +++ /dev/null @@ -1,6 +0,0 @@ -package co.yixiang.modules.inform.service; - -public interface SendMsgService { - //type:0 支付 1:申请退款 - String inform(long orderId,int type); -} 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 526e7f86..08456053 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 @@ -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; diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java index adaafb6d..c8125771 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java @@ -119,6 +119,8 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl pageList = storeProductMapper.selectPage(pageModel, wrapper); List 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; } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java b/zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java index d9027dd0..badf2749 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java @@ -106,6 +106,8 @@ public interface StoreProductMapper extends CoreMapper { 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 selectPage(E page, @Param(Constants.WRAPPER) Wrapper queryWrapper); } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java b/zsw-bxg/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java index 074e79d0..9cd7df50 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java +++ b/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; diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java index f8a42f11..7388c34f 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java +++ b/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; diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/store/service/YxStoreBrandService.java b/zsw-bxg/src/main/java/co/yixiang/modules/store/service/YxStoreBrandService.java index 196f82df..2de1ce90 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/store/service/YxStoreBrandService.java +++ b/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 { List getList(); - + Map> getListByName(); /** * 查询数据分页 * @param criteria 条件 diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/store/service/dto/YxStoreBrandNameDto.java b/zsw-bxg/src/main/java/co/yixiang/modules/store/service/dto/YxStoreBrandNameDto.java new file mode 100644 index 00000000..13b145ec --- /dev/null +++ b/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; +} diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/store/service/dto/YxStoreBrandSamllDto.java b/zsw-bxg/src/main/java/co/yixiang/modules/store/service/dto/YxStoreBrandSamllDto.java index b354c058..7d2be778 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/store/service/dto/YxStoreBrandSamllDto.java +++ b/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; } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/store/service/impl/Sort.java b/zsw-bxg/src/main/java/co/yixiang/modules/store/service/impl/Sort.java new file mode 100644 index 00000000..40524404 --- /dev/null +++ b/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> sort(List list){ + Map> map = new HashMap>(); + List arraylist = new ArrayList(); + 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(); + } + 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; + } + } +} diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/store/service/impl/YxStoreBrandServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/store/service/impl/YxStoreBrandServiceImpl.java index febe6045..dce195e1 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/store/service/impl/YxStoreBrandServiceImpl.java +++ b/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 > 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> map = sort.sort(list); + Map> resultMap = new HashMap<>(); + // 遍历排序之后的集合 + for (Map.Entry> 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 list2 = new ArrayList(); + 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 queryAll(YxStoreBrandQueryCriteria criteria, Pageable pageable) { diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/user/domain/YxUser.java b/zsw-bxg/src/main/java/co/yixiang/modules/user/domain/YxUser.java index 27d4564f..5bfa1cd9 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/user/domain/YxUser.java +++ b/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) */ 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 8fad5a66..456444d5 100644 --- a/zsw-bxg/src/main/java/co/yixiang/utils/EvaluationDTO.java +++ b/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; + /** 评测介绍 */ private String synopsis;