Commit 88ea3b2e authored by ysongq's avatar ysongq

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

parents 8542fef0 64b65468
......@@ -2,3 +2,4 @@ alter table t_finance_customer_assets add remark text COMMENT '备注';
alter table t_platform_log add caller_type char(2) NOT NULL COMMENT '调用类型:01商城用户,02平台用户';
alter table t_finance_trade_flow add assets_id Bigint(20) default NULL COMMENT'企业资产id';
alter table t_finance_customer_balance add balance_time datetime default NULL COMMENT'充值时间';
alter table t_finance_trade_flow add balance_money decimal(20,5) NOT NULL DEFAULT '0' COMMENT '结余';
\ No newline at end of file
......@@ -4,6 +4,7 @@ import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.BaseController;
import com.jz.manage.moduls.controller.finance.platForm.BalanceAuditRequest;
import com.jz.manage.moduls.controller.finance.platForm.BalanceInfoDto;
import com.jz.manage.moduls.controller.finance.platForm.BalanceListDto;
import com.jz.manage.moduls.controller.finance.platForm.BalanceListRequest;
......@@ -79,4 +80,25 @@ public class FinanceCustomerBalanceController extends BaseController {
result.setData(dto);
return result;
}
/**
* 充值管理--充值审核
*
* @return
* @author Bellamy
* @since 2020-12-08
*/
@PostMapping(value = "/balanceInfoAudit")
@ApiOperation(value = "充值管理--充值审核", notes = "充值审核")
public Result<Object> getBalanceInfoAudit(@RequestBody BalanceAuditRequest balanceAuditRequest, HttpServletRequest httpRequest) throws Exception {
Result<Object> result = new Result<>();
if (StringUtils.isEmpty(balanceAuditRequest.getCustomerBalanceId())) {
return Result.error("参数不能为空!");
}
if (StringUtils.isEmpty(balanceAuditRequest.getAuditStatus())) {
return Result.error("参数不能为空!");
}
Result<Object> dto = financeCustomerBalanceService.uptBalanceInfoAuditByid(balanceAuditRequest);
return dto;
}
}
\ No newline at end of file
package com.jz.manage.moduls.controller.finance.platForm;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 平台利润中心--充值管理--充值审核参数对象
*
* @author Bellamy
* @since 2020-12-08 10:41:43
*/
@ApiModel(value = "充值管理--充值审核参数对象", description = "充值审核参数对象")
public class BalanceAuditRequest {
/**
* 审核意见
*/
@ApiModelProperty(value = "审核意见")
private String rejectReason;
/**
* 充值id
*/
@ApiModelProperty(value = "充值id")
private String customerBalanceId;
/**
* 审核状态:01待审核,02审核通过,03未通过
*/
@ApiModelProperty(value = "审核状态")
private String auditStatus;
public String getRejectReason() {
return rejectReason;
}
public void setRejectReason(String rejectReason) {
this.rejectReason = rejectReason;
}
public String getAuditStatus() {
return auditStatus;
}
public void setAuditStatus(String auditStatus) {
this.auditStatus = auditStatus;
}
public String getCustomerBalanceId() {
return customerBalanceId;
}
public void setCustomerBalanceId(String customerBalanceId) {
this.customerBalanceId = customerBalanceId;
}
}
\ No newline at end of file
package com.jz.manage.moduls.controller.order;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.BaseController;
import com.jz.manage.moduls.controller.order.bean.OrderDetailDto;
import com.jz.manage.moduls.controller.order.bean.OrderDto;
import com.jz.manage.moduls.controller.order.bean.OrderRequest;
import com.jz.manage.moduls.service.OrderService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* 订单表(TOrder)表控制层
......@@ -13,13 +23,51 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2020-12-01 10:41:41
*/
@RestController
@RequestMapping("order")
@RequestMapping("/order")
@Api(tags = "平台--订单管理")
public class OrderController extends BaseController {
/**
* 服务对象
*/
@Autowired
private OrderService tOrderService;
private OrderService orderService;
/**
* 订单管理列表(分页查询)
*
* @author Bellamy
*/
@PostMapping(value = "/list")
@ApiOperation(value = "订单管理列表(分页查询)", notes = "订单列表(分页查询)")
public PageInfoResponse<OrderDto> queryPageList(@RequestBody OrderRequest orderRequest, HttpServletRequest req) throws Exception {
PageInfoResponse<OrderDto> pageInfo = new PageInfoResponse<OrderDto>();
try {
pageInfo = orderService.queryListOrderInfo(orderRequest, req);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(Constants.FAILURE_CODE);
e.printStackTrace();
}
return pageInfo;
}
/**
* 根据订单主键查询,订单详情
*
* @param orderId
* @author Bellamy
*/
@GetMapping(value = "/orderDetail")
@ApiOperation(value = "订单详情", notes = "订单详情")
public Result<OrderDetailDto> getOrderDetail(@RequestParam(value = "orderId") String orderId, HttpServletRequest req) throws Exception {
Result<OrderDetailDto> result = new Result<OrderDetailDto>();
if (StringUtils.isNotEmpty(orderId)) {
OrderDetailDto orderDto = orderService.queryOrderDetail(orderId);
result.setData(orderDto);
} else {
result.setMessage("参数为不能为空!");
}
return result;
}
}
\ No newline at end of file
package com.jz.manage.moduls.controller.order.bean;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Date;
/**
* 订单表(TOrder)实体类
*
* @author makejava
* @since 2020-12-01 10:41:40
*/
@ApiModel(value = "订单管理--订单列表返回参数对象", description = "订单列表返回参数对象")
public class OrderDto {
private static final long serialVersionUID = 651546246975691600L;
/**
* 订单id
*/
@ApiModelProperty(value = "订单id")
private Long orderId;
/**
* 订单编号
*/
@ApiModelProperty(value = "订单编号")
private String orderNumber;
/**
* 用户id
*/
@ApiModelProperty(value = "用户id")
private Long customerId;
/**
* 订单状态:01待支付,02已支付,03已取消
*/
@ApiModelProperty(value = "订单状态:01待支付,02已支付,03已取消")
private String orderStatus;
/**
* 订单金额
*/
@ApiModelProperty(value = "订单金额")
private BigDecimal orderMoney;
/**
* 订单时间
*/
@ApiModelProperty(value = "订单时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date orderTime;
/**
* 支付金额
*/
@ApiModelProperty(value = "支付金额")
private BigDecimal paymentMoney;
/**
* 支付时间
*/
@ApiModelProperty(value = "支付时间")
private Date paymentTime;
/**
* 支付方式:01余额
*/
@ApiModelProperty(value = "支付方式:01余额")
private String paymentMethod;
/**
* 购买方式:01年,02季,03月,04次(服务类型)
*/
@ApiModelProperty(value = "购买方式:01年,02季,03月,04次(服务类型)")
private String purchaseMethod;
/**
* 生效日期
*/
@ApiModelProperty(value = "生效日期")
private Date takeEffectTime;
/**
* 失效日期
*/
@ApiModelProperty(value = "失效日期")
private Date invalidTime;
/**
* 数据名称
*/
@ApiModelProperty(value = "数据名称")
private String dataName;
/**
* 数据分类
*/
@ApiModelProperty(value = "数据分类")
private String dataType;
/**
* 企业名称
*/
@ApiModelProperty(value = "企业名称")
private String departmentName;
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public String getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public Long getCustomerId() {
return customerId;
}
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
public String getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(String orderStatus) {
this.orderStatus = orderStatus;
}
public BigDecimal getOrderMoney() {
return orderMoney;
}
public void setOrderMoney(BigDecimal orderMoney) {
this.orderMoney = orderMoney;
}
public Date getOrderTime() {
return orderTime;
}
public void setOrderTime(Date orderTime) {
this.orderTime = orderTime;
}
public BigDecimal getPaymentMoney() {
return paymentMoney;
}
public void setPaymentMoney(BigDecimal paymentMoney) {
this.paymentMoney = paymentMoney;
}
public Date getPaymentTime() {
return paymentTime;
}
public void setPaymentTime(Date paymentTime) {
this.paymentTime = paymentTime;
}
public String getPaymentMethod() {
return paymentMethod;
}
public void setPaymentMethod(String paymentMethod) {
this.paymentMethod = paymentMethod;
}
public String getPurchaseMethod() {
return purchaseMethod;
}
public void setPurchaseMethod(String purchaseMethod) {
this.purchaseMethod = purchaseMethod;
}
public Date getTakeEffectTime() {
return takeEffectTime;
}
public void setTakeEffectTime(Date takeEffectTime) {
this.takeEffectTime = takeEffectTime;
}
public Date getInvalidTime() {
return invalidTime;
}
public void setInvalidTime(Date invalidTime) {
this.invalidTime = invalidTime;
}
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 String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
}
\ No newline at end of file
package com.jz.manage.moduls.controller.order.bean;
import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 订单表(TOrder)实体类
*
* @author makejava
* @since 2020-12-01 10:41:40
*/
@ApiModel
public class OrderRequest extends BasePageBean {
private static final long serialVersionUID = 651546246975691600L;
/**
* 订单编号
*/
@ApiModelProperty(value = "订单编号")
private String departmentName;
/**
* 数据行业
*/
@ApiModelProperty(value = "数据行业")
private String categoryId;
/**
* 购买方式:01年,02季,03月,04次(服务类型)
*/
@ApiModelProperty(value = "购买方式:01年,02季,03月,04次(服务类型)")
private String purchaseMethod;
/**
* 数据名称
*/
@ApiModelProperty(value = "数据名称")
private String dataName;
/**
* 数据分类
*/
@ApiModelProperty(value = "数据分类")
private String dataType;
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 String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public String getPurchaseMethod() {
return purchaseMethod;
}
public void setPurchaseMethod(String purchaseMethod) {
this.purchaseMethod = purchaseMethod;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
}
\ No newline at end of file
package com.jz.manage.moduls.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
......@@ -20,6 +22,7 @@ public class FinanceCustomerBalance implements Serializable {
/**
* 充值id
*/
@TableId(value = "customer_balance_id",type = IdType.AUTO)
private Long customerBalanceId;
/**
* 企业客户资产id
......@@ -54,6 +57,15 @@ public class FinanceCustomerBalance implements Serializable {
*/
private String rejectReason;
/**
* 更新时间
*/
private Date uptTime;
/**
* 更新人
*/
private String uptPerson;
public Long getCustomerBalanceId() {
return customerBalanceId;
......@@ -127,4 +139,19 @@ public class FinanceCustomerBalance implements Serializable {
this.rejectReason = rejectReason;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getUptPerson() {
return uptPerson;
}
public void setUptPerson(String uptPerson) {
this.uptPerson = uptPerson;
}
}
\ No newline at end of file
package com.jz.manage.moduls.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
......@@ -61,10 +62,12 @@ public class FinanceTradeFlow implements Serializable {
/**
* 资产id
*/
@TableField(value = "assets_id")
private Long assetsId;
/**
* 资产结余
*/
@TableField(value = "balance_money")
private BigDecimal balanceMoney;
......
package com.jz.manage.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.common.entity.FinanceCustomerBalance;
import com.jz.manage.moduls.controller.finance.platForm.BalanceInfoDto;
import com.jz.manage.moduls.controller.finance.platForm.BalanceListDto;
import com.jz.manage.moduls.entity.FinanceCustomerBalance;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......
package com.jz.manage.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.manage.moduls.controller.order.bean.OrderDetailDto;
import com.jz.manage.moduls.controller.order.bean.OrderDto;
import com.jz.manage.moduls.entity.Order;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 订单表(TOrder)表数据库访问层
......@@ -12,4 +18,7 @@ import com.jz.manage.moduls.entity.Order;
public interface OrderDao extends BaseMapper<Order> {
List<OrderDto> queryListOrderInfo(Map param) throws Exception;
OrderDetailDto queryOrderDetail(@Param("orderId") String orderId) throws Exception;
}
\ No newline at end of file
package com.jz.manage.moduls.service;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.finance.platForm.BalanceAuditRequest;
import com.jz.manage.moduls.controller.finance.platForm.BalanceInfoDto;
import com.jz.manage.moduls.controller.finance.platForm.BalanceListDto;
import com.jz.manage.moduls.controller.finance.platForm.BalanceListRequest;
......@@ -19,4 +21,6 @@ public interface FinanceCustomerBalanceService {
PageInfoResponse<BalanceListDto> findListBalance(BalanceListRequest balanceListRequest, HttpServletRequest httpRequest) throws Exception;
BalanceInfoDto queryBalanceByid(String customerBalanceId) throws Exception;
Result<Object> uptBalanceInfoAuditByid(BalanceAuditRequest balanceAuditRequest) throws Exception;
}
\ No newline at end of file
package com.jz.manage.moduls.service;
import com.jz.common.bean.PageInfoResponse;
import com.jz.manage.moduls.controller.order.bean.OrderDetailDto;
import com.jz.manage.moduls.controller.order.bean.OrderDto;
import com.jz.manage.moduls.controller.order.bean.OrderRequest;
import javax.servlet.http.HttpServletRequest;
/**
* 订单表(TOrder)表服务接口
*
......@@ -9,5 +16,7 @@ package com.jz.manage.moduls.service;
public interface OrderService {
PageInfoResponse<OrderDto> queryListOrderInfo(OrderRequest orderRequest, HttpServletRequest req) throws Exception;
OrderDetailDto queryOrderDetail(String orderId) throws Exception;
}
\ No newline at end of file
package com.jz.manage.moduls.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.enums.AuditStatusEnum;
import com.jz.common.enums.TradeFlowEnum;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.finance.platForm.BalanceAuditRequest;
import com.jz.manage.moduls.controller.finance.platForm.BalanceInfoDto;
import com.jz.manage.moduls.controller.finance.platForm.BalanceListDto;
import com.jz.manage.moduls.controller.finance.platForm.BalanceListRequest;
import com.jz.manage.moduls.entity.FinanceCustomerAssets;
import com.jz.manage.moduls.entity.FinanceCustomerBalance;
import com.jz.manage.moduls.entity.FinanceTradeFlow;
import com.jz.manage.moduls.mapper.FinanceCustomerAssetsDao;
import com.jz.manage.moduls.mapper.FinanceCustomerBalanceDao;
import com.jz.manage.moduls.mapper.FinanceTradeFlowDao;
import com.jz.manage.moduls.service.FinanceCustomerBalanceService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -25,11 +40,19 @@ import java.util.Map;
* @since 2020-12-01 10:41:39
*/
@Service("financeCustomerBalanceService")
@Transactional
public class FinanceCustomerBalanceServiceImpl implements FinanceCustomerBalanceService {
private static final Logger logger = LoggerFactory.getLogger(FinanceCustomerBalanceServiceImpl.class);
@Autowired
private FinanceCustomerBalanceDao financeCustomerBalanceDao;
@Autowired
private FinanceCustomerAssetsDao financeCustomerAssetsDao;
@Autowired
private FinanceTradeFlowDao financeTradeFlowDao;
@Override
public PageInfoResponse<BalanceListDto> findListBalance(BalanceListRequest balanceListRequest, HttpServletRequest httpRequest) throws Exception {
......@@ -72,4 +95,86 @@ public class FinanceCustomerBalanceServiceImpl implements FinanceCustomerBalance
public BalanceInfoDto queryBalanceByid(String customerBalanceId) throws Exception {
return financeCustomerBalanceDao.queryBalanceByid(customerBalanceId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Object> uptBalanceInfoAuditByid(BalanceAuditRequest balanceAuditRequest) throws Exception {
//1.修改充值记录状态
FinanceCustomerBalance balance = new FinanceCustomerBalance();
balance.setAuditStatus(balanceAuditRequest.getAuditStatus());
balance.setRejectReason(balanceAuditRequest.getRejectReason());
balance.setCustomerBalanceId(Long.valueOf(balanceAuditRequest.getCustomerBalanceId()));
//balance.setUptPerson();
balance.setUptTime(new Date());
int len = financeCustomerBalanceDao.updateById(balance);
if (len > 0) {
logger.info("###########################修改充值审核状态成功####################################");
//2.查询出充值金额 和 账户id
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("customer_balance_id", balanceAuditRequest.getCustomerBalanceId());
wrapper.eq("del_flag", "N");
FinanceCustomerBalance financeCustomerBalance = financeCustomerBalanceDao.selectOne(wrapper);
Long assetsId = financeCustomerBalance.getAssetsId(); //企业用户资产id
String balanceMoney = financeCustomerBalance.getBalanceMoney().toString(); //充值金额
BigDecimal balanceMoneyObj = new BigDecimal(balanceMoney);
//3.查询资产金额
QueryWrapper assetsWrapper = new QueryWrapper();
assetsWrapper.eq("assets_id", assetsId);
wrapper.eq("del_flag", "N");
FinanceCustomerAssets financeCustomerAssets = financeCustomerAssetsDao.selectOne(assetsWrapper);
String frozenMoney = financeCustomerAssets.getFrozenMoney().toString(); // 冻结金额
BigDecimal frozenMoneyObj = new BigDecimal(frozenMoney);
frozenMoneyObj = frozenMoneyObj.subtract(balanceMoneyObj);
if (AuditStatusEnum.YSH.getValue().equals(balanceAuditRequest.getAuditStatus())) {
//审核成功 给总金额和可用余额加上充值金额 ,冻结减去
String useMoney = financeCustomerAssets.getUseMoney().toString(); // 可用金额
BigDecimal useMoneyObj = new BigDecimal(useMoney);
useMoneyObj = useMoneyObj.add(balanceMoneyObj);
String totalMoney = financeCustomerAssets.getTotalMoney().toString(); //总金额
BigDecimal totalMoneyObj = new BigDecimal(totalMoney);
totalMoneyObj = totalMoneyObj.add(balanceMoneyObj);
//4.更新 企业资产
FinanceCustomerAssets saveAssets = new FinanceCustomerAssets();
saveAssets.setAssetsId(assetsId);
saveAssets.setUseMoney(useMoneyObj);
saveAssets.setTotalMoney(totalMoneyObj);
saveAssets.setFrozenMoney(frozenMoneyObj);
saveAssets.setUptTime(new Date());
//saveAssets.setUptPerson();
financeCustomerAssetsDao.updateById(saveAssets);
logger.info("###########################充值审核通过---更新企业资产成功####################################");
//添加流水记录
FinanceTradeFlow financeTradeFlow = new FinanceTradeFlow();
financeTradeFlow.setCreTime(new Date());
financeTradeFlow.setTradeMoney(balanceMoneyObj);
financeTradeFlow.setAssetsId(assetsId);
financeTradeFlow.setTradeType(TradeFlowEnum.CZ.getValue());
financeTradeFlow.setTradeFlowNumber("123132");
financeTradeFlow.setBalanceMoney(useMoneyObj);
financeTradeFlow.setDelFlag("N");
//financeTradeFlow.setCashOutId();
//financeTradeFlow.setCrePerson();
financeTradeFlowDao.insert(financeTradeFlow);
logger.info("#####################商城提现流水记录添加成功#####################");
}
if (AuditStatusEnum.WTG.getValue().equals(balanceAuditRequest.getAuditStatus())) {
//4.审核未通过 更新 企业资产
FinanceCustomerAssets saveAssets = new FinanceCustomerAssets();
saveAssets.setAssetsId(assetsId);
saveAssets.setFrozenMoney(frozenMoneyObj);
saveAssets.setUptTime(new Date());
//saveAssets.setUptPerson();
financeCustomerAssetsDao.updateById(saveAssets);
logger.info("###########################充值审核未通过--更新企业资产成功####################################");
}
return Result.ok();
} else {
return Result.error("提交失败!");
}
}
}
\ No newline at end of file
package com.jz.manage.moduls.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.manage.moduls.controller.order.bean.OrderDetailDto;
import com.jz.manage.moduls.controller.order.bean.OrderDto;
import com.jz.manage.moduls.controller.order.bean.OrderRequest;
import com.jz.manage.moduls.mapper.OrderDao;
import com.jz.manage.moduls.service.OrderService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 订单表(TOrder)表服务实现类
......@@ -12,8 +26,54 @@ import org.springframework.stereotype.Service;
* @since 2020-12-01 10:41:40
*/
@Service("orderService")
@Transactional
public class OrderServiceImpl implements OrderService {
@Autowired
private OrderDao tOrderDao;
private OrderDao orderDao;
@Override
public PageInfoResponse<OrderDto> queryListOrderInfo(OrderRequest orderRequest, HttpServletRequest req) throws Exception {
PageInfoResponse<OrderDto> pageInfoResponse = new PageInfoResponse<>();
Map param = new HashMap();
//从session中获取平台用户id
//SysUserDto user = (SysUserDto) SessionUtils.getUserCurrent(requset,"sysUser");
//param.put("userId", user.getUserId());
//数据行业
if (StringUtils.isNotEmpty(orderRequest.getCategoryId())) {
param.put("categoryId", orderRequest.getCategoryId());
}
//订单方式
if (StringUtils.isNotEmpty(orderRequest.getPurchaseMethod())) {
param.put("orderMethod", orderRequest.getPurchaseMethod());
}
//企业名
if (StringUtils.isNotEmpty(orderRequest.getDepartmentName())) {
param.put("departmentName", orderRequest.getDepartmentName());
}
//数据名称
if (StringUtils.isNotEmpty(orderRequest.getDataName())) {
param.put("dataName", orderRequest.getDataName());
}
//数据类型
if (StringUtils.isNotEmpty(orderRequest.getDataType())) {
param.put("dataType", orderRequest.getDataType());
}
PageHelper.startPage(orderRequest.getPageNum(), orderRequest.getPageSize());
List<OrderDto> list = orderDao.queryListOrderInfo(param);
PageInfo<OrderDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(Constants.SUCCESS_CODE);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
@Override
public OrderDetailDto queryOrderDetail(String orderId) throws Exception {
return orderDao.queryOrderDetail(orderId);
}
}
\ No newline at end of file
......@@ -72,10 +72,10 @@
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="tradeFlowId" useGeneratedKeys="true">
<!--<insert id="insert" keyProperty="tradeFlowId" useGeneratedKeys="true">
insert into t_finance_trade_flow(order_id, cash_out_id, customer_balance_id, trade_flow_number, trade_money, trade_type, cre_time, cre_person, del_flag)
values (#{orderId}, #{cashOutId}, #{customerBalanceId}, #{tradeFlowNumber}, #{tradeMoney}, #{tradeType}, #{creTime}, #{crePerson}, #{delFlag})
</insert>
</insert>-->
<insert id="insertBatch" keyProperty="tradeFlowId" useGeneratedKeys="true">
insert into t_finance_trade_flow(order_id, cash_out_id, customer_balance_id, trade_flow_number,
......
......@@ -223,4 +223,70 @@
delete from t_order where order_id = #{orderId}
</delete>
<select id="queryListOrderInfo" resultType="com.jz.manage.moduls.controller.order.bean.OrderDto" parameterType="map">
select
t.order_id as orderId,
t.order_number as orderNumber,
t.customer_id as customerId,
(case when t.order_status ='01' then '待支付'
when t.order_status ='02' then '已支付'
when t.order_status ='03' then '已取消'
end) as orderStatus,
t.order_money as orderMoney,
t.order_time as orderTime,
t.payment_money as paymentMoney,
t.payment_time as paymentTime,
t.payment_method AS paymentMethod,
(case when t.purchase_method ='01' then '年'
when t.purchase_method ='02' then '季'
when t.purchase_method ='03' then '月'
when t.purchase_method ='04' then '次'
end) as purchaseMethod,
t.price_type as priceType,
t.cre_time as creTime,
t2.data_name as dataName,
(case when t2.data_type ='01' then 'API' when t2.data_type ='02' then '数据包' end) as dataType,
t4.department_name as departmentName
from t_order t
left 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
left join t_mall_customer t3 on t3.customer_id=t.customer_id
inner join t_department t4 on t4.department_id=t3.department_id
where 1=1 and t.del_flag='N'
<if test="orderId != null">and t.order_id = #{orderId}</if>
<if test="dataType != null and dataType != ''">and t2.data_type = #{dataType}</if>
<if test="orderNumber != null and orderNumber != ''">and t.order_number = #{orderNumber}</if>
<if test="dataName != null and dataName != ''">and t2.data_name like concat('%',#{dataName},'%')</if>
<if test="purchaseMethod != null and purchaseMethod != ''">and t.purchase_method = #{purchaseMethod}</if>
<if test="categoryId != null">and t2.category_id = #{categoryId}</if>
<if test="departmentName != null">and t4.department_name = #{departmentName}</if>
</select>
<select id="queryOrderDetail" resultType="com.jz.manage.moduls.controller.order.bean.OrderDetailDto" parameterType="map">
select
t.order_number as orderNumber,
(case when t.order_status ='01' then '待支付'
when t.order_status ='02' then '已支付'
when t.order_status ='03' then '已取消'
end) as orderStatus,
t.order_money as orderMoney,
t.order_time as orderTime,
(case when t.payment_method ='01' then '余额' else '其他' end)AS paymentMethod,
(case when t.purchase_method ='01' then '年'
when t.purchase_method ='02' then '季'
when t.purchase_method ='03' then '月'
when t.purchase_method ='04' then '次'
end) as purchaseMethod,
t2.data_name as dataName,
(case when t2.data_type ='01' then 'API' when t2.data_type ='02' then '数据包' end) as dataType,
t4.department_name as departmentName
from t_order t
left 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
left join t_mall_customer t3 on t3.customer_id=t.customer_id
inner join t_department t4 on t4.department_id=t3.department_id
where 1=1 and t.del_flag='N'
<if test="orderId != null">and t.order_id = #{orderId}</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