发货邮件邮件 bug 修改

This commit is contained in:
Jack 2024-12-12 10:01:27 +08:00
parent 6fc21b3e3f
commit 48aa92e2b8
35 changed files with 1062 additions and 114 deletions

View File

@ -141,4 +141,6 @@ public interface AccountUserBaseService extends IBaseService<AccountUserBase> {
* @param code * @param code
*/ */
void callbackGoogle(HttpServletResponse response, String code); void callbackGoogle(HttpServletResponse response, String code);
boolean changePassword(String old_password, String password);
} }

View File

@ -48,12 +48,12 @@ import com.suisung.mall.common.modules.distribution.ShopDistributionUser;
import com.suisung.mall.common.modules.distribution.ShopDistributionUserCommission; import com.suisung.mall.common.modules.distribution.ShopDistributionUserCommission;
import com.suisung.mall.common.modules.pay.PayUserResource; import com.suisung.mall.common.modules.pay.PayUserResource;
import com.suisung.mall.common.modules.plantform.ShopPlantformSubsiteUser; import com.suisung.mall.common.modules.plantform.ShopPlantformSubsiteUser;
import com.suisung.mall.common.pojo.dto.SmsDto;
import com.suisung.mall.common.service.MessageService; import com.suisung.mall.common.service.MessageService;
import com.suisung.mall.common.utils.*; import com.suisung.mall.common.utils.*;
import com.suisung.mall.common.utils.constbank.RSAUtil; import com.suisung.mall.common.utils.constbank.RSAUtil;
import com.suisung.mall.common.utils.phone.PhoneNumberUtils; import com.suisung.mall.common.utils.phone.PhoneNumberUtils;
import com.suisung.mall.common.utils.pojo.dto.EmailDTO; import com.suisung.mall.common.utils.pojo.dto.EmailDTO;
import com.suisung.mall.core.web.model.SmsDto;
import com.suisung.mall.core.web.service.CloundService; import com.suisung.mall.core.web.service.CloundService;
import com.suisung.mall.core.web.service.RedisService; import com.suisung.mall.core.web.service.RedisService;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl; import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
@ -89,75 +89,52 @@ import static com.suisung.mall.common.utils.I18nUtil._;
@Service @Service
public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseMapper, AccountUserBase> implements AccountUserBaseService { public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseMapper, AccountUserBase> implements AccountUserBaseService {
private final String VERIFY_CODE_KEY = "register:verifyCode:";
@Autowired @Autowired
private AuthService authService; private AuthService authService;
@Autowired @Autowired
private AdminService adminService; private AdminService adminService;
@Autowired @Autowired
private SnsService snsService; private SnsService snsService;
@Autowired @Autowired
private HttpServletRequest request; private HttpServletRequest request;
@Autowired @Autowired
private RedisService redisService; private RedisService redisService;
@Autowired @Autowired
private ShopService shopService; private ShopService shopService;
@Autowired @Autowired
private PayService payService; private PayService payService;
@Autowired @Autowired
private AccountUserInfoService accountUserInfoService; private AccountUserInfoService accountUserInfoService;
@Autowired @Autowired
private AccountUserLoginService accountUserLoginService; private AccountUserLoginService accountUserLoginService;
@Autowired @Autowired
private AccountBaseConfigService accountBaseConfigService; private AccountBaseConfigService accountBaseConfigService;
@Autowired @Autowired
private AccountBaseUserLevelService baseUserLevelService; private AccountBaseUserLevelService baseUserLevelService;
@Autowired @Autowired
private AccountUserSnsService accountUserSnsService; private AccountUserSnsService accountUserSnsService;
@Autowired @Autowired
private AccountUserBindConnectService bindConnectService; private AccountUserBindConnectService bindConnectService;
@Autowired @Autowired
private AccountUserTypeService accountUserTypeService; private AccountUserTypeService accountUserTypeService;
@Autowired @Autowired
private MessageService messageService; private MessageService messageService;
@Autowired @Autowired
private WeiXinService weiXinService; private WeiXinService weiXinService;
@Autowired @Autowired
private AccountUserBindConnectService accountUserBindConnectService; private AccountUserBindConnectService accountUserBindConnectService;
@Autowired @Autowired
private AccountUserBaseService accountUserBaseService; private AccountUserBaseService accountUserBaseService;
@Autowired @Autowired
private AccountUserChannelCodeService accountUserChannelCodeService; private AccountUserChannelCodeService accountUserChannelCodeService;
@Autowired @Autowired
private AccountUserChannelService accountUserChannelService; private AccountUserChannelService accountUserChannelService;
@Autowired @Autowired
private AccountUserBaseMapper accountUserBaseMapper; private AccountUserBaseMapper accountUserBaseMapper;
@Autowired @Autowired
private CloundService cloundService; private CloundService cloundService;
private final Logger logger = LoggerFactory.getLogger(AccountUserBaseServiceImpl.class);
private final String VERIFY_CODE_KEY = "register:verifyCode:";
private Logger logger = LoggerFactory.getLogger(AccountUserBaseServiceImpl.class);
@Override @Override
public CommonResult login(Map<String, String> params) { public CommonResult login(Map<String, String> params) {
@ -345,7 +322,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
String chain_ids = user.getChain_ids(); String chain_ids = user.getChain_ids();
if (StrUtil.isNotBlank(chain_ids)) { if (StrUtil.isNotBlank(chain_ids)) {
setIdentity(RoleIdEnum.CHAIN.getState(), null, user.getChain_ids(), userDTO); setIdentity(RoleIdEnum.CHAIN.getState(), null, user.getChain_ids(), userDTO);
return;
} }
} }
@ -369,7 +345,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
String store_ids = user.getStore_ids(); String store_ids = user.getStore_ids();
if (StrUtil.isNotBlank(store_ids)) { if (StrUtil.isNotBlank(store_ids)) {
user.setRid(RoleIdEnum.STORE.getState()); user.setRid(RoleIdEnum.STORE.getState());
return;
} }
} }
@ -1227,11 +1202,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
Date fx_user_time = new Date(); Date fx_user_time = new Date();
boolean update_flag = false; boolean update_flag = false;
if (fx_user_row != null && ObjectUtil.notEqual(user_parent_id, old_user_parent_id)) { update_flag = fx_user_row != null && ObjectUtil.notEqual(user_parent_id, old_user_parent_id);
update_flag = true;
} else {
update_flag = false;
}
if (update_flag) { if (update_flag) {
// 初始化推销员记录 // 初始化推销员记录
@ -1911,8 +1882,8 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
String user_salt = user_row.getUser_salt(); String user_salt = user_row.getUser_salt();
String md5_password = SecureUtil.md5(user_salt + SecureUtil.md5(old_password)); String md5_password = SecureUtil.md5(user_salt + SecureUtil.md5(old_password));
if (!StrUtil.equals(md5_password, user_password)) { if (!StrUtil.equals(md5_password, user_row.getUser_password())) {
throw new ApiException(_("请输入账号")); throw new ApiException(_("原密码错误!"));
} }
} }
@ -2069,6 +2040,11 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
data.put("user_mobile", user_mobile); data.put("user_mobile", user_mobile);
} }
String user_intl = getParameter("user_intl");
if (StrUtil.isNotBlank(user_intl)) {
data.put("user_intl", user_intl);
}
String code = getParameter("code"); String code = getParameter("code");
if (StrUtil.isNotBlank(user_mobile) && StrUtil.isNotBlank(code)) { if (StrUtil.isNotBlank(user_mobile) && StrUtil.isNotBlank(code)) {
// todo 验证 验证码 // todo 验证 验证码
@ -2263,28 +2239,71 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
Long expire = redisService.getExpire(VERIFY_CODE_KEY + number); Long expire = redisService.getExpire(VERIFY_CODE_KEY + number);
if (expire != -1) { if (expire != -1) {
//一分钟后允许重发
if (expire > 60 * 4) {
throw new ApiException(_("验证码获取频率太高,请稍后再试")); throw new ApiException(_("验证码获取频率太高,请稍后再试"));
} }
}
String verifyCode = RandomUtil.randomNumbers(4); String verifyCode = RandomUtil.randomNumbers(4);
redisService.set(VERIFY_CODE_KEY + number, verifyCode, 60 * 5); redisService.set(VERIFY_CODE_KEY + number, verifyCode, 60 * 5);
// todo 优化国际手机号截取 // todo 优化国际手机号截取
if (PhoneUtil.isMobile(number)) { if (PhoneUtil.isMobile(number)) {
number = StrUtil.removePrefix(number, "+86");
SmsDto smsDTO = new SmsDto();
smsDTO.setMobile(number);
//读取sms配置信息 //读取sms配置信息
String service_user_id = accountBaseConfigService.getConfig("service_user_id"); String service_user_id = accountBaseConfigService.getConfig("service_user_id");
String service_app_key = accountBaseConfigService.getConfig("service_app_key"); String service_app_key = accountBaseConfigService.getConfig("service_app_key");
smsDTO.setServiceUserId(service_user_id); number = StrUtil.removePrefix(number, "+86");
smsDTO.setServiceAppKey(service_app_key);
smsDTO.setContent(String.format(_("您的验证码: [%s] 5分钟内有效"), verifyCode));
SmsDto smsDto = new SmsDto();
smsDto.setSmsType(accountBaseConfigService.getConfig("sms_type", 1)); //默认短信通道
smsDto.setSmsSign(accountBaseConfigService.getConfig("sms_sign", "")); //默认短信通道
smsDto.setServiceUserId(service_user_id);
smsDto.setServiceAppKey(service_app_key);
//其它通道要赋值通道信息 appid 以及 key
String aliyunSmsAccessKeyId = accountBaseConfigService.getConfig("aliyun_sms_access_key_id");
String aliyunSmsAccessKeySecret = accountBaseConfigService.getConfig("aliyun_sms_access_key_secret");
String aliyunSmsRegionId = accountBaseConfigService.getConfig("aliyun_sms_region_id");
smsDto.setAliyunSmsAccessKeyId(aliyunSmsAccessKeyId);
smsDto.setAliyunSmsAccessKeySecret(aliyunSmsAccessKeySecret);
smsDto.setAliyunSmsRegionId(aliyunSmsRegionId);
String huaweiSmsKey = accountBaseConfigService.getConfig("huawei_sms_access_key");
String huaweiSmsKeySecret = accountBaseConfigService.getConfig("huawei_sms_access_secret");
smsDto.setHuaweiSmsKey(huaweiSmsKey);
smsDto.setHuaweiSmsKeySecret(huaweiSmsKeySecret);
// 短信应用SDK AppID 1400开头
Integer tengxunAppId = accountBaseConfigService.getConfig("tengxun_sms_app_id", 0);
// 短信应用SDK AppKey
String tengxunAppkey = accountBaseConfigService.getConfig("tengxun_sms_app_key");
smsDto.setTengxunAppId(tengxunAppId);
smsDto.setTengxunAppkey(tengxunAppkey);
smsDto.setTengxunTemplateId(1); //短信模板ID
smsDto.setMobile(number);
String aliyunSmsSign = accountBaseConfigService.getConfig("aliyun_sms_sign");
smsDto.setSmsSign(aliyunSmsSign);
smsDto.setTemplateCode("SMS_308685826");
smsDto.setContent("您的验证码为:${code},请勿泄露于他人!");
Map msgArgs = new HashMap();
msgArgs.put("code", verifyCode);
smsDto.setParamMap(msgArgs); //传入模板对应参数
try { try {
return cloundService.send(smsDTO); ThirdUtil.send(smsDto);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new ApiException(e.getMessage());
} }
return true;
} else if (CheckUtil.isEmail(number)) { } else if (CheckUtil.isEmail(number)) {
QueryWrapper<AccountBaseConfig> queryWrapper = new QueryWrapper<>(); QueryWrapper<AccountBaseConfig> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("config_type", "email"); queryWrapper.eq("config_type", "email");
@ -2294,7 +2313,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
Map<String, String> configMap = configs.stream().collect(Collectors.toMap(AccountBaseConfig::getConfig_key, AccountBaseConfig::getConfig_value, (k1, k2) -> k2)); Map<String, String> configMap = configs.stream().collect(Collectors.toMap(AccountBaseConfig::getConfig_key, AccountBaseConfig::getConfig_value, (k1, k2) -> k2));
EmailDTO emailDTO = Convert.convert(EmailDTO.class, configMap); EmailDTO emailDTO = Convert.convert(EmailDTO.class, configMap);
emailDTO.setEmail_to_Address(number); emailDTO.setEmail_to_Address(number);
emailDTO.setSubject(String.format(_("%s 注册验证码"), accountBaseConfigService.getConfig("site_name", "lancerdt"))); emailDTO.setSubject(String.format(_("%s 注册验证码"), accountBaseConfigService.getConfig("site_name", "MallSuite")));
emailDTO.setContent(String.format(_("您的验证码: [%s] 5分钟内有效"), verifyCode)); emailDTO.setContent(String.format(_("您的验证码: [%s] 5分钟内有效"), verifyCode));
try { try {
return EmailUtil.send(emailDTO); return EmailUtil.send(emailDTO);
@ -2322,19 +2341,61 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
// todo 优化国际手机号截取 // todo 优化国际手机号截取
if (PhoneUtil.isMobile(number)) { if (PhoneUtil.isMobile(number)) {
number = StrUtil.removePrefix(number, "+86"); number = StrUtil.removePrefix(number, "+86");
SmsDto smsDTO = new SmsDto();
smsDTO.setMobile(number);
//读取sms配置信息 //读取sms配置信息
String service_user_id = accountBaseConfigService.getConfig("service_user_id"); String service_user_id = accountBaseConfigService.getConfig("service_user_id");
String service_app_key = accountBaseConfigService.getConfig("service_app_key"); String service_app_key = accountBaseConfigService.getConfig("service_app_key");
smsDTO.setServiceUserId(service_user_id);
smsDTO.setServiceAppKey(service_app_key);
smsDTO.setContent(String.format(_("您的验证码: [%s] 5分钟内有效"), verifyCode)); SmsDto smsDto = new SmsDto();
smsDto.setSmsType(accountBaseConfigService.getConfig("sms_type", 1)); //默认短信通道
smsDto.setServiceUserId(service_user_id);
smsDto.setServiceAppKey(service_app_key);
//其它通道要赋值通道信息 appid 以及 key
String aliyunSmsAccessKeyId = accountBaseConfigService.getConfig("aliyun_sms_access_key_id");
String aliyunSmsAccessKeySecret = accountBaseConfigService.getConfig("aliyun_sms_access_key_secret");
String aliyunSmsRegionId = accountBaseConfigService.getConfig("aliyun_sms_region_id");
String aliyunSmsSign = accountBaseConfigService.getConfig("aliyun_sms_sign");
smsDto.setAliyunSmsAccessKeyId(aliyunSmsAccessKeyId);
smsDto.setAliyunSmsAccessKeySecret(aliyunSmsAccessKeySecret);
smsDto.setAliyunSmsRegionId(aliyunSmsRegionId);
String huaweiSmsKey = accountBaseConfigService.getConfig("huawei_sms_access_key");
String huaweiSmsKeySecret = accountBaseConfigService.getConfig("huawei_sms_access_secret");
smsDto.setHuaweiSmsKey(huaweiSmsKey);
smsDto.setHuaweiSmsKeySecret(huaweiSmsKeySecret);
// 短信应用SDK AppID 1400开头
Integer tengxunAppId = accountBaseConfigService.getConfig("tengxun_sms_app_id", 0);
// 短信应用SDK AppKey
String tengxunAppkey = accountBaseConfigService.getConfig("tengxun_sms_app_key");
smsDto.setTengxunAppId(tengxunAppId);
smsDto.setTengxunAppkey(tengxunAppkey);
smsDto.setTengxunTemplateId(1); //腾讯短信模板ID
smsDto.setMobile(number);
smsDto.setSmsSign(aliyunSmsSign);
smsDto.setTemplateCode("SMS_308685826");
// smsDto.setContent("您的验证码[yzm][minutes]分钟内有效。");
smsDto.setContent("您的验证码为:${code},请勿泄露于他人!");
Map msgArgs = new HashMap();
msgArgs.put("code", verifyCode);
smsDto.setParamMap(msgArgs); //传入模板对应参数
// Map msgArgs = new HashMap();
// msgArgs.put("yzm", verifyCode);
// smsDto.setParamMap(msgArgs); //传入模板对应参数
try { try {
return cloundService.send(smsDTO); ThirdUtil.send(smsDto);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new ApiException(e.getMessage());
} }
return true;
} else if (CheckUtil.isEmail(number)) { } else if (CheckUtil.isEmail(number)) {
QueryWrapper<AccountBaseConfig> queryWrapper = new QueryWrapper<>(); QueryWrapper<AccountBaseConfig> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("config_type", "email"); queryWrapper.eq("config_type", "email");
@ -2343,7 +2404,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
Map<String, String> configMap = configs.stream().collect(Collectors.toMap(AccountBaseConfig::getConfig_key, AccountBaseConfig::getConfig_value, (k1, k2) -> k2)); Map<String, String> configMap = configs.stream().collect(Collectors.toMap(AccountBaseConfig::getConfig_key, AccountBaseConfig::getConfig_value, (k1, k2) -> k2));
EmailDTO emailDTO = Convert.convert(EmailDTO.class, configMap); EmailDTO emailDTO = Convert.convert(EmailDTO.class, configMap);
emailDTO.setEmail_to_Address(number); emailDTO.setEmail_to_Address(number);
emailDTO.setSubject(String.format(_("%s 用户找回密码 验证码"), accountBaseConfigService.getConfig("site_name", "lancerdt"))); emailDTO.setSubject(String.format(_("%s 用户找回密码 验证码"), accountBaseConfigService.getConfig("site_name", "MallSuite")));
emailDTO.setContent(String.format(_("您的验证码: [%s] 5分钟内有效"), verifyCode)); emailDTO.setContent(String.format(_("您的验证码: [%s] 5分钟内有效"), verifyCode));
try { try {
return EmailUtil.send(emailDTO); return EmailUtil.send(emailDTO);
@ -2370,7 +2431,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
//通过lure脚本原子验证令牌和删除令牌 //通过lure脚本原子验证令牌和删除令牌
String script = "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) else return 0 end"; String script = "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) else return 0 end";
Long res = redisService.execute(script, Arrays.asList(VERIFY_CODE_KEY + number), verifyCode); Long res = redisService.execute(script, Collections.singletonList(VERIFY_CODE_KEY + number), verifyCode);
return res != 0L; return res != 0L;
} }
@ -2840,7 +2901,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
List<AccountUserBase> list = super.gets(ids); List<AccountUserBase> list = super.gets(ids);
UserDto currentUser = getCurrentUser(); UserDto currentUser = getCurrentUser();
if ((currentUser!=null&&currentUser.getClient_id().equals(AuthConstant.ADMIN_CLIENT_ID)) && ConfigConstant.URL_BASE.equals("https://demo.lancerdt.com")) { if ((currentUser != null && currentUser.getClient_id().equals(AuthConstant.ADMIN_CLIENT_ID)) && ConfigConstant.URL_BASE.equals("https://demo.mallsuite.cn")) {
for (AccountUserBase it : list) { for (AccountUserBase it : list) {
if (ObjectUtil.isNotEmpty(it)) { if (ObjectUtil.isNotEmpty(it)) {
String userAccount = it.getUser_account(); String userAccount = it.getUser_account();
@ -2861,4 +2922,20 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
return list; return list;
} }
@Override
public boolean changePassword(String old_password, String password) {
UserDto user = getCurrentUser();
if (user == null) {
throw new ApiException(ResultCode.UNAUTHORIZED);
}
if (!doResetPasswd(user.getUser_account(), password, old_password)) {
throw new ApiException(ResultCode.FAILED);
}
return true;
}
} }

View File

@ -135,6 +135,48 @@
<groupId>com.aliyun.oss</groupId> <groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId> <artifactId>aliyun-sdk-oss</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.5.16</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java</artifactId>
<version>3.1.87</version>
</dependency>
<dependency>
<groupId>com.github.qcloudsms</groupId>
<artifactId>qcloudsms</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>com.apistd.uni</groupId>
<artifactId>uni-sdk</artifactId>
<version>0.0.4</version>
</dependency>
<dependency>
<groupId>com.qcloud</groupId>
<artifactId>cos_api</artifactId>
<version>5.6.8</version>
<!--排除这个slf4j-log4j12-->
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.huaweicloud</groupId>
<artifactId>esdk-obs-java-bundle</artifactId>
<version>3.21.11</version>
</dependency>
<!-- google libphonenumber --> <!-- google libphonenumber -->
<dependency> <dependency>
<groupId>com.googlecode.libphonenumber</groupId> <groupId>com.googlecode.libphonenumber</groupId>

View File

@ -18,4 +18,17 @@ public class CommonConstant {
public static final Integer Delivery_Amount_Comput_Type_Original = 1; public static final Integer Delivery_Amount_Comput_Type_Original = 1;
public static final Integer Delivery_Amount_Comput_Type_Discounted = 2; public static final Integer Delivery_Amount_Comput_Type_Discounted = 2;
public static final Integer Delivery_Amount_Comput_Type_Payment = 3; public static final Integer Delivery_Amount_Comput_Type_Payment = 3;
// 店铺角色权限组
public static final String STORE_RIGHT_GROUP_ADMIN = "店铺管理员"; // 店铺管理员;
public static final String STORE_RIGHT_GROUP_YYJL = "运营经理"; // 店铺管理员;
public static final String STORE_RIGHT_GROUP_DDSHY = "订单审核员"; // 店铺管理员;
public static final String STORE_RIGHT_GROUP_CWSHY = "财务审核员"; // 店铺管理员;
public static final String STORE_RIGHT_GROUP_FHSHY = "发货审核员"; // 店铺管理员;
public static final String STORE_RIGHT_GROUP_YWJL = "业务经理"; // 店铺管理员;
public static final String STORE_RIGHT_GROUP_CKGLY = "仓库管理员"; // 店铺管理员;
public static final String STORE_RIGHT_GROUP_ZLWHY = "资料维护员"; // 店铺管理员;
public static final String STORE_RIGHT_GROUP_KF = "客服"; // 店铺管理员;
public static final String STORE_RIGHT_GROUP_KZ1 = "扩展1"; // 店铺管理员;
public static final String STORE_RIGHT_GROUP_KZ2 = "扩展2"; // 店铺管理员;
} }

View File

@ -0,0 +1,44 @@
package com.suisung.mall.common.pojo.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "邮件配置DTO", description = "邮件配置DTO")
public class EmailDto {
@ApiModelProperty("发信邮箱")
private String emailAddr;
@ApiModelProperty("发信人")
private String emailFromname;
@ApiModelProperty("SMTP 服务器")
private String emailHost;
@ApiModelProperty("SMTP 端口号")
private Integer emailPort;
@ApiModelProperty("单行SMTP 身份验证用户名")
private String emailId;
@ApiModelProperty("SMTP 身份验证密码")
private String emailPass;
@ApiModelProperty("是否加密")
private String emailSecure;
@ApiModelProperty("调试级别")
private String emailDebug;
@ApiModelProperty("测试接收的邮件地址")
private String emailToAddress;
@ApiModelProperty("邮件主题")
private String subject;
@ApiModelProperty("邮件内容")
private String content;
}

View File

@ -0,0 +1,51 @@
package com.suisung.mall.common.pojo.dto;
import cn.hutool.core.collection.CollUtil;
import lombok.Getter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Getter
public enum ErrorTypeEnum {
ERR_NOT_DEFINITION("未分类异常", 0),
ERR_WX_JSPI("微信JSPI异常", 2001),
ERR_WX_XCX("微信小程序异常", 2002),
ERR_WX_MP("微信公众号异常", 2003),
ERR_ALI_PAY("支付宝支付异常", 3001),
ERR_PSUH_MSG("消息推送异常", 4001),
ERR_ALI_SERVICE("阿里云服务异常", 5001),
ERR_TENCENT_SERVICE("腾讯云服务异常", 5002),
ERR_HUAWEI_SERVICE("华为云服务异常", 5003),
ERR_ORDER_SERVICE("订单处理异常", 6001);
private final String label;
private final int value;
ErrorTypeEnum(String label, int value) {
this.label = label;
this.value = value;
}
private static final List<Map<String, Object>> errorTypes = new ArrayList<>();
public static List<Map<String, Object>> getAllValues() {
if (CollUtil.isNotEmpty(errorTypes)) {
return errorTypes;
}
ErrorTypeEnum[] typeEnumList = values();
for (ErrorTypeEnum typeEnum : typeEnumList) {
Map<String, Object> errorMap = new HashMap<>();
errorMap.put("label", typeEnum.getLabel());
errorMap.put("value", typeEnum.getValue());
errorTypes.add(errorMap);
}
return errorTypes;
}
}

View File

@ -0,0 +1,73 @@
package com.suisung.mall.common.pojo.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Map;
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "短信发送DTO", description = "短信发送DTO")
public class SmsDto {
@ApiModelProperty(value = "短信类型")
private Integer smsType;
@ApiModelProperty(value = "手机号码")
private String mobile;
@ApiModelProperty(value = "短信内容")
private String content;
@ApiModelProperty(value = "模板编号-扩展使用")
private String tplId;
@ApiModelProperty(value = "签名通道号-扩展使用")
private String messageTplSender;
@ApiModelProperty(value = "动态参数-扩展使用")
private Map tplParas;
@ApiModelProperty(value = "账号/平台id")
private String serviceUserId;
@ApiModelProperty(value = "短信KEY/平台KEY")
private String serviceAppKey;
@ApiModelProperty(value = "tengxun_sms_app_id")
private Integer tengxunAppId;
@ApiModelProperty(value = "tengxun_sms_app_key")
private String tengxunAppkey;
@ApiModelProperty(value = "腾讯云模板id")
private Integer tengxunTemplateId;
@ApiModelProperty(value = "huawei_sms_access_key")
private String huaweiSmsKey;
@ApiModelProperty(value = "huawei_sms_access_secret")
private String huaweiSmsKeySecret;
@ApiModelProperty(value = "aliyun_sms_access_key_id")
private String aliyunSmsAccessKeyId;
@ApiModelProperty(value = "aliyun_sms_access_key_secret")
private String aliyunSmsAccessKeySecret;
@ApiModelProperty(value = "aliyun_sms_region_id")
private String aliyunSmsRegionId;
@ApiModelProperty(value = "阿里云模板code")
private String templateCode;
@ApiModelProperty(value = "阿里云短信参数")
private Map<String, Object> paramMap;
@ApiModelProperty(value = "sms_sign")
private String smsSign;
}

View File

@ -0,0 +1,10 @@
package com.suisung.mall.common.service;
import com.suisung.mall.common.pojo.dto.SmsDto;
/**
* 第三方服务
*/
public interface ThirdService {
void send(SmsDto smsDto);
}

View File

@ -0,0 +1,67 @@
package com.suisung.mall.common.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.suisung.mall.common.exception.ApiException;
import com.suisung.mall.common.pojo.dto.ErrorTypeEnum;
import com.suisung.mall.common.pojo.dto.SmsDto;
import com.suisung.mall.common.service.ThirdService;
import com.suisung.mall.common.utils.LogUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
public class AliServiceImpl implements ThirdService {
private final Logger logger = LoggerFactory.getLogger(AliServiceImpl.class);
@Override
public void send(SmsDto smsDto) {
String aliyunSmsAccessKeyId = smsDto.getAliyunSmsAccessKeyId();
String aliyunSmsAccessKeySecret = smsDto.getAliyunSmsAccessKeySecret();
String aliyunSmsRegionId = smsDto.getAliyunSmsRegionId();
String smsSign = smsDto.getSmsSign();
DefaultProfile profile = DefaultProfile.getProfile(aliyunSmsRegionId, aliyunSmsAccessKeyId, aliyunSmsAccessKeySecret);
IAcsClient client = new DefaultAcsClient(profile);
// 组装请求对象-具体描述见控制台-文档部分内容
SendSmsRequest request = new SendSmsRequest();
// 必填:待发送手机号
request.setPhoneNumbers(smsDto.getMobile());
// 必填:短信签名-可在短信控制台中找到
request.setSignName(smsSign);
// 必填:短信模板-可在短信控制台中找到
request.setTemplateCode(smsDto.getTemplateCode());
// 选填参考https://help.aliyun.com/zh/sms/developer-reference/api-dysmsapi-2017-05-25-sendsms?spm=a2c4g.11186623.help-menu-44282.d_4_2_4_2_0.380018db3iM2mx
Map<String, Object> paramMap = smsDto.getParamMap();
if (CollUtil.isNotEmpty(paramMap)) {
// String str = paramMap.toString();
// str = str.replaceAll("=", ":");
request.setTemplateParam(JSONUtil.toJsonStr(paramMap)); // json 格式
}
logger.info("阿里云短信发送请求的参数:{}", JSONUtil.toJsonStr(smsDto));
// 获取发送结果
try {
SendSmsResponse response = client.getAcsResponse(request);
logger.info("阿里云短信发送返回结果:{}", response);
if (!response.getCode().equals("OK")) {
String errMsg = response.getMessage();
LogUtil.error(ErrorTypeEnum.ERR_ALI_SERVICE.getValue(), errMsg);
throw new ApiException(errMsg);
}
} catch (ClientException e) {
LogUtil.error(ErrorTypeEnum.ERR_ALI_SERVICE.getValue(), e);
throw new ApiException(e.getMessage());
}
}
}

View File

@ -0,0 +1,50 @@
package com.suisung.mall.common.service.impl;
import com.suisung.mall.common.exception.ApiException;
import com.suisung.mall.common.pojo.dto.ErrorTypeEnum;
import com.suisung.mall.common.pojo.dto.SmsDto;
import com.suisung.mall.common.service.ThirdService;
import com.suisung.mall.common.utils.LogUtil;
import com.suisung.mall.core.web.service.CloundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
@Primary
public class DefaultSmsServiceImpl implements ThirdService {
@Autowired
private CloundService cloundService;
@Override
public void send(SmsDto smsDto) {
boolean flag = true;
String configBaseUserId = smsDto.getServiceUserId();
String configBaseAppKey = smsDto.getServiceAppKey();
com.suisung.mall.core.web.model.SmsDto smsData = new com.suisung.mall.core.web.model.SmsDto();
smsData.setMobile(smsDto.getMobile());
smsData.setServiceUserId(configBaseUserId);
smsData.setServiceAppKey(configBaseAppKey);
String msgContent = smsDto.getContent();
for (Map.Entry<String, Object> entry : smsDto.getParamMap().entrySet()) {
String variable = "[" + entry.getKey() + "]";
Object value = entry.getValue();
msgContent = msgContent.replace(variable, value.toString());
}
smsData.setContent(msgContent);
try {
cloundService.send(smsData);
} catch (Exception e) {
LogUtil.error(ErrorTypeEnum.ERR_NOT_DEFINITION.getValue(), e);
throw new ApiException(e.getMessage());
}
}
}

View File

@ -0,0 +1,43 @@
package com.suisung.mall.common.service.impl;
import com.apistd.uni.Uni;
import com.apistd.uni.UniException;
import com.apistd.uni.UniResponse;
import com.apistd.uni.sms.UniMessage;
import com.apistd.uni.sms.UniSMS;
import com.suisung.mall.common.pojo.dto.ErrorTypeEnum;
import com.suisung.mall.common.pojo.dto.SmsDto;
import com.suisung.mall.common.service.ThirdService;
import com.suisung.mall.common.utils.LogUtil;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
@Service
public class HuaweiServiceimpl implements ThirdService {
@Override
public void send(SmsDto smsDto) {
String huaweiSmsKey = smsDto.getHuaweiSmsKey();
String huaweiSmsKeySecret = smsDto.getHuaweiSmsKeySecret();
// 初始化
Uni.init(huaweiSmsKey, huaweiSmsKeySecret);
// 若使用简易验签模式仅传入第一个参数即可
// 设置自定义参数 (变量短信)
Map<String, String> templateData = new HashMap<>();
templateData.put("code", smsDto.getContent());
// 构建信息
UniMessage message = UniSMS.buildMessage()
.setTo(smsDto.getMobile())
.setSignature("UniSMS")
.setTemplateId("login_tmpl")
.setTemplateData(templateData);
// 发送短信
try {
UniResponse res = message.send();
// todo
} catch (UniException e) {
LogUtil.error(ErrorTypeEnum.ERR_HUAWEI_SERVICE.getValue(), e);
}
}
}

View File

@ -0,0 +1,61 @@
package com.suisung.mall.common.service.impl;
import cn.hutool.core.convert.Convert;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.github.qcloudsms.SmsSingleSender;
import com.github.qcloudsms.SmsSingleSenderResult;
import com.github.qcloudsms.httpclient.HTTPException;
import com.github.qcloudsms.httpclient.HTTPResponse;
import com.suisung.mall.common.exception.ApiException;
import com.suisung.mall.common.pojo.dto.ErrorTypeEnum;
import com.suisung.mall.common.pojo.dto.SmsDto;
import com.suisung.mall.common.service.ThirdService;
import com.suisung.mall.common.utils.LogUtil;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.Map;
@Service
public class TencentServiceImpl implements ThirdService {
@Override
public void send(SmsDto smsDto) {
// 短信应用SDK AppID 1400开头
Integer tengxunAppId =smsDto.getTengxunAppId();
// 短信应用SDK AppKey
String tengxunAppkey = smsDto.getTengxunAppkey();
// 短信模板ID需要在短信应用中申请
Integer tengxunTemplateId = smsDto.getTengxunTemplateId();
// 签名使用的是签名内容而不是签名ID
String smsSign = smsDto.getSmsSign();
//参数一定要对应短信模板中的参数顺序和个数
String[] params = new String[smsDto.getParamMap().size()];
int i = 0;
for (Map.Entry<String, Object> entry : smsDto.getParamMap().entrySet()) {
params[i++] = entry.getValue().toString();
}
//创建ssender对象
SmsSingleSender ssender = new SmsSingleSender(tengxunAppId, tengxunAppkey);
//发送
SmsSingleSenderResult result;
try {
result = ssender.sendWithParam("86", smsDto.getMobile(), tengxunTemplateId, params, smsSign, "", "");
HTTPResponse response = result.getResponse();
String body = response.body;
JSONObject res = JSONUtil.parseObj(body);
Integer resultCode = Convert.toInt(res.get("result"));
// todo 成功状态码不确定是多少待配置成功后再试
if (resultCode != 0) {
String errmsg = Convert.toStr(res.get("errmsg"));
LogUtil.error(ErrorTypeEnum.ERR_TENCENT_SERVICE.getValue(), errmsg);
throw new ApiException(errmsg);
}
} catch (HTTPException | IOException e) {
LogUtil.error(ErrorTypeEnum.ERR_TENCENT_SERVICE.getValue(), e);
throw new ApiException(e.getMessage());
}
}
}

View File

@ -73,8 +73,6 @@ public class ContextUtil {
if (loginUser == null) { if (loginUser == null) {
throw new ApiException(ResultCode.UNAUTHORIZED); throw new ApiException(ResultCode.UNAUTHORIZED);
} else {
} }
return loginUser.getId(); return loginUser.getId();

View File

@ -0,0 +1,37 @@
package com.suisung.mall.common.utils;
import com.suisung.mall.common.pojo.dto.SmsDto;
import com.suisung.mall.common.service.ThirdService;
import com.suisung.mall.common.service.impl.AliServiceImpl;
import com.suisung.mall.common.service.impl.DefaultSmsServiceImpl;
import com.suisung.mall.common.service.impl.HuaweiServiceimpl;
import com.suisung.mall.common.service.impl.TencentServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Component
public class ThirdUtil {
private static final Map<Integer, ThirdService> thirdMap = new HashMap<>();
public ThirdUtil(ApplicationContext applicationContext) {
// todo 自带短信代码放出来走设计模式消除if else 降低维护成本
thirdMap.put(0, applicationContext.getBean(DefaultSmsServiceImpl.class));
thirdMap.put(1, applicationContext.getBean(AliServiceImpl.class));
thirdMap.put(2, applicationContext.getBean(TencentServiceImpl.class));
thirdMap.put(3, applicationContext.getBean(HuaweiServiceimpl.class));
}
/**
* 发送短信
*
* @param smsDto
*/
public static void send(SmsDto smsDto) {
ThirdService thirdService = thirdMap.get(smsDto.getSmsType());
thirdService.send(smsDto);
}
}

View File

@ -2,7 +2,12 @@ package com.suisung.mall;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import com.suisung.mall.common.config.DruidConfig; import com.suisung.mall.common.config.DruidConfig;
import com.suisung.mall.common.service.impl.AliServiceImpl;
import com.suisung.mall.common.service.impl.DefaultSmsServiceImpl;
import com.suisung.mall.common.service.impl.HuaweiServiceimpl;
import com.suisung.mall.common.service.impl.TencentServiceImpl;
import com.suisung.mall.common.utils.ContextUtil; import com.suisung.mall.common.utils.ContextUtil;
import com.suisung.mall.common.utils.ThirdUtil;
import com.suisung.mall.common.weblog.ControllerLogAspect; import com.suisung.mall.common.weblog.ControllerLogAspect;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -20,7 +25,12 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = {RestControllerAdvice.class}), @ComponentScan.Filter(type = FilterType.ANNOTATION, value = {RestControllerAdvice.class}),
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = {ControllerLogAspect.class}), @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = {ControllerLogAspect.class}),
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = DruidConfig.class), @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = DruidConfig.class),
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = ContextUtil.class) @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = ContextUtil.class),
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = ThirdUtil.class),
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = DefaultSmsServiceImpl.class),
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = AliServiceImpl.class),
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = TencentServiceImpl.class),
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = HuaweiServiceimpl.class)
}) })
// 排除,不包含一些东西 // 排除,不包含一些东西
@SpringBootApplication(exclude = {DruidDataSourceAutoConfigure.class, DataSourceAutoConfiguration.class}) @SpringBootApplication(exclude = {DruidDataSourceAutoConfigure.class, DataSourceAutoConfiguration.class})

View File

@ -8,6 +8,7 @@ import cn.hutool.json.JSONUtil;
import com.suisung.mall.common.modules.product.ShopProductIndex; import com.suisung.mall.common.modules.product.ShopProductIndex;
import com.suisung.mall.common.pojo.dto.ProductRecommendDTO; import com.suisung.mall.common.pojo.dto.ProductRecommendDTO;
import com.suisung.mall.common.pojo.dto.ProductSearchDTO; import com.suisung.mall.common.pojo.dto.ProductSearchDTO;
import com.suisung.mall.common.utils.CheckUtil;
import com.suisung.mall.search.dao.EsProductDao; import com.suisung.mall.search.dao.EsProductDao;
import com.suisung.mall.search.domain.EsProduct; import com.suisung.mall.search.domain.EsProduct;
import com.suisung.mall.search.repository.EsProductRepository; import com.suisung.mall.search.repository.EsProductRepository;
@ -132,7 +133,7 @@ public class EsProductServiceImpl implements EsProductService {
} }
} }
// 品牌编号过滤 // 品牌编号过滤
if (productSearchDTO.getBrand_id() != null) { if (CheckUtil.isNotEmpty(productSearchDTO.getBrand_id())) {
boolQueryBuilder.must(QueryBuilders.termQuery("brandId", productSearchDTO.getBrand_id())); boolQueryBuilder.must(QueryBuilders.termQuery("brandId", productSearchDTO.getBrand_id()));
} }
@ -142,7 +143,7 @@ public class EsProductServiceImpl implements EsProductService {
} }
// 商品分类过滤 // 商品分类过滤
if (productSearchDTO.getCategory_id() != null) { if (CheckUtil.isNotEmpty(productSearchDTO.getCategory_id())) {
boolQueryBuilder.must(QueryBuilders.termQuery("categoryId", productSearchDTO.getCategory_id())); boolQueryBuilder.must(QueryBuilders.termQuery("categoryId", productSearchDTO.getCategory_id()));
} }

View File

@ -157,6 +157,15 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.qcloud/qcloud-java-sdk -->
<dependency>
<groupId>com.qcloud</groupId>
<artifactId>qcloud-java-sdk</artifactId>
<version>2.0.1</version>
</dependency>
<!--https://blog.csdn.net/qianlingo/article/details/107914871--> <!--https://blog.csdn.net/qianlingo/article/details/107914871-->
<!--百度人脸识别API--> <!--百度人脸识别API-->
<dependency> <dependency>
@ -217,7 +226,7 @@
<dependency> <dependency>
<groupId>commons-codec</groupId> <groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
<version>1.9</version> <version>1.11</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore --> <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
@ -277,6 +286,12 @@
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.suisung.mall</groupId>
<artifactId>mall-account</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<!--打票机 使用的库 结束--> <!--打票机 使用的库 结束-->

View File

@ -6,6 +6,7 @@ import com.suisung.mall.common.service.MessageService;
import com.suisung.mall.common.utils.I18nUtil; import com.suisung.mall.common.utils.I18nUtil;
import com.suisung.mall.shop.config.SpringUtil; import com.suisung.mall.shop.config.SpringUtil;
import com.suisung.mall.shop.message.service.ShopMessageTemplateService; import com.suisung.mall.shop.message.service.ShopMessageTemplateService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException; import org.quartz.JobExecutionException;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -20,9 +21,10 @@ import java.util.Map;
*/ */
public class RsyncNoticeMsgJob extends QuartzJobBean { public class RsyncNoticeMsgJob extends QuartzJobBean {
private Logger logger = LoggerFactory.getLogger(RsyncNoticeMsgJob.class);
@Override @Override
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException { protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
Logger logger = LoggerFactory.getLogger(RsyncNoticeMsgJob.class);
MessageService messageService = SpringUtil.getBean(MessageService.class); MessageService messageService = SpringUtil.getBean(MessageService.class);
ShopMessageTemplateService shopMessageTemplateService = SpringUtil.getBean(ShopMessageTemplateService.class); ShopMessageTemplateService shopMessageTemplateService = SpringUtil.getBean(ShopMessageTemplateService.class);
@ -31,9 +33,7 @@ public class RsyncNoticeMsgJob extends QuartzJobBean {
String key = messageService.getKey("notice_msg"); String key = messageService.getKey("notice_msg");
int times = 10000; int times = 10000;
//如果队列有数据一直读完 //如果队列有数据一直读完
while (times > 0) { while (times > 0) {
String data = messageService.receiveNoticeMsg(); String data = messageService.receiveNoticeMsg();
@ -41,8 +41,9 @@ public class RsyncNoticeMsgJob extends QuartzJobBean {
break; break;
} }
JSONObject queue_row = JSONUtil.parseObj(data); logger.debug("异步通知消息作业接收到的数据{}", data);
JSONObject queue_row = JSONUtil.parseObj(data);
Integer user_id = (Integer) queue_row.get("user_id"); Integer user_id = (Integer) queue_row.get("user_id");
Integer store_id = (Integer) queue_row.get("store_id"); Integer store_id = (Integer) queue_row.get("store_id");
@ -58,6 +59,7 @@ public class RsyncNoticeMsgJob extends QuartzJobBean {
//判断是否超时 //判断是否超时
if (true || new Date().getTime() - time < 60 * 10) { if (true || new Date().getTime() - time < 60 * 10) {
//发送消息 //发送消息
logger.debug("异步通知消息作业key:{}开始执行", key);
if (!shopMessageTemplateService.send(user_id, store_id, message_tpl_id, args)) { if (!shopMessageTemplateService.send(user_id, store_id, message_tpl_id, args)) {
logger.error(String.format(I18nUtil._("发送消息失败 : %s - %s - %s - %s"), user_id, store_id, message_tpl_id, args)); logger.error(String.format(I18nUtil._("发送消息失败 : %s - %s - %s - %s"), user_id, store_id, message_tpl_id, args));
} }

View File

@ -4,6 +4,7 @@ import com.suisung.mall.common.modules.message.ShopMessageTemplate;
import com.suisung.mall.common.modules.wechat.ShopWechatTplmsg; import com.suisung.mall.common.modules.wechat.ShopWechatTplmsg;
import com.suisung.mall.core.web.service.IBaseService; import com.suisung.mall.core.web.service.IBaseService;
import java.util.List;
import java.util.Map; import java.util.Map;
@ -31,4 +32,15 @@ public interface ShopMessageTemplateService extends IBaseService<ShopMessageTemp
String getWechatTplData(String open_id, ShopWechatTplmsg wechatTplmsg, Map args); String getWechatTplData(String open_id, ShopWechatTplmsg wechatTplmsg, Map args);
/**
* 临时方法发送阿里云短信
* @param mobile
* @param tmplCode
* @param tmplParams
* @return 阿里云返回的 json 数据
*/
Boolean aliyunSmsSend(String mobile, String tmplCode, Map<String,Object> tmplParams);
Integer aliyunSmsSend(List<String> mobiles, String tmplCode, Map<String,Object> tmplParams);
} }

View File

@ -7,6 +7,12 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.suisung.mall.common.api.BindCode; import com.suisung.mall.common.api.BindCode;
import com.suisung.mall.common.exception.ApiException; import com.suisung.mall.common.exception.ApiException;
@ -18,10 +24,14 @@ import com.suisung.mall.common.modules.account.AccountUserLogin;
import com.suisung.mall.common.modules.message.ShopMessageTemplate; import com.suisung.mall.common.modules.message.ShopMessageTemplate;
import com.suisung.mall.common.modules.store.ShopStoreBase; import com.suisung.mall.common.modules.store.ShopStoreBase;
import com.suisung.mall.common.modules.wechat.ShopWechatTplmsg; import com.suisung.mall.common.modules.wechat.ShopWechatTplmsg;
import com.suisung.mall.common.pojo.dto.ErrorTypeEnum;
import com.suisung.mall.common.pojo.dto.SmsDto;
import com.suisung.mall.common.service.impl.AliServiceImpl;
import com.suisung.mall.common.utils.EmailUtil; import com.suisung.mall.common.utils.EmailUtil;
import com.suisung.mall.common.utils.LogUtil;
import com.suisung.mall.common.utils.ThirdUtil;
import com.suisung.mall.common.utils.WxHttpUtil; import com.suisung.mall.common.utils.WxHttpUtil;
import com.suisung.mall.common.utils.pojo.dto.EmailDTO; import com.suisung.mall.common.utils.pojo.dto.EmailDTO;
import com.suisung.mall.core.web.model.SmsDto;
import com.suisung.mall.core.web.service.CloundService; import com.suisung.mall.core.web.service.CloundService;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl; import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.shop.base.service.AccountBaseConfigService; import com.suisung.mall.shop.base.service.AccountBaseConfigService;
@ -33,6 +43,8 @@ import com.suisung.mall.shop.store.service.ShopStoreBaseService;
import com.suisung.mall.shop.wechat.service.ShopWechatTplmsgService; import com.suisung.mall.shop.wechat.service.ShopWechatTplmsgService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.text.StringSubstitutor; import org.apache.commons.text.StringSubstitutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -104,8 +116,10 @@ public class ShopMessageTemplateServiceImpl extends BaseServiceImpl<ShopMessageT
* @access public * @access public
*/ */
public boolean send(Integer user_id, Integer store_id, String message_tpl_id, Map args) { public boolean send(Integer user_id, Integer store_id, String message_tpl_id, Map args) {
log.debug("消息发送开始,参数为:{} {} {} {}", user_id, store_id, message_tpl_id, args);
Integer admin_user_id = accountBaseConfigService.getConfig("message_notice_user_id", 10001); Integer admin_user_id = accountBaseConfigService.getConfig("message_notice_user_id", 10001);
args.put("site_name", accountBaseConfigService.getConfig("site_name", "lancerdt")); args.put("site_name", accountBaseConfigService.getConfig("site_name", "MallSuite"));
args.put("date", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); args.put("date", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
//默认平台管理员 //默认平台管理员
@ -159,7 +173,6 @@ public class ShopMessageTemplateServiceImpl extends BaseServiceImpl<ShopMessageT
} }
} }
// 发送邮件 // 发送邮件
if (message_row.getMessage_email_enable() > 0 && !user_setting.isEmpty()) { if (message_row.getMessage_email_enable() > 0 && !user_setting.isEmpty()) {
String email = (String) user_setting.get("email"); String email = (String) user_setting.get("email");
@ -250,27 +263,61 @@ public class ShopMessageTemplateServiceImpl extends BaseServiceImpl<ShopMessageT
String[] activeProfiles = environment.getActiveProfiles(); String[] activeProfiles = environment.getActiveProfiles();
String activeProfile = activeProfiles[0]; String activeProfile = activeProfiles[0];
// 生产环境才允许短信发送 // 短信发送生产环境才允许短信发送
if (message_row.getMessage_sms_enable() > 0 && !user_setting.isEmpty() && activeProfile.equals("prod")) { if (message_row.getMessage_sms_enable() > 0 && !user_setting.isEmpty() && activeProfile.equals("prod")) {
String mobile = (String) user_setting.get("mobile"); String mobile = (String) user_setting.get("mobile");
if (StrUtil.isNotEmpty(mobile)) { if (StrUtil.isNotEmpty(mobile)) {
String message_sms = dealMessageTemplate(message_row.getMessage_sms(), args); // String message_sms = dealMessageTemplate(message_row.getMessage_sms(), args);
//str = '[chain_name]的商品库存不足请及时补货SPU[product_id]SKU[item_id],可去店铺查看详情'; //str = '[chain_name]的商品库存不足请及时补货SPU[product_id]SKU[item_id],可去店铺查看详情';
mobile = StrUtil.removePrefix(mobile, "+86"); mobile = StrUtil.removePrefix(mobile, "+86");
SmsDto smsDTO = new SmsDto();
smsDTO.setMobile(mobile);
smsDTO.setContent(message_sms);
//读取sms配置信息
String service_user_id = accountBaseConfigService.getConfig("service_user_id"); String service_user_id = accountBaseConfigService.getConfig("service_user_id");
String service_app_key = accountBaseConfigService.getConfig("service_app_key"); String service_app_key = accountBaseConfigService.getConfig("service_app_key");
smsDTO.setServiceUserId(service_user_id); SmsDto smsDto = new SmsDto();
smsDTO.setServiceAppKey(service_app_key);
smsDto.setSmsType(accountBaseConfigService.getConfig("sms_type", 0)); //默认短信通道
smsDto.setServiceUserId(service_user_id);
smsDto.setServiceAppKey(service_app_key);
//其它通道要赋值通道信息 appid 以及 key
String aliyunSmsAccessKeyId = accountBaseConfigService.getConfig("aliyun_sms_access_key_id");
String aliyunSmsAccessKeySecret = accountBaseConfigService.getConfig("aliyun_sms_access_key_secret");
String aliyunSmsRegionId = accountBaseConfigService.getConfig("aliyun_sms_region_id");
String aliyunSmsSign = accountBaseConfigService.getConfig("aliyun_sms_sign");
smsDto.setAliyunSmsAccessKeyId(aliyunSmsAccessKeyId);
smsDto.setAliyunSmsAccessKeySecret(aliyunSmsAccessKeySecret);
smsDto.setAliyunSmsRegionId(aliyunSmsRegionId);
smsDto.setSmsSign(aliyunSmsSign);
String huaweiSmsKey = accountBaseConfigService.getConfig("huawei_sms_access_key");
String huaweiSmsKeySecret = accountBaseConfigService.getConfig("huawei_sms_access_secret");
smsDto.setHuaweiSmsKey(huaweiSmsKey);
smsDto.setHuaweiSmsKeySecret(huaweiSmsKeySecret);
// 短信应用SDK AppID 1400开头
Integer tengxunAppId = accountBaseConfigService.getConfig("tengxun_sms_app_id", 0);
// 短信应用SDK AppKey
String tengxunAppkey = accountBaseConfigService.getConfig("tengxun_sms_app_key");
smsDto.setTengxunAppId(tengxunAppId);
smsDto.setTengxunAppkey(tengxunAppkey);
smsDto.setMobile(mobile);
smsDto.setTemplateCode(message_row.getMessage_tpl_id());
smsDto.setContent(message_row.getMessage_sms());
smsDto.setParamMap(args); //传入模板对应参数
smsDto.setTengxunTemplateId(Convert.toInt(message_row.getMessage_tpl_id()));
try { try {
cloundService.send(smsDTO); ThirdUtil.send(smsDto);
log.debug("消息发送的数据:{}", smsDto);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage()); LogUtil.error(ErrorTypeEnum.ERR_PSUH_MSG.getValue(), e);
} }
} }
} }
@ -533,4 +580,84 @@ public class ShopMessageTemplateServiceImpl extends BaseServiceImpl<ShopMessageT
wxTelMsgPushVo.setData(BaseValue); wxTelMsgPushVo.setData(BaseValue);
return JSON.toJSONString(wxTelMsgPushVo); return JSON.toJSONString(wxTelMsgPushVo);
} }
/**
* 临时方法发送阿里云短信
* @param mobile
* @param tmplCode
* @param tmplParams
* @return 阿里云返回的 json 数据
*/
@Override
public Boolean aliyunSmsSend(String mobile, String tmplCode, Map<String,Object> tmplParams) {
if (StrUtil.isBlank(mobile) || StrUtil.isBlank(tmplCode)) {
LogUtil.error("阿里云发送短信时,缺少必要参数!");
return false;
}
// 先从redis里获取才从数据库里获取
String aliyunSmsAccessKeyId = accountBaseConfigService.getConfig("aliyun_sms_access_key_id");
String aliyunSmsAccessKeySecret = accountBaseConfigService.getConfig("aliyun_sms_access_key_secret");
String aliyunSmsRegionId = accountBaseConfigService.getConfig("aliyun_sms_region_id");
String aliyunSmsSign = accountBaseConfigService.getConfig("aliyun_sms_sign");
if (StrUtil.isBlank(aliyunSmsAccessKeyId) || StrUtil.isBlank(aliyunSmsAccessKeySecret) || StrUtil.isBlank(aliyunSmsRegionId) || StrUtil.isBlank(aliyunSmsSign)) {
LogUtil.error("阿里云发送短信时,获取不到关键参数!");
return false;
}
DefaultProfile profile = DefaultProfile.getProfile(aliyunSmsRegionId, aliyunSmsAccessKeyId, aliyunSmsAccessKeySecret);
IAcsClient client = new DefaultAcsClient(profile);
// 组装请求对象-具体描述见控制台-文档部分内容
SendSmsRequest request = new SendSmsRequest();
// 必填:待发送手机号
request.setPhoneNumbers(mobile);
// 必填:短信签名-可在短信控制台中找到
request.setSignName(aliyunSmsSign);
// 必填:短信模板-可在短信控制台中找到
request.setTemplateCode(tmplCode);
// 选填参考https://help.aliyun.com/zh/sms/developer-reference/api-dysmsapi-2017-05-25-sendsms?spm=a2c4g.11186623.help-menu-44282.d_4_2_4_2_0.380018db3iM2mx
if (CollUtil.isNotEmpty(tmplParams)) {
request.setTemplateParam(JSONUtil.toJsonStr(tmplParams)); // json 格式
}
// 获取发送结果
try {
SendSmsResponse response = client.getAcsResponse(request);
if (response == null) {
LogUtil.error(ErrorTypeEnum.ERR_ALI_SERVICE.getValue(), "阿里云短信服务返回失败!");
return false;
}
log.debug("阿里云短信发送返回结果:{}", JSONUtil.toJsonStr(response));
if (response.getCode() == null || !"OK".equals(response.getCode())) {
String errMsg = response.getMessage();
LogUtil.error(ErrorTypeEnum.ERR_ALI_SERVICE.getValue(), errMsg);
return false;
}
return true;
} catch (ClientException e) {
LogUtil.error(ErrorTypeEnum.ERR_ALI_SERVICE.getValue(), e);
log.error("阿里云短信发送出错:{}", e.getMessage());
return false;
}
}
/**
* @param mobiles
* @param tmplCode
* @param tmplParams
* @return
*/
@Override
public Integer aliyunSmsSend(List<String> mobiles, String tmplCode, Map<String, Object> tmplParams) {
int successCnt = 0;
for (String mobile : mobiles) {
if (aliyunSmsSend(mobile, tmplCode, tmplParams)) {
successCnt++;
}
}
return successCnt;
}
} }

View File

@ -28,6 +28,7 @@ public class MessageListener {
String messageId = message.getMessageProperties().getMessageId(); String messageId = message.getMessageProperties().getMessageId();
try { try {
log.debug("消息监听到:{} ### {}",messageId, msgTO);
boolean flag = messageService.sendNoticeMsg(msgTO.getUser_id(), msgTO.getStore_id(), msgTO.getMessage_id(), msgTO.getArgs()); boolean flag = messageService.sendNoticeMsg(msgTO.getUser_id(), msgTO.getStore_id(), msgTO.getMessage_id(), msgTO.getArgs());
if (flag) { if (flag) {
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);

View File

@ -78,6 +78,7 @@ import com.suisung.mall.shop.invoicing.service.InvoicingStockBillItemService;
import com.suisung.mall.shop.invoicing.service.InvoicingStockBillService; import com.suisung.mall.shop.invoicing.service.InvoicingStockBillService;
import com.suisung.mall.shop.invoicing.service.InvoicingWarehouseBaseService; import com.suisung.mall.shop.invoicing.service.InvoicingWarehouseBaseService;
import com.suisung.mall.shop.message.service.MqMessageService; import com.suisung.mall.shop.message.service.MqMessageService;
import com.suisung.mall.shop.message.service.ShopMessageTemplateService;
import com.suisung.mall.shop.message.vo.MqMessageVo; import com.suisung.mall.shop.message.vo.MqMessageVo;
import com.suisung.mall.shop.number.service.ShopNumberSeqService; import com.suisung.mall.shop.number.service.ShopNumberSeqService;
import com.suisung.mall.shop.order.mapper.ShopOrderBaseMapper; import com.suisung.mall.shop.order.mapper.ShopOrderBaseMapper;
@ -280,6 +281,10 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
private ShopOrderDeliveryAddressService shopOrderDeliveryAddressService; private ShopOrderDeliveryAddressService shopOrderDeliveryAddressService;
@Resource @Resource
private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService; private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService;
@Resource
private ShopMessageTemplateService shopMessageTemplateService;
@Value("${sf-express.enable}") @Value("${sf-express.enable}")
private Integer enable_sf_express; private Integer enable_sf_express;
@ -2936,7 +2941,8 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
args.put("order_payment_amount", order_payment_amount); args.put("order_payment_amount", order_payment_amount);
args.put("order_add_time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); args.put("order_add_time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
MsgTO msgTO = new MsgTO(user_id, 0, message_id, args); // 提醒买家付款成功发消息队列
MsgTO msgTO = new MsgTO(user_id, store_id, message_id, args);
mqMessageVos.add(new MqMessageVo(MqConstant.SHOP_EXCHANGE, MqConstant.SHOP_MSG_ROUTING_KEY, JSONUtil.parseObj(msgTO))); mqMessageVos.add(new MqMessageVo(MqConstant.SHOP_EXCHANGE, MqConstant.SHOP_MSG_ROUTING_KEY, JSONUtil.parseObj(msgTO)));
// todo 处理视频类订单 // todo 处理视频类订单
@ -3029,13 +3035,49 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
shopDistributionUserOrderService.settleDistributionUserOrder(order_id); shopDistributionUserOrderService.settleDistributionUserOrder(order_id);
} }
//提醒商家发货 //提醒商家(店铺管理员)发货
message_id = "notice-of-delivery"; message_id = "notice-of-delivery";
args = new HashMap(); args = new HashMap();
args.put("order_id", order_id); args.put("order_id", order_id);
args.put("order_payment_amount", order_payment_amount);
args.put("date", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); args.put("date", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
MsgTO sellerMsgTo = new MsgTO(user_id, store_id, message_id, args);
// 2024-12-10 add
// 获取店铺管理员的 userId
List<Integer> shopKeepers = storeEmployeeService.selectEmployeeByStoreId(store_id, CommonConstant.STORE_RIGHT_GROUP_ADMIN);
if (CollUtil.isNotEmpty(shopKeepers)) {
// 获取所有店铺管理员的手机号
List<String> shopKeeperMobiles = new ArrayList<>();
for (Integer userId : shopKeepers) {
String mobile = "";
Map bind_row = accountService.getBind(userId, BindCode.MOBILE);
if (bind_row == null || bind_row.get("bind_id") == null) {
// 补偿手机号码
AccountUserInfo accountUserInfo = accountService.getUserInfo(userId);
if(accountUserInfo!=null && StrUtil.isNotBlank(accountUserInfo.getUser_mobile()) ){
mobile = accountUserInfo.getUser_mobile();
}
}else{
mobile = bind_row.get("bind_id").toString();
}
// 获取所有店铺管理员的手机号
shopKeeperMobiles.add(mobile);
// 老流程之前获取用户id不正确现在更正 2024-12-10 update 获取所有店铺管理员的 user_id
MsgTO sellerMsgTo = new MsgTO(userId, store_id, message_id, args);
mqMessageVos.add(new MqMessageVo(MqConstant.SHOP_EXCHANGE, MqConstant.SHOP_MSG_ROUTING_KEY, JSONUtil.parseObj(sellerMsgTo))); mqMessageVos.add(new MqMessageVo(MqConstant.SHOP_EXCHANGE, MqConstant.SHOP_MSG_ROUTING_KEY, JSONUtil.parseObj(sellerMsgTo)));
logger.info("提醒商家发货,请求参数:{}", sellerMsgTo);
}
// 2024-12-10 add
Map<String, Object> tmplArgs = new HashMap<>(2);
tmplArgs.put("order_id", order_id);
tmplArgs.put("order_payment_amount", order_payment_amount);
// 所有店铺管理员的发送邮件 提醒商家您收到一笔${order_payment_amount}元新订单${order_id}付款请及时处理
shopMessageTemplateService.aliyunSmsSend(shopKeeperMobiles, "SMS_475831067", tmplArgs);//SMS_475945807
}
// 付款成功对通知推广员进行提醒 // 付款成功对通知推广员进行提醒
if (accountBaseConfigService.getConfig("plantform_fx_enable", false)) { if (accountBaseConfigService.getConfig("plantform_fx_enable", false)) {
@ -3877,10 +3919,11 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
/** /**
* 取消订单 * 取消订单
* 流程订单状态积分众宝库存礼包优惠券 有就统统退还
* *
* @param order_ids 订单id * @param order_ids 订单id
* @param order_rows 订单数据 * @param order_rows 订单数据
* check_paid_flag 默认值 true * @param check_paid_flag 默认值 true
*/ */
@Transactional @Transactional
public boolean cancel(List<String> order_ids, List<Map> order_rows, boolean check_paid_flag) { public boolean cancel(List<String> order_ids, List<Map> order_rows, boolean check_paid_flag) {
@ -3894,16 +3937,22 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
if (CollUtil.isEmpty(order_rows)) { if (CollUtil.isEmpty(order_rows)) {
order_rows = Convert.toList(Map.class, shopOrderInfoService.gets(order_ids)); order_rows = Convert.toList(Map.class, shopOrderInfoService.gets(order_ids));
} }
for (String order_id : order_ids) { for (String order_id : order_ids) {
Optional<Map> orderOpl = order_rows.stream().filter(s -> ObjectUtil.equal(order_id, Convert.toStr(s.get("order_id")))).findFirst(); Optional<Map> orderOpl = order_rows.stream().filter(s -> ObjectUtil.equal(order_id, Convert.toStr(s.get("order_id")))).findFirst();
Map order = orderOpl.orElseGet(HashMap::new); Map order = orderOpl.orElseGet(HashMap::new);
// 订单状态(LIST):2011-待订单审核;2013-待财务审核;2020-待配货/待出库审核;2030-待发货;2040-已发货/待收货确认;2060-已完成/已签收;2070-已取消/已作废;
Integer order_state_id = (Integer) order.get("order_state_id"); Integer order_state_id = (Integer) order.get("order_state_id");
// 付款状态(ENUM):3010-未付款;3011-付款待审核;3012-部分付款;3013-已付款
Integer order_is_paid = (Integer) order.get("order_is_paid"); Integer order_is_paid = (Integer) order.get("order_is_paid");
// 要检查订单付款状态
if (check_paid_flag) { if (check_paid_flag) {
if (ifCancel(order_state_id, order_is_paid)) { if (ifCancel(order_state_id, order_is_paid)) {
// 未付款未配送的订单才能取消订单
cancel_id_row.add(order_id); cancel_id_row.add(order_id);
} }
} else { } else {
// 不检查订单付款状态
cancel_id_row.add(order_id); cancel_id_row.add(order_id);
} }
} }
@ -3919,8 +3968,8 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
QueryWrapper<ShopOrderBase> baseQueryWrapper = new QueryWrapper<>(); QueryWrapper<ShopOrderBase> baseQueryWrapper = new QueryWrapper<>();
baseQueryWrapper.in("order_id", order_ids); baseQueryWrapper.in("order_id", order_ids);
baseQueryWrapper.ne("order_state_id", StateCode.ORDER_STATE_CANCEL); baseQueryWrapper.ne("order_state_id", StateCode.ORDER_STATE_CANCEL); // 2070-已取消
if (!edit(orderBase, baseQueryWrapper)) { if (!edit(orderBase, baseQueryWrapper)) {// 批量更改状态
throw new ApiException(ResultCode.FAILED); throw new ApiException(ResultCode.FAILED);
} }
@ -3930,9 +3979,8 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
QueryWrapper<ShopOrderInfo> infoQueryWrapper = new QueryWrapper<>(); QueryWrapper<ShopOrderInfo> infoQueryWrapper = new QueryWrapper<>();
infoQueryWrapper.in("order_id", cancel_id_row); infoQueryWrapper.in("order_id", cancel_id_row);
infoQueryWrapper.ne("order_state_id", StateCode.ORDER_STATE_CANCEL); infoQueryWrapper.ne("order_state_id", StateCode.ORDER_STATE_CANCEL);
if (!shopOrderInfoService.edit(shopOrderInfo, infoQueryWrapper)) { if (!shopOrderInfoService.edit(shopOrderInfo, infoQueryWrapper)) {
throw new ApiException(String.format("修改订单取消状态有误: %s", CollUtil.join(cancel_id_row, ","))); throw new ApiException(String.format("订单:%s 取消状态有误!", CollUtil.join(cancel_id_row, ",")));
} }
// 积分退还 order_resource_ext1 默认为积分 // 积分退还 order_resource_ext1 默认为积分
@ -3944,8 +3992,8 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
Map order = orderOpl.orElseGet(HashMap::new); Map order = orderOpl.orElseGet(HashMap::new);
Integer buyer_user_id = (Integer) order.get("buyer_user_id"); Integer buyer_user_id = (Integer) order.get("buyer_user_id");
BigDecimal order_resource_ext1 = order_data_row.getOrder_resource_ext1(); BigDecimal order_resource_ext1 = order_data_row.getOrder_resource_ext1();// 积分
BigDecimal order_resource_ext2 = order_data_row.getOrder_resource_ext2(); BigDecimal order_resource_ext2 = order_data_row.getOrder_resource_ext2();// 众宝
if (ObjectUtil.compare(order_resource_ext1, BigDecimal.ZERO) > 0 && CheckUtil.isNotEmpty(buyer_user_id)) { if (ObjectUtil.compare(order_resource_ext1, BigDecimal.ZERO) > 0 && CheckUtil.isNotEmpty(buyer_user_id)) {
Integer store_id = (Integer) order.get("store_id"); Integer store_id = (Integer) order.get("store_id");
@ -3956,10 +4004,11 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
} }
} }
if (ObjectUtil.compare(order_resource_ext2, BigDecimal.ZERO) > 0 && CheckUtil.isNotEmpty(buyer_user_id)) { // 程序没有编写完成缺失众宝积分退回功能
String desc = String.format("%s 众宝退还", order_resource_ext2); //if (ObjectUtil.compare(order_resource_ext2, BigDecimal.ZERO) > 0 && CheckUtil.isNotEmpty(buyer_user_id)) {
// String desc = String.format("%s 众宝退还", order_resource_ext2);
// todo shopUserPointsHistoryService.sp(buyer_user_id,order_resource_ext2,SpType.SP_TYPE_CONSUME_RETRUN, desc); // todo shopUserPointsHistoryService.sp(buyer_user_id,order_resource_ext2,SpType.SP_TYPE_CONSUME_RETRUN, desc);
} //}
} }
// 限购商品数量退还 // 限购商品数量退还
@ -3976,10 +4025,12 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
List<ShopUserProductBuy> productBuyList = shopUserProductBuyService.find(buyQueryWrapper); List<ShopUserProductBuy> productBuyList = shopUserProductBuyService.find(buyQueryWrapper);
Integer order_item_quantity = order_item_row.getOrder_item_quantity(); Integer order_item_quantity = order_item_row.getOrder_item_quantity();
if (CollUtil.isNotEmpty(productBuyList)) {
for (ShopUserProductBuy productBuy : productBuyList) { for (ShopUserProductBuy productBuy : productBuyList) {
productBuy.setProduct_buy_num(productBuy.getProduct_buy_num() - order_item_quantity); productBuy.setProduct_buy_num(productBuy.getProduct_buy_num() - order_item_quantity);
} }
if (CollUtil.isNotEmpty(productBuyList)) {
if (!shopUserProductBuyService.saveOrUpdate(productBuyList)) { if (!shopUserProductBuyService.saveOrUpdate(productBuyList)) {
throw new ApiException(ResultCode.FAILED); throw new ApiException(ResultCode.FAILED);
} }
@ -4854,7 +4905,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
List<ShopOrderInfo> shopOrderInfos = shopOrderInfoService.gets(order_ids); List<ShopOrderInfo> shopOrderInfos = shopOrderInfoService.gets(order_ids);
List<Map> rows = Convert.toList(Map.class, shopOrderInfos); List<Map> rows = Convert.toList(Map.class, shopOrderInfos);
// 检查登录用户和订单店铺是否有权限操作取消动作
if (CheckUtil.checkDataRights(user_id, rows, "buyer_user_id") || CheckUtil.checkDataRights(Convert.toInt(user.getStore_id()), rows, "store_id")) { if (CheckUtil.checkDataRights(user_id, rows, "buyer_user_id") || CheckUtil.checkDataRights(Convert.toInt(user.getStore_id()), rows, "store_id")) {
cancel(order_ids, rows, true); cancel(order_ids, rows, true);
} else { } else {
@ -7817,14 +7868,16 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
} }
/** /**
* 是否可以取消 * 检查是否可以取消
* *
* @param order_state_id 订单状态 * @param order_state_id 订单状态
* @param order_is_paid * @param order_is_paid
* @return boolean true-false-不可 * @return boolean true-false-不可
*/ */
private boolean ifCancel(Integer order_state_id, Integer order_is_paid) { private boolean ifCancel(Integer order_state_id, Integer order_is_paid) {
// 订单状态2010-待付款;2011-待订单审核;2013-待财务审核;2020-待配货;2030-待发货
List<Integer> order_states = Arrays.asList(StateCode.ORDER_STATE_WAIT_PAY, StateCode.ORDER_STATE_WAIT_REVIEW, StateCode.ORDER_STATE_WAIT_FINANCE_REVIEW, StateCode.ORDER_STATE_PICKING, StateCode.ORDER_STATE_WAIT_SHIPPING); List<Integer> order_states = Arrays.asList(StateCode.ORDER_STATE_WAIT_PAY, StateCode.ORDER_STATE_WAIT_REVIEW, StateCode.ORDER_STATE_WAIT_FINANCE_REVIEW, StateCode.ORDER_STATE_PICKING, StateCode.ORDER_STATE_WAIT_SHIPPING);
// 3010-未付款未付款的订单才能取消
return order_states.contains(order_state_id) && ObjectUtil.equal(order_is_paid, StateCode.ORDER_PAID_STATE_NO); return order_states.contains(order_state_id) && ObjectUtil.equal(order_is_paid, StateCode.ORDER_PAID_STATE_NO);
} }

View File

@ -9,6 +9,7 @@ import com.suisung.mall.common.pojo.dto.ProductSearchDTO;
import com.suisung.mall.core.web.service.IBaseService; import com.suisung.mall.core.web.service.IBaseService;
import com.suisung.mall.shop.product.pojo.vo.ProductVo; import com.suisung.mall.shop.product.pojo.vo.ProductVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.Serializable; import java.io.Serializable;
@ -258,4 +259,7 @@ public interface ShopProductBaseService extends IBaseService<ShopProductBase> {
* @return * @return
*/ */
Map getProductBasicInfo(Long product_id, Integer store_id); Map getProductBasicInfo(Long product_id, Integer store_id);
@Transactional
boolean updateProductSubsite(Integer store_id);
} }

View File

@ -5,6 +5,7 @@ import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.suisung.mall.common.modules.product.ShopProductAnalytics; import com.suisung.mall.common.modules.product.ShopProductAnalytics;
import com.suisung.mall.common.modules.product.ShopProductItem; import com.suisung.mall.common.modules.product.ShopProductItem;
import com.suisung.mall.common.utils.CheckUtil;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl; import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.shop.product.mapper.ShopProductAnalyticsMapper; import com.suisung.mall.shop.product.mapper.ShopProductAnalyticsMapper;
import com.suisung.mall.shop.product.service.ShopProductAnalyticsService; import com.suisung.mall.shop.product.service.ShopProductAnalyticsService;
@ -44,7 +45,8 @@ public class ShopProductAnalyticsServiceImpl extends BaseServiceImpl<ShopProduct
@Override @Override
public Map getAnalytics(Long product_id) { public Map getAnalytics(Long product_id) {
ShopProductAnalytics product_analytics = get(product_id); ShopProductAnalytics product_analytics = get(product_id);
if (ObjectUtil.isNull(product_analytics)) { if (ObjectUtil.isNull(product_analytics))
{
//初始化兼容 //初始化兼容
product_analytics = new ShopProductAnalytics(); product_analytics = new ShopProductAnalytics();
product_analytics.setProduct_id(product_id); product_analytics.setProduct_id(product_id);
@ -67,7 +69,12 @@ public class ShopProductAnalyticsServiceImpl extends BaseServiceImpl<ShopProduct
for (int k = 0; k < product_ids.size(); k++) { for (int k = 0; k < product_ids.size(); k++) {
Long product_id = product_ids.get(k); Long product_id = product_ids.get(k);
if (!product_id_row.contains(product_id)) { if (CheckUtil.isEmpty(product_id)) {
continue;
}
if (!product_id_row.contains(product_id))
{
//初始化兼容 //初始化兼容
ShopProductAnalytics product_analytics = new ShopProductAnalytics(); ShopProductAnalytics product_analytics = new ShopProductAnalytics();
product_analytics.setProduct_id(product_id); product_analytics.setProduct_id(product_id);

View File

@ -228,6 +228,9 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
@Autowired @Autowired
private ThreadPoolExecutor executor; private ThreadPoolExecutor executor;
@Autowired
private ShopBaseLangMetaService shopBaseLangMetaService;
private Logger logger = LoggerFactory.getLogger(ShopProductBaseServiceImpl.class); private Logger logger = LoggerFactory.getLogger(ShopProductBaseServiceImpl.class);
@Override @Override
@ -5059,4 +5062,43 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
return null; return null;
} }
} }
@Override
@Transactional
public boolean updateProductSubsite(Integer store_id) {
ShopStoreBase storeBase = shopStoreBaseService.get(store_id);
if (storeBase == null) {
throw new ApiException(I18nUtil._("店铺基础信息不存在!"));
}
ShopProductIndex shopProductIndex = new ShopProductIndex();
shopProductIndex.setSubsite_id(storeBase.getSubsite_id());
QueryWrapper<ShopProductIndex> indexQueryWrapper = new QueryWrapper<>();
indexQueryWrapper.eq("store_id", store_id);
if (!shopProductIndexService.edit(shopProductIndex, indexQueryWrapper)) {
throw new ApiException(I18nUtil._("产品索引信息修改失败!"));
}
return true;
}
public String initProductLangIndex(Long productId, String productNameIndex) {
QueryWrapper<ShopBaseLangMeta> queryParams = new QueryWrapper<>();
queryParams.eq("table_name", "shop_product_base");
queryParams.eq("column_name", "product_name");
queryParams.eq("primary_key", productId);
List<ShopBaseLangMeta> langmetaRows = shopBaseLangMetaService.find(queryParams);
// 处理唯一的meta_value列
List<String> langNameIndexRow = CommonUtil.column(langmetaRows, ShopBaseLangMeta::getMeta_value);
if (!langNameIndexRow.isEmpty()) {
productNameIndex = String.format("%s -|- %s", productNameIndex, String.join(" ", langNameIndexRow));
}
return productNameIndex;
}
} }

View File

@ -273,9 +273,9 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
// 更改商城订单状态为已取消注意事务问题 // 更改商城订单状态为已取消注意事务问题
List<String> orderList = new ArrayList<>(); List<String> orderList = new ArrayList<>();
orderList.add(shopStoreSfOrderExist.getShop_order_id()); orderList.add(shopStoreSfOrderExist.getShop_order_id());
Boolean success = shopOrderBaseService.cancel(orderList, null, false); // 取消订单, 流程订单状态积分众宝库存礼包优惠券 有就统统退还
Boolean success = shopOrderBaseService.cancel(orderList, null, false); // 不检查订单付款状态
if (!success) { if (!success) {
// return new SFExpressApiRes().fail(1, "取消商家订单失败!");
throw new ApiException(I18nUtil._("取消商家订单失败!")); throw new ApiException(I18nUtil._("取消商家订单失败!"));
} }
@ -286,7 +286,6 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
shopStoreSfOrder.setStatus_desc("线上商城发起取消订单"); shopStoreSfOrder.setStatus_desc("线上商城发起取消订单");
success = shopStoreSfOrderService.updateShopStoreSfOrderStatus(shopStoreSfOrder); success = shopStoreSfOrderService.updateShopStoreSfOrderStatus(shopStoreSfOrder);
if (!success) { if (!success) {
// return new SFExpressApiRes().fail(1, "取消顺丰订单失败!");
throw new ApiException(I18nUtil._("取消顺丰订单失败!")); throw new ApiException(I18nUtil._("取消顺丰订单失败!"));
} }

View File

@ -1,7 +1,9 @@
package com.suisung.mall.shop.store.controller.admin; package com.suisung.mall.shop.store.controller.admin;
import cn.hutool.core.collection.CollUtil;
import com.suisung.mall.common.api.CommonResult; import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.modules.store.ShopStorePrinter; import com.suisung.mall.common.modules.store.ShopStorePrinter;
import com.suisung.mall.shop.store.service.ShopStoreEmployeeService;
import com.suisung.mall.shop.store.service.ShopStorePrinterService; import com.suisung.mall.shop.store.service.ShopStorePrinterService;
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService; import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -13,6 +15,9 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Api(tags = "门店打票机打印业务") @Api(tags = "门店打票机打印业务")
@RestController @RestController
@ -25,13 +30,16 @@ public class ShopStorePrinterController {
@Resource @Resource
private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService; private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService;
@Resource
private ShopStoreEmployeeService shopStoreEmployeeService;
@ApiOperation(value = "内部测试案例", notes = "内部测试案例") @ApiOperation(value = "内部测试案例", notes = "内部测试案例")
@RequestMapping(value = "/testcase", method = {RequestMethod.GET}) @RequestMapping(value = "/testcase", method = {RequestMethod.GET})
public CommonResult TestCase() { public CommonResult TestCase() {
Object data = shopStoreSameCityTransportBaseService.computeSameCityTransportFee(3L, BigDecimal.valueOf(110.07123874241765), BigDecimal.valueOf(23.366250981849255), 100, BigDecimal.valueOf(0.5), BigDecimal.valueOf(5.5), BigDecimal.valueOf(5.5), true); // Object data = shopStoreSameCityTransportBaseService.computeSameCityTransportFee(3L, BigDecimal.valueOf(110.07123874241765), BigDecimal.valueOf(23.366250981849255), 100, BigDecimal.valueOf(0.5), BigDecimal.valueOf(5.5), BigDecimal.valueOf(5.5), true);
return CommonResult.success(data); List<Integer> list = shopStoreEmployeeService.selectEmployeeByStoreId(3,"店铺管理员");
return CommonResult.success(list);
} }
@ApiOperation(value = "测试打印模版消息", notes = "测试打印模版消息") @ApiOperation(value = "测试打印模版消息", notes = "测试打印模版消息")

View File

@ -2,8 +2,11 @@ package com.suisung.mall.shop.store.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.suisung.mall.common.modules.store.ShopStoreEmployee; import com.suisung.mall.common.modules.store.ShopStoreEmployee;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* <p> * <p>
* 卖家用户表公司员工employee-通过user id启用用户中心 Mapper 接口 * 卖家用户表公司员工employee-通过user id启用用户中心 Mapper 接口
@ -16,4 +19,11 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface ShopStoreEmployeeMapper extends BaseMapper<ShopStoreEmployee> { public interface ShopStoreEmployeeMapper extends BaseMapper<ShopStoreEmployee> {
/**
* 根据店铺id和角色权限组id获取多条 userId
* @param storeId
* @param groupId
* @return
*/
List<Integer> selectByStoreIdRightGroupId(@Param("storeId") Integer storeId, @Param("groupId") Integer groupId);
} }

View File

@ -17,4 +17,12 @@ import java.util.Map;
public interface ShopStoreEmployeeRightsGroupService extends IBaseService<ShopStoreEmployeeRightsGroup> { public interface ShopStoreEmployeeRightsGroupService extends IBaseService<ShopStoreEmployeeRightsGroup> {
Map getList(ShopStoreEmployeeRightsGroup shopStoreEmployeeRightsGroup, Integer pageNum, Integer pageSize); Map getList(ShopStoreEmployeeRightsGroup shopStoreEmployeeRightsGroup, Integer pageNum, Integer pageSize);
/**
* 根据店铺id和角色权限组名称获取一条记录
* @param storeId
* @param groupName
* @return
*/
ShopStoreEmployeeRightsGroup getByGroupName(Integer storeId, String groupName);
} }

View File

@ -29,4 +29,12 @@ public interface ShopStoreEmployeeService extends IBaseService<ShopStoreEmployee
boolean removeEmployee(Integer user_id); boolean removeEmployee(Integer user_id);
/**
* 根据店铺id和角色权限组名称获取多条 userId
* @param storeId
* @param rightsGroupName
* @return
*/
List<Integer> selectEmployeeByStoreId(Integer storeId, String rightsGroupName);
} }

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.suisung.mall.common.modules.store.ShopStoreInfo; import com.suisung.mall.common.modules.store.ShopStoreInfo;
import com.suisung.mall.core.web.service.IBaseService; import com.suisung.mall.core.web.service.IBaseService;
import java.util.List;
import java.util.Map; import java.util.Map;
@ -21,4 +22,11 @@ public interface ShopStoreInfoService extends IBaseService<ShopStoreInfo> {
Map getInfoList(QueryWrapper<ShopStoreInfo> queryWrapper, Integer pageNum, Integer pageSize); Map getInfoList(QueryWrapper<ShopStoreInfo> queryWrapper, Integer pageNum, Integer pageSize);
/**
* 获取店长的手机号码
* @param storeId
* @return
*/
List<String> getStoreKeeperMobile(Integer storeId);
} }

View File

@ -36,7 +36,18 @@ public class ShopStoreEmployeeRightsGroupServiceImpl extends BaseServiceImpl<Sho
} }
Page<ShopStoreEmployeeRightsGroup> lists = lists(queryWrapper, pageNum, pageSize); Page<ShopStoreEmployeeRightsGroup> lists = lists(queryWrapper, pageNum, pageSize);
return toMobileResult(lists); return toMobileResult(lists);
}
/**
* 根据店铺id和角色权限组名称获取一条记录
* @param storeId
* @param rightsGroupName
* @return
*/
@Override
public ShopStoreEmployeeRightsGroup getByGroupName(Integer storeId, String rightsGroupName) {
QueryWrapper<ShopStoreEmployeeRightsGroup> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("store_id", storeId).eq("rights_group_name", rightsGroupName);
return getOne(queryWrapper);
} }
} }

View File

@ -3,6 +3,7 @@ package com.suisung.mall.shop.store.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.suisung.mall.common.api.CommonResult; import com.suisung.mall.common.api.CommonResult;
@ -26,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -43,15 +45,18 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
@Service @Service
public class ShopStoreEmployeeServiceImpl extends BaseServiceImpl<ShopStoreEmployeeMapper, ShopStoreEmployee> implements ShopStoreEmployeeService { public class ShopStoreEmployeeServiceImpl extends BaseServiceImpl<ShopStoreEmployeeMapper, ShopStoreEmployee> implements ShopStoreEmployeeService {
@Autowired // @Resource
private ShopStoreEmployeeService shopStoreEmployeeService; // private ShopStoreEmployeeService shopStoreEmployeeService;
@Autowired @Resource
private AccountService accountService; private AccountService accountService;
@Autowired @Resource
private ShopStoreEmployeeRightsGroupService shopStoreEmployeeRightsGroupService; private ShopStoreEmployeeRightsGroupService shopStoreEmployeeRightsGroupService;
@Resource
private ShopStoreEmployeeMapper shopStoreEmployeeMapper;
@Override @Override
public Map getList(QueryWrapper<ShopStoreEmployee> wrapper, Integer pageNum, Integer pageSize) { public Map getList(QueryWrapper<ShopStoreEmployee> wrapper, Integer pageNum, Integer pageSize) {
@ -62,7 +67,7 @@ public class ShopStoreEmployeeServiceImpl extends BaseServiceImpl<ShopStoreEmplo
Map data = toMobileResult(lists); Map data = toMobileResult(lists);
List<Map> items = (List<Map>) data.get("items"); List<Map> items = (List<Map>) data.get("items");
shopStoreEmployeeService.fixUserInfo(items); fixUserInfo(items);
handleGroupName(items, store_id); handleGroupName(items, store_id);
return data; return data;
@ -204,4 +209,26 @@ public class ShopStoreEmployeeServiceImpl extends BaseServiceImpl<ShopStoreEmplo
return false; return false;
} }
/**
* 根据店铺id和角色权限组名称获取多条 userId
*
* @param storeId
* @param rightsGroupName
* @return
*/
@Override
public List<Integer> selectEmployeeByStoreId(Integer storeId, String rightsGroupName) {
if ((storeId == null || storeId <= 0) && StrUtil.isBlank(rightsGroupName)) {
return null;
}
Integer rightsGroupId = null;
ShopStoreEmployeeRightsGroup rightsGroup = shopStoreEmployeeRightsGroupService.getByGroupName(storeId, rightsGroupName);
if (rightsGroup != null) {
rightsGroupId = rightsGroup.getRights_group_id();
}
return shopStoreEmployeeMapper.selectByStoreIdRightGroupId(storeId, rightsGroupId);
}
} }

View File

@ -85,10 +85,22 @@ public class ShopStoreInfoServiceImpl extends BaseServiceImpl<ShopStoreInfoMappe
item.put("store_product_num", storeAnalytics.getStore_product_num()); item.put("store_product_num", storeAnalytics.getStore_product_num());
item.put("store_favorite_num", storeAnalytics.getStore_favorite_num()); item.put("store_favorite_num", storeAnalytics.getStore_favorite_num());
item.put("store_trade_amount", storeAnalytics.getStore_trade_amount()); item.put("store_trade_amount", storeAnalytics.getStore_trade_amount());
} }
return data; return data;
} }
/**
* 获取店长的手机号码
*
* @param storeId
* @return
*/
@Override
public List<String> getStoreKeeperMobile(Integer storeId) {
QueryWrapper<ShopStoreInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("store_id", storeId).select("store_tel");
return null;
}
} }

View File

@ -7,4 +7,19 @@
employee_id, store_id, user_id, rights_group_id, employee_is_admin, employee_login_time, employee_is_kefu employee_id, store_id, user_id, rights_group_id, employee_is_admin, employee_login_time, employee_is_kefu
</sql> </sql>
<select id="selectByStoreIdRightGroupId" resultType="Integer">
SELECT user_id
FROM shop_store_employee a
<where>
<if test="storeId!=null">
and a.store_id = #{storeId}
</if>
<if test="groupId!=null">
and find_in_set(#{groupId}, a.rights_group_id)
</if>
</where>
</select>
</mapper> </mapper>