|
|
@@ -1,6 +1,15 @@
|
|
|
package com.uas.platform.b2c.fa.payment.controller;
|
|
|
|
|
|
+import com.uas.platform.b2c.common.account.model.Enterprise;
|
|
|
+import com.uas.platform.b2c.core.support.SystemSession;
|
|
|
+import com.uas.platform.b2c.fa.payment.model.Installment;
|
|
|
+import com.uas.platform.b2c.fa.payment.model.InstallmentStore;
|
|
|
+import com.uas.platform.b2c.fa.payment.service.InstallmentStoreService;
|
|
|
+import com.uas.platform.core.exception.IllegalOperatorException;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
/**
|
|
|
@@ -12,4 +21,66 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@RestController
|
|
|
@RequestMapping("trade/installment-stores")
|
|
|
public class InstallmentStoreController {
|
|
|
+
|
|
|
+ private final InstallmentStoreService installmentStoreService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ public InstallmentStoreController(InstallmentStoreService installmentStoreService) {
|
|
|
+ this.installmentStoreService = installmentStoreService;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分期权限店铺的保存功能
|
|
|
+ * @param storeUuid 店铺uuid
|
|
|
+ * @param storeId 店铺id
|
|
|
+ * @param enuu 企业uu
|
|
|
+ * @param enable 是否启用 启用:1,禁用:0
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
+ public void saveStore(@RequestParam("storeUuid") String storeUuid , @RequestParam("storeId") Long storeId , @RequestParam("enuu") Long enuu , @RequestParam("enable") Short enable) {
|
|
|
+ installmentStoreService.saveStore(storeUuid, storeId, enuu, enable);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分期权限店铺的删除功能
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
|
|
+ public void deleteStore(@RequestParam("id") Long id) {
|
|
|
+ installmentStoreService.deleteStore(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分期权限店铺的开启功能
|
|
|
+ * @param storeUuid 店铺uuid
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/capsOFF", method = RequestMethod.GET)
|
|
|
+ public void capsOFF(@RequestParam("storeUuid") String storeUuid) {
|
|
|
+ installmentStoreService.capsOFF(storeUuid);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分期权限店铺的关闭功能
|
|
|
+ * @param storeUuid 店铺uuid
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/capsON", method = RequestMethod.GET)
|
|
|
+ public void capsON(@RequestParam("storeUuid") String storeUuid) {
|
|
|
+ installmentStoreService.capsON(storeUuid);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分期权限店铺开启分期功能的验证
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/capsOFFVerify", method = RequestMethod.GET)
|
|
|
+ public String capsOFFVerify(@RequestParam(defaultValue = "0",value = "enable") Short enable) {
|
|
|
+ Enterprise enterprise = SystemSession.getUser().getEnterprise();
|
|
|
+ if (enterprise == null) {
|
|
|
+ throw new IllegalOperatorException("该账号为个人账号");
|
|
|
+ }
|
|
|
+ InstallmentStore installmentStore = installmentStoreService.getInstallmentByEnuuAndEnable(enterprise.getUu(), enable);
|
|
|
+ if (installmentStore == null) {
|
|
|
+ return "fail";
|
|
|
+ }
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
}
|