Merge branch 'master' into cc_20250527_desk

# Conflicts:
#	coolstore-partner-web/src/main/resources/application-online.properties
This commit is contained in:
shuo.wang
2025-05-28 20:07:48 +08:00
14 changed files with 140 additions and 9 deletions

View File

@@ -132,6 +132,7 @@ public enum ShopSubStageEnum {
case SHOP_STAGE_22:
case SHOP_STAGE_23:
case SHOP_STAGE_24:
case SHOP_STAGE_25:
return ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_00;
default:
return null;
@@ -150,6 +151,7 @@ public enum ShopSubStageEnum {
case SHOP_STAGE_20:
case SHOP_STAGE_21:
case SHOP_STAGE_22:
case SHOP_STAGE_25:
return null;
default:
return planCompleteTime.plusDays(getPlanCompleteDays()).toString();

View File

@@ -109,8 +109,7 @@ public class HyPartnerUserInfoDAO {
}
public List<HyPartnerUserInfoDO> selectPasswordIsNull(){
Example example = new Example(HyPartnerUserInfoDO.class);
example.createCriteria().andIsNull("downstreamSystemPassword");
return hyPartnerUserInfoMapper.selectByExample(example);
return hyPartnerUserInfoMapper.selectPasswordIsNull();
}
}

View File

@@ -219,4 +219,13 @@ public class LineInfoDAO {
List<LineInfoDO> lineMobile = lineInfoMapper.getByLineIds(lineIds);
return lineMobile.stream().filter(o->StringUtils.isNotBlank(o.getMobile())).collect(Collectors.toMap(LineInfoDO::getId, LineInfoDO::getUsername, (k1, k2)-> k1));
}
public List<LineInfoDO> getListByPartnerIds(List<String> partnerIds){
if(CollectionUtils.isEmpty(partnerIds)){
return Lists.newArrayList();
}
Example example = new Example(LineInfoDO.class);
example.createCriteria().andIn("partnerId",partnerIds);
return lineInfoMapper.selectByExample(example);
}
}

View File

@@ -44,7 +44,7 @@ public class QualificationsInfoDAO {
}
return qualificationsInfoMapper.getByLineId(lineId);
}
public List<QualificationsInfoDO> getByLineIds(@Param("lineIds") List<Long> lineIds){
public List<QualificationsInfoDO> getByLineIds( List<Long> lineIds){
if (lineIds==null|| lineIds.isEmpty()){
return new java.util.ArrayList<>();
}
@@ -52,4 +52,13 @@ public class QualificationsInfoDAO {
example.createCriteria().andIn("lineId", lineIds);
return qualificationsInfoMapper.selectByExample(example);
}
public List<QualificationsInfoDO> getByPartnerIds( List<String> partnerIds){
if (partnerIds.isEmpty()){
return new java.util.ArrayList<>();
}
Example example = new Example(QualificationsInfoDO.class);
example.createCriteria().andIn("partnerId", partnerIds);
return qualificationsInfoMapper.selectByExample(example);
}
}

View File

@@ -141,12 +141,29 @@ public class ShopAccountDAO {
return shopAccountMapper.selectByExample(example);
}
public List<ShopAccountDO> getPasswordIsNullByShopIds(List<Long> shopIds){
if (CollectionUtils.isEmpty(shopIds)){
return new ArrayList<>();
}
Example example = new Example(ShopAccountDO.class);
List<String> systemNameList = new ArrayList<>();
systemNameList.add("火码POS");
systemNameList.add("云流水");
systemNameList.add("新掌柜");
example.createCriteria().andIn("shopId", shopIds).andIsNull("password").andIn("systemName",systemNameList);
return shopAccountMapper.selectByExample(example);
}
/**
* @Auther: wangshuo
* @Date: 2025/4/28
* @description: 数据处理专用只处理,盐值 密码 第二密码
*/
public Integer dateHandle(List<ShopAccountDO> list){
if (CollectionUtils.isEmpty(list)){
return CommonConstants.ZERO;
}
return shopAccountMapper.dateHandle(list);
}
/**

View File

@@ -291,4 +291,10 @@ public class ShopInfoDAO {
public List<FranchiseReportDTO> getShopFranchiseReportList(FranchiseReportRequest request){
return shopInfoMapper.getShopFranchiseReportList(request);
}
public List<ShopInfoDO> selectByPartnerIds(List<String> partnerIds){
Example example = new Example(ShopInfoDO.class);
example.createCriteria().andIn("partnerId", partnerIds).andEqualTo("deleted", false);
return shopInfoMapper.selectByExample(example);
}
}

View File

@@ -53,4 +53,6 @@ public interface HyPartnerUserInfoMapper extends tk.mybatis.mapper.common.Mappe
Integer dataHandle(@Param("list") List<HyPartnerUserInfoDO> hyPartnerUserInfoDOList);
List<HyPartnerUserInfoDO> selectPasswordIsNull();
}

View File

@@ -56,6 +56,9 @@
<select id="selectLastCrmCreateTime" resultType="java.lang.String">
SELECT crm_create_time as crmCreateTime FROM xfsg_partner_user_info ORDER BY crm_create_time desc limit 1
</select>
<select id="selectPasswordIsNull" resultType="com.cool.store.entity.HyPartnerUserInfoDO">
SELECT * FROM `xfsg_partner_user_info` a LEFT JOIN xfsg_qualifications_info b on a.partner_id=b.partner_id WHERE b.id is not null and a.downstream_system_password is null
</select>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into xfsg_partner_user_info
@@ -184,6 +187,8 @@
<if test="item.downstreamSystemSecondaryPassword != null">
downstream_system_secondary_password = #{item.downstreamSystemSecondaryPassword},
</if>
update_time = now()
</set>
where id = #{item.id}

View File

@@ -176,6 +176,7 @@
<if test="item.secondaryPassword != null">
secondary_password = #{item.secondaryPassword},
</if>
remark = #{item.remark}
</set>
where id = #{item.id}

View File

@@ -428,9 +428,11 @@
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
<foreach collection="regionIds" item="item" index="index" open="and region_id in (" separator="," close=")">
#{item}
</foreach>
<if test="regionIds!=null and regionIds.size >0">
<foreach collection="regionIds" item="item" index="index" open="and region_id in (" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="getShopIdBySuccessOpen" resultType="com.cool.store.entity.ShopInfoDO">
select a.id as id, a.partner_id as partnerId

View File

@@ -914,6 +914,8 @@ public class DataHandlerServerImpl implements DataHandlerServer {
@Transactional(rollbackFor = Exception.class)
public Integer JingDongStageHandler() {
List<ShopStageInfoDO> subStages = shopStageInfoDAO.getSubStages(ShopSubStageEnum.SHOP_STAGE_19.getShopSubStage());
List<ShopStageInfoDO> jdSubStages = shopStageInfoDAO.getSubStages(ShopSubStageEnum.SHOP_STAGE_25.getShopSubStage());
List<Long> jdStageShopIds = jdSubStages.stream().map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
Set<Long> lineIds = subStages.stream().map(ShopStageInfoDO::getLineId).collect(Collectors.toSet());
List<LineInfoDO> lineInfoDOS = lineInfoDAO.getByLineIds(new ArrayList<>(lineIds));
Map<Long, LineInfoDO> lineMap = lineInfoDOS.stream().collect(Collectors.toMap(LineInfoDO::getId, line -> line));
@@ -922,6 +924,9 @@ public class DataHandlerServerImpl implements DataHandlerServer {
ShopSubStageEnum shopSubStageEnum = ShopSubStageEnum.SHOP_STAGE_25;
List<Long> shopIds = shopAccountDAO.getShopId();
for (ShopStageInfoDO shopStageInfoDO : subStages) {
if (jdStageShopIds.contains(shopStageInfoDO.getShopId())){
continue;
}
LineInfoDO lineInfoDO = lineMap.get(shopStageInfoDO.getLineId());
if (Objects.isNull(lineInfoDO)) {
log.info("线索不存在:{}", shopStageInfoDO.getShopId());

View File

@@ -17,6 +17,7 @@ import com.cool.store.response.MiniShopsResponse;
import com.cool.store.service.*;
import com.cool.store.utils.PasswordUtil;
import com.cool.store.utils.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -31,6 +32,7 @@ import java.util.stream.Collectors;
* @Date 2025/4/7 15:51
* @Version 1.0
*/
@Slf4j
@Service
public class ShopAccountServiceImpl implements ShopAccountService {
@Resource
@@ -55,6 +57,8 @@ public class ShopAccountServiceImpl implements ShopAccountService {
OldShopDAO oldShopDAO;
@Resource
ThirdXinGuanJiaService thirdXinGuanJiaService;
@Resource
private LineInfoDAO lineInfoDAO;
@Override
public List<ShopAccountDTO> getShopAccountByShopId(Long shopId) {
@@ -362,13 +366,77 @@ public class ShopAccountServiceImpl implements ShopAccountService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean handleOldDataAccount() {
List<HyPartnerUserInfoDO> hyPartnerUserInfoDOS = hyPartnerUserInfoDAO.selectPasswordIsNull();
if (CollectionUtils.isEmpty(hyPartnerUserInfoDOS)){
return true;
}
List<String> partnerIds = hyPartnerUserInfoDOS.stream().map(HyPartnerUserInfoDO::getPartnerId).collect(Collectors.toList());
return null;
List<QualificationsInfoDO> qualificationsInfoDOList = qualificationsInfoDAO.getByPartnerIds(partnerIds);
Map<String, QualificationsInfoDO> qualificationsInfoDOMap = qualificationsInfoDOList.stream().collect(Collectors.toMap(QualificationsInfoDO::getPartnerId, Function.identity()));
List<ShopInfoDO> shopInfoDOS = shopInfoDAO.selectByPartnerIds(partnerIds);
Map<String,List<Long>> shopIdByPartnerIdMap = shopInfoDOS.stream().collect(Collectors.groupingBy(ShopInfoDO::getPartnerId,Collectors.mapping(ShopInfoDO::getId,Collectors.toList())));
List<Long> shopIds = shopInfoDOS.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
// 获取密码为空的门店账户新管家ylspos
List<ShopAccountDO> passwordIsNullByShopIds = shopAccountDAO.getPasswordIsNullByShopIds(shopIds);
Map<Long, List<ShopAccountDO>> shopAccountDOMap = passwordIsNullByShopIds.stream().collect(Collectors.groupingBy(ShopAccountDO::getShopId));
for (HyPartnerUserInfoDO hyPartnerUserInfoDO : hyPartnerUserInfoDOS){
QualificationsInfoDO qualificationsInfoDO = qualificationsInfoDOMap.get(hyPartnerUserInfoDO.getPartnerId());
if (qualificationsInfoDO == null ){
log.info("获取证件信息失败,手机号:{}",hyPartnerUserInfoDO.getMobile());
continue;
}
String substring = qualificationsInfoDO.getIdCardNo().substring(qualificationsInfoDO.getIdCardNo().length() - 6);
if (StringUtil.isBlank(substring)){
log.info("身份证截取失败,手机号:{}",hyPartnerUserInfoDO.getMobile());
continue;
}
//生成密码和盐值
byte[] saltBytes = PasswordUtil.generateSalt();
String salt = PasswordUtil.bytesToHex(saltBytes);
if (StringUtil.isBlank(salt)){
log.info("盐值生成失败,手机号:{}",hyPartnerUserInfoDO.getMobile());
continue;
}
String password = PasswordUtil.encryptPassword(substring, salt);
if (StringUtil.isBlank(password)){
log.info("密码生成失败,手机号:{}",hyPartnerUserInfoDO.getMobile());
continue;
}
GetPasswordDTO getPasswordDTO = new GetPasswordDTO();
getPasswordDTO.setPassword(substring);
String downstreamSystemSecondaryPassword = thirdXinGuanJiaService.getPassword(getPasswordDTO);
if (StringUtil.isBlank(downstreamSystemSecondaryPassword)){
log.info("第二密码密码生成失败,手机号:{}",hyPartnerUserInfoDO.getMobile());
continue;
}
hyPartnerUserInfoDO.setDownstreamSystemPassword(password);
hyPartnerUserInfoDO.setDownstreamSystemSalting(salt);
hyPartnerUserInfoDO.setDownstreamSystemSecondaryPassword(downstreamSystemSecondaryPassword);
List<Long> shopIdList = shopIdByPartnerIdMap.get(hyPartnerUserInfoDO.getPartnerId());
if (CollectionUtils.isEmpty(shopIdList)){
log.info("没有门店,手机号:{}",hyPartnerUserInfoDO.getMobile());
continue;
}
for (Long shopId : shopIdList){
if (shopAccountDOMap.containsKey(shopId)){
List<ShopAccountDO> shopAccountDOList = shopAccountDOMap.get(shopId);
if (CollectionUtils.isNotEmpty(shopAccountDOList)){
for (ShopAccountDO shopAccountDO : shopAccountDOList) {
shopAccountDO.setPassword(password);
shopAccountDO.setPasswordSalt(salt);
shopAccountDO.setSecondaryPassword(downstreamSystemSecondaryPassword);
}
}
}
}
}
hyPartnerUserInfoDAO.dataHandle(hyPartnerUserInfoDOS);
shopAccountDAO.dateHandle(passwordIsNullByShopIds);
return true;
}

View File

@@ -85,6 +85,12 @@ public class ShopAccountController {
return ResponseResult.success(accountService.handleAccountPassword());
}
@ApiOperation("密码数据处理3.0")
@GetMapping("/handleOldDataAccount")
public ResponseResult<Boolean> handleOldDataAccount() {
return ResponseResult.success(accountService.handleOldDataAccount());
}
}

View File

@@ -57,7 +57,7 @@ fixMobileOpenid=HSAY4AF322E
#xxljob配置
#xxljob配置
xxl.job.admin.addresses = https://job.coolstore.cn/xxl-job-admin/
xxl.job.admin.addresses = https://job.coolstore.cn/xxl-job-admin
xxl.job.executor.appname = ${spring.application.name}
xxl.job.executor.ip =
xxl.job.executor.port = 40301