发货邮件邮件 bug 修改
This commit is contained in:
parent
6fc21b3e3f
commit
48aa92e2b8
@ -141,4 +141,6 @@ public interface AccountUserBaseService extends IBaseService<AccountUserBase> {
|
||||
* @param code
|
||||
*/
|
||||
void callbackGoogle(HttpServletResponse response, String code);
|
||||
|
||||
boolean changePassword(String old_password, String password);
|
||||
}
|
||||
|
||||
@ -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.pay.PayUserResource;
|
||||
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.utils.*;
|
||||
import com.suisung.mall.common.utils.constbank.RSAUtil;
|
||||
import com.suisung.mall.common.utils.phone.PhoneNumberUtils;
|
||||
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.RedisService;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
@ -89,75 +89,52 @@ import static com.suisung.mall.common.utils.I18nUtil._;
|
||||
@Service
|
||||
public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseMapper, AccountUserBase> implements AccountUserBaseService {
|
||||
|
||||
private final String VERIFY_CODE_KEY = "register:verifyCode:";
|
||||
@Autowired
|
||||
private AuthService authService;
|
||||
|
||||
@Autowired
|
||||
private AdminService adminService;
|
||||
|
||||
@Autowired
|
||||
private SnsService snsService;
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private ShopService shopService;
|
||||
|
||||
@Autowired
|
||||
private PayService payService;
|
||||
|
||||
@Autowired
|
||||
private AccountUserInfoService accountUserInfoService;
|
||||
|
||||
@Autowired
|
||||
private AccountUserLoginService accountUserLoginService;
|
||||
|
||||
@Autowired
|
||||
private AccountBaseConfigService accountBaseConfigService;
|
||||
|
||||
@Autowired
|
||||
private AccountBaseUserLevelService baseUserLevelService;
|
||||
|
||||
@Autowired
|
||||
private AccountUserSnsService accountUserSnsService;
|
||||
|
||||
@Autowired
|
||||
private AccountUserBindConnectService bindConnectService;
|
||||
|
||||
@Autowired
|
||||
private AccountUserTypeService accountUserTypeService;
|
||||
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
|
||||
@Autowired
|
||||
private WeiXinService weiXinService;
|
||||
|
||||
@Autowired
|
||||
private AccountUserBindConnectService accountUserBindConnectService;
|
||||
|
||||
@Autowired
|
||||
private AccountUserBaseService accountUserBaseService;
|
||||
|
||||
@Autowired
|
||||
private AccountUserChannelCodeService accountUserChannelCodeService;
|
||||
|
||||
@Autowired
|
||||
private AccountUserChannelService accountUserChannelService;
|
||||
|
||||
@Autowired
|
||||
private AccountUserBaseMapper accountUserBaseMapper;
|
||||
|
||||
@Autowired
|
||||
private CloundService cloundService;
|
||||
|
||||
private final String VERIFY_CODE_KEY = "register:verifyCode:";
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(AccountUserBaseServiceImpl.class);
|
||||
private final Logger logger = LoggerFactory.getLogger(AccountUserBaseServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public CommonResult login(Map<String, String> params) {
|
||||
@ -345,7 +322,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
String chain_ids = user.getChain_ids();
|
||||
if (StrUtil.isNotBlank(chain_ids)) {
|
||||
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();
|
||||
if (StrUtil.isNotBlank(store_ids)) {
|
||||
user.setRid(RoleIdEnum.STORE.getState());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1227,11 +1202,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
Date fx_user_time = new Date();
|
||||
|
||||
boolean update_flag = false;
|
||||
if (fx_user_row != null && ObjectUtil.notEqual(user_parent_id, old_user_parent_id)) {
|
||||
update_flag = true;
|
||||
} else {
|
||||
update_flag = false;
|
||||
}
|
||||
update_flag = fx_user_row != null && ObjectUtil.notEqual(user_parent_id, old_user_parent_id);
|
||||
|
||||
if (update_flag) {
|
||||
// 初始化推销员记录
|
||||
@ -1911,8 +1882,8 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
String user_salt = user_row.getUser_salt();
|
||||
|
||||
String md5_password = SecureUtil.md5(user_salt + SecureUtil.md5(old_password));
|
||||
if (!StrUtil.equals(md5_password, user_password)) {
|
||||
throw new ApiException(_("请输入账号"));
|
||||
if (!StrUtil.equals(md5_password, user_row.getUser_password())) {
|
||||
throw new ApiException(_("原密码错误!"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2069,6 +2040,11 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
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");
|
||||
if (StrUtil.isNotBlank(user_mobile) && StrUtil.isNotBlank(code)) {
|
||||
// todo 验证 验证码
|
||||
@ -2263,28 +2239,71 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
|
||||
Long expire = redisService.getExpire(VERIFY_CODE_KEY + number);
|
||||
if (expire != -1) {
|
||||
//一分钟后允许重发
|
||||
if (expire > 60 * 4) {
|
||||
throw new ApiException(_("验证码获取频率太高,请稍后再试"));
|
||||
}
|
||||
}
|
||||
|
||||
String verifyCode = RandomUtil.randomNumbers(4);
|
||||
redisService.set(VERIFY_CODE_KEY + number, verifyCode, 60 * 5);
|
||||
|
||||
// todo 优化国际手机号截取
|
||||
if (PhoneUtil.isMobile(number)) {
|
||||
number = StrUtil.removePrefix(number, "+86");
|
||||
SmsDto smsDTO = new SmsDto();
|
||||
smsDTO.setMobile(number);
|
||||
//读取sms配置信息
|
||||
String service_user_id = accountBaseConfigService.getConfig("service_user_id");
|
||||
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));
|
||||
number = StrUtil.removePrefix(number, "+86");
|
||||
|
||||
|
||||
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 {
|
||||
return cloundService.send(smsDTO);
|
||||
ThirdUtil.send(smsDto);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new ApiException(e.getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (CheckUtil.isEmail(number)) {
|
||||
QueryWrapper<AccountBaseConfig> queryWrapper = new QueryWrapper<>();
|
||||
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));
|
||||
EmailDTO emailDTO = Convert.convert(EmailDTO.class, configMap);
|
||||
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));
|
||||
try {
|
||||
return EmailUtil.send(emailDTO);
|
||||
@ -2322,19 +2341,61 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
// todo 优化国际手机号截取
|
||||
if (PhoneUtil.isMobile(number)) {
|
||||
number = StrUtil.removePrefix(number, "+86");
|
||||
SmsDto smsDTO = new SmsDto();
|
||||
smsDTO.setMobile(number);
|
||||
//读取sms配置信息
|
||||
String service_user_id = accountBaseConfigService.getConfig("service_user_id");
|
||||
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 {
|
||||
return cloundService.send(smsDTO);
|
||||
ThirdUtil.send(smsDto);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new ApiException(e.getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (CheckUtil.isEmail(number)) {
|
||||
QueryWrapper<AccountBaseConfig> queryWrapper = new QueryWrapper<>();
|
||||
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));
|
||||
EmailDTO emailDTO = Convert.convert(EmailDTO.class, configMap);
|
||||
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));
|
||||
try {
|
||||
return EmailUtil.send(emailDTO);
|
||||
@ -2370,7 +2431,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
|
||||
//通过lure脚本原子验证令牌和删除令牌
|
||||
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;
|
||||
}
|
||||
@ -2840,7 +2901,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
List<AccountUserBase> list = super.gets(ids);
|
||||
UserDto currentUser = getCurrentUser();
|
||||
|
||||
if ((currentUser!=null&¤tUser.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) {
|
||||
if (ObjectUtil.isNotEmpty(it)) {
|
||||
String userAccount = it.getUser_account();
|
||||
@ -2861,4 +2922,20 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,6 +135,48 @@
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
</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 -->
|
||||
<dependency>
|
||||
<groupId>com.googlecode.libphonenumber</groupId>
|
||||
|
||||
@ -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_Discounted = 2;
|
||||
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"; // 店铺管理员;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -73,8 +73,6 @@ public class ContextUtil {
|
||||
|
||||
if (loginUser == null) {
|
||||
throw new ApiException(ResultCode.UNAUTHORIZED);
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
return loginUser.getId();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,12 @@ package com.suisung.mall;
|
||||
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
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.ThirdUtil;
|
||||
import com.suisung.mall.common.weblog.ControllerLogAspect;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
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.ASSIGNABLE_TYPE, value = {ControllerLogAspect.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})
|
||||
|
||||
@ -8,6 +8,7 @@ import cn.hutool.json.JSONUtil;
|
||||
import com.suisung.mall.common.modules.product.ShopProductIndex;
|
||||
import com.suisung.mall.common.pojo.dto.ProductRecommendDTO;
|
||||
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.domain.EsProduct;
|
||||
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()));
|
||||
}
|
||||
|
||||
@ -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()));
|
||||
}
|
||||
|
||||
|
||||
@ -157,6 +157,15 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</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-->
|
||||
<!--百度人脸识别API-->
|
||||
<dependency>
|
||||
@ -217,7 +226,7 @@
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.9</version>
|
||||
<version>1.11</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
|
||||
@ -277,6 +286,12 @@
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.suisung.mall</groupId>
|
||||
<artifactId>mall-account</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!--打票机 使用的库 结束-->
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import com.suisung.mall.common.service.MessageService;
|
||||
import com.suisung.mall.common.utils.I18nUtil;
|
||||
import com.suisung.mall.shop.config.SpringUtil;
|
||||
import com.suisung.mall.shop.message.service.ShopMessageTemplateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.slf4j.Logger;
|
||||
@ -20,9 +21,10 @@ import java.util.Map;
|
||||
*/
|
||||
public class RsyncNoticeMsgJob extends QuartzJobBean {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(RsyncNoticeMsgJob.class);
|
||||
|
||||
@Override
|
||||
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
Logger logger = LoggerFactory.getLogger(RsyncNoticeMsgJob.class);
|
||||
|
||||
MessageService messageService = SpringUtil.getBean(MessageService.class);
|
||||
ShopMessageTemplateService shopMessageTemplateService = SpringUtil.getBean(ShopMessageTemplateService.class);
|
||||
@ -31,9 +33,7 @@ public class RsyncNoticeMsgJob extends QuartzJobBean {
|
||||
String key = messageService.getKey("notice_msg");
|
||||
|
||||
int times = 10000;
|
||||
|
||||
//如果队列有数据,一直读完
|
||||
|
||||
while (times > 0) {
|
||||
String data = messageService.receiveNoticeMsg();
|
||||
|
||||
@ -41,8 +41,9 @@ public class RsyncNoticeMsgJob extends QuartzJobBean {
|
||||
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 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) {
|
||||
//发送消息
|
||||
logger.debug("异步通知消息作业key:{}开始执行", key);
|
||||
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));
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import com.suisung.mall.common.modules.message.ShopMessageTemplate;
|
||||
import com.suisung.mall.common.modules.wechat.ShopWechatTplmsg;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@ -31,4 +32,15 @@ public interface ShopMessageTemplateService extends IBaseService<ShopMessageTemp
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@ -7,6 +7,12 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
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.suisung.mall.common.api.BindCode;
|
||||
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.store.ShopStoreBase;
|
||||
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.LogUtil;
|
||||
import com.suisung.mall.common.utils.ThirdUtil;
|
||||
import com.suisung.mall.common.utils.WxHttpUtil;
|
||||
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.impl.BaseServiceImpl;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.text.StringSubstitutor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -104,8 +116,10 @@ public class ShopMessageTemplateServiceImpl extends BaseServiceImpl<ShopMessageT
|
||||
* @access public
|
||||
*/
|
||||
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);
|
||||
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()));
|
||||
|
||||
//默认平台管理员
|
||||
@ -159,7 +173,6 @@ public class ShopMessageTemplateServiceImpl extends BaseServiceImpl<ShopMessageT
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 发送邮件
|
||||
if (message_row.getMessage_email_enable() > 0 && !user_setting.isEmpty()) {
|
||||
String email = (String) user_setting.get("email");
|
||||
@ -250,27 +263,61 @@ public class ShopMessageTemplateServiceImpl extends BaseServiceImpl<ShopMessageT
|
||||
|
||||
String[] activeProfiles = environment.getActiveProfiles();
|
||||
String activeProfile = activeProfiles[0];
|
||||
// 生产环境才允许短信发送
|
||||
// 短信发送,生产环境才允许短信发送
|
||||
if (message_row.getMessage_sms_enable() > 0 && !user_setting.isEmpty() && activeProfile.equals("prod")) {
|
||||
|
||||
String mobile = (String) user_setting.get("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],可去店铺查看详情。';
|
||||
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_app_key = accountBaseConfigService.getConfig("service_app_key");
|
||||
smsDTO.setServiceUserId(service_user_id);
|
||||
smsDTO.setServiceAppKey(service_app_key);
|
||||
SmsDto smsDto = new SmsDto();
|
||||
|
||||
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 {
|
||||
cloundService.send(smsDTO);
|
||||
ThirdUtil.send(smsDto);
|
||||
|
||||
log.debug("消息发送的数据:{}", smsDto);
|
||||
} 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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -28,6 +28,7 @@ public class MessageListener {
|
||||
String messageId = message.getMessageProperties().getMessageId();
|
||||
|
||||
try {
|
||||
log.debug("消息监听到:{} ### {}",messageId, msgTO);
|
||||
boolean flag = messageService.sendNoticeMsg(msgTO.getUser_id(), msgTO.getStore_id(), msgTO.getMessage_id(), msgTO.getArgs());
|
||||
if (flag) {
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
|
||||
@ -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.InvoicingWarehouseBaseService;
|
||||
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.number.service.ShopNumberSeqService;
|
||||
import com.suisung.mall.shop.order.mapper.ShopOrderBaseMapper;
|
||||
@ -280,6 +281,10 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
private ShopOrderDeliveryAddressService shopOrderDeliveryAddressService;
|
||||
@Resource
|
||||
private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService;
|
||||
@Resource
|
||||
private ShopMessageTemplateService shopMessageTemplateService;
|
||||
|
||||
|
||||
@Value("${sf-express.enable}")
|
||||
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_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)));
|
||||
|
||||
// todo 处理视频类订单
|
||||
@ -3029,13 +3035,49 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
shopDistributionUserOrderService.settleDistributionUserOrder(order_id);
|
||||
}
|
||||
|
||||
//提醒商家发货
|
||||
//提醒商家(店铺管理员)发货
|
||||
message_id = "notice-of-delivery";
|
||||
args = new HashMap();
|
||||
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()));
|
||||
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)));
|
||||
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)) {
|
||||
@ -3877,10 +3919,11 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
* 流程:订单状态;积分、众宝、库存、礼包、优惠券 有就统统退还
|
||||
*
|
||||
* @param order_ids 订单id
|
||||
* @param order_rows 订单数据
|
||||
* check_paid_flag 默认值 true
|
||||
* @param check_paid_flag 默认值 true
|
||||
*/
|
||||
@Transactional
|
||||
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)) {
|
||||
order_rows = Convert.toList(Map.class, shopOrderInfoService.gets(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();
|
||||
Map order = orderOpl.orElseGet(HashMap::new);
|
||||
// 订单状态(LIST):2011-待订单审核;2013-待财务审核;2020-待配货/待出库审核;2030-待发货;2040-已发货/待收货确认;2060-已完成/已签收;2070-已取消/已作废;
|
||||
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");
|
||||
// 要检查订单付款状态
|
||||
if (check_paid_flag) {
|
||||
if (ifCancel(order_state_id, order_is_paid)) {
|
||||
// 未付款,未配送的订单才能取消订单
|
||||
cancel_id_row.add(order_id);
|
||||
}
|
||||
} else {
|
||||
// 不检查订单付款状态
|
||||
cancel_id_row.add(order_id);
|
||||
}
|
||||
}
|
||||
@ -3919,8 +3968,8 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
|
||||
QueryWrapper<ShopOrderBase> baseQueryWrapper = new QueryWrapper<>();
|
||||
baseQueryWrapper.in("order_id", order_ids);
|
||||
baseQueryWrapper.ne("order_state_id", StateCode.ORDER_STATE_CANCEL);
|
||||
if (!edit(orderBase, baseQueryWrapper)) {
|
||||
baseQueryWrapper.ne("order_state_id", StateCode.ORDER_STATE_CANCEL); // 2070-已取消
|
||||
if (!edit(orderBase, baseQueryWrapper)) {// 批量更改状态
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
}
|
||||
|
||||
@ -3930,9 +3979,8 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
QueryWrapper<ShopOrderInfo> infoQueryWrapper = new QueryWrapper<>();
|
||||
infoQueryWrapper.in("order_id", cancel_id_row);
|
||||
infoQueryWrapper.ne("order_state_id", StateCode.ORDER_STATE_CANCEL);
|
||||
|
||||
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 默认为积分。
|
||||
@ -3944,8 +3992,8 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
Map order = orderOpl.orElseGet(HashMap::new);
|
||||
|
||||
Integer buyer_user_id = (Integer) order.get("buyer_user_id");
|
||||
BigDecimal order_resource_ext1 = order_data_row.getOrder_resource_ext1();
|
||||
BigDecimal order_resource_ext2 = order_data_row.getOrder_resource_ext2();
|
||||
BigDecimal order_resource_ext1 = order_data_row.getOrder_resource_ext1();// 积分
|
||||
BigDecimal order_resource_ext2 = order_data_row.getOrder_resource_ext2();// 众宝
|
||||
|
||||
if (ObjectUtil.compare(order_resource_ext1, BigDecimal.ZERO) > 0 && CheckUtil.isNotEmpty(buyer_user_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);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
// 限购商品数量退还
|
||||
@ -3976,10 +4025,12 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
List<ShopUserProductBuy> productBuyList = shopUserProductBuyService.find(buyQueryWrapper);
|
||||
|
||||
Integer order_item_quantity = order_item_row.getOrder_item_quantity();
|
||||
if (CollUtil.isNotEmpty(productBuyList)) {
|
||||
|
||||
for (ShopUserProductBuy productBuy : productBuyList) {
|
||||
productBuy.setProduct_buy_num(productBuy.getProduct_buy_num() - order_item_quantity);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(productBuyList)) {
|
||||
|
||||
if (!shopUserProductBuyService.saveOrUpdate(productBuyList)) {
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
}
|
||||
@ -4854,7 +4905,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
|
||||
List<ShopOrderInfo> shopOrderInfos = shopOrderInfoService.gets(order_ids);
|
||||
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")) {
|
||||
cancel(order_ids, rows, true);
|
||||
} else {
|
||||
@ -7817,14 +7868,16 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否可以取消
|
||||
* 检查是否可以取消?
|
||||
*
|
||||
* @param order_state_id 订单状态
|
||||
* @param order_is_paid
|
||||
* @return boolean true-可,false-不可
|
||||
*/
|
||||
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);
|
||||
// 3010-未付款,未付款的订单才能取消
|
||||
return order_states.contains(order_state_id) && ObjectUtil.equal(order_is_paid, StateCode.ORDER_PAID_STATE_NO);
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import com.suisung.mall.common.pojo.dto.ProductSearchDTO;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
import com.suisung.mall.shop.product.pojo.vo.ProductVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.Serializable;
|
||||
@ -258,4 +259,7 @@ public interface ShopProductBaseService extends IBaseService<ShopProductBase> {
|
||||
* @return
|
||||
*/
|
||||
Map getProductBasicInfo(Long product_id, Integer store_id);
|
||||
|
||||
@Transactional
|
||||
boolean updateProductSubsite(Integer store_id);
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.suisung.mall.common.modules.product.ShopProductAnalytics;
|
||||
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.shop.product.mapper.ShopProductAnalyticsMapper;
|
||||
import com.suisung.mall.shop.product.service.ShopProductAnalyticsService;
|
||||
@ -44,7 +45,8 @@ public class ShopProductAnalyticsServiceImpl extends BaseServiceImpl<ShopProduct
|
||||
@Override
|
||||
public Map getAnalytics(Long product_id) {
|
||||
ShopProductAnalytics product_analytics = get(product_id);
|
||||
if (ObjectUtil.isNull(product_analytics)) {
|
||||
if (ObjectUtil.isNull(product_analytics))
|
||||
{
|
||||
//初始化兼容
|
||||
product_analytics = new ShopProductAnalytics();
|
||||
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++) {
|
||||
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();
|
||||
product_analytics.setProduct_id(product_id);
|
||||
|
||||
@ -228,6 +228,9 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
@Autowired
|
||||
private ThreadPoolExecutor executor;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseLangMetaService shopBaseLangMetaService;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(ShopProductBaseServiceImpl.class);
|
||||
|
||||
@Override
|
||||
@ -5059,4 +5062,43 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,9 +273,9 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
// 更改商城订单状态为:已取消,注意事务问题
|
||||
List<String> orderList = new ArrayList<>();
|
||||
orderList.add(shopStoreSfOrderExist.getShop_order_id());
|
||||
Boolean success = shopOrderBaseService.cancel(orderList, null, false);
|
||||
// 取消订单, 流程:订单状态;积分、众宝、库存、礼包、优惠券 有就统统退还
|
||||
Boolean success = shopOrderBaseService.cancel(orderList, null, false); // 不检查订单付款状态
|
||||
if (!success) {
|
||||
// return new SFExpressApiRes().fail(1, "取消商家订单失败!");
|
||||
throw new ApiException(I18nUtil._("取消商家订单失败!"));
|
||||
}
|
||||
|
||||
@ -286,7 +286,6 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
shopStoreSfOrder.setStatus_desc("线上商城发起取消订单");
|
||||
success = shopStoreSfOrderService.updateShopStoreSfOrderStatus(shopStoreSfOrder);
|
||||
if (!success) {
|
||||
// return new SFExpressApiRes().fail(1, "取消顺丰订单失败!");
|
||||
throw new ApiException(I18nUtil._("取消顺丰订单失败!"));
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
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.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.ShopStoreSameCityTransportBaseService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -13,6 +15,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Api(tags = "门店打票机打印业务")
|
||||
@RestController
|
||||
@ -25,13 +30,16 @@ public class ShopStorePrinterController {
|
||||
@Resource
|
||||
private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService;
|
||||
|
||||
@Resource
|
||||
private ShopStoreEmployeeService shopStoreEmployeeService;
|
||||
|
||||
@ApiOperation(value = "内部测试案例", notes = "内部测试案例")
|
||||
@RequestMapping(value = "/testcase", method = {RequestMethod.GET})
|
||||
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 = "测试打印模版消息")
|
||||
|
||||
@ -2,8 +2,11 @@ package com.suisung.mall.shop.store.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreEmployee;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 卖家用户表—公司员工employee-通过user id启用用户中心 Mapper 接口
|
||||
@ -16,4 +19,11 @@ import org.springframework.stereotype.Repository;
|
||||
@Repository
|
||||
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);
|
||||
}
|
||||
|
||||
@ -17,4 +17,12 @@ import java.util.Map;
|
||||
public interface ShopStoreEmployeeRightsGroupService extends IBaseService<ShopStoreEmployeeRightsGroup> {
|
||||
|
||||
Map getList(ShopStoreEmployeeRightsGroup shopStoreEmployeeRightsGroup, Integer pageNum, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 根据店铺id和角色权限组名称获取一条记录
|
||||
* @param storeId
|
||||
* @param groupName
|
||||
* @return
|
||||
*/
|
||||
ShopStoreEmployeeRightsGroup getByGroupName(Integer storeId, String groupName);
|
||||
}
|
||||
|
||||
@ -29,4 +29,12 @@ public interface ShopStoreEmployeeService extends IBaseService<ShopStoreEmployee
|
||||
|
||||
boolean removeEmployee(Integer user_id);
|
||||
|
||||
/**
|
||||
* 根据店铺id和角色权限组名称,获取多条 userId
|
||||
* @param storeId
|
||||
* @param rightsGroupName
|
||||
* @return
|
||||
*/
|
||||
List<Integer> selectEmployeeByStoreId(Integer storeId, String rightsGroupName);
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreInfo;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@ -21,4 +22,11 @@ public interface ShopStoreInfoService extends IBaseService<ShopStoreInfo> {
|
||||
|
||||
Map getInfoList(QueryWrapper<ShopStoreInfo> queryWrapper, Integer pageNum, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取店长的手机号码
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
List<String> getStoreKeeperMobile(Integer storeId);
|
||||
|
||||
}
|
||||
|
||||
@ -36,7 +36,18 @@ public class ShopStoreEmployeeRightsGroupServiceImpl extends BaseServiceImpl<Sho
|
||||
}
|
||||
Page<ShopStoreEmployeeRightsGroup> lists = lists(queryWrapper, pageNum, pageSize);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.suisung.mall.shop.store.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -43,15 +45,18 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||
@Service
|
||||
public class ShopStoreEmployeeServiceImpl extends BaseServiceImpl<ShopStoreEmployeeMapper, ShopStoreEmployee> implements ShopStoreEmployeeService {
|
||||
|
||||
@Autowired
|
||||
private ShopStoreEmployeeService shopStoreEmployeeService;
|
||||
// @Resource
|
||||
// private ShopStoreEmployeeService shopStoreEmployeeService;
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private ShopStoreEmployeeRightsGroupService shopStoreEmployeeRightsGroupService;
|
||||
|
||||
@Resource
|
||||
private ShopStoreEmployeeMapper shopStoreEmployeeMapper;
|
||||
|
||||
@Override
|
||||
public Map getList(QueryWrapper<ShopStoreEmployee> wrapper, Integer pageNum, Integer pageSize) {
|
||||
|
||||
@ -62,7 +67,7 @@ public class ShopStoreEmployeeServiceImpl extends BaseServiceImpl<ShopStoreEmplo
|
||||
Map data = toMobileResult(lists);
|
||||
List<Map> items = (List<Map>) data.get("items");
|
||||
|
||||
shopStoreEmployeeService.fixUserInfo(items);
|
||||
fixUserInfo(items);
|
||||
handleGroupName(items, store_id);
|
||||
|
||||
return data;
|
||||
@ -204,4 +209,26 @@ public class ShopStoreEmployeeServiceImpl extends BaseServiceImpl<ShopStoreEmplo
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,10 +85,22 @@ public class ShopStoreInfoServiceImpl extends BaseServiceImpl<ShopStoreInfoMappe
|
||||
item.put("store_product_num", storeAnalytics.getStore_product_num());
|
||||
item.put("store_favorite_num", storeAnalytics.getStore_favorite_num());
|
||||
item.put("store_trade_amount", storeAnalytics.getStore_trade_amount());
|
||||
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -7,4 +7,19 @@
|
||||
employee_id, store_id, user_id, rights_group_id, employee_is_admin, employee_login_time, employee_is_kefu
|
||||
</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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user