You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

175 lines
5.9 KiB

package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.dto.form.mq.MqBaseFormDTO;
3 years ago
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcVolunteerPolyDTO;
3 years ago
import com.epmet.dto.form.LonAndLatFormDTO;
import com.epmet.dto.form.VolunteerPolyListFormDTO;
import com.epmet.dto.form.VolunteerPolyMapDataFormDTO;
import com.epmet.dto.form.VolunteerPolyPieFormDTO;
import com.epmet.dto.result.VolunteerPolyMapDataResultDTO;
import com.epmet.dto.result.VolunteerPolyPieResultDTO;
import com.epmet.service.IcVolunteerPolyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 志愿者信息聚合
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-05-19
*/
@RestController
@RequestMapping("icVolunteerPoly")
public class IcVolunteerPolyController {
@Autowired
private IcVolunteerPolyService icVolunteerPolyService;
@RequestMapping("page")
public Result<PageData<IcVolunteerPolyDTO>> page(@RequestParam Map<String, Object> params) {
PageData<IcVolunteerPolyDTO> page = icVolunteerPolyService.page(params);
return new Result<PageData<IcVolunteerPolyDTO>>().ok(page);
}
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET})
public Result<IcVolunteerPolyDTO> get(@PathVariable("id") String id) {
IcVolunteerPolyDTO data = icVolunteerPolyService.get(id);
return new Result<IcVolunteerPolyDTO>().ok(data);
}
@NoRepeatSubmit
@PostMapping("save")
public Result save(@RequestBody IcVolunteerPolyDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
icVolunteerPolyService.save(dto);
return new Result();
}
@NoRepeatSubmit
@PostMapping("update")
public Result update(@RequestBody IcVolunteerPolyDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
icVolunteerPolyService.update(dto);
return new Result();
}
@PostMapping("delete")
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
icVolunteerPolyService.delete(ids);
return new Result();
}
/**
* 网格党建平面图地图
*
* @param form
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.VolunteerPolyMapDataResultDTO>>
* @author LZN
* @date 2022/5/19 13:54
*/
@PostMapping("/mapData")
public Result<List<VolunteerPolyMapDataResultDTO>> getMapData(@RequestBody VolunteerPolyMapDataFormDTO form, @LoginUser TokenDto tokenDto) {
form.setCustomerId(tokenDto.getCustomerId());
List<VolunteerPolyMapDataResultDTO> dto = icVolunteerPolyService.getMapData(form);
return new Result<List<VolunteerPolyMapDataResultDTO>>().ok(dto);
}
/**
* 网格党建平面图列表
*
* @param form
* @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData>
* @author LZN
* @date 2022/5/19 14:49
*/
@PostMapping("list")
public Result<PageData> getList(@RequestBody VolunteerPolyListFormDTO form, @LoginUser TokenDto tokenDto) {
form.setCustomerId(tokenDto.getCustomerId());
PageData data = icVolunteerPolyService.getList(form);
return new Result<PageData>().ok(data);
}
/**
* 抽取志愿者数据
*
* @Param customerId
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2022/5/19 15:41
*/
@PostMapping("volunteerDataExtraction/{customerId}")
public Result volunteerDataExtraction(@PathVariable("customerId") String customerId) {
icVolunteerPolyService.volunteerDataExtraction(customerId);
return new Result();
}
/**
* 志愿者变动
*
* @Param form
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2022/5/19 18:05
*/
@PostMapping("volunteerChanged")
public Result volunteerChanged(@RequestBody MqBaseFormDTO form) {
icVolunteerPolyService.volunteerChanged(form);
return new Result();
}
/**
* 网格党建平面图饼图
*
* @param form
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.VolunteerPolyPieResultDTO>
* @author LZN
* @date 2022/5/19 17:21
*/
@PostMapping("statistics")
3 years ago
public Result<List<VolunteerPolyPieResultDTO>> getStatistics(@RequestBody VolunteerPolyPieFormDTO form, @LoginUser TokenDto tokenDto) {
form.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(form);
List<VolunteerPolyPieResultDTO> dto = icVolunteerPolyService.getStatistics(form);
return new Result<List<VolunteerPolyPieResultDTO>>().ok(dto);
}
3 years ago
/**
* 修改经纬度
*
* @param tokenDto
* @param form
* @return com.epmet.commons.tools.utils.Result
* @author LZN
* @date 2022/5/24 15:07
*/
@PostMapping("LonAndLat")
public Result LonAndLat(@LoginUser TokenDto tokenDto, @RequestBody LonAndLatFormDTO form) {
form.setUserId(tokenDto.getUserId());
3 years ago
form.setCustomerId(tokenDto.getCustomerId());
icVolunteerPolyService.updateLonAndLat(form);
3 years ago
return new Result();
3 years ago
3 years ago
}
}