inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java
@@ -151,8 +151,7 @@ @ApiOperation(value = "è´¹ç¨ç»è®¡è·åæ»ä»·") @GetMapping("/costStatistics2") public Result<?> costStatistics2(@RequestBody Map<String, Object> data) throws Exception { CostStatisticsDto costStatisticsDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), CostStatisticsDto.class); public Result<?> costStatistics2( CostStatisticsDto costStatisticsDto) throws Exception { return Result.success(insOrderService.costStatistics2(costStatisticsDto)); } inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderPlanController.java
@@ -48,7 +48,7 @@ @ApiOperation(value = "导åºå§æè´¹ç¨") @GetMapping("/exportCommissionFees") public void exportCommissionFees(Map<String, Object> data,HttpServletResponse response) { public void exportCommissionFees(@RequestParam Map<String, Object> data,HttpServletResponse response) { insOrderPlanService.exportCommissionFees(data,response); } @@ -228,4 +228,4 @@ return Result.success(insOrderPlanService.getCurrentMonthPlanTotalBySonLaboratory(insOrderPlanCountDTO.getSonLaboratory(),insOrderPlanCountDTO.getStartTime(),insOrderPlanCountDTO.getEndTime())); } } } inspect-server/src/main/java/com/ruoyi/inspect/controller/InsUnPassController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,23 @@ package com.ruoyi.inspect.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.Result; import com.ruoyi.inspect.dto.UnPassPageDto; import com.ruoyi.inspect.service.InsUnPassService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @RestController @RequestMapping("/unPass") public class InsUnPassController { @Resource private InsUnPassService insUnPassService; @GetMapping("/pageInsUnPass") public Result selectUnPass(Page page, UnPassPageDto unPassPageDto) { return Result.success(insUnPassService.pageInsUnPass(page,unPassPageDto)); } } inspect-server/src/main/java/com/ruoyi/inspect/controller/ReportController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,60 @@ package com.ruoyi.inspect.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.Result; import com.ruoyi.inspect.service.InsOrderService; import com.ruoyi.inspect.service.ReportService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @AllArgsConstructor @RequestMapping("/report") @Api(tags = "æ¥è¡¨æ¨¡å") public class ReportController { private ReportService reportService; private InsOrderService insOrderService; @ApiOperation(value = "æ¥çæ ·åç¼ºé·ææ°") @PostMapping("/selectSampleDefects") public Result selectSampleDefects(Integer size, Integer current, String inspectionItems, String orderNumber) { return Result.success(insOrderService.selectSampleDefects(new Page<>(current, size),inspectionItems, orderNumber)); } @ApiOperation(value = "æ¥çæ¯æ¥ä¸å¡ç»è®¡") @GetMapping("/businessStatisticsByDay") public Result businessStatisticsByDay(){ return Result.success(reportService.businessStatisticsByDay()); } @ApiOperation(value = "æ¥çæ£æµé¡¹ç®ç»è®¡") @GetMapping("/testProductByDay") public Result testProductByDay(){ return Result.success(reportService.testProductByDay()); } @ApiOperation(value = "æ¥è¯¢æ¥åä»»å¡å¾") @GetMapping("/calendarWorkByWeek") public Result calendarWorkByWeek(){ return Result.success(reportService.calendarWorkByWeek()); } @ApiOperation(value = "æ·»å æ¥ç¨") @PostMapping("/addSchedule") public Result addSchedule(String time, String text){ return Result.success(reportService.addSchedule(time,text)); } @ApiOperation(value = "æ¥è¯¢æçæ¥ç¨") @PostMapping("/ScheduleByMe") public Result ScheduleByMe(String date){ return Result.success(reportService.ScheduleByMe(date)); } } inspect-server/src/main/java/com/ruoyi/inspect/controller/WarehouseController.java
@@ -20,7 +20,7 @@ private WarehouseService warehouseService; @PostMapping("/addWarehouse") @GetMapping("/addWarehouse") @ApiOperation("æ·»å ä»åº") public Result addWarehouse(String name) { return Result.success(warehouseService.addWarehouse(name)); @@ -99,4 +99,4 @@ return Result.success(warehouseService.searchSampleId(sampleCode)); } } } inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java
@@ -56,7 +56,7 @@ List<SampleProductDto2> selectSampleAndProductByOrderId(@Param("ew") QueryWrapper<SampleProductDto2> ew, @Param("id") Integer id); IPage<CostStatisticsDto> selectCostStatistics(IPage<CostStatisticsDto> page, QueryWrapper<CostStatisticsDto> ew, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("laboratory") String laboratory); IPage<CostStatisticsDto> selectCostStatistics(IPage<CostStatisticsDto> page,@Param("ew") QueryWrapper<CostStatisticsDto> ew, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("laboratory") String laboratory); List<CostStatisticsDto> selectCostStatistics2(@Param("ew") QueryWrapper<CostStatisticsDto> ew,@Param("startTime") String startTime, @Param("endTime") String endTime,@Param("laboratory") String laboratory); @@ -104,4 +104,4 @@ @Param("endTime") String endTime, @Param("checkName") String checkName ); } } inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsUnPassMapper.java
@@ -6,6 +6,7 @@ import com.ruoyi.inspect.dto.UnPassPageDto; import com.ruoyi.inspect.pojo.InsUnPass; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; /** * @author æ±ä½³å @@ -13,5 +14,5 @@ */ @Mapper public interface InsUnPassMapper extends BaseMapper<InsUnPass> { IPage<UnPassPageDto> pageInsUnPass(IPage<UnPassPageDto> page, QueryWrapper<UnPassPageDto> ew); } IPage<UnPassPageDto> pageInsUnPass(IPage<UnPassPageDto> page,@Param("ew") QueryWrapper<UnPassPageDto> ew); } inspect-server/src/main/java/com/ruoyi/inspect/mapper/ScheduleMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,11 @@ package com.ruoyi.inspect.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.inspect.pojo.Schedule; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; @Mapper @Repository public interface ScheduleMapper extends BaseMapper<Schedule> { } inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderService.java
@@ -39,7 +39,7 @@ void exportChecked(Map<String,Object> data, HttpServletResponse response); Map<String, Object> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto); IPage<CostStatisticsDto> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto); Map<String, Object> costStatistics2(CostStatisticsDto costStatisticsDto); inspect-server/src/main/java/com/ruoyi/inspect/service/ReportService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,23 @@ package com.ruoyi.inspect.service; import com.ruoyi.inspect.pojo.Schedule; import java.util.List; import java.util.Map; public interface ReportService { //æ¯æ¥ä¸å¡ç»è®¡ Map<String,Object> businessStatisticsByDay(); //æ£æµé¡¹ç®ç»è®¡ Map<String,Object> testProductByDay(); //é¦é¡µ-->æ¥åä»»å¡å¾ Map<String,Object> calendarWorkByWeek(); //é¦é¡µ-->æ·»å æ¥ç¨ int addSchedule(String time, String text); //é¦é¡µ-->æçæ¥ç¨ List<Schedule> ScheduleByMe(String date); } inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -462,7 +462,10 @@ dateTimeFormatter),LocalTime.of(23, 59, 59) ).toString(); // è·åæ°æ® String company = data.get("company").toString(); String company = ""; if(data.containsKey("company")) { company = data.get("company").toString(); } List<CommissionFeesDto> list = insOrderMapper.selectCommissionFees(laboratory,company, start, end); list = list.stream().map(dto -> { Set<String> uniqueTags = new HashSet<>(); inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
@@ -1858,16 +1858,12 @@ @Override public Map<String, Object> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto) { public IPage<CostStatisticsDto> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto) { String dates = costStatisticsDto.getDates(); String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); costStatisticsDto.setDates(null); Map<String, Object> map = new HashMap<>(); // map.put("head", PrintChina.printChina(CostStatisticsDto.class)); Map<String, Integer> map1 = new HashMap<>(); if (map1.get("look") == 1) costStatisticsDto.setCreateUser(map1.get("userId")); // è·åå½å人æå¨å®éªå®¤ Integer userId = 1; Integer userId = Integer.parseInt(SecurityUtils.getLoginUser().getUser().getUserId().toString()); String departLimsId = userMapper.selectById(userId).getDepartLimsId(); String laboratory = ""; if (StringUtils.isNotBlank(departLimsId)) { @@ -1894,8 +1890,7 @@ return dto; }).collect(Collectors.toList()); dtoIPage.setRecords(collect); map.put("body", dtoIPage); return map; return dtoIPage; } @Override inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsUnPassServiceImpl.java
@@ -26,9 +26,6 @@ @Override public IPage<UnPassPageDto> pageInsUnPass(Page page, UnPassPageDto unPassPageDto) { Map<String, Object> map = new HashMap<>(); // Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("pageInsUnPass"); // if (map1.get("look") == 1) unPassPageDto.setCreateUser(map1.get("userId")); return insUnPassMapper.pageInsUnPass(page, QueryWrappers.queryWrappers(unPassPageDto)); } } } inspect-server/src/main/java/com/ruoyi/inspect/service/impl/ReportServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,288 @@ package com.ruoyi.inspect.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.entity.User; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.inspect.dto.CostStatisticsDto; import com.ruoyi.inspect.mapper.InsOrderMapper; import com.ruoyi.inspect.mapper.InsProductMapper; import com.ruoyi.inspect.mapper.InsProductUserMapper; import com.ruoyi.inspect.mapper.ScheduleMapper; import com.ruoyi.inspect.pojo.InsOrder; import com.ruoyi.inspect.pojo.InsProduct; import com.ruoyi.inspect.pojo.InsProductUser; import com.ruoyi.inspect.pojo.Schedule; import com.ruoyi.inspect.service.ReportService; import com.ruoyi.system.mapper.UserMapper; import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; @Service @AllArgsConstructor public class ReportServiceImpl implements ReportService { private InsOrderMapper insOrderMapper; private InsProductUserMapper insProductUserMapper; private InsProductMapper insProductMapper; private ScheduleMapper scheduleMapper; private UserMapper userMapper; //æ¯æ¥ä¸å¡ç»è®¡ @Override public Map<String, Object> businessStatisticsByDay() { Map<String, Object> map = new HashMap<>(); /*任塿¥æ¶*/ //仿¥ä»»å¡æ¥æ¶ Long receive = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getState, 1).apply("DATE(create_time) = CURDATE()")); map.put("RECEIVE", receive); //æ¨æ¥ä»»å¡æ¥æ¶ Long received = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getState, 1).apply("DATE(create_time) = CURDATE() - INTERVAL 1 DAY")); //æ¯ä¾=(ä»å¤©-æ¨å¤©)/æ¨å¤© BigDecimal ratio = new BigDecimal(receive - received).divide(new BigDecimal(received == 0 ? 1 : received), 2, BigDecimal.ROUND_HALF_UP); map.put("RECEIVE_RATIO", ratio); /*ä»»å¡å·²å®æ*/ //仿¥ä»»å¡å®æ Long finishe = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getState, 4).apply("DATE(create_time) = CURDATE()")); map.put("FINISHE", finishe); //æ¨æ¥ä»»å¡å®æ Long finished = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getState, 4).apply("DATE(create_time) = CURDATE() - INTERVAL 1 DAY")); //ä»»å¡å®ææ¯ä¾=(ä»å¤©-æ¨å¤©)/æ¨å¤© BigDecimal finishedRatio = new BigDecimal(finishe - finished).divide(new BigDecimal(finished == 0 ? 1 : finished), 2, BigDecimal.ROUND_HALF_UP); map.put("FINISHE_RATIO", finishedRatio); /*ä»»å¡å©ä½*/ //仿¥ä»»å¡å©ä½ long surplus = receive - finishe; map.put("SURPLUS", surplus); //æ¨æ¥ä»»å¡å©ä½ long surplused = received - finished; //å©ä½æ¯ä¾=(ä»å¤©-æ¨å¤©)/æ¨å¤© BigDecimal surplusRatio = new BigDecimal(surplus - surplused).divide(new BigDecimal(surplused == 0 ? 1 : surplused), 2, BigDecimal.ROUND_HALF_UP); map.put("SURPLUS_RATIO", surplusRatio); LocalDate today = LocalDate.now(); LocalTime end = LocalTime.of(23, 59, 59); // è·åå½å人æå¨å®éªå®¤ Integer userId = Integer.parseInt(SecurityUtils.getUserId().toString()); String departLimsId = userMapper.selectById(userId).getDepartLimsId(); String laboratory = ""; if(StringUtils.isNotBlank(departLimsId)) { String[] split = departLimsId.split(","); for (String s : split) { if (StringUtils.isNotBlank(s) && (!Arrays.asList("1","22").contains(s))) { laboratory = insOrderMapper.getDepartment(Integer.parseInt(s)); } } } /*æ£æµè´¹ç¨*/ //仿¥æ£æµè´¹ç¨ QueryWrapper<CostStatisticsDto> costStatisticsDtoQueryWrappers = new QueryWrapper<>(); costStatisticsDtoQueryWrappers.eq("create_time", LocalDateTime.now()); IPage<CostStatisticsDto> page = new Page<>(); page.setSize(-1); page.setCurrent(-1); IPage<CostStatisticsDto> iPage = insOrderMapper.selectCostStatistics(page, costStatisticsDtoQueryWrappers,LocalDate.now().atStartOfDay().toString(),today.atTime(end).toString(),laboratory); BigDecimal price = BigDecimal.ZERO; for (CostStatisticsDto record : iPage.getRecords()) { price.add(record.getPrice()); } map.put("PRICE", price); //æ¨æ¥æ£æµè´¹ç¨ QueryWrapper<CostStatisticsDto> costWrappers = new QueryWrapper<>(); costWrappers.eq("create_time", LocalDateTime.now().minusDays(1)); IPage<CostStatisticsDto> dtoIPage = insOrderMapper.selectCostStatistics(page, costWrappers,LocalDate.now().atStartOfDay().toString(),today.atTime(end).toString(),laboratory); BigDecimal priced = BigDecimal.ZERO; for (CostStatisticsDto record : dtoIPage.getRecords()) { priced.add(record.getPrice()); } //æ¯ä¾=(仿¥-æ¨æ¥)/æ¨æ¥ BigDecimal priceRatio = (price.subtract(priced)).divide(priced.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ONE : priced, 2, BigDecimal.ROUND_HALF_UP); map.put("PRICE_RATIO", priceRatio); /*æ£æµå·¥æ¶*/ //仿¥æ£æµå·¥æ¶ Double cost = 0.0; for (CostStatisticsDto record : iPage.getRecords()) { cost += record.getCost(); } map.put("COST", cost); //æ¨æ¥æ£æµå·¥æ¶ Double costed = 0.0; for (CostStatisticsDto record : dtoIPage.getRecords()) { costed += record.getCost(); } //æ¯ä¾=(仿¥-æ¨æ¥)/æ¨æ¥ BigDecimal costRatio = new BigDecimal(cost - costed).divide(new BigDecimal(costed == 0 ? 1 : costed), 2, BigDecimal.ROUND_HALF_UP); map.put("COST_RATIO", costRatio); /*æ£æµäººå*/ //仿¥æ£æµäººå List<InsProductUser> insProductUsers = insProductUserMapper.selectList(Wrappers.<InsProductUser>lambdaQuery().apply("DATE(create_time) = CURDATE()")); long person = insProductUsers.stream().map(InsProductUser::getCreateUser).distinct().count(); map.put("PERSON", person); //æ¨æ¥æ£æµäººå List<InsProductUser> insProductUserss = insProductUserMapper.selectList(Wrappers.<InsProductUser>lambdaQuery().apply("DATE(create_time) = CURDATE() - INTERVAL 1 DAY")); long persons = insProductUserss.stream().map(InsProductUser::getCreateUser).distinct().count(); //æ¯ä¾=(ä»å¤©-æ¨å¤©)/æ¨å¤© BigDecimal personRatio = new BigDecimal(person - persons).divide(new BigDecimal(persons == 0 ? 1 : persons), 2, BigDecimal.ROUND_HALF_UP); map.put("PERSON_RATIO", personRatio); /*è¿åæ¥ä»»å¡æ¥æ¶éä¸å®æé*/ //è·åè¿åæ¥çæ¨ªåæ LocalDate currentDate = LocalDate.now(); List<LocalDate> lastTenDays = new ArrayList<>(); List<Long> receTenDays = new ArrayList<>(); List<Long> finTenDays = new ArrayList<>(); for (int i = 9; i > -1; i--) { lastTenDays.add(currentDate.minusDays(i)); receTenDays.add(insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getState, 1).apply("DATE(create_time) = CURDATE() - INTERVAL " + i + " DAY"))); finTenDays.add(insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getState, 4).apply("DATE(create_time) = CURDATE() - INTERVAL " + i + " DAY"))); } map.put("DAYS", lastTenDays); map.put("RECETENDAYS", receTenDays); map.put("FINISHTENDAYS", finTenDays); return map; } //æ£æµé¡¹ç®ç»è®¡ @Override public Map<String, Object> testProductByDay() { Map<String, Object> map = new HashMap<>(); /*é¡¹ç®æ¥æ¶*/ //仿¥é¡¹ç®æ¥æ¶é Long receive = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getState, 1).apply("DATE(create_time) = CURDATE()")); map.put("RECEVICE", receive); //æ¨æ¥é¡¹ç®æ¥æ¶é Long received = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getState, 1).apply("DATE(create_time) = CURDATE() - INTERVAL 1 DAY")); //æ¯ä¾=(ä»å¤©-æ¨å¤©)/æ¨å¤© BigDecimal ratio = new BigDecimal(receive - received).divide(new BigDecimal(received == 0 ? 1 : received), 2, BigDecimal.ROUND_HALF_UP); map.put("RECEIVE_RATIO", ratio); /*项ç®å®æ*/ //仿¥é¡¹ç®å®æé Long finishe = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getState, 1).isNotNull(InsProduct::getInsResult).apply("DATE(create_time) = CURDATE()")); map.put("FINISHE", finishe); //æ¨æ¥é¡¹ç®å®æé Long finished = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getState, 1).isNotNull(InsProduct::getInsResult).apply("DATE(create_time) = CURDATE() - INTERVAL 1 DAY")); //ä»»å¡å®ææ¯ä¾=(ä»å¤©-æ¨å¤©)/æ¨å¤© BigDecimal finishedRatio = new BigDecimal(finishe - finished).divide(new BigDecimal(finished == 0 ? 1 : finished), 2, BigDecimal.ROUND_HALF_UP); map.put("FINISHE_RATIO", finishedRatio); /*项ç®å©ä½*/ //仿¥é¡¹ç®å©ä½é long surplus = receive - finishe; map.put("SURPLUS", surplus); //æ¨æ¥é¡¹ç®å©ä½ long surplused = received - finished; //å©ä½æ¯ä¾=(ä»å¤©-æ¨å¤©)/æ¨å¤© BigDecimal surplusRatio = new BigDecimal(surplus - surplused).divide(new BigDecimal(surplused == 0 ? 1 : surplused), 2, BigDecimal.ROUND_HALF_UP); map.put("SURPLUS_RATIO", surplusRatio); /*仿¥é¡¹ç®åæ ¼ç*/ //仿¥å®æéä¸çåæ ¼é/仿¥å®æé Long accept = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getState, 1).eq(InsProduct::getInsResult,1).apply("DATE(create_time) = CURDATE()")); map.put("ACCEPT", accept); BigDecimal acceptRate = new BigDecimal(accept).divide(new BigDecimal(finishe == 0 ? 1 : finishe), 2, BigDecimal.ROUND_HALF_UP); map.put("ACCEPT_RATE_TODAY", acceptRate); /*仿¥é¡¹ç®å®æç*/ //仿¥å®æé/仿¥æ¥æ¶é BigDecimal finishRate = new BigDecimal(finishe).divide(new BigDecimal(receive == 0 ? 1 : receive), 2, BigDecimal.ROUND_HALF_UP); map.put("FINISH_RATE_TODAY", finishRate); /*仿¥é¡¹ç®å»¶æç*/ //仿¥é¡¹ç®å©ä½/仿¥é¡¹ç®æ¥æ¶é BigDecimal delayRate = new BigDecimal(surplus).divide(new BigDecimal(received == 0 ? 1 : received), 2, BigDecimal.ROUND_HALF_UP); map.put("DELAY_RATE_TODAY", delayRate); /*è¿åæ¥çé¡¹ç®æ¥æ¶éä¸å®æé*/ //è·åè¿åæ¥çæ¨ªåæ LocalDate currentDate = LocalDate.now(); List<LocalDate> lastTenDays = new ArrayList<>(); List<Long> receTenDays = new ArrayList<>(); List<Long> finTenDays = new ArrayList<>(); for (int i = 9; i > -1; i--) { lastTenDays.add(currentDate.minusDays(i)); receTenDays.add(insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getState, 1).apply("DATE(create_time) = CURDATE() - INTERVAL " + i + " DAY"))); finTenDays.add(insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getState, 1).isNotNull(InsProduct::getInsResult).apply("DATE(create_time) = CURDATE() - INTERVAL " + i + " DAY"))); } map.put("DAYS", lastTenDays); map.put("RECETENDAYS", receTenDays); map.put("FINISHTENDAYS", finTenDays); return map; } //é¦é¡µ-->æ¥åä»»å¡å¾ @Override public Map<String, Object> calendarWorkByWeek() { Map<String, Object> map = new HashMap<>(); List<Integer> insState = new ArrayList<>(); insState.add(0); insState.add(1); /*è·ååä¸å¨æ¥æ*/ LocalDate currentDate = LocalDate.now(); List<LocalDate> weekDays = new ArrayList<>(); for (int i = 6, j = 0; i >= 0; i--, j++) { weekDays.add(currentDate.minusDays(i)); //æ¥è¯¢å½å¤©éè¦æ£æµçå§æè®¢å List<InsOrder> insOrders = insOrderMapper.selectList(Wrappers.<InsOrder>lambdaQuery() .eq(InsOrder::getState, 1) .in(InsOrder::getInsState, insState) .apply("DATE(create_time) = CURDATE() - INTERVAL " + j + " DAY")); List<Map<String, Object>> works = insOrders.stream().map(insOrder -> { HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("text", insOrder.getEntrustCode()); hashMap.put("type", insOrder.getType()); User user = userMapper.selectById(insOrder.getCreateUser()); hashMap.put("name", user.getName()); return hashMap; }).collect(Collectors.toList()); map.put("work" + i, works); } map.put("weekDays", weekDays); return map; } //é¦é¡µ-->æ·»å æ¥ç¨ @Override public int addSchedule(String time, String text) { //è·åå½åç¨æ·id Integer userId = Integer.parseInt(SecurityUtils.getUserId().toString()); Schedule schedule = new Schedule(); schedule.setUserId(userId); schedule.setScheduleTime(LocalDateTime.parse(time, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); schedule.setText(text); return scheduleMapper.insert(schedule); } //é¦é¡µ-->æçæ¥ç¨ @Override public List<Schedule> ScheduleByMe(String date) { //è·åå½åç¨æ·id Integer userId = Integer.parseInt(SecurityUtils.getUserId().toString()); LocalDate localDate = LocalDate.parse(date, DateTimeFormatter.ofPattern("yyyy-MM-dd")); LocalDateTime startTime = localDate.atStartOfDay(); LocalDateTime endTime = localDate.plusDays(1).atStartOfDay().minusSeconds(1); return scheduleMapper.selectList(Wrappers.<Schedule>lambdaQuery().eq(Schedule::getUserId, userId).between(Schedule::getScheduleTime, startTime, endTime)); } } inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -594,9 +594,6 @@ A.company, A.`name` )B <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> ${ew.customSqlSegment} </if> </select> <select id="selectDeviceList" resultType="com.ruoyi.inspect.vo.DeviceVO"> select @@ -855,105 +852,6 @@ <select id="selectCommissionFees" resultType="com.ruoyi.inspect.dto.CommissionFeesDto"> <!-- SELECT--> <!-- date_format(create_time, '%Y-%m-%d') AS create_time,--> <!-- entrust_code,--> <!-- sample_name,--> <!-- sample_model,--> <!-- sample_num,--> <!-- ins_item,--> <!-- production,--> <!-- company,--> <!-- custom,--> <!-- engineering,--> <!-- total_price--> <!-- FROM--> <!-- (--> <!-- SELECT--> <!-- io.*,--> <!-- sample_counts.sample_num,--> <!-- GROUP_CONCAT( DISTINCT isa.sample SEPARATOR 'ã' ) AS sample_name,--> <!-- GROUP_CONCAT( DISTINCT isa.model SEPARATOR 'ã' ) AS sample_model,--> <!-- total_product_counts.ins_item,--> <!-- total_price--> <!-- FROM--> <!-- ins_order io--> <!-- LEFT JOIN ins_sample isa ON io.id = isa.ins_order_id--> <!-- LEFT JOIN ins_sample_user isau ON isau.ins_sample_id = io.id--> <!-- LEFT JOIN ins_order_state iot ON iot.ins_order_id = io.id--> <!-- LEFT JOIN ins_report ir ON io.id = ir.ins_order_id--> <!-- AND ir.is_ratify = 1--> <!-- LEFT JOIN USER u ON io.create_user = u.id--> <!-- LEFT JOIN (--> <!-- SELECT--> <!-- ins_order_id,--> <!-- COUNT(*) AS sample_num--> <!-- FROM--> <!-- ins_sample--> <!-- WHERE--> <!-- id IN (--> <!-- SELECT--> <!-- id1--> <!-- FROM--> <!-- (--> <!-- SELECT--> <!-- is2.id id1,--> <!-- ip.id--> <!-- FROM--> <!-- ins_sample is2--> <!-- LEFT JOIN ins_product ip ON is2.id = ip.ins_sample_id--> <!-- WHERE--> <!-- ip.id IS NOT NULL--> <!-- ) s--> <!-- )--> <!-- GROUP BY--> <!-- ins_order_id--> <!-- ) sample_counts ON io.id = sample_counts.ins_order_id--> <!-- LEFT JOIN (--> <!-- SELECT--> <!-- SUM( price ) AS total_price,--> <!-- sample_id,--> <!-- ins_order_id,--> <!-- man_hour_group,--> <!-- ins_item--> <!-- FROM--> <!-- (--> <!-- SELECT--> <!-- ins_sample.id AS sample_id,--> <!-- ins_sample.ins_order_id,--> <!-- ins_product.man_hour_group,--> <!-- GROUP_CONCAT( DISTINCT inspection_item SEPARATOR ',' ) AS ins_item,--> <!-- price--> <!-- FROM--> <!-- ins_product--> <!-- JOIN ins_sample ON ins_product.ins_sample_id = ins_sample.id--> <!-- WHERE--> <!-- ins_product.state = 1--> <!-- GROUP BY--> <!-- ins_sample.ins_order_id,--> <!-- ins_sample.id,--> <!-- ins_product.man_hour_group--> <!-- ) b--> <!-- GROUP BY--> <!-- ins_order_id--> <!-- ) total_product_counts ON io.id = total_product_counts.ins_order_id--> <!-- WHERE--> <!-- <if test="laboratory!=null and laboratory!=''">--> <!-- io.laboratory=#{laboratory} AND--> <!-- </if>--> <!-- io.create_time between #{startTime} and #{endTime}--> <!-- AND--> <!-- io.state NOT IN ( 0, 2, 3 )--> <!-- GROUP BY--> <!-- io.id,--> <!-- type--> <!-- ORDER BY--> <!-- type DESC,--> <!-- io.id DESC--> <!-- ) a--> SELECT A.entrust_code, A.engineering, @@ -1086,8 +984,8 @@ group by io.entrust_code order by send_time desc </select> <select id="getTasksShow" resultType="com.ruoyi.inspect.dto.TasksShowDto"> SELECT io.entrust_code, @@ -1141,7 +1039,7 @@ LEFT JOIN `user` u ON ips.update_user = u.id WHERE io.entrust_code IS NOT NULL AND u.state = 1 AND u.status = 0 AND io.state in (1,4) AND IFNULL(ir.is_ratify,-1) != 1 AND ios.laboratory = #{sonLaboratory}