GroupLocalController.java 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. package com.tzy.controller.group;
  2. import com.alibaba.fastjson.JSON;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.github.pagehelper.PageInfo;
  5. import com.google.common.collect.Lists;
  6. import com.tzy.annotation.ApiLog;
  7. import com.tzy.app.domain.AppBaseUser;
  8. import com.tzy.app.domain.AppUserDetailInfo;
  9. import com.tzy.app.domain.order.OrderListDTO;
  10. import com.tzy.app.dto.mq.GoodsListDTO;
  11. import com.tzy.app.service.AppUserDetailInfoService;
  12. import com.tzy.app.service.IAppBaseUserService;
  13. import com.tzy.common.constant.Constants;
  14. import com.tzy.common.constant.MsgConstants;
  15. import com.tzy.common.constant.NoticeMsgModel;
  16. import com.tzy.common.core.domain.AjaxResult;
  17. import com.tzy.common.dto.InDto;
  18. import com.tzy.common.dto.OutDTO;
  19. import com.tzy.common.dto.UserInfo;
  20. import com.tzy.common.dto.order.OrderStatusDTO;
  21. import com.tzy.common.enums.BusinessType;
  22. import com.tzy.common.exception.AppAssert;
  23. import com.tzy.common.exception.ServiceException;
  24. import com.tzy.common.utils.DateUtils;
  25. import com.tzy.common.utils.ServletUtils;
  26. import com.tzy.common.utils.UserUtils;
  27. import com.tzy.dto.AuctionJPushDTO;
  28. import com.tzy.dto.local.*;
  29. import com.tzy.framework.util.RedisUtils;
  30. import com.tzy.member.benefits.dto.OrderSubmitDTO;
  31. import com.tzy.pojo.card.CardGroupOrderInfo;
  32. import com.tzy.pojo.item.Sku;
  33. import com.tzy.service.SkuService;
  34. import com.tzy.sportcard.api.bean.act.AppActPrize;
  35. import com.tzy.sportcard.api.domain.AppUserInfoDto;
  36. import com.tzy.sportcard.api.domain.GroupInfo;
  37. import com.tzy.sportcard.api.domain.MerchantInfo;
  38. import com.tzy.sportcard.api.dto.AuctionOrderDTO;
  39. import com.tzy.sportcard.api.dto.LiveDTO;
  40. import com.tzy.sportcard.api.dto.ResourceData;
  41. import com.tzy.sportcard.api.dto.group.GroupStatusInfoDto;
  42. import com.tzy.sportcard.api.dto.group.ProductPromGroupInfoDto;
  43. import com.tzy.sportcard.api.dto.merchant.MerchantScoreDTO;
  44. import com.tzy.sportcard.api.dto.prize.PublicCodeParam;
  45. import com.tzy.sportcard.api.dto.prize.PublicCodeResultDTO;
  46. import com.tzy.sportcard.api.service.*;
  47. import com.tzy.sportcard.group.domain.CardGroupLivesConfig;
  48. import com.tzy.sportcard.group.dto.MerchantAvatarsDTO;
  49. import com.tzy.sportcard.group.dto.OrderCallBackDTO;
  50. import com.tzy.sportcard.group.mapper.CardGroupLivesConfigMapper;
  51. import com.tzy.sportcard.group.service.AppActService;
  52. import com.tzy.sportcard.group.service.ICardGroupInfoService;
  53. import com.tzy.sportcard.group.service.ICardGroupOrderInfoService;
  54. import com.tzy.sportcard.group.service.ITzyMerchantInfoService;
  55. import com.tzy.system.domain.TzyShippingAddress;
  56. import com.tzy.system.domain.TzySysNoticeRecord;
  57. import com.tzy.system.mapper.TzyShippingAddressMapper;
  58. import com.tzy.system.service.ITzySysNoticeRecordService;
  59. import com.tzy.util.NoticeType;
  60. import io.swagger.annotations.Api;
  61. import io.swagger.annotations.ApiOperation;
  62. import lombok.extern.slf4j.Slf4j;
  63. import org.apache.commons.lang3.StringUtils;
  64. import org.elasticsearch.common.Strings;
  65. import org.springframework.beans.factory.annotation.Autowired;
  66. import org.springframework.util.CollectionUtils;
  67. import org.springframework.util.DigestUtils;
  68. import org.springframework.web.bind.annotation.*;
  69. import org.teasoft.bee.osql.SuidRich;
  70. import javax.annotation.Resource;
  71. import java.math.BigDecimal;
  72. import java.util.*;
  73. import java.util.stream.Collectors;
  74. /**
  75. * @author by po'yi
  76. * @Classname GroupControllerNew
  77. * @Description
  78. * @Date 2022/11/24 13:24
  79. */
  80. @Api(value = "内网访问组团新接口")
  81. @RestController
  82. @RequestMapping("/api/local")
  83. @Slf4j
  84. public class GroupLocalController {
  85. @Autowired
  86. private SuidRich suidRich;
  87. @Resource
  88. private IAllocateGoodsService allocateGoodsService;
  89. @Autowired
  90. private AppActService appActService;
  91. @Autowired
  92. private AsyncAppService asyncAppService;
  93. @Autowired
  94. private RedisUtils redisUtils;
  95. @Resource
  96. private MineApiService mineApiService;
  97. @Resource
  98. private AuctionOrderService auctionOrderService;
  99. @Resource
  100. private ITzySysNoticeRecordService noticeRecordService;
  101. @Resource
  102. private IAppBaseUserService appBaseUserService;
  103. @Resource
  104. private CardGroupLivesConfigMapper cardGroupLivesConfigMapper;
  105. @Autowired
  106. private GroupApiService groupApiService;
  107. @Autowired
  108. private SkuService skuService;
  109. @Autowired
  110. private TzyShippingAddressMapper tzyShippingAddressMapper;
  111. @Resource
  112. private ICardGroupOrderInfoService cardGroupOrderInfoService;
  113. @Resource
  114. private ITzyMerchantInfoService tzyMerchantInfoService;
  115. @Autowired
  116. private MerchantApiService merchantApiService;
  117. @Resource
  118. private ICardGroupInfoService cardGroupInfoService;
  119. @Resource
  120. private AppUserDetailInfoService appUserDetailInfoService;
  121. private ResourceData freePayBuild(String orderNo, String payType) {
  122. ResourceData resourceData = new ResourceData();
  123. ResourceData.PayAmount payAmount = new ResourceData.PayAmount();
  124. payAmount.setTotal(0);
  125. payAmount.setPayer_total(0);
  126. resourceData.setAmount(payAmount);
  127. resourceData.setTrade_type(payType);
  128. resourceData.setSubPaymentType(payType);
  129. resourceData.setBank_type(payType);
  130. resourceData.setOut_trade_no(orderNo);
  131. resourceData.setTransaction_id(String.valueOf(System.currentTimeMillis()));
  132. resourceData.setSuccess_time(DateUtils.dateTime(new Date()));
  133. resourceData.setTrade_state("TRADE_SUCCESS");
  134. resourceData.setTrade_state_desc("TRADE_SUCCESS");
  135. return resourceData;
  136. }
  137. @PostMapping("/get/address/{userId}")
  138. public ResultDTO address(@PathVariable Long userId) {
  139. List<TzyShippingAddress> list = tzyShippingAddressMapper.findFirstAddressByUserId(userId);
  140. return ResultDTO.buildSuccessResult(AddressDTO.builder().address(!CollectionUtils.isEmpty(list)).build());
  141. }
  142. @PostMapping("/get/explain/{liveId}")
  143. public ResultDTO getLivingExplain(@PathVariable Long liveId) {
  144. LivingExplainDTO livingExplainDTO =
  145. suidRich.selectOne(LivingExplainDTO.builder().liveId(liveId).status(1).build());
  146. return ResultDTO.buildSuccessResult(livingExplainDTO);
  147. }
  148. @PostMapping("/close/explain/{liveId}")
  149. public ResultDTO closeLivingExplain(@PathVariable Long liveId) {
  150. LivingExplainDTO livingExplainDTO =
  151. suidRich.selectOne(LivingExplainDTO.builder().liveId(liveId).status(1).build());
  152. if (Objects.nonNull(livingExplainDTO)) {
  153. suidRich.update(LivingExplainDTO.builder().id(livingExplainDTO.getId()).status(2).build());
  154. }
  155. return ResultDTO.buildEmptySuccess();
  156. }
  157. @PostMapping("/get/sku/{skuId}")
  158. public ResultDTO getSku(@PathVariable Integer skuId) {
  159. Sku sku = skuService.selectSkuByIdAndStatus(skuId, 101L);
  160. return ResultDTO.buildSuccessResult(sku);
  161. }
  162. @PostMapping("/get/live/{liveId}")
  163. public ResultDTO findLive(@PathVariable Long liveId) {
  164. CardGroupLivesConfig config = cardGroupLivesConfigMapper.selectCardGroupLivesConfigById(liveId);
  165. return ResultDTO.buildSuccessResult(config);
  166. }
  167. @PostMapping("/get/live/list")
  168. public ResultDTO findLive(@RequestBody LiveDTO liveDTO) {
  169. List<CardGroupLivesConfig> list = Lists.newArrayList();
  170. for (Long liveId : liveDTO.getIds()) {
  171. CardGroupLivesConfig config = cardGroupLivesConfigMapper.selectCardGroupLivesConfigById(liveId);
  172. if (Objects.nonNull(config)) {
  173. if (!Objects.equals(config.getStatus(), 0L) && !Objects.equals(config.getStatus(), 1L)) {
  174. list.add(config);
  175. }
  176. }
  177. }
  178. return ResultDTO.buildSuccessResult(list);
  179. }
  180. @ApiOperation("竞价下单")
  181. @PostMapping("/order/submit")
  182. public ResultDTO orderSubmit(@RequestBody AuctionOrderDTO auctionOrderDTO){
  183. OrderSubmitDTO orderSubmitDTO = auctionOrderService.generateOrder(auctionOrderDTO);
  184. return ResultDTO.buildSuccessResult(orderSubmitDTO);
  185. }
  186. @ApiOperation("竞价订单回调")
  187. @PostMapping("/order/callback")
  188. public ResultDTO orderCallBack(@RequestBody AuctionOrderDTO auctionOrderDTO){
  189. List<OrderCallBackDTO> result = auctionOrderService.orderCallBack(auctionOrderDTO.getOrderIds());
  190. return ResultDTO.buildSuccessResult(result);
  191. }
  192. @ApiOperation("竞价发放奖品优惠券")
  193. @PostMapping("/send/coupon")
  194. public ResultDTO sendCoupon(@RequestBody AuctionOrderDTO auctionOrderDTO){
  195. auctionOrderService.sendCoupon(auctionOrderDTO);
  196. return ResultDTO.buildEmptySuccess();
  197. }
  198. @ApiOperation("发送站内信")
  199. @PostMapping("/send/notice")
  200. public ResultDTO sendNotice(@RequestBody TzySysNoticeRecord noticeRecord){
  201. noticeRecord.setFromUser("HOBBY STOCKS");
  202. noticeRecord.setType(NoticeType.ACT);
  203. int rs = noticeRecordService.insertTzySysNoticeRecord(noticeRecord);
  204. if(rs == 0){
  205. return ResultDTO.build500Error("竞价发送站内信失败:" + noticeRecord.getToUserid());
  206. }
  207. return ResultDTO.buildEmptySuccess();
  208. }
  209. @ApiOperation("发送极光推送")
  210. @PostMapping("/send/jPush")
  211. public ResultDTO jPush(@RequestBody AuctionJPushDTO auctionJPushDTO) {
  212. List<String> smsRegisterList = mineApiService.searchUserInfoByIds(auctionJPushDTO.getUserIds()).stream()
  213. .filter(appUserInfoDto -> Objects.nonNull(appUserInfoDto) && !StringUtils.isEmpty(appUserInfoDto.getSmsRegisterId()))
  214. .map(AppUserInfoDto::getSmsRegisterId)
  215. .distinct()
  216. .collect(Collectors.toList());
  217. Map<String, String> extrasMap = new HashMap<>();
  218. extrasMap.put("url", auctionJPushDTO.getUrl());
  219. asyncAppService.jpush(19, Constants.JPUSH_TYPE_ID, smsRegisterList, auctionJPushDTO.getParams(), extrasMap);
  220. return ResultDTO.buildEmptySuccess();
  221. }
  222. @ApiOperation("竞价积分变更")
  223. @PostMapping("/change/point")
  224. public ResultDTO changePoint(@RequestBody UserPointDTO userPointDTO){
  225. if (userPointDTO == null || userPointDTO.getPointRecords() == null) {
  226. return ResultDTO.build500Error("参数为空");
  227. }
  228. userPointDTO.getPointRecords().forEach(record ->{
  229. Long point = record.getChangePoint();
  230. if(point < 0){
  231. AppBaseUser appBaseUser = appBaseUserService.selectAppBaseUserById(userPointDTO.getUserId().longValue());
  232. if(appBaseUser == null) {
  233. throw new ServiceException("用户不存在");
  234. }
  235. // 负数,检查积分是否足够
  236. long pointsToDeduct = Math.abs(point); // 获取要扣除的积分值
  237. if(appBaseUser.getPoint() < pointsToDeduct){
  238. throw new ServiceException("积分不足");
  239. }
  240. }
  241. record.setType(Constants.POINT_TYPE_COMMON)
  242. .setChangePoint(record.getChangePoint())
  243. .setUserId(userPointDTO.getUserId().longValue())
  244. .setOrderId(record.getOrderId())
  245. .setOrderNo("抢拍活动")
  246. .setRefId(record.getRefId())
  247. .setCreateTime(new Date());
  248. });
  249. mineApiService.addPointsOfUser(userPointDTO.getUserId(), userPointDTO.getPointRecords());
  250. return ResultDTO.buildEmptySuccess();
  251. }
  252. @ResponseBody
  253. @GetMapping(value = "/group/info/{id}")
  254. //@ApiVersion(1.0)
  255. @ApiOperation("获取组队信息")
  256. public CardGroupInfoDTO getGroupInfo(@PathVariable("id") Long id) {
  257. CardGroupInfoDTO info=new CardGroupInfoDTO();
  258. info.setId(id);
  259. return suidRich.selectOne(info);
  260. }
  261. @ResponseBody
  262. @GetMapping(value = "/order/detail/{id}")
  263. //@ApiVersion(1.0)
  264. @ApiOperation("获取组队信息")
  265. public OrderDTO getOrderDetail(@PathVariable("id") Long id) {
  266. OrderDTO order=new OrderDTO();
  267. order.setId(id);
  268. order=suidRich.selectOne(order);
  269. OrderListDTO condition=new OrderListDTO();
  270. condition.setOrderId(id);
  271. List<OrderListDTO> orderLists = suidRich.select(condition);
  272. if(!orderLists.isEmpty()){
  273. List<GoodsListDTO> list = orderLists.stream().filter(ol -> ol.getStatus()==100||ol.getStatus()==101)
  274. .map(ol -> new GoodsListDTO(ol.getQty(), ol.getSkuId(), ol.getSkuName())).collect(Collectors.toList());
  275. order.setGoodsListDTOS(list);
  276. }
  277. return order;
  278. }
  279. @ResponseBody
  280. //@PostMapping(value = "/order/allocate/callback")
  281. //@ApiVersion(1.0)
  282. @ApiOperation("卡密分配后回调")
  283. public ResultDTO orderAllocateCallBack(@RequestBody AllocateResult result) {
  284. if(result.getOrderId()==null){
  285. return ResultDTO.buildErrorResult("参数缺失");
  286. }
  287. CardGroupOrderInfo order = new CardGroupOrderInfo();
  288. order.setId(result.getOrderId());
  289. CardGroupOrderInfo existOrder = suidRich.selectOne(order);
  290. if(existOrder == null){
  291. return ResultDTO.buildErrorResult("订单不存在");
  292. }
  293. order.setGoodsAllocate(1);
  294. order.setProp2(result.getGuessCount()>0?result.getGuessCount().toString():"0");
  295. order.setProp3(result.getMissCardCount()>0?result.getMissCardCount().toString():"0");
  296. order.setUpdateTime(DateUtils.getTimestampNow());
  297. suidRich.update(order);
  298. allocateGoodsService.aftAllocateOrderGoods(existOrder.getGroupInfoId());
  299. return ResultDTO.buildEmptySuccess();
  300. }
  301. @ResponseBody
  302. @GetMapping(value = "/public/{actId}")
  303. @ApiOperation("公布抽奖码")
  304. public ResultDTO publicActCode(@PathVariable("actId") Integer actId, @RequestParam String code) {
  305. String key="app_lucky_public_code_"+actId;
  306. if(redisUtils.hasKey(key)){
  307. return ResultDTO.buildErrorResult("短时间内请勿重复请求!");
  308. }
  309. log.info("接收到抽奖结果公布回调:活动id:{},code:{}",actId,code);
  310. redisUtils.set(key,1,60);
  311. List<PublicCodeResultDTO> resultDTOs = appActService.publicActCode(new PublicCodeParam(actId, code, null));
  312. for (PublicCodeResultDTO resultDTO : resultDTOs) {
  313. appActService.sendWinCodesPrize(resultDTO.getWinCodes(),resultDTO.getPrize());
  314. String failMsg=String.format(NoticeMsgModel.LUCKY_ACT_FAIL_NOTICE, resultDTO.getPrize().getName());
  315. //禁用发放默认奖品功能
  316. // if(StringUtils.isNotEmpty(resultDTO.getDefaultPrizeConfig())){
  317. // JSONObject prizeJson = JSON.parseObject(resultDTO.getDefaultPrizeConfig());
  318. // failMsg=String.format(NoticeMsgModel.LUCKY_ACT_DEFAULT_PRIZE_NOTICE, resultDTO.getPrize().getName(),prizeJson.getString("name"));
  319. // Integer prizeId = prizeJson.getInteger("prizeId");
  320. // appActService.sendActDefaultCoupon(actId,prizeId);
  321. // }
  322. asyncAppService.noticeActUser(actId,2,failMsg, "活动揭晓记录",resultDTO.getActType());
  323. }
  324. redisUtils.del(key);
  325. return ResultDTO.buildEmptySuccess();
  326. }
  327. @ApiLog(title = "重新申请抽奖码", businessType = BusinessType.SEARCH)
  328. @ResponseBody
  329. @PostMapping(value = "/luck/code/repeat/{userId}/{prizeRecordId}")
  330. //@ApiVersion(1.0)
  331. @ApiOperation("重新申请抽奖码")
  332. public OutDTO repeat(@PathVariable("userId") Integer userId,@PathVariable("prizeRecordId") Integer prizeRecordId) {
  333. if (prizeRecordId == null || userId == null) {
  334. return OutDTO.error500("参数未传!");
  335. }
  336. appActService.checkLuckyCode(prizeRecordId, userId);
  337. return OutDTO.ok();
  338. }
  339. @ResponseBody
  340. @GetMapping(value = "/group/living/check/{id}")
  341. @ApiOperation("拼团是否允许直播")
  342. public ResultDTO allowedStartGroupLive(@PathVariable("id") Integer groupInfoId) {
  343. GroupInfo groupInfo = groupApiService.getGroupInfoById(groupInfoId);
  344. AppAssert.notNull(groupInfo, "拼团不存在!");
  345. return ResultDTO.buildSuccessResult(groupApiService.allowedStartGroupLive(groupInfo));
  346. }
  347. @PostMapping("/merchant/avatars")
  348. @ApiOperation("官网商家头像")
  349. public ResultDTO getMerchantAvatars(@RequestBody MerchantAvatarsDTO merchantAvatars){
  350. PageInfo<String> avatars = tzyMerchantInfoService.getAvatars(merchantAvatars);
  351. return ResultDTO.buildSuccessResult(avatars);
  352. }
  353. // /**
  354. // * 根据id集合查询拼团信息
  355. // */
  356. // @ResponseBody
  357. // @GetMapping(value = "/groupInfoByIds")
  358. // @ApiOperation("根据id集合查询拼团信息")
  359. // public ResultDTO getGroupInfoByIds(@RequestParam("ids") String ids) {
  360. // List<Integer> groupInfoIds = Arrays.stream(ids.split(",")).map(Integer::parseInt).collect(Collectors.toList());
  361. // List<ProductPromGroupInfoDto> groupInfos = groupApiService.getGroupInfosByIds(groupInfoIds);
  362. // return ResultDTO.buildSuccessResult(groupInfos);
  363. // }
  364. /**
  365. * 获取店铺基本信息
  366. *
  367. * @return
  368. */
  369. @ApiLog(title = "根据id获取店铺基本信息", businessType = BusinessType.SEARCH, indto = "{{inDto}}")
  370. @ResponseBody
  371. @RequestMapping(value = "/getMerchantInfoByID", method = RequestMethod.POST)
  372. public OutDTO getMerchantBasicInfoByID(@RequestBody InDto inDto) {
  373. if (null == inDto) {
  374. return OutDTO.error(10000, "参数不能为空");
  375. }
  376. Object idObj = inDto.get("id");
  377. if (null == idObj) {
  378. return OutDTO.error(10010, "参数[id]不能为空");
  379. }
  380. int targetMerId = Integer.parseInt(idObj.toString());
  381. //查询商家信息
  382. MerchantInfo merchantInfo = merchantApiService.getMerchantInfo(targetMerId);
  383. if (null == merchantInfo) {
  384. return OutDTO.error500("商家不存在");
  385. }
  386. return OutDTO.ok()
  387. .put("merchantInfo", merchantInfo);
  388. }
  389. /**
  390. * 根据id集合查询拼团状态信息
  391. */
  392. @ResponseBody
  393. @PostMapping(value = "/groupInfoStatus")
  394. @ApiOperation("根据id集合查询拼团信息")
  395. public ResultDTO getGroupInfoStatus(@RequestBody List<Integer> editGroupIds) {
  396. if (editGroupIds == null || editGroupIds.isEmpty()) {
  397. return ResultDTO.buildErrorResult("参数为空!");
  398. }
  399. if (editGroupIds.size()>30) {
  400. return ResultDTO.buildErrorResult("最多只能查询30条!");
  401. }
  402. List<GroupStatusInfoDto> groupInfos = groupApiService.getGroupStatusByIds(editGroupIds);
  403. return ResultDTO.buildSuccessResult(groupInfos);
  404. }
  405. /**
  406. * 统计打款信息
  407. */
  408. @ResponseBody
  409. @PostMapping(value = "/generateGroupPaymentRecord")
  410. @ApiOperation("统计打款信息")
  411. public ResultDTO generateGroupClosePaymentRecord(@RequestBody Integer groupIds) {
  412. if (groupIds == null) {
  413. return ResultDTO.buildErrorResult("参数为空!");
  414. }
  415. cardGroupInfoService.checkAllActClosePaymentInfosWithoutChannel(groupIds);
  416. return ResultDTO.buildSuccessResult("success");
  417. }
  418. /**
  419. * 根据id集合查询拼团状态信息
  420. */
  421. @ResponseBody
  422. @PostMapping(value = "/orderInfoStatus")
  423. @ApiOperation("根据id集合查询拼团信息")
  424. public ResultDTO getGroupOrderInfoStatus(@RequestBody List<Long> orderIds) {
  425. if (orderIds == null || orderIds.isEmpty()) {
  426. return ResultDTO.buildErrorResult("参数为空!");
  427. }
  428. if (orderIds.size()>30) {
  429. return ResultDTO.buildErrorResult("最多只能查询30条!");
  430. }
  431. List<OrderStatusDTO> groupInfos = cardGroupOrderInfoService.getOrderInfoStatus(orderIds);
  432. return ResultDTO.buildSuccessResult(groupInfos);
  433. }
  434. @ApiLog(title = "更新个人资料",businessType = BusinessType.SEARCH,indto = "{{inDto}}")
  435. @ResponseBody
  436. @PostMapping(value = "/user/inviteCode")
  437. public ResultDTO getInviteCode(@RequestBody List<Long> userIds) {
  438. if (userIds == null || userIds.isEmpty()) {
  439. return ResultDTO.buildErrorResult("参数为空!");
  440. }
  441. if (userIds.size()>100) {
  442. return ResultDTO.buildErrorResult("最多只能查询100条!");
  443. }
  444. //循环用户信息
  445. for (Long userId : userIds) {
  446. appUserDetailInfoService.getByUserId(userId.intValue());
  447. }
  448. return ResultDTO.buildSuccessResult(userIds.size());
  449. }
  450. @ResponseBody
  451. @GetMapping("/guess/prize/{teamId}")
  452. @ApiOperation("竞猜活动中奖用户自动参与区块链")
  453. public ResultDTO guessPrize(@PathVariable("teamId")Long teamId){
  454. try {
  455. appActService.guessSendPrize(teamId);
  456. } catch (Exception e) {
  457. e.printStackTrace();
  458. return ResultDTO.build500Error(e.getLocalizedMessage());
  459. }
  460. return ResultDTO.buildEmptySuccess();
  461. }
  462. }