Commit 8e7132c8 authored by zhangyong's avatar zhangyong

1

parent 587a7226
......@@ -25,7 +25,7 @@ public class SwaggerConfig {
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("前端接口在线文档")
.title("B2B前端接口在线文档")
.description("在线文档")
.termsOfServiceUrl("NO terms of service")
.version("1.0")
......
This diff is collapsed.
......@@ -33,18 +33,18 @@ public class BrandController {
@ApiOperation("首页Banner图片")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "OrgNO", dataType = "String", required = true, value = "区域编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "CompNO", dataType = "String", required = true, value = "组件编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "区域编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "compNO", dataType = "String", required = true, value = "组件编号", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "int", required = true, value = "页码", defaultValue = "1"),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "int", required = true, value = "每页显示数", defaultValue = "10"),
})
@RequestMapping(value = "/getBanner",method=RequestMethod.GET)
public String getBanner(HttpServletRequest request) {
String orgNO = request.getParameter("OrgNO");
String compNO = request.getParameter("CompNO");
String langId = request.getParameter("LangID");
String orgNO = request.getParameter("orgNO");
String compNO = request.getParameter("compNO");
String langId = request.getParameter("langID");
String index = request.getParameter("index");
String limit = request.getParameter("limit");
......
......@@ -23,8 +23,8 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import redis.clients.jedis.JedisCommands;
@Api
@Api(tags={"搜索引擎商品相关接口"})
@Controller
@RequestMapping("solr/goods")
public class SolrGoodsController {
......@@ -41,15 +41,15 @@ public class SolrGoodsController {
@ApiOperation("搜索引擎商品搜索")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType="long", allowMultiple=false, required=true, name="index", value="分页编号"),
@ApiImplicitParam(paramType = "query", dataType="long", allowMultiple=false, required=true, name="size", value="分页大小"),
@ApiImplicitParam(paramType = "query", dataType="long", allowMultiple=false, required=true, name="limit", value="分页大小"),
@ApiImplicitParam(paramType = "query", dataType="string", allowMultiple=false, required=true, name="queryKey", value="搜索关键字"),
@ApiImplicitParam(paramType = "query", dataType="string", allowMultiple=true, required=true, name="orders", value="排序关键字"),
@ApiImplicitParam(paramType = "query", dataType="string", allowMultiple=true, required=true, name="keywords", value="精确搜索条件"),
@ApiImplicitParam(paramType = "query", dataType="string", allowMultiple=true, required=true, name="facetFields", value="单字段分组字段"),
@ApiImplicitParam(paramType = "query", dataType="string", allowMultiple=true, required=true, name="facetPivotFields", value="多字段分组字段"),
})
public Object query(Long index, Long size, String queryKey, String[] orders, String[] keywords, String[] facetFields, String[] facetPivotFields) {
Page page = new Page(index, size, orders);
public Object query(Long index, Long limit, String queryKey, String[] orders, String[] keywords, String[] facetFields, String[] facetPivotFields) {
Page page = new Page(index, limit, orders);
return service.query(page, queryKey, keywords, facetFields, facetPivotFields);
}
......
......@@ -75,7 +75,7 @@ public class UserController {
}
@ApiOperation("获取店铺信息")
@ApiOperation("获取用户信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "custNO", dataType = "String", required = true, value = "账号编码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "shopNO", dataType = "String", required = false, value = "店铺编号", defaultValue = ""),
......@@ -90,8 +90,21 @@ public class UserController {
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();
return Rjx.jsonOk().setData(tCustomer).toJson();
}
......
package com.egolm.shop.pojo;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Date;
/**
* @author 曲欣亮
* @since 2018-10-09
* @version v-1.0
*/
@Entity(name="tCustAddress")
public class TCustAddress implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private String sStreet;
private String sCityID;
private String sEmail;
private String sAddrName;
private String sDistrict;
private String sTel;
private Date dLastUpdateTime;
private String sProvinceID;
@Id
private String sAddrID;
private String sStreetID;
private Date dCreateDate;
private String sCity;
private String sContacts;
private String sConfirmUser;
private String sPostalcode;
private String sMobile;
private String sShopNO;
private Integer nTag;
private String sCustNO;
private String sCreateUser;
private String sDistrictID;
private Date dConfirmDate;
private String sAddress;
private String sProvince;
/**
* 无参数构造方法
*/
public TCustAddress () {
super();
}
/**
* 全参数构造方法
* @param sStreet
* @param sCityID
* @param sEmail
* @param sAddrName
* @param sDistrict
* @param sTel
* @param dLastUpdateTime
* @param sProvinceID
* @param sAddrID
* @param sStreetID
* @param dCreateDate
* @param sCity
* @param sContacts
* @param sConfirmUser
* @param sPostalcode
* @param sMobile
* @param sShopNO
* @param nTag
* @param sCustNO
* @param sCreateUser
* @param sDistrictID
* @param dConfirmDate
* @param sAddress
* @param sProvince
*/
public TCustAddress(String sStreet, String sCityID, String sEmail, String sAddrName, String sDistrict, String sTel, Date dLastUpdateTime, String sProvinceID, String sAddrID, String sStreetID, Date dCreateDate, String sCity, String sContacts, String sConfirmUser, String sPostalcode, String sMobile, String sShopNO, Integer nTag, String sCustNO, String sCreateUser, String sDistrictID, Date dConfirmDate, String sAddress, String sProvince) {
this.sStreet = sStreet;
this.sCityID = sCityID;
this.sEmail = sEmail;
this.sAddrName = sAddrName;
this.sDistrict = sDistrict;
this.sTel = sTel;
this.dLastUpdateTime = dLastUpdateTime;
this.sProvinceID = sProvinceID;
this.sAddrID = sAddrID;
this.sStreetID = sStreetID;
this.dCreateDate = dCreateDate;
this.sCity = sCity;
this.sContacts = sContacts;
this.sConfirmUser = sConfirmUser;
this.sPostalcode = sPostalcode;
this.sMobile = sMobile;
this.sShopNO = sShopNO;
this.nTag = nTag;
this.sCustNO = sCustNO;
this.sCreateUser = sCreateUser;
this.sDistrictID = sDistrictID;
this.dConfirmDate = dConfirmDate;
this.sAddress = sAddress;
this.sProvince = sProvince;
}
public void setsStreet(String sStreet) {
this.sStreet = sStreet;
}
public String getsStreet() {
return sStreet;
}
public void setsCityID(String sCityID) {
this.sCityID = sCityID;
}
public String getsCityID() {
return sCityID;
}
public void setsEmail(String sEmail) {
this.sEmail = sEmail;
}
public String getsEmail() {
return sEmail;
}
public void setsAddrName(String sAddrName) {
this.sAddrName = sAddrName;
}
public String getsAddrName() {
return sAddrName;
}
public void setsDistrict(String sDistrict) {
this.sDistrict = sDistrict;
}
public String getsDistrict() {
return sDistrict;
}
public void setsTel(String sTel) {
this.sTel = sTel;
}
public String getsTel() {
return sTel;
}
public void setdLastUpdateTime(Date dLastUpdateTime) {
this.dLastUpdateTime = dLastUpdateTime;
}
public Date getdLastUpdateTime() {
return dLastUpdateTime;
}
public void setsProvinceID(String sProvinceID) {
this.sProvinceID = sProvinceID;
}
public String getsProvinceID() {
return sProvinceID;
}
public void setsAddrID(String sAddrID) {
this.sAddrID = sAddrID;
}
public String getsAddrID() {
return sAddrID;
}
public void setsStreetID(String sStreetID) {
this.sStreetID = sStreetID;
}
public String getsStreetID() {
return sStreetID;
}
public void setdCreateDate(Date dCreateDate) {
this.dCreateDate = dCreateDate;
}
public Date getdCreateDate() {
return dCreateDate;
}
public void setsCity(String sCity) {
this.sCity = sCity;
}
public String getsCity() {
return sCity;
}
public void setsContacts(String sContacts) {
this.sContacts = sContacts;
}
public String getsContacts() {
return sContacts;
}
public void setsConfirmUser(String sConfirmUser) {
this.sConfirmUser = sConfirmUser;
}
public String getsConfirmUser() {
return sConfirmUser;
}
public void setsPostalcode(String sPostalcode) {
this.sPostalcode = sPostalcode;
}
public String getsPostalcode() {
return sPostalcode;
}
public void setsMobile(String sMobile) {
this.sMobile = sMobile;
}
public String getsMobile() {
return sMobile;
}
public void setsShopNO(String sShopNO) {
this.sShopNO = sShopNO;
}
public String getsShopNO() {
return sShopNO;
}
public void setnTag(Integer nTag) {
this.nTag = nTag;
}
public Integer getnTag() {
return nTag;
}
public void setsCustNO(String sCustNO) {
this.sCustNO = sCustNO;
}
public String getsCustNO() {
return sCustNO;
}
public void setsCreateUser(String sCreateUser) {
this.sCreateUser = sCreateUser;
}
public String getsCreateUser() {
return sCreateUser;
}
public void setsDistrictID(String sDistrictID) {
this.sDistrictID = sDistrictID;
}
public String getsDistrictID() {
return sDistrictID;
}
public void setdConfirmDate(Date dConfirmDate) {
this.dConfirmDate = dConfirmDate;
}
public Date getdConfirmDate() {
return dConfirmDate;
}
public void setsAddress(String sAddress) {
this.sAddress = sAddress;
}
public String getsAddress() {
return sAddress;
}
public void setsProvince(String sProvince) {
this.sProvince = sProvince;
}
public String getsProvince() {
return sProvince;
}
}
package com.egolm.shop.service;
import java.util.List;
import java.util.Map;
import com.egolm.common.jdbc.Page;
import com.egolm.shop.pojo.TCustAddress;
public interface AddressService {
public List<Map<String,Object>> query(Map<String,Object> params ,Page page);
public String saveOrUpdate(Map<String,Object> params);
public TCustAddress getAddById(String addId);
public String delete(String addId,String userNO,String shopNO,String langID);
public String defaultAdd(String addId,String userNO,String shopNO,String type,String langID) ;
}
......@@ -19,4 +19,6 @@ public interface UserService {
public String modifyPwd(Map<String,Object> params);
public String sendSms(Map<String,Object> params);
public boolean checkShopExists(String custNO,String shopNO);
}
package com.egolm.shop.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.egolm.common.StringUtil;
import com.egolm.common.Util;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.common.jdbc.dialect.SqlServerDialect;
import com.egolm.shop.pojo.TCustAddress;
import com.egolm.shop.service.AddressService;
import com.egolm.shop.service.UserService;
@Service
public class AddressServiceImpl implements AddressService {
private static final Log logger = LogFactory.getLog(AddressServiceImpl.class);
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private UserService userService;
public List<Map<String,Object>> query(Map<String,Object> params ,Page page){
try {
String shopNO = params.get("shopNO")+"";
String userNO = params.get("userNO")+"";
String sql="select "
+ "addrID=t.sAddrID, "
+ "addrName=t.sAddrName, "
+ "contacts=t.sContacts, "
+ "mobile=t.sMobile, "
+ "tel=t.sTel, "
+ "province=t.sProvince, "
+ "city=t.sCity, "
+ "districtID=t.sDistrictID, "
+ "provinceID=t.sProvinceID, "
+ "cityID=t.sCityID, "
+ "district=t.sDistrict, "
+ "address=t.sAddress, "
+ "street=t.sStreet, "
+ "postalcode=t.sPostalcode, "
+ "tag=t.nTag ,"
+ " lastUpdateTime = t.dLastUpdateTime "
+ " from tCustAddress t where t.sShopNO=? and t.sCustNO = ? and t.nTag&1=0 ";
jdbcTemplate.setDialect(new SqlServerDialect());
return jdbcTemplate.limit(sql, page, shopNO,userNO);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public String saveOrUpdate(Map<String,Object> params) {
String addId = params.get("addId")+"";
boolean isEdit = false;
if(StringUtil.isNotEmpty(addId)) {
isEdit = true; //修改
}
System.out.println("addId----"+addId+"------isEdit----"+isEdit);
try {
String shopNO = params.get("shopNO")+"";
String userNO = params.get("userNO")+"";
String addrName = params.get("addrName")+"";
String provinceID = params.get("provinceID")+"";
String province = params.get("province")+"";
String cityID = params.get("cityID")+"";
String city = params.get("city")+"";
String districtID = params.get("districtID")+"";
String district = params.get("district")+"";
String streetID = params.get("streetID")+"";
String street = params.get("street")+"";
String mobile = params.get("mobile")+"";
String tel = params.get("tel")+"";
String contacts = params.get("contacts")+"";
String postCode = params.get("postCode")+"";
String address = params.get("address")+"";
boolean isShopExists = userService.checkShopExists(userNO, shopNO);
if(!isShopExists) {
return Rjx.jsonErr().setCode(-100).setMessage(isEdit?"更新失败":"新增失败").set("errorMsg","店铺不存在").toJson();
}
TCustAddress custAddress = isEdit ? getAddById(addId):new TCustAddress();
if(custAddress != null) {
custAddress.setsCustNO(userNO);
custAddress.setsShopNO(shopNO);
custAddress.setsAddrName(addrName);
custAddress.setsProvinceID(provinceID);
custAddress.setsProvince(province);
custAddress.setsCityID(cityID);
custAddress.setsCity(city);
custAddress.setsDistrictID(districtID);
custAddress.setsDistrict(district);
custAddress.setsStreetID(streetID);
custAddress.setsStreet(street);
custAddress.setsMobile(mobile);
custAddress.setsTel(tel);
custAddress.setsContacts(contacts);
custAddress.setsPostalcode(postCode);
custAddress.setsAddress(address);
//如果ID为空则为新增地址
if(!isEdit) {
custAddress.setsAddrID(Util.uuid().replace("-", "").substring(1, 24));
}
custAddress.setnTag(isEdit ? custAddress.getnTag() :0);
custAddress.setsCreateUser(isEdit ? custAddress.getsCreateUser():userNO);
custAddress.setdCreateDate(isEdit ? custAddress.getdCreateDate():new Date());
custAddress.setsConfirmUser(userNO);
custAddress.setdConfirmDate(new Date());
custAddress.setdLastUpdateTime(new Date());
}else {
return Rjx.jsonErr().setCode(-100).setMessage("更新失败").set("errorMsg","更新地址不存在").toJson();
}
int i = jdbcTemplate.saveOrUpdate(custAddress);
if(i >0) {
return Rjx.jsonOk().setMessage(isEdit?"更新成功":"新增成功").toJson();
}else {
return Rjx.jsonErr().setCode(-100).setMessage(isEdit?"新增失败":"更新失败").toJson();
}
} catch (Exception e) {
e.printStackTrace();
return Rjx.jsonErr().setCode(-100).setMessage(isEdit?"更新操作异常":"新增操作异常").toJson();
}
}
public TCustAddress getAddById(String addId){
try {
String sql = "SELECT * FROM tCustAddress where sAddrID = ? and nTag&1=0 ";
return jdbcTemplate.queryForBean(sql, TCustAddress.class, addId);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public String delete(String addId,String userNO,String shopNO,String langID) {
try {
boolean isShopExists = userService.checkShopExists(userNO, shopNO);
if(!isShopExists) {
return Rjx.jsonErr().setCode(-100).setMessage("设置失败").set("errorMsg","店铺不存在").toJson();
}
TCustAddress custAddress = getAddById(addId);
if(custAddress != null) {
custAddress.setnTag(1);
custAddress.setsConfirmUser(userNO);
custAddress.setdConfirmDate(new Date());
custAddress.setdLastUpdateTime(new Date());
int i = jdbcTemplate.update(custAddress);
if(i >0) {
return Rjx.jsonOk().setMessage("删除成功").toJson();
}else {
return Rjx.jsonErr().setCode(-100).setMessage("删除失败").toJson();
}
}else {
return Rjx.jsonErr().setMessage("删除失败").set("errorMsg", "地址不存在,请刷新后重试.").toJson();
}
} catch (Exception e) {
e.printStackTrace();
return Rjx.jsonErr().setCode(-100).setMessage("删除操作异常").toJson();
}
}
/**
*
* @Title: defaultAdd
* @Description: 设置或取消默认地址 0为非默认 2 为默认地址
* @param: @param addId
* @param: @param userNO
* @param: @param shopNO
* @param: @param type
* @param: @param langID
* @param: @return
* @return: String
* @throws
*/
public String defaultAdd(String addId,String userNO,String shopNO,String type,String langID) {
boolean isShopExists = userService.checkShopExists(userNO, shopNO);
if(!isShopExists) {
return Rjx.jsonErr().setCode(-100).setMessage("设置失败").set("errorMsg","店铺不存在").toJson();
}
if(type.equals("0")) { //取消默认
String sql = " UPDATE tCustAddress SET nTag = 0, sConfirmUser = ? ,dConfirmDate = getdate(),dLastUpdateTime = getdate() WHERE sAddrID = ? AND sCustNO = ? AND sShopNO = ? ";
int i = jdbcTemplate.update(sql,userNO,addId,userNO,shopNO);
if(i >0) {
return Rjx.jsonOk().setMessage("取消默认成功").toJson();
}else {
return Rjx.jsonErr().setCode(-100).setMessage("取消默认失败").toJson();
}
}else if(type.equals("2")) { //设为默认
//设置所有的地址为 非默认
String noDefaultSql = " UPDATE tCustAddress SET nTag = 0, sConfirmUser = ? ,dConfirmDate = getdate(),dLastUpdateTime = getdate() WHERE sCustNO = ? AND sShopNO = ? ";
jdbcTemplate.update(noDefaultSql,userNO,userNO,shopNO);
//设置指定地址为默认
String defaultSql = " UPDATE tCustAddress SET nTag = 2, sConfirmUser = ? ,dConfirmDate = getdate(),dLastUpdateTime = getdate() WHERE sAddrID = ? AND sCustNO = ? AND sShopNO = ? ";
int i = jdbcTemplate.update(defaultSql,userNO,addId,userNO,shopNO);
if(i >0) {
return Rjx.jsonOk().setMessage("设置默认成功").toJson();
}else {
return Rjx.jsonErr().setCode(-100).setMessage("设置默认失败").toJson();
}
}else {
return Rjx.jsonErr().setCode(-100).setMessage("操作失败").set("errorMsg","参数类型错误 ").toJson();
}
}
}
......@@ -80,6 +80,29 @@ public class UserServiceImpl implements UserService {
}
}
/**
* 验证店铺是否存在
* @Title: checkShopExists
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param: @param custNO
* @param: @param shopNO
* @param: @return
* @return: boolean
* @throws
*/
public boolean checkShopExists(String custNO,String shopNO) {
try {
String sql = "SELECT count(1) FROM tShop WHERE sCustNO = ? AND sShopNO = ? AND nTag&1=0";
int i = jdbcTemplate.queryForInt(sql,custNO,shopNO);
if(i >0) {
return true;
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
public TCustomer getCustomer(String mobile) {
try {
......
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