mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-27 06:25:13 +08:00
Merge branch 'dev-zza' into dev
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.pile.domain.ChargeAlgorithmRecord;
|
||||
|
||||
/**
|
||||
* 电池充电算法记录Service接口
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2025-04-12
|
||||
*/
|
||||
public interface ChargeAlgorithmRecordService {
|
||||
/**
|
||||
* 查询电池充电算法记录
|
||||
*
|
||||
* @param id 电池充电算法记录主键
|
||||
* @return 电池充电算法记录
|
||||
*/
|
||||
public ChargeAlgorithmRecord selectChargeAlgorithmRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询电池充电算法记录列表
|
||||
*
|
||||
* @param chargeAlgorithmRecord 电池充电算法记录
|
||||
* @return 电池充电算法记录集合
|
||||
*/
|
||||
public List<ChargeAlgorithmRecord> selectChargeAlgorithmRecordList(ChargeAlgorithmRecord chargeAlgorithmRecord);
|
||||
|
||||
/**
|
||||
* 新增电池充电算法记录
|
||||
*
|
||||
* @param chargeAlgorithmRecord 电池充电算法记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertChargeAlgorithmRecord(ChargeAlgorithmRecord chargeAlgorithmRecord);
|
||||
|
||||
/**
|
||||
* 修改电池充电算法记录
|
||||
*
|
||||
* @param chargeAlgorithmRecord 电池充电算法记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateChargeAlgorithmRecord(ChargeAlgorithmRecord chargeAlgorithmRecord);
|
||||
|
||||
/**
|
||||
* 批量删除电池充电算法记录
|
||||
*
|
||||
* @param ids 需要删除的电池充电算法记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteChargeAlgorithmRecordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除电池充电算法记录信息
|
||||
*
|
||||
* @param id 电池充电算法记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteChargeAlgorithmRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 通过订单号查询充电电池算法报告
|
||||
* @param orderCode
|
||||
* @return
|
||||
*/
|
||||
ChargeAlgorithmRecord queryRecordByOrderCode(String orderCode);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.pile.service.ChargeAlgorithmRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.jsowell.pile.mapper.ChargeAlgorithmRecordMapper;
|
||||
import com.jsowell.pile.domain.ChargeAlgorithmRecord;
|
||||
|
||||
/**
|
||||
* 电池充电算法记录Service业务层处理
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2025-04-12
|
||||
*/
|
||||
@Service
|
||||
public class ChargeAlgorithmRecordServiceImpl implements ChargeAlgorithmRecordService {
|
||||
@Autowired
|
||||
private ChargeAlgorithmRecordMapper chargeAlgorithmRecordMapper;
|
||||
|
||||
/**
|
||||
* 查询电池充电算法记录
|
||||
*
|
||||
* @param id 电池充电算法记录主键
|
||||
* @return 电池充电算法记录
|
||||
*/
|
||||
@Override
|
||||
public ChargeAlgorithmRecord selectChargeAlgorithmRecordById(Long id) {
|
||||
return chargeAlgorithmRecordMapper.selectChargeAlgorithmRecordById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询电池充电算法记录列表
|
||||
*
|
||||
* @param chargeAlgorithmRecord 电池充电算法记录
|
||||
* @return 电池充电算法记录
|
||||
*/
|
||||
@Override
|
||||
public List<ChargeAlgorithmRecord> selectChargeAlgorithmRecordList(ChargeAlgorithmRecord chargeAlgorithmRecord) {
|
||||
return chargeAlgorithmRecordMapper.selectChargeAlgorithmRecordList(chargeAlgorithmRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增电池充电算法记录
|
||||
*
|
||||
* @param chargeAlgorithmRecord 电池充电算法记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertChargeAlgorithmRecord(ChargeAlgorithmRecord chargeAlgorithmRecord) {
|
||||
chargeAlgorithmRecord.setCreateTime(DateUtils.getNowDate());
|
||||
return chargeAlgorithmRecordMapper.insertChargeAlgorithmRecord(chargeAlgorithmRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改电池充电算法记录
|
||||
*
|
||||
* @param chargeAlgorithmRecord 电池充电算法记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateChargeAlgorithmRecord(ChargeAlgorithmRecord chargeAlgorithmRecord) {
|
||||
return chargeAlgorithmRecordMapper.updateChargeAlgorithmRecord(chargeAlgorithmRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除电池充电算法记录
|
||||
*
|
||||
* @param ids 需要删除的电池充电算法记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteChargeAlgorithmRecordByIds(Long[] ids) {
|
||||
return chargeAlgorithmRecordMapper.deleteChargeAlgorithmRecordByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除电池充电算法记录信息
|
||||
*
|
||||
* @param id 电池充电算法记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteChargeAlgorithmRecordById(Long id) {
|
||||
return chargeAlgorithmRecordMapper.deleteChargeAlgorithmRecordById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过订单号查询充电电池算法报告
|
||||
* @param orderCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ChargeAlgorithmRecord queryRecordByOrderCode(String orderCode) {
|
||||
return chargeAlgorithmRecordMapper.queryRecordByOrderCode(orderCode);
|
||||
}
|
||||
}
|
||||
@@ -8,18 +8,22 @@ import com.jsowell.adapay.dto.PaymentConfirmParam;
|
||||
import com.jsowell.adapay.dto.SplitData;
|
||||
import com.jsowell.adapay.response.PaymentConfirmResponse;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.model.LoginUser;
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.common.enums.DelFlagEnum;
|
||||
import com.jsowell.common.enums.adapay.AdapayStatusEnum;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.AdapayMemberAccount;
|
||||
import com.jsowell.pile.domain.OrderSplitRecord;
|
||||
import com.jsowell.pile.domain.PileMerchantInfo;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitDTO;
|
||||
import com.jsowell.pile.dto.SplitOrderDTO;
|
||||
import com.jsowell.pile.mapper.OrderSplitRecordMapper;
|
||||
import com.jsowell.pile.service.AdapayMemberAccountService;
|
||||
import com.jsowell.pile.service.OrderSplitRecordService;
|
||||
import com.jsowell.pile.service.PileMerchantInfoService;
|
||||
import com.jsowell.pile.vo.OrderInfoDetailVO;
|
||||
import com.jsowell.pile.vo.web.*;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -28,10 +32,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@@ -40,6 +41,9 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
|
||||
@Resource
|
||||
private OrderSplitRecordMapper orderSplitRecordMapper;
|
||||
|
||||
@Autowired
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Autowired
|
||||
private AdapayMemberAccountService adapayMemberAccountService;
|
||||
|
||||
@@ -264,6 +268,10 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
|
||||
@Override
|
||||
public PageResponse queryOrderSplitData(QueryOrderSplitDTO dto) {
|
||||
List<SplitRecordInfoVO> resultList = new ArrayList<>();
|
||||
// 获取当前登录用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
// 通过 depId 查询运营商记录表,如果查出来,则为运营商
|
||||
PileMerchantInfo pileMerchantInfo = pileMerchantInfoService.queryInfoByDeptId(String.valueOf(loginUser.getDeptId()));
|
||||
|
||||
// 设置分页参数
|
||||
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
|
||||
@@ -274,6 +282,7 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
|
||||
List<String> orderCodes = orderSplitRecordMapper.queryOrderCodesByParams(dto);
|
||||
PageInfo<String> pageInfo = new PageInfo<>(orderCodes);
|
||||
|
||||
// 查询符合条件的分账记录
|
||||
List<OrderSplitRecordVO> orderSplitRecordVOS = orderSplitRecordMapper.queryOrderSplitData(pageInfo.getList());
|
||||
|
||||
// 根据 orderCode 分组
|
||||
@@ -307,10 +316,21 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
|
||||
.build();
|
||||
orderSplitList.add(orderSplit);
|
||||
}
|
||||
// 对 orderSplitList 进行排序,将当前登录用户的分账记录放在第一条
|
||||
if (pileMerchantInfo != null) {
|
||||
for (int i = 0; i < orderSplitList.size(); i++) {
|
||||
SplitRecordInfoVO.OrderSplit orderSplit = orderSplitList.get(i);
|
||||
if (StringUtils.equals(String.valueOf(pileMerchantInfo.getId()), orderSplit.getMerchantId())) {
|
||||
// 实则是调用swap()方法,将符合条件的记录与第一条记录进行位置互换
|
||||
Collections.swap(orderSplitList, i, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
vo.setOrderSplitList(orderSplitList);
|
||||
|
||||
resultList.add(vo);
|
||||
}
|
||||
|
||||
// 组装分页返回参数
|
||||
PageResponse pageResponse = PageResponse.builder()
|
||||
.pageSize(pageSize)
|
||||
|
||||
Reference in New Issue
Block a user