xuhy
2023-05-06 0ad75f90e6464b95bef06c88227f521c5c03d41d
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TDriverServiceImpl.java
@@ -18,7 +18,10 @@
import com.stylefeng.guns.modular.system.service.ITDriverService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.modular.system.service.ITRegionService;
import org.apache.commons.io.FileUtils;
import org.apache.poi.hdf.extractor.TC;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -27,7 +30,11 @@
import org.springframework.util.StringUtils;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
@@ -72,6 +79,7 @@
    @Autowired
    private TCashWithdrawalMapper tCashWithdrawalMapper;
    private Logger log = LoggerFactory.getLogger(this.getClass());
    @Override
    public EntityWrapper<TDriver> getPageList(String createTime, String phone, Integer status) {
        EntityWrapper<TDriver> wrapper = new EntityWrapper<>();
@@ -285,11 +293,9 @@
    }
    @Override
    public JSONObject ocr(String imgUrl) {
        File file = new File(imgUrl);
    public JSONObject ocr(File file) {
        String result = httpUtils.ocr("2", file);
        JSONObject jsonObject = JSONObject.parseObject(result);
        return jsonObject;
        return JSONObject.parseObject(result);
    }
    @Override
@@ -486,4 +492,38 @@
//        commissionResp.setAccumulatedCommission(BigDecimal.ZERO);
    }
    @Override
    public void getDataStatistics(Integer agentId, Model model,Map<String, Object> map) {
        // 司机总数
        Integer driverTotal = tDriverMapper.selectCount(new EntityWrapper<TDriver>()
                .eq("agentId", agentId));
        // 司机最近一月数量
        LocalDate now = LocalDate.now();
        LocalDate localDate = now.plusMonths(1);
        Integer driverMonthTotal = tDriverMapper.selectCount(new EntityWrapper<TDriver>()
                .eq("agentId", agentId)
                .between("createTime", localDate, now));
        model.addAttribute("driverTotal",driverTotal);
        model.addAttribute("driverMonthTotal",driverMonthTotal);
        map.put("driverTotal",driverTotal);
        map.put("driverMonthTotal",driverMonthTotal);
    }
    @Override
    public void getDataStatisticsByIds(List<Integer> ids, Model model, Map<String, Object> map) {
        // 司机总数
        Integer driverTotal = tDriverMapper.selectCount(new EntityWrapper<TDriver>()
                .in("agentId", ids));
        // 司机最近一月数量
        LocalDate now = LocalDate.now();
        LocalDate localDate = now.plusMonths(1);
        Integer driverMonthTotal = tDriverMapper.selectCount(new EntityWrapper<TDriver>()
                .in("agentId", ids)
                .between("createTime", localDate, now));
        model.addAttribute("driverTotal",driverTotal);
        model.addAttribute("driverMonthTotal",driverMonthTotal);
        map.put("driverTotal",driverTotal);
        map.put("driverMonthTotal",driverMonthTotal);
    }
}