Commit b4f2ee2e authored by Quxl's avatar Quxl

x

parent a5469903
...@@ -11,6 +11,7 @@ import org.springframework.web.servlet.ModelAndView; ...@@ -11,6 +11,7 @@ import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.json.MappingJackson2JsonView; import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
import com.egolm.shop.util.I18NUtils;
@Component @Component
public class ExceptionHandler implements HandlerExceptionResolver { public class ExceptionHandler implements HandlerExceptionResolver {
...@@ -19,16 +20,17 @@ public class ExceptionHandler implements HandlerExceptionResolver { ...@@ -19,16 +20,17 @@ public class ExceptionHandler implements HandlerExceptionResolver {
@Override @Override
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
String langID = request.getParameter("langID");
ModelAndView mav = new ModelAndView(new MappingJackson2JsonView()); ModelAndView mav = new ModelAndView(new MappingJackson2JsonView());
try { try {
response.setContentType("application/json"); response.setContentType("application/json");
if (ex instanceof XException) { if (ex instanceof XException) {
mav.addAllObjects(((XException) ex).getRjx()); mav.addAllObjects(((XException) ex).getRjx());
} else { } else {
mav.addAllObjects(Rjx.jsonErr().setMessage("未处理异常[" + ex.getClass().getName() + ":" + ex.getMessage() + "]")); mav.addAllObjects(Rjx.jsonErr().setMessage(I18NUtils.getMessage(langID, "Msg_Unknow_error")));
} }
} catch (Exception e) { } catch (Exception e) {
mav.addAllObjects(Rjx.jsonErr().setMessage("异常处理失败")); mav.addAllObjects(Rjx.jsonErr().setMessage(I18NUtils.getMessage(langID, "Msg_Exception_processFailure")));
} finally { } finally {
logger.error("", ex); logger.error("", ex);
} }
......
package com.egolm.shop.controller; package com.egolm.shop.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -7,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -7,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.bean.Rjx;
import com.egolm.shop.service.CommonService; import com.egolm.shop.service.CommonService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -37,7 +41,6 @@ public class CommonController { ...@@ -37,7 +41,6 @@ public class CommonController {
return commonService.queryDistrictByOrgNO(orgNO, langID); return commonService.queryDistrictByOrgNO(orgNO, langID);
} }
@ApiOperation("获取已开通的城市") @ApiOperation("获取已开通的城市")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
...@@ -50,4 +53,20 @@ public class CommonController { ...@@ -50,4 +53,20 @@ public class CommonController {
String langID = request.getParameter("langID"); String langID = request.getParameter("langID");
return commonService.getOpenCity(langID); return commonService.getOpenCity(langID);
} }
@ApiOperation("获取共同参数")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getCommonArgs",method=RequestMethod.GET)
public String getCommonArgs(HttpServletRequest request) {
String langID = request.getParameter("langID");
String commonNO = request.getParameter("commonNO");
List<Map<String, Object>> list = commonService.getCommonArgs(langID, commonNO);
return Rjx.jsonOk().set("list", list).toJson();
}
} }
...@@ -169,4 +169,66 @@ public class UserController { ...@@ -169,4 +169,66 @@ public class UserController {
params.put("content",content); params.put("content",content);
return userService.sendSms(params); return userService.sendSms(params);
} }
@ApiOperation("修改认证信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "int", name = "shopId", value = "店铺ID"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "shopName", value = "店铺名称"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "provinceId", value = "省ID"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "cityId", value = "市ID"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "districtId", value = "区ID"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "address", value = "详细地址"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "certifTypeID", value = "店铺证件类型 A.营业执照"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "certifNO", value = "店铺证件号码"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "certifPicUrl", value = "店铺证件图片URL"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "bankTypeID", value = "银行ID"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "bankType", value = "银行名称"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "bankCardNO", value = "银行卡号"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "customerName", value = "客户姓名"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "email", value = "邮箱"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "memo", value = "备注"),
/*=======================================================分界线=================================================================*/
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/modifyShopAuthInfo",method=RequestMethod.GET)
public String modifyShopAuthInfo(
Integer shopId,
String shopName,
String provinceId,
String cityId,
String districtId,
String address,
String certifTypeID,
String certifNO,
String certifPicUrl,
String bankTypeID,
String bankType,
String bankCardNO,
String customerName,
String email,
String memo,
String langID,
HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("shopId", shopId);
parameters.put("shopName", shopName);
parameters.put("provinceId", provinceId);
parameters.put("cityId", cityId);
parameters.put("districtId", districtId);
parameters.put("address", address);
parameters.put("certifTypeID", certifTypeID);
parameters.put("certifNO", certifNO);
parameters.put("certifPicUrl", certifPicUrl);
parameters.put("bankTypeID", bankTypeID);
parameters.put("bankType", bankType);
parameters.put("bankCardNO", bankCardNO);
parameters.put("customerName", customerName);
parameters.put("email", email);
parameters.put("memo", memo);
parameters.put("langID", langID);
return userService.modifyShopAuthInfo(parameters);
}
} }
package com.egolm.shop.service; package com.egolm.shop.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.egolm.shop.pojo.TCommon; import com.egolm.shop.pojo.TCommon;
...@@ -20,4 +21,6 @@ public interface CommonService { ...@@ -20,4 +21,6 @@ public interface CommonService {
public String queryDistrictByOrgNO(String orgNO,String langID) ; public String queryDistrictByOrgNO(String orgNO,String langID) ;
public String getOpenCity(String langID) ; public String getOpenCity(String langID) ;
public List<Map<String, Object>> getCommonArgs(String langID, String commonNO);
} }
...@@ -21,4 +21,6 @@ public interface UserService { ...@@ -21,4 +21,6 @@ public interface UserService {
public String sendSms(Map<String,Object> params); public String sendSms(Map<String,Object> params);
public boolean checkShopExists(String custNO,String shopNO); public boolean checkShopExists(String custNO,String shopNO);
public String modifyShopAuthInfo(Map<String, Object> parameters);
} }
...@@ -169,4 +169,33 @@ public class CommonServiceImpl implements CommonService{ ...@@ -169,4 +169,33 @@ public class CommonServiceImpl implements CommonService{
} }
return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_Province_getfailure")).toJson(); return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_Province_getfailure")).toJson();
} }
@Override
public List<Map<String, Object>> getCommonArgs(String langID, String commonNO) {
String sql = ""
+ "SELECT "
+ "DISTINCT "
+ "CommonNO = a.sCommonNO, "
+ "ComID = a.sComID, "
+ "ComName = isnull( b.sValue1, a.sComDesc ), "
+ "Num = a.nNum1, "
+ "Text = a.sText1, "
+ "Memo = a.sMemo "
+ "FROM "
+ "tCommon a "
+ "LEFT JOIN "
+ "t_frm_LangPack b "
+ "ON "
+ "b.sLangType = 'Common' "
+ "AND b.sKey1 = a.sCommonNO "
+ "AND b.sKey2 = a.sComID "
+ "AND b.sLangID = ? "
+ "WHERE "
+ "a.sCommonNO = ? "
+ "AND a.nTag& 1 = 0 "
+ "ORDER BY "
+ "a.sComID";
return jdbcTemplate.queryForList(sql, langID, commonNO);
}
} }
...@@ -400,5 +400,50 @@ public class UserServiceImpl implements UserService { ...@@ -400,5 +400,50 @@ public class UserServiceImpl implements UserService {
} }
return false; return false;
} }
@Override
public String modifyShopAuthInfo(Map<String, Object> parameters) {
String langID = (String)parameters.get("langID");
Integer shopId = (Integer)parameters.get("shopId");
Map<String, Object> map = jdbcTemplate.queryForMap("select sShopNO, sCustNO from tShop where nShopID = ?", shopId);
String shopNo = (String)map.get("sShopNO");
String custNo = (String)map.get("sCustNO");
String shopName = (String)parameters.get("shopName");
String provinceId = (String)parameters.get("provinceId");
String cityId = (String)parameters.get("cityId");
String districtId = (String)parameters.get("districtId");
String address = (String)parameters.get("address");
String certifTypeID = (String)parameters.get("certifTypeID");
String certifNO = (String)parameters.get("certifNO");
String certifPicUrl = (String)parameters.get("certifPicUrl");
String bankTypeID = (String)parameters.get("bankTypeID");
String bankType = (String)parameters.get("bankType");
String bankCardNO = (String)parameters.get("bankCardNO");
String customerName = (String)parameters.get("customerName");
String email = (String)parameters.get("email");
String memo = (String)parameters.get("memo");
String sql = "update tCustomer c, tShop s set c.sCustomerName = ?, s.sShopName = ?, s.sProvinceID = ?, s.sCityID = ?, s.sDistrictID = ?, s.sAddress = ?, s.sEmail = ?, s.sMemo = ? where c.sCustNO = s.sCustNO and s.nShopID = ?";
jdbcTemplate.update(sql, customerName, shopName, provinceId, cityId, districtId, address, email, memo, shopId);
int count = jdbcTemplate.queryForInt("select count(*) from tShopCertif where sShopNO = ? and sCertifTypeID = ? and sCertifNO = ?", new Object[] {shopNo, certifTypeID, certifNO});
if(count == 0) {
String sqlInsert = "insert into tShopCertif (sShopNO, sCertifTypeID, sCertifType, sCertifNO, dValidDate, dExpiryDate, nTag, sCreateUser, dCreateDate, dLastUpdateTime) values (?, ?, '', ?, getdate(), ?, 0, '', getdate(), getdate())";
Object[] args = new Object[] {shopNo, certifTypeID, certifNO, new Date(System.currentTimeMillis() + (1000L*60*60*24*365*100))};
jdbcTemplate.update(sqlInsert, args);
}
Integer itemId = jdbcTemplate.queryForInt("select max(nItem) from tShopCertifPic where sShopNO = ? and sCertifTypeID = ? and sCertifNO = ?", shopNo, certifTypeID, certifNO);
String insertPicSql = "insert into tShopCertifPic (sShopNO, sCertifTypeID, sCertifNO, nItem, sPicDesc, sURL, sCreateUser, dCreateDate, dLastUpdateTime) values (?, ?, ?, ?, '', ?, '', getdate(), getdate())";
Object[] insertPicArgs = new Object[] {shopNo, certifTypeID, certifNO, ++itemId, certifPicUrl};
jdbcTemplate.update(insertPicSql, insertPicArgs);
int countBankCard = jdbcTemplate.queryForInt("select count(*) from tCustBank where sCustNO = ? and sBankAccountNO = ?", custNo, bankCardNO);
if(countBankCard > 0) {
jdbcTemplate.update("update tCustBank set sBankTypeID = ?, sBankType = ?, sBankAccount = ? where sCustNO = ? and sBankAccountNO = ?", bankTypeID, bankType, bankCardNO, custNo, bankCardNO);
} else {
String sqlBankInsert = "insert into tCustBank (sCustNO, sBankTypeID, sBankType, sBankAccountNO, sBankAccount, nTag, sCreateUser, dCreateDate, dLastUpdateTime) values (?, ?, ?, ?, ?, 0, '', getdate(), getdate())";
Object[] sqlBankInsertArgs = new Object[] {custNo, bankTypeID, bankType, bankCardNO, bankCardNO};
jdbcTemplate.update(sqlBankInsert, sqlBankInsertArgs);
}
return Rjx.jsonOk().setMessage(I18NUtils.getMessage(langID, "Msg_SMS_success")).toJson();
}
} }
...@@ -14,7 +14,7 @@ spring.http.encoding.charset=utf-8 ...@@ -14,7 +14,7 @@ spring.http.encoding.charset=utf-8
spring.datasource.username=ERP spring.datasource.username=ERP
spring.datasource.password=qiyang@2013 spring.datasource.password=qiyang@2013
spring.datasource.url=jdbc:sqlserver://10.10.0.22:1433;instanceName=SQLSERVER;DatabaseName=EGOLMDEV spring.datasource.url=jdbc:sqlserver://10.10.0.22:1433;instanceName=SQLSERVER;DatabaseName=B2BDB
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.testWhileIdle=true spring.datasource.testWhileIdle=true
spring.datasource.validationQueryTimeout=5 spring.datasource.validationQueryTimeout=5
......
Msg_Unknow_error=Unknow exception
Msg_Exception_processFailure=Exception process failed
Msg_Parameter_empty= Parameters can not be empty Msg_Parameter_empty= Parameters can not be empty
Msg_DataDictionary_query_error=Data dictionary query error Msg_DataDictionary_query_error=Data dictionary query error
Msg_Must_enter=must be entered Msg_Must_enter=must be entered
......
Msg_Unknow_error=\u672A\u77E5\u5F02\u5E38
Msg_Exception_processFailure=\u5F02\u5E38\u5904\u7406\u5931\u8D25
Msg_Parameter_empty=\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A Msg_Parameter_empty=\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A
Msg_DataDictionary_query_error=\u6570\u636E\u5B57\u5178\u67E5\u8BE2\u51FA\u9519 Msg_DataDictionary_query_error=\u6570\u636E\u5B57\u5178\u67E5\u8BE2\u51FA\u9519
Msg_Must_enter=\u4E3A\u5FC5\u586B\u9879 Msg_Must_enter=\u4E3A\u5FC5\u586B\u9879
......
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