Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1556,8 +1556,17 @@ public class DateUtil {
|
||||
return c.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加日期的天数
|
||||
* 此方法用于给定一个日期后,增加指定数量的天数
|
||||
*
|
||||
* @param date 原始日期
|
||||
* @param amount 要增加的天数,正数表示未来日期,负数表示过去日期
|
||||
* @return 增加天数后的日期
|
||||
*/
|
||||
public static Date add(Date date,int amount){
|
||||
return add(date,Calendar.DATE,amount);
|
||||
// 调用另一个重载的add方法,将Calendar.DATE作为参数,表示按天数增加
|
||||
return add(date,Calendar.DATE,amount);
|
||||
}
|
||||
|
||||
public static String addMonth(Date date, int month){
|
||||
|
||||
+3
@@ -759,6 +759,9 @@ public class PropertyController {
|
||||
//int avgPrice = districtStatService.findLatestDistrictAvgPrice(new DistrictKey(district), null);
|
||||
// 返回2B价格,小程序用,其他也改为2B
|
||||
int avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), null);
|
||||
if(avgPrice == 0){
|
||||
avgPrice = districtStatService.findLatestDistrictAvgPrice2B(new DistrictKey(district), DateUtil.add(new Date(), -7));
|
||||
}
|
||||
if (avgPrice != 0) {
|
||||
districtInfoDto.setAvgPrice(avgPrice);
|
||||
}
|
||||
|
||||
+2
-2
@@ -166,7 +166,7 @@ class SMSOutgoingListener extends BaseBatch {
|
||||
|
||||
def mobile = msg.getObject().mobile
|
||||
String content = msg.getObject().msgContent.trim()
|
||||
content = content.replace("【房价网】", "【上海估家】")
|
||||
content = content.replace("【房价网】", "【上海估家网络科技】")
|
||||
if(!content.startsWith("【")){
|
||||
content = "【上海估家】" + content;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ class SMSOutgoingListener extends BaseBatch {
|
||||
JSONObject con = new JSONObject()
|
||||
con.put("code", checkCode);
|
||||
println("mobile:"+mobile+" code:"+checkCode)
|
||||
return AliyunSmsClient.sendSms(mobile, "SMS_483925328", con.toString())
|
||||
return AliyunSmsClient.sendSms(mobile, "SMS_485015075", con.toString())
|
||||
}
|
||||
}
|
||||
int resCode = SingletonClient.getClient().sendSMS([mobile] as String[],content, 5)
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ class AliyunSmsClient {
|
||||
//必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式;发送国际/港澳台消息时,接收号码格式为00+国际区号+号码,如“0085200000000”
|
||||
request.setPhoneNumbers(phoneNumber)
|
||||
//必填:短信签名-可在短信控制台中找到
|
||||
request.setSignName("上海估家")
|
||||
request.setSignName("上海估家网络科技")
|
||||
//必填:短信模板-可在短信控制台中找到
|
||||
request.setTemplateCode(templateCode);
|
||||
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
|
||||
@@ -52,7 +52,7 @@ class AliyunSmsClient {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
sendSms("13061966193", "SMS_483925328", '{"code":5555}')
|
||||
sendSms("15021384995", "SMS_485015075", '{"code":6666}')
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -325,7 +325,7 @@ public class AiShopServiceImpl implements AiShopService {
|
||||
query.setCityDisplay(evaluation.getCity());
|
||||
Pager pager = new Pager();
|
||||
pager.setStartRow(0);
|
||||
pager.setPageSize(5);
|
||||
pager.setPageSize(10);
|
||||
query.setPager(pager);
|
||||
query.setTable("latest_seawater");
|
||||
List<Seawater> shops = seawaterService.findSeawatersByQuery(query);
|
||||
@@ -378,7 +378,7 @@ public class AiShopServiceImpl implements AiShopService {
|
||||
query.setCityDisplay(evaluation.getCity());
|
||||
Pager pager = new Pager();
|
||||
pager.setStartRow(0);
|
||||
pager.setPageSize(5);
|
||||
pager.setPageSize(10);
|
||||
query.setPager(pager);
|
||||
query.setTable("latest_seawater");
|
||||
List<Seawater> shops = seawaterService.findSeawatersByQuery(query);
|
||||
|
||||
+33
-9
@@ -1527,7 +1527,12 @@ public class DistrictStatServiceImpl implements DistrictStatService {
|
||||
@Override
|
||||
public int findLatestDistrictAvgPrice2B(DistrictKey districtKey, Date weekend) {
|
||||
if (weekend == null) {
|
||||
weekend = DateUtil.getFirstDayOfWeek(new Date());
|
||||
Date now = DateUtil.truncateDay(new Date());
|
||||
if(!DateUtil.isSunday(now)){
|
||||
weekend = DateUtil.getFirstDayOfWeek(now);
|
||||
}else{
|
||||
weekend = now;
|
||||
}
|
||||
}
|
||||
String cacheKey = districtKey.getCity() + "_" + districtKey.getRegion() + "_" + districtKey.getName() + "_2B_" + DateUtil.formatToYYMMDD(weekend);
|
||||
Object obj = CacheUtils.getValue(this.getClass(), cacheKey);
|
||||
@@ -1604,9 +1609,13 @@ public class DistrictStatServiceImpl implements DistrictStatService {
|
||||
|
||||
if (startDate == null) {
|
||||
throw new IllegalArgumentException("开始日期不能为空");
|
||||
}else {
|
||||
startDate = DateUtil.truncateDay(startDate);
|
||||
}
|
||||
if (endDate == null) {
|
||||
throw new IllegalArgumentException("结束日期不能为空");
|
||||
}else {
|
||||
endDate = DateUtil.truncateDay(endDate);
|
||||
}
|
||||
if (StringUtils.isBlank(periodModel)) {
|
||||
periodModel = "weekly";
|
||||
@@ -1642,7 +1651,6 @@ public class DistrictStatServiceImpl implements DistrictStatService {
|
||||
sortParams.add(new SortParam("weekend", true));
|
||||
List<DistrictStat> dss = this.districtStatDao.findAllByParams(params, sortParams);
|
||||
if (null == dss || dss.isEmpty()) {// 如果没有在小区均价表中查到均价数据,通过城市的价格计算小区均价
|
||||
|
||||
List<QueryParam> cityQueryParams = new ArrayList<QueryParam>();
|
||||
cityQueryParams.add(new QueryParam("city", city));
|
||||
cityQueryParams.add(new QueryParam("region", region));
|
||||
@@ -1708,15 +1716,35 @@ public class DistrictStatServiceImpl implements DistrictStatService {
|
||||
}
|
||||
|
||||
List<Date> timeSeries = generateTimeSeries(weekendDates.get(0), endDate, periodModel);
|
||||
|
||||
Map<Date, DistrictStat> statMap = new HashMap<Date, DistrictStat>();
|
||||
|
||||
for (DistrictStat districtStat : dss) {
|
||||
if (timeSeries.contains(districtStat.getWeekend())) {
|
||||
statMap.put(districtStat.getWeekend(), districtStat);
|
||||
}
|
||||
}
|
||||
|
||||
if("monthly".equals(periodModel)){
|
||||
Date firstWeekendOfMonth = DateUtil.getFirstWeekendOfMonth(endDate);
|
||||
List<DistrictStat> stats = districtStatService.findDistrictStat(new DistrictKey(city, region, name), null , firstWeekendOfMonth, endDate);
|
||||
if(stats.isEmpty()){
|
||||
Date sunDay = DateUtil.getFirstDayOfWeek(endDate);
|
||||
if(!timeSeries.contains(sunDay)){
|
||||
timeSeries.add(sunDay);
|
||||
}
|
||||
}else{
|
||||
if(DateUtil.isSunday(endDate)){
|
||||
timeSeries.remove(endDate);
|
||||
}else{
|
||||
timeSeries.remove(DateUtil.getLastSunday(endDate));
|
||||
}
|
||||
for(int i = stats.size()-1; i >= 0; i--){
|
||||
if (!timeSeries.contains(stats.get(i).getWeekend())){
|
||||
statMap.put(stats.get(i).getWeekend(), stats.get(i));
|
||||
timeSeries.add(stats.get(i).getWeekend());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Date time : timeSeries) {
|
||||
if (!statMap.containsKey(time)) {
|
||||
DistrictStat districtStat = new DistrictStat();
|
||||
@@ -1772,10 +1800,6 @@ public class DistrictStatServiceImpl implements DistrictStatService {
|
||||
monthlyDates.add(date);
|
||||
}
|
||||
}
|
||||
Date sunDay = DateUtil.getFirstDayOfWeek(endDate);
|
||||
if (!monthlyDates.contains(sunDay)) {
|
||||
monthlyDates.add(sunDay);
|
||||
}
|
||||
return monthlyDates;
|
||||
} else {
|
||||
throw new IllegalArgumentException("非法的计算周期");
|
||||
|
||||
Reference in New Issue
Block a user