Merge branch 'cc_20250529_fix_desk' into 'master'

Cc 20250529 fix desk

See merge request hangzhou/java/custom_zxjp!106
This commit is contained in:
苏竹红
2025-05-29 10:49:50 +00:00
14 changed files with 168 additions and 8 deletions

View File

@@ -259,6 +259,7 @@ public enum ErrorCodeEnum {
EXPORT_LIMIT_5000(151008,"导出数据不能超过5000条请增加筛选条件减少导出数量",null),
REGION_INTERSECTION_IS_NULL(151011,"所选所属大区/分公司,不在所选集团下",null),
CHECK_PAYER_ERROR(151012,"缴费人必须是签约人,请重新填写!",null),
SHOP_HAVE_NOT_OVER_ACCORDING(1511014,"该加盟商下有未结束跟进的门店,请先结束门店",null)
;

View File

@@ -23,6 +23,8 @@ public enum FileTypeEnum {
ZXJP_OPEN_SHOP_REPORT("zxjpOpenShopReport","正新鸡排开店"),
IMPORT_OA_OLD_SHOP_STAGE_DATA("importOaOldShopStageData", "导入OA旧阶段数据"),
IMPORT_OA_OLD_SHOP_STAGE_DATA_ERROR("OaOldShopStageDataError", "导入OA旧数据阶段错误列表"),
IMPORT_FITMENT_SHOP_STAGE("importFitmentShopStage", "导入装修阶段完成数据"),
IMPORT_FITMENT_SHOP_STAGE_DATA_ERROR_LIST("OaOldShopStageDataErrorList", "导入装修阶段完成数据错误列表 "),
;
private String fileType;
private String desc;

View File

@@ -297,4 +297,14 @@ public class ShopInfoDAO {
example.createCriteria().andIn("partnerId", partnerIds).andEqualTo("deleted", false);
return shopInfoMapper.selectByExample(example);
}
/**
* @Auther: wangshuo
* @Date: 2025/5/29
* @description: 获取门店列表,根据门店状态
*/
public List<ShopInfoDO> selectByShopStatus(Long lineId,List<Integer> shopStatus){
Example example = new Example(ShopInfoDO.class);
example.createCriteria().andEqualTo("lineId", lineId).andIn("shopStatus", shopStatus).andEqualTo("deleted", false);
return shopInfoMapper.selectByExample(example);
}
}

View File

@@ -76,7 +76,7 @@
</foreach>
</select>
<select id="getSignType" resultType="com.cool.store.entity.SignFranchiseDO">
select shop_id as shopId, sign_type as signType from xfsg_sign_franchise
select shop_id as shopId, sign_type as signType,partnership_signatory_second as partnershipSignatorySecond from xfsg_sign_franchise
where
shop_id in
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">

View File

@@ -19,4 +19,13 @@ public class ImportOaOldShopDataErrorDTO {
@ExcelProperty(value = "错误原因", order = 2)
@ColumnWidth(40)
private String errorReason;
public ImportOaOldShopDataErrorDTO() {
}
public ImportOaOldShopDataErrorDTO(String shopCode, String errorReason) {
this.shopCode = shopCode;
this.errorReason = errorReason;
}
}

View File

@@ -53,4 +53,7 @@ public class PreparationCommonPendingVO {
private Integer signType;
@ApiModelProperty("业务备注")
private String businessRemark;
@ApiModelProperty("签约人2姓名")
private String partnershipSignatorySecond;
}

View File

@@ -32,4 +32,8 @@ public interface DataHandlerServer {
Boolean dataHandlerV20241012(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user,
ImportTaskDO task);
Integer JingDongStageHandler();
//处理测量 设计 施工 验收 完成
Boolean dataHandlerV2025029(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user,
ImportTaskDO task);
}

View File

@@ -954,6 +954,95 @@ public class DataHandlerServerImpl implements DataHandlerServer {
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean dataHandlerV2025029(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user, ImportTaskDO task) {
List<ImportOaOldShopDataDTO> list = new ArrayList<>();
List<ImportOaOldShopDataErrorDTO> errorList = new ArrayList<>();
ListUtils.emptyIfNull(dataMapList)
.forEach(data -> {
try {
ImportOaOldShopDataDTO importOaOldShopDataDTO = new ImportOaOldShopDataDTO();
importOaOldShopDataDTO.setShopCode(String.valueOf(data.get("门店编码")));
list.add(importOaOldShopDataDTO);
} catch (Exception e) {
log.info("dataHandlerV2025029 转化dto error:{}", JSONObject.toJSONString(data));
}
});
log.info("导入数据条数:{}", list.size());
if (CollectionUtils.isEmpty(list)) {
log.info("导入数据转化为空");
return false;
}
List<String> shopCodeList = list.stream().map(ImportOaOldShopDataDTO::getShopCode).collect(Collectors.toList());
List<ShopInfoDO> shopInfoList = shopInfoDAO.selectByShopCodeList(shopCodeList);
if (CollectionUtils.isEmpty(shopInfoList)) {
log.info("导入数据根据shopCode 未找到数据");
}
List<Long> shopIds = shopInfoList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
Map<String, List<ShopInfoDO>> shopMapByCode = shopInfoList.stream().collect(Collectors.groupingBy(ShopInfoDO::getShopCode));
//装修验收数据
List<AcceptanceInfoDO> acceptanceInfoDOList = acceptanceInfoDAO.selectByShopIds(shopIds);
Map<Long, AcceptanceInfoDO> acceptanceInfoMap = acceptanceInfoDOList.stream().collect(Collectors.toMap(AcceptanceInfoDO::getShopId, item -> item));
//合同阶段
List<ShopStageInfoDO> signFranchiseStageList = shopStageInfoDAO.getSubStageList(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
Map<Long, ShopStageInfoDO> signFranchiseStageMap = signFranchiseStageList.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, Function.identity()));
//装修阶段需要变更的shopId
List<Long> fitmentFhopIdList = new ArrayList<>();
//装修验收表需要初始化的门店
List<Long> initFitmentShopIdList = new ArrayList<>();
for (ImportOaOldShopDataDTO dto : list) {
String shopCode = dto.getShopCode();
List<ShopInfoDO> shopInfoDOS = shopMapByCode.get(shopCode);
if (CollectionUtils.isEmpty(shopInfoDOS)){
errorList.add(new ImportOaOldShopDataErrorDTO(dto.getShopCode(), "门店编码未找到"));
continue;
}
if (shopInfoDOS.size() > 1){
errorList.add(new ImportOaOldShopDataErrorDTO(dto.getShopCode(), "门店编码重复"));
continue;
}
ShopInfoDO shopInfoDO = shopInfoDOS.get(0);
Long shopId = shopInfoDO.getId();
ShopStageInfoDO signFranchiseStage = signFranchiseStageMap.get(shopId);
if (!signFranchiseStage.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_84.getShopSubStageStatus())){
errorList.add(new ImportOaOldShopDataErrorDTO(dto.getShopCode(), "合同阶段未完成"));
continue;
}
AcceptanceInfoDO acceptanceInfoDO = acceptanceInfoMap.get(shopId);
if (Objects.isNull(acceptanceInfoDO)){
initFitmentShopIdList.add(shopId);
}
fitmentFhopIdList.add(shopId);
}
//装修stage
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_863);
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91);
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112);
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_123);
//装修表初始化
acceptanceInfoDAO.initAcceptanceInfo(initFitmentShopIdList);
if (!errorList.isEmpty()) {
task.setStatus(ImportTaskStatusEnum.ERROR.getCode());
String url = null;
try {
url = easyExcelUtil.exportExcel(ImportOaOldShopDataErrorDTO.class, errorList, null,
FileTypeEnum.IMPORT_FITMENT_SHOP_STAGE_DATA_ERROR_LIST.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()),
FileTypeEnum.IMPORT_FITMENT_SHOP_STAGE_DATA_ERROR_LIST.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()));
} catch (Exception e) {
log.info("导出失败列表失败 errorList:{}", JSONObject.toJSONString(errorList));
}
task.setFileUrl(url);
} else {
task.setStatus(ImportTaskStatusEnum.SUCCESS.getCode());
}
task.setTotalNum(dataMapList.size());
task.setSuccessNum(dataMapList.size() - errorList.size());
importTaskMapper.update(eid, task);
return null;
}
private static @NotNull ShopStageInfoDO getShopStageInfoDO(ShopSubStageEnum shopSubStageEnum, ShopStageInfoDO shopStageInfoDO, ShopSubStageStatusEnum shopSubStageStatus) {
ShopStageEnum shopStageEnum = shopSubStageEnum.getShopStageEnum();
ShopStageInfoDO shopStageInfo = new ShopStageInfoDO();

View File

@@ -698,6 +698,7 @@ public class DeskServiceImpl implements DeskService {
SignFranchiseDO signFranchiseDO = signTypeMap.get(x.getShopId());
if (signFranchiseDO != null) {
preparationCommonPendingVO.setSignType(signFranchiseDO.getSignType());
preparationCommonPendingVO.setPartnershipSignatorySecond(signFranchiseDO.getPartnershipSignatorySecond());
}
preparationCommonPendingVO.setShopCode(shopInfoDO.getShopCode());
preparationCommonPendingVO.setJoinMode(shopInfoDO.getJoinMode());

View File

@@ -4,22 +4,28 @@ import com.alibaba.fastjson.JSONObject;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.LineAuditInfoDAO;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.dao.ShopInfoDAO;
import com.cool.store.entity.LineAuditInfoDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.enums.AuditResultTypeEnum;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.LineStatusEnum;
import com.cool.store.enums.WorkflowSubStageEnum;
import com.cool.store.enums.point.ShopStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.AuditCloseRequest;
import com.cool.store.request.AuditPassRequest;
import com.cool.store.request.AuditRejectRequest;
import com.cool.store.request.LineFollowLogRequest;
import com.cool.store.service.LineFollowService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
/**
* @author zhangchenbiao
@@ -36,6 +42,8 @@ public abstract class LineFlowService {
private LineInfoDAO lineInfoDAO;
@Resource
private LineFollowService lineFollowService;
@Resource
private ShopInfoDAO shopInfoDAO;
/**
* 审核通过
@@ -89,6 +97,11 @@ public abstract class LineFlowService {
*/
@Transactional(rollbackFor = Exception.class)
public Boolean auditClose(AuditCloseRequest request, LoginUserInfo user){
List<ShopInfoDO> shopInfoDOS = shopInfoDAO.selectByShopStatus(request.getLineId(), Arrays.asList(ShopStatusEnum.DONE.getCode(), ShopStatusEnum.ING.getCode()));
if (CollectionUtils.isNotEmpty(shopInfoDOS)){
throw new ServiceException(ErrorCodeEnum.SHOP_HAVE_NOT_OVER_ACCORDING);
}
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
String partnerId = lineInfo.getPartnerId();
LineAuditInfoDO auditInfo = new LineAuditInfoDO();

View File

@@ -883,7 +883,7 @@ public class PointServiceImpl implements PointService {
pointInfoDAO.updatePointInfo(updatePoint);
ShopInfoDO updateShop = new ShopInfoDO();
updateShop.setId(shopId);
updateShop.setShopName(pointInfo.getPointName());
// updateShop.setShopName(pointInfo.getPointName());
updateShop.setPointId(pointId);
updateShop.setRegionId(pointInfo.getRegionId());
shopInfoDAO.updateShopInfo(updateShop);
@@ -971,7 +971,7 @@ public class PointServiceImpl implements PointService {
Long pointId = pointInfoDAO.addPointInfo(pointInfo);
pointDetailInfo.setPointId(pointId);
pointDetailInfoDAO.addPointDetailInfo(pointDetailInfo);
shopInfo.setShopName(pointInfo.getPointName());
// shopInfo.setShopName(pointInfo.getPointName());
shopInfo.setPointId(pointId);
shopInfoDAO.updateShopInfo(shopInfo);
PointRecommendDO pointRecommendDO = new PointRecommendDO();

View File

@@ -279,6 +279,10 @@ public class SyncDataServiceImpl implements SyncDataService {
return null;
}
String shopCode = shopInfoDO.getShopCode().trim();
if (Objects.isNull(signFranchiseDO)){
log.info("合同阶段暂未完成");
return "";
}
Boolean partnershipSignatorySecondIsNull = StringUtils.isBlank(signFranchiseDO.getPartnershipSignatorySecond());
if (String.valueOf(FranchiseBrandEnum.ZXJP.getCode()).equals(shopInfoDO.getFranchiseBrand())) {
//M10001

View File

@@ -128,4 +128,28 @@ public class DataHandlerController {
public ResponseResult<Integer> JingDongStageHandler() {
return ResponseResult.success(dataHandlerServer.JingDongStageHandler());
}
@PostMapping("/dataHandlerV2025029")
@ApiOperation("/处理测量 设计 施工 验收 完成")
public ResponseResult<Boolean> dataHandlerV2025029(MultipartFile file) {
ExcelReader reader = null;
try {
reader = ExcelUtil.getReader(file.getInputStream());
} catch (IOException e) {
log.error("read file error:", e);
}
assert reader != null;
List<Map<String, Object>> dataMapList = reader.read(0, 1, Integer.MAX_VALUE);
ImportTaskDO importTaskDO = new ImportTaskDO();
importTaskDO.setFileName(file.getOriginalFilename());
importTaskDO.setFileType(FileTypeEnum.IMPORT_FITMENT_SHOP_STAGE.getFileType());
importTaskDO.setIsImport(true);
importTaskDO.setStatus(ImportTaskStatusEnum.PROGRESS.getCode());
importTaskDO.setCreateUserId(CurrentUserHolder.getUserId());
importTaskDO.setCreateName(CurrentUserHolder.getUser().getName());
importTaskDO.setCreateTime(System.currentTimeMillis());
importTaskMapper.insert(eid, importTaskDO);
dataHandlerServer.dataHandlerV2025029(dataMapList, file.getOriginalFilename(), CurrentUserHolder.getUser(), importTaskDO);
return ResponseResult.success(true);
}
}

View File

@@ -62,10 +62,10 @@ public class LineAuditController {
return ResponseResult.success(bankService.repayment(request));
}
// @ApiOperation("结束跟进")
// @PostMapping("/close")
// public ResponseResult<Boolean> auditClose(@RequestBody AuditCloseRequest request){
// return ResponseResult.success(lineFlowService.auditClose(request, CurrentUserHolder.getUser()));
// }
@ApiOperation("结束跟进")
@PostMapping("/close")
public ResponseResult<Boolean> auditClose(@RequestBody AuditCloseRequest request){
return ResponseResult.success(lineFlowService.auditClose(request, CurrentUserHolder.getUser()));
}
}