| | |
| | | import cn.exrick.xboot.your.mapper.SignCountMapper; |
| | | import cn.exrick.xboot.your.entity.SignCount; |
| | | import cn.exrick.xboot.your.service.ISignCountService; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | } |
| | | return this.signCountMapper.signCount(orderStatusCount,page); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderStatusCount> signCounts2New(OrderStatusCount orderStatusCount) { |
| | | List<OrderStatusCount> records = this.signCountMapper.signCount2New(orderStatusCount); |
| | | List<OrderStatusCount> recordsAll = this.signCountMapper.signCountNewTotal(orderStatusCount); |
| | | for (int i=0;i<records.size();i++) { |
| | | for (OrderStatusCount statusCountx: recordsAll) { |
| | | if(records.get(i).getCarName().equals(statusCountx.getCarName())){ |
| | | if(statusCountx.getProportion().length()>6){ |
| | | String ss = statusCountx.getProportion().replace("%",""); |
| | | BigDecimal bigDecimal = new BigDecimal(ss); |
| | | double sss = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | records.get(i).setName(sss + "%"); |
| | | }else{ |
| | | records.get(i).setName(statusCountx.getProportion()); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | if(!StrUtil.isEmpty(records.get(i).getSignCount()) && !StrUtil.isEmpty(records.get(i).getAmount()) && !StrUtil.isEmpty(records.get(i).getNotSignCount())){ |
| | | int abnormalSign = Integer.parseInt(records.get(i).getAmount())-Integer.parseInt(records.get(i).getSignCount())-Integer.parseInt(records.get(i).getNotSignCount()); |
| | | if(abnormalSign<0){ |
| | | abnormalSign = 0; |
| | | } |
| | | records.get(i).setAbnormalSign(abnormalSign + ""); |
| | | } |
| | | if(records.get(i).getProportion().length()>6){ |
| | | String ss = records.get(i).getProportion().replace("%",""); |
| | | BigDecimal bigDecimal = new BigDecimal(ss); |
| | | double sss = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | records.get(i).setProportion(sss+ "%"); |
| | | } |
| | | //"oneBatch":"01段","twoBatch":"0","threeBatch":"0","fourBatch":"0","fiveBatch":"0" |
| | | if("0".equals(records.get(i).getOneBatch())){ |
| | | records.get(i).setOneBatch(null); |
| | | }else{ |
| | | records.get(i).setBatch("01段"); |
| | | } |
| | | if("0".equals(records.get(i).getTwoBatch())){ |
| | | records.get(i).setTwoBatch(null); |
| | | }else{ |
| | | records.get(i).setBatch("02段"); |
| | | } |
| | | if("0".equals(records.get(i).getThreeBatch())){ |
| | | records.get(i).setThreeBatch(null); |
| | | }else{ |
| | | records.get(i).setBatch("03段"); |
| | | } |
| | | if("0".equals(records.get(i).getFourBatch())){ |
| | | records.get(i).setFourBatch(null); |
| | | }else{ |
| | | records.get(i).setBatch("04段"); |
| | | } |
| | | if("0".equals(records.get(i).getFiveBatch())){ |
| | | records.get(i).setFiveBatch(null); |
| | | }else{ |
| | | records.get(i).setBatch("05段"); |
| | | } |
| | | } |
| | | return records; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<OrderStatusCount> signCountsNew(OrderStatusCount orderStatusCount, QueryRequest queryRequest) { |
| | | Page<OrderStatusCount> page = new Page<>(); |
| | | if (org.apache.commons.lang3.StringUtils.isNotBlank(queryRequest.getPageSize() + "") && (queryRequest.getPageSize() != 0)) { |
| | | page.setCurrent(queryRequest.getPageNum()); |
| | | page.setSize(queryRequest.getPageSize()); |
| | | } else { |
| | | page.setCurrent(0); |
| | | page.setSize(-1); |
| | | } |
| | | IPage<OrderStatusCount> orderStatusCountIPage = this.signCountMapper.signCountNew(orderStatusCount, page); |
| | | List<OrderStatusCount> recordsAll = this.signCountMapper.signCountNewTotal(orderStatusCount); |
| | | List<OrderStatusCount> records = orderStatusCountIPage.getRecords(); |
| | | |
| | | for (int i=0;i<records.size();i++) { |
| | | for (OrderStatusCount statusCountx: recordsAll) { |
| | | if(records.get(i).getCarName().equals(statusCountx.getCarName())){ |
| | | if(statusCountx.getProportion().length()>6){ |
| | | String ss = statusCountx.getProportion().replace("%",""); |
| | | BigDecimal bigDecimal = new BigDecimal(ss); |
| | | double sss = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | records.get(i).setSendMonth(sss + "%"); |
| | | }else{ |
| | | records.get(i).setSendMonth(statusCountx.getProportion()); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | if(records.get(i).getProportion().length()>6){ |
| | | String ss = records.get(i).getProportion().replace("%",""); |
| | | BigDecimal bigDecimal = new BigDecimal(ss); |
| | | double sss = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | records.get(i).setProportion(sss+ "%"); |
| | | } |
| | | //"oneBatch":"01段","twoBatch":"0","threeBatch":"0","fourBatch":"0","fiveBatch":"0" |
| | | if("0".equals(records.get(i).getOneBatch())){ |
| | | records.get(i).setOneBatch(null); |
| | | } |
| | | if("0".equals(records.get(i).getTwoBatch())){ |
| | | records.get(i).setTwoBatch(null); |
| | | } |
| | | if("0".equals(records.get(i).getThreeBatch())){ |
| | | records.get(i).setThreeBatch(null); |
| | | } |
| | | if("0".equals(records.get(i).getFourBatch())){ |
| | | records.get(i).setFourBatch(null); |
| | | } |
| | | if("0".equals(records.get(i).getFiveBatch())){ |
| | | records.get(i).setFiveBatch(null); |
| | | } |
| | | } |
| | | // List<OrderStatusCount> recordsLast = new ArrayList<>(); |
| | | orderStatusCountIPage.setRecords(records); |
| | | return orderStatusCountIPage; |
| | | } |
| | | } |