docker 文件
parent
1fbf694f7f
commit
5c86fdc0b8
@ -1,3 +1,3 @@
|
|||||||
pic_path=/Volumes/Lexar/www/pic/
|
pic_path=/users/root/www/pic/
|
||||||
pic_recourse_url=/pic/
|
pic_recourse_url=/pic/
|
||||||
initPwd=tz2022
|
initPwd=tz2022
|
@ -0,0 +1,8 @@
|
|||||||
|
FROM daocloud.io/library/java:8-jre-alpine
|
||||||
|
MAINTAINER tianze
|
||||||
|
ARG JAVA_OPTS="-Xmx128M"
|
||||||
|
ENV JAVA_OPTS=$JAVA_OPTS
|
||||||
|
ARG RUN_ARGS="--spring.profiles.active=dev"
|
||||||
|
ENV RUN_ARGS=$RUN_ARGS
|
||||||
|
ADD target/tianze-competition.jar /competition-service.jar
|
||||||
|
ENTRYPOINT ["sh","-c","java $JAVA_OPTS -jar /competition-service.jar $RUN_ARGS"]
|
@ -1,10 +1,29 @@
|
|||||||
package com.tz.platform.competitiion.api;
|
package com.tz.platform.competitiion.api;
|
||||||
|
|
||||||
|
import com.tz.platform.common.core.base.BaseController;
|
||||||
|
import com.tz.platform.common.core.base.Result;
|
||||||
|
import com.tz.platform.competitiion.api.biz.ApiRankingBiz;
|
||||||
|
import com.tz.platform.competitiion.api.dto.ListRankingDTO;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/api/competition/ranking")
|
@RequestMapping(value = "/api/competition/ranking")
|
||||||
public class ApiCompetitionRankingController {
|
public class ApiCompetitionRankingController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiRankingBiz rankingBiz;
|
||||||
|
|
||||||
|
@GetMapping(value = "list")
|
||||||
|
public Result<ListRankingDTO> listRank(@RequestParam("compId") Long cmpId, @RequestParam("stageId") Integer stageId,@RequestParam("orderBy") String sort,@RequestParam("direct") Integer direct,String date){
|
||||||
|
return rankingBiz.list(cmpId,stageId,sort,direct,date);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "listAll")
|
||||||
|
public Result<ListRankingDTO> listAll(@RequestParam("compId") Long cmpId, @RequestParam("stageId") Integer stageId){
|
||||||
|
return rankingBiz.listAll(cmpId,stageId,getUserNo());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,99 @@
|
|||||||
|
package com.tz.platform.competitiion.api.biz;
|
||||||
|
|
||||||
|
import com.tz.platform.common.core.base.Result;
|
||||||
|
import com.tz.platform.common.core.tools.BeanUtils;
|
||||||
|
import com.tz.platform.competitiion.api.dto.ListRankingDTO;
|
||||||
|
import com.tz.platform.competitiion.api.dto.RankingDTO;
|
||||||
|
import com.tz.platform.entity.Competition;
|
||||||
|
import com.tz.platform.entity.Ranking;
|
||||||
|
import com.tz.platform.repository.CompetitionDao;
|
||||||
|
import com.tz.platform.repository.RankingDao;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ApiRankingBiz
|
||||||
|
{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String,Object> template;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompetitionDao competitionDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RankingDao rankingDao;
|
||||||
|
|
||||||
|
public Result<ListRankingDTO> list(Long compId,Integer stageId,String sort,Integer direct,String date){
|
||||||
|
|
||||||
|
Competition competition = competitionDao.getById(compId);
|
||||||
|
|
||||||
|
String key = "rankList_"+compId+"_"+stageId+"_"+date;
|
||||||
|
Object rankList = template.opsForValue().get(key);
|
||||||
|
|
||||||
|
List<Ranking> rankingList = null;
|
||||||
|
if(rankList == null){
|
||||||
|
if(StringUtils.isEmpty(date)){
|
||||||
|
rankingList = rankingDao.findAllByCompIdAndStageIdAndUpdateTime(compId,stageId,competition.getUpdateRankDate());
|
||||||
|
}else{
|
||||||
|
rankingList = rankingDao.findAllByCompIdAndStageIdAndUpdateTime(compId,stageId,date);
|
||||||
|
}
|
||||||
|
if(rankingList!=null){
|
||||||
|
template.opsForValue().set(key,rankingList,30, TimeUnit.MINUTES);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
rankingList = (List<Ranking>) rankList;
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(rankingList, (o1, o2) -> {
|
||||||
|
if(StringUtils.isEmpty(sort)){
|
||||||
|
Integer r1 = o1.getPersonalRank();
|
||||||
|
Integer r2 = o2.getPersonalRank();
|
||||||
|
if(r1 == null){
|
||||||
|
r1 = 0;
|
||||||
|
}
|
||||||
|
if(r2 == null){
|
||||||
|
r2 = 0;
|
||||||
|
}
|
||||||
|
if(direct == 0){
|
||||||
|
return r1 - r2;
|
||||||
|
}else{
|
||||||
|
return r2 - r1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
ListRankingDTO dto = new ListRankingDTO();
|
||||||
|
List<RankingDTO> rankingDTOList = BeanUtils.copyProperties(rankingList,RankingDTO.class);
|
||||||
|
dto.setTotal(rankingDTOList.size());
|
||||||
|
dto.setList(rankingDTOList);
|
||||||
|
return Result.success(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result<ListRankingDTO> listAll(Long compId,Integer stageId,Long userNo){
|
||||||
|
String key = "rankList_"+compId+"_"+stageId+"_"+userNo;
|
||||||
|
Object rankList = template.opsForValue().get(key);
|
||||||
|
List<Ranking> rankingList = null;
|
||||||
|
if(rankList == null){
|
||||||
|
rankingList = rankingDao.findAllByCompIdAndStageIdAndUserNo(compId,stageId,userNo);
|
||||||
|
|
||||||
|
if(rankingList!=null&&rankingList.size()>0){
|
||||||
|
template.opsForValue().set(key,rankingList,30, TimeUnit.MINUTES);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
rankingList = (List<Ranking>) rankList;
|
||||||
|
}
|
||||||
|
ListRankingDTO dto = new ListRankingDTO();
|
||||||
|
List<RankingDTO> rankingDTOList = BeanUtils.copyProperties(rankingList,RankingDTO.class);
|
||||||
|
dto.setTotal(rankingDTOList.size());
|
||||||
|
dto.setList(rankingDTOList);
|
||||||
|
return Result.success(dto);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
version: "3.0"
|
||||||
|
services:
|
||||||
|
tianze-upload:
|
||||||
|
build:
|
||||||
|
context: ./upload/upload-service
|
||||||
|
args:
|
||||||
|
JAVA_OPTS: '-Xmn256M -Xmx1024M'
|
||||||
|
RUN_ARGS: '--spring.profiles.active=pro --spring.cloud.nacos.server-addr=172.19.255.105:8848'
|
||||||
|
image: alient/tianze:upload
|
||||||
|
container_name: upload
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /tmp/logs/upload:/root/tianze/logs/upload
|
||||||
|
- /root/tianze/www/pic/:/users/root/www/pic/
|
||||||
|
networks:
|
||||||
|
- tianze
|
||||||
|
ports:
|
||||||
|
- "50015:50015"
|
||||||
|
tianze-user:
|
||||||
|
build:
|
||||||
|
context: ./user/user-service
|
||||||
|
args:
|
||||||
|
JAVA_OPTS: '-Xmn256M -Xmx1024M'
|
||||||
|
RUN_ARGS: '--spring.profiles.active=pro --spring.cloud.nacos.server-addr=172.19.255.105:8848'
|
||||||
|
image: alient/tianze:user
|
||||||
|
container_name: user
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /tmp/logs/user:/root/tianze/logs/user
|
||||||
|
networks:
|
||||||
|
- tianze
|
||||||
|
ports:
|
||||||
|
- "50011:50011"
|
||||||
|
tianze-system:
|
||||||
|
build:
|
||||||
|
context: ./system/system-service
|
||||||
|
args:
|
||||||
|
JAVA_OPTS: '-Xmn256M -Xmx1024M'
|
||||||
|
RUN_ARGS: '--spring.profiles.active=pro --spring.cloud.nacos.server-addr=172.19.255.105:8848'
|
||||||
|
image: alient/tianze:system
|
||||||
|
container_name: system
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /tmp/logs/system:/root/tianze/logs/system
|
||||||
|
networks:
|
||||||
|
- tianze
|
||||||
|
ports:
|
||||||
|
- "50014:50014"
|
||||||
|
tianze-gateway:
|
||||||
|
build:
|
||||||
|
context: ./gateway
|
||||||
|
args:
|
||||||
|
JAVA_OPTS: '-Xmn256M -Xmx1024M'
|
||||||
|
RUN_ARGS: '--spring.profiles.active=pro --spring.cloud.nacos.server-addr=172.19.255.105:8848'
|
||||||
|
image: alient/tianze:gateway
|
||||||
|
container_name: gateway
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /tmp/logs/gateway:/root/tianze/logs/gateway
|
||||||
|
networks:
|
||||||
|
- tianze
|
||||||
|
ports:
|
||||||
|
- "50010:50010"
|
||||||
|
tianze-exam:
|
||||||
|
build:
|
||||||
|
context: ./exam/exam-service
|
||||||
|
args:
|
||||||
|
JAVA_OPTS: '-Xmn256M -Xmx1024M'
|
||||||
|
RUN_ARGS: '--spring.profiles.active=pro --spring.cloud.nacos.server-addr=172.19.255.105:8848'
|
||||||
|
image: alient/tianze:exam
|
||||||
|
container_name: exam
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /tmp/logs/exam:/root/tianze/logs/exam
|
||||||
|
networks:
|
||||||
|
- tianze
|
||||||
|
ports:
|
||||||
|
- "50013:50013"
|
||||||
|
tianze-competition:
|
||||||
|
build:
|
||||||
|
context: ./competition/competition-service
|
||||||
|
args:
|
||||||
|
JAVA_OPTS: '-Xmn256M -Xmx1024M'
|
||||||
|
RUN_ARGS: '--spring.profiles.active=pro --spring.cloud.nacos.server-addr=172.19.255.105:8848'
|
||||||
|
image: alient/tianze:competition
|
||||||
|
container_name: competition
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /tmp/logs/competition:/root/tianze/logs/competition
|
||||||
|
networks:
|
||||||
|
- tianze
|
||||||
|
ports:
|
||||||
|
- "50012:50012"
|
||||||
|
networks:
|
||||||
|
tianze:
|
||||||
|
driver: bridge
|
@ -0,0 +1,8 @@
|
|||||||
|
FROM daocloud.io/library/java:8-jre-alpine
|
||||||
|
MAINTAINER tianze
|
||||||
|
ARG JAVA_OPTS="-Xmx128M"
|
||||||
|
ENV JAVA_OPTS=$JAVA_OPTS
|
||||||
|
ARG RUN_ARGS="--spring.profiles.active=dev"
|
||||||
|
ENV RUN_ARGS=$RUN_ARGS
|
||||||
|
ADD target/tianze-exam.jar /exam-service.jar
|
||||||
|
ENTRYPOINT ["sh","-c","java $JAVA_OPTS -jar /exam-service.jar $RUN_ARGS"]
|
@ -0,0 +1,8 @@
|
|||||||
|
FROM daocloud.io/library/java:8-jre-alpine
|
||||||
|
MAINTAINER tianze
|
||||||
|
ARG JAVA_OPTS="-Xmn256M -Xmx1024M"
|
||||||
|
ENV JAVA_OPTS=$JAVA_OPTS
|
||||||
|
ARG RUN_ARGS="--spring.profiles.active=pro --spring.cloud.nacos.server-addr=172.19.255.105:8848"
|
||||||
|
ENV RUN_ARGS=$RUN_ARGS
|
||||||
|
ADD target/tianze-gateway.jar /gateway-service.jar
|
||||||
|
ENTRYPOINT ["sh","-c","java $JAVA_OPTS -jar /gateway-service.jar $RUN_ARGS"]
|
@ -0,0 +1,8 @@
|
|||||||
|
FROM daocloud.io/library/java:8-jre-alpine
|
||||||
|
MAINTAINER tianze
|
||||||
|
ARG JAVA_OPTS="-Xmx128M"
|
||||||
|
ENV JAVA_OPTS=$JAVA_OPTS
|
||||||
|
ARG RUN_ARGS="--spring.profiles.active=dev"
|
||||||
|
ENV RUN_ARGS=$RUN_ARGS
|
||||||
|
ADD target/tianze-system.jar /system-service.jar
|
||||||
|
ENTRYPOINT ["sh","-c","java $JAVA_OPTS -jar /system-service.jar $RUN_ARGS"]
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.tz.platform.system.api;
|
||||||
|
|
||||||
|
import com.tz.platform.common.core.base.Result;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/system")
|
||||||
|
public class SystemController {
|
||||||
|
|
||||||
|
@GetMapping(value = "init")
|
||||||
|
public Result<String> init(){
|
||||||
|
|
||||||
|
return Result.success("success");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.tz.platform.system.api.biz;
|
||||||
|
|
||||||
|
import com.tz.platform.common.core.base.Result;
|
||||||
|
import com.tz.platform.feign.user.IFeignUser;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class SystemBiz {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IFeignUser feignUser;
|
||||||
|
|
||||||
|
public Result<String> initSystem(){
|
||||||
|
|
||||||
|
return Result.success("success");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
FROM daocloud.io/library/java:8-jre-alpine
|
||||||
|
MAINTAINER tianze
|
||||||
|
ARG JAVA_OPTS="-Xmx128M"
|
||||||
|
ENV JAVA_OPTS=$JAVA_OPTS
|
||||||
|
ARG RUN_ARGS="--spring.profiles.active=dev"
|
||||||
|
ENV RUN_ARGS=$RUN_ARGS
|
||||||
|
ADD target/tianze-upload.jar /upload-service.jar
|
||||||
|
ENTRYPOINT ["sh","-c","java $JAVA_OPTS -jar /upload-service.jar $RUN_ARGS"]
|
@ -0,0 +1,8 @@
|
|||||||
|
FROM daocloud.io/library/java:8-jre-alpine
|
||||||
|
MAINTAINER tianze
|
||||||
|
ARG JAVA_OPTS="-Xmx128M"
|
||||||
|
ENV JAVA_OPTS=$JAVA_OPTS
|
||||||
|
ARG RUN_ARGS="--spring.profiles.active=pro --spring.cloud.nacos.server-addr=172.19.255.105:8848"
|
||||||
|
ENV RUN_ARGS=$RUN_ARGS
|
||||||
|
ADD target/tianze-user.jar /user-service.jar
|
||||||
|
ENTRYPOINT ["sh","-c","java $JAVA_OPTS -jar /user-service.jar $RUN_ARGS"]
|
Loading…
Reference in New Issue