|
@@ -40,6 +40,7 @@ import shop.alien.util.common.DistanceUtil;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
import java.time.*;
|
|
import java.time.*;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatterBuilder;
|
|
import java.time.format.DateTimeFormatterBuilder;
|
|
@@ -1375,37 +1376,82 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public boolean logoutStore(Integer storeId, String reason) {
|
|
|
|
- StoreInfo storeInfo = this.getById(storeId);
|
|
|
|
- if (storeInfo == null) {
|
|
|
|
- throw new RuntimeException("店铺不存在");
|
|
|
|
- }
|
|
|
|
- if (storeInfo.getLogoutFlag() == 1) {
|
|
|
|
- throw new RuntimeException("店铺已经注销");
|
|
|
|
|
|
+ public void logoutStore(StoreInfoVo storeInfo) {
|
|
|
|
+ String key = "verification_" + storeInfo.getStorePhone();
|
|
|
|
+ String redisVerificationCode = baseRedisService.getString(key);
|
|
|
|
+ if(redisVerificationCode.equals(storeInfo.getVerificationCode())){
|
|
|
|
+ // 通过id获取当前店铺信息
|
|
|
|
+ LambdaQueryWrapper<StoreInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ lambdaQueryWrapper.eq(StoreInfo::getId, storeInfo.getId());
|
|
|
|
+ StoreInfo storeIn = storeInfoMapper.selectOne(lambdaQueryWrapper);
|
|
|
|
+ if(storeIn!=null){
|
|
|
|
+ // 添加注销原因
|
|
|
|
+ storeIn.setLogoutReason(storeIn.getLogoutReason());
|
|
|
|
+ // 添加注销code
|
|
|
|
+ storeIn.setLogoutCode(storeIn.getLogoutCode());
|
|
|
|
+ // 注销中状态
|
|
|
|
+ storeIn.setStoreStatus(-1);
|
|
|
|
+ // 添加注销申请时间
|
|
|
|
+ storeIn.setLogoutTime(new Date());
|
|
|
|
+ // 更新logout_flag状态为1
|
|
|
|
+ storeIn.setLogoutFlag(1);
|
|
|
|
+ int num = storeInfoMapper.updateById(storeIn);
|
|
|
|
+ if(num>0){
|
|
|
|
+ // 发送通知
|
|
|
|
+ LifeNotice lifeMessage = new LifeNotice();
|
|
|
|
+ lifeMessage.setReceiverId("store_" + storeInfo.getStorePhone());
|
|
|
|
+ String text = "您提交的店铺注销申请已成功提交, 系统将按流程进行处理. 注销申请提交后, 将进入7天的冷静期. 期间您可以随时在" +
|
|
|
|
+ "[门店装修]-[操作]中撤回申请. 冷静期结束后, 系统将正式开始注销操作. 店铺内所有数据将被永久清除, 且无法恢复." +
|
|
|
|
+ "如有疑问, 可联系客服咨询. 感谢您使用我们的服务.";
|
|
|
|
+ lifeMessage.setContext(text);
|
|
|
|
+ lifeMessage.setTitle("注销通知");
|
|
|
|
+ lifeMessage.setSenderId("system");
|
|
|
|
+ lifeMessage.setIsRead(0);
|
|
|
|
+ lifeMessage.setNoticeType(1);
|
|
|
|
+ lifeNoticeMapper.insert(lifeMessage);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ throw new RuntimeException("验证码错误");
|
|
}
|
|
}
|
|
-
|
|
|
|
- storeInfo.setLogoutFlag(1);
|
|
|
|
- storeInfo.setLogoutReason(reason);
|
|
|
|
- storeInfo.setLogoutTime(new Date());
|
|
|
|
-
|
|
|
|
- return this.updateById(storeInfo);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public boolean cancelLogoutStore(Integer storeId) {
|
|
|
|
- StoreInfo storeInfo = this.getById(storeId);
|
|
|
|
- if (storeInfo == null) {
|
|
|
|
- throw new RuntimeException("店铺不存在");
|
|
|
|
- }
|
|
|
|
- if (storeInfo.getLogoutFlag() == 0) {
|
|
|
|
- throw new RuntimeException("店铺未注销");
|
|
|
|
|
|
+ public void cancelLogoutStore(StoreInfoVo storeInfo) {
|
|
|
|
+ // 通过id获取当前商家账号信息
|
|
|
|
+ LambdaQueryWrapper<StoreInfo> storeUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ storeUserLambdaQueryWrapper.eq(StoreInfo::getId, storeInfo.getId());
|
|
|
|
+ StoreInfo storeIn = storeInfoMapper.selectOne(storeUserLambdaQueryWrapper);
|
|
|
|
+ // 修改注销标记为0
|
|
|
|
+ storeIn.setLogoutFlag(0);
|
|
|
|
+ // 注销状态变为可用
|
|
|
|
+ storeIn.setStoreStatus(0);
|
|
|
|
+ // 清空注销原因
|
|
|
|
+ storeIn.setLogoutReason(null);
|
|
|
|
+ // 清空注销code
|
|
|
|
+ storeIn.setLogoutCode(null);
|
|
|
|
+ // 清空注销申请时间
|
|
|
|
+ storeIn.setLogoutTime(null);
|
|
|
|
+ // 更新logout_flag状态为0
|
|
|
|
+ storeIn.setLogoutFlag(0);
|
|
|
|
+ int num = storeInfoMapper.updateById(storeIn);
|
|
|
|
+ if (num > 0) {
|
|
|
|
+ // 发送通知
|
|
|
|
+ LifeNotice lifeMessage = new LifeNotice();
|
|
|
|
+ lifeMessage.setReceiverId("store_" + storeInfo.getStorePhone());
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ String storeDate = simpleDateFormat.format(storeInfo.getCreatedTime());
|
|
|
|
+ String text = "处理结果:已撤回注销申请" +
|
|
|
|
+ "处理时间:" + storeDate +
|
|
|
|
+ "当前账号状态已恢复正常. 您可以继续使用该店铺登录并享受各项服务, 所有店铺数据均已妥善保留." +
|
|
|
|
+ "若您后续仍有注销需求, 可随时通过门店装修页面重新提交申请. 感谢您的理解与支持!";
|
|
|
|
+ lifeMessage.setContext(text);
|
|
|
|
+ lifeMessage.setTitle("撤销注销通知");
|
|
|
|
+ lifeMessage.setSenderId("system");
|
|
|
|
+ lifeMessage.setIsRead(0);
|
|
|
|
+ lifeMessage.setNoticeType(1);
|
|
|
|
+ lifeNoticeMapper.insert(lifeMessage);
|
|
}
|
|
}
|
|
-
|
|
|
|
- storeInfo.setLogoutFlag(0);
|
|
|
|
- storeInfo.setLogoutReason(null);
|
|
|
|
- storeInfo.setLogoutTime(null);
|
|
|
|
-
|
|
|
|
- return this.updateById(storeInfo);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|