|
|
@@ -1,10 +1,16 @@
|
|
|
package com.cyksj.service.mange.account;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.http.HttpUtil;
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.cyksj.mapper.AccountMapper;
|
|
|
+import com.cyksj.mapper.manage.AutoUpdateAccountPwdLogMapper;
|
|
|
import com.cyksj.model.entity.Account;
|
|
|
+import com.cyksj.model.entity.AutoUpdateAccountPwdLog;
|
|
|
import com.cyksj.model.entity.OrderDon;
|
|
|
import com.cyksj.model.excel.ExcelAccountData;
|
|
|
import com.cyksj.model.views.ExpiredAccountDataView;
|
|
|
@@ -26,6 +32,8 @@ import java.util.List;
|
|
|
public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements CmsAccountService {
|
|
|
private final AccountMapper accountMapper;
|
|
|
|
|
|
+ private final AutoUpdateAccountPwdLogMapper autoUpdateAccountPwdLogMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<ExpiredAccountDataView> getExpiredAccountView(Boolean isCorpWx, String customerService, Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, String startTime, String endTime, String now, Long offset, Long limit) {
|
|
|
return accountMapper.getExpiredAccountView(isCorpWx, customerService, goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime, now, new Page<>(offset, limit));
|
|
|
@@ -46,4 +54,38 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
|
|
|
return accountMapper.getNoAppleOneOrderDon(skuIds, yesZeroDate, thisZeroDate, noOrderStatus);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void recordAutoUpdatePwd(Long accountId, String account, String oldPwd, String newPwd, String operateIp) {
|
|
|
+ AutoUpdateAccountPwdLog log = new AutoUpdateAccountPwdLog();
|
|
|
+
|
|
|
+ log.setAccountId(accountId);
|
|
|
+ log.setAccount(account);
|
|
|
+ log.setOldPwd(oldPwd);
|
|
|
+ log.setNewPwd(newPwd);
|
|
|
+ log.setOperateLocation(getRealAddressByIP(operateIp));
|
|
|
+ log.setOperateIp(operateIp);
|
|
|
+
|
|
|
+ autoUpdateAccountPwdLogMapper.insert(log);
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getRealAddressByIP(String ip) {
|
|
|
+ if (StrUtil.isBlank(ip)) {
|
|
|
+ return "unknown";
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ String rspStr = HttpUtil.get("http://whois.pconline.com.cn/ipJson.jsp?ip=" + ip + "&json=true");
|
|
|
+ if (StrUtil.isEmpty(rspStr)) {
|
|
|
+ log.error("获取地理位置异常 {}", ip);
|
|
|
+ return "unknown";
|
|
|
+ }
|
|
|
+ JSONObject obj = JSONUtil.parseObj(rspStr);
|
|
|
+ String region = obj.getStr("pro");
|
|
|
+ String city = obj.getStr("city");
|
|
|
+ return String.format("%s %s", region, city);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("获取地理位置异常 {}", ip);
|
|
|
+ }
|
|
|
+
|
|
|
+ return "unknown";
|
|
|
+ }
|
|
|
}
|