| | |
| | | return R.fail("清空绑定门店的用户门店数据失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public Long saveOrUpdateAppUser(AppUser appuser) { |
| | | log.error("导入订单-保存用户失败{}", cause.getMessage()); |
| | | return null; |
| | | } |
| | | |
| | | }; |
| | | } |
| | | } |
| | |
| | | public R<Boolean> judgmentDailyShare(Long appUserId) { |
| | | return R.fail("判断当天是否分享获得过积分失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R save(UserPoint userPoint) { |
| | | |
| | | return R.fail("导入订单-保存积分流水失败" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | @PostMapping("/app-user/clearBindShop") |
| | | R clearBindShop(@RequestParam("shopId") Integer shopId); |
| | | |
| | | @PostMapping("/app-user/saveOrUpdateAppUser") |
| | | Long saveOrUpdateAppUser(@RequestBody AppUser appuser); |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/user-point/judgmentDailyShare") |
| | | R<Boolean> judgmentDailyShare(@RequestParam("appUserId") Long appUserId); |
| | | |
| | | @PostMapping("/user-point/save") |
| | | R save(@RequestBody UserPoint userPoint); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @TableName("t_charge_order") |
| | | @ApiModel(value="Order对象", description="") |
| | | public class ChargeOrder { |
| | | // 订单编号 |
| | | private String orderNumber; |
| | | // 订单类型 |
| | | private String orderType; |
| | | // 充电方式 |
| | | private String chargeType; |
| | | // 充电用户 |
| | | private String phone; |
| | | // 开始时间 |
| | | private LocalDateTime beginTime; |
| | | // 结束时间 |
| | | private LocalDateTime endTime; |
| | | // 充电时长 |
| | | private String chargingDuration; |
| | | // 充电电量 |
| | | private BigDecimal chargingCapacity; |
| | | // 电站运营商 |
| | | private String powerStationOperator; |
| | | // 城市名称 |
| | | private String city; |
| | | // 充电场站 |
| | | private String chargingStation; |
| | | // 电站id |
| | | private Integer powerStationId; |
| | | // 终端编码 |
| | | private String terminalCode; |
| | | // 车牌号 |
| | | private String plateNumber; |
| | | // 电站价电费金额 |
| | | private BigDecimal electricityAmount; |
| | | // 电站价服务费金额 |
| | | private BigDecimal serviceAmount; |
| | | // 电站价总金额 |
| | | private BigDecimal totalAmount; |
| | | |
| | | |
| | | } |
| | |
| | | @TableField(exist = false) |
| | | @Excel(name = "联系电话") |
| | | private String phone; |
| | | @ApiModelProperty(value = "变动类型(4=提现,5=订单收入,6=订单退款)") |
| | | @ApiModelProperty(value = "变动类型(4=提现,5=订单收入,6=订单退款,7-提现失败回退)") |
| | | @TableField("type") |
| | | @Excel(name = "变更类型",readConverterExp = "5=订单收入,6=订单退款") |
| | | @Excel(name = "变更类型",readConverterExp = "4=提现,5=订单收入,6=订单退款,7-提现失败回退") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "历史余额") |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取所有用户积分列表 |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getUserPointPageList") |
| | | @ApiOperation(value = "所有用户积分列表", tags = "后台-财务统计-用户积分统计") |
| | | public R<PageInfo<UserPointStatisticsVO>> getUserPointPageList(@RequestParam(value = "name",required = false) String name, |
| | | @ApiParam("当前页")@RequestParam("pageCurr") Integer pageCurr, |
| | | @ApiParam("分页大小")@RequestParam("pageSize") Integer pageSize) { |
| | | PageInfo<UserPointStatisticsVO> pageInfo=appUserService.getUserPointPageList(name,pageCurr,pageSize); |
| | | |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | @PostMapping("/saveOrUpdateAppUser") |
| | | Long saveOrUpdateAppUser(@RequestBody AppUser appuser){ |
| | | if (appuser.getId() == null) { |
| | | //保存用户 |
| | | appUserService.save(appuser); |
| | | }else { |
| | | appUserService.updateById(appuser); |
| | | } |
| | | return appuser.getId(); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.account.mapper.UserPointMapper; |
| | | import com.ruoyi.account.service.UserPointService; |
| | | import com.ruoyi.account.vo.TransferPoint; |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | | import com.ruoyi.account.vo.UserPointStatistics; |
| | | import com.ruoyi.account.vo.UserPointVO; |
| | | import com.ruoyi.account.vo.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.YearMonth; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private UserPointService userPointService; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | @Resource |
| | | private UserPointMapper userPointMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户积分变更详情 |
| | | */ |
| | | @GetMapping("/getUserPontDetailPageList") |
| | | @ApiOperation(value = "用户积分详情", tags = "管理后台-财务统计-用户积分统计") |
| | | public R<PageInfo<UserPointDetailVO>> getUserPontDetailPageList(@RequestParam(value = "types",required = false) Collection<Integer> types, |
| | | @RequestParam(value = "id") Long id, |
| | | @ApiParam("当前页")@RequestParam("pageCurr") Integer pageCurr, |
| | | @ApiParam("分页大小")@RequestParam("pageSize") Integer pageSize) { |
| | | PageInfo<UserPointDetailVO> pageInfo=userPointService.getUserPontDetailPageList(types,id,pageCurr,pageSize); |
| | | |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | /** |
| | | * 判断当天是否分享获得过积分 |
| | | * @param appUserId |
| | | * @return |
| | | * 用户积分统计 |
| | | */ |
| | | @PostMapping("/judgmentDailyShare") |
| | | public R<Boolean> judgmentDailyShare(@RequestParam("appUserId") Long appUserId){ |
| | | long count = userPointService.count(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUserId) |
| | | .eq(UserPoint::getType, 4).last(" and DATE_FORMAT(NOW(), '%Y-%m-%d') = DATE_FORMAT(create_time, '%Y-%m-%d')")); |
| | | return R.ok(count != 0); |
| | | @GetMapping("/getUserPointStatisticsPageList") |
| | | @ApiOperation(value = "用户积分统计", tags = "管理后台-财务统计-用户积分统计") |
| | | public R<UserPointStatisticsOutVO> getUserPointStatisticsPageList(@RequestParam(value = "types",required = false) Collection<Integer> types, |
| | | @RequestParam(value = "name",required = false) String name, |
| | | @RequestParam(value = "phone",required = false) String phone, |
| | | @RequestParam(value = "beginTime",required = false) LocalDateTime beginTime, |
| | | @RequestParam(value = "endTime",required = false) LocalDateTime endTime, |
| | | @ApiParam("当前页")@RequestParam("pageCurr") Integer pageCurr, |
| | | @ApiParam("分页大小")@RequestParam("pageSize") Integer pageSize) { |
| | | UserPointStatisticsOutVO userPointStatisticsOutVO = new UserPointStatisticsOutVO(); |
| | | //充值绿电分 |
| | | |
| | | Integer chargePoint=userPointService.selectRechargeAndUse(name,phone,beginTime,endTime,17); |
| | | // 消费绿电分 |
| | | Integer exchangePoint =userPointService.selectRechargeAndUse(name,phone,beginTime,endTime,4); |
| | | Integer cancelPoint = userPointService.selectRechargeAndUse(name,phone,beginTime,endTime,16); |
| | | Integer usePoint=(exchangePoint==null?0:exchangePoint )-( cancelPoint==null?0:cancelPoint); |
| | | userPointStatisticsOutVO.setChargeTotalPoint(chargePoint==null?0:chargePoint); |
| | | userPointStatisticsOutVO.setUseTotalPoint(usePoint); |
| | | |
| | | //查找记录 |
| | | PageInfo<UserPointStatisticsPageVO> pageInfo=userPointService.getUserPointStatisticsPageList(types,name,phone,beginTime,endTime,pageCurr,pageSize); |
| | | userPointStatisticsOutVO.setPageInfo(pageInfo); |
| | | |
| | | return R.ok(userPointStatisticsOutVO); |
| | | } |
| | | |
| | | /** |
| | | * 导出店铺余额列表 |
| | | */ |
| | | |
| | | @GetMapping("/userPointExcel") |
| | | @ApiOperation(value = "导出", tags = {"管理后台-财务统计-用户积分统计"}) |
| | | void userPointExcel(HttpServletResponse response, |
| | | @RequestParam(value = "types",required = false) Collection<Integer> types, |
| | | @RequestParam(value = "name",required = false) String name, |
| | | @RequestParam(value = "phone",required = false) String phone, |
| | | @RequestParam(value = "beginTime",required = false) LocalDateTime beginTime, |
| | | @RequestParam(value = "endTime",required = false) LocalDateTime endTime){ |
| | | List<UserPointExcel> exportList =userPointMapper.userPointExcel(types,name,phone,beginTime,endTime); |
| | | exportList.forEach(x->{ |
| | | if (x.getType()==12||x.getType()==17){ |
| | | x.setVariablePointStr("+"+x.getVariablePoint()+"绿电分"); |
| | | }else { |
| | | x.setVariablePointStr("-"+x.getVariablePoint()+"绿电分"); |
| | | } |
| | | }); |
| | | ExcelUtil<UserPointExcel> util = new ExcelUtil<UserPointExcel>(UserPointExcel.class); |
| | | util.exportExcel(response, exportList, "店铺余额列表数据"); |
| | | } |
| | | |
| | | @PostMapping("/save") |
| | | R save(@RequestBody UserPoint userPoint){ |
| | | userPointService.save(userPoint); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.vo.NearbyReferrer; |
| | | import com.ruoyi.account.vo.NearbyReferrerVo; |
| | | import com.ruoyi.account.vo.UserStatistics; |
| | | import com.ruoyi.account.vo.UserStatisticsDetail; |
| | | import com.ruoyi.account.vo.*; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | List<AppUser> getAppUserByPhoneNoFilter(@Param("phone") String phone); |
| | | |
| | | |
| | | |
| | | List<UserPointStatisticsVO> getUserPointPageList(PageInfo<UserPointStatisticsVO> pageInfo,@Param("name") String name); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | | import com.ruoyi.account.vo.UserPointExcel; |
| | | import com.ruoyi.account.vo.UserPointStatisticsPageVO; |
| | | import com.ruoyi.account.vo.UserPointStatisticsVO; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | List<UserPointDetailVO> getUserPointDetail(PageInfo<UserPointDetailVO> pageInfo, @Param("userId") Long userId, @Param("startTime") LocalDateTime startTime, |
| | | @Param("endTime") LocalDateTime endTime, @Param("type") Integer type); |
| | | |
| | | |
| | | List<UserPointDetailVO> getUserPontDetailPageList(PageInfo<UserPointDetailVO> pageInfo, @Param("userId") Long userId, @Param("types")Collection<Integer> types); |
| | | |
| | | Integer selectRechargeAndUse(@Param("name")String name,@Param("phone") String phone, @Param("beginTime")LocalDateTime beginTime, @Param("endTime")LocalDateTime endTime,@Param("type")Integer type); |
| | | |
| | | List<UserPointStatisticsPageVO> getUserPointStatisticsPageList(PageInfo<UserPointStatisticsPageVO> pageInfo, @Param("types")Collection<Integer> types, @Param("name")String name,@Param("phone") String phone,@Param("beginTime") LocalDateTime beginTime,@Param("endTime") LocalDateTime endTime); |
| | | |
| | | List<UserPointExcel> userPointExcel(@Param("types")Collection<Integer> types, @Param("name")String name,@Param("phone") String phone,@Param("beginTime") LocalDateTime beginTime,@Param("endTime") LocalDateTime endTime); |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | AppUser index(); |
| | | |
| | | PageInfo<UserPointStatisticsVO> getUserPointPageList(String name, Integer pageCurr, Integer pageSize); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | | import com.ruoyi.account.vo.UserPointStatistics; |
| | | import com.ruoyi.account.vo.UserPointVO; |
| | | import com.ruoyi.account.vo.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | |
| | | IPage<UserPoint> getUserPointPage(Page<UserPoint> page, UserPoint userPoint); |
| | | |
| | | |
| | | PageInfo<UserPointDetailVO> getUserPontDetailPageList(Collection<Integer> types, Long id, Integer pageCurr, Integer pageSize); |
| | | |
| | | Integer selectRechargeAndUse(String name, String phone, LocalDateTime beginTime, LocalDateTime endTime,Integer type); |
| | | |
| | | PageInfo<UserPointStatisticsPageVO> getUserPointStatisticsPageList(Collection<Integer> types, String name, String phone, LocalDateTime beginTime, LocalDateTime endTime, Integer pageCurr, Integer pageSize); |
| | | } |
| | |
| | | } |
| | | return user; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<UserPointStatisticsVO> getUserPointPageList(String name, Integer pageCurr, Integer pageSize) { |
| | | PageInfo<UserPointStatisticsVO> pageInfo=new PageInfo<>(pageCurr,pageSize); |
| | | List<UserPointStatisticsVO> list=baseMapper.getUserPointPageList(pageInfo, name); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.account.api.model.*; |
| | | import com.ruoyi.account.mapper.UserPointMapper; |
| | | import com.ruoyi.account.service.*; |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | | import com.ruoyi.account.vo.UserPointStatistics; |
| | | import com.ruoyi.account.vo.UserPointVO; |
| | | import com.ruoyi.account.vo.*; |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.PhoneNumberValidator; |
| | |
| | | import com.ruoyi.system.api.feignClient.SysConfigClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | private UserPointService userPointService; |
| | | @Resource |
| | | private SysConfigClient sysConfigClient; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private UserPointMapper userPointMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | }); |
| | | return userPointIPage; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<UserPointDetailVO> getUserPontDetailPageList(Collection<Integer> types, Long id, Integer pageCurr, Integer pageSize) { |
| | | PageInfo<UserPointDetailVO> pageInfo = new PageInfo<>(pageCurr, pageSize); |
| | | List<UserPointDetailVO> list =baseMapper.getUserPontDetailPageList(pageInfo,id,types); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectRechargeAndUse(String name, String phone, LocalDateTime beginTime, LocalDateTime endTime,Integer type) { |
| | | |
| | | return baseMapper.selectRechargeAndUse(name,phone,beginTime,endTime,type); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<UserPointStatisticsPageVO> getUserPointStatisticsPageList(Collection<Integer> types, String name, String phone, LocalDateTime beginTime, LocalDateTime endTime, Integer pageCurr, Integer pageSize) { |
| | | PageInfo<UserPointStatisticsPageVO> pageInfo = new PageInfo<>(pageCurr, pageSize); |
| | | List<UserPointStatisticsPageVO>list=baseMapper.getUserPointStatisticsPageList(pageInfo,types,name,phone,beginTime,endTime); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserPointExcel { |
| | | |
| | | @Excel(name = "用户名") |
| | | private String name; |
| | | @Excel(name = "手机号") |
| | | private String phone; |
| | | @Excel(name = "变动类型",readConverterExp="4=兑换商品,12=他人赠送,13=赠与他人,16=取消订单,17=充值") |
| | | private Integer type; |
| | | |
| | | @Excel(name = "变动金额") |
| | | private String variablePointStr; |
| | | private Integer variablePoint; |
| | | |
| | | |
| | | @Excel(name = "订单编号") |
| | | private Long objectId; |
| | | |
| | | @Excel(name = "变更时间") |
| | | private String createTime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserPointStatisticsOutVO { |
| | | private Integer chargeTotalPoint; |
| | | private Integer useTotalPoint; |
| | | PageInfo<UserPointStatisticsPageVO> pageInfo; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserPointStatisticsPageVO { |
| | | @ApiModelProperty("用户名") |
| | | private String name; |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | @ApiModelProperty(value = "变动类型(4=兑换商品,12=他人赠送,13=赠与他人,16=取消订单,17=充值 )") |
| | | private Integer type; |
| | | @ApiModelProperty(value = "变动金额") |
| | | private Integer variablePoint; |
| | | @ApiModelProperty("订单编号") |
| | | private Long objectId; |
| | | @ApiModelProperty(value = "变动时间") |
| | | private String createTime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.vo; |
| | | |
| | | import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserPointStatisticsVO { |
| | | |
| | | @ApiModelProperty("用户id") |
| | | private Long id; |
| | | @ApiModelProperty("用户姓名") |
| | | private String name; |
| | | @ApiModelProperty("绿电分总数") |
| | | private Integer totalPoint; |
| | | @ApiModelProperty("已使用绿电分数") |
| | | private Integer usePoint; |
| | | @ApiModelProperty("可用绿电分数") |
| | | private Integer availablePoint; |
| | | } |
| | |
| | | <result column="del_flag" property="delFlag" /> |
| | | <result column="first_add" property="firstAdd" /> |
| | | <result column="last_login_time" property="lastLoginTime" /> |
| | | <result column="invite_user_id" property="inviteUserId" /> |
| | | <result column="shop_id" property="shopId" /> |
| | | <result column="part_point" property="partPoint" /> |
| | | <result column="part_grow_point" property="partGrowPoint" /> |
| | | <result column="shop_point" property="shopPoint" /> |
| | | <result column="share_point" property="sharePoint" /> |
| | | <result column="shop_amount" property="shopAmount" /> |
| | | <result column="last_shop_time" property="lastShopTime" /> |
| | | </resultMap> |
| | |
| | | <select id="getAppUserByPhoneNoFilter" resultType="com.ruoyi.account.api.model.AppUser"> |
| | | SELECT * FROM t_app_user WHERE phone like CONCAT('%',#{phone},'%') |
| | | </select> |
| | | <select id="getUserPointPageList" resultType="com.ruoyi.account.vo.UserPointStatisticsVO"> |
| | | select |
| | | id, |
| | | name, |
| | | (recharge_point + transferable_in_point)as `totalPoint`, |
| | | (exchange_point - cancel_point + transferable_out_point) as `usePoint`, |
| | | available_point |
| | | from |
| | | t_app_user |
| | | where |
| | | del_flag=0 |
| | | <if test="null != name and name!= '' "> |
| | | and `name` like CONCAT('%',#{name},'%') |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | order by create_time desc |
| | | </select> |
| | | <select id="getUserPontDetailPageList" resultType="com.ruoyi.account.vo.UserPointDetailVO"> |
| | | select |
| | | type, |
| | | variable_point, |
| | | DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') as createTime, |
| | | object_id as objectId, |
| | | CASE WHEN (balance - historical_point) > 0 THEN 1 ELSE 2 END AS flag |
| | | from t_user_point where app_user_id = #{userId} |
| | | <if test="types != null and types.size>0"> |
| | | AND type IN |
| | | <foreach collection="types" item="type" open="(" separator="," close=")"> |
| | | #{type} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | <select id="selectRechargeAndUse" resultType="java.lang.Integer"> |
| | | select |
| | | sum(tp.variable_point) as chargeTotalPoint |
| | | from |
| | | t_user_point tp |
| | | left join t_app_user tu on tp.app_user_id = tu.id |
| | | where |
| | | tp.type =#{type} |
| | | <if test="null != name and '' != name"> |
| | | AND tu.`name` LIKE concat('%',#{name},'%') |
| | | </if> |
| | | <if test="null != phone and '' != phone"> |
| | | AND tu.`phone` LIKE concat('%',#{phone},'%') |
| | | </if> |
| | | |
| | | <if test="null != beginTime and null != endTime"> |
| | | and tp.create_time between #{beginTime} and #{endTime} |
| | | </if> |
| | | |
| | | </select> |
| | | <select id="getUserPointStatisticsPageList" resultType="com.ruoyi.account.vo.UserPointStatisticsPageVO"> |
| | | select |
| | | tu.name, |
| | | tu.phone, |
| | | tp.type, |
| | | tp.variable_point, |
| | | tp.object_id, |
| | | tp.create_time |
| | | from |
| | | t_user_point tp |
| | | left join t_app_user tu on tp.app_user_id = tu.id |
| | | where |
| | | 1=1 |
| | | <if test="types != null and types.size>0"> |
| | | AND type IN |
| | | <foreach collection="types" item="type" open="(" separator="," close=")"> |
| | | #{type} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != name and '' != name"> |
| | | AND tu.`name` LIKE concat('%',#{name},'%') |
| | | </if> |
| | | <if test="null != phone and '' != phone"> |
| | | AND tu.`phone` LIKE concat('%',#{phone},'%') |
| | | </if> |
| | | |
| | | <if test="null != beginTime and null != endTime"> |
| | | and tp.create_time between #{beginTime} and #{endTime} |
| | | </if> |
| | | order by create_time desc |
| | | </select> |
| | | <select id="userPointExcel" resultType="com.ruoyi.account.vo.UserPointExcel"> |
| | | select |
| | | tu.name, |
| | | tu.phone, |
| | | tp.type, |
| | | tp.variable_point, |
| | | tp.object_id, |
| | | tp.create_time |
| | | from |
| | | t_user_point tp |
| | | left join t_app_user tu on tp.app_user_id = tu.id |
| | | where |
| | | 1=1 |
| | | <if test="types != null and types.size>0"> |
| | | AND type IN |
| | | <foreach collection="types" item="type" open="(" separator="," close=")"> |
| | | #{type} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != name and '' != name"> |
| | | AND tu.`name` LIKE concat('%',#{name},'%') |
| | | </if> |
| | | <if test="null != phone and '' != phone"> |
| | | AND tu.`phone` LIKE concat('%',#{phone},'%') |
| | | </if> |
| | | |
| | | <if test="null != beginTime and null != endTime"> |
| | | and tp.create_time between #{beginTime} and #{endTime} |
| | | </if> |
| | | order by create_time desc |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.dto.GetImportOrderDTO; |
| | | import com.ruoyi.order.model.ChargeOrder; |
| | | import com.ruoyi.order.service.ChargeOrderService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Api(tags = "充电订单") |
| | | @RestController |
| | | @RequestMapping("/charge") |
| | | public class ChargeOrderController { |
| | | @Resource |
| | | private ChargeOrderService chargeOrderService; |
| | | |
| | | /** |
| | | * 导入充电信息 |
| | | */ |
| | | @PostMapping("/importExpress") |
| | | public R importExpress(@RequestBody String url) { |
| | | JSONObject jsonObject = JSONObject.parseObject(url); |
| | | String url2 = jsonObject.getString("url"); |
| | | chargeOrderService.importExpress(url2); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取导入订单列表 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getImportData") |
| | | @ApiOperation(value = "获取导入订单列表", tags = "后台-充电订单") |
| | | public R<PageInfo<ChargeOrder>> getUserPointPageList(@RequestBody GetImportOrderDTO getImportOrderDTO) { |
| | | |
| | | PageInfo<ChargeOrder> pageInfo=chargeOrderService.getUserPointPageList(getImportOrderDTO); |
| | | |
| | | return R.ok(pageInfo); |
| | | } |
| | | } |
| | |
| | | orderPage.setAppUserIds(orderPage.getAppUserIds().stream().distinct().collect(Collectors.toList())); |
| | | } |
| | | |
| | | // UserAddress userAddress = JSON.parseObject(order.getAddressJson(), UserAddress.class); |
| | | // orderInfo.setRecipient(userAddress.getRecieveName() + "-" + userAddress.getRecievePhone()); |
| | | // userAddress.setRecieveAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getRecieveAddress()); |
| | | // orderInfo.setAddress(userAddress.getRecieveAddress()); |
| | | |
| | | |
| | | List<OrderExport> orderExportList = orderMapper.getOrderExportList(orderPage); |
| | |
| | | orderExport.setGoodsName(goods.getName()); |
| | | /* orderExport.setCompanyCostPrice(goods.getOperatingCost()); |
| | | orderExport.setSupplierCostPrice(goods.getShopCost());*/ |
| | | } |
| | | |
| | | String expressJson = orderExport.getExpressJson(); |
| | | if (StringUtils.isNotEmpty(expressJson) && !expressJson.equals("NULL")) { |
| | | JSONObject jsonObject = JSONObject.parseObject(expressJson); |
| | | orderExport.setExpressNum(jsonObject.getString("num")); |
| | | orderExport.setExpressName(ExpressCompanyMap.getCompanyNameByCode(jsonObject.getString("com"))); |
| | | } |
| | | }); |
| | | |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.Data; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class GetImportOrderDTO { |
| | | private String orderNumber; |
| | | private String phone; |
| | | private String chargingStation; |
| | | private String powerStationOperator; |
| | | private String terminalCode; |
| | | private LocalDateTime beginTime1; |
| | | private LocalDateTime endTime1; |
| | | private LocalDateTime beginTime2; |
| | | private LocalDateTime endTime2; |
| | | private Integer pageCurr; |
| | | private Integer pageSize; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.dto.GetImportOrderDTO; |
| | | import com.ruoyi.order.model.ChargeOrder; |
| | | import com.ruoyi.order.model.OrderGood; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ChargeOrderMapper extends BaseMapper<ChargeOrder> { |
| | | List<ChargeOrder> getUserPointPageList(PageInfo<ChargeOrder> pageInfo,@Param("dto") GetImportOrderDTO dto); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.dto.GetImportOrderDTO; |
| | | import com.ruoyi.order.model.ChargeOrder; |
| | | import com.ruoyi.order.model.Order; |
| | | |
| | | public interface ChargeOrderService extends IService<ChargeOrder> { |
| | | void importExpress(String url); |
| | | |
| | | PageInfo<ChargeOrder> getUserPointPageList(GetImportOrderDTO getImportOrderDTO); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.feignClient.UserPointClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.common.core.constant.ExpressCompanyMap; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.dto.GetImportOrderDTO; |
| | | import com.ruoyi.order.mapper.ChargeOrderMapper; |
| | | import com.ruoyi.order.mapper.OrderMapper; |
| | | import com.ruoyi.order.model.ChargeOrder; |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.order.service.ChargeOrderService; |
| | | import com.ruoyi.order.service.OrderService; |
| | | import com.ruoyi.order.vo.ConfirmDelivery; |
| | | import com.ruoyi.other.api.domain.Region; |
| | | import com.ruoyi.system.api.domain.SysConfig; |
| | | import com.ruoyi.system.api.feignClient.SysConfigClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class ChargeOrderServiceImpl extends ServiceImpl<ChargeOrderMapper, ChargeOrder> implements ChargeOrderService { |
| | | |
| | | @Resource |
| | | private OrderService orderService; |
| | | @Resource |
| | | private SysConfigClient sysConfigClient; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private UserPointClient userPointClient; |
| | | @Resource |
| | | private ChargeOrderService chargeOrderService; |
| | | private static final String DEFAULT_AVATAR_URL = "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/admin/aedfbbb41280471f8d9fa7905298b65f.png"; |
| | | |
| | | |
| | | @Override |
| | | public void importExpress(String url) { |
| | | URL url1 = null; |
| | | try { |
| | | url1 = new URL(url); |
| | | } catch (MalformedURLException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | List<String> orderNumberList=new ArrayList<>(); |
| | | |
| | | try (InputStream fileInputStream = url1.openStream()) { |
| | | Workbook workbook = new XSSFWorkbook(fileInputStream); |
| | | Sheet sheet = workbook.getSheetAt(0); // 获取第一个Sheet |
| | | int lastRowNum = sheet.getLastRowNum(); |
| | | for (int i = 1; i <= lastRowNum; i++) {//第二行开始 |
| | | Row row = sheet.getRow(i); |
| | | // 订单编号 |
| | | if (row.getCell(0) == null){ |
| | | throw new ServiceException("第" + i + "行订单编号为空", 500); |
| | | } |
| | | row.getCell(0).setCellType(CellType.STRING); |
| | | String orderNum = row.getCell(0).getStringCellValue(); |
| | | |
| | | // 订单类型 |
| | | if (row.getCell(1) == null){ |
| | | throw new ServiceException("第" + i + "行订单类型为空", 500); |
| | | } |
| | | row.getCell(1).setCellType(CellType.STRING); |
| | | String orderType = row.getCell(1).getStringCellValue(); |
| | | |
| | | // 充电方式 |
| | | if (row.getCell(2) == null){ |
| | | throw new ServiceException("第" + i + "行充电方式为空", 500); |
| | | } |
| | | row.getCell(2).setCellType(CellType.STRING); |
| | | String chargeType = row.getCell(2).getStringCellValue(); |
| | | |
| | | |
| | | // 充电用户 |
| | | if (row.getCell(3) == null){ |
| | | throw new ServiceException("第" + i + "行充电用户为空", 500); |
| | | } |
| | | row.getCell(3).setCellType(CellType.STRING); |
| | | String phone = row.getCell(3).getStringCellValue(); |
| | | |
| | | |
| | | // 开始时间 |
| | | Cell beginTimeCell = row.getCell(6); |
| | | if (beginTimeCell == null) { |
| | | throw new ServiceException("第" + (i + 1) + "行开始时间为空", 500); |
| | | } |
| | | |
| | | LocalDateTime beginTime; |
| | | if (beginTimeCell.getCellType() == CellType.NUMERIC || DateUtil.isCellDateFormatted(beginTimeCell)) { |
| | | // 处理数值型日期(包括Excel内置日期格式) |
| | | beginTime = beginTimeCell.getDateCellValue().toInstant() |
| | | .atZone(ZoneId.systemDefault()) |
| | | .toLocalDateTime(); |
| | | } else { |
| | | // 处理文本型日期(如 "2025/4/3 23:25:38") |
| | | String dateStr = beginTimeCell.getStringCellValue().trim(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/M/d H:mm:ss"); |
| | | beginTime = LocalDateTime.parse(dateStr, formatter); |
| | | } |
| | | |
| | | // 结束时间 |
| | | Cell endTimeCell = row.getCell(6); |
| | | if (endTimeCell == null) { |
| | | throw new ServiceException("第" + (i + 1) + "行开始时间为空", 500); |
| | | } |
| | | |
| | | LocalDateTime endTime; |
| | | if (endTimeCell.getCellType() == CellType.NUMERIC || DateUtil.isCellDateFormatted(endTimeCell)) { |
| | | // 处理数值型日期(包括Excel内置日期格式) |
| | | endTime = endTimeCell.getDateCellValue().toInstant() |
| | | .atZone(ZoneId.systemDefault()) |
| | | .toLocalDateTime(); |
| | | } else { |
| | | // 处理文本型日期(如 "2025/4/3 23:25:38") |
| | | String dateStr = beginTimeCell.getStringCellValue().trim(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/M/d H:mm:ss"); |
| | | endTime = LocalDateTime.parse(dateStr, formatter); |
| | | } |
| | | |
| | | |
| | | // 充电时长 |
| | | if (row.getCell(8 )== null){ |
| | | throw new ServiceException("第" + i + "行充电时长为空", 500); |
| | | } |
| | | row.getCell(8).setCellType(CellType.STRING); |
| | | String chargingDuration = row.getCell(8).getStringCellValue(); |
| | | |
| | | |
| | | // 充电电量 |
| | | if (row.getCell(9 )== null){ |
| | | throw new ServiceException("第" + i + "行充电电量为空", 500); |
| | | } |
| | | row.getCell(9).setCellType(CellType.STRING); |
| | | String chargingCapacity = row.getCell(9).getStringCellValue(); |
| | | |
| | | // 电站运营商 |
| | | if (row.getCell(15 )== null){ |
| | | throw new ServiceException("第" + i + "行电站运营商为空", 500); |
| | | } |
| | | row.getCell(15).setCellType(CellType.STRING); |
| | | String powerStationOperator = row.getCell(15).getStringCellValue(); |
| | | |
| | | // 城市名称 |
| | | if (row.getCell(16 )== null){ |
| | | throw new ServiceException("第" + i + "行城市名称为空", 500); |
| | | } |
| | | row.getCell(16).setCellType(CellType.STRING); |
| | | String city = row.getCell(16).getStringCellValue(); |
| | | |
| | | // 充电场站 |
| | | if (row.getCell(17 )== null){ |
| | | throw new ServiceException("第" + i + "行充电场站为空", 500); |
| | | } |
| | | row.getCell(17).setCellType(CellType.STRING); |
| | | String chargingStation = row.getCell(17).getStringCellValue(); |
| | | |
| | | // 电站id |
| | | if (row.getCell(18 )== null){ |
| | | throw new ServiceException("第" + i + "行电站id为空", 500); |
| | | } |
| | | row.getCell(18).setCellType(CellType.STRING); |
| | | String powerStationId = row.getCell(18).getStringCellValue(); |
| | | |
| | | // 终端编码 |
| | | if (row.getCell(20 )== null){ |
| | | throw new ServiceException("第" + i + "行电站id为空", 500); |
| | | } |
| | | row.getCell(20).setCellType(CellType.STRING); |
| | | String terminalCode = row.getCell(20).getStringCellValue(); |
| | | |
| | | // 车牌号 |
| | | if (row.getCell(26 )== null){ |
| | | throw new ServiceException("第" + i + "行车牌号为空", 500); |
| | | } |
| | | row.getCell(26).setCellType(CellType.STRING); |
| | | String plateNumber = row.getCell(26).getStringCellValue(); |
| | | |
| | | // 电站价电费金额 |
| | | if (row.getCell(73 )== null){ |
| | | throw new ServiceException("第" + i + "行电站价电费金额为空", 500); |
| | | } |
| | | row.getCell(73).setCellType(CellType.STRING); |
| | | String electricityAmount = row.getCell(73).getStringCellValue(); |
| | | |
| | | // 电站价服务费金额 |
| | | if (row.getCell(74 )== null){ |
| | | throw new ServiceException("第" + i + "行电站价服务费金额为空", 500); |
| | | } |
| | | row.getCell(74).setCellType(CellType.STRING); |
| | | String serviceAmount = row.getCell(74).getStringCellValue(); |
| | | |
| | | // 电站价总金额 |
| | | if (row.getCell(75 )== null){ |
| | | throw new ServiceException("第" + i + "行电站价服务费金额为空", 500); |
| | | } |
| | | row.getCell(75).setCellType(CellType.STRING); |
| | | String totalAmount = row.getCell(75).getStringCellValue(); |
| | | |
| | | |
| | | //检查订单号是否重复 |
| | | if (orderNumberList.contains(orderNum)) { |
| | | throw new ServiceException("订单号重复:" + orderNum, 500); |
| | | } |
| | | //数据库中是否存在 |
| | | ChargeOrder order = chargeOrderService.getOne(new LambdaQueryWrapper<ChargeOrder>() |
| | | .eq(ChargeOrder::getOrderNumber, orderNum) |
| | | ); |
| | | if (order != null) { |
| | | throw new ServiceException("数据库中订单已存在:" + orderNum, 500); |
| | | } |
| | | orderNumberList.add(orderNum);//添加到订单集合中 |
| | | |
| | | |
| | | ChargeOrder chargeOrder = new ChargeOrder(); |
| | | chargeOrder.setOrderNumber(orderNum); |
| | | chargeOrder.setOrderType(orderType); |
| | | chargeOrder.setChargeType(chargeType); |
| | | chargeOrder.setPhone(phone); |
| | | chargeOrder.setBeginTime(beginTime ); |
| | | chargeOrder.setEndTime(endTime); |
| | | chargeOrder.setChargingDuration(chargingDuration); |
| | | chargeOrder.setChargingCapacity( new BigDecimal(chargingCapacity)); |
| | | chargeOrder.setPowerStationOperator(powerStationOperator); |
| | | chargeOrder.setCity(city); |
| | | chargeOrder.setChargingStation(chargingStation); |
| | | chargeOrder.setPowerStationId(Integer.valueOf(powerStationId)); |
| | | chargeOrder.setTerminalCode(terminalCode); |
| | | chargeOrder.setPlateNumber(plateNumber); |
| | | chargeOrder.setElectricityAmount(new BigDecimal(electricityAmount)); |
| | | chargeOrder.setServiceAmount(new BigDecimal(serviceAmount)); |
| | | chargeOrder.setTotalAmount(new BigDecimal(totalAmount)); |
| | | |
| | | R r = importData(chargeOrder); |
| | | if (R.isError(r)) { |
| | | throw new ServiceException(r.getMsg(), 500); |
| | | } |
| | | } |
| | | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<ChargeOrder> getUserPointPageList(GetImportOrderDTO dto) { |
| | | PageInfo<ChargeOrder> pageInfo = new PageInfo<>(dto.getPageCurr(), dto.getPageSize()); |
| | | List<ChargeOrder> list= baseMapper.getUserPointPageList(pageInfo,dto); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | private R importData(ChargeOrder chargeOrder) { |
| | | //先计算出积分数 |
| | | Integer point = getPoint(chargeOrder.getTotalAmount()); |
| | | //获取用户,更改积分数 |
| | | AppUser appuser = appUserClient.getAppUserByPhone1(chargeOrder.getPhone()).getData(); |
| | | if (null==appuser){ |
| | | //创建用户 |
| | | appuser = new AppUser(); |
| | | // Long userId = UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE; |
| | | // appuser.setId(userId); |
| | | appuser.setPhone(chargeOrder.getPhone()); |
| | | appuser.setStatus(1); |
| | | appuser.setAvatar( DEFAULT_AVATAR_URL); |
| | | appuser.setCreateTime(LocalDateTime.now()); |
| | | appuser.setDelFlag(false); |
| | | } |
| | | Integer chargePoint=appuser.getRechargePoint();//充值积分 |
| | | Integer availablePoint=appuser.getAvailablePoint();//可用积分 |
| | | Integer totalPoint=appuser.getTotalPoint();//总积分 |
| | | appuser.setRechargePoint(chargePoint==null?0:chargePoint +point);//充值积分增加 |
| | | appuser.setAvailablePoint(availablePoint==null?0:availablePoint+point);//可用积分增加 |
| | | appuser.setTotalPoint(totalPoint==null?0:totalPoint+point);//总积分增加 |
| | | |
| | | Long userId = appUserClient.saveOrUpdateAppUser(appuser); |
| | | if (userId==null){ |
| | | return R.fail("导入订单-保存用户失败"); |
| | | } |
| | | |
| | | //添加用户积分流水 |
| | | //转入用户 |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(17); |
| | | userPoint.setHistoricalPoint(availablePoint); |
| | | userPoint.setVariablePoint(point); |
| | | userPoint.setBalance(appuser.getAvailablePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(userId); |
| | | userPoint.setExtention(chargeOrder.getOrderNumber()); |
| | | R r = userPointClient.save(userPoint); |
| | | if (r.isError(r)) { |
| | | return R.fail("导入订单-保存用户积分流水失败"); |
| | | } |
| | | //保存到数据库 |
| | | chargeOrderService.save(chargeOrder); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取现金兑换的积分数 |
| | | * @param cash |
| | | * @return |
| | | */ |
| | | public Integer getPoint(BigDecimal cash){ |
| | | if (cash == null || cash.compareTo(BigDecimal.ZERO) < 0) { |
| | | throw new IllegalArgumentException("金额不能为null或负数"); |
| | | } |
| | | // 获取积分兑换比例配置 |
| | | R<SysConfig> info = sysConfigClient.getInfo(8L); |
| | | if (info == null || info.getData() == null) { |
| | | throw new RuntimeException("获取积分兑换比例配置失败"); |
| | | } |
| | | String configValue = info.getData().getConfigValue(); |
| | | if (StringUtils.isBlank(configValue)) { |
| | | throw new RuntimeException("积分兑换比例配置值为空"); |
| | | } |
| | | try { |
| | | // 使用BigDecimal处理比例,避免精度问题 |
| | | BigDecimal ratio = new BigDecimal(configValue.trim()); |
| | | if (ratio.compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new RuntimeException("积分兑换比例必须大于0"); |
| | | } |
| | | |
| | | // 计算积分并向下取整(Floor) |
| | | BigDecimal points = cash.multiply(ratio); |
| | | return points.setScale(0, RoundingMode.FLOOR).intValue(); |
| | | |
| | | } catch (NumberFormatException e) { |
| | | throw new RuntimeException("积分兑换比例配置值格式错误", e); |
| | | } catch (ArithmeticException e) { |
| | | throw new RuntimeException("积分计算结果溢出", e); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | order.setPointDeductionAmount(pointDeductionAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setPaymentAmount(paymentMoney);//实际支付价格 |
| | | order.setPoint(orderPoint);//使用积分 |
| | | order.setPayMethod(orderPayment.getPaymentType());//支付方式 |
| | | if (orderPayment.getPaymentType()==3 && orderPoint>0){//微信支付 但支付的积分也大于0 |
| | | order.setPayMethod(4);//组合支付 |
| | | }else { |
| | | order.setPayMethod(orderPayment.getPaymentType());//积分或者微信 |
| | | } |
| | | order.setPayStatus(1); |
| | | order.setShopId(orderPayment.getShopId()); |
| | | order.setDelFlag(0); |
| | |
| | | /** |
| | | * 订单状态 |
| | | */ |
| | | @Excel(name = "订单状态" , readConverterExp = "1=待发货,2=待收货,3=待使用,4=已完成,5=已取消,6=已退款,7=售后中,8=已评价") |
| | | @Excel(name = "订单状态" , readConverterExp = "3=待使用,4=已完成,5=已取消,8=已评价") |
| | | private String orderStatus; |
| | | |
| | | |
| | | /** |
| | | * 交易单号 |
| | | */ |
| | | @Excel(name = "交易单号") |
| | | private String serialNumber; |
| | | |
| | | /** |
| | | * 商户单号 |
| | |
| | | private String orderNumber; |
| | | |
| | | /** |
| | | * 商户号 |
| | | * 交易单号 |
| | | */ |
| | | @Excel(name = "商户号") |
| | | private String tradeMerchantNo = "729677708"; |
| | | |
| | | /** |
| | | * 发货方式 |
| | | */ |
| | | @Excel(name = "发货方式", readConverterExp = "1=快递,2=自提") |
| | | private String distributionMode; |
| | | |
| | | /** |
| | | * 发货模式 |
| | | */ |
| | | @Excel(name = "发货模式") |
| | | private String deliveryMode = "统一发货"; |
| | | |
| | | |
| | | /** |
| | | * 是否完成发货 |
| | | */ |
| | | @Excel(name = "是否完成发货") |
| | | private String isDelivery; |
| | | |
| | | /** |
| | | * 是否重新发货 |
| | | */ |
| | | @Excel(name = "是否重新发货") |
| | | private String isReDelivery; |
| | | |
| | | |
| | | /** |
| | | * 订单类型 |
| | | */ |
| | | @Excel(name = "订单类型", readConverterExp = "1=服务,2=单品(自提),3=单品(快递)") |
| | | private String orderType; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 收货地址 |
| | | */ |
| | | @Excel(name = "收货地址") |
| | | private String address; |
| | | @Excel(name = "交易单号") |
| | | private String serialNumber; |
| | | |
| | | /** |
| | | * 下单时间 |
| | |
| | | @Excel(name = "联系方式") |
| | | private String phone; |
| | | |
| | | |
| | | /** |
| | | * 商品名称 |
| | | */ |
| | |
| | | */ |
| | | @Excel(name = "商品售价") |
| | | private BigDecimal sellingPrice; |
| | | |
| | | /** |
| | | * 成本价 |
| | | */ |
| | | @Excel(name = "公司运营成本") |
| | | private BigDecimal companyCostPrice; |
| | | |
| | | /** |
| | | * 成本价 |
| | | */ |
| | | @Excel(name = "门店、供应商成本") |
| | | private BigDecimal supplierCostPrice; |
| | | |
| | | @Excel(name = "支付方式",readConverterExp ="1=微信,2=账户余额,3=积分,4=组合") |
| | | private Integer pay_method; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | @Excel(name = "支付金额") |
| | | private String orderMoney; |
| | | |
| | | @Excel(name = "支付积分") |
| | | private String point; |
| | | |
| | | private String goodJson; |
| | | /** |
| | | * 商户号 |
| | | */ |
| | | @Excel(name = "商户号") |
| | | private String tradeMerchantNo = "729677708"; |
| | | |
| | | /** |
| | | * 发货方式 |
| | | */ |
| | | /* @Excel(name = "发货方式", readConverterExp = "1=快递,2=自提") |
| | | private String distributionMode;*/ |
| | | |
| | | /** |
| | | * 发货模式 |
| | | */ |
| | | /* @Excel(name = "发货模式") |
| | | private String deliveryMode = "统一发货";*/ |
| | | |
| | | |
| | | /** |
| | | * 是否完成发货 |
| | | */ |
| | | /* |
| | | @Excel(name = "是否完成发货") |
| | | private String isDelivery; |
| | | */ |
| | | |
| | | /** |
| | | * 是否重新发货 |
| | | */ |
| | | /* |
| | | @Excel(name = "是否重新发货") |
| | | private String isReDelivery; |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * 订单类型 |
| | | */ |
| | | /* @Excel(name = "订单类型", readConverterExp = "1=服务,2=单品(自提),3=单品(快递)") |
| | | private String orderType;*/ |
| | | |
| | | |
| | | |
| | | /** |
| | | * 收货地址 |
| | | */ |
| | | /* |
| | | @Excel(name = "收货地址") |
| | | private String address; |
| | | */ |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 成本价 |
| | | */ |
| | | /* @Excel(name = "公司运营成本") |
| | | private BigDecimal companyCostPrice;*/ |
| | | |
| | | /** |
| | | * 成本价 |
| | | */ |
| | | /* @Excel(name = "门店、供应商成本") |
| | | private BigDecimal supplierCostPrice;*/ |
| | | |
| | | |
| | | |
| | | /** |
| | | * 快递单号 |
| | | */ |
| | | @Excel(name = "快递单号") |
| | | /* @Excel(name = "快递单号") |
| | | private String expressNum; |
| | | |
| | | private String expressJson; |
| | | private String expressJson;*/ |
| | | |
| | | private String goodJson; |
| | | |
| | | |
| | | /** |
| | | * 快递公司 |
| | | */ |
| | | @Excel(name = "快递公司") |
| | | private String expressName; |
| | | /* @Excel(name = "快递公司") |
| | | private String expressName;*/ |
| | | |
| | | /** |
| | | /* *//** |
| | | * 省 |
| | | */ |
| | | *//* |
| | | @Excel(name = "省") |
| | | private String province; |
| | | |
| | | /** |
| | | *//** |
| | | * 省区划代码 |
| | | */ |
| | | *//* |
| | | @Excel(name = "省区划代码") |
| | | private String provinceCode; |
| | | |
| | | /** |
| | | *//** |
| | | * 市 |
| | | */ |
| | | *//* |
| | | @Excel(name = "市") |
| | | private String city; |
| | | |
| | | /** |
| | | *//** |
| | | * 市区划代码 |
| | | */ |
| | | *//* |
| | | @Excel(name = "市区划代码") |
| | | private String cityCode; |
| | | |
| | | private String addressJson; |
| | | private String addressJson;*/ |
| | | |
| | | |
| | | |
New file |
| | |
| | | <?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.ruoyi.order.mapper.ChargeOrderMapper"> |
| | | |
| | | |
| | | <select id="getUserPointPageList" resultType="com.ruoyi.order.model.ChargeOrder"> |
| | | select * from t_charge_order |
| | | where |
| | | 1=1 |
| | | <if test="dto.orderNumber != null and dto.orderNumber != ''"> |
| | | AND order_number LIKE CONCAT('%', #{dto.orderNumber}, '%') |
| | | </if> |
| | | <if test="dto.phone != null and dto.phone != ''"> |
| | | AND phone LIKE CONCAT('%', #{dto.phone}, '%') |
| | | </if> |
| | | <if test="dto.chargingStation != null and dto.chargingStation != ''"> |
| | | AND charging_station LIKE CONCAT('%', #{dto.chargingStation}, '%') |
| | | </if> |
| | | <if test="dto.powerStationOperator != null and dto.powerStationOperator != ''"> |
| | | AND power_station_operator LIKE CONCAT('%', #{dto.powerStationOperator}, '%') |
| | | </if> |
| | | <if test="dto.terminalCode != null and dto.terminalCode != ''"> |
| | | AND terminal_code LIKE CONCAT('%', #{dto.terminalCode}, '%') |
| | | </if> |
| | | <if test="dto.beginTime1 != null and dto.endTime1 != null "> |
| | | AND begin_time between #{dto.beginTime1} and #{dto.endTime1} |
| | | </if> |
| | | |
| | | <if test="dto.beginTime2 != null and dto.endTime2 != null"> |
| | | AND end_time between #{dto.beginTime2 } and #{dto.endTime2 } |
| | | </if> |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | SELECT |
| | | o.order_status, |
| | | o.order_number, |
| | | CASE WHEN o.order_type = 1 THEN 1 WHEN o.order_type = 2 and o.distribution_mode = 1 THEN 2 ELSE 3 END as orderType, |
| | | case when o.order_type = 1 then 1 else o.distribution_mode end as distributionMode, |
| | | o.address_Json, |
| | | o.create_time, |
| | | o.app_user_id, |
| | | og.goods_id, |
| | | og.selling_price, |
| | | og.good_json, |
| | | og.selling_price orderMoney, |
| | | o.express_json, |
| | | o.serial_number, |
| | | o.deliver_province province, |
| | | o.deliver_province_code provinceCode, |
| | | o.deliver_city city, |
| | | o.deliver_city_code cityCode |
| | | o.pay_method, |
| | | o.payment_amount orderMoney, |
| | | o.point , |
| | | o.serial_number |
| | | |
| | | FROM |
| | | t_order_good og |
| | | LEFT JOIN t_order o ON og.order_id = o.id |
| | |
| | | <if test="null != item.code and '' != item.code"> |
| | | and o.order_number like CONCAT('%', #{item.code}, '%') |
| | | </if> |
| | | <if test="null != item.goodsName and '' != item.goodsName"> |
| | | and good_name like CONCAT('%', #{item.goodsName}, '%') |
| | | </if> |
| | | |
| | | <if test="null != item.appUserIds and item.appUserIds.size() > 0"> |
| | | and o.app_user_id in |
| | | <foreach collection="item.appUserIds" separator="," item="tem" index="index" open="(" close=")"> |
| | | #{tem} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != item.goodsType and 1 == item.goodsType"> |
| | | and order_type = #{item.goodsType} |
| | | </if> |
| | | <if test="null != item.goodsType and 2 == item.goodsType"> |
| | | and order_type = 2 and distribution_mode = 1 |
| | | </if> |
| | | <if test="null != item.goodsType and 3 == item.goodsType"> |
| | | and order_type = 2 and distribution_mode = 2 |
| | | </if> |
| | | <if test="null != item.paymentType"> |
| | | and o.pay_method = #{item.paymentType} |
| | |
| | | and o.order_status in (4, 8) |
| | | </if> |
| | | <if test="null != item.shopId"> |
| | | and o.shop_id = #{item.shopId} and distribution_mode != 2 |
| | | and o.shop_id = #{item.shopId} |
| | | </if> |
| | | <if test="null != item.startTime and null != item.endTime"> |
| | | and o.create_time between #{item.startTime} and #{item.endTime} |
| | |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | |
| | | import com.ruoyi.other.service.ShopBalanceStatementService; |
| | | import com.ruoyi.other.service.ShopService; |
| | | |
| | | import com.ruoyi.other.vo.ShopBalanceStatementDetailPage; |
| | | import com.ruoyi.other.vo.ShopCommission; |
| | | import com.ruoyi.other.vo.ShopCommissionDetail; |
| | | import com.ruoyi.other.vo.*; |
| | | |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | |
| | | }*/ |
| | | |
| | | |
| | | /** |
| | | * 获取门店流水数据 |
| | | * |
| | | * @param types |
| | | * @param objectId |
| | | * @return |
| | | */ |
| | | @GetMapping("/getShopBalanceStatementPageList") |
| | | public R<PageInfo<ShopBalanceStatementVO>> getShopBalanceStatementPageList(@RequestParam("types") Collection<Integer> types, |
| | | @RequestParam(value = "objectId", required = false) Long objectId, |
| | | @RequestParam(value = "id") Integer id, |
| | | @ApiParam("当前页")@RequestParam("pageCurr") Integer pageCurr, |
| | | @ApiParam("分页大小")@RequestParam("pageSize") Integer pageSize) { |
| | | PageInfo<ShopBalanceStatementVO> pageInfo=shopBalanceStatementService.getShopBalanceStatementPageList(types,objectId,id,pageCurr,pageSize); |
| | | |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.account.api.model.AppUserShop; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | |
| | | */ |
| | | |
| | | /** |
| | | * 获取店铺收益 后天-工作台-收益分析 |
| | | * 获取店铺收益 后台-工作台-收益分析 |
| | | */ |
| | | @PostMapping("/getIncomeAnalysis") |
| | | R<Map<String, Object>> getIncomeAnalysis(@RequestBody ShopAnalysisDTO shopAnalysisDTO){ |
| | |
| | | return R.ok(shop.getId()); |
| | | } |
| | | |
| | | /** |
| | | * 店铺余额列表 |
| | | */ |
| | | |
| | | @GetMapping("/getBalanceList") |
| | | @ApiOperation(value = "门店余额列表", tags = {"后台-财务统计-余额列表"}) |
| | | R<PageInfo<ShopBalanceListVO>> getBalanceList(@ApiParam("门店名称")@RequestParam("name") String name, |
| | | @ApiParam("当前页")@RequestParam("pageCurr") Integer pageCurr, |
| | | @ApiParam("分页大小")@RequestParam("pageSize") Integer pageSize){ |
| | | PageInfo<ShopBalanceListVO> pageInfo=shopService.getBalanceList(name,pageCurr,pageSize); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | /** |
| | | * 导出店铺余额列表 |
| | | */ |
| | | |
| | | @GetMapping("/shopBalanceExcel") |
| | | @ApiOperation(value = "导出", tags = {"后台-财务统计-余额列表"}) |
| | | void shopBalanceExcel(HttpServletResponse response,@ApiParam("门店名称")@RequestParam(value = "name" ,required = false) String name){ |
| | | List<ShopBalanceExcel> exportList =shopMapper.shopBalanceExcel(name); |
| | | ExcelUtil<ShopBalanceExcel> util = new ExcelUtil<ShopBalanceExcel>(ShopBalanceExcel.class); |
| | | util.exportExcel(response, exportList, "店铺余额列表数据"); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | //扣除账户余额及添加变动明细 |
| | | BigDecimal balance = shop.getBalance();//余额 |
| | | BigDecimal canWithdrawMoney = shop.getCanWithdrawMoney();//可提现金额 |
| | | BigDecimal withdrawMoney = shop.getWithdrawMoney();//审核中金额 |
| | | BigDecimal withdrawAuditMoney = shop.getWithdrawAuditMoney();//审核中金额 |
| | | shop.setBalance(balance.subtract(money).setScale(2, RoundingMode.HALF_EVEN));//余额减少 |
| | | shop.setCanWithdrawMoney(canWithdrawMoney.subtract(money).setScale(2, RoundingMode.HALF_EVEN));//可提现金额减少 |
| | | shop.setWithdrawAuditMoney(withdrawMoney.add(money).setScale(2, RoundingMode.HALF_EVEN));//审核中金额增加 |
| | | shop.setWithdrawAuditMoney(withdrawAuditMoney.add(money).setScale(2, RoundingMode.HALF_EVEN));//审核中金额增加 |
| | | shopService.updateById(shop); |
| | | //添加余额变动明细 |
| | | ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement(); |
| | |
| | | //添加门店变动明细 |
| | | ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement(); |
| | | shopBalanceStatement.setShopId(shop.getId()); |
| | | shopBalanceStatement.setType(4); |
| | | shopBalanceStatement.setType(7); |
| | | shopBalanceStatement.setHistoricalBalance(balance); |
| | | shopBalanceStatement.setVariableAmount(money); |
| | | shopBalanceStatement.setBalance(shop.getBalance()); |
| | |
| | | //添加门店变动明细 |
| | | ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement(); |
| | | shopBalanceStatement.setShopId(shop.getId()); |
| | | shopBalanceStatement.setType(4); |
| | | shopBalanceStatement.setType(7); |
| | | shopBalanceStatement.setHistoricalBalance(balance); |
| | | shopBalanceStatement.setVariableAmount(money); |
| | | shopBalanceStatement.setBalance(shop.getBalance()); |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | import com.ruoyi.other.vo.ShopBalanceListVO; |
| | | import com.ruoyi.other.vo.ShopBalanceStatementVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | List<ShopBalanceStatementVO> getShopBalanceStatementList(PageInfo<ShopBalanceStatementVO> pageInfo, @Param("shopId") Integer shopId, @Param("startTime") LocalDateTime startTime, |
| | | @Param("endTime") LocalDateTime endTime, @Param("type") Integer type); |
| | | |
| | | List<ShopBalanceStatementVO> getShopBalanceStatementPageList(PageInfo<ShopBalanceStatementVO> pageInfo,@Param("types") Collection<Integer> types,@Param("objectId") Long objectId,@Param("shopId") Integer id); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.vo.GoodsVO; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | | import com.ruoyi.other.vo.ShopDetailVO; |
| | | import com.ruoyi.other.vo.ShopStatistics; |
| | | import com.ruoyi.other.vo.*; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | ShopStatistics getShopStatistics(@Param("shopId") Integer shopId); |
| | | |
| | | List<GoodsVO> selectListByShopId(PageInfo<GoodsVO> pageInfo, @Param("shopId") Integer shopId); |
| | | |
| | | List<ShopBalanceListVO> getBalanceList(PageInfo<ShopBalanceListVO> pageInfo, String name); |
| | | |
| | | List<ShopBalanceExcel> shopBalanceExcel(String name); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | import com.ruoyi.other.vo.ShopBalanceListVO; |
| | | import com.ruoyi.other.vo.ShopBalanceStatementVO; |
| | | |
| | | import java.util.Collection; |
| | | |
| | | |
| | | /** |
| | |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface ShopBalanceStatementService extends IService<ShopBalanceStatement> { |
| | | PageInfo<ShopBalanceStatementVO> getShopBalanceStatementPageList(Collection<Integer> types, Long objectId, Integer id, Integer pageCurr, Integer pageSize); |
| | | // ShopCommissionStatisticsVO shopCommissionStatistics(IPage<ShopBalanceStatement> page, ShopBalanceStatement shopBalanceStatement); |
| | | } |
| | |
| | | Integer addGoodsByShop(AddGoodsDTO addGoodsDTO); |
| | | |
| | | Integer editGoodsByShop(AddGoodsDTO addGoodsDTO); |
| | | |
| | | PageInfo<ShopBalanceListVO> getBalanceList(String name, Integer pageCurr, Integer pageSize); |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | import com.ruoyi.other.mapper.ShopBalanceStatementMapper; |
| | | import com.ruoyi.other.service.ShopBalanceStatementService; |
| | | |
| | | import com.ruoyi.other.vo.ShopBalanceListVO; |
| | | import com.ruoyi.other.vo.ShopBalanceStatementVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Service |
| | | public class ShopBalanceStatementServiceImpl extends ServiceImpl<ShopBalanceStatementMapper, ShopBalanceStatement> implements ShopBalanceStatementService { |
| | | |
| | | @Autowired |
| | | private ShopBalanceStatementMapper shopBalanceStatementMapper; |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<ShopBalanceStatementVO> getShopBalanceStatementPageList(Collection<Integer> types, Long objectId, Integer id, Integer pageCurr, Integer pageSize) { |
| | | PageInfo<ShopBalanceStatementVO> pageInfo = new PageInfo<>(pageCurr, pageSize); |
| | | List<ShopBalanceStatementVO> list =shopBalanceStatementMapper.getShopBalanceStatementPageList(pageInfo,types,objectId,id); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
| | |
| | | return goods.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<ShopBalanceListVO> getBalanceList(String name, Integer pageCurr, Integer pageSize) { |
| | | PageInfo<ShopBalanceListVO> pageInfo = new PageInfo<>(pageCurr, pageSize); |
| | | |
| | | List<ShopBalanceListVO> list = shopMapper.getBalanceList(pageInfo,name); |
| | | |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | /** |
| | | * 获取商品当前的价格,就是看当前商品是否在秒杀活动中 |
| | | */ |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class AllShopVO { |
| | | private Integer id; |
| | | private String name; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | @Data |
| | | public class ShopBalanceExcel { |
| | | @Excel(name = "门店id") |
| | | private Integer id; |
| | | @Excel(name = "店铺名称") |
| | | private String name; |
| | | @Excel(name = "收益总额") |
| | | private BigDecimal totalMoney; |
| | | |
| | | @Excel(name = "余额") |
| | | private BigDecimal balance; |
| | | @Excel(name = "冻结金额") |
| | | private BigDecimal frozenMoney; |
| | | |
| | | @Excel(name = "可提现金额") |
| | | private BigDecimal canWithdrawMoney; |
| | | |
| | | @Excel(name = "提现中金额") |
| | | private BigDecimal withdrawAuditMoney; |
| | | @Excel(name = "已提现金额") |
| | | private BigDecimal withdrawMoney; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class ShopBalanceListVO { |
| | | |
| | | @ApiModelProperty("门店id") |
| | | private Integer id; |
| | | @ApiModelProperty("门店名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("总收入") |
| | | private BigDecimal totalMoney; |
| | | @ApiModelProperty("余额") |
| | | private BigDecimal balance; |
| | | @ApiModelProperty("可提现金额") |
| | | private BigDecimal canWithdrawMoney; |
| | | @ApiModelProperty("冻结金额") |
| | | private BigDecimal frozenMoney; |
| | | @ApiModelProperty("审核中金额") |
| | | private BigDecimal withdrawAuditMoney; |
| | | @ApiModelProperty("已提现金额") |
| | | private BigDecimal withdrawMoney; |
| | | } |
| | |
| | | @ApiModel("ShopBalanceStatementVO对象") |
| | | public class ShopBalanceStatementVO { |
| | | |
| | | @ApiModelProperty(value = "变动类型(4=提现,5=订单收入,6=订单退款)") |
| | | @ApiModelProperty(value = "变动类型(4=提现,5=订单收入,6=订单退款,7=提现失败)") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "变动金额") |
| | |
| | | @ApiModelProperty(value = "增或减标识: 1-增 2-减") |
| | | private Integer flag; |
| | | |
| | | @ApiModelProperty("提现/订单号") |
| | | private String objectId; |
| | | |
| | | } |
| | |
| | | </if> |
| | | order by createTime desc |
| | | </select> |
| | | |
| | | <select id="getShopBalanceStatementPageList" resultType="com.ruoyi.other.vo.ShopBalanceStatementVO"> |
| | | select |
| | | type, |
| | | variable_amount, |
| | | DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') as createTime, |
| | | historical_balance, |
| | | balance, |
| | | CASE WHEN (balance - historical_balance) > 0 THEN 1 ELSE 0 END AS flag, |
| | | object_id |
| | | from |
| | | t_shop_balance_statement |
| | | where |
| | | shop_id = #{shopId} |
| | | <if test="objectId != null "> |
| | | AND object_id = #{objectId} |
| | | </if> |
| | | <if test="types != null and types.size>0"> |
| | | AND type IN |
| | | <foreach collection="types" item="type" open="(" separator="," close=")"> |
| | | #{type} |
| | | </foreach> |
| | | </if> |
| | | |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | ORDER BY ifnull(tg.sort, -1) DESC |
| | | </select> |
| | | <select id="getBalanceList" resultType="com.ruoyi.other.vo.ShopBalanceListVO"> |
| | | SELECT |
| | | id, |
| | | name, |
| | | balance, |
| | | can_withdraw_money AS canWithdrawMoney, |
| | | withdraw_audit_money AS withdrawAuditMoney, |
| | | withdraw_money AS withdrawMoney, |
| | | (balance - can_withdraw_money) AS frozenMoney, |
| | | (can_withdraw_money + withdraw_audit_money + withdraw_money + (balance - can_withdraw_money)) AS totalMoney |
| | | FROM t_shop |
| | | WHERE del_flag = 0 |
| | | <if test="name != null and name != ''"> |
| | | AND `name` LIKE CONCAT('%', #{name}, '%') |
| | | </if> |
| | | </select> |
| | | <select id="shopBalanceExcel" resultType="com.ruoyi.other.vo.ShopBalanceExcel"> |
| | | select |
| | | id, |
| | | name, |
| | | balance, |
| | | can_withdraw_money AS canWithdrawMoney, |
| | | withdraw_audit_money AS withdrawAuditMoney, |
| | | withdraw_money AS withdrawMoney, |
| | | (balance - can_withdraw_money) AS frozenMoney, |
| | | (can_withdraw_money + withdraw_audit_money + withdraw_money + (balance - can_withdraw_money)) AS totalMoney |
| | | FROM t_shop |
| | | WHERE del_flag = 0 |
| | | <if test="name != null and name != ''"> |
| | | AND `name` LIKE CONCAT('%', #{name}, '%') |
| | | </if> |
| | | </select> |
| | | </mapper> |