|
|
@@ -0,0 +1,56 @@
|
|
|
+package com.fs.his.controller;
|
|
|
+
|
|
|
+import com.fs.common.core.controller.BaseController;
|
|
|
+import com.fs.common.core.domain.R;
|
|
|
+import com.fs.common.core.redis.RedisCache;
|
|
|
+import com.fs.company.domain.Company;
|
|
|
+import com.fs.company.service.ICompanyService;
|
|
|
+import com.fs.his.domain.FsRedPacket;
|
|
|
+import com.fs.his.service.IFsRedPacketService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.annotation.Profile;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @description: 红包信息
|
|
|
+ * @author: Xgb
|
|
|
+ * @createDate: 2025/11/4
|
|
|
+ * @version: 1.0
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/his/redPacket")
|
|
|
+public class FsRedPacketController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFsRedPacketService fsRedPacketService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICompanyService companyService;
|
|
|
+
|
|
|
+ @GetMapping("/info")
|
|
|
+ public R info() {
|
|
|
+ FsRedPacket result;
|
|
|
+
|
|
|
+ result = new FsRedPacket();
|
|
|
+ BigDecimal totalBalance = BigDecimal.ZERO;
|
|
|
+ BigDecimal totalTodayConsumption = BigDecimal.ZERO;
|
|
|
+ List<Company> companies = companyService.selectCompanyList(new Company());
|
|
|
+ for (Company c : companies) {
|
|
|
+ FsRedPacket info = fsRedPacketService.getInfo(c.getCompanyId());
|
|
|
+ if (info.getRedBalance() != null) {
|
|
|
+ totalBalance = totalBalance.add(info.getRedBalance());
|
|
|
+ }
|
|
|
+ if (info.getRedTodayComsumption() != null) {
|
|
|
+ totalTodayConsumption = totalTodayConsumption.add(info.getRedTodayComsumption());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.setRedBalance(totalBalance);
|
|
|
+ result.setRedTodayComsumption(totalTodayConsumption);
|
|
|
+ return R.ok().put("data", result);
|
|
|
+ }
|
|
|
+}
|