门店收益查询条件修改

This commit is contained in:
geng.tang@qq.com
2024-04-23 15:56:47 +08:00
parent d1f41aa8e8
commit 0ff3937e0b
10 changed files with 90 additions and 19 deletions

View File

@@ -236,7 +236,6 @@ public class OrderTask {
return;
}
Set<Integer> equipmentIds = new HashSet<>();
Set<Integer> orderIds = new HashSet<>();
Set<String> tuijianUserPhones = new HashSet<>();
@@ -247,7 +246,7 @@ public class OrderTask {
for (OrderPay order : orderList) {
equipmentIds.add(order.getEquipmentId());
mendianCodes.add(order.getMerchantCode());
orderIds.add(order.getId());
orderIds.add(order.getRentOrderId());
userIds.add(order.getUserId());
if (order.getDealerPhone() != null) {
tuijianUserPhones.add(order.getDealerPhone());
@@ -303,7 +302,7 @@ public class OrderTask {
// 查询所有区域经理
// Wrappers.lambdaQuery(Manager.class)
List<Manager> jingliList = managerService.list();
List<Integer> finalOrderIds = new ArrayList<>();
// 开始结算
for (OrderPay order : orderList) {
@@ -322,7 +321,7 @@ public class OrderTask {
User orderUser = orderUserMap.get(order.getUserId()).get(0);
List<EquipmentOrderGoods> equipmentOrderGoods = orderGoodsMap.get(order.getId());
List<EquipmentOrderGoods> equipmentOrderGoods = orderGoodsMap.get(order.getRentOrderId());
if (CollectionUtils.isNotEmpty(equipmentOrderGoods)) {
EquipmentOrderGoods orderGoods = equipmentOrderGoods.get(0);
BigDecimal touziProfit;
@@ -384,7 +383,7 @@ public class OrderTask {
profitLog.setOrderId(order.getId());
profitLog.setOrderNo(orderNo);
profitLog.setOrderUserName(orderUser.getNickname());
profitLog.setComments("推广收益:" + order.getUserId());
profitLog.setComments("推广收益:" + orderUser.getPhone());
profitLog.setEquipmentCode(equipment.getEquipmentCode());
profitLog.setOrderSource(order.getOrderSource());
// profitLog.setIsRenew(order.getIsRenew());
@@ -407,7 +406,7 @@ public class OrderTask {
profitLog.setOrderId(order.getId());
profitLog.setOrderNo(orderNo);
profitLog.setOrderUserName(orderUser.getNickname());
profitLog.setComments("门店收益:" + order.getMerchantCode());
profitLog.setComments("门店收益:" + merchant.getMerchantName());
profitLog.setEquipmentCode(equipment.getEquipmentCode());
profitLog.setMerchantName(merchant.getMerchantName());
profitLog.setOrderSource(order.getOrderSource());
@@ -440,7 +439,7 @@ public class OrderTask {
profitLog.setOrderId(order.getId());
profitLog.setOrderNo(orderNo);
profitLog.setOrderUserName(orderUser.getNickname());
profitLog.setComments("区域经理收益:" + order.getMerchantCode());
profitLog.setComments("区域经理收益:" + order.getMerchantName());
profitLog.setEquipmentCode(equipment.getEquipmentCode());
profitLog.setMerchantName(merchant.getMerchantName());
profitLog.setOrderSource(order.getOrderSource());
@@ -449,14 +448,17 @@ public class OrderTask {
log.info("发放区域经理{}分润,订单号{}", managerUserId, orderNo);
}
}
finalOrderIds.add(order.getId());
} else {
log.info("订单{}无电池记录!", order.getId());
}
}
// 设置为已结算
LambdaUpdateWrapper<OrderPay> updateWrapper = Wrappers.lambdaUpdate(OrderPay.class).in(OrderPay::getId, orderIds).set(OrderPay::getIsSettled, 1);
orderPayService.update(updateWrapper);
if(CollectionUtil.isNotEmpty(finalOrderIds)){
LambdaUpdateWrapper<OrderPay> updateWrapper = Wrappers.lambdaUpdate(OrderPay.class).in(OrderPay::getId, finalOrderIds).set(OrderPay::getIsSettled, 1).set(OrderPay::getSettledTime, new Date());
orderPayService.update(updateWrapper);
}
}
/**

View File

@@ -0,0 +1,40 @@
package com.gxwebsoft.common.core.utils;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
/**
* @author tanggeng
* @date 2023/5/29 16:39
* @description LOCALDATE转化
*/
public class LocalDateUtil {
public static Date localDate2Date(LocalDate lDate){
return Date.from(lDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
}
public static Date localDateTime2Date(LocalDateTime lDate){
return Date.from(lDate.atZone(ZoneId.systemDefault()).toInstant());
}
public static LocalDate date2LocalDate(Date lDate){
if(null == lDate){
return null;
}
Instant instant = lDate.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
return instant.atZone(zoneId).toLocalDate();
}
public static LocalDateTime date2LocalDateTime(Date lDate){
if(null == lDate){
return null;
}
Instant instant = lDate.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
return instant.atZone(zoneId).toLocalDateTime();
}
}

View File

@@ -140,7 +140,7 @@ public class MainController extends BaseController {
public ApiResult<User> userInfo() {
final Integer loginUserId = getLoginUserId();
if(loginUserId != null){
return success(userService.getByIdRel(getLoginUserId()));
return success(userService.getByIdRel(loginUserId));
}
return fail("loginUserId不存在",null);
}

View File

@@ -119,9 +119,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
@Override
public User getByIdRel(Integer userId) {
UserParam param = new UserParam();
param.setUserId(userId);
User user = param.getOne(baseMapper.selectListRel(param));
// UserParam param = new UserParam();
// param.setUserId(userId);
// User user = param.getOne(baseMapper.selectListRel(param));
User user = baseMapper.selectById(userId);
if (user != null) {
user.setRoles(userRoleService.listByUserId(user.getUserId()));
user.setAuthorities(roleMenuService.listMenuByUserId(user.getUserId(), null));

View File

@@ -1,8 +1,11 @@
package com.gxwebsoft.shop.controller;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gxwebsoft.common.core.utils.CommonUtil;
import com.gxwebsoft.common.core.utils.LocalDateUtil;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.shop.service.ProfitLogService;
@@ -20,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
/**
@@ -40,12 +44,22 @@ public class ProfitLogController extends BaseController {
@GetMapping("/page")
public ApiResult<PageResult<ProfitLog>> page(ProfitLogParam param) {
PageParam<ProfitLog, ProfitLogParam> page = new PageParam<>(param);
QueryWrapper<ProfitLog> wrapper = page.getWrapper();
QueryWrapper<ProfitLog> wrapper = page.getWrapper("beginDate", "endDate", "scene");
LocalDate beginDate = param.getBeginDate();
wrapper.ge(null != beginDate, "create_time", beginDate);
if(null != beginDate){
// Date dBegin = LocalDateUtil.localDate2Date(beginDate);
wrapper.ge("create_time", beginDate);
}
LocalDate endDate = param.getEndDate();
if(null != endDate){
wrapper.lt("create_time", endDate);
// Date dEnd = LocalDateUtil.localDate2Date(endDate.plusDays(1));
wrapper.lt("create_time", endDate.plusDays(1));
}
Integer scene = param.getScene();
if(null != scene && scene > 0){
wrapper.eq("scene", scene);
}
wrapper.orderByDesc("create_time");

View File

@@ -45,6 +45,9 @@ public class MerchantWithdraw implements Serializable {
@ApiModelProperty(value = "用户昵称")
private String nickname;
@ApiModelProperty(value = "提现用户手机号")
private String userPhone;
@ApiModelProperty(value = "提现金额")
private BigDecimal money;

View File

@@ -1,5 +1,6 @@
package com.gxwebsoft.shop.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
@@ -8,6 +9,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDate;
@@ -58,8 +60,10 @@ public class ProfitLogParam extends BaseParam {
private Integer status;
@ApiModelProperty(value = "开始日期")
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
private LocalDate beginDate;
@ApiModelProperty(value = "结束日期")
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
private LocalDate endDate;
}

View File

@@ -129,6 +129,7 @@ public class MerchantWithdrawServiceImpl extends ServiceImpl<MerchantWithdrawMap
.withdrawCode(IdUtil.getSnowflakeNextIdStr())
.userId(userId)
.nickname(user.getNickname())
.userPhone(user.getPhone())
.tenantId(tenantId)
.money(amount)
.cardType(cardType)

View File

@@ -71,6 +71,7 @@ mybatis-plus:
configuration:
map-underscore-to-camel-case: true
cache-enabled: true
log-impl: ${LOG_IMPL:org.apache.ibatis.logging.nologging.NoLoggingImpl}
global-config:
:banner: false
db-config: