Commit 38d6100e by 杨卫

feat:本地maven问题导致完全无法编译开新分支开发

1 parent baa7d2e5
Showing 19 changed files with 552 additions and 10 deletions
...@@ -66,5 +66,8 @@ public class AssignStaffMerchantDTO implements Serializable { ...@@ -66,5 +66,8 @@ public class AssignStaffMerchantDTO implements Serializable {
@ApiModelProperty(notes = "园区店商户号") @ApiModelProperty(notes = "园区店商户号")
private Integer yqMerchantId; private Integer yqMerchantId;
@ApiModelProperty(notes = "驻店类型(1:门店常驻, 2:临时调动支援)")
private Byte stationType;
} }
} }
package cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.List;
/**
* @ClassName AssignStaffMerchantV2DTO
* @Description 员工基础账号分配门店V2 DTO
*/
@Data
@ToString
public class AssignStaffMerchantV2DTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "员工基础信息id")
private Integer staffId;
@ApiModelProperty(notes = "入职门店名称")
private String merchantName;
@ApiModelProperty(notes = "入职门店商户号")
private Integer merchantId;
@ApiModelProperty(notes = "操作人")
private String operatorBy;
@ApiModelProperty(notes = "创建来源(1:账户中心,2:SCRM,3:生意助手,4:门店助手,5:服务商saas,6:D+,7:生意助手员工版小程序,8:北森同步)")
private Byte createdSource;
@ApiModelProperty(notes = "门店项列表")
private List<ShopItem> shopItemList;
/**
* 门店项(园区店+驻店类型+场景)
*/
@Data
@ToString
public static class ShopItem implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "园区店商户号")
private Integer yqMerchantId;
@ApiModelProperty(notes = "园区店名称")
private String yqMerchantName;
@ApiModelProperty(notes = "驻店类型(1:门店常驻, 2:临时调动支援)")
private Byte stationType;
@ApiModelProperty(notes = "业务场景标识列表")
private List<String> baseSceneCodeList;
}
}
...@@ -41,4 +41,7 @@ public class SingleAssignStaffMerchantDTO implements Serializable { ...@@ -41,4 +41,7 @@ public class SingleAssignStaffMerchantDTO implements Serializable {
@ApiModelProperty(notes = "创建来源(1:账户中心,2:SCRM,3:生意助手,4:门店助手,5:服务商saas,6:D+,7:生意助手员工版小程序,8:北森同步)") @ApiModelProperty(notes = "创建来源(1:账户中心,2:SCRM,3:生意助手,4:门店助手,5:服务商saas,6:D+,7:生意助手员工版小程序,8:北森同步)")
private Byte createdSource; private Byte createdSource;
@ApiModelProperty(notes = "驻店类型(1:门店常驻, 2:临时调动支援)")
private Byte stationType;
} }
...@@ -76,4 +76,7 @@ public class StaffAccountRecordDTO extends StaffAccountRecord implements Seriali ...@@ -76,4 +76,7 @@ public class StaffAccountRecordDTO extends StaffAccountRecord implements Seriali
@ApiModelProperty(notes = "适配业务字符串,多个以“、”分隔,无适配业务则为null") @ApiModelProperty(notes = "适配业务字符串,多个以“、”分隔,无适配业务则为null")
private String accountSceneStr; private String accountSceneStr;
@ApiModelProperty(notes = "驻店类型描述")
private String stationTypeDesc;
} }
package cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import cn.com.glsx.dj.smartcarlife.dto.scene.SceneDTO;
/**
* @ClassName StaffAccountRecordDetailDTO
* @Description 编辑园区店数据回显 DTO
*/
@Data
@ToString
public class StaffAccountRecordDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "账号记录id")
private Integer id;
@ApiModelProperty(notes = "员工手机号")
private String staffPhone;
@ApiModelProperty(notes = "4s店商户号")
private Integer merchantId;
@ApiModelProperty(notes = "4s店名称")
private String merchantName;
@ApiModelProperty(notes = "园区店商户号")
private Integer yqMerchantId;
@ApiModelProperty(notes = "园区店名称")
private String yqMerchantName;
@ApiModelProperty(notes = "驻店类型(1:门店常驻, 2:临时调动支援)")
private Byte stationType;
@ApiModelProperty(notes = "业务场景列表")
private List<SceneDTO> sceneList;
@ApiModelProperty(notes = "创建时间")
private Date createdDate;
@ApiModelProperty(notes = "创建人")
private String createdBy;
@ApiModelProperty(notes = "删除标识")
private String deletedFlag;
}
package cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.List;
/**
* @ClassName YqMerchant4sSceneDTO
* @Description 园区店下4s店及业务场景 DTO(两次聚合)
*/
@Data
@ToString
public class YqMerchant4sSceneDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "园区店商户号")
private Integer yqMerchantId;
@ApiModelProperty(notes = "园区店名称")
private String yqMerchantName;
@ApiModelProperty(notes = "4s店列表")
private List<ShopSceneDTO> shopList;
/**
* 4s店维度聚合
*/
@Data
@ToString
public static class ShopSceneDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "4s店商户号")
private Integer shopMerchantId;
@ApiModelProperty(notes = "4s店名称")
private String shopMerchantName;
@ApiModelProperty(notes = "场景列表")
private List<SceneDetailDTO> sceneList;
}
/**
* 场景详情
*/
@Data
@ToString
public static class SceneDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "场景标识")
private String baseSceneCode;
@ApiModelProperty(notes = "场景值")
private String scene;
@ApiModelProperty(notes = "场景名称")
private String sceneName;
@ApiModelProperty(notes = "所属园区店商户号")
private Integer yqMerchantId;
@ApiModelProperty(notes = "所属园区店名称")
private String yqMerchantName;
}
}
...@@ -22,6 +22,12 @@ public class SceneQueryFilterDTO implements Serializable { ...@@ -22,6 +22,12 @@ public class SceneQueryFilterDTO implements Serializable {
private Integer yqMerchantId; private Integer yqMerchantId;
/** /**
* 4s店商户号
*/
@ApiModelProperty(notes = "4s店商户号")
private Integer merchantId;
/**
* 场景名称(模糊查询) * 场景名称(模糊查询)
*/ */
@ApiModelProperty(notes = "场景名称(模糊查询)") @ApiModelProperty(notes = "场景名称(模糊查询)")
......
package cn.com.glsx.dj.smartcarlife.enums;
/**
* 驻店类型枚举
*/
public enum StationTypeEnum {
PERMANENT((byte) 1, "门店常驻"),
TEMPORARY((byte) 2, "临时调动支援");
private final Byte value;
private final String displayName;
StationTypeEnum(Byte value, String displayName) {
this.value = value;
this.displayName = displayName;
}
public Byte getValue() {
return value;
}
public String getDisplayName() {
return displayName;
}
public static String getDisplayNameByValue(Byte value) {
if (value == null) {
return null;
}
for (StationTypeEnum temp : StationTypeEnum.values()) {
if (temp.getValue().equals(value)) {
return temp.getDisplayName();
}
}
return null;
}
}
...@@ -106,6 +106,12 @@ public class StaffAccountRecord implements Serializable { ...@@ -106,6 +106,12 @@ public class StaffAccountRecord implements Serializable {
private Date updatedDate; private Date updatedDate;
/** /**
* 驻店类型(1:门店常驻, 2:临时调动支援)
*/
@Column(name = "station_type")
private Byte stationType;
/**
* 删除标识(D:已删除;N:未删除;I:禁用) * 删除标识(D:已删除;N:未删除;I:禁用)
*/ */
@Column(name = "deleted_flag") @Column(name = "deleted_flag")
......
...@@ -205,5 +205,34 @@ public interface StaffBaseInfoRemote { ...@@ -205,5 +205,34 @@ public interface StaffBaseInfoRemote {
@ApiParam(name="condition",notes="查询条件",dataType= ApiParam.DataTypeEnum.OBJECT,required=true) @ApiParam(name="condition",notes="查询条件",dataType= ApiParam.DataTypeEnum.OBJECT,required=true)
@ApiResponse("员工列表") @ApiResponse("员工列表")
RpcResponse<List<StaffBaseInfoDTO>> getStaffListByPhones(StaffBaseInfoDTO condition); RpcResponse<List<StaffBaseInfoDTO>> getStaffListByPhones(StaffBaseInfoDTO condition);
@ApiMethod("员工基础账号分配门店V2")
@ApiParam(name = "dto", notes = "分配门店入参V2", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("分配结果")
RpcResponse<String> assignStaffMerchantV2(AssignStaffMerchantV2DTO dto);
@ApiMethod("禁用或启用员工园区店账号V2")
@ApiParam(name = "condition", notes = "参数id", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("禁用或启用结果V2")
RpcResponse<String> disableStaffAccountV2(StaffAccountRecordDTO condition);
@ApiMethod("查询园区店下4s店及业务场景")
@ApiParam(name = "yqMerchantIdList", notes = "园区店商户号列表", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("园区店4s店场景列表")
RpcResponse<List<YqMerchant4sSceneDTO>> query4sByYqMerchantList(List<Integer> yqMerchantIdList);
@ApiMethod("查询驻店员工门店账号列表")
@ApiParam(name = "condition", notes = "查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("门店账号列表")
RpcResponse<List<StaffAccountRecordDTO>> listStaffAccountRecords(StaffAccountRecordDTO condition);
@ApiMethod("编辑园区店数据回显")
@ApiParam(name = "accountRecordId", notes = "账号记录id", dataType = ApiParam.DataTypeEnum.INTEGER, required = true)
@ApiResponse("账号详情")
RpcResponse<StaffAccountRecordDetailDTO> getStaffAccountRecordDetail(Integer accountRecordId);
@ApiMethod("清理无效账户场景数据")
@ApiResponse("清理记录数")
RpcResponse<Integer> cleanInvalidAccountScene();
} }
...@@ -38,4 +38,6 @@ public interface SceneMerchantRefNewMapper extends OreMapper<SceneMerchantRefNew ...@@ -38,4 +38,6 @@ public interface SceneMerchantRefNewMapper extends OreMapper<SceneMerchantRefNew
List<MerchantListDTO> querySimpleSceneRefByShopNew(@Param("merchantId") Integer merchantId,@Param("scene") Integer scene,@Param("baseSceneCode") String baseSceneCode); List<MerchantListDTO> querySimpleSceneRefByShopNew(@Param("merchantId") Integer merchantId,@Param("scene") Integer scene,@Param("baseSceneCode") String baseSceneCode);
List<SceneMerchantRefNew> getShopMerchantServiceRef(@Param("shopMerchantId") Integer shopMerchantId, @Param("refMerchantId") Integer refMerchantId,@Param("baseSceneCode") String baseSceneCode); List<SceneMerchantRefNew> getShopMerchantServiceRef(@Param("shopMerchantId") Integer shopMerchantId, @Param("refMerchantId") Integer refMerchantId,@Param("baseSceneCode") String baseSceneCode);
List<SceneMerchantRefNew> query4sByYqMerchantList(@Param("yqMerchantIdList") List<Integer> yqMerchantIdList);
} }
\ No newline at end of file \ No newline at end of file
...@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper; import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.Date;
import java.util.List; import java.util.List;
@Mapper @Mapper
...@@ -27,5 +28,9 @@ public interface StaffAccountRecordMapper extends OreMapper<StaffAccountRecord> ...@@ -27,5 +28,9 @@ public interface StaffAccountRecordMapper extends OreMapper<StaffAccountRecord>
List<String> queryStaffYqMerchantScene(@Param("staffPhone") String staffPhone, @Param("yqMerchantId") Integer yqMerchantId); List<String> queryStaffYqMerchantScene(@Param("staffPhone") String staffPhone, @Param("yqMerchantId") Integer yqMerchantId);
List<String> searchStaffYqMerchantScene(@Param("staffPhone") String staffPhone, @Param("yqMerchantId") Integer yqMerchantId, @Param("sceneType") Integer sceneType); List<String> searchStaffYqMerchantScene(@Param("staffPhone") String staffPhone, @Param("yqMerchantId") Integer yqMerchantId, @Param("sceneType") Integer sceneType, @Param("merchantId") Integer merchantId);
int batchUpdateDeleteFlagByPhoneAndYqMerchant(@Param("staffPhone") String staffPhone, @Param("yqMerchantId") Integer yqMerchantId, @Param("deletedFlag") String deletedFlag, @Param("updatedBy") String updatedBy, @Param("updatedDate") Date updatedDate);
int cleanInvalidAccountScene();
} }
\ No newline at end of file \ No newline at end of file
...@@ -5,6 +5,7 @@ import cn.com.glsx.dj.smartcarlife.dto.scene.SceneDTO; ...@@ -5,6 +5,7 @@ import cn.com.glsx.dj.smartcarlife.dto.scene.SceneDTO;
import cn.com.glsx.dj.smartcarlife.dto.scene.SceneQueryFilterDTO; import cn.com.glsx.dj.smartcarlife.dto.scene.SceneQueryFilterDTO;
import cn.com.glsx.dj.smartcarlife.dto.staff.*; import cn.com.glsx.dj.smartcarlife.dto.staff.*;
import cn.com.glsx.dj.smartcarlife.model.StaffConfig; import cn.com.glsx.dj.smartcarlife.model.StaffConfig;
import cn.com.glsx.dj.smartcarlife.service.SceneMerchantRefService;
import cn.com.glsx.dj.smartcarlife.service.merchantPerformanceConfig.StaffAccountRecordService; import cn.com.glsx.dj.smartcarlife.service.merchantPerformanceConfig.StaffAccountRecordService;
import cn.com.glsx.dj.smartcarlife.service.merchantPerformanceConfig.StaffBaseInfoService; import cn.com.glsx.dj.smartcarlife.service.merchantPerformanceConfig.StaffBaseInfoService;
import cn.com.glsx.dj.smartcarlife.service.merchantPerformanceConfig.StaffConfigService; import cn.com.glsx.dj.smartcarlife.service.merchantPerformanceConfig.StaffConfigService;
...@@ -12,6 +13,9 @@ import cn.com.glsx.framework.core.beans.rpc.RpcPagination; ...@@ -12,6 +13,9 @@ import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum; import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.annotation.ApiMethod;
import cn.com.glsx.framework.core.annotation.ApiParam;
import cn.com.glsx.framework.core.annotation.ApiResponse;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -34,6 +38,9 @@ public class StaffBaseInfoRemoteImpl implements StaffBaseInfoRemote { ...@@ -34,6 +38,9 @@ public class StaffBaseInfoRemoteImpl implements StaffBaseInfoRemote {
@Autowired @Autowired
private StaffAccountRecordService staffAccountRecordService; private StaffAccountRecordService staffAccountRecordService;
@Autowired
private SceneMerchantRefService sceneMerchantRefService;
@Override @Override
public RpcResponse<RpcPagination<StaffBaseInfoDTO>> listWithPage( public RpcResponse<RpcPagination<StaffBaseInfoDTO>> listWithPage(
@NotNull RpcPagination<StaffBaseInfoDTO> pagination) { @NotNull RpcPagination<StaffBaseInfoDTO> pagination) {
...@@ -444,4 +451,99 @@ public class StaffBaseInfoRemoteImpl implements StaffBaseInfoRemote { ...@@ -444,4 +451,99 @@ public class StaffBaseInfoRemoteImpl implements StaffBaseInfoRemote {
return RpcResponse.error(e); return RpcResponse.error(e);
} }
} }
@ApiMethod("员工基础账号分配门店V2")
@ApiParam(name = "dto", notes = "分配门店入参V2", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("分配结果")
@Override
public RpcResponse<String> assignStaffMerchantV2(AssignStaffMerchantV2DTO dto) {
try {
for (AssignStaffMerchantV2DTO.ShopItem shopItem : dto.getShopItemList()) {
SingleAssignStaffMerchantDTO singleAssign = new SingleAssignStaffMerchantDTO();
singleAssign.setStaffId(dto.getStaffId());
singleAssign.setMerchantId(dto.getMerchantId());
singleAssign.setMerchantName(dto.getMerchantName());
singleAssign.setYqMerchantId(shopItem.getYqMerchantId());
singleAssign.setYqMerchantName(shopItem.getYqMerchantName());
singleAssign.setStationType(shopItem.getStationType());
singleAssign.setBaseSceneCodeList(shopItem.getBaseSceneCodeList());
singleAssign.setOperatorBy(dto.getOperatorBy());
singleAssign.setCreatedSource(dto.getCreatedSource());
staffBaseInfoService.assignStaffMerchant(singleAssign);
}
return RpcResponse.success("分配成功");
} catch (Exception e) {
log.error("员工基础账号分配门店V2异常: {}", e.getMessage(), e);
return RpcResponse.fail(e.getMessage());
}
}
@ApiMethod("禁用或启用员工园区店账号V2")
@ApiParam(name = "condition", notes = "参数id", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("禁用或启用结果V2")
@Override
public RpcResponse<String> disableStaffAccountV2(StaffAccountRecordDTO condition) {
try {
staffAccountRecordService.disableStaffAccountV2(condition);
return RpcResponse.success("操作成功");
} catch (Exception e) {
log.error("禁用或启用员工园区店账号V2异常: {}", e.getMessage(), e);
return RpcResponse.fail(e.getMessage());
}
}
@ApiMethod("查询园区店下4s店及业务场景")
@ApiParam(name = "yqMerchantIdList", notes = "园区店商户号列表", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("园区店4s店场景列表")
@Override
public RpcResponse<List<YqMerchant4sSceneDTO>> query4sByYqMerchantList(List<Integer> yqMerchantIdList) {
try {
List<YqMerchant4sSceneDTO> result = sceneMerchantRefService.query4sByYqMerchantList(yqMerchantIdList);
return RpcResponse.success(result);
} catch (Exception e) {
log.error("查询园区店下4s店及业务场景异常: {}", e.getMessage(), e);
return RpcResponse.fail(e.getMessage());
}
}
@ApiMethod("查询驻店员工门店账号列表")
@ApiParam(name = "condition", notes = "查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("门店账号列表")
@Override
public RpcResponse<List<StaffAccountRecordDTO>> listStaffAccountRecords(StaffAccountRecordDTO condition) {
try {
List<StaffAccountRecordDTO> result = staffAccountRecordService.listStaffAccountRecords(condition);
return RpcResponse.success(result);
} catch (Exception e) {
log.error("查询驻店员工门店账号列表异常: {}", e.getMessage(), e);
return RpcResponse.fail(e.getMessage());
}
}
@ApiMethod("编辑园区店数据回显")
@ApiParam(name = "accountRecordId", notes = "账号记录id", dataType = ApiParam.DataTypeEnum.INTEGER, required = true)
@ApiResponse("账号详情")
@Override
public RpcResponse<StaffAccountRecordDetailDTO> getStaffAccountRecordDetail(Integer accountRecordId) {
try {
StaffAccountRecordDetailDTO result = staffAccountRecordService.getStaffAccountRecordDetail(accountRecordId);
return RpcResponse.success(result);
} catch (Exception e) {
log.error("编辑园区店数据回显异常: {}", e.getMessage(), e);
return RpcResponse.fail(e.getMessage());
}
}
@ApiMethod("清理无效账户场景数据")
@ApiResponse("清理记录数")
@Override
public RpcResponse<Integer> cleanInvalidAccountScene() {
try {
int count = staffAccountRecordService.cleanInvalidAccountScene();
return RpcResponse.success(count);
} catch (Exception e) {
log.error("清理无效账户场景数据异常: {}", e.getMessage(), e);
return RpcResponse.fail(e.getMessage());
}
}
} }
...@@ -7,6 +7,7 @@ import cn.com.glsx.dj.smartcarlife.dto.businessassistant.MerchantServiceCenterDT ...@@ -7,6 +7,7 @@ import cn.com.glsx.dj.smartcarlife.dto.businessassistant.MerchantServiceCenterDT
import cn.com.glsx.dj.smartcarlife.dto.merchant.CarBrandDTO; import cn.com.glsx.dj.smartcarlife.dto.merchant.CarBrandDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchantRef.*; import cn.com.glsx.dj.smartcarlife.dto.merchantRef.*;
import cn.com.glsx.dj.smartcarlife.dto.scene.SceneDTO; import cn.com.glsx.dj.smartcarlife.dto.scene.SceneDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig.YqMerchant4sSceneDTO;
import cn.com.glsx.dj.smartcarlife.dto.staff.StaffDailyReportConfigDTO; import cn.com.glsx.dj.smartcarlife.dto.staff.StaffDailyReportConfigDTO;
import cn.com.glsx.dj.smartcarlife.enums.*; import cn.com.glsx.dj.smartcarlife.enums.*;
import cn.com.glsx.dj.smartcarlife.manager.StaffManager; import cn.com.glsx.dj.smartcarlife.manager.StaffManager;
...@@ -2112,4 +2113,71 @@ public class SceneMerchantRefService { ...@@ -2112,4 +2113,71 @@ public class SceneMerchantRefService {
RpcAssert.assertNotNull(baseSceneCode, DefaultErrorEnum.DATA_NULL,"baseSceneCode not be null"); RpcAssert.assertNotNull(baseSceneCode, DefaultErrorEnum.DATA_NULL,"baseSceneCode not be null");
return sceneMerchantRefNewMapper.querySimpleSceneRefByShopNew(merchantId, scene, baseSceneCode); return sceneMerchantRefNewMapper.querySimpleSceneRefByShopNew(merchantId, scene, baseSceneCode);
} }
/**
* 查询园区店下4s店及业务场景(二级聚合)
* 第一级: 按园区店(yqMerchantId)聚合
* 第二级: 按园区店下4s店(shopMerchantId)聚合
*
* @param yqMerchantIdList 园区店商户号列表
* @return 园区店4s店场景列表
*/
public List<YqMerchant4sSceneDTO> query4sByYqMerchantList(List<Integer> yqMerchantIdList) {
if (CollectionUtils.isEmpty(yqMerchantIdList)) {
return new ArrayList<>();
}
// 1. 查询原始数据
List<SceneMerchantRefNew> refList = sceneMerchantRefNewMapper.query4sByYqMerchantList(yqMerchantIdList);
if (CollectionUtils.isEmpty(refList)) {
return new ArrayList<>();
}
// 2. 获取场景名称映射 baseSceneCode -> SceneDTO
List<SceneDTO> allScenes = sceneService.getScenesByParams(null);
Map<String, String> sceneNameMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(allScenes)) {
sceneNameMap = allScenes.stream()
.filter(s -> s.getBaseSceneCode() != null)
.collect(Collectors.toMap(SceneDTO::getBaseSceneCode, SceneDTO::getName, (v1, v2) -> v1));
}
// 3. 二级聚合: 先按园区店分组,再按4s店分组
// 第一级: 按园区店(yqMerchantId = subMerchantId)分组
Map<Integer, List<SceneMerchantRefNew>> yqGroup = refList.stream()
.filter(r -> r.getSubMerchantId() != null)
.collect(Collectors.groupingBy(SceneMerchantRefNew::getSubMerchantId, LinkedHashMap::new, Collectors.toList()));
List<YqMerchant4sSceneDTO> result = new ArrayList<>();
for (Map.Entry<Integer, List<SceneMerchantRefNew>> yqEntry : yqGroup.entrySet()) {
YqMerchant4sSceneDTO yqDto = new YqMerchant4sSceneDTO();
yqDto.setYqMerchantId(yqEntry.getKey());
List<SceneMerchantRefNew> yqItems = yqEntry.getValue();
// 园区店名称取第一条
yqDto.setYqMerchantName(yqItems.get(0).getSubMerchantName());
// 第二级: 按4s店(shopMerchantId = mainMerchantId)分组
Map<Integer, List<SceneMerchantRefNew>> shopGroup = yqItems.stream()
.filter(r -> r.getMainMerchantId() != null)
.collect(Collectors.groupingBy(SceneMerchantRefNew::getMainMerchantId, LinkedHashMap::new, Collectors.toList()));
List<YqMerchant4sSceneDTO.ShopSceneDTO> shopList = new ArrayList<>();
for (Map.Entry<Integer, List<SceneMerchantRefNew>> shopEntry : shopGroup.entrySet()) {
YqMerchant4sSceneDTO.ShopSceneDTO shopDto = new YqMerchant4sSceneDTO.ShopSceneDTO();
shopDto.setShopMerchantId(shopEntry.getKey());
List<SceneMerchantRefNew> shopItems = shopEntry.getValue();
// 4s店名称取第一条
shopDto.setShopMerchantName(shopItems.get(0).getMainMerchantName());
// 场景列表
List<YqMerchant4sSceneDTO.SceneDetailDTO> sceneList = shopItems.stream().map(item -> {
YqMerchant4sSceneDTO.SceneDetailDTO sceneDto = new YqMerchant4sSceneDTO.SceneDetailDTO();
sceneDto.setBaseSceneCode(item.getBaseSceneCode());
sceneDto.setScene(item.getScene() != null ? String.valueOf(item.getScene()) : null);
sceneDto.setSceneName(sceneNameMap.getOrDefault(item.getBaseSceneCode(), item.getBaseSceneCode()));
sceneDto.setYqMerchantId(item.getSubMerchantId());
sceneDto.setYqMerchantName(item.getSubMerchantName());
return sceneDto;
}).collect(Collectors.toList());
shopDto.setSceneList(sceneList);
shopList.add(shopDto);
}
yqDto.setShopList(shopList);
result.add(yqDto);
}
return result;
}
} }
...@@ -121,6 +121,9 @@ public class StaffBaseInfoService { ...@@ -121,6 +121,9 @@ public class StaffBaseInfoService {
@Autowired @Autowired
private SceneService sceneService; private SceneService sceneService;
@Autowired
private SceneMerchantRefNewMapper sceneMerchantRefNewMapper;
public Page<StaffBaseInfoDTO> listWithPage(RpcPagination<StaffBaseInfoDTO> pagination) { public Page<StaffBaseInfoDTO> listWithPage(RpcPagination<StaffBaseInfoDTO> pagination) {
RpcAssert.assertNotNull(pagination, DefaultErrorEnum.DATA_NULL, "RpcPagination not be null"); RpcAssert.assertNotNull(pagination, DefaultErrorEnum.DATA_NULL, "RpcPagination not be null");
try { try {
...@@ -2154,16 +2157,13 @@ public class StaffBaseInfoService { ...@@ -2154,16 +2157,13 @@ public class StaffBaseInfoService {
} }
StaffAccountRecordDTO recordQuery = StaffAccountRecordDTO.builder() StaffAccountRecordDTO recordQuery = StaffAccountRecordDTO.builder()
.staffPhone(staffPhone) .staffPhone(staffPhone)
.merchantId(dto.getMerchantId())
.yqMerchantId(yqMerchantId) .yqMerchantId(yqMerchantId)
.deletedFlagList(Arrays.asList(StaffStatusEnum.NOT_DELETED.getName(), StaffStatusEnum.INVALID.getName())) .deletedFlagList(Arrays.asList(StaffStatusEnum.NOT_DELETED.getName(), StaffStatusEnum.INVALID.getName()))
.build(); .build();
List<StaffAccountRecordDTO> existAccountList = staffAccountRecordService.listStaffAccountRecord(recordQuery); List<StaffAccountRecordDTO> existAccountList = staffAccountRecordService.listStaffAccountRecord(recordQuery);
if(CollectionUtils.isNotEmpty(existAccountList)){
log.info("指定园区店下已有账号,请重新分配");
throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "该门店和业务场景组合已存在,请勿重复新增");
}
// 然获取到账户中心账号uuid后,增加员工园区店账号记录 // 获取场景信息
Integer merchantId = dto.getMerchantId(); Integer merchantId = dto.getMerchantId();
String merchantName = dto.getMerchantName(); String merchantName = dto.getMerchantName();
List<String> baseSceneCodes = dto.getBaseSceneCodeList(); List<String> baseSceneCodes = dto.getBaseSceneCodeList();
...@@ -2173,7 +2173,44 @@ public class StaffBaseInfoService { ...@@ -2173,7 +2173,44 @@ public class StaffBaseInfoService {
throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "场景信息不存在"); throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "场景信息不存在");
} }
// 校验驻店类型
if (Objects.isNull(dto.getStationType())) {
throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "驻店类型不能为空");
}
String sceneTypes = scenes.stream().map(SceneDTO::getSceneType).filter(Objects::nonNull).map(String::valueOf).distinct().sorted().collect(Collectors.joining(",")); String sceneTypes = scenes.stream().map(SceneDTO::getSceneType).filter(Objects::nonNull).map(String::valueOf).distinct().sorted().collect(Collectors.joining(","));
if (CollectionUtils.isNotEmpty(existAccountList)) {
// 已存在:场景覆盖(先删后插)+ 更新stationType/staffSceneLabel
StaffAccountRecordDTO existRecord = existAccountList.get(0);
Integer accountRecordId = existRecord.getId();
// 删除旧的场景记录
StaffAccountScene deleteCondition = new StaffAccountScene();
deleteCondition.setAccountRecordId(accountRecordId);
List<StaffAccountScene> oldScenes = staffAccountSceneMapper.select(deleteCondition);
for (StaffAccountScene oldScene : oldScenes) {
StaffAccountScene deleteScene = new StaffAccountScene();
deleteScene.setId(oldScene.getId());
deleteScene.setDeletedFlag(DeleteFlagEnum.D.getValue());
staffAccountSceneMapper.updateByPrimaryKeySelective(deleteScene);
}
// 重新插入新场景
batchInsertAccountScene(scenes, accountRecordId, dto.getMerchantId());
// 更新 accountRecord 的 staffSceneLabel 和 stationType
StaffAccountRecord updateRecord = new StaffAccountRecord();
updateRecord.setId(accountRecordId);
updateRecord.setStaffSceneLabel(sceneTypes);
updateRecord.setStationType(dto.getStationType());
updateRecord.setUpdatedBy(dto.getOperatorBy());
updateRecord.setUpdatedDate(new Date());
staffAccountRecordService.updateByPrimaryKeySelective(updateRecord);
log.info("场景覆盖更新完成,accountRecordId:{}", accountRecordId);
} else {
// 不存在:走原插入逻辑
StaffAccountRecord accountRecord = new StaffAccountRecord(); StaffAccountRecord accountRecord = new StaffAccountRecord();
accountRecord.setStaffUuid("temp_uuid"); accountRecord.setStaffUuid("temp_uuid");
accountRecord.setStaffPhone(staffPhone); accountRecord.setStaffPhone(staffPhone);
...@@ -2189,11 +2226,12 @@ public class StaffBaseInfoService { ...@@ -2189,11 +2226,12 @@ public class StaffBaseInfoService {
accountRecord.setUpdatedDate(new Date()); accountRecord.setUpdatedDate(new Date());
accountRecord.setDeletedFlag(DeleteFlagEnum.N.getValue()); accountRecord.setDeletedFlag(DeleteFlagEnum.N.getValue());
accountRecord.setCreatedSource(dto.getCreatedSource()); accountRecord.setCreatedSource(dto.getCreatedSource());
accountRecord.setStationType(dto.getStationType());
staffAccountRecordService.insertStaffAccountRecord(accountRecord); staffAccountRecordService.insertStaffAccountRecord(accountRecord);
// 批量新增 dj_car_life_staff_account_scene 记录 // 批量新增 dj_car_life_staff_account_scene 记录
Integer accountRecordId = accountRecord.getId(); Integer accountRecordId = accountRecord.getId();
batchInsertAccountScene(scenes, accountRecordId); batchInsertAccountScene(scenes, accountRecordId, dto.getMerchantId());
Byte workingStatus = staffBaseInfo.getWorkingStatus(); Byte workingStatus = staffBaseInfo.getWorkingStatus();
if (WorkingStatusEnum.WAIT_ACTIVATE.getValue() == workingStatus) { if (WorkingStatusEnum.WAIT_ACTIVATE.getValue() == workingStatus) {
...@@ -2238,11 +2276,20 @@ public class StaffBaseInfoService { ...@@ -2238,11 +2276,20 @@ public class StaffBaseInfoService {
staffAccountRecordUpdate.setId(accountRecord.getId()); staffAccountRecordUpdate.setId(accountRecord.getId());
staffAccountRecordUpdate.setStaffUuid(staffUuid); staffAccountRecordUpdate.setStaffUuid(staffUuid);
staffAccountRecordService.updateByPrimaryKeySelective(staffAccountRecordUpdate); staffAccountRecordService.updateByPrimaryKeySelective(staffAccountRecordUpdate);
}
return Boolean.TRUE; return Boolean.TRUE;
} }
public void batchInsertAccountScene(List<SceneDTO> scenes, Integer accountRecordId) { public void batchInsertAccountScene(List<SceneDTO> scenes, Integer accountRecordId, Integer merchantId) {
for (SceneDTO sceneItem : scenes) { for (SceneDTO sceneItem : scenes) {
// 校验4s店是否支持该场景,不支持则跳过
if (merchantId != null) {
List<SceneMerchantRefNew> refList = sceneMerchantRefNewMapper.findByMerchantIdSceneAndBaseSceneCode(merchantId, null, sceneItem.getBaseSceneCode());
if (CollectionUtils.isEmpty(refList) || refList.stream().noneMatch(ref -> ref.getStatus() != null && ref.getStatus() == 1)) {
log.warn("4s店[merchantId={}]不支持场景[baseSceneCode={}],跳过插入", merchantId, sceneItem.getBaseSceneCode());
continue;
}
}
Integer sceneType = sceneItem.getSceneType(); Integer sceneType = sceneItem.getSceneType();
StaffAccountScene staffAccountScene = StaffAccountScene.builder() StaffAccountScene staffAccountScene = StaffAccountScene.builder()
.accountRecordId(accountRecordId) .accountRecordId(accountRecordId)
......
...@@ -80,4 +80,16 @@ ...@@ -80,4 +80,16 @@
where main_merchant_id = #{shopMerchantId} and sub_merchant_id = #{refMerchantId} and sub_merchant_type = 7 and base_scene_code = #{baseSceneCode} where main_merchant_id = #{shopMerchantId} and sub_merchant_id = #{refMerchantId} and sub_merchant_type = 7 and base_scene_code = #{baseSceneCode}
and deleted_flag = 'N' and status = 1 and deleted_flag = 'N' and status = 1
</select> </select>
<select id="query4sByYqMerchantList" resultMap="BaseResultMap">
SELECT for4s.main_merchant_id, for4s.main_merchant_name, for4s.base_scene_code, for4s.scene,
for4s.sub_merchant_id, for4s.sub_merchant_name
FROM dj_car_life_scene_merchant_ref_new for4s
WHERE for4s.sub_merchant_id IN
<foreach collection="yqMerchantIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
AND for4s.main_merchant_type = 2
AND for4s.deleted_flag = 'N'
AND for4s.status = 1
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<result column="yq_merchant_id" property="yqMerchantId" jdbcType="INTEGER" /> <result column="yq_merchant_id" property="yqMerchantId" jdbcType="INTEGER" />
<result column="yq_merchant_name" property="yqMerchantName" jdbcType="VARCHAR" /> <result column="yq_merchant_name" property="yqMerchantName" jdbcType="VARCHAR" />
<result column="created_source" property="createdSource" jdbcType="TINYINT" /> <result column="created_source" property="createdSource" jdbcType="TINYINT" />
<result column="station_type" property="stationType" jdbcType="TINYINT" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" /> <result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" /> <result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" /> <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
...@@ -36,7 +37,7 @@ ...@@ -36,7 +37,7 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
id, staff_uuid, staff_phone, job_type, staff_scene_label, merchant_id, merchant_name, yq_merchant_id, yq_merchant_name, created_source, id, staff_uuid, staff_phone, job_type, staff_scene_label, merchant_id, merchant_name, yq_merchant_id, yq_merchant_name, created_source, station_type,
created_by, created_date, updated_by, updated_date, deleted_flag created_by, created_date, updated_by, updated_date, deleted_flag
</sql> </sql>
...@@ -104,6 +105,9 @@ ...@@ -104,6 +105,9 @@
<if test="yqMerchantId != null"> <if test="yqMerchantId != null">
and yq_merchant_id = #{yqMerchantId,jdbcType=INTEGER} and yq_merchant_id = #{yqMerchantId,jdbcType=INTEGER}
</if> </if>
<if test="merchantId != null">
and merchant_id = #{merchantId,jdbcType=INTEGER}
</if>
<if test="yqMerchantIdList != null and yqMerchantIdList.size() != 0 "> <if test="yqMerchantIdList != null and yqMerchantIdList.size() != 0 ">
and yq_merchant_id in and yq_merchant_id in
<foreach close=")" collection="yqMerchantIdList" index="index" item="item" open="(" separator=","> <foreach close=")" collection="yqMerchantIdList" index="index" item="item" open="(" separator=",">
...@@ -137,6 +141,9 @@ ...@@ -137,6 +141,9 @@
<if test="yqMerchantId != null"> <if test="yqMerchantId != null">
AND sr.yq_merchant_id = #{yqMerchantId,jdbcType=INTEGER} AND sr.yq_merchant_id = #{yqMerchantId,jdbcType=INTEGER}
</if> </if>
<if test="merchantId != null">
AND sr.merchant_id = #{merchantId,jdbcType=INTEGER}
</if>
<if test="sceneType != null"> <if test="sceneType != null">
AND ss.scene_type = #{sceneType} AND ss.scene_type = #{sceneType}
</if> </if>
...@@ -144,4 +151,31 @@ ...@@ -144,4 +151,31 @@
AND ss.deleted_flag = 'N' AND ss.deleted_flag = 'N'
</where> </where>
</select> </select>
<!-- 按手机号+园区店批量更新删除标识状态(禁用/启用V2) -->
<update id="batchUpdateDeleteFlagByPhoneAndYqMerchant">
UPDATE dj_car_life_staff_account_record
SET deleted_flag = #{deletedFlag,jdbcType=VARCHAR},
updated_by = #{updatedBy,jdbcType=VARCHAR},
updated_date = #{updatedDate,jdbcType=TIMESTAMP}
WHERE staff_phone = #{staffPhone,jdbcType=VARCHAR}
AND yq_merchant_id = #{yqMerchantId,jdbcType=INTEGER}
AND deleted_flag <![CDATA[<>]]> 'D'
</update>
<!-- 清理4s店不支持的场景数据 -->
<update id="cleanInvalidAccountScene">
UPDATE dj_car_life_staff_account_scene ss
INNER JOIN dj_car_life_staff_account_record sr ON ss.account_record_id = sr.id
SET ss.deleted_flag = 'D', ss.updated_date = NOW()
WHERE ss.deleted_flag = 'N'
AND NOT EXISTS (
SELECT 1 FROM dj_car_life_scene_merchant_ref_new ref
WHERE ref.main_merchant_id = sr.merchant_id
AND ref.base_scene_code = ss.base_scene_code
AND ref.main_merchant_type = 2
AND ref.deleted_flag = 'N'
AND ref.status = 1
)
</update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
<result column="accountMentorPhone" property="mentorPhone" jdbcType="VARCHAR"/> <result column="accountMentorPhone" property="mentorPhone" jdbcType="VARCHAR"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/> <result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP"/> <result column="created_date" property="createdDate" jdbcType="TIMESTAMP"/>
<result column="station_type" property="stationType" jdbcType="TINYINT"/>
</collection> </collection>
</resultMap> </resultMap>
...@@ -482,7 +483,7 @@ ...@@ -482,7 +483,7 @@
/*账号信息*/ /*账号信息*/
sar.id as accountRecordId,sar.deleted_flag as accountRecordDeletedFlag, sar.id as accountRecordId,sar.deleted_flag as accountRecordDeletedFlag,
sar.merchant_id,sar.merchant_name,sar.yq_merchant_id,sar.yq_merchant_name,sar.staff_scene_label as yqMerchantStaffSceneLabel, sar.merchant_id,sar.merchant_name,sar.yq_merchant_id,sar.yq_merchant_name,sar.staff_scene_label as yqMerchantStaffSceneLabel,
sar.job_type as accountJobType,sbi.mentor_name as accountMentorName,sbi.mentor_phone as accountMentorPhone,sar.created_date,sar.created_by sar.job_type as accountJobType,sbi.mentor_name as accountMentorName,sbi.mentor_phone as accountMentorPhone,sar.created_date,sar.created_by,sar.station_type
from dj_car_life_staff_base_info sbi from dj_car_life_staff_base_info sbi
left join dj_car_life_staff_business_info_change_record sbicr on sbi.staff_phone = sbicr.staff_phone and sbicr.deleted_flag = 'N' left join dj_car_life_staff_business_info_change_record sbicr on sbi.staff_phone = sbicr.staff_phone and sbicr.deleted_flag = 'N'
left join dj_car_life_staff_account_record sar on sbi.staff_phone = sar.staff_phone and sar.deleted_flag in ('N','I') left join dj_car_life_staff_account_record sar on sbi.staff_phone = sar.staff_phone and sar.deleted_flag in ('N','I')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!