Merge remote-tracking branch 'origin/master'
| | |
| | | import java.io.File; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 设å¤(DeviceController)表æ§å¶å± |
| | |
| | | @ValueClassify("设å¤") |
| | | @ApiOperation(value = "ç»´æ¤æ°éé
ç½®") |
| | | @PostMapping("/saveDataAcquisitionConfiguration") |
| | | public Result<?> saveDataAcquisitionConfiguration(@RequestBody DataConfigDto dataConfigList) { |
| | | dataConfigService.saveOrUpdateBatch(dataConfigList.getDataConfigList()); |
| | | public Result<?> saveDataAcquisitionConfiguration(@RequestParam(value = "deviceId") Integer deviceId, @RequestBody DataConfigDto dataConfigList) { |
| | | if (dataConfigList.getIsDevice()) { |
| | | System.out.println(); |
| | | Device device = new Device(); |
| | | device.setId(deviceId); |
| | | device.setCollectUrl(dataConfigList.getCollectUrl()); |
| | | device.setStorageUrl(dataConfigList.getStorageUrl()); |
| | | device.setIp(dataConfigList.getIp()); |
| | | device.setFileType(dataConfigList.getFileType()); |
| | | deviceService.updateById(device); |
| | | } else { |
| | | dataConfigService.saveOrUpdateBatch(dataConfigList.getDataConfigList()); |
| | | } |
| | | return Result.success(); |
| | | } |
| | | |
| | | // @ValueClassify("设å¤") |
| | | // @ApiOperation(value = "æ¥è¯¢æ°éé
ç½®") |
| | | // @GetMapping("/queryDataAcquisitionConfiguration") |
| | | // public Result<?> queryDataAcquisitionConfiguration(@RequestParam("deviceId") Integer deviceId, @RequestParam("insProductItem") String insProductItem) { |
| | | // List<DataConfig> list = dataConfigService.list(Wrappers.<DataConfig>lambdaQuery() |
| | | // .eq(DataConfig::getDeviceId, deviceId) |
| | | // .eq(DataConfig::getInsProductItem, insProductItem)); |
| | | // return Result.success(list); |
| | | // } |
| | | |
| | | @ValueClassify("设å¤") |
| | | @ApiOperation(value = "æ¥è¯¢æ°éé
ç½®") |
| | | @GetMapping("/queryDataAcquisitionConfiguration") |
| | | public Result<?> queryDataAcquisitionConfiguration(@RequestParam("deviceId") Integer deviceId, @RequestParam("insProductItem") String insProductItem) { |
| | | List<DataConfig> list = dataConfigService.list(Wrappers.<DataConfig>lambdaQuery() |
| | | public Result<?> queryDataAcquisitionConfiguration(@RequestParam("deviceId") Integer deviceId, |
| | | @RequestParam("isDevice") Boolean isDevice, |
| | | @RequestParam(value = "insProductItem", required = false) String insProductItem) { |
| | | if (isDevice) { |
| | | List<DataConfig> list = dataConfigService.list(Wrappers.<DataConfig>lambdaQuery() |
| | | .eq(DataConfig::getDeviceId, deviceId) |
| | | .eq(DataConfig::getInsProductItem, insProductItem)); |
| | | return Result.success(list); |
| | | return Result.success(list); |
| | | } else { |
| | | return Result.success(dataConfigService.selectDataConfigList(deviceId)); |
| | | } |
| | | } |
| | | |
| | | @ValueClassify("设å¤") |
| | | @ApiOperation(value = "å 餿°éé
ç½®") |
| | | @DeleteMapping("/deleteDataAcquisitionConfiguration") |
| | | public Result<?> deleteDataAcquisitionConfiguration(@RequestParam("id") Integer id) { |
| | | dataConfigService.removeById(id); |
| | | public Result<?> deleteDataAcquisitionConfiguration(@RequestParam("ids") String ids) { |
| | | List<String> split = Arrays.asList(ids.split(",")); |
| | | List<String> collect = split.stream().distinct().collect(Collectors.toList()); |
| | | dataConfigService.removeBatchByIds(collect); |
| | | return Result.success(); |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.mom.dto; |
| | | |
| | | import com.yuanchu.mom.pojo.DataConfig; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | |
| | | public class DataConfigDto { |
| | | |
| | | private List<DataConfig> dataConfigList; |
| | | |
| | | private Boolean isDevice; |
| | | |
| | | @ApiModelProperty("æä»¶åç¼") |
| | | private String fileType; |
| | | |
| | | @ApiModelProperty("ééå°å") |
| | | private String collectUrl; |
| | | |
| | | @ApiModelProperty("åå¨å°å") |
| | | private String storageUrl; |
| | | |
| | | @ApiModelProperty("设å¤IP") |
| | | private String ip; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.yuanchu.mom.annotation.ValueTableShow; |
| | | import com.yuanchu.mom.common.OrderBy; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class DeviceConfigDtoPage extends OrderBy { |
| | | |
| | | @ValueTableShow(2) |
| | | @ApiModelProperty(value = "设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ValueTableShow(3) |
| | | @ApiModelProperty(value = "æä»¶åç¼") |
| | | private String fileType; |
| | | |
| | | @ValueTableShow(4) |
| | | @ApiModelProperty(value = "ééå°å") |
| | | private String collectUrl; |
| | | |
| | | @ValueTableShow(5) |
| | | @ApiModelProperty(value = "åå¨å°å") |
| | | private String storageUrl; |
| | | |
| | | @ValueTableShow(6) |
| | | @ApiModelProperty(value = "IPå°å") |
| | | private String ip; |
| | | |
| | | @ValueTableShow(7) |
| | | @ApiModelProperty(value = "æ£éªé¡¹") |
| | | private String inspectionItem; |
| | | |
| | | @ValueTableShow(8) |
| | | @ApiModelProperty(value = "æ£éªé¡¹å项") |
| | | private String inspectionItemSubClass; |
| | | |
| | | @ValueTableShow(9) |
| | | @ApiModelProperty(value = "å
¬å¼") |
| | | private String formula; |
| | | |
| | | @ValueTableShow(10) |
| | | @ApiModelProperty(value = "åç
§X") |
| | | private String referx; |
| | | |
| | | @ValueTableShow(11) |
| | | @ApiModelProperty(value = "X") |
| | | private String x; |
| | | |
| | | @ValueTableShow(12) |
| | | @ApiModelProperty(value = "åç
§Y") |
| | | private String refery; |
| | | |
| | | @ValueTableShow(13) |
| | | @ApiModelProperty(value = "Y") |
| | | private String y; |
| | | |
| | | private Integer id; |
| | | } |
| | |
| | | package com.yuanchu.mom.mapper; |
| | | |
| | | import com.yuanchu.mom.pojo.DataConfig; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.yuanchu.mom.dto.DeviceConfigDtoPage; |
| | | import com.yuanchu.mom.pojo.DataConfig; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface DataConfigMapper extends BaseMapper<DataConfig> { |
| | | |
| | | List<DeviceConfigDtoPage> selectDataConfigList(Integer deviceId); |
| | | } |
| | |
| | | package com.yuanchu.mom.service; |
| | | |
| | | import com.yuanchu.mom.pojo.DataConfig; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.mom.dto.DeviceConfigDtoPage; |
| | | import com.yuanchu.mom.pojo.DataConfig; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface DataConfigService extends IService<DataConfig> { |
| | | |
| | | List<DeviceConfigDtoPage> selectDataConfigList(Integer deviceId); |
| | | } |
| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import com.yuanchu.mom.pojo.DataConfig; |
| | | import com.yuanchu.mom.mapper.DataConfigMapper; |
| | | import com.yuanchu.mom.service.DataConfigService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.common.GetLook; |
| | | import com.yuanchu.mom.dto.DeviceConfigDtoPage; |
| | | import com.yuanchu.mom.mapper.DataConfigMapper; |
| | | import com.yuanchu.mom.pojo.DataConfig; |
| | | import com.yuanchu.mom.service.DataConfigService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-07-13 12:23:00 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class DataConfigServiceImpl extends ServiceImpl<DataConfigMapper, DataConfig> implements DataConfigService { |
| | | |
| | | private GetLook getLook; |
| | | |
| | | private DataConfigMapper dataConfigMapper; |
| | | @Override |
| | | public List<DeviceConfigDtoPage> selectDataConfigList(Integer deviceId) { |
| | | return dataConfigMapper.selectDataConfigList(deviceId); |
| | | } |
| | | } |
| | |
| | | public Result<?> dataAcquisition(HttpServletRequest request, Integer id, String entrustCode, String sampleCode) { |
| | | String ipAddress = request.getRemoteAddr(); |
| | | // 鲿¢åç¯å°åå为IPv6 |
| | | String ip = ipAddress.equals("0:0:0:0:0:0:0:1") ? "127.0.0.1" : ipAddress; |
| | | String ip = ipAddress.equals("0:0:0:0:0:0:0:1") ? "127.0.0.1" : ipAddress; |
| | | List<Device> device = baseMapper.selectList(Wrappers.<Device>lambdaQuery() |
| | | .eq(Device::getIp, ip)); |
| | | if (ObjectUtils.isEmpty(device)) { |
| | |
| | | .orderBy(false, false, DataConfig::getId)); |
| | | hashMap.putAll(DataAcquisition.dataAcquisitionEntrance(request, list, i, entrustCode, sampleCode, ip)); |
| | | }); |
| | | String frequency = DataAcquisition.createFrequency(entrustCode, sampleCode); |
| | | hashMap.put("frequency", frequency); |
| | | return Result.success(hashMap); |
| | | } |
| | | } |
| | |
| | | } |
| | | // 妿åå¨åå¨å°åï¼åç§»å¨å°å |
| | | if (ObjectUtils.isNotEmpty(device.getStorageUrl())) { |
| | | String s = HTTP + ip + MOVEFILE + "?startFilePath=" + device.getCollectUrl() + "&endFilePath=" + device.getStorageUrl(); |
| | | String s = HTTP + ip + MOVEFILE + "?startFilePath=" + device.getCollectUrl() + "&endFilePath=" + device.getStorageUrl() + "&fileType=" + device.getFileType(); |
| | | String storageUrlResult = HttpUtil.get(s); |
| | | JSONObject storageUrlResultJson = JSON.parseObject(storageUrlResult); |
| | | if (Objects.equals(storageUrlResultJson.get("code"), 1)) { |
| | | if (Objects.equals(storageUrlResultJson.get("code"), 0)) { |
| | | if (ObjectUtils.isEmpty(storageUrlResultJson.get("msg"))) { |
| | | throw new ErrorException("åå¨å°åé误ï¼å¯è½æä»¶è·¯å¾é
ç½®é误ï¼"); |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } |
| | | String frequency = createFrequency(entrustCode, sampleCode); |
| | | map.put("frequency", frequency); |
| | | return map; |
| | | } |
| | | } |
| | | |
| | | private static String createFrequency(String entrustCode, String sampleCode) { |
| | | public static String createFrequency(String entrustCode, String sampleCode) { |
| | | String key = frequency + ":" + entrustCode + ":" + sampleCode; |
| | | boolean b = RedisUtil.hasKey(key); |
| | | String frequencyValue; |
| | |
| | | JSONObject jsonObject1 = JSON.parseObject(dataList.get(y).toString()); |
| | | Object o = jsonObject1.get(key); |
| | | if (ObjectUtils.isNotEmpty(o)) { |
| | | list.add(o); |
| | | // å°æ°ç¹è¿ä¸ä½ |
| | | double v1 = 0; |
| | | try { |
| | | v1 = Double.parseDouble(o.toString()); |
| | | double v2 = v1 / 1000; |
| | | list.add(v2); |
| | | } catch (NumberFormatException e) { |
| | | list.add(o); |
| | | } |
| | | |
| | | } |
| | | } |
| | | // è¿è¡å
¬å¼è®¡ç® |
| | |
| | | <result column="y" property="y" /> |
| | | </resultMap> |
| | | |
| | | <select id="selectDataConfigList" resultType="com.yuanchu.mom.dto.DeviceConfigDtoPage"> |
| | | SELECT d.device_name, |
| | | d.file_type, |
| | | d.collect_url, |
| | | d.storage_url, |
| | | d.ip, |
| | | ip.inspection_item, |
| | | if(ip.inspection_item_subclass is not null and ip.inspection_item_subclass != '', |
| | | ip.inspection_item_subclass, ip.inspection_item) inspection_item_subclass, |
| | | ddc.formula, |
| | | ddc.referx, |
| | | ddc.refery, |
| | | ddc.x, |
| | | ddc.y, |
| | | ddc.id |
| | | FROM device d |
| | | left join structure_item_parameter ip on FIND_IN_SET(ip.id, d.ins_product_ids) |
| | | left join device_data_config ddc on ddc.device_id = d.id and |
| | | if(ip.inspection_item_subclass is not null and |
| | | ip.inspection_item_subclass != '', ip.inspection_item_subclass, |
| | | ip.inspection_item) = ddc.ins_product_item |
| | | where d.id = #{deviceId} |
| | | </select> |
| | | </mapper> |
| | |
| | | </select> |
| | | |
| | | <select id="getInspectionItemSubclass" resultType="java.lang.String"> |
| | | SELECT ip.inspection_item_subclass FROM ins_product ip |
| | | SELECT if(ip.inspection_item_subclass is not null and ip.inspection_item_subclass != '', |
| | | ip.inspection_item_subclass, ip.inspection_item) inspection_item_subclass FROM ins_product ip |
| | | where ip.ins_sample_id = #{id} |
| | | </select> |
| | | </mapper> |
| | |
| | | @ValueClassify("æ£éªä¸å") |
| | | @ApiOperation(value = "æ£éªåé
") |
| | | @PostMapping("/upInsOrder") |
| | | public Result<?> upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId) { |
| | | return Result.success(insOrderService.upInsOrder(orderId, sampleId, appointed, userId)); |
| | | public Result<?> upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId,String sonLaboratory) { |
| | | return Result.success(insOrderService.upInsOrder(orderId, sampleId, appointed, userId,sonLaboratory)); |
| | | } |
| | | @ValueClassify("æ£éªä¸å") |
| | | @ApiOperation(value = "æ·»å æ£éªä¸åæ°æ®") |
| | |
| | | @ValueClassify("æ£éªä»»å¡") |
| | | @ApiOperation(value = "ä»»å¡äº¤æ¥") |
| | | @PostMapping("/upPlanUser") |
| | | public Result<?> upPlanUser(Integer userId, Integer orderId) { |
| | | return Result.success(insOrderPlanService.upPlanUser(userId, orderId)); |
| | | public Result<?> upPlanUser(Integer userId, Integer orderId,String sonLaboratory) { |
| | | return Result.success(insOrderPlanService.upPlanUser(userId, orderId, sonLaboratory)); |
| | | } |
| | | |
| | | @ValueClassify("æ£éªä»»å¡") |
| | |
| | | return num == 1 ? Result.success() : Result.fail("æäº¤å¤±è´¥ï¼é¨å项ç®è¿æªè¿è¡æ£éª"); |
| | | } |
| | | |
| | | @ValueClassify("æ£éªä»»å¡") |
| | | @ApiOperation(value = "æ¯å¦å
许修æ¹ééå¼") |
| | | @DeleteMapping("/isItAllowedToModifyTheCollectedValues") |
| | | public Result<?> isItAllowedToModifyTheCollectedValues() { |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "ä¿åæ£éªå
容") |
| | | @PostMapping("/saveInsContext") |
| | | @ValueAuth |
| | |
| | | */ |
| | | public interface InsSampleMapper extends BaseMapper<InsSample> { |
| | | |
| | | IPage<InsOrderPlanVO> findInsSampleAndOrder(Page page, QueryWrapper<InsOrderPlanDTO> ew, Integer userId); |
| | | IPage<InsOrderPlanVO> findInsSampleAndOrder(Page page, QueryWrapper<InsOrderPlanDTO> ew, Integer userId,String sonLaboratory); |
| | | |
| | | IPage<InsOrderPlanTaskSwitchVo> inspectionOrderDetailsTaskSwitching(Page page, QueryWrapper<InsOrderPlanDTO> ew, Integer userId); |
| | | IPage<InsOrderPlanTaskSwitchVo> inspectionOrderDetailsTaskSwitching(Page page, QueryWrapper<InsOrderPlanDTO> ew, Integer userId,String sonLaboratory); |
| | | |
| | | List<SampleProductDto> selectSampleProductListByOrderId(Integer id); |
| | | |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | |
| | | /** |
| | | * æ ·åè´è´£äººè®°å½ |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | public InsSampleUser(Integer insSampleId, Integer userId, Integer state) { |
| | | /** |
| | | * åè¯éªå®¤ |
| | | * @param insSampleId |
| | | * @param userId |
| | | * @param state |
| | | */ |
| | | private String sonLaboratory; |
| | | |
| | | public InsSampleUser(Integer insSampleId, Integer userId, Integer state,String sonLaboratory) { |
| | | this.insSampleId = insSampleId; |
| | | this.userId = userId; |
| | | this.state = state; |
| | | this.sonLaboratory = sonLaboratory; |
| | | } |
| | | } |
| | |
| | | |
| | | Map<String, Object> doInsOrder(Integer id, String laboratory); |
| | | |
| | | int upPlanUser(Integer userId, Integer orderId); |
| | | int upPlanUser(Integer userId, Integer orderId,String sonLaboratory); |
| | | |
| | | int verifyPlan(Integer orderId, String laboratory, Integer type, String tell); |
| | | |
| | |
| | | Map<String, Object> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto); |
| | | |
| | | //ä¿®æ¹æ£éªä¸åæ°æ® |
| | | int upInsOrder(Integer orderId,Integer sampleId, String appointed, Integer userId); |
| | | int upInsOrder(Integer orderId,Integer sampleId, String appointed, Integer userId,String sonLaboratory); |
| | | |
| | | int addInsOrder(List<SampleProductDto> list, InsOrder insOrder, List<List<Integer>> pairing); |
| | | |
| | |
| | | userId = map1.get("userId"); |
| | | insOrderPlanDTO.setUserId(userId.longValue()); |
| | | } |
| | | IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId); |
| | | String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//è¯éªå®¤ |
| | | IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory); |
| | | map.put("body", insOrderPage); |
| | | return map; |
| | | } |
| | |
| | | if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) { |
| | | insOrderPlanDTO.setUserId(userId.longValue()); |
| | | } |
| | | IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId); |
| | | String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//è¯éªå®¤ |
| | | IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory); |
| | | map.put("body", insOrderPage); |
| | | return map; |
| | | } |
| | | |
| | | //认é¢ä»»å¡ |
| | | @Override |
| | | public boolean claimInsOrderPlan(InsOrderPlanDTO entity) { |
| | | if (Objects.isNull(entity)) { |
| | |
| | | } |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null); |
| | | Integer userId = map1.get("userId"); |
| | | InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 1); |
| | | InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 1,entity.getSonLaboratory()); |
| | | return insSampleUserMapper.insert(insSampleUser) > 0; |
| | | } |
| | | |
| | |
| | | productVos = productVos.stream().sorted(Comparator.comparing(productVo -> productVo.getInsProduct().getInspectionItemClass())).collect(Collectors.toList()); |
| | | } |
| | | else { |
| | | //çµå--çå¾ªç¯ |
| | | //çµå--ç循ç¯å温åè¯éª |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, sampleId) |
| | | .eq(InsProduct::getInspectionItem, inspectionItem)); |
| | |
| | | .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, insProduct.getInspectionItemSubclass()) |
| | | .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode())); |
| | | if (count == 0 && ObjectUtils.isNotEmpty(insProduct.getManHour())) { |
| | | //æ·»å æ¯ä¸ªäººç产éå·¥æ¶ |
| | | //æ·»å æ¯ä¸ªäººç产éå·¥æ¶,è¦å¤æå½åæ¶é´æ¯å¦æ¯è¿ä¸ªäººçæçæ¶é´,妿䏿¯åæ¯å ç |
| | | AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours(); |
| | | auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//æ£æµç¶é¡¹ |
| | | auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//æ£æµå项 |
| | |
| | | }); |
| | | } |
| | | |
| | | //äº¤æ¥ |
| | | @Override |
| | | public int upPlanUser(Integer userId, Integer orderId) { |
| | | public int upPlanUser(Integer userId, Integer orderId,String sonLaboratory) { |
| | | InsSampleUser insSampleUser = new InsSampleUser(); |
| | | insSampleUser.setUserId(userId); |
| | | insSampleUser.setInsSampleId(orderId); |
| | | insSampleUser.setState(0); |
| | | insSampleUser.setSonLaboratory(sonLaboratory); |
| | | return insSampleUserMapper.insert(insSampleUser); |
| | | } |
| | | |
| | |
| | | info.setViewStatus(false); |
| | | info.setJumpPath("b1-inspect-order-plan"); |
| | | informationNotificationService.addInformationNotification(info); |
| | | upPlanUser(verifyUser, orderId); |
| | | //夿 ¸äºº--æ£éªåç¸å
³è´è´£äºº |
| | | InsSampleUser insSampleUser = new InsSampleUser(); |
| | | insSampleUser.setUserId(verifyUser); |
| | | insSampleUser.setInsSampleId(orderId); |
| | | insSampleUser.setState(0); |
| | | insSampleUser.setSonLaboratory(laboratory); |
| | | insSampleUserMapper.insert(insSampleUser); |
| | | /*æ ¡éªä¸ä¸result表*/ |
| | | CompletableFuture.supplyAsync(() -> { |
| | | List<Integer> ips = insProducts.stream().map(InsProduct::getId).distinct().collect(Collectors.toList()); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId) { |
| | | public int upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId,String sonLaboratory) { |
| | | InsOrder insOrder = new InsOrder(); |
| | | insOrder.setId(orderId); |
| | | insOrder.setAppointed(LocalDate.parse(appointed)); |
| | |
| | | insSampleUser.setState(0); |
| | | insSampleUser.setUserId(userId); |
| | | insSampleUser.setInsSampleId(orderId); |
| | | insSampleUser.setSonLaboratory(sonLaboratory); |
| | | insSampleUserMapper.insert(insSampleUser); |
| | | } |
| | | return 1; |
| | |
| | | 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 |
| | | 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 |
| | |
| | | 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 ( |
| | | WHERE son_laboratory=#{sonLaboratory} and (ins_sample_id, id) IN ( |
| | | SELECT ins_sample_id, MAX(id) |
| | | FROM ins_sample_user |
| | | WHERE son_laboratory=#{sonLaboratory} |
| | | GROUP BY ins_sample_id |
| | | ) |
| | | ORDER BY ins_sample_id, 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 |
| | | ins_sample_user where son_laboratory=#{sonLaboratory} 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> |
| | |
| | | <select id="inspectionOrderDetailsTaskSwitching" resultType="com.yuanchu.mom.vo.InsOrderPlanTaskSwitchVo"> |
| | | select * from( |
| | | SELECT |
| | | a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id,(ios.verify_user = #{userId}) verify_user |
| | | FROM |
| | | a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id,<!--(ios.verify_user = #{userId})--> verify_user |
| | | <!--FROM |
| | | ( |
| | | SELECT |
| | | io.id, |
| | |
| | | a.user_id DESC, |
| | | a.type DESC, |
| | | a.id |
| | | ) b--> |
| | | FROM |
| | | ( |
| | | SELECT |
| | | io.id, |
| | | io.entrust_code, |
| | | io.type, |
| | | io.appointed, |
| | | 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 --> |
| | | SELECT * |
| | | FROM ins_sample_user u |
| | | WHERE son_laboratory=#{sonLaboratory} and (ins_sample_id, id) IN ( |
| | | SELECT ins_sample_id, MAX(id) |
| | | FROM ins_sample_user |
| | | WHERE son_laboratory=#{sonLaboratory} |
| | | 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 |
| | | <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 where son_laboratory=#{sonLaboratory} 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.type DESC, |
| | | a.id |
| | | ) b |
| | | where ins_state is not null)A |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | |
| | | List<Map<String, Object>> performanceShiftYearList(String time, String userName, String laboratory); |
| | | |
| | | List<PerformanceShiftMapDto> performanceShiftList(String time, String userName, String laboratory); |
| | | |
| | | String seldepLimsId(int depLimsId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.common.GetLook; |
| | | import com.yuanchu.mom.dto.PerformanceShiftAddDto; |
| | | import com.yuanchu.mom.dto.PerformanceShiftMapDto; |
| | | import com.yuanchu.mom.mapper.PerformanceShiftMapper; |
| | | import com.yuanchu.mom.mapper.UserMapper; |
| | | import com.yuanchu.mom.pojo.Enums; |
| | | import com.yuanchu.mom.pojo.PerformanceShift; |
| | | import com.yuanchu.mom.pojo.User; |
| | | import com.yuanchu.mom.service.EnumService; |
| | | import com.yuanchu.mom.service.PerformanceShiftService; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | |
| | | |
| | | @Autowired |
| | | private EnumService enumService; |
| | | |
| | | @Autowired |
| | | GetLook getLook; |
| | | |
| | | @Autowired |
| | | UserMapper userMapper; |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public Map<String, Object> performanceShiftPage(Page<Object> page, String time, String userName, String laboratory) { |
| | | //æ¥è¯¢å½åç»å½äººåçæ¶æ |
| | | Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId"); |
| | | //夿å
¨é¨,个人,ç»ç»çæé |
| | | User user = userMapper.selectById(userId);//å½åç»å½ç人 |
| | | //è·åå½å人æå±å®éªå®¤id |
| | | String departLimsId = user.getDepartLimsId(); |
| | | if (com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) { |
| | | String[] split = departLimsId.split(","); |
| | | //æ¥è¯¢å¯¹åºæ¶æåç§°(éä¿¡å®éªå®¤,çµåå®éªå®¤,æ£æµå) |
| | | String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1])); |
| | | if (departLims.contains("å®éªå®¤")) { |
| | | laboratory = departLims; |
| | | } |
| | | } |
| | | IPage<PerformanceShiftMapDto> mapIPage = baseMapper.performanceShiftPage(page, time, userName, laboratory); |
| | | List<Enums> shiftType = enumService.selectEnumByCategory("çæ¬¡ç±»å"); |
| | | List<Map<String, Object>> mapYearIPage = baseMapper.performanceShiftYearPage(time, userName, laboratory); |
| | |
| | | |
| | | <select id="performanceShiftPage" resultMap="performanceShiftPageMap"> |
| | | SELECT |
| | | if(u.department is not null and u.department != '', CONCAT(u.name, 'ï¼', u.department, 'ï¼'), u.name) name, |
| | | GROUP_CONCAT(s.work_time, 'ï¼', s.shift, 'ï¼', s.id order by s.work_time SEPARATOR ';') AS shift_time, u.id user_id |
| | | if(u2.department is not null and u2.department != '', CONCAT(u2.name, 'ï¼', u2.department, 'ï¼'), u2.name) name, |
| | | GROUP_CONCAT(s.work_time, 'ï¼', s.shift, 'ï¼', s.id order by s.work_time SEPARATOR ';') AS shift_time, u2.id user_id |
| | | FROM performance_shift s |
| | | LEFT JOIN user u on u.id = s.user_id |
| | | LEFT JOIN (SELECT u.* from |
| | | user u |
| | | left join department_lims dl on FIND_IN_SET(dl.id,u.depart_lims_id) |
| | | where state=1 |
| | | <if test="laboratory != null and laboratory != ''"> |
| | | and dl.name=#{laboratory} |
| | | </if> |
| | | ) u2 on u2.id = s.user_id |
| | | <where> |
| | | name is not null |
| | | <if test="time != null and time != ''"> |
| | | and DATE_FORMAT(s.work_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m' ) |
| | | </if> |
| | | <if test="userName != null and userName != ''"> |
| | | and u.name like concat('%', #{userName}, '%') |
| | | </if> |
| | | <if test="laboratory != null and laboratory != ''"> |
| | | and u2.name like concat('%', #{userName}, '%') |
| | | </if> |
| | | </where> |
| | | GROUP BY u.id |
| | | GROUP BY u2.id |
| | | order by s.create_time |
| | | </select> |
| | | |
| | |
| | | GROUP BY u.id |
| | | order by s.create_time |
| | | </select> |
| | | |
| | | <select id="seldepLimsId" resultType="java.lang.String"> |
| | | select name |
| | | from department_lims |
| | | where id = #{depLimsId} |
| | | </select> |
| | | </mapper> |
| | |
| | | package com.yuanchu.mom.backup; |
| | | |
| | | import com.yuanchu.mom.dto.PerformanceShiftAddDto; |
| | | import com.yuanchu.mom.mapper.EnumMapper; |
| | | import com.yuanchu.mom.pojo.Enums; |
| | | import com.yuanchu.mom.pojo.PerformanceShift; |
| | | import com.yuanchu.mom.pojo.User; |
| | | import com.yuanchu.mom.service.EnumService; |
| | | import com.yuanchu.mom.service.PerformanceShiftService; |
| | | import com.yuanchu.mom.service.UserService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.*; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.time.temporal.WeekFields; |
| | | import java.util.Date; |
| | | import java.util.Dictionary; |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | import java.util.stream.Collectors; |
| | | |
| | | //@Component |
| | | @Component |
| | | @EnableScheduling |
| | | @Slf4j |
| | | public class MysqlDataBackup { |
| | |
| | | @Value("${backup.mysqldump}") |
| | | private String mysqldump; |
| | | |
| | | @Resource |
| | | private PerformanceShiftService performanceShiftService; |
| | | |
| | | @Resource |
| | | private EnumService enumService; |
| | | |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | /** |
| | | * æ¯å¤©æä¸23ç¹05ç§æ§è¡ ã 0 0 4 1/1 * ? ã |
| | | * æµè¯ 20 ç§ä¸æ¬¡ã 0/20 * * * * ? ã@Scheduled(cron = "5 * 23 * * ?") |
| | | */ |
| | | // @Scheduled(cron = "5 0 23 * * ?") |
| | | //@Scheduled(cron = "0/20 * * * * ?") |
| | | private void configureTasks() { |
| | | log.info("ãå¤ä»½æ°æ®åºã--START"); |
| | | String dbUrl2 = dbUrl.replace("jdbc:mysql://", ""); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡,æ¯ä¸ªæ1å·ç00:00:00 |
| | | * ç»æ¯ä¸ªäººé½è¿è¡æç(é»è®¤æ©ç) |
| | | */ |
| | | @Scheduled(cron = "0 0 0 1 * ?") |
| | | //@Scheduled(cron = "0/20 * * * * ?") |
| | | private void timerCreateSchedule(){ |
| | | System.out.println("å¼å§ç»æ¯ä¸ªäººè¿è¡æç,é»è®¤æ©ç======start"); |
| | | // TODO ç»æ¯ä¸ªäººé½è¿è¡æç(é»è®¤æ©ç) |
| | | PerformanceShiftAddDto performanceShiftAddDto = new PerformanceShiftAddDto(); |
| | | //çæ¬¡--æ©(æ¥è¯¢åå
¸) |
| | | List<Enums> shiftType = enumService.selectEnumByCategory("çæ¬¡ç±»å"); |
| | | List<String> collect = shiftType.stream().filter(enums -> enums.getLabel().equals("æ©")).map(enums -> enums.getValue()).collect(Collectors.toList()); |
| | | performanceShiftAddDto.setShift(collect.get(0)); |
| | | //人å--ææäºº |
| | | String userIds = userService.getDeviceManager().stream().map(user -> user.getId().toString()).distinct().collect(Collectors.joining(",")); |
| | | performanceShiftAddDto.setUserId(userIds); |
| | | //卿¬¡--å½æææ |
| | | // è·åå½åæ¥æ |
| | | LocalDate today = LocalDate.now(); |
| | | // è·åæ¬æç第ä¸å¤©åæåä¸å¤© |
| | | LocalDate firstDayOfMonth = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | LocalDate lastDayOfMonth = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | // è·åå¨å段信æ¯ï¼æ ¹æ®åºåè®¾ç½®ï¼ |
| | | WeekFields weekFields = WeekFields.of(Locale.getDefault()); |
| | | // è·åæ¬æç¬¬ä¸å¤©çå¨ä¸ |
| | | LocalDate startOfWeek = firstDayOfMonth.with(TemporalAdjusters.previousOrSame(weekFields.getFirstDayOfWeek())); |
| | | // éåæ¬æææå¤©æ°ï¼æ¾åºæ¯å¨ç第ä¸å¤©åæåä¸å¤© |
| | | LocalDate endOfWeek; |
| | | while (startOfWeek.isBefore(firstDayOfMonth.plusMonths(1))) { |
| | | endOfWeek = startOfWeek.plusDays(6); |
| | | LocalDateTime startDateTime = LocalDateTime.of(startOfWeek, LocalTime.MIDNIGHT); |
| | | LocalDateTime endDateTime = LocalDateTime.of(endOfWeek, LocalTime.MIDNIGHT); |
| | | System.out.println("Week starts on " + startDateTime + " and ends on " + endDateTime); |
| | | performanceShiftAddDto.setStartWeek(startDateTime); |
| | | performanceShiftAddDto.setEndWeek(endDateTime); |
| | | performanceShiftService.performanceShiftAdd(performanceShiftAddDto); |
| | | startOfWeek = startOfWeek.plusWeeks(1); |
| | | } |
| | | |
| | | System.out.println("æçç»æ======end"); |
| | | } |
| | | |
| | | /** |
| | | * 夿æä»¶æ¯å¦åå¨ï¼ä¸åå¨å建 |
| | | */ |
| | |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.time.temporal.WeekFields; |
| | | import java.util.Locale; |
| | | |
| | | |
| | | @SpringBootTest |
| | | class SystemRunApplicationTest { |
| | | |
| | | @Test |
| | | void contextLoads() throws Exception { |
| | | void contextLoads() { |
| | | // è·åå½åæ¥æ |
| | | LocalDate today = LocalDate.now(); |
| | | |
| | | // è·åæ¬æç第ä¸å¤©åæåä¸å¤© |
| | | LocalDate firstDayOfMonth = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | LocalDate lastDayOfMonth = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | |
| | | // è·åå¨å段信æ¯ï¼æ ¹æ®åºåè®¾ç½®ï¼ |
| | | WeekFields weekFields = WeekFields.of(Locale.getDefault()); |
| | | |
| | | // è·åæ¬æç¬¬ä¸å¤©çå¨ä¸ |
| | | LocalDate startOfWeek = firstDayOfMonth.with(TemporalAdjusters.previousOrSame(weekFields.getFirstDayOfWeek())); |
| | | |
| | | // éåæ¬æææå¤©æ°ï¼æ¾åºæ¯å¨ç第ä¸å¤©åæåä¸å¤© |
| | | LocalDate endOfWeek; |
| | | while (startOfWeek.isBefore(firstDayOfMonth.plusMonths(1))) { |
| | | endOfWeek = startOfWeek.plusDays(6); |
| | | LocalDateTime startDateTime = LocalDateTime.of(startOfWeek, LocalTime.MIDNIGHT); |
| | | LocalDateTime endDateTime = LocalDateTime.of(endOfWeek, LocalTime.MIDNIGHT); |
| | | |
| | | System.out.println("Week starts on " + startDateTime + " and ends on " + endDateTime); |
| | | |
| | | startOfWeek = startOfWeek.plusWeeks(1); |
| | | } |
| | | } |
| | | } |