Procházet zdrojové kódy

修改门店信息

qin před 1 rokem
rodič
revize
5e5b9530ad

+ 3 - 5
src/main/java/com/poteviohealth/ym/ipos/controller/app/SettlementAppController.java

@@ -28,8 +28,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.text.DecimalFormat;
 
 /**
  * 结算管理app
@@ -120,12 +118,12 @@ public class SettlementAppController extends BaseWebController {
         VaultsResponse<GroupLeaderDTO>  vaultsResponse = customerFeignClient.getGroupLeaderById(groupLeaderParams);
         GroupLeaderDTO groupLeaderDTO = vaultsResponse.getData();
 
-        if(groupLeaderDTO.getRemainedAmt()>=dto.getAmount()){
+       /* if(groupLeaderDTO.getRemainedAmt()>=dto.getAmount()){
             DecimalFormat df = new DecimalFormat("#0.00");
             return VaultsResponse.failed("留存保证金为:"+new BigDecimal(df.format(groupLeaderDTO.getRemainedAmt() / 100.0))+"元,可提现金额不足");
-        }
+        }*/
 
-        dto.setAmount(dto.getAmount()-groupLeaderDTO.getRemainedAmt());
+        dto.setAmount(dto.getAmount());
         return splitService.withdraw(dto);
     }
 

+ 32 - 0
src/main/java/com/poteviohealth/ym/ipos/model/payment/ChangeBindPos.java

@@ -0,0 +1,32 @@
+package com.poteviohealth.ym.ipos.model.payment;
+
+import com.poteviohealth.ym.ipos.model.payment.detail.StoreInfoChange;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 4.30.门店信息修改
+ * https://open.wangcaio2o.com/docs/ipos-sa/4.30.md
+ * @author Qin
+ */
+@Data
+public class ChangeBindPos{
+
+    @ApiModelProperty(value = "报文签名",required = true)
+    private String sign;
+
+    @ApiModelProperty(value = "系统平台号:由翼码提供",required = true)
+    private String system_id = "5447";
+
+    @ApiModelProperty(value = "商户号:翼码商户号,由翼码提供",required = true)
+    private String isspid = "00436433";
+
+    @ApiModelProperty(value = "请求类型,固定值:store_edit_request",required = true)
+    private String request_type = "store_edit_request";
+
+    @ApiModelProperty(value = "门店信息")
+    private StoreInfoChange store_info;
+
+    @ApiModelProperty(value = "门店编号",required = true)
+    private String store_id;
+}

+ 28 - 0
src/main/java/com/poteviohealth/ym/ipos/model/payment/back/ChangeBingPosBack.java

@@ -0,0 +1,28 @@
+package com.poteviohealth.ym.ipos.model.payment.back;
+
+import com.poteviohealth.ym.ipos.model.back.BaseBack;
+import com.poteviohealth.ym.ipos.model.back.ResultBack;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 终端绑定交易返回值
+ * @author Qin
+ */
+@Data
+public class ChangeBingPosBack{
+    @ApiModelProperty(value = "报文签名")
+    private String sign;
+
+    @ApiModelProperty(value = "返回类型",required = true)
+    private String response_type;
+
+    @ApiModelProperty(value = "商户号:翼码商户号,由翼码提供",required = true)
+    private String isspid;
+
+    @ApiModelProperty(value = "门店编号",required = true)
+    private String store_id;
+
+    @ApiModelProperty(value = "响应值",required = true)
+    private ResultBack result;
+}

+ 14 - 0
src/main/java/com/poteviohealth/ym/ipos/model/payment/detail/StoreInfoChange.java

@@ -0,0 +1,14 @@
+package com.poteviohealth.ym.ipos.model.payment.detail;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 门店信息修改
+ * @author Qin
+ */
+@Data
+public class StoreInfoChange {
+    @ApiModelProperty(value = "门店名称",required = true)
+    private String store_name;
+}

+ 9 - 0
src/main/java/com/poteviohealth/ym/ipos/service/IPaymentService.java

@@ -21,6 +21,15 @@ public interface IPaymentService {
      */
     VaultsResponse bindPos(BindDto dto);
 
+
+    /**
+     * 修改门店信息
+     * @param dto
+     * @return
+     */
+    VaultsResponse changeBindPos(BindDto dto);
+
+
     /**
      * 支付查询交易
      * @param transactionId

+ 9 - 1
src/main/java/com/poteviohealth/ym/ipos/service/impl/MerchantServiceImpl.java

@@ -136,13 +136,21 @@ public class MerchantServiceImpl implements IMerchantService {
                 log.info("stringVault==="+stringVault);
                 return stringVault;
             }
+
             if(dto.getSourceId().equals(1)){
-                //终端绑定交易
                 BindDto bd = new BindDto();
                 bd.setAppId(stringVault.getData());
                 bd.setPosId(code);
                 bd.setStoreId(dto.getId().toString());
                 bd.setName("("+code+")"+dto.getMerchant_short_name());
+                //修改门店信息
+                if(!dto.getMerchant_short_name().equals(searchBack.getBase_merchant_short_name())){
+                    VaultsResponse changeVr = paymentService.changeBindPos(bd);
+                    if(!changeVr.validate()){
+                        return changeVr;
+                    }
+                }
+                //终端绑定交易
                 return paymentService.bindPos(bd);
             }
             log.info("openModifyVault==="+openModifyVault);

+ 23 - 0
src/main/java/com/poteviohealth/ym/ipos/service/impl/PaymentServiceImpl.java

@@ -72,6 +72,29 @@ public class PaymentServiceImpl implements IPaymentService {
         return VaultsResponse.failed(back.getResult().getComment());
     }
 
+    @Override
+    public VaultsResponse changeBindPos(BindDto dto) {
+        ChangeBindPos pos = new ChangeBindPos();
+        pos.setStore_id(dto.getStoreId());
+        StoreInfoChange storeInfo = new StoreInfoChange();
+        storeInfo.setStore_name(dto.getName());
+        pos.setStore_info(storeInfo);
+        ChangeBingPosBack back = null;
+        try {
+            back = (ChangeBingPosBack) YmUtil.resultBack(pos,new ChangeBingPosBack());
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+            return VaultsResponse.failed(e.getMessage());
+        }
+
+        if(YmUtil.SUCCESS.equals(back.getResult().getId())){
+            return VaultsResponse.success(back.getStore_id());
+        }
+
+        return VaultsResponse.failed(back.getResult().getComment());
+
+    }
+
     @Override
     public VaultsResponse<PayQueryBack> barcodeQuery(String transactionId) {