diff --git a/eladmin-common/src/main/java/me/zhengjie/base/OperatorBaseEntity.java b/eladmin-common/src/main/java/me/zhengjie/base/OperatorBaseEntity.java new file mode 100644 index 0000000..cf1234d --- /dev/null +++ b/eladmin-common/src/main/java/me/zhengjie/base/OperatorBaseEntity.java @@ -0,0 +1,35 @@ +package me.zhengjie.base; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import javax.persistence.Column; +import javax.persistence.EntityListeners; +import javax.persistence.MappedSuperclass; +import java.sql.Timestamp; + +/** + * @author Enzo + * @date : 2021/4/14 + */ +@Getter +@Setter +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +public class OperatorBaseEntity { + + @Column(name = "gmt_create") + @ApiModelProperty(value = "生成时间") + private Timestamp gmtCreate; + + @Column(name = "gmt_modified") + @ApiModelProperty(value = "修改时间") + private Timestamp gmtModified; + + @Column(name = "operator") + @ApiModelProperty(value = "操作人") + private String operator; + +} diff --git a/eladmin-common/src/main/java/me/zhengjie/constant/SmsConstant.java b/eladmin-common/src/main/java/me/zhengjie/constant/SmsConstant.java new file mode 100644 index 0000000..8e76185 --- /dev/null +++ b/eladmin-common/src/main/java/me/zhengjie/constant/SmsConstant.java @@ -0,0 +1,36 @@ +package me.zhengjie.constant; + + +/** + * @author Enzo + * @date : 2021/4/14 + * 短信发送常量 + */ +public class SmsConstant { + /** + * APP ID + */ + public static final String APP_ID = "app1"; + + public static final String FORMATE_TIMESTAMP = "yyyyMMddHHmmss"; + + /** + * TOKEN + */ + public static final String TOKEN = "f625d0a23493cd8aeb8ada97da7a7b65"; + + + /** + * 短信url + */ + public static final String SMS_LINK = "http://api.hzdaba.cn/v2/Accounts/baiyekeji_label/Sms/send"; + + + + + + + + + +} diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/enums/StatusEnum.java b/eladmin-common/src/main/java/me/zhengjie/utils/enums/StatusEnum.java new file mode 100644 index 0000000..e1850f5 --- /dev/null +++ b/eladmin-common/src/main/java/me/zhengjie/utils/enums/StatusEnum.java @@ -0,0 +1,29 @@ +package me.zhengjie.utils.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author Enzo + * @date : 2021/4/14 + */ +@Getter +@AllArgsConstructor +public enum StatusEnum { + + + /** 成功*/ + SUCCESS(1,"成功"), + + /** 进行中 */ + PROCESSING(0,"进行中"), + + /** 审核未通过 */ + UNSUCCESSFUL(-1,"未成功"); + + private final Integer value; + private final String description; + + + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/sms/domain/TbTemplate.java b/eladmin-system/src/main/java/me/zhengjie/modules/sms/domain/TbTemplate.java new file mode 100644 index 0000000..b83e8f4 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/sms/domain/TbTemplate.java @@ -0,0 +1,90 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.sms.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import me.zhengjie.base.BaseEntity; +import me.zhengjie.base.OperatorBaseEntity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @website https://el-admin.vip +* @description / +* @author Enzo +* @date 2021-04-14 +**/ +@Entity +@Getter +@Setter +@Table(name="tb_template") +public class TbTemplate extends OperatorBaseEntity implements Serializable { + + @Id + @Column(name = "id") + @NotNull(groups = BaseEntity.Update.class) + @ApiModelProperty(value = "ID", hidden = true) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(name = "template_name") + @ApiModelProperty(value = "模板名称") + private String templateName; + + @Column(name = "template_status") + @ApiModelProperty(value = "审核状态 0-申请中 1-申请通过 1-未通过") + private Integer templateStatus; + + @Column(name = "send_message") + @ApiModelProperty(value = "发送的信息") + private String sendMessage; + + @Column(name = "audit_time") + @ApiModelProperty(value = "审核时间") + private Timestamp auditTime; + + @Column(name = "last_update_time") + @ApiModelProperty(value = "生成时间") + private Timestamp lastUpdateTime; + + @Column(name = "remark") + @ApiModelProperty(value = "备注") + private String remark; + + @Column(name = "reviewer") + @ApiModelProperty(value = "审核人员") + private String reviewer; + + @Column(name = "rejected_msg") + @ApiModelProperty(value = "驳回原因") + private String rejectedMsg; + + + @Column(name = "link_url") + @ApiModelProperty(value = "跳转链接") + private String linkUrl; + + public void copy(TbTemplate source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/sms/repository/TbTemplateRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/sms/repository/TbTemplateRepository.java new file mode 100644 index 0000000..c41a4f8 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/sms/repository/TbTemplateRepository.java @@ -0,0 +1,37 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.sms.repository; + + +import me.zhengjie.modules.sms.domain.TbTemplate; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://el-admin.vip +* @author Enzo +* @date 2021-04-14 +**/ +public interface TbTemplateRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 根据名称查询 + * @param name 名称 + * @return / + */ + TbTemplate findByTemplateName(String name); + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/sms/rest/TbTemplateController.java b/eladmin-system/src/main/java/me/zhengjie/modules/sms/rest/TbTemplateController.java new file mode 100644 index 0000000..10be9ab --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/sms/rest/TbTemplateController.java @@ -0,0 +1,100 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.sms.rest; + +import me.zhengjie.annotation.Log; +; +import me.zhengjie.modules.sms.domain.TbTemplate; +import me.zhengjie.modules.sms.service.TbTemplateService; +import me.zhengjie.modules.sms.service.dto.TbTemplateQueryCriteria; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://el-admin.vip +* @author Enzo +* @date 2021-04-14 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "TemplateController管理") +@RequestMapping("/api/tbTemplate") +public class TbTemplateController { + + private final TbTemplateService tbTemplateService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('tbTemplate:list')") + public void download(HttpServletResponse response, TbTemplateQueryCriteria criteria) throws IOException { + tbTemplateService.download(tbTemplateService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询TemplateController") + @ApiOperation("查询TemplateController") + @PreAuthorize("@el.check('tbTemplate:list')") + public ResponseEntity query(TbTemplateQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(tbTemplateService.queryAll(criteria,pageable),HttpStatus.OK); + } + + + @Log("新增TemplateController") + @ApiOperation("新增TemplateController") + @PostMapping + @PreAuthorize("@el.check('tbTemplate:add')") + public ResponseEntity create(@Validated @RequestBody TbTemplate resources){ + tbTemplateService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改TemplateController") + @ApiOperation("修改TemplateController") + @PreAuthorize("@el.check('tbTemplate:edit')") + public ResponseEntity update(@Validated @RequestBody TbTemplate resources){ + tbTemplateService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除TemplateController") + @ApiOperation("删除TemplateController") + @PreAuthorize("@el.check('tbTemplate:del')") + @DeleteMapping + public ResponseEntity delete(@RequestBody Long[] ids) { + tbTemplateService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + + @Log("审核TemplateController") + @ApiOperation("审核TemplateController") + @PreAuthorize("@el.check('tbTemplate:review')") + @PostMapping("/review") + public ResponseEntity review(@Validated @RequestBody TbTemplate resources){ + tbTemplateService.review(resources); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/TbTemplateService.java b/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/TbTemplateService.java new file mode 100644 index 0000000..e2f3fd2 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/TbTemplateService.java @@ -0,0 +1,90 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.sms.service; + + +import me.zhengjie.modules.sms.domain.TbTemplate; +import me.zhengjie.modules.sms.service.dto.TbTemplateDto; +import me.zhengjie.modules.sms.service.dto.TbTemplateQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://el-admin.vip +* @description 服务接口 +* @author Enzo +* @date 2021-04-14 +**/ +public interface TbTemplateService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(TbTemplateQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(TbTemplateQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return TbTemplateDto + */ + TbTemplateDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return TbTemplateDto + */ + void create(TbTemplate resources); + + /** + * 编辑 + * @param resources / + */ + void update(TbTemplate resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + /** + * 平台审核 + * @param resources + */ + void review(TbTemplate resources); +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/dto/TbTemplateDto.java b/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/dto/TbTemplateDto.java new file mode 100644 index 0000000..6a45fb8 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/dto/TbTemplateDto.java @@ -0,0 +1,73 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.sms.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; + +/** +* @website https://el-admin.vip +* @description / +* @author Enzo +* @date 2021-04-14 +**/ +@Data +public class TbTemplateDto implements Serializable { + + /** 防止精度丢失 */ + @JsonSerialize(using= ToStringSerializer.class) + private Long id; + + /** 模板名称 */ + private String templateName; + + /** 审核状态 0-申请中 1-申请通过 1-未通过 */ + private Integer templateStatus; + + /** 发送的信息 */ + private String sendMessage; + + /** 审核时间 */ + private Timestamp auditTime; + + /** 生成时间 */ + private Timestamp lastUpdateTime; + + /** 备注 */ + private String remark; + + /** 审核人员 */ + private String reviewer; + + /** 驳回原因 */ + private String rejectedMsg; + + /** 生成时间 */ + private Timestamp gmtCreate; + + /** 修改时间 */ + private Timestamp gmtModified; + + /** 操作人 */ + private String operator; + + /** 操作人 */ + private String linkUrl; + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/dto/TbTemplateQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/dto/TbTemplateQueryCriteria.java new file mode 100644 index 0000000..bd02c9e --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/dto/TbTemplateQueryCriteria.java @@ -0,0 +1,29 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.sms.service.dto; + +import lombok.Data; +import java.util.List; +import me.zhengjie.annotation.Query; + +/** +* @website https://el-admin.vip +* @author Enzo +* @date 2021-04-14 +**/ +@Data +public class TbTemplateQueryCriteria{ +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/impl/TbTemplateServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/impl/TbTemplateServiceImpl.java new file mode 100644 index 0000000..3e627a8 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/impl/TbTemplateServiceImpl.java @@ -0,0 +1,141 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.sms.service.impl; + +import lombok.RequiredArgsConstructor; +import me.zhengjie.exception.EntityExistException; +import me.zhengjie.modules.sms.domain.TbTemplate; +import me.zhengjie.modules.sms.repository.TbTemplateRepository; +import me.zhengjie.modules.sms.service.TbTemplateService; +import me.zhengjie.modules.sms.service.dto.TbTemplateDto; +import me.zhengjie.modules.sms.service.dto.TbTemplateQueryCriteria; +import me.zhengjie.modules.sms.service.mapstruct.TbTemplateMapper; +import me.zhengjie.utils.*; +import me.zhengjie.utils.enums.StatusEnum; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** +* @website https://el-admin.vip +* @description 服务实现 +* @author Enzo +* @date 2021-04-14 +**/ +@Service +@RequiredArgsConstructor +public class TbTemplateServiceImpl implements TbTemplateService { + + private final TbTemplateRepository tbTemplateRepository; + private final TbTemplateMapper tbTemplateMapper; + + @Override + public Map queryAll(TbTemplateQueryCriteria criteria, Pageable pageable){ + Page page = tbTemplateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(tbTemplateMapper::toDto)); + } + + @Override + public List queryAll(TbTemplateQueryCriteria criteria){ + return tbTemplateMapper.toDto(tbTemplateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public TbTemplateDto findById(Long id) { + TbTemplate tbTemplate = tbTemplateRepository.findById(id).orElseGet(TbTemplate::new); + ValidationUtil.isNull(tbTemplate.getId(),"TbTemplate","id",id); + return tbTemplateMapper.toDto(tbTemplate); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(TbTemplate resources) { + TbTemplate template = tbTemplateRepository.findByTemplateName(resources.getTemplateName()); + if(template != null){ + throw new EntityExistException(TbTemplate.class,"name",resources.getTemplateName()); + } + Timestamp timestamp = new Timestamp(System.currentTimeMillis()); + resources.setGmtModified(timestamp); + resources.setGmtCreate(timestamp); + resources.setOperator(SecurityUtils.getCurrentUser().getUsername()); + resources.setTemplateStatus(StatusEnum.PROCESSING.getValue()); + + tbTemplateRepository.save(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TbTemplate resources) { + TbTemplate tbTemplate = tbTemplateRepository.findById(resources.getId()).orElseGet(TbTemplate::new); + ValidationUtil.isNull( tbTemplate.getId(),"TbTemplate","id",resources.getId()); + Timestamp timestamp = new Timestamp(System.currentTimeMillis()); + tbTemplate.setReviewer(SecurityUtils.getCurrentUser().getUsername()); + tbTemplate.setAuditTime(timestamp); + tbTemplate.setLastUpdateTime(timestamp); + tbTemplate.copy(resources); + tbTemplateRepository.save(tbTemplate); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + tbTemplateRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (TbTemplateDto tbTemplate : all) { + Map map = new LinkedHashMap<>(); + map.put("模板名称", tbTemplate.getTemplateName()); + map.put("审核状态 0-申请中 1-申请通过 1-未通过", tbTemplate.getTemplateStatus()); + map.put("发送的信息", tbTemplate.getSendMessage()); + map.put("审核时间", tbTemplate.getAuditTime()); + map.put("最后修改时间", tbTemplate.getLastUpdateTime()); + map.put("备注", tbTemplate.getRemark()); + map.put("审核人员", tbTemplate.getReviewer()); + map.put("驳回原因", tbTemplate.getRejectedMsg()); + map.put("生成时间", tbTemplate.getGmtCreate()); + map.put("修改时间", tbTemplate.getGmtModified()); + map.put("操作人", tbTemplate.getOperator()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public void review(TbTemplate resources) { + TbTemplate tbTemplate = tbTemplateRepository.findById(resources.getId()).orElseGet(TbTemplate::new); + ValidationUtil.isNull(tbTemplate.getId(),"TbTemplate","id",resources.getId()); + Timestamp timestamp = new Timestamp(System.currentTimeMillis()); + tbTemplate.copy(resources); + tbTemplate.setAuditTime(timestamp); + tbTemplate.setLastUpdateTime(timestamp); + tbTemplateRepository.save(tbTemplate); + } + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/mapstruct/TbTemplateMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/mapstruct/TbTemplateMapper.java new file mode 100644 index 0000000..2328d3f --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/sms/service/mapstruct/TbTemplateMapper.java @@ -0,0 +1,33 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.sms.service.mapstruct; + + +import me.zhengjie.base.BaseMapper; +import me.zhengjie.modules.sms.domain.TbTemplate; +import me.zhengjie.modules.sms.service.dto.TbTemplateDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://el-admin.vip +* @author Enzo +* @date 2021-04-14 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface TbTemplateMapper extends BaseMapper { + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/sms/vo/SendVo.java b/eladmin-system/src/main/java/me/zhengjie/modules/sms/vo/SendVo.java new file mode 100644 index 0000000..66878a1 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/sms/vo/SendVo.java @@ -0,0 +1,20 @@ +package me.zhengjie.modules.sms.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author Enzo + * @date : 2021/4/14 + */ +@Data +public class SendVo { + @ApiModelProperty("手机号码集合") + private List phoneList; + @ApiModelProperty("发送链接") + private String linkUrl; + @ApiModelProperty("模板id") + private String sendMessage; +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/upload/task/model/SendSmsJsonContent.java b/eladmin-system/src/main/java/me/zhengjie/modules/upload/task/model/SendSmsJsonContent.java new file mode 100644 index 0000000..15e47f7 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/upload/task/model/SendSmsJsonContent.java @@ -0,0 +1,58 @@ +package me.zhengjie.modules.upload.task.model; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author Enzo + * @date : 2021/4/15 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class SendSmsJsonContent { + + /** + * 签名校验 + * + * sig值= MD5(开发者账户ID + 开发者账户授权令牌 + 时间戳) + * MD5值共32位(注:转成大写) + * 时间戳是当前系统时间(24小时制),格式“yyyyMMddHHmmss”。时间戳有效时间为50分钟 + */ + @JSONField(name = "sig") + private String sig; + + /** + * 开发者账号下的APP ID + */ + @JSONField(name = "appid") + private String appId; + + /** + * 请求唯一id + * 随机生成的字符串, 8~16位字符串 + */ + @JSONField(name = "number_id") + private String numberId; + + /** + * 电话号码 + */ + @JSONField(name = "mobile") + private String mobile; + + + @JSONField(name = "result_url") + private String resultUrl; + + /** + * (非必须参数) + * 数据过期自动释放的天数 + * 默认30天,无此字段则默认30天后过期释放 + */ + + @JSONField(name = "template") + private String template; +}