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

Commit 7ac5b220 authored by 姜秀龙's avatar 姜秀龙

Merge remote-tracking branch 'refs/remotes/origin/master' into jxl_20240313_prod

# Conflicts:
#	liquidnet-bus-config/liquidnet-config/liquidnet-service-kylin.yml
#	liquidnet-bus-config/liquidnet-config/liquidnet-service-platform.yml
parents 4f4c0d8c 80777d5e
package com.liquidnet.service.adam.dto.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "AdamNftVo", description = "个人藏品响应数据")
@Data
public class AdamNftVo implements java.io.Serializable, Cloneable{
private static final long serialVersionUID = 1L; // 手动指定
@ApiModelProperty(position = 1, value = "是否存在NFT 1:存在 2:不存在")
private int hasNft;
@ApiModelProperty(position = 2, value = "是否存在NFT订单 1:存在 2:不存在")
private int hasNftOrder;
private static final AdamNftVo obj = new AdamNftVo();
public static AdamNftVo getNew() {
try {
return (AdamNftVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new AdamNftVo();
}
}
}
......@@ -22,6 +22,9 @@ public class AdamUserProfileVo implements java.io.Serializable, Cloneable {
private AdamUserMemberVo userMemberVo;
@ApiModelProperty(position = 16, value = "会员卡信息")
private AdamMemberJoinusVo memberJoinusVo;
@ApiModelProperty(position = 17, value = "藏品信息")
private AdamNftVo adamNftVo;
// @ApiModelProperty(position = 17, value = "业务账号信息")
// private List<AdamUserBizAcctVo> bizAcctVoList;
......
......@@ -25,4 +25,6 @@ public interface ISweetManualService extends IService<SweetManual> {
//发布与否
ResponseDto<Boolean> changeRelease(String manualId, Integer isRelease);
ResponseDto<Boolean> changeReleaseManual(String manualId, Integer isReleaseManual);
}
......@@ -274,6 +274,7 @@ public class ShiroConfig
filterChainDefinitionMap.put("/js/**", "anon");
filterChainDefinitionMap.put("/ruoyi/**", "anon");
filterChainDefinitionMap.put("/captcha/captchaImage**", "anon");
filterChainDefinitionMap.put("/health", "anon");
// 退出 logout地址,shiro去清除session
filterChainDefinitionMap.put("/logout", "logout");
// 不需要拦截的访问
......
package com.liquidnet.client.admin.web.controller.zhengzai.health;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Api(tags = "健康检查")
@Controller
@RequestMapping("/health")
public class HealthController {
@GetMapping("")
@ResponseBody
public AjaxResult health() {
return AjaxResult.success("success");
}
}
......@@ -152,7 +152,7 @@
var formData = new FormData();
formData.append("file", e.target.files[0]);
$.ajax({
url: platformUrl + "/platform/basicServices/alOss/upload",//路径是你控制器中上传图片的方法,下面controller里面我会写到
url: platformUrl + "/platform/basicServices/alOss/upload/unsm",//路径是你控制器中上传图片的方法,下面controller里面我会写到
data: formData,
cache: false,
contentType: false,
......
......@@ -182,7 +182,7 @@
var formData = new FormData();
formData.append("file", e.target.files[0]);
$.ajax({
url: platformUrl + "/platform/basicServices/alOss/upload",//路径是你控制器中上传图片的方法,下面controller里面我会写到
url: platformUrl + "/platform/basicServices/alOss/upload/unsm",//路径是你控制器中上传图片的方法,下面controller里面我会写到
data: formData,
cache: false,
contentType: false,
......
......@@ -24,6 +24,9 @@ public class OrderExportVo implements Serializable, Cloneable{
@Excel(name = "票种适用结束时间", cellType = Excel.ColumnType.STRING)
private String useEnd;
@Excel(name = "购买数量", cellType = Excel.ColumnType.STRING)
private String buyTotal;
private static final OrderExportVo obj = new OrderExportVo();
public static OrderExportVo getNew() {
......@@ -43,6 +46,7 @@ public class OrderExportVo implements Serializable, Cloneable{
this.setUseTime(source.getUseTime());
this.setUseStart(source.getUseStart());
this.setUseEnd(source.getUseEnd());
this.setBuyTotal(source.getBuyTotal());
return this;
}
}
......@@ -21,5 +21,11 @@
<groupId>com.aliyun</groupId>
<artifactId>dysmsapi20170525</artifactId>
</dependency>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-common-base</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -4,11 +4,15 @@ import com.alibaba.fastjson.JSON;
import com.aliyun.dysmsapi20170525.Client;
import com.aliyun.dysmsapi20170525.models.*;
import com.aliyun.teaopenapi.models.Config;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.ServletUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
@Slf4j
@Component
......@@ -83,6 +87,18 @@ public class SmsProcessor {
if (!isSucc) {
log.warn("###发送短信API处理失败[pn={},sn={},tc={},tp={},respBody={}]", phoneNumber, signName, templateCode, templateParam, JSON.toJSON(smsResponseBody));
String cliIpAddr = CurrentUtil.getCliIpAddr();
log.info("[send] cliIpAddr: {}", cliIpAddr);
StringBuilder sb = new StringBuilder();
HttpServletRequest request = ServletUtils.getRequest();
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
String headerValue = request.getHeader(headerName);
sb.append(headerName).append(": ").append(headerValue).append("\n");
}
log.info("[send] headers: {}.", sb);
}
return isSucc;
......
......@@ -12,11 +12,21 @@ import javax.servlet.http.HttpServletResponse;
@Component
public class GlobalLogTrackInterceptor extends HandlerInterceptorAdapter {
private static final String LNS_TRANCE_ID = "lnsTranceId";
private static final String X_SERVER_HEADER = "X-Server";
private static final String POD_NAME_ENV = "POD_NAME";
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String t = MDC.get(LNS_TRANCE_ID);
MDC.put(LNS_TRANCE_ID, null == t ? String.valueOf(System.nanoTime()) : t);
// 从环境变量获取POD_NAME并添加到响应头
String podName = System.getenv(POD_NAME_ENV);
if (podName != null && !podName.isEmpty()) {
// log.info("[preHandle] podName: {}", podName);
response.setHeader(X_SERVER_HEADER, podName);
}
return true;
}
......
......@@ -137,6 +137,8 @@ global-auth:
# - ${liquidnet.info.context}/wx/oauth2/access_token
- ${liquidnet.info.context}/rsc/**
- ${liquidnet.info.context}/user/info/rds
# 健康检查
- ${liquidnet.info.context}/health
include-url-pattern: # 模式II(与模式I互斥)
# - ${liquidnet.info.context}/**
oncheck-url-pattern:
......
......@@ -109,6 +109,8 @@ global-auth:
- ${liquidnet.info.context}/candy-coupon/useBack
- ${liquidnet.info.context}/candy-coupon/useBackJxl
- ${liquidnet.info.context}/inner/**
# 健康检查
- ${liquidnet.info.context}/health
oncheck-url-pattern:
# - ${liquidnet.info.context}/**
# -----------------------------------------------------------
......
......@@ -92,6 +92,8 @@ global-auth:
- ${liquidnet.info.context}/user/userLikeOperation
- ${liquidnet.info.context}/user/userDislikeOperation
- ${liquidnet.info.context}/performance/getUserListByCon
# 健康检查
- ${liquidnet.info.context}/health
oncheck-url-pattern:
# - ${liquidnet.info.context}/**
# -----------------------------------------------------------
......
......@@ -145,6 +145,8 @@ global-auth:
- ${liquidnet.info.context}/app/mix/details
- ${liquidnet.info.context}/wdt/**
- ${liquidnet.info.context}/bracelet/callback
# 健康检查
- ${liquidnet.info.context}/health
oncheck-url-pattern:
-
# -----------------------------------------------------------
......
......@@ -124,6 +124,8 @@ global-auth:
- ${liquidnet.info.context}/notify/**
- ${liquidnet.info.context}/refund/**
- ${liquidnet.info.context}/pay/**
# 健康检查
- ${liquidnet.info.context}/health
# -----------------------------------------------------------
# -----------------------------------------------------------
......
......@@ -112,6 +112,8 @@ global-auth:
- ${liquidnet.info.context}/swagger-resources/**
- ${liquidnet.info.context}/v2/api-docs*
- ${liquidnet.info.context}/fields/app/details
# 健康检查
- ${liquidnet.info.context}/health
# -----------------------------------------------------------
# -----------------------------------------------------------
......@@ -115,6 +115,8 @@ global-auth:
- ${liquidnet.info.context}/frontNoLogin/**
- ${liquidnet.info.context}/volunteers/project/list
- ${liquidnet.info.context}/volunteers/project/details
# 健康检查
- ${liquidnet.info.context}/health
oncheck-url-pattern:
-
......
......@@ -116,6 +116,8 @@ global-auth:
- ${liquidnet.info.context}/user/logs/in2111
- ${liquidnet.info.context}/user/logs/de2111
- ${liquidnet.info.context}/user/logs/in2112
# 健康检查
- ${liquidnet.info.context}/health
oncheck-url-pattern:
# - ${liquidnet.info.context}/**
# -----------------------------------------------------------
......
......@@ -57,4 +57,5 @@ public class OrderExportDao {
//支付时间
private String timePay;
private String buyTotal;
}
......@@ -714,14 +714,23 @@ GROUP BY user_mobile,tickets_id;
</select>
<select id="exportOrderByPerformanceIdPay" resultMap="OrderExportDaoResult">
SELECT performance_title,user_mobile,user_name,title,CONCAT(use_start,use_end) as 'use_time',use_start,use_end
FROM kylin_order_tickets kot
INNER JOIN kylin_order_ticket_relations as kotr on kotr.order_id = kot.order_tickets_id
INNER JOIN kylin_order_ticket_status as kots on kots.order_id = kot.order_tickets_id
INNER JOIN kylin_tickets as kt on kt.tickets_id = kotr.ticket_id
WHERE performance_id = #{performancesId}
AND status IN (1, 3)
GROUP BY user_mobile,tickets_id;
SELECT
performance_title,
user_mobile,
user_name,
title,
count(user_mobile) as 'buy_total',
CONCAT(use_start,use_end) as 'use_time',
use_start,
use_end
FROM kylin_order_tickets kot
INNER JOIN kylin_order_ticket_entities kote on kot.order_tickets_id = kote.order_id
INNER JOIN kylin_order_ticket_relations as kotr on kotr.order_id = kot.order_tickets_id
INNER JOIN kylin_order_ticket_status as kots on kots.order_id = kot.order_tickets_id
INNER JOIN kylin_tickets as kt on kt.tickets_id = kotr.ticket_id
WHERE kotr.performance_id = #{performancesId}
AND kots.status IN (1, 3)
GROUP BY user_mobile, tickets_id;
</select>
<select id="getPerformanceSimpleByTicketId" resultType="com.liquidnet.service.kylin.dao.PerformanceSimpleAllDao">
<!-- select kp.performances_id as performancesId,-->
......
......@@ -38,6 +38,12 @@ public class SweetManualAppletDto implements Serializable ,Cloneable{
@ApiModelProperty("纬度")
private String latitude;
@ApiModelProperty("是否发布手册 0:不发布 1:发布")
private Integer isReleaseManual;
@ApiModelProperty("是否距离今日最近 0:否 1:是")
private Integer isNear;
private static final SweetManualAppletDto obj = new SweetManualAppletDto();
public static SweetManualAppletDto getNew() {
......
......@@ -31,6 +31,9 @@ public class SweetManualDto implements Serializable ,Cloneable{
@ApiModelProperty("是否发布")
private Integer isRelease;
@ApiModelProperty("是否发布手册 0:不发布 1:发布")
private Integer isReleaseManual;
private static final SweetManualDto obj = new SweetManualDto();
public static SweetManualDto getNew() {
try {
......
......@@ -45,6 +45,11 @@ public class SweetManual implements Serializable,Cloneable {
*/
private Integer isRelease;
/**
* 0取消手册 1发布手册
*/
private Integer isReleaseManual;
/**
* 创建时间
*/
......
......@@ -49,7 +49,8 @@
t.time_sell ,
t.time_stop,
IFNULL(sm.status ,0) as 'manualStatus',
IFNULL(sm.is_release,0) as 'is_release'
IFNULL(sm.is_release,0) as 'is_release',
IFNULL(sm.is_release_manual,0) as 'is_release_manual'
FROM
kylin_performances AS p
LEFT JOIN kylin_performance_status AS ps ON p.performances_id = ps.performance_id
......@@ -131,7 +132,8 @@
p.time_end,
t1.time_sell,
t1.pay_countdown_minute,
t1.is_member
t1.is_member,
sm.is_release_manual
FROM kylin_performances AS p
LEFT JOIN kylin_performance_status AS ps ON p.performances_id = ps.performance_id
LEFT JOIN kylin_performance_relations AS pr ON p.performances_id = pr.performance_id
......
......@@ -94,6 +94,9 @@ public class AdamLoginController {
return ResponseDto.failure(ErrorMapping.get("10000"));
}
String cliIpAddr = CurrentUtil.getCliIpAddr();
log.info("cliIpAddr: {}", cliIpAddr);
String smsCode = RandomStringUtils.randomNumeric(6);
ObjectNode msgNode = JsonUtils.OM().createObjectNode();
msgNode.put("code", smsCode);
......
......@@ -436,6 +436,11 @@ public class AdamUserController {
}
userProfileVo.setMemberJoinusVo(memberJoinusVo);
AdamNftVo adamNftVo = AdamNftVo.getNew();
adamNftVo.setHasNft(adamRdmService.hasNft(currentUid) ? 1 : 2);
adamNftVo.setHasNftOrder(adamRdmService.hasNftOrder(currentUid) ? 1 : 2);
userProfileVo.setAdamNftVo(adamNftVo);
return ResponseDto.success(userProfileVo);
}
......
package com.liquidnet.service.adam.controller;
import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/health")
public class HealthController {
@ApiOperation("健康检查")
@GetMapping
public ResponseDto<String> info() {
return ResponseDto.success("success");
}
}
......@@ -29,10 +29,7 @@ import java.time.LocalDateTime;
import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
......@@ -1082,6 +1079,26 @@ public class AdamRdmService {
Object o = redisUtil.get(AdamRedisConst.INCR_USER_ENTERS.concat(uid));
return null == o ? -1 : (int) o;
}
public boolean hasNft(String currentUid) {
final String rdsKey = "goblin:u_d_art_ct:" + currentUid;
Object o = redisUtil.get(rdsKey);
if (Objects.isNull(o)) {
return false;
}
int num = (int) o;
return num > 0;
}
public boolean hasNftOrder(String currentUid) {
final String rdsKey = "goblin:nft:order:idList:" + currentUid;
Object obj = redisUtil.get(rdsKey);
if (obj != null) {
return true;
}
return false;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
......
package com.liquidnet.service.candy.controller;
import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/health")
public class HealthController {
@ApiOperation("健康检查")
@GetMapping
public ResponseDto<String> info() {
return ResponseDto.success("success");
}
}
package com.liquidnet.service.chime.controller;
import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/health")
public class HealthController {
@ApiOperation("健康检查")
@GetMapping
public ResponseDto<String> info() {
return ResponseDto.success("success");
}
}
package com.liquidnet.service.goblin.controller;
import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/health")
public class HealthController {
@ApiOperation("健康检查")
@GetMapping
public ResponseDto<String> info() {
return ResponseDto.success("success");
}
}
package com.liquidnet.service.kylin.controller;
import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/health")
public class HealthController {
@ApiOperation("健康检查")
@GetMapping
public ResponseDto<String> info() {
return ResponseDto.success("success");
}
}
package com.liquidnet.service.order.controller;
import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/health")
public class HealthController {
@ApiOperation("健康检查")
@GetMapping
public ResponseDto<String> info() {
return ResponseDto.success("success");
}
}
package com.liquidnet.service.platform.controller;
import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/health")
public class HealthController {
@ApiOperation("健康检查")
@GetMapping
public ResponseDto<String> info() {
return ResponseDto.success("success");
}
}
package com.liquidnet.service.slime.controller;
import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/health")
public class HealthController {
@ApiOperation("健康检查")
@GetMapping
public ResponseDto<String> info() {
return ResponseDto.success("success");
}
}
......@@ -495,6 +495,9 @@ public class PerformanceUtils {
log.info("performanceId = " + performanceId + " NEED CHANGE TIMES USE_START");
return true;
}
if (times.getRealNameLimit() == null) {
times.setRealNameLimit(0);
}
if (!times.getRealNameLimit().equals(timesVo.getRealNameLimit())) {
log.info("performanceId = " + performanceId + " NEED CHANGE TIMES RealNameLimit");
return true;
......
package com.liquidnet.service.controller;
import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/health")
public class HealthController {
@ApiOperation("健康检查")
@GetMapping
public ResponseDto<String> info() {
return ResponseDto.success("success");
}
}
package com.liquidnet.service.stone.controller;
import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/health")
public class HealthController {
@ApiOperation("健康检查")
@GetMapping
public ResponseDto<String> info() {
return ResponseDto.success("success");
}
}
package com.liquidnet.service.sweet.controller;
import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/health")
public class HealthController {
@ApiOperation("健康检查")
@GetMapping
public ResponseDto<String> info() {
return ResponseDto.success("success");
}
}
......@@ -9,6 +9,7 @@ import com.liquidnet.service.sweet.dto.SweetPerformArtistTimeListDto;
import com.liquidnet.service.sweet.entity.SweetManualNotify;
import com.liquidnet.service.sweet.entity.SweetManualShop;
import com.liquidnet.service.sweet.entity.SweetRichtext;
import com.liquidnet.service.sweet.utils.MarkNearestUtils;
import com.liquidnet.service.sweet.utils.ObjectUtil;
import com.liquidnet.service.sweet.utils.RedisArDataUtils;
import com.liquidnet.service.sweet.utils.RedisDataUtils;
......@@ -49,9 +50,13 @@ public class SweetAppletController {
List<SweetManualAppletDto> vo = ObjectUtil.getSweetManualAppletDtoList();
for (SweetManualAppletDto item : dto) {
if (item.getTitle().contains(name)) {
if (item.getIsReleaseManual() == null) {
item.setIsReleaseManual(0);
}
vo.add(item);
}
}
MarkNearestUtils.markNearestPerformance(vo);
return ResponseDto.success(vo);
}
......
......@@ -4,9 +4,7 @@ package com.liquidnet.service.sweet.controller;
import com.github.pagehelper.PageInfo;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.dto.SweetManualDto;
import com.liquidnet.service.sweet.entity.SweetStage;
import com.liquidnet.service.sweet.service.ISweetManualService;
import com.liquidnet.service.sweet.service.ISweetManualSortService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -77,4 +75,16 @@ public class SweetManualController {
return sweetManualService.changeStatus(manualId, performancesId, status);
}
@PostMapping("changeReleaseManual")
@ApiOperation("修改是否发布手册")
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "manualId", value = "电子手册id", required = true),
@ApiImplicitParam(type = "query", dataType = "Integer", name = "isReleaseManual", value = "是否发布手册", required = true),
})
public ResponseDto<Boolean> changeReleaseManual(@RequestParam(value = "manualId") String manualId,
@RequestParam(value = "isReleaseManual") Integer isReleaseManual) {
return sweetManualService.changeReleaseManual(manualId, isReleaseManual);
}
}
package com.liquidnet.service.sweet.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.commons.lang.util.BeanUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
......@@ -11,11 +11,8 @@ import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.dto.SweetManualDto;
import com.liquidnet.service.sweet.entity.SweetManual;
import com.liquidnet.service.sweet.entity.SweetStage;
import com.liquidnet.service.sweet.mapper.SweetManualMapper;
import com.liquidnet.service.sweet.mapper.SweetStageMapper;
import com.liquidnet.service.sweet.service.ISweetManualService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.service.sweet.utils.RedisDataUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -128,4 +125,18 @@ public class SweetManualServiceImpl extends ServiceImpl<SweetManualMapper, Sweet
redisDataUtils.deletePushListRedisData();
return ResponseDto.success();
}
@Override
public ResponseDto<Boolean> changeReleaseManual(String manualId, Integer isReleaseManual) {
try {
SweetManual sweetManual = SweetManual.getNew();
sweetManual.setIsReleaseManual(isReleaseManual);
sweetManual.setUpdatedAt(LocalDateTime.now());
sweetManualMapper.update(sweetManual, Wrappers.lambdaUpdate(SweetManual.class).eq(SweetManual::getManualId, manualId));
} catch (Exception e) {
return ResponseDto.failure();
}
redisDataUtils.deletePushListRedisData();
return ResponseDto.success();
}
}
package com.liquidnet.service.sweet.utils;
import com.liquidnet.service.sweet.dto.SweetManualAppletDto;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
public class MarkNearestUtils {
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
static {
// 如果 timeStart 是北京时间,设置时区
DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT+8"));
}
/**
* 1. 设置列表中距离当前时间最近的演出 isNear = 1,其余为 0
* 2. 按timeStart 降序排列
*
* @param list 演出手册 DTO 列表
*/
public static void markNearestPerformance(List<SweetManualAppletDto> list) {
if (list == null || list.isEmpty()) {
return;
}
Date now = new Date();
SweetManualAppletDto nearest = null;
Date nearestTime = null;
for (SweetManualAppletDto dto : list) {
if (dto.getTimeStart() == null || dto.getTimeStart().trim().isEmpty()) {
dto.setIsNear(0);
continue;
}
try {
Date startTime = DATE_FORMAT.parse(dto.getTimeStart());
// 可选:如果只考虑未来或正在进行的演出,可取消下面的注释
if (startTime.before(now)) continue;
if (nearestTime == null || Math.abs(startTime.getTime() - now.getTime()) <
Math.abs(nearestTime.getTime() - now.getTime())) {
nearestTime = startTime;
nearest = dto;
}
} catch (ParseException e) {
// 解析失败,设为 0
dto.setIsNear(0);
}
}
// 先将所有 isNear 设为 0
for (SweetManualAppletDto dto : list) {
dto.setIsNear(0);
}
// 将最近的那个设为 1
if (nearest != null) {
nearest.setIsNear(1);
}
// 第二步:按 timeStart 降序排序(最新的在前)
list.sort((a, b) -> {
if (a.getTimeStart() == null && b.getTimeStart() == null) return 0;
if (a.getTimeStart() == null) return 1;
if (b.getTimeStart() == null) return -1;
try {
Date dateA = DATE_FORMAT.parse(a.getTimeStart());
Date dateB = DATE_FORMAT.parse(b.getTimeStart());
return dateB.compareTo(dateA); // 降序:b.compareTo(a)
} catch (ParseException e) {
// 解析失败,保持原顺序(或可抛出异常)
return 0;
}
});
}
}
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