package com.yc.sdk.shopping.service;
|
|
import org.springframework.context.annotation.Scope;
|
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.EmptyResultDataAccessException;
|
import org.springframework.stereotype.Service;
|
|
import com.yc.action.grid.GridUtils;
|
import com.yc.service.BaseService;
|
|
@Service("UserSettingImpl")
|
@Scope("prototype")
|
public class UserSettingImpl extends BaseService implements UserSettingIfc {
|
|
@Override
|
public Integer changeCurrency(String userCode,String currency,Integer logonType) {
|
// logonType : 0表示登录号用户 ,1 表示客户,2 表示工号, 3 表示供应商
|
if (logonType == null) logonType = 0 ;
|
String sql = "set nocount on ;"
|
+ " update a set Currency = "+GridUtils.prossSqlParm(currency)+" from _sysuser a where UserCode= "+GridUtils.prossSqlParm(userCode)+" ; select @@rowcount ; " ;
|
String sql1 = "set nocount on ;"
|
+ " update a set Currency = "+GridUtils.prossSqlParm(currency)+" from t110203 a where CltCode = "+GridUtils.prossSqlParm(userCode)+" ; select @@rowcount ; " ;
|
String sql2 = "set nocount on ;"
|
+ " update a set Currency = "+GridUtils.prossSqlParm(currency)+" from t180201 a where HrCode = "+GridUtils.prossSqlParm(userCode)+" ; select @@rowcount ; " ;
|
String sql3 = "set nocount on ;"
|
+ " update a set Currency = "+GridUtils.prossSqlParm(currency)+" from t110302 a where VndCode = "+GridUtils.prossSqlParm(userCode)+" ; select @@rowcount ; " ;
|
try {
|
Integer ret = null ;
|
if (logonType == 0) ret = this.jdbcTemplate.queryForObject(sql,Integer.class) ;
|
if (logonType == 1) ret = this.jdbcTemplate.queryForObject(sql1,Integer.class) ;
|
if (logonType == 2) ret = this.jdbcTemplate.queryForObject(sql2,Integer.class) ;
|
if (logonType == 3) ret = this.jdbcTemplate.queryForObject(sql3,Integer.class) ;
|
return ret;
|
}catch(DataAccessException e ) {
|
if (e instanceof EmptyResultDataAccessException){
|
return null ;
|
}else {
|
e.printStackTrace();
|
throw e;
|
}
|
}catch(Exception e){
|
e.printStackTrace();
|
throw e;
|
}
|
}
|
|
@Override
|
public Integer changeLang(String userCode,Integer langId,Integer logonType) {
|
// logonType : 0表示登录号用户 ,1 表示客户,2 表示工号, 3 表示供应商
|
if (logonType == null) logonType = 0 ;
|
String sql = "set nocount on ;"
|
+ " update a set LangId = "+langId+" from _sysuser a where UserCode= "+GridUtils.prossSqlParm(userCode)+" ; select @@rowcount ; " ;
|
String sql1 = "set nocount on ;"
|
+ " update a set LangId = "+langId+" from t110203 a where CltCode = "+GridUtils.prossSqlParm(userCode)+" ; select @@rowcount ; " ;
|
String sql2 = "set nocount on ;"
|
+ " update a set Currency = "+langId+" from t180201 a where HrCode = "+GridUtils.prossSqlParm(userCode)+" ; select @@rowcount ; " ;
|
String sql3 = "set nocount on ;"
|
+ " update a set LangId = "+langId+" from t110302 a where VndCode = "+GridUtils.prossSqlParm(userCode)+" ; select @@rowcount ; " ;
|
try {
|
Integer ret = null ;
|
if (logonType == 0) ret = this.jdbcTemplate.queryForObject(sql,Integer.class) ;
|
if (logonType == 1) ret = this.jdbcTemplate.queryForObject(sql1,Integer.class) ;
|
if (logonType == 2) ret = this.jdbcTemplate.queryForObject(sql2,Integer.class) ;
|
if (logonType == 3) ret = this.jdbcTemplate.queryForObject(sql3,Integer.class) ;
|
return ret;
|
}catch(DataAccessException e ) {
|
if (e instanceof EmptyResultDataAccessException){
|
return null ;
|
}else {
|
e.printStackTrace();
|
throw e;
|
}
|
}catch(Exception e){
|
e.printStackTrace();
|
throw e;
|
}
|
}
|
}
|