250417
This commit is contained in:
@@ -80,6 +80,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
"/api/think/think-vip-cards-bills/make-bill",
|
||||
"/api/think/think-cards-bills/make-bill",
|
||||
"/api/think/think-recharge-log/refund-notify"
|
||||
// "/api/think/think-order/fixInvoiceData"
|
||||
)
|
||||
.permitAll()
|
||||
.anyRequest()
|
||||
|
||||
@@ -3,14 +3,18 @@ package com.gxwebsoft.think.controller;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.think.entity.ThinkInvoice;
|
||||
import com.gxwebsoft.think.entity.ThinkOrder;
|
||||
import com.gxwebsoft.think.entity.ThinkOrderInfo;
|
||||
import com.gxwebsoft.think.entity.ThinkSite;
|
||||
import com.gxwebsoft.think.service.ThinkInvoiceService;
|
||||
import com.gxwebsoft.think.service.ThinkOrderInfoService;
|
||||
import com.gxwebsoft.think.service.ThinkOrderService;
|
||||
import com.gxwebsoft.think.service.ThinkSiteService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -19,6 +23,7 @@ import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 定时任务
|
||||
@@ -38,6 +43,13 @@ public class SchedulingController extends BaseController {
|
||||
private ThinkSiteService thinkSiteService;
|
||||
@Resource
|
||||
private ThinkOrderInfoService thinkOrderInfoService;
|
||||
@Resource
|
||||
private ThinkInvoiceService thinkInvoiceService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private ThinkInvoiceController thinkInvoiceController;
|
||||
|
||||
@Scheduled(cron = "* * * * * *")
|
||||
public void task() {
|
||||
@@ -94,6 +106,38 @@ public class SchedulingController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
// 核销订单
|
||||
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);
|
||||
thinkOrderService.updateById(thinkOrder);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询开票
|
||||
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());
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -191,6 +191,10 @@ public class ThinkCardController extends BaseController {
|
||||
}
|
||||
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)) {
|
||||
return success("添加成功", thinkCard.getId());
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package com.gxwebsoft.think.controller;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.gxwebsoft.common.core.utils.JSONUtil;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
@@ -23,9 +27,12 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 控制器
|
||||
@@ -47,6 +54,8 @@ public class ThinkInvoiceController extends BaseController {
|
||||
private ThinkUsersVipService thinkUsersVipService;
|
||||
@Resource
|
||||
private ThinkSiteService thinkSiteService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
// private final String taxnum = "339901999999142";
|
||||
// private final String appKey = "SD56531018";
|
||||
@@ -163,25 +172,224 @@ public class ThinkInvoiceController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("发票合开")
|
||||
@PostMapping("/doInvoiceByList")
|
||||
public ApiResult<?> doInvoiceByList(@RequestBody ThinkInvoice thinkInvoice) {
|
||||
List<ThinkInvoice> thinkInvoiceList = new ArrayList<>();
|
||||
List<ThinkOrder> thinkOrderList = thinkOrderService.listByIds(thinkInvoice.getOrderIdList());
|
||||
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listByOrderIds(thinkInvoice.getOrderIdList());
|
||||
List<Integer> startTimeList = new ArrayList<>(thinkOrderInfoList.stream().map(ThinkOrderInfo::getStartTime).toList());
|
||||
// startTimeList排序
|
||||
ThinkOrder firstOrder = thinkOrderList.get(0);
|
||||
ThinkSite thinkSite = thinkSiteService.getById(firstOrder.getSid());
|
||||
String rentStartTime = thinkSite.getRentStartDate();
|
||||
String rentEndTime = thinkSite.getRentEndDate();
|
||||
if (!startTimeList.isEmpty()) {
|
||||
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);
|
||||
for (Integer orderId : thinkInvoice.getOrderIdList()) {
|
||||
ThinkOrder thinkOrder = thinkOrderList.stream().filter(o -> o.getId().equals(orderId)).findFirst().orElse(null);
|
||||
if (thinkOrder != null) {
|
||||
ThinkInvoice thinkInvoice1 = new ThinkInvoice();
|
||||
thinkInvoice1.setIncoiveNum(invoiceNum);
|
||||
thinkInvoice1.setIncoiveCode("91450100737617400R");
|
||||
thinkInvoice1.setOid(orderId);
|
||||
thinkInvoice1.setOrderNum(thinkOrder.getOrderNum());
|
||||
thinkInvoice1.setUid(thinkOrder.getUid());
|
||||
thinkInvoice1.setPrice(thinkInvoice.getPrice());
|
||||
thinkInvoice1.setName(thinkInvoice.getName());
|
||||
thinkInvoice1.setPhone(thinkInvoice.getPhone());
|
||||
thinkInvoice1.setCode(thinkInvoice.getCode());
|
||||
thinkInvoice1.setType(2);
|
||||
thinkInvoice1.setItype(1);
|
||||
thinkInvoice1.setStatus(1);
|
||||
thinkInvoice1.setInvoicetype(thinkInvoice.getInvoicetype());
|
||||
thinkInvoice1.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
|
||||
if (thinkInvoice.getEmail() == null) thinkInvoice1.setEmail("");
|
||||
else thinkInvoice1.setEmail(thinkInvoice.getEmail());
|
||||
|
||||
if (thinkInvoice.getTel() != null) thinkInvoice1.setTel(thinkInvoice.getTel());
|
||||
if (thinkInvoice.getAddress() != null) thinkInvoice1.setAddress(thinkInvoice.getAddress());
|
||||
if (thinkInvoice.getBank() != null) thinkInvoice1.setBank(thinkInvoice.getBank());
|
||||
if (thinkInvoice.getAccount() != null) thinkInvoice1.setAccount(thinkInvoice.getAccount());
|
||||
thinkInvoice1.setIsOpen(2);
|
||||
thinkInvoiceList.add(thinkInvoice1);
|
||||
}
|
||||
}
|
||||
thinkInvoiceService.saveBatch(thinkInvoiceList);
|
||||
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
||||
String method = "nuonuo.OpeMplatform.requestBillingNew";//API方法名
|
||||
String token = getInvoiceToken();
|
||||
|
||||
final NuoNuo nuoNuo = new NuoNuo();
|
||||
final NuoNuoOrder order = new NuoNuoOrder();
|
||||
order.setBuyerName(thinkInvoice.getName());
|
||||
order.setBuyerTaxNum(thinkInvoice.getCode());
|
||||
order.setBuyerPhone(thinkInvoice.getPhone());
|
||||
order.setSalerTaxNum(taxnum); // 91450100737617400R
|
||||
order.setSalerTel(sellerTel);
|
||||
order.setOrderNo(invoiceNum);
|
||||
order.setInvoiceDate(DateUtil.now());
|
||||
order.setClerk("赵裕璐");
|
||||
order.setPayee("班嘉良");
|
||||
order.setChecker("蓝蕙孚");
|
||||
order.setShowCheckerType("1");
|
||||
order.setInvoiceType("1");
|
||||
order.setInvoiceLine(thinkInvoice.getInvoicetype().equals(1) ? "pc" : "bs");
|
||||
final NuoNuoGoods goods = new NuoNuoGoods();
|
||||
goods.setGoodsName("*经营租赁*场地费");
|
||||
|
||||
goods.setGoodsCode("3040502029902");
|
||||
// 不含税单价
|
||||
final BigDecimal taxExcludedAmount = thinkInvoice.getPrice().multiply(new BigDecimal("0.95")).setScale(2, RoundingMode.HALF_UP);
|
||||
goods.setPrice(taxExcludedAmount.toString());
|
||||
goods.setNum("1");
|
||||
goods.setWithTaxFlag("0");
|
||||
goods.setDField1("无");
|
||||
goods.setDField2("无");
|
||||
goods.setDField3("无");
|
||||
goods.setDField4("无");
|
||||
goods.setDField5("无");
|
||||
goods.setTaxRate("0.05");
|
||||
goods.setFavouredPolicyFlag("09");
|
||||
final BigDecimal tax = thinkInvoice.getPrice().multiply(new BigDecimal("0.05")).setScale(2, RoundingMode.HALF_UP);
|
||||
goods.setTax(tax.toString());
|
||||
order.setInvoiceDetail(goods);
|
||||
|
||||
NuoNuoRealPropertyRentInfo nuoNuoRealPropertyRentInfo = new NuoNuoRealPropertyRentInfo();
|
||||
nuoNuoRealPropertyRentInfo.setRealPropertyAddress(thinkSite.getProvince() + thinkSite.getCity() + thinkSite.getRegion());
|
||||
nuoNuoRealPropertyRentInfo.setDetailAddress(thinkSite.getAddress());
|
||||
nuoNuoRealPropertyRentInfo.setRealPropertyCertificate(thinkSite.getRealPropertyCertificate());
|
||||
nuoNuoRealPropertyRentInfo.setRentStartDate(rentStartTime);
|
||||
nuoNuoRealPropertyRentInfo.setRentEndDate(rentEndTime);
|
||||
nuoNuoRealPropertyRentInfo.setCrossCityFlag("0");
|
||||
nuoNuoRealPropertyRentInfo.setUnit("2");
|
||||
order.setRealPropertyRentInfo(nuoNuoRealPropertyRentInfo);
|
||||
order.setSpecificFactor("6");
|
||||
order.setExtensionNumber("7426");
|
||||
nuoNuo.setOrder(order);
|
||||
|
||||
|
||||
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);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
final JSONObject jsonObject = JSONObject.parseObject(json);
|
||||
final String code = jsonObject.getString("code");
|
||||
final String result = jsonObject.getString("result");
|
||||
System.out.println("jsonObject = " + jsonObject);
|
||||
if (code.equals("E0000")) {
|
||||
final JSONObject resNo = JSONObject.parseObject(result);
|
||||
final String invoiceSerialNum = resNo.getString("invoiceSerialNum");
|
||||
for (ThinkOrder thinkOrder : thinkOrderList) {
|
||||
thinkOrder.setIsInvoice(1);
|
||||
}
|
||||
thinkOrderService.updateBatchById(thinkOrderList);
|
||||
for (ThinkInvoice thinkInvoice1 : thinkInvoiceList) {
|
||||
thinkInvoice1.setIncoiveNum(invoiceSerialNum);
|
||||
}
|
||||
thinkInvoiceService.updateBatchById(thinkInvoiceList);
|
||||
return success("发票开具成功", json);
|
||||
}
|
||||
}
|
||||
return fail("开票失败");
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("开具发票")
|
||||
@PostMapping("/doInvoice")
|
||||
public ApiResult<?> doInvoice(@RequestBody ThinkInvoice thinkInvoice) {
|
||||
// System.out.println("thinkInvoice = " + thinkInvoice);
|
||||
// final Integer oid = thinkInvoice.getOid();
|
||||
// final ThinkOrder thinkOrder = thinkOrderService.getById(thinkInvoice.getOid());
|
||||
// System.out.println("thinkOrder = " + thinkOrder);
|
||||
// final List<ThinkOrderInfo> orderInfos = thinkOrderInfoService.list(new LambdaQueryWrapper<ThinkOrderInfo>().eq(ThinkOrderInfo::getOid, thinkInvoice.getOid()));
|
||||
thinkInvoice.setStatus(1);
|
||||
thinkInvoiceService.updateById(thinkInvoice);
|
||||
if (thinkInvoice.getId() != null) thinkInvoiceService.updateById(thinkInvoice);
|
||||
else {
|
||||
if (thinkInvoice.getOrderNum() == null) return fail("非法请求");
|
||||
ThinkInvoice check = thinkInvoiceService.getByOrderNum(thinkInvoice.getOrderNum());
|
||||
if (check != null) return fail("该订单已开过发票");
|
||||
thinkInvoice.setIncoiveCode("91450100737617400R");
|
||||
thinkInvoice.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
if (thinkInvoice.getCode() == null) thinkInvoice.setCode("");
|
||||
if (thinkInvoice.getIncoiveNum() == null) thinkInvoice.setIncoiveNum("");
|
||||
if (thinkInvoice.getEmail() == null) thinkInvoice.setEmail("");
|
||||
if (thinkInvoice.getIsOpen() == null) thinkInvoice.setIsOpen(2);
|
||||
thinkInvoiceService.save(thinkInvoice);
|
||||
}
|
||||
String json = newInvoice(thinkInvoice);
|
||||
if (!json.isEmpty()) return success("开票成功", json);
|
||||
return fail("发票开具失败");
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询发票")
|
||||
@GetMapping("/showInvoice/{id}")
|
||||
public ApiResult<?> showInvoice(@PathVariable("id") Integer id) {
|
||||
return success("查询成功", getRes(id));
|
||||
}
|
||||
|
||||
private void retry(Integer id) {
|
||||
ThinkInvoice thinkInvoice = thinkInvoiceService.getById(id);
|
||||
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
||||
String method = "nuonuo.OpeMplatform.reInvoice";//API方法名
|
||||
String token = getInvoiceToken();
|
||||
String senid = UUID.randomUUID().toString();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("fpqqlsh", thinkInvoice.getIncoiveNum());
|
||||
String content = JSONUtil.toJSONString(map);
|
||||
String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
|
||||
System.out.println("invoice retry res:" + result);
|
||||
}
|
||||
|
||||
public String getRes(Integer id) {
|
||||
final ThinkInvoice thinkInvoice = thinkInvoiceService.getById(id);
|
||||
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
||||
String method = "nuonuo.OpeMplatform.queryInvoiceResult";//API方法名
|
||||
String token = getInvoiceToken();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
if (!thinkInvoice.getIncoiveNum().isEmpty()) map.put("serialNos", thinkInvoice.getIncoiveNum());
|
||||
else map.put("orderNos", thinkInvoice.getOrderNum());
|
||||
String content = JSONUtil.toJSONString(map);//API私有请求参数
|
||||
String senid = UUID.randomUUID().toString(); // 唯一标识,由企业自己生成32位随机码
|
||||
|
||||
String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
|
||||
thinkInvoiceService.update(
|
||||
new LambdaUpdateWrapper<ThinkInvoice>()
|
||||
.eq(ThinkInvoice::getIncoiveNum, thinkInvoice.getIncoiveNum())
|
||||
.set(ThinkInvoice::getResJson, result)
|
||||
);
|
||||
final JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
final String code = jsonObject.getString("code");
|
||||
final String body = jsonObject.getString("result");
|
||||
if (code.equals("E0000")) {
|
||||
JSONArray jsonArray = JSONArray.parseArray(body);
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
String status = jsonArray.getJSONObject(i).getString("status");
|
||||
if (status.equals("2")) {
|
||||
thinkInvoiceService.update(
|
||||
new LambdaUpdateWrapper<ThinkInvoice>()
|
||||
.eq(ThinkInvoice::getIncoiveNum, thinkInvoice.getIncoiveNum())
|
||||
.set(ThinkInvoice::getIsOpen, 1)
|
||||
);
|
||||
} else if (status.equals("22")) {
|
||||
retry(id);
|
||||
}
|
||||
}
|
||||
return body;
|
||||
}else if(code.equals("E9500")) {
|
||||
newInvoice(thinkInvoice);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private String newInvoice(ThinkInvoice thinkInvoice) {
|
||||
// 开票接口
|
||||
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
||||
// String appKey = "92969434";
|
||||
// String appSecret = "D51901886E454FEF";
|
||||
String method = "nuonuo.OpeMplatform.requestBillingNew";//API方法名
|
||||
String tokenJsonStr = NNOpenSDK.getIntance().getMerchantToken(appKey, appSecret); //访问令牌
|
||||
JSONObject tokenJson = JSONObject.parseObject(tokenJsonStr);
|
||||
String token = tokenJson.getString("access_token");
|
||||
String token = getInvoiceToken();
|
||||
|
||||
final NuoNuo nuoNuo = new NuoNuo();
|
||||
final NuoNuoOrder order = new NuoNuoOrder();
|
||||
order.setBuyerName(thinkInvoice.getName());
|
||||
@@ -194,66 +402,61 @@ public class ThinkInvoiceController extends BaseController {
|
||||
order.setClerk("赵裕璐");
|
||||
order.setPayee("班嘉良");
|
||||
order.setChecker("蓝蕙孚");
|
||||
order.setInvoiceType(String.valueOf(thinkInvoice.getInvoicetype()));
|
||||
order.setRemark("不动产地址:广西壮族自治区南宁市良庆区五象大道西段669号广西体育中心综合馆;(市)标志:否;");
|
||||
order.setShowCheckerType("1");
|
||||
order.setInvoiceType("1");
|
||||
order.setInvoiceLine(thinkInvoice.getInvoicetype().equals(1) ? "pc" : "bs");
|
||||
final NuoNuoGoods goods = new NuoNuoGoods();
|
||||
if (thinkInvoice.getItype().equals(1)) {
|
||||
final ThinkOrder thinkOrder = thinkOrderService.getById(thinkInvoice.getOid());
|
||||
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkInvoice.getOid());
|
||||
goods.setGoodsName(thinkOrderInfoList.get(0).getSiteName() + "-" + thinkOrderInfoList.get(0).getFieldName()
|
||||
+ "(" + thinkOrder.getDateTime() + ")");
|
||||
} else if (thinkInvoice.getItype().equals(2)) {
|
||||
goods.setGoodsName("广西体育中心VIP卡");
|
||||
} else if (thinkInvoice.getItype().equals(3)) {
|
||||
goods.setGoodsName("广西体育中心IC卡");
|
||||
goods.setGoodsName("*经营租赁*场地费");
|
||||
} else {
|
||||
goods.setGoodsName("广西体育中心场馆");
|
||||
goods.setGoodsName("*预付卡销售*预付卡");
|
||||
}
|
||||
|
||||
// goods.setGoodsCode("3040502029902000000");
|
||||
goods.setWithTaxFlag("0");
|
||||
// if (!CollectionUtils.isEmpty(orderInfos)) {
|
||||
// final ThinkOrderInfo thinkOrderInfo = orderInfos.get(0);
|
||||
// if (thinkOrderInfo != null) {
|
||||
// goods.setDField1(thinkOrderInfo.getDateTime());
|
||||
// }
|
||||
// }
|
||||
goods.setWithTaxFlag("1");
|
||||
goods.setDField1("无");
|
||||
goods.setDField2("无");
|
||||
goods.setDField3("无");
|
||||
goods.setDField4("无");
|
||||
goods.setDField5("无");
|
||||
goods.setTaxRate(new BigDecimal("0.05").toString());
|
||||
final BigDecimal taxExcludedAmount = thinkInvoice.getPrice().divide(new BigDecimal("1.05"), 4, RoundingMode.HALF_UP);
|
||||
final BigDecimal tax = taxExcludedAmount.multiply(new BigDecimal("0.05")).setScale(4, RoundingMode.HALF_EVEN);
|
||||
goods.setTax(tax.toString());
|
||||
goods.setTaxExcludedAmount(taxExcludedAmount.toString());
|
||||
goods.setTaxIncludedAmount(thinkInvoice.getPrice().toString());
|
||||
order.setInvoiceDetail(goods);
|
||||
// System.out.println("税额 = " + tax);
|
||||
// System.out.println("不含税金额 = " + taxExcludedAmount);
|
||||
// System.out.println("含税金额 = " + thinkOrder.getTotalPrice());
|
||||
BigDecimal taxRate = BigDecimal.valueOf(0.05);
|
||||
|
||||
|
||||
if (thinkInvoice.getItype().equals(1)) {
|
||||
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkInvoice.getOid());
|
||||
String startTime = DateUtil.format(DateUtil.date((thinkOrderInfoList.get(0).getStartTime() * 1000L)), "yyyy-MM-dd");
|
||||
goods.setTaxRate(taxRate.toString());
|
||||
final BigDecimal tax = thinkInvoice.getPrice().multiply(taxRate).setScale(2, RoundingMode.HALF_UP);
|
||||
goods.setFavouredPolicyFlag("09");
|
||||
final ThinkOrder thinkOrder = thinkOrderService.getById(thinkInvoice.getOid());
|
||||
NuoNuoRealPropertyRentInfo nuoNuoRealPropertyRentInfo = new NuoNuoRealPropertyRentInfo();
|
||||
ThinkSite thinkSite = thinkSiteService.getById(thinkOrder.getSid());
|
||||
goods.setPrice(thinkInvoice.getPrice()
|
||||
.divide(BigDecimal.valueOf(1.05), 2, RoundingMode.HALF_UP)
|
||||
.divide(thinkSite.getSize(), 2, RoundingMode.HALF_UP)
|
||||
.setScale(2, RoundingMode.HALF_UP).toString());
|
||||
goods.setTax(tax.toString());
|
||||
goods.setGoodsCode("3040502029902");
|
||||
NuoNuoRealPropertyRentInfo nuoNuoRealPropertyRentInfo = new NuoNuoRealPropertyRentInfo();
|
||||
goods.setNum(thinkSite.getSize().toString());
|
||||
nuoNuoRealPropertyRentInfo.setRealPropertyAddress(thinkSite.getProvince() + thinkSite.getCity() + thinkSite.getRegion());
|
||||
nuoNuoRealPropertyRentInfo.setDetailAddress(thinkSite.getAddress());
|
||||
nuoNuoRealPropertyRentInfo.setRealPropertyCertificate(thinkSite.getRealPropertyCertificate());
|
||||
nuoNuoRealPropertyRentInfo.setRentStartDate(thinkSite.getRentStartDate());
|
||||
nuoNuoRealPropertyRentInfo.setRentEndDate(thinkSite.getRentEndDate());
|
||||
nuoNuoRealPropertyRentInfo.setCrossCityFlag("0");
|
||||
order.setRealPropertyRentInfo(nuoNuoRealPropertyRentInfo);
|
||||
} else if (thinkInvoice.getItype().equals(4)) {
|
||||
NuoNuoRealPropertyRentInfo nuoNuoRealPropertyRentInfo = new NuoNuoRealPropertyRentInfo();
|
||||
nuoNuoRealPropertyRentInfo.setRealPropertyAddress("广西壮族自治区南宁市良庆区");
|
||||
nuoNuoRealPropertyRentInfo.setDetailAddress("五象大道西段669号");
|
||||
// nuoNuoRealPropertyRentInfo.setRealPropertyCertificate(thinkSite.getRealPropertyCertificate());
|
||||
nuoNuoRealPropertyRentInfo.setRentStartDate(thinkInvoice.getRentStartDate());
|
||||
nuoNuoRealPropertyRentInfo.setRentEndDate(thinkInvoice.getRentEndDate());
|
||||
nuoNuoRealPropertyRentInfo.setRealPropertyCertificate("无");
|
||||
nuoNuoRealPropertyRentInfo.setRentStartDate(startTime);
|
||||
nuoNuoRealPropertyRentInfo.setRentEndDate(startTime);
|
||||
nuoNuoRealPropertyRentInfo.setCrossCityFlag("0");
|
||||
nuoNuoRealPropertyRentInfo.setUnit("2");
|
||||
order.setRealPropertyRentInfo(nuoNuoRealPropertyRentInfo);
|
||||
order.setSpecificFactor("6");
|
||||
} else {
|
||||
goods.setTaxRate("0.00");
|
||||
goods.setZeroRateFlag("2");
|
||||
goods.setFavouredPolicyFlag("04");
|
||||
goods.setNum("1");
|
||||
goods.setPrice(thinkInvoice.getPrice().setScale(2, RoundingMode.HALF_UP).toString());
|
||||
goods.setTax("0.00");
|
||||
goods.setGoodsCode("6010000000000000000");
|
||||
}
|
||||
order.setInvoiceDetail(goods);
|
||||
order.setExtensionNumber("7426");
|
||||
nuoNuo.setOrder(order);
|
||||
|
||||
|
||||
@@ -281,35 +484,24 @@ public class ThinkInvoiceController extends BaseController {
|
||||
}
|
||||
System.out.println("invoiceSerialNum = " + invoiceSerialNum);
|
||||
thinkInvoice.setIncoiveNum(invoiceSerialNum);
|
||||
thinkInvoice.setIsOpen(1);
|
||||
getRes(thinkInvoice.getId());
|
||||
// thinkInvoice.setIsOpen(1);
|
||||
thinkInvoiceService.updateById(thinkInvoice);
|
||||
return success("发票开具成功", json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
return fail("发票开具失败");
|
||||
return "";
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询发票")
|
||||
@GetMapping("/showInvoice/{id}")
|
||||
public ApiResult<?> showInvoice(@PathVariable("id") Integer id) {
|
||||
final ThinkInvoice thinkInvoice = thinkInvoiceService.getById(id);
|
||||
NNOpenSDK sdk = NNOpenSDK.getIntance();
|
||||
String method = "nuonuo.OpeMplatform.queryInvoiceResult";//API方法名
|
||||
String token = NNOpenSDK.getIntance().getMerchantToken(appKey, appSecret); //访问令牌
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("serialNos", thinkInvoice.getIncoiveNum());
|
||||
String content = JSONUtil.toJSONString(map);//API私有请求参数
|
||||
String senid = UUID.randomUUID().toString(); // 唯一标识,由企业自己生成32位随机码
|
||||
|
||||
String result = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, token, taxnum, method, content);
|
||||
final JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
final String code = jsonObject.getString("code");
|
||||
final String body = jsonObject.getString("result");
|
||||
if (code.equals("E0000")) {
|
||||
return success("查询成功", body);
|
||||
private String getInvoiceToken() {
|
||||
String tokenInRedis = redisUtil.get("invoiceToken");
|
||||
if (StrUtil.isNotBlank(tokenInRedis)) {
|
||||
return tokenInRedis;
|
||||
}
|
||||
return success("查询失败", result);
|
||||
String tokenJsonStr = NNOpenSDK.getIntance().getMerchantToken(appKey, appSecret); //访问令牌
|
||||
JSONObject tokenJson = JSONObject.parseObject(tokenJsonStr);
|
||||
String token = tokenJson.getString("access_token");
|
||||
redisUtil.set("invoiceToken", token);
|
||||
return token;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.gxwebsoft.think.controller;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.date.*;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
@@ -108,6 +105,8 @@ public class ThinkOrderController extends BaseController {
|
||||
private ThinkRechargeLogService thinkRechargeLogService;
|
||||
@Resource
|
||||
private ThinkVipService thinkVipService;
|
||||
@Resource
|
||||
private ThinkOrderRefundLogService thinkOrderRefundLogService;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@@ -121,6 +120,55 @@ public class ThinkOrderController extends BaseController {
|
||||
|
||||
// private NotificationConfig config;
|
||||
|
||||
|
||||
@Deprecated
|
||||
@ApiOperation("修复数据")
|
||||
@GetMapping("/fixInvoiceData")
|
||||
public ApiResult<?> fixInvoiceData() {
|
||||
List<ThinkOrder> thinkOrderList = thinkOrderService.list(
|
||||
new LambdaQueryWrapper<ThinkOrder>()
|
||||
.eq(ThinkOrder::getPayStatus, 1)
|
||||
.eq(ThinkOrder::getOrderStatus, 1)
|
||||
.eq(ThinkOrder::getIsInvoice, 3)
|
||||
.gt(ThinkOrder::getCreateTime, 1742400000)
|
||||
.ne(ThinkOrder::getUid, 0)
|
||||
);
|
||||
List<ThinkOrder> updateList = new ArrayList<>();
|
||||
for (ThinkOrder thinkOrder : thinkOrderList) {
|
||||
if (thinkOrder.getCid() != 0) {
|
||||
ThinkCard thinkCard = thinkCardService.getById(thinkOrder.getCid());
|
||||
if (thinkCard != null && thinkCard.getIsInvoice() == 2) {
|
||||
thinkOrder.setIsInvoice(2);
|
||||
updateList.add(thinkOrder);
|
||||
}
|
||||
} else {
|
||||
if (thinkOrder.getCode() != null) {
|
||||
ThinkCard thinkCard = thinkCardService.getByCode(thinkOrder.getCode());
|
||||
if (thinkCard != null && thinkCard.getIsInvoice() == 2) {
|
||||
thinkOrder.setIsInvoice(2);
|
||||
updateList.add(thinkOrder);
|
||||
}
|
||||
} else {
|
||||
if (thinkOrder.getVid() != 0) {
|
||||
ThinkUsersVip thinkUsersVip = thinkUsersVipService.getById(thinkOrder.getVid());
|
||||
if (thinkUsersVip != null && thinkUsersVip.getIsInvoice() == 2) {
|
||||
thinkOrder.setIsInvoice(2);
|
||||
updateList.add(thinkOrder);
|
||||
}
|
||||
} else {
|
||||
if (thinkOrder.getWechatOrder() != null) {
|
||||
thinkOrder.setIsInvoice(2);
|
||||
updateList.add(thinkOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!updateList.isEmpty()) thinkOrderService.updateBatchById(updateList);
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("微信通知")
|
||||
@PostMapping("/notify")
|
||||
public String notify(@RequestBody String body, @RequestHeader Map<String, Object> header) {
|
||||
@@ -430,7 +478,7 @@ public class ThinkOrderController extends BaseController {
|
||||
if (thinkOrder.getThinkOrderInfos().isEmpty()) return fail("非法请求.code:5");
|
||||
Date date = DateUtil.parse(thinkOrder.getThinkOrderInfos().get(0).getTimePeriod(), "yyyy-MM-dd");
|
||||
long secDiff = DateUtil.between(DateUtil.beginOfDay(DateUtil.date()), date, DateUnit.SECOND);
|
||||
if (secDiff >= 604800) return fail("只能预定7天内的场地");
|
||||
if (secDiff >= 604800 && !thinkOrder.getSid().equals(28)) return fail("只能预定7天内的场地");
|
||||
// 用户限制订单,单个用户(每个id)每个时段只能订两个场地,每次预订间隔要3分钟
|
||||
// 今天的订单
|
||||
ThinkOrder todayOrder = thinkOrderService.getTodayOrder(user.getUid());
|
||||
@@ -439,6 +487,14 @@ public class ThinkOrderController extends BaseController {
|
||||
return fail("每次预订需间隔3分钟");
|
||||
}
|
||||
}
|
||||
// 周末场地需要周四17点后才能预定
|
||||
if (DateUtil.dayOfWeek(date) == 6 || DateUtil.dayOfWeek(date) == 7 || DateUtil.dayOfWeek(date) == 1) {
|
||||
if (DateUtil.dayOfWeek(new Date()) == 5 && DateUtil.hour(new Date(), true) < 17)
|
||||
return fail("周末场地需要周四17点后才能预定");
|
||||
if (DateUtil.dayOfWeek(new Date()) == 2 || DateUtil.dayOfWeek(new Date()) == 3 || DateUtil.dayOfWeek(new Date()) == 4) {
|
||||
return fail("周四17点后才能预定");
|
||||
}
|
||||
}
|
||||
Map<Integer, Integer> siteTimeNumMap = new HashMap<>();
|
||||
siteTimeNumMap.put(thinkOrder.getThinkOrderInfos().get(0).getStartTime(), 1);
|
||||
if (thinkOrder.getThinkOrderInfos().size() > 1) {
|
||||
@@ -448,26 +504,53 @@ public class ThinkOrderController extends BaseController {
|
||||
siteTimeNumMap.put(thinkOrder.getThinkOrderInfos().get(0).getStartTime(), 2);
|
||||
}
|
||||
}
|
||||
// 用户今天定的这个场的订单
|
||||
// 用户定的这个场的订单
|
||||
List<Integer> startTimeList = thinkOrder.getThinkOrderInfos().stream().map(ThinkOrderInfo::getStartTime).toList();
|
||||
Map<Integer, Integer> bookingNumMap = new HashMap<>();
|
||||
List<ThinkOrder> userTodayOrderListInSite = thinkOrderService.getTodayOrderInSite(user.getUid(), thinkOrder.getSid());
|
||||
List<ThinkOrderInfo> userTodayOrderInfoListInSite = new ArrayList<>();
|
||||
if (!userTodayOrderListInSite.isEmpty()) {
|
||||
userTodayOrderInfoListInSite = thinkOrderInfoService.listByOrderIds(userTodayOrderListInSite.stream().map(ThinkOrder::getId).toList());
|
||||
for (ThinkOrderInfo info : userTodayOrderInfoListInSite) {
|
||||
if (bookingNumMap.containsKey(info.getStartTime())) {
|
||||
bookingNumMap.put(info.getStartTime(), bookingNumMap.get(info.getStartTime()) + 1);
|
||||
} else {
|
||||
bookingNumMap.put(info.getStartTime(), 1);
|
||||
List<ThinkOrderInfo> orderInfoListInSite = thinkOrderInfoService.orderInfoListByStartTimeList(
|
||||
thinkOrder.getSid(), startTimeList);
|
||||
if (!orderInfoListInSite.isEmpty()) {
|
||||
Set<Integer> orderIdSet = orderInfoListInSite.stream().map(ThinkOrderInfo::getOid).collect(Collectors.toSet());
|
||||
List<ThinkOrder> orderList = thinkOrderService.listByIds(orderIdSet);
|
||||
List<ThinkOrder> userOrderList = orderList.stream().filter(o -> o.getUid().equals(user.getUid())).toList();
|
||||
if (!userOrderList.isEmpty()) {
|
||||
List<ThinkOrderInfo> userTodayOrderInfoListInSite = new ArrayList<>();
|
||||
userTodayOrderInfoListInSite = thinkOrderInfoService.listByOrderIds(userOrderList.stream().map(ThinkOrder::getId).toList());
|
||||
for (ThinkOrderInfo info : userTodayOrderInfoListInSite) {
|
||||
if (bookingNumMap.containsKey(info.getStartTime())) {
|
||||
bookingNumMap.put(info.getStartTime(), bookingNumMap.get(info.getStartTime()) + 1);
|
||||
} else {
|
||||
bookingNumMap.put(info.getStartTime(), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 250327规则修改
|
||||
// 周1~周4晚上的18-22时间段、周五~周日全天进行限制。 (限制规则:每个账号订场规则调整成这样,每个时段只能定2个场地)
|
||||
int day = DateUtil.dayOfWeek(date);
|
||||
if ((day == 1 || day == 6 || day == 7)) {
|
||||
for (ThinkOrderInfo info : thinkOrder.getThinkOrderInfos()) {
|
||||
if (bookingNumMap.get(info.getStartTime()) != null) {
|
||||
if (bookingNumMap.get(info.getStartTime()) + siteTimeNumMap.get(info.getStartTime()) > 2) {
|
||||
return fail("每个时段只能预定两个场地");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (ThinkOrderInfo info : thinkOrder.getThinkOrderInfos()) {
|
||||
String hour = DateUtil.format(DateUtil.date((info.getStartTime() * 1000L)), "HH");
|
||||
int hourInt = Integer.parseInt(hour);
|
||||
if (hourInt >= 18) {
|
||||
if (bookingNumMap.get(info.getStartTime()) != null) {
|
||||
if (bookingNumMap.get(info.getStartTime()) + siteTimeNumMap.get(info.getStartTime()) > 2) {
|
||||
return fail("每个时段只能预定两个场地");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ThinkOrderInfo info : thinkOrder.getThinkOrderInfos()) {
|
||||
if (bookingNumMap.get(info.getStartTime()) != null) {
|
||||
if (bookingNumMap.get(info.getStartTime()) + siteTimeNumMap.get(info.getStartTime()) > 2) {
|
||||
return fail("每个时段只能预定两个场地");
|
||||
}
|
||||
}
|
||||
|
||||
ThinkOrderInfo checkOrder = thinkOrderInfoService.checkOrder(info);
|
||||
if (checkOrder != null) {
|
||||
ThinkOrder thinkOrderCheck = thinkOrderService.getById(checkOrder.getOid());
|
||||
@@ -479,6 +562,7 @@ public class ThinkOrderController extends BaseController {
|
||||
|
||||
if (thinkOrder.getPayType().equals(2) && thinkOrder.getVid() == null) return fail("请选择会员卡");
|
||||
if (thinkOrder.getPayType().equals(5) && thinkOrder.getCode() == null) return fail("请选择IC卡");
|
||||
thinkOrder.setCanInvoice(true);
|
||||
thinkOrder.setOrderNum(IdUtil.getSnowflake().nextIdStr());
|
||||
BigDecimal totalPrice = BigDecimal.ZERO;
|
||||
// BigDecimal reducePrice = BigDecimal.ZERO;
|
||||
@@ -548,6 +632,7 @@ public class ThinkOrderController extends BaseController {
|
||||
if (thinkOrder.getVid() != null) {
|
||||
ThinkUsersVip usersVip = thinkUsersVipService.getById(thinkOrder.getVid());
|
||||
if (usersVip == null) return fail("非法请求,code:4");
|
||||
if (usersVip.getExpireTime() < timestamp) return fail("会员卡已过期");
|
||||
if (!usersVip.getUid().equals(getLoginUser().getUid())) return fail("非法请求,code:1");
|
||||
if (usersVip.getType().equals(5)) {
|
||||
if (usersVip.getRemainingMoney().compareTo(BigDecimal.ZERO) < 1) return fail("余额不足");
|
||||
@@ -561,7 +646,7 @@ public class ThinkOrderController extends BaseController {
|
||||
thinkOrder.setReducePrice(totalPrice);
|
||||
thinkOrder.setPayPrice(BigDecimal.ZERO);
|
||||
} else {
|
||||
if (usersVip.getNum() < num) return fail("次数不足");
|
||||
// if (usersVip.getNum() < num) return fail("次数不足");
|
||||
long todayTime = DateUtil.parse(DateUtil.today() + " 00:00:00").getTime() / 1000;
|
||||
if (usersVip.getUseTime().equals(todayTime)) {
|
||||
return fail("今天已使用");
|
||||
@@ -610,6 +695,7 @@ public class ThinkOrderController extends BaseController {
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!usersVip.getIsInvoice().equals(2)) thinkOrder.setCanInvoice(false);
|
||||
}
|
||||
// IC卡
|
||||
if (thinkOrder.getCode() != null) {
|
||||
@@ -617,6 +703,7 @@ public class ThinkOrderController extends BaseController {
|
||||
if (card == null) return fail("非法请求,code:0");
|
||||
// if (!card.getUid().equals(getLoginUser().getUid())) return fail("非法请求,code:1");
|
||||
thinkOrder.setCid(card.getId());
|
||||
if (card.getExpireTime() < timestamp) return fail("会员卡已过期");
|
||||
if (card.getType().equals(5)) {
|
||||
if (card.getRemainingMoney().compareTo(BigDecimal.ZERO) < 1) return fail("余额不足");
|
||||
BigDecimal discount = card.getDiscount().divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_UP);
|
||||
@@ -676,6 +763,7 @@ public class ThinkOrderController extends BaseController {
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!card.getIsInvoice().equals(2)) thinkOrder.setCanInvoice(false);
|
||||
}
|
||||
|
||||
thinkOrder.setCreateTime(timestamp);
|
||||
@@ -690,7 +778,7 @@ public class ThinkOrderController extends BaseController {
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("添加")
|
||||
@ApiOperation("营业端添加")
|
||||
@PostMapping("/add-from-device")
|
||||
public ApiResult<?> addFromDevice(@RequestBody ThinkOrder thinkOrder, HttpServletRequest request) throws IOException, WxErrorException {
|
||||
ThinkSite thinkSite = thinkSiteService.getById(thinkOrder.getSid());
|
||||
@@ -722,7 +810,7 @@ public class ThinkOrderController extends BaseController {
|
||||
thinkOrder.setAid(user.getUid());
|
||||
Long now = new Date().getTime();
|
||||
long timestamp = (now / 1000);
|
||||
|
||||
thinkOrder.setCanInvoice(true);
|
||||
int num = 0;
|
||||
if (thinkOrder.getThinkOrderInfos() != null) {
|
||||
for (ThinkOrderInfo thinkOrderInfo : thinkOrder.getThinkOrderInfos()) {
|
||||
@@ -784,6 +872,7 @@ public class ThinkOrderController extends BaseController {
|
||||
if (thinkOrder.getCid() != null && !thinkOrder.getCid().equals(0)) {
|
||||
ThinkCard card = thinkCardService.getById(thinkOrder.getCid());
|
||||
if (card == null) return fail("IC卡不存在");
|
||||
if (card.getExpireTime() < timestamp) return fail("会员卡已过期");
|
||||
if (card.getType().equals(5)) {
|
||||
BigDecimal discount = card.getDiscount().divide(BigDecimal.valueOf(10), 2, RoundingMode.HALF_UP);
|
||||
BigDecimal payPrice = totalPrice.multiply(discount);
|
||||
@@ -833,6 +922,7 @@ public class ThinkOrderController extends BaseController {
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!card.getIsInvoice().equals(2)) thinkOrder.setCanInvoice(false);
|
||||
}
|
||||
|
||||
thinkOrder.setAid(getLoginUserId());
|
||||
@@ -844,7 +934,7 @@ public class ThinkOrderController extends BaseController {
|
||||
}
|
||||
thinkOrderInfoService.saveBatch(thinkOrder.getThinkOrderInfos());
|
||||
if (thinkOrder.getPayType() >= 6 || thinkOrder.getPayType().equals(2)) {
|
||||
thinkOrder.setIsInvoice(3);
|
||||
thinkOrder.setIsInvoice(thinkOrder.getCanInvoice() ? 2 : 3);
|
||||
thinkOrderService.updateById(thinkOrder);
|
||||
updatePay(thinkOrder, null, thinkOrder.getTotalPrice().multiply(BigDecimal.valueOf(100)).intValue());
|
||||
return success(thinkOrder.getId());
|
||||
@@ -909,7 +999,7 @@ public class ThinkOrderController extends BaseController {
|
||||
return success("下单成功", thinkOrderService.createWxOrder(order.getPayPrice(), order.getOrderNum(), desc, getLoginUser().getOpenid()));
|
||||
}
|
||||
if (order.getPayType() >= 6 || order.getPayType().equals(2)) {
|
||||
order.setIsInvoice(3);
|
||||
order.setIsInvoice(order.getCanInvoice() ? 2 : 3);
|
||||
thinkOrderService.updateById(order);
|
||||
updatePay(order, null, order.getTotalPrice().multiply(BigDecimal.valueOf(100)).intValue());
|
||||
return success("支付成功", order.getId());
|
||||
@@ -991,26 +1081,67 @@ public class ThinkOrderController extends BaseController {
|
||||
}
|
||||
if (thinkOrder.getOrderStatus() != null && thinkOrder.getOrderStatus().equals(3)) {
|
||||
// 取消
|
||||
int num = 0;
|
||||
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
||||
for (ThinkOrderInfo thinkOrderInfo : thinkOrderInfoList) {
|
||||
thinkOrderInfo.setPayStatus(0);
|
||||
num += thinkOrderInfo.getAdultNum() + thinkOrderInfo.getChildrenNum();
|
||||
}
|
||||
thinkOrderInfoService.updateBatchById(thinkOrderInfoList);
|
||||
ThinkOrder thinkOrder1 = thinkOrderService.getByIdRel(thinkOrder.getId());
|
||||
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);
|
||||
}
|
||||
}
|
||||
if (thinkOrder1.getCode() != null && !thinkOrder1.getCode().isEmpty()) {
|
||||
ThinkCard thinkCard = thinkCardService.getByCode(thinkOrder1.getCode());
|
||||
if (thinkCard != null) {
|
||||
thinkCard.setUseTime(0L);
|
||||
thinkCardService.updateById(thinkCard);
|
||||
ThinkCard card = thinkCardService.getByCode(thinkOrder1.getCode());
|
||||
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() + 1);
|
||||
}
|
||||
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 (thinkOrderService.updateById(thinkOrder)) {
|
||||
return success("修改成功");
|
||||
@@ -1583,7 +1714,7 @@ public class ThinkOrderController extends BaseController {
|
||||
new LambdaQueryWrapper<ThinkCard>()
|
||||
.select(ThinkCard::getName, ThinkCard::getVid)
|
||||
.eq(ThinkCard::getStatus, 1)
|
||||
.eq(ThinkCard::getSid, param.getSid())
|
||||
.like(ThinkCard::getSid, param.getSid())
|
||||
.between(ThinkCard::getCreateTime, param.getCreateTimeStart(), param.getCreateTimeEnd())
|
||||
.groupBy(ThinkCard::getVid)
|
||||
);
|
||||
@@ -1603,7 +1734,6 @@ public class ThinkOrderController extends BaseController {
|
||||
new LambdaQueryWrapper<ThinkCard>()
|
||||
.eq(ThinkCard::getVid, card.getVid())
|
||||
.eq(ThinkCard::getStatus, 1)
|
||||
.eq(ThinkCard::getSid, param.getSid())
|
||||
.between(ThinkCard::getCreateTime, param.getCreateTimeStart(), param.getCreateTimeEnd())
|
||||
);
|
||||
BigDecimal totalIncome = list.stream().map(ThinkCard::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
@@ -1683,9 +1813,8 @@ public class ThinkOrderController extends BaseController {
|
||||
int numVIP = 0;
|
||||
List<ThinkUsersVip> vipList = thinkUsersVipService.list(
|
||||
new LambdaQueryWrapper<ThinkUsersVip>()
|
||||
.select(ThinkUsersVip::getName, ThinkUsersVip::getVid)
|
||||
.eq(ThinkUsersVip::getStatus, 1)
|
||||
.eq(ThinkUsersVip::getSid, param.getSid())
|
||||
.like(ThinkUsersVip::getSid, param.getSid())
|
||||
.between(ThinkUsersVip::getCreateTime, param.getCreateTimeStart(), param.getCreateTimeEnd())
|
||||
.groupBy(ThinkUsersVip::getVid)
|
||||
);
|
||||
@@ -1697,7 +1826,6 @@ public class ThinkOrderController extends BaseController {
|
||||
new LambdaQueryWrapper<ThinkUsersVip>()
|
||||
.eq(ThinkUsersVip::getVid, card.getVid())
|
||||
.eq(ThinkUsersVip::getStatus, 1)
|
||||
.eq(ThinkUsersVip::getSid, param.getSid())
|
||||
.between(ThinkUsersVip::getCreateTime, param.getCreateTimeStart(), param.getCreateTimeEnd())
|
||||
);
|
||||
data.put("name", card.getName());
|
||||
@@ -1923,11 +2051,13 @@ public class ThinkOrderController extends BaseController {
|
||||
switch (order.getPayType()) {
|
||||
case 16:
|
||||
case 6: {
|
||||
amount = thinkCard.getPrice().divide(new BigDecimal(thinkCard.getMonth() * 365), 2, RoundingMode.HALF_UP);
|
||||
if (!thinkCard.getMonth().equals(0))
|
||||
amount = thinkCard.getPrice().divide(new BigDecimal(thinkCard.getMonth() * 30), 2, RoundingMode.HALF_UP);
|
||||
}
|
||||
break;
|
||||
case 7: {
|
||||
amount = thinkCard.getPrice().divide(new BigDecimal(thinkCard.getTerm() * 30), 2, RoundingMode.HALF_UP);
|
||||
if (!thinkCard.getTerm().equals(0))
|
||||
amount = thinkCard.getPrice().divide(new BigDecimal(thinkCard.getTerm() * 365), 2, RoundingMode.HALF_UP);
|
||||
}
|
||||
break;
|
||||
case 8: {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gxwebsoft.think.controller;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.think.entity.*;
|
||||
import com.gxwebsoft.think.service.*;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -127,10 +129,22 @@ public class ThinkOrderRefundLogController extends BaseController {
|
||||
ThinkOrder thinkOrder = thinkOrderService.getById(thinkOrderRefundLog.getOid());
|
||||
thinkOrderRefundLog.setOrder(thinkOrder);
|
||||
thinkOrderRefundLog.setRefundNo("R" + thinkOrder.getOrderNum());
|
||||
thinkOrderRefundLog.setCreateTime(LocalDateTimeUtil.now());
|
||||
thinkOrder.setOrderStatus(4);
|
||||
thinkOrderService.updateById(thinkOrder);
|
||||
if (thinkOrder.getPayType().equals(1)) {
|
||||
thinkOrderService.refund(thinkOrderRefundLog);
|
||||
if (thinkOrder.getWechatOrder() != null
|
||||
&& !thinkOrder.getWechatOrder().isEmpty() && thinkOrder.getWechatOrder().contains("420000"))
|
||||
thinkOrderService.refund(thinkOrderRefundLog);
|
||||
else {
|
||||
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
||||
for (ThinkOrderInfo thinkOrderInfo : thinkOrderInfoList) {
|
||||
thinkOrderInfo.setPayStatus(0);
|
||||
}
|
||||
thinkOrderInfoService.updateBatchById(thinkOrderInfoList);
|
||||
thinkOrder.setOrderStatus(3);
|
||||
thinkOrderService.updateById(thinkOrder);
|
||||
}
|
||||
} else {
|
||||
int num = 0;
|
||||
List<ThinkOrderInfo> thinkOrderInfoList = thinkOrderInfoService.listInOrder(thinkOrder.getId());
|
||||
|
||||
@@ -68,4 +68,21 @@ public class NuoNuoGoods implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String dField5;
|
||||
|
||||
@ApiModelProperty(value = "数量")
|
||||
@TableField(exist = false)
|
||||
private String num;
|
||||
|
||||
@ApiModelProperty(value = "单价")
|
||||
@TableField(exist = false)
|
||||
private String price;
|
||||
|
||||
@ApiModelProperty(value = "折扣")
|
||||
@TableField(exist = false)
|
||||
private String favouredPolicyFlag;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "零税率标识")
|
||||
@TableField(exist = false)
|
||||
private String zeroRateFlag;
|
||||
|
||||
}
|
||||
|
||||
@@ -62,6 +62,10 @@ public class NuoNuoOrder implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String checker;
|
||||
|
||||
@ApiModelProperty(value = "是否显示复核人")
|
||||
@TableField(exist = false)
|
||||
private String showCheckerType;
|
||||
|
||||
@ApiModelProperty(value = "备注信息")
|
||||
@TableField(exist = false)
|
||||
private String remark;
|
||||
@@ -74,14 +78,24 @@ public class NuoNuoOrder implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "分机号")
|
||||
@TableField(exist = false)
|
||||
private String extensionNumber;
|
||||
|
||||
@ApiModelProperty(value = "开票类型:1:蓝票;2:红票 (数电票冲红请对接数电快捷冲红接口)")
|
||||
@TableField(exist = false)
|
||||
private String invoiceType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String specificFactor;
|
||||
|
||||
@ApiModelProperty(value = "开票明细")
|
||||
@TableField(exist = false)
|
||||
private NuoNuoGoods invoiceDetail;
|
||||
|
||||
@ApiModelProperty(value = "发票类型")
|
||||
@TableField(exist = false)
|
||||
private String invoiceLine;
|
||||
|
||||
@ApiModelProperty(value = "完整字段名invoiceTractorAndCombineHarvester,开具拖拉机和联合收割机特定要素的数电票才需要传specificFactor =13)")
|
||||
@TableField(exist = false)
|
||||
|
||||
@@ -44,4 +44,7 @@ public class NuoNuoRealPropertyRentInfo implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String crossCityFlag;
|
||||
|
||||
@ApiModelProperty(value = "面积单位")
|
||||
@TableField(exist = false)
|
||||
private String unit;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -102,4 +103,8 @@ public class ThinkInvoice implements Serializable {
|
||||
|
||||
private String url;
|
||||
|
||||
private String resJson;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<Integer> orderIdList;
|
||||
}
|
||||
|
||||
@@ -199,4 +199,7 @@ public class ThinkOrder implements Serializable {
|
||||
|
||||
@TableField(exist = false)
|
||||
private String adminName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Boolean canInvoice;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ThinkSite implements Serializable {
|
||||
private String rentEndDate;
|
||||
|
||||
@ApiModelProperty(value = "场馆面积")
|
||||
private String size;
|
||||
private BigDecimal size;
|
||||
|
||||
@ApiModelProperty(value = "产权证书/不动产权证号")
|
||||
private String realPropertyCertificate;
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY a.incoive_num
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
|
||||
@@ -39,5 +39,9 @@ public interface ThinkInvoiceService extends IService<ThinkInvoice> {
|
||||
*/
|
||||
ThinkInvoice getByIdRel(Integer id);
|
||||
|
||||
ThinkInvoice getByOid(Integer oid);
|
||||
|
||||
ThinkInvoice getByOrderNum(String orderNum);
|
||||
|
||||
ThinkInvoice getData(ThinkInvoiceParam param);
|
||||
}
|
||||
|
||||
@@ -46,4 +46,6 @@ public interface ThinkOrderInfoService extends IService<ThinkOrderInfo> {
|
||||
ThinkOrderInfo checkOrder(ThinkOrderInfo thinkOrderInfo);
|
||||
|
||||
List<ThinkOrderInfo> checkOrderList(ThinkOrderInfo thinkOrderInfo);
|
||||
|
||||
List<ThinkOrderInfo> orderInfoListByStartTimeList(Integer sid, List<Integer> startTimeList);
|
||||
}
|
||||
|
||||
@@ -70,5 +70,5 @@ public interface ThinkOrderService extends IService<ThinkOrder> {
|
||||
|
||||
ThinkOrder getTodayOrder(Integer userId);
|
||||
|
||||
List<ThinkOrder> getTodayOrderInSite(Integer userId, Integer sid);
|
||||
List<ThinkOrder> getTodayOrderInSite(Integer userId, Integer sid, String date);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,20 @@ public class ThinkInvoiceServiceImpl extends ServiceImpl<ThinkInvoiceMapper, Thi
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThinkInvoice getByOid(Integer oid) {
|
||||
ThinkInvoiceParam param = new ThinkInvoiceParam();
|
||||
param.setOid(oid);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThinkInvoice getByOrderNum(String orderNum) {
|
||||
ThinkInvoiceParam param = new ThinkInvoiceParam();
|
||||
param.setOrderNum(orderNum);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThinkInvoice getData(ThinkInvoiceParam param) {
|
||||
QueryWrapper<ThinkInvoice> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
@@ -83,4 +83,14 @@ public class ThinkOrderInfoServiceImpl extends ServiceImpl<ThinkOrderInfoMapper,
|
||||
.ne(ThinkOrderInfo::getPayStatus, 0)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThinkOrderInfo> orderInfoListByStartTimeList(Integer sid, List<Integer> startTimeList) {
|
||||
return list(
|
||||
new LambdaQueryWrapper<ThinkOrderInfo>()
|
||||
.eq(ThinkOrderInfo::getSid, sid)
|
||||
.in(ThinkOrderInfo::getStartTime, startTimeList)
|
||||
.in(ThinkOrderInfo::getPayStatus, 1 ,3)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,15 +727,15 @@ public class ThinkOrderServiceImpl extends ServiceImpl<ThinkOrderMapper, ThinkOr
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThinkOrder> getTodayOrderInSite(Integer userId, Integer sid) {
|
||||
public List<ThinkOrder> getTodayOrderInSite(Integer userId, Integer sid, String date) {
|
||||
return list(
|
||||
new LambdaQueryWrapper<ThinkOrder>()
|
||||
.eq(ThinkOrder::getUid, userId)
|
||||
.eq(ThinkOrder::getSid, sid)
|
||||
.in(ThinkOrder::getOrderStatus, 1, 2)
|
||||
.between(ThinkOrder::getCreateTime,
|
||||
DateUtil.parse(DateUtil.today() + " 00:00:00").getTime() / 1000,
|
||||
(int) (System.currentTimeMillis() / 1000))
|
||||
DateUtil.parse(date + " 00:00:00").getTime() / 1000,
|
||||
(int) (DateUtil.parse(date + " 23:59:59").getTime() / 1000))
|
||||
.orderByDesc(ThinkOrder::getCreateTime)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.think.entity.ThinkCard;
|
||||
import com.gxwebsoft.think.entity.ThinkSite;
|
||||
import com.gxwebsoft.think.entity.ThinkUsersVip;
|
||||
import com.gxwebsoft.think.entity.ThinkVip;
|
||||
@@ -12,12 +13,14 @@ import com.gxwebsoft.think.param.ThinkVipParam;
|
||||
import com.gxwebsoft.think.service.ThinkSiteService;
|
||||
import com.gxwebsoft.think.service.ThinkUsersVipService;
|
||||
import com.gxwebsoft.think.service.ThinkVipService;
|
||||
import org.beetl.ext.fn.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -79,9 +82,9 @@ public class ThinkVipServiceImpl extends ServiceImpl<ThinkVipMapper, ThinkVip> i
|
||||
LambdaQueryWrapper<ThinkVip> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (param.getType() != null) {
|
||||
if (param.getType().equals(0)) {
|
||||
queryWrapper.in(ThinkVip::getType, 1, 3);
|
||||
queryWrapper.in(ThinkVip::getType, 1, 3, 4);
|
||||
} else if (param.getType().equals(4)) {
|
||||
queryWrapper.in(ThinkVip::getType, 4, 5);
|
||||
queryWrapper.in(ThinkVip::getType, 5);
|
||||
} else {
|
||||
queryWrapper.eq(ThinkVip::getType, param.getType());
|
||||
}
|
||||
@@ -98,17 +101,22 @@ public class ThinkVipServiceImpl extends ServiceImpl<ThinkVipMapper, ThinkVip> i
|
||||
.eq(ThinkVip::getIsUse, 1);
|
||||
if (param.getType() != null) {
|
||||
if (param.getType().equals(0)) {
|
||||
wrapper.in(ThinkVip::getType, 1, 3);
|
||||
wrapper.in(ThinkVip::getType, 1, 3, 4);
|
||||
} else if (param.getType().equals(4)) {
|
||||
wrapper.in(ThinkVip::getType, 4, 5);
|
||||
wrapper.in(ThinkVip::getType, 5);
|
||||
} else {
|
||||
wrapper.eq(ThinkVip::getType, param.getType());
|
||||
}
|
||||
}
|
||||
wrapper.orderByAsc(ThinkVip::getSort);
|
||||
ThinkSite site = thinkSiteService.getById(thinkVip.getSid());
|
||||
if (site != null) thinkVip.setSiteNames(site.getName());
|
||||
thinkVip.setCardList(list(wrapper));
|
||||
// ThinkSite site = thinkSiteService.getById(thinkVip.getSid());
|
||||
// if (site != null) thinkVip.setSiteNames(site.getName());
|
||||
List<ThinkVip> cardList = list(wrapper);
|
||||
for (ThinkVip card : cardList) {
|
||||
List<ThinkSite> siteList = thinkSiteService.listByIds(Arrays.stream(card.getSid().split(",")).map(Integer::valueOf).toList());
|
||||
if (!siteList.isEmpty()) card.setSiteNames(String.join(",", siteList.stream().map(ThinkSite::getName).toList()));
|
||||
}
|
||||
thinkVip.setCardList(cardList);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
||||
Reference in New Issue
Block a user