fix 筹备列表 开店时间错误,导出也是
This commit is contained in:
@@ -242,6 +242,14 @@ public class ShopStageInfoDAO {
|
||||
return shopStageInfoMapper.getShopContractActualCompletionTime(shopIdList);
|
||||
}
|
||||
|
||||
|
||||
public List<ShopStageInfoDO> getOpenActivityActualCompletionTime(List<Long> shopIdList){
|
||||
if (CollectionUtils.isEmpty(shopIdList)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return shopStageInfoMapper.getOpenActivityActualCompletionTime(shopIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可以上传租赁合同的店铺id
|
||||
* @param shopIds
|
||||
|
||||
@@ -113,6 +113,7 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
|
||||
List<ScheduleDTO> getPlatformBuildList(@Param("shopIds") List<Long> shopIds);
|
||||
|
||||
List<ShopStageInfoDO> getShopContractActualCompletionTime(@Param("shopIds") List<Long> shopIds);
|
||||
List<ShopStageInfoDO> getOpenActivityActualCompletionTime(@Param("shopIds") List<Long> shopIds);
|
||||
|
||||
/**
|
||||
* 获取可以上传租赁合同的店铺id
|
||||
|
||||
@@ -103,7 +103,8 @@
|
||||
b.username as username,
|
||||
b.mobile as mobile,
|
||||
b.investment_manager as investmentManager,
|
||||
DATE_ADD(b.create_time, INTERVAL 50 DAY) as planOpenTime
|
||||
DATE_ADD(b.create_time, INTERVAL 50 DAY) as planOpenTime,
|
||||
a.create_time as createTime
|
||||
from xfsg_shop_info a left join xfsg_line_info b on a.line_id = b.id
|
||||
where a.deleted = 0
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
|
||||
@@ -354,4 +354,15 @@
|
||||
and shop_sub_stage =#{shopSubStage}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getOpenActivityActualCompletionTime" resultType="com.cool.store.entity.ShopStageInfoDO">
|
||||
select
|
||||
*
|
||||
from xfsg_shop_stage_info where shop_stage = 2 and shop_sub_stage = 140 and actual_complete_time is not null
|
||||
<if test="shopIds != null and shopIds.size() > 0">
|
||||
and shop_id in
|
||||
<foreach collection="shopIds" item="shopId" index="index" open="(" separator="," close=")">
|
||||
#{shopId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -36,5 +36,5 @@ public class PreparationDTO {
|
||||
|
||||
private String supervisorUserId;
|
||||
|
||||
|
||||
private Date createTime;
|
||||
}
|
||||
|
||||
@@ -59,16 +59,22 @@ public class PreparationScheduleVO {
|
||||
|
||||
private Long lineId;
|
||||
|
||||
|
||||
@ApiModelProperty("督导")
|
||||
private String supervisionName;
|
||||
|
||||
@ApiModelProperty("开业活动完成时间")
|
||||
private Date openingActivityEndTime;
|
||||
@ApiModelProperty("门店创建时间")
|
||||
private Date shopCreateTime;
|
||||
public void setDays() {
|
||||
if (this.planOpenTime==null|| this.ContractCompletionTime==null){
|
||||
return;
|
||||
if (this.openingActivityEndTime==null){
|
||||
long between = ChronoUnit.SECONDS.between(new Date().toInstant(), this.shopCreateTime.toInstant());
|
||||
double days = (double) between / (24*60*60);
|
||||
this.days=String.format("%.1f", days);
|
||||
}else{
|
||||
long between = ChronoUnit.SECONDS.between(this.openingActivityEndTime.toInstant(), this.shopCreateTime.toInstant());
|
||||
double days = (double) between / (24*60*60);
|
||||
this.days = String.format("%.1f", days);
|
||||
}
|
||||
long between = ChronoUnit.SECONDS.between(this.ContractCompletionTime.toInstant(), this.planOpenTime.toInstant());
|
||||
double days = (double) between / (24*60*60);
|
||||
this.days = String.format("%.1f", days);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.cool.store.utils.easyExcel.EasyExcelUtil;
|
||||
import com.cool.store.utils.poi.DateUtils;
|
||||
import com.cool.store.utils.poi.StringUtils;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -107,7 +108,13 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
|
||||
userIds.addAll(preparationDTOS.stream().filter(x -> StringUtils.isNotEmpty(x.getInvestmentManager())).map(PreparationDTO::getInvestmentManager).collect(Collectors.toSet()));
|
||||
userIds.addAll(preparationDTOS.stream().filter(x -> StringUtils.isNotEmpty(x.getSupervisorUserId())).map(PreparationDTO::getSupervisorUserId).collect(Collectors.toSet()));
|
||||
Map<String, EnterpriseUserDO> userInfoMap = enterpriseUserDAO.getUserInfoMap(new ArrayList<>(userIds));
|
||||
|
||||
List<ShopStageInfoDO> openActivityActualCompletionTime = shopStageInfoDAO.getOpenActivityActualCompletionTime(shopIds);
|
||||
Map<Long, ShopStageInfoDO> openActivityStageMap;
|
||||
if (openActivityActualCompletionTime !=null){
|
||||
openActivityStageMap = openActivityActualCompletionTime.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, x -> x));
|
||||
} else {
|
||||
openActivityStageMap = new HashMap<>();
|
||||
}
|
||||
List<PreparationScheduleDTO> result = new ArrayList<>();
|
||||
preparationDTOS.forEach(x -> {
|
||||
PreparationScheduleDTO dto1 = new PreparationScheduleDTO();
|
||||
@@ -120,19 +127,20 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
|
||||
dto1.setInvestmentManagerName(userInfoMap.getOrDefault(x.getInvestmentManager(), new EnterpriseUserDO()).getName());
|
||||
dto1.setRegionNodeName(regionNameMap.getOrDefault(x.getRegionId(), ""));
|
||||
ScheduleDTO dto = scheduleDTOMap.getOrDefault(x.getId(), new ScheduleDTO());
|
||||
dto1.setCurrentProgress(dto.getCompletionColumn().toString()+ "/" + dto.getTotalColumn().toString() );
|
||||
ShopStageInfoDO stageInfoDO = shopStageInfoDOMap.getOrDefault(x.getId(), new ShopStageInfoDO());
|
||||
if (StringUtils.isNotEmpty(stageInfoDO.getActualCompleteTime()) && x.getPlanOpenTime() != null) {
|
||||
long between = ChronoUnit.SECONDS.between(DateUtils.strToDate(stageInfoDO.getActualCompleteTime(), DateUtils.YYYY_MM_DD_HH_MM_SS).toInstant(), x.getPlanOpenTime().toInstant());
|
||||
dto1.setCurrentProgress(dto.getCompletionColumn().toString() + "/" + dto.getTotalColumn().toString());
|
||||
if ( openActivityStageMap.containsKey(x.getId())) {
|
||||
Date openActivity = DateUtils.strToDate(openActivityStageMap.get(x.getId()).getActualCompleteTime(), YYYY_MM_DD_HH_MM_SS);
|
||||
long between = ChronoUnit.SECONDS.between(openActivity.toInstant(), x.getCreateTime().toInstant());
|
||||
double days = (double) between / (24 * 60 * 60);
|
||||
String day = String.format("%.1f", days);
|
||||
if (StringUtils.isNotEmpty(day)) {
|
||||
dto1.setDays(day);
|
||||
}
|
||||
dto1.setDays(String.format("%.1f", days));
|
||||
}else{
|
||||
long between = ChronoUnit.SECONDS.between(new Date().toInstant(), x.getCreateTime().toInstant());
|
||||
double days = (double) between / (24 * 60 * 60);
|
||||
dto1.setDays(String.format("%.1f", days));
|
||||
}
|
||||
result.add(dto1);
|
||||
});
|
||||
url = easyExcelUtil.exportExcel(PreparationScheduleDTO.class, result, null, FileTypeEnum.PREPARATION.getDesc()+DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_1,new Date()), FileTypeEnum.PREPARATION.getDesc()+DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_1,new Date()));
|
||||
url = easyExcelUtil.exportExcel(PreparationScheduleDTO.class, result, null, FileTypeEnum.PREPARATION.getDesc() + DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_1, new Date()), FileTypeEnum.PREPARATION.getDesc() + DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_1, new Date()));
|
||||
} catch (Throwable e) {
|
||||
flag = Boolean.FALSE;
|
||||
log.error("fileUpload upload err, originFileName={}", FileTypeEnum.TEAM_LINE.getDesc(), e);
|
||||
|
||||
@@ -94,6 +94,13 @@ public class PreparationServiceImpl implements PreparationService {
|
||||
List<ShopStageInfoDO> shopContractActualCompletionTime = shopStageInfoDAO.getShopContractActualCompletionTime(shopIds);
|
||||
Map<Long, ScheduleDTO> scheduleDTOMap = scheduleList.stream().collect(Collectors.toMap(ScheduleDTO::getShopId, x -> x));
|
||||
Map<Long, ShopStageInfoDO> shopStageInfoDOMap = shopContractActualCompletionTime.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, x -> x));
|
||||
List<ShopStageInfoDO> openActivityActualCompletionTime = shopStageInfoDAO.getOpenActivityActualCompletionTime(shopIds);
|
||||
Map<Long, ShopStageInfoDO> openActivityStageMap;
|
||||
if (openActivityActualCompletionTime !=null){
|
||||
openActivityStageMap = openActivityActualCompletionTime.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, x -> x));
|
||||
} else {
|
||||
openActivityStageMap = new HashMap<>();
|
||||
}
|
||||
List<Long> regionIds = preparationDTOS.stream().map(PreparationDTO::getRegionId).collect(Collectors.toList());
|
||||
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(regionIds);
|
||||
Set<String> userIds = preparationDTOS.stream().filter(x -> StringUtils.isNotEmpty(x.getShopManagerUserId())).map(PreparationDTO::getShopManagerUserId).collect(Collectors.toSet());
|
||||
@@ -112,6 +119,10 @@ public class PreparationServiceImpl implements PreparationService {
|
||||
preparationScheduleVO.setShopCode(x.getShopCode());
|
||||
preparationScheduleVO.setPlanOpenTime(x.getPlanOpenTime());
|
||||
preparationScheduleVO.setStoreNum(x.getStoreNum());
|
||||
preparationScheduleVO.setShopCreateTime(x.getCreateTime());
|
||||
if ( openActivityStageMap.containsKey(x.getId())) {
|
||||
preparationScheduleVO.setOpeningActivityEndTime(DateUtils.strToDate(openActivityStageMap.get(x.getId()).getActualCompleteTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||
}
|
||||
preparationScheduleVO.setShopManagerUserName(userInfoMap.getOrDefault(x.getShopManagerUserId(), new EnterpriseUserDO()).getName());
|
||||
preparationScheduleVO.setSupervisionName(userInfoMap.getOrDefault(x.getSupervisorUserId(), new EnterpriseUserDO()).getName());
|
||||
preparationScheduleVO.setInvestmentManagerName(userInfoMap.getOrDefault(x.getInvestmentManager(), new EnterpriseUserDO()).getName());
|
||||
|
||||
@@ -167,6 +167,7 @@ public class ShopServiceImpl implements ShopService {
|
||||
addShop.setLineId(request.getLineId());
|
||||
addShop.setPartnerId(lineInfo.getPartnerId());
|
||||
addShop.setShopName(shopName);
|
||||
addShop.setSupervisorUserId(lineInfo.getInvestmentManager());
|
||||
addShopList.add(addShop);
|
||||
}
|
||||
shopInfoDAO.batchAddShop(addShopList);
|
||||
|
||||
Reference in New Issue
Block a user