Commit c16e67e9 by 叶立庆

Merge branch 'v5.8.6.2' into 'master'

上线合并

See merge request !22
2 parents 2299e320 7c4b9021
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</parent> </parent>
<groupId>cn.com.glsx.merchants</groupId> <groupId>cn.com.glsx.merchants</groupId>
<artifactId>platform-merchants-api</artifactId> <artifactId>platform-merchants-api</artifactId>
<version>5.8.4-SNAPSHOT</version> <version>5.8.6.2-SNAPSHOT</version>
<name>platform-merchants-api</name> <name>platform-merchants-api</name>
<properties> <properties>
<deploy.scanPackage>cn.com.glsx.merchants.remote</deploy.scanPackage> <deploy.scanPackage>cn.com.glsx.merchants.remote</deploy.scanPackage>
......
...@@ -562,4 +562,9 @@ public interface MerchantRemote { ...@@ -562,4 +562,9 @@ public interface MerchantRemote {
@ApiResponse("门店/品牌/子品牌列表") @ApiResponse("门店/品牌/子品牌列表")
RpcResponse<RpcPagination<MerchantPageWithBrandDTO>> pageListMerchantWithBrand(@NotNull RpcPagination<MerchantPageWithBrandDTO> pagination); RpcResponse<RpcPagination<MerchantPageWithBrandDTO>> pageListMerchantWithBrand(@NotNull RpcPagination<MerchantPageWithBrandDTO> pagination);
@ApiMethod("查询当天更新的商户名称")
@ApiResponse("查询商户名称")
RpcResponse<List<MerchantRequest>> getMerchantNameByLastTime();
} }
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dependency> <dependency>
<groupId>cn.com.glsx.merchants</groupId> <groupId>cn.com.glsx.merchants</groupId>
<artifactId>platform-merchants-api</artifactId> <artifactId>platform-merchants-api</artifactId>
<version>5.8.4-SNAPSHOT</version> <version>5.8.6.2-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.glsx</groupId> <groupId>com.glsx</groupId>
...@@ -134,6 +134,12 @@ ...@@ -134,6 +134,12 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-smartcarlife-api</artifactId>
<version>5.8.6.2-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
......
package cn.com.glsx.merchants.config;
import cn.com.glsx.dj.smartcarlife.remote.SyncMerchantInfoRemote;
import org.oreframework.boot.autoconfigure.dubbo.reference.ReferenceBuilderFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author deployer name
* @version V1.0
* @Title: DubboConfig.java
* @Description: Dubbo服务注册配置
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2018
*/
@Configuration
public class SmartCarLifeDubboConfig {
@Autowired
private ReferenceBuilderFactory factory;
@Bean
public SyncMerchantInfoRemote getSyncMerchantInfoRemote() {
return factory.builder(SyncMerchantInfoRemote.class).check(false).timeout(30000).version("1.0.0").build();
}
}
package cn.com.glsx.merchants.event;
import cn.com.glsx.merchants.entity.Merchant;
import org.springframework.context.ApplicationEvent;
/**
* 门店基础信息事件
*
* @description: 商户更新后发布,携带门店基础信息
*/
public class MerchantInfoEvent extends ApplicationEvent {
private final Merchant merchant;
public MerchantInfoEvent(Object source, Merchant merchant) {
super(source);
this.merchant = merchant;
}
public Merchant getMerchant() {
return merchant;
}
}
package cn.com.glsx.merchants.event;
import cn.com.glsx.dj.smartcarlife.remote.SyncMerchantInfoRemote;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.merchants.entity.Merchant;
import cn.com.glsx.merchants.model.request.MerchantRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
/**
* 门店基础信息事件消费
*/
@Slf4j
@Component
public class MerchantInfoEventListener {
@Autowired
private SyncMerchantInfoRemote syncMerchantInfoRemote;
@EventListener
public void onMerchantInfo(MerchantInfoEvent event) {
Merchant merchant = event.getMerchant();
log.info("收到门店基础信息事件: merchantNo={}, merchantName={}, merchantUuid={}",
merchant.getMerchantNo(), merchant.getMerchantName(), merchant.getMerchantUuid());
MerchantRequest request = new MerchantRequest();
request.setMerchantNo(merchant.getMerchantNo());
request.setMerchantName(merchant.getMerchantName());
request.setMerchantId(merchant.getMerchantNo());
RpcResponse<Boolean> booleanRpcResponse = syncMerchantInfoRemote.updateMerchantName(request);
if (booleanRpcResponse.isFailed() || !booleanRpcResponse.getResult()) {
log.error("更新DJ系统门店名称失败");
return;
}
}
}
...@@ -178,4 +178,7 @@ public interface MerchantMapper extends CommonBaseMapper<Merchant> { ...@@ -178,4 +178,7 @@ public interface MerchantMapper extends CommonBaseMapper<Merchant> {
List<Integer> pageListMerchantIds(RpcPagination<MerchantPageWithBrandDTO> pagination); List<Integer> pageListMerchantIds(RpcPagination<MerchantPageWithBrandDTO> pagination);
List<MerchantPageWithBrandDTO> listMerchantWithBrandByMerchantIds(@Param("merchantIds") List<Integer> merchantIds); List<MerchantPageWithBrandDTO> listMerchantWithBrandByMerchantIds(@Param("merchantIds") List<Integer> merchantIds);
List<Merchant> getMerchantNameByLastTime();
} }
\ No newline at end of file \ No newline at end of file
...@@ -962,6 +962,20 @@ public class MerchantRemoteImpl implements MerchantRemote { ...@@ -962,6 +962,20 @@ public class MerchantRemoteImpl implements MerchantRemote {
} }
/** /**
* 查询当天更新的商户名称
* @return
*/
@Override
public RpcResponse<List<MerchantRequest>> getMerchantNameByLastTime() {
try {
return merchantService.getMerchantNameByLastTime();
} catch (Exception e) {
log.error(e.getMessage(),e);
return RpcResponse.error(e);
}
}
/**
* 查询商户名称 * 查询商户名称
* @author yangwei * @author yangwei
* @since 2026/1/23 16:49 * @since 2026/1/23 16:49
......
...@@ -19,6 +19,7 @@ import cn.com.glsx.merchants.dto.merchant.*; ...@@ -19,6 +19,7 @@ import cn.com.glsx.merchants.dto.merchant.*;
import cn.com.glsx.merchants.entity.*; import cn.com.glsx.merchants.entity.*;
import cn.com.glsx.merchants.enums.*; import cn.com.glsx.merchants.enums.*;
import cn.com.glsx.merchants.enums.beisen.AccountEventSyncBeiSenEnum; import cn.com.glsx.merchants.enums.beisen.AccountEventSyncBeiSenEnum;
import cn.com.glsx.merchants.event.MerchantInfoEvent;
import cn.com.glsx.merchants.kafka.producer.SynMerchantComponent; import cn.com.glsx.merchants.kafka.producer.SynMerchantComponent;
import cn.com.glsx.merchants.listener.ImportMerchantListener; import cn.com.glsx.merchants.listener.ImportMerchantListener;
import cn.com.glsx.merchants.mapper.MerchantMapper; import cn.com.glsx.merchants.mapper.MerchantMapper;
...@@ -55,12 +56,12 @@ import org.apache.commons.collections4.CollectionUtils; ...@@ -55,12 +56,12 @@ import org.apache.commons.collections4.CollectionUtils;
import org.oreframework.distribute.lock.annotation.GlsxDistributeLockable; import org.oreframework.distribute.lock.annotation.GlsxDistributeLockable;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
...@@ -114,6 +115,9 @@ public class MerchantService { ...@@ -114,6 +115,9 @@ public class MerchantService {
@Autowired @Autowired
private DataPermissionService dataPermissionService; private DataPermissionService dataPermissionService;
@Autowired
private ApplicationEventPublisher applicationEventPublisher;
@Autowired @Autowired
private MerchantProductMenuService merchantProductMenuService; private MerchantProductMenuService merchantProductMenuService;
...@@ -285,6 +289,8 @@ public class MerchantService { ...@@ -285,6 +289,8 @@ public class MerchantService {
// 7. // 7.
MerchantLog merchantLog = merchantLogService.buildMerchantLog(ModuleEnum.MERCHANT.getModelType(), MethodEnum.ADD_MERCHANT.getMethodType(), merchantId + "", "成功", merchantRequest); MerchantLog merchantLog = merchantLogService.buildMerchantLog(ModuleEnum.MERCHANT.getModelType(), MethodEnum.ADD_MERCHANT.getMethodType(), merchantId + "", "成功", merchantRequest);
merchantLogService.saveMerchantLog(merchantLog); merchantLogService.saveMerchantLog(merchantLog);
// 发布门店基础信息事件
applicationEventPublisher.publishEvent(new MerchantInfoEvent(this, merchant));
return merchantId; return merchantId;
} }
...@@ -724,6 +730,10 @@ public class MerchantService { ...@@ -724,6 +730,10 @@ public class MerchantService {
// 发布商户同步 // 发布商户同步
synMerchantComponent.sendKafkaMessageSynMerchant(merchant1.getMerchantNo().toString()); synMerchantComponent.sendKafkaMessageSynMerchant(merchant1.getMerchantNo().toString());
// 发布门店基础信息事件
merchant.setMerchantNo(merchant1.getMerchantNo());
merchant.setMerchantUuid(merchant1.getMerchantUuid());
applicationEventPublisher.publishEvent(new MerchantInfoEvent(this, merchant));
return merchant1.getMerchantUuid(); return merchant1.getMerchantUuid();
} }
...@@ -3078,4 +3088,24 @@ public class MerchantService { ...@@ -3078,4 +3088,24 @@ public class MerchantService {
return merchantList; return merchantList;
} }
public RpcResponse<List<MerchantRequest>> getMerchantNameByLastTime() {
try {
List<Merchant> list = merchantMapper.getMerchantNameByLastTime();
if (list == null || list.isEmpty()) {
return RpcResponse.success(new ArrayList<>());
}
List<MerchantRequest> collect = list.stream().map(s -> {
MerchantRequest m = new MerchantRequest();
BeanUtils.copyProperties(s, m);
m.setMerchantId(s.getMerchantNo());
m.setMerchantNo(s.getMerchantNo());
m.setMerchantName(s.getMerchantName());
return m;
}).collect(Collectors.toList());
return RpcResponse.success(collect);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(e.getMessage());
}
}
} }
...@@ -1349,6 +1349,9 @@ ...@@ -1349,6 +1349,9 @@
</foreach> </foreach>
ORDER BY s.merchantNo DESC ORDER BY s.merchantNo DESC
</select> </select>
<select id="getMerchantNameByLastTime" resultMap="BaseResultMap">
SELECT * FROM `platform_merchant` WHERE DATE_FORMAT(updated_time,'%Y-%m-%d')=DATE_FORMAT(NOW(),'%Y-%m-%d') LIMIT 1000
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!