|
@@ -10,6 +10,9 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONArray;
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.pj.api.wx.bo.MsgDataBO;
|
|
@@ -24,6 +27,8 @@ import com.pj.project.tb_invoice_order.TbInvoiceOrder;
|
|
|
import com.pj.project.tb_invoice_order.TbInvoiceOrderService;
|
|
|
import com.pj.project4sp.admin.SpAdmin;
|
|
|
import com.pj.project4sp.admin.SpAdminService;
|
|
|
+import com.pj.project4sp.global.BusinessException;
|
|
|
+import com.pj.utils.cache.RedisUtil;
|
|
|
import com.pj.utils.so.SoMap;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -103,6 +108,13 @@ public class TbInvoiceInfoService extends ServiceImpl<TbInvoiceInfoMapper, TbInv
|
|
|
String customerId = so.getString("customerId");
|
|
|
String customerName = so.getString("customerName");
|
|
|
|
|
|
+ List<String> orderIdList = Arrays.asList(orderIds.split(","));
|
|
|
+ List<TbInvoiceOrder> orderList = tbInvoiceOrderService.listByIds(orderIdList);
|
|
|
+ List<TbInvoiceOrder> collect = orderList.stream().filter(o -> o.getStatus() != 0).collect(Collectors.toList());
|
|
|
+ if(collect.size() > 0){
|
|
|
+ throw new BusinessException("请选择待申请的订单");
|
|
|
+ }
|
|
|
+
|
|
|
TbEntity entity = tbEntityService.getById(entityId);
|
|
|
TbInvoiceInfo t = new TbInvoiceInfo();
|
|
|
t.setEntityId(entityId).setIsElec(isElec).setTotalMoney(totalMoney)
|
|
@@ -114,8 +126,7 @@ public class TbInvoiceInfoService extends ServiceImpl<TbInvoiceInfoMapper, TbInv
|
|
|
.setBank(entity.getBank()).setBankNo(entity.getBankNo()).setEmail(entity.getEmail()).setPhone(entity.getPhone());
|
|
|
this.save(t);
|
|
|
|
|
|
- List<String> orderIdList = Arrays.asList(orderIds.split(","));
|
|
|
- List<TbInvoiceOrder> orderList = tbInvoiceOrderService.listByIds(orderIdList);
|
|
|
+
|
|
|
for (TbInvoiceOrder invoiceOrder : orderList) {
|
|
|
invoiceOrder.setInfoId(t.getId()).setInfoNo(t.getNo()).setStatus(1);
|
|
|
}
|
|
@@ -161,6 +172,12 @@ public class TbInvoiceInfoService extends ServiceImpl<TbInvoiceInfoMapper, TbInv
|
|
|
}
|
|
|
|
|
|
public List<FeeDeatilsGroup> getDetailsById(String id){
|
|
|
+ String jsonStr = RedisUtil.get("invoicedetails:" + id );
|
|
|
+ if(StrUtil.isNotEmpty(jsonStr)){
|
|
|
+ JSONArray objects = JSONUtil.parseArray(jsonStr);
|
|
|
+ List<FeeDeatilsGroup> grouping = JSONUtil.toList(objects, FeeDeatilsGroup.class);
|
|
|
+ return grouping;
|
|
|
+ }
|
|
|
List<TbInvoiceOrder> invoiceOrderList = tbInvoiceOrderService.findByInfoId(id);
|
|
|
List<TbFeeDetails> allDetailsList = new ArrayList<>();
|
|
|
for (TbInvoiceOrder invoiceOrder : invoiceOrderList) {
|
|
@@ -175,7 +192,10 @@ public class TbInvoiceInfoService extends ServiceImpl<TbInvoiceInfoMapper, TbInv
|
|
|
group.setGroupHash(hash);
|
|
|
groups.add(group);
|
|
|
}
|
|
|
- return grouping(groups);
|
|
|
+ List<FeeDeatilsGroup> grouping = grouping(groups);
|
|
|
+ String groupingJson = JSONUtil.toJsonStr(grouping);
|
|
|
+ RedisUtil.set("invoicedetails:" + id, groupingJson);
|
|
|
+ return grouping;
|
|
|
}
|
|
|
|
|
|
private List<FeeDeatilsGroup> grouping(List<FeeDeatilsGroup> list){
|