14 changed files with 419 additions and 8 deletions
@ -0,0 +1,30 @@ |
|||
package com.epmet.dto.form.screen; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/6/1 3:11 下午 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class ColorProjectTotalFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -6991770717583778665L; |
|||
|
|||
public interface ColorProjectTotalForm{} |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
@NotBlank(message = "组织ID不能为空",groups = ColorProjectTotalForm.class) |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 行政区域码【平阴必填】 |
|||
*/ |
|||
private String areaCode; |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.epmet.dto.form.screen; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/6/2 9:42 上午 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class StreetDetailPYFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -4821168326488796711L; |
|||
|
|||
public interface StreetDetailPYForm{} |
|||
|
|||
@NotBlank(message = "组织ID不能为空",groups = StreetDetailPYForm.class) |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 行政区域编码 平阴必填 |
|||
*/ |
|||
private String areaCode; |
|||
} |
@ -0,0 +1,48 @@ |
|||
package com.epmet.dto.result.screen; |
|||
|
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/6/1 3:15 下午 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class ColorProjectTotalResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -8211214262766797296L; |
|||
|
|||
/** |
|||
* 事件总数 |
|||
*/ |
|||
private Integer projectTotal; |
|||
|
|||
/** |
|||
* 红灯事件总数 |
|||
*/ |
|||
private Integer redTotal; |
|||
|
|||
/** |
|||
* 黄灯事件总数 |
|||
*/ |
|||
private Integer yellowTotal; |
|||
|
|||
/** |
|||
* 绿灯事件总数 |
|||
*/ |
|||
private Integer greenTotal; |
|||
|
|||
@JsonIgnore |
|||
private Integer projectLevel; |
|||
|
|||
public ColorProjectTotalResultDTO() { |
|||
this.projectTotal = NumConstant.ZERO; |
|||
this.redTotal = NumConstant.ZERO; |
|||
this.yellowTotal = NumConstant.ZERO; |
|||
this.greenTotal = NumConstant.ZERO; |
|||
} |
|||
} |
@ -0,0 +1,50 @@ |
|||
package com.epmet.dto.result.screen; |
|||
|
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/6/2 9:43 上午 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class StreetDetailPYResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 663001974527694466L; |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 组织名称 |
|||
*/ |
|||
private String agencyName; |
|||
|
|||
/** |
|||
* 注册党员数 |
|||
*/ |
|||
private Integer partyMemberTotal; |
|||
|
|||
/** |
|||
* 网格总数 |
|||
*/ |
|||
private Integer gridTotal; |
|||
|
|||
/** |
|||
* 网格员数 |
|||
*/ |
|||
private Integer gridMemberTotal; |
|||
|
|||
public StreetDetailPYResultDTO() { |
|||
this.partyMemberTotal = NumConstant.ZERO; |
|||
this.gridTotal = NumConstant.ZERO; |
|||
this.gridMemberTotal = NumConstant.ZERO; |
|||
this.agencyId = ""; |
|||
this.agencyName = ""; |
|||
} |
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.epmet.datareport.controller.screen; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.datareport.service.evaluationindex.screen.PyService; |
|||
import com.epmet.dto.form.screen.StreetDetailPYFormDTO; |
|||
import com.epmet.dto.result.screen.StreetDetailPYResultDTO; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/6/2 9:40 上午 |
|||
* @DESC |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("pyscreen") |
|||
public class PyController { |
|||
|
|||
@Autowired |
|||
private PyService pyService; |
|||
|
|||
/** |
|||
* @Description 街道:注册党员数、网格数、网格员数 |
|||
* @Param formDTO |
|||
* @author zxc |
|||
* @date 2021/6/2 10:07 上午 |
|||
*/ |
|||
@PostMapping("streetdetail-py") |
|||
public Result<StreetDetailPYResultDTO> streetDetail(@RequestBody StreetDetailPYFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO, StreetDetailPYFormDTO.StreetDetailPYForm.class); |
|||
return new Result<StreetDetailPYResultDTO>().ok(pyService.streetDetail(formDTO)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.epmet.datareport.service.evaluationindex.screen; |
|||
|
|||
import com.epmet.dto.form.screen.StreetDetailPYFormDTO; |
|||
import com.epmet.dto.result.screen.StreetDetailPYResultDTO; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/6/2 10:05 上午 |
|||
* @DESC |
|||
*/ |
|||
public interface PyService { |
|||
|
|||
/** |
|||
* @Description 街道:注册党员数、网格数、网格员数 |
|||
* @Param formDTO |
|||
* @author zxc |
|||
* @date 2021/6/2 10:07 上午 |
|||
*/ |
|||
StreetDetailPYResultDTO streetDetail(StreetDetailPYFormDTO formDTO); |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.epmet.datareport.service.evaluationindex.screen.impl; |
|||
|
|||
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.constant.DataSourceConstant; |
|||
import com.epmet.datareport.dao.evaluationindex.screen.ScreenUserTotalDataDao; |
|||
import com.epmet.datareport.service.evaluationindex.screen.PyService; |
|||
import com.epmet.dto.form.screen.StreetDetailPYFormDTO; |
|||
import com.epmet.dto.result.screen.StreetDetailPYResultDTO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/6/2 10:05 上午 |
|||
* @DESC |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@DataSource(DataSourceConstant.EVALUATION_INDEX) |
|||
public class PyServiceImpl implements PyService { |
|||
|
|||
@Autowired |
|||
private ScreenUserTotalDataDao screenUserTotalDataDao; |
|||
|
|||
/** |
|||
* @Description 街道:注册党员数、网格数、网格员数 |
|||
* @Param formDTO |
|||
* @author zxc |
|||
* @date 2021/6/2 10:07 上午 |
|||
*/ |
|||
@Override |
|||
public StreetDetailPYResultDTO streetDetail(StreetDetailPYFormDTO formDTO) { |
|||
StreetDetailPYResultDTO result = new StreetDetailPYResultDTO(); |
|||
if (StringUtils.isEmpty(formDTO.getAreaCode())){ |
|||
result = screenUserTotalDataDao.selectStreetDetailByAgencyId(formDTO.getAgencyId()); |
|||
}else { |
|||
StreetDetailPYResultDTO eightStreet = screenUserTotalDataDao.selectStreetDetailByAreaCode(formDTO.getAreaCode()); |
|||
result = screenUserTotalDataDao.selectStreetDetailByAgencyId(formDTO.getAgencyId()); |
|||
if (null == result){ |
|||
throw new RenException("组织ID【"+formDTO.getAgencyId()+"】不存在于screen_customer_agency"); |
|||
} |
|||
result.setGridMemberTotal(result.getGridMemberTotal() + eightStreet.getGridMemberTotal()); |
|||
result.setPartyMemberTotal(result.getPartyMemberTotal() + eightStreet.getPartyMemberTotal()); |
|||
result.setGridTotal(result.getGridTotal() + eightStreet.getGridTotal()); |
|||
} |
|||
return result; |
|||
} |
|||
} |
Loading…
Reference in new issue