Merge remote-tracking branch 'origin/master'
| | |
| | | |
| | | import java.util.Map; |
| | | |
| | | @Api("æ åæ¹æ³") |
| | | @Api(tags = "æ åæ¹æ³") |
| | | @RestController |
| | | @RequestMapping("/standardMethod") |
| | | @AllArgsConstructor |
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @ApiModelProperty("ç¶çº§id") |
| | | private Integer fatherId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | private String companyId; |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<StandardMethod> selectStandardMethods() { |
| | | return standardMethodMapper.selectList(Wrappers.<StandardMethod>lambdaQuery().select(StandardMethod::getId,StandardMethod::getCode,StandardMethod::getName)); |
| | | return standardMethodMapper.selectList(Wrappers.<StandardMethod>lambdaQuery().select(StandardMethod::getId,StandardMethod::getCode,StandardMethod::getName).ne(StandardMethod::getId, 0)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | <select id="selectDeviceParameterPage" resultType="com.yuanchu.mom.dto.DeviceDto"> |
| | | select * from( |
| | | SELECT |
| | | d.*, u.name equipmentManagerUser, l.laboratory_name laboratoryName, i.inspection_item insProductItem |
| | | d.*, u.name equipmentManagerUser, l.laboratory_name laboratoryName |
| | | FROM |
| | | device d |
| | | left join `user` u on u.id = d.equipment_manager |
| | | left join laboratory l on l.id = d.subordinate_departments_id |
| | | left join ins_product i on i.id = d.ins_product_ids |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | |
| | | package com.yuanchu.mom.config; |
| | | |
| | | import cn.hutool.log.Log; |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.fasterxml.jackson.databind.DeserializationFeature; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.SerializationFeature; |
| | | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.http.converter.HttpMessageConverter; |
| | | import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; |
| | |
| | | |
| | | @Override |
| | | protected void addInterceptors(InterceptorRegistry registry) { |
| | | // registry.addInterceptor(fiferConfig).addPathPatterns("/**"); |
| | | // registry.addInterceptor(powerConfig).addPathPatterns("/**"); |
| | | registry.addInterceptor(fiferConfig).addPathPatterns("/**"); |
| | | registry.addInterceptor(powerConfig).addPathPatterns("/**"); |
| | | registry.addInterceptor(logConfig).addPathPatterns("/**"); |
| | | super.addInterceptors(registry); |
| | | } |
| | |
| | | // ç¨ApiInfoBuilderè¿è¡å®å¶ |
| | | return new ApiInfoBuilder() |
| | | // 设置æ é¢ |
| | | .title("OMS") |
| | | .title("LIMS") |
| | | // æè¿° |
| | | .description("OMSç³»ç»") |
| | | .description("å®éªå®¤ç®¡çç³»ç»") |
| | | // ä½è
ä¿¡æ¯ |
| | | .contact(new Contact("éµ·é", null, null)) |
| | | .contact(new Contact("éµ·éç½ç»ç§æ", null, null)) |
| | | // çæ¬ |
| | | .version("çæ¬å·:V1.0") |
| | | .version("çæ¬å·ï¼V1.0") |
| | | //åè®® |
| | | .license("The Apache License") |
| | | .license("åä¸é¡¹ç®") |
| | | //åè®®url |
| | | .licenseUrl("http://www.baidu.com") |
| | | .build(); |
| | |
| | | package com.yuanchu.mom.utils; |
| | | |
| | | import com.yuanchu.mom.mapper.SystemLogMapper; |
| | | import lombok.Builder; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | // System.out.println(wrapper.getExpression().getSqlSegment()); |
| | | return wrapper; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/insOrder") |
| | | @Api("æ£éªå模å") |
| | | @Api(tags="æ£éªå模å") |
| | | public class InsOrderController { |
| | | |
| | | private InsOrderService insOrderService; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/insOrderPlan") |
| | | @Api("/æ£éªä»»å¡") |
| | | @Api(tags = "æ£éªä»»å¡") |
| | | @AllArgsConstructor |
| | | public class InsOrderPlanController { |
| | | |
| | |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.annotation.ValueClassify; |
| | | import com.yuanchu.mom.dto.ReportPageDto; |
| | | import com.yuanchu.mom.exception.ErrorException; |
| | |
| | | |
| | | @RestController |
| | | @RequestMapping("/insReport") |
| | | //@AllArgsConstructor |
| | | @Api("æ£éªæ¥å") |
| | | @Api(tags = "æ£éªæ¥å") |
| | | public class InsReportController { |
| | | |
| | | @Resource |
| | |
| | | return Result.success(insReportService.pageInsReport(page, reportPageDto)); |
| | | } |
| | | |
| | | @ValueClassify("æ¥åç¼å¶") |
| | | @ApiOperation(value = "æ¥åä¸ä¼ ") |
| | | @PostMapping("/inReport") |
| | | @ValueAuth |
| | | public Result inReport(MultipartFile file, Integer id) { |
| | | String urlString; |
| | | String pathName; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/unPass") |
| | | @Api("/ä¸åæ ¼ç®¡ç") |
| | | @Api(tags = "ä¸åæ ¼ç®¡ç") |
| | | @AllArgsConstructor |
| | | public class InsUnPassController { |
| | | @Resource |
| | |
| | | UnPassPageDto unPassPageDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), UnPassPageDto.class); |
| | | return Result.success(insUnPassService.pageInsUnPass(page, unPassPageDto)); |
| | | } |
| | | } |
| | | } |
| | |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/report") |
| | | @Api("æ¥è¡¨æ¨¡å") |
| | | @Api(tags = "æ¥è¡¨æ¨¡å") |
| | | public class ReportController { |
| | | |
| | | private ReportService reportService; |
| | |
| | | @RequestMapping("/StandardTemplate") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api("åå§è®°å½æ¨¡æ¿") |
| | | @Api(tags = "åå§è®°å½æ¨¡æ¿") |
| | | public class StandardTemplateController { |
| | | |
| | | private StandardTemplateService standardTemplateService; |
| | |
| | | import com.yuanchu.mom.service.StandardProductListService; |
| | | import com.yuanchu.mom.service.StandardTreeService; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/standardTree") |
| | | @Api(tags="æ ååº") |
| | | public class StandardTreeController { |
| | | |
| | | private StandardTreeService standardTreeService; |
| | |
| | | return Result.success(standardProductListService.selectStandardProductListByMethodId(id, tree, page)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¹éç¼è¾æ¥è¯¢æ£éªé¡¹ç®") |
| | | @PostMapping("/selectStandardProductByMethodId") |
| | | @ValueAuth |
| | | public Result selectStandardProductByMethodId(Integer id, String tree, Integer page,String laboratory,String item,String items){ |
| | | return Result.success(standardProductListService.selectStandardProductByMethodId(id, tree, page, laboratory, item, items)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¹éç¼è¾æ¥è¯¢æææ£éªé¡¹ç®åæ£éªå项æä¸¾") |
| | | @PostMapping("/selectStandardProductEnumByMethodId") |
| | | @ValueAuth |
| | | public Result selectStandardProductEnumByMethodId(Integer id, String tree){ |
| | | return Result.success(standardProductListService.selectStandardProductEnumByMethodId(id, tree)); |
| | | } |
| | | |
| | | @ApiOperation(value = "è·åæ åæ ä¸æ åæ¹æ³æä¸¾") |
| | | @GetMapping("/selectStandardMethodEnum") |
| | | @ValueAuth |
| | |
| | | return Result.success(standardTreeService.getStandardTree2()); |
| | | } |
| | | |
| | | @ValueClassify("æ ååº") |
| | | @ApiOperation(value = "æ¹éä¿®æ¹é¡¹ç®å
容") |
| | | @PostMapping("/upStandardProducts") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "standardProductList",dataTypeClass = StandardProductList.class), |
| | | @ApiImplicitParam(name = "ids",dataTypeClass = Integer.class) |
| | | }) |
| | | public Result upStandardProducts(@RequestBody Map<String, Object> product){ |
| | | return Result.success(standardTreeService.upStandardProducts(product)); |
| | | } |
| | | } |
| | |
| | | @RequestMapping("/warehouse") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api("æ ·åä»åº") |
| | | @Api(tags = "æ ·å管ç") |
| | | public class WarehouseController { |
| | | |
| | | private WarehouseService warehouseService; |
| | |
| | | @Data |
| | | public class UnPassPageDto extends InsUnPass implements Serializable { |
| | | |
| | | } |
| | | } |
| | |
| | | */ |
| | | public interface InsUnPassMapper extends BaseMapper<InsUnPass> { |
| | | IPage<UnPassPageDto> pageInsUnPass(IPage<UnPassPageDto> page, QueryWrapper<UnPassPageDto> ew); |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.mom.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.yuanchu.mom.pojo.StandardProductList; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | |
| | | */ |
| | | public interface StandardProductListMapper extends BaseMapper<StandardProductList> { |
| | | |
| | | IPage<StandardProductList> standardProductListIPage(Integer id, String tree, IPage<StandardProductList> iPage, String laboratory, String item, String items); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | * æ£æµé¡¹ |
| | | */ |
| | | @ValueTableShow(value = 4, name = "æ£æµé¡¹") |
| | | private String inspectionItems; |
| | | private String inspectionItem; |
| | | /** |
| | | * æ£æµå项 |
| | | */ |
| | |
| | | private String dic; |
| | | |
| | | private String tree; |
| | | |
| | | private Integer structureItemParameterId; |
| | | } |
| | |
| | | */ |
| | | public interface InsUnPassService { |
| | | Map<String, Object> pageInsUnPass(Page page, UnPassPageDto unPassPageDto); |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.mom.service; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.mom.pojo.InsSample; |
| | | import com.yuanchu.mom.pojo.StandardProductList; |
| | |
| | | |
| | | Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree, Integer page); |
| | | |
| | | IPage<StandardProductList> selectStandardProductByMethodId(Integer id, String tree, Integer page, String laboratory, String item, String items); |
| | | |
| | | Map<String, List<?>> selectStandardProductEnumByMethodId(Integer id, String tree); |
| | | |
| | | } |
| | |
| | | import com.yuanchu.mom.pojo.StandardTree; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author Administrator |
| | |
| | | |
| | | List<SampleTypeDto> getStandardTree2(); |
| | | |
| | | int upStandardProducts(Map<String, Object> product); |
| | | |
| | | } |
| | |
| | | }catch (Exception e){ |
| | | throw new ErrorException("æ¾ä¸å°æ£éªäººçç¾å"); |
| | | } |
| | | if(signatureUrl == null || "".equals(signatureUrl)){ |
| | | throw new ErrorException("æ¾ä¸å°æ£éªäººçç¾å"); |
| | | } |
| | | XWPFTemplate template = XWPFTemplate.compile(url, builder.build()).render( |
| | | new HashMap<String, Object>() {{ |
| | | put("order", insOrder); |
| | |
| | | String laboratory = insOrderMapper.selectById(insReport.getInsOrderId()).getLaboratory(); |
| | | sealUrl = insReportMapper.getLaboratoryByName(laboratory); |
| | | }catch (Exception e){ |
| | | throw new ErrorException("æ¾ä¸å°æ¥åç« å°"); |
| | | throw new ErrorException("æ¾ä¸å°æ¥åä¸ç¨ç« "); |
| | | } |
| | | if(sealUrl==null) throw new ErrorException("æ¾ä¸å°æ¥åä¸ç¨ç« "); |
| | | //ç³»ç»çææ¥åå°å |
| | | String url = insReport.getUrl(); |
| | | //æå¨ä¸ä¼ æ¥åå°å |
| | |
| | | public Map<String, Object> pageInsUnPass(Page page, UnPassPageDto unPassPageDto) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(UnPassPageDto.class)); |
| | | // Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("pageInsUnPass"); |
| | | // if (map1.get("look") == 1) unPassPageDto.setCreateUser(map1.get("userId")); |
| | | map.put("body", insUnPassMapper.pageInsUnPass(page, QueryWrappers.queryWrappers(unPassPageDto))); |
| | | return map; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | 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.mapper.StandardProductListMapper; |
| | |
| | | |
| | | @Override |
| | | public int upStandardProductList(StandardProductList list) { |
| | | /*if(list.getId()==null || list.getId().equals("")){ |
| | | |
| | | }*/ |
| | | return standardProductListMapper.updateById(list); |
| | | } |
| | | |
| | |
| | | public List<StandardProductList> selectStandardProductList(InsSample insSample) { |
| | | String[] models = insSample.getModel().split("-(?=[^-]*$)");//æåæåä¸ä¸ªã-ã |
| | | List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1).eq(StandardProductList::getModel, models[0])); |
| | | if (list.size() == 0) { |
| | | list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1)); |
| | | } |
| | | list = list.stream().filter(a -> { |
| | | try { |
| | | if (a.getSection() != null && !Objects.equals(a.getSection(), "")) { |
| | |
| | | List<String> manHours = JSON.parseArray(a.getManHour(), String.class); |
| | | List<String> prices = JSON.parseArray(a.getPrice(), String.class); |
| | | boolean isIf = false; |
| | | for (int i = 0;i<sections.size();i++){ |
| | | for (int i = 0; i < sections.size(); i++) { |
| | | if (sections.get(i).contains("&")) { |
| | | String[] split = sections.get(i).split("&"); |
| | | isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(split[0])) > -1 && new BigDecimal(models[1]).compareTo(new BigDecimal(split[1])) < 1; |
| | |
| | | String param = sections.get(i).replace("=", ""); |
| | | isIf = new BigDecimal(models[1]).compareTo(new BigDecimal(param)) == 0; |
| | | } |
| | | if(isIf) { |
| | | if (isIf) { |
| | | a.setSection(sections.get(i)); |
| | | a.setAsk(asks.get(i)); |
| | | a.setTell(tells.get(i)); |
| | |
| | | List<StandardProductList> list = new ArrayList<>(); |
| | | if (trees.length == 3) { |
| | | List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2])); |
| | | if (treeList.size() == 0) { |
| | | StandardTree standardTree = new StandardTree(); |
| | | standardTree.setFactory(trees[0]); |
| | | standardTree.setLaboratory(trees[1]); |
| | | standardTree.setSampleType(trees[2]); |
| | | treeList.add(standardTree); |
| | | } |
| | | for (StandardTree standardTree : treeList) { |
| | | String str = tree+" - "+standardTree.getSample()+" - "+standardTree.getModel(); |
| | | String str = tree + " - " + standardTree.getSample() + " - " + standardTree.getModel(); |
| | | list.addAll(standardTreeMapper.selectStandardProductListByTree3("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str)); |
| | | } |
| | | } else if (trees.length == 4){ |
| | | } else if (trees.length == 4) { |
| | | List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3])); |
| | | if (treeList.size() == 0) { |
| | | StandardTree standardTree = new StandardTree(); |
| | | standardTree.setFactory(trees[0]); |
| | | standardTree.setLaboratory(trees[1]); |
| | | standardTree.setSampleType(trees[2]); |
| | | standardTree.setSample(trees[2]); |
| | | treeList.add(standardTree); |
| | | } |
| | | for (StandardTree standardTree : treeList) { |
| | | String str = tree+" - "+standardTree.getModel(); |
| | | String str = tree + " - " + standardTree.getModel(); |
| | | list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str)); |
| | | list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", standardTree.getSample(), standardTree.getModel(), str)); |
| | | } |
| | |
| | | for (StandardProductList sp : standardProductLists) { |
| | | for (StandardProductList pl : list) { |
| | | if (Objects.equals(sp.getInspectionItem(), pl.getInspectionItem()) |
| | | && Objects.equals(sp.getInspectionItemSubclass(), pl.getInspectionItemSubclass()) |
| | | && Objects.equals(sp.getModel(), pl.getModel())) { |
| | | && Objects.equals(sp.getInspectionItemSubclass() == null ? "" : sp.getInspectionItemSubclass(), pl.getInspectionItemSubclass() == null ? "" : pl.getInspectionItemSubclass()) |
| | | && Objects.equals(sp.getModel(), pl.getModel()) && Objects.equals(sp.getStructureItemParameterId(), pl.getStructureItemParameterId())) { |
| | | pl.setId(sp.getId()); |
| | | pl.setState(id==0?1:sp.getState()); |
| | | if (sp.getState() != null && !sp.getState().equals("")) { |
| | | pl.setState(sp.getState()); |
| | | } else { |
| | | pl.setState(id == 0 ? 1 : 0); |
| | | } |
| | | pl.setMethodS(sp.getMethodS()); |
| | | if(sp.getAsk()!=null&&!sp.getAsk().equals("")){ |
| | | if (sp.getAsk() != null && !sp.getAsk().equals("")) { |
| | | pl.setAsk(sp.getAsk()); |
| | | } |
| | | if(sp.getTell()!=null&&!sp.getTell().equals("")){ |
| | | if (sp.getTell() != null && !sp.getTell().equals("")) { |
| | | pl.setTell(sp.getTell()); |
| | | } |
| | | if(sp.getPrice()!=null&&!sp.getPrice().equals("")){ |
| | | if (sp.getPrice() != null && !sp.getPrice().equals("")) { |
| | | pl.setPrice(sp.getPrice()); |
| | | } |
| | | if(sp.getManHour()!=null&&!sp.getManHour().equals("")){ |
| | | if (sp.getManHour() != null && !sp.getManHour().equals("")) { |
| | | pl.setManHour(sp.getManHour()); |
| | | } |
| | | if(sp.getSection()!=null&&!sp.getSection().equals("")){ |
| | | if (sp.getSection() != null && !sp.getSection().equals("")) { |
| | | pl.setSection(sp.getSection()); |
| | | } |
| | | if(sp.getTemplateId()!=null&&!sp.getTemplateId().equals("")){ |
| | | if (sp.getTemplateId() != null && !sp.getTemplateId().equals("")) { |
| | | pl.setTemplateId(sp.getTemplateId()); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if(page == 1){ |
| | | if (page == 1) { |
| | | Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId"); |
| | | CompletableFuture.supplyAsync(() -> { |
| | | standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).like(StandardProductList::getTree, tree)); |
| | | standardProductListService2.saveBatch(list.stream().map(a->{ |
| | | standardProductListService2.saveBatch(list.stream().map(a -> { |
| | | a.setFactory(trees[0]); |
| | | a.setLaboratory(trees[1]); |
| | | a.setSampleType(trees[2]); |
| | |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | try { |
| | | map.put("productList", list.subList((page - 1)*50, page * 50)); |
| | | }catch (IndexOutOfBoundsException e){ |
| | | map.put("productList", list.subList((page - 1)*50, list.size())); |
| | | map.put("productList", list.subList((page - 1) * 50, page * 50)); |
| | | } catch (IndexOutOfBoundsException e) { |
| | | map.put("productList", list.subList((page - 1) * 50, list.size())); |
| | | } |
| | | map.put("total", list.size()); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<StandardProductList> selectStandardProductByMethodId(Integer id, String tree, Integer page, String laboratory, String item, String items) { |
| | | IPage<StandardProductList> iPage = new Page<>(); |
| | | iPage.setSize(100); |
| | | iPage.setCurrent(page); |
| | | return standardProductListMapper.standardProductListIPage(id, tree, iPage, laboratory, item, items); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, List<?>> selectStandardProductEnumByMethodId(Integer id, String tree) { |
| | | HashMap<String, List<?>> map = new HashMap<>(); |
| | | map.put("item", standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() |
| | | .eq(StandardProductList::getStandardMethodListId, id) |
| | | .like(StandardProductList::getTree, tree) |
| | | .select(StandardProductList::getInspectionItem) |
| | | .groupBy(StandardProductList::getInspectionItem))); |
| | | map.put("items", standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() |
| | | .eq(StandardProductList::getStandardMethodListId, id) |
| | | .like(StandardProductList::getTree, tree) |
| | | .select(StandardProductList::getInspectionItemSubclass) |
| | | .groupBy(StandardProductList::getInspectionItemSubclass))); |
| | | return map; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author Administrator |
| | |
| | | return standardTreeMapper.getStandardTree2(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int upStandardProducts(Map<String, Object> product) { |
| | | List<Integer> ids = JSON.parseArray(JSON.toJSONString(product.get("ids"))); |
| | | StandardProductList productList = JSON.parseObject(JSON.toJSONString(product.get("standardProductList")), StandardProductList.class); |
| | | standardProductListMapper.update(productList, Wrappers.<StandardProductList>lambdaUpdate().in(StandardProductList::getId, ids)); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.InsUnPass"> |
| | | <id property="id" column="id" jdbcType="INTEGER"/> |
| | | <result property="sample" column="sample" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItems" column="inspection_items" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItem" column="inspection_item" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemSubclass" column="inspection_item_subclass" jdbcType="VARCHAR"/> |
| | | <result property="lastValue" column="last_value" jdbcType="VARCHAR"/> |
| | | <result property="model" column="model" jdbcType="VARCHAR"/> |
| | |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <select id="pageInsUnPass" resultType="com.yuanchu.mom.dto.UnPassPageDto"> |
| | | select * |
| | | from ins_un_pass iu |
| | | SELECT * FROM |
| | | ins_un_pass iu |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | | </mapper> |
| | |
| | | <result property="manHourGroup" column="man_hour_group" jdbcType="VARCHAR"/> |
| | | <result property="inspectionItemType" column="inspection_item_type" jdbcType="VARCHAR"/> |
| | | <result property="inspectionValueType" column="inspection_value_type" jdbcType="VARCHAR"/> |
| | | <result property="deviceGroup" column="device_group" jdbcType="VARCHAR"/> |
| | | <result property="checkoutNumber" column="checkout_number" jdbcType="INTEGER"/> |
| | | <result property="section" column="section" jdbcType="VARCHAR"/> |
| | | <result property="valueType" column="value_type" jdbcType="VARCHAR"/> |
| | | <result property="method" column="method" jdbcType="VARCHAR"/> |
| | | <result property="manDay" column="man_day" jdbcType="INTEGER"/> |
| | | <result property="bsm" column="bsm" jdbcType="VARCHAR"/> |
| | |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,inspection_item,inspection_item_classify, |
| | | inspection_item_subclass,laboratory,unit, |
| | | price,man_hour,man_hour_group, |
| | | inspection_item_type,inspection_value_type,device_group, |
| | | checkout_number,section,value_type, |
| | | method,man_day,bsm, |
| | | ask,standard_method_list_id,create_user, |
| | | update_user,create_time,update_time |
| | | </sql> |
| | | <select id="standardProductListIPage" resultType="com.yuanchu.mom.pojo.StandardProductList"> |
| | | select * from `center-lims`.standard_product_list |
| | | where standard_method_list_id = #{id} |
| | | and tree like concat('%',#{tree},'%') |
| | | <if test="laboratory != ''"> |
| | | and son_laboratory = #{laboratory} |
| | | </if> |
| | | <if test="item != ''"> |
| | | and inspection_item = #{item} |
| | | </if> |
| | | <if test="items != ''"> |
| | | and inspection_item_subclass = #{items} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | 0 state, |
| | | #{model} model, |
| | | #{sample} sample, |
| | | #{trees} tree |
| | | #{trees} tree, |
| | | id structure_item_parameter_id |
| | | from structure_item_parameter |
| | | where ( |
| | | sample is NULL |
| | |
| | | 0 state, |
| | | #{model} model, |
| | | #{sample} sample, |
| | | #{trees} tree |
| | | #{trees} tree, |
| | | id structure_item_parameter_id |
| | | from structure_item_parameter |
| | | where sample LIKE CONCAT('%[', #{tree}, ']%') |
| | | </select> |
| | |
| | | 0 state, |
| | | #{model} model, |
| | | #{sample} sample, |
| | | #{trees} tree |
| | | #{trees} tree, |
| | | id structure_item_parameter_id |
| | | from structure_item_parameter |
| | | where ( |
| | | sample is NULL |
| | |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | #url: jdbc:mysql://localhost:3306/center_lims?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | # url: jdbc:mysql://114.132.189.42:9004/center-lims?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://localhost:3306/center-lims?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | # url: jdbc:mysql://114.132.189.42:9004/center-lims?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | druid: |
| | |
| | | filters: stat,wall,log4j # é
ç½®çæ§ç»è®¡æ¦æªçfiltersï¼å»æåçæ§çé¢sqlæ æ³ç»è®¡ï¼'wall'ç¨äºé²ç«å¢ |
| | | useGlobalDataSourceStat: true #åå¹¶å¤ä¸ªDruidDatasourceççæ§æ°æ® |
| | | connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500; #éè¿connectProperties屿§æ¥æå¼mergesqlåè½ç½æ
¢sQLè®°å½ |
| | | |
| | | redis: |
| | | # redisæ°æ®åºç´¢å¼(é»è®¤ä¸º0)ï¼æä»¬ä½¿ç¨ç´¢å¼ä¸º3çæ°æ®åºï¼é¿å
åå
¶ä»æ°æ®åºå²çª |
| | | database: 0 |
| | | # redisæå¡å¨å°åï¼é»è®¤ä¸ºloaclhostï¼ |
| | | host: 127.0.0.1 |
| | | # redis端å£ï¼é»è®¤ä¸º6379ï¼ |
| | | port: 6379 |
| | | # redis访é®å¯ç ï¼é»è®¤ä¸ºç©ºï¼ |
| | | password: root2022 |
| | | # redisè¿æ¥è¶
æ¶æ¶é´ï¼å使¯«ç§ï¼ |
| | | timeout: 20 |
| | | # redisè¿æ¥æ± é
ç½® |
| | | pool: |
| | | # æå¤§å¯ç¨è¿æ¥æ°ï¼é»è®¤ä¸º8ï¼è´æ°è¡¨ç¤ºæ éï¼ |
| | | max-active: 8 |
| | | # æå¤§ç©ºé²è¿æ¥æ°ï¼é»è®¤ä¸º8ï¼è´æ°è¡¨ç¤ºæ éï¼ |
| | | max-idle: 8 |
| | | # æå°ç©ºé²è¿æ¥æ°ï¼é»è®¤ä¸º0ï¼è¯¥å¼åªæä¸ºæ£æ°ææç¨ï¼ |
| | | min-idle: 0 |
| | | # ä»è¿æ¥æ± ä¸è·åè¿æ¥æå¤§çå¾
æ¶é´ï¼é»è®¤ä¸º-1ï¼åä½ä¸ºæ¯«ç§ï¼è´æ°è¡¨ç¤ºæ éï¼ |
| | | max-wait: -1 |
| | | |
| | | redis: |
| | | # redisæ°æ®åºç´¢å¼(é»è®¤ä¸º0)ï¼æä»¬ä½¿ç¨ç´¢å¼ä¸º3çæ°æ®åºï¼é¿å
åå
¶ä»æ°æ®åºå²çª |
| | | database: 0 |
| | | # redisæå¡å¨å°åï¼é»è®¤ä¸ºloaclhostï¼ |
| | | host: 127.0.0.1 |
| | | # redis端å£ï¼é»è®¤ä¸º6379ï¼ |
| | | port: 6379 |
| | | # redis访é®å¯ç ï¼é»è®¤ä¸ºç©ºï¼ |
| | | password: root2022 |
| | | # redisè¿æ¥è¶
æ¶æ¶é´ï¼å使¯«ç§ï¼ |
| | | timeout: 20 |
| | | # redisè¿æ¥æ± é
ç½® |
| | | pool: |
| | | # æå¤§å¯ç¨è¿æ¥æ°ï¼é»è®¤ä¸º8ï¼è´æ°è¡¨ç¤ºæ éï¼ |
| | | max-active: 8 |
| | | # æå¤§ç©ºé²è¿æ¥æ°ï¼é»è®¤ä¸º8ï¼è´æ°è¡¨ç¤ºæ éï¼ |
| | | max-idle: 8 |
| | | # æå°ç©ºé²è¿æ¥æ°ï¼é»è®¤ä¸º0ï¼è¯¥å¼åªæä¸ºæ£æ°ææç¨ï¼ |
| | | min-idle: 0 |
| | | # ä»è¿æ¥æ± ä¸è·åè¿æ¥æå¤§çå¾
æ¶é´ï¼é»è®¤ä¸º-1ï¼åä½ä¸ºæ¯«ç§ï¼è´æ°è¡¨ç¤ºæ éï¼ |
| | | max-wait: -1 |
| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.pojo.AuthApi; |
| | | import com.yuanchu.mom.annotation.ValueClassify; |
| | | import com.yuanchu.mom.dto.PersonDto; |
| | | import com.yuanchu.mom.pojo.Company; |
| | | import com.yuanchu.mom.service.UserService; |
| | | import com.yuanchu.mom.util.HeaderToken; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.Authorization; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/companies") |
| | | @Api("ç»ç»æ¨¡å") |
| | | @Api(tags="ç¨æ·æ¨¡å") |
| | | public class CompaniesController { |
| | | |
| | | @Autowired |
| | | private HeaderToken headerToken; |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "è·åç»ç»å表") |
| | | private UserService userService; |
| | | |
| | | @ValueClassify("ç¨æ·ç®¡ç") |
| | | @ApiOperation(value = "è·å人äºç³»ç»ç»ç»æ¶æ") |
| | | @GetMapping(value = "/selectCompaniesList") |
| | | public Result<List<Company>> selectcompaniesList(){ |
| | | public Result<List<Company>> selectCompaniesList() { |
| | | return Result.success(headerToken.companyUrl()); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation("è·å人äºç³»ç»ç»ç»ä¸ç人å") |
| | | @PostMapping(value = "/selectSimpleList") |
| | | public Result<?> selectSimpleList(String companyId) { |
| | | return Result.success(headerToken.userUrl(companyId)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation("å°äººäºç³»ç»å¾éçå
å®¹è½¬ç§»å°æ¬ç³»ç»") |
| | | @PostMapping(value = "/addPersonUser") |
| | | public Result<?> addPersonUser(@RequestBody PersonDto personDto) { |
| | | return Result.success(userService.addPersonUser(personDto)); |
| | | } |
| | | |
| | | } |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ValueTableShow(2) |
| | | @ValueTableShow(value = 2) |
| | | @ApiModelProperty(value = "客æ·è´¦å·") |
| | | private String account; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.dto; |
| | | |
| | | import com.yuanchu.mom.pojo.Company; |
| | | import com.yuanchu.mom.pojo.Person; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class PersonDto { |
| | | |
| | | private List<Person> person; |
| | | |
| | | private List<Company> company; |
| | | |
| | | } |
| | |
| | | @NoArgsConstructor |
| | | public class UserPageDto extends User { |
| | | |
| | | @ValueTableShow(10) |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | private String createUserName; |
| | | |
| | | @ValueTableShow(11) |
| | | @ApiModelProperty(value = "æ´æ°ç¨æ·") |
| | | private String updateUserName; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.yuanchu.mom.pojo.Departments; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface DepartmentsMapper extends BaseMapper<Departments> { |
| | | |
| | | } |
| | |
| | | |
| | | public class AuthApi { |
| | | |
| | | public static String companies = "https://ztt-sso.asuncloud.net/api/org/v1/companies"; |
| | | /** |
| | | * æµè¯å°å |
| | | * */ |
| | | // private String code = "https://ztt-sso.asuncloud.net/oauth2/token"; |
| | | /** |
| | | * æ£å¼å°å |
| | | * */ |
| | | public static String code = "https://ztt-sso.chinaztt.cn/oauth2/token"; |
| | | |
| | | public static String post="https://ztt-sso.asuncloud.net/api/org/v1/post?companyId="; |
| | | /** |
| | | * æ²³å£äººäºæµè¯åº |
| | | * */ |
| | | // private String appId = "8b2f2c7e-2ab9-4718-8193-c0c636dceba8"; |
| | | // private String appSecret = "db59b70d28ab1865aafe4008f59d4760"; |
| | | /** |
| | | * æ²³å£äººäºæ£å¼åº |
| | | * */ |
| | | public static String appId = "f6f3d70f-3666-4d3d-b9c5-430de3f6007c"; |
| | | public static String appSecret = "a18923496542302066b0a7bec993a4e2"; |
| | | /** |
| | | * è£
å¤äººäºæµè¯åº |
| | | * */ |
| | | // private String appId = "0acf9b63-31e3-45c4-99c1-af1aac88b985"; |
| | | // private String appSecret = "7fb7a4026c71619345c31fa12ba31f4f"; |
| | | /** |
| | | * è£
å¤äººäºæ£å¼åº |
| | | * */ |
| | | // private String appId = "6f5f6a0c-2a01-4ef6-9e75-c8a6f0c2f044"; |
| | | // private String appSecret = "89b9c4735b1e5ee9d6a8544b9b38bb03"; |
| | | |
| | | public static String simple="https://ztt-sso.asuncloud.net/api/org/v1/employees/simple?companyId="; |
| | | public static String companies = "https://ztt-connector.chinaztt.cn/api/org/v1/companies"; |
| | | |
| | | public static String simple="https://ztt-connector.chinaztt.cn/api/org/v1/employees/simple?companyId="; |
| | | |
| | | /** |
| | | * 人åå¯ç è·å |
| | | * */ |
| | | public static String password = "https://ztt-connector.chinaztt.cn/api/org/v1/employees/original_pwd/"; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * é¨é¨æç» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-04-15 04:01:48 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "Department对象", description = "é¨é¨æç»") |
| | | @TableName("department") |
| | | public class Departments implements Serializable { |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("ç¶çº§id") |
| | | private Integer fatherId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | private String companyId; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.pojo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class Person { |
| | | |
| | | private String name; |
| | | |
| | | //人åç¼å·ï¼å
¨å±å¯ä¸ |
| | | private String employeeID; |
| | | //å²ä½ |
| | | private String position; |
| | | //å²ä½ç¼ç |
| | | private String positionCode; |
| | | //ææºå·ç |
| | | private String phoneNumber; |
| | | |
| | | //æ§å« 1:ç· 2:女 |
| | | private Integer gender; |
| | | |
| | | //ç»ç»ç¶æ enable:å¨è disabled:离è |
| | | private String status; |
| | | //æå±ç»ç»ç¼ç |
| | | private String companyId; |
| | | //å
¬å¸é®ç®±(å¯ç¨äºé®ç®±ç³»ç») |
| | | private String companyEmail; |
| | | //å
¥èå
¬å¸æ¶é´ |
| | | private String dateOfJoiningTheCompany; |
| | | //ç»ç»å
çé¨é¨ç¼ç |
| | | private String departmentCode; |
| | | |
| | | @ApiModelProperty(">1ï¼åå¨ =0ï¼ä¸åå¨") |
| | | private Long isLive; |
| | | } |
| | |
| | | @ApiModelProperty(value = "å§å") |
| | | private String name; |
| | | |
| | | @ValueTableShow(2) |
| | | @ApiModelProperty(value = "å§åEN") |
| | | private String nameEn; |
| | | |
| | |
| | | @ApiModelProperty(value = "ç¶æ") |
| | | private Integer state; |
| | | |
| | | @ValueTableShow(4) |
| | | @ApiModelProperty(value = "å¹´é¾") |
| | | private Integer age; |
| | | |
| | | @ValueTableShow(5) |
| | | @ApiModelProperty(value = "é®ç®±") |
| | | private String email; |
| | | |
| | |
| | | @ApiModelProperty(value = "é¨é¨") |
| | | private String department; |
| | | |
| | | @ValueTableShow(8) |
| | | @ApiModelProperty(value = "åä½") |
| | | private String company; |
| | | |
| | | @ValueTableShow(14) |
| | | @ApiModelProperty(value = "åä½å°å") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(value = "è§è²ä¸»é®") |
| | | private Integer roleId; |
| | | |
| | | @ValueTableShow(9) |
| | | @ApiModelProperty(value = "åå»ºæ¥æ") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ValueTableShow(10) |
| | | @ApiModelProperty(value = "æ´æ°æ¥æ") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | |
| | | /** |
| | | * ç»ç» |
| | | */ |
| | | // @ValueTableShow(value = 14,name = "ç»ç»") |
| | | @ApiModelProperty(value = "å
³èçé¨é¨id") |
| | | private String departId; |
| | | |
| | | ////人åç¼å·ï¼å
¨å±å¯ä¸ |
| | | // private String employeeID; |
| | | ////å²ä½ |
| | | // private String position; |
| | | ////å²ä½ç¼ç |
| | | // private String positionCode; |
| | | ////ææºå·ç |
| | | // private String phoneNumber; |
| | | // |
| | | // //æ§å« 1:ç· 2:女 |
| | | // private int gender; |
| | | // |
| | | // //ç»ç»ç¶æ enable:å¨è disabled:离è |
| | | // private String status; |
| | | ////æå±ç»ç»ç¼ç |
| | | // private String companyId; |
| | | ////å
¬å¸é®ç®±(å¯ç¨äºé®ç®±ç³»ç») |
| | | // private String companyEmail; |
| | | ////å
¥èå
¬å¸æ¶é´ |
| | | // private String dateOfJoiningTheCompany; |
| | | ////ç»ç»å
çé¨é¨ç¼ç |
| | | // private String departmentCode; |
| | | } |
| | |
| | | package com.yuanchu.mom.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.dto.PersonDto; |
| | | import com.yuanchu.mom.dto.UserPageDto; |
| | | import com.yuanchu.mom.pojo.User; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | |
| | | int upUserPassword(String oldPassword, String newPassWord); |
| | | |
| | | int addPersonUser(PersonDto personDto); |
| | | |
| | | } |
| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.common.GetLook; |
| | | import com.yuanchu.mom.common.PrintChina; |
| | | import com.yuanchu.mom.dto.PersonDto; |
| | | import com.yuanchu.mom.dto.UserPageDto; |
| | | import com.yuanchu.mom.exception.ErrorException; |
| | | import com.yuanchu.mom.mapper.DepartmentsMapper; |
| | | import com.yuanchu.mom.mapper.UserMapper; |
| | | import com.yuanchu.mom.pojo.Departments; |
| | | import com.yuanchu.mom.pojo.User; |
| | | import com.yuanchu.mom.service.UserService; |
| | | import com.yuanchu.mom.utils.Jwt; |
| | | import com.yuanchu.mom.util.HeaderToken; |
| | | import com.yuanchu.mom.utils.QueryWrappers; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.DigestUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | |
| | | @Service |
| | | public class UserServiceImp implements UserService { |
| | |
| | | @Resource |
| | | UserMapper userMapper; |
| | | @Resource |
| | | Jwt jwt; |
| | | @Resource |
| | | private GetLook getLook; |
| | | |
| | | @Resource |
| | | private DepartmentsMapper departmentsMapper; |
| | | |
| | | @Resource |
| | | private HeaderToken headerToken; |
| | | |
| | | @Override |
| | | public User selectUserByPwd(String account, String password) { |
| | |
| | | return userMapper.updateById(user); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int addPersonUser(PersonDto personDto) { |
| | | AtomicReference<String> departId = new AtomicReference<>(""); |
| | | AtomicReference<String> companyName = new AtomicReference<>(); |
| | | personDto.getCompany().forEach(company->{ |
| | | Departments department = departmentsMapper.selectOne(Wrappers.<Departments>lambdaQuery().eq(Departments::getCompanyId, company.getCompanyId())); |
| | | if(BeanUtil.isEmpty(department)){ |
| | | department = new Departments(); |
| | | department.setName(company.getCompanyName()); |
| | | department.setCompanyId(company.getCompanyId()); |
| | | Departments department2 = departmentsMapper.selectOne(Wrappers.<Departments>lambdaQuery().eq(Departments::getCompanyId, company.getParentCompanyId())); |
| | | if(BeanUtil.isEmpty(department2)){ |
| | | department.setFatherId(1); |
| | | }else{ |
| | | department.setFatherId(department2.getId()); |
| | | } |
| | | departmentsMapper.insert(department); |
| | | } |
| | | departId.set(departId.get()+department.getId()+","); |
| | | companyName.set(department.getName()); |
| | | }); |
| | | personDto.getPerson().forEach(person -> { |
| | | User user = userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getAccount, person.getEmployeeID())); |
| | | if(BeanUtil.isEmpty(user)){ |
| | | user = new User(); |
| | | user.setName(person.getName()); |
| | | user.setNameEn("not write"); |
| | | user.setAccount(person.getEmployeeID()); |
| | | user.setPhone(person.getPhoneNumber()); |
| | | user.setEmail(person.getCompanyEmail()); |
| | | user.setIsCustom(person.getCompanyId().equals("SC2463")?0:1); |
| | | user.setDepartId(departId.get()); |
| | | // user.setPassword(DigestUtils.md5DigestAsHex(headerToken.getPassword(person.getEmployeeID()).getBytes())); |
| | | user.setPassword(DigestUtils.md5DigestAsHex("123456".getBytes())); |
| | | user.setCompany(companyName.get()); |
| | | user.setAddress("æªå¡«å"); |
| | | userMapper.insert(user); |
| | | }else{ |
| | | user.setName(person.getName()); |
| | | user.setPhone(person.getPhoneNumber()); |
| | | user.setEmail(person.getCompanyEmail()); |
| | | user.setIsCustom(person.getCompanyId().equals("SC2463")?0:1); |
| | | user.setDepartId(departId.get()); |
| | | user.setCompany(companyName.get()); |
| | | user.setCreateUser(null); |
| | | user.setCreateTime(null); |
| | | user.setUpdateUser(null); |
| | | user.setUpdateTime(null); |
| | | userMapper.updateById(user); |
| | | } |
| | | }); |
| | | return 1; |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.log.Log; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.yuanchu.mom.exception.ErrorException; |
| | | import com.yuanchu.mom.mapper.UserMapper; |
| | | import com.yuanchu.mom.pojo.AuthApi; |
| | | import com.yuanchu.mom.pojo.Company; |
| | | import com.yuanchu.mom.pojo.Post; |
| | | import com.yuanchu.mom.pojo.Person; |
| | | import com.yuanchu.mom.pojo.User; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.Duration; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Component |
| | | public class HeaderToken { |
| | |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | public static void main(String[] args) { |
| | | HttpRequest request = HttpRequest.post("https://ztt-sso.asuncloud.net/oauth2/token") |
| | | .header("Content-Type", "application/x-www-form-urlencoded") |
| | | .form("grant_type", "client_credentials") |
| | | .form("client_id", "8b2f2c7e-2ab9-4718-8193-c0c636dceba8") |
| | | .form("client_secret", "db59b70d28ab1865aafe4008f59d4760"); |
| | | |
| | | HttpResponse response = request.execute(); |
| | | |
| | | System.out.println(response.body()); |
| | | } |
| | | @Resource |
| | | private UserMapper userMapper; |
| | | |
| | | public String fetchNewAccessToken() { |
| | | HttpRequest request = HttpRequest.post("https://ztt-sso.asuncloud.net/oauth2/token") |
| | | HttpRequest request = HttpRequest.post(AuthApi.code) |
| | | .header("Content-Type", "application/x-www-form-urlencoded") |
| | | .form("grant_type", "client_credentials") |
| | | .form("client_id", "8b2f2c7e-2ab9-4718-8193-c0c636dceba8") |
| | | .form("client_secret", "db59b70d28ab1865aafe4008f59d4760"); |
| | | .form("client_id", AuthApi.appId) |
| | | .form("client_secret", AuthApi.appSecret); |
| | | HttpResponse response = request.execute(); |
| | | |
| | | System.out.println(response.body()); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | JsonNode jsonNode = null; |
| | | JsonNode jsonNode; |
| | | try { |
| | | jsonNode = objectMapper.readTree(response.body()); |
| | | String accessToken = jsonNode.get("access_token").asText(); |
| | | redisTemplate.opsForValue().set("access_token",accessToken); |
| | | redisTemplate.expire("access_token", dataTime("access_token"), TimeUnit.SECONDS); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | Log.get().info("è·å人äºç³»ç»tokenï¼"+accessToken); |
| | | redisTemplate.opsForValue().set("access_token",accessToken,jsonNode.get("expires_in").asInt() - 60,TimeUnit.SECONDS); |
| | | return accessToken; |
| | | } catch (Exception e) { |
| | | throw new ErrorException(e.getMessage()); |
| | | } |
| | | return null; |
| | | } |
| | | private String accessToken ; |
| | | |
| | | //夿æ¯å¦è¿æ |
| | | //夿æ¯å¦åå¨ |
| | | public String getAccessToken() { |
| | | accessToken=(String) redisTemplate.opsForValue().get("access_token"); |
| | | if (accessToken == null) { |
| | | String accessToken; |
| | | if (!redisTemplate.hasKey("access_token")) { |
| | | accessToken = fetchNewAccessToken(); |
| | | }else{ |
| | | accessToken = redisTemplate.opsForValue().get("access_token")+""; |
| | | } |
| | | return accessToken; |
| | | } |
| | | //夿 token æ¯å¦å·²åå¨ |
| | | public String getToken(String token) { |
| | | String o = redisTemplate.opsForValue().get(token).toString(); |
| | | if (o != null && !o.isEmpty()) { |
| | | return o; |
| | | }else{ |
| | | redisTemplate.expire(token,dataTime("access_token"),TimeUnit.SECONDS); |
| | | String tokens = redisTemplate.opsForValue().get(token).toString(); |
| | | return tokens; |
| | | } |
| | | // è·å token |
| | | // accessToken = fetchNewAccessToken(); |
| | | // return accessToken; |
| | | } |
| | | |
| | | //è·åtokenè¿ææ¶é´ |
| | | public Long dataTime(String token){ |
| | | Long access_token = redisTemplate.getExpire(token); |
| | | if(access_token != null && access_token >60) { |
| | | redisTemplate.expire(token, access_token - 60 ,TimeUnit.SECONDS); |
| | | return access_token - 60; |
| | | }//å°±ç´æ¥è°ç¨ |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | //è°ç¨ |
| | | public List<Company> companyUrl() { |
| | | public List<Company> companyUrl() { |
| | | String accessToken = getAccessToken(); |
| | | String getToken= getToken(accessToken); |
| | | String apiUrl =AuthApi.companies; // æ¿æ¢ä¸ºå®é
çAPI端ç¹URL |
| | | HttpRequest request = HttpRequest.get(apiUrl) |
| | | HttpRequest request = HttpRequest.get(AuthApi.companies) |
| | | .header("Authorization", "Bearer " + accessToken); |
| | | HttpResponse response = request.execute(); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String body = response.body(); |
| | | List<Company> companies = null; |
| | | List<Company> companies; |
| | | try { |
| | | companies = objectMapper.readValue(body, new TypeReference<List<Company>>(){}); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | companies = JSON.parseArray(request.execute().body(), Company.class); |
| | | }catch (Exception e){ |
| | | throw new ErrorException(e.getMessage()); |
| | | } |
| | | return companies; |
| | | return companies.stream().filter(ob->{ |
| | | if(ob.getStatus().equals("enabled")) return true; |
| | | return false; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | |
| | | public List<Post> postUrl(String companyId) { |
| | | public List<Person> userUrl(String companyId) { |
| | | String accessToken = getAccessToken(); |
| | | String token = getToken(accessToken); |
| | | String apiUrl =AuthApi.post+companyId; // æ¿æ¢ä¸ºå®é
çAPI端ç¹URL |
| | | HttpRequest request = HttpRequest.get(apiUrl) |
| | | .header("Authorization", "Bearer " + accessToken); |
| | | HttpResponse response = request.execute(); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String body = response.body(); |
| | | List<Post> posts = null; |
| | | try { |
| | | posts=objectMapper.readValue(body, new TypeReference<List<Post>>() {}); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return posts; |
| | | } |
| | | |
| | | public List<User> userUrl(String companyId) { |
| | | String accessToken = getAccessToken(); |
| | | String token = getToken(accessToken); |
| | | String apiUrl =AuthApi.simple+companyId; // æ¿æ¢ä¸ºå®é
çAPI端ç¹URL |
| | | HttpRequest request = HttpRequest.get(apiUrl) |
| | | HttpRequest request = HttpRequest.get(AuthApi.simple+companyId) |
| | | .header("Authorization", "Bearer " + accessToken) |
| | | .header("Content-Type", "application/form-data"); |
| | | HttpResponse response = request.execute(); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String body = response.body(); |
| | | List<User> user=null; |
| | | List<Person> person; |
| | | try { |
| | | user= objectMapper.readValue(body,new TypeReference<List<User>>(){}); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | person = JSON.parseArray(request.execute().body(), Person.class); |
| | | }catch (Exception e){ |
| | | throw new ErrorException(e.getMessage()); |
| | | } |
| | | return user; |
| | | return person.stream().filter(ob->{ |
| | | if(Objects.equals(ob.getStatus(), "enabled")) { |
| | | ob.setIsLive(userMapper.selectCount(Wrappers.<User>lambdaQuery().eq(User::getAccount, ob.getEmployeeID()))); |
| | | return true; |
| | | } |
| | | return false; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | |
| | | public String getPassword(String employeeId) { |
| | | String accessToken = getAccessToken(); |
| | | HttpRequest request = HttpRequest.get(AuthApi.password + employeeId) |
| | | .header("Authorization", "Bearer " + accessToken); |
| | | System.out.println(AuthApi.password + employeeId); |
| | | System.out.println(request.execute().body()); |
| | | return JSON.parseObject(request.execute().body()).get("originalPwd").toString(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.yuanchu.mom.mapper.DepartmentsMapper"> |
| | | </mapper> |