Commit dc22513e authored by 张永's avatar 张永

需求 #17240

parent a916094f
...@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.StringUtil; import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
import com.egolm.common.web.ServletUtil;
import com.egolm.shop.api.service.UserService; import com.egolm.shop.api.service.UserService;
import com.egolm.shop.bean.TCustomer; import com.egolm.shop.bean.TCustomer;
import com.egolm.shop.common.XException; import com.egolm.shop.common.XException;
...@@ -210,7 +211,8 @@ public class UserController { ...@@ -210,7 +211,8 @@ public class UserController {
XException.assertNotBlank(openId, "OpenID不能为空"); XException.assertNotBlank(openId, "OpenID不能为空");
mobile = StringUtil.isBlank(mobile) ? "" : mobile; mobile = StringUtil.isBlank(mobile) ? "" : mobile;
name = StringUtil.isBlank(name) ? "" : name; name = StringUtil.isBlank(name) ? "" : name;
Map<String, Object> map = userService.loginByOpenId(appId,orgNo, openId, mobile, unionId, name); String clientIp = ServletUtil.remoteIp(request);
Map<String, Object> map = userService.loginByOpenId(appId,orgNo, openId, mobile, unionId, name,clientIp);
Rjx rjx = Rjx.jsonOk(); Rjx rjx = Rjx.jsonOk();
rjx.putAll(map); rjx.putAll(map);
return rjx.toJson(); return rjx.toJson();
......
...@@ -49,7 +49,7 @@ public interface UserService { ...@@ -49,7 +49,7 @@ public interface UserService {
public List<Map<String, Object>> queryBankList(String sCustNO); public List<Map<String, Object>> queryBankList(String sCustNO);
public Map<String, Object> loginByOpenId(String appId,String orgNo, String openId, String mobile, String unionId, String name); public Map<String, Object> loginByOpenId(String appId,String orgNo, String openId, String mobile, String unionId, String name,String clientIp);
public Map<String, Object> loginUpdateOpenId(String appId,String orgNo, String openId, String mobile, String unionId, String name); public Map<String, Object> loginUpdateOpenId(String appId,String orgNo, String openId, String mobile, String unionId, String name);
......
...@@ -18,6 +18,7 @@ import org.apache.commons.logging.LogFactory; ...@@ -18,6 +18,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.DuplicateKeyException;
import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
...@@ -861,7 +862,7 @@ public class UserServiceImpl implements UserService { ...@@ -861,7 +862,7 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
public Map<String, Object> loginByOpenId(String appId,String orgNo, String openId, String mobile, String unionId, String name) { public Map<String, Object> loginByOpenId(String appId,String orgNo, String openId, String mobile, String unionId, String name,String clientIp) {
mobile = StringUtil.isBlank(mobile) ? null : mobile; mobile = StringUtil.isBlank(mobile) ? null : mobile;
String sql = "exec up_B2BUserLogin ?, ?, ?, ?, ?,?"; String sql = "exec up_B2BUserLogin ?, ?, ?, ?, ?,?";
ResultMutil result = readJdbcTemplate.executeMutil(sql, orgNo, openId, mobile, unionId, name,appId); ResultMutil result = readJdbcTemplate.executeMutil(sql, orgNo, openId, mobile, unionId, name,appId);
...@@ -891,9 +892,22 @@ public class UserServiceImpl implements UserService { ...@@ -891,9 +892,22 @@ public class UserServiceImpl implements UserService {
map.put("shopList", shopList); map.put("shopList", shopList);
map.put("payServiceList", payServiceList); map.put("payServiceList", payServiceList);
map.put("shopAgentList", shopAgentList); map.put("shopAgentList", shopAgentList);
addCustLoginLog(uMap.get("sUserNO")+"", openId, clientIp);
return map; return map;
} }
} }
//需求 #17240
public void addCustLoginLog(String custNO,String openId,String ip) {
try {
String sql = "INSERT INTO dbo.tCustLoginLog (sCustNO, dLoginTime, sLoginSite, sIPAddress, sTerminalTypeID, sTerminalType, dLastUpdateTime) "
+ " VALUES ('"+custNO+"', getdate(), '"+openId+"', '"+ip+"', 'wx', '', getdate()) ";
jdbcTemplate.execute(sql);
} catch (Exception e) {
logger.info("保存tCustLoginLog 日志失败 ,custNO="+custNO+",openId="+openId+",ip="+ip+" "+e);
}
}
@Override @Override
public Map<String, Object> loginUpdateOpenId(String appId,String orgNo, String openId, String mobile, String unionId, String name) { public Map<String, Object> loginUpdateOpenId(String appId,String orgNo, String openId, String mobile, String unionId, String name) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment