88e030b7
王彪总
init project
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
package com.java110.acct.integral.impl;
import com.alibaba.fastjson.JSONObject;
import com.java110.acct.integral.IComputeDeductionIntegral;
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;
import com.java110.intf.user.IUserV1InnerServiceSMO;
import com.java110.utils.cache.CommonCache;
import com.java110.utils.cache.MappingCache;
import com.java110.utils.util.ListUtil;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ComputeDeductionIntegralImpl implements IComputeDeductionIntegral {
private static final String MALL_DOMAIN = "MALL";
@Autowired
private IMallInnerServiceSMO mallInnerServiceSMOImpl;
@Autowired
private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
@Override
public DeductionIntegralDto deduction(String userId, String orderId, String communityId) {
String mallSwitch = MappingCache.getValue(MALL_DOMAIN, "MALL_SWITCH");
if (!"ON".equals(mallSwitch)) {
return new DeductionIntegralDto(0, 0);
}
UserDto userDto = new UserDto();
userDto.setUserId(userId);
List<UserDto> userDtos = userV1InnerServiceSMOImpl.queryUsers(userDto);
if (ListUtil.isNull(userDtos)) {
return new DeductionIntegralDto(0, 0);
}
JSONObject reqJson = new JSONObject();
reqJson.put("link", userDtos.get(0).getTel());
ResultVo resultVo = mallInnerServiceSMOImpl.postMallData(new MallDataDto("queryAppUserIntegralBmoImpl", reqJson));
if (resultVo.getCode() != ResultVo.CODE_OK) {
return new DeductionIntegralDto(0, 0);
}
JSONObject data = (JSONObject) resultVo.getData();
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;
}
}
|