Merge branch 'cc_20241112_addUpdateShopRegionId' into 'master'
Cc 20241112 add update shop region See merge request hangzhou/java/custom_zxjp!27
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;
|
||||
}
|
||||
|
||||
@@ -10,11 +10,6 @@ import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2024/4/26 15:00
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@ContentStyle(horizontalAlignment = HorizontalAlignment.LEFT,wrapped = true)
|
||||
public class PreparationScheduleDTO {
|
||||
@@ -37,7 +32,7 @@ public class PreparationScheduleDTO {
|
||||
@ExcelProperty("门店编号")
|
||||
@ColumnWidth(30)
|
||||
@ApiModelProperty("门店编码")
|
||||
private String storeNum;
|
||||
private String shopCode;
|
||||
|
||||
|
||||
@ExcelProperty("当前进度")
|
||||
@@ -50,7 +45,7 @@ public class PreparationScheduleDTO {
|
||||
@ApiModelProperty("计划开店时间")
|
||||
private String planOpenTime;
|
||||
|
||||
@ExcelProperty("开店时长(小时)")
|
||||
@ExcelProperty("开店时长(天)")
|
||||
@ColumnWidth(30)
|
||||
@ApiModelProperty("开店时长")
|
||||
private String days;
|
||||
|
||||
@@ -25,4 +25,7 @@ public class UpdateShopCodeRequest {
|
||||
|
||||
@ApiModelProperty("门店名称")
|
||||
private String shopName;
|
||||
|
||||
@ApiModelProperty("门店所属区域")
|
||||
private Long regionId;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ public class PreparationScheduleDetailVO {
|
||||
@ApiModelProperty("扩展经理手机号")
|
||||
private String developmentManagerMobile;
|
||||
|
||||
@ApiModelProperty("门店所属区域id")
|
||||
private Long regionId;
|
||||
public void setDays() {
|
||||
if (this.planOpenTime==null|| this.ContractCompletionTime==null){
|
||||
return;
|
||||
|
||||
@@ -59,16 +59,23 @@ 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(this.shopCreateTime.toInstant(), new Date().toInstant());
|
||||
double days = (double) between / (24*60*60);
|
||||
this.days=String.format("%.1f", days);
|
||||
}else{
|
||||
long between = ChronoUnit.SECONDS.between(this.shopCreateTime.toInstant(), this.openingActivityEndTime.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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,7 @@ import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
@@ -35,15 +32,22 @@ public class MiniShopPageVO {
|
||||
@ApiModelProperty("铺位id")
|
||||
private Long pointId;
|
||||
|
||||
public MiniShopPageVO(Long shopId, String shopName,String shopCode,Boolean flag,Long pointId) {
|
||||
@ApiModelProperty("门店所属区域id")
|
||||
private Long regionId;
|
||||
@ApiModelProperty("门店所属区域name")
|
||||
private String regionName;
|
||||
|
||||
public MiniShopPageVO(Long shopId, String shopName,String shopCode,Boolean flag,Long pointId,Long regionId,String regionName) {
|
||||
this.shopId = shopId;
|
||||
this.shopName = shopName;
|
||||
this.shopCode = shopCode;
|
||||
this.flag = flag;
|
||||
this.pointId = pointId;
|
||||
this.regionId = regionId;
|
||||
this.regionName = regionName;
|
||||
}
|
||||
|
||||
public static List<MiniShopPageVO> convertList(List<ShopInfoDO> shopInfoList, Map<Long, ShopStageInfoDO> stageMap ) {
|
||||
public static List<MiniShopPageVO> convertList(List<ShopInfoDO> shopInfoList, Map<Long, ShopStageInfoDO> stageMap, Map<Long, String> regionNameMap ) {
|
||||
List<MiniShopPageVO> resultList = new ArrayList<>();
|
||||
for (ShopInfoDO shopInfo : shopInfoList) {
|
||||
ShopStageInfoDO stageInfoDO = stageMap.get(shopInfo.getId());
|
||||
@@ -53,7 +57,10 @@ public class MiniShopPageVO {
|
||||
flag = Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
resultList.add(new MiniShopPageVO(shopInfo.getId(), shopInfo.getShopName(),shopInfo.getShopCode(),flag,shopInfo.getPointId()));
|
||||
if(Objects.isNull(regionNameMap)){
|
||||
regionNameMap = new HashMap<>();
|
||||
}
|
||||
resultList.add(new MiniShopPageVO(shopInfo.getId(), shopInfo.getShopName(),shopInfo.getShopCode(),flag,shopInfo.getPointId(),shopInfo.getRegionId(), regionNameMap.getOrDefault(shopInfo.getRegionId(),"")));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
@@ -115,24 +122,25 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
|
||||
dto1.setUsername(x.getUsername());
|
||||
dto1.setShopName(x.getShopName());
|
||||
dto1.setPlanOpenTime(DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS, x.getPlanOpenTime()));
|
||||
dto1.setStoreNum(x.getStoreNum());
|
||||
dto1.setShopCode(x.getShopCode());
|
||||
dto1.setSupervisionName(userInfoMap.getOrDefault(x.getSupervisorUserId(), new EnterpriseUserDO()).getName());
|
||||
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( x.getCreateTime().toInstant(),openActivity.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( x.getCreateTime().toInstant(),new Date().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);
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ExportServiceImpl implements ExportService {
|
||||
request.setRegionIds(regionService.getSubRegionIdsByRegionIds(request.getRegionIds()));
|
||||
}
|
||||
}
|
||||
//开业进度数据
|
||||
//进度数据
|
||||
List<PreparationDTO> preparationDTOS = shopInfoDAO.ListByCondition(request);
|
||||
if (CollectionUtils.isEmpty(preparationDTOS)) {
|
||||
throw new ServiceException(ErrorCodeEnum.NO_DATA);
|
||||
|
||||
@@ -83,8 +83,6 @@ public class PreparationServiceImpl implements PreparationService {
|
||||
request.setRegionIds(regionService.getSubRegionIdsByRegionIds(request.getRegionIds()));
|
||||
}
|
||||
}
|
||||
List<String> subRegionIdsByRegionIds = regionService.getSubRegionIdsByRegionIds(request.getRegionIds());
|
||||
request.setRegionIds(subRegionIdsByRegionIds);
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
//开业进度数据
|
||||
List<PreparationDTO> preparationDTOS = shopInfoDAO.ListByCondition(request);
|
||||
@@ -94,6 +92,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 +117,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());
|
||||
@@ -177,6 +186,7 @@ public class PreparationServiceImpl implements PreparationService {
|
||||
preparationScheduleDetailVO.setInvestmentManagerName(investmentManager.getName());
|
||||
preparationScheduleDetailVO.setInvestmentManagerMobile(investmentManager.getMobile());
|
||||
preparationScheduleDetailVO.setRegionNodeName(regionNameMap.get(shopInfo.getRegionId()));
|
||||
preparationScheduleDetailVO.setRegionId(shopInfo.getRegionId());
|
||||
preparationScheduleDetailVO.setDays();
|
||||
return preparationScheduleDetailVO;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.cool.store.utils.RandomEightCharCodeUtils;
|
||||
import com.cool.store.vo.shop.MiniShopPageVO;
|
||||
import com.cool.store.vo.shop.ShopStageInfoVO;
|
||||
import com.cool.store.vo.shop.StageShopCountVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -51,6 +52,8 @@ public class ShopServiceImpl implements ShopService {
|
||||
private CommonService commonService;
|
||||
@Resource
|
||||
UserAuthMappingService userAuthMappingService;
|
||||
@Autowired
|
||||
private RegionDao regionDao;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -96,7 +99,9 @@ public class ShopServiceImpl implements ShopService {
|
||||
List<Long> shopIds = shopList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
|
||||
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStageList(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
|
||||
Map<Long, ShopStageInfoDO> stageMap = subStageList.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, Function.identity()));
|
||||
return MiniShopPageVO.convertList(shopList,stageMap);
|
||||
List<Long> regionIds = shopList.stream().map(ShopInfoDO::getRegionId).collect(Collectors.toList());
|
||||
Map<Long, String> regionNameMap = regionDao.getRegionNameMap(regionIds);
|
||||
return MiniShopPageVO.convertList(shopList,stageMap,regionNameMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -162,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);
|
||||
@@ -185,6 +191,7 @@ public class ShopServiceImpl implements ShopService {
|
||||
shopInfo.setShopCode(request.getShopCode());
|
||||
shopInfo.setShopName(request.getShopName());
|
||||
shopInfo.setUpdateTime(new Date());
|
||||
shopInfo.setRegionId(request.getRegionId());
|
||||
return shopInfoDAO.updateShopInfo(shopInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class PCShopController {
|
||||
return ResponseResult.success(shopService.addShop(request));
|
||||
}
|
||||
|
||||
@ApiOperation("修改门店编号和门店名称")
|
||||
@ApiOperation("修改门店编号和门店名称和门店所属区域")
|
||||
@PostMapping("/updateShopCode")
|
||||
public ResponseResult<Integer> updateShopCode(@RequestBody @Validated UpdateShopCodeRequest request) {
|
||||
return ResponseResult.success(shopService.updateShopCode(request));
|
||||
|
||||
Reference in New Issue
Block a user