250825
This commit is contained in:
@@ -246,7 +246,7 @@ public class WxOfficialController extends BaseController {
|
|||||||
.execute().body();
|
.execute().body();
|
||||||
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
System.out.println("jsonObject = " + jsonObject);
|
// System.out.println("jsonObject = " + jsonObject);
|
||||||
if(jsonObject != null){
|
if(jsonObject != null){
|
||||||
return success(jsonObject);
|
return success(jsonObject);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,6 +233,12 @@
|
|||||||
<artifactId>commons-logging</artifactId>
|
<artifactId>commons-logging</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- ftp -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-net</groupId>
|
||||||
|
<artifactId>commons-net</artifactId>
|
||||||
|
<version>3.9.0</version>
|
||||||
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
|
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ public class MybatisPlusConfig {
|
|||||||
"think_wechat_bill",
|
"think_wechat_bill",
|
||||||
"think_wechat_bill_log",
|
"think_wechat_bill_log",
|
||||||
"think_wechat_deposit",
|
"think_wechat_deposit",
|
||||||
|
"think_card_balance",
|
||||||
"sys_log"
|
"sys_log"
|
||||||
|
|
||||||
// "booking_user",
|
// "booking_user",
|
||||||
|
|||||||
@@ -79,7 +79,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
"/api/think/think-order/check-code-only",
|
"/api/think/think-order/check-code-only",
|
||||||
"/api/think/think-vip-cards-bills/make-bill",
|
"/api/think/think-vip-cards-bills/make-bill",
|
||||||
"/api/think/think-cards-bills/make-bill",
|
"/api/think/think-cards-bills/make-bill",
|
||||||
"/api/think/think-recharge-log/refund-notify"
|
"/api/think/think-recharge-log/refund-notify",
|
||||||
|
"/api/think/think-ftp-check-bill/async",
|
||||||
|
"/api/think/think-card-balance/set-data"
|
||||||
// "/api/think/think-order/fixInvoiceData"
|
// "/api/think/think-order/fixInvoiceData"
|
||||||
)
|
)
|
||||||
.permitAll()
|
.permitAll()
|
||||||
|
|||||||
@@ -48,6 +48,25 @@ public class RequestUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public User getOrgAdmin(Integer orgId) {
|
||||||
|
String path = "/system/user/org-admin/" + orgId;
|
||||||
|
try {
|
||||||
|
// 链式构建请求
|
||||||
|
String result = HttpRequest.get(host.concat(path))
|
||||||
|
.header("Authorization", ACCESS_TOKEN)
|
||||||
|
.header("Tenantid", TENANT_ID)
|
||||||
|
.timeout(20000)//超时,毫秒
|
||||||
|
.execute().body();
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
final String data = jsonObject.getString("data");
|
||||||
|
return JSONObject.parseObject(data, User.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public User getUserByPhone(String phone) {
|
public User getUserByPhone(String phone) {
|
||||||
String path = "/system/user/getByPhone/" + phone;
|
String path = "/system/user/getByPhone/" + phone;
|
||||||
try {
|
try {
|
||||||
@@ -78,7 +97,7 @@ public class RequestUtil {
|
|||||||
.execute().body();
|
.execute().body();
|
||||||
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
System.out.println("jsonObject = " + jsonObject);
|
// System.out.println("jsonObject = " + jsonObject);
|
||||||
final String data = jsonObject.getString("data");
|
final String data = jsonObject.getString("data");
|
||||||
return JSONObject.parseObject(data, User.class);
|
return JSONObject.parseObject(data, User.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ public class ApiResult<T> implements Serializable {
|
|||||||
@ApiModelProperty(value = "状态信息")
|
@ApiModelProperty(value = "状态信息")
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "内容")
|
||||||
|
private T content;
|
||||||
|
|
||||||
@ApiModelProperty(value = "返回数据")
|
@ApiModelProperty(value = "返回数据")
|
||||||
private T data;
|
private T data;
|
||||||
|
|
||||||
@@ -66,6 +69,15 @@ public class ApiResult<T> implements Serializable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public T getContent() {
|
||||||
|
return this.content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiResult<T> setContent(T content) {
|
||||||
|
this.content = content;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public T getData() {
|
public T getData() {
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ import java.util.Map;
|
|||||||
* @since 2017-06-10 10:10:19
|
* @since 2017-06-10 10:10:19
|
||||||
*/
|
*/
|
||||||
public class BaseController {
|
public class BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private HttpServletRequest request;
|
private HttpServletRequest request;
|
||||||
@Resource
|
@Resource
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前登录的user
|
* 获取当前登录的user
|
||||||
@@ -68,27 +68,27 @@ public class BaseController {
|
|||||||
* @return tenantId
|
* @return tenantId
|
||||||
*/
|
*/
|
||||||
public Integer getTenantId() {
|
public Integer getTenantId() {
|
||||||
// 1 从登录用户拿tenantId
|
// 1 从登录用户拿tenantId
|
||||||
User loginUser = getLoginUser();
|
User loginUser = getLoginUser();
|
||||||
if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
return loginUser.getTenantId();
|
return loginUser.getTenantId();
|
||||||
}
|
|
||||||
// 2 从域名拿ID
|
|
||||||
String Domain = request.getHeader("Domain");
|
|
||||||
if (StrUtil.isNotBlank(Domain)) {
|
|
||||||
String key = "Domain:" + Domain;
|
|
||||||
String tenantId = redisUtil.get(key);
|
|
||||||
if(tenantId != null){
|
|
||||||
System.out.println("从域名拿ID = " + tenantId);
|
|
||||||
return Integer.valueOf(tenantId);
|
|
||||||
}
|
}
|
||||||
}
|
// 2 从域名拿ID
|
||||||
// 3 从请求头拿ID
|
String Domain = request.getHeader("Domain");
|
||||||
String tenantId = request.getHeader("tenantId");
|
if (StrUtil.isNotBlank(Domain)) {
|
||||||
if(StrUtil.isNotBlank(tenantId)){
|
String key = "Domain:" + Domain;
|
||||||
return Integer.valueOf(tenantId);
|
String tenantId = redisUtil.get(key);
|
||||||
}
|
if (tenantId != null) {
|
||||||
return null;
|
System.out.println("从域名拿ID = " + tenantId);
|
||||||
|
return Integer.valueOf(tenantId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 3 从请求头拿ID
|
||||||
|
String tenantId = request.getHeader("tenantId");
|
||||||
|
if (StrUtil.isNotBlank(tenantId)) {
|
||||||
|
return Integer.valueOf(tenantId);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -130,6 +130,11 @@ public class BaseController {
|
|||||||
return success(data).setMessage(message);
|
return success(data).setMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public <T> ApiResult<T> success(String message, T data, T content) {
|
||||||
|
return success(data).setMessage(message).setContent(content);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回分页查询数据
|
* 返回分页查询数据
|
||||||
*
|
*
|
||||||
@@ -200,20 +205,20 @@ public class BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 自定义函数
|
// 自定义函数
|
||||||
public String getAuthorization(){
|
public String getAuthorization() {
|
||||||
return request.getHeader("Authorization");
|
return request.getHeader("Authorization");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAppId() {
|
public String getAppId() {
|
||||||
// 兼容小写
|
// 兼容小写
|
||||||
if(request.getHeader("appid") != null){
|
if (request.getHeader("appid") != null) {
|
||||||
return request.getHeader("appid");
|
return request.getHeader("appid");
|
||||||
}
|
}
|
||||||
return request.getHeader("AppId");
|
return request.getHeader("AppId");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSign() {
|
public String getSign() {
|
||||||
return request.getParameter("sign");
|
return request.getParameter("sign");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -221,49 +226,49 @@ public class BaseController {
|
|||||||
* 存在签名信息则需要验证
|
* 存在签名信息则需要验证
|
||||||
*/
|
*/
|
||||||
public void isCheckSign() {
|
public void isCheckSign() {
|
||||||
if (StrUtil.isNotBlank(getSign())) {
|
if (StrUtil.isNotBlank(getSign())) {
|
||||||
if(getTenantId() == null){
|
if (getTenantId() == null) {
|
||||||
throw new BusinessException("签名失败:TenantId不能为空");
|
throw new BusinessException("签名失败:TenantId不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
String timestamp1 = request.getParameter("timestamp");
|
||||||
|
long timestamp2 = System.currentTimeMillis();
|
||||||
|
long time = timestamp2 - Long.parseLong(timestamp1);
|
||||||
|
if (time > 600000L) {
|
||||||
|
throw new BusinessException("签名失败:请求超时");
|
||||||
|
}
|
||||||
|
|
||||||
|
Enumeration<String> names = request.getParameterNames();
|
||||||
|
//2.遍历正文名称的枚举获得请求参数
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
while (names.hasMoreElements()) {
|
||||||
|
String name = names.nextElement();
|
||||||
|
String value = request.getParameter(name);
|
||||||
|
params.put(name, value);
|
||||||
|
}
|
||||||
|
String signString = SignCheckUtil.getSignString(params, getAppSecret());
|
||||||
|
System.out.println("请求的参数 = " + params);
|
||||||
|
System.out.println("正确的签名 = " + signString);
|
||||||
|
System.out.println("签名是否正确 = " + SignCheckUtil.signCheck(params, getAppSecret()));
|
||||||
|
|
||||||
|
if (!SignCheckUtil.signCheck(params, getAppSecret())) {
|
||||||
|
throw new BusinessException("签名失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String timestamp1 = request.getParameter("timestamp");
|
// 模拟提交参数
|
||||||
long timestamp2 = System.currentTimeMillis();
|
// String key = "FRbMx1FkG4Qz6GZxY";
|
||||||
long time = timestamp2 - Long.parseLong(timestamp1);
|
// Map<String, String> param0 = new HashMap<>();
|
||||||
if(time > 600000L){
|
// param0.put("orderId", "D2018062976332656413");
|
||||||
throw new BusinessException("签名失败:请求超时");
|
// param0.put("MainAccountID", "DC3NHPJ73S");
|
||||||
}
|
// param0.put("MainAccountSN", "320");
|
||||||
|
// param0.put("payStatus", "2");
|
||||||
|
// param0.put("title","测试");
|
||||||
|
// System.out.println("请求的参数 = " + param0);
|
||||||
|
// String signString0 = SignCheckUtil.getSignString(param0, key);
|
||||||
|
// System.out.println("signString0 = " + signString0);
|
||||||
|
|
||||||
Enumeration<String> names = request.getParameterNames();
|
// return SignCheckUtil.signCheck(params, getAppSecret());
|
||||||
//2.遍历正文名称的枚举获得请求参数
|
|
||||||
Map<String, String> params = new HashMap<>();
|
|
||||||
while(names.hasMoreElements()){
|
|
||||||
String name = names.nextElement();
|
|
||||||
String value = request.getParameter(name);
|
|
||||||
params.put(name,value);
|
|
||||||
}
|
|
||||||
String signString = SignCheckUtil.getSignString(params, getAppSecret());
|
|
||||||
System.out.println("请求的参数 = " + params);
|
|
||||||
System.out.println("正确的签名 = " + signString);
|
|
||||||
System.out.println("签名是否正确 = " + SignCheckUtil.signCheck(params, getAppSecret()));
|
|
||||||
|
|
||||||
if (!SignCheckUtil.signCheck(params, getAppSecret())) {
|
|
||||||
throw new BusinessException("签名失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 模拟提交参数
|
|
||||||
// String key = "FRbMx1FkG4Qz6GZxY";
|
|
||||||
// Map<String, String> param0 = new HashMap<>();
|
|
||||||
// param0.put("orderId", "D2018062976332656413");
|
|
||||||
// param0.put("MainAccountID", "DC3NHPJ73S");
|
|
||||||
// param0.put("MainAccountSN", "320");
|
|
||||||
// param0.put("payStatus", "2");
|
|
||||||
// param0.put("title","测试");
|
|
||||||
// System.out.println("请求的参数 = " + param0);
|
|
||||||
// String signString0 = SignCheckUtil.getSignString(param0, key);
|
|
||||||
// System.out.println("signString0 = " + signString0);
|
|
||||||
|
|
||||||
// return SignCheckUtil.signCheck(params, getAppSecret());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -272,9 +277,9 @@ public class BaseController {
|
|||||||
* @return AppSecret
|
* @return AppSecret
|
||||||
*/
|
*/
|
||||||
public String getAppSecret() {
|
public String getAppSecret() {
|
||||||
String key = "cache5:AppSecret:" + Integer.valueOf(getAppId());
|
String key = "cache5:AppSecret:" + Integer.valueOf(getAppId());
|
||||||
System.out.println("key = " + key);
|
System.out.println("key = " + key);
|
||||||
return redisUtil.get(key);
|
return redisUtil.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -66,7 +66,9 @@ public class AreaController extends BaseController {
|
|||||||
if (level != null) str += "-" + level;
|
if (level != null) str += "-" + level;
|
||||||
List<Area> topList;
|
List<Area> topList;
|
||||||
String topListString = redisTemplate.opsForValue().get(str);
|
String topListString = redisTemplate.opsForValue().get(str);
|
||||||
if (topListString == null) {
|
System.out.println("str: " + str);
|
||||||
|
System.out.println("topListString: " + topListString);
|
||||||
|
// if (topListString == null || topListString.equals("[]")) {
|
||||||
topList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 1));
|
topList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 1));
|
||||||
for (Area top : topList) {
|
for (Area top : topList) {
|
||||||
List<Area> secondList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 2).eq(Area::getFid, top.getId()));
|
List<Area> secondList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 2).eq(Area::getFid, top.getId()));
|
||||||
@@ -79,7 +81,7 @@ public class AreaController extends BaseController {
|
|||||||
top.setChildren(secondList);
|
top.setChildren(secondList);
|
||||||
}
|
}
|
||||||
redisTemplate.opsForValue().set(str, JSON.toJSONString(topList));
|
redisTemplate.opsForValue().set(str, JSON.toJSONString(topList));
|
||||||
} else topList = JSON.parseArray(topListString, Area.class);
|
// } else topList = JSON.parseArray(topListString, Area.class);
|
||||||
return success(topList);
|
return success(topList);
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
//return success(areaService.listRel(param));
|
//return success(areaService.listRel(param));
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.gxwebsoft.think.controller;
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
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.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
@@ -21,8 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,91 +54,158 @@ public class SchedulingController extends BaseController {
|
|||||||
|
|
||||||
@Scheduled(cron = "* * * * * *")
|
@Scheduled(cron = "* * * * * *")
|
||||||
public void task() {
|
public void task() {
|
||||||
// 15分钟取消订单
|
String newTime = DateUtil.format(LocalDateTime.now(), "HH:mm");
|
||||||
List<ThinkOrder> orderList = thinkOrderService.list(
|
if ((newTime.equals("21:30") || newTime.equals("21:45")) && redisUtil.get("swimmingCheck") == null) {
|
||||||
new LambdaUpdateWrapper<ThinkOrder>()
|
redisUtil.set("swimmingCheck", 1, 3L, TimeUnit.HOURS);
|
||||||
.eq(ThinkOrder::getPayStatus, 2)
|
// 每天21:30后核销游泳馆订单
|
||||||
.eq(ThinkOrder::getOrderStatus, 2)
|
List<ThinkOrder> swimmingOrderList = thinkOrderService.list(
|
||||||
.apply("UNIX_TIMESTAMP() > `create_time` + " + 15 * 60)
|
new LambdaQueryWrapper<ThinkOrder>()
|
||||||
);
|
.eq(ThinkOrder::getSid, 37)
|
||||||
if (!orderList.isEmpty()) {
|
.eq(ThinkOrder::getPayStatus, 1)
|
||||||
List<ThinkOrderInfo> orderInfoList = new ArrayList<>();
|
.in(ThinkOrder::getOrderStatus, 2)
|
||||||
for (ThinkOrder thinkOrder : orderList) {
|
|
||||||
thinkOrder.setOrderStatus(3);
|
|
||||||
List<ThinkOrderInfo> orderInfoListTmp = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
|
||||||
orderInfoList.addAll(orderInfoListTmp);
|
|
||||||
thinkOrder.setUpdateTime(System.currentTimeMillis() / 1000);
|
|
||||||
}
|
|
||||||
for (ThinkOrderInfo thinkOrderInfo : orderInfoList) {
|
|
||||||
thinkOrderInfo.setPayStatus(0);
|
|
||||||
}
|
|
||||||
thinkOrderService.updateBatchById(orderList);
|
|
||||||
thinkOrderInfoService.updateBatchById(orderInfoList);
|
|
||||||
}
|
|
||||||
|
|
||||||
//每天0点清空人数
|
|
||||||
if (DateUtil.format(LocalDateTime.now(), "HH:mm:ss").equals("00:00:00")) {
|
|
||||||
thinkSiteService.update(
|
|
||||||
new LambdaUpdateWrapper<ThinkSite>()
|
|
||||||
.set(ThinkSite::getDailyNum, 0)
|
|
||||||
);
|
);
|
||||||
}
|
if (!swimmingOrderList.isEmpty()) {
|
||||||
|
List<Integer> orderIdList = swimmingOrderList.stream().map(ThinkOrder::getId).toList();
|
||||||
// 每天21:30后核销游泳馆订单
|
|
||||||
if (DateUtil.format(LocalDateTime.now(), "HH:mm:ss").equals("21:30:10")) {
|
|
||||||
// 今天0点时间戳
|
|
||||||
final long dayStart = DateUtil.beginOfDay(DateUtil.date()).getTime() / 1000;
|
|
||||||
List<ThinkOrderInfo> orderInfoList = thinkOrderInfoService.list(
|
|
||||||
new LambdaQueryWrapper<ThinkOrderInfo>()
|
|
||||||
.select(ThinkOrderInfo::getOid)
|
|
||||||
.eq(ThinkOrderInfo::getSid, 37)
|
|
||||||
.eq(ThinkOrderInfo::getPayStatus, 1)
|
|
||||||
.between(ThinkOrderInfo::getStartTime, dayStart, (int) (System.currentTimeMillis() / 1000))
|
|
||||||
);
|
|
||||||
if (!orderInfoList.isEmpty()) {
|
|
||||||
List<Integer> orderIdList = orderInfoList.stream().map(ThinkOrderInfo::getOid).toList();
|
|
||||||
thinkOrderService.update(
|
thinkOrderService.update(
|
||||||
new LambdaUpdateWrapper<ThinkOrder>()
|
new LambdaUpdateWrapper<ThinkOrder>()
|
||||||
.in(ThinkOrder::getId, orderIdList)
|
.in(ThinkOrder::getId, orderIdList)
|
||||||
.eq(ThinkOrder::getOrderStatus, 2)
|
|
||||||
.eq(ThinkOrder::getPayStatus, 1)
|
|
||||||
.set(ThinkOrder::getOrderStatus, 1)
|
.set(ThinkOrder::getOrderStatus, 1)
|
||||||
|
.set(ThinkOrder::getUpdateTime, DateUtil.currentSeconds())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
// 2分钟取消订单
|
||||||
|
List<ThinkOrder> orderList = thinkOrderService.list(
|
||||||
|
new LambdaUpdateWrapper<ThinkOrder>()
|
||||||
|
.eq(ThinkOrder::getPayStatus, 2)
|
||||||
|
.eq(ThinkOrder::getOrderStatus, 2)
|
||||||
|
.apply("UNIX_TIMESTAMP() > `create_time` + " + (2 * 60))
|
||||||
|
);
|
||||||
|
if (!orderList.isEmpty()) {
|
||||||
|
List<ThinkOrderInfo> orderInfoList = new ArrayList<>();
|
||||||
|
for (ThinkOrder thinkOrder : orderList) {
|
||||||
|
thinkOrder.setOrderStatus(3);
|
||||||
|
List<ThinkOrderInfo> orderInfoListTmp = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
||||||
|
orderInfoList.addAll(orderInfoListTmp);
|
||||||
|
thinkOrder.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||||
|
}
|
||||||
|
for (ThinkOrderInfo thinkOrderInfo : orderInfoList) {
|
||||||
|
thinkOrderInfo.setPayStatus(0);
|
||||||
|
redisUtil.delete(thinkOrderInfo.getStartTime().toString() + thinkOrderInfo.getFid().toString());
|
||||||
|
}
|
||||||
|
thinkOrderService.updateBatchById(orderList);
|
||||||
|
thinkOrderInfoService.updateBatchById(orderInfoList);
|
||||||
|
}
|
||||||
|
|
||||||
// 核销订单
|
// 清除占场redis
|
||||||
List<ThinkOrder> otherOrderList = thinkOrderService.list(
|
List<ThinkOrder> cancelOrderList = thinkOrderService.list(
|
||||||
new LambdaUpdateWrapper<ThinkOrder>()
|
new LambdaUpdateWrapper<ThinkOrder>()
|
||||||
.ne(ThinkOrder::getSid, 37)
|
.in(ThinkOrder::getOrderStatus, 3, 4, 5, 6)
|
||||||
.eq(ThinkOrder::getPayStatus, 1)
|
.between(ThinkOrder::getCreateTime, DateUtil.beginOfDay(DateUtil.date()).getTime() / 1000, (int) (System.currentTimeMillis() / 1000))
|
||||||
.eq(ThinkOrder::getOrderStatus, 2)
|
);
|
||||||
);
|
if (!cancelOrderList.isEmpty()) {
|
||||||
for (ThinkOrder thinkOrder : otherOrderList) {
|
List<Integer> orderIdList = cancelOrderList.stream().map(ThinkOrder::getId).toList();
|
||||||
List<ThinkOrderInfo> orderInfoList = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
List<ThinkOrderInfo> orderInfoListTmp = thinkOrderInfoService.listByOrderIds(orderIdList);
|
||||||
ThinkOrderInfo lastOne = orderInfoList.get(orderInfoList.size() - 1);
|
for (ThinkOrderInfo thinkOrderInfo : orderInfoListTmp) {
|
||||||
if ((int) (System.currentTimeMillis() / 1000) > (lastOne.getStartTime() + 1800)) {
|
redisUtil.delete(thinkOrderInfo.getStartTime().toString() + thinkOrderInfo.getFid().toString());
|
||||||
thinkOrder.setOrderStatus(1);
|
}
|
||||||
thinkOrderService.updateById(thinkOrder);
|
}
|
||||||
|
|
||||||
|
//每天0点清空人数
|
||||||
|
if (DateUtil.format(LocalDateTime.now(), "HH:mm:ss").equals("00:00:00")) {
|
||||||
|
thinkSiteService.update(
|
||||||
|
new LambdaUpdateWrapper<ThinkSite>()
|
||||||
|
.set(ThinkSite::getDailyNum, 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 核销订单
|
||||||
|
List<ThinkOrder> otherOrderList = thinkOrderService.list(
|
||||||
|
new LambdaUpdateWrapper<ThinkOrder>()
|
||||||
|
.ne(ThinkOrder::getSid, 37)
|
||||||
|
.eq(ThinkOrder::getPayStatus, 1)
|
||||||
|
.eq(ThinkOrder::getOrderStatus, 2)
|
||||||
|
);
|
||||||
|
for (ThinkOrder thinkOrder : otherOrderList) {
|
||||||
|
List<ThinkOrderInfo> orderInfoList = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
||||||
|
ThinkOrderInfo lastOne = orderInfoList.get(orderInfoList.size() - 1);
|
||||||
|
if ((int) (System.currentTimeMillis() / 1000) > (lastOne.getStartTime() + 1800)) {
|
||||||
|
thinkOrder.setOrderStatus(1);
|
||||||
|
thinkOrder.setCheckBy(1);
|
||||||
|
thinkOrder.setCheckTime(new Date());
|
||||||
|
thinkOrderService.updateById(thinkOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询开票
|
||||||
|
String invoiceFlag = redisUtil.get("invoiceFlag");
|
||||||
|
if (invoiceFlag == null) {
|
||||||
|
redisUtil.set("invoiceFlag", "1", 3L, TimeUnit.MINUTES);
|
||||||
|
ThinkInvoice thinkInvoice = thinkInvoiceService.getOne(
|
||||||
|
new LambdaUpdateWrapper<ThinkInvoice>()
|
||||||
|
.gt(ThinkInvoice::getId, 5481)
|
||||||
|
.eq(ThinkInvoice::getIsOpen, 2)
|
||||||
|
.eq(ThinkInvoice::getType, 2)
|
||||||
|
.eq(ThinkInvoice::getDeleted, 0)
|
||||||
|
.groupBy(ThinkInvoice::getIncoiveNum)
|
||||||
|
.last("order by RAND() limit 1")
|
||||||
|
);
|
||||||
|
// for (ThinkInvoice thinkInvoice : invoiceList) {
|
||||||
|
if (thinkInvoice != null)
|
||||||
|
thinkInvoiceController.getRes(thinkInvoice.getId());
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 每2分钟检测撞场
|
||||||
|
if (redisUtil.get("sameOrderCheck") == null) {
|
||||||
|
redisUtil.set("sameOrderCheck", 1, 2L, TimeUnit.MINUTES);
|
||||||
|
List<ThinkOrder> checkOrderList = thinkOrderService.list(
|
||||||
|
new LambdaQueryWrapper<ThinkOrder>()
|
||||||
|
.ne(ThinkOrder::getSid, 37)
|
||||||
|
.in(ThinkOrder::getOrderStatus, 1, 2)
|
||||||
|
.eq(ThinkOrder::getPayStatus, 1)
|
||||||
|
.gt(ThinkOrder::getCreateTime, 1748707200)
|
||||||
|
.orderByAsc(ThinkOrder::getCreateTime)
|
||||||
|
);
|
||||||
|
Set<Integer> refundOrderIdList = new HashSet<>();
|
||||||
|
if (!checkOrderList.isEmpty()) {
|
||||||
|
for (ThinkOrder thinkOrder : checkOrderList) {
|
||||||
|
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
||||||
|
for (ThinkOrderInfo thinkOrderInfo : thinkOrderInfoList) {
|
||||||
|
List<ThinkOrderInfo> checkThinkOrderInfoList = thinkOrderInfoService.list(
|
||||||
|
new LambdaQueryWrapper<ThinkOrderInfo>()
|
||||||
|
.ne(ThinkOrderInfo::getOid, thinkOrder.getId())
|
||||||
|
.eq(ThinkOrderInfo::getFid, thinkOrderInfo.getFid())
|
||||||
|
.eq(ThinkOrderInfo::getSid, thinkOrderInfo.getSid())
|
||||||
|
.eq(ThinkOrderInfo::getStartTime, thinkOrderInfo.getStartTime())
|
||||||
|
);
|
||||||
|
if (!checkThinkOrderInfoList.isEmpty()) {
|
||||||
|
for (ThinkOrderInfo checkThinkOrderInfo : checkThinkOrderInfoList) {
|
||||||
|
ThinkOrder sameOrder = thinkOrderService.getOne(
|
||||||
|
new LambdaQueryWrapper<ThinkOrder>()
|
||||||
|
.eq(ThinkOrder::getId, checkThinkOrderInfo.getOid())
|
||||||
|
);
|
||||||
|
if (sameOrder.getPayStatus().equals(1) && (sameOrder.getOrderStatus().equals(1) || sameOrder.getOrderStatus().equals(2))) {
|
||||||
|
refundOrderIdList.add(sameOrder.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!refundOrderIdList.isEmpty()) {
|
||||||
|
List<ThinkOrder> doCancelOrderList = thinkOrderService.listByIds(refundOrderIdList.stream().toList());
|
||||||
|
for (ThinkOrder refundOrder : doCancelOrderList) {
|
||||||
|
System.out.println("撞场订单: " + refundOrder.getOrderNum());
|
||||||
|
thinkOrderService.cancelOrder(refundOrder, true, 2);
|
||||||
|
refundOrder.setOrderStatus(6);
|
||||||
|
refundOrder.setRefundTime((int) (System.currentTimeMillis() / 1000));
|
||||||
|
thinkOrderService.updateById(refundOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询开票
|
|
||||||
String invoiceFlag = redisUtil.get("invoiceFlag");
|
|
||||||
if (invoiceFlag == null) {
|
|
||||||
redisUtil.set("invoiceFlag", "1", 5L, TimeUnit.MINUTES);
|
|
||||||
ThinkInvoice thinkInvoice = thinkInvoiceService.getOne(
|
|
||||||
new LambdaUpdateWrapper<ThinkInvoice>()
|
|
||||||
.gt(ThinkInvoice::getId, 5481)
|
|
||||||
.eq(ThinkInvoice::getIsOpen, 2)
|
|
||||||
.eq(ThinkInvoice::getType, 2)
|
|
||||||
.groupBy(ThinkInvoice::getIncoiveNum)
|
|
||||||
.last("order by id asc limit 1")
|
|
||||||
);
|
|
||||||
// for (ThinkInvoice thinkInvoice : invoiceList) {
|
|
||||||
thinkInvoiceController.getRes(thinkInvoice.getId());
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,319 @@
|
|||||||
|
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.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.think.entity.*;
|
||||||
|
import com.gxwebsoft.think.service.*;
|
||||||
|
import com.gxwebsoft.think.param.ThinkCardBalanceParam;
|
||||||
|
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.jacoco.agent.rt.RT;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.websocket.server.PathParam;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡余额记录控制器
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-06-20 20:58:38
|
||||||
|
*/
|
||||||
|
@Api(tags = "卡余额记录管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/think/think-card-balance")
|
||||||
|
public class ThinkCardBalanceController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private ThinkCardBalanceService thinkCardBalanceService;
|
||||||
|
@Resource
|
||||||
|
private ThinkCardService thinkCardService;
|
||||||
|
@Resource
|
||||||
|
private ThinkUsersVipService thinkUsersVipService;
|
||||||
|
@Resource
|
||||||
|
private ThinkVipService thinkVipService;
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderService thinkOrderService;
|
||||||
|
|
||||||
|
@GetMapping("/set-data")
|
||||||
|
public ApiResult<?> setData() {
|
||||||
|
List<ThinkCard> thinkCardList = thinkCardService.list(
|
||||||
|
new LambdaQueryWrapper<ThinkCard>().gt(ThinkCard::getExpireTime, DateUtil.currentSeconds())
|
||||||
|
);
|
||||||
|
List<ThinkUsersVip> thinkUsersVipList = thinkUsersVipService.list(
|
||||||
|
new LambdaQueryWrapper<ThinkUsersVip>().gt(ThinkUsersVip::getExpireTime, DateUtil.currentSeconds())
|
||||||
|
);
|
||||||
|
List<ThinkVip> thinkVipList = thinkVipService.list();
|
||||||
|
for (ThinkCard thinkCard : thinkCardList) {
|
||||||
|
ThinkVip thinkVip = thinkVipList.stream().filter(v -> v.getId().equals(thinkCard.getVid())).findFirst().orElse(null);
|
||||||
|
if (thinkVip == null) return fail(thinkCard.getVid() + "NOT FOUND");
|
||||||
|
BigDecimal reduceEach = BigDecimal.ZERO;
|
||||||
|
BigDecimal balance = BigDecimal.ZERO;
|
||||||
|
if (thinkVip.getMode().equals(0)) {
|
||||||
|
reduceEach = thinkCardBalanceService.getThinkCardBalance(thinkVip);
|
||||||
|
if (thinkVip.getType().equals(1) || thinkVip.getType().equals(3) || thinkVip.getType().equals(4)) {
|
||||||
|
DateTime dateTime = DateUtil.date(thinkCard.getExpireTime() * 1000);
|
||||||
|
String date = DateUtil.format(dateTime, "yyyy-MM-dd") + " 23:59:59";
|
||||||
|
double remainTimestampD = DateUtil.parse(date, "yyyy-MM-dd HH:mm:ss").getTime() - System.currentTimeMillis();
|
||||||
|
double remainDay = Math.ceil(remainTimestampD / (24 * 60 * 60 * 1000));
|
||||||
|
balance = reduceEach.multiply(BigDecimal.valueOf(remainDay));
|
||||||
|
|
||||||
|
} else if (thinkVip.getType().equals(2)) {
|
||||||
|
balance = reduceEach.multiply(BigDecimal.valueOf(thinkCard.getNum()));
|
||||||
|
} else if (thinkVip.getType().equals(5)) {
|
||||||
|
balance = thinkCard.getRemainingMoney();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
long time = DateUtil.parse(thinkVip.getExpiredTime(), "yyyy-MM-dd").getTime();
|
||||||
|
DateTime dateTime = DateUtil.date(time);
|
||||||
|
String date = DateUtil.format(dateTime, "yyyy-MM-dd") + " 23:59:59";
|
||||||
|
double remainTimestampD = DateUtil.parse(date, "yyyy-MM-dd HH:mm:ss").getTime() - (thinkCard.getCreateTime() * 1000);
|
||||||
|
double remainDay = Math.ceil(remainTimestampD / (24 * 60 * 60 * 1000));
|
||||||
|
reduceEach = thinkVip.getPrice().divide(BigDecimal.valueOf(remainDay), RoundingMode.HALF_UP);
|
||||||
|
|
||||||
|
double remainToNowTimestampD = DateUtil.parse(date, "yyyy-MM-dd HH:mm:ss").getTime() - System.currentTimeMillis();
|
||||||
|
double remainToNowDay = Math.ceil(remainToNowTimestampD / (24 * 60 * 60 * 1000));
|
||||||
|
BigDecimal usedMoney = reduceEach.multiply(BigDecimal.valueOf(remainDay).subtract(BigDecimal.valueOf(remainToNowDay)));
|
||||||
|
balance = thinkVip.getPrice().subtract(usedMoney);
|
||||||
|
}
|
||||||
|
ThinkCardBalance thinkCardBalance = new ThinkCardBalance();
|
||||||
|
thinkCardBalance.setCid(thinkCard.getId());
|
||||||
|
thinkCardBalance.setUid(thinkCard.getUid());
|
||||||
|
thinkCardBalance.setBalance(balance);
|
||||||
|
thinkCardBalance.setReduceEach(reduceEach);
|
||||||
|
thinkCardBalance.setType(thinkVip.getType());
|
||||||
|
thinkCardBalance.setDiscount(thinkVip.getDiscount());
|
||||||
|
thinkCardBalance.setVipId(thinkVip.getId());
|
||||||
|
thinkCardBalance.setUpdateTime(DateUtil.currentSeconds());
|
||||||
|
thinkCardBalance.setCreateTime(DateUtil.currentSeconds());
|
||||||
|
thinkCardBalanceService.save(thinkCardBalance);
|
||||||
|
}
|
||||||
|
for (ThinkUsersVip thinkCard : thinkUsersVipList) {
|
||||||
|
ThinkVip thinkVip = thinkVipList.stream().filter(v -> v.getId().equals(thinkCard.getVid())).findFirst().orElse(null);
|
||||||
|
if (thinkVip == null) return fail(thinkCard.getVid() + "NOT FOUND");
|
||||||
|
BigDecimal reduceEach = BigDecimal.ZERO;
|
||||||
|
BigDecimal balance = BigDecimal.ZERO;
|
||||||
|
if (thinkVip.getMode().equals(0)) {
|
||||||
|
reduceEach = thinkCardBalanceService.getThinkCardBalance(thinkVip);
|
||||||
|
if (thinkVip.getType().equals(1) || thinkVip.getType().equals(3) || thinkVip.getType().equals(4)) {
|
||||||
|
DateTime dateTime = DateUtil.date(thinkCard.getExpireTime() * 1000);
|
||||||
|
String date = DateUtil.format(dateTime, "yyyy-MM-dd") + " 23:59:59";
|
||||||
|
double remainTimestampD = DateUtil.parse(date, "yyyy-MM-dd HH:mm:ss").getTime() - System.currentTimeMillis();
|
||||||
|
double remainDay = Math.ceil(remainTimestampD / (24 * 60 * 60 * 1000));
|
||||||
|
balance = reduceEach.multiply(BigDecimal.valueOf(remainDay));
|
||||||
|
|
||||||
|
} else if (thinkVip.getType().equals(2)) {
|
||||||
|
balance = reduceEach.multiply(BigDecimal.valueOf(thinkCard.getNum()));
|
||||||
|
} else if (thinkVip.getType().equals(5)) {
|
||||||
|
balance = thinkCard.getRemainingMoney();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
long time = DateUtil.parse(thinkVip.getExpiredTime(), "yyyy-MM-dd").getTime();
|
||||||
|
DateTime dateTime = DateUtil.date(time);
|
||||||
|
String date = DateUtil.format(dateTime, "yyyy-MM-dd") + " 23:59:59";
|
||||||
|
double remainTimestampD = DateUtil.parse(date, "yyyy-MM-dd HH:mm:ss").getTime() - (thinkCard.getCreateTime() * 1000);
|
||||||
|
double remainDay = Math.ceil(remainTimestampD / (24 * 60 * 60 * 1000));
|
||||||
|
reduceEach = thinkVip.getPrice().divide(BigDecimal.valueOf(remainDay), RoundingMode.HALF_UP);
|
||||||
|
|
||||||
|
double remainToNowTimestampD = DateUtil.parse(date, "yyyy-MM-dd HH:mm:ss").getTime() - System.currentTimeMillis();
|
||||||
|
double remainToNowDay = Math.ceil(remainToNowTimestampD / (24 * 60 * 60 * 1000));
|
||||||
|
BigDecimal usedMoney = reduceEach.multiply(BigDecimal.valueOf(remainDay).subtract(BigDecimal.valueOf(remainToNowDay)));
|
||||||
|
balance = thinkVip.getPrice().subtract(usedMoney);
|
||||||
|
}
|
||||||
|
|
||||||
|
ThinkCardBalance thinkCardBalance = new ThinkCardBalance();
|
||||||
|
thinkCardBalance.setVid(thinkCard.getId());
|
||||||
|
thinkCardBalance.setUid(thinkCard.getUid());
|
||||||
|
thinkCardBalance.setBalance(balance);
|
||||||
|
thinkCardBalance.setReduceEach(reduceEach);
|
||||||
|
thinkCardBalance.setDiscount(thinkVip.getDiscount());
|
||||||
|
thinkCardBalance.setVipId(thinkVip.getId());
|
||||||
|
thinkCardBalance.setType(thinkVip.getType());
|
||||||
|
thinkCardBalance.setUpdateTime(DateUtil.currentSeconds());
|
||||||
|
thinkCardBalance.setCreateTime(DateUtil.currentSeconds());
|
||||||
|
thinkCardBalanceService.save(thinkCardBalance);
|
||||||
|
}
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/set-order-data")
|
||||||
|
public ApiResult<?> setOrderData(@PathParam("page") Integer page) {
|
||||||
|
// IPage<ThinkCardBalance> cardBalanceListNot5 = thinkCardBalanceService.page(
|
||||||
|
// new Page<>(page, 1000),
|
||||||
|
// new LambdaQueryWrapper<ThinkCardBalance>()
|
||||||
|
// .ne(ThinkCardBalance::getType, 5)
|
||||||
|
// );
|
||||||
|
// for (ThinkCardBalance thinkCardBalance : cardBalanceListNot5.getRecords()) {
|
||||||
|
// LambdaQueryWrapper<ThinkOrder> wrapper = new LambdaQueryWrapper<ThinkOrder>()
|
||||||
|
// .eq(ThinkOrder::getUid, thinkCardBalance.getUid())
|
||||||
|
// .eq(ThinkOrder::getPayStatus, 1);
|
||||||
|
// if (thinkCardBalance.getCid() != null) wrapper.eq(ThinkOrder::getCid, thinkCardBalance.getCid());
|
||||||
|
// else wrapper.eq(ThinkOrder::getVid, thinkCardBalance.getVid());
|
||||||
|
// List<ThinkOrder> orderList = thinkOrderService.list(wrapper);
|
||||||
|
// if (!orderList.isEmpty()) {
|
||||||
|
// for (ThinkOrder thinkOrder : orderList) {
|
||||||
|
// thinkOrder.setReducePrice(thinkOrder.getTotalPrice().subtract(thinkCardBalance.getReduceEach()));
|
||||||
|
// thinkOrder.setPayPrice(thinkCardBalance.getReduceEach());
|
||||||
|
// thinkOrderService.updateById(thinkOrder);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// List<ThinkCardBalance> cardBalanceList5 = thinkCardBalanceService.list(
|
||||||
|
// new LambdaQueryWrapper<ThinkCardBalance>()
|
||||||
|
// .eq(ThinkCardBalance::getType, 5)
|
||||||
|
// );
|
||||||
|
// for (ThinkCardBalance thinkCardBalance : cardBalanceList5) {
|
||||||
|
// LambdaQueryWrapper<ThinkOrder> wrapper = new LambdaQueryWrapper<ThinkOrder>()
|
||||||
|
// .eq(ThinkOrder::getUid, thinkCardBalance.getUid())
|
||||||
|
// .eq(ThinkOrder::getPayStatus, 1);
|
||||||
|
// if (thinkCardBalance.getCid() != null) wrapper.eq(ThinkOrder::getCid, thinkCardBalance.getCid());
|
||||||
|
// else wrapper.eq(ThinkOrder::getVid, thinkCardBalance.getVid());
|
||||||
|
// List<ThinkOrder> orderList = thinkOrderService.list(wrapper);
|
||||||
|
// if (!orderList.isEmpty()) {
|
||||||
|
// for (ThinkOrder thinkOrder : orderList) {
|
||||||
|
// BigDecimal discount = thinkCardBalance.getDiscount().divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_UP);
|
||||||
|
// BigDecimal payPrice = thinkOrder.getTotalPrice().multiply(discount);
|
||||||
|
// thinkOrder.setPayPrice(payPrice);
|
||||||
|
// thinkOrder.setReducePrice(thinkOrder.getTotalPrice().subtract(payPrice));
|
||||||
|
// thinkOrderService.updateById(thinkOrder);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
// List<ThinkCardBalance> thinkCardBalanceList = thinkCardBalanceService.list(
|
||||||
|
// new LambdaQueryWrapper<ThinkCardBalance>()
|
||||||
|
// .isNotNull(ThinkCardBalance::getVid)
|
||||||
|
// );
|
||||||
|
// for (ThinkCardBalance thinkCardBalance : thinkCardBalanceList) {
|
||||||
|
// ThinkUsersVip thinkUsersVip = thinkUsersVipService.getById(thinkCardBalance.getVid());
|
||||||
|
// if (thinkUsersVip != null) {
|
||||||
|
// thinkCardBalance.setType(thinkUsersVip.getType());
|
||||||
|
// thinkCardBalanceService.updateById(thinkCardBalance);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
List<ThinkOrder> orderList = thinkOrderService.list(
|
||||||
|
new LambdaQueryWrapper<ThinkOrder>()
|
||||||
|
.eq(ThinkOrder::getPayStatus, 1)
|
||||||
|
.eq(ThinkOrder::getPayPrice, 0)
|
||||||
|
.gt(ThinkOrder::getCreateTime, 1742400000)
|
||||||
|
.in(ThinkOrder::getPayType, 6, 7, 8, 9, 10, 11, 16, 17)
|
||||||
|
);
|
||||||
|
|
||||||
|
for (ThinkOrder thinkOrder : orderList) {
|
||||||
|
ThinkCardBalance thinkCardBalance = null;
|
||||||
|
if (!thinkOrder.getCid().equals(0)) {
|
||||||
|
thinkCardBalance = thinkCardBalanceService.getByCid(thinkOrder.getCid());
|
||||||
|
}
|
||||||
|
if (thinkOrder.getVid() != null) {
|
||||||
|
thinkCardBalance = thinkCardBalanceService.getByVid(thinkOrder.getVid());
|
||||||
|
}
|
||||||
|
if (thinkCardBalance != null) {
|
||||||
|
if (!thinkCardBalance.getType().equals(5)) {
|
||||||
|
thinkOrder.setPayPrice(thinkCardBalance.getReduceEach());
|
||||||
|
thinkOrder.setReducePrice(thinkOrder.getTotalPrice().subtract(thinkCardBalance.getReduceEach()));
|
||||||
|
thinkOrderService.updateById(thinkOrder);
|
||||||
|
} else {
|
||||||
|
BigDecimal discount = thinkCardBalance.getDiscount().divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_UP);
|
||||||
|
BigDecimal payPrice = thinkOrder.getTotalPrice().multiply(discount);
|
||||||
|
thinkOrder.setPayPrice(payPrice);
|
||||||
|
thinkOrder.setReducePrice(thinkOrder.getTotalPrice().subtract(payPrice));
|
||||||
|
thinkOrderService.updateById(thinkOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("分页查询卡余额记录")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<ThinkCardBalance>> page(ThinkCardBalanceParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkCardBalanceService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部卡余额记录")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<ThinkCardBalance>> list(ThinkCardBalanceParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkCardBalanceService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('think:thinkCardBalance:list')")
|
||||||
|
@ApiOperation("根据id查询卡余额记录")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<ThinkCardBalance> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkCardBalanceService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加卡余额记录")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody ThinkCardBalance thinkCardBalance) {
|
||||||
|
if (thinkCardBalanceService.save(thinkCardBalance)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改卡余额记录")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody ThinkCardBalance thinkCardBalance) {
|
||||||
|
if (thinkCardBalanceService.updateById(thinkCardBalance)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除卡余额记录")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (thinkCardBalanceService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量添加卡余额记录")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<ThinkCardBalance> list) {
|
||||||
|
if (thinkCardBalanceService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量修改卡余额记录")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<ThinkCardBalance> batchParam) {
|
||||||
|
if (batchParam.update(thinkCardBalanceService, "id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量删除卡余额记录")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (thinkCardBalanceService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,9 +2,11 @@ package com.gxwebsoft.think.controller;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
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.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
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;
|
||||||
@@ -20,6 +22,7 @@ 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 javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -47,6 +50,10 @@ public class ThinkCardController extends BaseController {
|
|||||||
private ThinkVipCardsBillsService thinkVipCardsBillsService;
|
private ThinkVipCardsBillsService thinkVipCardsBillsService;
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkSiteService thinkSiteService;
|
private ThinkSiteService thinkSiteService;
|
||||||
|
@Resource
|
||||||
|
private ThinkLogService thinkLogService;
|
||||||
|
@Resource
|
||||||
|
private ThinkCardBalanceService thinkCardBalanceService;
|
||||||
|
|
||||||
@ApiOperation("用户卡")
|
@ApiOperation("用户卡")
|
||||||
@PostMapping("/user-card")
|
@PostMapping("/user-card")
|
||||||
@@ -182,20 +189,41 @@ public class ThinkCardController extends BaseController {
|
|||||||
return fail("卡号已存在");
|
return fail("卡号已存在");
|
||||||
}
|
}
|
||||||
if (thinkCard.getCode() == null) thinkCard.setCode(RandomUtil.randomString(8));
|
if (thinkCard.getCode() == null) thinkCard.setCode(RandomUtil.randomString(8));
|
||||||
|
BigDecimal reduceEach = BigDecimal.ZERO;
|
||||||
ThinkVip thinkVip = thinkVipService.getById(thinkCard.getVid());
|
ThinkVip thinkVip = thinkVipService.getById(thinkCard.getVid());
|
||||||
if (thinkVip.getMode().equals(0))
|
if (thinkCard.getIsChange() == null) {
|
||||||
thinkCard.setExpireTime(DateUtil.currentSeconds() + (thinkCard.getTerm() * 86400 * 365) + (thinkCard.getMonth() * 86400 * 30));
|
if (thinkVip.getMode().equals(0)) {
|
||||||
else{
|
reduceEach = thinkCardBalanceService.getThinkCardBalance(thinkVip);
|
||||||
long time = DateUtil.parse(thinkVip.getExpiredTime(), "yyyy-MM-dd").getTime();
|
thinkCard.setExpireTime(DateUtil.currentSeconds() + (thinkVip.getTerm() * 86400 * 365) + (thinkVip.getMonth() * 86400 * 30) + (thinkVip.getDay() * 86400));
|
||||||
thinkCard.setExpireTime(time / 1000);
|
} else {
|
||||||
|
long time = DateUtil.parse(thinkVip.getExpiredTime(), "yyyy-MM-dd").getTime();
|
||||||
|
DateTime dateTime = DateUtil.date(time);
|
||||||
|
String date = DateUtil.format(dateTime, "yyyy-MM-dd") + " 23:59:59";
|
||||||
|
thinkCard.setExpireTime(DateUtil.parse(date, "yyyy-MM-dd HH:mm:ss").getTime() / 1000L);
|
||||||
|
double remainTimestampD = DateUtil.parse(date, "yyyy-MM-dd HH:mm:ss").getTime() - System.currentTimeMillis();
|
||||||
|
double remainDay = Math.ceil(remainTimestampD / (24 * 60 * 60 * 1000));
|
||||||
|
reduceEach = thinkVip.getPrice().divide(BigDecimal.valueOf(remainDay), RoundingMode.HALF_UP);
|
||||||
|
}
|
||||||
|
thinkCard.setCreateTime(DateUtil.currentSeconds());
|
||||||
|
thinkCard.setUpdateTime(DateUtil.currentSeconds());
|
||||||
|
thinkCard.setRemainingMoney(thinkVip.getPrice());
|
||||||
|
thinkCard.setNum(thinkVip.getCount());
|
||||||
|
thinkCard.setCount(thinkVip.getCount());
|
||||||
|
thinkCard.setDiscount(thinkVip.getDiscount());
|
||||||
|
thinkCard.setAid(getLoginUserId());
|
||||||
}
|
}
|
||||||
thinkCard.setCreateTime(DateUtil.currentSeconds());
|
|
||||||
thinkCard.setUpdateTime(DateUtil.currentSeconds());
|
|
||||||
thinkCard.setRemainingMoney(thinkVip.getPrice());
|
|
||||||
thinkCard.setNum(thinkVip.getCount());
|
|
||||||
thinkCard.setCount(thinkVip.getCount());
|
|
||||||
thinkCard.setDiscount(thinkVip.getDiscount());
|
|
||||||
if (thinkCardService.save(thinkCard)) {
|
if (thinkCardService.save(thinkCard)) {
|
||||||
|
ThinkCardBalance thinkCardBalance = new ThinkCardBalance();
|
||||||
|
thinkCardBalance.setCid(thinkCard.getId());
|
||||||
|
thinkCardBalance.setUid(thinkCard.getUid());
|
||||||
|
thinkCardBalance.setBalance(thinkVip.getPrice());
|
||||||
|
thinkCardBalance.setReduceEach(reduceEach);
|
||||||
|
thinkCardBalance.setType(thinkVip.getType());
|
||||||
|
thinkCardBalance.setDiscount(thinkVip.getDiscount());
|
||||||
|
thinkCardBalance.setVipId(thinkVip.getId());
|
||||||
|
thinkCardBalance.setUpdateTime(DateUtil.currentSeconds());
|
||||||
|
thinkCardBalance.setCreateTime(DateUtil.currentSeconds());
|
||||||
|
thinkCardBalanceService.save(thinkCardBalance);
|
||||||
return success("添加成功", thinkCard.getId());
|
return success("添加成功", thinkCard.getId());
|
||||||
}
|
}
|
||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
@@ -221,11 +249,35 @@ public class ThinkCardController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("修改")
|
@ApiOperation("修改")
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody ThinkCard thinkCard) {
|
public ApiResult<?> update(@RequestBody ThinkCard thinkCard, HttpServletRequest request) {
|
||||||
|
ThinkLog thinkLog = null;
|
||||||
|
if (thinkCard.getSaveLog() != null && thinkCard.getSaveLog()) {
|
||||||
|
ThinkCard thinkCard1 = thinkCardService.getById(thinkCard.getId());
|
||||||
|
thinkLog = new ThinkLog();
|
||||||
|
// 实体类转json
|
||||||
|
String json = JSON.toJSONString(thinkCard1);
|
||||||
|
String desc = "修改IC卡:".concat(thinkCard1.getCode()).concat(".修改后数据:").concat(json);
|
||||||
|
thinkLog.setAdminId(getLoginUserId());
|
||||||
|
thinkLog.setAdminName(getLoginUser().getRealName());
|
||||||
|
thinkLog.setDescription(desc);
|
||||||
|
thinkLog.setIp(request.getRemoteAddr());
|
||||||
|
thinkLog.setStatus(1);
|
||||||
|
thinkLog.setAddTime(System.currentTimeMillis() / 1000);
|
||||||
|
thinkLog.setLogType(0);
|
||||||
|
thinkLog.setOperateType(4);
|
||||||
|
}
|
||||||
if (thinkCardService.updateById(thinkCard)) {
|
if (thinkCardService.updateById(thinkCard)) {
|
||||||
thinkVipCardsBillsService.setCardUid(thinkCard.getId(), thinkCard.getUid());
|
thinkVipCardsBillsService.setCardUid(thinkCard.getId(), thinkCard.getUid());
|
||||||
|
if (thinkLog != null) {
|
||||||
|
thinkLog.setDescription(thinkLog.getDescription() + ".成功");
|
||||||
|
thinkLogService.save(thinkLog);
|
||||||
|
}
|
||||||
return success("修改成功");
|
return success("修改成功");
|
||||||
}
|
}
|
||||||
|
if (thinkLog != null) {
|
||||||
|
thinkLog.setDescription(thinkLog.getDescription() + ".失败");
|
||||||
|
thinkLogService.save(thinkLog);
|
||||||
|
}
|
||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ package com.gxwebsoft.think.controller;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||||
import com.gxwebsoft.think.entity.ThinkCard;
|
import com.gxwebsoft.think.entity.ThinkCard;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkCardBalance;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkVip;
|
||||||
|
import com.gxwebsoft.think.service.ThinkCardBalanceService;
|
||||||
import com.gxwebsoft.think.service.ThinkCardLogService;
|
import com.gxwebsoft.think.service.ThinkCardLogService;
|
||||||
import com.gxwebsoft.think.entity.ThinkCardLog;
|
import com.gxwebsoft.think.entity.ThinkCardLog;
|
||||||
import com.gxwebsoft.think.param.ThinkCardLogParam;
|
import com.gxwebsoft.think.param.ThinkCardLogParam;
|
||||||
@@ -13,14 +17,23 @@ 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.ThinkCardService;
|
import com.gxwebsoft.think.service.ThinkCardService;
|
||||||
|
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.beans.factory.annotation.Autowired;
|
||||||
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 javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||||
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||||
|
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||||
|
import org.apache.poi.xssf.streaming.SXSSFRow;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 控制器
|
* 控制器
|
||||||
@@ -36,6 +49,12 @@ public class ThinkCardLogController extends BaseController {
|
|||||||
private ThinkCardLogService thinkCardLogService;
|
private ThinkCardLogService thinkCardLogService;
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkCardService thinkCardService;
|
private ThinkCardService thinkCardService;
|
||||||
|
@Resource
|
||||||
|
private ThinkVipService thinkVipService;
|
||||||
|
@Resource
|
||||||
|
private ThinkCardBalanceService thinkCardBalanceService;
|
||||||
|
@Resource
|
||||||
|
private ConfigProperties config;
|
||||||
|
|
||||||
@ApiOperation("分页查询")
|
@ApiOperation("分页查询")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@@ -65,24 +84,41 @@ public class ThinkCardLogController extends BaseController {
|
|||||||
thinkCardLog.setAid(getLoginUserId());
|
thinkCardLog.setAid(getLoginUserId());
|
||||||
if (thinkCardLogService.save(thinkCardLog)) {
|
if (thinkCardLogService.save(thinkCardLog)) {
|
||||||
ThinkCard thinkCard = thinkCardService.getByCode(thinkCardLog.getCode());
|
ThinkCard thinkCard = thinkCardService.getByCode(thinkCardLog.getCode());
|
||||||
if (thinkCard.getExpireTime() > (DateUtil.currentSeconds() / 1000)) {
|
ThinkVip thinkVip = thinkVipService.getById(thinkCard.getVid());
|
||||||
thinkCard.setExpireTime((DateUtil.currentSeconds() / 1000) + (thinkCard.getTerm() * 86400 * 365) + (thinkCard.getMonth() * 86400 * 30));
|
|
||||||
|
if (thinkCard.getExpireTime() < DateUtil.currentSeconds()) {
|
||||||
|
thinkCard.setExpireTime((DateUtil.currentSeconds()) + (thinkVip.getTerm() * 86400 * 365) + (thinkVip.getMonth() * 86400 * 30) + (thinkVip.getDay() * 86400));
|
||||||
} else {
|
} else {
|
||||||
thinkCard.setExpireTime(thinkCard.getExpireTime() + (thinkCard.getTerm() * 86400 * 365) + (thinkCard.getMonth() * 86400 * 30));
|
thinkCard.setExpireTime(thinkCard.getExpireTime() + (thinkVip.getTerm() * 86400 * 365) + (thinkVip.getMonth() * 86400 * 30) + (thinkVip.getDay() * 86400));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ThinkCardBalance thinkCardBalance = new ThinkCardBalance();
|
||||||
|
thinkCardBalance.setCid(thinkCard.getId());
|
||||||
|
thinkCardBalance.setUid(thinkCard.getUid());
|
||||||
|
thinkCardBalance.setBalance(thinkVip.getPrice());
|
||||||
|
thinkCardBalance.setReduceEach(thinkCardBalanceService.getThinkCardBalance(thinkVip));
|
||||||
|
thinkCardBalance.setType(thinkVip.getType());
|
||||||
|
thinkCardBalance.setDiscount(thinkVip.getDiscount());
|
||||||
|
thinkCardBalance.setVipId(thinkVip.getId());
|
||||||
|
thinkCardBalance.setUpdateTime(DateUtil.currentSeconds());
|
||||||
|
thinkCardBalance.setCreateTime(DateUtil.currentSeconds());
|
||||||
|
thinkCardBalanceService.save(thinkCardBalance);
|
||||||
|
|
||||||
|
if (thinkCard.getExpireTime() < (DateUtil.currentSeconds())) {
|
||||||
|
thinkCard.setRemainingMoney(thinkCardLog.getMoney());
|
||||||
|
} else {
|
||||||
|
thinkCard.setRemainingMoney(thinkCardLog.getMoney().add(thinkCard.getRemainingMoney()));
|
||||||
|
}
|
||||||
|
|
||||||
// 充值卡
|
// 充值卡
|
||||||
if (thinkCard.getType().equals(4) || thinkCard.getType().equals(5)) {
|
if (thinkCard.getType().equals(4) || thinkCard.getType().equals(5)) {
|
||||||
// 是否已过期,过期的清空,未过期的在旧卡基础上叠加
|
// 是否已过期,过期的清空,未过期的在旧卡基础上叠加
|
||||||
if (thinkCard.getExpireTime() < (DateUtil.currentSeconds() / 1000)) {
|
|
||||||
thinkCard.setRemainingMoney(thinkCardLog.getMoney());
|
|
||||||
} else {
|
|
||||||
thinkCard.setRemainingMoney(thinkCardLog.getMoney().add(thinkCard.getRemainingMoney()));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (thinkCard.getExpireTime() < (DateUtil.currentSeconds() / 1000)) {
|
if (thinkCard.getExpireTime() < (DateUtil.currentSeconds())) {
|
||||||
thinkCard.setNum(thinkCardLog.getCount());
|
thinkCard.setNum(thinkCardLog.getCount());
|
||||||
} else {
|
} else {
|
||||||
thinkCard.setNum(thinkCardLog.getCount() + thinkCard.getCount());
|
thinkCard.setNum(thinkCardLog.getCount() + thinkCard.getNum());
|
||||||
}
|
}
|
||||||
// thinkCard.setNum(thinkCard.getCount() + thinkCard.getCount());
|
// thinkCard.setNum(thinkCard.getCount() + thinkCard.getCount());
|
||||||
}
|
}
|
||||||
@@ -139,4 +175,49 @@ public class ThinkCardLogController extends BaseController {
|
|||||||
return fail("删除失败");
|
return fail("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public ApiResult<?> export(@RequestBody ThinkCardLogParam param) throws IOException {
|
||||||
|
List<ThinkCardLog> logList = thinkCardLogService.listRel(param);
|
||||||
|
String filename = "excel/卡充值记录-" + new Date().getTime() + ".xlsx";
|
||||||
|
String path = config.getUploadPath() + filename;
|
||||||
|
SXSSFWorkbook workbook = new SXSSFWorkbook();
|
||||||
|
SXSSFSheet sheet = workbook.createSheet();
|
||||||
|
String[] headers = {"卡号", "姓名", "手机号", "会员卡名称", "支付方式", "充值金额", "充值次数", "操作员", "第三方订单号", "充值时间"};
|
||||||
|
for (int i = 0; i < headers.length; i++) {
|
||||||
|
sheet.setColumnWidth(i, 20 * 256);
|
||||||
|
}
|
||||||
|
SXSSFRow row = sheet.createRow(0);
|
||||||
|
for (int i = 0; i < headers.length; i++) {
|
||||||
|
row.createCell(i).setCellValue(headers[i]);
|
||||||
|
}
|
||||||
|
String[] payTypeArr = {"", "微信支付", "支付宝支付", "现金支付", "POS机支付"};
|
||||||
|
int rowNum = 1;
|
||||||
|
for (ThinkCardLog log : logList) {
|
||||||
|
SXSSFRow dataRow = sheet.createRow(rowNum);
|
||||||
|
dataRow.createCell(0).setCellValue(log.getCode() != null ? log.getCode() : "");
|
||||||
|
dataRow.createCell(1).setCellValue(log.getUsername() != null ? log.getUsername() : "");
|
||||||
|
dataRow.createCell(2).setCellValue(log.getPhone() != null ? log.getPhone() : "");
|
||||||
|
dataRow.createCell(3).setCellValue(log.getCardName() != null ? log.getCardName() : "");
|
||||||
|
String payTypeStr = (log.getPayType() != null && log.getPayType() > 0 && log.getPayType() < payTypeArr.length) ? payTypeArr[log.getPayType()] : "";
|
||||||
|
dataRow.createCell(4).setCellValue(payTypeStr);
|
||||||
|
dataRow.createCell(5).setCellValue(log.getMoney() != null ? log.getMoney().toString() : "");
|
||||||
|
dataRow.createCell(6).setCellValue(log.getCount() != null ? log.getCount() : 0);
|
||||||
|
dataRow.createCell(7).setCellValue(log.getAdminName() != null ? log.getAdminName() : "");
|
||||||
|
dataRow.createCell(8).setCellValue(log.getWechatOrder() != null ? log.getWechatOrder() : "");
|
||||||
|
dataRow.createCell(9).setCellValue(log.getCreateTime() != null ? DateUtil.format(DateUtil.date(log.getCreateTime() * 1000), "yyyy-MM-dd HH:mm:ss") : "");
|
||||||
|
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,5 +1,6 @@
|
|||||||
package com.gxwebsoft.think.controller;
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
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.ThinkFieldService;
|
import com.gxwebsoft.think.service.ThinkFieldService;
|
||||||
import com.gxwebsoft.think.entity.ThinkField;
|
import com.gxwebsoft.think.entity.ThinkField;
|
||||||
@@ -63,6 +64,8 @@ public class ThinkFieldController extends BaseController {
|
|||||||
@ApiOperation("添加")
|
@ApiOperation("添加")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ThinkField thinkField) {
|
public ApiResult<?> save(@RequestBody ThinkField thinkField) {
|
||||||
|
thinkField.setCreateTime((int) DateUtil.currentSeconds());
|
||||||
|
thinkField.setUpdateTime((int) DateUtil.currentSeconds());
|
||||||
if (thinkFieldService.save(thinkField)) {
|
if (thinkFieldService.save(thinkField)) {
|
||||||
return success("添加成功");
|
return success("添加成功");
|
||||||
}
|
}
|
||||||
@@ -72,6 +75,7 @@ public class ThinkFieldController extends BaseController {
|
|||||||
@ApiOperation("修改")
|
@ApiOperation("修改")
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody ThinkField thinkField) {
|
public ApiResult<?> update(@RequestBody ThinkField thinkField) {
|
||||||
|
thinkField.setUpdateTime((int) DateUtil.currentSeconds());
|
||||||
if (thinkFieldService.updateById(thinkField)) {
|
if (thinkFieldService.updateById(thinkField)) {
|
||||||
return success("修改成功");
|
return success("修改成功");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,401 @@
|
|||||||
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkOrder;
|
||||||
|
import com.gxwebsoft.think.service.ThinkFtpCheckBillService;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkFtpCheckBill;
|
||||||
|
import com.gxwebsoft.think.param.ThinkFtpCheckBillParam;
|
||||||
|
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.apache.commons.net.ftp.FTP;
|
||||||
|
import org.apache.commons.net.ftp.FTPClient;
|
||||||
|
import org.apache.commons.net.ftp.FTPFile;
|
||||||
|
import org.apache.commons.net.ftp.FTPReply;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 控制器
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-05-21 11:58:28
|
||||||
|
*/
|
||||||
|
@Api(tags = "管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/think/think-ftp-check-bill")
|
||||||
|
public class ThinkFtpCheckBillController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private ThinkFtpCheckBillService thinkFtpCheckBillService;
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderService thinkOrderService;
|
||||||
|
|
||||||
|
@Value("${config.upload-path}")
|
||||||
|
private String uploadPath;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<ThinkFtpCheckBill>> page(ThinkFtpCheckBillParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkFtpCheckBillService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<ThinkFtpCheckBill>> list(ThinkFtpCheckBillParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkFtpCheckBillService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('think:thinkFtpCheckBill:list')")
|
||||||
|
@ApiOperation("根据id查询")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<ThinkFtpCheckBill> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkFtpCheckBillService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody ThinkFtpCheckBill thinkFtpCheckBill) {
|
||||||
|
if (thinkFtpCheckBillService.save(thinkFtpCheckBill)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody ThinkFtpCheckBill thinkFtpCheckBill) {
|
||||||
|
if (thinkFtpCheckBillService.updateById(thinkFtpCheckBill)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (thinkFtpCheckBillService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量添加")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<ThinkFtpCheckBill> list) {
|
||||||
|
if (thinkFtpCheckBillService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量修改")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<ThinkFtpCheckBill> batchParam) {
|
||||||
|
if (batchParam.update(thinkFtpCheckBillService, "id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量删除")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (thinkFtpCheckBillService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("FTP同步")
|
||||||
|
@GetMapping("/async")
|
||||||
|
public ApiResult<?> async() {
|
||||||
|
FTPClient ftpClient = new FTPClient();
|
||||||
|
try {
|
||||||
|
// 配置FTP连接参数
|
||||||
|
ftpClient.connect("uisftp.chinaums.com", 21);
|
||||||
|
ftpClient.login("103000-8984501651390AT", "651390At!");
|
||||||
|
ftpClient.enterLocalPassiveMode();
|
||||||
|
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
|
||||||
|
ftpClient.setControlEncoding("UTF-8");
|
||||||
|
|
||||||
|
// 连接到FTP服务器
|
||||||
|
int replyCode = ftpClient.getReplyCode();
|
||||||
|
if (!FTPReply.isPositiveCompletion(replyCode)) {
|
||||||
|
throw new RuntimeException("FTP服务器连接失败");
|
||||||
|
}
|
||||||
|
ftpClient.changeWorkingDirectory("/build");
|
||||||
|
// 文件列表
|
||||||
|
for (FTPFile file : ftpClient.listFiles()) {
|
||||||
|
if (file.isFile()) {
|
||||||
|
// 获取文件名
|
||||||
|
String fileName = file.getName();
|
||||||
|
// 下载文件
|
||||||
|
String remoteFilePath = "/build/" + fileName;
|
||||||
|
String localFilePath = uploadPath + "excel/" + fileName;
|
||||||
|
if (!FileUtil.exist(localFilePath)) {
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(localFilePath);
|
||||||
|
ftpClient.retrieveFile(remoteFilePath, outputStream);
|
||||||
|
outputStream.flush();
|
||||||
|
outputStream.close();
|
||||||
|
System.out.println("对账文件: " + fileName);
|
||||||
|
FileInputStream fileInputStream = new FileInputStream(localFilePath);
|
||||||
|
HSSFWorkbook workbook = new HSSFWorkbook(fileInputStream);
|
||||||
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
List<ThinkFtpCheckBill> thinkFtpCheckBillList = new ArrayList<>();
|
||||||
|
for (Row row : sheet) {
|
||||||
|
if (row.getRowNum() > 3 &&
|
||||||
|
(row.getCell(4).toString().equals("消费") || row.getCell(5).toString().equals("消费"))) {
|
||||||
|
String deviceNo = "";
|
||||||
|
String cardNo = "";
|
||||||
|
double amount = 0;
|
||||||
|
double settleAmount = 0;
|
||||||
|
double feeAmount = 0;
|
||||||
|
double paidAmount = 0;
|
||||||
|
String refNo = "";
|
||||||
|
String flowNo = "";
|
||||||
|
String cardType = "";
|
||||||
|
String postCardType = "";
|
||||||
|
String payType = "";
|
||||||
|
String orderNo = "";
|
||||||
|
LocalDateTime payTime = null;
|
||||||
|
if (row.getCell(4).toString().equals("消费")) {
|
||||||
|
cardNo = row.getCell(3).toString();
|
||||||
|
amount = row.getCell(5).getNumericCellValue();
|
||||||
|
deviceNo = row.getCell(6).toString();
|
||||||
|
settleAmount = Double.parseDouble(row.getCell(7).toString());
|
||||||
|
feeAmount = Double.parseDouble(row.getCell(8).toString());
|
||||||
|
refNo = row.getCell(9).toString();
|
||||||
|
flowNo = row.getCell(10).toString();
|
||||||
|
paidAmount = Double.parseDouble(row.getCell(16).toString());
|
||||||
|
cardType = row.getCell(11).toString();
|
||||||
|
orderNo = row.getCell(12).toString();
|
||||||
|
postCardType = row.getCell(21).toString();
|
||||||
|
payType = row.getCell(13).toString();
|
||||||
|
} else {
|
||||||
|
deviceNo = row.getCell(3).toString();
|
||||||
|
cardNo = row.getCell(4).toString();
|
||||||
|
amount = row.getCell(6).getNumericCellValue();
|
||||||
|
settleAmount = Double.parseDouble(row.getCell(7).toString());
|
||||||
|
feeAmount = Double.parseDouble(row.getCell(8).toString());
|
||||||
|
paidAmount = Double.parseDouble(row.getCell(9).toString());
|
||||||
|
refNo = row.getCell(10).toString();
|
||||||
|
flowNo = row.getCell(11).toString();
|
||||||
|
cardType = row.getCell(12).toString();
|
||||||
|
postCardType = row.getCell(13).toString();
|
||||||
|
payType = row.getCell(14).toString();
|
||||||
|
orderNo = row.getCell(15).toString();
|
||||||
|
}
|
||||||
|
Date dateItem = row.getCell(1).getDateCellValue();
|
||||||
|
String date = DateUtil.format(dateItem, "yyyy-MM-dd");
|
||||||
|
long startTime = dateItem.getTime() / 1000;
|
||||||
|
long endTime = DateUtil.parse(date + " 23:59:59", "yyyy-MM-dd HH:mm:ss").getTime() / 1000;
|
||||||
|
payTime = LocalDateTimeUtil.parse(date + " " + row.getCell(2).toString(), "yyyy-MM-dd HH:mm:ss");
|
||||||
|
if (!flowNo.isEmpty() && !orderNo.isEmpty()) {
|
||||||
|
ThinkFtpCheckBill check = thinkFtpCheckBillService.getByOrderNo(orderNo);
|
||||||
|
if (check == null) {
|
||||||
|
ThinkFtpCheckBill thinkFtpCheckBill = new ThinkFtpCheckBill();
|
||||||
|
thinkFtpCheckBill.setDeviceNo(deviceNo);
|
||||||
|
thinkFtpCheckBill.setCardNo(cardNo);
|
||||||
|
thinkFtpCheckBill.setOrderNo(orderNo);
|
||||||
|
thinkFtpCheckBill.setAmount(BigDecimal.valueOf(amount));
|
||||||
|
thinkFtpCheckBill.setSettleAmount(BigDecimal.valueOf(settleAmount));
|
||||||
|
thinkFtpCheckBill.setFeeAmount(BigDecimal.valueOf(feeAmount));
|
||||||
|
thinkFtpCheckBill.setPaidAmount(BigDecimal.valueOf(paidAmount));
|
||||||
|
thinkFtpCheckBill.setRefNo(refNo);
|
||||||
|
thinkFtpCheckBill.setFlowNo(flowNo);
|
||||||
|
thinkFtpCheckBill.setCardType(cardType);
|
||||||
|
thinkFtpCheckBill.setPostCardType(postCardType);
|
||||||
|
thinkFtpCheckBill.setPayType(payType);
|
||||||
|
thinkFtpCheckBill.setPayTime(payTime);
|
||||||
|
if (payTime != null) {
|
||||||
|
thinkFtpCheckBill.setPayTime(payTime);
|
||||||
|
}
|
||||||
|
thinkFtpCheckBillList.add(thinkFtpCheckBill);
|
||||||
|
}
|
||||||
|
ThinkOrder thinkOrder = thinkOrderService.getUnCheckBillByWechatCode(flowNo, startTime, endTime);
|
||||||
|
if (thinkOrder != null) {
|
||||||
|
BigDecimal price = BigDecimal.valueOf(amount);
|
||||||
|
if (thinkOrder.getPayPrice().compareTo(price) == 0) {
|
||||||
|
System.out.println("check bill: " + thinkOrder.getOrderNum());
|
||||||
|
thinkOrder.setCheckBill(1);
|
||||||
|
thinkOrderService.updateById(thinkOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!thinkFtpCheckBillList.isEmpty()) {
|
||||||
|
thinkFtpCheckBillService.saveBatch(thinkFtpCheckBillList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 断开与FTP服务器的连接
|
||||||
|
ftpClient.logout();
|
||||||
|
ftpClient.disconnect();
|
||||||
|
return success();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println("PDF文件下载失败");
|
||||||
|
return fail(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("FTP同步")
|
||||||
|
public void ftpAsync() {
|
||||||
|
FTPClient ftpClient = new FTPClient();
|
||||||
|
try {
|
||||||
|
// 配置FTP连接参数
|
||||||
|
ftpClient.connect("uisftp.chinaums.com", 21);
|
||||||
|
ftpClient.login("103000-8984501651390AT", "651390At!");
|
||||||
|
ftpClient.enterLocalPassiveMode();
|
||||||
|
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
|
||||||
|
ftpClient.setControlEncoding("UTF-8");
|
||||||
|
|
||||||
|
// 连接到FTP服务器
|
||||||
|
int replyCode = ftpClient.getReplyCode();
|
||||||
|
if (!FTPReply.isPositiveCompletion(replyCode)) {
|
||||||
|
throw new RuntimeException("FTP服务器连接失败");
|
||||||
|
}
|
||||||
|
ftpClient.changeWorkingDirectory("/build");
|
||||||
|
// 文件列表
|
||||||
|
for (FTPFile file : ftpClient.listFiles()) {
|
||||||
|
if (file.isFile()) {
|
||||||
|
// 获取文件名
|
||||||
|
String fileName = file.getName();
|
||||||
|
// 下载文件
|
||||||
|
String remoteFilePath = "/build/" + fileName;
|
||||||
|
String localFilePath = uploadPath + "excel/" + fileName;
|
||||||
|
if (!FileUtil.exist(localFilePath)) {
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(localFilePath);
|
||||||
|
ftpClient.retrieveFile(remoteFilePath, outputStream);
|
||||||
|
outputStream.flush();
|
||||||
|
outputStream.close();
|
||||||
|
System.out.println("对账文件: " + fileName);
|
||||||
|
FileInputStream fileInputStream = new FileInputStream(localFilePath);
|
||||||
|
HSSFWorkbook workbook = new HSSFWorkbook(fileInputStream);
|
||||||
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
List<ThinkFtpCheckBill> thinkFtpCheckBillList = new ArrayList<>();
|
||||||
|
for (Row row : sheet) {
|
||||||
|
if (row.getRowNum() > 3 &&
|
||||||
|
(row.getCell(4).toString().equals("消费") || row.getCell(5).toString().equals("消费"))) {
|
||||||
|
String deviceNo = "";
|
||||||
|
String cardNo = "";
|
||||||
|
double amount = 0;
|
||||||
|
double settleAmount = 0;
|
||||||
|
double feeAmount = 0;
|
||||||
|
double paidAmount = 0;
|
||||||
|
String refNo = "";
|
||||||
|
String flowNo = "";
|
||||||
|
String cardType = "";
|
||||||
|
String postCardType = "";
|
||||||
|
String payType = "";
|
||||||
|
String orderNo = "";
|
||||||
|
LocalDateTime payTime = null;
|
||||||
|
if (row.getCell(4).toString().equals("消费")) {
|
||||||
|
cardNo = row.getCell(3).toString();
|
||||||
|
amount = row.getCell(5).getNumericCellValue();
|
||||||
|
deviceNo = row.getCell(6).toString();
|
||||||
|
settleAmount = Double.parseDouble(row.getCell(7).toString());
|
||||||
|
feeAmount = Double.parseDouble(row.getCell(8).toString());
|
||||||
|
refNo = row.getCell(9).toString();
|
||||||
|
flowNo = row.getCell(10).toString();
|
||||||
|
paidAmount = Double.parseDouble(row.getCell(16).toString());
|
||||||
|
cardType = row.getCell(11).toString();
|
||||||
|
orderNo = row.getCell(12).toString();
|
||||||
|
postCardType = row.getCell(21).toString();
|
||||||
|
payType = row.getCell(13).toString();
|
||||||
|
} else {
|
||||||
|
deviceNo = row.getCell(3).toString();
|
||||||
|
cardNo = row.getCell(4).toString();
|
||||||
|
amount = row.getCell(6).getNumericCellValue();
|
||||||
|
settleAmount = Double.parseDouble(row.getCell(7).toString());
|
||||||
|
feeAmount = Double.parseDouble(row.getCell(8).toString());
|
||||||
|
paidAmount = Double.parseDouble(row.getCell(9).toString());
|
||||||
|
refNo = row.getCell(10).toString();
|
||||||
|
flowNo = row.getCell(11).toString();
|
||||||
|
cardType = row.getCell(12).toString();
|
||||||
|
postCardType = row.getCell(13).toString();
|
||||||
|
payType = row.getCell(14).toString();
|
||||||
|
orderNo = row.getCell(15).toString();
|
||||||
|
}
|
||||||
|
Date dateItem = row.getCell(1).getDateCellValue();
|
||||||
|
String date = DateUtil.format(dateItem, "yyyy-MM-dd");
|
||||||
|
long startTime = dateItem.getTime() / 1000;
|
||||||
|
long endTime = DateUtil.parse(date + " 23:59:59", "yyyy-MM-dd HH:mm:ss").getTime() / 1000;
|
||||||
|
payTime = LocalDateTimeUtil.parse(date + " " + row.getCell(2).toString(), "yyyy-MM-dd HH:mm:ss");
|
||||||
|
if (!flowNo.isEmpty() && !orderNo.isEmpty()) {
|
||||||
|
ThinkFtpCheckBill check = thinkFtpCheckBillService.getByOrderNo(orderNo);
|
||||||
|
if (check == null) {
|
||||||
|
ThinkFtpCheckBill thinkFtpCheckBill = new ThinkFtpCheckBill();
|
||||||
|
thinkFtpCheckBill.setDeviceNo(deviceNo);
|
||||||
|
thinkFtpCheckBill.setCardNo(cardNo);
|
||||||
|
thinkFtpCheckBill.setOrderNo(orderNo);
|
||||||
|
thinkFtpCheckBill.setAmount(BigDecimal.valueOf(amount));
|
||||||
|
thinkFtpCheckBill.setSettleAmount(BigDecimal.valueOf(settleAmount));
|
||||||
|
thinkFtpCheckBill.setFeeAmount(BigDecimal.valueOf(feeAmount));
|
||||||
|
thinkFtpCheckBill.setPaidAmount(BigDecimal.valueOf(paidAmount));
|
||||||
|
thinkFtpCheckBill.setRefNo(refNo);
|
||||||
|
thinkFtpCheckBill.setFlowNo(flowNo);
|
||||||
|
thinkFtpCheckBill.setCardType(cardType);
|
||||||
|
thinkFtpCheckBill.setPostCardType(postCardType);
|
||||||
|
thinkFtpCheckBill.setPayType(payType);
|
||||||
|
thinkFtpCheckBill.setPayTime(payTime);
|
||||||
|
if (payTime != null) {
|
||||||
|
thinkFtpCheckBill.setPayTime(payTime);
|
||||||
|
}
|
||||||
|
thinkFtpCheckBillList.add(thinkFtpCheckBill);
|
||||||
|
}
|
||||||
|
ThinkOrder thinkOrder = thinkOrderService.getUnCheckBillByWechatCode(flowNo, startTime, endTime);
|
||||||
|
if (thinkOrder != null) {
|
||||||
|
BigDecimal price = BigDecimal.valueOf(amount);
|
||||||
|
if (thinkOrder.getPayPrice().compareTo(price) == 0) {
|
||||||
|
System.out.println("check bill: " + thinkOrder.getOrderNum());
|
||||||
|
thinkOrder.setCheckBill(1);
|
||||||
|
thinkOrderService.updateById(thinkOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!thinkFtpCheckBillList.isEmpty()) {
|
||||||
|
thinkFtpCheckBillService.saveBatch(thinkFtpCheckBillList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 断开与FTP服务器的连接
|
||||||
|
ftpClient.logout();
|
||||||
|
ftpClient.disconnect();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println("PDF文件下载失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -172,7 +172,8 @@ public class ThinkGoodsOrderController extends BaseController {
|
|||||||
// 微信统一下单接口
|
// 微信统一下单接口
|
||||||
if (order.getPayType().equals(PAY_TYPE_WECHAT)) {
|
if (order.getPayType().equals(PAY_TYPE_WECHAT)) {
|
||||||
String desc = order.getInfoList().get(0).getTitle();
|
String desc = order.getInfoList().get(0).getTitle();
|
||||||
return success("下单成功", thinkOrderService.createWxOrder(order.getPayPrice(), order.getOrderNum(), desc, getLoginUser().getOpenid()));
|
return success("下单成功", thinkOrderService.createWxOrder(order.getPayPrice(), order.getOrderNum(),
|
||||||
|
desc, getLoginUser().getOpenid(), "https://gxtyzx-api2.websoft.top/api/think/think-order/notify"));
|
||||||
}
|
}
|
||||||
if (order.getPayType().equals(2)) {
|
if (order.getPayType().equals(2)) {
|
||||||
updatePay(order, null, order.getTotalPrice().multiply(BigDecimal.valueOf(100)).intValue());
|
updatePay(order, null, order.getTotalPrice().multiply(BigDecimal.valueOf(100)).intValue());
|
||||||
|
|||||||
@@ -55,7 +55,11 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ThinkSiteService thinkSiteService;
|
private ThinkSiteService thinkSiteService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private ThinkCardService thinkCardService;
|
||||||
|
@Resource
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
|
@Resource
|
||||||
|
private ThinkRechargeLogService thinkRechargeLogService;
|
||||||
|
|
||||||
// private final String taxnum = "339901999999142";
|
// private final String taxnum = "339901999999142";
|
||||||
// private final String appKey = "SD56531018";
|
// private final String appKey = "SD56531018";
|
||||||
@@ -68,12 +72,17 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
private final String appSecret = "D51901886E454FEF";
|
private final String appSecret = "D51901886E454FEF";
|
||||||
private final String sellerTel = "18907712789";
|
private final String sellerTel = "18907712789";
|
||||||
private final String url = "https://sdk.nuonuo.com/open/v1/services";
|
private final String url = "https://sdk.nuonuo.com/open/v1/services";
|
||||||
|
private final String clerk = "刘绍仪";
|
||||||
|
private final String extensionNumber = "6192";
|
||||||
|
// private final String clerk = "赵裕璐";
|
||||||
|
// private final String extensionNumber = "7426";
|
||||||
|
|
||||||
@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());
|
if (param.getForAdmin() == null) param.setUid(getLoginUser().getUid());
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
|
param.setDeleted(0);
|
||||||
return success(thinkInvoiceService.pageRel(param));
|
return success(thinkInvoiceService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +94,9 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
@ApiOperation("查询全部")
|
@ApiOperation("查询全部")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<ThinkInvoice>> list(ThinkInvoiceParam param) {
|
public ApiResult<List<ThinkInvoice>> list(ThinkInvoiceParam param) {
|
||||||
|
if (param.getForAdmin() == null) param.setUid(getLoginUser().getUid());
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
|
param.setDeleted(0);
|
||||||
return success(thinkInvoiceService.listRel(param));
|
return success(thinkInvoiceService.listRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,9 +111,11 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
@ApiOperation("添加")
|
@ApiOperation("添加")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ThinkInvoice thinkInvoice) {
|
public ApiResult<?> save(@RequestBody ThinkInvoice thinkInvoice) {
|
||||||
|
if (thinkInvoice.getCode() == null || thinkInvoice.getCode().isEmpty())
|
||||||
|
return fail("请输入税号");
|
||||||
thinkInvoice.setIncoiveNum("");
|
thinkInvoice.setIncoiveNum("");
|
||||||
thinkInvoice.setUid(getLoginUser().getUid());
|
thinkInvoice.setUid(getLoginUser().getUid());
|
||||||
thinkInvoice.setCode(thinkInvoice.getIncoiveCode());
|
// thinkInvoice.setCode(thinkInvoice.getIncoiveCode());
|
||||||
thinkInvoice.setIncoiveNum(RandomUtil.randomString(20));
|
thinkInvoice.setIncoiveNum(RandomUtil.randomString(20));
|
||||||
if (!thinkInvoice.getIsOpen().equals(1)) thinkInvoice.setIsOpen(2);
|
if (!thinkInvoice.getIsOpen().equals(1)) thinkInvoice.setIsOpen(2);
|
||||||
thinkInvoice.setCreateTime(DateUtil.currentSeconds());
|
thinkInvoice.setCreateTime(DateUtil.currentSeconds());
|
||||||
@@ -115,8 +128,10 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
}
|
}
|
||||||
} else if (thinkInvoice.getItype().equals(2)) {
|
} else if (thinkInvoice.getItype().equals(2)) {
|
||||||
if (thinkInvoice.getOid() != null) {
|
if (thinkInvoice.getOid() != null) {
|
||||||
ThinkUsersVip thinkUsersVip = thinkUsersVipService.getById(thinkInvoice.getOid());
|
// ThinkUsersVip thinkUsersVip = thinkUsersVipService.getById(thinkInvoice.getOid());
|
||||||
thinkInvoice.setInfo(thinkUsersVip.getName() + " 微信订单号: " + thinkUsersVip.getWechatOrder());
|
// thinkInvoice.setInfo(thinkUsersVip.getName() + " 微信订单号: " + thinkUsersVip.getWechatOrder());
|
||||||
|
ThinkRechargeLog thinkRechargeLog = thinkRechargeLogService.getById(thinkInvoice.getOid());
|
||||||
|
thinkInvoice.setInfo("订单号: " + thinkRechargeLog.getOrderNum());
|
||||||
}
|
}
|
||||||
} else if (thinkInvoice.getItype().equals(4)) {
|
} else if (thinkInvoice.getItype().equals(4)) {
|
||||||
thinkInvoice.setInfo("租赁发票");
|
thinkInvoice.setInfo("租赁发票");
|
||||||
@@ -175,6 +190,9 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
@ApiOperation("发票合开")
|
@ApiOperation("发票合开")
|
||||||
@PostMapping("/doInvoiceByList")
|
@PostMapping("/doInvoiceByList")
|
||||||
public ApiResult<?> doInvoiceByList(@RequestBody ThinkInvoice thinkInvoice) {
|
public ApiResult<?> doInvoiceByList(@RequestBody ThinkInvoice thinkInvoice) {
|
||||||
|
if (thinkInvoice.getCode() == null) return fail("请输入税号");
|
||||||
|
String taxCode = thinkInvoice.getCode().replaceAll(" ", "");
|
||||||
|
thinkInvoice.setCode(taxCode);
|
||||||
List<ThinkInvoice> thinkInvoiceList = new ArrayList<>();
|
List<ThinkInvoice> thinkInvoiceList = new ArrayList<>();
|
||||||
List<ThinkOrder> thinkOrderList = thinkOrderService.listByIds(thinkInvoice.getOrderIdList());
|
List<ThinkOrder> thinkOrderList = thinkOrderService.listByIds(thinkInvoice.getOrderIdList());
|
||||||
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listByOrderIds(thinkInvoice.getOrderIdList());
|
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listByOrderIds(thinkInvoice.getOrderIdList());
|
||||||
@@ -182,13 +200,9 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
// startTimeList排序
|
// startTimeList排序
|
||||||
ThinkOrder firstOrder = thinkOrderList.get(0);
|
ThinkOrder firstOrder = thinkOrderList.get(0);
|
||||||
ThinkSite thinkSite = thinkSiteService.getById(firstOrder.getSid());
|
ThinkSite thinkSite = thinkSiteService.getById(firstOrder.getSid());
|
||||||
String rentStartTime = thinkSite.getRentStartDate();
|
startTimeList = startTimeList.stream().sorted().toList();
|
||||||
String rentEndTime = thinkSite.getRentEndDate();
|
String rentStartTime = DateUtil.format(DateUtil.date((startTimeList.get(0) * 1000L)), "yyyy-MM-dd");
|
||||||
if (!startTimeList.isEmpty()) {
|
String rentEndTime = DateUtil.format(DateUtil.date((startTimeList.get(startTimeList.size() - 1) * 1000L)), "yyyy-MM-dd");
|
||||||
startTimeList.sort(Integer::compareTo);
|
|
||||||
rentStartTime = DateUtil.format(DateUtil.date((startTimeList.get(0) * 1000L)), "yyyy-MM-dd");
|
|
||||||
rentEndTime = DateUtil.format(DateUtil.date((startTimeList.get(startTimeList.size() - 1) * 1000L)), "yyyy-MM-dd");
|
|
||||||
}
|
|
||||||
String invoiceNum = RandomUtil.randomString(20);
|
String invoiceNum = RandomUtil.randomString(20);
|
||||||
for (Integer orderId : thinkInvoice.getOrderIdList()) {
|
for (Integer orderId : thinkInvoice.getOrderIdList()) {
|
||||||
ThinkOrder thinkOrder = thinkOrderList.stream().filter(o -> o.getId().equals(orderId)).findFirst().orElse(null);
|
ThinkOrder thinkOrder = thinkOrderList.stream().filter(o -> o.getId().equals(orderId)).findFirst().orElse(null);
|
||||||
@@ -220,6 +234,10 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
thinkInvoiceList.add(thinkInvoice1);
|
thinkInvoiceList.add(thinkInvoice1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (ThinkOrder thinkOrder : thinkOrderList) {
|
||||||
|
thinkOrder.setIsInvoice(1);
|
||||||
|
}
|
||||||
|
thinkOrderService.updateBatchById(thinkOrderList);
|
||||||
thinkInvoiceService.saveBatch(thinkInvoiceList);
|
thinkInvoiceService.saveBatch(thinkInvoiceList);
|
||||||
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
||||||
String method = "nuonuo.OpeMplatform.requestBillingNew";//API方法名
|
String method = "nuonuo.OpeMplatform.requestBillingNew";//API方法名
|
||||||
@@ -234,7 +252,7 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
order.setSalerTel(sellerTel);
|
order.setSalerTel(sellerTel);
|
||||||
order.setOrderNo(invoiceNum);
|
order.setOrderNo(invoiceNum);
|
||||||
order.setInvoiceDate(DateUtil.now());
|
order.setInvoiceDate(DateUtil.now());
|
||||||
order.setClerk("赵裕璐");
|
order.setClerk(clerk);
|
||||||
order.setPayee("班嘉良");
|
order.setPayee("班嘉良");
|
||||||
order.setChecker("蓝蕙孚");
|
order.setChecker("蓝蕙孚");
|
||||||
order.setShowCheckerType("1");
|
order.setShowCheckerType("1");
|
||||||
@@ -244,10 +262,8 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
goods.setGoodsName("*经营租赁*场地费");
|
goods.setGoodsName("*经营租赁*场地费");
|
||||||
|
|
||||||
goods.setGoodsCode("3040502029902");
|
goods.setGoodsCode("3040502029902");
|
||||||
// 不含税单价
|
// goods.setPrice(thinkInvoice.getPrice().toString());
|
||||||
final BigDecimal taxExcludedAmount = thinkInvoice.getPrice().multiply(new BigDecimal("0.95")).setScale(2, RoundingMode.HALF_UP);
|
goods.setNum(thinkSite.getSize().toString());
|
||||||
goods.setPrice(taxExcludedAmount.toString());
|
|
||||||
goods.setNum("1");
|
|
||||||
goods.setWithTaxFlag("0");
|
goods.setWithTaxFlag("0");
|
||||||
goods.setDField1("无");
|
goods.setDField1("无");
|
||||||
goods.setDField2("无");
|
goods.setDField2("无");
|
||||||
@@ -256,21 +272,29 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
goods.setDField5("无");
|
goods.setDField5("无");
|
||||||
goods.setTaxRate("0.05");
|
goods.setTaxRate("0.05");
|
||||||
goods.setFavouredPolicyFlag("09");
|
goods.setFavouredPolicyFlag("09");
|
||||||
final BigDecimal tax = thinkInvoice.getPrice().multiply(new BigDecimal("0.05")).setScale(2, RoundingMode.HALF_UP);
|
|
||||||
|
BigDecimal taxRate = BigDecimal.valueOf(0.05);
|
||||||
|
goods.setPrice(thinkInvoice.getPrice()
|
||||||
|
.divide(BigDecimal.valueOf(1.05), 8, RoundingMode.HALF_UP)
|
||||||
|
.divide(thinkSite.getSize(), 8, RoundingMode.HALF_UP).toString());
|
||||||
|
final BigDecimal tax = thinkInvoice.getPrice().divide(BigDecimal.valueOf(1.05), 2, RoundingMode.HALF_UP)
|
||||||
|
.multiply(taxRate).setScale(2, RoundingMode.DOWN);
|
||||||
goods.setTax(tax.toString());
|
goods.setTax(tax.toString());
|
||||||
|
goods.setTaxIncludedAmount(thinkInvoice.getPrice().toString());
|
||||||
|
goods.setTaxExcludedAmount(thinkInvoice.getPrice().subtract(tax).toString());
|
||||||
order.setInvoiceDetail(goods);
|
order.setInvoiceDetail(goods);
|
||||||
|
|
||||||
NuoNuoRealPropertyRentInfo nuoNuoRealPropertyRentInfo = new NuoNuoRealPropertyRentInfo();
|
NuoNuoRealPropertyRentInfo nuoNuoRealPropertyRentInfo = new NuoNuoRealPropertyRentInfo();
|
||||||
nuoNuoRealPropertyRentInfo.setRealPropertyAddress(thinkSite.getProvince() + thinkSite.getCity() + thinkSite.getRegion());
|
nuoNuoRealPropertyRentInfo.setRealPropertyAddress(thinkSite.getProvince() + thinkSite.getCity() + thinkSite.getRegion());
|
||||||
nuoNuoRealPropertyRentInfo.setDetailAddress(thinkSite.getAddress());
|
nuoNuoRealPropertyRentInfo.setDetailAddress(thinkSite.getAddress());
|
||||||
nuoNuoRealPropertyRentInfo.setRealPropertyCertificate(thinkSite.getRealPropertyCertificate());
|
nuoNuoRealPropertyRentInfo.setRealPropertyCertificate("无");
|
||||||
nuoNuoRealPropertyRentInfo.setRentStartDate(rentStartTime);
|
nuoNuoRealPropertyRentInfo.setRentStartDate(rentStartTime);
|
||||||
nuoNuoRealPropertyRentInfo.setRentEndDate(rentEndTime);
|
nuoNuoRealPropertyRentInfo.setRentEndDate(rentEndTime);
|
||||||
nuoNuoRealPropertyRentInfo.setCrossCityFlag("0");
|
nuoNuoRealPropertyRentInfo.setCrossCityFlag("0");
|
||||||
nuoNuoRealPropertyRentInfo.setUnit("2");
|
nuoNuoRealPropertyRentInfo.setUnit("2");
|
||||||
order.setRealPropertyRentInfo(nuoNuoRealPropertyRentInfo);
|
order.setRealPropertyRentInfo(nuoNuoRealPropertyRentInfo);
|
||||||
order.setSpecificFactor("6");
|
order.setSpecificFactor("6");
|
||||||
order.setExtensionNumber("7426");
|
order.setExtensionNumber(extensionNumber);
|
||||||
nuoNuo.setOrder(order);
|
nuoNuo.setOrder(order);
|
||||||
|
|
||||||
|
|
||||||
@@ -278,12 +302,12 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
String senid = UUID.randomUUID().toString(); // 唯一标识,由企业自己生成32位随机码
|
String senid = UUID.randomUUID().toString(); // 唯一标识,由企业自己生成32位随机码
|
||||||
|
|
||||||
String json = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content); // 请求API
|
String json = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content); // 请求API
|
||||||
System.out.println("json = " + json);
|
// System.out.println("json = " + json);
|
||||||
if (StrUtil.isNotBlank(json)) {
|
if (StrUtil.isNotBlank(json)) {
|
||||||
final JSONObject jsonObject = JSONObject.parseObject(json);
|
final JSONObject jsonObject = JSONObject.parseObject(json);
|
||||||
final String code = jsonObject.getString("code");
|
final String code = jsonObject.getString("code");
|
||||||
final String result = jsonObject.getString("result");
|
final String result = jsonObject.getString("result");
|
||||||
System.out.println("jsonObject = " + jsonObject);
|
// System.out.println("jsonObject = " + jsonObject);
|
||||||
if (code.equals("E0000")) {
|
if (code.equals("E0000")) {
|
||||||
final JSONObject resNo = JSONObject.parseObject(result);
|
final JSONObject resNo = JSONObject.parseObject(result);
|
||||||
final String invoiceSerialNum = resNo.getString("invoiceSerialNum");
|
final String invoiceSerialNum = resNo.getString("invoiceSerialNum");
|
||||||
@@ -296,20 +320,27 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
}
|
}
|
||||||
thinkInvoiceService.updateBatchById(thinkInvoiceList);
|
thinkInvoiceService.updateBatchById(thinkInvoiceList);
|
||||||
return success("发票开具成功", json);
|
return success("发票开具成功", json);
|
||||||
|
} else {
|
||||||
|
return fail(jsonObject.getString("describe"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fail("开票失败");
|
return fail("开票失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("开具发票")
|
@ApiOperation("开具发票")
|
||||||
@PostMapping("/doInvoice")
|
@PostMapping("/doInvoice")
|
||||||
public ApiResult<?> doInvoice(@RequestBody ThinkInvoice thinkInvoice) {
|
public ApiResult<?> doInvoice(@RequestBody ThinkInvoice thinkInvoice) {
|
||||||
|
if (thinkInvoice.getCode() != null) {
|
||||||
|
String code = thinkInvoice.getCode().replaceAll(" ", "");
|
||||||
|
thinkInvoice.setCode(code);
|
||||||
|
}
|
||||||
thinkInvoice.setStatus(1);
|
thinkInvoice.setStatus(1);
|
||||||
if (thinkInvoice.getId() != null) thinkInvoiceService.updateById(thinkInvoice);
|
if (thinkInvoice.getId() != null) thinkInvoiceService.updateById(thinkInvoice);
|
||||||
else {
|
else {
|
||||||
if (thinkInvoice.getOrderNum() == null) return fail("非法请求");
|
if (thinkInvoice.getOrderNum() == null) return fail("非法请求");
|
||||||
ThinkInvoice check = thinkInvoiceService.getByOrderNum(thinkInvoice.getOrderNum());
|
if (thinkInvoice.getOid() == null) return fail("非法请求");
|
||||||
|
if (thinkInvoice.getItype() == null) return fail("非法请求");
|
||||||
|
ThinkInvoice check = thinkInvoiceService.getByOidNType(thinkInvoice.getOid(), thinkInvoice.getItype());
|
||||||
if (check != null) return fail("该订单已开过发票");
|
if (check != null) return fail("该订单已开过发票");
|
||||||
thinkInvoice.setIncoiveCode("91450100737617400R");
|
thinkInvoice.setIncoiveCode("91450100737617400R");
|
||||||
thinkInvoice.setCreateTime(System.currentTimeMillis() / 1000);
|
thinkInvoice.setCreateTime(System.currentTimeMillis() / 1000);
|
||||||
@@ -317,10 +348,12 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
if (thinkInvoice.getIncoiveNum() == null) thinkInvoice.setIncoiveNum("");
|
if (thinkInvoice.getIncoiveNum() == null) thinkInvoice.setIncoiveNum("");
|
||||||
if (thinkInvoice.getEmail() == null) thinkInvoice.setEmail("");
|
if (thinkInvoice.getEmail() == null) thinkInvoice.setEmail("");
|
||||||
if (thinkInvoice.getIsOpen() == null) thinkInvoice.setIsOpen(2);
|
if (thinkInvoice.getIsOpen() == null) thinkInvoice.setIsOpen(2);
|
||||||
|
// thinkInvoice.setOrderNum(RandomUtil.randomString(20));
|
||||||
thinkInvoiceService.save(thinkInvoice);
|
thinkInvoiceService.save(thinkInvoice);
|
||||||
}
|
}
|
||||||
String json = newInvoice(thinkInvoice);
|
String json = newInvoice(thinkInvoice);
|
||||||
if (!json.isEmpty()) return success("开票成功", json);
|
if (!json.isEmpty()) return success("开票成功", json);
|
||||||
|
|
||||||
return fail("发票开具失败");
|
return fail("发票开具失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,6 +376,11 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
System.out.println("invoice retry res:" + result);
|
System.out.println("invoice retry res:" + result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getRes")
|
||||||
|
public ApiResult<?> getRes(@RequestBody ThinkInvoice thinkInvoice) {
|
||||||
|
return success("查询成功", getRes(thinkInvoice.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
public String getRes(Integer id) {
|
public String getRes(Integer id) {
|
||||||
final ThinkInvoice thinkInvoice = thinkInvoiceService.getById(id);
|
final ThinkInvoice thinkInvoice = thinkInvoiceService.getById(id);
|
||||||
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
||||||
@@ -367,29 +405,53 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
JSONArray jsonArray = JSONArray.parseArray(body);
|
JSONArray jsonArray = JSONArray.parseArray(body);
|
||||||
for (int i = 0; i < jsonArray.size(); i++) {
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
String status = jsonArray.getJSONObject(i).getString("status");
|
String status = jsonArray.getJSONObject(i).getString("status");
|
||||||
|
String pdfUrl = jsonArray.getJSONObject(i).getString("pdfUrl");
|
||||||
|
String xmlUrl = jsonArray.getJSONObject(i).getString("xmlUrl");
|
||||||
if (status.equals("2")) {
|
if (status.equals("2")) {
|
||||||
thinkInvoiceService.update(
|
thinkInvoiceService.update(
|
||||||
new LambdaUpdateWrapper<ThinkInvoice>()
|
new LambdaUpdateWrapper<ThinkInvoice>()
|
||||||
.eq(ThinkInvoice::getIncoiveNum, thinkInvoice.getIncoiveNum())
|
.eq(ThinkInvoice::getIncoiveNum, thinkInvoice.getIncoiveNum())
|
||||||
.set(ThinkInvoice::getIsOpen, 1)
|
.set(ThinkInvoice::getIsOpen, 1)
|
||||||
|
.set(ThinkInvoice::getUrl, pdfUrl)
|
||||||
|
.set(ThinkInvoice::getXmlUrl, xmlUrl)
|
||||||
);
|
);
|
||||||
} else if (status.equals("22")) {
|
} else if (status.equals("22")) {
|
||||||
retry(id);
|
retry(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return body;
|
return body;
|
||||||
}else if(code.equals("E9500")) {
|
} else if (code.equals("E9500")) {
|
||||||
newInvoice(thinkInvoice);
|
newInvoice(thinkInvoice);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("发票红冲")
|
||||||
|
@PostMapping("/invoiceRed")
|
||||||
|
public ApiResult<?> invoiceRed(@RequestBody ThinkInvoice thinkInvoice) {
|
||||||
|
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
||||||
|
String method = "nuonuo.OpeMplatform.fastInvoiceRed";//API方法名
|
||||||
|
String token = getInvoiceToken();
|
||||||
|
ThinkInvoice thinkInvoice1 = thinkInvoiceService.getById(thinkInvoice.getId());
|
||||||
|
final NuoNuo nuoNuo = new NuoNuo();
|
||||||
|
final NuoNuoOrder order = new NuoNuoOrder();
|
||||||
|
order.setOrderNo(thinkInvoice1.getOrderNum());
|
||||||
|
order.setTaxNum(taxnum);
|
||||||
|
order.setBillNo(taxnum);
|
||||||
|
String content = JSONUtil.toJSONString(nuoNuo);//API私有请求参数
|
||||||
|
String senid = UUID.randomUUID().toString(); // 唯一标识,由企业自己生成32位随机码
|
||||||
|
|
||||||
|
String json = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content); // 请求API
|
||||||
|
// System.out.println("json = " + json);
|
||||||
|
return success("操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
private String newInvoice(ThinkInvoice thinkInvoice) {
|
private String newInvoice(ThinkInvoice thinkInvoice) {
|
||||||
// 开票接口
|
// 开票接口
|
||||||
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
||||||
String method = "nuonuo.OpeMplatform.requestBillingNew";//API方法名
|
String method = "nuonuo.OpeMplatform.requestBillingNew";//API方法名
|
||||||
String token = getInvoiceToken();
|
String token = getInvoiceToken();
|
||||||
|
// String invoiceNum = RandomUtil.randomString(20);
|
||||||
final NuoNuo nuoNuo = new NuoNuo();
|
final NuoNuo nuoNuo = new NuoNuo();
|
||||||
final NuoNuoOrder order = new NuoNuoOrder();
|
final NuoNuoOrder order = new NuoNuoOrder();
|
||||||
order.setBuyerName(thinkInvoice.getName());
|
order.setBuyerName(thinkInvoice.getName());
|
||||||
@@ -399,7 +461,7 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
order.setSalerTel(sellerTel);
|
order.setSalerTel(sellerTel);
|
||||||
order.setOrderNo((thinkInvoice.getOrderNum() == null || thinkInvoice.getOrderNum().isEmpty()) ? thinkInvoice.getIncoiveNum() : thinkInvoice.getOrderNum());
|
order.setOrderNo((thinkInvoice.getOrderNum() == null || thinkInvoice.getOrderNum().isEmpty()) ? thinkInvoice.getIncoiveNum() : thinkInvoice.getOrderNum());
|
||||||
order.setInvoiceDate(DateUtil.now());
|
order.setInvoiceDate(DateUtil.now());
|
||||||
order.setClerk("赵裕璐");
|
order.setClerk(clerk);
|
||||||
order.setPayee("班嘉良");
|
order.setPayee("班嘉良");
|
||||||
order.setChecker("蓝蕙孚");
|
order.setChecker("蓝蕙孚");
|
||||||
order.setShowCheckerType("1");
|
order.setShowCheckerType("1");
|
||||||
@@ -412,7 +474,6 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
goods.setGoodsName("*预付卡销售*预付卡");
|
goods.setGoodsName("*预付卡销售*预付卡");
|
||||||
}
|
}
|
||||||
|
|
||||||
goods.setWithTaxFlag("1");
|
|
||||||
goods.setDField1("无");
|
goods.setDField1("无");
|
||||||
goods.setDField2("无");
|
goods.setDField2("无");
|
||||||
goods.setDField3("无");
|
goods.setDField3("无");
|
||||||
@@ -420,20 +481,22 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
goods.setDField5("无");
|
goods.setDField5("无");
|
||||||
BigDecimal taxRate = BigDecimal.valueOf(0.05);
|
BigDecimal taxRate = BigDecimal.valueOf(0.05);
|
||||||
|
|
||||||
|
|
||||||
if (thinkInvoice.getItype().equals(1)) {
|
if (thinkInvoice.getItype().equals(1)) {
|
||||||
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkInvoice.getOid());
|
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkInvoice.getOid());
|
||||||
String startTime = DateUtil.format(DateUtil.date((thinkOrderInfoList.get(0).getStartTime() * 1000L)), "yyyy-MM-dd");
|
String startTime = DateUtil.format(DateUtil.date((thinkOrderInfoList.get(0).getStartTime() * 1000L)), "yyyy-MM-dd");
|
||||||
goods.setTaxRate(taxRate.toString());
|
goods.setTaxRate(taxRate.toString());
|
||||||
final BigDecimal tax = thinkInvoice.getPrice().multiply(taxRate).setScale(2, RoundingMode.HALF_UP);
|
final BigDecimal tax = thinkInvoice.getPrice().divide(BigDecimal.valueOf(1.05), 2, RoundingMode.HALF_UP)
|
||||||
|
.multiply(taxRate).setScale(2, RoundingMode.DOWN);
|
||||||
goods.setFavouredPolicyFlag("09");
|
goods.setFavouredPolicyFlag("09");
|
||||||
final ThinkOrder thinkOrder = thinkOrderService.getById(thinkInvoice.getOid());
|
final ThinkOrder thinkOrder = thinkOrderService.getById(thinkInvoice.getOid());
|
||||||
ThinkSite thinkSite = thinkSiteService.getById(thinkOrder.getSid());
|
ThinkSite thinkSite = thinkSiteService.getById(thinkOrder.getSid());
|
||||||
goods.setPrice(thinkInvoice.getPrice()
|
goods.setPrice(thinkInvoice.getPrice()
|
||||||
.divide(BigDecimal.valueOf(1.05), 2, RoundingMode.HALF_UP)
|
.divide(BigDecimal.valueOf(1.05), 8, RoundingMode.HALF_UP)
|
||||||
.divide(thinkSite.getSize(), 2, RoundingMode.HALF_UP)
|
.divide(thinkSite.getSize(), 8, RoundingMode.HALF_UP).toString());
|
||||||
.setScale(2, RoundingMode.HALF_UP).toString());
|
// goods.setPrice(thinkInvoice.getPrice().toString());
|
||||||
goods.setTax(tax.toString());
|
goods.setTax(tax.toString());
|
||||||
|
goods.setTaxIncludedAmount(thinkInvoice.getPrice().toString());
|
||||||
|
goods.setTaxExcludedAmount(thinkInvoice.getPrice().subtract(tax).toString());
|
||||||
goods.setGoodsCode("3040502029902");
|
goods.setGoodsCode("3040502029902");
|
||||||
NuoNuoRealPropertyRentInfo nuoNuoRealPropertyRentInfo = new NuoNuoRealPropertyRentInfo();
|
NuoNuoRealPropertyRentInfo nuoNuoRealPropertyRentInfo = new NuoNuoRealPropertyRentInfo();
|
||||||
goods.setNum(thinkSite.getSize().toString());
|
goods.setNum(thinkSite.getSize().toString());
|
||||||
@@ -446,6 +509,7 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
nuoNuoRealPropertyRentInfo.setUnit("2");
|
nuoNuoRealPropertyRentInfo.setUnit("2");
|
||||||
order.setRealPropertyRentInfo(nuoNuoRealPropertyRentInfo);
|
order.setRealPropertyRentInfo(nuoNuoRealPropertyRentInfo);
|
||||||
order.setSpecificFactor("6");
|
order.setSpecificFactor("6");
|
||||||
|
goods.setWithTaxFlag("0");
|
||||||
} else {
|
} else {
|
||||||
goods.setTaxRate("0.00");
|
goods.setTaxRate("0.00");
|
||||||
goods.setZeroRateFlag("2");
|
goods.setZeroRateFlag("2");
|
||||||
@@ -454,9 +518,10 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
goods.setPrice(thinkInvoice.getPrice().setScale(2, RoundingMode.HALF_UP).toString());
|
goods.setPrice(thinkInvoice.getPrice().setScale(2, RoundingMode.HALF_UP).toString());
|
||||||
goods.setTax("0.00");
|
goods.setTax("0.00");
|
||||||
goods.setGoodsCode("6010000000000000000");
|
goods.setGoodsCode("6010000000000000000");
|
||||||
|
goods.setWithTaxFlag("1");
|
||||||
}
|
}
|
||||||
order.setInvoiceDetail(goods);
|
order.setInvoiceDetail(goods);
|
||||||
order.setExtensionNumber("7426");
|
order.setExtensionNumber(extensionNumber); // 13807717477
|
||||||
nuoNuo.setOrder(order);
|
nuoNuo.setOrder(order);
|
||||||
|
|
||||||
|
|
||||||
@@ -464,12 +529,12 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
String senid = UUID.randomUUID().toString(); // 唯一标识,由企业自己生成32位随机码
|
String senid = UUID.randomUUID().toString(); // 唯一标识,由企业自己生成32位随机码
|
||||||
|
|
||||||
String json = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content); // 请求API
|
String json = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content); // 请求API
|
||||||
System.out.println("json = " + json);
|
// System.out.println("json = " + json);
|
||||||
if (StrUtil.isNotBlank(json)) {
|
if (StrUtil.isNotBlank(json)) {
|
||||||
final JSONObject jsonObject = JSONObject.parseObject(json);
|
final JSONObject jsonObject = JSONObject.parseObject(json);
|
||||||
final String code = jsonObject.getString("code");
|
final String code = jsonObject.getString("code");
|
||||||
final String result = jsonObject.getString("result");
|
final String result = jsonObject.getString("result");
|
||||||
System.out.println("jsonObject = " + jsonObject);
|
System.out.println("invoice jsonObject = " + jsonObject);
|
||||||
if (code.equals("E0000")) {
|
if (code.equals("E0000")) {
|
||||||
final JSONObject resNo = JSONObject.parseObject(result);
|
final JSONObject resNo = JSONObject.parseObject(result);
|
||||||
final String invoiceSerialNum = resNo.getString("invoiceSerialNum");
|
final String invoiceSerialNum = resNo.getString("invoiceSerialNum");
|
||||||
@@ -478,11 +543,15 @@ public class ThinkInvoiceController extends BaseController {
|
|||||||
thinkOrder.setIsInvoice(1);
|
thinkOrder.setIsInvoice(1);
|
||||||
thinkOrderService.updateById(thinkOrder);
|
thinkOrderService.updateById(thinkOrder);
|
||||||
} else if (thinkInvoice.getItype().equals(2)) {
|
} else if (thinkInvoice.getItype().equals(2)) {
|
||||||
final ThinkUsersVip thinkUsersVip = thinkUsersVipService.getById(thinkInvoice.getOid());
|
final ThinkRechargeLog thinkRechargeLog = thinkRechargeLogService.getById(thinkInvoice.getOid());
|
||||||
thinkUsersVip.setIsInvoice(1);
|
thinkRechargeLog.setIsInvoice(1);
|
||||||
thinkUsersVipService.updateById(thinkUsersVip);
|
thinkRechargeLogService.updateById(thinkRechargeLog);
|
||||||
|
} else if (thinkInvoice.getItype().equals(3)) {
|
||||||
|
ThinkCard thinkCard = thinkCardService.getById(thinkInvoice.getOid());
|
||||||
|
thinkCard.setIsInvoice(1);
|
||||||
|
thinkCardService.updateById(thinkCard);
|
||||||
}
|
}
|
||||||
System.out.println("invoiceSerialNum = " + invoiceSerialNum);
|
// System.out.println("invoiceSerialNum = " + invoiceSerialNum);
|
||||||
thinkInvoice.setIncoiveNum(invoiceSerialNum);
|
thinkInvoice.setIncoiveNum(invoiceSerialNum);
|
||||||
getRes(thinkInvoice.getId());
|
getRes(thinkInvoice.getId());
|
||||||
// thinkInvoice.setIsOpen(1);
|
// thinkInvoice.setIsOpen(1);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class ThinkMachineOpenLogController extends BaseController {
|
|||||||
String[] qrcode = thinkMachineOpenLog.getQrcode().split(",");
|
String[] qrcode = thinkMachineOpenLog.getQrcode().split(",");
|
||||||
for (String s : qrcode) {
|
for (String s : qrcode) {
|
||||||
Map<String, Object> res = thinkOrderService.getByQrCode(s, false);
|
Map<String, Object> res = thinkOrderService.getByQrCode(s, false);
|
||||||
System.out.println(res);
|
// System.out.println(res);
|
||||||
ThinkOrder thinkOrder = (ThinkOrder) res.get("data");
|
ThinkOrder thinkOrder = (ThinkOrder) res.get("data");
|
||||||
if (thinkOrder != null) {
|
if (thinkOrder != null) {
|
||||||
ThinkMachineOpenLog openLog = thinkMachineOpenLogService.getByOrderId(thinkOrder.getId());
|
ThinkMachineOpenLog openLog = thinkMachineOpenLogService.getByOrderId(thinkOrder.getId());
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,145 @@
|
|||||||
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||||
|
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.common.system.entity.Organization;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkOrder;
|
||||||
|
import com.gxwebsoft.think.service.ThinkOrderOffCheckService;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkOrderOffCheck;
|
||||||
|
import com.gxwebsoft.think.param.ThinkOrderOffCheckParam;
|
||||||
|
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 javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 折扣审核控制器
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-05-26 09:42:46
|
||||||
|
*/
|
||||||
|
@Api(tags = "折扣审核管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/think/think-order-off-check")
|
||||||
|
public class ThinkOrderOffCheckController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderOffCheckService thinkOrderOffCheckService;
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderService thinkOrderService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询折扣审核")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<ThinkOrderOffCheck>> page(ThinkOrderOffCheckParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkOrderOffCheckService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部折扣审核")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<ThinkOrderOffCheck>> list(ThinkOrderOffCheckParam param) {
|
||||||
|
param.setCheckUid(getLoginUserId());
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkOrderOffCheckService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('think:thinkOrderOffCheck:list')")
|
||||||
|
@ApiOperation("根据id查询折扣审核")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<ThinkOrderOffCheck> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(thinkOrderOffCheckService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加折扣审核")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody ThinkOrderOffCheck thinkOrderOffCheck, HttpServletRequest request) {
|
||||||
|
User loginUser = getLoginUser();
|
||||||
|
if (loginUser.getOrganizationId() == null) return fail("该用户未配置部门,无法申请");
|
||||||
|
RequestUtil requestUtil = new RequestUtil();
|
||||||
|
String accessToken = JwtUtil.getAccessToken(request);
|
||||||
|
requestUtil.setAccessToken(accessToken);
|
||||||
|
requestUtil.setTenantId("10150");
|
||||||
|
// 部门经理
|
||||||
|
User orgAdmin = requestUtil.getOrgAdmin(loginUser.getOrganizationId());
|
||||||
|
if (orgAdmin == null) return fail("未配置部门经理,无法申请");
|
||||||
|
thinkOrderOffCheck.setCheckUid(orgAdmin.getUserId());
|
||||||
|
thinkOrderOffCheck.setUserId(loginUser.getUserId());
|
||||||
|
|
||||||
|
ThinkOrder thinkOrder = thinkOrderService.getById(thinkOrderOffCheck.getOid());
|
||||||
|
thinkOrder.setReqOffStatus(1);
|
||||||
|
thinkOrderService.updateById(thinkOrder);
|
||||||
|
if (thinkOrderOffCheckService.save(thinkOrderOffCheck)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改折扣审核")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody ThinkOrderOffCheck thinkOrderOffCheck) {
|
||||||
|
if (thinkOrderOffCheckService.updateById(thinkOrderOffCheck)) {
|
||||||
|
ThinkOrderOffCheck thinkOrderOffCheck1 = thinkOrderOffCheckService.getById(thinkOrderOffCheck.getId());
|
||||||
|
ThinkOrder thinkOrder = thinkOrderService.getById(thinkOrderOffCheck1.getOid());
|
||||||
|
if (thinkOrderOffCheck.getStatus().equals(1)) {
|
||||||
|
thinkOrder.setReqOffStatus(2);
|
||||||
|
thinkOrder.setPayPrice(thinkOrderOffCheck1.getOffAmount());
|
||||||
|
thinkOrder.setReducePrice(thinkOrder.getTotalPrice().subtract(thinkOrderOffCheck1.getOffAmount()));
|
||||||
|
thinkOrderService.updateById(thinkOrder);
|
||||||
|
} else {
|
||||||
|
thinkOrder.setReqOffStatus(3);
|
||||||
|
thinkOrderService.updateById(thinkOrder);
|
||||||
|
}
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除折扣审核")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (thinkOrderOffCheckService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量添加折扣审核")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<ThinkOrderOffCheck> list) {
|
||||||
|
if (thinkOrderOffCheckService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量修改折扣审核")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<ThinkOrderOffCheck> batchParam) {
|
||||||
|
if (batchParam.update(thinkOrderOffCheckService, "id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量删除折扣审核")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (thinkOrderOffCheckService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.gxwebsoft.think.controller;
|
|||||||
import cn.hutool.core.date.DateTime;
|
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 com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
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.service.*;
|
import com.gxwebsoft.think.service.*;
|
||||||
@@ -20,6 +21,7 @@ import com.wechat.pay.java.service.refund.model.RefundNotification;
|
|||||||
import com.wechat.pay.java.service.refund.model.Status;
|
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.beans.factory.annotation.Autowired;
|
||||||
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.*;
|
||||||
|
|
||||||
@@ -57,6 +59,9 @@ public class ThinkOrderRefundLogController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ThinkCardService thinkCardService;
|
private ThinkCardService thinkCardService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
@PostMapping("/notify")
|
@PostMapping("/notify")
|
||||||
public ApiResult<?> refundNotify(@RequestBody String body, @RequestHeader Map<String, Object> header) {
|
public ApiResult<?> refundNotify(@RequestBody String body, @RequestHeader Map<String, Object> header) {
|
||||||
System.out.println("refund body = " + body);
|
System.out.println("refund body = " + body);
|
||||||
@@ -86,6 +91,7 @@ public class ThinkOrderRefundLogController extends BaseController {
|
|||||||
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
||||||
for (ThinkOrderInfo thinkOrderInfo : thinkOrderInfoList) {
|
for (ThinkOrderInfo thinkOrderInfo : thinkOrderInfoList) {
|
||||||
thinkOrderInfo.setPayStatus(0);
|
thinkOrderInfo.setPayStatus(0);
|
||||||
|
redisUtil.delete(thinkOrderInfo.getStartTime().toString() + thinkOrderInfo.getFid().toString());
|
||||||
}
|
}
|
||||||
thinkOrderInfoService.updateBatchById(thinkOrderInfoList);
|
thinkOrderInfoService.updateBatchById(thinkOrderInfoList);
|
||||||
}
|
}
|
||||||
@@ -126,7 +132,24 @@ public class ThinkOrderRefundLogController extends BaseController {
|
|||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ThinkOrderRefundLog thinkOrderRefundLog) {
|
public ApiResult<?> save(@RequestBody ThinkOrderRefundLog thinkOrderRefundLog) {
|
||||||
if (thinkOrderRefundLog.getType().equals(0)) {
|
if (thinkOrderRefundLog.getType().equals(0)) {
|
||||||
|
// 下单半个小时内可退
|
||||||
|
// 可提前6小时退
|
||||||
ThinkOrder thinkOrder = thinkOrderService.getById(thinkOrderRefundLog.getOid());
|
ThinkOrder thinkOrder = thinkOrderService.getById(thinkOrderRefundLog.getOid());
|
||||||
|
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
||||||
|
if (thinkOrderRefundLog.getIsAdmin() == null) {
|
||||||
|
if (!thinkOrder.getSid().equals(37)) {
|
||||||
|
System.out.println("time cal: " + DateUtil.currentSeconds() + "," + thinkOrder.getCreateTime() + "," + ((int) DateUtil.currentSeconds() - thinkOrder.getCreateTime()));
|
||||||
|
if ((int) DateUtil.currentSeconds() - thinkOrder.getCreateTime() > 1800) {
|
||||||
|
if (thinkOrderInfoList.get(0).getStartTime() - (int) DateUtil.currentSeconds() < (3600 * 6)) {
|
||||||
|
return fail("距离开场已不足6小时不可退");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (thinkOrder.getOrderStatus().equals(1)) {
|
||||||
|
return fail("该订单已使用不可退");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
thinkOrderRefundLog.setOrder(thinkOrder);
|
thinkOrderRefundLog.setOrder(thinkOrder);
|
||||||
thinkOrderRefundLog.setRefundNo("R" + thinkOrder.getOrderNum());
|
thinkOrderRefundLog.setRefundNo("R" + thinkOrder.getOrderNum());
|
||||||
thinkOrderRefundLog.setCreateTime(LocalDateTimeUtil.now());
|
thinkOrderRefundLog.setCreateTime(LocalDateTimeUtil.now());
|
||||||
@@ -137,9 +160,10 @@ public class ThinkOrderRefundLogController extends BaseController {
|
|||||||
&& !thinkOrder.getWechatOrder().isEmpty() && thinkOrder.getWechatOrder().contains("420000"))
|
&& !thinkOrder.getWechatOrder().isEmpty() && thinkOrder.getWechatOrder().contains("420000"))
|
||||||
thinkOrderService.refund(thinkOrderRefundLog);
|
thinkOrderService.refund(thinkOrderRefundLog);
|
||||||
else {
|
else {
|
||||||
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
|
||||||
for (ThinkOrderInfo thinkOrderInfo : thinkOrderInfoList) {
|
for (ThinkOrderInfo thinkOrderInfo : thinkOrderInfoList) {
|
||||||
thinkOrderInfo.setPayStatus(0);
|
thinkOrderInfo.setPayStatus(0);
|
||||||
|
redisUtil.delete(thinkOrderInfo.getStartTime().toString() + thinkOrderInfo.getFid().toString());
|
||||||
}
|
}
|
||||||
thinkOrderInfoService.updateBatchById(thinkOrderInfoList);
|
thinkOrderInfoService.updateBatchById(thinkOrderInfoList);
|
||||||
thinkOrder.setOrderStatus(3);
|
thinkOrder.setOrderStatus(3);
|
||||||
@@ -147,10 +171,10 @@ public class ThinkOrderRefundLogController extends BaseController {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
|
||||||
for (ThinkOrderInfo thinkOrderInfo : thinkOrderInfoList) {
|
for (ThinkOrderInfo thinkOrderInfo : thinkOrderInfoList) {
|
||||||
thinkOrderInfo.setPayStatus(0);
|
thinkOrderInfo.setPayStatus(0);
|
||||||
num += thinkOrderInfo.getAdultNum() + thinkOrderInfo.getChildrenNum();
|
num += thinkOrderInfo.getAdultNum() + thinkOrderInfo.getChildrenNum();
|
||||||
|
redisUtil.delete(thinkOrderInfo.getStartTime().toString() + thinkOrderInfo.getFid().toString());
|
||||||
}
|
}
|
||||||
thinkOrderInfoService.updateBatchById(thinkOrderInfoList);
|
thinkOrderInfoService.updateBatchById(thinkOrderInfoList);
|
||||||
thinkOrder.setOrderStatus(6);
|
thinkOrder.setOrderStatus(6);
|
||||||
@@ -193,7 +217,7 @@ public class ThinkOrderRefundLogController extends BaseController {
|
|||||||
BigDecimal newBalance = card.getRemainingMoney().add(card.getEachMoney());
|
BigDecimal newBalance = card.getRemainingMoney().add(card.getEachMoney());
|
||||||
card.setRemainingMoney(newBalance);
|
card.setRemainingMoney(newBalance);
|
||||||
} else if (card.getType().equals(2)) {
|
} else if (card.getType().equals(2)) {
|
||||||
card.setNum(card.getNum() + 1);
|
card.setNum(card.getNum() + num);
|
||||||
}
|
}
|
||||||
card.setUseTime(0L);
|
card.setUseTime(0L);
|
||||||
thinkCardService.updateById(card);
|
thinkCardService.updateById(card);
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ public class ThinkRechargeLogController extends BaseController {
|
|||||||
if (num <= 0) thinkUsersVip.setStatus(3);
|
if (num <= 0) thinkUsersVip.setStatus(3);
|
||||||
else thinkUsersVip.setNum(num);
|
else thinkUsersVip.setNum(num);
|
||||||
}
|
}
|
||||||
|
thinkUsersVip.setExpireTime(thinkUsersVip.getExpireTime() - (thinkUsersVip.getTerm() * 86400 * 365) + (thinkUsersVip.getMonth() * 86400 * 30));
|
||||||
|
|
||||||
thinkUsersVipService.updateById(thinkUsersVip);
|
thinkUsersVipService.updateById(thinkUsersVip);
|
||||||
}
|
}
|
||||||
@@ -102,7 +103,11 @@ public class ThinkRechargeLogController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("分页查询")
|
@ApiOperation("分页查询")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<ThinkRechargeLog>> page(ThinkRechargeLogParam param) {
|
public ApiResult<?> page(ThinkRechargeLogParam param) {
|
||||||
|
if (param.getForUser() != null) {
|
||||||
|
if (getLoginUserId() == null) return fail("请登录");
|
||||||
|
param.setUid(getLoginUser().getUid());
|
||||||
|
}
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(thinkRechargeLogService.pageRel(param));
|
return success(thinkRechargeLogService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.think.controller;
|
package com.gxwebsoft.think.controller;
|
||||||
|
|
||||||
|
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.ThinkSiteService;
|
import com.gxwebsoft.think.service.ThinkSiteService;
|
||||||
import com.gxwebsoft.think.entity.ThinkSite;
|
import com.gxwebsoft.think.entity.ThinkSite;
|
||||||
@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,6 +73,8 @@ public class ThinkSiteController extends BaseController {
|
|||||||
@ApiOperation("添加")
|
@ApiOperation("添加")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ThinkSite thinkSite) {
|
public ApiResult<?> save(@RequestBody ThinkSite thinkSite) {
|
||||||
|
thinkSite.setCreateTime((int) DateUtil.currentSeconds());
|
||||||
|
thinkSite.setUpdateTime((int) DateUtil.currentSeconds());
|
||||||
if (thinkSiteService.save(thinkSite)) {
|
if (thinkSiteService.save(thinkSite)) {
|
||||||
return success("添加成功");
|
return success("添加成功");
|
||||||
}
|
}
|
||||||
@@ -80,6 +84,7 @@ public class ThinkSiteController extends BaseController {
|
|||||||
@ApiOperation("修改")
|
@ApiOperation("修改")
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody ThinkSite thinkSite) {
|
public ApiResult<?> update(@RequestBody ThinkSite thinkSite) {
|
||||||
|
thinkSite.setUpdateTime((int) DateUtil.currentSeconds());
|
||||||
if (thinkSiteService.updateById(thinkSite)) {
|
if (thinkSiteService.updateById(thinkSite)) {
|
||||||
return success("修改成功");
|
return success("修改成功");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ public class ThinkUsersVipController extends BaseController {
|
|||||||
private ThinkUsersVipBuyLogService thinkUsersVipBuyLogService;
|
private ThinkUsersVipBuyLogService thinkUsersVipBuyLogService;
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkRechargeLogService thinkRechargeLogService;
|
private ThinkRechargeLogService thinkRechargeLogService;
|
||||||
|
@Resource
|
||||||
|
private ThinkCardBalanceService thinkCardBalanceService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
@@ -166,21 +168,38 @@ public class ThinkUsersVipController extends BaseController {
|
|||||||
order.setPayTime(DateUtil.currentSeconds());
|
order.setPayTime(DateUtil.currentSeconds());
|
||||||
order.setPrices(order.getTempPrices());
|
order.setPrices(order.getTempPrices());
|
||||||
// 查找有没有一样的卡
|
// 查找有没有一样的卡
|
||||||
ThinkUsersVip sameOrder = thinkUsersVipService.getByVidAndUid(order.getVid(), order.getUid());
|
List<ThinkUsersVip> sameOrderList = thinkUsersVipService.getByVidAndUid(order.getVid(), order.getUid());
|
||||||
System.out.println("sameOrder >>>>> " + sameOrder);
|
// System.out.println("sameOrder >>>>> " + sameOrder);
|
||||||
ThinkVip thinkVip = thinkVipService.getByIdRel(order.getVid());
|
ThinkVip thinkVip = thinkVipService.getByIdRel(order.getVid());
|
||||||
if (sameOrder != null && !sameOrder.getId().equals(order.getId()) && thinkVip.getMode().equals(0)) {
|
ThinkUsersVip sameOrder = sameOrderList.stream().filter(uV -> !uV.getId().equals(order.getId()))
|
||||||
|
.findFirst().orElse(null);
|
||||||
|
BigDecimal reduceEach = BigDecimal.ZERO;
|
||||||
|
if (sameOrder != null) {
|
||||||
usersVip = sameOrder;
|
usersVip = sameOrder;
|
||||||
|
long expiredTime = 0;
|
||||||
if (thinkVip.getMode().equals(0)) {
|
if (thinkVip.getMode().equals(0)) {
|
||||||
// 是否已过期,过期的从现在开始计算,未过期的在旧卡基础上叠加
|
// 是否已过期,过期的从现在开始计算,未过期的在旧卡基础上叠加
|
||||||
if (sameOrder.getExpireTime() < DateUtil.currentSeconds()) {
|
if (sameOrder.getExpireTime() < DateUtil.currentSeconds()) {
|
||||||
sameOrder.setExpireTime(DateUtil.currentSeconds() + (order.getTerm() * 86400 * 365) + (order.getMonth() * 86400 * 30));
|
expiredTime = DateUtil.currentSeconds() + (thinkVip.getTerm() * 86400 * 365) + (thinkVip.getMonth() * 86400 * 30);
|
||||||
|
System.out.println("here: " + expiredTime);
|
||||||
} else {
|
} else {
|
||||||
sameOrder.setExpireTime(sameOrder.getExpireTime() + (order.getTerm() * 86400 * 365) + (order.getMonth() * 86400 * 30));
|
expiredTime = sameOrder.getExpireTime() + (thinkVip.getTerm() * 86400 * 365) + (thinkVip.getMonth() * 86400 * 30);
|
||||||
|
System.out.println("here1: " + expiredTime);
|
||||||
}
|
}
|
||||||
|
expiredTime = expiredTime * 1000L;
|
||||||
|
reduceEach = thinkCardBalanceService.getThinkCardBalance(thinkVip);
|
||||||
} else {
|
} else {
|
||||||
sameOrder.setExpireTime(DateUtil.parse(thinkVip.getExpiredTime(), "yyyy-MM-dd").getTime() / 1000L);
|
long time = DateUtil.parse(thinkVip.getExpiredTime(), "yyyy-MM-dd").getTime();
|
||||||
|
DateTime dateTime = DateUtil.date(time);
|
||||||
|
String date = DateUtil.format(dateTime, "yyyy-MM-dd") + " 23:59:59";
|
||||||
|
double remainTimestampD = DateUtil.parse(date, "yyyy-MM-dd HH:mm:ss").getTime() - System.currentTimeMillis();
|
||||||
|
double remainDay = Math.ceil(remainTimestampD / (24 * 60 * 60 * 1000));
|
||||||
|
reduceEach = thinkVip.getPrice().divide(BigDecimal.valueOf(remainDay), RoundingMode.HALF_UP);
|
||||||
|
expiredTime = DateUtil.parse(thinkVip.getExpiredTime(), "yyyy-MM-dd").getTime();
|
||||||
}
|
}
|
||||||
|
DateTime dateTime = DateUtil.date(expiredTime);
|
||||||
|
String date = DateUtil.format(dateTime, "yyyy-MM-dd") + " 23:59:59";
|
||||||
|
sameOrder.setExpireTime(DateUtil.parse(date, "yyyy-MM-dd HH:mm:ss").getTime() / 1000L);
|
||||||
// 充值卡
|
// 充值卡
|
||||||
if (sameOrder.getType().equals(4) || sameOrder.getType().equals(5)) {
|
if (sameOrder.getType().equals(4) || sameOrder.getType().equals(5)) {
|
||||||
// 是否已过期,过期的清空,未过期的在旧卡基础上叠加
|
// 是否已过期,过期的清空,未过期的在旧卡基础上叠加
|
||||||
@@ -193,7 +212,7 @@ public class ThinkUsersVipController extends BaseController {
|
|||||||
if (sameOrder.getExpireTime() < DateUtil.currentSeconds()) {
|
if (sameOrder.getExpireTime() < DateUtil.currentSeconds()) {
|
||||||
sameOrder.setNum(order.getCount());
|
sameOrder.setNum(order.getCount());
|
||||||
} else {
|
} else {
|
||||||
sameOrder.setNum(sameOrder.getCount() + order.getCount());
|
sameOrder.setNum(sameOrder.getNum() + order.getCount());
|
||||||
}
|
}
|
||||||
// sameOrder.setNum(sameOrder.getCount() + order.getCount());
|
// sameOrder.setNum(sameOrder.getCount() + order.getCount());
|
||||||
}
|
}
|
||||||
@@ -215,6 +234,23 @@ public class ThinkUsersVipController extends BaseController {
|
|||||||
thinkRechargeLog.setPayTime(LocalDateTimeUtil.now());
|
thinkRechargeLog.setPayTime(LocalDateTimeUtil.now());
|
||||||
thinkRechargeLogService.updateById(thinkRechargeLog);
|
thinkRechargeLogService.updateById(thinkRechargeLog);
|
||||||
}
|
}
|
||||||
|
ThinkCardBalance thinkCardBalance = thinkCardBalanceService.getByVid(usersVip.getId());
|
||||||
|
if (thinkCardBalance == null) {
|
||||||
|
thinkCardBalance = new ThinkCardBalance();
|
||||||
|
thinkCardBalance.setVid(usersVip.getId());
|
||||||
|
thinkCardBalance.setUid(usersVip.getUid());
|
||||||
|
thinkCardBalance.setBalance(thinkVip.getPrice());
|
||||||
|
thinkCardBalance.setReduceEach(reduceEach);
|
||||||
|
thinkCardBalance.setType(thinkVip.getType());
|
||||||
|
thinkCardBalance.setDiscount(thinkVip.getDiscount());
|
||||||
|
thinkCardBalance.setVipId(thinkVip.getId());
|
||||||
|
thinkCardBalance.setUpdateTime(DateUtil.currentSeconds());
|
||||||
|
thinkCardBalance.setCreateTime(DateUtil.currentSeconds());
|
||||||
|
}else {
|
||||||
|
thinkCardBalance.setBalance(thinkVip.getPrice().add(thinkCardBalance.getBalance()));
|
||||||
|
thinkCardBalanceService.updateById(thinkCardBalance);
|
||||||
|
}
|
||||||
|
|
||||||
if (usersVip.getType().equals(1) || usersVip.getType().equals(3)) {
|
if (usersVip.getType().equals(1) || usersVip.getType().equals(3)) {
|
||||||
List<ThinkVipCardsBills> list = new ArrayList<>();
|
List<ThinkVipCardsBills> list = new ArrayList<>();
|
||||||
BigDecimal avgAmount = BigDecimal.ZERO;
|
BigDecimal avgAmount = BigDecimal.ZERO;
|
||||||
@@ -278,18 +314,21 @@ public class ThinkUsersVipController extends BaseController {
|
|||||||
thinkUsersVip.setTerm(thinkVip.getTerm());
|
thinkUsersVip.setTerm(thinkVip.getTerm());
|
||||||
thinkUsersVip.setMode(thinkVip.getMode());
|
thinkUsersVip.setMode(thinkVip.getMode());
|
||||||
thinkUsersVip.setCreateTime(DateUtil.currentSeconds());
|
thinkUsersVip.setCreateTime(DateUtil.currentSeconds());
|
||||||
|
long time = DateUtil.currentSeconds();
|
||||||
if (thinkVip.getMode().equals(0)) {
|
if (thinkVip.getMode().equals(0)) {
|
||||||
if (!thinkVip.getTerm().equals(0))
|
if (!thinkVip.getTerm().equals(0))
|
||||||
thinkUsersVip.setExpireTime(DateUtil.currentSeconds() + (long) thinkVip.getTerm() * 365 * 24 * 60 * 60);
|
time += (long) thinkVip.getTerm() * 365 * 24 * 60 * 60;
|
||||||
if (!thinkVip.getMonth().equals(0))
|
if (!thinkVip.getMonth().equals(0))
|
||||||
thinkUsersVip.setExpireTime(DateUtil.currentSeconds() + (long) thinkVip.getMonth() * 30 * 24 * 60 * 60);
|
time += (long) thinkVip.getMonth() * 30 * 24 * 60 * 60;
|
||||||
if (!thinkVip.getDay().equals(0))
|
if (!thinkVip.getDay().equals(0))
|
||||||
thinkUsersVip.setExpireTime(DateUtil.currentSeconds() + (long) thinkVip.getDay() * 24 * 60 * 60);
|
time += (long) thinkVip.getDay() * 24 * 60 * 60;
|
||||||
} else {
|
} else {
|
||||||
long time = DateUtil.parse(thinkVip.getExpiredTime(), "yyyy-MM-dd").getTime();
|
time = DateUtil.parse(thinkVip.getExpiredTime(), "yyyy-MM-dd").getTime();
|
||||||
thinkUsersVip.setExpireTime(time / 1000);
|
time = time / 1000;
|
||||||
}
|
}
|
||||||
|
DateTime dateTime = DateUtil.date(time * 1000L);
|
||||||
|
String date = DateUtil.format(dateTime, "yyyy-MM-dd") + " 23:59:59";
|
||||||
|
thinkUsersVip.setExpireTime(DateUtil.parse(date, "yyyy-MM-dd HH:mm:ss").getTime() / 1000L);
|
||||||
ThinkRechargeLog thinkRechargeLog = new ThinkRechargeLog();
|
ThinkRechargeLog thinkRechargeLog = new ThinkRechargeLog();
|
||||||
thinkRechargeLog.setUid(getLoginUser().getUid());
|
thinkRechargeLog.setUid(getLoginUser().getUid());
|
||||||
thinkRechargeLog.setOrderNum(orderNumber);
|
thinkRechargeLog.setOrderNum(orderNumber);
|
||||||
|
|||||||
@@ -4,28 +4,32 @@ import cn.hutool.core.date.DateTime;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.think.entity.ThinkOrder;
|
import com.gxwebsoft.think.entity.*;
|
||||||
import com.gxwebsoft.think.entity.ThinkUsersVip;
|
import com.gxwebsoft.think.service.*;
|
||||||
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.think.param.ThinkVipCardsBillsParam;
|
||||||
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;
|
||||||
import com.gxwebsoft.common.core.web.PageParam;
|
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.core.config.ConfigProperties;
|
||||||
|
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.poi.xssf.streaming.SXSSFRow;
|
||||||
|
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||||
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||||
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.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,6 +48,14 @@ public class ThinkVipCardsBillsController extends BaseController {
|
|||||||
private ThinkUsersVipService thinkUsersVipService;
|
private ThinkUsersVipService thinkUsersVipService;
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkOrderService thinkOrderService;
|
private ThinkOrderService thinkOrderService;
|
||||||
|
@Resource
|
||||||
|
private ThinkVipService thinkVipService;
|
||||||
|
@Resource
|
||||||
|
private ThinkCardService thinkCardService;
|
||||||
|
@Resource
|
||||||
|
private ThinkUsersService thinkUsersService;
|
||||||
|
@Resource
|
||||||
|
private ConfigProperties config;
|
||||||
|
|
||||||
@ApiOperation("分页查询Vip卡每日账单")
|
@ApiOperation("分页查询Vip卡每日账单")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@@ -55,7 +67,11 @@ public class ThinkVipCardsBillsController extends BaseController {
|
|||||||
@GetMapping("/total-amount")
|
@GetMapping("/total-amount")
|
||||||
public ApiResult<?> totalAmount(ThinkVipCardsBillsParam param) {
|
public ApiResult<?> totalAmount(ThinkVipCardsBillsParam param) {
|
||||||
List<ThinkVipCardsBills> list = thinkVipCardsBillsService.listRel(param);
|
List<ThinkVipCardsBills> list = thinkVipCardsBillsService.listRel(param);
|
||||||
return success(list.stream().map(ThinkVipCardsBills::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
|
// for (ThinkVipCardsBills bill : list) {
|
||||||
|
// if (bill.getThinkOrder() != null) totalAmount = totalAmount.add(bill.getThinkOrder().getPayPrice());
|
||||||
|
// }
|
||||||
|
return success(totalAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询全部Vip卡每日账单")
|
@ApiOperation("查询全部Vip卡每日账单")
|
||||||
@@ -127,87 +143,258 @@ public class ThinkVipCardsBillsController extends BaseController {
|
|||||||
return fail("删除失败");
|
return fail("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出Excel")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public ApiResult<?> export(@RequestBody ThinkVipCardsBillsParam param) throws IOException {
|
||||||
|
|
||||||
|
List<ThinkVipCardsBills> billsList = thinkVipCardsBillsService.listRel(param);
|
||||||
|
String cardName = param.getIsVip() != null ? "VIP卡" : "实体卡";
|
||||||
|
String filename = "excel/" + cardName + "账单-" + new Date().getTime() + ".xlsx";
|
||||||
|
String uploadPath = config.getUploadPath();
|
||||||
|
String path = uploadPath + filename;
|
||||||
|
|
||||||
|
// 确保目录存在
|
||||||
|
java.io.File directory = new java.io.File(uploadPath + "excel");
|
||||||
|
if (!directory.exists()) {
|
||||||
|
directory.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
SXSSFWorkbook workbook = new SXSSFWorkbook();
|
||||||
|
SXSSFSheet sheet = workbook.createSheet("VIP卡账单");
|
||||||
|
|
||||||
|
// 设置列宽
|
||||||
|
sheet.setColumnWidth(0, 20 * 256); // 用户
|
||||||
|
sheet.setColumnWidth(1, 30 * 256); // 名称
|
||||||
|
sheet.setColumnWidth(2, 15 * 256); // 日期
|
||||||
|
sheet.setColumnWidth(3, 15 * 256); // 金额
|
||||||
|
|
||||||
|
// 创建表头
|
||||||
|
SXSSFRow headerRow = sheet.createRow(0);
|
||||||
|
String[] headers = {"用户", "手机号", "卡名称", "日期", "金额"};
|
||||||
|
for (int i = 0; i < headers.length; i++) {
|
||||||
|
headerRow.createCell(i).setCellValue(headers[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 填充数据
|
||||||
|
int rowNum = 1;
|
||||||
|
for (ThinkVipCardsBills bill : billsList) {
|
||||||
|
SXSSFRow row = sheet.createRow(rowNum++);
|
||||||
|
|
||||||
|
// 用户
|
||||||
|
String username = "";
|
||||||
|
if (bill.getUser() != null) {
|
||||||
|
username = bill.getUser().getUsername() != null ? bill.getUser().getUsername() : "";
|
||||||
|
}
|
||||||
|
row.createCell(0).setCellValue(username);
|
||||||
|
|
||||||
|
String phone = "";
|
||||||
|
if (bill.getUser() != null) {
|
||||||
|
phone = bill.getUser().getPhone() != null ? bill.getUser().getPhone() : "";
|
||||||
|
}
|
||||||
|
row.createCell(1).setCellValue(phone);
|
||||||
|
|
||||||
|
// 名称
|
||||||
|
String name = "";
|
||||||
|
if (bill.getVip() != null && bill.getVip().getName() != null) {
|
||||||
|
name = bill.getVip().getName();
|
||||||
|
} else if (bill.getCard() != null && bill.getCard().getName() != null) {
|
||||||
|
name = bill.getCard().getName();
|
||||||
|
}
|
||||||
|
row.createCell(2).setCellValue(name);
|
||||||
|
|
||||||
|
// 日期
|
||||||
|
String date = bill.getDate() != null ? bill.getDate() : "";
|
||||||
|
row.createCell(3).setCellValue(date);
|
||||||
|
|
||||||
|
// 金额
|
||||||
|
String amount = bill.getThinkOrder() != null ? bill.getThinkOrder().getPayPrice().toString() : "";
|
||||||
|
row.createCell(4).setCellValue(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存文件
|
||||||
|
try (FileOutputStream fileOut = new FileOutputStream(path)) {
|
||||||
|
workbook.write(fileOut);
|
||||||
|
}
|
||||||
|
workbook.close();
|
||||||
|
|
||||||
|
// 创建文件记录
|
||||||
|
FileRecord result = new FileRecord();
|
||||||
|
result.setCreateUserId(getLoginUserId());
|
||||||
|
result.setName(filename);
|
||||||
|
result.setPath(path);
|
||||||
|
result.setUrl(config.getServerUrl() + "/file/" + filename);
|
||||||
|
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/make-bill")
|
@PostMapping("/make-bill")
|
||||||
public void makeBill() {
|
public void makeBill() {
|
||||||
|
List<ThinkVip> thinkVipList = thinkVipService.list();
|
||||||
List<ThinkUsersVip> usersVipList = thinkUsersVipService.list(
|
List<ThinkUsersVip> usersVipList = thinkUsersVipService.list(
|
||||||
new LambdaQueryWrapper<ThinkUsersVip>()
|
new LambdaQueryWrapper<ThinkUsersVip>()
|
||||||
.eq(ThinkUsersVip::getStatus, 1)
|
.eq(ThinkUsersVip::getStatus, 1)
|
||||||
);
|
);
|
||||||
for (ThinkUsersVip usersVip : usersVipList) {
|
for (ThinkUsersVip usersVip : usersVipList) {
|
||||||
List<ThinkVipCardsBills> list = new ArrayList<>();
|
ThinkVip thinkVip = thinkVipList.stream().filter(v -> v.getId().equals(usersVip.getVid())).findFirst().orElse(null);
|
||||||
List<ThinkOrder> orderList = thinkOrderService.list(
|
if (thinkVip != null) {
|
||||||
new LambdaQueryWrapper<ThinkOrder>()
|
List<ThinkVipCardsBills> list = new ArrayList<>();
|
||||||
.eq(ThinkOrder::getVid, usersVip.getId())
|
List<ThinkOrder> orderList = thinkOrderService.list(
|
||||||
.in(ThinkOrder::getPayStatus, 1)
|
new LambdaQueryWrapper<ThinkOrder>()
|
||||||
.in(ThinkOrder::getOrderStatus, 1, 2)
|
.eq(ThinkOrder::getVid, usersVip.getId())
|
||||||
);
|
.in(ThinkOrder::getPayStatus, 1)
|
||||||
BigDecimal avgAmount = BigDecimal.ZERO;
|
.in(ThinkOrder::getOrderStatus, 1, 2)
|
||||||
int dayNum = 0;
|
);
|
||||||
if (usersVip.getType().equals(1) || usersVip.getType().equals(3)) {
|
BigDecimal avgAmount = BigDecimal.ZERO;
|
||||||
BigDecimal totalAmountInAvg = BigDecimal.ZERO;
|
int dayNum = 0;
|
||||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
if (thinkVip.getType().equals(1) || thinkVip.getType().equals(3)) {
|
||||||
if (usersVip.getType().equals(1)) {
|
BigDecimal totalAmountInAvg = BigDecimal.ZERO;
|
||||||
totalAmount = usersVip.getPrice().multiply(new BigDecimal(usersVip.getTerm()));
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
avgAmount = totalAmount.divide(BigDecimal.valueOf(365).multiply(BigDecimal.valueOf(usersVip.getTerm())), RoundingMode.HALF_UP);
|
if (thinkVip.getType().equals(1)) {
|
||||||
dayNum = 365 * usersVip.getTerm();
|
totalAmount = thinkVip.getPrice().multiply(new BigDecimal(thinkVip.getTerm()));
|
||||||
} else if (usersVip.getType().equals(3)) {
|
avgAmount = totalAmount.divide(BigDecimal.valueOf(365).multiply(BigDecimal.valueOf(thinkVip.getTerm())), RoundingMode.HALF_UP);
|
||||||
totalAmount = usersVip.getPrice().multiply(new BigDecimal(usersVip.getMonth()));
|
dayNum = 365 * thinkVip.getTerm();
|
||||||
avgAmount = totalAmount.divide(BigDecimal.valueOf(30).multiply(BigDecimal.valueOf(usersVip.getMonth())), RoundingMode.HALF_UP);
|
} else if (thinkVip.getType().equals(3)) {
|
||||||
dayNum = 30 * usersVip.getMonth();
|
totalAmount = thinkVip.getPrice().multiply(new BigDecimal(thinkVip.getMonth()));
|
||||||
}
|
avgAmount = totalAmount.divide(BigDecimal.valueOf(30).multiply(BigDecimal.valueOf(thinkVip.getMonth())), RoundingMode.HALF_UP);
|
||||||
totalAmountInAvg = avgAmount.multiply(BigDecimal.valueOf(dayNum - 1));
|
dayNum = 30 * thinkVip.getMonth();
|
||||||
BigDecimal lastDayAmount = totalAmount.subtract(totalAmountInAvg);
|
}
|
||||||
for (int i = 0; i < dayNum; i++) {
|
totalAmountInAvg = avgAmount.multiply(BigDecimal.valueOf(dayNum - 1));
|
||||||
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
BigDecimal lastDayAmount = totalAmount.subtract(totalAmountInAvg);
|
||||||
thinkVipCardsBills.setUid(usersVip.getUid());
|
for (int i = 0; i < dayNum; i++) {
|
||||||
thinkVipCardsBills.setVid(usersVip.getId());
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
DateTime dateTime = DateUtil.date((usersVip.getCreateTime() * 1000L) + (i * 86400000L));
|
thinkVipCardsBills.setUid(usersVip.getUid());
|
||||||
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
thinkVipCardsBills.setVid(usersVip.getId());
|
||||||
if (i == dayNum - 1) thinkVipCardsBills.setAmount(lastDayAmount);
|
DateTime dateTime = DateUtil.date((usersVip.getCreateTime() * 1000L) + (i * 86400000L));
|
||||||
else thinkVipCardsBills.setAmount(avgAmount);
|
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||||
if (!orderList.isEmpty()) {
|
if (i == dayNum - 1) thinkVipCardsBills.setAmount(lastDayAmount);
|
||||||
for (ThinkOrder thinkOrder : orderList) {
|
else thinkVipCardsBills.setAmount(avgAmount);
|
||||||
if (thinkOrder.getCreateTime() > (DateUtil.beginOfDay(dateTime).getTime() / 1000L) && thinkOrder.getCreateTime() < (DateUtil.endOfDay(dateTime).getTime() / 1000L)) {
|
if (!orderList.isEmpty()) {
|
||||||
thinkVipCardsBills.setUsed(1);
|
for (ThinkOrder thinkOrder : orderList) {
|
||||||
thinkVipCardsBills.setOid(thinkOrder.getId());
|
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);
|
list.add(thinkVipCardsBills);
|
||||||
}
|
}
|
||||||
}
|
} else if (thinkVip.getType().equals(2)) {
|
||||||
} else if (usersVip.getType().equals(4) || usersVip.getType().equals(5)) {
|
// 次卡
|
||||||
// 充值卡\折扣
|
if (!orderList.isEmpty()) {
|
||||||
if (!orderList.isEmpty()) {
|
avgAmount = thinkVip.getPrice().divide(BigDecimal.valueOf(thinkVip.getCount()), RoundingMode.HALF_UP);
|
||||||
for (ThinkOrder thinkOrder : orderList) {
|
for (ThinkOrder thinkOrder : orderList) {
|
||||||
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
thinkVipCardsBills.setUid(usersVip.getUid());
|
thinkVipCardsBills.setUid(usersVip.getUid());
|
||||||
thinkVipCardsBills.setVid(usersVip.getId());
|
thinkVipCardsBills.setVid(usersVip.getId());
|
||||||
DateTime dateTime = DateUtil.date((thinkOrder.getCreateTime() * 1000L));
|
DateTime dateTime = DateUtil.date((thinkOrder.getCreateTime() * 1000L));
|
||||||
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||||
thinkVipCardsBills.setAmount(thinkOrder.getTotalPrice());
|
thinkVipCardsBills.setAmount(avgAmount);
|
||||||
thinkVipCardsBills.setUsed(1);
|
thinkVipCardsBills.setUsed(1);
|
||||||
thinkVipCardsBills.setOid(thinkOrder.getId());
|
thinkVipCardsBills.setOid(thinkOrder.getId());
|
||||||
list.add(thinkVipCardsBills);
|
list.add(thinkVipCardsBills);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (thinkVip.getType().equals(4) || thinkVip.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<ThinkCard> thinkCardList = thinkCardService.list(
|
||||||
|
new LambdaQueryWrapper<ThinkCard>()
|
||||||
|
.eq(ThinkCard::getStatus, 1)
|
||||||
|
);
|
||||||
|
for (ThinkCard usersVip : thinkCardList) {
|
||||||
|
ThinkVip thinkVip = thinkVipList.stream().filter(v -> v.getId().equals(usersVip.getVid())).findFirst().orElse(null);
|
||||||
|
if (thinkVip != null) {
|
||||||
|
List<ThinkVipCardsBills> list = new ArrayList<>();
|
||||||
|
List<ThinkOrder> orderList = thinkOrderService.list(
|
||||||
|
new LambdaQueryWrapper<ThinkOrder>()
|
||||||
|
.eq(ThinkOrder::getCid, usersVip.getId())
|
||||||
|
.in(ThinkOrder::getPayStatus, 1)
|
||||||
|
.in(ThinkOrder::getOrderStatus, 1, 2)
|
||||||
|
);
|
||||||
|
BigDecimal avgAmount = BigDecimal.ZERO;
|
||||||
|
int dayNum = 0;
|
||||||
|
if (thinkVip.getType().equals(1) || thinkVip.getType().equals(3)) {
|
||||||
|
BigDecimal totalAmountInAvg = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
|
if (thinkVip.getType().equals(1)) {
|
||||||
|
totalAmount = thinkVip.getPrice().multiply(new BigDecimal(thinkVip.getTerm()));
|
||||||
|
avgAmount = totalAmount.divide(BigDecimal.valueOf(365).multiply(BigDecimal.valueOf(thinkVip.getTerm())), RoundingMode.HALF_UP);
|
||||||
|
dayNum = 365 * thinkVip.getTerm();
|
||||||
|
} else if (thinkVip.getType().equals(3)) {
|
||||||
|
totalAmount = thinkVip.getPrice().multiply(new BigDecimal(thinkVip.getMonth()));
|
||||||
|
avgAmount = totalAmount.divide(BigDecimal.valueOf(30).multiply(BigDecimal.valueOf(thinkVip.getMonth())), RoundingMode.HALF_UP);
|
||||||
|
dayNum = 30 * thinkVip.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.setCid(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 (thinkVip.getType().equals(2)) {
|
||||||
|
// 次卡
|
||||||
|
if (!orderList.isEmpty()) {
|
||||||
|
avgAmount = thinkVip.getPrice().divide(BigDecimal.valueOf(thinkVip.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 (thinkVip.getType().equals(4) || thinkVip.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);
|
||||||
}
|
}
|
||||||
thinkVipCardsBillsService.saveBatch(list);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ public class NuoNuoOrder implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String salerTaxNum;
|
private String salerTaxNum;
|
||||||
|
|
||||||
|
private String taxNum;
|
||||||
|
|
||||||
@ApiModelProperty(value = "销方电话")
|
@ApiModelProperty(value = "销方电话")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String salerTel;
|
private String salerTel;
|
||||||
@@ -103,4 +105,7 @@ public class NuoNuoOrder implements Serializable {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private NuoNuoRealPropertyRentInfo realPropertyRentInfo;
|
private NuoNuoRealPropertyRentInfo realPropertyRentInfo;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String billNo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,4 +173,16 @@ public class ThinkCard implements Serializable {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private ThinkVip thinkVip;
|
private ThinkVip thinkVip;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkInvoice thinkInvoice;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean saveLog;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean isChange;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkCardLog cardLog;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
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 io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡余额记录
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-06-20 20:58:38
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "ThinkCardBalance对象", description = "卡余额记录")
|
||||||
|
public class ThinkCardBalance implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer cid;
|
||||||
|
|
||||||
|
private Integer vid;
|
||||||
|
|
||||||
|
private Integer uid;
|
||||||
|
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private BigDecimal discount;
|
||||||
|
|
||||||
|
private Integer vipId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "每次减少金额")
|
||||||
|
private BigDecimal reduceEach;
|
||||||
|
|
||||||
|
private Long createTime;
|
||||||
|
|
||||||
|
private Long updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -86,5 +87,7 @@ public class ThinkCardLog implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Long expireTime;
|
private Long expireTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Integer> payTypeList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package com.gxwebsoft.think.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-05-21 11:58:28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "ThinkFtpCheckBill对象", description = "")
|
||||||
|
public class ThinkFtpCheckBill implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "终端号")
|
||||||
|
private String deviceNo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "卡号")
|
||||||
|
private String cardNo;
|
||||||
|
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "结算金额")
|
||||||
|
private BigDecimal settleAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手续费")
|
||||||
|
private BigDecimal feeAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "实际支付金额")
|
||||||
|
private BigDecimal paidAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "参考号")
|
||||||
|
private String refNo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "流水号")
|
||||||
|
private String flowNo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "卡类型")
|
||||||
|
private String cardType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发卡行")
|
||||||
|
private String postCardType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "支付方式")
|
||||||
|
private String payType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "银商订单号")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
private LocalDateTime payTime;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -38,6 +38,8 @@ public class ThinkGoodsCategory implements Serializable {
|
|||||||
@ApiModelProperty(value = "排序")
|
@ApiModelProperty(value = "排序")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
|
private Integer isShow;
|
||||||
|
|
||||||
private Integer createTime;
|
private Integer createTime;
|
||||||
|
|
||||||
private Integer updateTime;
|
private Integer updateTime;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ 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.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
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;
|
||||||
@@ -63,6 +64,9 @@ public class ThinkInvoice implements Serializable {
|
|||||||
@ApiModelProperty(value = "税号")
|
@ApiModelProperty(value = "税号")
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
|
@TableLogic
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
@ApiModelProperty(value = "手机号码")
|
@ApiModelProperty(value = "手机号码")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
@@ -103,6 +107,8 @@ public class ThinkInvoice implements Serializable {
|
|||||||
|
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
|
private String xmlUrl;
|
||||||
|
|
||||||
private String resJson;
|
private String resJson;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class ThinkLog implements Serializable {
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@ApiModelProperty(value = "添加时间")
|
@ApiModelProperty(value = "添加时间")
|
||||||
private Integer addTime;
|
private Long addTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "0:操作日志;1:登录日志;2:定时任务 ")
|
@ApiModelProperty(value = "0:操作日志;1:登录日志;2:定时任务 ")
|
||||||
private Integer logType;
|
private Integer logType;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -146,6 +147,21 @@ public class ThinkOrder implements Serializable {
|
|||||||
@ApiModelProperty(value = "对账情况:1=已对账;2=未对账;3=已对账,金额对不上;4=未查询到该订单")
|
@ApiModelProperty(value = "对账情况:1=已对账;2=未对账;3=已对账,金额对不上;4=未查询到该订单")
|
||||||
private Integer checkBill;
|
private Integer checkBill;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "折扣申请状态(0未申请 1审核中 2已通过 3未通过)")
|
||||||
|
private Integer reqOffStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "折扣凭证")
|
||||||
|
private String discountCert;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "核销方")
|
||||||
|
private Integer checkBy;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "核销时间")
|
||||||
|
private Date checkTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "退款方")
|
||||||
|
private Integer refundBy;
|
||||||
|
|
||||||
@ApiModelProperty(value = "场馆名称")
|
@ApiModelProperty(value = "场馆名称")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String siteName;
|
private String siteName;
|
||||||
@@ -202,4 +218,28 @@ public class ThinkOrder implements Serializable {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Boolean canInvoice;
|
private Boolean canInvoice;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<String> qrCodeList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean adultFree;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean childFree;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal adultPrice;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal childrenPrice;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkOrderOffCheck thinkOrderOffCheck;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String typeStr;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean isAdmin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ public class ThinkOrderInfo implements Serializable {
|
|||||||
@ApiModelProperty(value = "儿童人数")
|
@ApiModelProperty(value = "儿童人数")
|
||||||
private Integer childrenNum;
|
private Integer childrenNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "核销数量")
|
||||||
|
private Integer usedNum;
|
||||||
|
|
||||||
@ApiModelProperty(value = "1已付款,2未付款,3无需付款或占用状态")
|
@ApiModelProperty(value = "1已付款,2未付款,3无需付款或占用状态")
|
||||||
private Integer payStatus;
|
private Integer payStatus;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.gxwebsoft.think.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
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 2025-05-26 09:42:46
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "ThinkOrderOffCheck对象", description = "折扣审核")
|
||||||
|
public class ThinkOrderOffCheck implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer oid;
|
||||||
|
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "原价")
|
||||||
|
private BigDecimal originAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "折扣")
|
||||||
|
private BigDecimal rate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "折后价")
|
||||||
|
private BigDecimal offAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "申请原因")
|
||||||
|
private String reqReason;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "拒绝原因")
|
||||||
|
private String refuseReason;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "审核人")
|
||||||
|
private Integer checkUid;
|
||||||
|
|
||||||
|
@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 ThinkOrder thinkOrder;
|
||||||
|
}
|
||||||
@@ -60,4 +60,7 @@ public class ThinkOrderRefundLog implements Serializable {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private ThinkOrder order;
|
private ThinkOrder order;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean isAdmin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,10 @@ public class ThinkSite implements Serializable {
|
|||||||
|
|
||||||
private Integer dailyNum;
|
private Integer dailyNum;
|
||||||
|
|
||||||
|
private Integer adultFree;
|
||||||
|
|
||||||
|
private Integer childFree;
|
||||||
|
|
||||||
private String machineCode;
|
private String machineCode;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ public class ThinkVip implements Serializable {
|
|||||||
@ApiModelProperty(value = "会员卡价格")
|
@ApiModelProperty(value = "会员卡价格")
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "会员卡价格")
|
||||||
|
private Integer reportSid;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "续卡价格")
|
||||||
|
private BigDecimal renewPrice;
|
||||||
|
|
||||||
@ApiModelProperty(value = "会员卡介绍")
|
@ApiModelProperty(value = "会员卡介绍")
|
||||||
@TableField(value = "`desc`")
|
@TableField(value = "`desc`")
|
||||||
private String desc;
|
private String desc;
|
||||||
|
|||||||
@@ -66,4 +66,7 @@ public class ThinkVipCardsBills implements Serializable {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private ThinkUsers user;
|
private ThinkUsers user;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private ThinkOrder thinkOrder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.ThinkCardBalance;
|
||||||
|
import com.gxwebsoft.think.param.ThinkCardBalanceParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡余额记录Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-06-20 20:58:38
|
||||||
|
*/
|
||||||
|
public interface ThinkCardBalanceMapper extends BaseMapper<ThinkCardBalance> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkCardBalance>
|
||||||
|
*/
|
||||||
|
List<ThinkCardBalance> selectPageRel(@Param("page") IPage<ThinkCardBalance> page,
|
||||||
|
@Param("param") ThinkCardBalanceParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<ThinkCardBalance> selectListRel(@Param("param") ThinkCardBalanceParam 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.ThinkFtpCheckBill;
|
||||||
|
import com.gxwebsoft.think.param.ThinkFtpCheckBillParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-05-21 11:58:28
|
||||||
|
*/
|
||||||
|
public interface ThinkFtpCheckBillMapper extends BaseMapper<ThinkFtpCheckBill> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkFtpCheckBill>
|
||||||
|
*/
|
||||||
|
List<ThinkFtpCheckBill> selectPageRel(@Param("page") IPage<ThinkFtpCheckBill> page,
|
||||||
|
@Param("param") ThinkFtpCheckBillParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<ThinkFtpCheckBill> selectListRel(@Param("param") ThinkFtpCheckBillParam 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.ThinkOrderOffCheck;
|
||||||
|
import com.gxwebsoft.think.param.ThinkOrderOffCheckParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 折扣审核Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-05-26 09:42:46
|
||||||
|
*/
|
||||||
|
public interface ThinkOrderOffCheckMapper extends BaseMapper<ThinkOrderOffCheck> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkOrderOffCheck>
|
||||||
|
*/
|
||||||
|
List<ThinkOrderOffCheck> selectPageRel(@Param("page") IPage<ThinkOrderOffCheck> page,
|
||||||
|
@Param("param") ThinkOrderOffCheckParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<ThinkOrderOffCheck> selectListRel(@Param("param") ThinkOrderOffCheckParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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.ThinkCardBalanceMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM think_card_balance a
|
||||||
|
<where>
|
||||||
|
<if test="param.id != null">
|
||||||
|
AND a.id = #{param.id}
|
||||||
|
</if>
|
||||||
|
<if test="param.cid != null">
|
||||||
|
AND a.cid = #{param.cid}
|
||||||
|
</if>
|
||||||
|
<if test="param.vid != null">
|
||||||
|
AND a.vid = #{param.vid}
|
||||||
|
</if>
|
||||||
|
<if test="param.uid != null">
|
||||||
|
AND a.uid = #{param.uid}
|
||||||
|
</if>
|
||||||
|
<if test="param.balance != null">
|
||||||
|
AND a.balance = #{param.balance}
|
||||||
|
</if>
|
||||||
|
<if test="param.reduceEach != null">
|
||||||
|
AND a.reduce_each = #{param.reduceEach}
|
||||||
|
</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.ThinkCardBalance">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.think.entity.ThinkCardBalance">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -41,6 +41,18 @@
|
|||||||
<if test="param.count != null">
|
<if test="param.count != null">
|
||||||
AND a.count = #{param.count}
|
AND a.count = #{param.count}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.payTypeList != null">
|
||||||
|
AND a.pay_type IN
|
||||||
|
<foreach collection="param.payTypeList" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="param.codeList != null">
|
||||||
|
AND a.code IN
|
||||||
|
<foreach collection="param.codeList" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null">
|
||||||
AND (a.code LIKE CONCAT('%', #{param.keywords}, '%')
|
AND (a.code LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR c.phone = #{param.keywords}
|
OR c.phone = #{param.keywords}
|
||||||
|
|||||||
@@ -19,6 +19,12 @@
|
|||||||
<if test="param.vid != null">
|
<if test="param.vid != null">
|
||||||
AND a.vid = #{param.vid}
|
AND a.vid = #{param.vid}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.vipList != null">
|
||||||
|
AND a.vid IN
|
||||||
|
<foreach collection="param.vipList" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="param.aid != null">
|
<if test="param.aid != null">
|
||||||
AND a.aid = #{param.aid}
|
AND a.aid = #{param.aid}
|
||||||
</if>
|
</if>
|
||||||
@@ -125,25 +131,31 @@
|
|||||||
AND a.create_time <= #{param.createTimeEnd}
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.timeStart != null">
|
<if test="param.timeStart != null">
|
||||||
AND a.create_time >= #{param.timeStart}
|
AND a.create_time >= #{param.timeStart}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.timeEnd != null">
|
<if test="param.timeEnd != null">
|
||||||
AND a.create_time <= #{param.timeEnd}
|
AND a.create_time <= #{param.timeEnd}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.idcard != null">
|
<if test="param.idcard != null">
|
||||||
AND a.IDCard LIKE CONCAT('%', #{param.idcard}, '%')
|
AND a.IDCard LIKE CONCAT('%', #{param.idcard}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.remark != null">
|
<if test="param.notChangeCard != null">
|
||||||
AND a.remark LIKE CONCAT('%', #{param.remark}, '%')
|
AND a.origin_card_code IS NULL
|
||||||
</if>
|
</if>
|
||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null">
|
||||||
AND (a.username LIKE CONCAT('%', #{param.keywords}, '%')
|
AND (a.username LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR a.phone LIKE CONCAT('%', #{param.keywords}, '%')
|
OR a.phone LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR a.code LIKE CONCAT('%', #{param.keywords}, '%')
|
OR a.code LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR a.wechat_order LIKE CONCAT('%', #{param.keywords}, '%')
|
OR a.wechat_order LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR a.card_num LIKE CONCAT('%', #{param.keywords}, '%')
|
OR a.card_num LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.payTypeList != null">
|
||||||
|
AND a.pay_type IN
|
||||||
|
<foreach collection="param.payTypeList" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY a.create_time DESC
|
ORDER BY a.create_time DESC
|
||||||
</sql>
|
</sql>
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
<?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.ThinkFtpCheckBillMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM think_ftp_check_bill a
|
||||||
|
<where>
|
||||||
|
<if test="param.id != null">
|
||||||
|
AND a.id = #{param.id}
|
||||||
|
</if>
|
||||||
|
<if test="param.deviceNo != null">
|
||||||
|
AND a.device_no LIKE CONCAT('%', #{param.deviceNo}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.cardNo != null">
|
||||||
|
AND a.card_no LIKE CONCAT('%', #{param.cardNo}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.amount != null">
|
||||||
|
AND a.amount = #{param.amount}
|
||||||
|
</if>
|
||||||
|
<if test="param.settleAmount != null">
|
||||||
|
AND a.settle_amount = #{param.settleAmount}
|
||||||
|
</if>
|
||||||
|
<if test="param.feeAmount != null">
|
||||||
|
AND a.fee_amount = #{param.feeAmount}
|
||||||
|
</if>
|
||||||
|
<if test="param.paidAmount != null">
|
||||||
|
AND a.paid_amount = #{param.paidAmount}
|
||||||
|
</if>
|
||||||
|
<if test="param.refNo != null">
|
||||||
|
AND a.ref_no LIKE CONCAT('%', #{param.refNo}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.flowNo != null">
|
||||||
|
AND a.flow_no LIKE CONCAT('%', #{param.flowNo}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.cardType != null">
|
||||||
|
AND a.card_type LIKE CONCAT('%', #{param.cardType}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.postCardType != null">
|
||||||
|
AND a.post_card_type LIKE CONCAT('%', #{param.postCardType}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.payType != null">
|
||||||
|
AND a.pay_type LIKE CONCAT('%', #{param.payType}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.payTimeStart != null">
|
||||||
|
AND a.pay_time >= #{param.payTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.payTimeEnd != null">
|
||||||
|
AND a.pay_time <= #{param.payTimeEnd}
|
||||||
|
</if>
|
||||||
|
<if test="param.orderNo != null">
|
||||||
|
AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.payTime != null">
|
||||||
|
AND a.pay_time LIKE CONCAT('%', #{param.payTime}, '%')
|
||||||
|
</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.flow_no LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY a.pay_time DESC
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.think.entity.ThinkFtpCheckBill">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.think.entity.ThinkFtpCheckBill">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -22,6 +22,9 @@
|
|||||||
<if test="param.sort != null">
|
<if test="param.sort != null">
|
||||||
AND a.sort = #{param.sort}
|
AND a.sort = #{param.sort}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.isShow != null">
|
||||||
|
AND a.is_show = #{param.isShow}
|
||||||
|
</if>
|
||||||
<if test="param.createTimeStart != null">
|
<if test="param.createTimeStart != null">
|
||||||
AND a.create_time >= #{param.createTimeStart}
|
AND a.create_time >= #{param.createTimeStart}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -74,6 +74,9 @@
|
|||||||
<if test="param.invoicetype != null">
|
<if test="param.invoicetype != null">
|
||||||
AND a.InvoiceType = #{param.invoicetype}
|
AND a.InvoiceType = #{param.invoicetype}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.deleted != null">
|
||||||
|
AND a.deleted = #{param.deleted}
|
||||||
|
</if>
|
||||||
<if test="param.vid != null">
|
<if test="param.vid != null">
|
||||||
AND a.vid = #{param.vid}
|
AND a.vid = #{param.vid}
|
||||||
</if>
|
</if>
|
||||||
@@ -81,6 +84,10 @@
|
|||||||
AND (
|
AND (
|
||||||
b.order_num LIKE CONCAT('%', #{param.keywords}, '%')
|
b.order_num LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR a.incoive_num LIKE CONCAT('%', #{param.keywords}, '%')
|
OR a.incoive_num LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
OR a.name LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
OR a.order_num LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
OR a.tel LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
OR a.incoive_code LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|||||||
@@ -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="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="param.orderNum != null">
|
<if test="param.orderNum != null">
|
||||||
AND a.order_num LIKE CONCAT('%', #{param.orderNum}, '%')
|
AND a.order_num LIKE CONCAT('%', #{param.orderNum}, '%')
|
||||||
</if>
|
</if>
|
||||||
@@ -85,6 +91,12 @@
|
|||||||
<if test="param.orderStatus != null">
|
<if test="param.orderStatus != null">
|
||||||
AND a.order_status = #{param.orderStatus}
|
AND a.order_status = #{param.orderStatus}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.orderStatusList != null">
|
||||||
|
AND a.order_status IN
|
||||||
|
<foreach collection="param.orderStatusList" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="param.type != null">
|
<if test="param.type != null">
|
||||||
AND a.type = #{param.type}
|
AND a.type = #{param.type}
|
||||||
</if>
|
</if>
|
||||||
@@ -118,6 +130,12 @@
|
|||||||
<if test="param.createTimeEnd != null">
|
<if test="param.createTimeEnd != null">
|
||||||
AND a.create_time <= #{param.createTimeEnd}
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.payTimeStart != null">
|
||||||
|
AND a.pay_time >= #{param.payTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.payTimeEnd != null">
|
||||||
|
AND a.pay_time <= #{param.payTimeEnd}
|
||||||
|
</if>
|
||||||
<if test="param.timeStart != null">
|
<if test="param.timeStart != null">
|
||||||
AND a.create_time >= #{param.timeStart}
|
AND a.create_time >= #{param.timeStart}
|
||||||
</if>
|
</if>
|
||||||
@@ -142,11 +160,15 @@
|
|||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null">
|
||||||
AND (a.name = #{param.keywords}
|
AND (a.name = #{param.keywords}
|
||||||
OR a.id = #{param.keywords}
|
OR a.id = #{param.keywords}
|
||||||
|
OR a.wechat_order LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR a.order_num LIKE CONCAT('%', #{param.keywords}, '%')
|
OR a.order_num LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR a.phone LIKE CONCAT('%', #{param.keywords}, '%')
|
OR a.phone LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR a.code LIKE CONCAT('%', #{param.keywords}, '%')
|
OR a.code LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.wechatInPos != null">
|
||||||
|
AND a.wechat_order NOT LIKE '420000%'
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<?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.ThinkOrderOffCheckMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM think_order_off_check a
|
||||||
|
<where>
|
||||||
|
<if test="param.id != null">
|
||||||
|
AND a.id = #{param.id}
|
||||||
|
</if>
|
||||||
|
<if test="param.oid != null">
|
||||||
|
AND a.oid = #{param.oid}
|
||||||
|
</if>
|
||||||
|
<if test="param.userId != null">
|
||||||
|
AND a.user_id = #{param.userId}
|
||||||
|
</if>
|
||||||
|
<if test="param.originAmount != null">
|
||||||
|
AND a.origin_amount = #{param.originAmount}
|
||||||
|
</if>
|
||||||
|
<if test="param.rate != null">
|
||||||
|
AND a.rate = #{param.rate}
|
||||||
|
</if>
|
||||||
|
<if test="param.offAmount != null">
|
||||||
|
AND a.off_amount = #{param.offAmount}
|
||||||
|
</if>
|
||||||
|
<if test="param.reqReason != null">
|
||||||
|
AND a.req_reason LIKE CONCAT('%', #{param.reqReason}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.refuseReason != null">
|
||||||
|
AND a.refuse_reason LIKE CONCAT('%', #{param.refuseReason}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.checkUid != null">
|
||||||
|
AND a.check_uid = #{param.checkUid}
|
||||||
|
</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.ThinkOrderOffCheck">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.think.entity.ThinkOrderOffCheck">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -27,6 +27,12 @@
|
|||||||
<if test="param.status != null">
|
<if test="param.status != null">
|
||||||
AND a.status = #{param.status}
|
AND a.status = #{param.status}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.statusList != null">
|
||||||
|
AND a.status IN
|
||||||
|
<foreach collection="param.statusList" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="param.createTimeStart != null">
|
<if test="param.createTimeStart != null">
|
||||||
AND a.create_time >= #{param.createTimeStart}
|
AND a.create_time >= #{param.createTimeStart}
|
||||||
</if>
|
</if>
|
||||||
@@ -42,6 +48,12 @@
|
|||||||
<if test="param.vid != null">
|
<if test="param.vid != null">
|
||||||
AND a.vid = #{param.vid}
|
AND a.vid = #{param.vid}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.vipList != null">
|
||||||
|
AND a.vid IN
|
||||||
|
<foreach collection="param.vipList" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="param.isInvoice != null">
|
<if test="param.isInvoice != null">
|
||||||
AND a.is_invoice = #{param.isInvoice}
|
AND a.is_invoice = #{param.isInvoice}
|
||||||
</if>
|
</if>
|
||||||
@@ -56,6 +68,9 @@
|
|||||||
OR a.vid = #{param.keywords}
|
OR a.vid = #{param.keywords}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.sid != null">
|
||||||
|
AND v.sid LIKE CONCAT('%', #{param.sid}, '%')
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,12 @@
|
|||||||
<if test="param.vid != null">
|
<if test="param.vid != null">
|
||||||
AND a.vid = #{param.vid}
|
AND a.vid = #{param.vid}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.vipList != null">
|
||||||
|
AND a.vid IN
|
||||||
|
<foreach collection="param.vipList" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="param.wechatOrder != null">
|
<if test="param.wechatOrder != null">
|
||||||
AND a.wechat_order LIKE CONCAT('%', #{param.wechatOrder}, '%')
|
AND a.wechat_order LIKE CONCAT('%', #{param.wechatOrder}, '%')
|
||||||
</if>
|
</if>
|
||||||
@@ -127,6 +133,7 @@
|
|||||||
OR a.code = #{param.keywords}
|
OR a.code = #{param.keywords}
|
||||||
OR b.phone = #{param.keywords}
|
OR b.phone = #{param.keywords}
|
||||||
OR b.truename = #{param.keywords}
|
OR b.truename = #{param.keywords}
|
||||||
|
OR a.wechat_order = #{param.keywords}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|||||||
@@ -16,6 +16,15 @@
|
|||||||
<if test="param.vid != null">
|
<if test="param.vid != null">
|
||||||
AND a.vid = #{param.vid}
|
AND a.vid = #{param.vid}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.isVip != null">
|
||||||
|
AND a.cid IS NULL
|
||||||
|
</if>
|
||||||
|
<if test="param.cid != null">
|
||||||
|
AND a.vid = #{param.vid}
|
||||||
|
</if>
|
||||||
|
<if test="param.isCard != null">
|
||||||
|
AND a.vid IS NULL
|
||||||
|
</if>
|
||||||
<if test="param.date != null">
|
<if test="param.date != null">
|
||||||
AND a.date LIKE CONCAT('%', #{param.date}, '%')
|
AND a.date LIKE CONCAT('%', #{param.date}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="param.price != null">
|
<if test="param.price != null">
|
||||||
AND a.price = #{param.price}
|
AND a.price = #{param.price}
|
||||||
|
</if>
|
||||||
|
<if test="param.reportSid != null">
|
||||||
|
AND a.report_sid = #{param.reportSid}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.desc != null">
|
<if test="param.desc != null">
|
||||||
AND a.desc LIKE CONCAT('%', #{param.desc}, '%')
|
AND a.desc LIKE CONCAT('%', #{param.desc}, '%')
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
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 2025-06-20 20:58:38
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "ThinkCardBalanceParam对象", description = "卡余额记录查询参数")
|
||||||
|
public class ThinkCardBalanceParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer cid;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer vid;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer uid;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "每次减少金额")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal reduceEach;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询参数
|
* 查询参数
|
||||||
@@ -48,4 +50,12 @@ public class ThinkCardLogParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer count;
|
private Integer count;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer sid;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Integer> payTypeList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<String> codeList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.think.param;
|
package com.gxwebsoft.think.param;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
@@ -166,4 +167,13 @@ public class ThinkCardParam extends BaseParam {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String orderBy;
|
private String orderBy;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean notChangeCard;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Integer> payTypeList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Integer> vipList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-05-21 11:58:28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "ThinkFtpCheckBillParam对象", description = "查询参数")
|
||||||
|
public class ThinkFtpCheckBillParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "终端号")
|
||||||
|
private String deviceNo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "卡号")
|
||||||
|
private String cardNo;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "结算金额")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal settleAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手续费")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal feeAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "实际支付金额")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal paidAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "参考号")
|
||||||
|
private String refNo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "流水号")
|
||||||
|
private String flowNo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "卡类型")
|
||||||
|
private String cardType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发卡行")
|
||||||
|
private String postCardType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "支付方式")
|
||||||
|
private String payType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "银商订单号")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
private String payTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String payTimeStart;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String payTimeEnd;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0已发布, 1待审核 2已驳回 3违规内容")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,6 +29,8 @@ public class ThinkGoodsCategoryParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer pid;
|
private Integer pid;
|
||||||
|
|
||||||
|
private Integer isShow;
|
||||||
|
|
||||||
@ApiModelProperty(value = "分类名称")
|
@ApiModelProperty(value = "分类名称")
|
||||||
private String catname;
|
private String catname;
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,10 @@ public class ThinkInvoiceParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer invoicetype;
|
private Integer invoicetype;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer vid;
|
private Integer vid;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
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 2025-05-26 09:42:46
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "ThinkOrderOffCheckParam对象", description = "折扣审核查询参数")
|
||||||
|
public class ThinkOrderOffCheckParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer oid;
|
||||||
|
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "原价")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal originAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "折扣")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal rate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "折后价")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private BigDecimal offAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "申请原因")
|
||||||
|
private String reqReason;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "拒绝原因")
|
||||||
|
private String refuseReason;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "审核人")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer checkUid;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0已发布, 1待审核 2已驳回 3违规内容")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -165,12 +165,30 @@ public class ThinkOrderParam extends BaseParam {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer orderTimeEnd;
|
private Integer orderTimeEnd;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer payTimeStart;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer payTimeEnd;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Boolean useVip;
|
private Boolean useVip;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Boolean isExport;
|
private Boolean isExport;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean wechatInPos;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean isUseTime;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<Integer> payTypeList;
|
private List<Integer> payTypeList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Integer> idList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Integer> orderStatusList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询参数
|
* 查询参数
|
||||||
@@ -55,4 +57,15 @@ public class ThinkRechargeLogParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer checkBill;
|
private Integer checkBill;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer sid;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean forUser;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Integer> vipList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Integer> statusList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询参数
|
* 查询参数
|
||||||
@@ -153,4 +154,7 @@ public class ThinkUsersVipParam extends BaseParam {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Boolean forAdmin;
|
private Boolean forAdmin;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Integer> vipList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ public class ThinkVipCardsBillsParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer vid;
|
private Integer vid;
|
||||||
|
|
||||||
|
private Integer cid;
|
||||||
|
|
||||||
|
private Integer oid;
|
||||||
|
|
||||||
private String date;
|
private String date;
|
||||||
|
|
||||||
private String amount;
|
private String amount;
|
||||||
@@ -51,4 +55,10 @@ public class ThinkVipCardsBillsParam extends BaseParam {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String dateEnd;
|
private String dateEnd;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean isVip;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean isCard;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ public class ThinkVipParam extends BaseParam {
|
|||||||
@ApiModelProperty(value = "会员卡说明")
|
@ApiModelProperty(value = "会员卡说明")
|
||||||
private String info;
|
private String info;
|
||||||
|
|
||||||
|
private Integer reportSid;
|
||||||
|
|
||||||
@ApiModelProperty(value = "折扣率")
|
@ApiModelProperty(value = "折扣率")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private BigDecimal discount;
|
private BigDecimal discount;
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.gxwebsoft.think.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkCardBalance;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkVip;
|
||||||
|
import com.gxwebsoft.think.param.ThinkCardBalanceParam;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡余额记录Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-06-20 20:58:38
|
||||||
|
*/
|
||||||
|
public interface ThinkCardBalanceService extends IService<ThinkCardBalance> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<ThinkCardBalance>
|
||||||
|
*/
|
||||||
|
PageResult<ThinkCardBalance> pageRel(ThinkCardBalanceParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkCardBalance>
|
||||||
|
*/
|
||||||
|
List<ThinkCardBalance> listRel(ThinkCardBalanceParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return ThinkCardBalance
|
||||||
|
*/
|
||||||
|
ThinkCardBalance getByIdRel(Integer id);
|
||||||
|
|
||||||
|
ThinkCardBalance getByCid(Integer cid);
|
||||||
|
|
||||||
|
ThinkCardBalance getByCid(Integer cid, BigDecimal amount);
|
||||||
|
|
||||||
|
ThinkCardBalance getByVid(Integer vid);
|
||||||
|
|
||||||
|
ThinkCardBalance getByVid(Integer vid, BigDecimal amount);
|
||||||
|
|
||||||
|
List<ThinkCardBalance> getCardList(Integer uid);
|
||||||
|
|
||||||
|
List<ThinkCardBalance> getVipList(Integer uid);
|
||||||
|
|
||||||
|
BigDecimal getThinkCardBalance(ThinkVip thinkVip);
|
||||||
|
}
|
||||||
@@ -52,6 +52,8 @@ public interface ThinkCardService extends IService<ThinkCard> {
|
|||||||
|
|
||||||
List<ThinkCard> listByCodeList(List<String> codeList);
|
List<ThinkCard> listByCodeList(List<String> codeList);
|
||||||
|
|
||||||
|
List<ThinkCard> listByVidList(List<Integer> vidList);
|
||||||
|
|
||||||
HashMap<String, String> createWxCodePay(BigDecimal totalPrice, String orderNo, String desc, String authCode);
|
HashMap<String, String> createWxCodePay(BigDecimal totalPrice, String orderNo, String desc, String authCode);
|
||||||
|
|
||||||
HashMap<String, String> checkWechatPayRes(String code);
|
HashMap<String, String> checkWechatPayRes(String code);
|
||||||
|
|||||||
@@ -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.ThinkFtpCheckBill;
|
||||||
|
import com.gxwebsoft.think.param.ThinkFtpCheckBillParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-05-21 11:58:28
|
||||||
|
*/
|
||||||
|
public interface ThinkFtpCheckBillService extends IService<ThinkFtpCheckBill> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<ThinkFtpCheckBill>
|
||||||
|
*/
|
||||||
|
PageResult<ThinkFtpCheckBill> pageRel(ThinkFtpCheckBillParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkFtpCheckBill>
|
||||||
|
*/
|
||||||
|
List<ThinkFtpCheckBill> listRel(ThinkFtpCheckBillParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return ThinkFtpCheckBill
|
||||||
|
*/
|
||||||
|
ThinkFtpCheckBill getByIdRel(Integer id);
|
||||||
|
|
||||||
|
ThinkFtpCheckBill getByOrderNo(String orderNo);
|
||||||
|
}
|
||||||
@@ -41,6 +41,8 @@ public interface ThinkInvoiceService extends IService<ThinkInvoice> {
|
|||||||
|
|
||||||
ThinkInvoice getByOid(Integer oid);
|
ThinkInvoice getByOid(Integer oid);
|
||||||
|
|
||||||
|
ThinkInvoice getByOidNType(Integer oid, Integer iType);
|
||||||
|
|
||||||
ThinkInvoice getByOrderNum(String orderNum);
|
ThinkInvoice getByOrderNum(String orderNum);
|
||||||
|
|
||||||
ThinkInvoice getData(ThinkInvoiceParam param);
|
ThinkInvoice getData(ThinkInvoiceParam param);
|
||||||
|
|||||||
@@ -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.ThinkOrderOffCheck;
|
||||||
|
import com.gxwebsoft.think.param.ThinkOrderOffCheckParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 折扣审核Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-05-26 09:42:46
|
||||||
|
*/
|
||||||
|
public interface ThinkOrderOffCheckService extends IService<ThinkOrderOffCheck> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<ThinkOrderOffCheck>
|
||||||
|
*/
|
||||||
|
PageResult<ThinkOrderOffCheck> pageRel(ThinkOrderOffCheckParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<ThinkOrderOffCheck>
|
||||||
|
*/
|
||||||
|
List<ThinkOrderOffCheck> listRel(ThinkOrderOffCheckParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return ThinkOrderOffCheck
|
||||||
|
*/
|
||||||
|
ThinkOrderOffCheck getByIdRel(Integer id);
|
||||||
|
|
||||||
|
ThinkOrderOffCheck getByOrderId(Integer oid);
|
||||||
|
}
|
||||||
@@ -58,12 +58,16 @@ public interface ThinkOrderService extends IService<ThinkOrder> {
|
|||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
HashMap<String, String> createWxOrder(BigDecimal totalPrice, String orderNo, String desc, String openid, String notify, Integer orderId);
|
||||||
|
|
||||||
HashMap<String, String> createWxCodePay(BigDecimal totalPrice, String orderNo, String desc, String authCode);
|
HashMap<String, String> createWxCodePay(BigDecimal totalPrice, String orderNo, String desc, String authCode);
|
||||||
|
|
||||||
HashMap<String, String> checkWechatPayRes(String orderNo);
|
HashMap<String, String> checkWechatPayRes(String orderNo);
|
||||||
|
|
||||||
Refund refund(ThinkOrderRefundLog orderRefund);
|
Refund refund(ThinkOrderRefundLog orderRefund);
|
||||||
|
|
||||||
|
String cancelOrder(ThinkOrder thinkOrder, Boolean forceCancel, Integer refundBy);
|
||||||
|
|
||||||
ThinkOrder getLastOrderByVid(Integer vid);
|
ThinkOrder getLastOrderByVid(Integer vid);
|
||||||
|
|
||||||
ThinkOrder getLastOrderByCardCode(String code);
|
ThinkOrder getLastOrderByCardCode(String code);
|
||||||
@@ -71,4 +75,6 @@ public interface ThinkOrderService extends IService<ThinkOrder> {
|
|||||||
ThinkOrder getTodayOrder(Integer userId);
|
ThinkOrder getTodayOrder(Integer userId);
|
||||||
|
|
||||||
List<ThinkOrder> getTodayOrderInSite(Integer userId, Integer sid, String date);
|
List<ThinkOrder> getTodayOrderInSite(Integer userId, Integer sid, String date);
|
||||||
|
|
||||||
|
ThinkOrder getUnCheckBillByWechatCode(String wechatCode, long startTime, long endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ public interface ThinkUsersVipService extends IService<ThinkUsersVip> {
|
|||||||
*/
|
*/
|
||||||
List<ThinkUsersVip> listRel(ThinkUsersVipParam param);
|
List<ThinkUsersVip> listRel(ThinkUsersVipParam param);
|
||||||
|
|
||||||
|
List<ThinkUsersVip> listByVipIds(List<Integer> vipIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id查询
|
* 根据id查询
|
||||||
*
|
*
|
||||||
@@ -41,5 +43,5 @@ public interface ThinkUsersVipService extends IService<ThinkUsersVip> {
|
|||||||
|
|
||||||
ThinkUsersVip getByOrderNo(String orderNo);
|
ThinkUsersVip getByOrderNo(String orderNo);
|
||||||
|
|
||||||
ThinkUsersVip getByVidAndUid(Integer vid, Integer uid);
|
List<ThinkUsersVip> getByVidAndUid(Integer vid, Integer uid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ public interface ThinkVipService extends IService<ThinkVip> {
|
|||||||
*/
|
*/
|
||||||
ThinkVip getByIdRel(Integer id);
|
ThinkVip getByIdRel(Integer id);
|
||||||
|
|
||||||
|
List<ThinkVip> listBySid(Integer sid);
|
||||||
|
|
||||||
|
List<ThinkVip> listByReportSid(Integer reportSid);
|
||||||
|
|
||||||
List<ThinkVip> listByGroup(ThinkVipParam param);
|
List<ThinkVip> listByGroup(ThinkVipParam param);
|
||||||
|
|
||||||
List<ThinkVip> total(ThinkVipParam param);
|
List<ThinkVip> total(ThinkVipParam param);
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
package com.gxwebsoft.think.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkVip;
|
||||||
|
import com.gxwebsoft.think.mapper.ThinkCardBalanceMapper;
|
||||||
|
import com.gxwebsoft.think.service.ThinkCardBalanceService;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkCardBalance;
|
||||||
|
import com.gxwebsoft.think.param.ThinkCardBalanceParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡余额记录Service实现
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-06-20 20:58:38
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ThinkCardBalanceServiceImpl extends ServiceImpl<ThinkCardBalanceMapper, ThinkCardBalance> implements ThinkCardBalanceService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ThinkCardBalance> pageRel(ThinkCardBalanceParam param) {
|
||||||
|
PageParam<ThinkCardBalance, ThinkCardBalanceParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
List<ThinkCardBalance> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkCardBalance> listRel(ThinkCardBalanceParam param) {
|
||||||
|
List<ThinkCardBalance> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<ThinkCardBalance, ThinkCardBalanceParam> page = new PageParam<>();
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkCardBalance getByIdRel(Integer id) {
|
||||||
|
ThinkCardBalanceParam param = new ThinkCardBalanceParam();
|
||||||
|
param.setId(id);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkCardBalance getByCid(Integer cid) {
|
||||||
|
return getOne(
|
||||||
|
new LambdaQueryWrapper<ThinkCardBalance>()
|
||||||
|
.eq(ThinkCardBalance::getCid, cid)
|
||||||
|
.orderByAsc(ThinkCardBalance::getId)
|
||||||
|
.ge(ThinkCardBalance::getBalance, 0)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkCardBalance getByCid(Integer cid, BigDecimal amount) {
|
||||||
|
return getOne(
|
||||||
|
new LambdaQueryWrapper<ThinkCardBalance>()
|
||||||
|
.eq(ThinkCardBalance::getCid, cid)
|
||||||
|
.orderByAsc(ThinkCardBalance::getId)
|
||||||
|
.ge(ThinkCardBalance::getBalance, amount)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkCardBalance getByVid(Integer vid) {
|
||||||
|
return getOne(
|
||||||
|
new LambdaQueryWrapper<ThinkCardBalance>()
|
||||||
|
.eq(ThinkCardBalance::getVid, vid)
|
||||||
|
.orderByAsc(ThinkCardBalance::getId)
|
||||||
|
.ge(ThinkCardBalance::getBalance, 0)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkCardBalance getByVid(Integer vid, BigDecimal amount) {
|
||||||
|
return getOne(
|
||||||
|
new LambdaQueryWrapper<ThinkCardBalance>()
|
||||||
|
.eq(ThinkCardBalance::getVid, vid)
|
||||||
|
.orderByAsc(ThinkCardBalance::getId)
|
||||||
|
.ge(ThinkCardBalance::getBalance, amount)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkCardBalance> getCardList(Integer uid) {
|
||||||
|
return list(
|
||||||
|
new LambdaQueryWrapper<ThinkCardBalance>()
|
||||||
|
.isNull(ThinkCardBalance::getVid)
|
||||||
|
.eq(ThinkCardBalance::getUid, uid)
|
||||||
|
.gt(ThinkCardBalance::getBalance, 0)
|
||||||
|
.orderByAsc(ThinkCardBalance::getId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkCardBalance> getVipList(Integer uid) {
|
||||||
|
return list(
|
||||||
|
new LambdaQueryWrapper<ThinkCardBalance>()
|
||||||
|
.isNull(ThinkCardBalance::getCid)
|
||||||
|
.eq(ThinkCardBalance::getUid, uid)
|
||||||
|
.gt(ThinkCardBalance::getBalance, 0)
|
||||||
|
.orderByAsc(ThinkCardBalance::getId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal getThinkCardBalance(ThinkVip thinkVip) {
|
||||||
|
BigDecimal reduceEach = BigDecimal.ZERO;
|
||||||
|
// 年卡
|
||||||
|
if (thinkVip.getType().equals(1)) {
|
||||||
|
reduceEach = thinkVip.getPrice().divide(BigDecimal.valueOf((thinkVip.getTerm() * 365L) + (thinkVip.getMonth() * 30L)), RoundingMode.HALF_UP);
|
||||||
|
} else if (thinkVip.getType().equals(2)) {
|
||||||
|
// 次卡
|
||||||
|
reduceEach = thinkVip.getPrice().divide(BigDecimal.valueOf(thinkVip.getCount()), RoundingMode.HALF_UP);
|
||||||
|
} else if (thinkVip.getType().equals(3) || thinkVip.getType().equals(4)) {
|
||||||
|
// 月卡、季卡
|
||||||
|
reduceEach = thinkVip.getPrice().divide(BigDecimal.valueOf(thinkVip.getMonth() * 30L), RoundingMode.HALF_UP);
|
||||||
|
}
|
||||||
|
return reduceEach;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,15 +6,19 @@ import com.gxwebsoft.common.core.utils.RequestUtil;
|
|||||||
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.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkCard;
|
||||||
import com.gxwebsoft.think.entity.ThinkCardLog;
|
import com.gxwebsoft.think.entity.ThinkCardLog;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkVip;
|
||||||
import com.gxwebsoft.think.mapper.ThinkCardLogMapper;
|
import com.gxwebsoft.think.mapper.ThinkCardLogMapper;
|
||||||
import com.gxwebsoft.think.param.ThinkCardLogParam;
|
import com.gxwebsoft.think.param.ThinkCardLogParam;
|
||||||
import com.gxwebsoft.think.service.ThinkCardLogService;
|
import com.gxwebsoft.think.service.ThinkCardLogService;
|
||||||
import com.gxwebsoft.think.service.ThinkCardService;
|
import com.gxwebsoft.think.service.ThinkCardService;
|
||||||
|
import com.gxwebsoft.think.service.ThinkVipService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,9 +31,25 @@ import java.util.List;
|
|||||||
public class ThinkCardLogServiceImpl extends ServiceImpl<ThinkCardLogMapper, ThinkCardLog> implements ThinkCardLogService {
|
public class ThinkCardLogServiceImpl extends ServiceImpl<ThinkCardLogMapper, ThinkCardLog> implements ThinkCardLogService {
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkCardService thinkCardService;
|
private ThinkCardService thinkCardService;
|
||||||
|
@Resource
|
||||||
|
private ThinkVipService thinkVipService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ThinkCardLog> pageRel(ThinkCardLogParam param, HttpServletRequest request) {
|
public PageResult<ThinkCardLog> pageRel(ThinkCardLogParam param, HttpServletRequest request) {
|
||||||
|
if (param.getSid() != null) {
|
||||||
|
List<ThinkVip> thinkVipList = thinkVipService.listByReportSid(param.getSid());
|
||||||
|
if (thinkVipList != null && !thinkVipList.isEmpty()) {
|
||||||
|
List<Integer> vidList = thinkVipList.stream().map(ThinkVip::getId).toList();
|
||||||
|
List<ThinkCard> cardList = thinkCardService.listByVidList(vidList);
|
||||||
|
if (cardList != null && !cardList.isEmpty()) {
|
||||||
|
List<String> codeList = cardList.stream().map(ThinkCard::getCode).toList();
|
||||||
|
param.setCodeList(codeList);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
List<ThinkCardLog> empty = new ArrayList<>();
|
||||||
|
return new PageResult<>(empty, 0L);
|
||||||
|
}
|
||||||
|
}
|
||||||
PageParam<ThinkCardLog, ThinkCardLogParam> page = new PageParam<>(param);
|
PageParam<ThinkCardLog, ThinkCardLogParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("id desc, create_time desc");
|
page.setDefaultOrder("id desc, create_time desc");
|
||||||
List<ThinkCardLog> list = baseMapper.selectPageRel(page, param);
|
List<ThinkCardLog> list = baseMapper.selectPageRel(page, param);
|
||||||
|
|||||||
@@ -2,17 +2,15 @@ package com.gxwebsoft.think.service.impl;
|
|||||||
|
|
||||||
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.ThinkRechargeLog;
|
||||||
import com.gxwebsoft.think.entity.ThinkUsers;
|
import com.gxwebsoft.think.entity.ThinkUsers;
|
||||||
import com.gxwebsoft.think.entity.ThinkVip;
|
import com.gxwebsoft.think.entity.ThinkVip;
|
||||||
import com.gxwebsoft.think.mapper.ThinkCardMapper;
|
import com.gxwebsoft.think.mapper.ThinkCardMapper;
|
||||||
import com.gxwebsoft.think.service.ThinkCardService;
|
import com.gxwebsoft.think.service.*;
|
||||||
import com.gxwebsoft.think.entity.ThinkCard;
|
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 com.gxwebsoft.think.service.ThinkVipService;
|
|
||||||
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.exception.ServiceException;
|
import com.wechat.pay.java.core.exception.ServiceException;
|
||||||
import com.wechat.pay.java.service.payments.jsapi.model.QueryOrderByOutTradeNoRequest;
|
import com.wechat.pay.java.service.payments.jsapi.model.QueryOrderByOutTradeNoRequest;
|
||||||
@@ -23,10 +21,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,6 +38,8 @@ public class ThinkCardServiceImpl extends ServiceImpl<ThinkCardMapper, ThinkCard
|
|||||||
private WechatConfigService wechatConfigService;
|
private WechatConfigService wechatConfigService;
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkVipService thinkVipService;
|
private ThinkVipService thinkVipService;
|
||||||
|
@Resource
|
||||||
|
private ThinkInvoiceService thinkInvoiceService;
|
||||||
|
|
||||||
// private String mchId = "1604773943";
|
// private String mchId = "1604773943";
|
||||||
private String mchId = "1246610101";
|
private String mchId = "1246610101";
|
||||||
@@ -50,6 +47,15 @@ public class ThinkCardServiceImpl extends ServiceImpl<ThinkCardMapper, ThinkCard
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ThinkCard> pageRel(ThinkCardParam param) {
|
public PageResult<ThinkCard> pageRel(ThinkCardParam param) {
|
||||||
|
if (param.getSid() != null) {
|
||||||
|
List<ThinkVip> thinkVipList = thinkVipService.listByReportSid(Integer.valueOf(param.getSid()));
|
||||||
|
if (thinkVipList.isEmpty()) {
|
||||||
|
List<ThinkCard> empty = new ArrayList<>();
|
||||||
|
return new PageResult<>(empty, 0L);
|
||||||
|
}
|
||||||
|
param.setSid(null);
|
||||||
|
param.setVipList(thinkVipList.stream().map(ThinkVip::getId).toList());
|
||||||
|
}
|
||||||
PageParam<ThinkCard, ThinkCardParam> page = new PageParam<>(param);
|
PageParam<ThinkCard, ThinkCardParam> page = new PageParam<>(param);
|
||||||
if (param.getOrderBy() != null) {
|
if (param.getOrderBy() != null) {
|
||||||
page.setDefaultOrder(param.getOrderBy());
|
page.setDefaultOrder(param.getOrderBy());
|
||||||
@@ -62,6 +68,9 @@ public class ThinkCardServiceImpl extends ServiceImpl<ThinkCardMapper, ThinkCard
|
|||||||
String[] sids = item.getSid().split(",");
|
String[] sids = item.getSid().split(",");
|
||||||
item.setSiteList(thinkSiteService.listByIds(Arrays.stream(sids).map(Integer::valueOf).toList()));
|
item.setSiteList(thinkSiteService.listByIds(Arrays.stream(sids).map(Integer::valueOf).toList()));
|
||||||
item.setThinkVip(vipList.stream().filter(item1 -> item1.getId().equals(item.getVid())).findFirst().orElse(null));
|
item.setThinkVip(vipList.stream().filter(item1 -> item1.getId().equals(item.getVid())).findFirst().orElse(null));
|
||||||
|
if (item.getIsInvoice().equals(1)) {
|
||||||
|
item.setThinkInvoice(thinkInvoiceService.getByOidNType(item.getId(), 3));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
@@ -129,6 +138,14 @@ public class ThinkCardServiceImpl extends ServiceImpl<ThinkCardMapper, ThinkCard
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkCard> listByVidList(List<Integer> vidList) {
|
||||||
|
return list(
|
||||||
|
new LambdaQueryWrapper<ThinkCard>()
|
||||||
|
.in(ThinkCard::getVid, vidList)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 扫码支付
|
* 扫码支付
|
||||||
* @param totalPrice
|
* @param totalPrice
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.gxwebsoft.think.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.think.mapper.ThinkFtpCheckBillMapper;
|
||||||
|
import com.gxwebsoft.think.service.ThinkFtpCheckBillService;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkFtpCheckBill;
|
||||||
|
import com.gxwebsoft.think.param.ThinkFtpCheckBillParam;
|
||||||
|
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 2025-05-21 11:58:28
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ThinkFtpCheckBillServiceImpl extends ServiceImpl<ThinkFtpCheckBillMapper, ThinkFtpCheckBill> implements ThinkFtpCheckBillService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ThinkFtpCheckBill> pageRel(ThinkFtpCheckBillParam param) {
|
||||||
|
PageParam<ThinkFtpCheckBill, ThinkFtpCheckBillParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
List<ThinkFtpCheckBill> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkFtpCheckBill> listRel(ThinkFtpCheckBillParam param) {
|
||||||
|
List<ThinkFtpCheckBill> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<ThinkFtpCheckBill, ThinkFtpCheckBillParam> page = new PageParam<>();
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkFtpCheckBill getByIdRel(Integer id) {
|
||||||
|
ThinkFtpCheckBillParam param = new ThinkFtpCheckBillParam();
|
||||||
|
param.setId(id);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkFtpCheckBill getByOrderNo(String orderNo) {
|
||||||
|
ThinkFtpCheckBillParam param = new ThinkFtpCheckBillParam();
|
||||||
|
param.setOrderNo(orderNo);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -52,6 +52,14 @@ public class ThinkInvoiceServiceImpl extends ServiceImpl<ThinkInvoiceMapper, Thi
|
|||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkInvoice getByOidNType(Integer oid, Integer iType) {
|
||||||
|
ThinkInvoiceParam param = new ThinkInvoiceParam();
|
||||||
|
param.setOid(oid);
|
||||||
|
param.setItype(iType);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ThinkInvoice getByOrderNum(String orderNum) {
|
public ThinkInvoice getByOrderNum(String orderNum) {
|
||||||
ThinkInvoiceParam param = new ThinkInvoiceParam();
|
ThinkInvoiceParam param = new ThinkInvoiceParam();
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package com.gxwebsoft.think.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkOrder;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkSite;
|
||||||
|
import com.gxwebsoft.think.mapper.ThinkOrderOffCheckMapper;
|
||||||
|
import com.gxwebsoft.think.service.ThinkOrderInfoService;
|
||||||
|
import com.gxwebsoft.think.service.ThinkOrderOffCheckService;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkOrderOffCheck;
|
||||||
|
import com.gxwebsoft.think.param.ThinkOrderOffCheckParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.think.service.ThinkOrderService;
|
||||||
|
import com.gxwebsoft.think.service.ThinkSiteService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 折扣审核Service实现
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-05-26 09:42:46
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ThinkOrderOffCheckServiceImpl extends ServiceImpl<ThinkOrderOffCheckMapper, ThinkOrderOffCheck> implements ThinkOrderOffCheckService {
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderService thinkOrderService;
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderInfoService thinkOrderInfoService;
|
||||||
|
@Resource
|
||||||
|
private ThinkSiteService thinkSiteService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ThinkOrderOffCheck> pageRel(ThinkOrderOffCheckParam param) {
|
||||||
|
PageParam<ThinkOrderOffCheck, ThinkOrderOffCheckParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
List<ThinkOrderOffCheck> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkOrderOffCheck> listRel(ThinkOrderOffCheckParam param) {
|
||||||
|
List<ThinkOrderOffCheck> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<ThinkOrderOffCheck, ThinkOrderOffCheckParam> page = new PageParam<>();
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
for (ThinkOrderOffCheck thinkOrderOffCheck : list) {
|
||||||
|
ThinkOrder thinkOrder = thinkOrderService.getById(thinkOrderOffCheck.getOid());
|
||||||
|
ThinkSite thinkSite = thinkSiteService.getById(thinkOrder.getSid());
|
||||||
|
thinkOrder.setSiteName(thinkSite.getName());
|
||||||
|
thinkOrder.setThinkOrderInfos(thinkOrderInfoService.listInOrder(thinkOrderOffCheck.getOid()));
|
||||||
|
thinkOrderOffCheck.setThinkOrder(thinkOrder);
|
||||||
|
}
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkOrderOffCheck getByIdRel(Integer id) {
|
||||||
|
ThinkOrderOffCheckParam param = new ThinkOrderOffCheckParam();
|
||||||
|
param.setId(id);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkOrderOffCheck getByOrderId(Integer oid) {
|
||||||
|
ThinkOrderOffCheckParam param = new ThinkOrderOffCheckParam();
|
||||||
|
param.setOid(oid);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.think.service.impl;
|
package com.gxwebsoft.think.service.impl;
|
||||||
|
|
||||||
|
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;
|
||||||
@@ -73,6 +74,10 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
private ThinkFieldService thinkFieldService;
|
private ThinkFieldService thinkFieldService;
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkMachineOpenLogService thinkMachineOpenLogService;
|
private ThinkMachineOpenLogService thinkMachineOpenLogService;
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderRefundLogService thinkOrderRefundLogService;
|
||||||
|
@Resource
|
||||||
|
private ThinkVipCardsBillsService thinkVipCardsBillsService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ThinkOrderController thinkOrderController;
|
private ThinkOrderController thinkOrderController;
|
||||||
@@ -88,6 +93,20 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ThinkOrder> pageRel(ThinkOrderParam param) {
|
public PageResult<ThinkOrder> pageRel(ThinkOrderParam param) {
|
||||||
|
if (param.getIsUseTime() != null && param.getIsUseTime() && param.getCreateTimeStart() != null) {
|
||||||
|
LambdaQueryWrapper<ThinkOrderInfo> queryWrapper = new LambdaQueryWrapper<ThinkOrderInfo>()
|
||||||
|
.in(ThinkOrderInfo::getPayStatus, 1, 3)
|
||||||
|
.ge(ThinkOrderInfo::getStartTime, param.getCreateTimeStart())
|
||||||
|
.le(ThinkOrderInfo::getStartTime, param.getCreateTimeEnd());
|
||||||
|
if (param.getSid() != null) queryWrapper.eq(ThinkOrderInfo::getSid, param.getSid());
|
||||||
|
List<ThinkOrderInfo> orderInfoList = thinkOrderInfoService.list(queryWrapper);
|
||||||
|
if (orderInfoList != null && !orderInfoList.isEmpty()) {
|
||||||
|
List<Integer> orderIdList = orderInfoList.stream().map(ThinkOrderInfo::getOid).toList();
|
||||||
|
param.setIdList(orderIdList);
|
||||||
|
}
|
||||||
|
param.setCreateTimeStart(null);
|
||||||
|
param.setCreateTimeEnd(null);
|
||||||
|
}
|
||||||
PageParam<ThinkOrder, ThinkOrderParam> page = new PageParam<>(param);
|
PageParam<ThinkOrder, ThinkOrderParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
List<ThinkOrder> list = baseMapper.selectPageRel(page, param);
|
List<ThinkOrder> list = baseMapper.selectPageRel(page, param);
|
||||||
@@ -185,7 +204,8 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
// 合并
|
// 合并
|
||||||
cardList.addAll(cardListByCode);
|
cardList.addAll(cardListByCode);
|
||||||
}
|
}
|
||||||
List<ThinkUsersVip> vipList = thinkUsersVipService.listByIds(new ArrayList<>(vidList));
|
List<ThinkUsersVip> vipList = new ArrayList<>();
|
||||||
|
if (!vidList.isEmpty()) vipList = thinkUsersVipService.listByIds(new ArrayList<>(vidList));
|
||||||
for (ThinkOrder d : list) {
|
for (ThinkOrder d : list) {
|
||||||
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(d.getId());
|
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(d.getId());
|
||||||
StringBuilder dateTimeList = new StringBuilder();
|
StringBuilder dateTimeList = new StringBuilder();
|
||||||
@@ -204,7 +224,8 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
d.setThinkOrderInfos(thinkOrderInfoList);
|
d.setThinkOrderInfos(thinkOrderInfoList);
|
||||||
if (!cardList.isEmpty())
|
if (!cardList.isEmpty())
|
||||||
d.setCard(cardList.stream().filter(c -> c.getId().equals(d.getCid())).findFirst().orElse(null));
|
d.setCard(cardList.stream().filter(c -> c.getId().equals(d.getCid())).findFirst().orElse(null));
|
||||||
d.setThinkVip(vipList.stream().filter(c -> c.getId().equals(d.getVid())).findFirst().orElse(null));
|
if (!vipList.isEmpty())
|
||||||
|
d.setThinkVip(vipList.stream().filter(c -> c.getId().equals(d.getVid())).findFirst().orElse(null));
|
||||||
}
|
}
|
||||||
// 排序
|
// 排序
|
||||||
PageParam<ThinkOrder, ThinkOrderParam> page = new PageParam<>();
|
PageParam<ThinkOrder, ThinkOrderParam> page = new PageParam<>();
|
||||||
@@ -285,7 +306,7 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
try {
|
try {
|
||||||
String data = aes.decryptStr(qrCode);
|
String data = aes.decryptStr(qrCode);
|
||||||
String[] idArr = data.split("_");
|
String[] idArr = data.split("_");
|
||||||
System.out.println("qr code decrypted: " + data);
|
// System.out.println("qr code decrypted: " + data);
|
||||||
long expiredSec = 30;
|
long expiredSec = 30;
|
||||||
// long expiredSec = 24 * 3600;
|
// long expiredSec = 24 * 3600;
|
||||||
if (idArr.length == 4 && idArr[3].equals("forDevice")) {
|
if (idArr.length == 4 && idArr[3].equals("forDevice")) {
|
||||||
@@ -408,74 +429,92 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
order.setIsInvoice(3);
|
order.setIsInvoice(3);
|
||||||
order.setCreateTime(DateUtil.currentSeconds());
|
order.setCreateTime(DateUtil.currentSeconds());
|
||||||
order.setUpdateTime(DateUtil.currentSeconds());
|
order.setUpdateTime(DateUtil.currentSeconds());
|
||||||
thinkOrderService.save(order);
|
int checkOrderNum = thinkOrderService.count(
|
||||||
String weekStr = "";
|
new LambdaQueryWrapper<ThinkOrder>()
|
||||||
switch (currentWeek) {
|
.eq(ThinkOrder::getVid, thinkUsersVip.getId())
|
||||||
case 1: {
|
.eq(ThinkOrder::getSid, 37)
|
||||||
weekStr = "星期一";
|
.eq(ThinkOrder::getStartTime, startTimeStr)
|
||||||
|
.eq(ThinkOrder::getPayStatus, 1)
|
||||||
|
);
|
||||||
|
if (checkOrderNum == 0) {
|
||||||
|
thinkOrderService.save(order);
|
||||||
|
String weekStr = "";
|
||||||
|
switch (currentWeek) {
|
||||||
|
case 1: {
|
||||||
|
weekStr = "星期一";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2: {
|
||||||
|
weekStr = "星期二";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3: {
|
||||||
|
weekStr = "星期三";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4: {
|
||||||
|
weekStr = "星期四";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5: {
|
||||||
|
weekStr = "星期五";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 6: {
|
||||||
|
weekStr = "星期六";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 7: {
|
||||||
|
weekStr = "星期日";
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
ThinkOrderInfo thinkOrderInfo = new ThinkOrderInfo();
|
||||||
case 2: {
|
thinkOrderInfo.setOid(order.getId());
|
||||||
weekStr = "星期二";
|
thinkOrderInfo.setSid(order.getSid());
|
||||||
|
thinkOrderInfo.setFid(113);
|
||||||
|
thinkOrderInfo.setSiteName(thinkSite.getName());
|
||||||
|
thinkOrderInfo.setFieldName(thinkField.getName());
|
||||||
|
thinkOrderInfo.setDateTime(today + "(" + weekStr + ")" + siteTimeItem.getTimePeriod());
|
||||||
|
thinkOrderInfo.setPrice(siteTimeItem.getPrice());
|
||||||
|
thinkOrderInfo.setChildrenPrice(siteTimeItem.getChildrenPrice());
|
||||||
|
if (thinkUsersVip.getCardType().equals(1)) {
|
||||||
|
thinkOrderInfo.setAdultNum(1);
|
||||||
|
thinkOrderInfo.setChildrenNum(0);
|
||||||
|
thinkOrderInfo.setIsChildren(2);
|
||||||
|
} else {
|
||||||
|
thinkOrderInfo.setAdultNum(0);
|
||||||
|
thinkOrderInfo.setChildrenNum(1);
|
||||||
|
thinkOrderInfo.setIsChildren(1);
|
||||||
}
|
}
|
||||||
break;
|
thinkOrderInfo.setIsFree(2);
|
||||||
case 3: {
|
thinkOrderInfo.setType(1);
|
||||||
weekStr = "星期三";
|
thinkOrderInfo.setUsedNum(0);
|
||||||
}
|
String[] timePeriodList = siteTimeItem.getTimePeriod().split(" - ");
|
||||||
break;
|
thinkOrderInfo.setMergeData(today + timePeriodList[0] + timePeriodList[1] + "37113");
|
||||||
case 4: {
|
thinkOrderInfo.setStartTime(Integer.valueOf(startTimeStr));
|
||||||
weekStr = "星期四";
|
thinkOrderInfo.setOrderTime(DateUtil.currentSeconds());
|
||||||
}
|
thinkOrderInfo.setTimeFlag(DateUtil.current());
|
||||||
break;
|
thinkOrderInfoService.save(thinkOrderInfo);
|
||||||
case 5: {
|
|
||||||
weekStr = "星期五";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 6: {
|
|
||||||
weekStr = "星期六";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 7: {
|
|
||||||
weekStr = "星期日";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ThinkOrderInfo thinkOrderInfo = new ThinkOrderInfo();
|
|
||||||
thinkOrderInfo.setOid(order.getId());
|
|
||||||
thinkOrderInfo.setSid(order.getSid());
|
|
||||||
thinkOrderInfo.setFid(113);
|
|
||||||
thinkOrderInfo.setSiteName(thinkSite.getName());
|
|
||||||
thinkOrderInfo.setFieldName(thinkField.getName());
|
|
||||||
thinkOrderInfo.setDateTime(today + "(" + weekStr + ")" + siteTimeItem.getTimePeriod());
|
|
||||||
thinkOrderInfo.setPrice(siteTimeItem.getPrice());
|
|
||||||
thinkOrderInfo.setChildrenPrice(siteTimeItem.getChildrenPrice());
|
|
||||||
if (thinkUsersVip.getCardType().equals(1)) {
|
|
||||||
thinkOrderInfo.setAdultNum(1);
|
|
||||||
thinkOrderInfo.setChildrenNum(0);
|
|
||||||
thinkOrderInfo.setIsChildren(2);
|
|
||||||
} else {
|
|
||||||
thinkOrderInfo.setAdultNum(0);
|
|
||||||
thinkOrderInfo.setChildrenNum(1);
|
|
||||||
thinkOrderInfo.setIsChildren(1);
|
|
||||||
}
|
|
||||||
thinkOrderInfo.setIsFree(2);
|
|
||||||
thinkOrderInfo.setType(1);
|
|
||||||
String[] timePeriodList = siteTimeItem.getTimePeriod().split(" - ");
|
|
||||||
thinkOrderInfo.setMergeData(today + timePeriodList[0] + timePeriodList[1] + "37113");
|
|
||||||
thinkOrderInfo.setStartTime(Integer.valueOf(startTimeStr));
|
|
||||||
thinkOrderInfo.setOrderTime(DateUtil.currentSeconds());
|
|
||||||
thinkOrderInfo.setTimeFlag(DateUtil.current());
|
|
||||||
thinkOrderInfoService.save(thinkOrderInfo);
|
|
||||||
|
|
||||||
thinkOrderController.updatePay(order, null, order.getTotalPrice().multiply(BigDecimal.valueOf(100)).intValue());
|
thinkOrderController.updatePay(order, null, order.getTotalPrice().multiply(BigDecimal.valueOf(100)).intValue());
|
||||||
order.setPayStatus(1);
|
order.setPayStatus(1);
|
||||||
order.setOrderStatus(1);
|
order.setOrderStatus(1);
|
||||||
thinkOrderService.updateById(order);
|
thinkOrderService.updateById(order);
|
||||||
redisUtil.set(qrCode, 1, 1L, TimeUnit.HOURS);
|
order.setThinkOrderInfos(new ArrayList<>() {{
|
||||||
return new HashMap<>() {{
|
add(thinkOrderInfo);
|
||||||
put("res", true);
|
}});
|
||||||
put("data", order);
|
redisUtil.set(qrCode, 1, 1L, TimeUnit.HOURS);
|
||||||
}};
|
return new HashMap<>() {{
|
||||||
|
put("res", true);
|
||||||
|
put("data", order);
|
||||||
|
}};
|
||||||
|
} else {
|
||||||
|
return new HashMap<>() {{
|
||||||
|
put("res", false);
|
||||||
|
put("msg", "重复下单");
|
||||||
|
}};
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return new HashMap<>() {{
|
return new HashMap<>() {{
|
||||||
put("res", false);
|
put("res", false);
|
||||||
@@ -522,9 +561,29 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
put("msg", "该订单已核销");
|
put("msg", "该订单已核销");
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
if (!thinkOrder.getOrderStatus().equals(2)) {
|
||||||
|
return new HashMap<>() {{
|
||||||
|
put("res", false);
|
||||||
|
put("msg", "该订单无法使用");
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
if (thinkOrder.getSid().equals(37)) {
|
||||||
|
// List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
||||||
|
String orderDate = DateUtil.format(DateUtil.date(Integer.parseInt(thinkOrder.getStartTime()) * 1000L), "yyyy-MM-dd");
|
||||||
|
// System.out.println("37 date cal 111:" + "/" + DateUtil.date(thinkOrderInfoList.get(0).getStartTime() * 1000));
|
||||||
|
// System.out.println("37 date cal 222:" + "/" + thinkOrderInfoList.get(0).getStartTime());
|
||||||
|
String today = DateUtil.format(DateUtil.date(), "yyyy-MM-dd");
|
||||||
|
System.out.println("37 date cal:" + orderDate + "/" + today + "/" + !orderDate.equals(today));
|
||||||
|
if (!orderDate.equals(today)) {
|
||||||
|
return new HashMap<>() {{
|
||||||
|
put("res", false);
|
||||||
|
put("msg", "该订单已过时");
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotEmpty(thinkOrder)) {
|
if (ObjectUtil.isNotEmpty(thinkOrder)) {
|
||||||
thinkOrder.setThinkOrderInfos(thinkOrderInfoService.list(new LambdaQueryWrapper<ThinkOrderInfo>().eq(ThinkOrderInfo::getOid, thinkOrder.getId())));
|
thinkOrder.setThinkOrderInfos(thinkOrderInfoService.listInOrder(thinkOrder.getId()));
|
||||||
}
|
}
|
||||||
return new HashMap<>() {{
|
return new HashMap<>() {{
|
||||||
put("res", true);
|
put("res", true);
|
||||||
@@ -546,6 +605,11 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<String, String> createWxOrder(BigDecimal totalPrice, String orderNo, String desc, String openid, String notify) {
|
public HashMap<String, String> createWxOrder(BigDecimal totalPrice, String orderNo, String desc, String openid, String notify) {
|
||||||
|
return createWxOrder(totalPrice, orderNo, desc, openid, notify, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<String, String> createWxOrder(BigDecimal totalPrice, String orderNo, String desc, String openid, String notify, Integer orderId) {
|
||||||
final HashMap<String, String> orderInfo = new HashMap<>();
|
final HashMap<String, String> orderInfo = new HashMap<>();
|
||||||
|
|
||||||
// 计算金额
|
// 计算金额
|
||||||
@@ -581,6 +645,7 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
orderInfo.put("package", response.getPackageVal());
|
orderInfo.put("package", response.getPackageVal());
|
||||||
orderInfo.put("signType", "RSA");
|
orderInfo.put("signType", "RSA");
|
||||||
orderInfo.put("paySign", response.getPaySign());
|
orderInfo.put("paySign", response.getPaySign());
|
||||||
|
orderInfo.put("orderId", orderId == null ? "" : orderId.toString());
|
||||||
return orderInfo;
|
return orderInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -680,7 +745,7 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
String refundNotifyUrl = "https://gxtyzx-api2.websoft.top/api/think/think-order-refund-log/notify";
|
String refundNotifyUrl = "https://gxtyzx-api2.websoft.top/api/think/think-order-refund-log/notify";
|
||||||
// 金额
|
// 金额
|
||||||
AmountReq amount = new AmountReq();
|
AmountReq amount = new AmountReq();
|
||||||
amount.setTotal(orderRefund.getOrder().getPrice().multiply(BigDecimal.valueOf(100)).longValue());
|
amount.setTotal(orderRefund.getOrder().getPayPrice().multiply(BigDecimal.valueOf(100)).longValue());
|
||||||
amount.setRefund(orderRefund.getRefundAmount().multiply(BigDecimal.valueOf(100)).longValue());
|
amount.setRefund(orderRefund.getRefundAmount().multiply(BigDecimal.valueOf(100)).longValue());
|
||||||
amount.setCurrency("CNY");
|
amount.setCurrency("CNY");
|
||||||
request.setNotifyUrl(refundNotifyUrl);
|
request.setNotifyUrl(refundNotifyUrl);
|
||||||
@@ -690,6 +755,96 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
return service.create(request);
|
return service.create(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String cancelOrder(ThinkOrder thinkOrder, Boolean forceCancel, Integer refundBy) {
|
||||||
|
ThinkOrder thinkOrder1 = getById(thinkOrder.getId());
|
||||||
|
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
||||||
|
if (!forceCancel) {
|
||||||
|
if (thinkOrder.getIsAdmin() == null) {
|
||||||
|
if (!thinkOrder1.getSid().equals(37)) {
|
||||||
|
if ((int) DateUtil.currentSeconds() - thinkOrder1.getCreateTime() > 1800) {
|
||||||
|
if (thinkOrderInfoList.get(0).getStartTime() - (int) DateUtil.currentSeconds() < (3600 * 6)) {
|
||||||
|
return "距离开场已不足6小时不可退";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (thinkOrder1.getOrderStatus().equals(1)) {
|
||||||
|
return "该订单已使用不可退";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int num = 0;
|
||||||
|
for (ThinkOrderInfo thinkOrderInfo : thinkOrderInfoList) {
|
||||||
|
thinkOrderInfo.setPayStatus(0);
|
||||||
|
num += thinkOrderInfo.getAdultNum() + thinkOrderInfo.getChildrenNum() - thinkOrderInfo.getUsedNum();
|
||||||
|
redisUtil.delete(thinkOrderInfo.getStartTime().toString() + thinkOrderInfo.getFid().toString());
|
||||||
|
}
|
||||||
|
thinkOrderInfoService.updateBatchById(thinkOrderInfoList);
|
||||||
|
|
||||||
|
if (thinkOrder1.getVid() != null && !thinkOrder1.getVid().equals(0)) {
|
||||||
|
ThinkUsersVip thinkUsersVip = thinkUsersVipService.getById(thinkOrder1.getVid());
|
||||||
|
if (thinkUsersVip != null) {
|
||||||
|
thinkUsersVip.setUseTime(0L);
|
||||||
|
ThinkVipCardsBills thinkVipCardsBills = new ThinkVipCardsBills();
|
||||||
|
thinkVipCardsBills.setVid(thinkOrder1.getVid());
|
||||||
|
thinkVipCardsBills.setUid(thinkOrder1.getUid());
|
||||||
|
DateTime dateTime = DateUtil.date(thinkOrderInfoList.get(0).getStartTime() * 1000L);
|
||||||
|
thinkVipCardsBills.setDate(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||||
|
thinkVipCardsBillsService.cancelLog(thinkVipCardsBills);
|
||||||
|
|
||||||
|
if (thinkUsersVip.getType().equals(5)) {
|
||||||
|
BigDecimal newBalance = thinkUsersVip.getRemainingMoney().add(thinkOrder1.getPayPrice());
|
||||||
|
thinkUsersVip.setRemainingMoney(newBalance);
|
||||||
|
} else if (thinkUsersVip.getType().equals(4)) {
|
||||||
|
BigDecimal newBalance = thinkUsersVip.getRemainingMoney().add(thinkUsersVip.getEachMoney());
|
||||||
|
thinkUsersVip.setRemainingMoney(newBalance);
|
||||||
|
thinkUsersVip.setNum(thinkUsersVip.getNum() + num);
|
||||||
|
} else {
|
||||||
|
thinkUsersVip.setNum(thinkUsersVip.getNum() + num);
|
||||||
|
}
|
||||||
|
thinkUsersVip.setUseTime(0L);
|
||||||
|
thinkUsersVipService.updateById(thinkUsersVip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ThinkCard card = null;
|
||||||
|
if (thinkOrder1.getCode() != null && !thinkOrder1.getCode().isEmpty()) {
|
||||||
|
card = thinkCardService.getByCode(thinkOrder1.getCode());
|
||||||
|
}
|
||||||
|
if (card == null && thinkOrder1.getCid() != null && !thinkOrder1.getCid().equals(0))
|
||||||
|
card = thinkCardService.getById(thinkOrder1.getCid());
|
||||||
|
if (card != null) {
|
||||||
|
if (card.getType().equals(5)) {
|
||||||
|
BigDecimal newBalance = card.getRemainingMoney().add(thinkOrder1.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() + num);
|
||||||
|
}
|
||||||
|
card.setUseTime(0L);
|
||||||
|
thinkCardService.updateById(card);
|
||||||
|
}
|
||||||
|
if (thinkOrder1.getWechatOrder() != null && !thinkOrder1.getWechatOrder().isEmpty() && thinkOrder1.getWechatOrder().contains("420000")) {
|
||||||
|
ThinkOrderRefundLog thinkOrderRefundLog = new ThinkOrderRefundLog();
|
||||||
|
thinkOrderRefundLog.setOid(thinkOrder.getId());
|
||||||
|
thinkOrderRefundLog.setRefundNo("R" + thinkOrder1.getOrderNum());
|
||||||
|
thinkOrderRefundLog.setType(0);
|
||||||
|
thinkOrderRefundLog.setRefundAmount(thinkOrder1.getPayPrice());
|
||||||
|
thinkOrderRefundLog.setUid(thinkOrder1.getUid());
|
||||||
|
thinkOrderRefundLog.setCreateTime(LocalDateTimeUtil.now());
|
||||||
|
thinkOrderRefundLogService.save(thinkOrderRefundLog);
|
||||||
|
thinkOrderRefundLog.setOrder(thinkOrder1);
|
||||||
|
thinkOrderService.refund(thinkOrderRefundLog);
|
||||||
|
}
|
||||||
|
if (refundBy != null) {
|
||||||
|
thinkOrder1.setRefundBy(refundBy);
|
||||||
|
updateById(thinkOrder1);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ThinkOrder getLastOrderByVid(Integer vid) {
|
public ThinkOrder getLastOrderByVid(Integer vid) {
|
||||||
return getOne(
|
return getOne(
|
||||||
@@ -739,4 +894,15 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
|||||||
.orderByDesc(ThinkOrder::getCreateTime)
|
.orderByDesc(ThinkOrder::getCreateTime)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThinkOrder getUnCheckBillByWechatCode(String wechatCode, long startTime, long endTime) {
|
||||||
|
return getOne(
|
||||||
|
new LambdaQueryWrapper<ThinkOrder>()
|
||||||
|
.eq(ThinkOrder::getWechatOrder, wechatCode)
|
||||||
|
.eq(ThinkOrder::getCheckBill, 2)
|
||||||
|
.between(ThinkOrder::getPayTime, startTime, endTime)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ package com.gxwebsoft.think.service.impl;
|
|||||||
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.ThinkSite;
|
import com.gxwebsoft.think.entity.ThinkSite;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkUsersVip;
|
||||||
|
import com.gxwebsoft.think.entity.ThinkVip;
|
||||||
import com.gxwebsoft.think.mapper.ThinkRechargeLogMapper;
|
import com.gxwebsoft.think.mapper.ThinkRechargeLogMapper;
|
||||||
import com.gxwebsoft.think.service.ThinkRechargeLogService;
|
import com.gxwebsoft.think.service.*;
|
||||||
import com.gxwebsoft.think.entity.ThinkRechargeLog;
|
import com.gxwebsoft.think.entity.ThinkRechargeLog;
|
||||||
import com.gxwebsoft.think.param.ThinkRechargeLogParam;
|
import com.gxwebsoft.think.param.ThinkRechargeLogParam;
|
||||||
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 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.refund.RefundService;
|
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.AmountReq;
|
||||||
@@ -37,10 +37,29 @@ public class ThinkRechargeLogServiceImpl extends ServiceImpl<ThinkRechargeLogMap
|
|||||||
@Resource
|
@Resource
|
||||||
private ThinkSiteService thinkSiteService;
|
private ThinkSiteService thinkSiteService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private ThinkVipService thinkVipService;
|
||||||
|
@Resource
|
||||||
private WechatConfigService wechatConfigService;
|
private WechatConfigService wechatConfigService;
|
||||||
|
@Resource
|
||||||
|
private ThinkUsersVipService thinkUsersVipService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ThinkRechargeLog> pageRel(ThinkRechargeLogParam param) {
|
public PageResult<ThinkRechargeLog> pageRel(ThinkRechargeLogParam param) {
|
||||||
|
if (param.getSid() != null) {
|
||||||
|
List<ThinkVip> thinkVipList = thinkVipService.listByReportSid(param.getSid());
|
||||||
|
if (thinkVipList.isEmpty()) {
|
||||||
|
List<ThinkRechargeLog> empty = new ArrayList<>();
|
||||||
|
return new PageResult<>(empty, 0L);
|
||||||
|
}
|
||||||
|
param.setSid(null);
|
||||||
|
List<ThinkUsersVip> thinkUsersVipList = thinkUsersVipService.listByVipIds(thinkVipList.stream().map(ThinkVip::getId).toList());
|
||||||
|
if (!thinkUsersVipList.isEmpty()) {
|
||||||
|
param.setVipList(thinkUsersVipList.stream().map(ThinkUsersVip::getId).toList());
|
||||||
|
}else {
|
||||||
|
List<ThinkRechargeLog> empty = new ArrayList<>();
|
||||||
|
return new PageResult<>(empty, 0L);
|
||||||
|
}
|
||||||
|
}
|
||||||
PageParam<ThinkRechargeLog, ThinkRechargeLogParam> page = new PageParam<>(param);
|
PageParam<ThinkRechargeLog, ThinkRechargeLogParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
List<ThinkRechargeLog> list = baseMapper.selectPageRel(page, param);
|
List<ThinkRechargeLog> list = baseMapper.selectPageRel(page, param);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.think.entity.ThinkUsersVip;
|
|||||||
import com.gxwebsoft.think.param.ThinkUsersVipParam;
|
import com.gxwebsoft.think.param.ThinkUsersVipParam;
|
||||||
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.ThinkVipService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
@@ -29,9 +30,12 @@ import java.util.stream.Collectors;
|
|||||||
public class ThinkUsersVipServiceImpl extends ServiceImpl<ThinkUsersVipMapper, ThinkUsersVip> implements ThinkUsersVipService {
|
public class ThinkUsersVipServiceImpl extends ServiceImpl<ThinkUsersVipMapper, ThinkUsersVip> implements ThinkUsersVipService {
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkSiteService thinkSiteService;
|
private ThinkSiteService thinkSiteService;
|
||||||
|
@Resource
|
||||||
|
private ThinkVipService thinkVipService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ThinkUsersVip> pageRel(ThinkUsersVipParam param) {
|
public PageResult<ThinkUsersVip> pageRel(ThinkUsersVipParam param) {
|
||||||
|
|
||||||
PageParam<ThinkUsersVip, ThinkUsersVipParam> page = new PageParam<>(param);
|
PageParam<ThinkUsersVip, ThinkUsersVipParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
List<ThinkUsersVip> list = baseMapper.selectPageRel(page, param);
|
List<ThinkUsersVip> list = baseMapper.selectPageRel(page, param);
|
||||||
@@ -62,6 +66,14 @@ public class ThinkUsersVipServiceImpl extends ServiceImpl<ThinkUsersVipMapper, T
|
|||||||
return page.sortRecords(list);
|
return page.sortRecords(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkUsersVip> listByVipIds(List<Integer> vipIds) {
|
||||||
|
return list(
|
||||||
|
new LambdaQueryWrapper<ThinkUsersVip>()
|
||||||
|
.in(ThinkUsersVip::getVid, vipIds)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ThinkUsersVip getByIdRel(Integer id) {
|
public ThinkUsersVip getByIdRel(Integer id) {
|
||||||
ThinkUsersVipParam param = new ThinkUsersVipParam();
|
ThinkUsersVipParam param = new ThinkUsersVipParam();
|
||||||
@@ -77,15 +89,14 @@ public class ThinkUsersVipServiceImpl extends ServiceImpl<ThinkUsersVipMapper, T
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ThinkUsersVip getByVidAndUid(Integer vid, Integer uid) {
|
public List<ThinkUsersVip> getByVidAndUid(Integer vid, Integer uid) {
|
||||||
return getOne(
|
return list(
|
||||||
new LambdaQueryWrapper<ThinkUsersVip>()
|
new LambdaQueryWrapper<ThinkUsersVip>()
|
||||||
.eq(ThinkUsersVip::getVid, vid)
|
.eq(ThinkUsersVip::getVid, vid)
|
||||||
.eq(ThinkUsersVip::getUid, uid)
|
.eq(ThinkUsersVip::getUid, uid)
|
||||||
.eq(ThinkUsersVip::getStatus, 1)
|
.eq(ThinkUsersVip::getStatus, 1)
|
||||||
.ne(ThinkUsersVip::getPayTime, 0)
|
.ne(ThinkUsersVip::getPayTime, 0)
|
||||||
.orderByDesc(ThinkUsersVip::getExpireTime)
|
.orderByDesc(ThinkUsersVip::getExpireTime)
|
||||||
.last("limit 1")
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,19 +3,20 @@ package com.gxwebsoft.think.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
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.entity.*;
|
||||||
import com.gxwebsoft.think.mapper.ThinkVipCardsBillsMapper;
|
import com.gxwebsoft.think.mapper.ThinkVipCardsBillsMapper;
|
||||||
import com.gxwebsoft.think.service.ThinkCardService;
|
import com.gxwebsoft.think.service.*;
|
||||||
import com.gxwebsoft.think.service.ThinkUsersService;
|
|
||||||
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.think.param.ThinkVipCardsBillsParam;
|
||||||
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 javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vip卡每日账单Service实现
|
* Vip卡每日账单Service实现
|
||||||
@@ -31,19 +32,29 @@ public class ThinkVipCardsBillsServiceImpl extends ServiceImpl<ThinkVipCardsBill
|
|||||||
private ThinkUsersService thinkUsersService;
|
private ThinkUsersService thinkUsersService;
|
||||||
@Resource
|
@Resource
|
||||||
private ThinkCardService thinkCardService;
|
private ThinkCardService thinkCardService;
|
||||||
|
@Resource
|
||||||
|
private ThinkOrderService thinkOrderService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ThinkVipCardsBills> pageRel(ThinkVipCardsBillsParam param) {
|
public PageResult<ThinkVipCardsBills> pageRel(ThinkVipCardsBillsParam param) {
|
||||||
PageParam<ThinkVipCardsBills, ThinkVipCardsBillsParam> page = new PageParam<>(param);
|
PageParam<ThinkVipCardsBills, ThinkVipCardsBillsParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
List<ThinkVipCardsBills> list = baseMapper.selectPageRel(page, param);
|
List<ThinkVipCardsBills> list = baseMapper.selectPageRel(page, param);
|
||||||
|
List<ThinkOrder> thinkOrderList = new ArrayList<>();
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
Set<Integer> oidList = new HashSet<>();
|
||||||
|
oidList = list.stream().map(ThinkVipCardsBills::getOid).collect(Collectors.toSet());
|
||||||
|
thinkOrderList = thinkOrderService.listByIds(oidList);
|
||||||
|
}
|
||||||
for (ThinkVipCardsBills thinkVipCardsBills : list) {
|
for (ThinkVipCardsBills thinkVipCardsBills : list) {
|
||||||
|
ThinkOrder thinkOrder = thinkOrderList.stream().filter(d -> d.getId().equals(thinkVipCardsBills.getOid())).findFirst().orElse(null);
|
||||||
if (thinkVipCardsBills.getVid() != null)
|
if (thinkVipCardsBills.getVid() != null)
|
||||||
thinkVipCardsBills.setVip(thinkUsersVipService.getById(thinkVipCardsBills.getVid()));
|
thinkVipCardsBills.setVip(thinkUsersVipService.getById(thinkVipCardsBills.getVid()));
|
||||||
if (thinkVipCardsBills.getCid() != null)
|
if (thinkVipCardsBills.getCid() != null)
|
||||||
thinkVipCardsBills.setCard(thinkCardService.getById(thinkVipCardsBills.getCid()));
|
thinkVipCardsBills.setCard(thinkCardService.getById(thinkVipCardsBills.getCid()));
|
||||||
if (thinkVipCardsBills.getUid() != null && !thinkVipCardsBills.getUid().equals(0))
|
if (thinkVipCardsBills.getUid() != null && !thinkVipCardsBills.getUid().equals(0))
|
||||||
thinkVipCardsBills.setUser(thinkUsersService.getById(thinkVipCardsBills.getUid()));
|
thinkVipCardsBills.setUser(thinkUsersService.getById(thinkVipCardsBills.getUid()));
|
||||||
|
thinkVipCardsBills.setThinkOrder(thinkOrder);
|
||||||
}
|
}
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
}
|
}
|
||||||
@@ -51,9 +62,42 @@ public class ThinkVipCardsBillsServiceImpl extends ServiceImpl<ThinkVipCardsBill
|
|||||||
@Override
|
@Override
|
||||||
public List<ThinkVipCardsBills> listRel(ThinkVipCardsBillsParam param) {
|
public List<ThinkVipCardsBills> listRel(ThinkVipCardsBillsParam param) {
|
||||||
List<ThinkVipCardsBills> list = baseMapper.selectListRel(param);
|
List<ThinkVipCardsBills> list = baseMapper.selectListRel(param);
|
||||||
|
List<ThinkOrder> thinkOrderList = new ArrayList<>();
|
||||||
|
List<ThinkUsers> thinkUsersList = new ArrayList<>();
|
||||||
|
List<ThinkUsersVip> thinkVipList = new ArrayList<>();
|
||||||
|
List<ThinkCard> thinkCardList = new ArrayList<>();
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
Set<Integer> oidList = list.stream().map(ThinkVipCardsBills::getOid).collect(Collectors.toSet());
|
||||||
|
thinkOrderList = thinkOrderService.listByIds(oidList);
|
||||||
|
|
||||||
|
Set<Integer> uidList = list.stream().map(ThinkVipCardsBills::getUid).collect(Collectors.toSet());
|
||||||
|
thinkUsersList = thinkUsersService.listByIds(uidList);
|
||||||
|
|
||||||
|
Set<Integer> vidList = list.stream().map(ThinkVipCardsBills::getVid).collect(Collectors.toSet());
|
||||||
|
thinkVipList = thinkUsersVipService.listByIds(vidList);
|
||||||
|
|
||||||
|
Set<Integer> cidList = list.stream().map(ThinkVipCardsBills::getCid).collect(Collectors.toSet());
|
||||||
|
thinkCardList = thinkCardService.listByIds(cidList);
|
||||||
|
}
|
||||||
// 排序
|
// 排序
|
||||||
PageParam<ThinkVipCardsBills, ThinkVipCardsBillsParam> page = new PageParam<>();
|
PageParam<ThinkVipCardsBills, ThinkVipCardsBillsParam> page = new PageParam<>();
|
||||||
page.setDefaultOrder("create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
|
for (ThinkVipCardsBills thinkVipCardsBills : list) {
|
||||||
|
ThinkOrder thinkOrder = thinkOrderList.stream().filter(d -> d.getId().equals(thinkVipCardsBills.getOid())).findFirst().orElse(null);
|
||||||
|
if (thinkVipCardsBills.getVid() != null) {
|
||||||
|
ThinkUsersVip thinkUsersVip = thinkVipList.stream().filter(d -> d.getId().equals(thinkVipCardsBills.getVid())).findFirst().orElse(null);
|
||||||
|
thinkVipCardsBills.setVip(thinkUsersVip);
|
||||||
|
}
|
||||||
|
if (thinkVipCardsBills.getCid() != null) {
|
||||||
|
ThinkCard thinkCard = thinkCardList.stream().filter(d -> d.getId().equals(thinkVipCardsBills.getCid())).findFirst().orElse(null);
|
||||||
|
thinkVipCardsBills.setCard(thinkCard);
|
||||||
|
}
|
||||||
|
if (thinkVipCardsBills.getUid() != null && !thinkVipCardsBills.getUid().equals(0)) {
|
||||||
|
ThinkUsers thinkUsers = thinkUsersList.stream().filter(d -> d.getId().equals(thinkVipCardsBills.getUid())).findFirst().orElse(null);
|
||||||
|
thinkVipCardsBills.setUser(thinkUsers);
|
||||||
|
}
|
||||||
|
thinkVipCardsBills.setThinkOrder(thinkOrder);
|
||||||
|
}
|
||||||
return page.sortRecords(list);
|
return page.sortRecords(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ 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.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.entity.ThinkCard;
|
|
||||||
import com.gxwebsoft.think.entity.ThinkSite;
|
import com.gxwebsoft.think.entity.ThinkSite;
|
||||||
import com.gxwebsoft.think.entity.ThinkUsersVip;
|
import com.gxwebsoft.think.entity.ThinkUsersVip;
|
||||||
import com.gxwebsoft.think.entity.ThinkVip;
|
import com.gxwebsoft.think.entity.ThinkVip;
|
||||||
@@ -13,7 +12,6 @@ import com.gxwebsoft.think.param.ThinkVipParam;
|
|||||||
import com.gxwebsoft.think.service.ThinkSiteService;
|
import com.gxwebsoft.think.service.ThinkSiteService;
|
||||||
import com.gxwebsoft.think.service.ThinkUsersVipService;
|
import com.gxwebsoft.think.service.ThinkUsersVipService;
|
||||||
import com.gxwebsoft.think.service.ThinkVipService;
|
import com.gxwebsoft.think.service.ThinkVipService;
|
||||||
import org.beetl.ext.fn.StringUtil;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
@@ -77,6 +75,22 @@ public class ThinkVipServiceImpl extends ServiceImpl<ThinkVipMapper, ThinkVip> i
|
|||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkVip> listBySid(Integer sid) {
|
||||||
|
return list(
|
||||||
|
new LambdaQueryWrapper<ThinkVip>()
|
||||||
|
.like(ThinkVip::getSid, sid)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ThinkVip> listByReportSid(Integer reportSid) {
|
||||||
|
return list(
|
||||||
|
new LambdaQueryWrapper<ThinkVip>()
|
||||||
|
.eq(ThinkVip::getReportSid, reportSid)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ThinkVip> listByGroup(ThinkVipParam param) {
|
public List<ThinkVip> listByGroup(ThinkVipParam param) {
|
||||||
LambdaQueryWrapper<ThinkVip> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ThinkVip> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
@@ -89,8 +103,9 @@ public class ThinkVipServiceImpl extends ServiceImpl<ThinkVipMapper, ThinkVip> i
|
|||||||
queryWrapper.eq(ThinkVip::getType, param.getType());
|
queryWrapper.eq(ThinkVip::getType, param.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
queryWrapper.eq(ThinkVip::getIsUse, 1)
|
queryWrapper
|
||||||
.eq(ThinkVip::getVipType, 2)
|
.eq(ThinkVip::getVipType, 2)
|
||||||
|
.eq(ThinkVip::getIsSale, 1)
|
||||||
.groupBy(ThinkVip::getSid);
|
.groupBy(ThinkVip::getSid);
|
||||||
List<ThinkVip> list = list(queryWrapper);
|
List<ThinkVip> list = list(queryWrapper);
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
@@ -98,7 +113,7 @@ public class ThinkVipServiceImpl extends ServiceImpl<ThinkVipMapper, ThinkVip> i
|
|||||||
LambdaQueryWrapper<ThinkVip> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ThinkVip> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(ThinkVip::getSid, thinkVip.getSid())
|
wrapper.eq(ThinkVip::getSid, thinkVip.getSid())
|
||||||
.eq(ThinkVip::getVipType, 2)
|
.eq(ThinkVip::getVipType, 2)
|
||||||
.eq(ThinkVip::getIsUse, 1);
|
.eq(ThinkVip::getIsSale, 1);
|
||||||
if (param.getType() != null) {
|
if (param.getType() != null) {
|
||||||
if (param.getType().equals(0)) {
|
if (param.getType().equals(0)) {
|
||||||
wrapper.in(ThinkVip::getType, 1, 3, 4);
|
wrapper.in(ThinkVip::getType, 1, 3, 4);
|
||||||
|
|||||||
@@ -21,5 +21,7 @@ socketio:
|
|||||||
# 框架配置
|
# 框架配置
|
||||||
config:
|
config:
|
||||||
# 开发环境接口
|
# 开发环境接口
|
||||||
server-url: https://gxtyzx-api2.websoft.top/api
|
# server-url: https://gxtyzx-api2.websoft.top/api
|
||||||
upload-path: /www/wwwroot/gxtyzx-api/file/
|
# upload-path: /www/wwwroot/gxtyzx-api/file/
|
||||||
|
server-url: http://127.0.0.1:9099/api
|
||||||
|
upload-path: /Users/liangxin/Project/JAVA/gxtyzx-java/file/
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ logging:
|
|||||||
file:
|
file:
|
||||||
name: websoft-modules.log
|
name: websoft-modules.log
|
||||||
level:
|
level:
|
||||||
root: DEBUG
|
root: WARN
|
||||||
com.gxwebsoft: DEBUG
|
com.gxwebsoft: ERROR
|
||||||
com.baomidou.mybatisplus: DEBUG
|
com.baomidou.mybatisplus: ERROR
|
||||||
|
|
||||||
socketio:
|
socketio:
|
||||||
host: 0.0.0.0 #IP地址
|
host: 0.0.0.0 #IP地址
|
||||||
@@ -25,7 +25,7 @@ socketio:
|
|||||||
config:
|
config:
|
||||||
# 生产环境接口
|
# 生产环境接口
|
||||||
server-url: https://gxtyzx-server.websoft.top/api
|
server-url: https://gxtyzx-server.websoft.top/api
|
||||||
upload-path: /www/wwwroot/file.ws/
|
upload-path: /www/wwwroot/gxtyzx-api/file/
|
||||||
|
|
||||||
# 阿里云OSS云存储
|
# 阿里云OSS云存储
|
||||||
endpoint: https://oss-cn-shenzhen.aliyuncs.com
|
endpoint: https://oss-cn-shenzhen.aliyuncs.com
|
||||||
|
|||||||
@@ -118,7 +118,8 @@ public class ThinkGenerator {
|
|||||||
// "think_wechat_bill",
|
// "think_wechat_bill",
|
||||||
// "think_wechat_bill_log",
|
// "think_wechat_bill_log",
|
||||||
// "think_cards_bills",
|
// "think_cards_bills",
|
||||||
"think_users_vip_buy_log",
|
// "think_ftp_check_bill",
|
||||||
|
"think_card_balance",
|
||||||
};
|
};
|
||||||
// 需要去除的表前缀
|
// 需要去除的表前缀
|
||||||
private static final String[] TABLE_PREFIX = new String[]{
|
private static final String[] TABLE_PREFIX = new String[]{
|
||||||
|
|||||||
Reference in New Issue
Block a user