Browse Source

安宁数据采集接口添加验证

dev_shibei_match
yinzuomei 5 years ago
parent
commit
8595a1d688
  1. 35
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/ScreenCollFormDTO.java
  2. 10
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnCommunityProjectProfileFormDTO.java
  3. 17
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsGovernMonthlyFormDTO.java
  4. 13
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsOrgMonthlyFormDTO.java
  5. 19
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsPmRankFormDTO.java
  6. 13
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsPmTotalMonthlyFormDTO.java
  7. 94
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/AnScreenCollController.java
  8. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/AnScreenCollService.java
  9. 70
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/AnScreenCollServiceImpl.java

35
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/ScreenCollFormDTO.java

@ -1,8 +1,12 @@
package com.epmet.dto.screencoll;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.List;
@ -14,21 +18,47 @@ import java.util.List;
*/
@Data
public class ScreenCollFormDTO<T> implements Serializable {
private static final long serialVersionUID = 4605543711669000348L;
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
* 返回错误码为8999提示信息为DTO中具体的列的校验注解message的内容
*/
public interface IsFirstShowGroup extends CustomerClientShowGroup {
}
public interface DateIdShowGroup extends CustomerClientShowGroup {
}
public interface MonthIdShowGroup extends CustomerClientShowGroup {
}
public interface CustomerIdShowGroup extends CustomerClientShowGroup {
}
public interface DataListShowGroup extends CustomerClientShowGroup {
}
/**
* 当为true时后台将先删除当前维度的数据后新增
*/
@NotNull(message = "isFirst不能为空", groups = IsFirstShowGroup.class)
private Boolean isFirst;
/**
* 日期Id, 数据更新至yyyyMMdd
*/
@NotBlank(message = "dateId不能为空;", groups = DateIdShowGroup.class)
@Length(min = 8, max = 8, message = "dateId不能为空,格式应为yyyyMMdd;", groups = {DateIdShowGroup.class})
private String dateId;
/**
* yyyyMM
*/
@NotBlank(message = "monthId不能为空,格式yyyyMM;", groups = MonthIdShowGroup.class)
@Length(min = 6, max = 6, message = "monthId不能为空,格式应为yyyyMM;", groups = {MonthIdShowGroup.class})
private String monthId;
/**
@ -39,6 +69,8 @@ public class ScreenCollFormDTO<T> implements Serializable {
/**
* 数据集合
*/
@Valid
@NotEmpty(message = "dataList不能为空", groups = DataListShowGroup.class)
private List<T> dataList;
@Override
@ -49,5 +81,6 @@ public class ScreenCollFormDTO<T> implements Serializable {
/**
* 当前客户id
*/
@NotBlank(message = "customerId不能为空;", groups = CustomerIdShowGroup.class)
private String customerId;
}

10
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnCommunityProjectProfileFormDTO.java

@ -1,7 +1,10 @@
package com.epmet.dto.screencoll.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
@ -14,23 +17,30 @@ import java.io.Serializable;
public class AnCommunityProjectProfileFormDTO implements Serializable {
private static final long serialVersionUID = 1466172677051250092L;
public interface DefaultShowGroup extends CustomerClientShowGroup {
}
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd项目根据实际情况赋值
*/
@NotBlank(message = "dataEndTime不能为空;", groups = DefaultShowGroup.class)
private String dataEndTime;
/**
* 社区id
*/
@NotBlank(message = "orgId不能为空;", groups = DefaultShowGroup.class)
private String orgId;
/**
* 项目数
*/
@NotNull(message = "projectTotal不能为空;", groups = DefaultShowGroup.class)
private Integer projectTotal;
/**
* 等级
*/
@NotBlank(message = "level不能为空;", groups = DefaultShowGroup.class)
private String level;
}

17
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsGovernMonthlyFormDTO.java

@ -1,7 +1,10 @@
package com.epmet.dto.screencoll.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
@ -12,51 +15,63 @@ import java.math.BigDecimal;
* @since v1.0.0 2020-10-09
*/
@Data
public class AnGrassRootsGovernMonthlyFormDTO implements Serializable {
public class AnGrassRootsGovernMonthlyFormDTO implements Serializable {
private static final long serialVersionUID = -6947401956711903753L;
public interface DefaultShowGroup extends CustomerClientShowGroup {
}
/**
* 网格街道或社区id
*/
@NotBlank(message = "orgId不能为空;", groups = DefaultShowGroup.class)
private String orgId;
/**
* 网格街道名称或者社区名称
*/
@NotBlank(message = "orgName不能为空;", groups = DefaultShowGroup.class)
private String orgName;
/**
* 网格grid;组织agency
*/
@NotBlank(message = "orgType不能为空,网格:grid;组织:agency;", groups = DefaultShowGroup.class)
private String orgType;
/**
* org_id的上一级id
*/
@NotBlank(message = "pid不能为空;", groups = DefaultShowGroup.class)
private String pid;
/**
* 参与项目数
*/
@NotNull(message = "partiProjectTotal不能为空;", groups = DefaultShowGroup.class)
private Integer partiProjectTotal;
/**
* 办结项目数
*/
@NotNull(message = "closedProjectTotal不能为空;", groups = DefaultShowGroup.class)
private Integer closedProjectTotal;
/**
* 项目响应度 存储的是%前面的数
*/
@NotNull(message = "projectResponseRatio不能为空;", groups = DefaultShowGroup.class)
private BigDecimal projectResponseRatio;
/**
* 项目满意率存储的是%前面的数
*/
@NotNull(message = "projectSatisRatio不能为空;", groups = DefaultShowGroup.class)
private BigDecimal projectSatisRatio;
/**
* 办结率 for 社区
*/
@NotNull(message = "closedProjectRatio不能为空;", groups = DefaultShowGroup.class)
private BigDecimal closedProjectRatio;
}

13
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsOrgMonthlyFormDTO.java

@ -1,7 +1,10 @@
package com.epmet.dto.screencoll.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
@ -13,39 +16,49 @@ import java.io.Serializable;
@Data
public class AnGrassRootsOrgMonthlyFormDTO implements Serializable {
private static final long serialVersionUID = -7389300512268641307L;
public interface DefaultShowGroup extends CustomerClientShowGroup {}
/**
* 网格id或者组织(街道或社区)id
*/
@NotBlank(message = "orgId不能为空;", groups = DefaultShowGroup.class)
private String orgId;
/**
* 组织名称OR网格名称
*/
@NotBlank(message = "orgName不能为空;", groups = DefaultShowGroup.class)
private String orgName;
/**
* 网格grid; 组织agency
*/
@NotBlank(message = "orgType不能为空;", groups = DefaultShowGroup.class)
private String orgType;
/**
* org_id的上一级id
*/
@NotBlank(message = "pid不能为空;", groups = DefaultShowGroup.class)
private String pid;
/**
* 党群数
*/
@NotNull(message = "groupTotal不能为空;", groups = DefaultShowGroup.class)
private Integer groupTotal;
/**
* 议题数
*/
@NotNull(message = "issueTotal不能为空;", groups = DefaultShowGroup.class)
private Integer issueTotal;
/**
* 项目数
*/
@NotNull(message = "projectTotal不能为空;", groups = DefaultShowGroup.class)
private Integer projectTotal;
}

19
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsPmRankFormDTO.java

@ -1,7 +1,11 @@
package com.epmet.dto.screencoll.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
@ -13,60 +17,73 @@ import java.io.Serializable;
@Data
public class AnGrassRootsPmRankFormDTO implements Serializable {
private static final long serialVersionUID = 3642729389245262928L;
public interface DefaultShowGroup extends CustomerClientShowGroup {}
/**
* 月份Id
* 月份Id
*/
@NotBlank(message = "monthId不能为空;", groups = DefaultShowGroup.class)
@Length(min = 6, max = 6, message = "monthId不能为空,格式应为yyyyMM;", groups = {DefaultShowGroup.class})
private String monthId;
/**
* 用户id
*/
@NotBlank(message = "userId不能为空;", groups = DefaultShowGroup.class)
private String userId;
/**
* 姓名
*/
@NotBlank(message = "userName不能为空;", groups = DefaultShowGroup.class)
private String userName;
/**
* 所属支部id
*/
@NotBlank(message = "branchId不能为空;", groups = DefaultShowGroup.class)
private String branchId;
/**
* 所属支部名称
*/
@NotBlank(message = "branchName不能为空;", groups = DefaultShowGroup.class)
private String branchName;
/**
* 所属社区id
*/
@NotBlank(message = "communityId不能为空;", groups = DefaultShowGroup.class)
private String communityId;
/**
* 所属社区名称
*/
@NotBlank(message = "communityName不能为空;", groups = DefaultShowGroup.class)
private String communityName;
/**
* 群成员数
*/
@NotNull(message = "groupMemberTotal不能为空;",groups =DefaultShowGroup.class )
private Integer groupMemberTotal;
/**
* 话题数
*/
@NotNull(message = "topicTotal不能为空;",groups =DefaultShowGroup.class )
private Integer topicTotal;
/**
* 参与人次
*/
@NotNull(message = "partiUserTotal不能为空;",groups =DefaultShowGroup.class )
private Integer partiUserTotal;
/**
* 议题数
*/
@NotNull(message = "issueTotal不能为空;",groups =DefaultShowGroup.class )
private Integer issueTotal;
/**

13
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsPmTotalMonthlyFormDTO.java

@ -1,7 +1,10 @@
package com.epmet.dto.screencoll.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
@ -14,44 +17,54 @@ import java.io.Serializable;
public class AnGrassRootsPmTotalMonthlyFormDTO implements Serializable {
private static final long serialVersionUID = 8675347783888892404L;
public interface DefaultShowGroup extends CustomerClientShowGroup {}
/**
* 网格id或者组织(街道或社区)id
*/
@NotBlank(message = "orgId不能为空;", groups = DefaultShowGroup.class)
private String orgId;
/**
* 组织名称OR网格名称
*/
@NotBlank(message = "orgName不能为空;", groups = DefaultShowGroup.class)
private String orgName;
/**
* 网格grid;组织agency
*/
@NotBlank(message = "orgType不能为空;", groups = DefaultShowGroup.class)
private String orgType;
/**
* org_id的上一级id
*/
@NotBlank(message = "pid不能为空;", groups = DefaultShowGroup.class)
private String pid;
/**
* 群成员数
*/
@NotNull(message = "groupMemberTotal不能为空;", groups = DefaultShowGroup.class)
private Integer groupMemberTotal;
/**
* 话题数
*/
@NotNull(message = "topicTotal不能为空;", groups = DefaultShowGroup.class)
private Integer topicTotal;
/**
* 话题参与人次
*/
@NotNull(message = "topicPartiUserTotal不能为空;", groups = DefaultShowGroup.class)
private Integer topicPartiUserTotal;
/**
* 议题数
*/
@NotNull(message = "issueTotal不能为空;", groups = DefaultShowGroup.class)
private Integer issueTotal;
}

94
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/AnScreenCollController.java

@ -1,11 +1,10 @@
package com.epmet.controller;
import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.dto.screencoll.form.*;
import com.epmet.service.evaluationindex.screen.AnScreenCollService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -23,79 +22,116 @@ public class AnScreenCollController {
private AnScreenCollService screenCollService;
/**
* @Description 安宁大屏数据采集 - 基层党员-各类总数
* @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329494
* @param formDTO
* @return void
* @Description 安宁大屏数据采集 - 基层党员-各类总数
* @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329494
* @author wangc
* @date 2020.10.09 17:20
*/
@PostMapping("pmtotal")
public Result pmTotal(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO<AnGrassRootsPmTotalMonthlyFormDTO> formDTO){
if(StringUtils.isBlank(customerId)) throw new ValidateException("客户Id不能为空");
screenCollService.pmTotal(formDTO,customerId);
public Result pmTotal(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO<AnGrassRootsPmTotalMonthlyFormDTO> formDTO) {
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO,
ScreenCollFormDTO.IsFirstShowGroup.class,
ScreenCollFormDTO.MonthIdShowGroup.class,
ScreenCollFormDTO.CustomerIdShowGroup.class,
ScreenCollFormDTO.DataListShowGroup.class);
formDTO.getDataList().forEach(data -> {
ValidatorUtils.validateEntity(data, AnGrassRootsPmTotalMonthlyFormDTO.DefaultShowGroup.class);
});
screenCollService.pmTotal(formDTO);
return new Result();
}
/**
* @Description 安宁大屏数据采集 - 基层党员-党员排行榜单
* @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329483
* @param formDTO
* @return void
* @Description 安宁大屏数据采集 - 基层党员-党员排行榜单 按月
* @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329483
* @author wangc
* @date 2020.10.09 17:19
*/
@PostMapping("pmrank")
public Result pmRank(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO<AnGrassRootsPmRankFormDTO> formDTO){
if (StringUtils.isBlank(formDTO.getMonthId())){
throw new ValidateException("月份Id不能为空");
}
screenCollService.pmRank(formDTO,customerId);
public Result pmRank(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO<AnGrassRootsPmRankFormDTO> formDTO) {
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO,
ScreenCollFormDTO.IsFirstShowGroup.class,
ScreenCollFormDTO.MonthIdShowGroup.class,
ScreenCollFormDTO.CustomerIdShowGroup.class,
ScreenCollFormDTO.DataListShowGroup.class);
formDTO.getDataList().forEach(data -> {
ValidatorUtils.validateEntity(data, AnGrassRootsPmRankFormDTO.DefaultShowGroup.class);
});
screenCollService.pmRank(formDTO);
return new Result();
}
/**
* @Description 安宁大屏数据采集 - 基层组织(党群数|议题数|项目数)-按月
* @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329498
* @param formDTO
* @return void
* @Description 安宁大屏数据采集 - 基层组织(党群数|议题数|项目数)-按月
* @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329498
* @author wangc
* @date 2020.10.09 17:22
*/
@PostMapping("grassrootsorg")
public Result grassrootsOrg(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO<AnGrassRootsOrgMonthlyFormDTO> formDTO){
if(StringUtils.isBlank(customerId)) throw new ValidateException("客户Id不能为空");
screenCollService.grassrootsOrg(formDTO,customerId);
public Result grassrootsOrg(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO<AnGrassRootsOrgMonthlyFormDTO> formDTO) {
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO,
ScreenCollFormDTO.IsFirstShowGroup.class,
ScreenCollFormDTO.MonthIdShowGroup.class,
ScreenCollFormDTO.CustomerIdShowGroup.class,
ScreenCollFormDTO.DataListShowGroup.class);
formDTO.getDataList().forEach(data -> {
ValidatorUtils.validateEntity(data, AnGrassRootsOrgMonthlyFormDTO.DefaultShowGroup.class);
});
screenCollService.grassrootsOrg(formDTO);
return new Result();
}
/**
* @Description 安宁大屏数据采集 - 基层治理-各类数
* @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329499
* @param formDTO
* @return void
* @Description 安宁大屏数据采集 - 基层治理-各类数 按月
* @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329499
* @author wangc
* @date 2020.10.09 17:23
*/
@PostMapping("grassrootsgovern")
public Result grassrootsGovern(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO<AnGrassRootsGovernMonthlyFormDTO> formDTO){
if(StringUtils.isBlank(customerId)) throw new ValidateException("客户Id不能为空");
screenCollService.grassrootsGovern(formDTO,customerId);
public Result grassrootsGovern(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO<AnGrassRootsGovernMonthlyFormDTO> formDTO) {
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO,
ScreenCollFormDTO.IsFirstShowGroup.class,
ScreenCollFormDTO.MonthIdShowGroup.class,
ScreenCollFormDTO.CustomerIdShowGroup.class,
ScreenCollFormDTO.DataListShowGroup.class);
formDTO.getDataList().forEach(data -> {
ValidatorUtils.validateEntity(data, AnGrassRootsGovernMonthlyFormDTO.DefaultShowGroup.class);
});
screenCollService.grassrootsGovern(formDTO);
return new Result();
}
/**
* @Description 安宁大屏数据采集 - 中央区-项目概要
* @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329502
* @param formDTO
* @return void
* @Description 安宁大屏数据采集 - 中央区-项目概要
* @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329502
* @author wangc
* @date 2020.10.09 16:41
*/
@PostMapping("projectfile")
public Result projectFile(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO<AnCommunityProjectProfileFormDTO> formDTO){
if(StringUtils.isBlank(customerId)) throw new ValidateException("客户Id不能为空");
screenCollService.communityProjectProfile(formDTO,customerId);
public Result projectFile(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO<AnCommunityProjectProfileFormDTO> formDTO) {
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO,
ScreenCollFormDTO.IsFirstShowGroup.class,
ScreenCollFormDTO.CustomerIdShowGroup.class,
ScreenCollFormDTO.DataListShowGroup.class);
formDTO.getDataList().forEach(data -> {
ValidatorUtils.validateEntity(data, AnCommunityProjectProfileFormDTO.DefaultShowGroup.class);
});
screenCollService.communityProjectProfile(formDTO);
return new Result();
}
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/AnScreenCollService.java

@ -17,7 +17,7 @@ public interface AnScreenCollService {
* @author wangc
* @date 2020.10.09 16:41
*/
void communityProjectProfile(ScreenCollFormDTO<AnCommunityProjectProfileFormDTO> formDTO,String customerId);
void communityProjectProfile(ScreenCollFormDTO<AnCommunityProjectProfileFormDTO> formDTO);
/**
* @Description 安宁大屏数据采集 - 基层党员-党员排行榜单
@ -27,7 +27,7 @@ public interface AnScreenCollService {
* @author wangc
* @date 2020.10.09 17:19
*/
void pmRank(ScreenCollFormDTO<AnGrassRootsPmRankFormDTO> formDTO,String customerId);
void pmRank(ScreenCollFormDTO<AnGrassRootsPmRankFormDTO> formDTO);
/**
* @Description 安宁大屏数据采集 - 基层党员-各类总数
@ -37,7 +37,7 @@ public interface AnScreenCollService {
* @author wangc
* @date 2020.10.09 17:20
*/
void pmTotal(ScreenCollFormDTO<AnGrassRootsPmTotalMonthlyFormDTO> formDTO,String customerId);
void pmTotal(ScreenCollFormDTO<AnGrassRootsPmTotalMonthlyFormDTO> formDTO);
/**
* @Description 安宁大屏数据采集 - 基层组织(党群数|议题数|项目数)-按月
@ -46,7 +46,7 @@ public interface AnScreenCollService {
* @author wangc
* @date 2020.10.09 17:22
*/
void grassrootsOrg(ScreenCollFormDTO<AnGrassRootsOrgMonthlyFormDTO> formDTO,String customerId);
void grassrootsOrg(ScreenCollFormDTO<AnGrassRootsOrgMonthlyFormDTO> formDTO);
/**
* @Description 安宁大屏数据采集 - 基层治理-各类数
@ -55,5 +55,5 @@ public interface AnScreenCollService {
* @author wangc
* @date 2020.10.09 17:23
*/
void grassrootsGovern(ScreenCollFormDTO<AnGrassRootsGovernMonthlyFormDTO> formDTO,String customerId);
void grassrootsGovern(ScreenCollFormDTO<AnGrassRootsGovernMonthlyFormDTO> formDTO);
}

70
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/AnScreenCollServiceImpl.java

@ -4,11 +4,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.ScreenAnCommunityProjectProfileDao;
import com.epmet.dao.evaluationindex.screen.ScreenAnGrassRootsGovernMonthlyDao;
import com.epmet.dao.evaluationindex.screen.ScreenAnGrassRootsOrgMonthlyDao;
import com.epmet.dao.evaluationindex.screen.ScreenAnGrassRootsPmRankDao;
import com.epmet.dao.evaluationindex.screen.ScreenAnGrassRootsPmTotalMonthlyDao;
import com.epmet.dao.evaluationindex.screen.*;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.dto.screencoll.form.*;
import com.epmet.service.evaluationindex.screen.AnScreenCollService;
@ -17,10 +13,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
@ -56,17 +48,17 @@ public class AnScreenCollServiceImpl implements AnScreenCollService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void communityProjectProfile(ScreenCollFormDTO<AnCommunityProjectProfileFormDTO> formDTO,String customerId) {
List<AnCommunityProjectProfileFormDTO> dataList = formDTO.getDataList();
if(CollectionUtils.isEmpty(dataList)) return ;
public void communityProjectProfile(ScreenCollFormDTO<AnCommunityProjectProfileFormDTO> formDTO) {
/*List<AnCommunityProjectProfileFormDTO> dataList = formDTO.getDataList();
if(CollectionUtils.isEmpty(dataList)) return ;*/
if(formDTO.getIsFirst()){
int affectRows = communityProjectProfileDao.deleteBatch(customerId);
int affectRows = communityProjectProfileDao.deleteBatch(formDTO.getCustomerId());
while(affectRows >= NumConstant.ONE){
affectRows = communityProjectProfileDao.deleteBatch(customerId);
affectRows = communityProjectProfileDao.deleteBatch(formDTO.getCustomerId());
}
}
Lists.partition(formDTO.getDataList(),NumConstant.ONE_HUNDRED).forEach(list -> {
communityProjectProfileDao.insertBatch(list,customerId);
communityProjectProfileDao.insertBatch(list,formDTO.getCustomerId());
});
}
@ -81,17 +73,17 @@ public class AnScreenCollServiceImpl implements AnScreenCollService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void pmRank(ScreenCollFormDTO<AnGrassRootsPmRankFormDTO> formDTO,String customerId) {
List<AnGrassRootsPmRankFormDTO> dataList = formDTO.getDataList();
if(CollectionUtils.isEmpty(dataList)) return ;
public void pmRank(ScreenCollFormDTO<AnGrassRootsPmRankFormDTO> formDTO) {
/*List<AnGrassRootsPmRankFormDTO> dataList = formDTO.getDataList();
if(CollectionUtils.isEmpty(dataList)) return ;*/
if(formDTO.getIsFirst()){
int affectRows = pmRankDao.deleteBatch(customerId,formDTO.getMonthId());
int affectRows = pmRankDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId());
while(affectRows >= NumConstant.ONE){
affectRows = pmRankDao.deleteBatch(customerId,formDTO.getMonthId());
affectRows = pmRankDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId());
}
}
Lists.partition(formDTO.getDataList(),NumConstant.ONE_HUNDRED).forEach(list -> {
pmRankDao.insertBatch(list,customerId);
pmRankDao.insertBatch(list,formDTO.getCustomerId());
});
}
@ -105,21 +97,21 @@ public class AnScreenCollServiceImpl implements AnScreenCollService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void pmTotal(ScreenCollFormDTO<AnGrassRootsPmTotalMonthlyFormDTO> formDTO,String customerId) {
List<AnGrassRootsPmTotalMonthlyFormDTO> dataList = formDTO.getDataList();
if(CollectionUtils.isEmpty(dataList)) return ;
public void pmTotal(ScreenCollFormDTO<AnGrassRootsPmTotalMonthlyFormDTO> formDTO) {
/*List<AnGrassRootsPmTotalMonthlyFormDTO> dataList = formDTO.getDataList();
if(CollectionUtils.isEmpty(dataList)) return ;*/
if(formDTO.getIsFirst()){
int affectRows = pmTotalMonthlyDao.deleteBatch(customerId,formDTO.getMonthId());
int affectRows = pmTotalMonthlyDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId());
while(affectRows >= NumConstant.ONE){
affectRows = pmTotalMonthlyDao.deleteBatch(customerId,formDTO.getMonthId());
affectRows = pmTotalMonthlyDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId());
}
}
String quarterId = DateUtils.getQuarterId(formDTO.getMonthId());
String yearId = DateUtils.getYearId(formDTO.getMonthId());
Lists.partition(formDTO.getDataList(),NumConstant.ONE_HUNDRED).forEach(list -> {
pmTotalMonthlyDao.insertBatch(list,
customerId,
formDTO.getCustomerId(),
formDTO.getMonthId(),
quarterId,
yearId);
@ -136,21 +128,21 @@ public class AnScreenCollServiceImpl implements AnScreenCollService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void grassrootsOrg(ScreenCollFormDTO<AnGrassRootsOrgMonthlyFormDTO> formDTO,String customerId) {
List<AnGrassRootsOrgMonthlyFormDTO> dataList = formDTO.getDataList();
if(CollectionUtils.isEmpty(dataList)) return ;
public void grassrootsOrg(ScreenCollFormDTO<AnGrassRootsOrgMonthlyFormDTO> formDTO) {
/*List<AnGrassRootsOrgMonthlyFormDTO> dataList = formDTO.getDataList();
if(CollectionUtils.isEmpty(dataList)) return ;*/
if(formDTO.getIsFirst()){
int affectRows = orgMonthlyDao.deleteBatch(customerId,formDTO.getMonthId());
int affectRows = orgMonthlyDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId());
while(affectRows >= NumConstant.ONE){
affectRows = orgMonthlyDao.deleteBatch(customerId,formDTO.getMonthId());
affectRows = orgMonthlyDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId());
}
}
String quarterId = DateUtils.getQuarterId(formDTO.getMonthId());
String yearId = DateUtils.getYearId(formDTO.getMonthId());
Lists.partition(formDTO.getDataList(),NumConstant.ONE_HUNDRED).forEach(list -> {
orgMonthlyDao.insertBatch(list,
customerId,
formDTO.getCustomerId(),
formDTO.getMonthId(),
quarterId,
yearId);
@ -167,21 +159,21 @@ public class AnScreenCollServiceImpl implements AnScreenCollService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void grassrootsGovern(ScreenCollFormDTO<AnGrassRootsGovernMonthlyFormDTO> formDTO,String customerId) {
List<AnGrassRootsGovernMonthlyFormDTO> dataList = formDTO.getDataList();
if(CollectionUtils.isEmpty(dataList)) return ;
public void grassrootsGovern(ScreenCollFormDTO<AnGrassRootsGovernMonthlyFormDTO> formDTO) {
/*List<AnGrassRootsGovernMonthlyFormDTO> dataList = formDTO.getDataList();
if(CollectionUtils.isEmpty(dataList)) return ;*/
if(formDTO.getIsFirst()){
int affectRows = governMonthlyDao.deleteBatch(customerId,formDTO.getMonthId());
int affectRows = governMonthlyDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId());
while(affectRows >= NumConstant.ONE){
affectRows = governMonthlyDao.deleteBatch(customerId,formDTO.getMonthId());
affectRows = governMonthlyDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId());
}
}
String quarterId = DateUtils.getQuarterId(formDTO.getMonthId());
String yearId = DateUtils.getYearId(formDTO.getMonthId());
Lists.partition(formDTO.getDataList(),NumConstant.ONE_HUNDRED).forEach(list -> {
governMonthlyDao.insertBatch(list,
customerId,
formDTO.getCustomerId(),
formDTO.getMonthId(),
quarterId,
yearId);

Loading…
Cancel
Save