Commit aeefd973 authored by Quxl's avatar Quxl

Merge branch 'master' of http://key@gitlab.egolm.com/key/shop.git

parents d6fe724a e40da28b
package com.egolm.shop.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.shop.config.XException;
import com.egolm.shop.pojo.TCustomer;
import com.egolm.shop.service.UserService;
import com.egolm.shop.util.I18NUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags={"用户接口"})
@RestController
@RequestMapping("user")
public class UserController {
@Autowired
private UserService userService;
@ApiOperation("创建游客账号")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "districtID", dataType = "String", required = true, value = "区域编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "组织机构", defaultValue = "SHBS"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, 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 = "/createGuest",method=RequestMethod.GET)
public String createGuest(HttpServletRequest request, HttpServletResponse response) {
Map<String,Object> params=new HashMap<>();
params.put("orgNO", request.getParameter("orgNO"));
params.put("districtID", request.getParameter("districtID")==null?"":request.getParameter("districtID"));
params.put("langID", request.getParameter("langID")==null?936:request.getParameter("langID"));
Map<String,Object> custMap = userService.createGuest(params);
return Rjx.jsonOk().set("custInfo",custMap).toString();
}
@ApiOperation("登陆")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "userNO", dataType = "String", required = false, value = "账号(账号/名称/手机号)", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "password", dataType = "String", required = false, value = "密码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "openID", dataType = "String", required = false, value = "openID(优先级小于账号)", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, 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 = "/login",method=RequestMethod.POST)
public String login(HttpServletRequest request, HttpServletResponse response) {
String userNO = request.getParameter("userNO")==null?"":request.getParameter("userNO");
String password = request.getParameter("password")==null?"":request.getParameter("password");
String openID = request.getParameter("openID");
Map<String,Object> params = new HashMap<String,Object>();
params.put("userNO", userNO);
params.put("password", password);
params.put("openID", openID);
return userService.login(params);
}
@ApiOperation("获取用户信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "custNO", dataType = "String", required = true, value = "账号编码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = false, value = "店铺编号", defaultValue = ""),
@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 = "/userInfo",method=RequestMethod.GET)
public String userInfo(HttpServletRequest request, HttpServletResponse response) {
String custNO = request.getParameter("custNO");
String shopNO = request.getParameter("shopNO")==null?"":request.getParameter("shopNO");
System.out.println("shopNO===="+StringUtil.isNotEmpty(shopNO));
TCustomer tCustomer = userService.getCustomer(custNO, shopNO);
Map<String,Object> resultMap = new HashMap<String,Object>();
if(tCustomer != null) {
resultMap.put("custNO",tCustomer.getsCustNO());
resultMap.put("custName", tCustomer.getsCustName());
resultMap.put("custLevelTypeId", tCustomer.getsCustLeveTypeID());
resultMap.put("custLevelType", tCustomer.getsCustLeveType()+"");
resultMap.put("point", tCustomer.getnPoint()+"");
resultMap.put("mobile", tCustomer.getsMobile()+"");
resultMap.put("custTypeID", tCustomer.getsCustTypeID()+"");
resultMap.put("openID", tCustomer.getsOpenID());
resultMap.put("shopList", tCustomer.gettShops());
}
return Rjx.jsonOk().setData(resultMap).toJson();
}
@ApiOperation("修改密码")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "mobile", dataType = "String", required = true, value = "手机号码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "password", dataType = "String", required = true, value = "店铺编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "smsCode", dataType = "String", required = true, value = "短信验证码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "smsTmpID", dataType = "String", required = true, value = "短信模板ID", defaultValue = ""),
@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 = "/modifyPwd",method=RequestMethod.POST)
public String modifyPwd(HttpServletRequest request, HttpServletResponse response) {
String mobile = request.getParameter("mobile");
String password = request.getParameter("password")==null?"":request.getParameter("password");
String smsCode = request.getParameter("smsCode")==null?"":request.getParameter("smsCode");
String langID = request.getParameter("langID")==null?"936":request.getParameter("langID");
String smsTmpID = request.getParameter("smsTmpID")==null?"936":request.getParameter("smsTmpID");
Map<String,Object> params = new HashMap<String,Object>();
params.put("mobile", mobile);
params.put("password", password);
params.put("smsCode", smsCode);
params.put("langID", langID);
params.put("smsTmpID", smsTmpID);
return userService.modifyPwd(params);
}
@ApiOperation("发送短信")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "mobile", dataType = "String", required = true, value = "手机号码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "smsTmpID", dataType = "String", required = true, value = "短信模板ID(看TCommon表中SmsTemplate的值)", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "content", dataType = "String", required = true, value = "内容,按模板上的参数填值,以,分隔", defaultValue = ""),
@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 = "/sendSms",method=RequestMethod.GET)
public String sendSms(HttpServletRequest request, HttpServletResponse response) {
String mobile = request.getParameter("mobile");
String smsTmpID = request.getParameter("smsTmpID");
String content = request.getParameter("content");
String langID = request.getParameter("langID");
Map<String,Object> params = new HashMap<String,Object>();
params.put("mobile", mobile);
params.put("langID", langID);
params.put("smsTmpID", smsTmpID);
params.put("content",content);
return userService.sendSms(params);
}
@ApiOperation("小程序注销")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "openId", dataType = "String", required = false, value = "OPENID", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, 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 = "/logoutByOpenId",method=RequestMethod.POST)
public String logoutByOpenId(String openId, String langID, HttpServletRequest request, HttpServletResponse response) {
userService.deleteOpenId(openId);
return Rjx.jsonOk().toJson();
}
@ApiOperation("小程序登陆")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "openId", dataType = "String", required = false, value = "OPENID", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "unionId", dataType = "String", required = false, value = "unionId", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "mobile", dataType = "String", required = false, value = "手机号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = false, value = "orgNo", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, 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 = "/loginByOpenId",method=RequestMethod.POST)
public String loginByOpenId(String openId, String mobile, String orgNo, String name, String unionId, String langID, HttpServletRequest request, HttpServletResponse response) {
XException.assertNotBlank(orgNo, "组织机构不能为空");
XException.assertNotBlank(openId, "OpenID不能为空");
mobile = StringUtil.isBlank(mobile) ? "" : mobile;
name = StringUtil.isBlank(name) ? "" : name;
Map<String, Object> map = userService.loginByOpenId(orgNo, openId, mobile, name);
Rjx rjx = Rjx.jsonOk();
rjx.putAll(map);
return rjx.toJson();
}
@ApiOperation("修改认证信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "string", name = "shopNo", value = "店铺ID", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "shopName", value = "店铺名称", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "provinceId", value = "省ID", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "cityId", value = "市ID", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "districtId", value = "区ID", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "address", value = "详细地址", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "certifTypeID", value = "店铺证件类型 A.营业执照", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "certifNO", value = "店铺证件号码", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "certifPicUrl", value = "店铺证件图片URL", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "bankTypeID", value = "银行ID", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "bankType", value = "银行名称", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "bankCardNO", value = "银行卡号", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "customerName", value = "客户姓名", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "email", value = "邮箱"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "memo", value = "备注"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "salesmanNO1", value = "业务员编号"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "mainBusiness", value = "主营业务"),
@ApiImplicitParam(paramType = "query", dataType = "int", name = "storeCount", 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.POST)
public String modifyShopAuthInfo(
String shopNo,
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,
String salesmanNO1,
String mainBusiness,
Integer storeCount,
HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("shopNo", shopNo);
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);
parameters.put("salesmanNO1", salesmanNO1);
parameters.put("mainBusiness", mainBusiness);
parameters.put("storeCount", storeCount);
return userService.modifyShopAuthInfo(parameters);
}
@ApiOperation("查询认证信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "string", name = "shopNo", required=true),
@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 = "/queryShopAuthInfo",method=RequestMethod.GET)
public String queryShopAuthInfo(String shopNo, String langID) {
return userService.queryShopAuthInfo(shopNo, langID);
}
@ApiOperation("根据OPENID获取用户信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "openId", dataType = "String", required = false, value = "OPENID", defaultValue = ""),
@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 = "/queryUserInfoByOpenId",method=RequestMethod.GET)
public String queryUserInfoByOpenId(String orgNo, String openId, String langID, HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> customerMap = userService.queryCustomerByOpenId(openId);
if(customerMap == null) {
return Rjx.jsonErr().setCode(201).setMessage(I18NUtils.getMessage(langID, "Msg_OpenID_notExist")).toJson();
}
String sCustNO = (String)customerMap.get("sCustNO");
List<Map<String, Object>> bankList = userService.queryBankList(sCustNO);
List<Map<String, Object>> shopList = userService.queryShopList(orgNo, sCustNO);
for(Map<String, Object> shopMap : shopList) {
String sOrgNO = (String)shopMap.get("sOrgNO");
if(orgNo.equals(sOrgNO)) {
customerMap.put("sShopNO", shopMap.get("sShopNO"));
break;
}
}
customerMap.put("nShopID", shopList.get(0).get("nShopID"));
customerMap.put("sEmail", shopList.get(0).get("sEmail"));
customerMap.put("sShopName", shopList.get(0).get("sShopName"));
return Rjx.jsonOk().set("customer", customerMap).set("bankList", bankList).set("shopList", shopList).setMessage(I18NUtils.getMessage(langID, "Msg_Login_success")).toJson();
}
@ApiOperation("根据店铺编号查询业务员")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "shopNo", dataType = "String", required = false),
@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 = "/getSalesmanByShopNo",method=RequestMethod.GET)
public String getSalesmanByShopNo(String shopNo) {
Map<String, Object> map = userService.getSalesmanByShopNo(shopNo);
return Rjx.jsonOk().set("data", map).toJson();
}
@ApiOperation("查询个人信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "custNo", dataType = "String", required = false),
@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 = "/getCustomer",method=RequestMethod.GET)
public String getCustomer(String custNo) {
Map<String, Object> map = userService.getCustomerByNO(custNo);
return Rjx.jsonOk().set("data", map).toJson();
}
@ApiOperation("修改个人信息邮箱")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "custNo", dataType = "String", required = false),
@ApiImplicitParam(paramType = "query", name = "email", dataType = "String", required = false),
@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 = "/updateCustomerEmail",method=RequestMethod.GET)
public String updateCustomerEmail(String custNo, String email) {
userService.updateCustomerEmail(custNo, email);
return Rjx.jsonOk().toJson();
}
}
package com.egolm.shop.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.shop.config.XException;
import com.egolm.shop.pojo.TCustomer;
import com.egolm.shop.service.UserService;
import com.egolm.shop.util.I18NUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags={"用户接口"})
@RestController
@RequestMapping("user")
public class UserController {
@Autowired
private UserService userService;
@ApiOperation("创建游客账号")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "districtID", dataType = "String", required = true, value = "区域编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "组织机构", defaultValue = "SHBS"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, 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 = "/createGuest",method=RequestMethod.GET)
public String createGuest(HttpServletRequest request, HttpServletResponse response) {
Map<String,Object> params=new HashMap<>();
params.put("orgNO", request.getParameter("orgNO"));
params.put("districtID", request.getParameter("districtID")==null?"":request.getParameter("districtID"));
params.put("langID", request.getParameter("langID")==null?936:request.getParameter("langID"));
Map<String,Object> custMap = userService.createGuest(params);
return Rjx.jsonOk().set("custInfo",custMap).toString();
}
@ApiOperation("登陆")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "userNO", dataType = "String", required = false, value = "账号(账号/名称/手机号)", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "password", dataType = "String", required = false, value = "密码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "openID", dataType = "String", required = false, value = "openID(优先级小于账号)", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, 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 = "/login",method=RequestMethod.POST)
public String login(HttpServletRequest request, HttpServletResponse response) {
String userNO = request.getParameter("userNO")==null?"":request.getParameter("userNO");
String password = request.getParameter("password")==null?"":request.getParameter("password");
String openID = request.getParameter("openID");
Map<String,Object> params = new HashMap<String,Object>();
params.put("userNO", userNO);
params.put("password", password);
params.put("openID", openID);
return userService.login(params);
}
@ApiOperation("获取用户信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "custNO", dataType = "String", required = true, value = "账号编码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = false, value = "店铺编号", defaultValue = ""),
@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 = "/userInfo",method=RequestMethod.GET)
public String userInfo(HttpServletRequest request, HttpServletResponse response) {
String custNO = request.getParameter("custNO");
String shopNO = request.getParameter("shopNO")==null?"":request.getParameter("shopNO");
System.out.println("shopNO===="+StringUtil.isNotEmpty(shopNO));
TCustomer tCustomer = userService.getCustomer(custNO, shopNO);
Map<String,Object> resultMap = new HashMap<String,Object>();
if(tCustomer != null) {
resultMap.put("custNO",tCustomer.getsCustNO());
resultMap.put("custName", tCustomer.getsCustName());
resultMap.put("custLevelTypeId", tCustomer.getsCustLeveTypeID());
resultMap.put("custLevelType", tCustomer.getsCustLeveType()+"");
resultMap.put("point", tCustomer.getnPoint()+"");
resultMap.put("mobile", tCustomer.getsMobile()+"");
resultMap.put("custTypeID", tCustomer.getsCustTypeID()+"");
resultMap.put("openID", tCustomer.getsOpenID());
resultMap.put("shopList", tCustomer.gettShops());
}
return Rjx.jsonOk().setData(resultMap).toJson();
}
@ApiOperation("修改密码")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "mobile", dataType = "String", required = true, value = "手机号码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "password", dataType = "String", required = true, value = "店铺编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "smsCode", dataType = "String", required = true, value = "短信验证码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "smsTmpID", dataType = "String", required = true, value = "短信模板ID", defaultValue = ""),
@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 = "/modifyPwd",method=RequestMethod.POST)
public String modifyPwd(HttpServletRequest request, HttpServletResponse response) {
String mobile = request.getParameter("mobile");
String password = request.getParameter("password")==null?"":request.getParameter("password");
String smsCode = request.getParameter("smsCode")==null?"":request.getParameter("smsCode");
String langID = request.getParameter("langID")==null?"936":request.getParameter("langID");
String smsTmpID = request.getParameter("smsTmpID")==null?"936":request.getParameter("smsTmpID");
Map<String,Object> params = new HashMap<String,Object>();
params.put("mobile", mobile);
params.put("password", password);
params.put("smsCode", smsCode);
params.put("langID", langID);
params.put("smsTmpID", smsTmpID);
return userService.modifyPwd(params);
}
@ApiOperation("发送短信")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "mobile", dataType = "String", required = true, value = "手机号码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "smsTmpID", dataType = "String", required = true, value = "短信模板ID(看TCommon表中SmsTemplate的值)", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "content", dataType = "String", required = true, value = "内容,按模板上的参数填值,以,分隔", defaultValue = ""),
@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 = "/sendSms",method=RequestMethod.GET)
public String sendSms(HttpServletRequest request, HttpServletResponse response) {
String mobile = request.getParameter("mobile");
String smsTmpID = request.getParameter("smsTmpID");
String content = request.getParameter("content");
String langID = request.getParameter("langID");
Map<String,Object> params = new HashMap<String,Object>();
params.put("mobile", mobile);
params.put("langID", langID);
params.put("smsTmpID", smsTmpID);
params.put("content",content);
return userService.sendSms(params);
}
@ApiOperation("小程序注销")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "openId", dataType = "String", required = false, value = "OPENID", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, 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 = "/logoutByOpenId",method=RequestMethod.POST)
public String logoutByOpenId(String openId, String langID, HttpServletRequest request, HttpServletResponse response) {
userService.deleteOpenId(openId);
return Rjx.jsonOk().toJson();
}
@ApiOperation("小程序登陆")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "openId", dataType = "String", required = false, value = "OPENID", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "unionId", dataType = "String", required = false, value = "unionId", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "mobile", dataType = "String", required = false, value = "手机号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = false, value = "orgNo", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, 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 = "/loginByOpenId",method=RequestMethod.POST)
public String loginByOpenId(String openId, String mobile, String orgNo, String name, String unionId, String langID, HttpServletRequest request, HttpServletResponse response) {
XException.assertNotBlank(orgNo, "组织机构不能为空");
XException.assertNotBlank(openId, "OpenID不能为空");
mobile = StringUtil.isBlank(mobile) ? "" : mobile;
name = StringUtil.isBlank(name) ? "" : name;
Map<String, Object> map = userService.loginByOpenId(orgNo, openId, mobile, name);
Rjx rjx = Rjx.jsonOk();
rjx.putAll(map);
return rjx.toJson();
}
@ApiOperation("修改认证信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "string", name = "shopNo", value = "店铺ID", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "shopName", value = "店铺名称", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "provinceId", value = "省ID", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "cityId", value = "市ID", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "districtId", value = "区ID", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "address", value = "详细地址", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "certifTypeID", value = "店铺证件类型 A.营业执照", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "certifNO", value = "店铺证件号码", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "certifPicUrl", value = "店铺证件图片URL", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "bankTypeID", value = "银行ID", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "bankType", value = "银行名称", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "bankCardNO", value = "银行卡号", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "customerName", value = "客户姓名", required=true),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "email", value = "邮箱"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "memo", value = "备注"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "salesmanNO1", value = "业务员编号"),
@ApiImplicitParam(paramType = "query", dataType = "string", name = "mainBusiness", value = "主营业务"),
@ApiImplicitParam(paramType = "query", dataType = "int", name = "storeCount", 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.POST)
public String modifyShopAuthInfo(
String shopNo,
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,
String salesmanNO1,
String mainBusiness,
Integer storeCount,
HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("shopNo", shopNo);
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);
parameters.put("salesmanNO1", salesmanNO1);
parameters.put("mainBusiness", mainBusiness);
parameters.put("storeCount", storeCount);
return userService.modifyShopAuthInfo(parameters);
}
@ApiOperation("查询认证信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "string", name = "shopNo", required=true),
@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 = "/queryShopAuthInfo",method=RequestMethod.GET)
public String queryShopAuthInfo(String shopNo, String langID) {
return userService.queryShopAuthInfo(shopNo, langID);
}
@ApiOperation("根据OPENID获取用户信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "openId", dataType = "String", required = false, value = "OPENID", defaultValue = ""),
@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 = "/queryUserInfoByOpenId",method=RequestMethod.GET)
public String queryUserInfoByOpenId(String orgNo, String openId, String langID, HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> customerMap = userService.queryCustomerByOpenId(openId);
if(customerMap == null) {
return Rjx.jsonErr().setCode(201).setMessage(I18NUtils.getMessage(langID, "Msg_OpenID_notExist")).toJson();
}
String sCustNO = (String)customerMap.get("sCustNO");
List<Map<String, Object>> bankList = userService.queryBankList(sCustNO);
List<Map<String, Object>> shopList = userService.queryShopList(orgNo, sCustNO);
for(Map<String, Object> shopMap : shopList) {
String sOrgNO = (String)shopMap.get("sOrgNO");
if(orgNo.equals(sOrgNO)) {
customerMap.put("sShopNO", shopMap.get("sShopNO"));
break;
}
}
customerMap.put("nShopID", shopList.get(0).get("nShopID"));
customerMap.put("sEmail", shopList.get(0).get("sEmail"));
customerMap.put("sShopName", shopList.get(0).get("sShopName"));
return Rjx.jsonOk().set("customer", customerMap).set("bankList", bankList).set("shopList", shopList).setMessage(I18NUtils.getMessage(langID, "Msg_Login_success")).toJson();
}
@ApiOperation("根据店铺编号查询业务员")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "shopNo", dataType = "String", required = false),
@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 = "/getSalesmanByShopNo",method=RequestMethod.GET)
public String getSalesmanByShopNo(String shopNo) {
Map<String, Object> map = userService.getSalesmanByShopNo(shopNo);
return Rjx.jsonOk().set("data", map).toJson();
}
@ApiOperation("查询个人信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "custNo", dataType = "String", required = false),
@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 = "/getCustomer",method=RequestMethod.GET)
public String getCustomer(String custNo) {
Map<String, Object> map = userService.getCustomerByNO(custNo);
return Rjx.jsonOk().set("data", map).toJson();
}
@ApiOperation("修改个人信息邮箱")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "custNo", dataType = "String", required = false),
@ApiImplicitParam(paramType = "query", name = "email", dataType = "String", required = false),
@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 = "/updateCustomerEmail",method=RequestMethod.GET)
public String updateCustomerEmail(String custNo, String email) {
userService.updateCustomerEmail(custNo, email);
return Rjx.jsonOk().toJson();
}
@ApiOperation("修改B2B用户UnionID")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "UserNO", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name = "UnionID", dataType = "String", required = true),
@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 = "/updateB2BUnionID",method=RequestMethod.GET)
public String updateB2BUnionID(String UserNO, String UnionID) {
userService.updateB2BUnionID(UserNO, UnionID);
return Rjx.jsonOk().toJson();
}
}
package com.egolm.shop.service;
import java.util.List;
import java.util.Map;
import com.egolm.shop.pojo.TCustomer;
import com.egolm.shop.pojo.TShop;
public interface UserService {
public TCustomer getCustomer(String custNO,String shopNO);
public TCustomer getCustomer(String mobile);
public TShop getShop(String shopNO);
public Map<String,Object> createGuest(Map<String,Object> params);
public String login(Map<String,Object> params) ;
public String modifyPwd(Map<String,Object> params);
public String sendSms(Map<String,Object> params);
public boolean checkShopExists(String custNO,String shopNO);
public String modifyShopAuthInfo(Map<String, Object> parameters);
public Map<String, Object> queryCustomerByOpenId(String openId);
public Map<String, Object> queryCustomerByMobile(String mobile);
public Map<String, Object> createCustomer(String orgNo, String openId, String mobile);
public List<Map<String, Object>> queryShopList(String orgNo, String custNo);
public Map<String, Object> createShop(String orgNo, Map<String, Object> customerMap);
public void deleteOpenId(String openId);
public void saveOpenId(String string, String openId);
public String queryShopAuthInfo(String shopNo, String langID);
public Map<String, Object> getSalesmanByShopNo(String shopNo);
public Map<String, Object> getCustomerByNO(String custNo);
public void updateCustomerEmail(String custNo, String email);
public List<Map<String, Object>> queryBankList(String sCustNO);
public Map<String, Object> loginByOpenId(String orgNo, String openId, String mobile, String name);
}
package com.egolm.shop.service;
import java.util.List;
import java.util.Map;
import com.egolm.shop.pojo.TCustomer;
import com.egolm.shop.pojo.TShop;
public interface UserService {
public TCustomer getCustomer(String custNO,String shopNO);
public TCustomer getCustomer(String mobile);
public TShop getShop(String shopNO);
public Map<String,Object> createGuest(Map<String,Object> params);
public String login(Map<String,Object> params) ;
public String modifyPwd(Map<String,Object> params);
public String sendSms(Map<String,Object> params);
public boolean checkShopExists(String custNO,String shopNO);
public String modifyShopAuthInfo(Map<String, Object> parameters);
public Map<String, Object> queryCustomerByOpenId(String openId);
public Map<String, Object> queryCustomerByMobile(String mobile);
public Map<String, Object> createCustomer(String orgNo, String openId, String mobile);
public List<Map<String, Object>> queryShopList(String orgNo, String custNo);
public Map<String, Object> createShop(String orgNo, Map<String, Object> customerMap);
public void deleteOpenId(String openId);
public void saveOpenId(String string, String openId);
public String queryShopAuthInfo(String shopNo, String langID);
public Map<String, Object> getSalesmanByShopNo(String shopNo);
public Map<String, Object> getCustomerByNO(String custNo);
public void updateCustomerEmail(String custNo, String email);
public List<Map<String, Object>> queryBankList(String sCustNO);
public Map<String, Object> loginByOpenId(String orgNo, String openId, String mobile, String name);
public void updateB2BUnionID(String UserNO, String UnionID);
}
......@@ -847,4 +847,10 @@ public class UserServiceImpl implements UserService {
}
return new XException((String)errorMsg);
}
@Override
public void updateB2BUnionID(String UserNO, String UnionID) {
jdbcTemplate.update("update tB2BUser set sUnionID = ? ,dLastUpdateTime = getdate() where sUserNO = ?", UnionID, UserNO);
}
}
\ No newline at end of file
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