| | |
| | | public interface InsOrderMapper extends BaseMapper<InsOrder> { |
| | | |
| | | //获取检验下单数据 |
| | | IPage<SampleOrderDto> selectInsOrderPage(IPage<InsOrder> page, QueryWrapper<SampleOrderDto> ew); |
| | | IPage<SampleOrderDto> selectInsOrderPage(IPage<InsOrder> page, @Param("ew") QueryWrapper<SampleOrderDto> ew, @Param("laboratory") String laboratory); |
| | | |
| | | //修改检验下单数据 |
| | | int upInsOrderParameter(InsOrder itemParameter); |
| | |
| | | String selLaboratoryCode(String laboratory); |
| | | |
| | | List<Map<Integer, Object>> selectReportModelByOrderId(@Param("id") Integer id, @Param("laboratory") String laboratory); |
| | | |
| | | String seldepLimsId(int depLimsId); |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("关联 光纤带表id") |
| | | private Integer insFibersId; |
| | | |
| | | @TableField(exist = false,select = false) |
| | | private Integer state; |
| | | } |
| | |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField(exist = false,select = false) |
| | | private Integer state; |
| | | |
| | | } |
| | |
| | | //再查询出所有的光纤带 |
| | | List<InsFibers> insFibers = insFibersMapper.selectList(Wrappers.<InsFibers>lambdaQuery().eq(InsFibers::getInsBushingId, insBushing.getId())); |
| | | if (CollectionUtils.isNotEmpty(insFibers)) { |
| | | for (InsFibers insFiber : insFibers) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFibersId, insFiber.getId())); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult).filter(sm -> ObjectUtils.isNotEmpty(sm)).collect(Collectors.toList()); |
| | | if (insProducts.size()==collect.size()) { |
| | | insFiber.setState(1);//已检验 |
| | | }else { |
| | | insFiber.setState(0);//未检验 |
| | | } |
| | | } |
| | | fibers.addAll(insFibers); |
| | | //查出光纤带下所有的光纤 |
| | | List<InsFiber> fiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().in(InsFiber::getInsFibersId, insFibers.stream().map(InsFibers::getId).collect(Collectors.toList()))); |
| | | for (InsFiber insFiber : fiberList) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFiberId, insFiber.getId())); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult).filter(sm -> ObjectUtils.isNotEmpty(sm)).collect(Collectors.toList()); |
| | | if (insProducts.size()==collect.size()) { |
| | | insFiber.setState(1);//已检验 |
| | | }else { |
| | | insFiber.setState(0);//未检验 |
| | | } |
| | | } |
| | | fiber.addAll(fiberList); |
| | | } else { |
| | | //如果套管下没有光纤带就只有光纤了 |
| | | List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId())); |
| | | for (InsFiber insFiber : insFiberList) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFiberId, insFiber.getId())); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult).filter(sm -> ObjectUtils.isNotEmpty(sm)).collect(Collectors.toList()); |
| | | if (insProducts.size()==collect.size()) { |
| | | insFiber.setState(1);//已检验 |
| | | }else { |
| | | insFiber.setState(0);//未检验 |
| | | } |
| | | } |
| | | fiber.addAll(insFiberList); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | productVos = productVos.stream().sorted(Comparator.comparing(productVo -> productVo.getInsProduct().getInspectionItemClass())).collect(Collectors.toList()); |
| | | } |
| | | else { |
| | | //电力--热循环 |
| | |
| | | //校验如果这个人这个检测项目已经添加过了则不需要再新增 |
| | | Long count = auxiliaryOutputWorkingHoursMapper.selectCount(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() |
| | | .eq(AuxiliaryOutputWorkingHours::getCheck, userId) |
| | | .eq(AuxiliaryOutputWorkingHours::getInspectProject, insProduct.getInspectionItemSubclass() + insProduct.getInspectionItem()) |
| | | .eq(AuxiliaryOutputWorkingHours::getInspectionItem, insProduct.getInspectionItem()) |
| | | .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, insProduct.getInspectionItemSubclass()) |
| | | .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode())); |
| | | if (count == 0 && ObjectUtils.isNotEmpty(insProduct.getManHour())) { |
| | | //添加每个人的产量工时 |
| | | AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours(); |
| | | auxiliaryOutputWorkingHours.setInspectProject(insProduct.getInspectionItemSubclass() + insProduct.getInspectionItem());//检测项目 |
| | | auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//检测父项 |
| | | auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//检测子项 |
| | | auxiliaryOutputWorkingHours.setSample(insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode());//样品编号 |
| | | auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//非加班委托单号 |
| | | auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//非加班工时 |
| | | auxiliaryOutputWorkingHours.setAmount(1);//非加班数量 |
| | |
| | | //获取检验下单数据 |
| | | @Override |
| | | public Map<String, Object> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(SampleOrderDto.class)); |
| | | //判断全部,个人,组织的权限 |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectInsOrderParameter"); |
| | | User user = userMapper.selectById(map1.get("userId")); |
| | | User user = userMapper.selectById(map1.get("userId"));//当前登录的人 |
| | | Integer roleId = user.getRoleId(); |
| | | //获取当前人所属实验室id |
| | | String departLimsId = user.getDepartLimsId(); |
| | | String laboratory=null; |
| | | if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")){ |
| | | String[] split = departLimsId.split(","); |
| | | //查询对应架构名称(通信实验室,电力实验室,检测办) |
| | | String departLims=baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1])); |
| | | if (departLims.contains("实验室")){ |
| | | laboratory=departLims; |
| | | } |
| | | } |
| | | //判断是否是全部权限 |
| | | Power power = powerMapper.selectOne(Wrappers.<Power>lambdaQuery().eq(Power::getRoleId, roleId).eq(Power::getMenuMethod, "selectAllInsOrder")); |
| | | if (ObjectUtils.isEmpty(power)) { |
| | |
| | | } |
| | | } |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(SampleOrderDto.class)); |
| | | map.put("body", insOrderMapper.selectInsOrderPage(page, QueryWrappers.queryWrappers(sampleOrderDto))); |
| | | map.put("body", insOrderMapper.selectInsOrderPage(page, QueryWrappers.queryWrappers(sampleOrderDto),laboratory)); |
| | | return map; |
| | | } |
| | | |
| | |
| | | <association property="children" resultMap="SampleDefectsChildrenMap" javaType="java.util.List"/> |
| | | </resultMap> |
| | | |
| | | <select id="selectInsOrderPage" resultType="com.yuanchu.mom.dto.SampleOrderDto"> |
| | | select * |
| | | from ( |
| | | SELECT |
| | | io.*, |
| | | ir.id report_id, |
| | | ir.url, |
| | | ir.url_s, |
| | | (select count(*) from ins_sample isa2 |
| | | where isa2.ins_order_id = io.id and isa2.sample_code NOT REGEXP '/') sample_num, |
| | | concat(ROUND((select count(*) from ins_product ip |
| | | where state = 1 and ins_result is not null and ip.ins_sample_id in (select id from ins_sample where |
| | | ins_sample.ins_order_id= io.id )) / (select count(*) from ins_product ip2 |
| | | where state = 1 and ip2.ins_sample_id in (select id from ins_sample where ins_sample.ins_order_id= io.id )) * |
| | | 100, 2), '%') insProgress, |
| | | group_concat(distinct isa.sample_code,' ') sample_code, |
| | | group_concat(distinct isa.sample,' ') sample_name, |
| | | group_concat(distinct isa.model,' ') sample_model, |
| | | u.name |
| | | FROM |
| | | ins_order io |
| | | LEFT JOIN ins_sample isa ON io.id = isa.ins_order_id |
| | | LEFT JOIN ( SELECT id, ins_order_id, is_ratify, url,url_s FROM ins_report WHERE is_ratify = 1 ) ir ON io.id = |
| | | ir.ins_order_id |
| | | left join user u on io.create_user = u.id |
| | | where 1=1 |
| | | <if test="laboratory!=null and laboratory!=''"> |
| | | and io.laboratory=#{laboratory} |
| | | </if> |
| | | GROUP BY |
| | | io.id |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | <resultMap id="SampleDefectsChildrenMap" type="com.yuanchu.mom.vo.SampleDefectsChildrenVo"> |
| | | <result column="entrust_code" property="entrust_code"/> |
| | | <result column="inspection_item" property="inspection_item"/> |
| | |
| | | create_time, |
| | | state |
| | | from ins_order |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | <select id="selectInsOrderPage" resultType="com.yuanchu.mom.dto.SampleOrderDto"> |
| | | select * |
| | | from ( |
| | | SELECT |
| | | io.*, |
| | | ir.id report_id, |
| | | ir.url, |
| | | ir.url_s, |
| | | (select count(*) from ins_sample isa2 |
| | | where isa2.ins_order_id = io.id and isa2.sample_code NOT REGEXP '/') sample_num, |
| | | concat(ROUND((select count(*) from ins_product ip |
| | | where state = 1 and ins_result is not null and ip.ins_sample_id in (select id from ins_sample where |
| | | ins_sample.ins_order_id= io.id )) / (select count(*) from ins_product ip2 |
| | | where state = 1 and ip2.ins_sample_id in (select id from ins_sample where ins_sample.ins_order_id= io.id )) * |
| | | 100, 2), '%') insProgress, |
| | | group_concat(distinct isa.sample_code,' ') sample_code, |
| | | group_concat(distinct isa.sample,' ') sample_name, |
| | | group_concat(distinct isa.model,' ') sample_model, |
| | | u.name |
| | | FROM |
| | | ins_order io |
| | | LEFT JOIN ins_sample isa ON io.id = isa.ins_order_id |
| | | LEFT JOIN ( SELECT id, ins_order_id, is_ratify, url,url_s FROM ins_report WHERE is_ratify = 1 ) ir ON io.id = |
| | | ir.ins_order_id |
| | | left join user u on io.create_user = u.id |
| | | GROUP BY |
| | | io.id |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | |
| | | </where> |
| | | </update> |
| | | <update id="updateStatus"> |
| | | update ins_order set state=3 where id=#{id} |
| | | update ins_order |
| | | set state=3 |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <select id="selectSampleDefects" resultMap="selectSampleDefectsMap"> |
| | |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="seldepLimsId" resultType="java.lang.String"> |
| | | select name |
| | | from department_lims |
| | | where id = #{depLimsId} |
| | | </select> |
| | | </mapper> |
| | |
| | | method, |
| | | man_day, |
| | | bsm, |
| | | ask, |
| | | tell as ask, |
| | | `last_value`, |
| | | ip.ins_result ip_ins_result, |
| | | state, |
| | |
| | | left join ins_product ip on isa.id = ip.ins_sample_id |
| | | left join ins_product_result ipr on ip.id = ipr.ins_product_id |
| | | where ins_order_id = #{id} |
| | | and template_id is not null |
| | | and state = 1 |
| | | </select> |
| | | |
| | |
| | | @ValueClassify("工时管理") |
| | | @ApiOperation(value = "统计产量工时汇总和辅助工时汇总") |
| | | @PostMapping("/collectWorkingHours") |
| | | public Result collectWorkingHours(){ |
| | | return Result.success(auxiliaryOutputWorkingHoursService.collectWorkingHours()); |
| | | public Result collectWorkingHours(@RequestBody Map<String, Object> data)throws Exception{ |
| | | AuxiliaryOutputWorkingHoursDto entity = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), AuxiliaryOutputWorkingHoursDto.class); |
| | | return Result.success(auxiliaryOutputWorkingHoursService.collectWorkingHours(entity)); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | @ApiModelProperty("部门") |
| | | private String departLims; |
| | | |
| | | @ApiModelProperty("总工时") |
| | | @ValueTableShow(35) |
| | | private Double total; |
| | | } |
| | |
| | | import com.alibaba.excel.annotation.ExcelIgnore; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.yuanchu.mom.annotation.ValueTableShow; |
| | | import com.yuanchu.mom.pojo.AuxiliaryCorrectionHours; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | |
| | | @ValueTableShow(2) |
| | | @ExcelProperty(value = "姓名") |
| | | private String name; |
| | | |
| | | //修正工时 |
| | | private AuxiliaryCorrectionHours auxiliaryCorrectionHours; |
| | | |
| | | @ApiModelProperty("类型") |
| | | @ValueTableShow(3) |
| | |
| | | @ExcelIgnore |
| | | private Integer thirtyOne; |
| | | |
| | | @ApiModelProperty("总工时") |
| | | @ValueTableShow(34) |
| | | @ExcelProperty(value = "总工时") |
| | | private Double total; |
| | | |
| | | @ApiModelProperty("月份") |
| | | @ValueTableShow(35) |
| | | @ExcelProperty(value = "月份") |
| | | private String month; |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | List<AuxiliaryOutputWorkingHours> selectListByIds(@Param("ids") List<Integer> ids); |
| | | |
| | | List<AuxiliaryOutputWorkingHours> selectLists(@Param("ew") QueryWrapper<AuxiliaryOutputWorkingHours> ew, @Param("ids") List<Integer> ids); |
| | | } |
| | |
| | | //查询该月的辅助工时 |
| | | List<Map<String, Object>> totalHours(@Param("month") String month, @Param("ids") List<Integer> ids); |
| | | |
| | | List<AuxiliaryWorkingHoursDay> selectLists(@Param("ew") QueryWrapper<AuxiliaryWorkingHoursDay> ew, @Param("ids") List<Integer> ids); |
| | | } |
| | |
| | | @ExcelIgnore |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("检测项目") |
| | | @ExcelProperty(value = "检测项目") |
| | | @ApiModelProperty("检测父项") |
| | | @ExcelProperty(value = "检测父项") |
| | | @ValueTableShow(2) |
| | | private String inspectProject; |
| | | private String inspectionItem; |
| | | |
| | | @ApiModelProperty("检测子项") |
| | | @ExcelProperty(value = "检测子项") |
| | | @ValueTableShow(2) |
| | | private String inspectionItemSubclass; |
| | | |
| | | @ApiModelProperty("样品编号") |
| | | @ExcelProperty(value = "样品编号") |
| | | @ValueTableShow(2) |
| | | private String sample; |
| | | |
| | | @ApiModelProperty("加班委托单号") |
| | | @ExcelProperty(value = "加班委托单号") |
| | |
| | | * 统计产量工时汇总和辅助工时汇总 |
| | | * @return |
| | | */ |
| | | Map<String,Object> collectWorkingHours(); |
| | | Map<String,Object> collectWorkingHours(AuxiliaryOutputWorkingHoursDto auxiliaryOutputWorkingHoursDto); |
| | | |
| | | /** |
| | | * 导出 |
| | |
| | | import com.yuanchu.mom.dto.*; |
| | | import com.yuanchu.mom.mapper.*; |
| | | import com.yuanchu.mom.pojo.AuxiliaryCorrectionHours; |
| | | import com.yuanchu.mom.pojo.AuxiliaryOutputWorkingHours; |
| | | import com.yuanchu.mom.pojo.Power; |
| | | import com.yuanchu.mom.pojo.User; |
| | | import com.yuanchu.mom.service.AuxiliaryOriginalHoursService; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | public Map<String, Object> selectAuxiliaryOriginalHours(Page page, AuxiliaryOriginalHoursLookDto auxiliaryOriginalHoursLookDto) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Integer> ids = new ArrayList<>(); |
| | | ; |
| | | map.put("head", PrintChina.printChina(AuxiliaryCorrectionHoursDto.class)); |
| | | //判断组长,组员,管理员权限 |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectAuxiliaryOriginalHours"); |
| | |
| | | //产量工时 |
| | | List<Map<String, Object>> maps = auxiliaryOutputWorkingHoursMapper.totalHours(auxiliaryOriginalHoursLookDto.getMonth(), ids); |
| | | if (ObjectUtils.isNotEmpty(maps)) { |
| | | for (Map<String, Object> objectMap : maps) { |
| | | auxiliaryOriginalHoursDtos.add(getData(objectMap, "产量工时")); |
| | | } |
| | | |
| | | auxiliaryOriginalHoursDtos.addAll(getData(maps, "产量工时").values()); |
| | | } |
| | | //辅助工时 |
| | | List<Map<String, Object>> maps1 = auxiliaryWorkingHoursDayMapper.totalHours(auxiliaryOriginalHoursLookDto.getMonth(), ids); |
| | | if (ObjectUtils.isNotEmpty(maps1)) { |
| | | for (Map<String, Object> objectMap : maps1) { |
| | | auxiliaryOriginalHoursDtos.add(getData(objectMap, "辅助工时")); |
| | | } |
| | | auxiliaryOriginalHoursDtos.addAll(getData(maps1, "辅助工时").values()); |
| | | } |
| | | //加班工时 |
| | | //总工时 |
| | | List<Map<String, Object>> maps2 = auxiliaryOriginalHoursMapper.totalHours(auxiliaryOriginalHoursLookDto.getMonth(), ids); |
| | | if (ObjectUtils.isNotEmpty(maps2)) { |
| | | //产量工时+辅助工时都不为空 |
| | | for (Map<String, Object> objectMap : maps2) { |
| | | auxiliaryOriginalHoursDtos.add(getData(objectMap, "总工时")); |
| | | auxiliaryOriginalHoursDtos.addAll(getData(maps2, "总工时").values()); |
| | | } |
| | | } |
| | | //如果輔助工时不为空 |
| | | //如果辅助工时不为空 |
| | | else if (ObjectUtils.isNotEmpty(maps1)) { |
| | | for (Map<String, Object> objectMap : maps1) { |
| | | auxiliaryOriginalHoursDtos.add(getData(objectMap, "总工时")); |
| | | } |
| | | auxiliaryOriginalHoursDtos.addAll(getData(maps1, "总工时").values()); |
| | | } else if (ObjectUtils.isNotEmpty(maps)) { |
| | | for (Map<String, Object> objectMap : maps) { |
| | | auxiliaryOriginalHoursDtos.add(getData(objectMap, "总工时")); |
| | | } |
| | | auxiliaryOriginalHoursDtos.addAll(getData(maps, "总工时").values()); |
| | | } |
| | | originalHoursDtoIPage.setRecords(auxiliaryOriginalHoursDtos); |
| | | map.put("body", originalHoursDtoIPage); |
| | |
| | | |
| | | } |
| | | |
| | | private AuxiliaryOriginalHoursDto getData(Map<String, Object> objectMap, String type) { |
| | | AuxiliaryOriginalHoursDto auxiliaryOriginalHoursDto = new AuxiliaryOriginalHoursDto(); |
| | | auxiliaryOriginalHoursDto.setName(objectMap.get("name").toString());//姓名 |
| | | private Map<String, AuxiliaryOriginalHoursDto> getData(List<Map<String, Object>> objectMaps, String type) { |
| | | Map<String, AuxiliaryOriginalHoursDto> dtoMap = new HashMap<>(); |
| | | for (Map<String, Object> objectMap : objectMaps) { |
| | | String name = objectMap.get("name").toString(); |
| | | String month = objectMap.get("month").toString().substring(0, 7); |
| | | AuxiliaryOriginalHoursDto auxiliaryOriginalHoursDto = dtoMap.get(name); |
| | | if (auxiliaryOriginalHoursDto == null) { |
| | | auxiliaryOriginalHoursDto = new AuxiliaryOriginalHoursDto(); |
| | | auxiliaryOriginalHoursDto.setName(name); |
| | | auxiliaryOriginalHoursDto.setType(type); |
| | | auxiliaryOriginalHoursDto.setMonth(objectMap.get("month").toString().substring(0, 7));//月份 |
| | | auxiliaryOriginalHoursDto.setMonth(month); |
| | | //查询这个人这个月是否有修正的产量工时 |
| | | AuxiliaryCorrectionHours auxiliaryCorrectionHours = auxiliaryCorrectionHoursMapper.selectOne(Wrappers.<AuxiliaryCorrectionHours>lambdaQuery() |
| | | .eq(AuxiliaryCorrectionHours::getNameUser, userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getName, auxiliaryOriginalHoursDto.getName())).getId()) |
| | | .eq(AuxiliaryCorrectionHours::getType, auxiliaryOriginalHoursDto.getType()) |
| | | .eq(AuxiliaryCorrectionHours::getMonth, auxiliaryOriginalHoursDto.getMonth())); |
| | | auxiliaryOriginalHoursDto.setAuxiliaryCorrectionHours(auxiliaryCorrectionHours); |
| | | dtoMap.put(name, auxiliaryOriginalHoursDto); |
| | | } |
| | | AuxiliaryCorrectionHours auxiliaryCorrectionHours = auxiliaryOriginalHoursDto.getAuxiliaryCorrectionHours(); |
| | | switch (objectMap.get("month").toString().substring(8, 10)) { |
| | | case "01": |
| | | auxiliaryOriginalHoursDto.setOneHours(Double.parseDouble(objectMap.get("manHours").toString())); |
| | |
| | | } |
| | | break; |
| | | } |
| | | return auxiliaryOriginalHoursDto; |
| | | auxiliaryOriginalHoursDto.setTotal((ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getOneHours()) ? auxiliaryOriginalHoursDto.getOneHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getTwoHours()) ? auxiliaryOriginalHoursDto.getTwoHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getThreeHours()) ? auxiliaryOriginalHoursDto.getThreeHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getFourHours()) ? auxiliaryOriginalHoursDto.getFourHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getFiveHours()) ? auxiliaryOriginalHoursDto.getFiveHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getSixHours()) ? auxiliaryOriginalHoursDto.getSixHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getSevenHours()) ? auxiliaryOriginalHoursDto.getSevenHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getEightHours()) ? auxiliaryOriginalHoursDto.getEightHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getNineHours()) ? auxiliaryOriginalHoursDto.getNineHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getTenHours()) ? auxiliaryOriginalHoursDto.getTenHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getElevenHours()) ? auxiliaryOriginalHoursDto.getElevenHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getTwelveHours()) ? auxiliaryOriginalHoursDto.getTwelveHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getThirteenHours()) ? auxiliaryOriginalHoursDto.getThirteenHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getFourteenHours()) ? auxiliaryOriginalHoursDto.getFourteenHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getFifteenHours()) ? auxiliaryOriginalHoursDto.getFifteenHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getSixteenHours()) ? auxiliaryOriginalHoursDto.getSixteenHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getSeventeenHours()) ? auxiliaryOriginalHoursDto.getSeventeenHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getEighteenHours()) ? auxiliaryOriginalHoursDto.getEighteenHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getNineteenHours()) ? auxiliaryOriginalHoursDto.getNineteenHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getTwentyHours()) ? auxiliaryOriginalHoursDto.getTwentyHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getTwentyOneHours()) ? auxiliaryOriginalHoursDto.getTwentyOneHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getTwentyTwoHours()) ? auxiliaryOriginalHoursDto.getTwentyTwoHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getTwentyThreeHours()) ? auxiliaryOriginalHoursDto.getTwentyThreeHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getTwentyFourHours()) ? auxiliaryOriginalHoursDto.getTwentyFourHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getTwentyFiveHours()) ? auxiliaryOriginalHoursDto.getTwentyFiveHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getTwentySixHours()) ? auxiliaryOriginalHoursDto.getTwentySixHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getTwentySevenHours()) ? auxiliaryOriginalHoursDto.getTwentySevenHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getTwentyEightHours()) ? auxiliaryOriginalHoursDto.getTwentyEightHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getTwentyNineHours()) ? auxiliaryOriginalHoursDto.getTwentyNineHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getThirtyHours()) ? auxiliaryOriginalHoursDto.getThirtyHours() : 0) |
| | | + (ObjectUtils.isNotEmpty(auxiliaryOriginalHoursDto.getThirtyOneHours()) ? auxiliaryOriginalHoursDto.getThirtyOneHours() : 0) |
| | | ); |
| | | DecimalFormat df = new DecimalFormat("#.####"); // 设定四位小数 |
| | | auxiliaryOriginalHoursDto.setTotal(Double.parseDouble(df.format(auxiliaryOriginalHoursDto.getTotal()))); |
| | | } |
| | | return dtoMap; |
| | | } |
| | | } |
| | |
| | | import com.alibaba.excel.ExcelWriter; |
| | | 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.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | } else { |
| | | //管理员(不添加限制条件所有人都可以看) |
| | | } |
| | | } |
| | | else { |
| | | } else { |
| | | //是组长 |
| | | //查询组长下的组员 |
| | | List<User> users = userMapper.selectList(Wrappers.<User>lambdaQuery().like(User::getDepartLimsId, user.getDepartLimsId())); |
| | |
| | | |
| | | //统计产量工时汇总和辅助工时汇总 |
| | | @Override |
| | | public Map<String, Object> collectWorkingHours() { |
| | | public Map<String, Object> collectWorkingHours(AuxiliaryOutputWorkingHoursDto auxiliaryOutputWorkingHoursDto) { |
| | | AuxiliaryOutputWorkingHours outputWorkingHours = new AuxiliaryOutputWorkingHours(); |
| | | AuxiliaryWorkingHoursDay workingHoursDay = new AuxiliaryWorkingHoursDay(); |
| | | 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()); |
| | | } |
| | | String dates = auxiliaryOutputWorkingHoursDto.getDateTime(); |
| | | auxiliaryOutputWorkingHoursDto.setDateTime(null); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Double sumOutputWorkTime = 0.0; |
| | | Double sumApprovedWorkingHour = 0.0; |
| | |
| | | ids = users.stream().map(User::getId).distinct().collect(Collectors.toList()); |
| | | } |
| | | } |
| | | List<AuxiliaryOutputWorkingHours> auxiliaryOutputWorkingHours = new ArrayList<>(); |
| | | List<AuxiliaryWorkingHoursDay> auxiliaryWorkingHoursDays = new ArrayList<>(); |
| | | if (ObjectUtils.isNotEmpty(dates)) { |
| | | String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); |
| | | //统计当前用户的产品工时 |
| | | List<AuxiliaryOutputWorkingHours> auxiliaryOutputWorkingHours = auxiliaryOutputWorkingHoursMapper.selectListByIds(ids); |
| | | auxiliaryOutputWorkingHours = auxiliaryOutputWorkingHoursMapper.selectLists(QueryWrappers.queryWrappers(outputWorkingHours) |
| | | .ge("date_time", split[0]) |
| | | .le("date_time", split[1] + " 23:59:59"),ids); |
| | | //统计当前用户的辅助工时 |
| | | auxiliaryWorkingHoursDays = auxiliaryWorkingHoursDayMapper.selectLists(QueryWrappers.queryWrappers(workingHoursDay) |
| | | .eq("state","已批准") |
| | | .ge("date_time", split[0]) |
| | | .le("date_time", split[1] + " 23:59:59"),ids); |
| | | } else { |
| | | auxiliaryOutputWorkingHours = auxiliaryOutputWorkingHoursMapper.selectListByIds(ids); |
| | | auxiliaryWorkingHoursDays = auxiliaryWorkingHoursDayMapper.selectListByIds(ids); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours)) { |
| | | Map<String, Double> sumMap = new HashMap<>(); |
| | | for (AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHour : auxiliaryOutputWorkingHours) { |
| | | if (!sumMap.containsKey(auxiliaryOutputWorkingHour.getManHourGroup())) { |
| | | sumMap.put(auxiliaryOutputWorkingHour.getManHourGroup(), auxiliaryOutputWorkingHour.getOutputWorkTime()); |
| | | if (!sumMap.containsKey(auxiliaryOutputWorkingHour.getManHourGroup()+auxiliaryOutputWorkingHour.getOrderNo()+auxiliaryOutputWorkingHour.getSample())) { |
| | | sumMap.put(auxiliaryOutputWorkingHour.getManHourGroup()+auxiliaryOutputWorkingHour.getOrderNo()+auxiliaryOutputWorkingHour.getSample(), auxiliaryOutputWorkingHour.getOutputWorkTime()); |
| | | } |
| | | } |
| | | sumOutputWorkTime = sumMap.values().stream().mapToDouble(Double::doubleValue).sum(); |
| | | } |
| | | map.put("产量工时汇总", sumOutputWorkTime); |
| | | //统计当前用户的辅助工时 |
| | | List<AuxiliaryWorkingHoursDay> auxiliaryWorkingHoursDays = auxiliaryWorkingHoursDayMapper.selectListByIds(ids); |
| | | if (ObjectUtils.isNotEmpty(auxiliaryWorkingHoursDays)) { |
| | | for (AuxiliaryWorkingHoursDay auxiliaryWorkingHoursDay : auxiliaryWorkingHoursDays) { |
| | | sumApprovedWorkingHour += auxiliaryWorkingHoursDay.getNonproductiveTime(); |
| | |
| | | <select id="selectAuxiliaryCorrectionHours" resultType="com.yuanchu.mom.dto.AuxiliaryCorrectionHoursDto"> |
| | | select A.* |
| | | from ( |
| | | select ach.*,name |
| | | select ach.*, |
| | | name, |
| | | sum(one_hours+two_hours+ three_hours+ four_hours+ five_hours+ six_hours+ seven_hours+ eight_hours+ nine_hours+ |
| | | ten_hours+ eleven_hours+ twelve_hours+thirteen_hours+ fourteen_hours+ fifteen_hours+ sixteen_hours+ |
| | | seventeen_hours+ eighteen_hours+ nineteen_hours+ twenty_hours+ twenty_one_hours+ twenty_two_hours+ |
| | | twenty_three_hours+ twenty_four_hours+ twenty_five_hours+ twenty_six_hours+ twenty_seven_hours+ |
| | | twenty_eight_hours+ twenty_nine_hours+ thirty_hours+ thirty_one_hours) as total |
| | | FROM auxiliary_correction_hours ach |
| | | left join user on user.id=ach.name_user |
| | | WHERE 1=1 |
| | |
| | | from (select C.name, C.month, C.manHours + D.manHours as total |
| | | from (select A.name, |
| | | A.month, |
| | | FORMAT(SUM(manHour), 2) as manHours |
| | | FORMAT(SUM(manHour), 4) as manHours |
| | | from ( |
| | | select user.name, |
| | | case |
| | |
| | | from ( |
| | | select user.name, |
| | | date_time as month, |
| | | FORMAT(SUM(output_work_time), 2) as manHours |
| | | FORMAT(SUM(output_work_time), 4) as manHours |
| | | from auxiliary_output_working_hours aowh |
| | | left join user on user.id = aowh.`check` |
| | | left join department_lims dl on depart_lims_id = dl.id |
| | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.AuxiliaryOutputWorkingHours"> |
| | | <id column="id" property="id"/> |
| | | <result column="inspect_project" property="inspectProject"/> |
| | | <result column="inspection_item" property="inspectionItem"/> |
| | | <result column="inspection_item_subclass" property="inspectionItemSubclass"/> |
| | | <result column="sample" property="sample"/> |
| | | <result column="overtime_order_no" property="overtimeOrderNo"/> |
| | | <result column="overtime_work_time" property="overtimeWorkTime"/> |
| | | <result column="overtime_amount" property="overtimeAmount"/> |
| | |
| | | select * |
| | | from ( |
| | | select aowh.id, |
| | | inspect_project, |
| | | inspection_item, |
| | | inspection_item_subclass, |
| | | overtime_order_no, |
| | | overtime_work_time, |
| | | overtime_amount, |
| | |
| | | output_work_time, |
| | | date_time, |
| | | week, |
| | | SUBSTRING(week_day, 2) AS week_day, |
| | | week_day, |
| | | name |
| | | FROM auxiliary_output_working_hours aowh |
| | | left join user on user.id=aowh.`check` |
| | |
| | | <select id="totalHours" resultType="java.util.Map"> |
| | | select A.name, |
| | | A.month, |
| | | A.manHours |
| | | FORMAT(SUM(A.manHours), 4) manHours |
| | | from( |
| | | select user.name, |
| | | date_time as month, |
| | | FORMAT(SUM(output_work_time), 2) as manHours |
| | | order_no, |
| | | sample, |
| | | man_hour_group, |
| | | output_work_time as manHours |
| | | -- FORMAT(SUM(output_work_time), 4) as manHours |
| | | from auxiliary_output_working_hours aowh |
| | | left join user on user.id=aowh.`check` |
| | | left join department_lims dl on depart_lims_id=dl.id |
| | | where date_time LIKE CONCAT('%', #{month}, '%') |
| | | <!--and `check` in (#{ids})--> |
| | | <if test="ids !=null and ids != ''"> |
| | | and `check` in |
| | | <foreach collection="ids" open="(" separator="," close=")" item="val"> |
| | | #{val} |
| | | </foreach> |
| | | </if> |
| | | group by user.name,date_time |
| | | order by user.name,date_time |
| | | group by user.name,date_time,order_no, |
| | | sample, |
| | | man_hour_group |
| | | order by user.name,date_time,order_no, |
| | | sample, |
| | | man_hour_group |
| | | )A |
| | | group by A.name, |
| | | A.month |
| | | order by A.name, |
| | | A.month |
| | | </select> |
| | | <select id="selectListByIds" resultType="com.yuanchu.mom.pojo.AuxiliaryOutputWorkingHours"> |
| | | select * from auxiliary_output_working_hours |
| | | where 1=1 |
| | | <!--and `check` in(#{ids})--> |
| | | <if test="ids !=null and ids != ''"> |
| | | and `check` in |
| | | <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> |
| | |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectLists" resultMap="BaseResultMap"> |
| | | select * from(select * from auxiliary_output_working_hours |
| | | WHERE 1=1 |
| | | <if test="ids !=null and ids != ''"> |
| | | and `check` in |
| | | <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> |
| | | #{val} |
| | | </foreach> |
| | | </if> |
| | | ) A |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | </select> |
| | | <select id="selectListByIds" resultType="com.yuanchu.mom.pojo.AuxiliaryWorkingHoursDay"> |
| | | select * from auxiliary_working_hours_day |
| | | where 1=1 |
| | | |
| | | where state='已审核' |
| | | <if test="ids !=null and ids != ''"> |
| | | and name_user in |
| | | <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> |
| | |
| | | <select id="totalHours" resultType="java.util.Map"> |
| | | select A.name, |
| | | A.month, |
| | | FORMAT(SUM(manHour), 2)as manHours |
| | | FORMAT(SUM(manHour), 4)as manHours |
| | | from( |
| | | select user.name, |
| | | case when reviewer_nonproductive_time is null then nonproductive_time |
| | |
| | | group by A.name,A.month |
| | | order by A.name,A.month |
| | | </select> |
| | | |
| | | <select id="selectLists" resultMap="BaseResultMap"> |
| | | select * from(select * from auxiliary_working_hours_day |
| | | WHERE 1=1 |
| | | <if test="ids !=null and ids != ''"> |
| | | and name_user in |
| | | <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> |
| | | #{val} |
| | | </foreach> |
| | | </if> |
| | | ) A |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | </mapper> |