|  |  |  | 
|---|
|  |  |  | package com.matrix.system.fenxiao.service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
|---|
|  |  |  | import com.matrix.core.pojo.AjaxResult; | 
|---|
|  |  |  | import com.matrix.core.tools.StringUtils; | 
|---|
|  |  |  | import com.matrix.system.fenxiao.dao.ShopSalesmanOrderDao; | 
|---|
|  |  |  | import com.matrix.system.fenxiao.dto.LoadFenxiaoOrderBasicDto; | 
|---|
|  |  |  | import com.matrix.system.fenxiao.dto.LoadFenxiaoOrderListDto; | 
|---|
|  |  |  | import com.matrix.system.fenxiao.dto.LoadSetOrderListDtoDto; | 
|---|
|  |  |  | import com.matrix.system.fenxiao.dto.UpdateSetOrderDoneDto; | 
|---|
|  |  |  | import com.matrix.system.fenxiao.entity.ShopSalesmanOrder; | 
|---|
|  |  |  | import com.matrix.system.fenxiao.vo.LoadFenxiaoOrderBasicVo; | 
|---|
|  |  |  | import com.matrix.system.fenxiao.vo.LoadFenxiaoOrderListVo; | 
|---|
|  |  |  | import com.matrix.system.fenxiao.vo.LoadSetOrderListDtoVo; | 
|---|
|  |  |  | import com.matrix.system.hive.action.util.QueryUtil; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @description 分销订单 | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | public class ShopSalesmanOrderService  extends ServiceImpl<ShopSalesmanOrderDao, ShopSalesmanOrder>{ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | ShopSalesmanOrderDao shopSalesmanOrderDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public AjaxResult loadFenxiaoOrderBasic(LoadFenxiaoOrderBasicDto loadFenxiaoOrderBasicDto) { | 
|---|
|  |  |  | //设置用户公司ID | 
|---|
|  |  |  | QueryUtil.setQueryLimitCom(loadFenxiaoOrderBasicDto); | 
|---|
|  |  |  | AjaxResult result= AjaxResult.buildSuccessInstance("查询成功"); | 
|---|
|  |  |  | //根据OPENID查询基础信息 | 
|---|
|  |  |  | Long companyId = loadFenxiaoOrderBasicDto.getCompanyId(); | 
|---|
|  |  |  | LoadFenxiaoOrderBasicVo loadFenxiaoOrderBasicVo = shopSalesmanOrderDao.selectFenxiaoOrderBasicByCompanyId(companyId); | 
|---|
|  |  |  | result.putInMap("basicdetail", loadFenxiaoOrderBasicVo); | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public AjaxResult loadFenxiaoOrderList(LoadFenxiaoOrderListDto loadFenxiaoOrderListDto) { | 
|---|
|  |  |  | //设置用户公司ID | 
|---|
|  |  |  | QueryUtil.setQueryLimitCom(loadFenxiaoOrderListDto); | 
|---|
|  |  |  | //排序 | 
|---|
|  |  |  | if(StringUtils.isBlank(loadFenxiaoOrderListDto.getSort())){ | 
|---|
|  |  |  | loadFenxiaoOrderListDto.setSort("create_time"); | 
|---|
|  |  |  | loadFenxiaoOrderListDto.setOrder("desc"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Page<LoadFenxiaoOrderListVo> page = new Page(loadFenxiaoOrderListDto.getPageNum(), loadFenxiaoOrderListDto.getPageSize()); | 
|---|
|  |  |  | IPage<LoadFenxiaoOrderListVo> loadFenxiaoOrderListVos = shopSalesmanOrderDao.findFenxiaoOrderList(page,loadFenxiaoOrderListDto); | 
|---|
|  |  |  | return AjaxResult.buildSuccessInstance(loadFenxiaoOrderListVos.getRecords(),loadFenxiaoOrderListVos.getTotal()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public AjaxResult loadSetOrderList(LoadSetOrderListDtoDto loadSetOrderListDto) { | 
|---|
|  |  |  | //设置用户公司ID | 
|---|
|  |  |  | QueryUtil.setQueryLimitCom(loadSetOrderListDto); | 
|---|
|  |  |  | //排序 | 
|---|
|  |  |  | if(StringUtils.isBlank(loadSetOrderListDto.getSort())){ | 
|---|
|  |  |  | loadSetOrderListDto.setSort("create_time"); | 
|---|
|  |  |  | loadSetOrderListDto.setOrder("desc"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Page<LoadSetOrderListDtoVo> page = new Page(loadSetOrderListDto.getPageNum(), loadSetOrderListDto.getPageSize()); | 
|---|
|  |  |  | IPage<LoadSetOrderListDtoVo> loadFenxiaoOrderListVos = shopSalesmanOrderDao.findSetOrderList(page,loadSetOrderListDto); | 
|---|
|  |  |  | return AjaxResult.buildSuccessInstance(loadFenxiaoOrderListVos.getRecords(),loadFenxiaoOrderListVos.getTotal()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | public AjaxResult updateSetOrderDone(UpdateSetOrderDoneDto updateSetOrderDoneDto) { | 
|---|
|  |  |  | //设置用户公司ID | 
|---|
|  |  |  | QueryUtil.setQueryLimitCom(updateSetOrderDoneDto); | 
|---|
|  |  |  | String orderIds = updateSetOrderDoneDto.getOrderIds(); | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | if(StrUtil.isNotEmpty(orderIds)){ | 
|---|
|  |  |  | List<Integer> idsList = new ArrayList<>(); | 
|---|
|  |  |  | List<String> idsStringList = Arrays.asList(orderIds.split(",")); | 
|---|
|  |  |  | //产生订单结算记录 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //记录收益流水 | 
|---|
|  |  |  | //         ShopRevenueFlow salesRevenueFlow=new ShopRevenueFlow(); | 
|---|
|  |  |  | //         salesRevenueFlow.setCompanyId(order.getCompanyId()); | 
|---|
|  |  |  | //         salesRevenueFlow.setCreateBy(MatrixConstance.SYSTEM_USER); | 
|---|
|  |  |  | //         salesRevenueFlow.setUpdateBy(MatrixConstance.SYSTEM_USER); | 
|---|
|  |  |  | //         salesRevenueFlow.setCreateTime(new Date()); | 
|---|
|  |  |  | //         salesRevenueFlow.setUpdateTime(new Date()); | 
|---|
|  |  |  | //         salesRevenueFlow.setAmount(salesAmount); | 
|---|
|  |  |  | //         salesRevenueFlow.setUserId(salesmanOrder.getSalesUserId()); | 
|---|
|  |  |  | //         salesRevenueFlow.setRevenueContent("推广收益"); | 
|---|
|  |  |  | //         salesRevenueFlow.setBusinessId(salesmanOrder.getOrderId()); | 
|---|
|  |  |  | //         shopRevenueFlowDao.insert(salesRevenueFlow); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //收益流水 | 
|---|
|  |  |  | //         ShopRevenueFlow invitationRevenueFlow=new ShopRevenueFlow(); | 
|---|
|  |  |  | //         invitationRevenueFlow.setCompanyId(order.getCompanyId()); | 
|---|
|  |  |  | //         invitationRevenueFlow.setCreateBy(MatrixConstance.SYSTEM_USER); | 
|---|
|  |  |  | //         invitationRevenueFlow.setUpdateBy(MatrixConstance.SYSTEM_USER); | 
|---|
|  |  |  | //         invitationRevenueFlow.setCreateTime(new Date()); | 
|---|
|  |  |  | //         invitationRevenueFlow.setUpdateTime(new Date()); | 
|---|
|  |  |  | //         invitationRevenueFlow.setAmount(salesAmount); | 
|---|
|  |  |  | //         invitationRevenueFlow.setUserId(invitationOrder.getSalesUserId()); | 
|---|
|  |  |  | //         invitationRevenueFlow.setRevenueContent("邀请收益"); | 
|---|
|  |  |  | //         invitationRevenueFlow.setBusinessId(invitationOrder.getOrderId()); | 
|---|
|  |  |  | //         shopRevenueFlowDao.insert(invitationRevenueFlow); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }*/ | 
|---|
|  |  |  | return AjaxResult.buildFailInstance("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|