Browse Source

Merge branch 'develop' into release_temp

dev
sunyuchao 4 years ago
parent
commit
5da74a794e
  1. 10
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/feign/DataAggregatorOpenFeignClient.java
  2. 10
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/feign/impl/DataAggregatorOpenFeignClientFallback.java
  3. 17
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/feign/impl/DataAggregatorOpenFeignClientFallbackFactory.java
  4. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  5. 15
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java
  6. 7
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ImportTaskService.java
  7. 12
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java
  8. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/CommunitySelfOrgImportExcel.java
  9. 51
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java
  10. 4
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java
  11. 8
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ExportGridLiveResTask.java
  12. 6
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java

10
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/feign/DataAggregatorFeignClient.java → epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/feign/DataAggregatorOpenFeignClient.java

@ -1,17 +1,17 @@
package com.epmet.feign;
package com.epmet.dataaggre.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO;
import com.epmet.feign.impl.DataAggregatorFeignClientClientFallBackFactory;
import com.epmet.dataaggre.feign.impl.DataAggregatorOpenFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallback = DataAggregatorFeignClientClientFallBackFactory.class)
// @FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallback= DataAggregatorFeignClientClientFallBackFactory.class,url = "localhost:8114")
public interface DataAggregatorFeignClient {
@FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallbackFactory = DataAggregatorOpenFeignClientFallbackFactory.class)
// @FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallbackFactory= DataAggregatorOpenFeignClientFallbackFactory.class,url = "localhost:8114")
public interface DataAggregatorOpenFeignClient {
/**
* 定时任务导出网格活跃统计表

10
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/feign/impl/DataAggregatorFeignClientClientFallBackFactory.java → epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/feign/impl/DataAggregatorOpenFeignClientFallback.java

@ -1,16 +1,12 @@
package com.epmet.feign.impl;
package com.epmet.dataaggre.feign.impl;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO;
import com.epmet.feign.DataAggregatorFeignClient;
import org.springframework.stereotype.Component;
@Component
public class DataAggregatorFeignClientClientFallBackFactory implements DataAggregatorFeignClient {
import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient;
public class DataAggregatorOpenFeignClientFallback implements DataAggregatorOpenFeignClient {
/**
* 定时任务导出网格活跃统计表
* @param form

17
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/feign/impl/DataAggregatorOpenFeignClientFallbackFactory.java

@ -0,0 +1,17 @@
package com.epmet.dataaggre.feign.impl;
import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class DataAggregatorOpenFeignClientFallbackFactory implements FallbackFactory<DataAggregatorOpenFeignClient> {
private DataAggregatorOpenFeignClientFallback fallback = new DataAggregatorOpenFeignClientFallback();
@Override
public DataAggregatorOpenFeignClient create(Throwable throwable) {
return null;
}
}

4
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -771,7 +771,7 @@ public class GovOrgServiceImpl implements GovOrgService {
//小雷哥手机号:18660295251,
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
at.setAtMobiles(Arrays.asList("18660295251","15764229697"));
at.setAtMobiles(Arrays.asList("18660295251"));
at.setIsAtAll(false);
dingTalkTextMsg.setAt(at);
@ -780,7 +780,7 @@ public class GovOrgServiceImpl implements GovOrgService {
text.setContent("网格活跃度统计: \n" +
"起止时间: " + formDTO.getStartTime().concat(StrConstant.UNDER_LINE).concat(formDTO.getEndTime()) + "\n" +
"文件下载地址: " + uploadResult.getData().getUrl() + "\n"+
"请查收@18660295251@15764229697");
"请查收@18660295251");
dingTalkTextMsg.setText(text);
HttpClientManager.getInstance().sendDingMsg(JSON.toJSONString(dingTalkTextMsg), url, secret);
}

15
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java

@ -12,9 +12,7 @@ import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.service.ImportTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("import-task")
@ -70,4 +68,15 @@ public class ImportTaskController {
return new Result();
}
/**
* 检查是否有正在执行的任务
* @param bizType 业务类型非必填不传则任意一种导入正在执行都会返回true
* @return
*/
@GetMapping("processing-check")
public Result processingTaskCheck(@RequestParam(value = "biz_type", required = false) String bizType) {
Boolean r = importTaskService.processingTaskCheck(bizType);
return new Result().ok(r);
}
}

7
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ImportTaskService.java

@ -44,4 +44,11 @@ public interface ImportTaskService {
* @return
*/
PageData<ImportTaskCommonResultDTO> page(ImportTaskCommonFormDTO param);
/**
* 检查是否有正在执行的任务
* @param bizType
* @return
*/
Boolean processingTaskCheck(String bizType);
}

12
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java

@ -14,6 +14,7 @@ import com.epmet.entity.ImportTaskEntity;
import com.epmet.service.ImportTaskService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -108,4 +109,15 @@ public class ImportTaskServiceImpl implements ImportTaskService {
});
return new PageData<>(list,page.getTotal());
}
@Override
public Boolean processingTaskCheck(String bizType) {
LambdaQueryWrapper<ImportTaskEntity> query = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(bizType)) {
query.eq(ImportTaskEntity::getBizType, bizType);
}
query.eq(ImportTaskEntity::getProcessStatus, ImportTaskConstants.PROCESS_STATUS_PROCESSING);
return importRecordDao.selectCount(query) > 0;
}
}

6
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/CommunitySelfOrgImportExcel.java

@ -27,9 +27,9 @@ import lombok.Data;
@Data
public class CommunitySelfOrgImportExcel {
@Excel(name = "组织名称", width = 40)
private String agencyName;
@Excel(name = "社会组织名称", width = 40)
/*@Excel(name = "组织名称", width = 40)
private String agencyName;*/
@Excel(name = "社会组织名称", width = 40)
private String societyName;
@Excel(name = "错误信息", width = 50)
private String errorInfo;

51
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java

@ -478,8 +478,9 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
@Override
//@Transactional(rollbackFor = Exception.class)
@Async
public void importCommunitySelfOrganization(TokenDto tokenDto, HttpServletResponse response, MultipartFile file, String taskId) throws IOException {
public void importCommunitySelfOrganization(TokenDto tokenDto, HttpServletResponse response, MultipartFile file, String taskId) {
try {
log.info("社会自组织导入,子线程开始执行");
List<CommunitySelfOrgImportExcel> fileList = new ArrayList<>();
CommunitySelfOrgImportExcel excel = null;
//1.读取Excel数据
@ -489,7 +490,7 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
//打印失败的行 和失败的信息
log.warn("第{}行,{}", entity.getRowNum(), entity.getErrorMsg());
excel = new CommunitySelfOrgImportExcel();
excel.setAgencyName(entity.getOrganizationName());
//excel.setAgencyName(entity.getOrganizationName());
excel.setSocietyName(entity.getOrganizationName());
excel.setErrorInfo(entity.getErrorMsg());
fileList.add(excel);
@ -524,10 +525,11 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
if (!m && !t){
errMsg.append("手机号码不合法;");
bl.set(true);
log.warn("手机号码不合法,自组织名称{}", obj.getOrganizationName());
}
if(bl.get()){
excel = new CommunitySelfOrgImportExcel();
excel.setAgencyName(obj.getOrganizationName());
//excel.setAgencyName(obj.getOrganizationName());
excel.setSocietyName(obj.getOrganizationName());
excel.setErrorInfo(errMsg.toString());
fileList.add(excel);
@ -542,22 +544,24 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
e.setOrgType(IcCommunitySelfOrganizationConstant.ORG_TYPE_AGENCY);
e.setPid(agencyInfo.getPid());
e.setPids(agencyInfo.getPids());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
e.setOrganizationCreatedTime(sdf.parse(l.getOrganizationCreatedTime()));
} catch (ParseException ex) {
ex.printStackTrace();
}
baseDao.insert(e);
e.setOrganizationCreatedTime(DateUtils.parse(l.getOrganizationCreatedTime(), DATE_PATTERN));
List<IcCommunitySelfOrganizationPersonnelEntity> persons = new ArrayList<>();
AtomicReference<Boolean> bl = new AtomicReference<>(false);
StringBuffer msg = new StringBuffer("");
if (CollectionUtils.isNotEmpty(l.getPersons())){
l.getPersons().forEach(p -> {
boolean m = PhoneValidatorUtils.isMobile(p.getPersonPhone());
boolean t = PhoneValidatorUtils.isTel(p.getPersonPhone());
if (!m && !t){
throw new EpmetException(EpmetErrorCode.CHECK_PHONE_ERROR.getCode());
bl.set(true);
msg.append("自组织下成员手机号错误;");
log.warn("自组织下成员手机号错误,自组织名称{}", l.getOrganizationName());
return;
//throw new EpmetException(EpmetErrorCode.CHECK_PHONE_ERROR.getCode());
}
});
List<IcCommunitySelfOrganizationPersonnelEntity> persons = ConvertUtils.sourceToTarget(l.getPersons(), IcCommunitySelfOrganizationPersonnelEntity.class);
persons = ConvertUtils.sourceToTarget(l.getPersons(), IcCommunitySelfOrganizationPersonnelEntity.class);
Map<String, List<IcCommunitySelfOrganizationPersonnelEntity>> groupByPhone = persons.stream().collect(Collectors.groupingBy(IcCommunitySelfOrganizationPersonnelEntity::getPersonPhone));
List<String> phones = new ArrayList<>();
groupByPhone.forEach((k,v) -> {
@ -566,28 +570,43 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
}
});
if (CollectionUtils.isNotEmpty(phones)){
StringBuffer sb = new StringBuffer();
bl.set(true);
msg.append("自组织下成员手机号重复;");
log.warn("自组织下成员手机号重复,自组织名称{}", l.getOrganizationName());
/*StringBuffer sb = new StringBuffer();
phones.forEach(p -> {
sb.append(p).append(",");
});
String copywriter = sb.toString().substring(NumConstant.ZERO, sb.length() - NumConstant.ONE);
EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.setMsg(String.format(EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.getMsg(),copywriter));
throw new RenException(EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.getCode());
throw new RenException(EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.getCode());*/
}
}
if(bl.get()){
CommunitySelfOrgImportExcel ex = new CommunitySelfOrgImportExcel();
//ex.setAgencyName(l.getOrganizationName());
ex.setSocietyName(l.getOrganizationName());
ex.setErrorInfo(msg.toString());
fileList.add(ex);
return;
}
baseDao.insert(e);
if(CollectionUtils.isNotEmpty(persons)){
persons.forEach(p -> {
p.setCustomerId(tokenDto.getCustomerId());
p.setOrgId(e.getId());
});
personnelService.insertBatch(persons);
}
});
}
//4.错误数据生成文件,修改导入任务状态
String url = erroeImport(fileList);
upImportTask(url, taskId, tokenDto.getUserId(), true);
} catch (Exception e) {
e.printStackTrace();
log.error("【社会自组织信息导入】程序错误");
String errorMsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【社会自组织信息导入】程序错误:{}", errorMsg);
upImportTask(null, taskId, tokenDto.getUserId(), false);
}
}

4
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java

@ -12,7 +12,7 @@ import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO;
import com.epmet.feign.DataAggregatorFeignClient;
import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -32,7 +32,7 @@ public class DemoController {
@Autowired
private DataStatisticalOpenFeignClient client;
@Autowired
private DataAggregatorFeignClient dataAggregatorFeignClient;
private DataAggregatorOpenFeignClient dataAggregatorFeignClient;
@GetMapping("testAlarm")
public void testAlarm() {

8
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ExportGridLiveResTask.java

@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO;
import com.epmet.feign.DataAggregatorFeignClient;
import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -12,7 +12,9 @@ import org.springframework.stereotype.Component;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
/**
@ -23,7 +25,7 @@ import java.util.*;
public class ExportGridLiveResTask implements ITask {
@Autowired
private DataAggregatorFeignClient dataAggregatorFeignClient;
private DataAggregatorOpenFeignClient dataAggregatorFeignClient;
@Override
public void run(String params) {

6
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java

@ -259,8 +259,9 @@ public class IcPartymemberStyleServiceImpl extends BaseServiceImpl<IcPartymember
@Override
//@Transactional(rollbackFor = Exception.class)
@Async
public void importData(TokenDto tokenDto, HttpServletResponse response, MultipartFile file, String taskId) throws IOException {
public void importData(TokenDto tokenDto, HttpServletResponse response, MultipartFile file, String taskId) {
try {
log.info("党员风采导入,子线程开始执行");
List<PartyMemberImportExcel> fileList = new ArrayList<>();
PartyMemberImportExcel excel = null;
ExcelImportResult<IcPartymemberStyleImportExcel> importResult = ExcelPoiUtils.importExcelMore(file, 0, 1, IcPartymemberStyleImportExcel.class);
@ -368,7 +369,8 @@ public class IcPartymemberStyleServiceImpl extends BaseServiceImpl<IcPartymember
String url = erroeImport(fileList);
upImportTask(url, taskId, tokenDto.getUserId(), true);
} catch (Exception e) {
log.error("【党员风采信息导入】程序错误");
String errorMsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【党员风采信息导入】程序错误:{}", errorMsg);
upImportTask(null, taskId, tokenDto.getUserId(), false);
}
}

Loading…
Cancel
Save