Your Name
2023-08-26 7958f1dddb8a7f4e70d232b07a7703955ecedae0
service-acct/src/main/java/com/java110/acct/cmd/couponProperty/ListCouponPropertyPoolCmd.java
@@ -20,12 +20,14 @@
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.dto.coupon.CouponPropertyPoolConfigDto;
import com.java110.intf.acct.ICouponPropertyPoolConfigV1InnerServiceSMO;
import com.java110.intf.acct.ICouponPropertyPoolV1InnerServiceSMO;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import com.java110.dto.couponPropertyPool.CouponPropertyPoolDto;
import com.java110.dto.coupon.CouponPropertyPoolDto;
import java.util.List;
import java.util.ArrayList;
import org.springframework.http.ResponseEntity;
@@ -51,6 +53,9 @@
    @Autowired
    private ICouponPropertyPoolV1InnerServiceSMO couponPropertyPoolV1InnerServiceSMOImpl;
    @Autowired
    private ICouponPropertyPoolConfigV1InnerServiceSMO couponPropertyPoolConfigV1InnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        super.validatePageInfo(reqJson);
@@ -67,6 +72,7 @@
           if (count > 0) {
               couponPropertyPoolDtos = couponPropertyPoolV1InnerServiceSMOImpl.queryCouponPropertyPools(couponPropertyPoolDto);
               queryConfigs(couponPropertyPoolDtos);
           } else {
               couponPropertyPoolDtos = new ArrayList<>();
           }
@@ -77,4 +83,32 @@
           cmdDataFlowContext.setResponseEntity(responseEntity);
    }
    private void queryConfigs(List<CouponPropertyPoolDto> couponPropertyPoolDtos) {
        if(couponPropertyPoolDtos == null || couponPropertyPoolDtos.size()<1){
            return ;
        }
        List<String> cppIds = new ArrayList<>();
        for(CouponPropertyPoolDto couponPropertyPoolDto: couponPropertyPoolDtos){
            cppIds.add(couponPropertyPoolDto.getCppId());
        }
        CouponPropertyPoolConfigDto couponPropertyPoolConfigDto = new CouponPropertyPoolConfigDto();
        couponPropertyPoolConfigDto.setCouponIds(cppIds.toArray(new String[cppIds.size()]));
        List<CouponPropertyPoolConfigDto> couponPropertyPoolConfigDtos
                = couponPropertyPoolConfigV1InnerServiceSMOImpl.queryCouponPropertyPoolConfigs(couponPropertyPoolConfigDto);
        List<CouponPropertyPoolConfigDto> tmpCouponPropertyPoolConfigDtos = null;
        for(CouponPropertyPoolDto couponPropertyPoolDto: couponPropertyPoolDtos){
            tmpCouponPropertyPoolConfigDtos = new ArrayList<>();
            for(CouponPropertyPoolConfigDto couponPropertyPoolConfigDto1: couponPropertyPoolConfigDtos){
                if(couponPropertyPoolDto.getCppId().equals(couponPropertyPoolConfigDto1.getCouponId())){
                    tmpCouponPropertyPoolConfigDtos.add(couponPropertyPoolConfigDto1);
                }
            }
            couponPropertyPoolDto.setConfigs(tmpCouponPropertyPoolConfigDtos);
        }
    }
}