Browse Source

Merge remote-tracking branch 'origin/develop' into release_temp

master
zxc 4 years ago
parent
commit
7c5310b6c3
  1. 19
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YuShanSysApiService.java
  2. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportNeighborHoodInfoListener.java
  3. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
  4. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  5. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

19
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YuShanSysApiService.java

@ -8,12 +8,9 @@ import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.enums.ExternalApiEnum;
import com.epmet.commons.tools.enums.ExternalServerEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -35,10 +32,17 @@ public class YuShanSysApiService {
*
* @return
*/
@Async
// @Async
public void updateUserPoints(String customerId, List<UpdateUserPointsFormDTO> paramList) {
/*try {
Thread.sleep(1000l);
} catch (InterruptedException e) {
log.error("调用榆山街道发放积分睡眠发生异常,{}",e);
e.printStackTrace();
}*/
if (StringUtils.isBlank(customerId) || CollectionUtils.isEmpty(paramList)) {
throw new RenException("参数错误");
log.warn("updateUserPoints 参数错误");
return;
}
if (!SpecialCustomerOrgConstant.PING_YIN_CUSTOMER_ID.equals(customerId)) {
return;
@ -66,14 +70,13 @@ public class YuShanSysApiService {
// formDTO.setMobile("13205302682");
Result<String> res = HttpClientManager.getInstance().sendPostByJSON(apiPath, JSON.toJSONString(formDTO));
Result result = JSON.parseObject(res.getData(), Result.class);
log.info(String.format("updateUserPoints 入参:%s;返参:%s", JSON.toJSONString(formDTO),JSON.toJSONString(result)));
log.info(String.format("updateUserPoints 入参:%s;返参:%s", JSON.toJSONString(formDTO), JSON.toJSONString(result)));
if (!result.success()) {
log.warn("updateUserPoints failed:{}", JSON.toJSONString(result));
}
}
} catch (Exception e) {
log.warn("updateUserPoints exception 入参:{}", JSON.toJSONString(formDTO));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
log.error("updateUserPoints exception 入参:{},异常:{}", JSON.toJSONString(formDTO), e);
}
}
}

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportNeighborHoodInfoListener.java

@ -79,7 +79,6 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
@Override
public void invoke(NeighborHoodInfoModel data, AnalysisContext context) {
log.info("invoke ==========");
if (null == data){
return;
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java

@ -58,6 +58,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -95,6 +96,8 @@ public class BuildingServiceImpl implements BuildingService {
private IcNeighborHoodService neighborHoodService;
@Autowired
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient;
@Autowired
private ExecutorService executorService;
@Override
@Transactional(rollbackFor = Exception.class)
@ -403,15 +406,15 @@ public class BuildingServiceImpl implements BuildingService {
* @date 2022/2/13 10:15 上午
*/
@Override
@Async
public Result buildingImportExcel(ImportInfoFormDTO formDTO, MultipartFile file,Result<ImportTaskCommonResultDTO> importTask) throws IOException {
executorService.submit(() -> {
ExcelReader excelReader = null;
try {
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return new Result<String>().error("读取文件失败");
log.error("读取文件失败");
}
excelReader = EasyExcel.read(inputStream).build();
// 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener
@ -430,6 +433,7 @@ public class BuildingServiceImpl implements BuildingService {
excelReader.finish();
}
}
});
return new Result<>();
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -70,6 +70,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
@Slf4j
@ -102,6 +103,8 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
private IcNeighborHoodService neighborHoodService;
@Autowired
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient;
@Autowired
private ExecutorService executorService;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@ -358,16 +361,16 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
return result;
}
@Async
@Override
public Result dispose(MultipartFile file, ImportInfoFormDTO formDTO, Result<ImportTaskCommonResultDTO> importTask) {
executorService.submit(() -> {
ExcelReader excelReader = null;
try {
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return new Result<String>().error("读取文件失败");
log.error("读取文件失败");
}
excelReader = EasyExcel.read(inputStream).build();
// 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener
@ -386,6 +389,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
excelReader.finish();
}
}
});
return new Result();
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

@ -232,7 +232,6 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
*/
@Override
public Result neighborhoodImport(ImportInfoFormDTO formDTO, MultipartFile file,Result<ImportTaskCommonResultDTO> importTask) {
log.info("neighborhoodImport start=====");
executorService.submit(() -> {
// importNeighbor(formDTO,file,importTask);
log.info("neighborhoodImport thread start=====");
@ -250,7 +249,6 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
ReadSheet readSheet = EasyExcel.readSheet(0).head(NeighborHoodInfoModel.class)
.registerReadListener(new ImportNeighborHoodInfoListener(formDTO,icHouseRedis,icBuildingDao,this,propertyManagementDao,epmetCommonServiceOpenFeignClient,importTask.getData().getTaskId()))
.build();
log.info("neighborhoodImport build readSheet num:{}",readSheet.getSheetNo());
excelReader.read(readSheet);
} catch (Exception e){
log.error("neighborhoodImport import exception", e);

Loading…
Cancel
Save