wuxw
2022-11-21 74d095b1ab981d07ba55dc0add4db5a2c53fe2be
service-acct/src/main/java/com/java110/acct/cmd/couponProperty/ListCouponPropertyPoolCmd.java
@@ -20,6 +20,8 @@
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.dto.couponPropertyPoolConfig.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;
@@ -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);
        }
    }
}