From 11973d88e2bed58888a74911c36248671b7567d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com> Date: Sat, 15 Feb 2025 18:01:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InspectionEquInfoController.java | 101 +- .../controller/InspectionStaffController.java | 38 +- .../controller/InspectionUtilController.java | 19 + .../controller/PartnerOwnController.java | 33 +- .../ShopInspectionGoodsController.java | 143 ++- .../inspection/entity/InspectionEquInfo.java | 18 + .../mapper/AppInspectionPartnerMapper.java | 131 ++- .../mapper/DlInspectionProjectMapper.java | 5 + .../mapper/InspectionWorkNodeMapper.java | 3 + .../service/AppInspectionPartnerService.java | 278 +++-- .../service/DlInspectionProjectService.java | 11 + .../service/IInspectionEquInfoService.java | 15 +- .../service/IInspectionWorkNodeService.java | 15 + .../impl/AppInspectionPartnerServiceImpl.java | 989 +++++++++--------- .../impl/DlInspectionProjectServiceImpl.java | 12 + .../impl/InspectionEquInfoServiceImpl.java | 128 +++ .../impl/InspectionStaffServiceImpl.java | 2 +- .../impl/InspectionWorkNodeServiceImpl.java | 11 + .../inspection/vo/ImportEquipmentVo.java | 24 + .../module/inspection/vo/ImportStaffVo.java | 8 +- .../vo/InspectionEqInfoImportVo.java | 119 +++ .../vo/InspectionOrderExportVo.java | 27 + .../module/payment/entity/OrderInfo.java | 38 + .../payment/service/OrderInfoService.java | 10 + .../service/impl/OrderInfoServiceImpl.java | 109 ++ .../module/payment/vo/OrderInfoExportVo.java | 41 + .../mapper/InspectionWorkNodeMapper.xml | 27 +- .../inspection/AppInspectionPartnerMapper.xml | 17 +- .../inspection/DlInspectionProjectMapper.xml | 27 + .../mapper/payment/OrderInfoMapper.xml | 20 +- .../framework/excel/core/util/ExcelUtils.java | 106 +- 31 files changed, 1727 insertions(+), 798 deletions(-) create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ImportEquipmentVo.java create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/InspectionEqInfoImportVo.java create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/InspectionOrderExportVo.java create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/vo/OrderInfoExportVo.java diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionEquInfoController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionEquInfoController.java index 3c428f50..23f2fbfd 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionEquInfoController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionEquInfoController.java @@ -1,26 +1,32 @@ package cn.iocoder.yudao.module.inspection.controller; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletResponse; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService; +import cn.iocoder.yudao.module.inspection.vo.InspectionEqInfoImportVo; +import cn.iocoder.yudao.module.inspection.vo.StaffImportExcelVO; import cn.iocoder.yudao.module.shop.entity.ShopMallPartners; +import cn.iocoder.yudao.module.system.api.dict.DictDataApi; +import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; import cn.iocoder.yudao.util.ExcelUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import cn.iocoder.yudao.module.core.controller.BaseController; import cn.iocoder.yudao.module.inspection.entity.InspectionEquInfo; import cn.iocoder.yudao.module.inspection.service.IInspectionEquInfoService; +import org.springframework.web.multipart.MultipartFile; + +import static cn.iocoder.yudao.framework.excel.core.util.ExcelUtils.exportBlankTemplate; /** * equInfoController @@ -30,25 +36,26 @@ import cn.iocoder.yudao.module.inspection.service.IInspectionEquInfoService; */ @RestController @RequestMapping("/admin-api/system/equInfo") -public class InspectionEquInfoController extends BaseController -{ +public class InspectionEquInfoController extends BaseController { @Autowired private IInspectionEquInfoService inspectionEquInfoService; - @Autowired - private AppInspectionPartnerService partnerService; + @Autowired + private AppInspectionPartnerService partnerService; + @Autowired + private DictDataApi dictDataApi; /** * 查询equInfo列表 */ @GetMapping("/list") - public CommonResult list(Integer pageNum,Integer pageSize,InspectionEquInfo inspectionEquInfo) throws Exception { + public CommonResult list(Integer pageNum, Integer pageSize, InspectionEquInfo inspectionEquInfo) throws Exception { - Page page =new Page(pageNum,pageSize); + Page page = new Page(pageNum, pageSize); if (ObjectUtil.isNull(inspectionEquInfo.getPartnerId())) { ShopMallPartners partners = partnerService.shopInfoByUserId(); inspectionEquInfo.setPartnerId(partners.getPartnerId()); } - IPage list = inspectionEquInfoService.selectInspectionEquInfoList(page,inspectionEquInfo); + IPage list = inspectionEquInfoService.selectInspectionEquInfoList(page, inspectionEquInfo); return success(list); } @@ -56,10 +63,9 @@ public class InspectionEquInfoController extends BaseController * 导出equInfo列表 */ @PostMapping("/export") - public void export(HttpServletResponse response, InspectionEquInfo inspectionEquInfo) - { - Page page =new Page(1,100000); - IPage list = inspectionEquInfoService.selectInspectionEquInfoList(page,inspectionEquInfo); + public void export(HttpServletResponse response, InspectionEquInfo inspectionEquInfo) { + Page page = new Page(1, 100000); + IPage list = inspectionEquInfoService.selectInspectionEquInfoList(page, inspectionEquInfo); ExcelUtil util = new ExcelUtil(InspectionEquInfo.class); util.exportExcel(response, list.getRecords(), "equInfo数据"); } @@ -68,8 +74,7 @@ public class InspectionEquInfoController extends BaseController * 获取equInfo详细信息 */ @GetMapping(value = "/{id}") - public CommonResult getInfo(@PathVariable("id") Long id) - { + public CommonResult getInfo(@PathVariable("id") Long id) { return success(inspectionEquInfoService.selectInspectionEquInfoById(id)); } @@ -90,7 +95,7 @@ public class InspectionEquInfoController extends BaseController public CommonResult edit(@RequestBody InspectionEquInfo inspectionEquInfo) throws Exception { ShopMallPartners partners = partnerService.shopInfo(); InspectionEquInfo inspectionEquInfo1 = inspectionEquInfoService.selectInspectionEquInfoById(inspectionEquInfo.getId()); - if (!partners.getPartnerId().equals(inspectionEquInfo1.getPartnerId())){ + if (!partners.getPartnerId().equals(inspectionEquInfo1.getPartnerId())) { return null; } return toAjax(inspectionEquInfoService.updateInspectionEquInfo(inspectionEquInfo)); @@ -99,13 +104,63 @@ public class InspectionEquInfoController extends BaseController /** * 删除equInfo */ - @DeleteMapping("/{id}") + @DeleteMapping("/{id}") public CommonResult remove(@PathVariable Long id) throws Exception { ShopMallPartners partners = partnerService.shopInfo(); InspectionEquInfo inspectionEquInfo1 = inspectionEquInfoService.selectInspectionEquInfoById(id); - if (!partners.getPartnerId().equals(inspectionEquInfo1.getPartnerId())){ + if (!partners.getPartnerId().equals(inspectionEquInfo1.getPartnerId())) { return null; } return toAjax(inspectionEquInfoService.deleteInspectionEquInfoById(id)); } + + /** + * 导入模板 + * + * @param response 响应 + * @throws IOException IOException + */ + @PostMapping("/importTemplate") + public void importTemplate(HttpServletResponse response) throws IOException { + // 表头 + String[] head = {"设备名称", "设备类型", "型号", "出厂编号", "校准日期", "复校日期", "证书编号", "制造商", "校准单位", "电话", "地址", "邮编", "电子邮箱"}; + + // 下拉框列及选项:列索引 -> 下拉框选项 + Map dropdownColumns = new HashMap<>(); + + // 查询设备类型 + List eqType = dictDataApi.getDictDataList("ins_equ_type"); + if (eqType != null && !eqType.isEmpty()) { + String[] array1 = eqType.stream() + .map(DictDataRespDTO::getLabel) + .toArray(String[]::new); + dropdownColumns.put(1, array1); // 设备类型列 + } + + // 示例数据(此处为自定义示例行,可根据实际需求修改) + List> exampleDataList = Arrays.asList( + Arrays.asList("示例设备", "请在下拉框中选择", "示例型号", "示例出厂编号", "2023/1/1", "2023/12/31", "123456", "示例制造商", "示例校准单位", "1234567890", "示例地址", "12345", "example@email.com") + ); + + // 调用方法导出空白模板 + exportBlankTemplate(response, "eq_template.xlsx", "设备信息", head, dropdownColumns, true, null, null); + } + + + /** + * 导入设备信息 + * + * @param file 文件 + * @return 导入结果 + */ + @PostMapping("/importEquipment") + public CommonResult> importEquipment(@RequestParam("file") MultipartFile file) { + try { + List list = ExcelUtils.read(file, InspectionEqInfoImportVo.class); + return success(inspectionEquInfoService.importStaff(list)); + } catch (Exception e) { + throw new RuntimeException(e.getMessage()); + } + } + } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionStaffController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionStaffController.java index 5fad688e..0d0c3cb5 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionStaffController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionStaffController.java @@ -58,9 +58,9 @@ public class InspectionStaffController extends BaseController { * @return */ @GetMapping("/list") - public CommonResult list(InspectionStaffQuery query, - @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) { + public CommonResult list(InspectionStaffQuery query, + @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) { Page page = new Page<>(pageNum, pageSize); IPage list = inspectionStaffService.getList(page, query); return success(list); @@ -73,7 +73,7 @@ public class InspectionStaffController extends BaseController { * @return */ @GetMapping("/get") - public CommonResult get(Long id) { + public CommonResult get(Long id) { return success(inspectionStaffService.get(id)); } @@ -84,7 +84,7 @@ public class InspectionStaffController extends BaseController { * @return */ @PostMapping("/save") - public CommonResult save(@RequestBody InspectionStaffSaveVo inspectionStaff) { + public CommonResult save(@RequestBody InspectionStaffSaveVo inspectionStaff) { //校验 verify(inspectionStaff); return success(inspectionStaffService.saveInspectionStaff(inspectionStaff)); @@ -97,7 +97,7 @@ public class InspectionStaffController extends BaseController { * @return */ @PutMapping("/update") - public CommonResult update(@RequestBody InspectionStaffSaveVo inspectionStaff) { + public CommonResult update(@RequestBody InspectionStaffSaveVo inspectionStaff) { Assert.notNull(inspectionStaff.getUserId(), "员工id不能为空"); //校验 verify(inspectionStaff); @@ -112,23 +112,7 @@ public class InspectionStaffController extends BaseController { */ @GetMapping("/get-import-template") public void importTemplate(HttpServletResponse response) throws IOException { - Map headerMap = new HashMap<>(); - headerMap.put(0, "部门名称"); - headerMap.put(1, "员工姓名"); - headerMap.put(2, "岗位"); - headerMap.put(3, "身份证号码"); - headerMap.put(4, "居住地址"); - headerMap.put(5, "学历"); - headerMap.put(6, "毕业院校"); - headerMap.put(7, "电话号码"); - headerMap.put(8, "短号"); - headerMap.put(9, "入职时间"); - headerMap.put(10, "试用期"); - headerMap.put(11, "社保购买日期"); - headerMap.put(12, "紧急联系人"); - headerMap.put(13, "紧急联系人电话"); - headerMap.put(14, "驾驶证类型"); - headerMap.put(15, "备注"); + String[] head = {"部门名称", "员工姓名", "岗位", "身份证号码", "居住地址", "学历", "毕业院校", "电话号码", "短号", "入职时间", "试用期", "社保购买日期", "紧急联系人", "紧急联系人电话", "驾驶证类型", "备注"}; // 下拉框列及选项:列索引 -> 下拉框选项 Map dropdownColumns = new HashMap<>(); @@ -151,16 +135,14 @@ public class InspectionStaffController extends BaseController { dropdownColumns.put(2, roles); - int[] dateColumns = {9, 10, 11}; - List> exampleDataList = Arrays.asList( - Arrays.asList("测试部门", "测试员工","岗位时下拉框选择","xxxxxxxxxxxxxxxxx","居住地","学历是下拉框","xxx学校","手机号","短号","2023/5/2(日期格式)","2023/5/2(日期格式)","2023/5/2(日期格式","紧急联系人","xxxxxxxx","A1,C1(有多个驾驶证类型使用逗号分割)","备注") + Arrays.asList("测试部门", "测试员工", "岗位时下拉框选择", "xxxxxxxxxxxxxxxxx", "居住地", "学历是下拉框", "xxx学校", "手机号", "短号", "2023/5/2(日期格式)", "2023/5/2(日期格式)", "2023/5/2(日期格式", "紧急联系人", "xxxxxxxx", "A1,C1(有多个驾驶证类型使用逗号分割)", "备注") ); List textColumns = Collections.singletonList(3); // 导出空白模板到Excel - exportBlankTemplate(response, "staff_template.xlsx", "员工信息", headerMap, dropdownColumns, dateColumns, true, exampleDataList,textColumns); + exportBlankTemplate(response, "staff_template.xlsx", "员工信息", head, dropdownColumns, true, exampleDataList, textColumns); } @GetMapping("/export") @@ -177,7 +159,7 @@ public class InspectionStaffController extends BaseController { * 导入 */ @PostMapping("/import") - public CommonResult importUser(@RequestParam("file") MultipartFile file) { + public CommonResult importUser(@RequestParam("file") MultipartFile file) { try { List list = ExcelUtils.read(file, StaffImportExcelVO.class); Map map = inspectionStaffService.importStaff(list); diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionUtilController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionUtilController.java index 542094fa..ceb4a74e 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionUtilController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionUtilController.java @@ -9,6 +9,8 @@ import cn.iocoder.yudao.module.inspection.entity.InspectionEquInfo; import cn.iocoder.yudao.module.inspection.entity.InspectionFile; import cn.iocoder.yudao.module.inspection.service.IInspectionEquInfoService; import cn.iocoder.yudao.module.inspection.service.IInspectionFileService; +import cn.iocoder.yudao.module.system.api.dict.DictDataApi; +import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; import cn.iocoder.yudao.module.system.api.permission.PermissionApi; import cn.iocoder.yudao.module.system.api.permission.RoleApi; import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO; @@ -53,6 +55,9 @@ public class InspectionUtilController { @Resource private WorkReportService workReportService; + @Resource + private DictDataApi dictDataApi; + /** * 根据用户取出当前用户的角色,只针对检测 * @@ -99,10 +104,24 @@ public class InspectionUtilController { map.put("equ", equs.getTotal()); long fileCount = fileService.count(new LambdaQueryWrapper().eq(InspectionFile::getType, "2")); map.put("file", fileCount); + //查询汇报数量 WorkReportPageReqVO workReportPageReqVO = new WorkReportPageReqVO(); workReportPageReqVO.setUserId(SecurityFrameworkUtils.getLoginUserId()); workReportPageReqVO.setServicePackageId("jiance"); + //根据dictType查询角色 + List roleList = dictDataApi.getDictDataList("ins_high_rise"); + //公司高层角色code集合 + List codes = roleList.stream().map(DictDataRespDTO::getValue).collect(Collectors.toList()); + + Map> longListMap = permissionApi.roleCodesByUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId())); + List roleKey = longListMap.get(SecurityFrameworkUtils.getLoginUserId()); + + //判断当前登陆人的角色是否是公司高层 + boolean isCompanyLeader = roleKey != null && roleKey.stream().anyMatch(codes::contains); + if (isCompanyLeader) { + workReportPageReqVO.setUserId(null); + } Long reportCount = workReportService.queryReportCount(workReportPageReqVO); map.put("report", reportCount); return success(map); diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java index 19da2a91..d070e643 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java @@ -762,6 +762,18 @@ public class PartnerOwnController extends BaseController { return success(partnerList.staticsTable5(partners.getPartnerId(), startTime, endTime)); } + /** + * 查询检测类型统计 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 结果 + */ + @GetMapping("/queryInspectionSkuList") + public CommonResult queryInspectionSkuList(String startTime, String endTime) { + return success(partnerList.queryInspectionSkuList(startTime, endTime)); + } + /** * 根据inspection_info的id查有的项目名称 * @@ -797,16 +809,27 @@ public class PartnerOwnController extends BaseController { /** * 分类计数 * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @param chooseStatus 状态 * @author 小李 * @date 17:14 2024/12/16 - * @param startTime 开始时间 - * @param endTime 结束时间 - * @param chooseStatus 状态 - **/ + **/ @GetMapping("/getTypeCount") public CommonResult getTypeCount(@RequestParam(value = "startTime", required = false) String startTime, @RequestParam(value = "endTime", required = false) String endTime, - @RequestParam(value = "chooseStatus", required = false) String chooseStatus){ + @RequestParam(value = "chooseStatus", required = false) String chooseStatus) { return success(partnerList.getTypeCount(startTime, endTime, chooseStatus)); } + + /** + * 获取员工统计 + * + * @param dlInspectionProject 项目 + * @return 结果 + */ + @PostMapping("/getStaffCount") + public CommonResult getStaffCount(@RequestBody DlInspectionProject dlInspectionProject) { + return success(partnerList.getStaffCount(dlInspectionProject)); + } } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/ShopInspectionGoodsController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/ShopInspectionGoodsController.java index 1513affb..f42da64f 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/ShopInspectionGoodsController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/ShopInspectionGoodsController.java @@ -4,15 +4,20 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Set; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; + +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.core.text.Convert; import cn.iocoder.yudao.module.core.text.ServletUtils; import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService; import cn.iocoder.yudao.module.payment.service.OrderInfoService; +import cn.iocoder.yudao.module.payment.vo.OrderInfoExportVo; import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.permission.RoleService; @@ -32,6 +37,8 @@ import cn.iocoder.yudao.module.core.controller.BaseController; import cn.iocoder.yudao.module.inspection.entity.ShopInspectionGoods; import cn.iocoder.yudao.module.inspection.service.IShopInspectionGoodsService; +import javax.servlet.http.HttpServletResponse; + /** * 检测商品Controller @@ -41,8 +48,7 @@ import cn.iocoder.yudao.module.inspection.service.IShopInspectionGoodsService; */ @RestController @RequestMapping("/admin-api/system/inspectionGoods") -public class ShopInspectionGoodsController extends BaseController -{ +public class ShopInspectionGoodsController extends BaseController { @Autowired private IShopInspectionGoodsService shopInspectionGoodsService; @Autowired @@ -63,11 +69,10 @@ public class ShopInspectionGoodsController extends BaseController // @PreAuthorize("@ss.hasPermi('system:inspectionGoods:list')") @GetMapping("/listSystem") public CommonResult listSystem(ShopInspectionGoods shopInspectionGoods, - @RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum, - @RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize) - { + @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) { Page page = new Page<>(pageNum, pageSize); - IPage list = shopInspectionGoodsService.listSystem(page,shopInspectionGoods); + IPage list = shopInspectionGoodsService.listSystem(page, shopInspectionGoods); return success(list); } @@ -76,12 +81,12 @@ public class ShopInspectionGoodsController extends BaseController */ @GetMapping("/listPartnerGoods") public CommonResult listPartnerGoods(ShopInspectionGoods shopInspectionGoods, - @RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum, - @RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize) throws Exception { + @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) throws Exception { ShopMallPartners one = appInspectionPartnerService.shopInfoByUserId(); shopInspectionGoods.setPartnerId(one.getPartnerId().intValue()); Page page = new Page<>(pageNum, pageSize); - IPage list = shopInspectionGoodsService.listPartnerGoods(page,shopInspectionGoods); + IPage list = shopInspectionGoodsService.listPartnerGoods(page, shopInspectionGoods); return success(list); } @@ -92,7 +97,7 @@ public class ShopInspectionGoodsController extends BaseController */ @GetMapping("/categoryList") public CommonResult categoryList() throws Exception { - return success( shopInspectionGoodsService.categoryList()); + return success(shopInspectionGoodsService.categoryList()); } /** @@ -107,7 +112,6 @@ public class ShopInspectionGoodsController extends BaseController } - /** * 商品详细信息 */ @@ -122,7 +126,7 @@ public class ShopInspectionGoodsController extends BaseController // throw new Exception("您不是商户"); // } - return success(appInspectionPartnerService.goodsDetail(goodsId)); + return success(appInspectionPartnerService.goodsDetail(goodsId)); } /** @@ -131,45 +135,47 @@ public class ShopInspectionGoodsController extends BaseController @PostMapping("/partnerEditGoods") public CommonResult partnerEditGoods(@RequestBody ShopInspectionGoods goods) throws Exception { LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); - LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(ShopMallPartners::getUserId,loginUser.getId()).eq(ShopMallPartners::getType,"jc").last("limit 1"); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ShopMallPartners::getUserId, loginUser.getId()).eq(ShopMallPartners::getType, "jc").last("limit 1"); ShopMallPartners one = appInspectionPartnerService.getOne(queryWrapper); - if (ObjectUtils.isEmpty(one)){ + if (ObjectUtils.isEmpty(one)) { throw new Exception("您不是商户"); } goods.setPartnerId(one.getPartnerId().intValue()); appInspectionPartnerService.editGoods(goods); - return success(); + return success(); } + /** * 上下架 */ @PostMapping("/partnerChangeListing") public CommonResult partnerChangeListing(Long goodsId) throws Exception { LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); - LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(ShopMallPartners::getUserId,loginUser.getId()).eq(ShopMallPartners::getType,"jc").last("limit 1"); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ShopMallPartners::getUserId, loginUser.getId()).eq(ShopMallPartners::getType, "jc").last("limit 1"); ShopMallPartners one = appInspectionPartnerService.getOne(queryWrapper); - if (ObjectUtils.isEmpty(one)){ + if (ObjectUtils.isEmpty(one)) { throw new Exception("您不是商户"); } appInspectionPartnerService.changeListing(goodsId); - return success(); + return success(); } + /** * 删除商品 */ @PostMapping("/partnerDelGoods") public CommonResult partnerDelGoods(Long goodsId) throws Exception { LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); - LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(ShopMallPartners::getUserId,loginUser.getId()).eq(ShopMallPartners::getType,"jc").last("limit 1"); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ShopMallPartners::getUserId, loginUser.getId()).eq(ShopMallPartners::getType, "jc").last("limit 1"); ShopMallPartners one = appInspectionPartnerService.getOne(queryWrapper); - if (ObjectUtils.isEmpty(one)){ + if (ObjectUtils.isEmpty(one)) { throw new Exception("您不是商户"); } appInspectionPartnerService.delGoods(goodsId); - return success(); + return success(); } /** @@ -184,19 +190,20 @@ public class ShopInspectionGoodsController extends BaseController List roleList = roleService.getRoleList(userRoleIdListByUserId); List roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList()); - ShopMallPartners partner = new ShopMallPartners(); - if (roles.contains("jcshop")){ - LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType,"jc").eq(ShopMallPartners::getIsBanned,"0").last("limit 1"); + ShopMallPartners partner = new ShopMallPartners(); + if (roles.contains("jcshop")) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType, "jc").eq(ShopMallPartners::getIsBanned, "0").last("limit 1"); partner = appInspectionPartnerService.getOne(queryWrapper); - if (ObjectUtil.isEmpty(partner)){ + if (ObjectUtil.isEmpty(partner)) { return error(); } - }else if (roles.contains("jcworker")){ - LambdaQueryWrapper queryWrapperWork =new LambdaQueryWrapper<>(); - queryWrapperWork.eq(PartnerWorker::getUserId,user.getId()); + } else if (roles.contains("jcworker")) { + LambdaQueryWrapper queryWrapperWork = new LambdaQueryWrapper<>(); + queryWrapperWork.eq(PartnerWorker::getUserId, user.getId()); + queryWrapperWork.last("limit 1"); PartnerWorker worker = partnerWorkerService.getOne(queryWrapperWork); - if (ObjectUtil.isEmpty(worker)){ + if (ObjectUtil.isEmpty(worker)) { return error(); } partner.setPartnerId(worker.getPartnerId()); @@ -204,17 +211,58 @@ public class ShopInspectionGoodsController extends BaseController shopInspectionOrder.setPartnerId(partner.getPartnerId()); shopInspectionOrder.setValidationTime(new Date()); Page page = new Page<>(pageNo, pageSize); - return CommonResult.success(orderInfoService.queryListPage(shopInspectionOrder,page)); + return CommonResult.success(orderInfoService.queryListPage(shopInspectionOrder, page)); } + /** + * 导出检测订单列表 + * + * @param response + * @param shopInspectionOrder + * @param pageNo + * @param pageSize + * @throws Exception + */ + @PostMapping("/exportPartnerOrderListSystem") + public void exportPartnerOrderListSystem(HttpServletResponse response, + OrderInfo shopInspectionOrder, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) throws Exception { + LoginUser user = SecurityFrameworkUtils.getLoginUser(); + Set userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(user.getId()); + List roleList = roleService.getRoleList(userRoleIdListByUserId); + List roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList()); + + ShopMallPartners partner = new ShopMallPartners(); + if (roles.contains("jcshop")) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType, "jc").eq(ShopMallPartners::getIsBanned, "0").last("limit 1"); + partner = appInspectionPartnerService.getOne(queryWrapper); + if (ObjectUtil.isEmpty(partner)) { + return; + } + } else if (roles.contains("jcworker")) { + LambdaQueryWrapper queryWrapperWork = new LambdaQueryWrapper<>(); + queryWrapperWork.eq(PartnerWorker::getUserId, user.getId()); + queryWrapperWork.last("limit 1"); + PartnerWorker worker = partnerWorkerService.getOne(queryWrapperWork); + if (ObjectUtil.isEmpty(worker)) { + return; + } + partner.setPartnerId(worker.getPartnerId()); + } + shopInspectionOrder.setPartnerId(partner.getPartnerId()); + shopInspectionOrder.setValidationTime(new Date()); + Page page = new Page<>(pageNo, pageSize); + orderInfoService.exportExcel(response, shopInspectionOrder, page); + } /** * 获取检测商品详细信息 */ @GetMapping(value = "/getByIdSystem") - public CommonResult getByIdSystem(@RequestParam("id") Long id) - { + public CommonResult getByIdSystem(@RequestParam("id") Long id) { return success(shopInspectionGoodsService.selectShopInspectionGoodsById(id)); } @@ -223,8 +271,7 @@ public class ShopInspectionGoodsController extends BaseController */ // @PreAuthorize("@ss.hasPermi('system:inspectionGoods:add')") @PostMapping("/add") - public CommonResult add(@RequestBody ShopInspectionGoods shopInspectionGoods) - { + public CommonResult add(@RequestBody ShopInspectionGoods shopInspectionGoods) { shopInspectionGoods.setIsListing("1"); return toAjax(shopInspectionGoodsService.insertShopInspectionGoods(shopInspectionGoods)); } @@ -234,8 +281,7 @@ public class ShopInspectionGoodsController extends BaseController */ // @PreAuthorize("@ss.hasPermi('system:inspectionGoods:edit')") @PostMapping("/edit") - public CommonResult edit(@RequestBody ShopInspectionGoods shopInspectionGoods) - { + public CommonResult edit(@RequestBody ShopInspectionGoods shopInspectionGoods) { return toAjax(shopInspectionGoodsService.updateShopInspectionGoods(shopInspectionGoods)); } @@ -244,8 +290,7 @@ public class ShopInspectionGoodsController extends BaseController */ // @PreAuthorize("@ss.hasPermi('system:inspectionGoods:edit')") @PostMapping("/examine") - public CommonResult examine(@RequestBody ShopInspectionGoods shopInspectionGoods) - { + public CommonResult examine(@RequestBody ShopInspectionGoods shopInspectionGoods) { return toAjax(shopInspectionGoodsService.examine(shopInspectionGoods)); } @@ -254,26 +299,24 @@ public class ShopInspectionGoodsController extends BaseController */ // @PreAuthorize("@ss.hasPermi('system:inspectionGoods:remove')") @PostMapping("/del") - public CommonResult remove(@RequestParam("idList") Long[] ids) - { + public CommonResult remove(@RequestParam("idList") Long[] ids) { return toAjax(shopInspectionGoodsService.deleteShopInspectionGoodsByIds(ids)); } @GetMapping("/listWx") public CommonResult listWx(ShopInspectionGoods shopInspectionGoods, - @RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum, - @RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize) - { + @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) { Page page = new Page<>(pageNum, pageSize); - IPage list = shopInspectionGoodsService.selectShopInspectionGoodsListWx(page,shopInspectionGoods); + IPage list = shopInspectionGoodsService.selectShopInspectionGoodsListWx(page, shopInspectionGoods); return success(list); } + /** * 获取检测商品详细信息 */ @GetMapping(value = "/{id}") - public CommonResult getInfo(@PathVariable("id") Long id) - { + public CommonResult getInfo(@PathVariable("id") Long id) { return success(shopInspectionGoodsService.selectShopInspectionGoodsById(id)); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionEquInfo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionEquInfo.java index 9318f227..3ab64a60 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionEquInfo.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionEquInfo.java @@ -73,6 +73,24 @@ public class InspectionEquInfo extends TenantBaseDO */ private Long folderId; + /** 检测证书编号 */ + private String certificateNumber; + + /** 制造商 */ + private String manufacturer; + + /** 电话 */ + private String mobile; + + /** 地址 */ + private String address; + + /** 邮编 */ + private String postcode; + + /** 邮箱 */ + private String email; + /** * 文件集合 */ diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/AppInspectionPartnerMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/AppInspectionPartnerMapper.java index a92b2c7c..7cafa60c 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/AppInspectionPartnerMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/AppInspectionPartnerMapper.java @@ -14,76 +14,125 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + import java.util.List; import java.util.Map; @Mapper public interface AppInspectionPartnerMapper extends BaseMapper { ShopMallPartners selectById(@Param("id") Long id); + ShopMallPartners selectByIdNew(); + IPage partnerList(Page page, @Param("vo") PartnerListQuery partnerListQuery); + PartnerListVo shopDetail(PartnerListQuery partnerListQuery); + void addSalesNum(@Param("partnerId") Long partnerId); - StatisticsInfo workNum(@Param("partnerId") Long partnerId,@Param("timeStr") String timeStr); - Integer srlNum(@Param("partnerId") Long partnerId,@Param("timeStr") String timeStr); - Integer hgNum(@Param("partnerId") Long partnerId,@Param("timeStr") String timeStr); + + StatisticsInfo workNum(@Param("partnerId") Long partnerId, @Param("timeStr") String timeStr); + + Integer srlNum(@Param("partnerId") Long partnerId, @Param("timeStr") String timeStr); + + Integer hgNum(@Param("partnerId") Long partnerId, @Param("timeStr") String timeStr); //订单数量接口 - StatisticsInfo orderNum(@Param("partnerId") Long partnerId,@Param("timeStr") String timeStr); - Integer allAmount(@Param("partnerId") Long partnerId); - Integer todayAmount(@Param("partnerId") Long partnerId,@Param("timeStr") String timeStr); - List hotGoodsList(@Param("partnerId") Long partnerId,@Param("dateStr")String dateStr); - List newHotGoodsList(@Param("dateStr")String dateStr); - IPage manageGoodsList(Page page,@Param("partnerId") Long partnerId, @Param("isListing")String isListing,@Param("goodsTitle") String goodsTitle); - IPage orderList(Page page,@Param("partnerId") Long partnerId, @Param("phoneNum") String phoneNum,@Param("title") String title); - List getWorkList(@Param("partnerId")Long partnerId, @Param("postId") Long postId, @Param("workName") String workName, @Param("phoneNum")String phoneNum); - IPage pageWorkList(@Param("partnerId")Long partnerId, @Param("postId") Long postId, @Param("workName") String workName, @Param("phoneNum")String phoneNum,Page page); - IPage inspectionList(Page page,@Param("partnerId")Long partnerId, @Param("status") String status, @Param("carNum")String carNum); - List workerInspectionList(@Param("workerId")Long workerId,@Param("status") String status, @Param("searchValue")String searchValue); - IPage validationList(Page page, @Param("partnerId") Long partnerId, @Param("searchValue") String searchValue); - IPage getPickCarList(Page page,@Param("partnerId") Long partnerId, @Param("phoneNum") String phoneNum, @Param("pickStatus") String pickStatus); - IPage getPickCarListOfWorker(Page page,@Param("workerId") Long workerId, @Param("phoneNum") String phoneNum); + StatisticsInfo orderNum(@Param("partnerId") Long partnerId, @Param("timeStr") String timeStr); + + Integer allAmount(@Param("partnerId") Long partnerId); + + Integer todayAmount(@Param("partnerId") Long partnerId, @Param("timeStr") String timeStr); + + List hotGoodsList(@Param("partnerId") Long partnerId, @Param("dateStr") String dateStr); + + List newHotGoodsList(@Param("dateStr") String dateStr); + + IPage manageGoodsList(Page page, @Param("partnerId") Long partnerId, @Param("isListing") String isListing, @Param("goodsTitle") String goodsTitle); + + IPage orderList(Page page, @Param("partnerId") Long partnerId, @Param("phoneNum") String phoneNum, @Param("title") String title); + + List getWorkList(@Param("partnerId") Long partnerId, @Param("postId") Long postId, @Param("workName") String workName, @Param("phoneNum") String phoneNum); + + IPage pageWorkList(@Param("partnerId") Long partnerId, @Param("postId") Long postId, @Param("workName") String workName, @Param("phoneNum") String phoneNum, Page page); + + IPage inspectionList(Page page, @Param("partnerId") Long partnerId, @Param("status") String status, @Param("carNum") String carNum); + + List workerInspectionList(@Param("workerId") Long workerId, @Param("status") String status, @Param("searchValue") String searchValue); + + IPage validationList(Page page, @Param("partnerId") Long partnerId, @Param("searchValue") String searchValue); + + IPage getPickCarList(Page page, @Param("partnerId") Long partnerId, @Param("phoneNum") String phoneNum, @Param("pickStatus") String pickStatus); + + IPage getPickCarListOfWorker(Page page, @Param("workerId") Long workerId, @Param("phoneNum") String phoneNum); + + List chartInfoAmount(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("partnerId") Long partnerId); + + List newChartInfoAmount(@Param("startTime") String startTime, @Param("endTime") String endTime); + + List chartInfoNum(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("partnerId") Long partnerId); + + List newChartInfoNum(@Param("startTime") String startTime, @Param("endTime") String endTime); + + List> chartInfoRatio(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("partnerId") Long partnerId); + + List> newChartInfoRatio(@Param("startTime") String startTime, @Param("endTime") String endTime); - List chartInfoAmount(@Param("startTime") String startTime,@Param("endTime")String endTime,@Param("partnerId")Long partnerId); - List newChartInfoAmount(@Param("startTime") String startTime,@Param("endTime")String endTime); - List chartInfoNum(@Param("startTime") String startTime,@Param("endTime")String endTime,@Param("partnerId")Long partnerId); - List newChartInfoNum(@Param("startTime") String startTime,@Param("endTime")String endTime); - List> chartInfoRatio(@Param("startTime") String startTime, @Param("endTime")String endTime, @Param("partnerId")Long partnerId); - List> newChartInfoRatio(@Param("startTime") String startTime, @Param("endTime")String endTime); List partnerCategoryList(@Param("partnerId") Long partnerId); - OrderInfo chartLineInspectionAmount(@Param("partnerId") Long partnerId,@Param("dateStr") String dateStr); + + OrderInfo chartLineInspectionAmount(@Param("partnerId") Long partnerId, @Param("dateStr") String dateStr); + OrderInfo newChartLineInspectionAmount(@Param("dateStr") String dateStr); - Map staticsTable1(@Param("partnerId") Long partnerId,@Param("startTime") String startTime,@Param("endTime") String endTime); - Map newStaticsTable1(@Param("startTime") String startTime,@Param("endTime") String endTime); - Map staticsTable2(@Param("partnerId") Long partnerId,@Param("startTime") String startTime,@Param("endTime") String endTime); - Map newStaticsTable2(@Param("startTime") String startTime,@Param("endTime") String endTime); - List> staticsTable3(@Param("partnerId") Long partnerId,@Param("startTime") String startTime,@Param("endTime") String endTime); - List> newStaticsTable3(@Param("startTime") String startTime,@Param("endTime") String endTime); - List> staticsTable3Detail(@Param("partnerId") Long partnerId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("remark") String remark); - List> staticsTable4(@Param("partnerId") Long partnerId,@Param("startTime") String startTime,@Param("endTime") String endTime); - List> staticsTable5(@Param("partnerId") Long partnerId,@Param("startTime") String startTime,@Param("endTime") String endTime); - Long dhjNum(@Param("partnerId") Long partnerId,@Param("dateStr") String dateStr); - Long getAppointNum(@Param("partnerId") Long partnerId,@Param("formDate") String formDate); - Long getPickNum(@Param("partnerId") Long partnerId,@Param("formDate") String formDate); + + Map staticsTable1(@Param("partnerId") Long partnerId, @Param("startTime") String startTime, @Param("endTime") String endTime); + + Map newStaticsTable1(@Param("startTime") String startTime, @Param("endTime") String endTime); + + Map staticsTable2(@Param("partnerId") Long partnerId, @Param("startTime") String startTime, @Param("endTime") String endTime); + + Map newStaticsTable2(@Param("startTime") String startTime, @Param("endTime") String endTime); + + List> staticsTable3(@Param("partnerId") Long partnerId, @Param("startTime") String startTime, @Param("endTime") String endTime); + + List> newStaticsTable3(@Param("startTime") String startTime, @Param("endTime") String endTime); + + List> staticsTable3Detail(@Param("partnerId") Long partnerId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("remark") String remark); + + List> staticsTable4(@Param("partnerId") Long partnerId, @Param("startTime") String startTime, @Param("endTime") String endTime); + + List> staticsTable5(@Param("partnerId") Long partnerId, @Param("startTime") String startTime, @Param("endTime") String endTime); + + Long dhjNum(@Param("partnerId") Long partnerId, @Param("dateStr") String dateStr); + + Long getAppointNum(@Param("partnerId") Long partnerId, @Param("formDate") String formDate); + + Long getPickNum(@Param("partnerId") Long partnerId, @Param("formDate") String formDate); /** * 根据时间查订单 * + * @param startTime 开始时间 非必传 + * @param endTime 结束时间 非必传 * @author 小李 * @date 14:39 2024/12/12 - * @param startTime 开始时间 非必传 - * @param endTime 结束时间 非必传 **/ IPage getOrderByDate(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("chooseStatus") String chooseStatus, Page page); /** * 分类计数 * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @param chooseStatus 状态 * @author 小李 * @date 17:14 2024/12/16 - * @param startTime 开始时间 - * @param endTime 结束时间 - * @param chooseStatus 状态 **/ List> getTypeCount(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("chooseStatus") String chooseStatus); + + /** + * 获取检测类型统计 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + */ + List> queryInspectionSkuList(@Param("startTime") String startTime, @Param("endTime") String endTime); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/DlInspectionProjectMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/DlInspectionProjectMapper.java index b00d94c0..dbd73789 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/DlInspectionProjectMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/DlInspectionProjectMapper.java @@ -3,11 +3,14 @@ package cn.iocoder.yudao.module.inspection.mapper; import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject; import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectPageReqVO; import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectRespVO; +import cn.iocoder.yudao.module.inspection.vo.InspectionOrderExportVo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 检测项目 Mapper * @@ -16,4 +19,6 @@ import org.apache.ibatis.annotations.Param; @Mapper public interface DlInspectionProjectMapper extends BaseMapper { IPage selectListPage(@Param("page") IPage page,@Param("entity") DlInspectionProjectPageReqVO pageReqVO); + + List queryProjectWorkerName(@Param("orderIds") List orderIds); } \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java index f2287d84..5e04339a 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.inspection.mapper; +import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject; import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -37,4 +38,6 @@ public interface InspectionWorkNodeMapper extends BaseMapper * @param workNodes */ void recheck(@Param("list") List workNodes, @Param("status") String status); + + List> getStaffCount(DlInspectionProject dlInspectionProject); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java index c003fae6..6a1b4fd6 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java @@ -23,121 +23,195 @@ import java.util.Map; public interface AppInspectionPartnerService extends IService { - IPage partnerList(Page page, PartnerListQuery partnerListQuery); - List categoryList(Long partnerId); - PartnerListVo shopDetail(PartnerListQuery partnerListQuery); - void addSalesNum(Long partnerId); - ShopMallPartners shopInfo() throws Exception; + IPage partnerList(Page page, PartnerListQuery partnerListQuery); - /** - * 重写shopInfo()方法 - * - */ - ShopMallPartners shopInfoByUserId() throws Exception; + List categoryList(Long partnerId); - JSONObject getAppointAndPickNum() throws Exception; + PartnerListVo shopDetail(PartnerListQuery partnerListQuery); - void startOrEnd(Long partnerId); - StatisticsInfo statisticsInfo(Long partnerId); - JSONObject chartInfoAmount(Long partnerId,String unit); - JSONObject newChartInfoAmount(String unit); - JSONObject chartLineInspectionNum(Long partnerId,String unit); - JSONObject newChartLineInspectionNum(String unit); - JSONObject chartLineInspectionAmount(Long partnerId,String unit); + void addSalesNum(Long partnerId); - JSONObject chartInfoNum(Long partnerId,String unit); - JSONObject newChartInfoNum(String unit); - JSONObject chartInfoRatio(Long partnerId, String unit); - JSONObject newChartInfoRatio(String unit); - List orderInfo(Long partnerId); - List hotGoodsList(Long partnerId); - List newHotGoodsList(); - void addGoods(ShopInspectionGoods goods) throws Exception; - IPage goodsList(Page page,Long partnerId, String isListing, String goodsTitle); - List canUseGoods(Long partnerId); - ShopInspectionGoods goodsDetail(Long goodsId); - void editGoods(ShopInspectionGoods goods) throws Exception; - void editSkuPrice(ShopInspectionGoods goods) throws Exception; + ShopMallPartners shopInfo() throws Exception; - void changeListing(Long goodsId) throws Exception; - void delGoods(Long goodsId) throws Exception; - void editPartnerInfo(ShopMallPartners partners); - PartnerVo getPartnerInfo(Long partnerId); - PartnerBalance accountInfo(Long partnerId); - IPage accountDetail(Page page,Long partnerId, Integer pageNum, Integer pageSize); - IPage orderList(Page page,Long partnerId,String phoneNum, String title); - OrderAppDetail orderDetail(Long partnerId,Long orderId); - Long orderDetailByCode(Long partnerId,String code) throws Exception; - void takeOut(Long partnerId,Long orderId,Long workId,String carNum) throws Exception; - void addWorker(Long partnerId,String realName,String phoneNum,Long postId) throws Exception; - List getWorkList(Long partnerId, Long postId, String workName, String phoneNum); + /** + * 重写shopInfo()方法 + */ + ShopMallPartners shopInfoByUserId() throws Exception; - IPage pageWorkList(Long partnerId, Long postId, String workName, String phoneNum, Page page); + JSONObject getAppointAndPickNum() throws Exception; - void delWorker(Long partnerId,Long workId); + void startOrEnd(Long partnerId); - IPage inspectionList(Page page,Long partnerId, String status, String carNum); - InspectionInfoVo inspectionDetail(Long inspectionInfoId); + StatisticsInfo statisticsInfo(Long partnerId); - List workerInspectionList(Long partnerId,String status,String searchValue); - void addStepInfo(InspectionStepInfo stepInfo); - void stopInspection(InspectionInfo info) throws Exception; - void makeCertOk(Long inspectionId); - IPage getAppointmentList(Page page,Long partnerId,String phoneNum); - IPage validationList(Page page,Long partnerId,String searchValue); - void sendCoupon(ShopCouponTemplate template) throws Exception; - IPage listCoupon(Page page,Long partnerId,String searchValue); - void delCoupon(Long partnerId,Long id); - void designatePickCarWorker(Long pickCarId,Long workerId); - IPage getPickCarList(Page page,Long partnerId, String phoneNum,String pickStatus); - InspectionPickCar getPickCarDetail(Long dataId); - IPage getPickCarListOfWorker(Page page,Long workerId, String phoneNum); - JSONObject vehicleLicenseOCR(String imagePath) throws Exception; - void offlineCharging(InspectionInfoVo infoVo); - String workOrderView(Long inspectionId); - List inspectionPostInfo(); - Map staticsTable1(Long partnerId, String startTime, String endTime); - Map newStaticsTable1(String startTime, String endTime); - Map staticsTable2(Long partnerId, String startTime, String endTime); - Map newStaticsTable2(String startTime, String endTime); - List> staticsTable3(Long partnerId, String startTime, String endTime); - List> newStaticsTable3(String startTime, String endTime); - List> staticsTable3Detail(Long partnerId, String startTime, String endTime,String remark); + JSONObject chartInfoAmount(Long partnerId, String unit); - List> staticsTable4(Long partnerId, String startTime, String endTime); - List> staticsTable5(Long partnerId, String startTime, String endTime); + JSONObject newChartInfoAmount(String unit); + + JSONObject chartLineInspectionNum(Long partnerId, String unit); + + JSONObject newChartLineInspectionNum(String unit); + + JSONObject chartLineInspectionAmount(Long partnerId, String unit); + + JSONObject chartInfoNum(Long partnerId, String unit); + + JSONObject newChartInfoNum(String unit); + + JSONObject chartInfoRatio(Long partnerId, String unit); + + JSONObject newChartInfoRatio(String unit); + + List orderInfo(Long partnerId); + + List hotGoodsList(Long partnerId); + + List newHotGoodsList(); + + void addGoods(ShopInspectionGoods goods) throws Exception; + + IPage goodsList(Page page, Long partnerId, String isListing, String goodsTitle); + + List canUseGoods(Long partnerId); + + ShopInspectionGoods goodsDetail(Long goodsId); + + void editGoods(ShopInspectionGoods goods) throws Exception; + + void editSkuPrice(ShopInspectionGoods goods) throws Exception; + + void changeListing(Long goodsId) throws Exception; + + void delGoods(Long goodsId) throws Exception; + + void editPartnerInfo(ShopMallPartners partners); + + PartnerVo getPartnerInfo(Long partnerId); + + PartnerBalance accountInfo(Long partnerId); + + IPage accountDetail(Page page, Long partnerId, Integer pageNum, Integer pageSize); + + IPage orderList(Page page, Long partnerId, String phoneNum, String title); + + OrderAppDetail orderDetail(Long partnerId, Long orderId); + + Long orderDetailByCode(Long partnerId, String code) throws Exception; + + void takeOut(Long partnerId, Long orderId, Long workId, String carNum) throws Exception; + + void addWorker(Long partnerId, String realName, String phoneNum, Long postId) throws Exception; + + List getWorkList(Long partnerId, Long postId, String workName, String phoneNum); + + IPage pageWorkList(Long partnerId, Long postId, String workName, String phoneNum, Page page); + + void delWorker(Long partnerId, Long workId); + + IPage inspectionList(Page page, Long partnerId, String status, String carNum); + + InspectionInfoVo inspectionDetail(Long inspectionInfoId); + + List workerInspectionList(Long partnerId, String status, String searchValue); + + void addStepInfo(InspectionStepInfo stepInfo); + + void stopInspection(InspectionInfo info) throws Exception; + + void makeCertOk(Long inspectionId); + + IPage getAppointmentList(Page page, Long partnerId, String phoneNum); + + IPage validationList(Page page, Long partnerId, String searchValue); + + void sendCoupon(ShopCouponTemplate template) throws Exception; + + IPage listCoupon(Page page, Long partnerId, String searchValue); + + void delCoupon(Long partnerId, Long id); + + void designatePickCarWorker(Long pickCarId, Long workerId); + + IPage getPickCarList(Page page, Long partnerId, String phoneNum, String pickStatus); + + InspectionPickCar getPickCarDetail(Long dataId); + + IPage getPickCarListOfWorker(Page page, Long workerId, String phoneNum); + + JSONObject vehicleLicenseOCR(String imagePath) throws Exception; + + void offlineCharging(InspectionInfoVo infoVo); + + String workOrderView(Long inspectionId); + + List inspectionPostInfo(); + + Map staticsTable1(Long partnerId, String startTime, String endTime); + + Map newStaticsTable1(String startTime, String endTime); + + Map staticsTable2(Long partnerId, String startTime, String endTime); + + Map newStaticsTable2(String startTime, String endTime); + + List> staticsTable3(Long partnerId, String startTime, String endTime); + + List> newStaticsTable3(String startTime, String endTime); + + List> staticsTable3Detail(Long partnerId, String startTime, String endTime, String remark); + + List> staticsTable4(Long partnerId, String startTime, String endTime); + + List> staticsTable5(Long partnerId, String startTime, String endTime); - //新检测金额折线图 - JSONObject newChartLineInspectionAmount(String unit); + //新检测金额折线图 + JSONObject newChartLineInspectionAmount(String unit); - /** - * 根据inspection_info的id查有的项目名称 - * - * @author 小李 - * @date 14:52 2024/12/10 - * @param ids inspection_info的id - **/ - Map getProjectByIds(Long[] ids); + /** + * 根据inspection_info的id查有的项目名称 + * + * @param ids inspection_info的id + * @author 小李 + * @date 14:52 2024/12/10 + **/ + Map getProjectByIds(Long[] ids); - /** - * 根据时间查订单 - * - * @author 小李 - * @date 14:39 2024/12/12 - * @param startTime 开始时间 非必传 - * @param endTime 结束时间 非必传 - **/ - IPage getOrderByDate(String startTime, String endTime, String chooseStatus, Page page); + /** + * 根据时间查订单 + * + * @param startTime 开始时间 非必传 + * @param endTime 结束时间 非必传 + * @author 小李 + * @date 14:39 2024/12/12 + **/ + IPage getOrderByDate(String startTime, String endTime, String chooseStatus, Page page); - /** - * 分类计数 - * - * @author 小李 - * @date 17:14 2024/12/16 - * @param startTime 开始时间 - * @param endTime 结束时间 - * @param chooseStatus 状态 - **/ - Map getTypeCount(String startTime, String endTime, String chooseStatus); + /** + * 分类计数 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @param chooseStatus 状态 + * @author 小李 + * @date 17:14 2024/12/16 + **/ + Map getTypeCount(String startTime, String endTime, String chooseStatus); + + /** + * 查询检测类型统计 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 结果 + */ + List> queryInspectionSkuList(String startTime, String endTime); + + /** + * 查询员工统计 + * + * @param dlInspectionProject 项目信息 + * @return 结果 + */ + List> getStaffCount(DlInspectionProject dlInspectionProject); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/DlInspectionProjectService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/DlInspectionProjectService.java index 68f0b792..0d6db9c6 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/DlInspectionProjectService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/DlInspectionProjectService.java @@ -4,10 +4,13 @@ import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject; import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectPageReqVO; import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectRespVO; import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectSaveReqVO; +import cn.iocoder.yudao.module.inspection.vo.InspectionOrderExportVo; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; +import org.apache.ibatis.annotations.Param; import javax.validation.Valid; +import java.util.List; /** * 检测项目 Service 接口 @@ -33,6 +36,7 @@ public interface DlInspectionProjectService extends IService getDlInspectionProjectPage(IPage page, DlInspectionProjectPageReqVO pageReqVO); + /** + * 查询项目对应的检测员名称 + * + * @param orderIds 订单id集合 + * @return + */ + List queryProjectWorkerName(List orderIds); } \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionEquInfoService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionEquInfoService.java index e8d157b7..0fec0564 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionEquInfoService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionEquInfoService.java @@ -1,7 +1,9 @@ package cn.iocoder.yudao.module.inspection.service; import java.util.List; +import java.util.Map; +import cn.iocoder.yudao.module.inspection.vo.InspectionEqInfoImportVo; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; @@ -13,8 +15,7 @@ import cn.iocoder.yudao.module.inspection.entity.InspectionEquInfo; * @author zcy * @date 2023-10-13 */ -public interface IInspectionEquInfoService extends IService -{ +public interface IInspectionEquInfoService extends IService { /** * 查询equInfo * @@ -29,7 +30,7 @@ public interface IInspectionEquInfoService extends IService * @param inspectionEquInfo equInfo * @return equInfo集合 */ - public IPage selectInspectionEquInfoList(Page page,InspectionEquInfo inspectionEquInfo); + public IPage selectInspectionEquInfoList(Page page, InspectionEquInfo inspectionEquInfo); /** * 新增equInfo @@ -62,4 +63,12 @@ public interface IInspectionEquInfoService extends IService * @return 结果 */ public int deleteInspectionEquInfoById(Long id); + + /** + * 导入设备信息 + * + * @param list 设备信息集合 + * @return 结果 + */ + Map importStaff(List list); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java index 526ee66e..b6e416d6 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.inspection.service; +import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject; import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; @@ -18,6 +19,7 @@ import java.util.Map; public interface IInspectionWorkNodeService extends IService { /** * 员工接单 + * * @param inspectionId * @param workNodeId */ @@ -25,6 +27,7 @@ public interface IInspectionWorkNodeService extends IService /** * 员工取消接单 + * * @param inspectionId * @param workNodeId */ @@ -32,12 +35,14 @@ public interface IInspectionWorkNodeService extends IService /** * 更新流程图片 步骤信息 + * * @param inspectionWorkNode */ void updateImageAndStep(InspectionWorkNode inspectionWorkNode); /** * 根据检测id获取流程信息 + * * @param inspectionId * @return */ @@ -47,6 +52,7 @@ public interface IInspectionWorkNodeService extends IService /** * 分页查询提成 + * * @param page * @param inspectionWorkNode * @return @@ -57,7 +63,16 @@ public interface IInspectionWorkNodeService extends IService /** * 重新检测 + * * @param workNodes */ void recheck(InspectionWorkNode workNodes); + + /** + * 获取员工统计排序 + * + * @param dlInspectionProject + * @return + */ + List> getStaffCount(DlInspectionProject dlInspectionProject); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java index 301acfc2..d537c990 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java @@ -74,7 +74,7 @@ import java.util.*; import java.util.stream.Collectors; @Service("appInspectionPartnerService") -public class AppInspectionPartnerServiceImpl extends ServiceImpl implements AppInspectionPartnerService { +public class AppInspectionPartnerServiceImpl extends ServiceImpl implements AppInspectionPartnerService { @Autowired private AppInspectionOrderService orderService; @Autowired @@ -102,7 +102,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl partnerList(Page page, PartnerListQuery partnerListQuery) { - if (null!=partnerListQuery.getDistance()){ - partnerListQuery.setDistance(partnerListQuery.getDistance()*1000); + if (null != partnerListQuery.getDistance()) { + partnerListQuery.setDistance(partnerListQuery.getDistance() * 1000); } - IPage partnerListVos = baseMapper.partnerList(page,partnerListQuery); + IPage partnerListVos = baseMapper.partnerList(page, partnerListQuery); return partnerListVos; } @@ -149,8 +149,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl shopInspectionCategories = baseMapper.partnerCategoryList(partnerId); for (ShopInspectionCategory shopInspectionCategory : shopInspectionCategories) { - LambdaQueryWrapper templateLambdaQueryWrapper =new LambdaQueryWrapper<>(); - templateLambdaQueryWrapper.eq(InspectionCategoryTemplate::getCategoryId,shopInspectionCategory.getId()).orderByAsc(InspectionCategoryTemplate::getSkuPrice); + LambdaQueryWrapper templateLambdaQueryWrapper = new LambdaQueryWrapper<>(); + templateLambdaQueryWrapper.eq(InspectionCategoryTemplate::getCategoryId, shopInspectionCategory.getId()).orderByAsc(InspectionCategoryTemplate::getSkuPrice); List list = categoryTemplateService.list(templateLambdaQueryWrapper); shopInspectionCategory.setTemplates(list); } @@ -160,10 +160,10 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl()); } return partnerListVo; @@ -182,21 +182,21 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl roleList = roleService.getRoleList(userRoleIdListByUserId); List roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList()); - ShopMallPartners partner = new ShopMallPartners(); - if (roles.contains("jcshop")){ - LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType,"jc").eq(ShopMallPartners::getIsBanned,"0").last("limit 1"); + ShopMallPartners partner = new ShopMallPartners(); + if (roles.contains("jcshop")) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType, "jc").eq(ShopMallPartners::getIsBanned, "0").last("limit 1"); partner = this.getOne(queryWrapper); - if (ObjectUtil.isEmpty(partner)){ + if (ObjectUtil.isEmpty(partner)) { throw new Exception("信息有误"); } - }else if (roles.contains("jcworker")){ - LambdaQueryWrapper queryWrapperWork =new LambdaQueryWrapper<>(); - queryWrapperWork.eq(PartnerWorker::getUserId,user.getId()); + } else if (roles.contains("jcworker")) { + LambdaQueryWrapper queryWrapperWork = new LambdaQueryWrapper<>(); + queryWrapperWork.eq(PartnerWorker::getUserId, user.getId()); queryWrapperWork.orderByAsc(PartnerWorker::getPartnerId); queryWrapperWork.last("limit 1"); PartnerWorker worker = partnerWorkerService.getOne(queryWrapperWork); - if (ObjectUtil.isEmpty(worker)){ + if (ObjectUtil.isEmpty(worker)) { throw new Exception("信息有误"); } partner.setPartnerId(worker.getPartnerId()); @@ -206,39 +206,37 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).last("limit 1"); ShopMallPartners partner = this.getOne(queryWrapper); - if (ObjectUtil.isEmpty(partner)){ + if (ObjectUtil.isEmpty(partner)) { throw new Exception("未查询到信息"); } return partner; } - @Override public JSONObject getAppointAndPickNum() throws Exception { ShopMallPartners shopMallPartners = this.shopInfo(); - String formDate = DateUtil.format(new Date(),"yyyy-MM-dd"); - Long appointNum = baseMapper.getAppointNum(shopMallPartners.getPartnerId(),formDate); - Long pickNum = baseMapper.getPickNum(shopMallPartners.getPartnerId(),formDate); - JSONObject res =new JSONObject(); - res.put("appointNum",appointNum); - res.put("pickNum",pickNum); + String formDate = DateUtil.format(new Date(), "yyyy-MM-dd"); + Long appointNum = baseMapper.getAppointNum(shopMallPartners.getPartnerId(), formDate); + Long pickNum = baseMapper.getPickNum(shopMallPartners.getPartnerId(), formDate); + JSONObject res = new JSONObject(); + res.put("appointNum", appointNum); + res.put("pickNum", pickNum); return res; } @Override public void startOrEnd(Long partnerId) { ShopMallPartners partners = baseMapper.selectById(partnerId); - if (StringUtils.isEmpty(partners.getIsWorking())||partners.getIsWorking().equals("0")){ + if (StringUtils.isEmpty(partners.getIsWorking()) || partners.getIsWorking().equals("0")) { partners.setIsWorking("1"); - }else { + } else { partners.setIsWorking("0"); } baseMapper.updateById(partners); @@ -247,7 +245,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl categories =new ArrayList<>(); - List series =new ArrayList<>(); - JSONObject seriesObject=new JSONObject(); - seriesObject.put("name","金额"); - List seriesObjectData =new ArrayList<>(); + JSONObject res = new JSONObject(); + List categories = new ArrayList<>(); + List series = new ArrayList<>(); + JSONObject seriesObject = new JSONObject(); + seriesObject.put("name", "金额"); + List seriesObjectData = new ArrayList<>(); //按照单位日期查询数据 //横坐标获取当前商品上架的商品 String startTime = null; String endTime = null; - if (unit.equals("day")){ + if (unit.equals("day")) { String format = DateUtil.format(new Date(), "yyyy-MM-dd"); - startTime = format+" 00:00:00"; - endTime = format+" 23:59:59"; - } else if (unit.equals("week")){ + startTime = format + " 00:00:00"; + endTime = format + " 23:59:59"; + } else if (unit.equals("week")) { // 获取当前日期 LocalDate currentDate = LocalDate.now(); @@ -289,8 +287,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper1 =new LambdaQueryWrapper<>(); - queryWrapper1.eq(ShopInspectionGoods::getPartnerId,partnerId); + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ShopInspectionGoods::getPartnerId, partnerId); List list1 = goodsService.list(queryWrapper1); - List list = baseMapper.chartInfoAmount(startTime,endTime,partnerId); + List list = baseMapper.chartInfoAmount(startTime, endTime, partnerId); //统计各个车型的价格 从高到低 for (OrderInfo orderInfo : list) { - categories.add(orderInfo.getGoodsTitle().indexOf("(")>0?orderInfo.getGoodsTitle().substring(0,orderInfo.getGoodsTitle().indexOf("(")):orderInfo.getGoodsTitle()); - list1.removeIf(it->{ - return it.getTitle().equals(orderInfo.getGoodsTitle()); + categories.add(orderInfo.getGoodsTitle().indexOf("(") > 0 ? orderInfo.getGoodsTitle().substring(0, orderInfo.getGoodsTitle().indexOf("(")) : orderInfo.getGoodsTitle()); + list1.removeIf(it -> { + return it.getTitle().equals(orderInfo.getGoodsTitle()); }); - seriesObjectData.add(Double.valueOf(orderInfo.getRealPayMoney())/100); + seriesObjectData.add(Double.valueOf(orderInfo.getRealPayMoney()) / 100); } - categories.addAll(list1.stream().map(it->{ - return it.getTitle().indexOf("(")>0?it.getTitle().substring(0,it.getTitle().indexOf("(")):it.getTitle(); + categories.addAll(list1.stream().map(it -> { + return it.getTitle().indexOf("(") > 0 ? it.getTitle().substring(0, it.getTitle().indexOf("(")) : it.getTitle(); }).collect(Collectors.toList())); - seriesObjectData.addAll(list1.stream().map(it->{ + seriesObjectData.addAll(list1.stream().map(it -> { return 0d; }).collect(Collectors.toList())); - seriesObject.put("data",seriesObjectData); + seriesObject.put("data", seriesObjectData); series.add(seriesObject); - res.put("categories",categories); - res.put("series",series); + res.put("categories", categories); + res.put("series", series); return res; } + @Override public JSONObject newChartInfoAmount(String unit) { - JSONObject res =new JSONObject(); - List categories =new ArrayList<>(); - List series =new ArrayList<>(); - JSONObject seriesObject=new JSONObject(); - seriesObject.put("name","金额"); - List seriesObjectData =new ArrayList<>(); + JSONObject res = new JSONObject(); + List categories = new ArrayList<>(); + List series = new ArrayList<>(); + JSONObject seriesObject = new JSONObject(); + seriesObject.put("name", "金额"); + List seriesObjectData = new ArrayList<>(); //按照单位日期查询数据 //横坐标获取当前商品上架的商品 String startTime = null; String endTime = null; - if (unit.equals("day")){ + if (unit.equals("day")) { String format = DateUtil.format(new Date(), "yyyy-MM-dd"); - startTime = format+" 00:00:00"; - endTime = format+" 23:59:59"; - } else if (unit.equals("week")){ + startTime = format + " 00:00:00"; + endTime = format + " 23:59:59"; + } else if (unit.equals("week")) { // 获取当前日期 LocalDate currentDate = LocalDate.now(); @@ -377,8 +376,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper1 =new LambdaQueryWrapper<>(); + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); // queryWrapper1.eq(ShopInspectionGoods::getPartnerId,partnerId); List list1 = goodsService.list(queryWrapper1); - List list = baseMapper.newChartInfoAmount(startTime,endTime); + List list = baseMapper.newChartInfoAmount(startTime, endTime); //统计各个车型的价格 从高到低 for (OrderInfo orderInfo : list) { - categories.add(orderInfo.getGoodsTitle().indexOf("(")>0?orderInfo.getGoodsTitle().substring(0,orderInfo.getGoodsTitle().indexOf("(")):orderInfo.getGoodsTitle()); - list1.removeIf(it->{ - return it.getTitle().equals(orderInfo.getGoodsTitle()); + categories.add(orderInfo.getGoodsTitle().indexOf("(") > 0 ? orderInfo.getGoodsTitle().substring(0, orderInfo.getGoodsTitle().indexOf("(")) : orderInfo.getGoodsTitle()); + list1.removeIf(it -> { + return it.getTitle().equals(orderInfo.getGoodsTitle()); }); - seriesObjectData.add(Double.valueOf(orderInfo.getRealPayMoney())/100); + seriesObjectData.add(Double.valueOf(orderInfo.getRealPayMoney()) / 100); } - categories.addAll(list1.stream().map(it->{ - return it.getTitle().indexOf("(")>0?it.getTitle().substring(0,it.getTitle().indexOf("(")):it.getTitle(); + categories.addAll(list1.stream().map(it -> { + return it.getTitle().indexOf("(") > 0 ? it.getTitle().substring(0, it.getTitle().indexOf("(")) : it.getTitle(); }).collect(Collectors.toList())); - seriesObjectData.addAll(list1.stream().map(it->{ + seriesObjectData.addAll(list1.stream().map(it -> { return 0d; }).collect(Collectors.toList())); - seriesObject.put("data",seriesObjectData); + seriesObject.put("data", seriesObjectData); series.add(seriesObject); - res.put("categories",categories); - res.put("series",series); + res.put("categories", categories); + res.put("series", series); return res; } @@ -446,14 +445,14 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl categories =new ArrayList<>(); - List series =new ArrayList<>(); - JSONObject seriesData1 =new JSONObject(); - seriesData1.put("name","总数量"); - List seriesData1List =new ArrayList<>(); - JSONObject seriesData2 =new JSONObject(); - List seriesData2List =new ArrayList<>(); - seriesData2.put("name","合格数"); + List categories = new ArrayList<>(); + List series = new ArrayList<>(); + JSONObject seriesData1 = new JSONObject(); + seriesData1.put("name", "总数量"); + List seriesData1List = new ArrayList<>(); + JSONObject seriesData2 = new JSONObject(); + List seriesData2List = new ArrayList<>(); + seriesData2.put("name", "合格数"); // JSONObject seriesData3 =new JSONObject(); // List seriesData3List =new ArrayList<>(); // seriesData3.put("name","环检次数"); @@ -467,39 +466,40 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper1 =new LambdaQueryWrapper<>(); - queryWrapper1.eq(InspectionInfo::getPartnerId,partnerId).like(InspectionInfo::getStartTime,date); + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(InspectionInfo::getPartnerId, partnerId).like(InspectionInfo::getStartTime, date); Long sum = inspectionInfoService.count(queryWrapper1); - LambdaQueryWrapper queryWrapper2 =new LambdaQueryWrapper<>(); - queryWrapper2.eq(InspectionInfo::getPartnerId,partnerId).like(InspectionInfo::getStartTime,date).eq(InspectionInfo::getIsPass,"1"); + LambdaQueryWrapper queryWrapper2 = new LambdaQueryWrapper<>(); + queryWrapper2.eq(InspectionInfo::getPartnerId, partnerId).like(InspectionInfo::getStartTime, date).eq(InspectionInfo::getIsPass, "1"); Long passNum = inspectionInfoService.count(queryWrapper2); - // Long noPassNum = baseMapper.dhjNum(partnerId,date); + // Long noPassNum = baseMapper.dhjNum(partnerId,date); seriesData1List.add(sum); seriesData2List.add(passNum); // seriesData3List.add(noPassNum); } - seriesData1.put("data",seriesData1List); - seriesData2.put("data",seriesData2List); - // seriesData3.put("data",seriesData3List); + seriesData1.put("data", seriesData1List); + seriesData2.put("data", seriesData2List); + // seriesData3.put("data",seriesData3List); series.add(seriesData1); series.add(seriesData2); //series.add(seriesData3); - res.put("categories",categories); - res.put("series",series); + res.put("categories", categories); + res.put("series", series); return res; } + @Override public JSONObject newChartLineInspectionNum(String unit) { JSONObject res = new JSONObject(); - List categories =new ArrayList<>(); - List series =new ArrayList<>(); - JSONObject seriesData1 =new JSONObject(); - seriesData1.put("name","总数量"); - List seriesData1List =new ArrayList<>(); - JSONObject seriesData2 =new JSONObject(); - List seriesData2List =new ArrayList<>(); - seriesData2.put("name","合格数"); + List categories = new ArrayList<>(); + List series = new ArrayList<>(); + JSONObject seriesData1 = new JSONObject(); + seriesData1.put("name", "总数量"); + List seriesData1List = new ArrayList<>(); + JSONObject seriesData2 = new JSONObject(); + List seriesData2List = new ArrayList<>(); + seriesData2.put("name", "合格数"); // JSONObject seriesData3 =new JSONObject(); // List seriesData3List =new ArrayList<>(); // seriesData3.put("name","环检次数"); @@ -513,26 +513,26 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper1 =new LambdaQueryWrapper<>(); - queryWrapper1.like(InspectionInfo::getStartTime,date); + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.like(InspectionInfo::getStartTime, date); Long sum = inspectionInfoService.count(queryWrapper1); - LambdaQueryWrapper queryWrapper2 =new LambdaQueryWrapper<>(); - queryWrapper2.like(InspectionInfo::getStartTime,date).eq(InspectionInfo::getIsPass,"1"); + LambdaQueryWrapper queryWrapper2 = new LambdaQueryWrapper<>(); + queryWrapper2.like(InspectionInfo::getStartTime, date).eq(InspectionInfo::getIsPass, "1"); Long passNum = inspectionInfoService.count(queryWrapper2); - // Long noPassNum = baseMapper.dhjNum(partnerId,date); + // Long noPassNum = baseMapper.dhjNum(partnerId,date); seriesData1List.add(sum); seriesData2List.add(passNum); // seriesData3List.add(noPassNum); } - seriesData1.put("data",seriesData1List); - seriesData2.put("data",seriesData2List); - // seriesData3.put("data",seriesData3List); + seriesData1.put("data", seriesData1List); + seriesData2.put("data", seriesData2List); + // seriesData3.put("data",seriesData3List); series.add(seriesData1); series.add(seriesData2); //series.add(seriesData3); - res.put("categories",categories); - res.put("series",series); + res.put("categories", categories); + res.put("series", series); return res; } @@ -544,11 +544,11 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl categories =new ArrayList<>(); - List series =new ArrayList<>(); - JSONObject seriesData1 =new JSONObject(); - seriesData1.put("name","成交金额"); - List seriesData1List =new ArrayList<>(); + List categories = new ArrayList<>(); + List series = new ArrayList<>(); + JSONObject seriesData1 = new JSONObject(); + seriesData1.put("name", "成交金额"); + List seriesData1List = new ArrayList<>(); List dateList = new ArrayList<>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); for (int i = 0; i < 7; i++) { @@ -559,14 +559,14 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl categories =new ArrayList<>(); - List series =new ArrayList<>(); - JSONObject seriesData1 =new JSONObject(); - seriesData1.put("name","成交金额"); - List seriesData1List =new ArrayList<>(); + List categories = new ArrayList<>(); + List series = new ArrayList<>(); + JSONObject seriesData1 = new JSONObject(); + seriesData1.put("name", "成交金额"); + List seriesData1List = new ArrayList<>(); List dateList = new ArrayList<>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); for (int i = 0; i < 7; i++) { @@ -591,38 +591,38 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl categories =new ArrayList<>(); - List series =new ArrayList<>(); - JSONObject seriesObject=new JSONObject(); - seriesObject.put("name","数量"); - List seriesObjectData =new ArrayList<>(); + JSONObject res = new JSONObject(); + List categories = new ArrayList<>(); + List series = new ArrayList<>(); + JSONObject seriesObject = new JSONObject(); + seriesObject.put("name", "数量"); + List seriesObjectData = new ArrayList<>(); //按照单位日期查询数据 //横坐标获取当前商品上架的商品 - String startTime ; - String endTime ; - if (unit.equals("day")){ + String startTime; + String endTime; + if (unit.equals("day")) { String format = DateUtil.format(new Date(), "yyyy-MM-dd"); - startTime = format+" 00:00:00"; - endTime = format+" 23:59:59"; - } else if (unit.equals("week")){ + startTime = format + " 00:00:00"; + endTime = format + " 23:59:59"; + } else if (unit.equals("week")) { // 获取当前日期 LocalDate currentDate = LocalDate.now(); @@ -634,8 +634,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper1 =new LambdaQueryWrapper<>(); - queryWrapper1.eq(ShopInspectionGoods::getPartnerId,partnerId); + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ShopInspectionGoods::getPartnerId, partnerId); List list1 = goodsService.list(queryWrapper1); - List list = baseMapper.chartInfoNum(startTime,endTime,partnerId); + List list = baseMapper.chartInfoNum(startTime, endTime, partnerId); //统计各个车型的价格 从高到低 for (OrderInfo orderInfo : list) { - categories.add(orderInfo.getGoodsTitle().indexOf("(")>0?orderInfo.getGoodsTitle().substring(0,orderInfo.getGoodsTitle().indexOf("(")):orderInfo.getGoodsTitle()); - list1.removeIf(it->{ + categories.add(orderInfo.getGoodsTitle().indexOf("(") > 0 ? orderInfo.getGoodsTitle().substring(0, orderInfo.getGoodsTitle().indexOf("(")) : orderInfo.getGoodsTitle()); + list1.removeIf(it -> { return it.getTitle().equals(orderInfo.getGoodsTitle()); }); seriesObjectData.add(orderInfo.getRealPayNum()); } - categories.addAll(list1.stream().map(it->{ - return it.getTitle().indexOf("(")>0?it.getTitle().substring(0,it.getTitle().indexOf("(")):it.getTitle(); + categories.addAll(list1.stream().map(it -> { + return it.getTitle().indexOf("(") > 0 ? it.getTitle().substring(0, it.getTitle().indexOf("(")) : it.getTitle(); }).collect(Collectors.toList())); - seriesObjectData.addAll(list1.stream().map(it->{ + seriesObjectData.addAll(list1.stream().map(it -> { return 0; }).collect(Collectors.toList())); - seriesObject.put("data",seriesObjectData); + seriesObject.put("data", seriesObjectData); series.add(seriesObject); - res.put("categories",categories); - res.put("series",series); + res.put("categories", categories); + res.put("series", series); return res; } + @Override public JSONObject newChartInfoNum(String unit) { - JSONObject res =new JSONObject(); - List categories =new ArrayList<>(); - List series =new ArrayList<>(); - JSONObject seriesObject=new JSONObject(); - seriesObject.put("name","数量"); - List seriesObjectData =new ArrayList<>(); + JSONObject res = new JSONObject(); + List categories = new ArrayList<>(); + List series = new ArrayList<>(); + JSONObject seriesObject = new JSONObject(); + seriesObject.put("name", "数量"); + List seriesObjectData = new ArrayList<>(); //按照单位日期查询数据 //横坐标获取当前商品上架的商品 - String startTime ; - String endTime ; - if (unit.equals("day")){ + String startTime; + String endTime; + if (unit.equals("day")) { String format = DateUtil.format(new Date(), "yyyy-MM-dd"); - startTime = format+" 00:00:00"; - endTime = format+" 23:59:59"; - } else if (unit.equals("week")){ + startTime = format + " 00:00:00"; + endTime = format + " 23:59:59"; + } else if (unit.equals("week")) { // 获取当前日期 LocalDate currentDate = LocalDate.now(); @@ -722,8 +723,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper1 =new LambdaQueryWrapper<>(); + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); List list1 = goodsService.list(queryWrapper1); - List list = baseMapper.newChartInfoNum(startTime,endTime); + List list = baseMapper.newChartInfoNum(startTime, endTime); //统计各个车型的价格 从高到低 for (OrderInfo orderInfo : list) { - categories.add(orderInfo.getGoodsTitle().indexOf("(")>0?orderInfo.getGoodsTitle().substring(0,orderInfo.getGoodsTitle().indexOf("(")):orderInfo.getGoodsTitle()); - list1.removeIf(it->{ + categories.add(orderInfo.getGoodsTitle().indexOf("(") > 0 ? orderInfo.getGoodsTitle().substring(0, orderInfo.getGoodsTitle().indexOf("(")) : orderInfo.getGoodsTitle()); + list1.removeIf(it -> { return it.getTitle().equals(orderInfo.getGoodsTitle()); }); seriesObjectData.add(orderInfo.getRealPayNum()); } - categories.addAll(list1.stream().map(it->{ - return it.getTitle().indexOf("(")>0?it.getTitle().substring(0,it.getTitle().indexOf("(")):it.getTitle(); + categories.addAll(list1.stream().map(it -> { + return it.getTitle().indexOf("(") > 0 ? it.getTitle().substring(0, it.getTitle().indexOf("(")) : it.getTitle(); }).collect(Collectors.toList())); - seriesObjectData.addAll(list1.stream().map(it->{ + seriesObjectData.addAll(list1.stream().map(it -> { return 0; }).collect(Collectors.toList())); - seriesObject.put("data",seriesObjectData); + seriesObject.put("data", seriesObjectData); series.add(seriesObject); - res.put("categories",categories); - res.put("series",series); + res.put("categories", categories); + res.put("series", series); return res; } @@ -789,21 +790,21 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl categories =new ArrayList<>(); - List series =new ArrayList<>(); - JSONObject seriesObject=new JSONObject(); - seriesObject.put("name","合格率"); - List seriesObjectData =new ArrayList<>(); + JSONObject res = new JSONObject(); + List categories = new ArrayList<>(); + List series = new ArrayList<>(); + JSONObject seriesObject = new JSONObject(); + seriesObject.put("name", "合格率"); + List seriesObjectData = new ArrayList<>(); //按照单位日期查询数据 //横坐标获取当前商品上架的商品 - String startTime ; - String endTime ; - if (unit.equals("day")){ + String startTime; + String endTime; + if (unit.equals("day")) { String format = DateUtil.format(new Date(), "yyyy-MM-dd"); - startTime = format+" 00:00:00"; - endTime = format+" 23:59:59"; - } else if (unit.equals("week")){ + startTime = format + " 00:00:00"; + endTime = format + " 23:59:59"; + } else if (unit.equals("week")) { // 获取当前日期 LocalDate currentDate = LocalDate.now(); @@ -815,8 +816,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper1 =new LambdaQueryWrapper<>(); - queryWrapper1.eq(ShopInspectionGoods::getPartnerId,partnerId); + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ShopInspectionGoods::getPartnerId, partnerId); List list1 = goodsService.list(queryWrapper1); - List> list = baseMapper.chartInfoRatio(startTime,endTime,partnerId); + List> list = baseMapper.chartInfoRatio(startTime, endTime, partnerId); //统计各个车型的价格 从高到低 - for (Map orderInfo : list) { - categories.add(orderInfo.get("goodsTitle").indexOf("(")>0?orderInfo.get("goodsTitle").substring(0,orderInfo.get("goodsTitle").indexOf("(")):orderInfo.get("goodsTitle")); - list1.removeIf(it->{ + for (Map orderInfo : list) { + categories.add(orderInfo.get("goodsTitle").indexOf("(") > 0 ? orderInfo.get("goodsTitle").substring(0, orderInfo.get("goodsTitle").indexOf("(")) : orderInfo.get("goodsTitle")); + list1.removeIf(it -> { return it.getTitle().equals(orderInfo.get("goodsTitle")); }); - if (ObjectUtil.isEmpty(orderInfo.get("passRatio"))){ + if (ObjectUtil.isEmpty(orderInfo.get("passRatio"))) { seriesObjectData.add(0d); - }else { + } else { seriesObjectData.add(Double.valueOf(String.valueOf(orderInfo.get("passRatio")))); } } - categories.addAll(list1.stream().map(it->{ - return it.getTitle().indexOf("(")>0?it.getTitle().substring(0,it.getTitle().indexOf("(")):it.getTitle(); + categories.addAll(list1.stream().map(it -> { + return it.getTitle().indexOf("(") > 0 ? it.getTitle().substring(0, it.getTitle().indexOf("(")) : it.getTitle(); }).collect(Collectors.toList())); - seriesObjectData.addAll(list1.stream().map(it->{ + seriesObjectData.addAll(list1.stream().map(it -> { return 0d; }).collect(Collectors.toList())); - seriesObject.put("data",seriesObjectData); + seriesObject.put("data", seriesObjectData); series.add(seriesObject); - res.put("categories",categories); - res.put("series",series); + res.put("categories", categories); + res.put("series", series); return res; } + @Override public JSONObject newChartInfoRatio(String unit) { - JSONObject res =new JSONObject(); - List categories =new ArrayList<>(); - List series =new ArrayList<>(); - JSONObject seriesObject=new JSONObject(); - seriesObject.put("name","合格率"); - List seriesObjectData =new ArrayList<>(); + JSONObject res = new JSONObject(); + List categories = new ArrayList<>(); + List series = new ArrayList<>(); + JSONObject seriesObject = new JSONObject(); + seriesObject.put("name", "合格率"); + List seriesObjectData = new ArrayList<>(); //按照单位日期查询数据 //横坐标获取当前商品上架的商品 - String startTime ; - String endTime ; - if (unit.equals("day")){ + String startTime; + String endTime; + if (unit.equals("day")) { String format = DateUtil.format(new Date(), "yyyy-MM-dd"); - startTime = format+" 00:00:00"; - endTime = format+" 23:59:59"; - } else if (unit.equals("week")){ + startTime = format + " 00:00:00"; + endTime = format + " 23:59:59"; + } else if (unit.equals("week")) { // 获取当前日期 LocalDate currentDate = LocalDate.now(); @@ -908,8 +910,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper1 =new LambdaQueryWrapper<>(); + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); List list1 = goodsService.list(queryWrapper1); - List> list = baseMapper.newChartInfoRatio(startTime,endTime); + List> list = baseMapper.newChartInfoRatio(startTime, endTime); //统计各个车型的价格 从高到低 - for (Map orderInfo : list) { - categories.add(orderInfo.get("goodsTitle").indexOf("(")>0?orderInfo.get("goodsTitle").substring(0,orderInfo.get("goodsTitle").indexOf("(")):orderInfo.get("goodsTitle")); - list1.removeIf(it->{ + for (Map orderInfo : list) { + categories.add(orderInfo.get("goodsTitle").indexOf("(") > 0 ? orderInfo.get("goodsTitle").substring(0, orderInfo.get("goodsTitle").indexOf("(")) : orderInfo.get("goodsTitle")); + list1.removeIf(it -> { return it.getTitle().equals(orderInfo.get("goodsTitle")); }); - if (ObjectUtil.isEmpty(orderInfo.get("passRatio"))){ + if (ObjectUtil.isEmpty(orderInfo.get("passRatio"))) { seriesObjectData.add(0d); - }else { + } else { seriesObjectData.add(Double.valueOf(String.valueOf(orderInfo.get("passRatio")))); } } - categories.addAll(list1.stream().map(it->{ - return it.getTitle().indexOf("(")>0?it.getTitle().substring(0,it.getTitle().indexOf("(")):it.getTitle(); + categories.addAll(list1.stream().map(it -> { + return it.getTitle().indexOf("(") > 0 ? it.getTitle().substring(0, it.getTitle().indexOf("(")) : it.getTitle(); }).collect(Collectors.toList())); - seriesObjectData.addAll(list1.stream().map(it->{ + seriesObjectData.addAll(list1.stream().map(it -> { return 0d; }).collect(Collectors.toList())); - seriesObject.put("data",seriesObjectData); + seriesObject.put("data", seriesObjectData); series.add(seriesObject); - res.put("categories",categories); - res.put("series",series); + res.put("categories", categories); + res.put("series", series); return res; } @@ -980,8 +982,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(OrderInfo::getPartnerId,partnerId).isNotNull(OrderInfo::getValidationTime).orderByDesc(OrderInfo::getValidationTime).last("limit 8"); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(OrderInfo::getPartnerId, partnerId).isNotNull(OrderInfo::getValidationTime).orderByDesc(OrderInfo::getValidationTime).last("limit 8"); List list = orderService.list(queryWrapper); return list; } @@ -994,8 +996,9 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl newHotGoodsList() { String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd"); @@ -1007,35 +1010,35 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(ShopInspectionGoods::getGoodsCategoryId,goods.getGoodsCategoryId()).eq(ShopInspectionGoods::getPartnerId,goods.getPartnerId()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ShopInspectionGoods::getGoodsCategoryId, goods.getGoodsCategoryId()).eq(ShopInspectionGoods::getPartnerId, goods.getPartnerId()); List list = goodsService.list(queryWrapper); - if (CollectionUtil.isNotEmpty(list)){ + if (CollectionUtil.isNotEmpty(list)) { throw new Exception("当前分类已存在商品"); } ShopInspectionCategory category = categoryService.getById(goods.getGoodsCategoryId()); goods.setTitle(category.getCategoryName()); - LambdaQueryWrapper categoryTemplateLambdaQueryWrapper =new LambdaQueryWrapper<>(); - categoryTemplateLambdaQueryWrapper.eq(InspectionCategoryTemplate::getCategoryId,category.getId()); + LambdaQueryWrapper categoryTemplateLambdaQueryWrapper = new LambdaQueryWrapper<>(); + categoryTemplateLambdaQueryWrapper.eq(InspectionCategoryTemplate::getCategoryId, category.getId()); List categoryTemplates = categoryTemplateService.list(categoryTemplateLambdaQueryWrapper); - List skuList = categoryTemplates.stream().sorted((o1,o2)->{ - if(o1.getSkuPrice() skuList = categoryTemplates.stream().sorted((o1, o2) -> { + if (o1.getSkuPrice() < o2.getSkuPrice()) { return 1; - }else if(o1.getSkuPrice().equals(o2.getSkuPrice())){ - if (o1.getSkuName().length(){ - InspectionGoodsSku sku =new InspectionGoodsSku(); + }).map(it -> { + InspectionGoodsSku sku = new InspectionGoodsSku(); sku.setSkuName(it.getSkuName()); sku.setPrice(it.getSkuPrice()); sku.setDbPrice(it.getSkuPrice()); @@ -1046,30 +1049,31 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl goodsList(Page page,Long partnerId, String isListing, String goodsTitle) { - return baseMapper.manageGoodsList(page,partnerId,isListing,goodsTitle); + public IPage goodsList(Page page, Long partnerId, String isListing, String goodsTitle) { + return baseMapper.manageGoodsList(page, partnerId, isListing, goodsTitle); } @Override public List canUseGoods(Long partnerId) { List listGoods = new ArrayList<>(); - LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(ShopInspectionGoods::getPartnerId,partnerId).eq(ShopInspectionGoods::getIsListing,"1").orderByAsc(ShopInspectionGoods::getOrderNum); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ShopInspectionGoods::getPartnerId, partnerId).eq(ShopInspectionGoods::getIsListing, "1").orderByAsc(ShopInspectionGoods::getOrderNum); List list = goodsService.list(queryWrapper); - if (CollectionUtil.isNotEmpty(list)){ + if (CollectionUtil.isNotEmpty(list)) { listGoods = list.stream().map(it -> { JSONObject item = new JSONObject(); item.put("label", it.getTitle()); @@ -1077,7 +1081,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(InspectionGoodsSku::getGoodsId,goodsId); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(InspectionGoodsSku::getGoodsId, goodsId); List list = skuService.list(queryWrapper); goods.setSkuList(list); - if (StringUtils.isNotEmpty(goods.getImages())){ + if (StringUtils.isNotEmpty(goods.getImages())) { goods.setImageList(goods.getImages().split(",")); } ShopInspectionCategory category = categoryService.getById(goods.getGoodsCategoryId()); goods.setCategoryName(category.getCategoryName()); - return goods; + return goods; } @Override @@ -1106,21 +1110,21 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper1 =new LambdaQueryWrapper<>(); - queryWrapper1.eq(ShopInspectionGoods::getGoodsCategoryId,goods.getGoodsCategoryId()) - .eq(ShopInspectionGoods::getPartnerId,goods.getPartnerId()) - .ne(ShopInspectionGoods::getId,goods.getId()); + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ShopInspectionGoods::getGoodsCategoryId, goods.getGoodsCategoryId()) + .eq(ShopInspectionGoods::getPartnerId, goods.getPartnerId()) + .ne(ShopInspectionGoods::getId, goods.getId()); List list = goodsService.list(queryWrapper1); - if (CollectionUtil.isNotEmpty(list)){ + if (CollectionUtil.isNotEmpty(list)) { throw new Exception("当前分类已存在商品"); } ShopInspectionCategory category = categoryService.getById(goods.getGoodsCategoryId()); @@ -1130,38 +1134,40 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(InspectionGoodsSku::getGoodsId,goodsId); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(InspectionGoodsSku::getGoodsId, goodsId); skuService.remove(queryWrapper); } @@ -1192,7 +1198,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl addressList = AddressSplitter.splitAddress(partners.getAddress()); @@ -1206,13 +1212,13 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(PartnerBalance::getPartnerId,partnerId); - return partnerBalanceService.getOne(queryWrapper); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(PartnerBalance::getPartnerId, partnerId); + return partnerBalanceService.getOne(queryWrapper); } @Override - public IPage accountDetail(Page page,Long partnerId, Integer pageNum, Integer pageSize) { + public IPage accountDetail(Page page, Long partnerId, Integer pageNum, Integer pageSize) { LoginUser user = SecurityFrameworkUtils.getLoginUser(); ShopMallPartners partnersTmp = baseMapper.selectById(partnerId); - if (!partnersTmp.getUserId().equals(user.getId())){ + if (!partnersTmp.getUserId().equals(user.getId())) { return null; } - LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(PartnerBalance::getPartnerId,partnerId); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(PartnerBalance::getPartnerId, partnerId); PartnerBalance one = partnerBalanceService.getOne(queryWrapper); - LambdaQueryWrapper queryWrapper1 =new LambdaQueryWrapper<>(); - queryWrapper1.eq(PartnerBalanceDetail::getPartnerBalanceId,one.getId()).orderByDesc(PartnerBalanceDetail::getChangeTime); - return detailService.page(page,queryWrapper1); + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(PartnerBalanceDetail::getPartnerBalanceId, one.getId()).orderByDesc(PartnerBalanceDetail::getChangeTime); + return detailService.page(page, queryWrapper1); } @Override - public IPage orderList(Page page,Long partnerId,String phoneNum, String title) { - return baseMapper.orderList(page,partnerId,phoneNum,title); + public IPage orderList(Page page, Long partnerId, String phoneNum, String title) { + return baseMapper.orderList(page, partnerId, phoneNum, title); } @Override public OrderAppDetail orderDetail(Long partnerId, Long orderId) { LoginUser user = SecurityFrameworkUtils.getLoginUser(); ShopMallPartners partnersTmp = baseMapper.selectById(partnerId); - if (!partnersTmp.getUserId().equals(user.getId())){ + if (!partnersTmp.getUserId().equals(user.getId())) { return null; } OrderInfo orderInfo = orderService.getById(orderId); - if (!orderInfo.getPartnerId().equals(partnerId)){ + if (!orderInfo.getPartnerId().equals(partnerId)) { return null; } ShopInspectionGoods goods = goodsService.getById(orderInfo.getGoodsId()); - OrderAppDetail orderDetail =new OrderAppDetail(); + OrderAppDetail orderDetail = new OrderAppDetail(); orderDetail.setGoodsId(orderInfo.getGoodsId()); - orderDetail.setGoodsTitle(orderInfo.getGoodsTitle()+ (StringUtils.isNotEmpty(orderInfo.getSkuName())?"-"+orderInfo.getSkuName():"")); + orderDetail.setGoodsTitle(orderInfo.getGoodsTitle() + (StringUtils.isNotEmpty(orderInfo.getSkuName()) ? "-" + orderInfo.getSkuName() : "")); orderDetail.setGoodsImage(goods.getImage()); orderDetail.setGoodsPrice(orderInfo.getGoodsPrice()); orderDetail.setPayMoney(orderInfo.getPayMoney()); @@ -1279,7 +1285,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(OrderInfo::getAccessCode,code); + public Long orderDetailByCode(Long partnerId, String code) throws Exception { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(OrderInfo::getAccessCode, code); OrderInfo one = orderService.getOne(queryWrapper); - if (ObjectUtil.isEmpty(one)){ + if (ObjectUtil.isEmpty(one)) { throw new Exception("核销码不存在"); } - return one.getId(); + return one.getId(); } @Override @Transactional(rollbackFor = Exception.class) - public void takeOut(Long partnerId, Long orderId,Long workId,String carNum) throws Exception { + public void takeOut(Long partnerId, Long orderId, Long workId, String carNum) throws Exception { LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); AdminUserDO user = userService.getUser(loginUser.getId()); ShopMallPartners partnersTmp = baseMapper.selectById(partnerId); - if (!partnersTmp.getUserId().equals(user.getId())){ + if (!partnersTmp.getUserId().equals(user.getId())) { return; } OrderInfo orderInfo = orderService.getById(orderId); - if (!orderInfo.getPartnerId().equals(partnerId)){ + if (!orderInfo.getPartnerId().equals(partnerId)) { throw new Exception("您无核销权限"); } - if (!orderInfo.getOrderStatus().equals("1")&&!ObjectUtil.isEmpty(orderInfo.getValidationTime())){ + if (!orderInfo.getOrderStatus().equals("1") && !ObjectUtil.isEmpty(orderInfo.getValidationTime())) { throw new Exception("已核销请不要重复核销"); } //处理订单信息 @@ -1320,20 +1326,20 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(PartnerCustomerInfo::getPartnerId,partnerId).eq(PartnerCustomerInfo::getUserId,orderInfo.getUserId()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(PartnerCustomerInfo::getPartnerId, partnerId).eq(PartnerCustomerInfo::getUserId, orderInfo.getUserId()); PartnerCustomerInfo customerInfo = customerInfoService.getOne(queryWrapper); - if (ObjectUtil.isEmpty(customerInfo)){ + if (ObjectUtil.isEmpty(customerInfo)) { AdminUserDO buyUser = userService.getUser(orderInfo.getUserId()); - customerInfo =new PartnerCustomerInfo(); + customerInfo = new PartnerCustomerInfo(); customerInfo.setPartnerId(partnerId); customerInfo.setUserId(buyUser.getId()); customerInfo.setCustomerPhone(buyUser.getMobile()); @@ -1368,7 +1374,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper1 =new LambdaQueryWrapper<>(); - queryWrapper1.eq(PartnerWorker::getUserId,workUser.getId()); + if (workUser.getMobile().equals(phoneNum)) { + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(PartnerWorker::getUserId, workUser.getId()); PartnerWorker one = partnerWorkerService.getOne(queryWrapper1); if (ObjectUtil.isNotEmpty(one)) { return; } - PartnerWorker partnerWorker =new PartnerWorker(); + PartnerWorker partnerWorker = new PartnerWorker(); partnerWorker.setPartnerId(partnerId); partnerWorker.setUserId(workUser.getId()); partnerWorker.setWorkPhone(workUser.getMobile()); @@ -1426,39 +1432,39 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl getWorkList(Long partnerId,Long postId,String workName,String phoneNum) { - return baseMapper.getWorkList(partnerId,postId,workName,phoneNum); + public List getWorkList(Long partnerId, Long postId, String workName, String phoneNum) { + return baseMapper.getWorkList(partnerId, postId, workName, phoneNum); } @Override public IPage pageWorkList(Long partnerId, Long postId, String workName, String phoneNum, Page page) { - return baseMapper.pageWorkList(partnerId,postId,workName,phoneNum,page); + return baseMapper.pageWorkList(partnerId, postId, workName, phoneNum, page); } @Override public void delWorker(Long partnerId, Long workId) { LoginUser user = SecurityFrameworkUtils.getLoginUser(); ShopMallPartners partnersTmp = baseMapper.selectById(partnerId); - if (!partnersTmp.getUserId().equals(user.getId())){ + if (!partnersTmp.getUserId().equals(user.getId())) { return; } partnerWorkerService.removeById(workId); } @Override - public IPage inspectionList(Page page,Long partnerId, String status, String carNum) { - return baseMapper.inspectionList(page,partnerId,status,carNum); + public IPage inspectionList(Page page, Long partnerId, String status, String carNum) { + return baseMapper.inspectionList(page, partnerId, status, carNum); } @Override @@ -1468,8 +1474,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(InspectionStepInfo::getInspectionInfoId,inspectionInfoId).orderByAsc(InspectionStepInfo::getStepNum); + queryWrapper.eq(InspectionStepInfo::getInspectionInfoId, inspectionInfoId).orderByAsc(InspectionStepInfo::getStepNum); queryWrapper.orderBy(true, false, InspectionStepInfo::getId); List list = stepInfoService.listByInspectionInfoId(inspectionInfoId); - if (CollectionUtil.isNotEmpty(list)){ + if (CollectionUtil.isNotEmpty(list)) { res.setStepInfos(list); } ShopInspectionCategory category = categoryService.getById(info.getCategoryId()); @@ -1519,18 +1525,18 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl workerInspectionList(Long workerId, String status, String searchValue) { - return baseMapper.workerInspectionList(workerId,status,searchValue); + return baseMapper.workerInspectionList(workerId, status, searchValue); } @Override public void addStepInfo(InspectionStepInfo stepInfo) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(InspectionStepInfo::getInspectionInfoId,stepInfo.getInspectionInfoId()).orderByDesc(InspectionStepInfo::getStepNum).last("limit 1"); + queryWrapper.eq(InspectionStepInfo::getInspectionInfoId, stepInfo.getInspectionInfoId()).orderByDesc(InspectionStepInfo::getStepNum).last("limit 1"); InspectionStepInfo list = stepInfoService.getOne(queryWrapper); - if (ObjectUtil.isNotEmpty(list)){ - stepInfo.setStepNum(list.getStepNum()+1); - }else { + if (ObjectUtil.isNotEmpty(list)) { + stepInfo.setStepNum(list.getStepNum() + 1); + } else { stepInfo.setStepNum(1); } stepInfoService.save(stepInfo); @@ -1539,33 +1545,33 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl getAppointmentList(Page page,Long partnerId,String phoneNum) { - return appointmentService.getAppointmentList(page,partnerId,phoneNum); + public IPage getAppointmentList(Page page, Long partnerId, String phoneNum) { + return appointmentService.getAppointmentList(page, partnerId, phoneNum); } @Override - public IPage validationList(Page page, Long partnerId,String searchValue) { + public IPage validationList(Page page, Long partnerId, String searchValue) { - return baseMapper.validationList(page,partnerId,searchValue); + return baseMapper.validationList(page, partnerId, searchValue); } @Override public void sendCoupon(ShopCouponTemplate template) throws Exception { LoginUser user = SecurityFrameworkUtils.getLoginUser(); ShopMallPartners partnersTmp = baseMapper.selectById(template.getPartnerId()); - if (!partnersTmp.getUserId().equals(user.getId())){ + if (!partnersTmp.getUserId().equals(user.getId())) { return; } - if (StringUtils.isEmpty(template.getRoleKey())){ + if (StringUtils.isEmpty(template.getRoleKey())) { throw new Exception("请选择角色信息"); } - if(template.getEventsStartTime().after(template.getExpirationTime())){ + if (template.getEventsStartTime().after(template.getExpirationTime())) { throw new Exception("活动开始时间需要在生效时间之前"); } - if(template.getEventsEndTime().before(template.getStartTime())){ + if (template.getEventsEndTime().before(template.getStartTime())) { throw new Exception("活动结束时间需要在开始时间之前"); } - if(template.getEventsStartTime().after(template.getEventsEndTime())){ + if (template.getEventsStartTime().after(template.getEventsEndTime())) { throw new Exception("结束时间要在开始时间之后"); } - if(template.getStartTime().after(template.getExpirationTime())){ + if (template.getStartTime().after(template.getExpirationTime())) { throw new Exception("结束时间要在开始时间之后"); } template.setBindMoudle("检测项目现金券"); template.setCouponType("cash"); template.setBindPartnerId(template.getPartnerId()); - if (ObjectUtil.isEmpty(template.getEventsEndTime())){ + if (ObjectUtil.isEmpty(template.getEventsEndTime())) { template.setStartTime(new Date()); template.setEventsEndTime(DateUtil.parse("2888-08-08")); } @@ -1657,41 +1663,42 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl listCoupon(Page page,Long partnerId, String searchValue) { - LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(ShopCouponTemplate::getPartnerId,partnerId).eq(ShopCouponTemplate::getBindMoudle,"检测项目现金券") - .eq(StringUtils.isNotEmpty(searchValue),ShopCouponTemplate::getTitle,searchValue).orderByDesc(TenantBaseDO::getCreateTime); + public IPage listCoupon(Page page, Long partnerId, String searchValue) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ShopCouponTemplate::getPartnerId, partnerId).eq(ShopCouponTemplate::getBindMoudle, "检测项目现金券") + .eq(StringUtils.isNotEmpty(searchValue), ShopCouponTemplate::getTitle, searchValue).orderByDesc(TenantBaseDO::getCreateTime); - return templateService.listCoupon(page,partnerId,searchValue); + return templateService.listCoupon(page, partnerId, searchValue); } @Override - public void delCoupon(Long partnerId,Long id) { + public void delCoupon(Long partnerId, Long id) { LoginUser user = SecurityFrameworkUtils.getLoginUser(); ShopMallPartners partnersTmp = baseMapper.selectById(partnerId); - if (!partnersTmp.getUserId().equals(user.getId())){ + if (!partnersTmp.getUserId().equals(user.getId())) { return; } templateService.deleteShopCouponTemplateById(id); } + @Override - public void designatePickCarWorker(Long pickCarId,Long workerId){ + public void designatePickCarWorker(Long pickCarId, Long workerId) { InspectionPickCar pickCar = pickCarService.getById(pickCarId); pickCar.setWorkerId(workerId); pickCarService.updateById(pickCar); } @Override - public IPage getPickCarList(Page page,Long partnerId, String phoneNum,String pickStatus) { + public IPage getPickCarList(Page page, Long partnerId, String phoneNum, String pickStatus) { - return baseMapper.getPickCarList(page,partnerId,phoneNum,pickStatus); + return baseMapper.getPickCarList(page, partnerId, phoneNum, pickStatus); } @Override public InspectionPickCar getPickCarDetail(Long dataId) { InspectionPickCar pickCar = pickCarService.getById(dataId); //获取已经指派了的修理工 - if (null!=pickCar.getWorkerId()){ + if (null != pickCar.getWorkerId()) { // PartnerWorker worker = partnerWorkerService.getById(pickCar.getWorkerId()); AdminUserDO user = userService.getUser(pickCar.getWorkerId()); pickCar.setWorkerName(user.getNickname()); @@ -1702,17 +1709,17 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl getPickCarListOfWorker(Page page,Long workerId, String phoneNum) { - return baseMapper.getPickCarListOfWorker(page,workerId,phoneNum); + public IPage getPickCarListOfWorker(Page page, Long workerId, String phoneNum) { + return baseMapper.getPickCarListOfWorker(page, workerId, phoneNum); } @Override public JSONObject vehicleLicenseOCR(String imagePath) throws Exception { try { - imagePath = imagePath.replace("undefined",""); + imagePath = imagePath.replace("undefined", ""); String s = VehicleLicenseOCR.dealFunction(imagePath); return JSONObject.parseObject(s); - }catch (Exception e){ + } catch (Exception e) { throw new Exception("识别失败,请对准拍摄"); } @@ -1726,7 +1733,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl inspectionPostInfo() { - PostPageReqVO post =new PostPageReqVO(); + PostPageReqVO post = new PostPageReqVO(); post.setCode("inspection"); - List postPage = postService.listPostPage(post); + List postPage = postService.listPostPage(post); // List sysPosts = postPage.getList(); // PostDO sysPost = new PostDO(); @@ -1802,8 +1809,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl staticsTable1(Long partnerId,String startTime,String endTime) { - if (StringUtils.isEmpty(startTime)){ + public Map staticsTable1(Long partnerId, String startTime, String endTime) { + if (StringUtils.isEmpty(startTime)) { startTime = DateUtil.format(new Date(), "yyyy-MM-dd"); endTime = DateUtil.format(new Date(), "yyyy-MM-dd"); } @@ -1812,9 +1819,10 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl map = baseMapper.staticsTable1(partnerId, startTime, endTime); return map; } + @Override - public Map newStaticsTable1(String startTime,String endTime) { - if (StringUtils.isEmpty(startTime)){ + public Map newStaticsTable1(String startTime, String endTime) { + if (StringUtils.isEmpty(startTime)) { startTime = DateUtil.format(new Date(), "yyyy-MM-dd"); endTime = DateUtil.format(new Date(), "yyyy-MM-dd"); } @@ -1826,7 +1834,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl staticsTable2(Long partnerId, String startTime, String endTime) { - if (StringUtils.isEmpty(startTime)){ + if (StringUtils.isEmpty(startTime)) { startTime = DateUtil.format(new Date(), "yyyy-MM-dd"); endTime = DateUtil.format(new Date(), "yyyy-MM-dd"); } @@ -1835,21 +1843,22 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl map = baseMapper.staticsTable2(partnerId, startTime, endTime); return map; } + @Override public Map newStaticsTable2(String startTime, String endTime) { - if (StringUtils.isEmpty(startTime)){ + if (StringUtils.isEmpty(startTime)) { startTime = DateUtil.format(new Date(), "yyyy-MM-dd"); endTime = DateUtil.format(new Date(), "yyyy-MM-dd"); } startTime = startTime + " 00:00:00"; endTime = endTime + " 23:59:59"; - Map map = baseMapper.newStaticsTable2( startTime, endTime); + Map map = baseMapper.newStaticsTable2(startTime, endTime); return map; } @Override public List> staticsTable3(Long partnerId, String startTime, String endTime) { - if (StringUtils.isEmpty(startTime)){ + if (StringUtils.isEmpty(startTime)) { startTime = DateUtil.format(new Date(), "yyyy-MM-dd"); endTime = DateUtil.format(new Date(), "yyyy-MM-dd"); } @@ -1858,9 +1867,10 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl> res = baseMapper.staticsTable3(partnerId, startTime, endTime); return res; } + @Override public List> newStaticsTable3(String startTime, String endTime) { - if (StringUtils.isEmpty(startTime)){ + if (StringUtils.isEmpty(startTime)) { startTime = DateUtil.format(new Date(), "yyyy-MM-dd"); endTime = DateUtil.format(new Date(), "yyyy-MM-dd"); } @@ -1872,19 +1882,19 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl> staticsTable3Detail(Long partnerId, String startTime, String endTime, String remark) { - if (StringUtils.isEmpty(startTime)){ + if (StringUtils.isEmpty(startTime)) { startTime = DateUtil.format(new Date(), "yyyy-MM-dd"); endTime = DateUtil.format(new Date(), "yyyy-MM-dd"); } startTime = startTime + " 00:00:00"; endTime = endTime + " 23:59:59"; - List> res = baseMapper.staticsTable3Detail(partnerId, startTime, endTime,remark); + List> res = baseMapper.staticsTable3Detail(partnerId, startTime, endTime, remark); return res; } @Override public List> staticsTable4(Long partnerId, String startTime, String endTime) { - if (StringUtils.isEmpty(startTime)){ + if (StringUtils.isEmpty(startTime)) { startTime = DateUtil.format(new Date(), "yyyy-MM-dd"); endTime = DateUtil.format(new Date(), "yyyy-MM-dd"); } @@ -1896,7 +1906,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl> staticsTable5(Long partnerId, String startTime, String endTime) { - if (StringUtils.isEmpty(startTime)){ + if (StringUtils.isEmpty(startTime)) { startTime = DateUtil.format(new Date(), "yyyy-MM-dd"); endTime = DateUtil.format(new Date(), "yyyy-MM-dd"); } @@ -1909,24 +1919,24 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl getProjectByIds(Long[] ids){ + public Map getProjectByIds(Long[] ids) { List inspectionWorkNodes = inspectionWorkNodeService. list(new LambdaQueryWrapper() .in(InspectionWorkNode::getInspectionInfoId, Arrays.asList(ids))); - if (ObjectUtil.isEmpty(inspectionWorkNodes)){ + if (ObjectUtil.isEmpty(inspectionWorkNodes)) { return null; } List projectIds = inspectionWorkNodes.stream().map(InspectionWorkNode::getProjectId).collect(Collectors.toList()); - if (CollUtil.isEmpty(projectIds)){ + if (CollUtil.isEmpty(projectIds)) { return null; } List projects = projectService.listByIds(projectIds); - if (CollUtil.isEmpty(projects)){ + if (CollUtil.isEmpty(projects)) { return null; } Map projectMap = projects.stream().collect(Collectors.toMap(DlInspectionProject::getId, DlInspectionProject::getProjectName)); @@ -1945,14 +1955,14 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl getOrderByDate(String startTime, String endTime, String chooseStatus, Page page){ - if (StringUtils.isEmpty(startTime)){ + public IPage getOrderByDate(String startTime, String endTime, String chooseStatus, Page page) { + if (StringUtils.isEmpty(startTime)) { startTime = DateUtil.format(new Date(), "yyyy-MM-dd"); endTime = DateUtil.format(new Date(), "yyyy-MM-dd"); } @@ -1964,15 +1974,15 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl getTypeCount(String startTime, String endTime, String chooseStatus){ - if (StringUtils.isEmpty(startTime)){ + public Map getTypeCount(String startTime, String endTime, String chooseStatus) { + if (StringUtils.isEmpty(startTime)) { startTime = DateUtil.format(new Date(), "yyyy-MM-dd"); endTime = DateUtil.format(new Date(), "yyyy-MM-dd"); } @@ -1981,4 +1991,27 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl> typeCount = baseMapper.getTypeCount(startTime, endTime, chooseStatus); return typeCount.stream().collect(Collectors.toMap(map -> String.valueOf(map.get("type")), map -> map.get("count"))); } + + /** + * 查询检测类型统计 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 结果 + */ + @Override + public List> queryInspectionSkuList(String startTime, String endTime) { + return baseMapper.queryInspectionSkuList(startTime, endTime); + } + + /** + * 查询员工统计 + * + * @param dlInspectionProject 项目信息 + * @return 结果 + */ + @Override + public List> getStaffCount(DlInspectionProject dlInspectionProject) { + return inspectionWorkNodeService.getStaffCount(dlInspectionProject); + } } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/DlInspectionProjectServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/DlInspectionProjectServiceImpl.java index 7b66327a..02f2733c 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/DlInspectionProjectServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/DlInspectionProjectServiceImpl.java @@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.inspection.service.ProjectRoyaltyService; import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectPageReqVO; import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectRespVO; import cn.iocoder.yudao.module.inspection.vo.DlInspectionProjectSaveReqVO; +import cn.iocoder.yudao.module.inspection.vo.InspectionOrderExportVo; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -116,4 +117,15 @@ public class DlInspectionProjectServiceImpl extends ServiceImpl queryProjectWorkerName(List orderIds) { + return baseMapper.queryProjectWorkerName(orderIds); + } + } \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionEquInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionEquInfoServiceImpl.java index ff4dc9da..08d19b99 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionEquInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionEquInfoServiceImpl.java @@ -3,13 +3,21 @@ package cn.iocoder.yudao.module.inspection.service.impl; import java.util.*; import java.util.stream.Collectors; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Validator; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.module.constant.InspectionConstants; import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; import cn.iocoder.yudao.module.inspection.entity.InspectionFile; import cn.iocoder.yudao.module.inspection.entity.InspectionStaff; import cn.iocoder.yudao.module.inspection.service.IInspectionFileService; +import cn.iocoder.yudao.module.inspection.vo.ImportEquipmentVo; +import cn.iocoder.yudao.module.inspection.vo.InspectionEqInfoImportVo; +import cn.iocoder.yudao.module.inspection.vo.StaffImportExcelVO; +import cn.iocoder.yudao.module.system.api.dict.DictDataApi; +import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -41,6 +49,9 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl importStaff(List list) { + if (CollUtil.isEmpty(list)) { + throw new RuntimeException("导入数据为空"); + } + Map resultMap = new HashMap<>(); + + // 校验导入信息 + ImportEquipmentVo importEquipmentVo = validImportEquipment(list); + // 保存信息 + int saveNum = saveImportStaff(importEquipmentVo.getSuccessList()); + resultMap.put("successList", importEquipmentVo.getSuccessList()); + resultMap.put("failList", importEquipmentVo.getFailList()); + return resultMap; + } + + /** + * 保存导入的设备信息 + * + * @param successList 设备信息集合 + * @return 结果 + */ + private int saveImportStaff(List successList) { + // 批量保存设备信息 + List inspectionEquInfos = BeanUtil.copyToList(successList, InspectionEquInfo.class); + this.saveBatch(inspectionEquInfos); + + List warnMessages = new ArrayList<>(); + for (InspectionEquInfo inspectionEqInfoImportVo : inspectionEquInfos) { + if (ObjectUtil.isNotEmpty(inspectionEqInfoImportVo.getNextCheckTime())) { + //同时处理提醒信息 + WarnMessage warnMessage = new WarnMessage(); + warnMessage.setTitle("设备检测即将到期"); + warnMessage.setContent("名为:" + inspectionEqInfoImportVo.getEquName() + "的设备即将到设定的检测时间,请及时处理相关事项!"); + warnMessage.setIsRead("0"); + warnMessage.setPartnerId(inspectionEqInfoImportVo.getPartnerId()); + warnMessage.setType("equ"); + warnMessage.setObjectId(inspectionEqInfoImportVo.getId()); + // 创建Calendar对象 + Calendar calendar = Calendar.getInstance(); + calendar.setTime(inspectionEqInfoImportVo.getNextCheckTime()); + calendar.add(Calendar.MONTH, -1); + Date newDate = calendar.getTime(); + warnMessage.setWarnTime(newDate); + + warnMessages.add(warnMessage); + } + //批量保存提醒信息 + if (CollUtil.isNotEmpty(warnMessages)) { + messageService.saveBatch(warnMessages); + } + } + return 0; + } + + /** + * 验证导入的设备信息 + * + * @param list 设备信息集合 + * @return 结果 + */ + private ImportEquipmentVo validImportEquipment(List list) { + List successList = new ArrayList<>(); + List failList = new ArrayList<>(); + + //查询设备类别 + // 查询设备类型 + List eqType = dictDataApi.getDictDataList("ins_equ_type"); + Map typeMap = eqType.stream().collect(Collectors.toMap(DictDataRespDTO::getLabel, DictDataRespDTO::getValue)); + + //去除示例数据 + if ("示例设备".equals(list.get(0).getEquName())) { + list.remove(0); + } + + for (InspectionEqInfoImportVo inspectionEqInfoImportVo : list) { + //判断设备名称是否为空 + if (ObjectUtil.isEmpty(inspectionEqInfoImportVo.getEquName())) { + inspectionEqInfoImportVo.setReason("设备名称不能为空"); + failList.add(inspectionEqInfoImportVo); + continue; + } + // 判断设备类别是否为空 + if (ObjectUtil.isEmpty(inspectionEqInfoImportVo.getType())) { + inspectionEqInfoImportVo.setReason(inspectionEqInfoImportVo.getEquName() + "设备类别不能为空"); + failList.add(inspectionEqInfoImportVo); + continue; + } + if (ObjectUtil.isEmpty(typeMap.get(inspectionEqInfoImportVo.getType()))) { + inspectionEqInfoImportVo.setReason(inspectionEqInfoImportVo.getEquName() + "请在下拉框中选择设备类型"); + failList.add(inspectionEqInfoImportVo); + continue; + }else { + inspectionEqInfoImportVo.setType(typeMap.get(inspectionEqInfoImportVo.getType())); + } + // 如果邮箱不为空判断是否正确 + if (ObjectUtil.isNotEmpty(inspectionEqInfoImportVo.getEmail())) { + if (!Validator.isEmail(inspectionEqInfoImportVo.getEmail())) { + inspectionEqInfoImportVo.setReason(inspectionEqInfoImportVo.getEquName() + "的邮箱格式不正确"); + failList.add(inspectionEqInfoImportVo); + continue; + } + } + successList.add(inspectionEqInfoImportVo); + } + ImportEquipmentVo importEquipmentVo = new ImportEquipmentVo(); + importEquipmentVo.setSuccessList(successList); + importEquipmentVo.setFailList(failList); + return importEquipmentVo; + } + /** * 添加设备附件 * diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionStaffServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionStaffServiceImpl.java index 3bfbd6f1..235386dd 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionStaffServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionStaffServiceImpl.java @@ -194,7 +194,7 @@ public class InspectionStaffServiceImpl extends ServiceImpl importStaff(List list) { - if (ObjectUtil.isEmpty(list)) { + if (CollUtil.isEmpty(list)) { throw new RuntimeException("导入数据为空"); } Map resultMap = new HashMap<>(); diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java index 1322311c..dad4ade2 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java @@ -405,6 +405,17 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl> getStaffCount(DlInspectionProject dlInspectionProject) { + return baseMapper.getStaffCount(dlInspectionProject); + } + /** * 判断传入的 InspectionWorkNode 对象是否在集合中有后续项目 * diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ImportEquipmentVo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ImportEquipmentVo.java new file mode 100644 index 00000000..53d6d0bb --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ImportEquipmentVo.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.inspection.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @Description: 导入设备返回对象 + * @Author: 86187 + * @Date: 2025/02/13 11:46 + * @Version: 1.0 + */ +@Data +public class ImportEquipmentVo { + /** + * 导入成功的集合 + */ + private List successList; + + /** + * 导入失败的集合 + */ + private List failList; +} diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ImportStaffVo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ImportStaffVo.java index 83721011..35759505 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ImportStaffVo.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/ImportStaffVo.java @@ -1,16 +1,22 @@ package cn.iocoder.yudao.module.inspection.vo; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; import java.util.List; /** - * @Description: 导入实习生返回对象 + * @Description: 导入检测员工返回对象 * @Author: 86187 * @Date: 2025/02/13 11:46 * @Version: 1.0 */ @Data +@Builder +@AllArgsConstructor +@NoArgsConstructor public class ImportStaffVo { /** * 导入成功的集合 diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/InspectionEqInfoImportVo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/InspectionEqInfoImportVo.java new file mode 100644 index 00000000..a5aa7f48 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/InspectionEqInfoImportVo.java @@ -0,0 +1,119 @@ +package cn.iocoder.yudao.module.inspection.vo; + +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @Description: 设备导入类 + * @Author: 86187 + * @Date: 2025/02/14 9:13 + * @Version: 1.0 + */ +@Data +@Accessors(chain = false) // 禁用链式调用 +public class InspectionEqInfoImportVo { + /** + * 设备名称 + */ + @ExcelProperty(value = "设备名称", index = 0) + private String equName; + + /** + * 设备类别(字典:ins_equ_type) + */ + @ExcelProperty(value = "设备类型", index = 1) + private String type; + + /** + * 设备型号 + */ + @ExcelProperty(value = "型号", index = 2) + private String equModel; + + /** + * 设备编号 + */ + @ExcelProperty(value = "出厂编号", index = 3) + private String equNumber; + + /** + * 有效期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @ExcelProperty(value = "校准日期", index = 4) + private Date validTime; + + /** + * 下次检定时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @ExcelProperty(value = "复校日期", index = 5) + private Date nextCheckTime; + + /** + * 检测证书编号 + */ + @ExcelProperty(value = "证书编号", index = 6) + private String certificateNumber; + + /** + * 制造商 + */ + @ExcelProperty(value = "制造商", index = 7) + private String manufacturer; + + /** + * 上次检定单位 + */ + @ExcelProperty(value = "校准单位", index = 8) + private String lastUnit; + + /** + * 电话 + */ + @ExcelProperty(value = "电话", index = 9) + private String mobile; + + /** + * 地址 + */ + @ExcelProperty(value = "地址", index = 10) + private String address; + + /** + * 邮编 + */ + @ExcelProperty(value = "邮编", index = 11) + private String postcode; + + /** + * 邮箱 + */ + @ExcelProperty(value = "电子邮箱", index = 12) + private String email; + + /** + * 设备检定周期 + */ +// @ExcelProperty(value = "设备检定周期", index = 13) + @ExcelIgnore + private String equZq; + + @ExcelIgnore + private Long id; + + @ExcelIgnore + private String reason; + +} diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/InspectionOrderExportVo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/InspectionOrderExportVo.java new file mode 100644 index 00000000..6da4e7f5 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/vo/InspectionOrderExportVo.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.inspection.vo; + +import lombok.Data; + +/** + * @Description: 查询数据库 + * @Author: 86187 + * @Date: 2025/02/15 17:11 + * @Version: 1.0 + */ +@Data +public class InspectionOrderExportVo { + /** + * 项目名称 + */ + private String projectName; + + /** + * 订单编号 + */ + private Long orderId; + + /** + * 工作人员名称 + */ + private String workName; +} diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/entity/OrderInfo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/entity/OrderInfo.java index 4392c762..ccba8620 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/entity/OrderInfo.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/entity/OrderInfo.java @@ -1,6 +1,8 @@ package cn.iocoder.yudao.module.payment.entity; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; @@ -17,13 +19,17 @@ import java.util.Date; @Data public class OrderInfo extends TenantBaseDO { //订单id + @ExcelIgnore private Long id; + @ExcelIgnore private String transactionId; //订单号 + @ExcelProperty(index = 0, value = "订单号") private String orderNo; //商品id private Long goodsId; //商品名称 + @ExcelProperty(index = 11, value = "商品名称") private String goodsTitle; private String goodsType; private Long skuId; @@ -31,8 +37,10 @@ public class OrderInfo extends TenantBaseDO { //用户id private Long userId; //用户姓名 + @ExcelProperty(index = 1, value = "客户姓名") private String realName; //用户手机号 + @ExcelProperty(index = 2, value = "联系方式") private String phonenumber; //商品原价 分 private Long goodsPrice; @@ -124,14 +132,44 @@ public class OrderInfo extends TenantBaseDO { private String isPickCar; private String remark; //车牌号 + @ExcelProperty(index = 3, value = "车牌号") private String carNo; //车辆品牌型号 + @ExcelProperty(index = 4, value = "品牌类型") private String carModel; //车辆性质 非营运 营运等 + @ExcelProperty(index = 8, value = "使用性质") private String carNature; //车架号 + @ExcelProperty(index = 5, value = "车架号") private String carIdNo; + @ExcelProperty(index = 6, value = "住址") + @TableField(exist = false) + private String userAddress; + + @ExcelProperty(index = 7, value = "单位") + @TableField(exist = false) + private String unitName; + + @ExcelProperty(index = 9, value = "来源") + @TableField(exist = false) + private String customerName; + + @ExcelProperty(index = 10, value = "代办人电话") + @TableField(exist = false) + private String phone; + + @ExcelProperty(index = 12, value = "新旧车") + @TableField(exist = false) + private String carStatus; + + @TableField(exist = false) + private Long payMoneyStr; + + @TableField(exist = false) + private Double inspectionTime; + } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/OrderInfoService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/OrderInfoService.java index a1eb3ad7..302ddeb6 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/OrderInfoService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/OrderInfoService.java @@ -12,6 +12,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import org.springframework.data.repository.query.Param; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -81,5 +83,13 @@ public interface OrderInfoService extends IService { IPage orderListPc(Page page,OrderInfo orderInfo); OrderInfo getOrderByOrderNo(String orderNo); + + /** + * 导出订单 + * @param response 响应 + * @param shopInspectionOrder 订单 + * @param page 分页 + */ + void exportExcel(HttpServletResponse response, OrderInfo shopInspectionOrder, Page page) throws IOException; } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/impl/OrderInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/impl/OrderInfoServiceImpl.java index 06fcf979..2b23004d 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/impl/OrderInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/impl/OrderInfoServiceImpl.java @@ -1,10 +1,13 @@ package cn.iocoder.yudao.module.payment.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ObjectUtil; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.inspection.entity.*; import cn.iocoder.yudao.module.inspection.service.*; +import cn.iocoder.yudao.module.inspection.vo.InspectionOrderExportVo; import cn.iocoder.yudao.module.partner.entity.PartnerWorker; import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService; import cn.iocoder.yudao.module.payment.entity.OrderInfo; @@ -13,6 +16,7 @@ import cn.iocoder.yudao.module.payment.entity.commentVo; import cn.iocoder.yudao.module.payment.mapper.OrderInfoMapper; import cn.iocoder.yudao.module.payment.service.IOrderInfoDetailService; import cn.iocoder.yudao.module.payment.service.OrderInfoService; +import cn.iocoder.yudao.module.payment.vo.OrderInfoExportVo; import cn.iocoder.yudao.module.shop.entity.*; import cn.iocoder.yudao.module.shop.service.*; import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; @@ -21,10 +25,12 @@ import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.permission.RoleService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.util.StringUtils; +import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.ObjectUtils; @@ -32,8 +38,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.math.BigDecimal; import java.util.*; +import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; @@ -78,6 +87,8 @@ public class OrderInfoServiceImpl extends ServiceImpl page) throws IOException { + // 查询订单数据 + List orderInfoIPage = queryListPage(shopInspectionOrder, page).getRecords(); + List objects = BeanUtil.copyToList(orderInfoIPage, OrderInfoExportVo.class); + + // 计算检测时长 + objects.forEach(item -> { + if (ObjectUtil.isNotEmpty(item.getStartTime()) && ObjectUtil.isNotEmpty(item.getEndTime())) { + long diff = item.getEndTime().getTime() - item.getStartTime().getTime(); + long hours = TimeUnit.MILLISECONDS.toHours(diff); + long minutes = TimeUnit.MILLISECONDS.toMinutes(diff) % 60; + String inspectionTime = String.format("%d小时%d分", hours, minutes); + item.setInspectionTime(inspectionTime); + } + }); + + // 查询所有检测项目 + List projectList = dlInspectionProjectService.list(Wrappers.lambdaQuery() + .orderBy(true, true,DlInspectionProject::getSort)); + + // 动态构建表头 + List> head = new ArrayList<>(); + // 固定列 + head.add(Collections.singletonList("订单号")); + head.add(Collections.singletonList("客户姓名")); + head.add(Collections.singletonList("联系方式")); + head.add(Collections.singletonList("车牌号")); + head.add(Collections.singletonList("品牌类型")); + head.add(Collections.singletonList("车架号")); + head.add(Collections.singletonList("住址")); + head.add(Collections.singletonList("单位")); + head.add(Collections.singletonList("使用性质")); + head.add(Collections.singletonList("来源")); + head.add(Collections.singletonList("代办人电话")); + head.add(Collections.singletonList("商品名称")); + head.add(Collections.singletonList("新旧车")); + head.add(Collections.singletonList("开始时间")); + head.add(Collections.singletonList("结束时间")); + head.add(Collections.singletonList("检测时长")); + head.add(Collections.singletonList("支付方式")); + head.add(Collections.singletonList("金额")); + // 动态列(检测项目) + for (DlInspectionProject project : projectList) { + head.add(Collections.singletonList(project.getProjectName())); + } + + List orderIds = orderInfoIPage.stream().map(OrderInfo::getId).collect(Collectors.toList()); + + List projectWorkerNames = dlInspectionProjectService.queryProjectWorkerName(orderIds); + + // 动态构建数据 + List> data = new ArrayList<>(); + for (OrderInfoExportVo item : objects) { + List row = new ArrayList<>(); + // 固定列数据 + row.add(item.getOrderNo()); + row.add(item.getRealName()); + row.add(item.getPhonenumber()); + row.add(item.getCarNo()); + row.add(item.getCarModel()); + row.add(item.getCarIdNo()); + row.add(item.getUserAddress()); + row.add(item.getUnitName()); + row.add(item.getCarNature()); + row.add(item.getCustomerName()); + row.add(item.getWorkerPhone()); + row.add(item.getGoodsTitle()); + row.add(item.getCarStatus()); + row.add(item.getStartTime()); + row.add(item.getEndTime()); + row.add(item.getInspectionTime()); + row.add(item.getPayType()); + row.add(item.getPayMoneyStr()); + // 动态列数据 + for (InspectionOrderExportVo project : projectWorkerNames) { + row.add(item.getDynamicColumns().get(project.getWorkName())); + } + data.add(row); + + } + + + + // 导出 Excel + EasyExcel.write(response.getOutputStream()) + .head(head) // 设置动态表头 + .sheet("检测商品信息") + .doWrite(data); // 写入数据 + } + } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/vo/OrderInfoExportVo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/vo/OrderInfoExportVo.java new file mode 100644 index 00000000..65a60695 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/vo/OrderInfoExportVo.java @@ -0,0 +1,41 @@ +package cn.iocoder.yudao.module.payment.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * @Description: 导出订单 + * @Author: 86187 + * @Date: 2025/02/15 10:49 + * @Version: 1.0 + */ +@Data +public class OrderInfoExportVo { + private String orderNo; + private String realName; + private String phonenumber; + private String carNo; + private String carModel; + private String carIdNo; + private String userAddress; + private String unitName; + private String carNature; + private String customerName; + private String workerPhone; + private String goodsTitle; + private String carStatus; + private Date startTime; + private Date endTime; + private String inspectionTime; + private String payType; + private Long payMoneyStr; + + // 动态列数据 + private Map dynamicColumns = new HashMap<>(); +} diff --git a/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml b/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml index b11b9c69..1d6adf68 100644 --- a/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml @@ -95,7 +95,7 @@ inspection_project_royalty AS royalty ON node.project_id = royalty.project_id and orders.goods_id = royalty.goods_id - node.status = '2' AND info.status = '1' + node.status = '2' AND info.status = '1' and node.deleted = 0 AND node.create_time = #{inspectionWorkNode.createTime} @@ -115,7 +115,32 @@ AND node.create_time BETWEEN #{inspectionWorkNode.rescueStart} AND #{inspectionWorkNode.rescueEnd} + group by node.deal_user_id ORDER BY node.create_time DESC; + diff --git a/dl-module-inspection/src/main/resources/mapper/inspection/AppInspectionPartnerMapper.xml b/dl-module-inspection/src/main/resources/mapper/inspection/AppInspectionPartnerMapper.xml index 2e7c05ae..44bebaa9 100644 --- a/dl-module-inspection/src/main/resources/mapper/inspection/AppInspectionPartnerMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/inspection/AppInspectionPartnerMapper.xml @@ -217,7 +217,7 @@ where sig.partner_id =#{partnerId} info.customer_source as customerSource, info.other_phone as otherPhone,oi.sku_id as skuId, oi.sku_name as skuName,oi.goods_price as goodsPrice from inspection_info info - LEFT JOIN inspection_step_info step ON info.id = st ep.inspection_info_id + LEFT JOIN inspection_step_info step ON info.id = step.inspection_info_id INNER JOIN system_users su on su.id = info.user_id INNER JOIN order_info oi on oi.id = info.inspection_order_id WHERE info.status = #{status} and info.partner_id = #{partnerId} @@ -649,4 +649,19 @@ FROM ) t2 GROUP BY t2.type + diff --git a/dl-module-inspection/src/main/resources/mapper/inspection/DlInspectionProjectMapper.xml b/dl-module-inspection/src/main/resources/mapper/inspection/DlInspectionProjectMapper.xml index 140971a6..370d72a5 100644 --- a/dl-module-inspection/src/main/resources/mapper/inspection/DlInspectionProjectMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/inspection/DlInspectionProjectMapper.xml @@ -25,4 +25,31 @@ ORDER BY sort + \ No newline at end of file diff --git a/dl-module-inspection/src/main/resources/mapper/payment/OrderInfoMapper.xml b/dl-module-inspection/src/main/resources/mapper/payment/OrderInfoMapper.xml index 479e6447..4ecb7be7 100644 --- a/dl-module-inspection/src/main/resources/mapper/payment/OrderInfoMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/payment/OrderInfoMapper.xml @@ -54,6 +54,7 @@ oi.comment_desc, oi.comment_star, suc.car_no + -- oi.pay_money FROM `order_info` oi LEFT JOIN system_users su ON su.id = oi.user_id @@ -253,17 +254,32 @@ oi.order_status, oi.comment_desc, oi.comment_star, - suc.car_no +-- suc.car_no, + info.car_num as carNo, + info.car_model, + info.car_id_no, + info.user_address, + info.unit_name, + info.car_nature, + info.customer_source as customerName, + info.worker_phone, + info.car_status, + oi.pay_money / 100 as payMoneyStr, + info.start_time, + info.end_time, + -- end_time 减去 start_time + DATE_FORMAT(info.end_time, '%Y-%m-%d %H:%i:%s') - DATE_FORMAT(info.start_time, '%Y-%m-%d %H:%i:%s') as inspectionTime FROM `order_info` oi LEFT JOIN system_users su ON su.id = oi.user_id left join shop_user_car suc on suc.car_id = oi.user_car_id + LEFT JOIN inspection_info info on info.inspection_order_id = oi.id where 1=1 and oi.order_status = #{entity.orderStatus} - and oi.validation_time is not null + -- and oi.validation_time is not null and oi.real_name like concat('%',#{entity.realName},'%') diff --git a/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/util/ExcelUtils.java b/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/util/ExcelUtils.java index 80e7b426..964506bc 100644 --- a/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/util/ExcelUtils.java +++ b/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/util/ExcelUtils.java @@ -89,108 +89,90 @@ public class ExcelUtils { } /** - * 导出空白模板Excel,并为指定列添加下拉框和日期时间格式验证 + * 导出空白模板Excel,并为指定列添加下拉框和日期时间格式验证,同时支持自定义示例数据。 * - * @param response HttpServletResponse - * @param fileName 文件名 - * @param sheetName 工作表名称 - * @param headerMap 表头字段映射(列索引 -> 列名称) - * @param dropdownColumns 带下拉框的列及选项(列索引 -> 下拉框选项数组) - * @param dateTimeColumns 需要验证日期时间格式的列(列索引) - * @param isMultiSelect 是否允许多选 - * @throws IOException + * @param response HttpServletResponse,用于将生成的Excel文件写入响应流。 + * @param fileName 导出的Excel文件名。 + * @param sheetName 工作表名称。 + * @param headerArray 表头字段数组(每个元素代表一列的表头名称)。 + * @param dropdownColumns 带下拉框的列及选项(列索引 -> 下拉框选项数组)。 + * @param isMultiSelect 是否允许多选的下拉框选项。 + * @param exampleDataList 自定义的示例数据(每个元素是一个包含多列数据的List)。 + * @param textColumns 需要设置为文本格式的列索引列表。 + * @throws IOException 如果在写入文件或操作Excel时发生错误。 */ public static void exportBlankTemplate(HttpServletResponse response, String fileName, String sheetName, - Map headerMap, + String[] headerArray, // 接收一个字符串数组作为表头 Map dropdownColumns, - int[] dateTimeColumns, boolean isMultiSelect, List> exampleDataList, List textColumns) throws IOException { + // 创建工作簿对象,支持xlsx格式 Workbook workbook = new XSSFWorkbook(); + // 创建一个工作表 Sheet sheet = workbook.createSheet(sheetName); // 创建表头 Row headerRow = sheet.createRow(0); - for (Map.Entry entry : headerMap.entrySet()) { - headerRow.createCell(entry.getKey()).setCellValue(entry.getValue()); + for (int i = 0; i < headerArray.length; i++) { + // 根据传入的表头数组动态创建每一列的表头 + headerRow.createCell(i).setCellValue(headerArray[i]); // 使用数组来填充表头 } - // 创建一个 CellStyle 对象,用于设置文本格式 - CellStyle textCellStyle = workbook.createCellStyle(); - DataFormat dataFormat = workbook.createDataFormat(); - textCellStyle.setDataFormat(dataFormat.getFormat("@")); // "@" 表示文本格式 - // 为每个需要文本格式的列设置整个列的文本格式 - for (Integer columnIndex : textColumns) { - setColumnTextFormat(sheet, columnIndex, textCellStyle); + + if (textColumns != null) { + // 创建一个 CellStyle 对象,用于设置文本格式 + CellStyle textCellStyle = workbook.createCellStyle(); + DataFormat dataFormat = workbook.createDataFormat(); + textCellStyle.setDataFormat(dataFormat.getFormat("@")); // "@" 表示文本格式 + // 为每个需要文本格式的列设置整个列的文本格式 + for (Integer columnIndex : textColumns) { + // 调用辅助方法,设置特定列的单元格为文本格式 + setColumnTextFormat(sheet, columnIndex, textCellStyle); + } } - // 添加多行自定义示例数据 - for (int i = 0; i < exampleDataList.size(); i++) { - List exampleData = exampleDataList.get(i); - Row exampleRow = sheet.createRow(i + 1); // 示例数据从第二行开始 - for (int j = 0; j < exampleData.size(); j++) { - Cell cell = exampleRow.createCell(j); - cell.setCellValue(exampleData.get(j)); - - // 如果当前列索引在 textColumns 列表中,则设置为文本格式 - if (textColumns.contains(j)) { - cell.setCellStyle(textCellStyle); + if (exampleDataList != null) { + // 添加多行自定义示例数据 + for (int i = 0; i < exampleDataList.size(); i++) { + // 获取每一行的示例数据 + List exampleData = exampleDataList.get(i); + // 在表格中创建新的一行 + Row exampleRow = sheet.createRow(i + 1); // 示例数据从第二行开始 + for (int j = 0; j < exampleData.size(); j++) { + // 在每一列添加数据 + Cell cell = exampleRow.createCell(j); + cell.setCellValue(exampleData.get(j)); } } } // 添加下拉框到指定列 if (dropdownColumns != null) { + // 遍历所有需要添加下拉框的列 for (Map.Entry entry : dropdownColumns.entrySet()) { + // 调用辅助方法添加下拉框 addDropdownValidation(sheet, entry.getKey(), entry.getValue(), isMultiSelect); } } - // 添加日期时间格式验证到指定列 - if (dateTimeColumns != null) { - for (int columnIndex : dateTimeColumns) { - addDateTimeValidation(sheet, columnIndex); - } - } - // 设置响应头,指示浏览器下载文件 response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, StandardCharsets.UTF_8.name()) + ".xlsx"); - // 将 Excel 文件写入输出流 + // 将生成的 Excel 文件写入到输出流 try (ServletOutputStream out = response.getOutputStream()) { - workbook.write(out); - out.flush(); + workbook.write(out); // 写入文件 + out.flush(); // 刷新输出流 } finally { + // 关闭工作簿对象,释放资源 workbook.close(); } } - - /** - * 为指定列添加日期时间格式验证 - * - * @param sheet 工作表 - * @param columnIndex 需要验证日期时间格式的列索引 - */ - private static void addDateTimeValidation(Sheet sheet, int columnIndex) { - // 使用 Excel 的数据验证机制为指定列添加日期时间格式验证 - DataValidationHelper validationHelper = sheet.getDataValidationHelper(); - DataValidationConstraint constraint = validationHelper.createCustomConstraint( - "AND(ISNUMBER(" + CellReference.convertNumToColString(columnIndex) + "1), TEXT(" + CellReference.convertNumToColString(columnIndex) + "1, \"yyyy-mm-dd hh:mm:ss\")= " + - "\"yyyy-mm-dd\")"); - - CellRangeAddressList addressList = new CellRangeAddressList(1, sheet.getPhysicalNumberOfRows(), columnIndex, columnIndex); - DataValidation validation = validationHelper.createValidation(constraint, addressList); - - sheet.addValidationData(validation); - } - - // 修改下拉框验证方法,支持多选功能 private static void addDropdownValidation(Sheet sheet, int column, String[] options, boolean isMultiSelect) { DataValidationHelper validationHelper = sheet.getDataValidationHelper();