Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dist.1.3.0
zhaoqiaobo 8 months ago
parent
commit
ac0c54ba4f
  1. 2
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesAbnormalPackageMapper.java
  2. 7
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesAbnormalPackageMapper.xml
  3. 15
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalPackageServiceImpl.java
  4. 28
      blade-service/logpm-factory/src/main/java/com/logpm/factory/aspect/AsyncAnnotationAspect.java
  5. 1
      blade-service/logpm-factory/src/main/java/com/logpm/factory/config/ExecutorConfig.java

2
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesAbnormalPackageMapper.java

@ -58,7 +58,7 @@ public interface AftersalesAbnormalPackageMapper extends BaseMapper<AftersalesAb
* @param aftersalesAbnormalPackageEntity
* @return
*/
List<AftersalesAbnormalPackageVO> getAbnormalPackage(@Param("param") AftersalesAbnormalPackageEntity aftersalesAbnormalPackageEntity);
List<AftersalesAbnormalPackageVO> getAbnormalPackage(@Param("param") AftersalesAbnormalPackageEntity aftersalesAbnormalPackageEntity,@Param("warehouseIds")List<Long> warehouseIds);
List<AftersalesTrunklineVO> getTrunklines(@Param("orderPackageCode") String orderPackageCode);
List<AftersalesDeliverVO> getDeliver(@Param("orderPackageCode") String orderPackageCode);

7
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesAbnormalPackageMapper.xml

@ -49,7 +49,12 @@
<where>
ldpl. is_deleted = 0
<if test="param.packageCode != null and param.packageCode != ''"> and ldpl.order_package_code =#{param.packageCode } </if>
<if test="param.warehouseId != null and param.warehouseId != ''"> and ldpl.warehouse_id =#{param.warehouseId } </if>
<if test="warehouseIds !=null ">
and ldpl.warehouse_id in
<foreach collection="warehouseIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
</where>
</select>
<select id="getTrunklines" resultType="com.logpm.aftersales.vo.AftersalesTrunklineVO">

15
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalPackageServiceImpl.java

@ -37,6 +37,8 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -76,14 +78,19 @@ public class AftersalesAbnormalPackageServiceImpl extends BaseServiceImpl<Afters
*/
@Override
public List<AftersalesAbnormalPackageVO> getAbnormalPackage(Map<String, Object> aftersalesAbnormalPackage, IPage<Object> page) {
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
List<Long> warehouseIds = new ArrayList<>();
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
AftersalesAbnormalPackageEntity aftersalesAbnormalPackageEntity = JSONObject.parseObject(JSONObject.toJSONString(aftersalesAbnormalPackage), AftersalesAbnormalPackageEntity.class);
if(ObjectUtils.isNotNull(myCurrentWarehouse)){
aftersalesAbnormalPackageEntity.setWarehouseId(myCurrentWarehouse.getId());
warehouseIds.add(myCurrentWarehouse.getId());
}else{
// 获取全部仓库
for (BasicdataWarehouseEntity basicdataWarehouseEntity : warehouseClient.getMyWarehouseList()) {
warehouseIds.add(basicdataWarehouseEntity.getId());
}
}
List<AftersalesAbnormalPackageVO> abnormalPackage = baseMapper.getAbnormalPackage(aftersalesAbnormalPackageEntity);
List<AftersalesAbnormalPackageVO> abnormalPackage = baseMapper.getAbnormalPackage(aftersalesAbnormalPackageEntity,warehouseIds);
abnormalPackage.forEach(i ->{
if (ObjectUtils.isNotNull(i.getPackageCode())){
i.setTrunklines( baseMapper.getTrunklines(i.getPackageCode()));

28
blade-service/logpm-factory/src/main/java/com/logpm/factory/aspect/AsyncAnnotationAspect.java

@ -43,6 +43,34 @@ import java.util.Objects;
public class AsyncAnnotationAspect {
private final BladeRedis bladeRedis;
private final Environment environment;
@Around("@annotation(org.springframework.scheduling.annotation.Async)")
public Object logAroundAsyncMethods(ProceedingJoinPoint joinPoint) throws Throwable {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
Async myAsync = method.getAnnotation(Async.class);
String annotationValue = myAsync.value();
if(StringUtil.isNotBlank(annotationValue) && annotationValue.equals("asyncExecutor")){
// 在方法执行前的操作
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后的操作
DynamicDataSourceContextHolder.poll();
return result;
}else{
return joinPoint.proceed();
}
}
/**
* 该方法为一个切面用于对标记了@RabbitListener注解的方法进行增强主要增加了日志记录和数据源上下文处理的功能
*

1
blade-service/logpm-factory/src/main/java/com/logpm/factory/config/ExecutorConfig.java

@ -64,6 +64,7 @@ public class ExecutorConfig {
}
RequestContextHolder.setRequestAttributes(context);
String tenantId1 = AuthUtil.getTenantId();
log.info(">>>>>>>>>>>>>>>> decorate {}",tenantId1);
runnable.run();
} finally {

Loading…
Cancel
Save