forked from ZhongFuCheng3y/austin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
277 additions
and
7 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
austin-support/src/main/java/com/java3y/austin/support/dao/ChannelAccountDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.java3y.austin.support.dao; | ||
|
||
|
||
import com.java3y.austin.support.domain.ChannelAccount; | ||
import com.java3y.austin.support.domain.MessageTemplate; | ||
import com.java3y.austin.support.domain.SmsRecord; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 渠道账号信息 Dao | ||
* | ||
* @author 3y | ||
*/ | ||
public interface ChannelAccountDao extends CrudRepository<ChannelAccount, Long> { | ||
|
||
|
||
/** | ||
* 查询 列表(分页) | ||
* | ||
* @param deleted 0:未删除 1:删除 | ||
* @param channelType 渠道值 | ||
* @return | ||
*/ | ||
List<ChannelAccount> findAllByIsDeletedEqualsAndSendChannelEquals(Integer deleted, Integer channelType); | ||
|
||
|
||
/** | ||
* 统计未删除的条数 | ||
* | ||
* @param deleted | ||
* @return | ||
*/ | ||
Long countByIsDeletedEquals(Integer deleted); | ||
} |
61 changes: 61 additions & 0 deletions
61
austin-support/src/main/java/com/java3y/austin/support/domain/ChannelAccount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.java3y.austin.support.domain; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
|
||
/** | ||
* @author 3y | ||
* 渠道账号信息 | ||
*/ | ||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Entity | ||
public class ChannelAccount { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
/** | ||
* 账号名称 | ||
*/ | ||
private String name; | ||
|
||
/** | ||
* 发送渠道 | ||
* 枚举值:com.java3y.austin.common.enums.ChannelType | ||
*/ | ||
private Integer sendChannel; | ||
|
||
/** | ||
* 账号配置 | ||
*/ | ||
private String accountConfig; | ||
|
||
/** | ||
* 是否删除 | ||
* 0:未删除 | ||
* 1:已删除 | ||
*/ | ||
private Integer isDeleted; | ||
|
||
/** | ||
* 创建时间 单位 s | ||
*/ | ||
private Integer created; | ||
|
||
/** | ||
* 更新时间 单位s | ||
*/ | ||
private Integer updated; | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
austin-web/src/main/java/com/java3y/austin/web/controller/ChannelAccountController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.java3y.austin.web.controller; | ||
|
||
|
||
import com.java3y.austin.common.constant.AustinConstant; | ||
import com.java3y.austin.common.vo.BasicResultVO; | ||
import com.java3y.austin.support.dao.ChannelAccountDao; | ||
import com.java3y.austin.support.domain.ChannelAccount; | ||
import com.java3y.austin.support.domain.MessageTemplate; | ||
import com.java3y.austin.web.service.ChannelAccountService; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
/** | ||
* 渠道账号管理接口 | ||
* | ||
* @author 3y | ||
*/ | ||
@Slf4j | ||
@RestController | ||
@RequestMapping("/account") | ||
@Api("素材管理接口") | ||
@CrossOrigin(origins = "http://localhost:3000", allowCredentials = "true", allowedHeaders = "*") | ||
public class ChannelAccountController { | ||
|
||
@Autowired | ||
private ChannelAccountService channelAccountService; | ||
|
||
|
||
/** | ||
* 如果Id存在,则修改 | ||
* 如果Id不存在,则保存 | ||
*/ | ||
@PostMapping("/save") | ||
@ApiOperation("/保存数据") | ||
public BasicResultVO saveOrUpdate(@RequestBody ChannelAccount channelAccount) { | ||
return BasicResultVO.success(channelAccountService.save(channelAccount)); | ||
} | ||
|
||
/** | ||
* 根据渠道标识查询渠道账号相关的信息 | ||
*/ | ||
@GetMapping("/query") | ||
@ApiOperation("/保存数据") | ||
public BasicResultVO query(Integer channelType) { | ||
return BasicResultVO.success(channelAccountService.queryByChannelType(channelType)); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
austin-web/src/main/java/com/java3y/austin/web/service/ChannelAccountService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.java3y.austin.web.service; | ||
|
||
|
||
import com.java3y.austin.common.vo.BasicResultVO; | ||
import com.java3y.austin.support.domain.ChannelAccount; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 渠道账号接口 | ||
* | ||
* @author 3y | ||
*/ | ||
public interface ChannelAccountService { | ||
|
||
|
||
/** | ||
* 保存/修改渠道账号信息 | ||
* | ||
* @param channelAccount | ||
* @return | ||
*/ | ||
ChannelAccount save(ChannelAccount channelAccount); | ||
|
||
/** | ||
* 根据渠道标识查询账号信息 | ||
* | ||
* @param channelType 渠道标识 | ||
* @return | ||
*/ | ||
List<ChannelAccount> queryByChannelType(Integer channelType); | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
austin-web/src/main/java/com/java3y/austin/web/service/impl/ChannelAccountServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.java3y.austin.web.service.impl; | ||
|
||
import cn.hutool.core.date.DateUtil; | ||
import com.java3y.austin.common.constant.AustinConstant; | ||
import com.java3y.austin.support.dao.ChannelAccountDao; | ||
import com.java3y.austin.support.domain.ChannelAccount; | ||
import com.java3y.austin.web.service.ChannelAccountService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author 3y | ||
*/ | ||
@Service | ||
public class ChannelAccountServiceImpl implements ChannelAccountService { | ||
|
||
@Autowired | ||
private ChannelAccountDao channelAccountDao; | ||
@Override | ||
public ChannelAccount save(ChannelAccount channelAccount) { | ||
if (channelAccount.getId() == null) { | ||
channelAccount.setCreated(Math.toIntExact(DateUtil.currentSeconds())); | ||
channelAccount.setIsDeleted(AustinConstant.FALSE); | ||
} | ||
channelAccount.setUpdated(Math.toIntExact(DateUtil.currentSeconds())); | ||
return channelAccountDao.save(channelAccount); | ||
} | ||
|
||
@Override | ||
public List<ChannelAccount> queryByChannelType(Integer channelType) { | ||
return channelAccountDao.findAllByIsDeletedEqualsAndSendChannelEquals(AustinConstant.FALSE, channelType); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 使用openjdk8的镜像 | ||
FROM openjdk:8-jre | ||
|
||
ENV PARAMS="" | ||
|
||
# 设置工作目录 | ||
WORKDIR /build | ||
# 将jar包复制到容器中 | ||
ADD ./austin-web-0.0.1-SNAPSHOT.jar ./austin.jar | ||
# 暴露8080端口 | ||
EXPOSE 8080 | ||
|
||
# 运行jar包 | ||
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS austin.jar $PARAMS"] | ||
|
||
|
||
# docker run -e PARAMS="--austin-database-ip= --austin-database-port=3306 --austin-redis-ip= --austin-mq-pipeline=eventbus " -p 8080:8080 --name austin:1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters