| | |
| | | private Integer insFibersId; |
| | | |
| | | private Integer standardMethodListId; |
| | | |
| | | //返回的20度常温的计算值(温度循环) |
| | | @TableField(exist = false ,select = false) |
| | | private String complue; |
| | | } |
| | |
| | | public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(InsOrderPlanVO.class)); |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null); |
| | | Integer userId = map1.get("userId"); |
| | | if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) { |
| | | Integer userId = null; |
| | | if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId()) ) { |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null); |
| | | userId = map1.get("userId"); |
| | | insOrderPlanDTO.setUserId(userId.longValue()); |
| | | } |
| | | IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId); |
| | |
| | | List<String> collect = new ArrayList<>(); |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId).select(InsSample::getId)); |
| | | List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList()); |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, ids).eq(InsProduct::getSonLaboratory, laboratory).eq(InsProduct::getState, 1).eq(InsProduct::getInsResult, 0)); |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .in(InsProduct::getInsSampleId, ids) |
| | | .eq(InsProduct::getSonLaboratory, laboratory) |
| | | .eq(InsProduct::getState, 1) |
| | | .eq(InsProduct::getInsResult, 0)); |
| | | if (insProducts.size() > 0) { |
| | | collect = insProducts.stream().map(insProduct -> { |
| | | return insProduct.getInspectionItem() + "-" + insProduct.getInspectionItemSubclass(); |
| | |
| | | if (ObjectUtils.isNotEmpty(insProductResult)) { |
| | | insProduct.setInsProductResult(insProductResult); |
| | | } |
| | | //求同等条件下1次循环20度常温的计算值 |
| | | InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId,insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId,sampleId) |
| | | .eq(InsProduct::getInspectionItem, "1") |
| | | .eq(InsProduct::getInspectionItemSubclass, "20℃(常温)") |
| | | .eq(InsProduct::getInspectionItemClass, insProduct.getInspectionItemClass()) |
| | | .eq(InsProduct::getInsFiberId, fiber.getId())).getId() )); |
| | | if (!insProductResult1.getComValue().equals("[]")) { |
| | | insProduct.setComplue(insProductResult1.getComValue().split(":")[1].split("\"")[1]); |
| | | } |
| | | productVo.setInsProduct(insProduct); |
| | | productVos.add(productVo); |
| | | } |
| | |
| | | productVo.setColor(fiber.getColor()); |
| | | productVo.setBushColor(fiber.getBushColor()); |
| | | insProduct.setInsProductResult(insProductResult); |
| | | //求同等条件下1次循环20度常温的计算值 |
| | | InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId,insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId,sampleId) |
| | | .eq(InsProduct::getInspectionItem, "1") |
| | | .eq(InsProduct::getInspectionItemSubclass, "20℃(常温)") |
| | | .eq(InsProduct::getInspectionItemClass, insProduct.getInspectionItemClass()) |
| | | .eq(InsProduct::getInsFiberId, fiber.getId())).getId() )); |
| | | if (!insProductResult1.getComValue().equals("[]")) { |
| | | insProduct.setComplue(insProductResult1.getComValue().split(":")[1].split("\"")[1]); |
| | | } |
| | | productVo.setInsProduct(insProduct); |
| | | productVos.add(productVo); |
| | | } |
| | |
| | | JSONObject insValue = JSON.parseObject(JSON.toJSONString(o)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("v", JSON.parseObject(JSON.toJSONString(insValue.get("v"))).get("v")); |
| | | map.put("r", JSON.toJSONString(insValue.get("r"))); |
| | | map.put("c", JSON.toJSONString(insValue.get("c"))); |
| | | try { |
| | | if ((insValue.get("u") == null || insValue.get("u").equals("")) && StrUtil.isNotEmpty(JSON.parseObject(JSON.toJSONString(insValue.get("v"))).get("v").toString())) { |
| | | map.put("u", userId + ""); |
| | |
| | | map2.put(product.getTemplateId(), standardTemplateService.getStandTempThingById(product.getTemplateId()) + ""); |
| | | thing = map2.get(product.getTemplateId()); |
| | | } |
| | | // thing = map2.get(product.getTemplateId()); |
| | | if (StrUtil.isNotEmpty(thing)) { |
| | | JSONObject sheet = JSON.parseObject(JSON.toJSONString(JSON.parseArray(JSON.toJSONString(JSON.parseObject(thing).get("data"))).get(0))); |
| | | JSONObject config = JSON.parseObject(JSON.toJSONString(sheet.get("config"))); |
| | |
| | | public int submitPlan(Integer orderId, String laboratory, Integer verifyUser) { |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId).select(InsSample::getId)); |
| | | List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList()); |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, ids).eq(InsProduct::getSonLaboratory, laboratory).eq(InsProduct::getState, 1).isNull(InsProduct::getInsResult).isNull(InsProduct::getInsFiberId).isNull(InsProduct::getInsFibersId)); |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .in(InsProduct::getInsSampleId, ids) |
| | | .eq(InsProduct::getSonLaboratory, laboratory) |
| | | .eq(InsProduct::getState, 1) |
| | | .isNull(InsProduct::getInsResult) |
| | | .isNull(InsProduct::getInsFiberId) |
| | | .isNull(InsProduct::getInsFibersId)); |
| | | insProducts.addAll(insProductMapper.selectFiberInsProduct(ids, laboratory)); |
| | | if (insProducts.size() > 0) { |
| | | String str = ""; |
| | |
| | | map.put("head", PrintChina.printChina(CostStatisticsDto.class)); |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("costStatistics"); |
| | | if (map1.get("look") == 1) costStatisticsDto.setCreateUser(map1.get("userId")); |
| | | IPage<CostStatisticsDto> costStatisticsDtoIPage = insOrderMapper.selectCostStatistics(page, QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); |
| | | List<CostStatisticsDto> costStatisticsDtoList = costStatisticsDtoIPage.getRecords(); |
| | | for (CostStatisticsDto statisticsDto : costStatisticsDtoList) { |
| | | statisticsDto.setNum(1); |
| | | } |
| | | List<CostStatisticsDto> costStatisticsDtoList1 = deduplicateAndSumCounts(costStatisticsDtoList); |
| | | costStatisticsDtoIPage.setRecords(costStatisticsDtoList1); |
| | | map.put("body", costStatisticsDtoIPage); |
| | | map.put("body",insOrderMapper.selectCostStatistics(page, QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59"))); |
| | | return map; |
| | | } |
| | | private static List<CostStatisticsDto> deduplicateAndSumCounts(List<CostStatisticsDto> list) { |
| | | // 使用一个 Map 来存放已经出现过的 inspectionItem + entrustCode + sample 的组合 |
| | | Map<String, CostStatisticsDto> map = new HashMap<>(); |
| | | // 遍历列表进行去重和计数 |
| | | for (CostStatisticsDto dto : list) { |
| | | String key = dto.getInspectionItem() + dto.getEntrustCode() + dto.getSample(); |
| | | if (map.containsKey(key)) { |
| | | // 如果已经存在,则累加数量 |
| | | CostStatisticsDto existingDto = map.get(key); |
| | | existingDto.setNum(existingDto.getNum() + dto.getNum()); |
| | | existingDto.setPrice(existingDto.getPrice().add(dto.getPrice())); |
| | | } else { |
| | | // 如果不存在,则放入 Map 中 |
| | | map.put(key, dto); |
| | | } |
| | | } |
| | | // 将 Map 中的值转为 List 返回 |
| | | return new ArrayList<>(map.values()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | costStatisticsDto.setDates(null); |
| | | List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); |
| | | double totalPrice = costStatisticsDtos.stream() |
| | | .filter(distinctByKey(dto -> Arrays.asList(dto.getEntrustCode(), dto.getSample(), dto.getCost()))) |
| | | .filter(dto -> dto.getPrice() != null) // 过滤掉价格为 null 的对象 |
| | | .mapToDouble(value -> value.getPrice().doubleValue()) |
| | | .mapToDouble(value -> value.getPrice().doubleValue()*value.getNum()) |
| | | .sum(); |
| | | map.put("total", totalPrice); |
| | | return map; |
| | | } |
| | | public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) { |
| | | Map<Object, Boolean> seen = new ConcurrentHashMap<>(); |
| | | return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @ValueTableShow(value = 5,name = "状态") |
| | | private String insState; |
| | | |
| | | @ValueTableShow(value = 5,name = "负责人") |
| | | private String userName; |
| | | |
| | | private Integer userId; |
| | | |
| | | @ValueTableShow(value = 8,name = "检验开始时间") |
| | | private String insTime; |
| | | |
| | |
| | | @ValueTableShow(value = 8,name = "理由") |
| | | private String verifyTell; |
| | | |
| | | private Integer userId; |
| | | |
| | | private String sonLaboratory; |
| | | |
| | |
| | | </select> |
| | | <select id="selectCostStatistics" resultType="com.yuanchu.mom.dto.CostStatisticsDto"> |
| | | select * from ( |
| | | SELECT |
| | | <!--SELECT |
| | | i.id, |
| | | i.entrust_code, |
| | | i.create_time, |
| | |
| | | SEPARATOR ',') inspection_item2 from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | BY b.ins_sample_id) c ON c.ins_sample_id = isa.id |
| | | where (i.state = 1 or i.state = 3 or i.state = 4) |
| | | ) a |
| | | ) a--> |
| | | SELECT A.id, |
| | | A.entrust_code, |
| | | A.create_time, |
| | | A.sample, |
| | | A.model, |
| | | A.inspection_item, |
| | | A.company, |
| | | A.`name`, |
| | | COUNT(1) num, |
| | | SUM(A.price) price, |
| | | SUM(A.cost) cost |
| | | FROM |
| | | (SELECT |
| | | i.id, |
| | | i.entrust_code, |
| | | i.create_time, |
| | | isa.sample, |
| | | isa.sample_code, |
| | | isa.model, |
| | | c.price, |
| | | c.cost, |
| | | c.inspection_item, |
| | | cus.company, |
| | | u.`name`, |
| | | i.create_user, |
| | | c.ins_sample_id |
| | | FROM |
| | | ins_order i |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id |
| | | LEFT JOIN `user` u ON u.id = i.user_id |
| | | left join custom cus on cus.id = u.company |
| | | LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id, |
| | | GROUP_CONCAT(b.inspection_item2 |
| | | SEPARATOR ',') |
| | | inspection_item from (select * , |
| | | GROUP_CONCAT(CONCAT(inspection_item,'',inspection_item_subclass) SEPARATOR ',')inspection_item2 from ins_product where state = 1 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | BY b.ins_sample_id) c ON c.ins_sample_id = isa.id |
| | | where (i.state = 1 or i.state = 3 or i.state = 4) and c.ins_sample_id IS not NULL)A |
| | | GROUP BY |
| | | A.id, |
| | | A.entrust_code, |
| | | A.create_time, |
| | | A.sample, |
| | | A.model, |
| | | A.inspection_item, |
| | | A.company, |
| | | A.`name` |
| | | ) B |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | |
| | | |
| | | <select id="selectCostStatistics2" resultType="com.yuanchu.mom.dto.CostStatisticsDto"> |
| | | select * from ( |
| | | SELECT |
| | | <!--SELECT |
| | | i.id, |
| | | i.entrust_code, |
| | | i.create_time, |
| | |
| | | SEPARATOR ',') inspection_item2 from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | BY b.ins_sample_id) c ON c.ins_sample_id = isa.id |
| | | where (i.state = 1 or i.state = 3 or i.state = 4) |
| | | ) a |
| | | ) a--> |
| | | SELECT A.id, |
| | | A.entrust_code, |
| | | A.create_time, |
| | | A.sample, |
| | | A.model, |
| | | A.inspection_item, |
| | | A.company, |
| | | A.`name`, |
| | | COUNT(1) num, |
| | | SUM(A.price) price, |
| | | SUM(A.cost) cost |
| | | FROM |
| | | (SELECT |
| | | i.id, |
| | | i.entrust_code, |
| | | i.create_time, |
| | | isa.sample, |
| | | isa.sample_code, |
| | | isa.model, |
| | | c.price, |
| | | c.cost, |
| | | c.inspection_item, |
| | | cus.company, |
| | | u.`name`, |
| | | i.create_user, |
| | | c.ins_sample_id |
| | | FROM |
| | | ins_order i |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id |
| | | LEFT JOIN `user` u ON u.id = i.user_id |
| | | left join custom cus on cus.id = u.company |
| | | LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id, |
| | | GROUP_CONCAT(b.inspection_item2 |
| | | SEPARATOR ',') |
| | | inspection_item from (select * , |
| | | GROUP_CONCAT(CONCAT(inspection_item,'',inspection_item_subclass) SEPARATOR ',')inspection_item2 from ins_product where state = 1 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | BY b.ins_sample_id) c ON c.ins_sample_id = isa.id |
| | | where (i.state = 1 or i.state = 3 or i.state = 4) and c.ins_sample_id IS not NULL)A |
| | | GROUP BY |
| | | A.id, |
| | | A.entrust_code, |
| | | A.create_time, |
| | | A.sample, |
| | | A.model, |
| | | A.inspection_item, |
| | | A.company, |
| | | A.`name` |
| | | ORDER BY |
| | | A.id, |
| | | A.entrust_code, |
| | | A.create_time, |
| | | A.sample, |
| | | A.model, |
| | | A.inspection_item, |
| | | A.company, |
| | | A.`name`) B |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | |
| | | <select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO"> |
| | | select * from(select * from( |
| | | SELECT |
| | | a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id,(ios.verify_user = #{userId}) verify_user |
| | | a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id,<!--(ios.verify_user = #{userId})--> verify_user |
| | | FROM |
| | | ( |
| | | SELECT |
| | |
| | | io.send_time, |
| | | group_concat(distinct isa.sample,' ') sample, |
| | | isu.user_id, |
| | | user.name userName, |
| | | ip.son_laboratory, |
| | | io.ins_time |
| | | FROM |
| | | ins_order io |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id |
| | | LEFT JOIN ( SELECT * FROM ins_sample_user GROUP BY ins_sample_id, user_id ) isu ON isu.ins_sample_id = io.id |
| | | LEFT JOIN ( <!--SELECT * FROM ins_sample_user GROUP BY ins_sample_id, user_id --> |
| | | SELECT * |
| | | FROM ins_sample_user u |
| | | WHERE (ins_sample_id, id) IN ( |
| | | SELECT ins_sample_id, MAX(id) |
| | | FROM ins_sample_user |
| | | GROUP BY ins_sample_id |
| | | ) |
| | | ORDER BY ins_sample_id, id |
| | | ) isu ON isu.ins_sample_id = io.id |
| | | LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id |
| | | LEFT JOIN user ON isu.user_id = user.id |
| | | WHERE |
| | | io.state = 1 |
| | | # AND io.ins_state != 5 |
| | | and send_time is not null |
| | | and (isu.user_id = #{userId} OR isu.user_id is NULL) |
| | | <if test="userId !=null and userId!=''"> |
| | | and (isu.user_id = #{userId} OR isu.user_id is NULL ) |
| | | </if> |
| | | OR isu.user_id is NULL |
| | | |
| | | GROUP BY |
| | | ip.son_laboratory, |
| | | io.id |
| | | ) a |
| | | LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory |
| | | left join (SELECT td.user_id order_user_id, td.ins_sample_id FROM ins_sample_user td,(SELECT max(id) id FROM |
| | | ins_sample_user GROUP BY ins_sample_id) md where td.id = md.id and user_id = #{userId}) isu2 on |
| | | ins_sample_user GROUP BY ins_sample_id) md where td.id = md.id |
| | | <if test="userId !=null and userId!=''"> |
| | | and user_id = #{userId} OR user_id is NULL |
| | | </if> |
| | | OR user_id is NULL |
| | | ) isu2 on |
| | | isu2.ins_sample_id = a.id |
| | | ORDER BY |
| | | a.user_id DESC, |
| | | <!--a.user_id DESC,--> |
| | | a.type DESC, |
| | | a.id |
| | | ) b |
| | |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | if (ObjectUtils.isNotEmpty(dates) && ObjectUtils.isNotEmpty(week)) { |
| | | String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | String[] weeks = week.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | map.put("body", auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, |
| | | IPage<AuxiliaryOutputWorkingHoursDto> auxiliaryOutputWorkingHoursDtoIPage = auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, |
| | | QueryWrappers.queryWrappers(auxiliaryOutputWorkingHoursDto) |
| | | .ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59") |
| | | .ge("week", weeks[0]).le("week", weeks[1]), ids)); |
| | | .ge("week", weeks[0]).le("week", weeks[1]), ids); |
| | | for (AuxiliaryOutputWorkingHoursDto record : auxiliaryOutputWorkingHoursDtoIPage.getRecords()) { |
| | | record.setDateTime(record.getDateTime().substring(0,10)); |
| | | } |
| | | map.put("body",auxiliaryOutputWorkingHoursDtoIPage ); |
| | | } else if (ObjectUtils.isNotEmpty(dates) && ObjectUtils.isEmpty(week)) { |
| | | String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | map.put("body", auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, |
| | | IPage<AuxiliaryOutputWorkingHoursDto> auxiliaryOutputWorkingHoursDtoIPage = auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, |
| | | QueryWrappers.queryWrappers(auxiliaryOutputWorkingHoursDto) |
| | | .ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59"), ids)); |
| | | .ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59"), ids); |
| | | for (AuxiliaryOutputWorkingHoursDto record : auxiliaryOutputWorkingHoursDtoIPage.getRecords()) { |
| | | record.setDateTime(record.getDateTime().substring(0,10)); |
| | | } |
| | | map.put("body",auxiliaryOutputWorkingHoursDtoIPage ); |
| | | } else if (ObjectUtils.isEmpty(dates) && ObjectUtils.isNotEmpty(week)) { |
| | | String[] weeks = week.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | map.put("body", auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, |
| | | IPage<AuxiliaryOutputWorkingHoursDto> auxiliaryOutputWorkingHoursDtoIPage = auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, |
| | | QueryWrappers.queryWrappers(auxiliaryOutputWorkingHoursDto) |
| | | .ge("week", weeks[0]).le("week", weeks[1]), ids)); |
| | | .ge("week", weeks[0]).le("week", weeks[1]), ids); |
| | | for (AuxiliaryOutputWorkingHoursDto record : auxiliaryOutputWorkingHoursDtoIPage.getRecords()) { |
| | | record.setDateTime(record.getDateTime().substring(0,10)); |
| | | } |
| | | map.put("body", auxiliaryOutputWorkingHoursDtoIPage); |
| | | } else { |
| | | map.put("body", auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, QueryWrappers.queryWrappers(auxiliaryOutputWorkingHoursDto), ids)); |
| | | IPage<AuxiliaryOutputWorkingHoursDto> auxiliaryOutputWorkingHoursDtoIPage = auxiliaryOutputWorkingHoursMapper.selectAuxiliaryOutputWorkingHours(page, QueryWrappers.queryWrappers(auxiliaryOutputWorkingHoursDto), ids); |
| | | for (AuxiliaryOutputWorkingHoursDto record : auxiliaryOutputWorkingHoursDtoIPage.getRecords()) { |
| | | record.setDateTime(record.getDateTime().substring(0,10)); |
| | | } |
| | | map.put("body", auxiliaryOutputWorkingHoursDtoIPage); |
| | | } |
| | | return map; |
| | | } |
| | |
| | | public Map<String, Object> collectWorkingHours(AuxiliaryOutputWorkingHoursDto auxiliaryOutputWorkingHoursDto) { |
| | | AuxiliaryOutputWorkingHours outputWorkingHours = new AuxiliaryOutputWorkingHours(); |
| | | AuxiliaryWorkingHoursDay workingHoursDay = new AuxiliaryWorkingHoursDay(); |
| | | List<Integer> ids = new ArrayList<>(); |
| | | if (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHoursDto.getWeekDay())){ |
| | | outputWorkingHours.setWeekDay(auxiliaryOutputWorkingHoursDto.getWeekDay()); |
| | | workingHoursDay.setWeekDay(auxiliaryOutputWorkingHoursDto.getWeekDay()); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHoursDto.getName())){ |
| | | User user = userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getName, auxiliaryOutputWorkingHoursDto.getName())); |
| | | outputWorkingHours.setCheck(user.getId()); |
| | | workingHoursDay.setNameUser(user.getId()); |
| | | List<User> user = userMapper.selectList(Wrappers.<User>lambdaQuery().like(User::getName, auxiliaryOutputWorkingHoursDto.getName())); |
| | | ids.addAll(user.stream().map(User::getId).collect(Collectors.toList())); |
| | | } |
| | | String dates = auxiliaryOutputWorkingHoursDto.getDateTime(); |
| | | auxiliaryOutputWorkingHoursDto.setDateTime(null); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Double sumOutputWorkTime = 0.0; |
| | | Double sumApprovedWorkingHour = 0.0; |
| | | List<Integer> ids = null; |
| | | |
| | | //判断是组长还是组员还是管理员 |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectAuxiliaryOutputWorkingHours"); |
| | | User user = userMapper.selectById(map1.get("userId")); |
| | |
| | | } |
| | | List<AuxiliaryOutputWorkingHours> auxiliaryOutputWorkingHours = new ArrayList<>(); |
| | | List<AuxiliaryWorkingHoursDay> auxiliaryWorkingHoursDays = new ArrayList<>(); |
| | | if (ids.size() == 0) { |
| | | ids=null; |
| | | } |
| | | if (ObjectUtils.isNotEmpty(dates)) { |
| | | String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | //统计当前用户的产品工时 |
| | |
| | | .eq("state","已批准") |
| | | .ge("date_time", split[0]) |
| | | .le("date_time", split[1] + " 23:59:59"),ids); |
| | | } else { |
| | | }else if (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHoursDto.getWeekDay())){ |
| | | //统计当前用户的产品工时 |
| | | auxiliaryOutputWorkingHours = auxiliaryOutputWorkingHoursMapper.selectLists(QueryWrappers.queryWrappers(outputWorkingHours),ids); |
| | | //统计当前用户的辅助工时 |
| | | auxiliaryWorkingHoursDays = auxiliaryWorkingHoursDayMapper.selectLists(QueryWrappers.queryWrappers(workingHoursDay).eq("state","已批准"),ids); |
| | | } |
| | | else { |
| | | auxiliaryOutputWorkingHours = auxiliaryOutputWorkingHoursMapper.selectListByIds(ids); |
| | | auxiliaryWorkingHoursDays = auxiliaryWorkingHoursDayMapper.selectListByIds(ids); |
| | | } |
| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | if (ObjectUtils.isNotEmpty(dates) && ObjectUtils.isNotEmpty(week)) { |
| | | String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | String[] weeks = week.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | map.put("body", auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, |
| | | IPage<AuxiliaryWorkingHoursDayDto> auxiliaryWorkingHoursDayDtoIPage = auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, |
| | | QueryWrappers.queryWrappers(auxiliaryWorkingHoursDayDto) |
| | | .ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59") |
| | | .ge("week", weeks[0]).le("week", weeks[1]), ids)); |
| | | .ge("week", weeks[0]).le("week", weeks[1]), ids); |
| | | for (AuxiliaryWorkingHoursDayDto record : auxiliaryWorkingHoursDayDtoIPage.getRecords()) { |
| | | record.setDateTime(record.getDateTime().substring(0,10)); |
| | | } |
| | | map.put("body", auxiliaryWorkingHoursDayDtoIPage); |
| | | } else if (ObjectUtils.isNotEmpty(dates) && ObjectUtils.isEmpty(week)) { |
| | | String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | map.put("body", auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, |
| | | IPage<AuxiliaryWorkingHoursDayDto> auxiliaryWorkingHoursDayDtoIPage = auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, |
| | | QueryWrappers.queryWrappers(auxiliaryWorkingHoursDayDto) |
| | | .ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59"), ids)); |
| | | .ge("date_time", split[0]).le("date_time", split[1] + " 23:59:59"), ids); |
| | | for (AuxiliaryWorkingHoursDayDto record : auxiliaryWorkingHoursDayDtoIPage.getRecords()) { |
| | | record.setDateTime(record.getDateTime().substring(0,10)); |
| | | } |
| | | map.put("body",auxiliaryWorkingHoursDayDtoIPage ); |
| | | } else if (ObjectUtils.isEmpty(dates) && ObjectUtils.isNotEmpty(week)) { |
| | | String[] weeks = week.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | map.put("body", auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, |
| | | IPage<AuxiliaryWorkingHoursDayDto> auxiliaryWorkingHoursDayDtoIPage = auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, |
| | | QueryWrappers.queryWrappers(auxiliaryWorkingHoursDayDto) |
| | | .ge("week", weeks[0]).le("week", weeks[1]), ids)); |
| | | .ge("week", weeks[0]).le("week", weeks[1]), ids); |
| | | for (AuxiliaryWorkingHoursDayDto record : auxiliaryWorkingHoursDayDtoIPage.getRecords()) { |
| | | record.setDateTime(record.getDateTime().substring(0,10)); |
| | | } |
| | | map.put("body", auxiliaryWorkingHoursDayDtoIPage); |
| | | } else { |
| | | map.put("body", auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, QueryWrappers.queryWrappers(auxiliaryWorkingHoursDayDto), ids)); |
| | | IPage<AuxiliaryWorkingHoursDayDto> auxiliaryWorkingHoursDayDtoIPage = auxiliaryWorkingHoursDayMapper.selectAuxiliaryWorkingHoursDay(page, QueryWrappers.queryWrappers(auxiliaryWorkingHoursDayDto), ids); |
| | | for (AuxiliaryWorkingHoursDayDto record : auxiliaryWorkingHoursDayDtoIPage.getRecords()) { |
| | | record.setDateTime(record.getDateTime().substring(0,10)); |
| | | } |
| | | map.put("body", auxiliaryWorkingHoursDayDtoIPage); |
| | | } |
| | | return map; |
| | | } |