250108
This commit is contained in:
@@ -34,6 +34,7 @@ public class BookingUserInvoiceController extends BaseController {
|
|||||||
@ApiOperation("分页查询发票")
|
@ApiOperation("分页查询发票")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<BookingUserInvoice>> page(BookingUserInvoiceParam param) {
|
public ApiResult<PageResult<BookingUserInvoice>> page(BookingUserInvoiceParam param) {
|
||||||
|
param.setUserId(getLoginUserId());
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(bookingUserInvoiceService.pageRel(param));
|
return success(bookingUserInvoiceService.pageRel(param));
|
||||||
}
|
}
|
||||||
@@ -56,6 +57,7 @@ public class BookingUserInvoiceController extends BaseController {
|
|||||||
@ApiOperation("添加发票")
|
@ApiOperation("添加发票")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody BookingUserInvoice bookingUserInvoice) {
|
public ApiResult<?> save(@RequestBody BookingUserInvoice bookingUserInvoice) {
|
||||||
|
bookingUserInvoice.setUserId(getLoginUserId());
|
||||||
if (bookingUserInvoiceService.save(bookingUserInvoice)) {
|
if (bookingUserInvoiceService.save(bookingUserInvoice)) {
|
||||||
return success("添加成功");
|
return success("添加成功");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ public class MybatisPlusConfig {
|
|||||||
if (tenantId != null) {
|
if (tenantId != null) {
|
||||||
return new LongValue(tenantId);
|
return new LongValue(tenantId);
|
||||||
}
|
}
|
||||||
return getLoginUserTenantId();
|
// return getLoginUserTenantId();
|
||||||
|
return new LongValue(10150);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -70,7 +70,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
"/api/cms/form-record",
|
"/api/cms/form-record",
|
||||||
"/api/shop/merchant-account/getMerchantAccountByPhone",
|
"/api/shop/merchant-account/getMerchantAccountByPhone",
|
||||||
"/api/think/think-order/notify",
|
"/api/think/think-order/notify",
|
||||||
"/api/think/think-users-vip/notify"
|
"/api/think/think-users-vip/notify",
|
||||||
|
"/api/think/think-order-refund-log/notify",
|
||||||
|
"/api/think/think-deposit/notify",
|
||||||
|
"/api/think/think-deposit/refund-notify",
|
||||||
|
"/api/think/think-machine-open-log",
|
||||||
|
"/api/think/think-order/check-code",
|
||||||
|
"/api/think/think-vip-cards-bills/make-bill",
|
||||||
|
"/api/think/think-cards-bills/make-bill"
|
||||||
)
|
)
|
||||||
.permitAll()
|
.permitAll()
|
||||||
.anyRequest()
|
.anyRequest()
|
||||||
|
|||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package com.gxwebsoft.common.system.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.system.entity.Area;
|
||||||
|
import com.gxwebsoft.common.system.param.AreaParam;
|
||||||
|
import com.gxwebsoft.common.system.service.AreaService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 控制器
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2023-07-06 15:08:15
|
||||||
|
*/
|
||||||
|
@Api(tags = "管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/common/area")
|
||||||
|
public class AreaController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private AreaService areaService;
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
|
@ApiOperation("分页查询")
|
||||||
|
@PostMapping("/page")
|
||||||
|
public ApiResult<PageResult<Area>> page(AreaParam param) {
|
||||||
|
PageParam<Area, AreaParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
return success(areaService.page(page, page.getWrapper()));
|
||||||
|
// 使用关联查询
|
||||||
|
//return success(areaService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部")
|
||||||
|
@PostMapping("/area-info-by-name")
|
||||||
|
public ApiResult<Area> areaInfoByName(@RequestBody AreaParam param) {
|
||||||
|
return success(areaService.areaInfoByName(param.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<List<Area>> list() {
|
||||||
|
return success(areaService.list());
|
||||||
|
// 使用关联查询
|
||||||
|
//return success(areaService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部")
|
||||||
|
@PostMapping("/list-by-level")
|
||||||
|
public ApiResult<?> listByLevel(@RequestBody AreaParam areaParam) {
|
||||||
|
Integer level = areaParam.getLevelId();
|
||||||
|
String str = "area-list-by-level";
|
||||||
|
if (level != null) str += "-" + level;
|
||||||
|
List<Area> topList;
|
||||||
|
String topListString = redisTemplate.opsForValue().get(str);
|
||||||
|
if (topListString == null) {
|
||||||
|
topList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 1));
|
||||||
|
for (Area top : topList) {
|
||||||
|
List<Area> secondList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 2).eq(Area::getFid, top.getId()));
|
||||||
|
if (level == null || level == 3) {
|
||||||
|
for (Area second : secondList) {
|
||||||
|
List<Area> thirdList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 3).eq(Area::getFid, second.getId()));
|
||||||
|
second.setChildren(thirdList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
top.setChildren(secondList);
|
||||||
|
}
|
||||||
|
redisTemplate.opsForValue().set(str, JSON.toJSONString(topList));
|
||||||
|
} else topList = JSON.parseArray(topListString, Area.class);
|
||||||
|
return success(topList);
|
||||||
|
// 使用关联查询
|
||||||
|
//return success(areaService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/city-list")
|
||||||
|
public ApiResult<?> cityList() {
|
||||||
|
List<Area> topList;
|
||||||
|
String topListString = redisTemplate.opsForValue().get("area-city-list");
|
||||||
|
if (topListString == null || topListString.equals("[]")) {
|
||||||
|
topList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 1));
|
||||||
|
for (Area top : topList) {
|
||||||
|
List<Area> secondList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 2).eq(Area::getFid, top.getId()));
|
||||||
|
top.setChildren(secondList);
|
||||||
|
}
|
||||||
|
redisTemplate.opsForValue().set("area-city-list", JSON.toJSONString(topList));
|
||||||
|
} else topList = JSON.parseArray(topListString, Area.class);
|
||||||
|
return success(topList);
|
||||||
|
// 使用关联查询
|
||||||
|
//return success(areaService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据id查询")
|
||||||
|
@PostMapping("/{id}")
|
||||||
|
public ApiResult<Area> get(@PathVariable("id") Integer id) {
|
||||||
|
return success(areaService.getById(id));
|
||||||
|
// 使用关联查询
|
||||||
|
//return success(areaService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -280,7 +280,7 @@ public class FileController extends BaseController {
|
|||||||
* 文件上传位置(服务器)
|
* 文件上传位置(服务器)
|
||||||
*/
|
*/
|
||||||
private String getUploadDir() {
|
private String getUploadDir() {
|
||||||
return config.getUploadPath() + "file/";
|
return config.getUploadPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.gxwebsoft.common.system.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2023-07-06 15:08:15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "Area对象", description = "")
|
||||||
|
@TableName("sys_area")
|
||||||
|
public class Area implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Integer fid;
|
||||||
|
|
||||||
|
private Integer levelId;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Area> children;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.gxwebsoft.common.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.gxwebsoft.common.system.entity.Area;
|
||||||
|
import com.gxwebsoft.common.system.param.AreaParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2023-07-06 15:08:15
|
||||||
|
*/
|
||||||
|
public interface AreaMapper extends BaseMapper<Area> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<Area>
|
||||||
|
*/
|
||||||
|
List<Area> selectPageRel(@Param("page") IPage<Area> page,
|
||||||
|
@Param("param") AreaParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<Area> selectListRel(@Param("param") AreaParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?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.common.system.mapper.AreaMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM sys_area a
|
||||||
|
<where>
|
||||||
|
<if test="param.id != null">
|
||||||
|
AND a.id = #{param.id}
|
||||||
|
</if>
|
||||||
|
<if test="param.name != null">
|
||||||
|
AND a.name LIKE CONCAT('%', #{param.name}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.fid != null">
|
||||||
|
AND a.fid = #{param.fid}
|
||||||
|
</if>
|
||||||
|
<if test="param.levelId != null">
|
||||||
|
AND a.level_id = #{param.levelId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.Area">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.Area">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.gxwebsoft.common.system.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 lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2023-07-06 15:08:15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "AreaParam对象", description = "查询参数")
|
||||||
|
public class AreaParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer fid;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer levelId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.gxwebsoft.common.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.system.entity.Area;
|
||||||
|
import com.gxwebsoft.common.system.param.AreaParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2023-07-06 15:08:15
|
||||||
|
*/
|
||||||
|
public interface AreaService extends IService<Area> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<Area>
|
||||||
|
*/
|
||||||
|
PageResult<Area> pageRel(AreaParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<Area>
|
||||||
|
*/
|
||||||
|
List<Area> listRel(AreaParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return Area
|
||||||
|
*/
|
||||||
|
Area getByIdRel(Integer id);
|
||||||
|
|
||||||
|
Area areaInfoByName(String name);
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.gxwebsoft.common.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
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.entity.Area;
|
||||||
|
import com.gxwebsoft.common.system.mapper.AreaMapper;
|
||||||
|
import com.gxwebsoft.common.system.param.AreaParam;
|
||||||
|
import com.gxwebsoft.common.system.service.AreaService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service实现
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2023-07-06 15:08:15
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements AreaService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<Area> pageRel(AreaParam param) {
|
||||||
|
PageParam<Area, AreaParam> page = new PageParam<>(param);
|
||||||
|
//page.setDefaultOrder("create_time desc");
|
||||||
|
List<Area> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Area> listRel(AreaParam param) {
|
||||||
|
List<Area> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<Area, AreaParam> page = new PageParam<>();
|
||||||
|
//page.setDefaultOrder("create_time desc");
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Area getByIdRel(Integer id) {
|
||||||
|
AreaParam param = new AreaParam();
|
||||||
|
param.setId(id);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Area areaInfoByName(String name) {
|
||||||
|
return getOne(
|
||||||
|
new LambdaQueryWrapper<Area>()
|
||||||
|
.eq(Area::getName, name)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -53,7 +53,7 @@ public class CartController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("查询全部购物车")
|
@ApiOperation("查询全部购物车")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<CartVo> list(CartParam param) {
|
public ApiResult<List<Cart>> list(CartParam param) {
|
||||||
if (ObjectUtil.isEmpty(getLoginUser())) {
|
if (ObjectUtil.isEmpty(getLoginUser())) {
|
||||||
return success("请先登录",null);
|
return success("请先登录",null);
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,27 @@ public class CartController extends BaseController {
|
|||||||
if (cartService.count(new LambdaUpdateWrapper<Cart>().eq(Cart::getUserId,getLoginUserId())) > 50) {
|
if (cartService.count(new LambdaUpdateWrapper<Cart>().eq(Cart::getUserId,getLoginUserId())) > 50) {
|
||||||
return fail("购物车宝贝数量已满,建议您先去结算或清理~");
|
return fail("购物车宝贝数量已满,建议您先去结算或清理~");
|
||||||
}
|
}
|
||||||
|
if (!cart.getIsNew()) {
|
||||||
|
LambdaQueryWrapper<Cart> cartLambdaQueryWrapper = new LambdaQueryWrapper<Cart>()
|
||||||
|
.eq(Cart::getGoodsId, cart.getGoodsId())
|
||||||
|
.eq(Cart::getUserId, cart.getUserId());
|
||||||
|
if (cart.getSpec() != null && !cart.getSpec().isEmpty()) cartLambdaQueryWrapper.eq(Cart::getSpec, cart.getSpec());
|
||||||
|
cartLambdaQueryWrapper.last("limit 1");
|
||||||
|
final Cart one = cartService.getOne(cartLambdaQueryWrapper);
|
||||||
|
if (ObjectUtil.isNotEmpty(one)) {
|
||||||
|
one.setIsNew(false);
|
||||||
|
one.setCartNum(one.getCartNum() + cart.getCartNum());
|
||||||
|
cartService.updateById(one);
|
||||||
|
return success("添加成功", one.getId());
|
||||||
|
} else {
|
||||||
|
cartService.save(cart);
|
||||||
|
return success("添加成功", cart.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cart.getCartNum().equals(0)) {
|
||||||
|
cartService.removeById(cart.getId());
|
||||||
|
return success("删除成功", cart.getId());
|
||||||
|
}
|
||||||
if (cartService.save(cart)) {
|
if (cartService.save(cart)) {
|
||||||
return success("添加成功",cart.getId());
|
return success("添加成功",cart.getId());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.io.Serializable;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gxwebsoft.think.entity.ThinkGoods;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -108,4 +109,6 @@ public class Cart implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<Cart> children;
|
private List<Cart> children;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkGoods goods;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,9 @@
|
|||||||
|
|
||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*,b.goods_name,b.image,c.merchant_name,c.address
|
SELECT a.*,b.title as goods_name,b.image
|
||||||
FROM shop_cart a
|
FROM shop_cart a
|
||||||
LEFT JOIN shop_goods b ON a.goods_id = b.goods_id
|
LEFT JOIN think_goods b ON a.goods_id = b.goods_id
|
||||||
LEFT JOIN shop_merchant c ON a.merchant_id = c.merchant_id
|
|
||||||
<where>
|
<where>
|
||||||
<if test="param.id != null">
|
<if test="param.id != null">
|
||||||
AND a.id = #{param.id}
|
AND a.id = #{param.id}
|
||||||
@@ -52,8 +51,7 @@
|
|||||||
AND a.create_time <= #{param.createTimeEnd}
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null">
|
||||||
AND (c.merchant_name LIKE CONCAT('%', #{param.keywords}, '%')
|
AND b.title LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR b.goods_name LIKE CONCAT('%', #{param.keywords}, '%')
|
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public interface CartService extends IService<Cart> {
|
|||||||
* @param param 查询参数
|
* @param param 查询参数
|
||||||
* @return List<Cart>
|
* @return List<Cart>
|
||||||
*/
|
*/
|
||||||
CartVo listRel(CartParam param);
|
List<Cart> listRel(CartParam param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id查询
|
* 根据id查询
|
||||||
|
|||||||
@@ -15,11 +15,14 @@ import com.gxwebsoft.shop.entity.Cart;
|
|||||||
import com.gxwebsoft.shop.param.CartParam;
|
import com.gxwebsoft.shop.param.CartParam;
|
||||||
import com.gxwebsoft.common.core.web.PageParam;
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.shop.service.GoodsService;
|
||||||
import com.gxwebsoft.shop.vo.CartShopVo;
|
import com.gxwebsoft.shop.vo.CartShopVo;
|
||||||
import com.gxwebsoft.shop.vo.CartVo;
|
import com.gxwebsoft.shop.vo.CartVo;
|
||||||
|
import com.gxwebsoft.think.service.ThinkGoodsService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -34,95 +37,99 @@ import java.util.stream.Stream;
|
|||||||
@Service
|
@Service
|
||||||
public class CartServiceImpl extends ServiceImpl<CartMapper, Cart> implements CartService {
|
public class CartServiceImpl extends ServiceImpl<CartMapper, Cart> implements CartService {
|
||||||
|
|
||||||
@Override
|
@Resource
|
||||||
public PageResult<Cart> pageRel(CartParam param) {
|
private ThinkGoodsService thinkGoodsService;
|
||||||
PageParam<Cart, CartParam> page = new PageParam<>(param);
|
@Override
|
||||||
page.setDefaultOrder("create_time desc");
|
public PageResult<Cart> pageRel(CartParam param) {
|
||||||
List<Cart> list = baseMapper.selectPageRel(page, param);
|
PageParam<Cart, CartParam> page = new PageParam<>(param);
|
||||||
return new PageResult<>(list, page.getTotal());
|
page.setDefaultOrder("create_time desc");
|
||||||
}
|
List<Cart> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
|
||||||
public CartVo listRel(CartParam param) {
|
|
||||||
List<Cart> list = baseMapper.selectListRel(param);
|
|
||||||
// 排序
|
|
||||||
PageParam<Cart, CartParam> page = new PageParam<>();
|
|
||||||
page.setDefaultOrder("create_time desc");
|
|
||||||
final List<Cart> carts = page.sortRecords(list);
|
|
||||||
System.out.println("carts = " + carts.size());
|
|
||||||
// 整理数据
|
|
||||||
final CartVo vo = new CartVo();
|
|
||||||
// 计算单品总价
|
|
||||||
for (Cart cart : carts) {
|
|
||||||
cart.setTotalPrice(cart.getPrice().multiply(BigDecimal.valueOf(cart.getCartNum())));
|
|
||||||
}
|
}
|
||||||
// 计算购物车金额
|
|
||||||
final Integer cartNum = carts.stream().map(Cart::getCartNum).reduce(Integer::sum).orElse(0);
|
@Override
|
||||||
final Integer selectNums = carts.stream().filter(d -> d.getSelected().equals(true)).map(Cart::getCartNum).reduce(Integer::sum).orElse(0);
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
final BigDecimal totalPrice = carts.stream().filter(d -> d.getSelected().equals(true)).map(Cart::getTotalPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
public List<Cart> listRel(CartParam param) {
|
||||||
// 按店铺ID分组
|
List<Cart> list = baseMapper.selectListRel(param);
|
||||||
final Map<Integer, List<Cart>> collectCart = carts.stream().collect(Collectors.groupingBy(Cart::getMerchantId));
|
// 排序
|
||||||
final ArrayList<CartShopVo> shops = new ArrayList<>();
|
PageParam<Cart, CartParam> page = new PageParam<>();
|
||||||
if (MapUtil.isNotEmpty(collectCart)) {
|
page.setDefaultOrder("create_time desc");
|
||||||
for (Integer shopId : collectCart.keySet()) {
|
for (Cart cart : list) {
|
||||||
final CartShopVo shopVo = new CartShopVo();
|
cart.setGoods(thinkGoodsService.getByIdRel(cart.getGoodsId()));
|
||||||
shopVo.setShopId(shopId);
|
|
||||||
shopVo.setCarts(collectCart.get(shopId));
|
|
||||||
if (ObjectUtil.isNotEmpty(collectCart.get(shopId).get(0))) {
|
|
||||||
final Cart cart = collectCart.get(shopId).get(0);
|
|
||||||
shopVo.setShopName(cart.getMerchantName());
|
|
||||||
shopVo.setShopLogo(cart.getImage());
|
|
||||||
shopVo.setAddress(cart.getAddress());
|
|
||||||
}
|
}
|
||||||
shops.add(shopVo);
|
return page.sortRecords(list);
|
||||||
}
|
// System.out.println("carts = " + carts.size());
|
||||||
|
// // 整理数据
|
||||||
|
// final CartVo vo = new CartVo();
|
||||||
|
// // 计算单品总价
|
||||||
|
// for (Cart cart : carts) {
|
||||||
|
// cart.setTotalPrice(cart.getPrice().multiply(BigDecimal.valueOf(cart.getCartNum())));
|
||||||
|
// }
|
||||||
|
// // 计算购物车金额
|
||||||
|
// final Integer cartNum = carts.stream().map(Cart::getCartNum).reduce(Integer::sum).orElse(0);
|
||||||
|
// final Integer selectNums = carts.stream().filter(d -> d.getSelected().equals(true)).map(Cart::getCartNum).reduce(Integer::sum).orElse(0);
|
||||||
|
// final BigDecimal totalPrice = carts.stream().filter(d -> d.getSelected().equals(true)).map(Cart::getTotalPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
// // 按店铺ID分组
|
||||||
|
// final Map<Integer, List<Cart>> collectCart = carts.stream().collect(Collectors.groupingBy(Cart::getMerchantId));
|
||||||
|
// final ArrayList<CartShopVo> shops = new ArrayList<>();
|
||||||
|
// if (MapUtil.isNotEmpty(collectCart)) {
|
||||||
|
// for (Integer shopId : collectCart.keySet()) {
|
||||||
|
// final CartShopVo shopVo = new CartShopVo();
|
||||||
|
// shopVo.setShopId(shopId);
|
||||||
|
// shopVo.setCarts(collectCart.get(shopId));
|
||||||
|
// if (ObjectUtil.isNotEmpty(collectCart.get(shopId).get(0))) {
|
||||||
|
// final Cart cart = collectCart.get(shopId).get(0);
|
||||||
|
// shopVo.setShopName(cart.getMerchantName());
|
||||||
|
// shopVo.setShopLogo(cart.getImage());
|
||||||
|
// shopVo.setAddress(cart.getAddress());
|
||||||
|
// }
|
||||||
|
// shops.add(shopVo);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// vo.setShops(shops);
|
||||||
|
// vo.setTotalPrice(totalPrice);
|
||||||
|
// vo.setTotalNums(Long.valueOf(cartNum));
|
||||||
|
// vo.setSelectNums(Long.valueOf(selectNums));
|
||||||
|
|
||||||
|
// return carts;
|
||||||
}
|
}
|
||||||
|
|
||||||
vo.setShops(shops);
|
@Override
|
||||||
vo.setTotalPrice(totalPrice);
|
public Cart getByIdRel(Integer id) {
|
||||||
vo.setTotalNums(Long.valueOf(cartNum));
|
CartParam param = new CartParam();
|
||||||
vo.setSelectNums(Long.valueOf(selectNums));
|
param.setId(id);
|
||||||
// updateBatchById(carts);
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
return vo;
|
@Override
|
||||||
}
|
public List<Cart> listRelMpj(CartParam param) {
|
||||||
|
|
||||||
@Override
|
// 多表查询
|
||||||
public Cart getByIdRel(Integer id) {
|
MPJLambdaWrapper<Cart> mpjLambdaWrapper = new MPJLambdaWrapper<>();
|
||||||
CartParam param = new CartParam();
|
mpjLambdaWrapper.selectAll(Cart.class)
|
||||||
param.setId(id);
|
.select(Goods::getGoodsName)
|
||||||
return param.getOne(baseMapper.selectListRel(param));
|
.select(Goods::getImage)
|
||||||
}
|
.leftJoin(Goods.class, Goods::getGoodsId, Cart::getGoodsId).eq(Cart::getUserId, param.getUserId());
|
||||||
|
|
||||||
@Override
|
// 查询选中状态
|
||||||
public List<Cart> listRelMpj(CartParam param) {
|
if (param.getSelected() != null) {
|
||||||
|
mpjLambdaWrapper.eq(Cart::getSelected, param.getSelected());
|
||||||
// 多表查询
|
}
|
||||||
MPJLambdaWrapper<Cart> mpjLambdaWrapper = new MPJLambdaWrapper<>();
|
// 商品类型 0商城 1预定
|
||||||
mpjLambdaWrapper.selectAll(Cart.class)
|
if (param.getType() != null) {
|
||||||
.select(Goods::getGoodsName)
|
mpjLambdaWrapper.eq(Cart::getType, param.getType());
|
||||||
.select(Goods::getImage)
|
}
|
||||||
.leftJoin(Goods.class,Goods::getGoodsId,Cart::getGoodsId).eq(Cart::getUserId,param.getUserId());
|
// 是否为立即购买
|
||||||
|
if (param.getIsNew() != null) {
|
||||||
// 查询选中状态
|
mpjLambdaWrapper.eq(Cart::getIsNew, param.getIsNew());
|
||||||
if(param.getSelected() != null){
|
}
|
||||||
mpjLambdaWrapper.eq(Cart::getSelected, param.getSelected());
|
// 指定cartId
|
||||||
}
|
if (param.getId() != null) {
|
||||||
// 商品类型 0商城 1预定
|
mpjLambdaWrapper.eq(Cart::getId, param.getId());
|
||||||
if(param.getType() != null){
|
}
|
||||||
mpjLambdaWrapper.eq(Cart::getType,param.getType());
|
System.out.println("mpjLambdaWrapper = " + mpjLambdaWrapper);
|
||||||
}
|
return baseMapper.selectJoinList(Cart.class, mpjLambdaWrapper);
|
||||||
// 是否为立即购买
|
}
|
||||||
if(param.getIsNew() != null){
|
|
||||||
mpjLambdaWrapper.eq(Cart::getIsNew,param.getIsNew());
|
|
||||||
}
|
|
||||||
// 指定cartId
|
|
||||||
if(param.getId() != null){
|
|
||||||
mpjLambdaWrapper.eq(Cart::getId,param.getId());
|
|
||||||
}
|
|
||||||
System.out.println("mpjLambdaWrapper = " + mpjLambdaWrapper);
|
|
||||||
return baseMapper.selectJoinList(Cart.class, mpjLambdaWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkOrder;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkSite;
|
||||||
|
import com.gxwebsoft.think.service.ThinkOrderService;
|
||||||
|
import com.gxwebsoft.think.service.ThinkSiteService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时任务
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2022-12-15 19:11:07
|
||||||
|
*/
|
||||||
|
@Api(tags = "定时任务")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/scheduled")
|
||||||
|
|
||||||
|
public class SchedulingController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderService thinkOrderService;
|
||||||
|
@Resource
|
||||||
|
private ThinkSiteService thinkSiteService;
|
||||||
|
|
||||||
|
@Scheduled(cron = "* * * * * *")
|
||||||
|
public void task() {
|
||||||
|
// 15分钟取消订单
|
||||||
|
thinkOrderService.update(
|
||||||
|
new LambdaUpdateWrapper<ThinkOrder>()
|
||||||
|
.set(ThinkOrder::getOrderStatus, 3)
|
||||||
|
.eq(ThinkOrder::getPayStatus, 2)
|
||||||
|
.eq(ThinkOrder::getOrderStatus, 2)
|
||||||
|
.apply("UNIX_TIMESTAMP() > `create_time` + " + 15 * 60)
|
||||||
|
);
|
||||||
|
|
||||||
|
//每天0点清空人数
|
||||||
|
if (DateUtil.format(LocalDateTime.now(), "HH:mm:ss").equals("00:00:00")) {
|
||||||
|
thinkSiteService.update(
|
||||||
|
new LambdaUpdateWrapper<ThinkSite>()
|
||||||
|
.set(ThinkSite::getDailyNum, 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.gxwebsoft.think.controller;
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
@@ -9,9 +12,13 @@ import com.gxwebsoft.common.core.web.PageResult;
|
|||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import com.gxwebsoft.think.entity.ThinkCard;
|
import com.gxwebsoft.think.entity.ThinkCard;
|
||||||
import com.gxwebsoft.think.entity.ThinkUsers;
|
import com.gxwebsoft.think.entity.ThinkUsers;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkVip;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkVipCardsBills;
|
||||||
import com.gxwebsoft.think.param.ThinkCardParam;
|
import com.gxwebsoft.think.param.ThinkCardParam;
|
||||||
import com.gxwebsoft.think.service.ThinkCardBindLogService;
|
import com.gxwebsoft.think.service.ThinkCardBindLogService;
|
||||||
import com.gxwebsoft.think.service.ThinkCardService;
|
import com.gxwebsoft.think.service.ThinkCardService;
|
||||||
|
import com.gxwebsoft.think.service.ThinkVipCardsBillsService;
|
||||||
|
import com.gxwebsoft.think.service.ThinkVipService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@@ -19,6 +26,9 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,6 +45,10 @@ public class ThinkCardController extends BaseController {
|
|||||||
private ThinkCardService thinkCardService;
|
private ThinkCardService thinkCardService;
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkCardBindLogService thinkCardBindLogService;
|
private ThinkCardBindLogService thinkCardBindLogService;
|
||||||
|
@Resource
|
||||||
|
private ThinkVipService thinkVipService;
|
||||||
|
@Resource
|
||||||
|
private ThinkVipCardsBillsService thinkVipCardsBillsService;
|
||||||
|
|
||||||
@ApiOperation("用户卡")
|
@ApiOperation("用户卡")
|
||||||
@PostMapping("/user-card")
|
@PostMapping("/user-card")
|
||||||
@@ -68,6 +82,89 @@ public class ThinkCardController extends BaseController {
|
|||||||
return success(thinkCardService.getByIdRel(id));
|
return success(thinkCardService.getByIdRel(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量生成")
|
||||||
|
@PostMapping("/make-card")
|
||||||
|
public ApiResult<?> makeCard(@RequestBody ThinkCard thinkCard) {
|
||||||
|
List<ThinkCard> thinkCardList = new ArrayList<>();
|
||||||
|
List<String> codeList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < thinkCard.getMakeNum(); i++) {
|
||||||
|
String code = RandomUtil.randomString(8);
|
||||||
|
codeList.add(code);
|
||||||
|
}
|
||||||
|
List<ThinkCard> existList = thinkCardService.listByCodeList(codeList);
|
||||||
|
if (!existList.isEmpty()) {
|
||||||
|
for (ThinkCard exist : existList) {
|
||||||
|
codeList.remove(exist.getCode());
|
||||||
|
}
|
||||||
|
for (int i = 0; i < existList.size(); i++) {
|
||||||
|
String code = RandomUtil.randomString(8);
|
||||||
|
codeList.add(code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ThinkVip thinkVip = thinkVipService.getById(thinkCard.getVid());
|
||||||
|
for (String code : codeList) {
|
||||||
|
ThinkCard thinkCard1 = new ThinkCard();
|
||||||
|
thinkCard1.setCode(code);
|
||||||
|
thinkCard1.setUid(thinkCard.getUid());
|
||||||
|
thinkCard1.setSid(thinkVip.getSid());
|
||||||
|
thinkCard1.setVid(thinkCard.getVid());
|
||||||
|
thinkCard1.setName(thinkVip.getName());
|
||||||
|
thinkCard1.setUsername(thinkCard.getUsername());
|
||||||
|
thinkCard1.setPhone(thinkCard.getPhone());
|
||||||
|
thinkCard1.setPrice(thinkVip.getPrice());
|
||||||
|
thinkCard1.setDesc(thinkVip.getDesc());
|
||||||
|
thinkCard1.setInfo(thinkVip.getInfo());
|
||||||
|
thinkCard1.setDiscount(thinkVip.getDiscount());
|
||||||
|
thinkCard1.setCount(thinkVip.getCount());
|
||||||
|
thinkCard1.setEachMoney(thinkVip.getEachMoney());
|
||||||
|
if (thinkVip.getType().equals(5))
|
||||||
|
thinkCard1.setRemainingMoney(thinkVip.getPrice());
|
||||||
|
thinkCard1.setStatus(1);
|
||||||
|
thinkCard1.setTerm(thinkVip.getTerm());
|
||||||
|
thinkCard1.setMonth(thinkVip.getMonth());
|
||||||
|
thinkCard1.setType(thinkVip.getType());
|
||||||
|
thinkCard1.setCardType(thinkVip.getCardType());
|
||||||
|
thinkCard1.setVipType(thinkVip.getVipType());
|
||||||
|
thinkCard1.setPic(thinkVip.getPic());
|
||||||
|
thinkCard1.setPrices(thinkVip.getPrices());
|
||||||
|
thinkCard1.setIsIntegral(thinkVip.getIsIntegral());
|
||||||
|
thinkCard1.setExpireTime(thinkCard.getExpireTime());
|
||||||
|
thinkCard1.setCardNum(code);
|
||||||
|
thinkCard1.setNum(thinkVip.getCount());
|
||||||
|
thinkCard1.setRemark(thinkCard.getRemark());
|
||||||
|
thinkCard1.setCreateTime(DateUtil.currentSeconds());
|
||||||
|
thinkCard1.setUpdateTime(DateUtil.currentSeconds());
|
||||||
|
thinkCardList.add(thinkCard1);
|
||||||
|
|
||||||
|
if (thinkCard1.getType().equals(1) || thinkCard1.getType().equals(3)) {
|
||||||
|
List<ThinkVipCardsBills> list = new ArrayList<>();
|
||||||
|
BigDecimal avgAmount = BigDecimal.ZERO;
|
||||||
|
int dayNum = 0;
|
||||||
|
if (thinkCard1.getType().equals(1)) {
|
||||||
|
BigDecimal totalAmount = thinkCard1.getPrice().multiply(new BigDecimal(thinkCard1.getTerm()));
|
||||||
|
avgAmount = totalAmount.divide(BigDecimal.valueOf(365).multiply(BigDecimal.valueOf(thinkCard1.getTerm())), RoundingMode.HALF_UP);
|
||||||
|
dayNum = 365 * thinkCard1.getTerm();
|
||||||
|
} else if (thinkCard1.getType().equals(3)) {
|
||||||
|
BigDecimal totalAmount = thinkCard1.getPrice().multiply(new BigDecimal(thinkCard1.getMonth()));
|
||||||
|
avgAmount = totalAmount.divide(BigDecimal.valueOf(30).multiply(BigDecimal.valueOf(thinkCard1.getMonth())), RoundingMode.HALF_UP);
|
||||||
|
dayNum = 30 * thinkCard1.getMonth();
|
||||||
|
}
|
||||||
|
for (int i = 0; i < dayNum; i++) {
|
||||||
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
|
thinkVipCardsBills.setUid(thinkCard1.getUid());
|
||||||
|
thinkVipCardsBills.setVid(thinkCard1.getId());
|
||||||
|
DateTime dateTime = DateUtil.date(System.currentTimeMillis() + (i * 86400000L));
|
||||||
|
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||||
|
thinkVipCardsBills.setAmount(avgAmount);
|
||||||
|
list.add(thinkVipCardsBills);
|
||||||
|
}
|
||||||
|
thinkVipCardsBillsService.saveBatch(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
thinkCardService.saveBatch(thinkCardList);
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("添加")
|
@ApiOperation("添加")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ThinkCard thinkCard) {
|
public ApiResult<?> save(@RequestBody ThinkCard thinkCard) {
|
||||||
@@ -81,6 +178,7 @@ public class ThinkCardController extends BaseController {
|
|||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody ThinkCard thinkCard) {
|
public ApiResult<?> update(@RequestBody ThinkCard thinkCard) {
|
||||||
if (thinkCardService.updateById(thinkCard)) {
|
if (thinkCardService.updateById(thinkCard)) {
|
||||||
|
thinkVipCardsBillsService.setCardUid(thinkCard.getId(), thinkCard.getUid());
|
||||||
return success("修改成功");
|
return success("修改成功");
|
||||||
}
|
}
|
||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
@@ -139,19 +237,14 @@ public class ThinkCardController extends BaseController {
|
|||||||
if (StrUtil.isBlank(thinkCard.getPhone())) {
|
if (StrUtil.isBlank(thinkCard.getPhone())) {
|
||||||
return fail("电话不能为空");
|
return fail("电话不能为空");
|
||||||
}
|
}
|
||||||
final ThinkCardParam thinkCardParam = new ThinkCardParam();
|
ThinkCard thinkCards = thinkCardService.getByCode(thinkCard.getCardNum());
|
||||||
thinkCardParam.setCardNum(thinkCard.getCardNum());
|
if (thinkCards == null) return fail("卡号不存在");
|
||||||
final List<ThinkCard> thinkCards = thinkCardService.listRel(thinkCardParam);
|
if (!thinkCards.getUid().equals(0)) return fail("该卡已被绑定");
|
||||||
if (!CollectionUtils.isEmpty(thinkCards)) {
|
thinkCards.setUid(loginUser.getUid());
|
||||||
final ThinkCard card = thinkCards.get(0);
|
thinkCards.setUsername(thinkCard.getUsername());
|
||||||
if (!card.getPhone().equals(getLoginUser().getPhone())) {
|
thinkCards.setPhone(thinkCard.getPhone());
|
||||||
return fail("非本人卡,无法绑定");
|
thinkCardService.updateById(thinkCards);
|
||||||
}
|
return success("激活成功", null);
|
||||||
card.setUid(getLoginUser().getUid());
|
|
||||||
thinkCardService.updateById(card);
|
|
||||||
return success("激活成功", null);
|
|
||||||
}
|
|
||||||
return fail("修改失败", null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,207 @@
|
|||||||
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.think.entity.*;
|
||||||
|
import com.gxwebsoft.think.param.ThinkVipCardsBillsParam;
|
||||||
|
import com.gxwebsoft.think.service.*;
|
||||||
|
import com.gxwebsoft.think.param.ThinkCardsBillsParam;
|
||||||
|
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 com.gxwebsoft.common.system.entity.User;
|
||||||
|
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.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vip卡每日账单控制器
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-25 16:41:01
|
||||||
|
*/
|
||||||
|
@Api(tags = "Vip卡每日账单管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/think/think-cards-bills")
|
||||||
|
public class ThinkCardsBillsController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private ThinkCardsBillsService thinkCardsBillsService;
|
||||||
|
@Resource
|
||||||
|
private ThinkCardService thinkCardService;
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderService thinkOrderService;
|
||||||
|
@Resource
|
||||||
|
private ThinkVipCardsBillsService thinkVipCardsBillsService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询Vip卡每日账单")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<ThinkCardsBills>> page(ThinkCardsBillsParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkCardsBillsService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/total-amount")
|
||||||
|
public ApiResult<?> totalAmount(ThinkCardsBillsParam param) {
|
||||||
|
List<ThinkCardsBills> list = thinkCardsBillsService.listRel(param);
|
||||||
|
return success(list.stream().map(ThinkCardsBills::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
}
|
||||||
|
@ApiOperation("查询全部Vip卡每日账单")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<ThinkCardsBills>> list(ThinkCardsBillsParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkCardsBillsService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('think:thinkCardsBills:list')")
|
||||||
|
@ApiOperation("根据id查询Vip卡每日账单")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<ThinkCardsBills> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkCardsBillsService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加Vip卡每日账单")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody ThinkCardsBills thinkCardsBills) {
|
||||||
|
if (thinkCardsBillsService.save(thinkCardsBills)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改Vip卡每日账单")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody ThinkCardsBills thinkCardsBills) {
|
||||||
|
if (thinkCardsBillsService.updateById(thinkCardsBills)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除Vip卡每日账单")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (thinkCardsBillsService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量添加Vip卡每日账单")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<ThinkCardsBills> list) {
|
||||||
|
if (thinkCardsBillsService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量修改Vip卡每日账单")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<ThinkCardsBills> batchParam) {
|
||||||
|
if (batchParam.update(thinkCardsBillsService, "id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量删除Vip卡每日账单")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (thinkCardsBillsService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
@PostMapping("/make-bill")
|
||||||
|
public void makeBill() {
|
||||||
|
List<ThinkCard> usersVipList = thinkCardService.list(
|
||||||
|
new LambdaQueryWrapper<ThinkCard>()
|
||||||
|
.eq(ThinkCard::getStatus, 1)
|
||||||
|
);
|
||||||
|
List<ThinkOrder> allOrderList = thinkOrderService.list(
|
||||||
|
new LambdaQueryWrapper<ThinkOrder>()
|
||||||
|
.ne(ThinkOrder::getCid, 0)
|
||||||
|
.in(ThinkOrder::getPayStatus, 1)
|
||||||
|
.in(ThinkOrder::getOrderStatus, 1, 2)
|
||||||
|
);
|
||||||
|
for (ThinkCard usersVip : usersVipList) {
|
||||||
|
List<ThinkVipCardsBills> list = new ArrayList<>();
|
||||||
|
List<ThinkOrder> orderList = allOrderList.stream().filter(o -> o.getCid().equals(usersVip.getId())).toList();
|
||||||
|
BigDecimal avgAmount = BigDecimal.ZERO;
|
||||||
|
int dayNum = 0;
|
||||||
|
if (usersVip.getType().equals(1) || usersVip.getType().equals(3)) {
|
||||||
|
if (usersVip.getType().equals(1)) {
|
||||||
|
BigDecimal totalAmount = usersVip.getPrice().multiply(new BigDecimal(usersVip.getTerm()));
|
||||||
|
avgAmount = totalAmount.divide(BigDecimal.valueOf(365).multiply(BigDecimal.valueOf(usersVip.getTerm())), RoundingMode.HALF_UP);
|
||||||
|
dayNum = 365 * usersVip.getTerm();
|
||||||
|
} else if (usersVip.getType().equals(3)) {
|
||||||
|
BigDecimal totalAmount = usersVip.getPrice().multiply(new BigDecimal(usersVip.getMonth()));
|
||||||
|
avgAmount = totalAmount.divide(BigDecimal.valueOf(30).multiply(BigDecimal.valueOf(usersVip.getMonth())), RoundingMode.HALF_UP);
|
||||||
|
dayNum = 30 * usersVip.getMonth();
|
||||||
|
}
|
||||||
|
for (int i = 0; i < dayNum; i++) {
|
||||||
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
|
thinkVipCardsBills.setUid(usersVip.getUid());
|
||||||
|
thinkVipCardsBills.setCid(usersVip.getId());
|
||||||
|
DateTime dateTime = DateUtil.date((usersVip.getCreateTime() * 1000L) + (i * 86400000L));
|
||||||
|
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||||
|
thinkVipCardsBills.setAmount(avgAmount);
|
||||||
|
if (!orderList.isEmpty()) {
|
||||||
|
for (ThinkOrder thinkOrder : orderList) {
|
||||||
|
if (thinkOrder.getCreateTime() > (DateUtil.beginOfDay(dateTime).getTime() / 1000L) && thinkOrder.getCreateTime() < (DateUtil.endOfDay(dateTime).getTime() / 1000L)) {
|
||||||
|
thinkVipCardsBills.setUsed(1);
|
||||||
|
thinkVipCardsBills.setOid(thinkOrder.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.add(thinkVipCardsBills);
|
||||||
|
}
|
||||||
|
} else if (usersVip.getType().equals(2)) {
|
||||||
|
// 次卡
|
||||||
|
if (!orderList.isEmpty()) {
|
||||||
|
avgAmount = usersVip.getPrice().divide(BigDecimal.valueOf(usersVip.getCount()), RoundingMode.HALF_UP);
|
||||||
|
for (ThinkOrder thinkOrder : orderList) {
|
||||||
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
|
thinkVipCardsBills.setUid(usersVip.getUid());
|
||||||
|
thinkVipCardsBills.setCid(usersVip.getId());
|
||||||
|
DateTime dateTime = DateUtil.date((thinkOrder.getCreateTime() * 1000L));
|
||||||
|
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||||
|
thinkVipCardsBills.setAmount(avgAmount);
|
||||||
|
thinkVipCardsBills.setUsed(1);
|
||||||
|
thinkVipCardsBills.setOid(thinkOrder.getId());
|
||||||
|
list.add(thinkVipCardsBills);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (usersVip.getType().equals(4) || usersVip.getType().equals(5)) {
|
||||||
|
// 充值卡\折扣
|
||||||
|
if (!orderList.isEmpty()) {
|
||||||
|
for (ThinkOrder thinkOrder : orderList) {
|
||||||
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
|
thinkVipCardsBills.setUid(usersVip.getUid());
|
||||||
|
thinkVipCardsBills.setCid(usersVip.getId());
|
||||||
|
DateTime dateTime = DateUtil.date((thinkOrder.getCreateTime() * 1000L));
|
||||||
|
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||||
|
thinkVipCardsBills.setAmount(thinkOrder.getTotalPrice());
|
||||||
|
thinkVipCardsBills.setUsed(1);
|
||||||
|
thinkVipCardsBills.setOid(thinkOrder.getId());
|
||||||
|
list.add(thinkVipCardsBills);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
thinkVipCardsBillsService.saveBatch(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.gxwebsoft.think.controller;
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.think.entity.*;
|
||||||
import com.gxwebsoft.think.service.ThinkDepositService;
|
import com.gxwebsoft.think.service.ThinkDepositService;
|
||||||
import com.gxwebsoft.think.entity.ThinkDeposit;
|
|
||||||
import com.gxwebsoft.think.param.ThinkDepositParam;
|
import com.gxwebsoft.think.param.ThinkDepositParam;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
@@ -10,6 +12,14 @@ import com.gxwebsoft.common.core.web.PageParam;
|
|||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.think.service.ThinkOrderService;
|
||||||
|
import com.gxwebsoft.think.service.ThinkUsersService;
|
||||||
|
import com.gxwebsoft.think.service.WechatConfigService;
|
||||||
|
import com.wechat.pay.java.core.notification.NotificationConfig;
|
||||||
|
import com.wechat.pay.java.core.notification.NotificationParser;
|
||||||
|
import com.wechat.pay.java.core.notification.RequestParam;
|
||||||
|
import com.wechat.pay.java.service.refund.model.RefundNotification;
|
||||||
|
import com.wechat.pay.java.service.refund.model.Status;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@@ -17,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 控制器
|
* 控制器
|
||||||
@@ -30,10 +41,74 @@ import java.util.List;
|
|||||||
public class ThinkDepositController extends BaseController {
|
public class ThinkDepositController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkDepositService thinkDepositService;
|
private ThinkDepositService thinkDepositService;
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderService thinkOrderService;
|
||||||
|
@Resource
|
||||||
|
private WechatConfigService wechatConfigService;
|
||||||
|
@Resource
|
||||||
|
private ThinkUsersService thinkUsersService;
|
||||||
|
|
||||||
|
@ApiOperation("微信通知")
|
||||||
|
@PostMapping("/notify")
|
||||||
|
public String notify(@RequestBody String body, @RequestHeader Map<String, Object> header) {
|
||||||
|
System.out.println("买卡支付通知 >>>>> ");
|
||||||
|
com.wechat.pay.java.core.notification.RequestParam requestParam = new RequestParam.Builder()
|
||||||
|
.serialNumber(header.get("wechatpay-serial").toString())
|
||||||
|
.nonce(header.get("wechatpay-nonce").toString())
|
||||||
|
.signature(header.get("wechatpay-signature").toString())
|
||||||
|
.timestamp(header.get("wechatpay-timestamp").toString())
|
||||||
|
.body(body)
|
||||||
|
.build();
|
||||||
|
NotificationConfig config = wechatConfigService.getNotificationConfig();
|
||||||
|
NotificationParser parser = new NotificationParser(config);
|
||||||
|
com.wechat.pay.java.service.payments.model.Transaction transaction = parser.parse(requestParam, com.wechat.pay.java.service.payments.model.Transaction.class);
|
||||||
|
// 查询订单信息
|
||||||
|
final ThinkDeposit order = thinkDepositService.getByOrderNo(transaction.getOutTradeNo());
|
||||||
|
if (order == null) return "订单不存在";
|
||||||
|
if (order.getStatus().equals(0)) {
|
||||||
|
// 2.更新订单支付状态
|
||||||
|
order.setUpdateTime(DateUtil.currentSeconds());
|
||||||
|
order.setStatus(1);
|
||||||
|
thinkDepositService.updateById(order);
|
||||||
|
}
|
||||||
|
return "订单已支付";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/refund-notify")
|
||||||
|
public ApiResult<?> refundNotify(@RequestBody String body, @RequestHeader Map<String, Object> header) {
|
||||||
|
System.out.println("refund body = " + body);
|
||||||
|
RequestParam requestParam = new RequestParam.Builder()
|
||||||
|
.serialNumber(header.get("wechatpay-serial").toString())
|
||||||
|
.nonce(header.get("wechatpay-nonce").toString())
|
||||||
|
.signature(header.get("wechatpay-signature").toString())
|
||||||
|
.timestamp(header.get("wechatpay-timestamp").toString())
|
||||||
|
.body(body)
|
||||||
|
.build();
|
||||||
|
NotificationConfig config = wechatConfigService.getNotificationConfig();
|
||||||
|
// 初始化 NotificationParser
|
||||||
|
NotificationParser parser = new NotificationParser(config);
|
||||||
|
RefundNotification notification = parser.parse(requestParam, RefundNotification.class);
|
||||||
|
System.out.println("notification = " + notification);
|
||||||
|
String orderNum = notification.getOutTradeNo();
|
||||||
|
ThinkDeposit thinkDeposit = thinkDepositService.getByOrderNo(orderNum);
|
||||||
|
if (notification.getRefundStatus().equals(Status.SUCCESS)) {
|
||||||
|
if (thinkDeposit != null) {
|
||||||
|
thinkDeposit.setRefundTime(DateUtil.currentSeconds());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
thinkDeposit.setStatus(3);
|
||||||
|
}
|
||||||
|
thinkDepositService.updateById(thinkDeposit);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("分页查询")
|
@ApiOperation("分页查询")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<ThinkDeposit>> page(ThinkDepositParam param) {
|
public ApiResult<?> page(ThinkDepositParam param) {
|
||||||
|
if (param.getForAdmin() == null) {
|
||||||
|
if (getLoginUser() == null) return fail("请先登录");
|
||||||
|
param.setPhone(getLoginUser().getPhone());
|
||||||
|
}
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(thinkDepositService.pageRel(param));
|
return success(thinkDepositService.pageRel(param));
|
||||||
}
|
}
|
||||||
@@ -56,8 +131,19 @@ public class ThinkDepositController extends BaseController {
|
|||||||
@ApiOperation("添加")
|
@ApiOperation("添加")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ThinkDeposit thinkDeposit) {
|
public ApiResult<?> save(@RequestBody ThinkDeposit thinkDeposit) {
|
||||||
|
User user = getLoginUser();
|
||||||
|
ThinkUsers thinkUsers = thinkUsersService.getById(getLoginUser().getUid());
|
||||||
|
thinkDeposit.setName(thinkUsers.getUsername());
|
||||||
|
thinkDeposit.setPhone(user.getPhone());
|
||||||
|
thinkDeposit.setOrderNum(IdUtil.getSnowflake().nextIdStr());
|
||||||
|
thinkDeposit.setStatus(0);
|
||||||
|
thinkDeposit.setAid(0);
|
||||||
|
thinkDeposit.setCreateTime(DateUtil.currentSeconds());
|
||||||
|
thinkDeposit.setUpdateTime(DateUtil.currentSeconds());
|
||||||
if (thinkDepositService.save(thinkDeposit)) {
|
if (thinkDepositService.save(thinkDeposit)) {
|
||||||
return success("添加成功");
|
String notify = "https://gxtyzx-api.websoft.top/api/think/think-deposit/notify";
|
||||||
|
return success(thinkOrderService.createWxOrder(thinkDeposit.getMoney(), thinkDeposit.getOrderNum(), "押金",
|
||||||
|
getLoginUser().getOpenid(), notify));
|
||||||
}
|
}
|
||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
@@ -66,6 +152,10 @@ public class ThinkDepositController extends BaseController {
|
|||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody ThinkDeposit thinkDeposit) {
|
public ApiResult<?> update(@RequestBody ThinkDeposit thinkDeposit) {
|
||||||
if (thinkDepositService.updateById(thinkDeposit)) {
|
if (thinkDepositService.updateById(thinkDeposit)) {
|
||||||
|
ThinkDeposit thinkDeposit1 = thinkDepositService.getByIdRel(thinkDeposit.getId());
|
||||||
|
if (thinkDeposit1.getMoneyType().equals(1) && thinkDeposit.getStatus().equals(2)) {
|
||||||
|
thinkDepositService.refund(thinkDeposit1);
|
||||||
|
}
|
||||||
return success("修改成功");
|
return success("修改成功");
|
||||||
}
|
}
|
||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.think.service.ThinkDepositItemService;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkDepositItem;
|
||||||
|
import com.gxwebsoft.think.param.ThinkDepositItemParam;
|
||||||
|
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 com.gxwebsoft.common.system.entity.User;
|
||||||
|
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 2024-12-05 23:17:01
|
||||||
|
*/
|
||||||
|
@Api(tags = "押金物品管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/think/think-deposit-item")
|
||||||
|
public class ThinkDepositItemController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private ThinkDepositItemService thinkDepositItemService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询押金物品")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<ThinkDepositItem>> page(ThinkDepositItemParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkDepositItemService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部押金物品")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<ThinkDepositItem>> list(ThinkDepositItemParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkDepositItemService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('think:thinkDepositItem:list')")
|
||||||
|
@ApiOperation("根据id查询押金物品")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<ThinkDepositItem> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkDepositItemService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加押金物品")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody ThinkDepositItem thinkDepositItem) {
|
||||||
|
if (thinkDepositItemService.save(thinkDepositItem)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改押金物品")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody ThinkDepositItem thinkDepositItem) {
|
||||||
|
if (thinkDepositItemService.updateById(thinkDepositItem)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除押金物品")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (thinkDepositItemService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量添加押金物品")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<ThinkDepositItem> list) {
|
||||||
|
if (thinkDepositItemService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量修改押金物品")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<ThinkDepositItem> batchParam) {
|
||||||
|
if (batchParam.update(thinkDepositItemService, "id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量删除押金物品")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (thinkDepositItemService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -45,7 +45,6 @@ public class ThinkGoodsController extends BaseController {
|
|||||||
return success(thinkGoodsService.listRel(param));
|
return success(thinkGoodsService.listRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('think:thinkGoods:list')")
|
|
||||||
@ApiOperation("根据id查询")
|
@ApiOperation("根据id查询")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<ThinkGoods> get(@PathVariable("id") Integer id) {
|
public ApiResult<ThinkGoods> get(@PathVariable("id") Integer id) {
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
package com.gxwebsoft.think.controller;
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.think.service.ThinkGoodsOrderService;
|
import com.gxwebsoft.think.entity.*;
|
||||||
import com.gxwebsoft.think.entity.ThinkGoodsOrder;
|
import com.gxwebsoft.think.service.*;
|
||||||
import com.gxwebsoft.think.param.ThinkGoodsOrderParam;
|
import com.gxwebsoft.think.param.ThinkGoodsOrderParam;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
@@ -10,13 +14,23 @@ import com.gxwebsoft.common.core.web.PageParam;
|
|||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.wechat.pay.java.core.notification.NotificationConfig;
|
||||||
|
import com.wechat.pay.java.core.notification.NotificationParser;
|
||||||
|
import com.wechat.pay.java.core.notification.RequestParam;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import me.chanjar.weixin.common.error.WxErrorException;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static com.gxwebsoft.think.consts.OrderStatusConsts.PAY_TYPE_WECHAT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 控制器
|
* 控制器
|
||||||
@@ -30,11 +44,82 @@ import java.util.List;
|
|||||||
public class ThinkGoodsOrderController extends BaseController {
|
public class ThinkGoodsOrderController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkGoodsOrderService thinkGoodsOrderService;
|
private ThinkGoodsOrderService thinkGoodsOrderService;
|
||||||
|
@Resource
|
||||||
|
private WechatConfigService wechatConfigService;
|
||||||
|
@Resource
|
||||||
|
private ThinkUsersService thinkUsersService;
|
||||||
|
@Resource
|
||||||
|
private ThinkGoodsOrderInfoService thinkGoodsOrderInfoService;
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderService thinkOrderService;
|
||||||
|
@Resource
|
||||||
|
private ThinkIntegralLogService thinkIntegralLogService;
|
||||||
|
|
||||||
|
@ApiOperation("微信通知")
|
||||||
|
@PostMapping("/notify")
|
||||||
|
public String notify(@RequestBody String body, @RequestHeader Map<String, Object> header) {
|
||||||
|
System.out.println("支付通知 >>>>> ");
|
||||||
|
com.wechat.pay.java.core.notification.RequestParam requestParam = new RequestParam.Builder()
|
||||||
|
.serialNumber(header.get("wechatpay-serial").toString())
|
||||||
|
.nonce(header.get("wechatpay-nonce").toString())
|
||||||
|
.signature(header.get("wechatpay-signature").toString())
|
||||||
|
.timestamp(header.get("wechatpay-timestamp").toString())
|
||||||
|
.body(body)
|
||||||
|
.build();
|
||||||
|
NotificationConfig config = wechatConfigService.getNotificationConfig();
|
||||||
|
NotificationParser parser = new NotificationParser(config);
|
||||||
|
com.wechat.pay.java.service.payments.model.Transaction transaction = parser.parse(requestParam, com.wechat.pay.java.service.payments.model.Transaction.class);
|
||||||
|
// 查询订单信息
|
||||||
|
final ThinkGoodsOrder order = thinkGoodsOrderService.getByOrderNum(transaction.getOutTradeNo());
|
||||||
|
if (order == null) return "订单不存在";
|
||||||
|
if (order.getPayStatus().equals(1)) {
|
||||||
|
updatePay(order, transaction.getTransactionId(), transaction.getAmount().getPayerTotal());
|
||||||
|
}
|
||||||
|
return "订单已支付";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updatePay(ThinkGoodsOrder order, String transactionId, Integer payAmount) {
|
||||||
|
order.setPayStatus(1);
|
||||||
|
order.setWechatOrder(transactionId);
|
||||||
|
// order.setPayPrice(new BigDecimal(NumberUtil.decimalFormat("0.00", transaction.getAmount().getPayerTotal() * 0.01)));
|
||||||
|
order.setPayPrice(new BigDecimal(NumberUtil.decimalFormat("0.00", payAmount * 0.01)));
|
||||||
|
order.setPayTime((int) DateUtil.currentSeconds());
|
||||||
|
if (order.getPayType().equals(1)) {
|
||||||
|
order.setWechatOrder(transactionId);
|
||||||
|
}
|
||||||
|
else if (order.getPayType().equals(2)) {
|
||||||
|
ThinkUsers thinkUsers = thinkUsersService.getById(order.getUid());
|
||||||
|
BigDecimal oldPoint = thinkUsers.getIntegral();
|
||||||
|
BigDecimal totalPoint = BigDecimal.ZERO;
|
||||||
|
List<ThinkGoodsOrderInfo> thinkGoodsOrderInfoList = thinkGoodsOrderInfoService.listInOrder(order.getId());
|
||||||
|
String goodsName = thinkGoodsOrderInfoList.get(0).getTitle();
|
||||||
|
for (ThinkGoodsOrderInfo info : thinkGoodsOrderInfoList) {
|
||||||
|
totalPoint = totalPoint.add(info.getIntegral());
|
||||||
|
}
|
||||||
|
thinkUsers.setIntegral(thinkUsers.getIntegral().subtract(totalPoint));
|
||||||
|
thinkUsersService.updateById(thinkUsers);
|
||||||
|
|
||||||
|
ThinkIntegralLog thinkIntegralLog = new ThinkIntegralLog();
|
||||||
|
thinkIntegralLog.setOrderNum(order.getOrderNum());
|
||||||
|
thinkIntegralLog.setOid(order.getId());
|
||||||
|
thinkIntegralLog.setSiteName(goodsName);
|
||||||
|
thinkIntegralLog.setUsername(thinkUsers.getUsername());
|
||||||
|
thinkIntegralLog.setPhone(thinkUsers.getPhone());
|
||||||
|
thinkIntegralLog.setIntegral(totalPoint);
|
||||||
|
thinkIntegralLog.setOldMoney(oldPoint);
|
||||||
|
thinkIntegralLog.setNewMoney(thinkUsers.getIntegral());
|
||||||
|
thinkIntegralLog.setInfo("商城购买");
|
||||||
|
thinkIntegralLog.setCreateTime((int) DateUtil.currentSeconds());
|
||||||
|
thinkIntegralLogService.save(thinkIntegralLog);
|
||||||
|
}
|
||||||
|
thinkGoodsOrderService.updateById(order);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("分页查询")
|
@ApiOperation("分页查询")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<ThinkGoodsOrder>> page(ThinkGoodsOrderParam param) {
|
public ApiResult<PageResult<ThinkGoodsOrder>> page(ThinkGoodsOrderParam param) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
|
param.setUid(getLoginUser().getUid());
|
||||||
return success(thinkGoodsOrderService.pageRel(param));
|
return success(thinkGoodsOrderService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,23 +130,55 @@ public class ThinkGoodsOrderController extends BaseController {
|
|||||||
return success(thinkGoodsOrderService.listRel(param));
|
return success(thinkGoodsOrderService.listRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('think:thinkGoodsOrder:list')")
|
|
||||||
@ApiOperation("根据id查询")
|
@ApiOperation("根据id查询")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<ThinkGoodsOrder> get(@PathVariable("id") Integer id) {
|
public ApiResult<ThinkGoodsOrder> get(@PathVariable("id") Integer id) {
|
||||||
|
ThinkGoodsOrder thinkGoodsOrder = thinkGoodsOrderService.getByIdRel(id);
|
||||||
|
thinkGoodsOrder.setInfoList(thinkGoodsOrderInfoService.listInOrder(thinkGoodsOrder.getId()));
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(thinkGoodsOrderService.getByIdRel(id));
|
return success(thinkGoodsOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("添加")
|
@ApiOperation("添加")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ThinkGoodsOrder thinkGoodsOrder) {
|
public ApiResult<?> save(@RequestBody ThinkGoodsOrder thinkGoodsOrder) throws IOException, WxErrorException {
|
||||||
|
User user = getLoginUser();
|
||||||
|
if (user == null) return fail("请先登录");
|
||||||
|
ThinkUsers thinkUsers = thinkUsersService.getById(user.getUid());
|
||||||
|
if (thinkGoodsOrder.getPayType().equals(2)) {
|
||||||
|
BigDecimal totalPoint = BigDecimal.ZERO;
|
||||||
|
for (ThinkGoodsOrderInfo info : thinkGoodsOrder.getInfoList()) {
|
||||||
|
totalPoint = totalPoint.add(info.getIntegral());
|
||||||
|
}
|
||||||
|
if (thinkUsers.getIntegral().compareTo(totalPoint) < 0) return fail("积分不足");
|
||||||
|
}
|
||||||
|
thinkGoodsOrder.setUid(thinkUsers.getId());
|
||||||
|
thinkGoodsOrder.setOrderNum(IdUtil.getSnowflake().nextIdStr());
|
||||||
|
thinkGoodsOrder.setWechatOrder("");
|
||||||
|
thinkGoodsOrder.setInfo("商城订单");
|
||||||
if (thinkGoodsOrderService.save(thinkGoodsOrder)) {
|
if (thinkGoodsOrderService.save(thinkGoodsOrder)) {
|
||||||
return success("添加成功");
|
for (ThinkGoodsOrderInfo info : thinkGoodsOrder.getInfoList()) {
|
||||||
|
info.setOid(thinkGoodsOrder.getId());
|
||||||
|
}
|
||||||
|
thinkGoodsOrderInfoService.saveBatch(thinkGoodsOrder.getInfoList());
|
||||||
|
return onPay(thinkGoodsOrder);
|
||||||
}
|
}
|
||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ApiResult<?> onPay(ThinkGoodsOrder order) throws IOException, WxErrorException {
|
||||||
|
// 微信统一下单接口
|
||||||
|
if (order.getPayType().equals(PAY_TYPE_WECHAT)) {
|
||||||
|
String desc = order.getInfoList().get(0).getTitle();
|
||||||
|
return success("下单成功", thinkOrderService.createWxOrder(order.getPayPrice(), order.getOrderNum(), desc, getLoginUser().getOpenid()));
|
||||||
|
}
|
||||||
|
if (order.getPayType().equals(2)) {
|
||||||
|
updatePay(order, null, order.getTotalPrice().multiply(BigDecimal.valueOf(100)).intValue());
|
||||||
|
return success("支付成功", order.getId());
|
||||||
|
}
|
||||||
|
return fail("支付失败");
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("修改")
|
@ApiOperation("修改")
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody ThinkGoodsOrder thinkGoodsOrder) {
|
public ApiResult<?> update(@RequestBody ThinkGoodsOrder thinkGoodsOrder) {
|
||||||
|
|||||||
@@ -36,6 +36,13 @@ public class ThinkIntegralController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ThinkUsersService thinkUsersService;
|
private ThinkUsersService thinkUsersService;
|
||||||
|
|
||||||
|
@ApiOperation("检查")
|
||||||
|
@PostMapping("/check")
|
||||||
|
public ApiResult<ThinkIntegral> check() {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkIntegralService.check(getLoginUser().getUid()));
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("分页查询")
|
@ApiOperation("分页查询")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<ThinkIntegral>> page(ThinkIntegralParam param) {
|
public ApiResult<PageResult<ThinkIntegral>> page(ThinkIntegralParam param) {
|
||||||
@@ -46,6 +53,7 @@ public class ThinkIntegralController extends BaseController {
|
|||||||
@ApiOperation("查询全部")
|
@ApiOperation("查询全部")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<ThinkIntegral>> list(ThinkIntegralParam param) {
|
public ApiResult<List<ThinkIntegral>> list(ThinkIntegralParam param) {
|
||||||
|
param.setUid(getLoginUser().getUid());
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(thinkIntegralService.listRel(param));
|
return success(thinkIntegralService.listRel(param));
|
||||||
}
|
}
|
||||||
@@ -59,30 +67,31 @@ public class ThinkIntegralController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("添加")
|
@ApiOperation("添加")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ThinkIntegral thinkIntegral) {
|
public ApiResult<?> save() {
|
||||||
final User loginUser = getLoginUser();
|
final User loginUser = getLoginUser();
|
||||||
if (ObjectUtil.isEmpty(loginUser)) {
|
if (ObjectUtil.isEmpty(loginUser)) {
|
||||||
return fail("请先登录");
|
return fail("请先登录");
|
||||||
}
|
}
|
||||||
final ThinkUsers users = thinkUsersService.getById(getLoginUser().getUid());
|
if (thinkIntegralService.check(getLoginUser().getUid()) != null) {
|
||||||
thinkIntegral.setUid(users.getId());
|
return fail("您今天已经签到过了");
|
||||||
thinkIntegral.setUsername(users.getUsername());
|
}
|
||||||
thinkIntegral.setPhone(users.getPhone());
|
final ThinkUsers users = thinkUsersService.getById(getLoginUser().getUid());
|
||||||
thinkIntegral.setIntegral(new BigDecimal("1"));
|
ThinkIntegral thinkIntegral = new ThinkIntegral();
|
||||||
thinkIntegral.setDateTime(DateUtil.today());
|
thinkIntegral.setUid(users.getId());
|
||||||
thinkIntegral.setDay(String.valueOf(DateUtil.thisDayOfMonth()));
|
thinkIntegral.setUsername(users.getUsername());
|
||||||
thinkIntegral.setCreateTime((int) DateUtil.currentSeconds());
|
thinkIntegral.setPhone(users.getPhone());
|
||||||
|
thinkIntegral.setIntegral(new BigDecimal("1"));
|
||||||
|
thinkIntegral.setDateTime(DateUtil.today());
|
||||||
|
thinkIntegral.setDay(String.valueOf(DateUtil.thisDayOfMonth()));
|
||||||
|
thinkIntegral.setCreateTime((int) DateUtil.currentSeconds());
|
||||||
|
|
||||||
if (thinkIntegralService.count(new LambdaUpdateWrapper<ThinkIntegral>().eq(ThinkIntegral::getId,users.getId()).eq(ThinkIntegral::getDateTime, DateUtil.today())) > 0) {
|
if (thinkIntegralService.save(thinkIntegral)) {
|
||||||
return fail("您今天已经签到过了.");
|
// 累计积分
|
||||||
}
|
users.setIntegral(users.getIntegral().add(thinkIntegral.getIntegral()));
|
||||||
if (thinkIntegralService.save(thinkIntegral)) {
|
thinkUsersService.updateById(users);
|
||||||
// 累计积分
|
return success("签到成功");
|
||||||
users.setIntegral(users.getIntegral().add(thinkIntegral.getIntegral()));
|
}
|
||||||
thinkUsersService.updateById(users);
|
return fail("签到失败");
|
||||||
return success("签到成功");
|
|
||||||
}
|
|
||||||
return fail("签到失败");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改")
|
@ApiOperation("修改")
|
||||||
@@ -133,13 +142,13 @@ public class ThinkIntegralController extends BaseController {
|
|||||||
@ApiOperation("本月签到数据")
|
@ApiOperation("本月签到数据")
|
||||||
@GetMapping("/getSignData")
|
@GetMapping("/getSignData")
|
||||||
public ApiResult<?> getSignData(ThinkIntegralParam param) {
|
public ApiResult<?> getSignData(ThinkIntegralParam param) {
|
||||||
final User loginUser = getLoginUser();
|
final User loginUser = getLoginUser();
|
||||||
if(loginUser == null){
|
if (loginUser == null) {
|
||||||
return fail("请先登录");
|
return fail("请先登录");
|
||||||
}
|
}
|
||||||
String message = thinkIntegralService.count(new LambdaUpdateWrapper<ThinkIntegral>().eq(ThinkIntegral::getPhone,loginUser.getPhone()).eq(ThinkIntegral::getDateTime, DateUtil.today())) > 0 ? "您今天已经签到过了" : "操作成功";
|
String message = thinkIntegralService.count(new LambdaUpdateWrapper<ThinkIntegral>().eq(ThinkIntegral::getPhone, loginUser.getPhone()).eq(ThinkIntegral::getDateTime, DateUtil.today())) > 0 ? "您今天已经签到过了" : "操作成功";
|
||||||
final List<ThinkIntegral> list = thinkIntegralService.list(new LambdaUpdateWrapper<ThinkIntegral>().eq(ThinkIntegral::getPhone,loginUser.getPhone()).like(ThinkIntegral::getDateTime, param.getDateTime()));
|
final List<ThinkIntegral> list = thinkIntegralService.list(new LambdaUpdateWrapper<ThinkIntegral>().eq(ThinkIntegral::getPhone, loginUser.getPhone()).like(ThinkIntegral::getDateTime, param.getDateTime()));
|
||||||
return success(message,list);
|
return success(message, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.think.controller;
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -11,9 +12,7 @@ import com.gxwebsoft.common.core.web.BatchParam;
|
|||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.think.entity.*;
|
import com.gxwebsoft.think.entity.*;
|
||||||
import com.gxwebsoft.think.param.ThinkInvoiceParam;
|
import com.gxwebsoft.think.param.ThinkInvoiceParam;
|
||||||
import com.gxwebsoft.think.service.ThinkInvoiceService;
|
import com.gxwebsoft.think.service.*;
|
||||||
import com.gxwebsoft.think.service.ThinkOrderInfoService;
|
|
||||||
import com.gxwebsoft.think.service.ThinkOrderService;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import nuonuo.open.sdk.NNOpenSDK;
|
import nuonuo.open.sdk.NNOpenSDK;
|
||||||
@@ -44,10 +43,21 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
private ThinkOrderService thinkOrderService;
|
private ThinkOrderService thinkOrderService;
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkOrderInfoService thinkOrderInfoService;
|
private ThinkOrderInfoService thinkOrderInfoService;
|
||||||
|
@Resource
|
||||||
|
private ThinkUsersVipService thinkUsersVipService;
|
||||||
|
@Resource
|
||||||
|
private ThinkSiteService thinkSiteService;
|
||||||
|
|
||||||
|
private final String taxnum = "339901999999142";
|
||||||
|
private final String appKey = "SD56531018";
|
||||||
|
private final String appSecret = "SD3C429B318C485E";
|
||||||
|
private final String sellerTel = "339901999999142";
|
||||||
|
private final String url = "https://sandbox.nuonuocs.cn/open/v1/services";
|
||||||
|
|
||||||
@ApiOperation("分页查询")
|
@ApiOperation("分页查询")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<ThinkInvoice>> page(ThinkInvoiceParam param) {
|
public ApiResult<PageResult<ThinkInvoice>> page(ThinkInvoiceParam param) {
|
||||||
|
if (param.getForAdmin() == null) param.setUid(getLoginUser().getUid());
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(thinkInvoiceService.pageRel(param));
|
return success(thinkInvoiceService.pageRel(param));
|
||||||
}
|
}
|
||||||
@@ -70,8 +80,25 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
@ApiOperation("添加")
|
@ApiOperation("添加")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ThinkInvoice thinkInvoice) {
|
public ApiResult<?> save(@RequestBody ThinkInvoice thinkInvoice) {
|
||||||
|
thinkInvoice.setIncoiveNum("");
|
||||||
|
thinkInvoice.setUid(getLoginUser().getUid());
|
||||||
|
thinkInvoice.setCode(thinkInvoice.getIncoiveCode());
|
||||||
|
thinkInvoice.setIncoiveNum(RandomUtil.randomString(20));
|
||||||
|
thinkInvoice.setIsOpen(2);
|
||||||
|
thinkInvoice.setCreateTime(DateUtil.currentSeconds());
|
||||||
|
thinkInvoice.setUpdateTime(DateUtil.currentSeconds());
|
||||||
|
if (thinkInvoice.getItype().equals(1)) {
|
||||||
|
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkInvoice.getOid());
|
||||||
|
ThinkOrderInfo thinkOrderInfo = thinkOrderInfoList.get(0);
|
||||||
|
thinkInvoice.setInfo(thinkOrderInfo.getSiteName() + "-" + thinkOrderInfo.getFieldName() + "(" + thinkOrderInfo.getDateTime() + ")");
|
||||||
|
} else if (thinkInvoice.getItype().equals(2)) {
|
||||||
|
ThinkUsersVip thinkUsersVip = thinkUsersVipService.getById(thinkInvoice.getOid());
|
||||||
|
thinkInvoice.setInfo(thinkUsersVip.getName() + " 微信订单号: " + thinkUsersVip.getWechatOrder());
|
||||||
|
} else if (thinkInvoice.getItype().equals(4)) {
|
||||||
|
thinkInvoice.setInfo("租赁发票");
|
||||||
|
}
|
||||||
if (thinkInvoiceService.save(thinkInvoice)) {
|
if (thinkInvoiceService.save(thinkInvoice)) {
|
||||||
return success("添加成功");
|
return success("添加成功", thinkInvoice);
|
||||||
}
|
}
|
||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
@@ -122,124 +149,137 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("开具发票")
|
@ApiOperation("开具发票")
|
||||||
@PostMapping("/doInvoice")
|
@PostMapping("/doInvoice")
|
||||||
public ApiResult<?> doInvoice(@RequestBody ThinkInvoice thinkInvoice) {
|
public ApiResult<?> doInvoice(@RequestBody ThinkInvoice thinkInvoice) {
|
||||||
System.out.println("thinkInvoice = " + thinkInvoice);
|
// System.out.println("thinkInvoice = " + thinkInvoice);
|
||||||
final Integer oid = thinkInvoice.getOid();
|
// final Integer oid = thinkInvoice.getOid();
|
||||||
final ThinkOrder thinkOrder = thinkOrderService.getById(thinkInvoice.getOid());
|
// final ThinkOrder thinkOrder = thinkOrderService.getById(thinkInvoice.getOid());
|
||||||
System.out.println("thinkOrder = " + thinkOrder);
|
// System.out.println("thinkOrder = " + thinkOrder);
|
||||||
final List<ThinkOrderInfo> orderInfos = thinkOrderInfoService.list(new LambdaQueryWrapper<ThinkOrderInfo>().eq(ThinkOrderInfo::getOid,thinkInvoice.getOid()));
|
// final List<ThinkOrderInfo> orderInfos = thinkOrderInfoService.list(new LambdaQueryWrapper<ThinkOrderInfo>().eq(ThinkOrderInfo::getOid, thinkInvoice.getOid()));
|
||||||
|
thinkInvoice.setStatus(1);
|
||||||
|
thinkInvoiceService.updateById(thinkInvoice);
|
||||||
|
// 开票接口
|
||||||
|
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
||||||
|
// String appKey = "92969434";
|
||||||
|
// String appSecret = "D51901886E454FEF";
|
||||||
|
String method = "nuonuo.OpeMplatform.requestBillingNew";//API方法名
|
||||||
|
String token = NNOpenSDK.getIntance().getMerchantToken(appKey, appSecret); //访问令牌
|
||||||
|
final NuoNuo nuoNuo = new NuoNuo();
|
||||||
|
final NuoNuoOrder order = new NuoNuoOrder();
|
||||||
|
order.setBuyerName(thinkInvoice.getName());
|
||||||
|
order.setBuyerTaxNum(thinkInvoice.getCode());
|
||||||
|
order.setBuyerPhone(thinkInvoice.getPhone());
|
||||||
|
order.setSalerTaxNum(taxnum); // 91450100737617400R
|
||||||
|
order.setSalerTel(sellerTel);
|
||||||
|
order.setOrderNo((thinkInvoice.getOrderNum() == null || thinkInvoice.getOrderNum().isEmpty()) ? thinkInvoice.getIncoiveNum() : thinkInvoice.getOrderNum());
|
||||||
|
order.setInvoiceDate(DateUtil.now());
|
||||||
|
order.setClerk("赵裕璐");
|
||||||
|
order.setPayee("班嘉良");
|
||||||
|
order.setChecker("蓝蕙孚");
|
||||||
|
order.setInvoiceType(String.valueOf(thinkInvoice.getInvoicetype()));
|
||||||
|
order.setRemark("不动产地址:广西壮族自治区南宁市良庆区五象大道西段669号广西体育中心综合馆;(市)标志:否;");
|
||||||
|
final NuoNuoGoods goods = new NuoNuoGoods();
|
||||||
|
goods.setGoodsName(thinkInvoice.getInfo());
|
||||||
|
// goods.setGoodsCode("3040502029902000000");
|
||||||
|
goods.setWithTaxFlag("0");
|
||||||
|
// if (!CollectionUtils.isEmpty(orderInfos)) {
|
||||||
|
// final ThinkOrderInfo thinkOrderInfo = orderInfos.get(0);
|
||||||
|
// if (thinkOrderInfo != null) {
|
||||||
|
// goods.setDField1(thinkOrderInfo.getDateTime());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
goods.setDField1("无");
|
||||||
|
goods.setDField2("无");
|
||||||
|
goods.setDField3("无");
|
||||||
|
goods.setDField4("无");
|
||||||
|
goods.setDField5("无");
|
||||||
|
goods.setTaxRate(new BigDecimal("0.05").toString());
|
||||||
|
final BigDecimal taxExcludedAmount = thinkInvoice.getPrice().divide(new BigDecimal("1.05"), 4, RoundingMode.HALF_UP);
|
||||||
|
final BigDecimal tax = taxExcludedAmount.multiply(new BigDecimal("0.05")).setScale(4, RoundingMode.HALF_EVEN);
|
||||||
|
goods.setTax(tax.toString());
|
||||||
|
goods.setTaxExcludedAmount(taxExcludedAmount.toString());
|
||||||
|
goods.setTaxIncludedAmount(thinkInvoice.getPrice().toString());
|
||||||
|
order.setInvoiceDetail(goods);
|
||||||
|
// System.out.println("税额 = " + tax);
|
||||||
|
// System.out.println("不含税金额 = " + taxExcludedAmount);
|
||||||
|
// System.out.println("含税金额 = " + thinkOrder.getTotalPrice());
|
||||||
|
if (thinkInvoice.getItype().equals(1)) {
|
||||||
|
final ThinkOrder thinkOrder = thinkOrderService.getById(thinkInvoice.getOid());
|
||||||
|
NuoNuoRealPropertyRentInfo nuoNuoRealPropertyRentInfo = new NuoNuoRealPropertyRentInfo();
|
||||||
|
ThinkSite thinkSite = thinkSiteService.getById(thinkOrder.getSid());
|
||||||
|
nuoNuoRealPropertyRentInfo.setRealPropertyAddress(thinkSite.getProvince() + thinkSite.getCity() + thinkSite.getRegion());
|
||||||
|
nuoNuoRealPropertyRentInfo.setDetailAddress(thinkSite.getAddress());
|
||||||
|
nuoNuoRealPropertyRentInfo.setRealPropertyCertificate(thinkSite.getRealPropertyCertificate());
|
||||||
|
nuoNuoRealPropertyRentInfo.setRentStartDate(thinkSite.getRentStartDate());
|
||||||
|
nuoNuoRealPropertyRentInfo.setRentEndDate(thinkSite.getRentEndDate());
|
||||||
|
nuoNuoRealPropertyRentInfo.setCrossCityFlag("0");
|
||||||
|
order.setRealPropertyRentInfo(nuoNuoRealPropertyRentInfo);
|
||||||
|
} else if (thinkInvoice.getItype().equals(4)) {
|
||||||
|
NuoNuoRealPropertyRentInfo nuoNuoRealPropertyRentInfo = new NuoNuoRealPropertyRentInfo();
|
||||||
|
nuoNuoRealPropertyRentInfo.setRealPropertyAddress("广西壮族自治区南宁市良庆区");
|
||||||
|
nuoNuoRealPropertyRentInfo.setDetailAddress("五象大道西段669号");
|
||||||
|
// nuoNuoRealPropertyRentInfo.setRealPropertyCertificate(thinkSite.getRealPropertyCertificate());
|
||||||
|
nuoNuoRealPropertyRentInfo.setRentStartDate(thinkInvoice.getRentStartDate());
|
||||||
|
nuoNuoRealPropertyRentInfo.setRentEndDate(thinkInvoice.getRentEndDate());
|
||||||
|
nuoNuoRealPropertyRentInfo.setCrossCityFlag("0");
|
||||||
|
order.setRealPropertyRentInfo(nuoNuoRealPropertyRentInfo);
|
||||||
|
}
|
||||||
|
nuoNuo.setOrder(order);
|
||||||
|
|
||||||
// 开票接口
|
|
||||||
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
String content = JSONUtil.toJSONString(nuoNuo);//API私有请求参数
|
||||||
String taxnum = "339901999999142";//ISV下授权商户税号,自用型应用置""即可
|
String senid = UUID.randomUUID().toString(); // 唯一标识,由企业自己生成32位随机码
|
||||||
String appKey = "SD56531018";
|
String json = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content); // 请求API
|
||||||
String appSecret = "SD3C429B318C485E";
|
System.out.println("json = " + json);
|
||||||
String method = "nuonuo.OpeMplatform.requestBillingNew";//API方法名
|
if (StrUtil.isNotBlank(json)) {
|
||||||
String token = NNOpenSDK.getIntance().getMerchantToken("SD56531018", "SD3C429B318C485E"); //访问令牌
|
final JSONObject jsonObject = JSONObject.parseObject(json);
|
||||||
final NuoNuo nuoNuo = new NuoNuo();
|
final String code = jsonObject.getString("code");
|
||||||
final NuoNuoOrder order = new NuoNuoOrder();
|
final String result = jsonObject.getString("result");
|
||||||
order.setBuyerName(thinkInvoice.getName());
|
System.out.println("jsonObject = " + jsonObject);
|
||||||
order.setBuyerTaxNum(thinkInvoice.getCode());
|
if (code.equals("E0000")) {
|
||||||
// order.setBuyerPhone(thinkInvoice.getPhone());
|
final JSONObject resNo = JSONObject.parseObject(result);
|
||||||
// order.setSalerTaxNum(invoice.getInvoiceCode());
|
final String invoiceSerialNum = resNo.getString("invoiceSerialNum");
|
||||||
// order.setSalerTel(invoice.getPhone());
|
if (thinkInvoice.getItype().equals(1)) {
|
||||||
order.setSalerTaxNum("339901999999142"); // 91450100737617400R
|
final ThinkOrder thinkOrder = thinkOrderService.getById(thinkInvoice.getOid());
|
||||||
order.setSalerTel("339901999999142");
|
thinkOrder.setIsInvoice(1);
|
||||||
order.setOrderNo(thinkOrder.getOrderNum());
|
thinkOrderService.updateById(thinkOrder);
|
||||||
order.setInvoiceDate(DateUtil.now());
|
} else if (thinkInvoice.getItype().equals(2)) {
|
||||||
order.setClerk("赵裕璐");
|
final ThinkUsersVip thinkUsersVip = thinkUsersVipService.getById(thinkInvoice.getOid());
|
||||||
order.setPayee("班嘉良");
|
thinkUsersVip.setIsInvoice(1);
|
||||||
order.setChecker("蓝蕙孚");
|
thinkUsersVipService.updateById(thinkUsersVip);
|
||||||
order.setBuyerPhone(thinkInvoice.getPhone());
|
}
|
||||||
order.setInvoiceType(String.valueOf(thinkInvoice.getInvoicetype()));
|
System.out.println("invoiceSerialNum = " + invoiceSerialNum);
|
||||||
order.setRemark("不动产地址:广西壮族自治区南宁市良庆区五象大道西段669号广西体育中心综合馆;(市)标志:否;");
|
thinkInvoice.setIncoiveNum(invoiceSerialNum);
|
||||||
final NuoNuoGoods goods = new NuoNuoGoods();
|
thinkInvoice.setIsOpen(1);
|
||||||
goods.setGoodsName("场地费");
|
thinkInvoiceService.updateById(thinkInvoice);
|
||||||
goods.setGoodsCode("3040502029902000000");
|
return success("发票开具成功", json);
|
||||||
goods.setWithTaxFlag("0");
|
}
|
||||||
if (!CollectionUtils.isEmpty(orderInfos)) {
|
}
|
||||||
final ThinkOrderInfo thinkOrderInfo = orderInfos.get(0);
|
return fail("发票开具失败");
|
||||||
if (thinkOrderInfo != null) {
|
|
||||||
goods.setDField1(thinkOrderInfo.getDateTime());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
goods.setDField2("无");
|
|
||||||
goods.setDField3("无");
|
|
||||||
goods.setDField4("无");
|
|
||||||
goods.setDField5("无");
|
|
||||||
goods.setTaxRate(new BigDecimal("0.05").toString());
|
|
||||||
final BigDecimal taxExcludedAmount = thinkOrder.getTotalPrice().divide(new BigDecimal("1.05"), 4, RoundingMode.HALF_UP);
|
|
||||||
final BigDecimal tax = taxExcludedAmount.multiply(new BigDecimal("0.05")).setScale(4,RoundingMode.HALF_EVEN);
|
|
||||||
goods.setTax(tax.toString());
|
|
||||||
goods.setTaxExcludedAmount(taxExcludedAmount.toString());
|
|
||||||
goods.setTaxIncludedAmount(thinkOrder.getTotalPrice().toString());
|
|
||||||
order.setInvoiceDetail(goods);
|
|
||||||
System.out.println("税额 = " + tax);
|
|
||||||
System.out.println("不含税金额 = " + taxExcludedAmount);
|
|
||||||
System.out.println("含税金额 = " + thinkOrder.getTotalPrice());
|
|
||||||
nuoNuo.setOrder(order);
|
|
||||||
|
|
||||||
String content = JSONUtil.toJSONString(nuoNuo);//API私有请求参数
|
@ApiOperation("根据id查询发票")
|
||||||
String url = "https://sandbox.nuonuocs.cn/open/v1/services"; //SDK请求地址
|
@GetMapping("/showInvoice/{id}")
|
||||||
String senid = UUID.randomUUID().toString(); // 唯一标识,由企业自己生成32位随机码
|
public ApiResult<?> showInvoice(@PathVariable("id") Integer id) {
|
||||||
String json = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content); // 请求API
|
final ThinkInvoice thinkInvoice = thinkInvoiceService.getById(id);
|
||||||
System.out.println("json = " + json);
|
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
||||||
if (StrUtil.isNotBlank(json)) {
|
String method = "nuonuo.OpeMplatform.queryInvoiceResult";//API方法名
|
||||||
final JSONObject jsonObject = JSONObject.parseObject(json);
|
String token = NNOpenSDK.getIntance().getMerchantToken(appKey, appSecret); //访问令牌
|
||||||
final String code = jsonObject.getString("code");
|
|
||||||
final String result = jsonObject.getString("result");
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
System.out.println("jsonObject = " + jsonObject);
|
map.put("serialNos", thinkInvoice.getIncoiveNum());
|
||||||
if (code.equals("E0000")) {
|
String content = JSONUtil.toJSONString(map);//API私有请求参数
|
||||||
final JSONObject resNo = JSONObject.parseObject(result);
|
String senid = UUID.randomUUID().toString(); // 唯一标识,由企业自己生成32位随机码
|
||||||
final String invoiceSerialNum = resNo.getString("invoiceSerialNum");
|
|
||||||
thinkOrder.setIsInvoice(1);
|
String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
|
||||||
thinkOrderService.updateById(thinkOrder);
|
final JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
System.out.println("invoiceSerialNum = " + invoiceSerialNum);
|
final String code = jsonObject.getString("code");
|
||||||
thinkInvoice.setId(null);
|
final String body = jsonObject.getString("result");
|
||||||
thinkInvoice.setIncoiveNum(invoiceSerialNum);
|
if (code.equals("E0000")) {
|
||||||
thinkInvoice.setIncoiveCode("339901999999142");
|
return success("查询成功", body);
|
||||||
thinkInvoice.setUid(thinkOrder.getUid());
|
}
|
||||||
thinkInvoice.setCreateTime(System.currentTimeMillis()/1000);
|
return success("查询失败", result);
|
||||||
thinkInvoiceService.save(thinkInvoice);
|
|
||||||
return success("发票开具成功", json);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return fail("发票开具失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("根据id查询发票")
|
|
||||||
@GetMapping("/showInvoice/{orderId}")
|
|
||||||
public ApiResult<?> showInvoice(@PathVariable("orderId") Integer orderId) {
|
|
||||||
final ThinkInvoice thinkInvoice = thinkInvoiceService.getOne(new LambdaQueryWrapper<ThinkInvoice>().eq(ThinkInvoice::getOid,orderId));
|
|
||||||
System.out.println("thinkInvoice = " + thinkInvoice);
|
|
||||||
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
|
||||||
String taxnum = "339901999999142";//ISV下授权商户税号,自用型应用置""即可
|
|
||||||
String appKey = "SD56531018";
|
|
||||||
String appSecret = "SD3C429B318C485E";
|
|
||||||
String method = "nuonuo.OpeMplatform.queryInvoiceResult";//API方法名
|
|
||||||
String token = NNOpenSDK.getIntance().getMerchantToken("SD56531018", "SD3C429B318C485E"); //访问令牌
|
|
||||||
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
// map.put("invoiceCode",invoiceNo);
|
|
||||||
map.put("serialNos", thinkInvoice.getIncoiveNum());
|
|
||||||
// map.put("inTaxAmount", order.getPayPrice().subtract(order.getPayPrice().multiply(new BigDecimal("0.06")))); // 含税金额
|
|
||||||
// map.put("exTaxAmount", order.getPayPrice()); // 不含税金额
|
|
||||||
System.out.println("map = " + map);
|
|
||||||
String content = JSONUtil.toJSONString(map);//API私有请求参数
|
|
||||||
String url = "https://sandbox.nuonuocs.cn/open/v1/services"; //SDK请求地址
|
|
||||||
String senid = UUID.randomUUID().toString(); // 唯一标识,由企业自己生成32位随机码
|
|
||||||
|
|
||||||
String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
|
|
||||||
System.out.println("result = " + result);
|
|
||||||
final JSONObject jsonObject = JSONObject.parseObject(result);
|
|
||||||
final String code = jsonObject.getString("code");
|
|
||||||
final String body = jsonObject.getString("result");
|
|
||||||
if (code.equals("E0000")) {
|
|
||||||
return success("查询成功", body);
|
|
||||||
}
|
|
||||||
return success("查询失败", result);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkOrder;
|
||||||
|
import com.gxwebsoft.think.service.ThinkMachineOpenLogService;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkMachineOpenLog;
|
||||||
|
import com.gxwebsoft.think.param.ThinkMachineOpenLogParam;
|
||||||
|
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 com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.think.service.ThinkOrderService;
|
||||||
|
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;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸机开门记录控制器
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-11-28 18:22:35
|
||||||
|
*/
|
||||||
|
@Api(tags = "闸机开门记录管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/think/think-machine-open-log")
|
||||||
|
public class ThinkMachineOpenLogController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private ThinkMachineOpenLogService thinkMachineOpenLogService;
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderService thinkOrderService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询闸机开门记录")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<ThinkMachineOpenLog>> page(ThinkMachineOpenLogParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkMachineOpenLogService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部闸机开门记录")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<ThinkMachineOpenLog>> list(ThinkMachineOpenLogParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkMachineOpenLogService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('think:thinkMachineOpenLog:list')")
|
||||||
|
@ApiOperation("根据id查询闸机开门记录")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<ThinkMachineOpenLog> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkMachineOpenLogService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加闸机开门记录")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody ThinkMachineOpenLog thinkMachineOpenLog) {
|
||||||
|
if (thinkMachineOpenLog.getQrcode() == null || thinkMachineOpenLog.getQrcode().isEmpty())
|
||||||
|
return fail("二维码不能为空");
|
||||||
|
String[] qrcode = thinkMachineOpenLog.getQrcode().split(",");
|
||||||
|
for (String s : qrcode) {
|
||||||
|
Map<String, Object> res = thinkOrderService.getByQrCode(s);
|
||||||
|
ThinkOrder thinkOrder = (ThinkOrder) res.get("data");
|
||||||
|
if (thinkOrder != null) {
|
||||||
|
ThinkMachineOpenLog openLog = thinkMachineOpenLogService.getByOrderId(thinkOrder.getId());
|
||||||
|
if (openLog == null) {
|
||||||
|
thinkMachineOpenLog.setOrderId(thinkOrder.getId());
|
||||||
|
thinkMachineOpenLogService.save(thinkMachineOpenLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改闸机开门记录")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody ThinkMachineOpenLog thinkMachineOpenLog) {
|
||||||
|
if (thinkMachineOpenLogService.updateById(thinkMachineOpenLog)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除闸机开门记录")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (thinkMachineOpenLogService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量添加闸机开门记录")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<ThinkMachineOpenLog> list) {
|
||||||
|
if (thinkMachineOpenLogService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量修改闸机开门记录")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<ThinkMachineOpenLog> batchParam) {
|
||||||
|
if (batchParam.update(thinkMachineOpenLogService, "id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量删除闸机开门记录")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (thinkMachineOpenLogService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,27 +6,28 @@ import cn.hutool.core.date.LocalDateTimeUtil;
|
|||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
|
import cn.hutool.crypto.SecureUtil;
|
||||||
|
import cn.hutool.crypto.symmetric.SymmetricAlgorithm;
|
||||||
|
import cn.hutool.crypto.symmetric.SymmetricCrypto;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||||
|
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import com.gxwebsoft.shop.entity.Cart;
|
import com.gxwebsoft.shop.entity.Cart;
|
||||||
import com.gxwebsoft.shop.entity.Goods;
|
import com.gxwebsoft.shop.entity.Goods;
|
||||||
import com.gxwebsoft.shop.entity.OrderGoods;
|
import com.gxwebsoft.shop.entity.OrderGoods;
|
||||||
import com.gxwebsoft.shop.entity.OrderInfo;
|
import com.gxwebsoft.shop.entity.OrderInfo;
|
||||||
import com.gxwebsoft.think.entity.ThinkOrder;
|
import com.gxwebsoft.think.entity.*;
|
||||||
import com.gxwebsoft.think.entity.ThinkOrderInfo;
|
|
||||||
import com.gxwebsoft.think.entity.ThinkSiteTime;
|
|
||||||
import com.gxwebsoft.think.entity.ThinkUsersVip;
|
|
||||||
import com.gxwebsoft.think.param.ThinkOrderParam;
|
import com.gxwebsoft.think.param.ThinkOrderParam;
|
||||||
import com.gxwebsoft.think.service.ThinkOrderInfoService;
|
import com.gxwebsoft.think.service.*;
|
||||||
import com.gxwebsoft.think.service.ThinkOrderService;
|
|
||||||
import com.gxwebsoft.think.service.ThinkSiteTimeService;
|
|
||||||
import com.gxwebsoft.think.service.WechatConfigService;
|
|
||||||
import com.wechat.pay.java.core.Config;
|
import com.wechat.pay.java.core.Config;
|
||||||
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
|
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
|
||||||
import com.wechat.pay.java.core.notification.NotificationConfig;
|
import com.wechat.pay.java.core.notification.NotificationConfig;
|
||||||
@@ -37,17 +38,26 @@ import com.wechat.pay.java.service.payments.model.TransactionAmount;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import me.chanjar.weixin.common.error.WxErrorException;
|
import me.chanjar.weixin.common.error.WxErrorException;
|
||||||
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
|
import org.apache.poi.ss.usermodel.Font;
|
||||||
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||||
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
|
import org.apache.poi.xssf.streaming.SXSSFRow;
|
||||||
|
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||||
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.gxwebsoft.think.consts.OrderStatusConsts.PAY_TYPE_WECHAT;
|
import static com.gxwebsoft.think.consts.OrderStatusConsts.PAY_TYPE_WECHAT;
|
||||||
@@ -70,8 +80,24 @@ public class ThinkOrderController extends BaseController {
|
|||||||
private ThinkOrderInfoService thinkOrderInfoService;
|
private ThinkOrderInfoService thinkOrderInfoService;
|
||||||
@Resource
|
@Resource
|
||||||
private WechatConfigService wechatConfigService;
|
private WechatConfigService wechatConfigService;
|
||||||
|
@Resource
|
||||||
|
private ThinkUsersVipService thinkUsersVipService;
|
||||||
|
@Resource
|
||||||
|
private ThinkCardService thinkCardService;
|
||||||
|
@Resource
|
||||||
|
private ThinkVipCardsBillsService thinkVipCardsBillsService;
|
||||||
|
@Resource
|
||||||
|
private ThinkSiteService thinkSiteService;
|
||||||
|
|
||||||
public static String privateKeyPath = "/www/jar/gxtyzx-java/file/93dc8f750fee4eeaa5fb0a768982d639.pem";
|
@Autowired
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
|
@Value("${config.upload-path}")
|
||||||
|
private String uploadPath;
|
||||||
|
@Value("${config.server-url}")
|
||||||
|
private String serverUrl;
|
||||||
|
@Resource
|
||||||
|
private ConfigProperties config;
|
||||||
|
|
||||||
// private NotificationConfig config;
|
// private NotificationConfig config;
|
||||||
|
|
||||||
@@ -86,14 +112,6 @@ public class ThinkOrderController extends BaseController {
|
|||||||
.timestamp(header.get("wechatpay-timestamp").toString())
|
.timestamp(header.get("wechatpay-timestamp").toString())
|
||||||
.body(body)
|
.body(body)
|
||||||
.build();
|
.build();
|
||||||
// if (config == null) {
|
|
||||||
// config = new RSAAutoCertificateConfig.Builder()
|
|
||||||
// .merchantId("1604773943")
|
|
||||||
// .privateKeyFromPath(privateKeyPath)
|
|
||||||
// .merchantSerialNumber("5EE433741F4AEF889636C423A1CE099090802CBE")
|
|
||||||
// .apiV3Key("c08jFf8304G8t2jcjFRKTe0t8F43Hjti")
|
|
||||||
// .build();
|
|
||||||
// }
|
|
||||||
NotificationConfig config = wechatConfigService.getNotificationConfig();
|
NotificationConfig config = wechatConfigService.getNotificationConfig();
|
||||||
NotificationParser parser = new NotificationParser(config);
|
NotificationParser parser = new NotificationParser(config);
|
||||||
com.wechat.pay.java.service.payments.model.Transaction transaction = parser.parse(requestParam, com.wechat.pay.java.service.payments.model.Transaction.class);
|
com.wechat.pay.java.service.payments.model.Transaction transaction = parser.parse(requestParam, com.wechat.pay.java.service.payments.model.Transaction.class);
|
||||||
@@ -101,36 +119,120 @@ public class ThinkOrderController extends BaseController {
|
|||||||
final ThinkOrder order = thinkOrderService.getByOrderNum(transaction.getOutTradeNo());
|
final ThinkOrder order = thinkOrderService.getByOrderNum(transaction.getOutTradeNo());
|
||||||
if (order == null) return "订单不存在";
|
if (order == null) return "订单不存在";
|
||||||
if (order.getPayStatus().equals(2)) {
|
if (order.getPayStatus().equals(2)) {
|
||||||
// 2.更新订单支付状态
|
updatePay(order, transaction.getTransactionId(), transaction.getAmount().getPayerTotal());
|
||||||
order.setPayStatus(1);
|
|
||||||
order.setWechatOrder(transaction.getTransactionId());
|
|
||||||
order.setPayPrice(new BigDecimal(NumberUtil.decimalFormat("0.00", transaction.getAmount().getPayerTotal() * 0.01)));
|
|
||||||
order.setPrice(new BigDecimal(NumberUtil.decimalFormat("0.00", transaction.getAmount().getPayerTotal() * 0.01)));
|
|
||||||
order.setPayTime((int) DateUtil.currentSeconds());
|
|
||||||
order.setQrcode("qrcode/" + LocalDateTimeUtil.format(LocalDateTime.now(), "yyyyMMdd") + "/" + IdUtil.getSnowflake().nextIdStr() + ".png");
|
|
||||||
thinkOrderService.updateById(order);
|
|
||||||
// 更新订单商品的支付状态
|
|
||||||
if (order.getType().equals(0)) {
|
|
||||||
List<ThinkOrderInfo> orderInfoList = thinkOrderInfoService.listInOrder(order.getId());
|
|
||||||
for (ThinkOrderInfo thinkOrderInfo : orderInfoList) {
|
|
||||||
thinkOrderInfo.setPayStatus(1);
|
|
||||||
}
|
|
||||||
thinkOrderInfoService.updateBatchById(orderInfoList);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return "订单已支付";
|
return "订单已支付";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updatePay(ThinkOrder order, String transactionId, Integer payAmount) {
|
||||||
|
order.setPayStatus(1);
|
||||||
|
order.setWechatOrder(transactionId);
|
||||||
|
// order.setPayPrice(new BigDecimal(NumberUtil.decimalFormat("0.00", transaction.getAmount().getPayerTotal() * 0.01)));
|
||||||
|
order.setPrice(new BigDecimal(NumberUtil.decimalFormat("0.00", payAmount * 0.01)));
|
||||||
|
order.setPayTime((int) DateUtil.currentSeconds());
|
||||||
|
order.setQrcode("qrcode/" + LocalDateTimeUtil.format(LocalDateTime.now(), "yyyyMMdd") + "/" + IdUtil.getSnowflake().nextIdStr() + ".png");
|
||||||
|
thinkOrderService.updateById(order);
|
||||||
|
// 更新订单商品的支付状态
|
||||||
|
if (order.getType().equals(0)) {
|
||||||
|
List<ThinkOrderInfo> orderInfoList = thinkOrderInfoService.listInOrder(order.getId());
|
||||||
|
for (ThinkOrderInfo thinkOrderInfo : orderInfoList) {
|
||||||
|
thinkOrderInfo.setPayStatus(1);
|
||||||
|
}
|
||||||
|
thinkOrderInfoService.updateBatchById(orderInfoList);
|
||||||
|
}
|
||||||
|
// 游泳馆限制人数
|
||||||
|
if (order.getSid() != null && order.getSid().equals(37)) {
|
||||||
|
ThinkSite thinkSite = thinkSiteService.getById(order.getSid());
|
||||||
|
thinkSite.setDailyNum(thinkSite.getDailyNum() + 1);
|
||||||
|
thinkSiteService.updateById(thinkSite);
|
||||||
|
}
|
||||||
|
// 使用记录
|
||||||
|
boolean saveBill = false;
|
||||||
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
|
thinkVipCardsBills.setOid(order.getId());
|
||||||
|
thinkVipCardsBills.setUid(order.getUid());
|
||||||
|
thinkVipCardsBills.setUsed(1);
|
||||||
|
thinkVipCardsBills.setDate(DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd"));
|
||||||
|
// VIP卡
|
||||||
|
if (order.getVid() != null) {
|
||||||
|
ThinkUsersVip usersVip = thinkUsersVipService.getById(order.getVid());
|
||||||
|
if (usersVip.getType().equals(5)) {
|
||||||
|
BigDecimal newBalance = usersVip.getRemainingMoney().subtract(order.getPayPrice());
|
||||||
|
usersVip.setRemainingMoney(newBalance);
|
||||||
|
thinkVipCardsBills.setAmount(order.getPayPrice());
|
||||||
|
} else if (usersVip.getType().equals(4)) {
|
||||||
|
BigDecimal newBalance = usersVip.getRemainingMoney().subtract(usersVip.getEachMoney());
|
||||||
|
usersVip.setRemainingMoney(newBalance);
|
||||||
|
usersVip.setNum(usersVip.getNum() - 1);
|
||||||
|
thinkVipCardsBills.setAmount(usersVip.getEachMoney());
|
||||||
|
} else {
|
||||||
|
usersVip.setNum(usersVip.getNum() - 1);
|
||||||
|
thinkVipCardsBills.setAmount(usersVip.getPrice().divide(BigDecimal.valueOf(usersVip.getCount()), RoundingMode.HALF_UP));
|
||||||
|
}
|
||||||
|
thinkUsersVipService.updateById(usersVip);
|
||||||
|
|
||||||
|
thinkVipCardsBills.setVid(order.getVid());
|
||||||
|
saveBill = true;
|
||||||
|
}
|
||||||
|
// IC卡
|
||||||
|
if (order.getCode() != null) {
|
||||||
|
ThinkCard card = thinkCardService.getByCode(order.getCode());
|
||||||
|
if (card.getType().equals(5)) {
|
||||||
|
BigDecimal newBalance = card.getRemainingMoney().subtract(order.getPayPrice());
|
||||||
|
thinkVipCardsBills.setAmount(order.getPayPrice());
|
||||||
|
card.setRemainingMoney(newBalance);
|
||||||
|
} else if (card.getType().equals(4)) {
|
||||||
|
BigDecimal newBalance = card.getRemainingMoney().subtract(card.getEachMoney());
|
||||||
|
thinkVipCardsBills.setAmount(card.getEachMoney());
|
||||||
|
card.setRemainingMoney(newBalance);
|
||||||
|
} else if (card.getType().equals(2)) {
|
||||||
|
card.setNum(card.getNum() - 1);
|
||||||
|
thinkVipCardsBills.setAmount(card.getPrice().divide(BigDecimal.valueOf(card.getCount()), RoundingMode.HALF_UP));
|
||||||
|
}
|
||||||
|
thinkCardService.updateById(card);
|
||||||
|
|
||||||
|
thinkVipCardsBills.setCid(card.getId());
|
||||||
|
saveBill = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (saveBill) thinkVipCardsBillsService.addLog(thinkVipCardsBills);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("分页查询")
|
@ApiOperation("分页查询")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<?> page(ThinkOrderParam param) {
|
public ApiResult<?> page(ThinkOrderParam param) {
|
||||||
if (getLoginUser() == null) return fail("请先登录");
|
if (param.getForAdmin() == null) {
|
||||||
param.setUid(getLoginUser().getUid());
|
if (getLoginUser() == null) return fail("请先登录");
|
||||||
|
param.setUid(getLoginUser().getUid());
|
||||||
|
}
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(thinkOrderService.pageRel(param));
|
return success(thinkOrderService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("总金额")
|
||||||
|
@GetMapping("/total-amount")
|
||||||
|
public ApiResult<?> totalAmount(ThinkOrderParam param) {
|
||||||
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
|
QueryWrapper<ThinkOrder> lambdaQueryWrapper = new QueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.select("SUM(`total_price`) AS `total_amount`");
|
||||||
|
lambdaQueryWrapper.eq("pay_status", 1);
|
||||||
|
if (param.getSid() != null) lambdaQueryWrapper.eq("sid", param.getSid());
|
||||||
|
if (param.getTimeStart() != null)
|
||||||
|
lambdaQueryWrapper.ge("create_time", param.getTimeStart()).le("create_time", param.getTimeEnd());
|
||||||
|
if (param.getKeywords() != null) {
|
||||||
|
lambdaQueryWrapper.and(
|
||||||
|
wrapper -> wrapper.or(w -> w.like("name", param.getKeywords()))
|
||||||
|
.or(w -> w.like("id", param.getKeywords()))
|
||||||
|
.or(w -> w.like("order_num", param.getKeywords()))
|
||||||
|
.or(w -> w.like("phone", param.getKeywords()))
|
||||||
|
.or(w -> w.like("code", param.getKeywords()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
ThinkOrder order = thinkOrderService.getOne(lambdaQueryWrapper);
|
||||||
|
if (order != null) totalAmount = order.getTotalAmount();
|
||||||
|
return success(totalAmount);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("查询全部")
|
@ApiOperation("查询全部")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<ThinkOrder>> list(ThinkOrderParam param) {
|
public ApiResult<List<ThinkOrder>> list(ThinkOrderParam param) {
|
||||||
@@ -142,21 +244,67 @@ public class ThinkOrderController extends BaseController {
|
|||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<ThinkOrder> get(@PathVariable("id") Integer id) {
|
public ApiResult<ThinkOrder> get(@PathVariable("id") Integer id) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(thinkOrderService.getByIdRel(id));
|
ThinkOrder order = thinkOrderService.getByIdRel(id);
|
||||||
|
if (order.getPayStatus().equals(1) && order.getOrderStatus().equals(2)) {
|
||||||
|
String secretKey = redisUtil.get("secretKey_10150");
|
||||||
|
byte[] key = null;
|
||||||
|
if (secretKey == null) {
|
||||||
|
key = SecureUtil.generateKey(SymmetricAlgorithm.AES.getValue()).getEncoded();
|
||||||
|
redisUtil.set("secretKey_10150", Base64.getEncoder().encodeToString(key));
|
||||||
|
} else {
|
||||||
|
key = Base64.getDecoder().decode(secretKey);
|
||||||
|
}
|
||||||
|
SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, key);
|
||||||
|
long timestamp = (int) (System.currentTimeMillis() / 1000);
|
||||||
|
order.setQrcode(aes.encryptHex(id + "_" + timestamp));
|
||||||
|
order.setQrCodeTimestamp(String.valueOf(timestamp));
|
||||||
|
}
|
||||||
|
return success(order);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据code核销")
|
||||||
|
@PostMapping("/check-code")
|
||||||
|
public ApiResult<?> getByQrCode(@RequestBody ThinkOrder order) {
|
||||||
|
if (order.getQrcode() == null || order.getQrcode().isEmpty()) return fail("二维码不能为空");
|
||||||
|
// 使用关联查询
|
||||||
|
Map<String, Object> res = thinkOrderService.getByQrCode(order.getQrcode());
|
||||||
|
if (!(Boolean) res.get("res")) return fail(res.get("msg"));
|
||||||
|
// 核销动作
|
||||||
|
ThinkOrder thinkOrder = (ThinkOrder) res.get("data");
|
||||||
|
thinkOrder.setOrderStatus(1);
|
||||||
|
// thinkOrderService.updateById(thinkOrder);
|
||||||
|
return success("核销成功", order.getQrcode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据code查询")
|
||||||
|
@GetMapping("/by-code/{code}")
|
||||||
|
public ApiResult<Map<String, Object>> getByQrCode(@PathVariable("code") String code) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkOrderService.getByQrCode(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("添加")
|
@ApiOperation("添加")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ThinkOrder thinkOrder, HttpServletRequest request) throws IOException, WxErrorException {
|
public ApiResult<?> save(@RequestBody ThinkOrder thinkOrder, HttpServletRequest request) throws IOException, WxErrorException {
|
||||||
|
for (ThinkOrderInfo info : thinkOrder.getThinkOrderInfos()) {
|
||||||
|
ThinkOrderInfo checkOrder = thinkOrderInfoService.checkOrder(info);
|
||||||
|
if (checkOrder != null) return fail("该场地已被预定");
|
||||||
|
}
|
||||||
|
if (thinkOrder.getSid().equals(37)) {
|
||||||
|
ThinkSite thinkSite = thinkSiteService.getById(thinkOrder.getSid());
|
||||||
|
if (thinkSite.getDailyMaxNum() != null && thinkSite.getDailyMaxNum() > 0 && thinkSite.getDailyNum() >= thinkSite.getDailyMaxNum())
|
||||||
|
return fail("已达上限,无法预定");
|
||||||
|
}
|
||||||
User user = getLoginUser();
|
User user = getLoginUser();
|
||||||
if (user == null) return fail("请先登录");
|
if (user == null) return fail("请先登录");
|
||||||
|
if (thinkOrder.getPayType().equals(2) && thinkOrder.getVid() == null) return fail("请选择会员卡");
|
||||||
|
if (thinkOrder.getPayType().equals(5) && thinkOrder.getCode() == null) return fail("请选择IC卡");
|
||||||
thinkOrder.setOrderNum(IdUtil.getSnowflake().nextIdStr());
|
thinkOrder.setOrderNum(IdUtil.getSnowflake().nextIdStr());
|
||||||
BigDecimal totalPrice = BigDecimal.ZERO;
|
BigDecimal totalPrice = BigDecimal.ZERO;
|
||||||
// BigDecimal reducePrice = BigDecimal.ZERO;
|
// BigDecimal reducePrice = BigDecimal.ZERO;
|
||||||
thinkOrder.setPayPrice(BigDecimal.ZERO);
|
thinkOrder.setPayPrice(BigDecimal.ZERO);
|
||||||
thinkOrder.setReducePrice(BigDecimal.ZERO);
|
thinkOrder.setReducePrice(BigDecimal.ZERO);
|
||||||
thinkOrder.setPrice(BigDecimal.ZERO);
|
thinkOrder.setPrice(BigDecimal.ZERO);
|
||||||
thinkOrder.setPrice(BigDecimal.ZERO);
|
|
||||||
thinkOrder.setUid(user.getUid());
|
thinkOrder.setUid(user.getUid());
|
||||||
Long now = new Date().getTime();
|
Long now = new Date().getTime();
|
||||||
int timestamp = (int) (now / 1000);
|
int timestamp = (int) (now / 1000);
|
||||||
@@ -165,19 +313,157 @@ public class ThinkOrderController extends BaseController {
|
|||||||
ThinkSiteTime siteTime = thinkSiteTimeService.getById(thinkOrderInfo.getSiteTimeId());
|
ThinkSiteTime siteTime = thinkSiteTimeService.getById(thinkOrderInfo.getSiteTimeId());
|
||||||
thinkOrderInfo.setPrice(BigDecimal.ZERO);
|
thinkOrderInfo.setPrice(BigDecimal.ZERO);
|
||||||
thinkOrderInfo.setChildrenPrice(BigDecimal.ZERO);
|
thinkOrderInfo.setChildrenPrice(BigDecimal.ZERO);
|
||||||
|
BigDecimal price = BigDecimal.ZERO;
|
||||||
if (siteTime != null && siteTime.getIsStatus() == 1) {
|
if (siteTime != null && siteTime.getIsStatus() == 1) {
|
||||||
thinkOrderInfo.setPrice(siteTime.getPrice());
|
// 半场
|
||||||
|
if (thinkOrderInfo.getType().equals(2)) thinkOrderInfo.setPrice(siteTime.getHalfPrice());
|
||||||
|
else thinkOrderInfo.setPrice(siteTime.getPrice());
|
||||||
thinkOrderInfo.setChildrenPrice(siteTime.getChildrenPrice());
|
thinkOrderInfo.setChildrenPrice(siteTime.getChildrenPrice());
|
||||||
thinkOrderInfo.setOrderTime(timestamp);
|
thinkOrderInfo.setOrderTime(timestamp);
|
||||||
thinkOrderInfo.setTimeFlag(now);
|
thinkOrderInfo.setTimeFlag(now);
|
||||||
thinkOrderInfo.setIsChildren(0);
|
// thinkOrderInfo.setIsChildren(0);
|
||||||
totalPrice = totalPrice.add(siteTime.getPrice().multiply(BigDecimal.valueOf(thinkOrderInfo.getAdultNum())));
|
if (thinkOrderInfo.getIsChildren().equals(2)) {
|
||||||
totalPrice = totalPrice.add(siteTime.getChildrenPrice().multiply(BigDecimal.valueOf(thinkOrderInfo.getChildrenNum())));
|
if (thinkOrderInfo.getAdultNum() < 1) return fail("非法请求,code:1");
|
||||||
|
if (thinkOrderInfo.getType().equals(2))
|
||||||
|
totalPrice = totalPrice.add(siteTime.getHalfPrice().multiply(BigDecimal.valueOf(thinkOrderInfo.getAdultNum())));
|
||||||
|
else
|
||||||
|
totalPrice = totalPrice.add(siteTime.getPrice().multiply(BigDecimal.valueOf(thinkOrderInfo.getAdultNum())));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (thinkOrderInfo.getChildrenNum() < 1) return fail("非法请求,code:2");
|
||||||
|
thinkOrderInfo.setChildrenPrice(siteTime.getChildrenPrice());
|
||||||
|
totalPrice = totalPrice.add(siteTime.getChildrenPrice().multiply(BigDecimal.valueOf(thinkOrderInfo.getChildrenNum())));
|
||||||
|
}
|
||||||
// reducePrice = reducePrice.add(thinkOrderInfo.getChildrenPrice());
|
// reducePrice = reducePrice.add(thinkOrderInfo.getChildrenPrice());
|
||||||
}
|
} else return fail("非法请求,code:3");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
thinkOrder.setTotalPrice(totalPrice);
|
thinkOrder.setTotalPrice(totalPrice);
|
||||||
|
// VIP卡
|
||||||
|
if (thinkOrder.getVid() != null) {
|
||||||
|
ThinkUsersVip usersVip = thinkUsersVipService.getById(thinkOrder.getVid());
|
||||||
|
if (usersVip == null) return fail("非法请求,code:4");
|
||||||
|
if (!usersVip.getUid().equals(getLoginUser().getUid())) return fail("非法请求,code:1");
|
||||||
|
if (usersVip.getType().equals(5)) {
|
||||||
|
if (usersVip.getRemainingMoney().compareTo(BigDecimal.ZERO) < 1) return fail("余额不足");
|
||||||
|
BigDecimal discount = usersVip.getDiscount().divide(BigDecimal.valueOf(10), RoundingMode.HALF_UP);
|
||||||
|
BigDecimal reducePrice = totalPrice.multiply(discount);
|
||||||
|
thinkOrder.setReducePrice(reducePrice);
|
||||||
|
thinkOrder.setPayPrice(totalPrice.subtract(reducePrice));
|
||||||
|
} else if (usersVip.getType().equals(4)) {
|
||||||
|
if (usersVip.getRemainingMoney().compareTo(BigDecimal.ZERO) < 1) return fail("余额不足");
|
||||||
|
thinkOrder.setReducePrice(usersVip.getEachMoney());
|
||||||
|
thinkOrder.setPayPrice(totalPrice.subtract(usersVip.getEachMoney()));
|
||||||
|
} else if (usersVip.getType().equals(2)) {
|
||||||
|
if (usersVip.getNum() < 1) return fail("次数不足");
|
||||||
|
thinkOrder.setReducePrice(totalPrice);
|
||||||
|
thinkOrder.setPayPrice(BigDecimal.ZERO);
|
||||||
|
} else {
|
||||||
|
if (usersVip.getNum() < 1) return fail("次数不足");
|
||||||
|
// 上次使用的订单
|
||||||
|
ThinkOrder lastOrder = thinkOrderService.getLastOrderByVid(usersVip.getId());
|
||||||
|
if (lastOrder != null) {
|
||||||
|
// 今天是否已经使用
|
||||||
|
long todayStart = DateUtil.beginOfDay(new Date()).getTime() / 1000;
|
||||||
|
long todayEnd = DateUtil.endOfDay(new Date()).getTime() / 1000;
|
||||||
|
if (lastOrder.getCreateTime() >= todayStart && lastOrder.getCreateTime() <= todayEnd) {
|
||||||
|
return fail("今天已使用");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
thinkOrder.setReducePrice(totalPrice);
|
||||||
|
thinkOrder.setPayPrice(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
switch (usersVip.getType()) {
|
||||||
|
// 年卡
|
||||||
|
case 1: {
|
||||||
|
thinkOrder.setPayType(7);
|
||||||
|
thinkOrder.setType(4);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// 次卡
|
||||||
|
case 2: {
|
||||||
|
thinkOrder.setPayType(8);
|
||||||
|
thinkOrder.setType(5);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// 月卡
|
||||||
|
case 3: {
|
||||||
|
thinkOrder.setPayType(6);
|
||||||
|
thinkOrder.setType(3);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// 余额卡
|
||||||
|
case 4: {
|
||||||
|
thinkOrder.setPayType(13);
|
||||||
|
thinkOrder.setType(6);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// IC卡
|
||||||
|
if (thinkOrder.getCode() != null) {
|
||||||
|
ThinkCard card = thinkCardService.getByCode(thinkOrder.getCode());
|
||||||
|
if (card == null) return fail("非法请求,code:0");
|
||||||
|
if (!card.getUid().equals(getLoginUser().getUid())) return fail("非法请求,code:1");
|
||||||
|
if (card.getType().equals(5)) {
|
||||||
|
if (card.getRemainingMoney().compareTo(BigDecimal.ZERO) < 1) return fail("余额不足");
|
||||||
|
BigDecimal discount = card.getDiscount().divide(BigDecimal.valueOf(10), RoundingMode.HALF_UP);
|
||||||
|
BigDecimal reducePrice = totalPrice.multiply(discount);
|
||||||
|
thinkOrder.setReducePrice(reducePrice);
|
||||||
|
thinkOrder.setPayPrice(totalPrice.subtract(reducePrice));
|
||||||
|
} else if (card.getType().equals(4)) {
|
||||||
|
if (card.getRemainingMoney().compareTo(BigDecimal.ZERO) < 1) return fail("余额不足");
|
||||||
|
thinkOrder.setReducePrice(card.getEachMoney());
|
||||||
|
thinkOrder.setPayPrice(totalPrice.subtract(card.getEachMoney()));
|
||||||
|
} else if (card.getType().equals(2)) {
|
||||||
|
if (card.getNum() < 1) return fail("次数不足");
|
||||||
|
thinkOrder.setReducePrice(totalPrice);
|
||||||
|
thinkOrder.setPayPrice(BigDecimal.ZERO);
|
||||||
|
} else {
|
||||||
|
// 上次使用的订单
|
||||||
|
ThinkOrder lastOrder = thinkOrderService.getLastOrderByCardCode(card.getCode());
|
||||||
|
// 今天是否已经使用
|
||||||
|
long todayStart = DateUtil.beginOfDay(new Date()).getTime() / 1000;
|
||||||
|
long todayEnd = DateUtil.endOfDay(new Date()).getTime() / 1000;
|
||||||
|
if (lastOrder.getCreateTime() >= todayStart && lastOrder.getCreateTime() <= todayEnd) {
|
||||||
|
return fail("今天已使用");
|
||||||
|
}
|
||||||
|
thinkOrder.setReducePrice(totalPrice);
|
||||||
|
thinkOrder.setPayPrice(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
switch (card.getType()) {
|
||||||
|
// 年卡
|
||||||
|
case 1: {
|
||||||
|
thinkOrder.setPayType(10);
|
||||||
|
thinkOrder.setType(8);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// 次卡
|
||||||
|
case 2: {
|
||||||
|
thinkOrder.setPayType(11);
|
||||||
|
thinkOrder.setType(9);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// 月卡
|
||||||
|
case 3: {
|
||||||
|
thinkOrder.setPayType(9);
|
||||||
|
thinkOrder.setType(7);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// 余额卡
|
||||||
|
case 4: {
|
||||||
|
thinkOrder.setPayType(14);
|
||||||
|
thinkOrder.setType(10);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5: {
|
||||||
|
thinkOrder.setPayType(14);
|
||||||
|
thinkOrder.setType(13);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
thinkOrder.setPayPrice(totalPrice);
|
||||||
|
|
||||||
thinkOrder.setCreateTime(timestamp);
|
thinkOrder.setCreateTime(timestamp);
|
||||||
thinkOrder.setUpdateTime(timestamp);
|
thinkOrder.setUpdateTime(timestamp);
|
||||||
@@ -198,9 +484,14 @@ public class ThinkOrderController extends BaseController {
|
|||||||
if (thinkOrder1 == null) return fail("订单不存在");
|
if (thinkOrder1 == null) return fail("订单不存在");
|
||||||
if (thinkOrder1.getPayStatus().equals(1)) return fail("该订单已支付");
|
if (thinkOrder1.getPayStatus().equals(1)) return fail("该订单已支付");
|
||||||
if (thinkOrder1.getOrderStatus().equals(3)) return fail("该订单已取消");
|
if (thinkOrder1.getOrderStatus().equals(3)) return fail("该订单已取消");
|
||||||
|
List<ThinkOrderInfo> thinkOrderInfos = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
||||||
|
for (ThinkOrderInfo info : thinkOrderInfos) {
|
||||||
|
ThinkOrderInfo checkOrder = thinkOrderInfoService.checkOrder(info);
|
||||||
|
if (checkOrder != null) return fail("该场地已被预定");
|
||||||
|
}
|
||||||
|
|
||||||
String desc = thinkOrder1.getThinkOrderInfos().get(0).getSiteName() + "-" + thinkOrder1.getThinkOrderInfos().get(0).getFieldName();
|
String desc = thinkOrder1.getThinkOrderInfos().get(0).getSiteName() + "-" + thinkOrder1.getThinkOrderInfos().get(0).getFieldName();
|
||||||
return success("下单成功", thinkOrderService.createWxOrder(thinkOrder1.getTotalPrice(), thinkOrder1.getOrderNum(), desc,
|
return success("下单成功", thinkOrderService.createWxOrder(thinkOrder1.getPayPrice(), thinkOrder1.getOrderNum(), desc,
|
||||||
getLoginUser().getOpenid()));
|
getLoginUser().getOpenid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,9 +499,14 @@ public class ThinkOrderController extends BaseController {
|
|||||||
// 微信统一下单接口
|
// 微信统一下单接口
|
||||||
if (order.getPayType().equals(PAY_TYPE_WECHAT)) {
|
if (order.getPayType().equals(PAY_TYPE_WECHAT)) {
|
||||||
String desc = order.getThinkOrderInfos().get(0).getSiteName() + "-" + order.getThinkOrderInfos().get(0).getFieldName();
|
String desc = order.getThinkOrderInfos().get(0).getSiteName() + "-" + order.getThinkOrderInfos().get(0).getFieldName();
|
||||||
return success("下单成功", thinkOrderService.createWxOrder(order.getTotalPrice(), order.getOrderNum(), desc, getLoginUser().getOpenid()));
|
return success("下单成功", thinkOrderService.createWxOrder(order.getPayPrice(), order.getOrderNum(), desc, getLoginUser().getOpenid()));
|
||||||
|
}
|
||||||
|
if (order.getPayType() >= 6 || order.getPayType().equals(2)) {
|
||||||
|
order.setIsInvoice(3);
|
||||||
|
thinkOrderService.updateById(order);
|
||||||
|
updatePay(order, null, order.getTotalPrice().multiply(BigDecimal.valueOf(100)).intValue());
|
||||||
|
return success("支付成功", order.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
return fail("支付失败");
|
return fail("支付失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,4 +555,61 @@ public class ThinkOrderController extends BaseController {
|
|||||||
return fail("删除失败");
|
return fail("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public ApiResult<?> export(@RequestBody ThinkOrderParam param) throws IOException {
|
||||||
|
List<ThinkOrder> orderList = thinkOrderService.listRel(param);
|
||||||
|
String filename = "excel/财务报表-" + new Date().getTime() + ".xlsx";
|
||||||
|
String path = uploadPath + filename;
|
||||||
|
SXSSFWorkbook workbook = new SXSSFWorkbook();
|
||||||
|
//创建工作表单
|
||||||
|
SXSSFSheet sheet = workbook.createSheet();
|
||||||
|
sheet.setColumnWidth(0, 20 * 256);
|
||||||
|
sheet.setColumnWidth(1, 20 * 256);
|
||||||
|
sheet.setColumnWidth(2, 20 * 256);
|
||||||
|
sheet.setColumnWidth(3, 40 * 256);
|
||||||
|
sheet.setColumnWidth(4, 20 * 256);
|
||||||
|
|
||||||
|
SXSSFRow row = sheet.createRow(0);
|
||||||
|
String[] headers = {"场馆名称", "下单时间", "单位", "手机号", "实际转账单位/个人", "价格", "积分", "支付方式", "预付卡号", "预付卡到期时间"};
|
||||||
|
String[] payType = {"余额支付", "微信支付", "积分", "支付宝", "现金", "POS机", "VIP月卡", "VIP年卡", "VIP次卡", "IC月卡",
|
||||||
|
"IC年卡", "IC次卡", "免费", "VIP充值卡", "</a-tag>", "积分支付", "VIP季卡", "IC季卡"};
|
||||||
|
for (int i = 0; i < headers.length; i++) {
|
||||||
|
row.createCell(i).setCellValue(headers[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rowNum = 1;
|
||||||
|
for (ThinkOrder order : orderList) {
|
||||||
|
SXSSFRow orderRow = sheet.createRow(rowNum);
|
||||||
|
orderRow.createCell(0).setCellValue(order.getSiteName());
|
||||||
|
orderRow.createCell(1).setCellValue(DateUtil.format(DateUtil.date(order.getCreateTime() * 1000), "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
orderRow.createCell(2).setCellValue(order.getName());
|
||||||
|
orderRow.createCell(3).setCellValue(order.getPhone());
|
||||||
|
orderRow.createCell(4).setCellValue(order.getName());
|
||||||
|
orderRow.createCell(5).setCellValue(order.getTotalPrice().toString());
|
||||||
|
orderRow.createCell(6).setCellValue("0");
|
||||||
|
orderRow.createCell(7).setCellValue(payType[order.getPayType()]);
|
||||||
|
if (order.getCard() != null) {
|
||||||
|
orderRow.createCell(8).setCellValue(order.getCard().getCode());
|
||||||
|
orderRow.createCell(9).setCellValue(DateUtil.format(DateUtil.date(order.getCard().getExpireTime() * 1000), "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
if (order.getThinkVip() != null) {
|
||||||
|
orderRow.createCell(8).setCellValue(order.getThinkVip().getCode());
|
||||||
|
orderRow.createCell(9).setCellValue(DateUtil.format(DateUtil.date(order.getThinkVip().getExpireTime() * 1000), "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// sheet.addMergedRegion(new CellRangeAddress(rowNum, 0, 2, 2));
|
||||||
|
rowNum++;
|
||||||
|
}
|
||||||
|
FileOutputStream output = new FileOutputStream(path);
|
||||||
|
workbook.write(output);
|
||||||
|
output.flush();
|
||||||
|
|
||||||
|
FileRecord result = new FileRecord();
|
||||||
|
result.setCreateUserId(getLoginUserId());
|
||||||
|
result.setName(filename);
|
||||||
|
result.setPath(path);
|
||||||
|
result.setUrl(config.getServerUrl() + "/file/" + filename);
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.gxwebsoft.think.controller;
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.think.service.ThinkOrderRefundLogService;
|
import com.gxwebsoft.think.entity.*;
|
||||||
import com.gxwebsoft.think.entity.ThinkOrderRefundLog;
|
import com.gxwebsoft.think.service.*;
|
||||||
import com.gxwebsoft.think.param.ThinkOrderRefundLogParam;
|
import com.gxwebsoft.think.param.ThinkOrderRefundLogParam;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
@@ -10,13 +12,23 @@ import com.gxwebsoft.common.core.web.PageParam;
|
|||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.wechat.pay.java.core.notification.NotificationConfig;
|
||||||
|
import com.wechat.pay.java.core.notification.NotificationParser;
|
||||||
|
import com.wechat.pay.java.service.refund.model.Refund;
|
||||||
|
import com.wechat.pay.java.service.refund.model.RefundNotification;
|
||||||
|
import com.wechat.pay.java.service.refund.model.Status;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.wechat.pay.java.core.notification.RequestParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信退款记录控制器
|
* 微信退款记录控制器
|
||||||
@@ -30,6 +42,51 @@ import java.util.List;
|
|||||||
public class ThinkOrderRefundLogController extends BaseController {
|
public class ThinkOrderRefundLogController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkOrderRefundLogService thinkOrderRefundLogService;
|
private ThinkOrderRefundLogService thinkOrderRefundLogService;
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderService thinkOrderService;
|
||||||
|
@Resource
|
||||||
|
private WechatConfigService wechatConfigService;
|
||||||
|
@Resource
|
||||||
|
private ThinkVipCardsBillsService thinkVipCardsBillsService;
|
||||||
|
@Resource
|
||||||
|
private ThinkUsersVipService thinkUsersVipService;
|
||||||
|
@Resource
|
||||||
|
private ThinkCardService thinkCardService;
|
||||||
|
|
||||||
|
@PostMapping("/notify")
|
||||||
|
public ApiResult<?> refundNotify(@RequestBody String body, @RequestHeader Map<String, Object> header) {
|
||||||
|
System.out.println("refund body = " + body);
|
||||||
|
RequestParam requestParam = new RequestParam.Builder()
|
||||||
|
.serialNumber(header.get("wechatpay-serial").toString())
|
||||||
|
.nonce(header.get("wechatpay-nonce").toString())
|
||||||
|
.signature(header.get("wechatpay-signature").toString())
|
||||||
|
.timestamp(header.get("wechatpay-timestamp").toString())
|
||||||
|
.body(body)
|
||||||
|
.build();
|
||||||
|
NotificationConfig config = wechatConfigService.getNotificationConfig();
|
||||||
|
// 初始化 NotificationParser
|
||||||
|
NotificationParser parser = new NotificationParser(config);
|
||||||
|
RefundNotification notification = parser.parse(requestParam, RefundNotification.class);
|
||||||
|
System.out.println("notification = " + notification);
|
||||||
|
String refundNo = notification.getOutRefundNo();
|
||||||
|
ThinkOrderRefundLog thinkOrderRefundLog = thinkOrderRefundLogService.getByRefundNo(refundNo);
|
||||||
|
ThinkOrder thinkOrder = null;
|
||||||
|
if (thinkOrderRefundLog.getType().equals(0)) {
|
||||||
|
thinkOrder = thinkOrderService.getById(thinkOrderRefundLog.getOid());
|
||||||
|
}
|
||||||
|
if (notification.getRefundStatus().equals(Status.SUCCESS)) {
|
||||||
|
thinkOrderRefundLog.setStatus(2);
|
||||||
|
if (thinkOrder != null) thinkOrder.setOrderStatus(6);
|
||||||
|
|
||||||
|
} else if (notification.getRefundStatus().equals(Status.ABNORMAL) || notification.getRefundStatus().equals(Status.CLOSED)) {
|
||||||
|
thinkOrderRefundLog.setStatus(4);
|
||||||
|
if (thinkOrder != null) thinkOrder.setOrderStatus(5);
|
||||||
|
}
|
||||||
|
thinkOrderRefundLog.setJson(notification.toString());
|
||||||
|
thinkOrderRefundLogService.updateById(thinkOrderRefundLog);
|
||||||
|
if (thinkOrder != null) thinkOrderService.updateById(thinkOrder);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("分页查询微信退款记录")
|
@ApiOperation("分页查询微信退款记录")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@@ -56,6 +113,59 @@ public class ThinkOrderRefundLogController extends BaseController {
|
|||||||
@ApiOperation("添加微信退款记录")
|
@ApiOperation("添加微信退款记录")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ThinkOrderRefundLog thinkOrderRefundLog) {
|
public ApiResult<?> save(@RequestBody ThinkOrderRefundLog thinkOrderRefundLog) {
|
||||||
|
if (thinkOrderRefundLog.getType().equals(0)) {
|
||||||
|
ThinkOrder thinkOrder = thinkOrderService.getById(thinkOrderRefundLog.getOid());
|
||||||
|
thinkOrderRefundLog.setOrder(thinkOrder);
|
||||||
|
thinkOrderRefundLog.setRefundNo("R" + thinkOrder.getOrderNum());
|
||||||
|
thinkOrder.setOrderStatus(4);
|
||||||
|
thinkOrderService.updateById(thinkOrder);
|
||||||
|
if (thinkOrder.getPayType().equals(1)) {
|
||||||
|
thinkOrderService.refund(thinkOrderRefundLog);
|
||||||
|
}else {
|
||||||
|
thinkOrder.setOrderStatus(6);
|
||||||
|
thinkOrderService.updateById(thinkOrder);
|
||||||
|
if (thinkOrder.getVid() != null && thinkOrder.getVid() != 0) {
|
||||||
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
|
thinkVipCardsBills.setVid(thinkOrder.getVid());
|
||||||
|
thinkVipCardsBills.setUid(thinkOrder.getUid());
|
||||||
|
DateTime dateTime = DateUtil.date(Long.parseLong(thinkOrder.getStartTime()) * 1000L);
|
||||||
|
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||||
|
thinkVipCardsBillsService.cancelLog(thinkVipCardsBills);
|
||||||
|
|
||||||
|
ThinkUsersVip usersVip = thinkUsersVipService.getById(thinkOrder.getVid());
|
||||||
|
if (usersVip.getType().equals(5)) {
|
||||||
|
BigDecimal newBalance = usersVip.getRemainingMoney().add(thinkOrder.getPayPrice());
|
||||||
|
usersVip.setRemainingMoney(newBalance);
|
||||||
|
} else if (usersVip.getType().equals(4)) {
|
||||||
|
BigDecimal newBalance = usersVip.getRemainingMoney().add(usersVip.getEachMoney());
|
||||||
|
usersVip.setRemainingMoney(newBalance);
|
||||||
|
usersVip.setNum(usersVip.getNum() + 1);
|
||||||
|
} else {
|
||||||
|
usersVip.setNum(usersVip.getNum() + 1);
|
||||||
|
}
|
||||||
|
thinkUsersVipService.updateById(usersVip);
|
||||||
|
}
|
||||||
|
if (thinkOrder.getCid() != null && thinkOrder.getCid() != 0) {
|
||||||
|
ThinkCard card = thinkCardService.getByCode(thinkOrder.getCode());
|
||||||
|
if (card.getType().equals(5)) {
|
||||||
|
BigDecimal newBalance = card.getRemainingMoney().add(thinkOrder.getPayPrice());
|
||||||
|
card.setRemainingMoney(newBalance);
|
||||||
|
} else if (card.getType().equals(4)) {
|
||||||
|
BigDecimal newBalance = card.getRemainingMoney().add(card.getEachMoney());
|
||||||
|
card.setRemainingMoney(newBalance);
|
||||||
|
} else if (card.getType().equals(2)) {
|
||||||
|
card.setNum(card.getNum() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
|
thinkVipCardsBills.setCid(thinkOrder.getCid());
|
||||||
|
thinkVipCardsBills.setUid(thinkOrder.getUid());
|
||||||
|
DateTime dateTime = DateUtil.date(Long.parseLong(thinkOrder.getStartTime()) * 1000L);
|
||||||
|
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||||
|
thinkVipCardsBillsService.cancelLog(thinkVipCardsBills);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (thinkOrderRefundLogService.save(thinkOrderRefundLog)) {
|
if (thinkOrderRefundLogService.save(thinkOrderRefundLog)) {
|
||||||
return success("添加成功");
|
return success("添加成功");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,6 +42,9 @@ public class ThinkSiteController extends BaseController {
|
|||||||
@ApiOperation("查询全部")
|
@ApiOperation("查询全部")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<ThinkSite>> list(ThinkSiteParam param) {
|
public ApiResult<List<ThinkSite>> list(ThinkSiteParam param) {
|
||||||
|
if (param.getIds() != null) {
|
||||||
|
param.setIdList(Arrays.stream(param.getIds().split(",")).map(Integer::parseInt).toList());
|
||||||
|
}
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(thinkSiteService.listRel(param));
|
return success(thinkSiteService.listRel(param));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.think.controller;
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
@@ -8,6 +9,7 @@ import cn.hutool.core.util.RandomUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.think.entity.*;
|
import com.gxwebsoft.think.entity.*;
|
||||||
|
import com.gxwebsoft.think.param.ThinkOrderParam;
|
||||||
import com.gxwebsoft.think.service.*;
|
import com.gxwebsoft.think.service.*;
|
||||||
import com.gxwebsoft.think.param.ThinkUsersVipParam;
|
import com.gxwebsoft.think.param.ThinkUsersVipParam;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
@@ -26,10 +28,9 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 控制器
|
* 控制器
|
||||||
@@ -51,20 +52,28 @@ public class ThinkUsersVipController extends BaseController {
|
|||||||
private WechatConfigService wechatConfigService;
|
private WechatConfigService wechatConfigService;
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkSiteService thinkSiteService;
|
private ThinkSiteService thinkSiteService;
|
||||||
|
@Resource
|
||||||
|
private ThinkVipCardsBillsService thinkVipCardsBillsService;
|
||||||
|
|
||||||
@ApiOperation("分页查询")
|
@ApiOperation("分页查询")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<?> page(ThinkUsersVipParam param) {
|
public ApiResult<?> page(ThinkUsersVipParam param) {
|
||||||
if (getLoginUser() == null) return fail("请先登录");
|
if (param.getForAdmin() == null) {
|
||||||
param.setUid(getLoginUser().getUid());
|
if (getLoginUser() == null) return fail("请先登录");
|
||||||
|
param.setUid(getLoginUser().getUid());
|
||||||
|
}
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(thinkUsersVipService.pageRel(param));
|
return success(thinkUsersVipService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询全部")
|
@ApiOperation("查询全部")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<ThinkUsersVip>> list(ThinkUsersVipParam param) {
|
public ApiResult<?> list(ThinkUsersVipParam param) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
|
if (param.getForAdmin() == null) {
|
||||||
|
if (getLoginUser() == null) return fail("请先登录");
|
||||||
|
param.setUid(getLoginUser().getUid());
|
||||||
|
}
|
||||||
return success(thinkUsersVipService.listRel(param));
|
return success(thinkUsersVipService.listRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,16 +111,80 @@ public class ThinkUsersVipController extends BaseController {
|
|||||||
com.wechat.pay.java.service.payments.model.Transaction transaction = parser.parse(requestParam, com.wechat.pay.java.service.payments.model.Transaction.class);
|
com.wechat.pay.java.service.payments.model.Transaction transaction = parser.parse(requestParam, com.wechat.pay.java.service.payments.model.Transaction.class);
|
||||||
// 查询订单信息
|
// 查询订单信息
|
||||||
final ThinkUsersVip order = thinkUsersVipService.getByOrderNo(transaction.getOutTradeNo());
|
final ThinkUsersVip order = thinkUsersVipService.getByOrderNo(transaction.getOutTradeNo());
|
||||||
|
ThinkUsersVip usersVip = null;
|
||||||
if (order == null) return "订单不存在";
|
if (order == null) return "订单不存在";
|
||||||
|
usersVip = order;
|
||||||
if (order.getStatus().equals(2)) {
|
if (order.getStatus().equals(2)) {
|
||||||
// 2.更新订单支付状态
|
// 2.更新订单支付状态
|
||||||
order.setStatus(1);
|
order.setStatus(1);
|
||||||
order.setPayTime(DateUtil.currentSeconds());
|
order.setPayTime(DateUtil.currentSeconds());
|
||||||
order.setPrices(order.getTempPrices());
|
order.setPrices(order.getTempPrices());
|
||||||
// 充值卡
|
// 查找有没有一样的卡
|
||||||
if (order.getType().equals(4)) order.setRemainingMoney(order.getPrice());
|
ThinkUsersVip sameOrder = thinkUsersVipService.getByVidAndUid(order.getVid(), order.getUid());
|
||||||
else if (order.getType().equals(2)) order.setNum(order.getCount());
|
if (sameOrder != null) {
|
||||||
thinkUsersVipService.updateById(order);
|
usersVip = sameOrder;
|
||||||
|
// 是否已过期,过期的从现在开始计算,未过期的在旧卡基础上叠加
|
||||||
|
if (sameOrder.getExpireTime() < DateUtil.currentSeconds()) {
|
||||||
|
sameOrder.setExpireTime(DateUtil.currentSeconds() + (order.getTerm() * 86400 * 365) + (order.getMonth() * 86400 * 30));
|
||||||
|
} else {
|
||||||
|
sameOrder.setExpireTime(sameOrder.getExpireTime() + (order.getTerm() * 86400 * 365) + (order.getMonth() * 86400 * 30));
|
||||||
|
}
|
||||||
|
// 充值卡
|
||||||
|
if (sameOrder.getType().equals(4)) {
|
||||||
|
// 是否已过期,过期的清空,未过期的在旧卡基础上叠加
|
||||||
|
if (sameOrder.getExpireTime() < DateUtil.currentSeconds()) {
|
||||||
|
sameOrder.setRemainingMoney(order.getPrice());
|
||||||
|
} else {
|
||||||
|
sameOrder.setRemainingMoney(order.getPrice().add(sameOrder.getRemainingMoney()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (sameOrder.getExpireTime() < DateUtil.currentSeconds()) {
|
||||||
|
sameOrder.setNum(order.getCount());
|
||||||
|
} else {
|
||||||
|
sameOrder.setNum(sameOrder.getCount() + order.getCount());
|
||||||
|
}
|
||||||
|
sameOrder.setNum(sameOrder.getCount() + order.getCount());
|
||||||
|
}
|
||||||
|
thinkUsersVipService.updateById(sameOrder);
|
||||||
|
// 删除订单
|
||||||
|
thinkUsersVipService.removeById(order.getId());
|
||||||
|
} else {
|
||||||
|
// 充值卡
|
||||||
|
if (order.getType().equals(4)) order.setRemainingMoney(order.getPrice());
|
||||||
|
else order.setNum(order.getCount());
|
||||||
|
thinkUsersVipService.updateById(order);
|
||||||
|
}
|
||||||
|
if (usersVip != null) {
|
||||||
|
if (usersVip.getType().equals(1) || usersVip.getType().equals(3)) {
|
||||||
|
List<ThinkVipCardsBills> list = new ArrayList<>();
|
||||||
|
BigDecimal avgAmount = BigDecimal.ZERO;
|
||||||
|
int dayNum = 0;
|
||||||
|
BigDecimal totalAmountInAvg = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
|
if (usersVip.getType().equals(1)) {
|
||||||
|
totalAmount = usersVip.getPrice().multiply(new BigDecimal(usersVip.getTerm()));
|
||||||
|
avgAmount = totalAmount.divide(BigDecimal.valueOf(365).multiply(BigDecimal.valueOf(usersVip.getTerm())), RoundingMode.HALF_UP);
|
||||||
|
dayNum = 365 * usersVip.getTerm();
|
||||||
|
} else if (usersVip.getType().equals(3)) {
|
||||||
|
totalAmount = usersVip.getPrice().multiply(new BigDecimal(usersVip.getMonth()));
|
||||||
|
avgAmount = totalAmount.divide(BigDecimal.valueOf(30).multiply(BigDecimal.valueOf(usersVip.getMonth())), RoundingMode.HALF_UP);
|
||||||
|
dayNum = 30 * usersVip.getMonth();
|
||||||
|
}
|
||||||
|
totalAmountInAvg = avgAmount.multiply(BigDecimal.valueOf(dayNum - 1));
|
||||||
|
BigDecimal lastDayAmount = totalAmount.subtract(totalAmountInAvg);
|
||||||
|
for (int i = 0; i < dayNum; i++) {
|
||||||
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
|
thinkVipCardsBills.setUid(usersVip.getUid());
|
||||||
|
thinkVipCardsBills.setVid(usersVip.getId());
|
||||||
|
DateTime dateTime = DateUtil.date((usersVip.getCreateTime() * 1000L) + (i * 86400000L));
|
||||||
|
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||||
|
if (i == dayNum - 1) thinkVipCardsBills.setAmount(lastDayAmount);
|
||||||
|
else thinkVipCardsBills.setAmount(avgAmount);
|
||||||
|
list.add(thinkVipCardsBills);
|
||||||
|
}
|
||||||
|
thinkVipCardsBillsService.saveBatch(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return "订单已支付";
|
return "订单已支付";
|
||||||
|
|
||||||
@@ -177,6 +250,9 @@ public class ThinkUsersVipController extends BaseController {
|
|||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody ThinkUsersVip thinkUsersVip) {
|
public ApiResult<?> update(@RequestBody ThinkUsersVip thinkUsersVip) {
|
||||||
if (thinkUsersVipService.updateById(thinkUsersVip)) {
|
if (thinkUsersVipService.updateById(thinkUsersVip)) {
|
||||||
|
if (thinkUsersVip.getUid().equals(0)) {
|
||||||
|
thinkVipCardsBillsService.clearUid(thinkUsersVip.getId());
|
||||||
|
}
|
||||||
return success("修改成功");
|
return success("修改成功");
|
||||||
}
|
}
|
||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
@@ -218,4 +294,31 @@ public class ThinkUsersVipController extends BaseController {
|
|||||||
return fail("删除失败");
|
return fail("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("使用记录")
|
||||||
|
@GetMapping("/log/{id}")
|
||||||
|
public ApiResult<?> getLog(@PathVariable Integer id) {
|
||||||
|
List<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
ThinkUsersVip thinkUsersVip = thinkUsersVipService.getByIdRel(id);
|
||||||
|
System.out.println(DateUtil.currentSeconds());
|
||||||
|
long dayNum = (DateUtil.currentSeconds() - thinkUsersVip.getPayTime()) / 3600 / 24;
|
||||||
|
List<ThinkOrder> orderList = thinkOrderService.listRel(new ThinkOrderParam() {{
|
||||||
|
setVid(id);
|
||||||
|
setPayStatus(1);
|
||||||
|
}});
|
||||||
|
dayNum += 1;
|
||||||
|
for (int i = 0; i < dayNum; i++) {
|
||||||
|
Map<String, Object> data = new HashMap<>();
|
||||||
|
Date date = DateUtil.offsetDay(new Date(), -i);
|
||||||
|
data.put("date", DateUtil.format(date, "yyyy-MM-dd"));
|
||||||
|
data.put("order", null);
|
||||||
|
for (ThinkOrder thinkOrder : orderList) {
|
||||||
|
if (thinkOrder.getCreateTime() > (DateUtil.beginOfDay(date).getTime() / 1000) && thinkOrder.getCreateTime() < (DateUtil.endOfDay(date).getTime() / 1000)) {
|
||||||
|
data.put("order", thinkOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.add(data);
|
||||||
|
}
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,214 @@
|
|||||||
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkOrder;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkUsersVip;
|
||||||
|
import com.gxwebsoft.think.service.ThinkOrderService;
|
||||||
|
import com.gxwebsoft.think.service.ThinkUsersVipService;
|
||||||
|
import com.gxwebsoft.think.service.ThinkVipCardsBillsService;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkVipCardsBills;
|
||||||
|
import com.gxwebsoft.think.param.ThinkVipCardsBillsParam;
|
||||||
|
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 com.gxwebsoft.common.system.entity.User;
|
||||||
|
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.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vip卡每日账单控制器
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-25 16:41:01
|
||||||
|
*/
|
||||||
|
@Api(tags = "Vip卡每日账单管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/think/think-vip-cards-bills")
|
||||||
|
public class ThinkVipCardsBillsController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private ThinkVipCardsBillsService thinkVipCardsBillsService;
|
||||||
|
@Resource
|
||||||
|
private ThinkUsersVipService thinkUsersVipService;
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderService thinkOrderService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询Vip卡每日账单")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<ThinkVipCardsBills>> page(ThinkVipCardsBillsParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkVipCardsBillsService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/total-amount")
|
||||||
|
public ApiResult<?> totalAmount(ThinkVipCardsBillsParam param) {
|
||||||
|
List<ThinkVipCardsBills> list = thinkVipCardsBillsService.listRel(param);
|
||||||
|
return success(list.stream().map(ThinkVipCardsBills::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部Vip卡每日账单")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<ThinkVipCardsBills>> list(ThinkVipCardsBillsParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkVipCardsBillsService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('think:thinkVipCardsBills:list')")
|
||||||
|
@ApiOperation("根据id查询Vip卡每日账单")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<ThinkVipCardsBills> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkVipCardsBillsService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加Vip卡每日账单")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody ThinkVipCardsBills thinkVipCardsBills) {
|
||||||
|
if (thinkVipCardsBillsService.save(thinkVipCardsBills)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改Vip卡每日账单")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody ThinkVipCardsBills thinkVipCardsBills) {
|
||||||
|
if (thinkVipCardsBillsService.updateById(thinkVipCardsBills)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除Vip卡每日账单")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (thinkVipCardsBillsService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量添加Vip卡每日账单")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<ThinkVipCardsBills> list) {
|
||||||
|
if (thinkVipCardsBillsService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量修改Vip卡每日账单")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<ThinkVipCardsBills> batchParam) {
|
||||||
|
if (batchParam.update(thinkVipCardsBillsService, "id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量删除Vip卡每日账单")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (thinkVipCardsBillsService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/make-bill")
|
||||||
|
public void makeBill() {
|
||||||
|
List<ThinkUsersVip> usersVipList = thinkUsersVipService.list(
|
||||||
|
new LambdaQueryWrapper<ThinkUsersVip>()
|
||||||
|
.eq(ThinkUsersVip::getStatus, 1)
|
||||||
|
);
|
||||||
|
for (ThinkUsersVip usersVip : usersVipList) {
|
||||||
|
List<ThinkVipCardsBills> list = new ArrayList<>();
|
||||||
|
List<ThinkOrder> orderList = thinkOrderService.list(
|
||||||
|
new LambdaQueryWrapper<ThinkOrder>()
|
||||||
|
.eq(ThinkOrder::getVid, usersVip.getId())
|
||||||
|
.in(ThinkOrder::getPayStatus, 1)
|
||||||
|
.in(ThinkOrder::getOrderStatus, 1, 2)
|
||||||
|
);
|
||||||
|
BigDecimal avgAmount = BigDecimal.ZERO;
|
||||||
|
int dayNum = 0;
|
||||||
|
if (usersVip.getType().equals(1) || usersVip.getType().equals(3)) {
|
||||||
|
BigDecimal totalAmountInAvg = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
|
if (usersVip.getType().equals(1)) {
|
||||||
|
totalAmount = usersVip.getPrice().multiply(new BigDecimal(usersVip.getTerm()));
|
||||||
|
avgAmount = totalAmount.divide(BigDecimal.valueOf(365).multiply(BigDecimal.valueOf(usersVip.getTerm())), RoundingMode.HALF_UP);
|
||||||
|
dayNum = 365 * usersVip.getTerm();
|
||||||
|
} else if (usersVip.getType().equals(3)) {
|
||||||
|
totalAmount = usersVip.getPrice().multiply(new BigDecimal(usersVip.getMonth()));
|
||||||
|
avgAmount = totalAmount.divide(BigDecimal.valueOf(30).multiply(BigDecimal.valueOf(usersVip.getMonth())), RoundingMode.HALF_UP);
|
||||||
|
dayNum = 30 * usersVip.getMonth();
|
||||||
|
}
|
||||||
|
totalAmountInAvg = avgAmount.multiply(BigDecimal.valueOf(dayNum - 1));
|
||||||
|
BigDecimal lastDayAmount = totalAmount.subtract(totalAmountInAvg);
|
||||||
|
for (int i = 0; i < dayNum; i++) {
|
||||||
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
|
thinkVipCardsBills.setUid(usersVip.getUid());
|
||||||
|
thinkVipCardsBills.setVid(usersVip.getId());
|
||||||
|
DateTime dateTime = DateUtil.date((usersVip.getCreateTime() * 1000L) + (i * 86400000L));
|
||||||
|
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||||
|
if (i == dayNum - 1) thinkVipCardsBills.setAmount(lastDayAmount);
|
||||||
|
else thinkVipCardsBills.setAmount(avgAmount);
|
||||||
|
if (!orderList.isEmpty()) {
|
||||||
|
for (ThinkOrder thinkOrder : orderList) {
|
||||||
|
if (thinkOrder.getCreateTime() > (DateUtil.beginOfDay(dateTime).getTime() / 1000L) && thinkOrder.getCreateTime() < (DateUtil.endOfDay(dateTime).getTime() / 1000L)) {
|
||||||
|
thinkVipCardsBills.setUsed(1);
|
||||||
|
thinkVipCardsBills.setOid(thinkOrder.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.add(thinkVipCardsBills);
|
||||||
|
}
|
||||||
|
} else if (usersVip.getType().equals(2)) {
|
||||||
|
// 次卡
|
||||||
|
if (!orderList.isEmpty()) {
|
||||||
|
avgAmount = usersVip.getPrice().divide(BigDecimal.valueOf(usersVip.getCount()), RoundingMode.HALF_UP);
|
||||||
|
for (ThinkOrder thinkOrder : orderList) {
|
||||||
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
|
thinkVipCardsBills.setUid(usersVip.getUid());
|
||||||
|
thinkVipCardsBills.setVid(usersVip.getId());
|
||||||
|
DateTime dateTime = DateUtil.date((thinkOrder.getCreateTime() * 1000L));
|
||||||
|
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||||
|
thinkVipCardsBills.setAmount(avgAmount);
|
||||||
|
thinkVipCardsBills.setUsed(1);
|
||||||
|
thinkVipCardsBills.setOid(thinkOrder.getId());
|
||||||
|
list.add(thinkVipCardsBills);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (usersVip.getType().equals(4) || usersVip.getType().equals(5)) {
|
||||||
|
// 充值卡\折扣
|
||||||
|
if (!orderList.isEmpty()) {
|
||||||
|
for (ThinkOrder thinkOrder : orderList) {
|
||||||
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
|
thinkVipCardsBills.setUid(usersVip.getUid());
|
||||||
|
thinkVipCardsBills.setVid(usersVip.getId());
|
||||||
|
DateTime dateTime = DateUtil.date((thinkOrder.getCreateTime() * 1000L));
|
||||||
|
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||||
|
thinkVipCardsBills.setAmount(thinkOrder.getTotalPrice());
|
||||||
|
thinkVipCardsBills.setUsed(1);
|
||||||
|
thinkVipCardsBills.setOid(thinkOrder.getId());
|
||||||
|
list.add(thinkVipCardsBills);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
thinkVipCardsBillsService.saveBatch(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -48,6 +48,12 @@ public class ThinkVipController extends BaseController {
|
|||||||
return success(thinkVipService.listRel(param));
|
return success(thinkVipService.listRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/total")
|
||||||
|
public ApiResult<List<ThinkVip>> total(ThinkVipParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkVipService.total(param));
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("根据id查询")
|
@ApiOperation("根据id查询")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<ThinkVip> get(@PathVariable("id") Integer id) {
|
public ApiResult<ThinkVip> get(@PathVariable("id") Integer id) {
|
||||||
|
|||||||
@@ -87,4 +87,6 @@ public class NuoNuoOrder implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String invoiceTractorAndCombineH;
|
private String invoiceTractorAndCombineH;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private NuoNuoRealPropertyRentInfo realPropertyRentInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.gxwebsoft.think.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-05-25 17:20:15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "NuoNuo不动产经营租赁服务特定要素", description = "不动产经营租赁服务特定要素")
|
||||||
|
public class NuoNuoRealPropertyRentInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "不动产地址(传对应省市区中文名称--需与行政区划名称一致)")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String realPropertyAddress;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "详细地址(不动产地址+详细地址 总长度 最大120字符,且必须包含 街、路、村、乡、镇、道 关键词)")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String detailAddress;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "产权证书/不动产权证号")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String realPropertyCertificate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租赁开始日期(不能晚于租赁结束日期)")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String rentStartDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租赁结束日期(不能早于租赁开始日期)")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String rentEndDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "跨地(市)标志(0-否 1-是)")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String crossCityFlag;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -150,4 +151,9 @@ public class ThinkCard implements Serializable {
|
|||||||
@ApiModelProperty(value = "备注")
|
@ApiModelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<ThinkSite> siteList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer makeNum;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.gxwebsoft.think.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vip卡每日账单
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-25 16:41:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "ThinkCardsBills对象", description = "Vip卡每日账单")
|
||||||
|
public class ThinkCardsBills implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer uid;
|
||||||
|
|
||||||
|
private Integer cid;
|
||||||
|
|
||||||
|
private Integer used;
|
||||||
|
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租户id")
|
||||||
|
private Integer tenantId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0已发布, 1待审核 2已驳回 3违规内容")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@TableLogic
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "修改时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkCard vip;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkUsers user;
|
||||||
|
}
|
||||||
@@ -37,6 +37,8 @@ public class ThinkDeposit implements Serializable {
|
|||||||
@ApiModelProperty(value = "姓名")
|
@ApiModelProperty(value = "姓名")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
private String orderNum;
|
||||||
|
|
||||||
@ApiModelProperty(value = "手机号码")
|
@ApiModelProperty(value = "手机号码")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
@@ -51,8 +53,12 @@ public class ThinkDeposit implements Serializable {
|
|||||||
@ApiModelProperty(value = "管理员id")
|
@ApiModelProperty(value = "管理员id")
|
||||||
private Integer aid;
|
private Integer aid;
|
||||||
|
|
||||||
private Integer createTime;
|
private Long createTime;
|
||||||
|
|
||||||
private Integer updateTime;
|
private Long updateTime;
|
||||||
|
|
||||||
|
private Long refundTime;
|
||||||
|
|
||||||
|
private String failReason;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.gxwebsoft.think.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 押金物品
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-05 23:17:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "ThinkDepositItem对象", description = "押金物品")
|
||||||
|
public class ThinkDepositItem implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
private Integer siteId;
|
||||||
|
|
||||||
|
private String siteName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租户id")
|
||||||
|
private Integer tenantId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.think.entity;
|
package com.gxwebsoft.think.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -62,12 +63,14 @@ public class ThinkGoods implements Serializable {
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品简介")
|
@ApiModelProperty(value = "商品简介")
|
||||||
|
@TableField(value = "`desc`")
|
||||||
private String desc;
|
private String desc;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品详细介绍")
|
@ApiModelProperty(value = "商品详细介绍")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序")
|
@ApiModelProperty(value = "排序")
|
||||||
|
@TableField(value = "`sort`")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否需要发货:1是;0否")
|
@ApiModelProperty(value = "是否需要发货:1是;0否")
|
||||||
@@ -83,4 +86,7 @@ public class ThinkGoods implements Serializable {
|
|||||||
|
|
||||||
private Integer updateTime;
|
private Integer updateTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkGoodsCategory category;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.think.entity;
|
package com.gxwebsoft.think.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -8,6 +9,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -40,4 +42,6 @@ public class ThinkGoodsCategory implements Serializable {
|
|||||||
|
|
||||||
private Integer updateTime;
|
private Integer updateTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<ThinkGoods> goodsList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.think.entity;
|
package com.gxwebsoft.think.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -9,6 +10,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -75,4 +77,7 @@ public class ThinkGoodsOrder implements Serializable {
|
|||||||
@ApiModelProperty(value = "支付时间")
|
@ApiModelProperty(value = "支付时间")
|
||||||
private Integer payTime;
|
private Integer payTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<ThinkGoodsOrderInfo> infoList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,4 +90,14 @@ public class ThinkInvoice implements Serializable {
|
|||||||
|
|
||||||
private Integer vid;
|
private Integer vid;
|
||||||
|
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
private String rentStartDate;
|
||||||
|
|
||||||
|
private String rentEndDate;
|
||||||
|
|
||||||
|
private String size;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.gxwebsoft.think.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸机开门记录
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-11-28 18:22:35
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "ThinkMachineOpenLog对象", description = "闸机开门记录")
|
||||||
|
public class ThinkMachineOpenLog implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer orderId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租户id")
|
||||||
|
private Integer tenantId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0在线, 1离线")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@TableLogic
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "注册时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "修改时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String qrcode;
|
||||||
|
}
|
||||||
@@ -67,6 +67,9 @@ public class ThinkOrder implements Serializable {
|
|||||||
@ApiModelProperty(value = "订单总额")
|
@ApiModelProperty(value = "订单总额")
|
||||||
private BigDecimal totalPrice;
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
@ApiModelProperty(value = "减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格")
|
@ApiModelProperty(value = "减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格")
|
||||||
private BigDecimal reducePrice;
|
private BigDecimal reducePrice;
|
||||||
|
|
||||||
@@ -103,6 +106,10 @@ public class ThinkOrder implements Serializable {
|
|||||||
@ApiModelProperty(value = "二维码地址,保存订单号,支付成功后才生成")
|
@ApiModelProperty(value = "二维码地址,保存订单号,支付成功后才生成")
|
||||||
private String qrcode;
|
private String qrcode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "核销码生成时间戳")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String qrCodeTimestamp;
|
||||||
|
|
||||||
@ApiModelProperty(value = "优惠说明")
|
@ApiModelProperty(value = "优惠说明")
|
||||||
@TableField("`desc`")
|
@TableField("`desc`")
|
||||||
private String desc;
|
private String desc;
|
||||||
@@ -156,4 +163,10 @@ public class ThinkOrder implements Serializable {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String openid;
|
private String openid;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkCard card;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkUsersVip thinkVip;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.think.entity;
|
package com.gxwebsoft.think.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -8,6 +9,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,7 +24,7 @@ import java.time.LocalDateTime;
|
|||||||
public class ThinkOrderRefundLog implements Serializable {
|
public class ThinkOrderRefundLog implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId(value = "int", type = IdType.AUTO)
|
@TableId(value = "`int`", type = IdType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户ID")
|
@ApiModelProperty(value = "用户ID")
|
||||||
@@ -31,10 +33,20 @@ public class ThinkOrderRefundLog implements Serializable {
|
|||||||
@ApiModelProperty(value = "场馆ID")
|
@ApiModelProperty(value = "场馆ID")
|
||||||
private Integer sid;
|
private Integer sid;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "退款单号")
|
||||||
|
private String refundNo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "0订场 1会员卡 2")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "退款金额")
|
||||||
|
private BigDecimal refundAmount;
|
||||||
|
|
||||||
@ApiModelProperty(value = "订单ID")
|
@ApiModelProperty(value = "订单ID")
|
||||||
private Integer oid;
|
private Integer oid;
|
||||||
|
|
||||||
@ApiModelProperty(value = "参数json")
|
@ApiModelProperty(value = "参数json")
|
||||||
|
@TableField(value = "`json`")
|
||||||
private String json;
|
private String json;
|
||||||
|
|
||||||
@ApiModelProperty(value = "来源")
|
@ApiModelProperty(value = "来源")
|
||||||
@@ -46,4 +58,6 @@ public class ThinkOrderRefundLog implements Serializable {
|
|||||||
@ApiModelProperty(value = "创建时间")
|
@ApiModelProperty(value = "创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkOrder order;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,9 +38,30 @@ public class ThinkSite implements Serializable {
|
|||||||
@ApiModelProperty(value = "营业时间")
|
@ApiModelProperty(value = "营业时间")
|
||||||
private String businessTime;
|
private String businessTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "省")
|
||||||
|
private String province;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "市")
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区")
|
||||||
|
private String region;
|
||||||
|
|
||||||
@ApiModelProperty(value = "场馆地址")
|
@ApiModelProperty(value = "场馆地址")
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租赁开始日期(不能晚于租赁结束日期)")
|
||||||
|
private String rentStartDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租赁结束日期(不能早于租赁开始日期)")
|
||||||
|
private String rentEndDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "场馆面积")
|
||||||
|
private String size;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "产权证书/不动产权证号")
|
||||||
|
private String realPropertyCertificate;
|
||||||
|
|
||||||
@ApiModelProperty(value = "场馆介绍")
|
@ApiModelProperty(value = "场馆介绍")
|
||||||
private String info;
|
private String info;
|
||||||
|
|
||||||
@@ -75,6 +96,10 @@ public class ThinkSite implements Serializable {
|
|||||||
|
|
||||||
private String lng;
|
private String lng;
|
||||||
|
|
||||||
|
private Integer dailyMaxNum;
|
||||||
|
|
||||||
|
private Integer dailyNum;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private BigDecimal distance;
|
private BigDecimal distance;
|
||||||
|
|
||||||
|
|||||||
@@ -100,4 +100,34 @@ public class ThinkVip implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<ThinkVip> cardList;
|
private List<ThinkVip> cardList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer totalNum;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal wechatAmount;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal wechatActual;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal wechatRefund;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal posAmount;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal posActual;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal posRefund;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal cashAmount;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal cashActual;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal cashRefund;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.gxwebsoft.think.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vip卡每日账单
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-25 16:41:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "ThinkVipCardsBills对象", description = "Vip卡每日账单")
|
||||||
|
public class ThinkVipCardsBills implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer uid;
|
||||||
|
|
||||||
|
private Integer vid;
|
||||||
|
|
||||||
|
private Integer cid;
|
||||||
|
|
||||||
|
private Integer oid;
|
||||||
|
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
private Integer used;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租户id")
|
||||||
|
private Integer tenantId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0已发布, 1待审核 2已驳回 3违规内容")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@TableLogic
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "修改时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkUsersVip vip;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkCard card;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkUsers user;
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.gxwebsoft.think.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkCardsBills;
|
||||||
|
import com.gxwebsoft.think.param.ThinkCardsBillsParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vip卡每日账单Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-25 16:41:01
|
||||||
|
*/
|
||||||
|
public interface ThinkCardsBillsMapper extends BaseMapper<ThinkCardsBills> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkCardsBills>
|
||||||
|
*/
|
||||||
|
List<ThinkCardsBills> selectPageRel(@Param("page") IPage<ThinkCardsBills> page,
|
||||||
|
@Param("param") ThinkCardsBillsParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<ThinkCardsBills> selectListRel(@Param("param") ThinkCardsBillsParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.gxwebsoft.think.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkDepositItem;
|
||||||
|
import com.gxwebsoft.think.param.ThinkDepositItemParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 押金物品Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-05 23:17:01
|
||||||
|
*/
|
||||||
|
public interface ThinkDepositItemMapper extends BaseMapper<ThinkDepositItem> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkDepositItem>
|
||||||
|
*/
|
||||||
|
List<ThinkDepositItem> selectPageRel(@Param("page") IPage<ThinkDepositItem> page,
|
||||||
|
@Param("param") ThinkDepositItemParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<ThinkDepositItem> selectListRel(@Param("param") ThinkDepositItemParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.gxwebsoft.think.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkMachineOpenLog;
|
||||||
|
import com.gxwebsoft.think.param.ThinkMachineOpenLogParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸机开门记录Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-11-28 18:22:35
|
||||||
|
*/
|
||||||
|
public interface ThinkMachineOpenLogMapper extends BaseMapper<ThinkMachineOpenLog> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkMachineOpenLog>
|
||||||
|
*/
|
||||||
|
List<ThinkMachineOpenLog> selectPageRel(@Param("page") IPage<ThinkMachineOpenLog> page,
|
||||||
|
@Param("param") ThinkMachineOpenLogParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<ThinkMachineOpenLog> selectListRel(@Param("param") ThinkMachineOpenLogParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.gxwebsoft.think.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkVipCardsBills;
|
||||||
|
import com.gxwebsoft.think.param.ThinkVipCardsBillsParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vip卡每日账单Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-25 16:41:01
|
||||||
|
*/
|
||||||
|
public interface ThinkVipCardsBillsMapper extends BaseMapper<ThinkVipCardsBills> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkVipCardsBills>
|
||||||
|
*/
|
||||||
|
List<ThinkVipCardsBills> selectPageRel(@Param("page") IPage<ThinkVipCardsBills> page,
|
||||||
|
@Param("param") ThinkVipCardsBillsParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<ThinkVipCardsBills> selectListRel(@Param("param") ThinkVipCardsBillsParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -140,6 +140,7 @@
|
|||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY a.create_time DESC
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 分页查询 -->
|
<!-- 分页查询 -->
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?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.think.mapper.ThinkCardsBillsMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM think_cards_bills a
|
||||||
|
<where>
|
||||||
|
<if test="param.id != null">
|
||||||
|
AND a.id = #{param.id}
|
||||||
|
</if>
|
||||||
|
<if test="param.uid != null">
|
||||||
|
AND a.uid = #{param.uid}
|
||||||
|
</if>
|
||||||
|
<if test="param.cid != null">
|
||||||
|
AND a.cid = #{param.cid}
|
||||||
|
</if>
|
||||||
|
<if test="param.date != null">
|
||||||
|
AND a.date LIKE CONCAT('%', #{param.date}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.amount != null">
|
||||||
|
AND a.amount LIKE CONCAT('%', #{param.amount}, '%')
|
||||||
|
</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.createTimeStart != null">
|
||||||
|
AND a.create_time >= #{param.createTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeEnd != null">
|
||||||
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
|
</if>
|
||||||
|
<if test="param.dateStart != null">
|
||||||
|
AND a.date >= #{param.dateStart} AND a.date <= #{param.dateEnd}
|
||||||
|
</if>
|
||||||
|
<if test="param.keywords != null">
|
||||||
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.think.entity.ThinkCardsBills">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.think.entity.ThinkCardsBills">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?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.think.mapper.ThinkDepositItemMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM think_deposit_item a
|
||||||
|
<where>
|
||||||
|
<if test="param.id != null">
|
||||||
|
AND a.id = #{param.id}
|
||||||
|
</if>
|
||||||
|
<if test="param.siteId != null">
|
||||||
|
AND a.site_id = #{param.siteId}
|
||||||
|
</if>
|
||||||
|
<if test="param.title != null">
|
||||||
|
AND a.title LIKE CONCAT('%', #{param.title}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.amount != null">
|
||||||
|
AND a.amount = #{param.amount}
|
||||||
|
</if>
|
||||||
|
<if test="param.siteName != null">
|
||||||
|
AND a.site_name LIKE CONCAT('%', #{param.siteName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeStart != null">
|
||||||
|
AND a.create_time >= #{param.createTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeEnd != null">
|
||||||
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
|
</if>
|
||||||
|
<if test="param.keywords != null">
|
||||||
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.think.entity.ThinkDepositItem">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.think.entity.ThinkDepositItem">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
AND a.create_time <= #{param.createTimeEnd}
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null">
|
||||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
AND (a.title LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY a.id DESC
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 分页查询 -->
|
<!-- 分页查询 -->
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<?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.think.mapper.ThinkMachineOpenLogMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM think_machine_open_log a
|
||||||
|
<where>
|
||||||
|
<if test="param.id != null">
|
||||||
|
AND a.id = #{param.id}
|
||||||
|
</if>
|
||||||
|
<if test="param.orderId != null">
|
||||||
|
AND a.order_id = #{param.orderId}
|
||||||
|
</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.createTimeStart != null">
|
||||||
|
AND a.create_time >= #{param.createTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeEnd != null">
|
||||||
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
|
</if>
|
||||||
|
<if test="param.keywords != null">
|
||||||
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.think.entity.ThinkMachineOpenLog">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.think.entity.ThinkMachineOpenLog">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -10,6 +10,12 @@
|
|||||||
<if test="param.id != null">
|
<if test="param.id != null">
|
||||||
AND a.id = #{param.id}
|
AND a.id = #{param.id}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.idList != null">
|
||||||
|
AND a.id IN
|
||||||
|
<foreach collection="param.idList" item="id" separator="," open="(" close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="param.name != null">
|
<if test="param.name != null">
|
||||||
AND a.name LIKE CONCAT('%', #{param.name}, '%')
|
AND a.name LIKE CONCAT('%', #{param.name}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -61,9 +61,9 @@
|
|||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null">
|
||||||
AND (a.truename LIKE CONCAT('%', #{param.keywords}, '%')
|
AND (a.truename LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR a.id = #{param.keywords}
|
OR a.id = #{param.keywords}
|
||||||
OR a.phone = #{param.keywords}
|
OR a.phone LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR a.username = #{param.keywords}
|
OR a.username LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR a.idcard = #{param.keywords}
|
OR a.idcard LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|||||||
@@ -130,6 +130,7 @@
|
|||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY a.create_time DESC
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 分页查询 -->
|
<!-- 分页查询 -->
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?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.think.mapper.ThinkVipCardsBillsMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM think_vip_cards_bills a
|
||||||
|
<where>
|
||||||
|
<if test="param.id != null">
|
||||||
|
AND a.id = #{param.id}
|
||||||
|
</if>
|
||||||
|
<if test="param.uid != null">
|
||||||
|
AND a.uid = #{param.uid}
|
||||||
|
</if>
|
||||||
|
<if test="param.vid != null">
|
||||||
|
AND a.vid = #{param.vid}
|
||||||
|
</if>
|
||||||
|
<if test="param.date != null">
|
||||||
|
AND a.date LIKE CONCAT('%', #{param.date}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.amount != null">
|
||||||
|
AND a.amount LIKE CONCAT('%', #{param.amount}, '%')
|
||||||
|
</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.createTimeStart != null">
|
||||||
|
AND a.create_time >= #{param.createTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeEnd != null">
|
||||||
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
|
</if>
|
||||||
|
<if test="param.dateStart != null">
|
||||||
|
AND a.date >= #{param.dateStart} AND a.date <= #{param.dateEnd}
|
||||||
|
</if>
|
||||||
|
<if test="param.keywords != null">
|
||||||
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.think.entity.ThinkVipCardsBills">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.think.entity.ThinkVipCardsBills">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.gxwebsoft.think.param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vip卡每日账单查询参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-25 16:41:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "ThinkCardsBillsParam对象", description = "Vip卡每日账单查询参数")
|
||||||
|
public class ThinkCardsBillsParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer uid;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer cid;
|
||||||
|
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
private String amount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0已发布, 1待审核 2已驳回 3违规内容")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String dateStart;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String dateEnd;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.gxwebsoft.think.param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 押金物品查询参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-05 23:17:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "ThinkDepositItemParam对象", description = "押金物品查询参数")
|
||||||
|
public class ThinkDepositItemParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer siteId;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
private String siteName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.think.param;
|
package com.gxwebsoft.think.param;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||||
@@ -58,4 +59,6 @@ public class ThinkDepositParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer aid;
|
private Integer aid;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean forAdmin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.think.param;
|
package com.gxwebsoft.think.param;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||||
@@ -94,4 +95,7 @@ public class ThinkInvoiceParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer vid;
|
private Integer vid;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean forAdmin;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.gxwebsoft.think.param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸机开门记录查询参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-11-28 18:22:35
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "ThinkMachineOpenLogParam对象", description = "闸机开门记录查询参数")
|
||||||
|
public class ThinkMachineOpenLogParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer orderId;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.think.param;
|
package com.gxwebsoft.think.param;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||||
@@ -154,4 +155,6 @@ public class ThinkOrderParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer checkBill;
|
private Integer checkBill;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean forAdmin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.think.param;
|
package com.gxwebsoft.think.param;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||||
@@ -10,6 +11,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询参数
|
* 查询参数
|
||||||
@@ -76,4 +78,9 @@ public class ThinkSiteParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer weekendOpen;
|
private Integer weekendOpen;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String ids;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Integer> idList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.think.param;
|
package com.gxwebsoft.think.param;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||||
@@ -150,4 +151,6 @@ public class ThinkUsersVipParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer checkBill;
|
private Integer checkBill;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean forAdmin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.gxwebsoft.think.param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vip卡每日账单查询参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-25 16:41:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "ThinkVipCardsBillsParam对象", description = "Vip卡每日账单查询参数")
|
||||||
|
public class ThinkVipCardsBillsParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer uid;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer vid;
|
||||||
|
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
private String amount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0已发布, 1待审核 2已驳回 3违规内容")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String dateStart;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String dateEnd;
|
||||||
|
}
|
||||||
@@ -40,5 +40,9 @@ public interface ThinkCardService extends IService<ThinkCard> {
|
|||||||
*/
|
*/
|
||||||
ThinkCard getByIdRel(Integer id);
|
ThinkCard getByIdRel(Integer id);
|
||||||
|
|
||||||
|
ThinkCard getByCode(String code);
|
||||||
|
|
||||||
List<ThinkCard> userCard(ThinkUsers user);
|
List<ThinkCard> userCard(ThinkUsers user);
|
||||||
|
|
||||||
|
List<ThinkCard> listByCodeList(List<String> codeList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.gxwebsoft.think.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkCardsBills;
|
||||||
|
import com.gxwebsoft.think.param.ThinkCardsBillsParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vip卡每日账单Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-25 16:41:01
|
||||||
|
*/
|
||||||
|
public interface ThinkCardsBillsService extends IService<ThinkCardsBills> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<ThinkCardsBills>
|
||||||
|
*/
|
||||||
|
PageResult<ThinkCardsBills> pageRel(ThinkCardsBillsParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkCardsBills>
|
||||||
|
*/
|
||||||
|
List<ThinkCardsBills> listRel(ThinkCardsBillsParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return ThinkCardsBills
|
||||||
|
*/
|
||||||
|
ThinkCardsBills getByIdRel(Integer id);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.gxwebsoft.think.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkDepositItem;
|
||||||
|
import com.gxwebsoft.think.param.ThinkDepositItemParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 押金物品Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-05 23:17:01
|
||||||
|
*/
|
||||||
|
public interface ThinkDepositItemService extends IService<ThinkDepositItem> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<ThinkDepositItem>
|
||||||
|
*/
|
||||||
|
PageResult<ThinkDepositItem> pageRel(ThinkDepositItemParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkDepositItem>
|
||||||
|
*/
|
||||||
|
List<ThinkDepositItem> listRel(ThinkDepositItemParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return ThinkDepositItem
|
||||||
|
*/
|
||||||
|
ThinkDepositItem getByIdRel(Integer id);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.think.entity.ThinkDeposit;
|
import com.gxwebsoft.think.entity.ThinkDeposit;
|
||||||
import com.gxwebsoft.think.param.ThinkDepositParam;
|
import com.gxwebsoft.think.param.ThinkDepositParam;
|
||||||
|
import com.wechat.pay.java.service.refund.model.Refund;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -39,4 +40,7 @@ public interface ThinkDepositService extends IService<ThinkDeposit> {
|
|||||||
*/
|
*/
|
||||||
ThinkDeposit getByIdRel(Integer id);
|
ThinkDeposit getByIdRel(Integer id);
|
||||||
|
|
||||||
|
ThinkDeposit getByOrderNo(String orderNo);
|
||||||
|
|
||||||
|
Refund refund(ThinkDeposit thinkDeposit);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,5 @@ public interface ThinkGoodsOrderInfoService extends IService<ThinkGoodsOrderInfo
|
|||||||
*/
|
*/
|
||||||
ThinkGoodsOrderInfo getByIdRel(Integer id);
|
ThinkGoodsOrderInfo getByIdRel(Integer id);
|
||||||
|
|
||||||
|
List<ThinkGoodsOrderInfo> listInOrder(Integer oid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,5 @@ public interface ThinkGoodsOrderService extends IService<ThinkGoodsOrder> {
|
|||||||
*/
|
*/
|
||||||
ThinkGoodsOrder getByIdRel(Integer id);
|
ThinkGoodsOrder getByIdRel(Integer id);
|
||||||
|
|
||||||
|
ThinkGoodsOrder getByOrderNum(String orderNum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,5 @@ public interface ThinkIntegralService extends IService<ThinkIntegral> {
|
|||||||
*/
|
*/
|
||||||
ThinkIntegral getByIdRel(Integer id);
|
ThinkIntegral getByIdRel(Integer id);
|
||||||
|
|
||||||
|
ThinkIntegral check(Integer uid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.gxwebsoft.think.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkMachineOpenLog;
|
||||||
|
import com.gxwebsoft.think.param.ThinkMachineOpenLogParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸机开门记录Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-11-28 18:22:35
|
||||||
|
*/
|
||||||
|
public interface ThinkMachineOpenLogService extends IService<ThinkMachineOpenLog> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<ThinkMachineOpenLog>
|
||||||
|
*/
|
||||||
|
PageResult<ThinkMachineOpenLog> pageRel(ThinkMachineOpenLogParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkMachineOpenLog>
|
||||||
|
*/
|
||||||
|
List<ThinkMachineOpenLog> listRel(ThinkMachineOpenLogParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return ThinkMachineOpenLog
|
||||||
|
*/
|
||||||
|
ThinkMachineOpenLog getByIdRel(Integer id);
|
||||||
|
|
||||||
|
ThinkMachineOpenLog getByOrderId(Integer orderId);
|
||||||
|
}
|
||||||
@@ -40,4 +40,6 @@ public interface ThinkOrderInfoService extends IService<ThinkOrderInfo> {
|
|||||||
ThinkOrderInfo getByIdRel(Integer id);
|
ThinkOrderInfo getByIdRel(Integer id);
|
||||||
|
|
||||||
List<ThinkOrderInfo> listInOrder(Integer orderId);
|
List<ThinkOrderInfo> listInOrder(Integer orderId);
|
||||||
|
|
||||||
|
ThinkOrderInfo checkOrder(ThinkOrderInfo thinkOrderInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,5 @@ public interface ThinkOrderRefundLogService extends IService<ThinkOrderRefundLog
|
|||||||
*/
|
*/
|
||||||
ThinkOrderRefundLog getByIdRel(Integer id);
|
ThinkOrderRefundLog getByIdRel(Integer id);
|
||||||
|
|
||||||
|
ThinkOrderRefundLog getByRefundNo(String refundNo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,14 @@ package com.gxwebsoft.think.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.think.entity.ThinkOrder;
|
import com.gxwebsoft.think.entity.ThinkOrder;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkOrderRefundLog;
|
||||||
import com.gxwebsoft.think.param.ThinkOrderParam;
|
import com.gxwebsoft.think.param.ThinkOrderParam;
|
||||||
|
import com.wechat.pay.java.service.refund.model.Refund;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service
|
* Service
|
||||||
@@ -41,6 +44,8 @@ public interface ThinkOrderService extends IService<ThinkOrder> {
|
|||||||
*/
|
*/
|
||||||
ThinkOrder getByIdRel(Integer id);
|
ThinkOrder getByIdRel(Integer id);
|
||||||
|
|
||||||
|
Map<String, Object> getByQrCode(String qrCode);
|
||||||
|
|
||||||
ThinkOrder getByOrderNum(String orderNum);
|
ThinkOrder getByOrderNum(String orderNum);
|
||||||
|
|
||||||
// HashMap<String, String> createWxOrder(ThinkOrder order);
|
// HashMap<String, String> createWxOrder(ThinkOrder order);
|
||||||
@@ -48,4 +53,11 @@ public interface ThinkOrderService extends IService<ThinkOrder> {
|
|||||||
HashMap<String, String> createWxOrder(BigDecimal totalPrice, String orderNo, String desc, String openid);
|
HashMap<String, String> createWxOrder(BigDecimal totalPrice, String orderNo, String desc, String openid);
|
||||||
|
|
||||||
HashMap<String, String> createWxOrder(BigDecimal totalPrice, String orderNo, String desc, String openid, String notify);
|
HashMap<String, String> createWxOrder(BigDecimal totalPrice, String orderNo, String desc, String openid, String notify);
|
||||||
|
|
||||||
|
Refund refund(ThinkOrderRefundLog orderRefund);
|
||||||
|
|
||||||
|
ThinkOrder getLastOrderByVid(Integer vid);
|
||||||
|
|
||||||
|
ThinkOrder getLastOrderByCardCode(String code);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,4 +40,6 @@ public interface ThinkUsersVipService extends IService<ThinkUsersVip> {
|
|||||||
ThinkUsersVip getByIdRel(Integer id);
|
ThinkUsersVip getByIdRel(Integer id);
|
||||||
|
|
||||||
ThinkUsersVip getByOrderNo(String orderNo);
|
ThinkUsersVip getByOrderNo(String orderNo);
|
||||||
|
|
||||||
|
ThinkUsersVip getByVidAndUid(Integer vid, Integer uid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.gxwebsoft.think.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkVipCardsBills;
|
||||||
|
import com.gxwebsoft.think.param.ThinkVipCardsBillsParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vip卡每日账单Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-25 16:41:01
|
||||||
|
*/
|
||||||
|
public interface ThinkVipCardsBillsService extends IService<ThinkVipCardsBills> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<ThinkVipCardsBills>
|
||||||
|
*/
|
||||||
|
PageResult<ThinkVipCardsBills> pageRel(ThinkVipCardsBillsParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkVipCardsBills>
|
||||||
|
*/
|
||||||
|
List<ThinkVipCardsBills> listRel(ThinkVipCardsBillsParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return ThinkVipCardsBills
|
||||||
|
*/
|
||||||
|
ThinkVipCardsBills getByIdRel(Integer id);
|
||||||
|
|
||||||
|
void clearUid(Integer vid);
|
||||||
|
|
||||||
|
void setUid(Integer vid, Integer uid);
|
||||||
|
|
||||||
|
void setCardUid(Integer cid, Integer uid);
|
||||||
|
|
||||||
|
void addLog(ThinkVipCardsBills thinkVipCardsBills);
|
||||||
|
|
||||||
|
void cancelLog(ThinkVipCardsBills thinkVipCardsBills);
|
||||||
|
}
|
||||||
@@ -40,4 +40,6 @@ public interface ThinkVipService extends IService<ThinkVip> {
|
|||||||
ThinkVip getByIdRel(Integer id);
|
ThinkVip getByIdRel(Integer id);
|
||||||
|
|
||||||
List<ThinkVip> listByGroup(ThinkVipParam param);
|
List<ThinkVip> listByGroup(ThinkVipParam param);
|
||||||
|
|
||||||
|
List<ThinkVip> total(ThinkVipParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.gxwebsoft.think.service.impl;
|
package com.gxwebsoft.think.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.think.entity.ThinkUsers;
|
import com.gxwebsoft.think.entity.ThinkUsers;
|
||||||
@@ -10,8 +9,11 @@ import com.gxwebsoft.think.entity.ThinkCard;
|
|||||||
import com.gxwebsoft.think.param.ThinkCardParam;
|
import com.gxwebsoft.think.param.ThinkCardParam;
|
||||||
import com.gxwebsoft.common.core.web.PageParam;
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.think.service.ThinkSiteService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,12 +24,18 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ThinkCardServiceImpl extends ServiceImpl<ThinkCardMapper, ThinkCard> implements ThinkCardService {
|
public class ThinkCardServiceImpl extends ServiceImpl<ThinkCardMapper, ThinkCard> implements ThinkCardService {
|
||||||
|
@Resource
|
||||||
|
private ThinkSiteService thinkSiteService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ThinkCard> pageRel(ThinkCardParam param) {
|
public PageResult<ThinkCard> pageRel(ThinkCardParam param) {
|
||||||
PageParam<ThinkCard, ThinkCardParam> page = new PageParam<>(param);
|
PageParam<ThinkCard, ThinkCardParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("id desc, create_time desc");
|
page.setDefaultOrder("id desc, create_time desc");
|
||||||
List<ThinkCard> list = baseMapper.selectPageRel(page, param);
|
List<ThinkCard> list = baseMapper.selectPageRel(page, param);
|
||||||
|
for (ThinkCard item : list) {
|
||||||
|
String[] sids = item.getSid().split(",");
|
||||||
|
item.setSiteList(thinkSiteService.listByIds(Arrays.stream(sids).map(Integer::valueOf).toList()));
|
||||||
|
}
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,6 +55,13 @@ public class ThinkCardServiceImpl extends ServiceImpl<ThinkCardMapper, ThinkCard
|
|||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkCard getByCode(String code) {
|
||||||
|
ThinkCardParam param = new ThinkCardParam();
|
||||||
|
param.setCode(code);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ThinkCard> userCard(ThinkUsers user) {
|
public List<ThinkCard> userCard(ThinkUsers user) {
|
||||||
return list(
|
return list(
|
||||||
@@ -55,8 +70,17 @@ public class ThinkCardServiceImpl extends ServiceImpl<ThinkCardMapper, ThinkCard
|
|||||||
.eq(ThinkCard::getStatus, 1)
|
.eq(ThinkCard::getStatus, 1)
|
||||||
.isNotNull(ThinkCard::getExpireTime)
|
.isNotNull(ThinkCard::getExpireTime)
|
||||||
.and(w -> w.or(w1 -> w1.gt(ThinkCard::getNum, 0))
|
.and(w -> w.or(w1 -> w1.gt(ThinkCard::getNum, 0))
|
||||||
.or(w2 -> w2.gt(ThinkCard::getRemainingMoney, 0)))
|
.or(w2 -> w2.gt(ThinkCard::getRemainingMoney, 0))
|
||||||
.last("AND expire_time > UNIX_TIMESTAMP()")
|
.or(w3 -> w3.last(" expire_time > UNIX_TIMESTAMP()"))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkCard> listByCodeList(List<String> codeList) {
|
||||||
|
return list(
|
||||||
|
new LambdaQueryWrapper<ThinkCard>()
|
||||||
|
.in(ThinkCard::getCode, codeList)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.gxwebsoft.think.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.think.mapper.ThinkCardsBillsMapper;
|
||||||
|
import com.gxwebsoft.think.service.ThinkCardService;
|
||||||
|
import com.gxwebsoft.think.service.ThinkCardsBillsService;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkCardsBills;
|
||||||
|
import com.gxwebsoft.think.param.ThinkCardsBillsParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.think.service.ThinkUsersService;
|
||||||
|
import com.gxwebsoft.think.service.ThinkVipService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vip卡每日账单Service实现
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-12-25 16:41:01
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ThinkCardsBillsServiceImpl extends ServiceImpl<ThinkCardsBillsMapper, ThinkCardsBills> implements ThinkCardsBillsService {
|
||||||
|
@Resource
|
||||||
|
private ThinkCardService thinkCardService;
|
||||||
|
@Resource
|
||||||
|
private ThinkUsersService thinkUsersService;
|
||||||
|
@Override
|
||||||
|
public PageResult<ThinkCardsBills> pageRel(ThinkCardsBillsParam param) {
|
||||||
|
PageParam<ThinkCardsBills, ThinkCardsBillsParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
List<ThinkCardsBills> list = baseMapper.selectPageRel(page, param);
|
||||||
|
for (ThinkCardsBills thinkCardsBills : list) {
|
||||||
|
thinkCardsBills.setVip(thinkCardService.getById(thinkCardsBills.getCid()));
|
||||||
|
thinkCardsBills.setUser(thinkUsersService.getById(thinkCardsBills.getUid()));
|
||||||
|
}
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkCardsBills> listRel(ThinkCardsBillsParam param) {
|
||||||
|
List<ThinkCardsBills> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<ThinkCardsBills, ThinkCardsBillsParam> page = new PageParam<>();
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkCardsBills getByIdRel(Integer id) {
|
||||||
|
ThinkCardsBillsParam param = new ThinkCardsBillsParam();
|
||||||
|
param.setId(id);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.gxwebsoft.think.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.think.mapper.ThinkDepositItemMapper;
|
||||||
|
import com.gxwebsoft.think.service.ThinkDepositItemService;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkDepositItem;
|
||||||
|
import com.gxwebsoft.think.param.ThinkDepositItemParam;
|
||||||
|
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 2024-12-05 23:17:01
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ThinkDepositItemServiceImpl extends ServiceImpl<ThinkDepositItemMapper, ThinkDepositItem> implements ThinkDepositItemService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ThinkDepositItem> pageRel(ThinkDepositItemParam param) {
|
||||||
|
PageParam<ThinkDepositItem, ThinkDepositItemParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
List<ThinkDepositItem> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkDepositItem> listRel(ThinkDepositItemParam param) {
|
||||||
|
List<ThinkDepositItem> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<ThinkDepositItem, ThinkDepositItemParam> page = new PageParam<>();
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkDepositItem getByIdRel(Integer id) {
|
||||||
|
ThinkDepositItemParam param = new ThinkDepositItemParam();
|
||||||
|
param.setId(id);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.think.service.impl;
|
package com.gxwebsoft.think.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.think.mapper.ThinkDepositMapper;
|
import com.gxwebsoft.think.mapper.ThinkDepositMapper;
|
||||||
import com.gxwebsoft.think.service.ThinkDepositService;
|
import com.gxwebsoft.think.service.ThinkDepositService;
|
||||||
@@ -7,8 +8,16 @@ import com.gxwebsoft.think.entity.ThinkDeposit;
|
|||||||
import com.gxwebsoft.think.param.ThinkDepositParam;
|
import com.gxwebsoft.think.param.ThinkDepositParam;
|
||||||
import com.gxwebsoft.common.core.web.PageParam;
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.think.service.WechatConfigService;
|
||||||
|
import com.wechat.pay.java.core.Config;
|
||||||
|
import com.wechat.pay.java.service.refund.RefundService;
|
||||||
|
import com.wechat.pay.java.service.refund.model.AmountReq;
|
||||||
|
import com.wechat.pay.java.service.refund.model.CreateRequest;
|
||||||
|
import com.wechat.pay.java.service.refund.model.Refund;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,6 +28,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ThinkDepositServiceImpl extends ServiceImpl<ThinkDepositMapper, ThinkDeposit> implements ThinkDepositService {
|
public class ThinkDepositServiceImpl extends ServiceImpl<ThinkDepositMapper, ThinkDeposit> implements ThinkDepositService {
|
||||||
|
@Resource
|
||||||
|
private WechatConfigService wechatConfigService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ThinkDeposit> pageRel(ThinkDepositParam param) {
|
public PageResult<ThinkDeposit> pageRel(ThinkDepositParam param) {
|
||||||
@@ -44,4 +55,29 @@ public class ThinkDepositServiceImpl extends ServiceImpl<ThinkDepositMapper, Thi
|
|||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkDeposit getByOrderNo(String orderNo) {
|
||||||
|
return getOne(
|
||||||
|
new LambdaQueryWrapper<ThinkDeposit>()
|
||||||
|
.eq(ThinkDeposit::getOrderNum, orderNo)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Refund refund(ThinkDeposit thinkDeposit) {
|
||||||
|
Config wxConfig = wechatConfigService.getConfig();
|
||||||
|
RefundService service = new RefundService.Builder().config(wxConfig).build();
|
||||||
|
CreateRequest request = new CreateRequest();
|
||||||
|
String refundNotifyUrl = "https://gxtyzx-api.websoft.top/api/think/think-deposit/refund-notify";
|
||||||
|
// 金额
|
||||||
|
AmountReq amount = new AmountReq();
|
||||||
|
amount.setTotal(thinkDeposit.getMoney().multiply(BigDecimal.valueOf(100)).longValue());
|
||||||
|
amount.setRefund(thinkDeposit.getMoney().multiply(BigDecimal.valueOf(100)).longValue());
|
||||||
|
amount.setCurrency("CNY");
|
||||||
|
request.setNotifyUrl(refundNotifyUrl);
|
||||||
|
request.setAmount(amount);
|
||||||
|
request.setOutTradeNo(thinkDeposit.getOrderNum());
|
||||||
|
request.setOutRefundNo("R" + thinkDeposit.getOrderNum());
|
||||||
|
return service.create(request);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ public class ThinkFieldServiceImpl extends ServiceImpl<ThinkFieldMapper, ThinkFi
|
|||||||
List<ThinkField> list = list(
|
List<ThinkField> list = list(
|
||||||
new LambdaQueryWrapper<ThinkField>()
|
new LambdaQueryWrapper<ThinkField>()
|
||||||
.eq(ThinkField::getSid, param.getSid())
|
.eq(ThinkField::getSid, param.getSid())
|
||||||
|
.orderByDesc(ThinkField::getSort)
|
||||||
);
|
);
|
||||||
List<ThinkOrder> orderList = new ArrayList<>();
|
List<ThinkOrder> orderList = new ArrayList<>();
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
@@ -94,17 +95,25 @@ public class ThinkFieldServiceImpl extends ServiceImpl<ThinkFieldMapper, ThinkFi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (FieldPeriodVo fieldPeriodVo : param.getPeriodVoList()) {
|
|
||||||
fieldPeriodVo.setSold(false);
|
|
||||||
}
|
|
||||||
for (ThinkField field : list) {
|
for (ThinkField field : list) {
|
||||||
List<FieldPeriodVo> tmpFieldPeriodVoList = param.getPeriodVoList();
|
List<FieldPeriodVo> tmpFieldPeriodVoList = new ArrayList<>();
|
||||||
if (!orderList.isEmpty()) {
|
for (FieldPeriodVo fieldPeriodVo : ObjectUtil.clone(param.getPeriodVoList())) {
|
||||||
for (ThinkOrder order : orderList) {
|
FieldPeriodVo tmpFieldPeriodVo = new FieldPeriodVo();
|
||||||
if (field.getId().equals(order.getFid())) {
|
tmpFieldPeriodVo.setPeriod(fieldPeriodVo.getPeriod());
|
||||||
for (FieldPeriodVo fieldPeriodVo : tmpFieldPeriodVoList) {
|
tmpFieldPeriodVo.setTimestamp(fieldPeriodVo.getTimestamp());
|
||||||
if (fieldPeriodVo.getTimestamp().equals(order.getStartTime())) {
|
tmpFieldPeriodVo.setSold(false);
|
||||||
fieldPeriodVo.setSold(true);
|
tmpFieldPeriodVo.setId(fieldPeriodVo.getId());
|
||||||
|
tmpFieldPeriodVoList.add(tmpFieldPeriodVo);
|
||||||
|
}
|
||||||
|
if (field.getIsRepeat().equals(2)) {
|
||||||
|
if (!orderList.isEmpty()) {
|
||||||
|
for (ThinkOrder order : orderList) {
|
||||||
|
if (field.getId().equals(order.getFid())) {
|
||||||
|
for (FieldPeriodVo fieldPeriodVo : tmpFieldPeriodVoList) {
|
||||||
|
if (fieldPeriodVo.getTimestamp().equals(order.getStartTime())) {
|
||||||
|
fieldPeriodVo.setSold(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,16 @@ package com.gxwebsoft.think.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.think.mapper.ThinkGoodsCategoryMapper;
|
import com.gxwebsoft.think.mapper.ThinkGoodsCategoryMapper;
|
||||||
|
import com.gxwebsoft.think.param.ThinkGoodsParam;
|
||||||
import com.gxwebsoft.think.service.ThinkGoodsCategoryService;
|
import com.gxwebsoft.think.service.ThinkGoodsCategoryService;
|
||||||
import com.gxwebsoft.think.entity.ThinkGoodsCategory;
|
import com.gxwebsoft.think.entity.ThinkGoodsCategory;
|
||||||
import com.gxwebsoft.think.param.ThinkGoodsCategoryParam;
|
import com.gxwebsoft.think.param.ThinkGoodsCategoryParam;
|
||||||
import com.gxwebsoft.common.core.web.PageParam;
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.think.service.ThinkGoodsService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,6 +23,9 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class ThinkGoodsCategoryServiceImpl extends ServiceImpl<ThinkGoodsCategoryMapper, ThinkGoodsCategory> implements ThinkGoodsCategoryService {
|
public class ThinkGoodsCategoryServiceImpl extends ServiceImpl<ThinkGoodsCategoryMapper, ThinkGoodsCategory> implements ThinkGoodsCategoryService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ThinkGoodsService thinkGoodsService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ThinkGoodsCategory> pageRel(ThinkGoodsCategoryParam param) {
|
public PageResult<ThinkGoodsCategory> pageRel(ThinkGoodsCategoryParam param) {
|
||||||
PageParam<ThinkGoodsCategory, ThinkGoodsCategoryParam> page = new PageParam<>(param);
|
PageParam<ThinkGoodsCategory, ThinkGoodsCategoryParam> page = new PageParam<>(param);
|
||||||
@@ -34,6 +40,12 @@ public class ThinkGoodsCategoryServiceImpl extends ServiceImpl<ThinkGoodsCategor
|
|||||||
// 排序
|
// 排序
|
||||||
PageParam<ThinkGoodsCategory, ThinkGoodsCategoryParam> page = new PageParam<>();
|
PageParam<ThinkGoodsCategory, ThinkGoodsCategoryParam> page = new PageParam<>();
|
||||||
page.setDefaultOrder("create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
|
for (ThinkGoodsCategory thinkGoodsCategory : list) {
|
||||||
|
thinkGoodsCategory.setGoodsList(thinkGoodsService.listRel(new ThinkGoodsParam() {{
|
||||||
|
setCid(thinkGoodsCategory.getId());
|
||||||
|
setStatus(1);
|
||||||
|
}}));
|
||||||
|
}
|
||||||
return page.sortRecords(list);
|
return page.sortRecords(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.think.service.impl;
|
package com.gxwebsoft.think.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.think.mapper.ThinkGoodsOrderInfoMapper;
|
import com.gxwebsoft.think.mapper.ThinkGoodsOrderInfoMapper;
|
||||||
import com.gxwebsoft.think.service.ThinkGoodsOrderInfoService;
|
import com.gxwebsoft.think.service.ThinkGoodsOrderInfoService;
|
||||||
@@ -44,4 +45,12 @@ public class ThinkGoodsOrderInfoServiceImpl extends ServiceImpl<ThinkGoodsOrderI
|
|||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkGoodsOrderInfo> listInOrder(Integer oid) {
|
||||||
|
return list(
|
||||||
|
new LambdaQueryWrapper<ThinkGoodsOrderInfo>()
|
||||||
|
.eq(ThinkGoodsOrderInfo::getOid, oid)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.gxwebsoft.think.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.think.mapper.ThinkGoodsOrderMapper;
|
import com.gxwebsoft.think.mapper.ThinkGoodsOrderMapper;
|
||||||
|
import com.gxwebsoft.think.service.ThinkGoodsOrderInfoService;
|
||||||
import com.gxwebsoft.think.service.ThinkGoodsOrderService;
|
import com.gxwebsoft.think.service.ThinkGoodsOrderService;
|
||||||
import com.gxwebsoft.think.entity.ThinkGoodsOrder;
|
import com.gxwebsoft.think.entity.ThinkGoodsOrder;
|
||||||
import com.gxwebsoft.think.param.ThinkGoodsOrderParam;
|
import com.gxwebsoft.think.param.ThinkGoodsOrderParam;
|
||||||
@@ -9,6 +10,7 @@ import com.gxwebsoft.common.core.web.PageParam;
|
|||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,12 +21,16 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ThinkGoodsOrderServiceImpl extends ServiceImpl<ThinkGoodsOrderMapper, ThinkGoodsOrder> implements ThinkGoodsOrderService {
|
public class ThinkGoodsOrderServiceImpl extends ServiceImpl<ThinkGoodsOrderMapper, ThinkGoodsOrder> implements ThinkGoodsOrderService {
|
||||||
|
@Resource
|
||||||
|
private ThinkGoodsOrderInfoService thinkGoodsOrderInfoService;
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ThinkGoodsOrder> pageRel(ThinkGoodsOrderParam param) {
|
public PageResult<ThinkGoodsOrder> pageRel(ThinkGoodsOrderParam param) {
|
||||||
PageParam<ThinkGoodsOrder, ThinkGoodsOrderParam> page = new PageParam<>(param);
|
PageParam<ThinkGoodsOrder, ThinkGoodsOrderParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
List<ThinkGoodsOrder> list = baseMapper.selectPageRel(page, param);
|
List<ThinkGoodsOrder> list = baseMapper.selectPageRel(page, param);
|
||||||
|
for (ThinkGoodsOrder thinkGoodsOrder : list) {
|
||||||
|
thinkGoodsOrder.setInfoList(thinkGoodsOrderInfoService.listInOrder(thinkGoodsOrder.getId()));
|
||||||
|
}
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,4 +50,11 @@ public class ThinkGoodsOrderServiceImpl extends ServiceImpl<ThinkGoodsOrderMappe
|
|||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkGoodsOrder getByOrderNum(String orderNum) {
|
||||||
|
ThinkGoodsOrderParam param = new ThinkGoodsOrderParam();
|
||||||
|
param.setOrderNum(orderNum);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,16 @@ package com.gxwebsoft.think.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.think.mapper.ThinkGoodsMapper;
|
import com.gxwebsoft.think.mapper.ThinkGoodsMapper;
|
||||||
|
import com.gxwebsoft.think.service.ThinkGoodsCategoryService;
|
||||||
import com.gxwebsoft.think.service.ThinkGoodsService;
|
import com.gxwebsoft.think.service.ThinkGoodsService;
|
||||||
import com.gxwebsoft.think.entity.ThinkGoods;
|
import com.gxwebsoft.think.entity.ThinkGoods;
|
||||||
import com.gxwebsoft.think.param.ThinkGoodsParam;
|
import com.gxwebsoft.think.param.ThinkGoodsParam;
|
||||||
import com.gxwebsoft.common.core.web.PageParam;
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,12 +22,17 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ThinkGoodsServiceImpl extends ServiceImpl<ThinkGoodsMapper, ThinkGoods> implements ThinkGoodsService {
|
public class ThinkGoodsServiceImpl extends ServiceImpl<ThinkGoodsMapper, ThinkGoods> implements ThinkGoodsService {
|
||||||
|
@Resource
|
||||||
|
private ThinkGoodsCategoryService thinkGoodsCategoryService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ThinkGoods> pageRel(ThinkGoodsParam param) {
|
public PageResult<ThinkGoods> pageRel(ThinkGoodsParam param) {
|
||||||
PageParam<ThinkGoods, ThinkGoodsParam> page = new PageParam<>(param);
|
PageParam<ThinkGoods, ThinkGoodsParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
List<ThinkGoods> list = baseMapper.selectPageRel(page, param);
|
List<ThinkGoods> list = baseMapper.selectPageRel(page, param);
|
||||||
|
for (ThinkGoods thinkGoods : list) {
|
||||||
|
thinkGoods.setCategory(thinkGoodsCategoryService.getById(thinkGoods.getCid()));
|
||||||
|
}
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.gxwebsoft.think.service.impl;
|
package com.gxwebsoft.think.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.think.mapper.ThinkIntegralMapper;
|
import com.gxwebsoft.think.mapper.ThinkIntegralMapper;
|
||||||
import com.gxwebsoft.think.service.ThinkIntegralService;
|
import com.gxwebsoft.think.service.ThinkIntegralService;
|
||||||
@@ -44,4 +46,12 @@ public class ThinkIntegralServiceImpl extends ServiceImpl<ThinkIntegralMapper, T
|
|||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkIntegral check(Integer uid) {
|
||||||
|
return getOne(
|
||||||
|
new LambdaUpdateWrapper<ThinkIntegral>()
|
||||||
|
.eq(ThinkIntegral::getId, uid)
|
||||||
|
.eq(ThinkIntegral::getDateTime, DateUtil.today()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.gxwebsoft.think.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.think.mapper.ThinkMachineOpenLogMapper;
|
||||||
|
import com.gxwebsoft.think.service.ThinkMachineOpenLogService;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkMachineOpenLog;
|
||||||
|
import com.gxwebsoft.think.param.ThinkMachineOpenLogParam;
|
||||||
|
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 2024-11-28 18:22:35
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ThinkMachineOpenLogServiceImpl extends ServiceImpl<ThinkMachineOpenLogMapper, ThinkMachineOpenLog> implements ThinkMachineOpenLogService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ThinkMachineOpenLog> pageRel(ThinkMachineOpenLogParam param) {
|
||||||
|
PageParam<ThinkMachineOpenLog, ThinkMachineOpenLogParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
List<ThinkMachineOpenLog> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkMachineOpenLog> listRel(ThinkMachineOpenLogParam param) {
|
||||||
|
List<ThinkMachineOpenLog> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<ThinkMachineOpenLog, ThinkMachineOpenLogParam> page = new PageParam<>();
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkMachineOpenLog getByIdRel(Integer id) {
|
||||||
|
ThinkMachineOpenLogParam param = new ThinkMachineOpenLogParam();
|
||||||
|
param.setId(id);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkMachineOpenLog getByOrderId(Integer orderId) {
|
||||||
|
ThinkMachineOpenLogParam param = new ThinkMachineOpenLogParam();
|
||||||
|
param.setOrderId(orderId);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -53,4 +53,15 @@ public class ThinkOrderInfoServiceImpl extends ServiceImpl<ThinkOrderInfoMapper,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkOrderInfo checkOrder(ThinkOrderInfo thinkOrderInfo) {
|
||||||
|
return getOne(
|
||||||
|
new LambdaQueryWrapper<ThinkOrderInfo>()
|
||||||
|
.eq(ThinkOrderInfo::getSid, thinkOrderInfo.getSid())
|
||||||
|
.eq(ThinkOrderInfo::getFid, thinkOrderInfo.getFid())
|
||||||
|
.eq(ThinkOrderInfo::getStartTime, thinkOrderInfo.getStartTime())
|
||||||
|
.eq(ThinkOrderInfo::getPayStatus, 1)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.think.service.impl;
|
package com.gxwebsoft.think.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.think.mapper.ThinkOrderRefundLogMapper;
|
import com.gxwebsoft.think.mapper.ThinkOrderRefundLogMapper;
|
||||||
import com.gxwebsoft.think.service.ThinkOrderRefundLogService;
|
import com.gxwebsoft.think.service.ThinkOrderRefundLogService;
|
||||||
@@ -44,4 +45,13 @@ public class ThinkOrderRefundLogServiceImpl extends ServiceImpl<ThinkOrderRefund
|
|||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkOrderRefundLog getByRefundNo(String refundNo) {
|
||||||
|
return getOne(
|
||||||
|
new LambdaQueryWrapper<ThinkOrderRefundLog>()
|
||||||
|
.eq(ThinkOrderRefundLog::getRefundNo, refundNo)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,39 @@
|
|||||||
package com.gxwebsoft.think.service.impl;
|
package com.gxwebsoft.think.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.crypto.SecureUtil;
|
||||||
|
import cn.hutool.crypto.symmetric.SymmetricAlgorithm;
|
||||||
|
import cn.hutool.crypto.symmetric.SymmetricCrypto;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
import com.gxwebsoft.think.entity.ThinkOrderInfo;
|
import com.gxwebsoft.think.entity.ThinkOrderInfo;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkOrderRefundLog;
|
||||||
import com.gxwebsoft.think.mapper.ThinkOrderMapper;
|
import com.gxwebsoft.think.mapper.ThinkOrderMapper;
|
||||||
import com.gxwebsoft.think.service.ThinkOrderInfoService;
|
import com.gxwebsoft.think.service.*;
|
||||||
import com.gxwebsoft.think.service.ThinkOrderService;
|
|
||||||
import com.gxwebsoft.think.entity.ThinkOrder;
|
import com.gxwebsoft.think.entity.ThinkOrder;
|
||||||
import com.gxwebsoft.think.param.ThinkOrderParam;
|
import com.gxwebsoft.think.param.ThinkOrderParam;
|
||||||
import com.gxwebsoft.common.core.web.PageParam;
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.think.service.WechatConfigService;
|
|
||||||
import com.wechat.pay.java.core.Config;
|
import com.wechat.pay.java.core.Config;
|
||||||
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||||
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
||||||
import com.wechat.pay.java.service.payments.jsapi.model.Payer;
|
import com.wechat.pay.java.service.payments.jsapi.model.Payer;
|
||||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
|
import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
|
||||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||||
|
import com.wechat.pay.java.service.refund.RefundService;
|
||||||
|
import com.wechat.pay.java.service.refund.model.AmountReq;
|
||||||
|
import com.wechat.pay.java.service.refund.model.CreateRequest;
|
||||||
|
import com.wechat.pay.java.service.refund.model.Refund;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service实现
|
* Service实现
|
||||||
@@ -43,6 +51,10 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
@Resource
|
@Resource
|
||||||
private WechatConfigService wechatConfigService;
|
private WechatConfigService wechatConfigService;
|
||||||
|
@Resource
|
||||||
|
private ThinkCardService thinkCardService;
|
||||||
|
@Resource
|
||||||
|
private ThinkUsersVipService thinkUsersVipService;
|
||||||
|
|
||||||
private Config wxConfig;
|
private Config wxConfig;
|
||||||
|
|
||||||
@@ -59,6 +71,13 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
List<ThinkOrder> list = baseMapper.selectPageRel(page, param);
|
List<ThinkOrder> list = baseMapper.selectPageRel(page, param);
|
||||||
list.forEach(d -> {
|
list.forEach(d -> {
|
||||||
d.setThinkOrderInfos(thinkOrderInfoService.list(new LambdaQueryWrapper<ThinkOrderInfo>().eq(ThinkOrderInfo::getOid, d.getId())));
|
d.setThinkOrderInfos(thinkOrderInfoService.list(new LambdaQueryWrapper<ThinkOrderInfo>().eq(ThinkOrderInfo::getOid, d.getId())));
|
||||||
|
if (d.getCid() != null && !d.getCid().equals(0)) {
|
||||||
|
d.setCard(thinkCardService.getById(d.getCid()));
|
||||||
|
}
|
||||||
|
if (d.getVid() != null && !d.getVid().equals(0)) {
|
||||||
|
d.setThinkVip(thinkUsersVipService.getById(d.getVid()));
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
}
|
}
|
||||||
@@ -66,6 +85,15 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
@Override
|
@Override
|
||||||
public List<ThinkOrder> listRel(ThinkOrderParam param) {
|
public List<ThinkOrder> listRel(ThinkOrderParam param) {
|
||||||
List<ThinkOrder> list = baseMapper.selectListRel(param);
|
List<ThinkOrder> list = baseMapper.selectListRel(param);
|
||||||
|
list.forEach(d -> {
|
||||||
|
d.setThinkOrderInfos(thinkOrderInfoService.list(new LambdaQueryWrapper<ThinkOrderInfo>().eq(ThinkOrderInfo::getOid, d.getId())));
|
||||||
|
if (d.getCid() != null && !d.getCid().equals(0)) {
|
||||||
|
d.setCard(thinkCardService.getById(d.getCid()));
|
||||||
|
}
|
||||||
|
if (d.getVid() != null && !d.getVid().equals(0)) {
|
||||||
|
d.setThinkVip(thinkUsersVipService.getById(d.getVid()));
|
||||||
|
}
|
||||||
|
});
|
||||||
// 排序
|
// 排序
|
||||||
PageParam<ThinkOrder, ThinkOrderParam> page = new PageParam<>();
|
PageParam<ThinkOrder, ThinkOrderParam> page = new PageParam<>();
|
||||||
page.setDefaultOrder("create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
@@ -83,6 +111,63 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
return thinkOrder;
|
return thinkOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getByQrCode(String qrCode) {
|
||||||
|
String secretKey = redisUtil.get("secretKey_10150");
|
||||||
|
byte[] key = null;
|
||||||
|
if (secretKey == null) {
|
||||||
|
key = SecureUtil.generateKey(SymmetricAlgorithm.AES.getValue()).getEncoded();
|
||||||
|
redisUtil.set("secretKey_10150", Base64.getEncoder().encodeToString(key));
|
||||||
|
} else {
|
||||||
|
key = Base64.getDecoder().decode(secretKey);
|
||||||
|
}
|
||||||
|
SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, key);
|
||||||
|
try {
|
||||||
|
String data = aes.decryptStr(qrCode);
|
||||||
|
String[] idArr = data.split("_");
|
||||||
|
// if ((int) (System.currentTimeMillis() / 1000) > Long.parseLong(idArr[1]) + 120) {
|
||||||
|
// return new HashMap<>() {{
|
||||||
|
// put("res", false);
|
||||||
|
// put("msg", "核销码已过期");
|
||||||
|
// }};
|
||||||
|
// }
|
||||||
|
ThinkOrderParam param = new ThinkOrderParam();
|
||||||
|
param.setId(Integer.valueOf(idArr[0]));
|
||||||
|
final ThinkOrder thinkOrder = param.getOne(baseMapper.selectListRel(param));
|
||||||
|
if (thinkOrder == null) {
|
||||||
|
return new HashMap<>() {{
|
||||||
|
put("res", false);
|
||||||
|
put("msg", "订单不存在");
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
if (!thinkOrder.getPayStatus().equals(1)) {
|
||||||
|
return new HashMap<>() {{
|
||||||
|
put("res", false);
|
||||||
|
put("msg", "该订单未支付");
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
if (thinkOrder.getOrderStatus().equals(1)) {
|
||||||
|
return new HashMap<>() {{
|
||||||
|
put("res", false);
|
||||||
|
put("msg", "该订单已核销");
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(thinkOrder)) {
|
||||||
|
thinkOrder.setThinkOrderInfos(thinkOrderInfoService.list(new LambdaQueryWrapper<ThinkOrderInfo>().eq(ThinkOrderInfo::getOid, thinkOrder.getId())));
|
||||||
|
}
|
||||||
|
return new HashMap<>() {{
|
||||||
|
put("res", true);
|
||||||
|
put("data", thinkOrder);
|
||||||
|
}};
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
return new HashMap<>() {{
|
||||||
|
put("res", false);
|
||||||
|
put("msg", "核销码错误");
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ThinkOrder getByOrderNum(String orderNum) {
|
public ThinkOrder getByOrderNum(String orderNum) {
|
||||||
ThinkOrderParam param = new ThinkOrderParam();
|
ThinkOrderParam param = new ThinkOrderParam();
|
||||||
@@ -141,7 +226,7 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
final Payer payer = new Payer();
|
final Payer payer = new Payer();
|
||||||
payer.setOpenid(openid);
|
payer.setOpenid(openid);
|
||||||
request.setPayer(payer);
|
request.setPayer(payer);
|
||||||
amount.setTotal(2);
|
amount.setTotal(1);
|
||||||
request.setAmount(amount);
|
request.setAmount(amount);
|
||||||
request.setNotifyUrl(notify);
|
request.setNotifyUrl(notify);
|
||||||
System.out.println("request = " + request);
|
System.out.println("request = " + request);
|
||||||
@@ -155,4 +240,49 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
return orderInfo;
|
return orderInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 退款申请
|
||||||
|
* @param orderRefund
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Refund refund(ThinkOrderRefundLog orderRefund) {
|
||||||
|
Config wxConfig = wechatConfigService.getConfig();
|
||||||
|
RefundService service = new RefundService.Builder().config(wxConfig).build();
|
||||||
|
CreateRequest request = new CreateRequest();
|
||||||
|
String refundNotifyUrl = "https://gxtyzx-api.websoft.top/api/think/think-order-refund-log/notify";
|
||||||
|
// 金额
|
||||||
|
AmountReq amount = new AmountReq();
|
||||||
|
amount.setTotal(orderRefund.getOrder().getPayPrice().multiply(BigDecimal.valueOf(100)).longValue());
|
||||||
|
amount.setRefund(orderRefund.getRefundAmount().multiply(BigDecimal.valueOf(100)).longValue());
|
||||||
|
amount.setCurrency("CNY");
|
||||||
|
request.setNotifyUrl(refundNotifyUrl);
|
||||||
|
request.setAmount(amount);
|
||||||
|
request.setOutTradeNo(orderRefund.getOrder().getOrderNum());
|
||||||
|
request.setOutRefundNo(orderRefund.getRefundNo());
|
||||||
|
return service.create(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkOrder getLastOrderByVid(Integer vid) {
|
||||||
|
return getOne(
|
||||||
|
new LambdaQueryWrapper<ThinkOrder>()
|
||||||
|
.eq(ThinkOrder::getVid, vid)
|
||||||
|
.eq(ThinkOrder::getPayStatus, 1)
|
||||||
|
.orderByDesc(ThinkOrder::getCreateTime)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkOrder getLastOrderByCardCode(String code) {
|
||||||
|
return getOne(
|
||||||
|
new LambdaQueryWrapper<ThinkOrder>()
|
||||||
|
.eq(ThinkOrder::getCode, code)
|
||||||
|
.eq(ThinkOrder::getPayStatus, 1)
|
||||||
|
.orderByDesc(ThinkOrder::getCreateTime)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,4 +76,14 @@ public class ThinkUsersVipServiceImpl extends ServiceImpl<ThinkUsersVipMapper, T
|
|||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkUsersVip getByVidAndUid(Integer vid, Integer uid) {
|
||||||
|
return getOne(
|
||||||
|
new LambdaQueryWrapper<ThinkUsersVip>()
|
||||||
|
.eq(ThinkUsersVip::getVid, vid)
|
||||||
|
.eq(ThinkUsersVip::getUid, uid)
|
||||||
|
.orderByDesc(ThinkUsersVip::getExpireTime)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user