|
@ -21,10 +21,15 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
import com.epmet.commons.tools.dto.result.OptionResultDTO; |
|
|
import com.epmet.commons.tools.dto.result.OptionResultDTO; |
|
|
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
|
|
import com.epmet.commons.tools.scan.param.ImgScanParamDTO; |
|
|
|
|
|
import com.epmet.commons.tools.scan.param.ImgTaskDTO; |
|
|
|
|
|
import com.epmet.commons.tools.scan.result.SyncScanResult; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
|
|
import com.epmet.commons.tools.utils.ScanContentUtils; |
|
|
import com.epmet.dao.IcPlacePatrolRecordDao; |
|
|
import com.epmet.dao.IcPlacePatrolRecordDao; |
|
|
import com.epmet.dao.IcPlacePatrolTeamStaffDao; |
|
|
import com.epmet.dao.IcPlacePatrolTeamStaffDao; |
|
|
import com.epmet.dto.IcPlacePatrolTeamStaffDTO; |
|
|
import com.epmet.dto.IcPlacePatrolTeamStaffDTO; |
|
@ -32,21 +37,24 @@ import com.epmet.dto.form.AddPlacePatrolRecordFormDTO; |
|
|
import com.epmet.dto.form.GetListPlacePatrolRecordFormDTO; |
|
|
import com.epmet.dto.form.GetListPlacePatrolRecordFormDTO; |
|
|
import com.epmet.dto.result.GetListPlacePatrolRecordResultDTO; |
|
|
import com.epmet.dto.result.GetListPlacePatrolRecordResultDTO; |
|
|
import com.epmet.dto.result.PlacePatrolRecordDetailResultDTO; |
|
|
import com.epmet.dto.result.PlacePatrolRecordDetailResultDTO; |
|
|
|
|
|
import com.epmet.entity.IcPlaceAttachmentEntity; |
|
|
import com.epmet.entity.IcPlacePatrolRecordEntity; |
|
|
import com.epmet.entity.IcPlacePatrolRecordEntity; |
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
|
|
|
import com.epmet.resi.group.constant.TopicConstant; |
|
|
|
|
|
import com.epmet.service.IcPlaceAttachmentService; |
|
|
import com.epmet.service.IcPlacePatrolRecordService; |
|
|
import com.epmet.service.IcPlacePatrolRecordService; |
|
|
import com.epmet.service.IcPlacePatrolReviewRecordService; |
|
|
import com.epmet.service.IcPlacePatrolReviewRecordService; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import org.slf4j.Logger; |
|
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.UUID; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -57,7 +65,7 @@ import java.util.stream.Collectors; |
|
|
*/ |
|
|
*/ |
|
|
@Service |
|
|
@Service |
|
|
public class IcPlacePatrolRecordServiceImpl extends BaseServiceImpl<IcPlacePatrolRecordDao, IcPlacePatrolRecordEntity> implements IcPlacePatrolRecordService { |
|
|
public class IcPlacePatrolRecordServiceImpl extends BaseServiceImpl<IcPlacePatrolRecordDao, IcPlacePatrolRecordEntity> implements IcPlacePatrolRecordService { |
|
|
private static final Logger log = LoggerFactory.getLogger(IcPlaceOrgServiceImpl.class); |
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private IcPlacePatrolReviewRecordService icPlacePatrolReviewRecordService; |
|
|
private IcPlacePatrolReviewRecordService icPlacePatrolReviewRecordService; |
|
|
@Autowired |
|
|
@Autowired |
|
@ -65,6 +73,15 @@ public class IcPlacePatrolRecordServiceImpl extends BaseServiceImpl<IcPlacePatro |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IcPlacePatrolTeamStaffDao icPlacePatrolTeamStaffDao; |
|
|
private IcPlacePatrolTeamStaffDao icPlacePatrolTeamStaffDao; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IcPlaceAttachmentService icPlaceAttachmentService; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${openapi.scan.server.url}") |
|
|
|
|
|
private String scanApiUrl; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${openapi.scan.method.imgSyncScan}") |
|
|
|
|
|
private String imgSyncScanMethod; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Author sun |
|
|
* @Author sun |
|
@ -79,6 +96,42 @@ public class IcPlacePatrolRecordServiceImpl extends BaseServiceImpl<IcPlacePatro |
|
|
entity.setPids(staffInfoCache.getAgencyPIds()); |
|
|
entity.setPids(staffInfoCache.getAgencyPIds()); |
|
|
entity.setFinalResult(entity.getFirstResult()); |
|
|
entity.setFinalResult(entity.getFirstResult()); |
|
|
entity.setFinalTime(entity.getFirstTime()); |
|
|
entity.setFinalTime(entity.getFirstTime()); |
|
|
|
|
|
//图片校验
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(formDTO.getImageList())) { |
|
|
|
|
|
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); |
|
|
|
|
|
formDTO.getImageList().forEach(imgUrl -> { |
|
|
|
|
|
ImgTaskDTO task = new ImgTaskDTO(); |
|
|
|
|
|
task.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
|
|
task.setUrl(imgUrl); |
|
|
|
|
|
imgScanParamDTO.getTasks().add(task); |
|
|
|
|
|
}); |
|
|
|
|
|
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); |
|
|
|
|
|
if (!imgScanResult.success()) { |
|
|
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
|
|
} else { |
|
|
|
|
|
if (!imgScanResult.getData().isAllPass()) { |
|
|
|
|
|
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode(), EpmetErrorCode.IMG_SCAN_FAILED.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//图片入库
|
|
|
|
|
|
List<IcPlaceAttachmentEntity> imageEntityList = new ArrayList<>(); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(formDTO.getImageList())) { |
|
|
|
|
|
int sort = 0; |
|
|
|
|
|
for (String url : formDTO.getImageList()) { |
|
|
|
|
|
IcPlaceAttachmentEntity attachment = new IcPlaceAttachmentEntity(); |
|
|
|
|
|
attachment.setCustomerId(formDTO.getCustomerId()); |
|
|
|
|
|
attachment.setAttachmentUrl(url); |
|
|
|
|
|
attachment.setIcEventId(entity.getId()); |
|
|
|
|
|
attachment.setCreatedBy(formDTO.getUserId()); |
|
|
|
|
|
attachment.setAttachmentFormat(url.substring(url.lastIndexOf(".") + NumConstant.ONE).toLowerCase()); |
|
|
|
|
|
attachment.setSort(sort++); |
|
|
|
|
|
attachment.setAttachmentType("image"); |
|
|
|
|
|
attachment.setStatus(TopicConstant.AUTO_PASSED); |
|
|
|
|
|
imageEntityList.add(attachment); |
|
|
|
|
|
} |
|
|
|
|
|
icPlaceAttachmentService.insertBatch(imageEntityList); |
|
|
|
|
|
} |
|
|
insert(entity); |
|
|
insert(entity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -142,8 +195,8 @@ public class IcPlacePatrolRecordServiceImpl extends BaseServiceImpl<IcPlacePatro |
|
|
List<IcPlacePatrolTeamStaffDTO> teamDTOList = icPlacePatrolTeamStaffDao.selectByTeamIds(teamIds); |
|
|
List<IcPlacePatrolTeamStaffDTO> teamDTOList = icPlacePatrolTeamStaffDao.selectByTeamIds(teamIds); |
|
|
|
|
|
|
|
|
//4.封装九小场所、分队成员数据
|
|
|
//4.封装九小场所、分队成员数据
|
|
|
for (OptionResultDTO n : nineList.getData()){ |
|
|
for (OptionResultDTO n : nineList.getData()) { |
|
|
if(resultDTO.getNinePlaceVal().equals(n.getValue())){ |
|
|
if (resultDTO.getNinePlaceVal().equals(n.getValue())) { |
|
|
resultDTO.setNinePlaceName(n.getLabel()); |
|
|
resultDTO.setNinePlaceName(n.getLabel()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -189,10 +242,10 @@ public class IcPlacePatrolRecordServiceImpl extends BaseServiceImpl<IcPlacePatro |
|
|
teamIds = teamIds.stream().distinct().collect(Collectors.toList()); |
|
|
teamIds = teamIds.stream().distinct().collect(Collectors.toList()); |
|
|
List<IcPlacePatrolTeamStaffDTO> teamDTOList = icPlacePatrolTeamStaffDao.selectByTeamIds(teamIds); |
|
|
List<IcPlacePatrolTeamStaffDTO> teamDTOList = icPlacePatrolTeamStaffDao.selectByTeamIds(teamIds); |
|
|
//4.封装九小场所、分队人员数据
|
|
|
//4.封装九小场所、分队人员数据
|
|
|
for (PlacePatrolRecordDetailResultDTO dto : result.getList()){ |
|
|
for (PlacePatrolRecordDetailResultDTO dto : result.getList()) { |
|
|
//九小场所
|
|
|
//九小场所
|
|
|
nineList.getData().forEach(n->{ |
|
|
nineList.getData().forEach(n -> { |
|
|
if(dto.getNinePlaceVal().equals(n.getValue())){ |
|
|
if (dto.getNinePlaceVal().equals(n.getValue())) { |
|
|
dto.setNinePlaceName(n.getLabel()); |
|
|
dto.setNinePlaceName(n.getLabel()); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|