Browse Source

特殊人群功能自测bug提交

feature/syp_points
songyunpeng 5 years ago
parent
commit
774da53a69
  1. 4
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/specialuser/controller/SpecialUserController.java
  2. 33
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/specialuser/service/impl/SpecialUserServiceImpl.java
  3. BIN
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/excel/民政享受政策人员表-样表.xlsx
  4. 24
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/SpecialUserDao.xml

4
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/specialuser/controller/SpecialUserController.java

@ -116,14 +116,14 @@ public class SpecialUserController {
@GetMapping("exportModule")
public void exportModule(HttpServletResponse res) throws Exception{
//获取要下载的模板名称
String fileName = "民政享受政策人员表 - 样表";
String fileName = "民政享受政策人员表-样表";
//设置要下载的文件的名称
res.setCharacterEncoding("UTF-8");
res.setHeader("content-Type", "application/vnd.ms-excel");
res.setHeader("Content-Disposition",
"attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xlsx");
//获取文件的路径
InputStream input = this.getClass().getResourceAsStream("/excel/民政享受政策人员表 - 样表.xlsx");
InputStream input = this.getClass().getResourceAsStream("/excel/民政享受政策人员表-样表.xlsx");
OutputStream out = res.getOutputStream();
byte[] b = new byte[2048];
int len;

33
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/specialuser/service/impl/SpecialUserServiceImpl.java

@ -45,6 +45,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -158,7 +159,13 @@ public class SpecialUserServiceImpl extends BaseServiceImpl<SpecialUserDao, Spec
SpecialUserResultDTO specialUserResultDTO = ConvertUtils.sourceToTarget(specialUserEntity, SpecialUserResultDTO.class);
specialUserResultDTO.setSuIsLow("1".equals(specialUserResultDTO.getSuIsLow())?"是":"否");
specialUserResultDTO.setSuIsPoor("1".equals(specialUserResultDTO.getSuIsPoor())?"是":"否");
specialUserResultDTO.setSuAge(DateUtil.ageOfNow(specialUserEntity.getSuBirthday()));
specialUserResultDTO.setSuAge(specialUserEntity.getSuBirthday()==null?0:DateUtil.ageOfNow(specialUserEntity.getSuBirthday()));
specialUserResultDTO.setSuLowMoney(specialUserResultDTO.getSuIsLow()==null?new BigDecimal(0.00):specialUserResultDTO.getSuLowMoney().setScale(2, BigDecimal.ROUND_HALF_UP));
specialUserResultDTO.setSuLivingSubsidy(specialUserResultDTO.getSuLivingSubsidy()==null?new BigDecimal(0.00):specialUserResultDTO.getSuLivingSubsidy().setScale(2, BigDecimal.ROUND_HALF_UP));
specialUserResultDTO.setSuCareSubsidy(specialUserResultDTO.getSuCareSubsidy()==null?new BigDecimal(0.00):specialUserResultDTO.getSuCareSubsidy().setScale(2, BigDecimal.ROUND_HALF_UP));
specialUserResultDTO.setSuElderlySubsidy(specialUserResultDTO.getSuElderlySubsidy()==null?new BigDecimal(0.00):specialUserResultDTO.getSuElderlySubsidy().setScale(2, BigDecimal.ROUND_HALF_UP));
specialUserResultDTO.setSuChildSubsidy(specialUserResultDTO.getSuChildSubsidy()==null?new BigDecimal(0.00):specialUserResultDTO.getSuChildSubsidy().setScale(2, BigDecimal.ROUND_HALF_UP));
specialUserResultDTO.setSuFiveGuaranteesSubsidy(specialUserResultDTO.getSuFiveGuaranteesSubsidy()==null?new BigDecimal(0.00):specialUserResultDTO.getSuFiveGuaranteesSubsidy().setScale(2, BigDecimal.ROUND_HALF_UP));
return new Result<SpecialUserResultDTO>().ok(specialUserResultDTO);
}
@ -191,8 +198,16 @@ public class SpecialUserServiceImpl extends BaseServiceImpl<SpecialUserDao, Spec
EpdcSpecialUserErrorResultDTO errorLineinfoDto;
for (int i = 0; i < specialUserExcels.size(); i++) {
SpecialUserExcel specialUserExcel = specialUserExcels.get(i);
//去除空格
specialUserExcel.setSuName(specialUserExcel.getSuName()==null?null:specialUserExcel.getSuName().replace(" ",""));
specialUserExcel.setSuVillage(specialUserExcel.getSuVillage()==null?null:specialUserExcel.getSuVillage().replace(" ",""));
specialUserExcel.setSuDisabilityNumber(specialUserExcel.getSuDisabilityNumber()==null?null:specialUserExcel.getSuDisabilityNumber().replace(" ",""));
specialUserExcel.setSuDisabilityType(specialUserExcel.getSuDisabilityType()==null?null:specialUserExcel.getSuDisabilityType().replace(" ",""));
specialUserExcel.setSuRelationship(specialUserExcel.getSuRelationship()==null?null:specialUserExcel.getSuRelationship().replace(" ",""));
//档号
String suBirthday = specialUserExcel.getSuBirthday();
String isLow = specialUserExcel.getSuIsLow();
String isPoor = specialUserExcel.getSuIsPoor();
if (StringUtils.isNotBlank(suBirthday)) {
String eL = "(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})(((0[13578]|1[02])(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)(0[1-9]|[12][0-9]|30))|(02(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))0229)";
Pattern pat = Pattern.compile(eL);
@ -205,6 +220,22 @@ public class SpecialUserServiceImpl extends BaseServiceImpl<SpecialUserDao, Spec
errorLineinfoList.add(errorLineinfoDto);
}
}
if(StringUtils.isNotBlank(isLow)){
if(!"1".equals(isLow) && !"0".equals(isLow)){
errorLineinfoDto = new EpdcSpecialUserErrorResultDTO();
errorLineinfoDto.setErroLine((i + 2) + "");
errorLineinfoDto.setErrorInfo("请检查是否低保户数据格式,例:是");
errorLineinfoList.add(errorLineinfoDto);
}
}
if(StringUtils.isNotBlank(isPoor)){
if(!"1".equals(isPoor) && !"0".equals(isPoor)){
errorLineinfoDto = new EpdcSpecialUserErrorResultDTO();
errorLineinfoDto.setErroLine((i + 2) + "");
errorLineinfoDto.setErrorInfo("请检查是否贫困户数据格式,例:是");
errorLineinfoList.add(errorLineinfoDto);
}
}
}
return errorLineinfoList;
}

BIN
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/excel/民政享受政策人员表 - 样表.xlsx → esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/excel/民政享受政策人员表-样表.xlsx

Binary file not shown.

24
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/SpecialUserDao.xml

@ -48,12 +48,12 @@
if(SU_IS_LOW = '1','是','否') as SU_IS_LOW,
SU_GUARANTEED_POPULATION,
SU_RELATIONSHIP,
SU_LOW_MONEY,
SU_LIVING_SUBSIDY,
SU_CARE_SUBSIDY,
SU_ELDERLY_SUBSIDY,
SU_CHILD_SUBSIDY,
SU_FIVE_GUARANTEES_SUBSIDY,
round(SU_LOW_MONEY,2) as SU_LOW_MONEY,
round(SU_LIVING_SUBSIDY,2)SU_LIVING_SUBSIDY,
round(SU_CARE_SUBSIDY,2)SU_CARE_SUBSIDY,
round(SU_ELDERLY_SUBSIDY,2)SU_ELDERLY_SUBSIDY,
round(SU_CHILD_SUBSIDY,2)SU_CHILD_SUBSIDY,
round(SU_FIVE_GUARANTEES_SUBSIDY,2)SU_FIVE_GUARANTEES_SUBSIDY,
if(SU_IS_POOR = '1','是','否') as SU_IS_POOR
from epdc_special_user
where DEL_FLAG = '0'
@ -144,28 +144,28 @@
<select id="selectMonthlySubsidy"
resultType="com.elink.esua.epdc.dto.result.SpecialUserMonthlySubsidyResultDTO">
select SU_VILLAGE,count(ID) as userTotal,
sum(if(SU_LOW_MONEY is null,0,SU_LOW_MONEY) +
round(sum(if(SU_LOW_MONEY is null,0,SU_LOW_MONEY) +
if(SU_LIVING_SUBSIDY is null,0,SU_LIVING_SUBSIDY) +
if(SU_CARE_SUBSIDY is null,0,SU_CARE_SUBSIDY) +
if(SU_ELDERLY_SUBSIDY is null,0,SU_ELDERLY_SUBSIDY) +
if(SU_CHILD_SUBSIDY is null,0,SU_CHILD_SUBSIDY)+
if(SU_FIVE_GUARANTEES_SUBSIDY is null,0,SU_FIVE_GUARANTEES_SUBSIDY)) as subsidyMoney
if(SU_FIVE_GUARANTEES_SUBSIDY is null,0,SU_FIVE_GUARANTEES_SUBSIDY)),2) as subsidyMoney
from epdc_special_user
where DEL_FLAG = '0' and SU_DISABILITY_TYPE is not null and SU_DISABILITY_TYPE != ''
where DEL_FLAG = '0' and SU_VILLAGE is not null and SU_VILLAGE != ''
group by SU_VILLAGE
order by userTotal desc
LIMIT #{pageIndex},#{pageSize}
</select>
<select id="selectCountMonthlySubsidy" resultType="java.lang.Long">
select count(1) from (select SU_VILLAGE,count(ID) as userTotal,
sum(if(SU_LOW_MONEY is null,0,SU_LOW_MONEY) +
round(sum(if(SU_LOW_MONEY is null,0,SU_LOW_MONEY) +
if(SU_LIVING_SUBSIDY is null,0,SU_LIVING_SUBSIDY) +
if(SU_CARE_SUBSIDY is null,0,SU_CARE_SUBSIDY) +
if(SU_ELDERLY_SUBSIDY is null,0,SU_ELDERLY_SUBSIDY) +
if(SU_CHILD_SUBSIDY is null,0,SU_CHILD_SUBSIDY)+
if(SU_FIVE_GUARANTEES_SUBSIDY is null,0,SU_FIVE_GUARANTEES_SUBSIDY)) as subsidyMoney
if(SU_FIVE_GUARANTEES_SUBSIDY is null,0,SU_FIVE_GUARANTEES_SUBSIDY)),2) as subsidyMoney
from epdc_special_user
where DEL_FLAG = '0' and SU_DISABILITY_TYPE is not null and SU_DISABILITY_TYPE != ''
where DEL_FLAG = '0' and SU_VILLAGE is not null and SU_VILLAGE != ''
group by SU_VILLAGE
order by userTotal desc)a
</select>

Loading…
Cancel
Save