12 changed files with 276 additions and 0 deletions
@ -0,0 +1,64 @@ |
|||||
|
package com.elink.esua.epdc.controller; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
||||
|
import com.elink.esua.epdc.dto.DeptOption; |
||||
|
import com.elink.esua.epdc.dto.form.EpiDemicReportFormDTO; |
||||
|
import com.elink.esua.epdc.service.CustomService; |
||||
|
import com.elink.esua.epdc.service.MessageService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* @author yinzuomei |
||||
|
* @Description 疫情管理 |
||||
|
* @Date 2020/1/28 11:26 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("custom/epidemic") |
||||
|
public class ApiCustomController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CustomService customService; |
||||
|
|
||||
|
@Autowired |
||||
|
private MessageService messageService; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @param |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
||||
|
* @Author yinzuomei |
||||
|
* @Description 获取所有组织机构信息 |
||||
|
* @Date 2020/1/28 11:50 |
||||
|
**/ |
||||
|
@GetMapping("getDeptTree") |
||||
|
public Result<DeptOption> getDeptTree() { |
||||
|
return customService.getDeptTree(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param mobile 手机号码 |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
||||
|
* @Author yinzuomei |
||||
|
* @Description 发送短信验证码 |
||||
|
* @Date 2020/1/28 11:55 |
||||
|
**/ |
||||
|
@GetMapping("sendCode") |
||||
|
public Result sendCode(String mobile) { |
||||
|
return messageService.sendSmsCode(mobile); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param formDTO |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
||||
|
* @Author yinzuomei |
||||
|
* @Description 疫情上报 |
||||
|
* @Date 2020/1/28 13:23 |
||||
|
**/ |
||||
|
@PostMapping("report") |
||||
|
public Result report(@RequestBody EpiDemicReportFormDTO formDTO) { |
||||
|
ValidatorUtils.validateEntity(formDTO); |
||||
|
return customService.report(formDTO); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
package com.elink.esua.epdc.feign; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.form.EpiDemicReportFormDTO; |
||||
|
import com.elink.esua.epdc.feign.fallback.CustomFeignClientFallback; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.http.MediaType; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
|
||||
|
/** |
||||
|
* @author yzm |
||||
|
* @Date: 2020/1/28 13:24 |
||||
|
* @Description: 定制化功能模块fegin |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.EPDC_CUSTOM_SERVER, fallback = CustomFeignClientFallback.class) |
||||
|
public interface CustomFeignClient { |
||||
|
/** |
||||
|
* @param formDTO |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
||||
|
* @Author yinzuomei |
||||
|
* @Description 疫情上报 |
||||
|
* @Date 2020/1/28 13:27 |
||||
|
**/ |
||||
|
@PostMapping(value = "custom/epidemic/report", consumes = MediaType.APPLICATION_JSON_VALUE) |
||||
|
Result report(EpiDemicReportFormDTO formDTO); |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.elink.esua.epdc.feign.fallback; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.form.EpiDemicReportFormDTO; |
||||
|
import com.elink.esua.epdc.feign.CustomFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @Description 定制化功能模块fegin |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/1/28 13:26 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class CustomFeignClientFallback implements CustomFeignClient { |
||||
|
|
||||
|
@Override |
||||
|
public Result report(EpiDemicReportFormDTO formDTO) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPDC_CUSTOM_SERVER, "report", formDTO); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
package com.elink.esua.epdc.service; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.DeptOption; |
||||
|
import com.elink.esua.epdc.dto.form.EpiDemicReportFormDTO; |
||||
|
|
||||
|
/** |
||||
|
* @Description 疫情管理 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/1/28 13:39 |
||||
|
*/ |
||||
|
public interface CustomService { |
||||
|
/** |
||||
|
* @param |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.DeptOption> |
||||
|
* @Author yinzuomei |
||||
|
* @Description 获取所有组织机构信息 |
||||
|
* @Date 2020/1/28 12:14 |
||||
|
**/ |
||||
|
Result<DeptOption> getDeptTree(); |
||||
|
|
||||
|
/** |
||||
|
* @param formDTO |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
||||
|
* @Author yinzuomei |
||||
|
* @Description 疫情上报 |
||||
|
* @Date 2020/1/28 13:23 |
||||
|
**/ |
||||
|
Result report(EpiDemicReportFormDTO formDTO); |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
package com.elink.esua.epdc.service.impl; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.DeptOption; |
||||
|
import com.elink.esua.epdc.dto.form.EpiDemicReportFormDTO; |
||||
|
import com.elink.esua.epdc.feign.AdminFeignClient; |
||||
|
import com.elink.esua.epdc.feign.CustomFeignClient; |
||||
|
import com.elink.esua.epdc.service.CustomService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* @Description 疫情管理实现 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/1/28 11:42 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CustomServiceImpl implements CustomService { |
||||
|
|
||||
|
@Autowired |
||||
|
private AdminFeignClient adminFeignClient; |
||||
|
@Autowired |
||||
|
private CustomFeignClient customFeignClient; |
||||
|
|
||||
|
/** |
||||
|
* @param |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.DeptOption> |
||||
|
* @Author yinzuomei |
||||
|
* @Description 获取所有组织机构信息 |
||||
|
* @Date 2020/1/28 13:31 |
||||
|
**/ |
||||
|
@Override |
||||
|
public Result<DeptOption> getDeptTree() { |
||||
|
return adminFeignClient.getDeptTree(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param formDTO |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
||||
|
* @Author yinzuomei |
||||
|
* @Description 疫情上报 |
||||
|
* @Date 2020/1/28 13:31 |
||||
|
**/ |
||||
|
@Override |
||||
|
public Result report(EpiDemicReportFormDTO formDTO) { |
||||
|
return customFeignClient.report(formDTO); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,56 @@ |
|||||
|
package com.elink.esua.epdc.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description 上报接口入参DTO |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/1/28 13:15 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EpiDemicReportFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 2379520294973498819L; |
||||
|
/** |
||||
|
* 是否是网格党建指导员(0:否,1:是) |
||||
|
*/ |
||||
|
@NotBlank(message = "网格党建指导员标识不能为空") |
||||
|
private String instructorFlag; |
||||
|
|
||||
|
/** |
||||
|
* 部门ID |
||||
|
*/ |
||||
|
private Long deptId; |
||||
|
|
||||
|
/** |
||||
|
* 地点 |
||||
|
*/ |
||||
|
@NotBlank(message = "地点不能为空") |
||||
|
private String address; |
||||
|
|
||||
|
/** |
||||
|
* 上报人姓名 |
||||
|
*/ |
||||
|
@NotBlank(message = "上报人姓名不能为空") |
||||
|
private String reporter; |
||||
|
|
||||
|
/** |
||||
|
* 上报人电话 |
||||
|
*/ |
||||
|
@NotBlank(message = "上报人电话不能为空") |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 验证码 |
||||
|
*/ |
||||
|
@NotBlank(message = "验证码不能为空") |
||||
|
private String smsCode; |
||||
|
|
||||
|
/** |
||||
|
* 上报内容 |
||||
|
*/ |
||||
|
@NotBlank(message = "上报内容不能为空") |
||||
|
private String content; |
||||
|
} |
||||
Loading…
Reference in new issue