Commit 2f56f603 authored by 张永's avatar 张永

需求 #14165

parent 9d5d3d2f
package com.egolm.shop.api; package com.egolm.shop.api;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; 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;
import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.web.bind.annotation.RequestMapping; 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.StringUtil; import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate; import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.shop.api.service.CommonService; import com.egolm.shop.api.service.CommonService;
import com.egolm.shop.common.XException; import com.egolm.shop.common.XException;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@Api(tags={"公共数据接口"}) @Api(tags={"公共数据接口"})
@RestController @RestController
@RequestMapping("common") @RequestMapping("common")
public class CommonController { public class CommonController {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired @Autowired
private CommonService commonService; private CommonService commonService;
@ApiOperation("组织构购获取省市区") @ApiOperation("组织构购获取省市区")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "组织机构", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "orgNO", dataType = "String", required = true, value = "组织机构", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @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 = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "") @ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/queryDistrictByOrgNO",method=RequestMethod.GET) @RequestMapping(value = "/queryDistrictByOrgNO",method=RequestMethod.GET)
public String queryDistrictByOrgNO(HttpServletRequest request) { public String queryDistrictByOrgNO(HttpServletRequest request) {
String orgNO = request.getParameter("orgNO"); String orgNO = request.getParameter("orgNO");
String langID = request.getParameter("langID"); String langID = request.getParameter("langID");
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"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"), @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 = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "") @ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/getOpenCity",method=RequestMethod.GET) @RequestMapping(value = "/getOpenCity",method=RequestMethod.GET)
public String getOpenCity(HttpServletRequest request) { public String getOpenCity(HttpServletRequest request) {
String langID = request.getParameter("langID"); String langID = request.getParameter("langID");
return commonService.getOpenCity(langID); return commonService.getOpenCity(langID);
} }
@ApiOperation("获取共同参数") @ApiOperation("获取共同参数")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "commonNo", dataType = "String", required = false, value = "参数名"), @ApiImplicitParam(paramType = "query", name = "commonNo", dataType = "String", required = false, value = "参数名"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @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 = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "") @ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/getCommonArgs",method=RequestMethod.GET) @RequestMapping(value = "/getCommonArgs",method=RequestMethod.GET)
public String getCommonArgs(HttpServletRequest request) { public String getCommonArgs(HttpServletRequest request) {
String langID = request.getParameter("langID"); String langID = request.getParameter("langID");
String commonNo = request.getParameter("commonNo"); String commonNo = request.getParameter("commonNo");
List<Map<String, Object>> list = commonService.getCommonArgs(langID, commonNo); List<Map<String, Object>> list = commonService.getCommonArgs(langID, commonNo);
return Rjx.jsonOk().set("list", list).toJson(); return Rjx.jsonOk().set("list", list).toJson();
} }
@ApiOperation("获取省市区数据") @ApiOperation("获取省市区数据")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "regionNo", dataType = "String"), @ApiImplicitParam(paramType = "query", name = "regionNo", dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @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 = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "") @ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/getRegionList",method=RequestMethod.GET) @RequestMapping(value = "/getRegionList",method=RequestMethod.GET)
public String getCityListByProvince(String regionNo) { public String getCityListByProvince(String regionNo) {
if(StringUtil.isBlank(regionNo)) { if(StringUtil.isBlank(regionNo)) {
regionNo = "000000"; regionNo = "000000";
} }
List<Map<String, Object>> list = jdbcTemplate.queryForList("select * from tRegion where sUpRegionNO = ?", regionNo); List<Map<String, Object>> list = jdbcTemplate.queryForList("select * from tRegion where sUpRegionNO = ?", regionNo);
return Rjx.jsonOk().set("list", list).toJson(); return Rjx.jsonOk().set("list", list).toJson();
} }
@ApiOperation("获取配置信息") @ApiOperation("获取配置信息")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "appId", dataType = "String"), @ApiImplicitParam(paramType = "query", name = "appId", dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"), @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 = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""), @ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "") @ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
}) })
@RequestMapping(value = "/getConfig",method=RequestMethod.GET) @RequestMapping(value = "/getConfig",method=RequestMethod.GET)
public Object getConfig(String appId) { public Object getConfig(String appId) {
Map<String, Object> map = null; Map<String, Object> map = null;
try { try {
map = jdbcTemplate.queryForMap("select sOrgNO, sOrgDesc, sOrgPicUrl from tOrg where sAppID = ? and nTag&1 = 0", appId); map = jdbcTemplate.queryForMap("select sOrgNO, sOrgDesc, sOrgPicUrl from tOrg where sAppID = ? and nTag&1 = 0", appId);
} catch (EmptyResultDataAccessException e) { } catch (EmptyResultDataAccessException e) {
throw new XException("配置不存在", e); throw new XException("配置不存在", e);
} }
String sOrgNO = (String)map.get("sOrgNO"); String sOrgNO = (String)map.get("sOrgNO");
String ossSql = "" + String ossSql = "" +
" declare @ChoiceOssKEY varchar(20) " + " declare @ChoiceOssKEY varchar(20) " +
" select @ChoiceOssKEY=sValue1 from tSystemCtrl " + " select @ChoiceOssKEY=sValue1 from tSystemCtrl " +
" where sCode = 'ChoiceOssKEY' " + " where sCode = 'ChoiceOssKEY' " +
" select sChoiceOssKEY=@ChoiceOssKEY,sDesc,sValue1,sValue2,Value3=sValue3,sValue4,sValue5,sMemo " + " select sChoiceOssKEY=@ChoiceOssKEY,sDesc,sValue1,sValue2,Value3=sValue3,sValue4,sValue5,sMemo " +
" from tSystemCtrl " + " from tSystemCtrl " +
" where sCode = @ChoiceOssKEY"; " where sCode = @ChoiceOssKEY";
Map<String, Object> omap = jdbcTemplate.queryForMap(ossSql.replaceAll("\\s+", " ")); Map<String, Object> omap = jdbcTemplate.queryForMap(ossSql.replaceAll("\\s+", " "));
Map<String, Object> cmap = jdbcTemplate.queryForMap("select sDesc,sValue1 from tSystemCtrl where sCode = 'ExemptCheck'"); Map<String, Object> cmap = jdbcTemplate.queryForMap("select sDesc,sValue1 from tSystemCtrl where sCode = 'ExemptCheck'");
List<Map<String, Object>> payTypes = jdbcTemplate.queryForList("select sSalesOrderPayTypeID, sSalesOrderPayType from tOrgPayType where sOrgNO = ? and nTag&1=0 order by nSort desc", sOrgNO); Map<String, Object> bmap = jdbcTemplate.queryForMap("select sDesc,sValue1 from tSystemCtrl where sCode = 'B2BBusinessModel'");
List<Map<String, Object>> goodsTags = jdbcTemplate.queryForList("select sGoodsTagID, sGoodsTag from tOrgGoodsTag where sOrgNO = ? and nTag&1 = 0", sOrgNO); List<Map<String, Object>> payTypes = jdbcTemplate.queryForList("select sSalesOrderPayTypeID, sSalesOrderPayType from tOrgPayType where sOrgNO = ? and nTag&1=0 order by nSort desc", sOrgNO);
Map<String, Object> shareInfo = new HashMap<String, Object>(); List<Map<String, Object>> goodsTags = jdbcTemplate.queryForList("select sGoodsTagID, sGoodsTag from tOrgGoodsTag where sOrgNO = ? and nTag&1 = 0", sOrgNO);
try { Map<String, Object> shareInfo = new HashMap<String, Object>();
String sql = "" try {
+ "SELECT " String sql = ""
+ "SharePicUrl = sPicUrl, " + "SELECT "
+ "ShareTitle = sShareTitle " + "SharePicUrl = sPicUrl, "
+ "FROM " + "ShareTitle = sShareTitle "
+ "tOrg " + "FROM "
+ "WHERE " + "tOrg "
+ "sOrgNO = ? " + "WHERE "
+ "AND sAppID = ?"; + "sOrgNO = ? "
shareInfo = jdbcTemplate.queryForMap(sql, sOrgNO, appId); + "AND sAppID = ?";
} catch (EmptyResultDataAccessException e) {} shareInfo = jdbcTemplate.queryForMap(sql, sOrgNO, appId);
} catch (EmptyResultDataAccessException e) {}
Map<String, Object> AppSystemInfo = new HashMap<String, Object>();
try { Map<String, Object> AppSystemInfo = new HashMap<String, Object>();
String sql = "" try {
+ "SELECT " String sql = ""
+ "IsAppCustService = convert(BIT, CASE WHEN nIsAppCustService = 1 THEN 1 ELSE 0 END), " + "SELECT "
+ "IsExemptCheck = convert(BIT, CASE WHEN nIsExemptCheck = 1 THEN 1 ELSE 0 END) " + "IsAppCustService = convert(BIT, CASE WHEN nIsAppCustService = 1 THEN 1 ELSE 0 END), "
+ "FROM " + "IsExemptCheck = convert(BIT, CASE WHEN nIsExemptCheck = 1 THEN 1 ELSE 0 END) "
+ "tOrg " + "FROM "
+ "WHERE " + "tOrg "
+ "sOrgNO = ? " + "WHERE "
+ "AND sAppID = ?"; + "sOrgNO = ? "
AppSystemInfo = jdbcTemplate.queryForMap(sql, sOrgNO, appId); + "AND sAppID = ?";
} catch (EmptyResultDataAccessException e) {} AppSystemInfo = jdbcTemplate.queryForMap(sql, sOrgNO, appId);
return Rjx.jsonOk().set("OrgInfo", map).set("PicInfo", omap).set("ExemptCheck", cmap).set("payTypes", payTypes).set("goodsTags", goodsTags).set("AppSystemInfo", AppSystemInfo).set("shareInfo", shareInfo).toJson(); } catch (EmptyResultDataAccessException e) {}
return Rjx.jsonOk().set("OrgInfo", map).set("PicInfo", omap).set("ExemptCheck", cmap).set("BusinessModel", bmap).set("payTypes", payTypes).set("goodsTags", goodsTags).set("AppSystemInfo", AppSystemInfo).set("shareInfo", shareInfo).toJson();
}
} }
}
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