Commit 84e7eb8b authored by machengbo's avatar machengbo

Merge branch 'dm_dev' of http://gitlab.ioubuy.cn/yaobenzhang/dm_project into dm_dev

parents 4299c2f7 88ea3b2e
package com.jz.common.enums;
/**
* @ClassName: 商品价格类型
* @Author: Carl
* @Date: 2020/12/8
* @Version:
*/
public enum PriceTypeEnum {
/**
* 免费
*/
MF("MF", "01"),
/**
* 收费
*/
SF("SF", "02"),
;
private String code;
private String value;
PriceTypeEnum(String code, String value) {
this.code = code;
this.value = value;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static PriceTypeEnum get(String code) {
if (code == null) {
return null;
}
for (PriceTypeEnum status : values()) {
if (status.getCode().equalsIgnoreCase(code)) {
return status;
}
}
return null;
}
}
......@@ -2,8 +2,17 @@ package com.jz.dm.mall.moduls.controller.goods;
import com.jz.common.base.BaseController;
import com.jz.common.utils.Result;
import com.jz.common.utils.StatusCode;
import com.jz.dm.mall.moduls.controller.goods.bean.dto.DataGoodsApiDto;
import com.jz.dm.mall.moduls.entity.DataGoodsApi;
import com.jz.dm.mall.moduls.service.DataGoodsApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -15,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("dataGoodsApi")
@Api("api商品详情")
public class DataGoodsApiController extends BaseController {
/**
* 服务对象
......@@ -22,5 +32,19 @@ public class DataGoodsApiController extends BaseController {
@Autowired
private DataGoodsApiService tDataGoodsApiService;
/**
* 根据主键查询商品详情-api
* @param id
* @return
*/
@GetMapping("/{id}")
@ApiOperation(value = "点击商品查看商品详情", notes = "api商品")
public Result<DataGoodsApiDto> findById(@PathVariable(value = "id") String id) {
if (id != null) {
Long key = Long.valueOf(id);
DataGoodsApiDto dataGoodsApi = tDataGoodsApiService.selectById(key);
return new Result<DataGoodsApiDto>(true, "查询商品详情成功!", StatusCode.OK, dataGoodsApi);
}
return new Result<>(false, "查询商品详情失败!");
}
}
\ No newline at end of file
......@@ -34,14 +34,14 @@ public class DataGoodsController extends BaseController {
private DataGoodsService dataGoodsService;
/**列表查询数据商品
* @param DataGoodsRequest
* @param dataGoodsRequest
* @return
*/
@PostMapping(value = "/findList")
public PageInfoResponse<DataGoodsDto> findList(@RequestBody DataGoodsRequest DataGoodsRequest, HttpServletRequest httpRequest){
public PageInfoResponse<DataGoodsDto> findList(@RequestBody DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest){
PageInfoResponse<DataGoodsDto> pageInfo = new PageInfoResponse<DataGoodsDto>();
try {
pageInfo = dataGoodsService.findList(DataGoodsRequest, httpRequest);
pageInfo = dataGoodsService.findList(dataGoodsRequest, httpRequest);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(Constants.FAILURE_CODE);
......@@ -53,14 +53,14 @@ public class DataGoodsController extends BaseController {
/**主键查询数据商品
* @param DataGoodsRequest
* @param dataGoodsRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/view")
public BaseBeanResponse<DataGoodsDto> view(@RequestBody DataGoodsRequest DataGoodsRequest, HttpServletRequest httpRequest){
public BaseBeanResponse<DataGoodsDto> view(@RequestBody DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest){
BaseBeanResponse<DataGoodsDto> baseBeanResponse = new BaseBeanResponse<DataGoodsDto>();
try {
baseBeanResponse = dataGoodsService.findById(DataGoodsRequest, httpRequest);
baseBeanResponse = dataGoodsService.findById(dataGoodsRequest, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("请求失败");
baseBeanResponse.setCode(Constants.FAILURE_CODE);
......@@ -71,14 +71,14 @@ public class DataGoodsController extends BaseController {
}
/**删除数据商品
* @param DataGoodsRequest
* @param dataGoodsRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/delete")
public BaseResponse delete(@RequestBody DataGoodsRequest DataGoodsRequest, HttpServletRequest httpRequest){
public BaseResponse delete(@RequestBody DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
try {
baseResponse = dataGoodsService.deleteById(DataGoodsRequest, httpRequest);
baseResponse = dataGoodsService.deleteById(dataGoodsRequest, httpRequest);
} catch (Exception e) {
baseResponse.setMessage("删除失败");
baseResponse.setCode(Constants.FAILURE_CODE);
......@@ -89,7 +89,7 @@ public class DataGoodsController extends BaseController {
}
/**新增数据商品
* @param DataGoodsRequest
* @param dataGoods
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/add")
......@@ -107,7 +107,7 @@ public class DataGoodsController extends BaseController {
}
/**修改数据商品
* @param DataGoodsRequest
* @param dataGoods
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/edit")
......
package com.jz.dm.mall.moduls.controller.goods.bean.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* @ClassName: 商品详情参数封装
* @Author: Carl
* @Date: 2020/12/8
* @Version:
*/
@ApiModel(value = "商品详情--商品详情参数对象", description = "商品详情参数对象")
public class DataGoodsApiDto{
/**
* api商品id
*/
@ApiModelProperty(value = "api商品id")
private Long goodsApi;
/**
* 数据id
*/
@ApiModelProperty(value = "数据id")
private Long dataGoodsId;
/**
* api参数id
*/
@ApiModelProperty(value = "api参数id")
private Long apiParamsId;
/**
* api服务名称
*/
@ApiModelProperty(value = "api服务名称")
private String apiName;
/**
* 请求类型(方式)
*/
@ApiModelProperty(value = "请求类型(方式)")
private String requestType;
/**
* api接口地址
*/
@ApiModelProperty(value = "api接口地址")
private String apiUrl;
/**
* api接口方法
*/
@ApiModelProperty(value = "api接口方法")
private String apiMethod;
/**
* api请求协议
*/
@ApiModelProperty(value = "api请求协议")
private String apiProtocl;
/**
* 返回类型
*/
@ApiModelProperty(value = "返回类型")
private String returnType;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date uptTime;
/**
* 价格类型
*/
@ApiModelProperty(value = "价格类型")
private String priceType;
/**
* 供应商名称
*/
@ApiModelProperty(value = "供应商名称")
private String supplierName;
/**
* 参数分类
*/
@ApiModelProperty(value = "参数分类:01公共参数,02请求参数,03响应参数,04请求头参数,05状态码参数")
private String paramsDiff;
/**
* 参数名称
*/
@ApiModelProperty(value = "参数名称")
private String paramsName;
/**
* 参数类型
*/
@ApiModelProperty(value = "参数类型")
private String paramsTYpe;
/**
* 参数描述
*/
@ApiModelProperty(value = "参数描述")
private String paramsDesc;
/**
* 默认值
*/
@ApiModelProperty(value = "默认值")
private String defaultValue;
/**
* 是否必选
*/
@ApiModelProperty(value = "是否必选:Y是,N否")
private String ifRequird;
/**
* 数据类型
*/
@ApiModelProperty(value = "数据类型")
private String dataType;
/**
* api返回数据样例
*/
@ApiModelProperty(value = "api返回数据样例")
private String returnDataExample;
/**
* api请求样例
*/
@ApiModelProperty(value = "api请求样例")
private String requestExample;
public Long getGoodsApi() {
return goodsApi;
}
public void setGoodsApi(Long goodsApi) {
this.goodsApi = goodsApi;
}
public Long getDataGoodsId() {
return dataGoodsId;
}
public void setDataGoodsId(Long dataGoodsId) {
this.dataGoodsId = dataGoodsId;
}
public String getApiName() {
return apiName;
}
public void setApiName(String apiName) {
this.apiName = apiName;
}
public String getRequestType() {
return requestType;
}
public void setRequestType(String requestType) {
this.requestType = requestType;
}
public String getApiUrl() {
return apiUrl;
}
public void setApiUrl(String apiUrl) {
this.apiUrl = apiUrl;
}
public String getApiMethod() {
return apiMethod;
}
public void setApiMethod(String apiMethod) {
this.apiMethod = apiMethod;
}
public String getApiProtocl() {
return apiProtocl;
}
public void setApiProtocl(String apiProtocl) {
this.apiProtocl = apiProtocl;
}
public String getReturnType() {
return returnType;
}
public void setReturnType(String returnType) {
this.returnType = returnType;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getPriceType() {
return priceType;
}
public void setPriceType(String priceType) {
this.priceType = priceType;
}
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public Long getApiParamsId() {
return apiParamsId;
}
public void setApiParamsId(Long apiParamsId) {
this.apiParamsId = apiParamsId;
}
public String getParamsDiff() {
return paramsDiff;
}
public void setParamsDiff(String paramsDiff) {
this.paramsDiff = paramsDiff;
}
public String getParamsName() {
return paramsName;
}
public void setParamsName(String paramsName) {
this.paramsName = paramsName;
}
public String getParamsTYpe() {
return paramsTYpe;
}
public void setParamsTYpe(String paramsTYpe) {
this.paramsTYpe = paramsTYpe;
}
public String getParamsDesc() {
return paramsDesc;
}
public void setParamsDesc(String paramsDesc) {
this.paramsDesc = paramsDesc;
}
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
public String getIfRequird() {
return ifRequird;
}
public void setIfRequird(String ifRequird) {
this.ifRequird = ifRequird;
}
public String getReturnDataExample() {
return returnDataExample;
}
public void setReturnDataExample(String returnDataExample) {
this.returnDataExample = returnDataExample;
}
public String getRequestExample() {
return requestExample;
}
public void setRequestExample(String requestExample) {
this.requestExample = requestExample;
}
}
package com.jz.dm.mall.moduls.controller.goods.bean.request;
import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Date;
......@@ -9,150 +11,180 @@ import java.util.Date;
* @author ybz
*
*/
@ApiModel(value = "数据集市--数据商品参数对象", description = "数据商品参数对象")
public class DataGoodsRequest extends BasePageBean {
/**
* 数据商品id
*/
@ApiModelProperty(value = "数据商品id")
private Long dataGoodsId;
/**
* 商品分类id(行业)
*/
@ApiModelProperty(value = "商品分类id(行业)")
private Long categoryId;
/**
* 数据商户id
*/
@ApiModelProperty(value = "数据商户id")
private Long userId;
/**
* 数据商品名称
*/
@ApiModelProperty(value = "数据商品名称")
private String dataName;
/**
* 数据类型:01api,02数据包
*/
@ApiModelProperty(value = "数据类型")
private String dataType;
/**
* 数据商品标签
*/
@ApiModelProperty(value = "数据商品标签")
private String dataLabel;
/**
* 数据商品图片
*/
@ApiModelProperty(value = "数据商品图片")
private String dataPicture;
/**
* 数据商品价格
*/
@ApiModelProperty(value = "数据商品价格")
private BigDecimal dataPrice;
/**
* 优惠价格
*/
@ApiModelProperty(value = "优惠价格")
private BigDecimal discountPrice;
/**
* 价格类型:01免费,02收费
*/
@ApiModelProperty(value = "价格类型")
private String priceType;
/**
* 商品规格
*/
@ApiModelProperty(value = "商品规格")
private String goodsStandards;
/**
* 数据状态:01预售,02在售中,03下架,04上架
*/
@ApiModelProperty(value = "数据状态")
private String dataStatus;
/**
* 审核状态:01待审核,02已审核,03未通过
*/
@ApiModelProperty(value = "审核状态")
private String auditStatus;
/**
* 清洗规则(脱敏校验)
*/
@ApiModelProperty(value = "清洗规则")
private String cleanRule;
/**
* 驳回原因
*/
@ApiModelProperty(value = "驳回原因")
private String rejectReason;
/**
* 审核人
*/
@ApiModelProperty(value = "审核人")
private String auditPerson;
/**
* 审核时间起
*/
@ApiModelProperty(value = "审核时间起")
private Date auditTimeStart;
/**
* 审核时间止
*/
@ApiModelProperty(value = "审核时间止")
private Date auditTimeEnd;
/**
* 创建时间起
*/
@ApiModelProperty(value = "创建时间起")
private Date creTimeStart;
/**
* 创建时间止
*/
@ApiModelProperty(value = "创建时间止")
private Date creTimeEnd;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String crePerson;
/**
* 更新时间起
*/
@ApiModelProperty(value = "更新时间起")
private Date uptTimeStart;
/**
* 更新时间止
*/
@ApiModelProperty(value = "更新时间止")
private Date uptTimeEnd;
/**
* 更新人
*/
@ApiModelProperty(value = "更新人")
private String uptPerson;
/**
* 删除标识
*/
@ApiModelProperty(value = "删除标识")
private String delFlag;
/**
* 年(元)
*/
@ApiModelProperty(value = "年(元)")
private BigDecimal yearType;
/**
* 季(元)
*/
@ApiModelProperty(value = "季(元)")
private BigDecimal seasonType;
/**
* 月(元)
*/
@ApiModelProperty(value = "月(元)")
private BigDecimal monthType;
/**
* 次(元)
*/
@ApiModelProperty(value = "次(元)")
private BigDecimal secondType;
public Long getDataGoodsId() {
......
package com.jz.dm.mall.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.common.entity.DataGoodsApi;
import com.jz.dm.mall.moduls.controller.goods.bean.dto.DataGoodsApiDto;
import com.jz.dm.mall.moduls.entity.DataGoodsApi;
import org.apache.ibatis.annotations.Param;
/**
* api商品(TDataGoodsApi)表数据库访问层
......@@ -11,6 +14,11 @@ import com.jz.common.entity.DataGoodsApi;
*/
public interface DataGoodsApiDao extends BaseMapper<DataGoodsApi> {
/**
* 根据主键查询商品详情
* @param id
* @return
*/
DataGoodsApiDto selectById(@Param("goodsApi") Long id);
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service;
import com.jz.dm.mall.moduls.controller.goods.bean.dto.DataGoodsApiDto;
/**
* api商品(TDataGoodsApi)表服务接口
*
......@@ -8,5 +11,10 @@ package com.jz.dm.mall.moduls.service;
*/
public interface DataGoodsApiService {
/**
* 根据主键查询商品api详情
* @param id
* @return
*/
DataGoodsApiDto selectById(Long goodsApi);
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service.impl;
import com.jz.common.enums.PriceTypeEnum;
import com.jz.dm.mall.moduls.controller.goods.bean.dto.DataGoodsApiDto;
import com.jz.dm.mall.moduls.entity.DataGoodsApi;
import com.jz.dm.mall.moduls.mapper.DataGoodsApiDao;
import com.jz.dm.mall.moduls.service.DataGoodsApiService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -17,4 +20,16 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
@Autowired
private DataGoodsApiDao tDataGoodsApiDao;
/**
* 根据主键查询商品api详情
*
* @param id
* @return
*/
@Override
public DataGoodsApiDto selectById(Long id) {
DataGoodsApiDto dataGoodsApiDto = tDataGoodsApiDao.selectById(id);
return dataGoodsApiDto;
}
}
\ No newline at end of file
......@@ -82,7 +82,7 @@ public class MallCustomerServiceImpl implements MallCustomerService {
mallCustomerApiDto.setCustomerAccount(mallCustomer.getCustomerAccount());
mallCustomerApiDto.setCustomerName(mallCustomer.getCustomerName());
// 存入到session
SessionUtils.setUserCurrent("mallCustomer", mallCustomerApiDto, request);
request.getSession().setAttribute("mallCustomer", mallCustomerApiDto);
// 存入到redis
redisTemplate.opsForValue().set("user_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER , mallCustomerApiDto, 3, TimeUnit.DAYS);
}
......
......@@ -21,6 +21,38 @@
<result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
</resultMap>
<!--根据主键查询商品详情-->
<select id="selectById" parameterType="map" resultType="com.jz.dm.mall.moduls.controller.goods.bean.dto.DataGoodsApiDto">
SELECT
t1.goods_api AS goodsApi,
t1.data_goods_id AS dataGoodsId,
t1.api_name AS apiName,
t1.request_type AS requestType,
t1.api_url AS apiUrl,
t1.api_method AS apiMethod,
t1.api_protocl AS apiProtocl,
t1.return_type AS returnType,
t1.upt_time AS uptTime,
t1.return_data_example AS returnDataExample,
t1.request_example AS requestExample,
t3.supplier_name AS supplierName,
t4.api_params_id AS apiParamsId,
t4.params_name AS paramsName,
t4.params_type AS paramsType,
t4.params_desc AS paramsDesc,
t4.if_requird AS ifRequird,
t4.default_value AS defaultValue,
( CASE WHEN t2.data_type = '01' THEN 'api' WHEN t2.data_type = '02' THEN '数据包' END ) AS dataType,
( CASE WHEN t2.price_type = '01' THEN '免费' WHEN t2.price_type = '02' THEN '收费' END ) AS priceType,
( CASE WHEN t4.params_diff = '01' THEN '公共参数' WHEN t4.params_diff = '02' THEN '请求参数' WHEN t4.params_diff = '03' THEN '响应参数' WHEN t4.params_diff = '04' THEN '请求头参数' WHEN t4.params_diff = '05' THEN '状态码参数' end ) AS paramsDiff
FROM
t_data_goods_api t1
INNER JOIN t_data_goods t2 ON t1.data_goods_id = t2.data_goods_id
INNER JOIN t_sys_user t3 ON t3.user_id = t2.user_id
INNER JOIN t_data_goods_api_params t4 ON t4.goods_api = t1.goods_api
WHERE
1 = 1
AND t1.del_flag = 'N'
<if test="goodsApi != null"> and t1.goods_api = #{goodsApi}</if>
</select>
</mapper>
\ 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