Browse Source

问题修复

dev
wangfukang 1 year ago
parent
commit
85f6907b09
  1. 16
      hiver-admin/test-output/test-report.html
  2. 3
      hiver-core/src/main/java/cc/hiver/core/service/UserService.java
  3. 15
      hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java
  4. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java
  5. 23
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java
  6. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java
  7. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
  8. 9
      hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml
  9. 37
      hiver-modules/hiver-social/src/main/java/cc/hiver/social/controller/WechatController.java
  10. 6
      hiver-modules/hiver-social/src/main/java/cc/hiver/social/handler/WxServerMsgHandler.java

16
hiver-admin/test-output/test-report.html

@ -35,7 +35,7 @@
<a href="#"><span class="badge badge-primary">Hiver</span></a>
</li>
<li class="m-r-10">
<a href="#"><span class="badge badge-primary">一月 09, 2025 17:32:09</span></a>
<a href="#"><span class="badge badge-primary">一月 22, 2025 18:29:49</span></a>
</li>
</ul>
</div>
@ -84,7 +84,7 @@
<div class="test-detail">
<span class="meta text-white badge badge-sm"></span>
<p class="name">passTest</p>
<p class="text-sm"><span>17:32:10 下午</span> / <span>0.028 secs</span></p>
<p class="text-sm"><span>18:29:50 下午</span> / <span>0.015 secs</span></p>
</div>
<div class="test-contents d-none">
<div class="detail-head">
@ -92,9 +92,9 @@
<div class="info">
<div class='float-right'><span class='badge badge-default'>#test-id=1</span></div>
<h5 class="test-status text-pass">passTest</h5>
<span class='badge badge-success'>01.09.2025 17:32:10</span>
<span class='badge badge-danger'>01.09.2025 17:32:10</span>
<span class='badge badge-default'>0.028 secs</span>
<span class='badge badge-success'>01.22.2025 18:29:50</span>
<span class='badge badge-danger'>01.22.2025 18:29:50</span>
<span class='badge badge-default'>0.015 secs</span>
</div>
<div class="m-t-10 m-l-5"></div>
</div>
@ -104,7 +104,7 @@
<tbody>
<tr class="event-row">
<td><span class="badge log pass-bg">Pass</span></td>
<td>17:32:10</td>
<td>18:29:50</td>
<td>
Test passed
</td>
@ -128,13 +128,13 @@
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Started</p>
<h3>一月 09, 2025 17:32:09</h3>
<h3>一月 22, 2025 18:29:49</h3>
</div></div>
</div>
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Ended</p>
<h3>一月 09, 2025 17:32:10</h3>
<h3>一月 22, 2025 18:29:50</h3>
</div></div>
</div>
<div class="col-md-3">

3
hiver-core/src/main/java/cc/hiver/core/service/UserService.java

@ -3,7 +3,6 @@ package cc.hiver.core.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.core.common.vo.SearchVo;
import cc.hiver.core.entity.User;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.data.domain.Page;
@ -129,7 +128,7 @@ public interface UserService extends HiverBaseService<User, String> {
* @author 王富康
* @date 2024/12/29
*/
void unSubscribeWxServer(WxMpXmlMessage wxMessage);
void unSubscribeWxServer(WxMpUser user);
User findByUnionid(String unionid);

15
hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java

@ -22,7 +22,6 @@ import cc.hiver.core.vo.RoleDTO;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.CharSequenceUtil;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -319,9 +318,19 @@ public class UserServiceImpl implements UserService {
save(wechatUser);
}
/**
* 取消关注公众号接触user绑定
* @author 王富康
* @date 2025/1/17
* @param user
*/
@Override
public void unSubscribeWxServer(WxMpXmlMessage wxMessage) {
public void unSubscribeWxServer(WxMpUser user) {
final String unionid = user.getUnionId();
User wechatUser = findByUnionid(unionid);
// 接触微信公众号的openId
wechatUser.setOfficialAccountOpenid("");
save(wechatUser);
}
@Override

3
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java

@ -131,7 +131,10 @@ public class CustomerController {
final User user = userService.get(userId);
user.setNickname(customer.getName());
user.setSex(customer.getSex());
// 2025-01-16 app/customer/edit这个接口手机号 穿了个空,报错:"mobile-11位手机号格式不正确"
if(StringUtils.isNotEmpty(customer.getPhone())){
user.setMobile(customer.getPhone());
}
user.setAddress(customer.getAddress());
userService.update(user);
}

23
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java

@ -3,14 +3,13 @@ package cc.hiver.mall.serviceimpl;
import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.constant.DealingsRecordConstant;
import cc.hiver.core.common.constant.SaleConstant;
import cc.hiver.core.common.constant.UserConstant;
import cc.hiver.core.common.sms.SmsUtil;
import cc.hiver.core.common.utils.*;
import cc.hiver.core.common.vo.PageVo;
import cc.hiver.core.common.utils.BeanUtils;
import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.common.utils.SnowFlakeUtil;
import cc.hiver.core.common.utils.StringUtils;
import cc.hiver.core.entity.LogiticsCompany;
import cc.hiver.core.entity.Role;
import cc.hiver.core.entity.User;
import cc.hiver.core.entity.UserRole;
import cc.hiver.core.service.LogiticsCompanyService;
import cc.hiver.core.service.RoleService;
import cc.hiver.core.service.UserRoleService;
@ -29,8 +28,6 @@ import cc.hiver.mall.service.mybatis.*;
import cn.hutool.core.text.CharSequenceUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@ -453,10 +450,10 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
// 分享页提交订单的时候,根据手机号查询下游客户信息,如果查不到,则新增下游客户
User byMobile;
String customerId = "";
if (StringUtils.isNotEmpty(saleQueryDTO.getMobile())) {
// if (StringUtils.isNotEmpty(saleQueryDTO.getMobile())) {
// 20240906如果前台传了客户id了,不要新增客户了就
if(StringUtils.isEmpty(saleQueryDTO.getUserId())){
byMobile = userService.findByMobile(saleQueryDTO.getMobile());
/*byMobile = userService.findByMobile(saleQueryDTO.getMobile());
if (byMobile == null) {
//默认密码
final String encryptPass = new BCryptPasswordEncoder().encode("123456");
@ -495,9 +492,9 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
}
byMobile = userService.save(byMobile);
}
}
}*/
customer.setUserId(byMobile.getId());
// customer.setUserId(byMobile.getId());
customer.setCreateTime(new Date());
customer.setDelFlag(CommonConstant.DEL_FLAG_FALSE);
customer.setName(saleQueryDTO.getUsername());
@ -545,10 +542,10 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
// 客户id拿前台传的
customerId = saleQueryDTO.getUserId();
}
} else {
/*} else {
log.error("下游客户未填写手机号!");
return null;
}
}*/
// 分享页提交订单这里肯定是:未收款
sale.setPayStatus("0");

4
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java

@ -83,12 +83,14 @@ public class SupplierServiceImpl implements SupplierService {
final Predicate[] arr = new Predicate[list.size()];
cq.where(list.toArray(arr));
final Expression<String> orderByExpression = root.get("orderByField");
final Expression<String> orderById = root.get("id");
final Expression<Object> orderCase = cb.selectCase()
.when(cb.isNull(orderByExpression), 1) // 如果是 null, 给一个较大的值
.otherwise(0); // 如果不是 null, 给一个较小的值
cq.orderBy(
cb.asc(orderCase), // 先按是否为 null 排序
cb.asc(orderByExpression) // 再按实际值排序
cb.asc(orderByExpression), // 再按实际值排序
cb.asc(orderById) // 按照id排序
);
return null;
}

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java

@ -1211,7 +1211,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
if (CollUtil.isNotEmpty(purchaseVo.getPurchaseDetails()) && purchaseVo.getPurchaseDetails().get(0).getPurchasePrice() != null && Objects.equals(shopUser.getType(), ShopUserConstant.SHOP_ADMIN_COST[0])) {
debtService.purchaseToDebt(purchase);
}
return ResultUtil.success("添加成功");
return new ResultUtil<>().setData(purchaseId, "入库成功");
} else {
return ResultUtil.error("添加入库单商品规格信息失败");
}

9
hiver-modules/hiver-mall/src/main/resources/mapper/CustomerMapper.xml

@ -472,7 +472,8 @@
name
WHEN '散客' THEN
1 ELSE CONVERT( name USING gbk )
END COLLATE gbk_chinese_ci ASC
END COLLATE gbk_chinese_ci ASC,
a.id asc
</otherwise>
</choose>
</select>
@ -542,7 +543,9 @@
FROM
t_user
WHERE
id IN (
official_account_openid is not null
and official_account_openid != ''
and id IN (
SELECT
user_id
FROM
@ -556,7 +559,7 @@
and user_id = #{userId}
</if>
<if test=" isAll != null and isAll != ''">
and category_id is null
and (category_id is null or category_id = '')
</if>
)
</select>

37
hiver-modules/hiver-social/src/main/java/cc/hiver/social/controller/WechatController.java

@ -174,6 +174,43 @@ public class WechatController {
return "redirect:" + url;
}
/**
* 公众号回调接口验证服务器
* @author 王富康
* @date 2025/1/15
* @param signature
* @param timestamp
* @param nonce
* @param echostr
* @param response
*/
/*@RequestMapping("echo")
@GetMapping
public void get(@RequestParam(required = false) String signature,
@RequestParam(required = false) String timestamp,
@RequestParam(required = false) String nonce,
@RequestParam(required = false) String echostr,
HttpServletResponse response) throws IOException {
if (!wxMpService.checkSignature(timestamp, nonce, signature)) {
log.warn("接收到了未通过校验的微信消息,这可能是token配置错了,或是接收了非微信官方的请求");
return;
}
response.setCharacterEncoding("UTF-8");
response.getWriter().write(echostr);
response.getWriter().flush();
response.getWriter().close();
}*/
/**
* 公众号回调接口验证成功之后
* @author 王富康
* @date 2025/1/15
* @param requestBody
* @param signature
* @param timestamp
* @param nonce
* @return String
*/
@RequestMapping("echo")
@ResponseBody
public String configAccess(@RequestBody String requestBody, @RequestParam("signature") String signature, @RequestParam("timestamp") String timestamp, @RequestParam("nonce") String nonce) {

6
hiver-modules/hiver-social/src/main/java/cc/hiver/social/handler/WxServerMsgHandler.java

@ -31,16 +31,16 @@ public class WxServerMsgHandler implements WxMpMessageHandler {
//判断是否是事件类型
if(wxMessage.getMsgType().equals(WxConsts.XmlMsgType.EVENT)){
//订阅
if(wxMessage.getEvent().equals(WxConsts.EventType.SUBSCRIBE)){
outContent = "【快衣店信息推送】欢迎您!致力于帮助服装店主们更好地进行商品管理和营销推广,我们会持续发布实用技巧、成功案例分析等内容。期待与您共同成长,共创辉煌业绩!";
final String lang = "zh_CN"; //语言
final WxMpUser user = wxMpService.getUserService().userInfo(wxMessage.getFromUser(),lang);
if(wxMessage.getEvent().equals(WxConsts.EventType.SUBSCRIBE)){
outContent = "【快衣店信息推送】欢迎您!致力于帮助服装店主们更好地进行商品管理和营销推广,我们会持续发布实用技巧、成功案例分析等内容。期待与您共同成长,共创辉煌业绩!";
log.info("关注公众号的用户信息:user====:{}",user);
userService.subscribeWxServer(user);
}
//取消订阅
if(wxMessage.getEvent().equals(WxConsts.EventType.UNSUBSCRIBE)){
userService.unSubscribeWxServer(user);
}
} else if (wxMessage.getMsgType().equals(WxConsts.XmlMsgType.TEXT)){
//判断为文本消息

Loading…
Cancel
Save