|
|
@@ -1,23 +1,29 @@
|
|
|
package com.fs.company.controller.company;
|
|
|
|
|
|
import com.fs.common.annotation.Log;
|
|
|
+import com.fs.common.annotation.RepeatSubmit;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.enums.BusinessType;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
+import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
|
import com.fs.company.domain.Company;
|
|
|
+import com.fs.company.domain.CompanyRecharge;
|
|
|
import com.fs.company.domain.CompanyRedPacketBalanceLogs;
|
|
|
+import com.fs.company.param.CompanyRechargeParam;
|
|
|
+import com.fs.company.service.ICompanyRechargeService;
|
|
|
import com.fs.company.service.ICompanyRedPacketBalanceLogsService;
|
|
|
+import com.fs.company.service.impl.CompanyServiceImpl;
|
|
|
+import com.fs.core.utils.OrderCodeUtils;
|
|
|
import com.fs.framework.security.LoginUser;
|
|
|
import com.fs.framework.service.TokenService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -28,7 +34,11 @@ public class CompanyRedPacketBalanceLogsController extends BaseController {
|
|
|
@Autowired
|
|
|
private ICompanyRedPacketBalanceLogsService companyRedPacketBalanceLogsService;
|
|
|
@Autowired
|
|
|
+ private CompanyServiceImpl companyService;
|
|
|
+ @Autowired
|
|
|
private TokenService tokenService;
|
|
|
+ @Autowired
|
|
|
+ private ICompanyRechargeService rechargeService;
|
|
|
|
|
|
/**
|
|
|
* 查询企业红包余额记录列表
|
|
|
@@ -65,7 +75,42 @@ public class CompanyRedPacketBalanceLogsController extends BaseController {
|
|
|
@GetMapping("/redBalance")
|
|
|
public R getCompanyRedPacketBalance(){
|
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
- Company company = companyRedPacketBalanceLogsService.getCompanyRedPacketBalance(loginUser.getCompany().getCompanyId());
|
|
|
+ Company company=companyService.selectCompanyById(loginUser.getCompany().getCompanyId());
|
|
|
return R.ok().put("data",company);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 红包充值功能 因公司余额的变动关联的地方太多,现在把充值红包的金额单独提出来 不合计到公司余额中
|
|
|
+ * @Param:
|
|
|
+ * @Return:
|
|
|
+ * @Author xgb
|
|
|
+ * @Date 2025/11/3 11:08
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('company:companyRecharge:Recharge')")
|
|
|
+ @Log(title = "红包充值", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping(value = "/redRecharge")
|
|
|
+ @Transactional
|
|
|
+ @RepeatSubmit
|
|
|
+ public R redRecharge(@RequestBody CompanyRechargeParam param)
|
|
|
+ {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ CompanyRecharge redRecharge=new CompanyRecharge();
|
|
|
+ String orderSn = OrderCodeUtils.getOrderSn();
|
|
|
+ if(StringUtils.isEmpty(orderSn)){
|
|
|
+ return R.error("订单生成失败,请重试");
|
|
|
+ }
|
|
|
+ redRecharge.setRechargeNo(orderSn);
|
|
|
+ redRecharge.setCompanyId(param.getCompanyId());
|
|
|
+ redRecharge.setMoney(param.getMoney());
|
|
|
+ redRecharge.setCreateUserId(loginUser.getUser().getUserId());
|
|
|
+ redRecharge.setIsAudit(0);
|
|
|
+ redRecharge.setStatus(1);
|
|
|
+ redRecharge.setRemark(param.getRemark());
|
|
|
+ redRecharge.setPayType(3);
|
|
|
+ redRecharge.setBusinessType(1);// 红包充值
|
|
|
+ rechargeService.insertCompanyRecharge(redRecharge);
|
|
|
+ return R.ok("提交成功,等待审核");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|