记得上下班打卡 | git大法好,push需谨慎

Commit 9d0068eb authored by 胡佳晨's avatar 胡佳晨

Merge branch 'master' into dev_change_times

parents d525157a c58e0b46
...@@ -8,6 +8,7 @@ import io.swagger.annotations.Api; ...@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -26,6 +27,7 @@ import java.util.List; ...@@ -26,6 +27,7 @@ import java.util.List;
@Api(tags = "前端-banner") @Api(tags = "前端-banner")
@RestController @RestController
@RequestMapping("banners") @RequestMapping("banners")
@Slf4j
public class KylinBannersController { public class KylinBannersController {
@Autowired @Autowired
...@@ -45,6 +47,7 @@ public class KylinBannersController { ...@@ -45,6 +47,7 @@ public class KylinBannersController {
List<KylinBanners> result = bannersServiceImpl.blist(position, provinceName); List<KylinBanners> result = bannersServiceImpl.blist(position, provinceName);
return ResponseDto.success(result); return ResponseDto.success(result);
} catch (Exception e) { } catch (Exception e) {
log.error("banner列表Error", e);
return ResponseDto.success(new ArrayList<>()); return ResponseDto.success(new ArrayList<>());
} }
} }
......
package com.liquidnet.service.kylin.controller; package com.liquidnet.service.kylin.controller;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.base.ErrorMapping; import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo; import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
...@@ -11,9 +13,12 @@ import io.swagger.annotations.Api; ...@@ -11,9 +13,12 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.juli.logging.Log;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -28,6 +33,7 @@ import java.util.List; ...@@ -28,6 +33,7 @@ import java.util.List;
@Api(tags = "前端-演出") @Api(tags = "前端-演出")
@RestController @RestController
@RequestMapping("performance") @RequestMapping("performance")
@Slf4j
public class KylinPerformancesController { public class KylinPerformancesController {
@Autowired @Autowired
...@@ -115,8 +121,12 @@ public class KylinPerformancesController { ...@@ -115,8 +121,12 @@ public class KylinPerformancesController {
@ApiImplicitParam(type = "query", dataType = "String", name = "cityName", value = "城市名称", required = true) @ApiImplicitParam(type = "query", dataType = "String", name = "cityName", value = "城市名称", required = true)
}) })
public ResponseDto<List> performanceCalendar(@RequestParam String yearMonth, @RequestParam String cityName) { public ResponseDto<List> performanceCalendar(@RequestParam String yearMonth, @RequestParam String cityName) {
List result = null; List result = CollectionUtil.arrayListString();
result = kylinPerformancesService.performanceCalendar(yearMonth, cityName); try {
result = kylinPerformancesService.performanceCalendar(yearMonth, cityName);
} catch (Exception e) {
log.error("kylinCalendarError", e);
}
return ResponseDto.success(result); return ResponseDto.success(result);
} }
...@@ -154,10 +164,15 @@ public class KylinPerformancesController { ...@@ -154,10 +164,15 @@ public class KylinPerformancesController {
@RequestParam(defaultValue = "0") double longitudeFrom, @RequestParam(defaultValue = "0") double longitudeFrom,
@RequestParam(defaultValue = "0") String agentId @RequestParam(defaultValue = "0") String agentId
) { ) {
KylinPerformanceVo result = kylinPerformancesService.detail(performancesId, latitudeFrom, longitudeFrom, agentId); try {
if (result != null) { KylinPerformanceVo result = kylinPerformancesService.detail(performancesId, latitudeFrom, longitudeFrom, agentId);
return ResponseDto.success(result); if (result != null) {
} else { return ResponseDto.success(result);
} else {
return ResponseDto.failure(ErrorMapping.get("20700"));
}
} catch (Exception e) {
log.error("演出详情Error", e);
return ResponseDto.failure(ErrorMapping.get("20700")); return ResponseDto.failure(ErrorMapping.get("20700"));
} }
} }
......
...@@ -245,7 +245,13 @@ public class KylinPerformancesServiceImpl implements IKylinPerformancesService { ...@@ -245,7 +245,13 @@ public class KylinPerformancesServiceImpl implements IKylinPerformancesService {
List<KylinPerformanceVo> performancesList = dataUtils.getPerformancesListOfcityName(cityName); List<KylinPerformanceVo> performancesList = dataUtils.getPerformancesListOfcityName(cityName);
// 获取此月开始结束时间 // 获取此月开始结束时间
String monthStart = DateUtil.getMonthFirst(yearMonth); String[] split = yearMonth.split("-");
String monthStart = "";
if (split.length > 2) {
monthStart = DateUtil.getMonthFirst(split[0].concat("-").concat(split[1]));
} else {
monthStart = DateUtil.getMonthFirst(yearMonth);
}
String monthEnd = ""; String monthEnd = "";
monthEnd = DateUtil.getMonthLast(monthStart); monthEnd = DateUtil.getMonthLast(monthStart);
......
...@@ -15,6 +15,7 @@ public class SweetConstant { ...@@ -15,6 +15,7 @@ public class SweetConstant {
public final static String REDIS_KEY_SWEET_SHOP = "sweet:artists:shop:manual:"; public final static String REDIS_KEY_SWEET_SHOP = "sweet:artists:shop:manual:";
public final static String REDIS_KEY_SWEET_LUCK_DRAW = "sweet:luckDraw:mobile:"; public final static String REDIS_KEY_SWEET_LUCK_DRAW = "sweet:luckDraw:mobile:";
public final static String REDIS_KEY_SWEET_LUCK_DRAW_RESULT = "sweet:luckDraw:num:";
public final static String REDIS_KEY_SWEET_LUCK_DRAW_SURPLUS = "sweet:luckDraw:num:";//中奖库存 public final static String REDIS_KEY_SWEET_LUCK_DRAW_SURPLUS = "sweet:luckDraw:num:";//中奖库存
public final static String REDIS_KEY_SWEET_LUCK_DRAW_ALL = "sweet:luckDraw:num:";//中奖总量 public final static String REDIS_KEY_SWEET_LUCK_DRAW_ALL = "sweet:luckDraw:num:";//中奖总量
public final static String REDIS_KEY_SWEET_LUCK_DRAW_PRESENT_MOBILE = "sweet:luckDraw:present:mobile:";//中奖库存 public final static String REDIS_KEY_SWEET_LUCK_DRAW_PRESENT_MOBILE = "sweet:luckDraw:present:mobile:";//中奖库存
......
...@@ -336,6 +336,7 @@ public class SweetAppletController { ...@@ -336,6 +336,7 @@ public class SweetAppletController {
HashMap<String, Integer> hashMap = CollectionUtil.mapStringInteger(); HashMap<String, Integer> hashMap = CollectionUtil.mapStringInteger();
hashMap.put("count", redisDataUtils.getLuckDrawStatus(mobile, luckDrawNum)); hashMap.put("count", redisDataUtils.getLuckDrawStatus(mobile, luckDrawNum));
hashMap.put("prize", redisDataUtils.getLuckDrawResult(mobile, luckDrawNum));
return ResponseDto.success(hashMap); return ResponseDto.success(hashMap);
} }
......
...@@ -6,6 +6,7 @@ import io.swagger.annotations.Api; ...@@ -6,6 +6,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
...@@ -19,6 +20,7 @@ import java.io.*; ...@@ -19,6 +20,7 @@ import java.io.*;
@Api(tags = "同步微信用户数据") @Api(tags = "同步微信用户数据")
@RestController @RestController
@RequestMapping("/wechatSync") @RequestMapping("/wechatSync")
@Slf4j
public class SweetWechatSyncDataController { public class SweetWechatSyncDataController {
@Autowired @Autowired
...@@ -35,18 +37,17 @@ public class SweetWechatSyncDataController { ...@@ -35,18 +37,17 @@ public class SweetWechatSyncDataController {
BufferedReader bufferedReader = new BufferedReader(read); BufferedReader bufferedReader = new BufferedReader(read);
String mobile = null; String mobile = null;
while ((mobile = bufferedReader.readLine()) != null) { while ((mobile = bufferedReader.readLine()) != null) {
System.out.println(mobile); log.info("mobile:[{}]", mobile);
try { try {
MultiValueMap<String, String> params = new LinkedMultiValueMap(); MultiValueMap<String, String> params = new LinkedMultiValueMap();
params.add("mobile", mobile); params.add("mobile", mobile);
// String url = "http://127.0.0.1:9001/adam/rsc/reg/mobile"; // String url = "http://127.0.0.1:9001/adam/rsc/reg/mobile";
// String url = "http://testadam.zhengzai.tv/adam/rsc/reg/mobile"; // String url = "http://adam.zhengzai.tv/adam/rsc/reg/mobile";
String url = ""; String url = "";
HttpUtil.post(url, params); HttpUtil.post(url, params);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.info("regMobileException:mobile:[{}]", mobile);
} }
} }
...@@ -62,7 +63,7 @@ public class SweetWechatSyncDataController { ...@@ -62,7 +63,7 @@ public class SweetWechatSyncDataController {
try { try {
sweetWechatMpService.userInfo(); sweetWechatMpService.userInfo();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("getUsers", e);
} }
} }
...@@ -75,7 +76,7 @@ public class SweetWechatSyncDataController { ...@@ -75,7 +76,7 @@ public class SweetWechatSyncDataController {
try { try {
sweetWechatMpService.getUser(openId); sweetWechatMpService.getUser(openId);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("getUser", e);
} }
} }
......
...@@ -46,16 +46,11 @@ public class SweetWechatTemplateController { ...@@ -46,16 +46,11 @@ public class SweetWechatTemplateController {
public ResponseDto followStatus( public ResponseDto followStatus(
@RequestParam() String unionId @RequestParam() String unionId
) { ) {
boolean status = sweetTemplateService.followStatusStr(unionId); boolean status = sweetTemplateService.followStatus(unionId);
if (status) { if (status) {
return ResponseDto.success(1); return ResponseDto.success(1);
} else { } else {
status = sweetTemplateService.followStatus(unionId); return ResponseDto.success(2);
if (status) {
return ResponseDto.success(1);
} else {
return ResponseDto.success(2);
}
} }
} }
......
...@@ -47,42 +47,49 @@ public class SweetWechatMpService { ...@@ -47,42 +47,49 @@ public class SweetWechatMpService {
log.info("nextOpenid:[{}] ", nextOpenid); log.info("nextOpenid:[{}] ", nextOpenid);
for (String openId : openids) { for (String openId : openids) {
WxMpUser wxMpUser = wxMpService.getUserService().userInfo(openId); try {
log.info("openId:[{}],wxMpUsers:[{}]", openId, wxMpUser); WxMpUser wxMpUser = wxMpService.getUserService().userInfo(openId);
if (!wxMpUser.getSubscribe()) {
SweetWechatUser userInfo = redisDataUtils.getSweetWechatUser(wxMpUser.getUnionId()); log.info("getSubscribeFalse:openId:[{}]", openId);
if (null == userInfo) { continue;
SweetWechatUser sweetWechatUser = SweetWechatUser.getNew(); }
sweetWechatUser.setOpenId(wxMpUser.getOpenId()); SweetWechatUser userInfo = redisDataUtils.getSweetWechatUser(wxMpUser.getUnionId());
sweetWechatUser.setUnionId(wxMpUser.getUnionId()); if (null == userInfo) {
sweetWechatUser.setNickname(wxMpUser.getNickname()); SweetWechatUser sweetWechatUser = SweetWechatUser.getNew();
sweetWechatUser.setSexDesc(wxMpUser.getSexDesc()); sweetWechatUser.setOpenId(wxMpUser.getOpenId());
sweetWechatUser.setSex(wxMpUser.getSex()); sweetWechatUser.setUnionId(wxMpUser.getUnionId());
sweetWechatUser.setHeadImgUrl(wxMpUser.getHeadImgUrl()); sweetWechatUser.setNickname(wxMpUser.getNickname());
sweetWechatUser.setLanguage(wxMpUser.getLanguage()); sweetWechatUser.setSexDesc(wxMpUser.getSexDesc());
sweetWechatUser.setCountry(wxMpUser.getCountry()); sweetWechatUser.setSex(wxMpUser.getSex());
sweetWechatUser.setProvince(wxMpUser.getProvince()); sweetWechatUser.setHeadImgUrl(wxMpUser.getHeadImgUrl());
sweetWechatUser.setCity(wxMpUser.getCity()); sweetWechatUser.setLanguage(wxMpUser.getLanguage());
sweetWechatUser.setSubscribeTime(DateUtil.ofEpochMilli(wxMpUser.getSubscribeTime())); sweetWechatUser.setCountry(wxMpUser.getCountry());
sweetWechatUser.setSubscribeScene(wxMpUser.getSubscribeScene()); sweetWechatUser.setProvince(wxMpUser.getProvince());
sweetWechatUser.setUserId(IDGenerator.nextSnowId()); sweetWechatUser.setCity(wxMpUser.getCity());
LinkedList<String> sqls = CollectionUtil.linkedListString(); sweetWechatUser.setSubscribeTime(DateUtil.ofEpochMilli(wxMpUser.getSubscribeTime()));
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr(); sweetWechatUser.setSubscribeScene(wxMpUser.getSubscribeScene());
sqls.add(SqlMapping.get("sweet_user.insert")); sweetWechatUser.setUserId(IDGenerator.nextSnowId());
sqlsDataA.add(new Object[]{ LinkedList<String> sqls = CollectionUtil.linkedListString();
sweetWechatUser.getUserId(), sweetWechatUser.getOpenId(), sweetWechatUser.getUnionId(), sweetWechatUser.getNickname(), LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr();
sweetWechatUser.getSexDesc(), sweetWechatUser.getSex(), sweetWechatUser.getHeadImgUrl(), sweetWechatUser.getLanguage(), sqls.add(SqlMapping.get("sweet_user.insert"));
sweetWechatUser.getCountry(), sweetWechatUser.getProvince(), sweetWechatUser.getCity(), sqlsDataA.add(new Object[]{
sweetWechatUser.getSubscribeTime(), sweetWechatUser.getSubscribeScene() sweetWechatUser.getUserId(), sweetWechatUser.getOpenId(), sweetWechatUser.getUnionId(), sweetWechatUser.getNickname(),
}); sweetWechatUser.getSexDesc(), sweetWechatUser.getSex(), sweetWechatUser.getHeadImgUrl(), sweetWechatUser.getLanguage(),
queueUtils.sendMsgByRedis(MQConst.SweetQueue.SWEET_USER_INSERT_DRAW.getKey(), sweetWechatUser.getCountry(), sweetWechatUser.getProvince(), sweetWechatUser.getCity(),
SqlMapping.gets(sqls, sqlsDataA)); sweetWechatUser.getSubscribeTime(), sweetWechatUser.getSubscribeScene()
// 入缓存 });
redisDataUtils.setSweetWechatUser(sweetWechatUser); queueUtils.sendMsgByRedis(MQConst.SweetQueue.SWEET_USER_INSERT_DRAW.getKey(),
SqlMapping.gets(sqls, sqlsDataA));
// 入缓存
redisDataUtils.setSweetWechatUser(sweetWechatUser);
}
} catch (Exception e) {
log.info("forException:openId:[{}]", openId);
} }
} }
log.info("nextOpenidSuccess:[{}] ", nextOpenid);
} while (!nextOpenid.isEmpty()); } while (!nextOpenid.isEmpty());
log.info("同步微信用户完成");
} }
public void getUser(String openId) throws WxErrorException { public void getUser(String openId) throws WxErrorException {
......
...@@ -404,6 +404,17 @@ public class RedisDataUtils { ...@@ -404,6 +404,17 @@ public class RedisDataUtils {
} }
} }
//获取抽奖状态
public int getLuckDrawResult(String mobile, String luckDrawNum) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_LUCK_DRAW_RESULT.concat(luckDrawNum).concat(":mobile:" + mobile);
Object obj = redisUtil.get(redisKey);
if(obj==null){
return 0;
}else{
return (int) redisUtil.get(redisKey);
}
}
//修改抽奖状态 //修改抽奖状态
public SweetPrizeVo changeLuckDrawStatus(String mobile, String unionId,String luckDrawNum) { public SweetPrizeVo changeLuckDrawStatus(String mobile, String unionId,String luckDrawNum) {
LinkedList<String> sqls = CollectionUtil.linkedListString(); LinkedList<String> sqls = CollectionUtil.linkedListString();
...@@ -444,6 +455,7 @@ public class RedisDataUtils { ...@@ -444,6 +455,7 @@ public class RedisDataUtils {
if (surplus < prizeALl) { if (surplus < prizeALl) {
prize = (int) redisUtil.incr(redisSurplus, 1); prize = (int) redisUtil.incr(redisSurplus, 1);
redisUtil.set(redisKey, 2); redisUtil.set(redisKey, 2);
redisUtil.set(SweetConstant.REDIS_KEY_SWEET_LUCK_DRAW_RESULT.concat(luckDrawNum).concat(":mobile:" + mobile),prize);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment