Ver código fonte

feat:销售端添加充值记录

caoliqin 1 semana atrás
pai
commit
d7922f17be

+ 29 - 1
fs-company/src/main/java/com/fs/company/controller/CompanyRechargeController.java

@@ -1,6 +1,8 @@
 package com.fs.company.controller;
 
+import cn.hutool.core.util.IdUtil;
 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;
@@ -11,6 +13,7 @@ import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.company.domain.Company;
 import com.fs.company.domain.CompanyRecharge;
+import com.fs.company.param.CompanyRechargeParam;
 import com.fs.company.service.ICompanyRechargeService;
 import com.fs.company.service.ICompanyService;
 import com.fs.company.vo.CompanyRechargeVO;
@@ -18,6 +21,7 @@ import com.fs.core.security.LoginUser;
 import com.fs.core.web.service.TokenService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
@@ -26,7 +30,7 @@ import java.util.List;
 
 /**
  * 充值Controller
- * 
+ *
  * @author fs
  * @date 2021-10-04
  */
@@ -100,5 +104,29 @@ public class CompanyRechargeController extends BaseController
         }
     }
 
+    @PreAuthorize("@ss.hasPermi('company:companyRecharge:recharge')")
+    @Log(title = "添加充值记录", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/recharge")
+    @Transactional
+    @RepeatSubmit
+    public R recharge(@RequestBody CompanyRechargeParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        CompanyRecharge recharge=new CompanyRecharge();
+        String orderSn = IdUtil.getSnowflake(0, 0).nextIdStr();
+        recharge.setRechargeNo(orderSn);
+        recharge.setCompanyId(loginUser.getCompany().getCompanyId());
+        recharge.setMoney(param.getMoney());
+        recharge.setCreateUserId(loginUser.getUser().getUserId());
+        recharge.setIsAudit(0);
+        recharge.setStatus(1);
+        recharge.setRemark(param.getRemark());
+        recharge.setPayType(3);
+        recharge.setImgs(param.getImgs());
+        companyRechargeService.insertCompanyRecharge(recharge);
+        return R.ok("提交成功,等待审核");
+
+    }
+
 
 }