|  |  |  | 
|---|
|  |  |  | package cc.mrbird.febs; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cc.mrbird.febs.common.entity.FebsResponse; | 
|---|
|  |  |  | import cc.mrbird.febs.common.enumerates.AgentLevelEnum; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.dto.AgentLevelUpdateDto; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.entity.AgentInfo; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.entity.DataDictionaryCustom; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper; | 
|---|
|  |  |  | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; | 
|---|
|  |  |  | import cc.mrbird.febs.common.exception.FebsException; | 
|---|
|  |  |  | import cc.mrbird.febs.common.utils.LoginUserUtil; | 
|---|
|  |  |  | import cc.mrbird.febs.common.utils.RedisUtils; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.conversion.MallGoodsConversion; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.dto.*; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.entity.*; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.mapper.*; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.quartz.ProfitJob; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.service.IAgentService; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.service.IApiMallOrderInfoService; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.vo.*; | 
|---|
|  |  |  | import cc.mrbird.febs.pay.util.WechatConfigure; | 
|---|
|  |  |  | import cc.mrbird.febs.rabbit.consumer.AgentConsumer; | 
|---|
|  |  |  | import cc.mrbird.febs.rabbit.producter.AgentProducer; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import cn.hutool.core.collection.CollUtil; | 
|---|
|  |  |  | import cn.hutool.core.util.ObjectUtil; | 
|---|
|  |  |  | import cn.hutool.core.util.RandomUtil; | 
|---|
|  |  |  | import cn.hutool.core.util.StrUtil; | 
|---|
|  |  |  | import cn.hutool.json.JSONObject; | 
|---|
|  |  |  | import cn.hutool.json.JSONUtil; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.exceptions.ApiException; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import okhttp3.*; | 
|---|
|  |  |  | import org.aspectj.weaver.loadtime.Agent; | 
|---|
|  |  |  | import org.junit.jupiter.api.Test; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.boot.test.context.SpringBootTest; | 
|---|
|  |  |  | import org.springframework.web.client.RestTemplate; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import java.io.IOException; | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.math.RoundingMode; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author wzy | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IAgentService agentService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MallGoodsStyleMapper mallGoodsStyleMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private  MallActAwardSetMapper mallActAwardSetMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private  MallMemberMapper mallMemberMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private  MallActWinRecordMapper mallActWinRecordMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private  MallActLuckdrawRecordMapper mallActLuckdrawRecordMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private  MallMemberWalletMapper mallMemberWalletMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private  MallActSetMapper mallActSetMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private  MallGoodsSkuMapper mallGoodsSkuMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private  MallOrderItemMapper mallOrderItemMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private  MallGoodsMapper mallGoodsMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private  MallGoodsImagesMapper goodsImagesMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IApiMallOrderInfoService iApiMallOrderInfoService; | 
|---|
|  |  |  | @Test | 
|---|
|  |  |  | public void agentTest() { | 
|---|
|  |  |  | //        agentProducer.sendDelayMsg(1L, 10000L); | 
|---|
|  |  |  | public void getCouponAmountMap(){ | 
|---|
|  |  |  | Long memberCouponId = 139L; | 
|---|
|  |  |  | List<AddOrderItemDto> items = new ArrayList<>(); | 
|---|
|  |  |  | AddOrderItemDto addOrderItemDto = new AddOrderItemDto(); | 
|---|
|  |  |  | addOrderItemDto.setSkuId(185L); | 
|---|
|  |  |  | addOrderItemDto.setCnt(2); | 
|---|
|  |  |  | items.add(addOrderItemDto); | 
|---|
|  |  |  | Map<Long, BigDecimal> couponAmountMap = iApiMallOrderInfoService.getCouponAmountMap(memberCouponId, items); | 
|---|
|  |  |  | for (Map.Entry<Long, BigDecimal> entry : couponAmountMap.entrySet()) { | 
|---|
|  |  |  | System.out.println("Key: " + entry.getKey() + ", Value: " + entry.getValue()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Test | 
|---|
|  |  |  | public void insertAgentTest() { | 
|---|
|  |  |  | AgentInfo agentInfo = new AgentInfo(); | 
|---|
|  |  |  | agentInfo.setOrderType(2); | 
|---|
|  |  |  | agentInfo.setOrderCnt(2000); | 
|---|
|  |  |  | agentInfo.setLastCnt(3); | 
|---|
|  |  |  | agentInfo.setDirectIncome(BigDecimal.valueOf(50)); | 
|---|
|  |  |  | agentInfo.setTeamIncome(BigDecimal.valueOf(15)); | 
|---|
|  |  |  | agentInfo.setTeamIncomeType(2); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DataDictionaryCustom data = new DataDictionaryCustom(); | 
|---|
|  |  |  | data.setType("AGENT_LEVEL_REQUIRE"); | 
|---|
|  |  |  | data.setCode(AgentLevelEnum.FOUR_LEVEL.name()); | 
|---|
|  |  |  | data.setValue(JSONObject.toJSONString(agentInfo)); | 
|---|
|  |  |  | dataDictionaryCustomMapper.insert(data); | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private RedisUtils redisUtils; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | RestTemplate restTemplate; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static final String API_KEY = "MPHXcBxkGLIDOmoaahS9pIB7"; | 
|---|
|  |  |  | public static final String SECRET_KEY = "f5ueNY65fE9C6FzFTVKc6Imo8NdZSWMw"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build(); | 
|---|
|  |  |  | @Test | 
|---|
|  |  |  | public void getAccessToken(){ | 
|---|
|  |  |  | ApiIdentifyAddressDto apiIdentifyAddressDto = new ApiIdentifyAddressDto(); | 
|---|
|  |  |  | apiIdentifyAddressDto.setText("上海市浦东新区纳贤路701号百度上海研发中心 F4A000 张三"); | 
|---|
|  |  |  | MediaType mediaType = MediaType.parse("application/json"); | 
|---|
|  |  |  | RequestBody body = RequestBody.create(mediaType, JSONUtil.toJsonStr(apiIdentifyAddressDto)); | 
|---|
|  |  |  | Request request = new Request.Builder() | 
|---|
|  |  |  | .url("https://aip.baidubce.com/rpc/2.0/nlp/v1/address?access_token=" + redisUtils.get(WechatConfigure.BAIDU_ACCESS_TOKEN_REDIS_KEY).toString()) | 
|---|
|  |  |  | .method("POST", body) | 
|---|
|  |  |  | .addHeader("Content-Type", "application/json") | 
|---|
|  |  |  | .addHeader("Accept", "application/json") | 
|---|
|  |  |  | .build(); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Response response = HTTP_CLIENT.newCall(request).execute(); | 
|---|
|  |  |  | String responseStr = response.body().string(); | 
|---|
|  |  |  | System.out.println(responseStr); | 
|---|
|  |  |  | if (responseStr.contains("error_code")) { | 
|---|
|  |  |  | System.out.println("获取access_token失败"); | 
|---|
|  |  |  | JSONObject jsonObject = JSONUtil.parseObj(responseStr); | 
|---|
|  |  |  | System.out.print(jsonObject.get("error_code").toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (IOException e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Test | 
|---|
|  |  |  | public void insertData() { | 
|---|
|  |  |  | int i = 1; | 
|---|
|  |  |  | for (AgentLevelEnum value : AgentLevelEnum.values()) { | 
|---|
|  |  |  | DataDictionaryCustom data = new DataDictionaryCustom(); | 
|---|
|  |  |  | data.setType("AGENT_LEVEL"); | 
|---|
|  |  |  | data.setDescription(value.getName()); | 
|---|
|  |  |  | data.setCode(value.name()); | 
|---|
|  |  |  | data.setValue(String.valueOf(i)); | 
|---|
|  |  |  | dataDictionaryCustomMapper.insert(data); | 
|---|
|  |  |  | public void getAccessToken2(){ | 
|---|
|  |  |  | // 官网获取的 API Key 更新为你注册的 | 
|---|
|  |  |  | String clientId = "MPHXcBxkGLIDOmoaahS9pIB7"; | 
|---|
|  |  |  | // 官网获取的 Secret Key 更新为你注册的 | 
|---|
|  |  |  | String clientSecret = "f5ueNY65fE9C6FzFTVKc6Imo8NdZSWMw"; | 
|---|
|  |  |  | String authHost = "https://aip.baidubce.com/oauth/2.0/token?"; | 
|---|
|  |  |  | String getAccessTokenUrl = authHost | 
|---|
|  |  |  | // 1. grant_type为固定参数 | 
|---|
|  |  |  | + "grant_type=client_credentials" | 
|---|
|  |  |  | // 2. 官网获取的 API Key | 
|---|
|  |  |  | + "&client_id=" + clientId | 
|---|
|  |  |  | // 3. 官网获取的 Secret Key | 
|---|
|  |  |  | + "&client_secret=" + clientSecret; | 
|---|
|  |  |  | String jsonStr = restTemplate.getForObject(getAccessTokenUrl, String.class); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 返回结果 | 
|---|
|  |  |  | * {"access_token":"ACCESS_TOKEN","expires_in":7200} | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | if (!jsonStr.contains("access_token")) { | 
|---|
|  |  |  | System.out.println("获取access_token失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(jsonStr); | 
|---|
|  |  |  | String accessToken = jsonObject.getString("access_token"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String accessTokenKey = WechatConfigure.BAIDU_ACCESS_TOKEN_REDIS_KEY; | 
|---|
|  |  |  | if (StrUtil.isEmpty(accessToken)) { | 
|---|
|  |  |  | log.error("获取baidu access_token失败: {}" , jsonObject.getString("errmsg")); | 
|---|
|  |  |  | throw new ApiException("获取access token失败"); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | log.info("baidu access_token : {}",accessToken); | 
|---|
|  |  |  | System.out.println(accessToken); | 
|---|
|  |  |  | redisUtils.set(accessTokenKey,accessToken); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @Test | 
|---|
|  |  |  | public void goodsDetails(){ | 
|---|
|  |  |  | Long id = 68L; | 
|---|
|  |  |  | MallGoods mallGoods = mallGoodsMapper.selectGoodsDetailById(id); | 
|---|
|  |  |  | if (mallGoods == null) { | 
|---|
|  |  |  | throw new FebsException("商品不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<String> images = goodsImagesMapper.selectGoodsImagesByGoodsId(mallGoods.getId()); | 
|---|
|  |  |  | MallGoodsDetailsVo mallGoodsDetailsVo = MallGoodsConversion.INSTANCE.entityToDetailsVo(mallGoods); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<GoodsDetailsStyleVo> styles = mallGoodsDetailsVo.getStyles(); | 
|---|
|  |  |  | if(ObjectUtil.isNotEmpty(styles)){ | 
|---|
|  |  |  | for(GoodsDetailsStyleVo goodsDetailsStyleVo : styles){ | 
|---|
|  |  |  | List<GoodsDetailsSkuVo> skus = goodsDetailsStyleVo.getSkus(); | 
|---|
|  |  |  | if(CollUtil.isNotEmpty(skus) ){ | 
|---|
|  |  |  | for(GoodsDetailsSkuVo goodsDetailsSkuVo : skus){ | 
|---|
|  |  |  | if(StrUtil.isNotEmpty(goodsDetailsSkuVo.getSample())){ | 
|---|
|  |  |  | goodsDetailsSkuVo.setSampleFlag(true); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | goodsDetailsSkuVo.setSampleFlag(false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (CollUtil.isNotEmpty(mallGoods.getStyles())) { | 
|---|
|  |  |  | Map<String, BigDecimal> stockAndVolume = mallGoodsMapper.selectGoodsStockAndVolume(id); | 
|---|
|  |  |  | mallGoodsDetailsVo.setStock(stockAndVolume.get("stock").intValue()); | 
|---|
|  |  |  | mallGoodsDetailsVo.setVolume(stockAndVolume.get("volume").intValue()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | mallGoodsDetailsVo.setImages(images); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static void main(String[] args) { | 
|---|
|  |  |  | getJson(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static void getJson(){ | 
|---|
|  |  |  | AgentLevelUpdateDto adminAgentLevelUpdateInfoVo = new AgentLevelUpdateDto(); | 
|---|
|  |  |  | String jsonStr = "{\"directIncome\":50,\"lastCnt\":3,\"orderCnt\":2000,\"orderType\":2,\"teamIncome\":15,\"teamIncomeType\":2}"; | 
|---|
|  |  |  | JSONObject jsonObject = JSONObject.parseObject(jsonStr); | 
|---|
|  |  |  | adminAgentLevelUpdateInfoVo.setDirectIncome(new BigDecimal((jsonObject.get("directIncome")==null?0:jsonObject.get("directIncome")).toString())); | 
|---|
|  |  |  | adminAgentLevelUpdateInfoVo.setLastCnt(Integer.parseInt((jsonObject.get("lastCnt")==null?0:jsonObject.get("lastCnt")).toString())); | 
|---|
|  |  |  | adminAgentLevelUpdateInfoVo.setOrderCnt(Integer.parseInt((jsonObject.get("orderCnt")==null?0:jsonObject.get("orderCnt")).toString())); | 
|---|
|  |  |  | adminAgentLevelUpdateInfoVo.setOrderType(Integer.parseInt(jsonObject.get("orderType").toString())); | 
|---|
|  |  |  | adminAgentLevelUpdateInfoVo.setTeamIncome(new BigDecimal((jsonObject.get("teamIncome")==null?0:jsonObject.get("teamIncome")).toString())); | 
|---|
|  |  |  | adminAgentLevelUpdateInfoVo.setTeamIncomeType(Integer.parseInt(jsonObject.get("orderType").toString())); | 
|---|
|  |  |  | adminAgentLevelUpdateInfoVo.setId(14L); | 
|---|
|  |  |  | AgentLevelUpdateDto agentLevelUpdateDtoJson = new AgentLevelUpdateDto(); | 
|---|
|  |  |  | agentLevelUpdateDtoJson.setDirectIncome(adminAgentLevelUpdateInfoVo.getDirectIncome()); | 
|---|
|  |  |  | agentLevelUpdateDtoJson.setLastCnt(adminAgentLevelUpdateInfoVo.getLastCnt()); | 
|---|
|  |  |  | agentLevelUpdateDtoJson.setOrderCnt(adminAgentLevelUpdateInfoVo.getOrderCnt()); | 
|---|
|  |  |  | agentLevelUpdateDtoJson.setTeamIncome(adminAgentLevelUpdateInfoVo.getTeamIncome()); | 
|---|
|  |  |  | agentLevelUpdateDtoJson.setOrderType(adminAgentLevelUpdateInfoVo.getOrderType()); | 
|---|
|  |  |  | agentLevelUpdateDtoJson.setTeamIncomeType(adminAgentLevelUpdateInfoVo.getTeamIncomeType()); | 
|---|
|  |  |  | JSONObject jsonObjectA = (JSONObject)JSONObject.toJSON(agentLevelUpdateDtoJson); | 
|---|
|  |  |  | System.out.println(jsonObjectA.toJSONString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Test | 
|---|
|  |  |  | public void autoLevelUp() { | 
|---|
|  |  |  | // agentService.autoUpAgentLevel(3L); | 
|---|
|  |  |  | //        agentProducer.sendAutoLevelUpMsg(3L); | 
|---|
|  |  |  | public void levelTest(){ | 
|---|
|  |  |  | ApiCreateOrderVerifyDto apiCreateOrderVerifyDto = new ApiCreateOrderVerifyDto(); | 
|---|
|  |  |  | List<AddOrderItemDto> addOrderItemDtos = new ArrayList<>(); | 
|---|
|  |  |  | AddOrderItemDto addOrderItemDto = new AddOrderItemDto(); | 
|---|
|  |  |  | addOrderItemDto.setCnt(1); | 
|---|
|  |  |  | addOrderItemDto.setSkuId(243L); | 
|---|
|  |  |  | addOrderItemDtos.add(addOrderItemDto); | 
|---|
|  |  |  | apiCreateOrderVerifyDto.setItems(addOrderItemDtos); | 
|---|
|  |  |  | MallMember member = mallMemberMapper.selectById(401L); | 
|---|
|  |  |  | List<AddOrderItemDto> items = apiCreateOrderVerifyDto.getItems(); | 
|---|
|  |  |  | if(CollUtil.isEmpty(items)){ | 
|---|
|  |  |  | System.out.println("请先挑选商品"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (AddOrderItemDto item : apiCreateOrderVerifyDto.getItems()) { | 
|---|
|  |  |  | MallGoodsSku sku = mallGoodsSkuMapper.selectSkuInfoById(item.getSkuId()); | 
|---|
|  |  |  | if (sku == null) { | 
|---|
|  |  |  | System.out.println("购买商品或sku不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if("样品".equals(sku.getSample())){ | 
|---|
|  |  |  | List<MallOrderItem> mallOrderItems = mallOrderItemMapper.selectItemBySkuIdUnCancel(sku.getId(), member.getId()); | 
|---|
|  |  |  | if (CollUtil.isNotEmpty(mallOrderItems)) { | 
|---|
|  |  |  | System.out.println("样品只能购买一次"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Integer cnt = item.getCnt(); | 
|---|
|  |  |  | if(1 < cnt){ | 
|---|
|  |  |  | System.out.println("样品只能购买一件"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | //验证用户的等级 | 
|---|
|  |  |  | if(AgentLevelEnum.ZERO_LEVEL.name().equals(member.getLevel())){ | 
|---|
|  |  |  | System.out.println(sku.getSkuName() + "请先申请成为合伙人"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | agentProducer.sendReturnMoneyMsg(14L); | 
|---|
|  |  |  | if (sku.getStock() < item.getCnt()) { | 
|---|
|  |  |  | System.out.println(sku.getSkuName() + "库存不足"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | MallGoods mallGoods = mallGoodsMapper.selectById(sku.getGoodsId()); | 
|---|
|  |  |  | if (MallGoods.ISSALE_STATUS_DISABLED.equals(mallGoods.getIsSale())) { | 
|---|
|  |  |  | System.out.println(mallGoods.getGoodsName() + "已下架"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Test | 
|---|
|  |  |  | public void bigdecimalTest() { | 
|---|
|  |  |  | BigDecimal aa = new BigDecimal("1.345"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | System.out.println(aa.setScale(2, RoundingMode.DOWN)); | 
|---|
|  |  |  | System.out.println(aa.setScale(2, RoundingMode.UP)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //    @Test | 
|---|
|  |  |  | //    public void skusTest() { | 
|---|
|  |  |  | //        ApiMallAwardDetailsVo apiMallAwardDetailsVo = new ApiMallAwardDetailsVo(); | 
|---|
|  |  |  | //        Long memberId = 4L; | 
|---|
|  |  |  | //        Long actId = 1L; | 
|---|
|  |  |  | //        MallMember mallMember = mallMemberMapper.selectById(memberId); | 
|---|
|  |  |  | //        if(ObjectUtil.isEmpty(mallMember)){ | 
|---|
|  |  |  | //            throw new FebsException("用户不存在"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        MallActSet mallActSet = mallActSetMapper.selectById(actId); | 
|---|
|  |  |  | //        if(ObjectUtil.isEmpty(mallActSet)){ | 
|---|
|  |  |  | //            throw new FebsException("活动不存在"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        Integer actStatus = mallActSet.getActStatus(); | 
|---|
|  |  |  | //        if(MallActSet.ACT_STATUS_DISABLED == actStatus){ | 
|---|
|  |  |  | //            throw new FebsException("活动还没开始"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        /** | 
|---|
|  |  |  | //         * 获取用户积分数,判断能不能抽奖 | 
|---|
|  |  |  | //         * 减少对应的积分数量 | 
|---|
|  |  |  | //         * 较少奖品的已抽奖 | 
|---|
|  |  |  | //         * 生成一条抽奖记录 | 
|---|
|  |  |  | //         */ | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); | 
|---|
|  |  |  | //        if(ObjectUtil.isEmpty(wallet)){ | 
|---|
|  |  |  | //            throw new FebsException("账户不存在"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        BigDecimal commission = wallet.getCommission(); | 
|---|
|  |  |  | //        BigDecimal prizeScore = wallet.getPrizeScore(); | 
|---|
|  |  |  | //        Integer actScoreCnt = mallActSet.getActScoreCnt(); | 
|---|
|  |  |  | //        if(prizeScore.compareTo(new BigDecimal(actScoreCnt))<0){ | 
|---|
|  |  |  | //            throw new FebsException("竞猜积分不足"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        /** | 
|---|
|  |  |  | //         * 中奖概率 20% | 
|---|
|  |  |  | //         * 每次抽奖产生一个随机数要大于8,则中奖 | 
|---|
|  |  |  | //         * 历史10条抽奖记录有中奖过,中奖记录少于两条,则中奖 | 
|---|
|  |  |  | //         */ | 
|---|
|  |  |  | //        //获取中奖概率 | 
|---|
|  |  |  | //        DataDictionaryCustom scoreDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( | 
|---|
|  |  |  | //                DataDictionaryEnum.WIN_SCORE.getType(), | 
|---|
|  |  |  | //                DataDictionaryEnum.WIN_SCORE.getCode()); | 
|---|
|  |  |  | //        DataDictionaryCustom cashDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( | 
|---|
|  |  |  | //                DataDictionaryEnum.WIN_CASH.getType(), | 
|---|
|  |  |  | //                DataDictionaryEnum.WIN_CASH.getCode()); | 
|---|
|  |  |  | //        String scoreDicValue = scoreDic.getValue(); | 
|---|
|  |  |  | //        String cashDicValue = cashDic.getValue(); | 
|---|
|  |  |  | //        BigDecimal totalProbability = new BigDecimal(scoreDicValue).add(new BigDecimal(cashDicValue)); | 
|---|
|  |  |  | //        //获取那个更大一点的几率 | 
|---|
|  |  |  | //        BigDecimal maxProbability = BigDecimal.ZERO; | 
|---|
|  |  |  | //        BigDecimal minProbability = BigDecimal.ZERO; | 
|---|
|  |  |  | //        Integer maxAwardType = 0; | 
|---|
|  |  |  | //        Integer minAwardType = 0; | 
|---|
|  |  |  | //        if(new BigDecimal(scoreDicValue).compareTo(new BigDecimal(cashDicValue)) < 0){ | 
|---|
|  |  |  | //            maxProbability = new BigDecimal(cashDicValue); | 
|---|
|  |  |  | //            minProbability = new BigDecimal(scoreDicValue); | 
|---|
|  |  |  | //            maxAwardType = MallActAwardSet.AWARD_TYPE_YJ; | 
|---|
|  |  |  | //            minAwardType = MallActAwardSet.AWARD_TYPE_JF; | 
|---|
|  |  |  | //        }else{ | 
|---|
|  |  |  | //            maxProbability = new BigDecimal(scoreDicValue); | 
|---|
|  |  |  | //            minProbability = new BigDecimal(cashDicValue); | 
|---|
|  |  |  | //            maxAwardType = MallActAwardSet.AWARD_TYPE_JF; | 
|---|
|  |  |  | //            minAwardType = MallActAwardSet.AWARD_TYPE_YJ; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        BigDecimal multiply = totalProbability.multiply(new BigDecimal(100)); | 
|---|
|  |  |  | //        BigDecimal failureScope = new BigDecimal(100).subtract(multiply); | 
|---|
|  |  |  | //        int randomInt = 90; | 
|---|
|  |  |  | //        //小于failureScope这个数字,则没中奖 | 
|---|
|  |  |  | //        if(new BigDecimal(randomInt).compareTo(failureScope) <= 0){ | 
|---|
|  |  |  | //            //抽奖记录 | 
|---|
|  |  |  | //            MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); | 
|---|
|  |  |  | //            mallActLuckdrawRecord.setActId(actId); | 
|---|
|  |  |  | //            mallActLuckdrawRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //            mallActLuckdrawRecord.setMemberId(memberId); | 
|---|
|  |  |  | //            mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); | 
|---|
|  |  |  | //            mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); | 
|---|
|  |  |  | //            mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //            List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); | 
|---|
|  |  |  | //            if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ | 
|---|
|  |  |  | //                apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); | 
|---|
|  |  |  | //                apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); | 
|---|
|  |  |  | //            }else{ | 
|---|
|  |  |  | //                apiMallAwardDetailsVo.setAwardName("未中奖"); | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //        }else if(new BigDecimal(randomInt).compareTo(failureScope) > 0 | 
|---|
|  |  |  | //                && new BigDecimal(randomInt).compareTo(failureScope.add(maxProbability.multiply(new BigDecimal(100)))) <= 0){ | 
|---|
|  |  |  | //            //大于failureScope.add(maxProbability.multiply(new BigDecimal(100)))这个数字,则中奖 | 
|---|
|  |  |  | //            //获取最新的十条抽奖记录 | 
|---|
|  |  |  | //            List<MallActLuckdrawRecord> records = mallActLuckdrawRecordMapper.selectRecordByMemberIdAndActId(memberId,actId); | 
|---|
|  |  |  | //            if(CollUtil.isNotEmpty(records)){ | 
|---|
|  |  |  | //                //中奖次数 | 
|---|
|  |  |  | //                Integer count = 0; | 
|---|
|  |  |  | //                for(MallActLuckdrawRecord mallActLuckdrawRecord : records){ | 
|---|
|  |  |  | //                    Integer status = mallActLuckdrawRecord.getStatus(); | 
|---|
|  |  |  | //                    if(MallActLuckdrawRecord.STATUS_ENABLE == status){ | 
|---|
|  |  |  | //                        count = count + 1; | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                if(new BigDecimal(count).compareTo(maxProbability.multiply(new BigDecimal(10))) < 0){ | 
|---|
|  |  |  | //                    //获取活动下该类别的奖品 | 
|---|
|  |  |  | //                    List<MallActAwardSet> mallActAwardSets = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId,maxAwardType); | 
|---|
|  |  |  | //                    if(CollUtil.isEmpty(mallActAwardSets)){ | 
|---|
|  |  |  | //                        //抽奖记录 | 
|---|
|  |  |  | //                        MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setActId(actId); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); | 
|---|
|  |  |  | //                        mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                        List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); | 
|---|
|  |  |  | //                        if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ | 
|---|
|  |  |  | //                            apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); | 
|---|
|  |  |  | //                            apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); | 
|---|
|  |  |  | //                        }else{ | 
|---|
|  |  |  | //                            apiMallAwardDetailsVo.setAwardName("未中奖"); | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  | //                    }else{ | 
|---|
|  |  |  | //                        List<MallActAwardSet> idList = new ArrayList(); | 
|---|
|  |  |  | //                        for(MallActAwardSet mallActAwardSet : mallActAwardSets){ | 
|---|
|  |  |  | //                            Integer awardTotal = mallActAwardSet.getAwardTotal(); | 
|---|
|  |  |  | //                            Integer awardCnt = mallActAwardSet.getAwardCnt(); | 
|---|
|  |  |  | //                            if(awardCnt < awardTotal){ | 
|---|
|  |  |  | //                                idList.add(mallActAwardSet); | 
|---|
|  |  |  | //                            } | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  | //                        MallActAwardSet mallActAwardSet = new MallActAwardSet(); | 
|---|
|  |  |  | //                        if(idList.size() <= 1){ | 
|---|
|  |  |  | //                            mallActAwardSet = idList.get(0); | 
|---|
|  |  |  | //                        }else{ | 
|---|
|  |  |  | //                            int randomIdIndex = RandomUtil.randomInt(0, idList.size()-1); | 
|---|
|  |  |  | //                            mallActAwardSet = idList.get(randomIdIndex); | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  | //                        mallActAwardSet.setAwardCnt(mallActAwardSet.getAwardCnt() + 1); | 
|---|
|  |  |  | //                        mallActAwardSetMapper.updateById(mallActAwardSet); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                        MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setActId(actId); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_ENABLE); | 
|---|
|  |  |  | //                        mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                        MallActWinRecord mallActWinRecord = new MallActWinRecord(); | 
|---|
|  |  |  | //                        mallActWinRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                        mallActWinRecord.setActId(actId); | 
|---|
|  |  |  | //                        mallActWinRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                        mallActWinRecord.setAwardId(mallActAwardSet.getId()); | 
|---|
|  |  |  | //                        mallActWinRecord.setAwardName(mallActAwardSet.getAwardName()); | 
|---|
|  |  |  | //                        mallActWinRecord.setAwardType(mallActAwardSet.getAwardType()); | 
|---|
|  |  |  | //                        mallActWinRecord.setAwardValue(mallActAwardSet.getAwardValue()); | 
|---|
|  |  |  | //                        mallActWinRecord.setRecordId(mallActLuckdrawRecord.getId()); | 
|---|
|  |  |  | //                        mallActWinRecordMapper.insert(mallActWinRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardName(mallActAwardSet.getAwardName()); | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardType(mallActAwardSet.getAwardType()); | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardValue(mallActAwardSet.getAwardValue()); | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardImage(mallActAwardSet.getAwardImage()); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                        if(MallActAwardSet.AWARD_TYPE_JF == mallActAwardSet.getAwardType()){ | 
|---|
|  |  |  | //                            prizeScore = prizeScore.add(new BigDecimal(mallActAwardSet.getAwardValue())); | 
|---|
|  |  |  | //                        }else if(MallActAwardSet.AWARD_TYPE_YJ == mallActAwardSet.getAwardType()){ | 
|---|
|  |  |  | //                            commission = commission.add(new BigDecimal(mallActAwardSet.getAwardValue())); | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                }else{ | 
|---|
|  |  |  | //                    //抽奖记录 | 
|---|
|  |  |  | //                    MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActId(actId); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); | 
|---|
|  |  |  | //                    mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); | 
|---|
|  |  |  | //                    if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); | 
|---|
|  |  |  | //                    }else{ | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardName("未中奖"); | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //            }else{ | 
|---|
|  |  |  | //                //获取活动下该类别的奖品 | 
|---|
|  |  |  | //                List<MallActAwardSet> mallActAwardSets = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId,maxAwardType); | 
|---|
|  |  |  | //                if(CollUtil.isEmpty(mallActAwardSets)){ | 
|---|
|  |  |  | //                    //抽奖记录 | 
|---|
|  |  |  | //                    MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActId(actId); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); | 
|---|
|  |  |  | //                    mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); | 
|---|
|  |  |  | //                    if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); | 
|---|
|  |  |  | //                    }else{ | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardName("未中奖"); | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                }else{ | 
|---|
|  |  |  | //                    List<MallActAwardSet> idList = new ArrayList(); | 
|---|
|  |  |  | //                    for(MallActAwardSet mallActAwardSet : mallActAwardSets){ | 
|---|
|  |  |  | //                        Integer awardTotal = mallActAwardSet.getAwardTotal(); | 
|---|
|  |  |  | //                        Integer awardCnt = mallActAwardSet.getAwardCnt(); | 
|---|
|  |  |  | //                        if(awardCnt < awardTotal){ | 
|---|
|  |  |  | //                            idList.add(mallActAwardSet); | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                    MallActAwardSet mallActAwardSet = new MallActAwardSet(); | 
|---|
|  |  |  | //                    if(idList.size() <= 1){ | 
|---|
|  |  |  | //                        mallActAwardSet = idList.get(0); | 
|---|
|  |  |  | //                    }else{ | 
|---|
|  |  |  | //                        int randomIdIndex = RandomUtil.randomInt(0, idList.size()-1); | 
|---|
|  |  |  | //                        mallActAwardSet = idList.get(randomIdIndex); | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                    mallActAwardSet.setAwardCnt(mallActAwardSet.getAwardCnt() + 1); | 
|---|
|  |  |  | //                    mallActAwardSetMapper.updateById(mallActAwardSet); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActId(actId); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_ENABLE); | 
|---|
|  |  |  | //                    mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    MallActWinRecord mallActWinRecord = new MallActWinRecord(); | 
|---|
|  |  |  | //                    mallActWinRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                    mallActWinRecord.setActId(actId); | 
|---|
|  |  |  | //                    mallActWinRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                    mallActWinRecord.setAwardId(mallActAwardSet.getId()); | 
|---|
|  |  |  | //                    mallActWinRecord.setAwardName(mallActAwardSet.getAwardName()); | 
|---|
|  |  |  | //                    mallActWinRecord.setAwardType(mallActAwardSet.getAwardType()); | 
|---|
|  |  |  | //                    mallActWinRecord.setAwardValue(mallActAwardSet.getAwardValue()); | 
|---|
|  |  |  | //                    mallActWinRecord.setRecordId(mallActLuckdrawRecord.getId()); | 
|---|
|  |  |  | //                    mallActWinRecordMapper.insert(mallActWinRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    apiMallAwardDetailsVo.setAwardName(mallActAwardSet.getAwardName()); | 
|---|
|  |  |  | //                    apiMallAwardDetailsVo.setAwardType(mallActAwardSet.getAwardType()); | 
|---|
|  |  |  | //                    apiMallAwardDetailsVo.setAwardValue(mallActAwardSet.getAwardValue()); | 
|---|
|  |  |  | //                    apiMallAwardDetailsVo.setAwardImage(mallActAwardSet.getAwardImage()); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    if(MallActAwardSet.AWARD_TYPE_JF == mallActAwardSet.getAwardType()){ | 
|---|
|  |  |  | //                        prizeScore = prizeScore.add(new BigDecimal(mallActAwardSet.getAwardValue())); | 
|---|
|  |  |  | //                    }else if(MallActAwardSet.AWARD_TYPE_YJ == mallActAwardSet.getAwardType()){ | 
|---|
|  |  |  | //                        commission = commission.add(new BigDecimal(mallActAwardSet.getAwardValue())); | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //        }else{ | 
|---|
|  |  |  | //            //中奖 | 
|---|
|  |  |  | //            //获取最新的十条抽奖记录 | 
|---|
|  |  |  | //            List<MallActLuckdrawRecord> records = mallActLuckdrawRecordMapper.selectRecordByMemberIdAndActId(memberId,actId); | 
|---|
|  |  |  | //            if(CollUtil.isNotEmpty(records)){ | 
|---|
|  |  |  | //                //中奖次数 | 
|---|
|  |  |  | //                Integer count = 0; | 
|---|
|  |  |  | //                for(MallActLuckdrawRecord mallActLuckdrawRecord : records){ | 
|---|
|  |  |  | //                    Integer status = mallActLuckdrawRecord.getStatus(); | 
|---|
|  |  |  | //                    if(MallActLuckdrawRecord.STATUS_ENABLE == status){ | 
|---|
|  |  |  | //                        count = count + 1; | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                if(new BigDecimal(count).compareTo(minProbability.multiply(new BigDecimal(10))) < 0){ | 
|---|
|  |  |  | //                    //获取活动下该类别的奖品 | 
|---|
|  |  |  | //                    List<MallActAwardSet> mallActAwardSets = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId,minAwardType); | 
|---|
|  |  |  | //                    if(CollUtil.isEmpty(mallActAwardSets)){ | 
|---|
|  |  |  | //                        //抽奖记录 | 
|---|
|  |  |  | //                        MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setActId(actId); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); | 
|---|
|  |  |  | //                        mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                        List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); | 
|---|
|  |  |  | //                        if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ | 
|---|
|  |  |  | //                            apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); | 
|---|
|  |  |  | //                            apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); | 
|---|
|  |  |  | //                        }else{ | 
|---|
|  |  |  | //                            apiMallAwardDetailsVo.setAwardName("未中奖"); | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  | //                    }else{ | 
|---|
|  |  |  | //                        List<MallActAwardSet> idList = new ArrayList(); | 
|---|
|  |  |  | //                        for(MallActAwardSet mallActAwardSet : mallActAwardSets){ | 
|---|
|  |  |  | //                            Integer awardTotal = mallActAwardSet.getAwardTotal(); | 
|---|
|  |  |  | //                            Integer awardCnt = mallActAwardSet.getAwardCnt(); | 
|---|
|  |  |  | //                            if(awardCnt < awardTotal){ | 
|---|
|  |  |  | //                                idList.add(mallActAwardSet); | 
|---|
|  |  |  | //                            } | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  | //                        MallActAwardSet mallActAwardSet = new MallActAwardSet(); | 
|---|
|  |  |  | //                        if(idList.size() <= 1){ | 
|---|
|  |  |  | //                            mallActAwardSet = idList.get(0); | 
|---|
|  |  |  | //                        }else{ | 
|---|
|  |  |  | //                            int randomIdIndex = RandomUtil.randomInt(0, idList.size()-1); | 
|---|
|  |  |  | //                            mallActAwardSet = idList.get(randomIdIndex); | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  | //                        mallActAwardSet.setAwardCnt(mallActAwardSet.getAwardCnt() + 1); | 
|---|
|  |  |  | //                        mallActAwardSetMapper.updateById(mallActAwardSet); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                        MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setActId(actId); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); | 
|---|
|  |  |  | //                        mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_ENABLE); | 
|---|
|  |  |  | //                        mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                        MallActWinRecord mallActWinRecord = new MallActWinRecord(); | 
|---|
|  |  |  | //                        mallActWinRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                        mallActWinRecord.setActId(actId); | 
|---|
|  |  |  | //                        mallActWinRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                        mallActWinRecord.setAwardId(mallActAwardSet.getId()); | 
|---|
|  |  |  | //                        mallActWinRecord.setAwardName(mallActAwardSet.getAwardName()); | 
|---|
|  |  |  | //                        mallActWinRecord.setAwardType(mallActAwardSet.getAwardType()); | 
|---|
|  |  |  | //                        mallActWinRecord.setAwardValue(mallActAwardSet.getAwardValue()); | 
|---|
|  |  |  | //                        mallActWinRecord.setRecordId(mallActLuckdrawRecord.getId()); | 
|---|
|  |  |  | //                        mallActWinRecordMapper.insert(mallActWinRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardName(mallActAwardSet.getAwardName()); | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardType(mallActAwardSet.getAwardType()); | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardValue(mallActAwardSet.getAwardValue()); | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardImage(mallActAwardSet.getAwardImage()); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                        if(MallActAwardSet.AWARD_TYPE_JF == mallActAwardSet.getAwardType()){ | 
|---|
|  |  |  | //                            prizeScore = prizeScore.add(new BigDecimal(mallActAwardSet.getAwardValue())); | 
|---|
|  |  |  | //                        }else if(MallActAwardSet.AWARD_TYPE_YJ == mallActAwardSet.getAwardType()){ | 
|---|
|  |  |  | //                            commission = commission.add(new BigDecimal(mallActAwardSet.getAwardValue())); | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                }else{ | 
|---|
|  |  |  | //                    //抽奖记录 | 
|---|
|  |  |  | //                    MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActId(actId); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); | 
|---|
|  |  |  | //                    mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); | 
|---|
|  |  |  | //                    if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); | 
|---|
|  |  |  | //                    }else{ | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardName("未中奖"); | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //            }else{ | 
|---|
|  |  |  | //                //获取活动下该类别的奖品 | 
|---|
|  |  |  | //                List<MallActAwardSet> mallActAwardSets = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId,minAwardType); | 
|---|
|  |  |  | //                if(CollUtil.isEmpty(mallActAwardSets)){ | 
|---|
|  |  |  | //                    //抽奖记录 | 
|---|
|  |  |  | //                    MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActId(actId); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); | 
|---|
|  |  |  | //                    mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); | 
|---|
|  |  |  | //                    if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); | 
|---|
|  |  |  | //                    }else{ | 
|---|
|  |  |  | //                        apiMallAwardDetailsVo.setAwardName("未中奖"); | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                }else{ | 
|---|
|  |  |  | //                    List<MallActAwardSet> idList = new ArrayList(); | 
|---|
|  |  |  | //                    for(MallActAwardSet mallActAwardSet : mallActAwardSets){ | 
|---|
|  |  |  | //                        Integer awardTotal = mallActAwardSet.getAwardTotal(); | 
|---|
|  |  |  | //                        Integer awardCnt = mallActAwardSet.getAwardCnt(); | 
|---|
|  |  |  | //                        if(awardCnt < awardTotal){ | 
|---|
|  |  |  | //                            idList.add(mallActAwardSet); | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                    MallActAwardSet mallActAwardSet = new MallActAwardSet(); | 
|---|
|  |  |  | //                    if(idList.size() <= 1){ | 
|---|
|  |  |  | //                        mallActAwardSet = idList.get(0); | 
|---|
|  |  |  | //                    }else{ | 
|---|
|  |  |  | //                        int randomIdIndex = RandomUtil.randomInt(0, idList.size()-1); | 
|---|
|  |  |  | //                        mallActAwardSet = idList.get(randomIdIndex); | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                    mallActAwardSet.setAwardCnt(mallActAwardSet.getAwardCnt() + 1); | 
|---|
|  |  |  | //                    mallActAwardSetMapper.updateById(mallActAwardSet); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActId(actId); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); | 
|---|
|  |  |  | //                    mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_ENABLE); | 
|---|
|  |  |  | //                    mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    MallActWinRecord mallActWinRecord = new MallActWinRecord(); | 
|---|
|  |  |  | //                    mallActWinRecord.setMemberId(memberId); | 
|---|
|  |  |  | //                    mallActWinRecord.setActId(actId); | 
|---|
|  |  |  | //                    mallActWinRecord.setActName(mallActSet.getActName()); | 
|---|
|  |  |  | //                    mallActWinRecord.setAwardId(mallActAwardSet.getId()); | 
|---|
|  |  |  | //                    mallActWinRecord.setAwardName(mallActAwardSet.getAwardName()); | 
|---|
|  |  |  | //                    mallActWinRecord.setAwardType(mallActAwardSet.getAwardType()); | 
|---|
|  |  |  | //                    mallActWinRecord.setAwardValue(mallActAwardSet.getAwardValue()); | 
|---|
|  |  |  | //                    mallActWinRecord.setRecordId(mallActLuckdrawRecord.getId()); | 
|---|
|  |  |  | //                    mallActWinRecordMapper.insert(mallActWinRecord); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    apiMallAwardDetailsVo.setAwardName(mallActAwardSet.getAwardName()); | 
|---|
|  |  |  | //                    apiMallAwardDetailsVo.setAwardType(mallActAwardSet.getAwardType()); | 
|---|
|  |  |  | //                    apiMallAwardDetailsVo.setAwardValue(mallActAwardSet.getAwardValue()); | 
|---|
|  |  |  | //                    apiMallAwardDetailsVo.setAwardImage(mallActAwardSet.getAwardImage()); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                    if(MallActAwardSet.AWARD_TYPE_JF == mallActAwardSet.getAwardType()){ | 
|---|
|  |  |  | //                        prizeScore = prizeScore.add(new BigDecimal(mallActAwardSet.getAwardValue())); | 
|---|
|  |  |  | //                    }else if(MallActAwardSet.AWARD_TYPE_YJ == mallActAwardSet.getAwardType()){ | 
|---|
|  |  |  | //                        commission = commission.add(new BigDecimal(mallActAwardSet.getAwardValue())); | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        //扣竞猜积分 | 
|---|
|  |  |  | //        prizeScore = prizeScore.subtract(new BigDecimal(actScoreCnt)); | 
|---|
|  |  |  | //        wallet.setPrizeScore(prizeScore); | 
|---|
|  |  |  | //        wallet.setCommission(commission); | 
|---|
|  |  |  | //        mallMemberWalletMapper.updateAmountWithVersion(wallet); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        System.out.println(apiMallAwardDetailsVo); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    @Test | 
|---|
|  |  |  | //    public void agentTest() { | 
|---|
|  |  |  | ////        agentProducer.sendDelayMsg(1L, 10000L); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        ApiMallActWinDetailsDto apiMallActWinDetailsDto = new ApiMallActWinDetailsDto(); | 
|---|
|  |  |  | //        apiMallActWinDetailsDto.setActId(1L); | 
|---|
|  |  |  | //        apiMallActWinDetailsDto.setPageNow(1); | 
|---|
|  |  |  | //        apiMallActWinDetailsDto.setPageSize(10); | 
|---|
|  |  |  | //        Long memberId = 4L; | 
|---|
|  |  |  | //        MallMember mallMember = mallMemberMapper.selectById(memberId); | 
|---|
|  |  |  | //        if(ObjectUtil.isEmpty(mallMember)){ | 
|---|
|  |  |  | //            throw new FebsException("用户不存在"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        apiMallActWinDetailsDto.setMemberId(memberId); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        Long actId = apiMallActWinDetailsDto.getActId(); | 
|---|
|  |  |  | //        MallActSet mallActSet = mallActSetMapper.selectById(actId); | 
|---|
|  |  |  | //        if(ObjectUtil.isEmpty(mallActSet)){ | 
|---|
|  |  |  | //            throw new FebsException("活动不存在"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        Page<ApiMallActWinDetailsVo> page = new Page<>(apiMallActWinDetailsDto.getPageNow(), apiMallActWinDetailsDto.getPageSize()); | 
|---|
|  |  |  | //        IPage<ApiMallActWinDetailsVo> apiMallActWinDetailsVoIPage = mallActWinRecordMapper.selectApiMallActWinDetailsListInPage(apiMallActWinDetailsDto, page); | 
|---|
|  |  |  | //        System.out.println(apiMallActWinDetailsVoIPage); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    @Test | 
|---|
|  |  |  | //    public void insertAgentTest() { | 
|---|
|  |  |  | ////        AgentInfo agentInfo = new AgentInfo(); | 
|---|
|  |  |  | ////        agentInfo.setOrderType(2); | 
|---|
|  |  |  | ////        agentInfo.setOrderCnt(2000); | 
|---|
|  |  |  | ////        agentInfo.setLastCnt(3); | 
|---|
|  |  |  | ////        agentInfo.setDirectIncome(BigDecimal.valueOf(50)); | 
|---|
|  |  |  | ////        agentInfo.setTeamIncome(BigDecimal.valueOf(15)); | 
|---|
|  |  |  | ////        agentInfo.setTeamIncomeType(2); | 
|---|
|  |  |  | //// | 
|---|
|  |  |  | ////        DataDictionaryCustom data = new DataDictionaryCustom(); | 
|---|
|  |  |  | ////        data.setType("AGENT_LEVEL_REQUIRE"); | 
|---|
|  |  |  | ////        data.setCode(AgentLevelEnum.FOUR_LEVEL.name()); | 
|---|
|  |  |  | ////        data.setValue(JSONObject.toJSONString(agentInfo)); | 
|---|
|  |  |  | ////        dataDictionaryCustomMapper.insert(data); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    @Test | 
|---|
|  |  |  | //    public void insertData() { | 
|---|
|  |  |  | //        int i = 1; | 
|---|
|  |  |  | //        for (AgentLevelEnum value : AgentLevelEnum.values()) { | 
|---|
|  |  |  | //            DataDictionaryCustom data = new DataDictionaryCustom(); | 
|---|
|  |  |  | //            data.setType("AGENT_LEVEL"); | 
|---|
|  |  |  | //            data.setDescription(value.getName()); | 
|---|
|  |  |  | //            data.setCode(value.name()); | 
|---|
|  |  |  | //            data.setValue(String.valueOf(i)); | 
|---|
|  |  |  | //            dataDictionaryCustomMapper.insert(data); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    public static void main(String[] args) { | 
|---|
|  |  |  | //        getJson(); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    public static void getJson(){ | 
|---|
|  |  |  | //        AgentLevelUpdateDto adminAgentLevelUpdateInfoVo = new AgentLevelUpdateDto(); | 
|---|
|  |  |  | //        String jsonStr = "{\"directIncome\":50,\"lastCnt\":3,\"orderCnt\":2000,\"orderType\":2,\"teamIncome\":15,\"teamIncomeType\":2}"; | 
|---|
|  |  |  | //        JSONObject jsonObject = JSONObject.parseObject(jsonStr); | 
|---|
|  |  |  | //        adminAgentLevelUpdateInfoVo.setDirectIncome(new BigDecimal((jsonObject.get("directIncome")==null?0:jsonObject.get("directIncome")).toString())); | 
|---|
|  |  |  | //        adminAgentLevelUpdateInfoVo.setLastCnt(Integer.parseInt((jsonObject.get("lastCnt")==null?0:jsonObject.get("lastCnt")).toString())); | 
|---|
|  |  |  | //        adminAgentLevelUpdateInfoVo.setOrderCnt(Integer.parseInt((jsonObject.get("orderCnt")==null?0:jsonObject.get("orderCnt")).toString())); | 
|---|
|  |  |  | //        adminAgentLevelUpdateInfoVo.setOrderType(Integer.parseInt(jsonObject.get("orderType").toString())); | 
|---|
|  |  |  | //        adminAgentLevelUpdateInfoVo.setTeamIncome(new BigDecimal((jsonObject.get("teamIncome")==null?0:jsonObject.get("teamIncome")).toString())); | 
|---|
|  |  |  | //        adminAgentLevelUpdateInfoVo.setTeamIncomeType(Integer.parseInt(jsonObject.get("orderType").toString())); | 
|---|
|  |  |  | //        adminAgentLevelUpdateInfoVo.setId(14L); | 
|---|
|  |  |  | //        AgentLevelUpdateDto agentLevelUpdateDtoJson = new AgentLevelUpdateDto(); | 
|---|
|  |  |  | //        agentLevelUpdateDtoJson.setDirectIncome(adminAgentLevelUpdateInfoVo.getDirectIncome()); | 
|---|
|  |  |  | //        agentLevelUpdateDtoJson.setLastCnt(adminAgentLevelUpdateInfoVo.getLastCnt()); | 
|---|
|  |  |  | //        agentLevelUpdateDtoJson.setOrderCnt(adminAgentLevelUpdateInfoVo.getOrderCnt()); | 
|---|
|  |  |  | //        agentLevelUpdateDtoJson.setTeamIncome(adminAgentLevelUpdateInfoVo.getTeamIncome()); | 
|---|
|  |  |  | //        agentLevelUpdateDtoJson.setOrderType(adminAgentLevelUpdateInfoVo.getOrderType()); | 
|---|
|  |  |  | //        agentLevelUpdateDtoJson.setTeamIncomeType(adminAgentLevelUpdateInfoVo.getTeamIncomeType()); | 
|---|
|  |  |  | //        JSONObject jsonObjectA = (JSONObject)JSONObject.toJSON(agentLevelUpdateDtoJson); | 
|---|
|  |  |  | //        System.out.println(jsonObjectA.toJSONString()); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    @Test | 
|---|
|  |  |  | //    public void autoLevelUp() { | 
|---|
|  |  |  | //        // agentService.autoUpAgentLevel(3L); | 
|---|
|  |  |  | ////        agentProducer.sendAutoLevelUpMsg(5L); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        agentProducer.sendReturnMoneyMsg(2L); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    @Test | 
|---|
|  |  |  | //    public void returnMoney() { | 
|---|
|  |  |  | //        // agentService.autoUpAgentLevel(3L); | 
|---|
|  |  |  | ////        agentProducer.sendAutoLevelUpMsg(5L); | 
|---|
|  |  |  | ////        agentProducer.sendReturnMoneyMsg(52L); | 
|---|
|  |  |  | //        agentService.returnMoneyToAgent(52L); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    @Test | 
|---|
|  |  |  | //    public void bigdecimalTest() { | 
|---|
|  |  |  | //        BigDecimal aa = new BigDecimal("1.345"); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        System.out.println(aa.setScale(2, RoundingMode.DOWN)); | 
|---|
|  |  |  | //        System.out.println(aa.setScale(2, RoundingMode.UP)); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    @Autowired | 
|---|
|  |  |  | //    private ProfitJob profitJob; | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    @Test | 
|---|
|  |  |  | //    public void profitJobTest() { | 
|---|
|  |  |  | //        profitJob.profitJob(); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    @Autowired | 
|---|
|  |  |  | //    private AgentConsumer agentConsumer; | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    @Test | 
|---|
|  |  |  | //    public void orderReturnTest() { | 
|---|
|  |  |  | //        agentConsumer.orderReturnMoney("7"); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | } | 
|---|