This commit is contained in:
weicw
2023-08-11 14:30:45 +08:00
parent 44cfec9028
commit 0adf61744b
31 changed files with 1268 additions and 44 deletions

View File

@@ -123,7 +123,7 @@ public class BcCartController extends BaseController {
.eq(Order::getPayStatus,PAY_STATUS_SUCCESS)
.eq(Order::getDeliveryTime, Date.valueOf(d.getDeliveryTime())));
if(one == null){
order.setOrderNo(IdUtil.getSnowflakeNextId());
order.setOrderNo(String.valueOf(IdUtil.getSnowflakeNextId()));
order.setTotalPrice(d.getTotalPrice());
order.setOrderPrice(d.getTotalPrice());
order.setPayPrice(d.getTotalPrice());

View File

@@ -151,7 +151,7 @@ public class EquipmentController extends BaseController {
record.setEquipmentCode(one.getEquipmentCode());
record.setUserId(getLoginUserId());
record.setEventType(EVENT_TYPE_BIND);
record.setComments("订单号:".concat(Long.toString(order.getOrderNo())));
record.setComments("订单号:".concat(order.getOrderNo()));
record.setMerchantCode(one.getMerchantCode());
equipmentRecordService.save(record);
// 订单发货

View File

@@ -81,6 +81,30 @@ public class EquipmentGoods implements Serializable {
@ApiModelProperty(value = "手续费")
private BigDecimal serviceCharges;
@ApiModelProperty(value = "投资人收益")
private BigDecimal touziProfit;
@ApiModelProperty(value = "投资人分期首期收益")
private BigDecimal touziFirstProfit;
@ApiModelProperty(value = "推荐人收益")
private BigDecimal tuijianProfit;
@ApiModelProperty(value = "推荐人分期首期收益")
private BigDecimal tuijianFirstProfit;
@ApiModelProperty(value = "门店收益")
private BigDecimal mendianProfit;
@ApiModelProperty(value = "门店分期首期收益")
private BigDecimal mendianFirstProfit;
@ApiModelProperty(value = "区域经理收益")
private BigDecimal jingliProfit;
@ApiModelProperty(value = "区域经理分期首期收益")
private BigDecimal jingliFirstProfit;
@ApiModelProperty(value = "分期方式")
private Integer periodsType;

View File

@@ -67,6 +67,30 @@ public class EquipmentOrderGoods implements Serializable {
@ApiModelProperty(value = "电池押金")
private BigDecimal batteryDeposit;
@ApiModelProperty(value = "投资人收益")
private BigDecimal touziProfit;
@ApiModelProperty(value = "投资人分期首期收益")
private BigDecimal touziFirstProfit;
@ApiModelProperty(value = "推荐人收益")
private BigDecimal tuijianProfit;
@ApiModelProperty(value = "推荐人分期首期收益")
private BigDecimal tuijianFirstProfit;
@ApiModelProperty(value = "门店收益")
private BigDecimal mendianProfit;
@ApiModelProperty(value = "门店分期首期收益")
private BigDecimal mendianFirstProfit;
@ApiModelProperty(value = "区域经理收益")
private BigDecimal jingliProfit;
@ApiModelProperty(value = "区域经理分期首期收益")
private BigDecimal jingliFirstProfit;
@ApiModelProperty(value = "电池保险")
private BigDecimal batteryInsurance;

View File

@@ -2,28 +2,41 @@ package com.gxwebsoft.apps.task;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.gxwebsoft.apps.entity.Equipment;
import com.gxwebsoft.apps.entity.EquipmentOrderGoods;
import com.gxwebsoft.apps.service.EquipmentGoodsService;
import com.gxwebsoft.apps.service.EquipmentOrderGoodsService;
import com.gxwebsoft.apps.service.EquipmentService;
import com.gxwebsoft.common.core.config.MybatisPlusConfig;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.common.system.service.UserService;
import com.gxwebsoft.love.entity.UserPlanLog;
import com.gxwebsoft.love.param.UserPlanLogParam;
import com.gxwebsoft.shop.entity.Manager;
import com.gxwebsoft.shop.entity.Merchant;
import com.gxwebsoft.shop.entity.Order;
import com.gxwebsoft.shop.entity.ProfitLog;
import com.gxwebsoft.shop.param.OrderParam;
import com.gxwebsoft.shop.service.ManagerService;
import com.gxwebsoft.shop.service.MerchantService;
import com.gxwebsoft.shop.service.OrderService;
import com.gxwebsoft.shop.service.ProfitLogService;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.NumberUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -44,15 +57,28 @@ public class OrderTask {
private EquipmentService equipmentService;
@Resource
private EquipmentGoodsService goodsService;
private EquipmentGoodsService equipmentGoodsService;
@Resource
private EquipmentOrderGoodsService orderGoodsService;
@Resource
private UserService userService;
@Resource
private MerchantService merchantService;
@Resource
private ProfitLogService profitLogService;
@Resource
private ManagerService managerService;
/**
* 删除30分钟未下单的订单
*/
@Scheduled(cron="0 0/30 * * * ? ")
// @Scheduled(cron="0 0/30 * * * ? ")
public void removeTimeoutOrder() {
Date newDate = DateUtil.offset(DateUtil.date(), DateField.MINUTE, -30);
LambdaQueryWrapper<Order> wrapper = Wrappers.lambdaQuery(Order.class)
@@ -66,7 +92,7 @@ public class OrderTask {
/**
* 计算分润
*/
@Scheduled(cron="0 0/30 * * * ? ")
@Scheduled(cron="0 0/1 * * * ? ")
@Transactional
public void CalcProfit() {
log.info("开始计算分润");
@@ -77,30 +103,44 @@ public class OrderTask {
.eq(Order::getOrderStatus, ORDER_STATUS_COMPLETED);
List<Order> orderList = orderService.list(wrapper);
if(CollectionUtils.isEmpty(orderList)){
return;
}
// 查询所有关联的设备
Set<Integer> equipmentIds = new HashSet<>();
Set<Integer> orderIds = new HashSet<>();
Set<String> tuijianUserPhones = new HashSet<>();
Set<String> mendianCodes = new HashSet<>();
for (Order order : orderList) {
equipmentIds.add(order.getEquipmentId());
if(order.getDealerPhone() != null){
mendianCodes.add(order.getMerchantCode());
orderIds.add(order.getOrderId());
if (order.getDealerPhone() != null) {
tuijianUserPhones.add(order.getDealerPhone());
}
}
// 查询所有订单商品
List<EquipmentOrderGoods> orderGoodsList = orderGoodsService.list(Wrappers.lambdaQuery(EquipmentOrderGoods.class).in(EquipmentOrderGoods::getOrderId, orderIds));
Map<Integer, List<EquipmentOrderGoods>> orderGoodsMap = orderGoodsList.stream().collect(Collectors.groupingBy(EquipmentOrderGoods::getOrderId));
// 查询所有关联的设备
List<Equipment> equipmentList = equipmentService.list(Wrappers.lambdaQuery(Equipment.class).in(Equipment::getEquipmentId, equipmentIds));
Map<Integer, Equipment> equipmentMap = new HashMap<>();
Set<Integer> touziUserIds = new HashSet<>();
for (Equipment equipment : equipmentList) {
equipmentMap.put(equipment.getEquipmentId(),equipment);
if(equipment.getTouziUserId() != null) {
equipmentMap.put(equipment.getEquipmentId(), equipment);
if (equipment.getTouziUserId() != null) {
touziUserIds.add(equipment.getTouziUserId());
}
}
// 查询所有投资人
Map<Integer, User> touziUserMap = new HashMap<>();
if(CollectionUtils.isNotEmpty(touziUserIds)){
if (CollectionUtils.isNotEmpty(touziUserIds)) {
List<User> list = userService.list(Wrappers.lambdaQuery(User.class).in(User::getUserId, touziUserIds));
for (User user : list) {
touziUserMap.put(user.getUserId(), user);
@@ -109,33 +149,135 @@ public class OrderTask {
// 查询所有推荐人
Map<String, User> tuijianUserMap = new HashMap<>();
if(CollectionUtils.isNotEmpty(tuijianUserPhones)){
if (CollectionUtils.isNotEmpty(tuijianUserPhones)) {
List<User> tuijianUserList = userService.list(Wrappers.lambdaQuery(User.class).in(User::getPhone, tuijianUserPhones));
for (User user : tuijianUserList) {
tuijianUserMap.put(user.getPhone(), user);
}
}
// 查询所有门店
Map<String, Merchant> mendianMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(mendianCodes)) {
List<Merchant> merchantList = merchantService.list(Wrappers.lambdaQuery(Merchant.class).in(Merchant::getMerchantCode, mendianCodes));
for (Merchant merchant : merchantList) {
mendianMap.put(merchant.getMerchantCode(), merchant);
}
}
// 查询所有区域经理
// Wrappers.lambdaQuery(Manager.class)
List<Manager> jingliList = managerService.list();
// 开始结算
for (Order order : orderList) {
// 计算投资人收益
Equipment equipment = equipmentMap.get(order.getEquipment());
User touziUser = touziUserMap.get(equipment.getTouziUserId());
if(touziUser != null){
List<EquipmentOrderGoods> equipmentOrderGoods = orderGoodsMap.get(order.getOrderId());
if (CollectionUtils.isNotEmpty(equipmentOrderGoods)) {
EquipmentOrderGoods orderGoods = equipmentOrderGoods.get(0);
BigDecimal touziProfit;
BigDecimal tuijianProfit;
BigDecimal mendianProfit;
BigDecimal jingliProfit;
Merchant merchant = mendianMap.get(order.getMerchantCode());
// 是否分期首期
if ("20".equals(orderGoods.getEquipmentCategory()) && order.getIsRenew() == 0) {
touziProfit = orderGoods.getTouziFirstProfit();
tuijianProfit = orderGoods.getTuijianFirstProfit();
mendianProfit = orderGoods.getMendianFirstProfit();
jingliProfit = orderGoods.getJingliFirstProfit();
} else {
touziProfit = orderGoods.getTouziProfit();
tuijianProfit = orderGoods.getTuijianProfit();
mendianProfit = orderGoods.getMendianProfit();
jingliProfit = orderGoods.getJingliProfit();
}
// 投资人收益
if (touziProfit.compareTo(BigDecimal.ZERO) > 0) {
Equipment equipment = equipmentMap.get(order.getEquipmentId());
User touziUser = touziUserMap.get(equipment.getTouziUserId());
if (touziUser != null) {
userService.updateBalanceByUserId(touziUser.getUserId(), touziProfit);
ProfitLog profitLog = new ProfitLog();
profitLog.setUserId(touziUser.getUserId());
profitLog.setMoney(touziProfit);
profitLog.setScene(1);
profitLog.setMerchantCode(merchant.getMerchantCode());
profitLog.setOrderId(order.getOrderId());
profitLog.setOrderNo(order.getOrderNo());
profitLog.setComments("投资设备:" + equipment.getEquipmentCode());
profitLogService.save(profitLog);
}
}
//推荐人收益
if (tuijianProfit.compareTo(BigDecimal.ZERO) > 0) {
User tuijianUser = tuijianUserMap.get(order.getDealerPhone());
if (tuijianUser != null) {
userService.updateBalanceByUserId(tuijianUser.getUserId(), tuijianProfit);
ProfitLog profitLog = new ProfitLog();
profitLog.setUserId(tuijianUser.getUserId());
profitLog.setMoney(tuijianProfit);
profitLog.setScene(3);
profitLog.setMerchantCode(merchant.getMerchantCode());
profitLog.setOrderId(order.getOrderId());
profitLog.setOrderNo(order.getOrderNo());
profitLog.setComments("推广收益:" + order.getUserId());
profitLogService.save(profitLog);
}
}
// 计算门店收益
if (mendianProfit.compareTo(BigDecimal.ZERO) > 0) {
Integer mendianUserId = merchant.getMerchantOwner();
if (mendianUserId != null) {
userService.updateBalanceByUserId(mendianUserId, mendianProfit);
ProfitLog profitLog = new ProfitLog();
profitLog.setUserId(mendianUserId);
profitLog.setMoney(mendianProfit);
profitLog.setScene(4);
profitLog.setMerchantCode(merchant.getMerchantCode());
profitLog.setOrderId(order.getOrderId());
profitLog.setOrderNo(order.getOrderNo());
profitLog.setComments("门店收益:" + order.getMerchantCode());
profitLogService.save(profitLog);
}
}
// 计算区域经理收益
if (jingliProfit.compareTo(BigDecimal.ZERO) > 0) {
Manager manager = null;
if (merchant.getManagerId() != null) {
manager = jingliList.stream().filter(d -> {
return d.getUserId().equals(merchant.getManagerId());
}).findFirst().orElse(null);
} else {
manager = jingliList.stream().filter(d -> {
return d.getProvince().equals(merchant.getProvince()) && d.getCity().equals(merchant.getCity()) && d.getArea().equals(merchant.getRegion());
}).findFirst().orElse(null);
}
if (manager != null) {
userService.updateBalanceByUserId(manager.getUserId(), jingliProfit);
ProfitLog profitLog = new ProfitLog();
profitLog.setUserId(manager.getUserId());
profitLog.setMoney(jingliProfit);
profitLog.setMerchantCode(merchant.getMerchantCode());
profitLog.setScene(5);
profitLog.setOrderId(order.getOrderId());
profitLog.setOrderNo(order.getOrderNo());
profitLog.setComments("门店业绩:" + order.getMerchantCode());
profitLogService.save(profitLog);
}
}
}
//获取推荐人身份、 计算推荐人收益
User tuijianUser = tuijianUserMap.get(order.getDealerPhone());
if(tuijianUser != null){
}
// 计算门店收益
// 计算区域经理收益
System.out.println(equipment);
}
LambdaUpdateWrapper<Order> updateWrapper = Wrappers.lambdaUpdate(Order.class).in(Order::getOrderId, orderIds).set(Order::getIsSettled, 1);
orderService.update(updateWrapper);
}
}

View File

@@ -52,4 +52,7 @@ public interface UserMapper extends BaseMapper<User> {
@InterceptorIgnore(tenantLine = "true")
void updateByUserId(@Param("param") User param);
@InterceptorIgnore(tenantLine = "true")
int updateBalanceByUserId(@Param("param") UserParam param);
}

View File

@@ -234,4 +234,8 @@
UPDATE sys_user SET grade_id = #{param.gradeId} WHERE user_id = #{param.userId}
</update>
<!-- 更新用户余额 -->
<update id="updateBalanceByUserId">
UPDATE sys_user SET balance = balance + #{param.balance} WHERE user_id = #{param.userId}
</update>
</mapper>

View File

@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.common.system.param.UserParam;
import io.swagger.models.auth.In;
import org.springframework.security.core.userdetails.UserDetailsService;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -109,4 +111,6 @@ public interface UserService extends IService<User>, UserDetailsService {
* @param user 用户信息
*/
void updateByUserId(User user);
boolean updateBalanceByUserId(Integer userId, BigDecimal balance);
}

View File

@@ -36,6 +36,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
@@ -302,6 +303,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
baseMapper.updateByUserId(user);
}
@Override
public boolean updateBalanceByUserId(Integer userId, BigDecimal balance) {
UserParam userParam = new UserParam();
userParam.setUserId(userId);
userParam.setBalance(balance);
int updated = baseMapper.updateBalanceByUserId(userParam);
return updated > 0;
}
/**
* 批量查询用户的角色
*

View File

@@ -87,7 +87,7 @@ public class OpenCartController extends BaseController {
}
// 2.创建订单
Order order = new Order();
order.setOrderNo(IdUtil.getSnowflakeNextId());
order.setOrderNo(String.valueOf(IdUtil.getSnowflakeNextId()));
order.setTotalPrice(param.getTotalPrice());
order.setOrderPrice(param.getTotalPrice());
order.setPayPrice(param.getTotalPrice());

View File

@@ -0,0 +1,152 @@
package com.gxwebsoft.shop.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.core.web.*;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.shop.entity.Manager;
import com.gxwebsoft.shop.param.ManagerParam;
import com.gxwebsoft.shop.service.ManagerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 区域经理控制器
*
* @author 科技小王子
* @since 2022-11-25 14:02:24
*/
@Api(tags = "区域经理管理")
@RestController
@RequestMapping("/api/shop/manager")
public class ManagerController extends BaseController {
@Resource
private ManagerService managerService;
@PreAuthorize("hasAuthority('shop:manager:list')")
@OperationLog
@ApiOperation("分页查询区域经理")
@GetMapping("/page")
public ApiResult<PageResult<Manager>> page(ManagerParam param) {
PageParam<Manager, ManagerParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
// return success(managerService.page(page, page.getWrapper()));
// 使用关联查询
return success(managerService.pageRel(param));
}
@PreAuthorize("hasAuthority('shop:manager:list')")
@OperationLog
@ApiOperation("查询全部区域经理")
@GetMapping()
public ApiResult<List<Manager>> list(ManagerParam param) {
PageParam<Manager, ManagerParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
// return success(managerService.list(page.getOrderWrapper()));
// 使用关联查询
return success(managerService.listRel(param));
}
@PreAuthorize("hasAuthority('shop:manager:list')")
@OperationLog
@ApiOperation("根据id查询区域经理")
@GetMapping("/{id}")
public ApiResult<Manager> get(@PathVariable("id") Integer id) {
// return success(managerService.getById(id));
// 使用关联查询
return success(managerService.getByIdRel(id));
}
@PreAuthorize("hasAuthority('shop:manager:save')")
@OperationLog
@ApiOperation("添加区域经理")
@PostMapping()
public ApiResult<?> save(@RequestBody Manager manager) {
// 查询该地区是否已有区域经理
LambdaQueryWrapper<Manager> wrapper = Wrappers.lambdaQuery(Manager.class)
.eq(Manager::getProvince, manager.getProvince())
.eq(Manager::getCity, manager.getCity())
.eq(Manager::getArea, manager.getArea());
int count = managerService.count(wrapper);
if(count > 0){
return fail("次区域已有区域经理");
}
// 记录当前登录用户id、租户id
if (managerService.save(manager)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('shop:manager:update')")
@OperationLog
@ApiOperation("修改区域经理")
@PutMapping()
public ApiResult<?> update(@RequestBody Manager manager) {
// 查询该地区是否已有区域经理
LambdaQueryWrapper<Manager> wrapper = Wrappers.lambdaQuery(Manager.class)
.eq(Manager::getProvince, manager.getProvince())
.eq(Manager::getCity, manager.getCity())
.eq(Manager::getArea, manager.getArea())
.ne(Manager::getManagerId, manager.getManagerId());
int count = managerService.count(wrapper);
if(count > 0){
return fail("此区域已有区域经理");
}
if (managerService.updateById(manager)) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('shop:manager:remove')")
@OperationLog
@ApiOperation("删除区域经理")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (managerService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('shop:manager:save')")
@OperationLog
@ApiOperation("批量添加区域经理")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<Manager> list) {
if (managerService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('shop:manager:update')")
@OperationLog
@ApiOperation("批量修改区域经理")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<Manager> batchParam) {
if (batchParam.update(managerService, "manager_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('shop:manager:remove')")
@OperationLog
@ApiOperation("批量删除区域经理")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (managerService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}

View File

@@ -1,10 +1,12 @@
package com.gxwebsoft.shop.controller;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.extra.qrcode.QrConfig;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.gxwebsoft.apps.entity.BcAgent;
@@ -80,7 +82,7 @@ public class OrderController extends BaseController {
@GetMapping("/page")
public ApiResult<PageResult<Order>> page(OrderParam param) {
// 搜索条件
if (getMerchantCode() != null) {
if ((param.getIsApp() == null || param.getIsApp() != true )&& getMerchantCode() != null) {
param.setMerchantCode(getMerchantCode());
}
// 云芯威项目查询关联设备
@@ -98,18 +100,34 @@ public class OrderController extends BaseController {
Map<Integer, List<Equipment>> equipmentCollect = equipmentList.stream().collect(Collectors.groupingBy(Equipment::getEquipmentId));
Map<Integer, List<EquipmentOrderGoods>> equipmentOrderGoodsCollect = equipmentOrderGoodsList.stream().collect(Collectors.groupingBy(EquipmentOrderGoods::getOrderId));
List<Order> renewOrderList = orderService.list(Wrappers.lambdaQuery(Order.class).eq(Order::getIsRenew, 1).in(Order::getRentOrderId, orderIds).eq(Order::getPayStatus,PAY_STATUS_SUCCESS));
Map<Integer, List<Order>> renewOrderMap = renewOrderList.stream().collect(Collectors.groupingBy(Order::getRentOrderId));
// 查询订单的设备
for (Order order : list) {
final OrderGoodsParam orderGoodsParam = new OrderGoodsParam();
orderGoodsParam.setOrderId(order.getOrderId());
List<EquipmentOrderGoods> equipmentOrderGoods = equipmentOrderGoodsCollect.get(order.getOrderId());
if(CollectionUtils.isNotEmpty(equipmentOrderGoods)){
order.setEquipmentGoods(equipmentOrderGoods.get(0));
if(CollectionUtils.isEmpty(equipmentOrderGoods)){
continue;
}
EquipmentOrderGoods orderGoods = equipmentOrderGoods.get(0);
order.setEquipmentGoods(orderGoods);
List<Equipment> equipment = equipmentCollect.get(order.getEquipmentId());
if(CollectionUtils.isNotEmpty(equipment)){
order.setEquipment(equipment.get(0));
}
// 续租订单
List<Order> renewOrders = renewOrderMap.get(order.getOrderId());
if(CollectionUtils.isNotEmpty(renewOrders) && renewOrders.size() >= orderGoods.getPeriods().intValue()){
order.setFenqiStatus(1);
}
// 逾期时间
long between = DateUtil.between( order.getExpirationTime(),DateUtil.date(), DateUnit.DAY);
if(DateUtil.date().isAfter(order.getExpirationTime())){
order.setExpirationDay((int) -between);
}else {
order.setExpirationDay((int) between);
}
}
PageParam<Order, OrderParam> page = new PageParam<>(param);
return success(new PageResult<>(list, page.getTotal()));
@@ -255,21 +273,19 @@ public class OrderController extends BaseController {
oeg.setComments(eg.getComments());
oeg.setStatus(eg.getStatus());
oeg.setMerchantCode(eg.getMerchantCode());
oeg.setTouziProfit(eg.getTouziProfit());
oeg.setTouziFirstProfit(eg.getTouziFirstProfit());
oeg.setTuijianProfit(eg.getTuijianProfit());
oeg.setTuijianFirstProfit(eg.getTuijianFirstProfit());
oeg.setMendianProfit(eg.getMendianProfit());
oeg.setMendianFirstProfit(eg.getMendianFirstProfit());
oeg.setJingliProfit(eg.getJingliProfit());
oeg.setJingliFirstProfit(eg.getJingliFirstProfit());
oeg.setTenantId(eg.getTenantId());
equipmentOrderGoodsService.saveOrUpdate(oeg);
// 添加推荐人关系
if (order.getDealerId() != null) {
final User dealer = userService.getById(order.getDealerId());
if (dealer == null) {
return fail("推荐人的用户ID不存在");
}
final UserReferee referee = new UserReferee();
referee.setDealerId(order.getDealerId());
referee.setUserId(getLoginUserId());
userRefereeService.save(referee);
}
}
// 是否存入星期值(10048)
if (order.getDeliveryTime() != null) {

View File

@@ -0,0 +1,136 @@
package com.gxwebsoft.shop.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.shop.service.ProfitLogService;
import com.gxwebsoft.shop.entity.ProfitLog;
import com.gxwebsoft.shop.param.ProfitLogParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 门店收益明细表控制器
*
* @author 科技小王子
* @since 2023-08-10 11:24:02
*/
@Api(tags = "门店收益明细表管理")
@RestController
@RequestMapping("/api/shop/profit-log")
public class ProfitLogController extends BaseController {
@Resource
private ProfitLogService profitLogService;
@OperationLog
@ApiOperation("分页查询门店收益明细表")
@GetMapping("/page")
public ApiResult<PageResult<ProfitLog>> page(ProfitLogParam param) {
PageParam<ProfitLog, ProfitLogParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
return success(profitLogService.page(page, page.getWrapper()));
// 使用关联查询
//return success(profitLogService.pageRel(param));
}
@OperationLog
@ApiOperation("查询全部门店收益明细表")
@GetMapping()
public ApiResult<List<ProfitLog>> list(ProfitLogParam param) {
PageParam<ProfitLog, ProfitLogParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
return success(profitLogService.list(page.getOrderWrapper()));
// 使用关联查询
//return success(profitLogService.listRel(param));
}
@OperationLog
@ApiOperation("根据id查询门店收益明细表")
@GetMapping("/{id}")
public ApiResult<ProfitLog> get(@PathVariable("id") Integer id) {
return success(profitLogService.getById(id));
// 使用关联查询
//return success(profitLogService.getByIdRel(id));
}
@PreAuthorize("hasAuthority('shop:profitLog:save')")
@OperationLog
@ApiOperation("添加门店收益明细表")
@PostMapping()
public ApiResult<?> save(@RequestBody ProfitLog profitLog) {
// 记录当前登录用户id
User loginUser = getLoginUser();
if (loginUser != null) {
profitLog.setUserId(loginUser.getUserId());
}
if (profitLogService.save(profitLog)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('shop:profitLog:update')")
@OperationLog
@ApiOperation("修改门店收益明细表")
@PutMapping()
public ApiResult<?> update(@RequestBody ProfitLog profitLog) {
if (profitLogService.updateById(profitLog)) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('shop:profitLog:remove')")
@OperationLog
@ApiOperation("删除门店收益明细表")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (profitLogService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('shop:profitLog:save')")
@OperationLog
@ApiOperation("批量添加门店收益明细表")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<ProfitLog> list) {
if (profitLogService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('shop:profitLog:update')")
@OperationLog
@ApiOperation("批量修改门店收益明细表")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<ProfitLog> batchParam) {
if (batchParam.update(profitLogService, "profit_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('shop:profitLog:remove')")
@OperationLog
@ApiOperation("批量删除门店收益明细表")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (profitLogService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}

View File

@@ -0,0 +1,77 @@
package com.gxwebsoft.shop.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* 区域经理
*
* @author 科技小王子
* @since 2022-11-25 14:02:24
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Manager对象", description = "区域经理")
@TableName("shop_manager")
public class Manager implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
@TableId(value = "manager_id", type = IdType.AUTO)
private Integer managerId;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "城区")
private String area;
@ApiModelProperty(value = "城市")
private String city;
@ApiModelProperty(value = "省份")
private String province;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "注册时间")
private Date createTime;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "关联用户")
@TableField(exist = false)
private User user;
@TableField(exist = false)
private String avatar;
@TableField(exist = false)
private String username;
@TableField(exist = false)
private String nickname;
@TableField(exist = false)
private String phone;
}

View File

@@ -28,6 +28,9 @@ public class Merchant implements Serializable {
@TableId(value = "merchant_id", type = IdType.AUTO)
private Integer merchantId;
@ApiModelProperty(value = "区域经理ID")
private Integer managerId;
@ApiModelProperty(value = "商户名称")
private String merchantName;

View File

@@ -34,7 +34,8 @@ public class Order implements Serializable {
private String subject;
@ApiModelProperty(value = "订单号")
private Long orderNo;
private String orderNo;
@ApiModelProperty(value = "商品总金额(不含优惠折扣)")
private BigDecimal totalPrice;
@@ -254,6 +255,10 @@ public class Order implements Serializable {
@TableField(exist = false)
private EquipmentOrderGoods equipmentGoods;
@ApiModelProperty("逾期天数")
@TableField(exist = false)
private Integer expirationDay;
@ApiModelProperty("设备")
@TableField(exist = false)
private Equipment equipment;
@@ -261,4 +266,8 @@ public class Order implements Serializable {
@ApiModelProperty("推荐人ID")
@TableField(exist = false)
private Integer dealerId;
@ApiModelProperty("分期状态 0还款中 1还款结束")
@TableField(exist = false)
private Integer fenqiStatus;
}

View File

@@ -0,0 +1,80 @@
package com.gxwebsoft.shop.entity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 门店收益明细表
*
* @author 科技小王子
* @since 2023-08-10 11:24:02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "ProfitLog对象", description = "门店收益明细表")
@TableName("shop_profit_log")
public class ProfitLog implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
@TableId(value = "profit_id", type = IdType.AUTO)
private Integer profitId;
@ApiModelProperty(value = "订单ID")
private Integer orderId;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "订单号")
private String orderNo;
@ApiModelProperty(value = "收益类型1资产收益2服务费收益3推广收益4门店业绩提成5站点业绩提成")
private Integer scene;
@ApiModelProperty(value = "变动金额")
private BigDecimal money;
@ApiModelProperty(value = "变动后余额")
private BigDecimal balance;
@ApiModelProperty(value = "管理员备注")
private String remark;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "商户编码")
private String merchantCode;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "注册时间")
private Date createTime;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
}

View File

@@ -0,0 +1,37 @@
package com.gxwebsoft.shop.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.shop.entity.Manager;
import com.gxwebsoft.shop.param.ManagerParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 区域经理Mapper
*
* @author 科技小王子
* @since 2022-11-25 14:02:24
*/
public interface ManagerMapper extends BaseMapper<Manager> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<Manager>
*/
List<Manager> selectPageRel(@Param("page") IPage<Manager> page,
@Param("param") ManagerParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<Manager> selectListRel(@Param("param") ManagerParam param);
}

View File

@@ -0,0 +1,37 @@
package com.gxwebsoft.shop.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.shop.entity.ProfitLog;
import com.gxwebsoft.shop.param.ProfitLogParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 门店收益明细表Mapper
*
* @author 科技小王子
* @since 2023-08-10 11:24:02
*/
public interface ProfitLogMapper extends BaseMapper<ProfitLog> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<ProfitLog>
*/
List<ProfitLog> selectPageRel(@Param("page") IPage<ProfitLog> page,
@Param("param") ProfitLogParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<ProfitLog> selectListRel(@Param("param") ProfitLogParam param);
}

View File

@@ -0,0 +1,54 @@
<?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.gxwebsoft.shop.mapper.ManagerMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*,b.avatar,b.username,b.phone,b.nickname
FROM shop_manager a
left join sys_user b on a.user_id = b.user_id
<where>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.city != null">
AND a.city = #{param.city}
</if>
<if test="param.area != null">
AND a.area = #{param.area}
</if>
<if test="param.province != null">
AND a.province = #{param.province}
</if>
<if test="param.phone != null">
AND b.phone = #{param.phone}
</if>
<if test="param.username != null">
AND b.username = #{param.username}
</if>
<if test="param.nickname != null">
AND b.nickname LIKE CONCAT('%', #{param.nickname}, '%')
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.Manager">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.Manager">
<include refid="selectSql"></include>
</select>
</mapper>

View File

@@ -0,0 +1,68 @@
<?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.gxwebsoft.shop.mapper.ProfitLogMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM shop_profit_log a
<where>
<if test="param.profitId != null">
AND a.profit_id = #{param.profitId}
</if>
<if test="param.orderId != null">
AND a.order_id = #{param.orderId}
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.scene != null">
AND a.scene = #{param.scene}
</if>
<if test="param.money != null">
AND a.money = #{param.money}
</if>
<if test="param.balance != null">
AND a.balance = #{param.balance}
</if>
<if test="param.remark != null">
AND a.remark LIKE CONCAT('%', #{param.remark}, '%')
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.deleted != null">
AND a.deleted = #{param.deleted}
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.merchantCode != null">
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.ProfitLog">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.ProfitLog">
<include refid="selectSql"></include>
</select>
</mapper>

View File

@@ -0,0 +1,66 @@
package com.gxwebsoft.shop.param;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 商城会员查询参数
*
* @author 科技小王子
* @since 2022-11-25 14:02:24
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "ManagerParam对象", description = "区域经理查询参数")
public class ManagerParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
@QueryField(type = QueryType.EQ)
private Integer managerId;
@ApiModelProperty(value = "用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "城区")
private String area;
@ApiModelProperty(value = "城市")
private String city;
@ApiModelProperty(value = "省份")
private String province;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty("登录账号")
@QueryField(type = QueryType.EQ)
private String username;
@ApiModelProperty("用户昵称")
@QueryField(type = QueryType.LIKE)
private String nickname;
@ApiModelProperty("手机号码")
@QueryField(type = QueryType.EQ)
private String phone;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
@QueryField(type = QueryType.EQ)
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
}

View File

@@ -241,4 +241,6 @@ public class OrderParam extends BaseParam {
@TableField(exist = false)
private Set<Integer> userIds;
private Boolean isApp;
}

View File

@@ -0,0 +1,76 @@
package com.gxwebsoft.shop.param;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* 门店收益明细表查询参数
*
* @author 科技小王子
* @since 2023-08-10 11:24:02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "ProfitLogParam对象", description = "门店收益明细表查询参数")
public class ProfitLogParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
@QueryField(type = QueryType.EQ)
private Integer profitId;
@ApiModelProperty(value = "订单ID")
@QueryField(type = QueryType.EQ)
private Integer orderId;
@ApiModelProperty(value = "订单号")
@QueryField(type = QueryType.EQ)
private String orderNo;
@ApiModelProperty(value = "用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "收益类型1资产收益2服务费收益3推广收益4门店业绩提成5站点业绩提成")
@QueryField(type = QueryType.EQ)
private Integer scene;
@ApiModelProperty(value = "变动金额")
@QueryField(type = QueryType.EQ)
private BigDecimal money;
@ApiModelProperty(value = "变动后余额")
@QueryField(type = QueryType.EQ)
private BigDecimal balance;
@ApiModelProperty(value = "管理员备注")
private String remark;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
@QueryField(type = QueryType.EQ)
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
@ApiModelProperty(value = "商户编码")
private String merchantCode;
}

View File

@@ -0,0 +1,42 @@
package com.gxwebsoft.shop.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.shop.entity.Manager;
import com.gxwebsoft.shop.param.ManagerParam;
import java.util.List;
/**
* 区域经理Service
*
* @author 科技小王子
* @since 2022-11-25 14:02:24
*/
public interface ManagerService extends IService<Manager> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Manager>
*/
PageResult<Manager> pageRel(ManagerParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Manager>
*/
List<Manager> listRel(ManagerParam param);
/**
* 根据id查询
*
* @param managerId 主键ID
* @return Manager
*/
Manager getByIdRel(Integer managerId);
}

View File

@@ -0,0 +1,42 @@
package com.gxwebsoft.shop.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.shop.entity.ProfitLog;
import com.gxwebsoft.shop.param.ProfitLogParam;
import java.util.List;
/**
* 门店收益明细表Service
*
* @author 科技小王子
* @since 2023-08-10 11:24:02
*/
public interface ProfitLogService extends IService<ProfitLog> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<ProfitLog>
*/
PageResult<ProfitLog> pageRel(ProfitLogParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<ProfitLog>
*/
List<ProfitLog> listRel(ProfitLogParam param);
/**
* 根据id查询
*
* @param profitId 主键ID
* @return ProfitLog
*/
ProfitLog getByIdRel(Integer profitId);
}

View File

@@ -0,0 +1,55 @@
package com.gxwebsoft.shop.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.service.UserService;
import com.gxwebsoft.shop.entity.Manager;
import com.gxwebsoft.shop.mapper.ManagerMapper;
import com.gxwebsoft.shop.param.ManagerParam;
import com.gxwebsoft.shop.service.ManagerService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 商城会员Service实现
*
* @author 科技小王子
* @since 2022-11-25 14:02:24
*/
@Service
public class ManagerServiceImpl extends ServiceImpl<ManagerMapper, Manager> implements ManagerService {
@Resource
private UserService userService;
@Override
public PageResult<Manager> pageRel(ManagerParam param) {
PageParam<Manager, ManagerParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
List<Manager> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Manager> listRel(ManagerParam param) {
List<Manager> list = baseMapper.selectListRel(param);
// 排序
PageParam<Manager, ManagerParam> page = new PageParam<>();
//page.setDefaultOrder("create_time desc");
return page.sortRecords(list);
}
@Override
public Manager getByIdRel(Integer managerId) {
ManagerParam param = new ManagerParam();
param.setManagerId(managerId);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -83,6 +83,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
public List<Order> listRel(OrderParam param) {
List<Order> list = baseMapper.selectListRel(param);
// 排序
PageParam<Order, OrderParam> page = new PageParam<>();
page.setDefaultOrder("create_time desc");
return page.sortRecords(list);

View File

@@ -0,0 +1,47 @@
package com.gxwebsoft.shop.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.shop.mapper.ProfitLogMapper;
import com.gxwebsoft.shop.service.ProfitLogService;
import com.gxwebsoft.shop.entity.ProfitLog;
import com.gxwebsoft.shop.param.ProfitLogParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 门店收益明细表Service实现
*
* @author 科技小王子
* @since 2023-08-10 11:24:02
*/
@Service
public class ProfitLogServiceImpl extends ServiceImpl<ProfitLogMapper, ProfitLog> implements ProfitLogService {
@Override
public PageResult<ProfitLog> pageRel(ProfitLogParam param) {
PageParam<ProfitLog, ProfitLogParam> page = new PageParam<>(param);
//page.setDefaultOrder("create_time desc");
List<ProfitLog> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<ProfitLog> listRel(ProfitLogParam param) {
List<ProfitLog> list = baseMapper.selectListRel(param);
// 排序
PageParam<ProfitLog, ProfitLogParam> page = new PageParam<>();
//page.setDefaultOrder("create_time desc");
return page.sortRecords(list);
}
@Override
public ProfitLog getByIdRel(Integer profitId) {
ProfitLogParam param = new ProfitLogParam();
param.setProfitId(profitId);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -0,0 +1,12 @@
package com.gxwebsoft.apps.task;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class OrderTaskTest {
@Test
void calcProfit() {
}
}

View File

@@ -22,8 +22,8 @@ import java.util.Map;
*/
public class ShopGenerator {
// 输出位置
private static final String OUTPUT_LOCATION = System.getProperty("user.dir");
//private static final String OUTPUT_LOCATION = "D:/codegen"; // 不想生成到项目中可以写磁盘路径
// private static final String OUTPUT_LOCATION = System.getProperty("user.dir");
private static final String OUTPUT_LOCATION = "D:/codegen"; // 不想生成到项目中可以写磁盘路径
// 输出目录
private static final String OUTPUT_DIR = "/src/main/java";
// 作者名称
@@ -31,10 +31,10 @@ public class ShopGenerator {
// 是否在xml中添加二级缓存配置
private static final boolean ENABLE_CACHE = false;
// 数据库连接配置
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/com_gxwebsoft_oa?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/open_ws?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
private static final String DB_USERNAME = "com_gxwebsoft_oa";
private static final String DB_PASSWORD = "EZfW2R4YiWfbLHLw";
private static final String DB_USERNAME = "open_ws";
private static final String DB_PASSWORD = "DzAmFiZfPJ6ZGApm";
// 包名
private static final String PACKAGE_NAME = "com.gxwebsoft";
// 模块名
@@ -83,7 +83,8 @@ public class ShopGenerator {
// "shop_user_comment",
// "shop_user_like",
// "shop_user_look"
"shop_user_feedback"
// "shop_user_feedback"
"shop_profit_log"
};
// 需要去除的表前缀