wuxw 1 год назад
Родитель
Сommit
36f11d01cd

+ 30 - 0
java110-bean/src/main/java/com/java110/dto/integral/DeductionIntegralDto.java

@@ -8,6 +8,12 @@ public class DeductionIntegralDto implements Serializable {
 
     private double money;
 
+    private String link;
+
+    private String communityId;
+
+    private String remark;
+
     public DeductionIntegralDto(int integral, double money) {
         this.integral = integral;
         this.money = money;
@@ -28,4 +34,28 @@ public class DeductionIntegralDto implements Serializable {
     public void setMoney(double money) {
         this.money = money;
     }
+
+    public String getLink() {
+        return link;
+    }
+
+    public void setLink(String link) {
+        this.link = link;
+    }
+
+    public String getCommunityId() {
+        return communityId;
+    }
+
+    public void setCommunityId(String communityId) {
+        this.communityId = communityId;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
 }

+ 4 - 0
java110-interface/src/main/java/com/java110/intf/job/IMallInnerServiceSMO.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.java110.config.feign.FeignConfiguration;
 import com.java110.dto.IotDataDto;
 import com.java110.dto.MallDataDto;
+import com.java110.dto.integral.DeductionIntegralDto;
 import com.java110.dto.integral.GiftIntegralDto;
 import com.java110.dto.user.UserDto;
 import com.java110.vo.ResultVo;
@@ -56,4 +57,7 @@ public interface IMallInnerServiceSMO {
 
     @RequestMapping(value = "/sendUserIntegral", method = RequestMethod.POST)
     ResultVo sendUserIntegral(@RequestBody GiftIntegralDto giftIntegralDto);
+
+    @RequestMapping(value = "/userIntegralToCommunity", method = RequestMethod.POST)
+    ResultVo userIntegralToCommunity(@RequestBody DeductionIntegralDto deductionIntegralDto);
 }

+ 4 - 2
service-acct/src/main/java/com/java110/acct/integral/impl/ComputeDeductionIntegralImpl.java

@@ -29,7 +29,7 @@ public class ComputeDeductionIntegralImpl implements IComputeDeductionIntegral {
     private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
 
     @Override
-    public DeductionIntegralDto deduction(String userId,String orderId, String communityId) {
+    public DeductionIntegralDto deduction(String userId, String orderId, String communityId) {
 
         String mallSwitch = MappingCache.getValue(MALL_DOMAIN, "MALL_SWITCH");
 
@@ -58,7 +58,9 @@ public class ComputeDeductionIntegralImpl implements IComputeDeductionIntegral {
         JSONObject data = reqJson.getJSONObject("data");
 
 
-       DeductionIntegralDto deductionIntegralDto =  new DeductionIntegralDto(data.getIntValue("integral"), data.getDoubleValue("integralMoney"));
+        DeductionIntegralDto deductionIntegralDto = new DeductionIntegralDto(data.getIntValue("integral"), data.getDoubleValue("integralMoney"));
+        deductionIntegralDto.setLink(userDtos.get(0).getTel());
+        deductionIntegralDto.setCommunityId(communityId);
         CommonCache.setValue("integral_deduction_" + orderId, JSONObject.toJSONString(deductionIntegralDto), CommonCache.PAY_DEFAULT_EXPIRE_TIME);
         return deductionIntegralDto;
     }

+ 17 - 1
service-acct/src/main/java/com/java110/acct/integral/impl/DeductionIntegralImpl.java

@@ -3,12 +3,20 @@ package com.java110.acct.integral.impl;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.acct.integral.IDeductionIntegral;
 import com.java110.dto.integral.DeductionIntegralDto;
+import com.java110.intf.job.IMallInnerServiceSMO;
 import com.java110.utils.cache.CommonCache;
 import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 @Service
 public class DeductionIntegralImpl implements IDeductionIntegral {
+
+    @Autowired
+    private IMallInnerServiceSMO mallInnerServiceSMOImpl;
+
+
     @Override
     public int deduction(String orderId) {
 
@@ -22,6 +30,14 @@ public class DeductionIntegralImpl implements IDeductionIntegral {
         if (deductionIntegralDto == null) {
             return 0;
         }
-        return 0;
+
+
+        ResultVo resultVo = mallInnerServiceSMOImpl.userIntegralToCommunity(deductionIntegralDto);
+
+        if(resultVo.getCode() != ResultVo.CODE_OK){
+            throw new IllegalArgumentException(resultVo.getMsg());
+        }
+
+        return 1;
     }
 }

+ 23 - 0
service-job/src/main/java/com/java110/job/smo/impl/MallInnerServiceSMOImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.core.log.LoggerFactory;
 import com.java110.dto.MallDataDto;
+import com.java110.dto.integral.DeductionIntegralDto;
 import com.java110.dto.integral.GiftIntegralDto;
 import com.java110.dto.user.UserDto;
 import com.java110.intf.job.IMallInnerServiceSMO;
@@ -153,4 +154,26 @@ public class MallInnerServiceSMOImpl extends BaseServiceSMO implements IMallInne
         return resultVo;
     }
 
+    @Override
+    public ResultVo userIntegralToCommunity(@RequestBody DeductionIntegralDto deductionIntegralDto) {
+
+        String mallSwitch = MappingCache.getValue(MALL_DOMAIN, "MALL_SWITCH");
+
+        if (!"ON".equals(mallSwitch)) {
+            return new ResultVo(ResultVo.CODE_OK, ResultVo.MSG_OK);
+        }
+
+        JSONObject paramIn = new JSONObject();
+        paramIn.put("link", deductionIntegralDto.getLink());
+        paramIn.put("integral", deductionIntegralDto.getIntegral());
+        paramIn.put("communityId", deductionIntegralDto.getCommunityId());
+
+        paramIn.put("remark", deductionIntegralDto.getRemark());
+
+        paramIn.put("mallApiCode", "userIntegralToCommunity");
+        ResultVo resultVo = sendMallImpl.post("/mall/api/common.openCommonApi", paramIn);
+
+        return resultVo;
+    }
+
 }