Commit 78e8094b authored by zhangc's avatar zhangc

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

parents 0717005a 4ea58688
alter table t_data_goods add use_person varchar(64) DEFAULT '0' COMMENT '使用人数';
alter table t_mall_customer add head_portrait_url varchar(512) COMMENT '头像';
alter table t_data_goods_api add file_deposit_id Bigint(20) default NULL COMMENT'文件存入id';
alter table t_data_goods add data_desc varchar(512) DEFAULT '0' COMMENT '数据描述';
alter table t_data_goods add data_desc varchar(512) DEFAULT NULL COMMENT '数据描述';
alter table t_data_goods_api add api_type char(2) NOT NULL COMMENT 'api类型:01制作api,02制作数据包';
alter table t_data_goods_api add target_url varchar(128) DEFAULT '0' COMMENT '目标地址';
alter table t_data_goods_api add api_desc varchar(512) DEFAULT '0' COMMENT '接口描述';
\ No newline at end of file
alter table t_data_goods_api add target_url varchar(128) DEFAULT NULL COMMENT '目标地址';
alter table t_data_goods_api add api_desc varchar(512) DEFAULT NULL COMMENT '接口描述';
\ No newline at end of file
......@@ -6,10 +6,8 @@ import com.jz.dm.service.AuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;
import javax.validation.Valid;
......@@ -94,7 +92,7 @@ public class AuthController {
*/
@ApiOperation("盐值重置接口")
@PostMapping(value = "/reset-salt")
public Mono<Result> resetSalt(@RequestBody @Valid SaltResetReq req) {
public Mono<Result> resetSalt(@RequestBody @Validated SaltResetReq req) {
return Mono.fromSupplier(() -> authService.updateSaltInfo(req));
}
}
......@@ -3,6 +3,7 @@ package com.jz.common.bean;
import com.jz.common.enums.UserTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
......@@ -13,6 +14,7 @@ import java.io.Serializable;
* @Version:
*/
@ApiModel
@Data
public class SysUserDto implements Serializable {
private static final long serialVersionUID = -8194718171444972705L;
......@@ -37,53 +39,13 @@ public class SysUserDto implements Serializable {
@ApiModelProperty(value = "账户")
private String account;
@ApiModelProperty(value = "供应商")
private String supplierName;
/**
* 电话
*/
@ApiModelProperty(value = "账号类型")
private UserTypeEnum userTypeEnum;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getOrgId() {
return orgId;
}
public void setOrgId(Long orgId) {
this.orgId = orgId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public UserTypeEnum getUserTypeEnum() {
return userTypeEnum;
}
public void setUserTypeEnum(UserTypeEnum userTypeEnum) {
this.userTypeEnum = userTypeEnum;
}
}
package com.jz.dm.mall.moduls.controller.finance;
import com.jz.common.base.BaseController;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.service.FinanceCustomerAssetsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
/**
* 商城企业客户资产(TFinanceCustomerAssets)表控制层
*
* @author Bellamy
* @since 2020-12-01 10:41:38
*/
@RestController
@RequestMapping("financeCustomerAssets")
@Api(tags = "商城企业客户资产--controller")
public class FinanceCustomerAssetsController extends BaseController {
/**
* 服务对象
*/
@Autowired
private FinanceCustomerAssetsService assetsService;
@GetMapping("/findAssets")
@ApiOperation(value = "查询余额是否充足")
public Result findAssets(@RequestParam(name = "assetsId", required = false) Long assetsId,
@RequestParam(name = "datarice", required = false) BigDecimal dataPrice) {
assetsService.findAssets(assetsId,dataPrice);
return null;
}
}
\ No newline at end of file
......@@ -51,7 +51,7 @@ public class FinanceTradeFlowController extends BaseController {
public Result<FinanceCustomerAssetsDto> getAccountMoney(HttpServletRequest requset) throws Exception {
Result<FinanceCustomerAssetsDto> result = new Result<>();
//requset.getSession().getAttribute(""); //从session中获取商城用户的 id,和企业资产账户id
MallCustomerApiDto currentUser = (MallCustomerApiDto) redisTemplate.opsForValue().get("user_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
MallCustomerApiDto currentUser = (MallCustomerApiDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
Map map = new HashMap();
map.put("assetsId", currentUser.getAssetsId()); //企业资产账户id
......@@ -94,7 +94,7 @@ public class FinanceTradeFlowController extends BaseController {
@ApiOperation(value = "提现----获取账户余额", notes = "获取账户余额")
public Result<FinanceCustomerAssetsDto> getCashOutAccountMoney(HttpServletRequest requset) throws Exception {
Result<FinanceCustomerAssetsDto> result = new Result<>();
MallCustomerApiDto currentUser = (MallCustomerApiDto) redisTemplate.opsForValue().get("user_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
MallCustomerApiDto currentUser = (MallCustomerApiDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
Map map = new HashMap();
map.put("assetsId", currentUser.getAssetsId()); //企业资产账户id
......@@ -114,7 +114,7 @@ public class FinanceTradeFlowController extends BaseController {
@ApiOperation(value = "提现----是否存在提现为审核接口", notes = "获取可提现金额")
public Result<Object> getCashOutAuditStutas(HttpServletRequest requset) throws Exception {
Result<Object> result = new Result<>();
MallCustomerApiDto currentUser = (MallCustomerApiDto) redisTemplate.opsForValue().get("user_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
MallCustomerApiDto currentUser = (MallCustomerApiDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
Map map = new HashMap();
map.put("assetsId", currentUser.getAssetsId()); //企业资产账户id
......
......@@ -26,7 +26,7 @@ import java.util.List;
*/
@RestController
@RequestMapping("dataGoodsApi")
@Api(tags = "平台--数据api-controller")
@Api(tags = "数据api-controller")
public class DataGoodsApiController extends BaseController {
/**
* 服务对象
......
package com.jz.dm.mall.moduls.controller.goods;
import com.jz.common.base.BaseController;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.service.DataGoodsCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;
/**
* 数据商品分类(行业)(TDataGoodsCategory)表控制层
*
* @author Bellamy
* @since 2020-12-01 10:41:32
*/
@RestController
@RequestMapping("dataGoodsCategory")
@Api(tags = "数据商品分类行业")
public class DataGoodsCategoryController extends BaseController {
/**
* 服务对象
*/
@Autowired
private DataGoodsCategoryService categoryService;
@GetMapping(value = "/findCategory/{pid}")
@ApiOperation(value = "查询数据商品分类", notes = "查询父类下的商品分类")
public Result findCategory(@PathVariable(value = "pid") Long pid) {
// categoryService.findCateGory
return null;
}
}
\ No newline at end of file
......@@ -34,6 +34,9 @@ public class MallHotRecommendGoodsController extends BaseController {
@ApiOperation(value = "热门商品api", notes = "热门商品api展示")
public Result<List<MallHotRecommendGoodsDto>> popularApi() {
List<MallHotRecommendGoodsDto> popularApiList = tMallHotRecommendGoodsService.selectByPopularApi();
if (popularApiList.size() == 0) {
return Result.of_success("没有热门商品!");
}
return new Result<>(true, "查询热门api成功", StatusCode.OK, popularApiList);
}
......
......@@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @ClassName:
......@@ -17,6 +18,9 @@ import java.math.BigDecimal;
@Data
public class DataDetailsDto implements Serializable {
@ApiModelProperty(value = "数据名称")
private String dataName;
@ApiModelProperty(value = "供应商名称")
private String supplierName;
......@@ -32,6 +36,16 @@ public class DataDetailsDto implements Serializable {
@ApiModelProperty(value = "数据描述")
private String dataDesc;
@ApiModelProperty(value = "更新时间")
private Date uptTime;
@ApiModelProperty(value = "创建时间")
private Date creTime;
@ApiModelProperty(value = "apiKey")
private String apiKey;
/**
* 请求类型(方式)
*/
......
......@@ -45,8 +45,8 @@ public class DataGoodsApiDto implements Serializable {
/**
* api服务名称
*/
@ApiModelProperty(value = "api服务名称")
private String apiName;
@ApiModelProperty(value = "数据名称")
private String dataName;
/**
* 请求类型(方式)
......@@ -179,5 +179,6 @@ public class DataGoodsApiDto implements Serializable {
@ApiModelProperty(value = "数据描述")
private String dataDesc;
@ApiModelProperty(value = "创建时间")
private Date creTime;
}
......@@ -5,6 +5,7 @@ import com.jz.common.constant.Constants;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.controller.order.bean.OrderRequest;
import com.jz.dm.mall.moduls.controller.order.bean.SaltResetReq;
import com.jz.dm.mall.moduls.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.Map;
......@@ -95,5 +97,15 @@ public class OrderController {
return result;
}
@PostMapping(value = "/resetSalt")
@ApiOperation(value = "订单详情---重置盐值", notes = "重置盐值")
public Result resetSalt(@RequestBody @Valid SaltResetReq req) {
Result result = new Result();
if (StringUtils.isNotEmpty(req.getGoodsToken()) && req.getId() != null) {
result = orderService.updateSalt(req);
}else {
result.setMessage("参数不能为空!");
}
return result;
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.jz.dm.mall.moduls.controller.order.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
......@@ -14,6 +15,7 @@ import java.util.List;
* @since 2020-12-01 10:41:31
*/
@ApiModel
@Data
public class DataGoodsApiDto implements Serializable {
private static final long serialVersionUID = -14346819849726413L;
/**
......@@ -96,7 +98,7 @@ public class DataGoodsApiDto implements Serializable {
* 授权码token
*/
@ApiModelProperty(value = "授权码token")
private String requestToken;
private String goodsToken;
/**
* 接口参数信息
......@@ -104,139 +106,4 @@ public class DataGoodsApiDto implements Serializable {
@ApiModelProperty(value = "接口参数信息")
private List<DataGoodsApiParamsDto> apiParamsDto;
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 getReturnDataExample() {
return returnDataExample;
}
public void setReturnDataExample(String returnDataExample) {
this.returnDataExample = returnDataExample;
}
public String getRequestExample() {
return requestExample;
}
public void setRequestExample(String requestExample) {
this.requestExample = requestExample;
}
public String getReturnType() {
return returnType;
}
public void setReturnType(String returnType) {
this.returnType = returnType;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getCrePerson() {
return crePerson;
}
public void setCrePerson(String crePerson) {
this.crePerson = crePerson;
}
public String getUptPerson() {
return uptPerson;
}
public void setUptPerson(String uptPerson) {
this.uptPerson = uptPerson;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getRequestToken() {
return requestToken;
}
public void setRequestToken(String requestToken) {
this.requestToken = requestToken;
}
public List<DataGoodsApiParamsDto> getApiParamsDto() {
return apiParamsDto;
}
public void setApiParamsDto(List<DataGoodsApiParamsDto> apiParamsDto) {
this.apiParamsDto = apiParamsDto;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.order.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.req
* @PROJECT_NAME: jz-dm-parent
* @NAME: SaltResetReq
* @DATE: 2020-12-26/19:16
* @DAY_NAME_SHORT: 周六
* @Description:
**/
@Data
@ApiModel("盐值重置请求体")
public class SaltResetReq implements Serializable {
@ApiModelProperty(value = "授权码",required = true)
@NotNull(message = "授权码不能为空")
private String goodsToken;
@ApiModelProperty(value = "订单id")
// @NotNull(message = "订单id不能为空")
private Long id;
}
......@@ -29,7 +29,7 @@ public class PayDto implements Serializable {
private String apiKey;
@ApiModelProperty(value = "资产账户id")
private String assetsId;
private Long assetsId;
@ApiModelProperty(value = "商品金额")
private BigDecimal dataPrice;
......@@ -37,7 +37,7 @@ public class PayDto implements Serializable {
@ApiModelProperty(value = "价格类型")
private String priceType;
@ApiModelProperty(value = "年(元)")
@ApiModelProperty(value = "购买方式")
private String purchaseMethod;
// /**
......
package com.jz.dm.mall.moduls.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
import java.util.Date;
/**
* 数据商品分类(行业)(TDataGoodsCategory)实体类
*
* @author Bellamy
* @since 2020-12-01 10:41:32
*/
@TableName("t_data_goods_category")
@ApiModel
public class DataGoodsCategory implements Serializable {
private static final long serialVersionUID = -54881838919746328L;
/**
* 商品分类id
*/
private Long categoryId;
/**
* 分类名称
*/
private String categoryName;
/**
* 父级分类id
*/
private Long parentId;
/**
* 是否为子节点:Y是,N否
*/
private String ifChild;
/**
* 创建时间
*/
private Date creTime;
/**
* 更新时间
*/
private Date uptTime;
private String delFlag;
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getIfChild() {
return ifChild;
}
public void setIfChild(String ifChild) {
this.ifChild = ifChild;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.dm.mall.moduls.entity.DataGoodsCategory;
/**
* 数据商品分类(行业)(TDataGoodsCategory)表数据库访问层
*
* @author Bellamy
* @since 2020-12-01 10:41:32
*/
public interface DataGoodsCategoryDao extends BaseMapper<DataGoodsCategory> {
}
\ No newline at end of file
......@@ -29,5 +29,21 @@ public interface OrderDao extends BaseMapper<Order> {
List<DataGoodsApiParamsDto> getApiParamsInfo(@Param("goodsApi") Long goodsApi);
/**
* 添加订单
* @param order
*/
void addOrder(Order order);
/**
* 更新授权码和盐值
* @param order
*/
void updateTokenAndSalt(Order order);
/**
* 重置盐值
* @param order
*/
void updateSalt(Order order);
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service;
/**
* 数据商品分类(行业)(TDataGoodsCategory)表服务接口
*
* @author Bellamy
* @since 2020-12-01 10:41:32
*/
public interface DataGoodsCategoryService {
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service;
import com.jz.dm.mall.moduls.entity.FinanceCustomerAssets;
import java.math.BigDecimal;
/**
* 商城企业客户资产(TFinanceCustomerAssets)表服务接口
*
* @author Bellamy
* @since 2020-12-01 10:41:38
*/
public interface FinanceCustomerAssetsService {
/**
* 查询余额是否充足
* @param id
*/
FinanceCustomerAssets findAssets(Long id, BigDecimal dataPrice);
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.controller.order.bean.OrderRequest;
import com.jz.dm.mall.moduls.controller.order.bean.SaltResetReq;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
......@@ -22,5 +24,10 @@ public interface OrderService {
Map getApiInterfaceDetail(Map params) throws Exception;
/**
* 重置盐值
* @param req
* @return
*/
Result updateSalt(SaltResetReq req);
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service.impl;
import com.jz.common.bean.SysUserDto;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.Result;
......@@ -9,15 +11,23 @@ import com.jz.dm.mall.moduls.controller.goods.bean.dto.DataGoodsApiDto;
import com.jz.dm.mall.moduls.mapper.DataGoodsApiDao;
import com.jz.dm.mall.moduls.service.DataGoodsApiService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* api商品(TDataGoodsApi)表服务实现类
......@@ -31,6 +41,7 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
private DataGoodsApiDao tDataGoodsApiDao;
/**
* 根据主键查询商品api详情
*
......@@ -39,6 +50,7 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
*/
@Override
public Result selectById(Long id) {
List<DataGoodsApiDto> dataGoodsApiDto = tDataGoodsApiDao.selectById(id);
if (dataGoodsApiDto.size() == 0) {
return Result.error(StatusCode.ERROR, "查询异常!");
......@@ -49,13 +61,13 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
Map<String, Object> map = new HashMap<>();
for (DataGoodsApiDto goodsApiDto : dataGoodsApiDto) {
if (goodsApiDto.getParamsDiffNum().equals("01")) {
if (goodsApiDto.getParamsDiffNum()!= null && goodsApiDto.getParamsDiffNum().equals("01")) {
list1.add(goodsApiDto);
}
if (goodsApiDto.getParamsDiffNum().equals("02")) {
if (goodsApiDto.getParamsDiffNum()!= null && goodsApiDto.getParamsDiffNum().equals("02")) {
list2.add(goodsApiDto);
}
if (goodsApiDto.getParamsDiffNum().equals("03")) {
if (goodsApiDto.getParamsDiffNum()!= null && goodsApiDto.getParamsDiffNum().equals("03")) {
list3.add(goodsApiDto);
}
if (!StringUtils.isEmpty(goodsApiDto.getRequestExample())) {
......@@ -68,20 +80,11 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
// 商品详情
DataGoodsApiDto goods = dataGoodsApiDto.get(0);
DataDetailsDto data = new DataDetailsDto();
data.setSupplierName(goods.getSupplierName());
data.setCategoryName(goods.getCategoryName());
data.setPriceType(goods.getPriceType());
data.setYearType(goods.getYearType());
data.setSeasonType(goods.getSeasonType());
data.setMonthType(goods.getMonthType());
data.setSecondType(goods.getSecondType());
data.setApiUrl(goods.getApiUrl());
data.setApiMethod(goods.getApiMethod());
data.setRequestType(goods.getRequestType());
data.setReturnType(goods.getReturnType());
data.setDataPicture(goods.getDataPicture());
data.setDataDesc(goods.getDataDesc());
data.setDataPrice(goods.getDataPrice());
DecimalFormat df = new DecimalFormat("#0.00");
String str = df.format(goods.getDataPrice());
BigDecimal bd = new BigDecimal(str).setScale(2, RoundingMode.HALF_UP);
data.setDataPrice(bd);
BeanUtils.copyProperties(goods, data);
map.put("dataInfo", data);
// 商品参数
......
package com.jz.dm.mall.moduls.service.impl;
import com.jz.dm.mall.moduls.mapper.DataGoodsCategoryDao;
import com.jz.dm.mall.moduls.service.DataGoodsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 数据商品分类(行业)(TDataGoodsCategory)表服务实现类
*
* @author Bellamy
* @since 2020-12-01 10:41:32
*/
@Service("dataGoodsCategoryService")
public class DataGoodsCategoryServiceImpl implements DataGoodsCategoryService {
@Autowired
private DataGoodsCategoryDao tDataGoodsCategoryDao;
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service.impl;
import com.jz.dm.mall.moduls.entity.FinanceCustomerAssets;
import com.jz.dm.mall.moduls.mapper.FinanceCustomerAssetsDao;
import com.jz.dm.mall.moduls.service.FinanceCustomerAssetsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* 商城企业客户资产(TFinanceCustomerAssets)表服务实现类
*
* @author Bellamy
* @since 2020-12-01 10:41:38
*/
@Service("financeCustomerAssetsService")
public class FinanceCustomerAssetsServiceImpl implements FinanceCustomerAssetsService {
@Autowired
private FinanceCustomerAssetsDao assetsDao;
/**
* 查询余额是否充足
*
* @param id
*/
@Override
@Async
public FinanceCustomerAssets findAssets(Long id, BigDecimal dataPrice) {
FinanceCustomerAssets assets = assetsDao.findById(id);
if(assets.getUseMoney().compareTo(dataPrice) == -1){
new Thread(new Runnable() {
@Override
public void run() {
// 解冻
BigDecimal frozenMoney = assets.getFrozenMoney();
}
}).start();
}
return null;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.MallCustomerApiDto;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.DateUtils;
import com.jz.common.utils.HttpsUtils;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.order.bean.*;
import com.jz.dm.mall.moduls.entity.Order;
import com.jz.dm.mall.moduls.mapper.OrderDao;
import com.jz.dm.mall.moduls.service.OrderService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -32,6 +42,13 @@ public class OrderServiceImpl implements OrderService {
@Autowired
private OrderDao orderDao;
@Autowired
private HttpsUtils httpsUtils;
@Autowired
private RedisTemplate redisTemplate;
@Override
public PageInfoResponse<OrderDto> findList(OrderRequest order, HttpServletRequest req) throws Exception {
PageInfoResponse<OrderDto> pageInfoResponse = new PageInfoResponse<>();
......@@ -101,6 +118,39 @@ public class OrderServiceImpl implements OrderService {
return returnMap;
}
/**
* 重置盐值
*
* @param req
* @return
*/
@Override
public Result updateSalt(SaltResetReq req) {
// 获取当前用户
MallCustomerApiDto customer = (MallCustomerApiDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_CUSTOMER);
//调用gatway
String url = "http://127.0.0.1:8088/api/auth/reset-salt";
JSONObject object = new JSONObject();
object.put("authCode",req.getGoodsToken());
String s = httpsUtils.submitPost(url, object.toString());
//处理返回的参数
JSONObject params = JSONObject.parseObject(s);
if (!params.get("code").equals(200) || org.springframework.util.StringUtils.isEmpty(params.get("data"))) {
return Result.error("修改失败!");
}
String data = params.getString("data");
JSONObject dataParam = JSONObject.parseObject(data);
String salt = dataParam.getString("salt");
// 修改参数
Order order = new Order();
order.setSaltValue(salt);
order.setOrderId(req.getId());
order.setUptTime(DateUtils.getToday());
order.setUptPerson(customer.getCustomerId() + "");
orderDao.updateSalt(order);
return Result.of_success(ResultMsg.SUCCESS, ResultCode.SUCCESS);
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service.impl;
import com.alibaba.druid.support.json.JSONUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jz.common.constant.ResultMsg;
import com.jz.common.enums.auth.AuthModeEnum;
import com.jz.common.enums.auth.AuthTypeEnum;
import com.jz.common.utils.DateUtils;
import com.jz.common.utils.NumberUtils;
import com.jz.common.utils.RestTemplateUtils;
import com.jz.common.utils.Result;
import com.jz.common.utils.*;
import com.jz.dm.mall.moduls.controller.pay.dto.PayDto;
import com.jz.dm.mall.moduls.controller.pay.req.AuthMallUserApiReq;
......@@ -56,7 +55,7 @@ public class PayServiceImpl implements PayService {
private FinanceTradeFlowDao financeTradeFlowDao;
@Autowired
private RestTemplate restTemplate;
private HttpsUtils httpsUtils;
@Value("${domain.apigateway}")
private String apiGateway;
......@@ -70,6 +69,9 @@ public class PayServiceImpl implements PayService {
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Result goodsPay(PayDto payDto) throws Exception{
if (StringUtils.isEmpty(payDto.getDepartmentId()) || StringUtils.isEmpty(payDto.getAssetsId())) {
return Result.of_error("用户没关联企业,支付失败!");
}
// 新增订单主表
Order order = new Order();
order.setOrderNumber(NumberUtils.getOrderNumber(payDto.getCustomerId() + ""));
......@@ -80,9 +82,10 @@ public class PayServiceImpl implements PayService {
order.setOrderTime(DateUtils.getToday());
order.setPaymentTime(order.getOrderTime());
order.setPaymentMethod("01");
// order.setSellerId();
// order.setDistrictMoney();
// order.setSellerId(); // TODO 卖家id
// order.setDistrictMoney(); //TODO 优惠金额
order.setTakeEffectTime(order.getOrderTime());
order.setApiKey(payDto.getApiKey());
//处理生效期
Date time = getTime(payDto);
if (time != null) {
......@@ -121,8 +124,7 @@ public class PayServiceImpl implements PayService {
}
// 获取企业资产信息
// payDto.getAssetsId()
FinanceCustomerAssets assets = financeCustomerAssetsDao.findById(Long.valueOf("34"));
FinanceCustomerAssets assets = financeCustomerAssetsDao.findById(payDto.getAssetsId());
// 可用金额减去支付金额
BigDecimal bigDecimal = new BigDecimal(assets.getUseMoney()+ "");
BigDecimal bigDecima2 = new BigDecimal(payDto.getDataPrice()+ "");
......@@ -134,19 +136,22 @@ public class PayServiceImpl implements PayService {
AuthMallUserApiReq apiReq = new AuthMallUserApiReq();
if ("04".equals(payDto.getPurchaseMethod())) {
apiReq.setAuthMode(AuthModeEnum.RECORD_TIME_MODE);
apiReq.setAuthMode(AuthModeEnum.POWER_CALL_MODE);
apiReq.setValidStartTime(null);
apiReq.setValidEndTime(null);
}else {
apiReq.setAuthMode(AuthModeEnum.RECORD_TIME_MODE);
apiReq.setValidStartTime(order.getTakeEffectTime());
apiReq.setValidEndTime(order.getInvalidTime());
}
apiReq.setApiKey(payDto.getApiKey());
apiReq.setAuthType(AuthTypeEnum.DATA_BANK_AUTH);
apiReq.setOrgCode("WAISJYX40E3e"); // TODO
apiReq.setOrgType("OUT");
apiReq.setOrgType("OUT"); // TODO
apiReq.setUserId(payDto.getCustomerId() + "");
apiReq.setValidStartTime(order.getTakeEffectTime());
apiReq.setValidEndTime(order.getInvalidTime());
String post = RestTemplateUtils.post(apiGateway, JSON.toJSONString(apiReq));
String post = httpsUtils.submitPost(apiGateway, JSON.toJSONString(apiReq));
System.out.println(post);
JSONObject params = JSONObject.parseObject(post);
if (!params.get("code").equals(200) || StringUtils.isEmpty(params.get("data"))){
return Result.of_error("授权失败!");
......@@ -157,6 +162,17 @@ public class PayServiceImpl implements PayService {
assets.setUptPerson(payDto.getCustomerId()+ "");
financeCustomerAssetsDao.updateAssets(assets);
// 获取到盐值和token,更新订单表
String data = params.getString("data");
JSONObject parse = JSONObject.parseObject(data);
String authCode = parse.getString("authCode");
String salt = parse.getString("salt");
order.setGoodsToken(authCode);
order.setSaltValue(salt);
order.setUptTime(DateUtils.getToday());
order.setUptPerson(payDto.getCustomerId() + "");
orderDao.updateTokenAndSalt(order);
// 新增记录表
Long assetsId = assets.getAssetsId();
if (assetsId!= null) {
......
......@@ -26,13 +26,14 @@
SELECT
t1.goods_api AS goodsApi,
t1.data_goods_id AS dataGoodsId,
t1.api_name AS apiName,
t2.data_name AS dataName,
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.cre_time as creTime,
t1.return_data_example AS returnDataExample,
t1.request_example AS requestExample,
t1.api_key as apiKey,
......@@ -59,7 +60,7 @@
t_data_goods_api t1
left JOIN t_data_goods t2 ON t1.data_goods_id = t2.data_goods_id
left 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
LEFT JOIN t_data_goods_api_params t4 ON t4.goods_api = t1.goods_api
INNER JOIN t_data_goods_category t5 ON t5.category_id = t2.category_id
WHERE
1 = 1
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jz.mall.moduls.mapper.DataGoodsCategoryDao">
<resultMap type="com.jz.dm.mall.moduls.entity.DataGoodsCategory" id="TDataGoodsCategoryMap">
<result property="categoryId" column="category_id" jdbcType="INTEGER"/>
<result property="categoryName" column="category_name" jdbcType="VARCHAR"/>
<result property="parentId" column="parent_id" jdbcType="INTEGER"/>
<result property="ifChild" column="if_child" jdbcType="VARCHAR"/>
<result property="creTime" column="cre_time" jdbcType="TIMESTAMP"/>
<result property="uptTime" column="upt_time" jdbcType="TIMESTAMP"/>
<result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="TDataGoodsCategoryMap">
select
category_id, category_name, parent_id, if_child, cre_time, upt_time, del_flag
from t_data_goods_category
where category_id = #{categoryId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="TDataGoodsCategoryMap">
select
category_id, category_name, parent_id, if_child, cre_time, upt_time, del_flag
from t_data_goods_category
limit #{offset}, #{limit}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="TDataGoodsCategoryMap">
select
category_id, category_name, parent_id, if_child, cre_time, upt_time, del_flag
from t_data_goods_category
<where>
<if test="categoryId != null">
and category_id = #{categoryId}
</if>
<if test="categoryName != null and categoryName != ''">
and category_name = #{categoryName}
</if>
<if test="parentId != null">
and parent_id = #{parentId}
</if>
<if test="ifChild != null and ifChild != ''">
and if_child = #{ifChild}
</if>
<if test="creTime != null">
and cre_time = #{creTime}
</if>
<if test="uptTime != null">
and upt_time = #{uptTime}
</if>
<if test="delFlag != null and delFlag != ''">
and del_flag = #{delFlag}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="categoryId" useGeneratedKeys="true">
insert into t_data_goods_category(category_name, parent_id, if_child, cre_time, upt_time, del_flag)
values (#{categoryName}, #{parentId}, #{ifChild}, #{creTime}, #{uptTime}, #{delFlag})
</insert>
<insert id="insertBatch" keyProperty="categoryId" useGeneratedKeys="true">
insert into t_data_goods_category(category_name, parent_id, if_child, cre_time, upt_time,
del_flag)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.categoryName}, #{entity.parentId}, #{entity.ifChild}, #{entity.creTime}, #{entity.uptTime},
#{entity.delFlag})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="categoryId" useGeneratedKeys="true">
insert into t_data_goods_category(category_name, parent_id, if_child, cre_time, upt_time,
del_flag)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.categoryName}, #{entity.parentId}, #{entity.ifChild}, #{entity.creTime}, #{entity.uptTime},
#{entity.delFlag})
</foreach>
on duplicate key update
category_name = values(category_name) , parent_id = values(parent_id) , if_child = values(if_child) , cre_time =
values(cre_time) , upt_time = values(upt_time) , del_flag = values(del_flag)
</insert>
<!--通过主键修改数据-->
<update id="update">
update t_data_goods_category
<set>
<if test="categoryName != null and categoryName != ''">
category_name = #{categoryName},
</if>
<if test="parentId != null">
parent_id = #{parentId},
</if>
<if test="ifChild != null and ifChild != ''">
if_child = #{ifChild},
</if>
<if test="creTime != null">
cre_time = #{creTime},
</if>
<if test="uptTime != null">
upt_time = #{uptTime},
</if>
<if test="delFlag != null and delFlag != ''">
del_flag = #{delFlag},
</if>
</set>
where category_id = #{categoryId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from t_data_goods_category where category_id = #{categoryId}
</delete>
</mapper>
\ No newline at end of file
......@@ -182,14 +182,14 @@
<!--通过实体作为筛选条件查询-->
<select id="findList" resultType="com.jz.dm.mall.moduls.controller.goods.bean.dto.DataGoodsListDto" parameterType="map">
SELECT
t1.data_goods_id as dataGoods,
t1.data_goods_id as dataGoodsId,
t1.category_id as categoryId,
t2.category_name as categoryName,
t1.data_name as dataName,
(CASE WHEN t1.data_type = '01' then 'api' WHEN t1.data_type = '01' then 'api' end) dataTYpe,
( CASE WHEN t1.data_type = '01' THEN 'api' WHEN t1.data_type = '02' THEN '数据包' END ) dataType,
t1.data_label as dataLabel,
t1.data_picture as dataPicture,
(CASE when t1.price_type = '01' then '免费' when t1.price_type = '02' then '收费' end) priceType,
( CASE when t1.price_type = '01' then '免费' when t1.price_type = '02' then '收费' end) priceType,
t1.discount_price as discountPrice,
t1.data_price as dataPrice,
t1.price_type as pariceType,
......@@ -219,15 +219,15 @@
</if>
<if test="uptTime != null ">
ORDER BY
#{uptTime} desc
t1.upt_time desc
</if>
<if test="usePerson != null ">
ORDER BY
#{usePerson} desc
t1.use_person desc
</if>
<if test="synthesizeRank != null">
ORDER BY
#{synthesizeRank} desc
t1.upt_time,t1.use_person desc
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -344,7 +344,7 @@
t3.request_example as requestExample,
t3.return_type as returnType,
t3.api_key as apiKey,
t3.request_token as requestToken
t.goods_token as goodsToken
from t_order t
inner join t_order_goods_info t1 on t.order_id=t1.order_id
inner join t_data_goods t2 on t2.data_goods_id=t1.data_goods_id <if test="dataGoodsId != null">and t2.data_goods_id = #{dataGoodsId}</if>
......@@ -380,6 +380,7 @@
order_time,
payment_money,
payment_time,
api_key,
payment_method,
purchase_method,
take_effect_time,
......@@ -389,6 +390,41 @@
cre_time
)
VALUES
(#{orderNumber}, #{customerId}, #{orderStatus},#{orderMoney}, #{orderTime}, #{paymentMoney}, #{paymentTime}, #{paymentMethod}, #{purchaseMethod}, #{takeEffectTime} ,#{invalidTime}, #{priceType}, #{crePerson}, #{creTime})
(#{orderNumber}, #{customerId}, #{orderStatus},#{orderMoney}, #{orderTime}, #{paymentMoney}, #{paymentTime}, #{apiKey}, #{paymentMethod}, #{purchaseMethod}, #{takeEffectTime} ,#{invalidTime}, #{priceType}, #{crePerson}, #{creTime})
</insert>
<update id="updateTokenAndSalt" parameterType="com.jz.dm.mall.moduls.entity.Order">
update t_order
<set>
<if test="goodsToken != null and goodsToken != ''">
goods_token = #{goodsToken},
</if>
<if test="saltValue != null and saltValue != ''">
salt_value = #{saltValue},
</if>
<if test="uptTime != null">
upt_time = #{uptTime},
</if>
<if test="uptPerson != null and uptPerson != ''">
upt_person = #{uptPerson},
</if>
</set>
where order_id = #{orderId}
</update>
<update id="updateSalt" parameterType="com.jz.dm.mall.moduls.entity.Order">
update t_order
<set>
<if test="saltValue != null and saltValue != ''">
salt_value = #{saltValue},
</if>
<if test="uptTime != null">
upt_time = #{uptTime},
</if>
<if test="uptPerson != null and uptPerson != ''">
upt_person = #{uptPerson},
</if>
</set>
where order_id = #{orderId}
</update>
</mapper>
\ No newline at end of file
......@@ -6,6 +6,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;
......@@ -25,4 +26,5 @@ public class manageApplication {
public HttpsUtils restTemplate() {
return new HttpsUtils();
}
}
package com.jz.manage.moduls.controller.goods;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.BaseController;
import com.jz.manage.moduls.entity.DataGoodsCategory;
import com.jz.manage.moduls.service.DataGoodsCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
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;
import java.util.List;
/**
* 数据商品分类(行业)(TDataGoodsCategory)表控制层
*
......@@ -14,12 +23,21 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("dataGoodsCategory")
@Api(tags = "平台--数据商品分类行业--controller")
public class DataGoodsCategoryController extends BaseController {
/**
* 服务对象
*/
@Autowired
private DataGoodsCategoryService tDataGoodsCategoryService;
private DataGoodsCategoryService categoryService;
@GetMapping(value = "/findCategory")
@ApiOperation(value = "查询数据商品分类", notes = "查询所有的商品分类")
public Result findCategory() {
Result result = categoryService.findCategory();
if (StringUtils.isEmpty(result)) {
return Result.of_error("查询失败!");
}
return result;
}
}
\ No newline at end of file
......@@ -29,7 +29,7 @@ import org.springframework.web.bind.annotation.*;
*/
@RestController
@RequestMapping("dataGoods")
@Api(tags = "自营数据")
@Api(tags = "平台--数据商品--controller")
public class DataGoodsController extends BaseController {
/**
* 服务对象
......
package com.jz.manage.moduls.controller.goods.bean.dto;
import com.jz.manage.moduls.entity.DataGoodsCategory;
import lombok.Data;
import java.util.List;
/**
* @ClassName:
* @Author: Carl
* @Date: 2021/1/8
* @Version:
*/
@Data
public class CategoryChildren extends DataGoodsCategory {
}
......@@ -2,6 +2,7 @@ package com.jz.manage.moduls.controller.goods.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
......@@ -14,6 +15,7 @@ import java.util.Date;
* @Version:
*/
@ApiModel(value = "商品列表", description = "商品列表参数对象")
@Data
public class DataGoodsListDto {
/**
......@@ -32,7 +34,7 @@ public class DataGoodsListDto {
* 数据类型
*/
@ApiModelProperty(value = "数据类型")
private String dataType;
private String apiType;
/**
* 数据行业
......@@ -52,65 +54,17 @@ public class DataGoodsListDto {
@ApiModelProperty(value = "上传时间")
private Date uptTime;
/**
* 创建时间
*/
@ApiModelProperty(value = "上传时间")
private Date creTime;
/**
* 数据状态
*/
@ApiModelProperty(value = "数据状态")
private String dataStatus;
public Long getDataGoodsId() {
return dataGoodsId;
}
public void setDataGoodsId(Long dataGoodsId) {
this.dataGoodsId = dataGoodsId;
}
public String getDataName() {
return dataName;
}
public void setDataName(String dataName) {
this.dataName = dataName;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getDataStatus() {
return dataStatus;
}
public void setDataStatus(String dataStatus) {
this.dataStatus = dataStatus;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
}
......@@ -3,6 +3,7 @@ package com.jz.manage.moduls.controller.goods.bean.request;
import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
......@@ -12,6 +13,7 @@ import java.util.Date;
* @Date: 2020/12/14
* @Version:
*/
@Data
@ApiModel(value = "数据集市--数据商品列表参数对象", description = "数据商品列表参数对象")
public class DataGoodsListRequest extends BasePageBean {
......@@ -43,45 +45,7 @@ public class DataGoodsListRequest extends BasePageBean {
* 数据类型
*/
@ApiModelProperty(value = "数据类型")
private String dataType;
private String apiType;
public String getDataName() {
return dataName;
}
public void setDataName(String dataName) {
this.dataName = dataName;
}
public String getDataStatus() {
return dataStatus;
}
public void setDataStatus(String dataStatus) {
this.dataStatus = dataStatus;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public Long getDataGoodsId() {
return dataGoodsId;
}
public void setDataGoodsId(Long dataGoodsId) {
this.dataGoodsId = dataGoodsId;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
}
......@@ -22,7 +22,7 @@ import reactor.core.publisher.Mono;
*/
@RestController
@RequestMapping("platformLog")
@Api(tags = "平台日志Controller")
@Api(tags = "平台--日志--Controller")
public class PlatformLogController extends BaseController {
/**
* 服务对象
......
......@@ -24,7 +24,7 @@ import javax.servlet.http.HttpServletRequest;
*/
@RestController
@RequestMapping("/order")
@Api(tags = "平台--订单管理")
@Api(tags = "平台--订单管理--controller")
public class OrderController extends BaseController {
/**
* 服务对象
......
......@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("orderPayment")
@Api(tags = "订单支付API")
@Api(tags = "平台--订单支付API--controller")
public class OrderPaymentController extends BaseController {
/**
* 服务对象
......
package com.jz.manage.moduls.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 数据商品分类(行业)(TDataGoodsCategory)实体类
......@@ -14,6 +17,7 @@ import java.util.Date;
*/
@TableName("t_data_goods_category")
@ApiModel
@Data
public class DataGoodsCategory implements Serializable {
private static final long serialVersionUID = -54881838919746328L;
/**
......@@ -44,60 +48,7 @@ public class DataGoodsCategory implements Serializable {
private String delFlag;
public Long getCategoryId() {
return categoryId;
}
private List<DataGoodsCategory> Children;
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getIfChild() {
return ifChild;
}
public void setIfChild(String ifChild) {
this.ifChild = ifChild;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
}
\ No newline at end of file
......@@ -3,6 +3,8 @@ package com.jz.manage.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.manage.moduls.entity.DataGoodsCategory;
import java.util.List;
/**
* 数据商品分类(行业)(TDataGoodsCategory)表数据库访问层
......@@ -13,4 +15,9 @@ import com.jz.manage.moduls.entity.DataGoodsCategory;
public interface DataGoodsCategoryDao extends BaseMapper<DataGoodsCategory> {
/**
* 查询所有分类
* @return
*/
List<DataGoodsCategory> selectByList();
}
\ No newline at end of file
package com.jz.manage.moduls.service;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.entity.DataGoodsCategory;
import java.util.List;
/**
* 数据商品分类(行业)(TDataGoodsCategory)表服务接口
*
......@@ -9,4 +14,9 @@ package com.jz.manage.moduls.service;
public interface DataGoodsCategoryService {
/**
* 查询所有的商品分类
* @return
*/
Result findCategory();
}
\ No newline at end of file
......@@ -76,23 +76,23 @@ public class DataGoodsApiServiceImpl implements DataGoodsApiService {
for (DataGoodsApiDto goodsApiDto : dataGoodsApiDto) {
// 固定参数
if (goodsApiDto.getParamsDiffNum().equals("01")) {
if (goodsApiDto.getParamsDiffNum()!= null && goodsApiDto.getParamsDiffNum().equals("01")) {
list1.add(goodsApiDto);
}
// 请求参数
if (goodsApiDto.getParamsDiffNum().equals("02")) {
if (goodsApiDto.getParamsDiffNum()!= null && goodsApiDto.getParamsDiffNum().equals("02")) {
list2.add(goodsApiDto);
}
// 响应参数
if (goodsApiDto.getParamsDiffNum().equals("03")) {
if (goodsApiDto.getParamsDiffNum()!= null && goodsApiDto.getParamsDiffNum().equals("03")) {
list3.add(goodsApiDto);
}
// 请求头参数
if (goodsApiDto.getParamsDiffNum().equals("04")) {
if (goodsApiDto.getParamsDiffNum()!= null && goodsApiDto.getParamsDiffNum().equals("04")) {
list4.add(goodsApiDto);
}
// 状态码参数
if (goodsApiDto.getParamsDiffNum().equals("05")) {
if (goodsApiDto.getParamsDiffNum()!= null && goodsApiDto.getParamsDiffNum().equals("05")) {
list5.add(goodsApiDto);
}
// api返回数据样例
......
package com.jz.manage.moduls.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.entity.DataGoodsCategory;
import com.jz.manage.moduls.mapper.DataGoodsCategoryDao;
import com.jz.manage.moduls.service.DataGoodsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 数据商品分类(行业)(TDataGoodsCategory)表服务实现类
*
......@@ -14,6 +24,44 @@ import org.springframework.stereotype.Service;
@Service("dataGoodsCategoryService")
public class DataGoodsCategoryServiceImpl implements DataGoodsCategoryService {
@Autowired
private DataGoodsCategoryDao tDataGoodsCategoryDao;
private DataGoodsCategoryDao categoryDao;
/**
* 查询所有的商品分类
*
* @return
*/
@Override
public Result findCategory() {
//1、查出所有分类
List<DataGoodsCategory> entities = categoryDao.selectByList();
// 找到所有的一级分类
List<DataGoodsCategory> level1Menus = entities.stream().filter(categoryEntity ->
categoryEntity.getParentId() == 0 && categoryEntity.getIfChild().equals("N")
).map((menu)->{
menu.setChildren(getChildrens(menu,entities));
// for (DataGoodsCategory child : menu.getChildren()) {
// if (child.getChildren().size() == 0 ) {
// return null;
// }
// return menu;
// }
return menu;
}).collect(Collectors.toList());
return Result.of_success(ResultMsg.SUCCESS, level1Menus);
}
private List<DataGoodsCategory> getChildrens(DataGoodsCategory root,List<DataGoodsCategory> all) {
List<DataGoodsCategory> children = all.stream().filter(categoryEntity -> {
return categoryEntity.getParentId() == root.getCategoryId() && categoryEntity.getIfChild().equals("Y");
}).map(categoryEntity -> {
//1、找到子菜单,同时递归调用
categoryEntity.setChildren(getChildrens(categoryEntity, all));
return categoryEntity;
}).collect(Collectors.toList());
}
\ No newline at end of file
return children;
}
}
\ No newline at end of file
......@@ -100,8 +100,8 @@ public class DataGoodsServiceImpl implements DataGoodsService {
param.put("dataName", goodsListRequest.getDataName());
}
//数据类型:01api,02数据包
if (!StringUtils.isEmpty(goodsListRequest.getDataType())) {
param.put("dataType", goodsListRequest.getDataType());
if (!StringUtils.isEmpty(goodsListRequest.getApiType())) {
param.put("apiType", goodsListRequest.getApiType());
}
//数据状态:01预售,02在售中,03下架,04上架
if (!StringUtils.isEmpty(goodsListRequest.getDataStatus())) {
......@@ -302,11 +302,8 @@ public class DataGoodsServiceImpl implements DataGoodsService {
}
apiReq.setApiExample(dataApiUpReq.getReturnDataExample());
// String url= "http://47.115.53.1:8088/api/producer/addDataBankApiInfo";
// String url= "http://127.0.0.1:8088/api/producer/addDataBankApiInfo";
String post = httpsUtils.submitPost(apiGateway, JSON.toJSONString(apiReq));
System.out.println(post);
JSONObject result = JSON.parseObject(post);
if (!result.get("code").equals(200) || org.springframework.util.StringUtils.isEmpty(result.get("data"))){
return Result.of_error("制作失败!");
......@@ -318,8 +315,21 @@ public class DataGoodsServiceImpl implements DataGoodsService {
dataGoods.setCrePerson(user.getUserId() + "");
dataGoods.setAuditTime(DateUtils.getToday());
dataGoods.setAuditPerson(user.getUserId() + "");
dataGoods.setDataType(dataApiUpReq.getApiType());
dataGoods.setUserId(user.getUserId());
dataGoods.setAuditStatus("02");
dataGoods.setDataStatus("02");
dataGoods.setDelFlag("N");
// 校验商品价格
if (!org.springframework.util.StringUtils.isEmpty(dataApiUpReq.getSecondType())) {
dataGoods.setDataPrice(dataApiUpReq.getSecondType());
}else if (!org.springframework.util.StringUtils.isEmpty(dataApiUpReq.getMonthType())) {
dataGoods.setDataPrice(dataApiUpReq.getMonthType());
}else if (!org.springframework.util.StringUtils.isEmpty(dataApiUpReq.getSeasonType())) {
dataGoods.setDataPrice(dataApiUpReq.getSeasonType());
}else {
dataGoods.setDataPrice(dataApiUpReq.getYearType());
}
BeanUtils.copyProperties(dataApiUpReq, dataGoods);
dataGoodsDao.insert(dataGoods);
......@@ -334,6 +344,7 @@ public class DataGoodsServiceImpl implements DataGoodsService {
dataGoodsApi.setEncryMode("MD5");
dataGoodsApi.setTransMode("http");
dataGoodsApi.setVersionNumber("v1.0");
dataGoodsApi.setDelFlag("N");
dataGoodsApi.setApiKey(result.get("data").toString());
BeanUtils.copyProperties(dataApiUpReq, dataGoodsApi);
tDataGoodsApiDao.insert(dataGoodsApi);
......@@ -347,6 +358,7 @@ public class DataGoodsServiceImpl implements DataGoodsService {
for (DataGoodsApiParams params : inboxParam) {
params.setGoodsApi(goodsApi);
params.setParamsDiff("01");
params.setDelFlag("N");
params.setCreTime(DateUtils.getToday());
params.setCrePerson(user.getUserId() + "");
BeanUtils.copyProperties(dataApiUpReq, params);
......@@ -359,6 +371,7 @@ public class DataGoodsServiceImpl implements DataGoodsService {
for (DataGoodsApiParams params : requestParam) {
params.setGoodsApi(goodsApi);
params.setParamsDiff("02");
params.setDelFlag("N");
params.setCreTime(DateUtils.getToday());
params.setCrePerson(user.getUserId() + "");
BeanUtils.copyProperties(dataApiUpReq, params);
......@@ -371,6 +384,7 @@ public class DataGoodsServiceImpl implements DataGoodsService {
for (DataGoodsApiParams params : responseParam) {
params.setGoodsApi(goodsApi);
params.setParamsDiff("03");
params.setDelFlag("N");
params.setCreTime(DateUtils.getToday());
params.setCrePerson(user.getUserId() + "");
BeanUtils.copyProperties(dataApiUpReq, params);
......@@ -383,6 +397,7 @@ public class DataGoodsServiceImpl implements DataGoodsService {
for (DataGoodsApiParams params : paramsList) {
params.setGoodsApi(goodsApi);
params.setParamsDiff("04");
params.setDelFlag("N");
params.setCreTime(DateUtils.getToday());
params.setCrePerson(user.getUserId() + "");
BeanUtils.copyProperties(dataApiUpReq, params);
......@@ -395,6 +410,7 @@ public class DataGoodsServiceImpl implements DataGoodsService {
for (DataGoodsApiParams params : paramsList) {
params.setGoodsApi(goodsApi);
params.setParamsDiff("05");
params.setDelFlag("N");
params.setCreTime(DateUtils.getToday());
params.setCrePerson(user.getUserId() + "");
BeanUtils.copyProperties(dataApiUpReq, params);
......
......@@ -41,17 +41,20 @@ public class SysUserServiceImpl implements SysUserService {
queryWrapper.eq("account", username);
SysUser sysUser = sysUserDao.selectOne(queryWrapper);
if (sysUser != null) {
SysUserDto SysUserDto = new SysUserDto();
SysUserDto sysUserDto = new SysUserDto();
// 赋值
SysUserDto.setUserId(sysUser.getUserId());
SysUserDto.setOrgId(sysUser.getOrgId());
SysUserDto.setAccount(sysUser.getAccount());
SysUserDto.setUserTypeEnum(UserTypeEnum.BACKGROUND_ROLE);
SysUserDto.setUserName(sysUser.getUserName());
sysUserDto.setUserId(sysUser.getUserId());
sysUserDto.setOrgId(sysUser.getOrgId());
sysUserDto.setAccount(sysUser.getAccount());
sysUserDto.setSupplierName(sysUser.getSupplierName());
sysUserDto.setUserTypeEnum(UserTypeEnum.BACKGROUND_ROLE);
sysUserDto.setUserName(sysUser.getUserName());
// 存入到session
SessionUtils.setUserCurrent("sysUser", SysUserDto, request);
SessionUtils.setUserCurrent("sysUser", sysUserDto, request);
// 存入到redis
redisTemplate.opsForValue().set("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS, SysUserDto, 3, TimeUnit.DAYS);
redisTemplate.opsForValue().set("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS, sysUserDto, 3, TimeUnit.DAYS);
SysUserDto userDto = (SysUserDto) redisTemplate.opsForValue().get("USER_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS);
System.out.println(userDto);
}
return sysUser;
}
......
......@@ -57,7 +57,7 @@
t_data_goods t1
INNER JOIN t_data_goods_category t2 ON t1.category_id = t2.category_id
INNER JOIN t_data_goods_api t3 ON t1.data_goods_id = t3.data_goods_id
INNER JOIN t_data_goods_api_params t4 ON t3.goods_api = t4.goods_api
LEFT JOIN t_data_goods_api_params t4 ON t3.goods_api = t4.goods_api
WHERE
1= 1 AND
t1.del_flag = 'N'
......
......@@ -118,4 +118,10 @@
delete from t_data_goods_category where category_id = #{categoryId}
</delete>
<select id="selectByList" resultType="com.jz.manage.moduls.entity.DataGoodsCategory" parameterType="map">
select
category_id, category_name, parent_id, if_child
from t_data_goods_category
where del_flag = "N"
</select>
</mapper>
\ No newline at end of file
......@@ -53,16 +53,19 @@
SELECT
t1.data_goods_id as dataGoodsId,
t1.data_name as dataName,
(CASE WHEN t1.data_type = '01' then 'api' WHEN t1.data_type = '02' then '数据包' end) dataType,
(CASE WHEN t3.api_type = '01' then 'api' WHEN t3.api_type = '02' then '数据包' end) apiType,
t1.category_id as categoryId,
t2.category_name as categoryName,
t1.upt_time as uptTime,
t1.cre_time as creTime,
(CASE WHEN t1.data_status = '01' then '预售'
WHEN t1.data_status = '02' then '在售中'
WHEN t1.data_status = '03' then '下架'
WHEN t1.data_status = '04' then '上架' end) dataStatus
FROM
t_data_goods t1 INNER JOIN t_data_goods_category t2 ON t1.category_id = t2.category_id
t_data_goods t1
INNER JOIN t_data_goods_category t2 ON t1.category_id = t2.category_id
INNER JOIN t_data_goods_api t3 ON t1.data_goods_id = t3.data_goods_id
where t1.del_flag = 'N'
and
t1.audit_status = '02'
......@@ -75,13 +78,19 @@
<if test="dataName != null and dataName != ''">
and t1.data_name like concat('%',#{dataName},'%')
</if>
<if test="dataType != null and dataType != ''">
and t1.data_type = #{dataType}
<if test="apiType != null and apiType != ''">
and t3.api_type = #{apiType}
</if>
<if test="dataStatus != null and dataStatus != ''">
and t1.data_status = #{dataStatus}
</if>
order by t1.upt_time desc
<if test="uptTime != null and uptTime != ''">
order by t1.upt_time desc
</if>
<if test="creTime != null and creTime != ''">
order by t1.cre_time desc
</if>
</select>
<!--新增所有列-->
......
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