cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceController.java
@@ -6,12 +6,14 @@ import com.yuanchu.mom.annotation.ValueAuth; import com.yuanchu.mom.annotation.ValueClassify; import com.yuanchu.mom.dto.DeviceDto; import com.yuanchu.mom.dto.DeviceDto1; import com.yuanchu.mom.pojo.Device; import com.yuanchu.mom.service.DeviceService; import com.yuanchu.mom.utils.JackSonUtil; import com.yuanchu.mom.vo.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -130,5 +132,23 @@ public Result selectDeviceByCode(String code) { return Result.success(deviceService.selectDeviceByCode(code)); } @ValueClassify("设å¤") @ApiOperation(value = "æ¥è¯¢æ°éé ç½®") @PostMapping("/getNumberCollect") public Result<?> getNumberCollect(Integer id) { DeviceDto1 deviceDto1 = new DeviceDto1(); BeanUtils.copyProperties(deviceService.getById(id),deviceDto1); return Result.success(deviceDto1); } @ValueClassify("设å¤") @ApiOperation(value = "ç»´æ¤æ°éé ç½®") @PostMapping("/numberCollect") public Result<?> numberCollect(@RequestBody DeviceDto1 deviceDto1) { Device device = new Device(); BeanUtils.copyProperties(deviceDto1,device); return Result.success(deviceService.updateById(device)); } } cnas-server/src/main/java/com/yuanchu/mom/dto/DeviceDto1.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,43 @@ package com.yuanchu.mom.dto; import com.yuanchu.mom.annotation.ValueTableShow; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; @Data public class DeviceDto1 { private Integer id; @ApiModelProperty(value = "IP") @ValueTableShow(1) @NotNull private String ip; @ApiModelProperty(value = "ééå°å") @NotNull private String collectUrl; @ApiModelProperty(value = "åå¨å°å") @NotNull private String storageUrl; @ApiModelProperty(value = "åç §") @NotNull private String refer; @ApiModelProperty(value = "X") @NotNull private String x; @ApiModelProperty(value = "Y") @NotNull private String y; @ApiModelProperty(value = "å ¬å¼") @NotNull private String formula; } cnas-server/src/main/java/com/yuanchu/mom/pojo/Device.java
@@ -118,4 +118,25 @@ @TableField(fill = FieldFill.INSERT) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime createTime; @ApiModelProperty(value = "IP") private String ip; @ApiModelProperty(value = "ééå°å") private String collectUrl; @ApiModelProperty(value = "åå¨å°å") private String storageUrl; @ApiModelProperty(value = "åç §") private String refer; @ApiModelProperty(value = "X") private String x; @ApiModelProperty(value = "Y") private String y; @ApiModelProperty(value = "å ¬å¼") private String formula; } cnas-server/src/main/java/com/yuanchu/mom/service/DeviceService.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.yuanchu.mom.dto.DeviceDto; import com.yuanchu.mom.dto.DeviceDto1; import com.yuanchu.mom.pojo.Device; import java.util.List; cnas-server/src/main/java/com/yuanchu/mom/service/impl/DeviceServiceImpl.java
@@ -7,6 +7,7 @@ import com.yuanchu.mom.common.GetLook; import com.yuanchu.mom.common.PrintChina; import com.yuanchu.mom.dto.DeviceDto; import com.yuanchu.mom.dto.DeviceDto1; import com.yuanchu.mom.mapper.DeviceMapper; import com.yuanchu.mom.mapper.StructureItemParameterMapper; import com.yuanchu.mom.pojo.Device; performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOriginalHoursController.java
@@ -11,12 +11,11 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.PostMapping; 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 javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Map; @Api(tags = "å·¥æ¶ç»è®¡-åå§å·¥æ¶") @@ -36,4 +35,11 @@ AuxiliaryOriginalHoursLookDto entity = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), AuxiliaryOriginalHoursLookDto.class); return Result.success(auxiliaryOriginalHoursService.selectAuxiliaryOriginalHours(page, entity)); } @ValueClassify("å·¥æ¶ç®¡ç") @ApiOperation(value = "导åºåå§å·¥æ¶") @GetMapping("/exportOriginalHours") public void exportOriginalHours(@RequestBody AuxiliaryOriginalHoursLookDto auxiliaryOriginalHoursLookDto,HttpServletResponse response) throws IOException { auxiliaryOriginalHoursService.exportWorkingHours(auxiliaryOriginalHoursLookDto,response); } } performance-server/src/main/java/com/yuanchu/mom/controller/AuxiliaryOutputWorkingHoursController.java
@@ -55,7 +55,7 @@ @ValueClassify("å·¥æ¶ç®¡ç") @ApiOperation(value = "导åº") @ApiOperation(value = "导åºäº§éå·¥æ¶+è¾ å©å·¥æ¶") @GetMapping("/exportWorkingHours") public void exportWorkingHours(HttpServletResponse response) throws IOException { auxiliaryOutputWorkingHoursService.exportWorkingHours(response); performance-server/src/main/java/com/yuanchu/mom/service/AuxiliaryOriginalHoursService.java
@@ -4,9 +4,18 @@ import com.yuanchu.mom.dto.AuxiliaryOriginalHoursDto; import com.yuanchu.mom.dto.AuxiliaryOriginalHoursLookDto; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Map; public interface AuxiliaryOriginalHoursService { Map<String, Object> selectAuxiliaryOriginalHours(Page page, AuxiliaryOriginalHoursLookDto auxiliaryOriginalHoursLookDto); /** * 导åºåå§å·¥æ¶ * * @param response */ void exportWorkingHours(AuxiliaryOriginalHoursLookDto auxiliaryOriginalHoursLookDto, HttpServletResponse response) throws IOException; } performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryOriginalHoursServiceImpl.java
@@ -1,14 +1,17 @@ package com.yuanchu.mom.service.impl; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.alibaba.fastjson.JSONObject; 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; import com.yuanchu.mom.common.GetLook; import com.yuanchu.mom.common.PrintChina; import com.yuanchu.mom.dto.AuxiliaryCorrectionHoursDto; import com.yuanchu.mom.dto.AuxiliaryOriginalHoursDto; import com.yuanchu.mom.dto.AuxiliaryOriginalHoursLookDto; import com.yuanchu.mom.dto.*; import com.yuanchu.mom.mapper.*; import com.yuanchu.mom.pojo.AuxiliaryCorrectionHours; import com.yuanchu.mom.pojo.Power; @@ -18,6 +21,9 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -124,11 +130,11 @@ } } //å¦æäº§éå·¥æ¶ä¸ºç©º else if (ObjectUtils.isEmpty(maps)) { else if (ObjectUtils.isNotEmpty(maps1)) { for (Map<String, Object> objectMap : maps1) { auxiliaryOriginalHoursDtos.add(getData(objectMap, "æ»å·¥æ¶")); } } else if (ObjectUtils.isEmpty(maps1)) { } else if (ObjectUtils.isNotEmpty(maps)) { for (Map<String, Object> objectMap : maps) { auxiliaryOriginalHoursDtos.add(getData(objectMap, "æ»å·¥æ¶")); } @@ -138,6 +144,33 @@ return map; } //导åºåå§å·¥æ¶ @Override public void exportWorkingHours(AuxiliaryOriginalHoursLookDto auxiliaryOriginalHoursLookDto, HttpServletResponse response) throws IOException { List<AuxiliaryOriginalHoursDto> auxiliaryOriginalHoursDtos = new ArrayList<AuxiliaryOriginalHoursDto>(); //æ¥è¯¢åå§å·¥æ¶(使ç¨å页æ¥è¯¢) IPage<AuxiliaryOriginalHoursDto> body = (IPage<AuxiliaryOriginalHoursDto>) selectAuxiliaryOriginalHours(new Page(-1, -1), auxiliaryOriginalHoursLookDto).get("body"); auxiliaryOriginalHoursDtos=body.getRecords(); response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding("UTF-8"); // è¿éURLEncoder.encodeå¯ä»¥é²æ¢ä¸æä¹±ç å½ç¶åeasyexcel没æå ³ç³» String fileName = URLEncoder.encode("å·¥æ¶ç»è®¡å¯¼åº", "UTF-8"); response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); try { // æ°å»ºExcelWriter ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).build(); WriteSheet mainSheet = EasyExcel.writerSheet(0, "åå§å·¥æ¶å¯¼åº").head(AuxiliaryOriginalHoursDto.class).build(); excelWriter.write(auxiliaryOriginalHoursDtos, mainSheet); // å ³éæµ excelWriter.finish(); } catch (IOException e) { throw new RuntimeException("导åºå¤±è´¥"); } } private AuxiliaryOriginalHoursDto getData(Map<String, Object> objectMap, String type) { AuxiliaryOriginalHoursDto auxiliaryOriginalHoursDto = new AuxiliaryOriginalHoursDto(); auxiliaryOriginalHoursDto.setName(objectMap.get("name").toString());//å§å performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryOutputWorkingHoursServiceImpl.java
@@ -167,8 +167,8 @@ //å¯¼åº @Override public void exportWorkingHours(HttpServletResponse response) throws IOException { List<AuxiliaryOutputWorkingHoursDto> auxiliaryOutputWorkingHoursDtos = null; List<AuxiliaryWorkingHoursDayDto> auxiliaryWorkingHoursDayDtos = null; List<AuxiliaryOutputWorkingHoursDto> auxiliaryOutputWorkingHoursDtos = new ArrayList<>(); List<AuxiliaryWorkingHoursDayDto> auxiliaryWorkingHoursDayDtos = new ArrayList<>(); List<Integer> ids = null; //夿æ¯ç»é¿è¿æ¯ç»åè¿æ¯ç®¡çå Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectAuxiliaryOutputWorkingHours"); @@ -199,7 +199,7 @@ response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding("UTF-8"); // è¿éURLEncoder.encodeå¯ä»¥é²æ¢ä¸æä¹±ç å½ç¶åeasyexcel没æå ³ç³» String fileName = URLEncoder.encode("å·¥æ¶ç®¡ç导åº", "UTF-8"); String fileName = URLEncoder.encode("æ¥å·¥æ¶ç®¡ç导åº", "UTF-8"); response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); try { // æ°å»ºExcelWriter performance-server/src/main/java/com/yuanchu/mom/service/impl/PerformanceShiftServiceImpl.java
@@ -3,7 +3,6 @@ import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; 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; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -18,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; import java.math.BigDecimal; import java.text.SimpleDateFormat; @@ -42,11 +42,10 @@ @Autowired private EnumService enumService; public List<PerformanceShift> list = new ArrayList<>(); @Transactional(rollbackFor = Exception.class) @Override public void performanceShiftAdd(PerformanceShiftAddDto performanceShiftAddDto) { List<PerformanceShift> list = new ArrayList<>(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); String formattedDateTime = performanceShiftAddDto.getStartWeek().format(formatter); String[] splitUserId = performanceShiftAddDto.getUserId().split(","); @@ -60,22 +59,21 @@ LocalDate lastDayOfMonth = performanceShiftAddDto.getEndWeek().toLocalDate().with(TemporalAdjusters.lastDayOfMonth()); List<LocalDateTime> localDateTimesBetween = getLocalDateTimesBetween(firstDayOfMonth.atStartOfDay(), lastDayOfMonth.atStartOfDay()); localDateTimesBetween.forEach(i -> { for (String s : splitUserId) { PerformanceShift performanceShift = new PerformanceShift(); performanceShift.setUserId(Integer.valueOf(s)); performanceShift.setUserId(Integer.valueOf(userId)); performanceShift.setWorkTime(i); performanceShift.setShift(""); list.add(performanceShift); } if (list.size() >= 1000) { baseMapper.insertBatchSomeColumn(list); list.clear(); } }); } } if (!list.isEmpty()) { baseMapper.insertBatchSomeColumn(list); } } list.clear(); } // 忬¡æ´æ° List<LocalDateTime> datesBetween = getLocalDateTimesBetween(performanceShiftAddDto.getStartWeek(), performanceShiftAddDto.getEndWeek()); @@ -212,22 +210,24 @@ for (int i = 1; i < 13; i++) { Map<String, Object> hashMapMonth = new LinkedHashMap<>(); double totalMonthAttendance = 0; for (Enums enums : shiftType) { if (!hashMapYear.containsKey(enums.getLabel())) { hashMapYear.put(enums.getLabel(), 0); for (Enums shift : shiftType) { // åå§åèµå¼ if (!hashMapYear.containsKey(shift.getLabel())) { hashMapYear.put(shift.getLabel(), 0); } // æ if (ObjectUtils.isNotEmpty(map.get("month_str")) && map.get("work_time").equals(i)) { if (!ObjectUtils.isEmpty(map.get("month_str"))) { String charArray = map.get("month_str").toString(); int count = countOccurrences(charArray, i + "ï¼" + enums.getValue()); hashMapMonth.put(enums.getLabel(), count); hashMapYear.put(enums.getLabel(), Integer.parseInt(hashMapYear.get(enums.getLabel()).toString()) + count ); if (enums.getValue().equals("0") || enums.getValue().equals("1") || enums.getValue().equals("2") || enums.getValue().equals("6")) { int count = countOccurrences(charArray, i + "ï¼" + shift.getValue()); hashMapMonth.put(shift.getLabel(), count); hashMapYear.put(shift.getLabel(), new BigDecimal(hashMapYear.get(shift.getLabel()).toString()).add(new BigDecimal(count))); // æ©ï¼ä¸ï¼å¤ï¼å·® if (shift.getValue().equals("0") || shift.getValue().equals("1") || shift.getValue().equals("2") || shift.getValue().equals("6")) { totalMonthAttendance += count; totalYearAttendance += count; } // åï¼å¦å¤å天ç®ç»æ© if (enums.getValue().equals("5")) { if (shift.getValue().equals("5")) { BigDecimal multiply = new BigDecimal("0.5").multiply(new BigDecimal(count)).setScale(1, BigDecimal.ROUND_CEILING); hashMapMonth.put(shiftType.get(0).getLabel(), new BigDecimal(hashMapMonth.get(shiftType.get(0).getLabel()).toString()).add(multiply)); hashMapYear.put(shiftType.get(0).getLabel(), new BigDecimal(hashMapYear.get(shiftType.get(0).getLabel()).toString()).add(multiply)); @@ -238,7 +238,7 @@ // ç©ºæ°æ® else { map.put("work_time", i); hashMapMonth.put(enums.getLabel(), 0); hashMapMonth.put(shift.getLabel(), 0); } } hashMapMonth.put("totalMonthAttendance", totalMonthAttendance); @@ -313,7 +313,7 @@ List<PerformanceShiftMapDto> mapIPage = baseMapper.performanceShiftList(time, userName, laboratory); mapIPage.forEach(i -> { String[] shiftTimes = i.getShiftTime().split(";"); int totalAttendance = 0; double totalAttendance = 0; List<Map<String, Object>> map = new ArrayList<>(); // å岿¥æ for (String shiftTime : shiftTimes) { @@ -324,12 +324,22 @@ i.getMonthlyAttendance().put(enums.getLabel(), 0); } if (enums.getValue().equals(shiftTimeAndShift[1])) { Integer num = (Integer) i.getMonthlyAttendance().get(enums.getLabel()); i.getMonthlyAttendance().put(enums.getLabel(), num += 1); BigDecimal bigDecimal = new BigDecimal(i.getMonthlyAttendance().get(enums.getLabel()).toString()); i.getMonthlyAttendance().put(enums.getLabel(), bigDecimal.add(new BigDecimal("1"))); } // åï¼å¦å¤å天ç®ç»æ© if (shiftTimeAndShift[1].equals("5") && enums.getValue().equals("0")) { BigDecimal bigDecimal = new BigDecimal(i.getMonthlyAttendance().get(enums.getLabel()).toString()); i.getMonthlyAttendance().put(enums.getLabel(), bigDecimal.add(new BigDecimal("0.5"))); } } if (shiftTimeAndShift[1].equals("1") || shiftTimeAndShift[1].equals("2") || shiftTimeAndShift[1].equals("0")) { // æ©ï¼ä¸ï¼å¤ï¼å·® if (shiftTimeAndShift[1].equals("1") || shiftTimeAndShift[1].equals("2") || shiftTimeAndShift[1].equals("0") || shiftTimeAndShift[1].equals("6")) { i.getMonthlyAttendance().put("totalAttendance", totalAttendance += 1); } // å if (shiftTimeAndShift[1].equals("5")) { i.getMonthlyAttendance().put("totalAttendance", totalAttendance += 0.5); } hashMap.put("id", shiftTimeAndShift[2]); hashMap.put("shift", shiftTimeAndShift[1]); @@ -400,9 +410,10 @@ /** * è¿å表头 * * <p> * å¤å±List代表è¡å å± List代表å ç¸åçåæ°æ®ä¼è¢«ä¸»å¨åå¹¶ * æé åå表头 * * @return List<List<String>> */ private static List<List<String>> getYearHeader(String year, List<Enums> enums){ @@ -413,13 +424,17 @@ line.add(Arrays.asList("åºå¤è¯¦æ ", year, "åºå¤")); // å¹´ header for (Enums anEnum : enums) { if (!anEnum.getValue().equals("5")) { line.add(Arrays.asList("è夿±æ»", year, anEnum.getLabel())); } } // æheader for (int i = 1; i < 13; i++) { line.add(Arrays.asList("åºå¤è¯¦æ ", i + " æ", "åºå¤")); for (Enums anEnum : enums) { if (!anEnum.getValue().equals("5")) { line.add(Arrays.asList("åºå¤è¯¦æ ", i + " æ", anEnum.getLabel())); } } } return line; @@ -458,12 +473,12 @@ excelRowList.add(list.get(i).getName()); excelRowList.add(list.get(i).getDepartment()); excelRowList.add(list.get(i).getMonthlyAttendance().get("totalAttendance")); excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(3).getLabel())); excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(4).getLabel())); excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(0).getLabel())); excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(1).getLabel())); excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(2).getLabel())); excelRowList.add(0); // åºå·® excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(3).getLabel())); // ä¼ excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(4).getLabel())); // å excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(0).getLabel())); // æ© excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(1).getLabel())); // ä¸ excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(2).getLabel())); // å¤ excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(6).getLabel())); // å·® for (Map<String, Object> o : list.get(i).getList()) { String enumLabel = ""; for (Enums anEnum : enums) { @@ -471,7 +486,7 @@ enumLabel = anEnum.getLabel(); } } excelRowList.add(ObjectUtils.isEmpty(enumLabel) ? "æ " : enumLabel); excelRowList.add(ObjectUtils.isEmpty(enumLabel) ? "-" : enumLabel); } data.add(excelRowList); } performance-server/src/main/java/com/yuanchu/mom/utils/StyleMonthUtils.java
@@ -13,8 +13,8 @@ // 头ççç¥ WriteCellStyle headWriteCellStyle = new WriteCellStyle(); // èæ¯é¢è² headWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex()); headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); // headWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex()); // headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); // åä½ WriteFont headWriteFont = new WriteFont(); performance-server/src/main/java/com/yuanchu/mom/utils/StyleYearUtils.java
@@ -2,15 +2,9 @@ import com.alibaba.excel.write.metadata.style.WriteCellStyle; import com.alibaba.excel.write.metadata.style.WriteFont; import com.yuanchu.mom.pojo.AuxiliaryOutputWorkingHours; import org.apache.poi.ss.usermodel.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; public class StyleYearUtils { /** @@ -22,7 +16,7 @@ // 头ççç¥ WriteCellStyle headWriteCellStyle = new WriteCellStyle(); // èæ¯é¢è² headWriteCellStyle.setFillForegroundColor(IndexedColors.GREEN.getIndex()); // headWriteCellStyle.setFillForegroundColor(IndexedColors.GREEN.getIndex()); headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); // åä½ @@ -63,7 +57,7 @@ WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); // è¿ééè¦æå® FillPatternType 为FillPatternType.SOLID_FOREGROUND ä¸ç¶æ æ³æ¾ç¤ºèæ¯é¢è².头é»è®¤äº FillPatternTypeæä»¥å¯ä»¥ä¸æå® contentWriteCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); // contentWriteCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); contentWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); // 设置åä½ @@ -73,14 +67,14 @@ contentWriteCellStyle.setWriteFont(contentWriteFont);//卿 ·å¼ç¨åºç¨è®¾ç½®çåä½; //è®¾ç½®æ ·å¼; // contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置åºè¾¹æ¡; // contentWriteCellStyle.setBottomBorderColor((short) 1);//设置åºè¾¹æ¡é¢è²; contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置åºè¾¹æ¡; contentWriteCellStyle.setBottomBorderColor((short) 0);//设置åºè¾¹æ¡é¢è²; contentWriteCellStyle.setBorderLeft(BorderStyle.THIN); //设置左边æ¡; contentWriteCellStyle.setLeftBorderColor((short) 1);//设置左边æ¡é¢è²; contentWriteCellStyle.setLeftBorderColor((short) 0);//设置左边æ¡é¢è²; contentWriteCellStyle.setBorderRight(BorderStyle.THIN);//设置å³è¾¹æ¡; contentWriteCellStyle.setRightBorderColor((short) 1);//设置å³è¾¹æ¡é¢è²; contentWriteCellStyle.setRightBorderColor((short) 0);//设置å³è¾¹æ¡é¢è²; contentWriteCellStyle.setBorderTop(BorderStyle.THIN);//设置顶边æ¡; contentWriteCellStyle.setTopBorderColor((short) 1); ///设置顶边æ¡é¢è²; contentWriteCellStyle.setTopBorderColor((short) 0); ///设置顶边æ¡é¢è²; contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);// æ°´å¹³å± ä¸ contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// åç´å± ä¸ user-server/src/main/java/com/yuanchu/mom/controller/CompaniesController.java
@@ -1,10 +1,18 @@ package com.yuanchu.mom.controller; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.yuanchu.mom.annotation.ValueAuth; import com.yuanchu.mom.annotation.ValueClassify; import com.yuanchu.mom.common.GetLook; import com.yuanchu.mom.dto.PersonDto; import com.yuanchu.mom.exception.ErrorException; import com.yuanchu.mom.mapper.PowerMapper; import com.yuanchu.mom.mapper.UserMapper; import com.yuanchu.mom.pojo.Company; import com.yuanchu.mom.pojo.Person; import com.yuanchu.mom.pojo.Power; import com.yuanchu.mom.pojo.User; import com.yuanchu.mom.service.UserService; import com.yuanchu.mom.util.HeaderToken; import com.yuanchu.mom.vo.Result; @@ -13,7 +21,9 @@ import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; import java.util.Map; @RestController @AllArgsConstructor @@ -25,12 +35,41 @@ private UserService userService; UserMapper userMapper; PowerMapper powerMapper; private GetLook getLook; @ValueClassify("ç¨æ·ç®¡ç") @PostMapping("/getSampleUser") @ApiOperation(value = "ç´æ¥è·åä¸èªå·±ç¸ååä½ç人åå表") public Result<?> getSampleUser(){ return Result.success(); } @ValueClassify("ç¨æ·ç®¡ç") @ApiOperation(value = "è·å人äºç³»ç»ç»ç»æ¶æ") @GetMapping(value = "/selectCompaniesList") public Result<List<Company>> selectCompaniesList() { //夿æ¯å¦æç´æ¥è·åç¬¬ä¸æ¹é¨é¨çæé Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId"); User user = userMapper.selectById(userId); Integer roleId = user.getRoleId(); Power power = powerMapper.selectOne(Wrappers.<Power>lambdaQuery().eq(Power::getRoleId, roleId).eq(Power::getMenuMethod, "getSampleUser")); if (ObjectUtils.isNotEmpty(power)){ List<Company> companies = new ArrayList<>(); Company company = new Company(); if (ObjectUtils.isEmpty(user.getCompanyId())){ throw new ErrorException("è¯¥ç¨æ·æ²¡ææå±åä½!"); } company.setCompanyId(user.getCompanyId()); companies.add(company); return Result.success(companies); }else { return Result.success(headerToken.companyUrl()); } } @ValueAuth @ApiOperation("è·å人äºç³»ç»ç»ç»ä¸ç人å") user-server/src/main/java/com/yuanchu/mom/pojo/User.java
@@ -105,4 +105,7 @@ @ApiModelProperty(value = "LIMSå ³èçé¨é¨id") private String departLimsId; @ApiModelProperty(value = "人äºç³»ç»å ³èçid") private String companyId; } user-server/src/main/java/com/yuanchu/mom/service/UserService.java
user-server/src/main/java/com/yuanchu/mom/service/impl/UserServiceImp.java
@@ -159,6 +159,7 @@ user.setCompany(BeanUtil.isNotEmpty(custom)?(custom.getId()+""):companyName); user.setAddress("æªå¡«å"); user.setRoleId(personDto.getRoleId()>10000?0:personDto.getRoleId()); user.setCompanyId(person.getCompanyId()); userMapper.insert(user); } else { user.setName(person.getName()); @@ -170,6 +171,7 @@ user.setCreateTime(null); user.setUpdateUser(null); user.setUpdateTime(null); user.setCompanyId(person.getCompanyId()); userMapper.updateById(user); } });