Crunchy
2024-05-22 08cad817f057c4a10e1ea59e362fbb492f3381df
Merge remote-tracking branch 'origin/master'
已修改44个文件
已删除2个文件
已添加5个文件
832 ■■■■■ 文件已修改
cnas-server/src/main/java/com/yuanchu/mom/controller/StandardMethodController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/java/com/yuanchu/mom/pojo/Department.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/resources/mapper/DeviceMapper.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/com/yuanchu/mom/config/OpenFifer.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/com/yuanchu/mom/config/Swagger3.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/com/yuanchu/mom/utils/GiveCode.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/com/yuanchu/mom/utils/QueryWrappers.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderPlanController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/controller/InsUnPassController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/controller/ReportController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTemplateController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTreeController.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/controller/WarehouseController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/dto/UnPassPageDto.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/mapper/InsUnPassMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/pojo/InsUnPass.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardProductList.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/InsUnPassService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/StandardProductListService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/StandardTreeService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsUnPassServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java 89 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/InsUnPassMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/StandardProductListMapper.xml 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/StandardTreeMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/static/report-template.docx 补丁 | 查看 | 原始文档 | blame | 历史
system-run/src/main/resources/application-dev.yml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
system-run/src/main/resources/application-prod.yml 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/controller/CompaniesController.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/controller/PostController.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/controller/SimpleController.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/dto/Custom.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/dto/PersonDto.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/dto/UserPageDto.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/mapper/DepartmentsMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/pojo/AuthApi.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/pojo/Departments.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/pojo/Person.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/pojo/User.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/service/UserService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/service/impl/RoleServiceImp.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/service/impl/UserServiceImp.java 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/java/com/yuanchu/mom/util/HeaderToken.java 154 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user-server/src/main/resources/mapper/DepartmentsMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/java/com/yuanchu/mom/controller/StandardMethodController.java
@@ -14,7 +14,7 @@
import java.util.Map;
@Api("标准方法")
@Api(tags = "标准方法")
@RestController
@RequestMapping("/standardMethod")
@AllArgsConstructor
cnas-server/src/main/java/com/yuanchu/mom/pojo/Department.java
@@ -4,12 +4,13 @@
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>
@@ -35,13 +36,17 @@
    @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;
}
cnas-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodServiceImpl.java
@@ -42,7 +42,7 @@
    @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
cnas-server/src/main/resources/mapper/DeviceMapper.xml
@@ -93,12 +93,11 @@
    <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}
framework/src/main/java/com/yuanchu/mom/config/OpenFifer.java
@@ -1,16 +1,12 @@
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;
@@ -63,8 +59,8 @@
    @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);
    }
framework/src/main/java/com/yuanchu/mom/config/Swagger3.java
@@ -34,15 +34,15 @@
        // ç”¨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();
framework/src/main/java/com/yuanchu/mom/utils/GiveCode.java
@@ -1,7 +1,6 @@
package com.yuanchu.mom.utils;
import com.yuanchu.mom.mapper.SystemLogMapper;
import lombok.Builder;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
framework/src/main/java/com/yuanchu/mom/utils/QueryWrappers.java
@@ -69,5 +69,4 @@
//        System.out.println(wrapper.getExpression().getSqlSegment());
        return wrapper;
    }
}
}
inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderController.java
@@ -31,7 +31,7 @@
@RestController
@AllArgsConstructor
@RequestMapping("/insOrder")
@Api("检验单模块")
@Api(tags="检验单模块")
public class InsOrderController {
    private InsOrderService insOrderService;
inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderPlanController.java
@@ -23,7 +23,7 @@
 */
@RestController
@RequestMapping("/insOrderPlan")
@Api("/检验任务")
@Api(tags = "检验任务")
@AllArgsConstructor
public class InsOrderPlanController {
inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java
@@ -4,7 +4,6 @@
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;
@@ -30,8 +29,7 @@
@RestController
@RequestMapping("/insReport")
//@AllArgsConstructor
@Api("检验报告")
@Api(tags = "检验报告")
public class InsReportController {
    @Resource
@@ -49,9 +47,9 @@
        return Result.success(insReportService.pageInsReport(page, reportPageDto));
    }
    @ValueClassify("报告编制")
    @ApiOperation(value = "报告上传")
    @PostMapping("/inReport")
    @ValueAuth
    public Result inReport(MultipartFile file, Integer id) {
        String urlString;
        String pathName;
inspect-server/src/main/java/com/yuanchu/mom/controller/InsUnPassController.java
@@ -23,7 +23,7 @@
 */
@RestController
@RequestMapping("/unPass")
@Api("/不合格管理")
@Api(tags = "不合格管理")
@AllArgsConstructor
public class InsUnPassController {
    @Resource
@@ -37,4 +37,4 @@
        UnPassPageDto unPassPageDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), UnPassPageDto.class);
        return Result.success(insUnPassService.pageInsUnPass(page, unPassPageDto));
    }
}
}
inspect-server/src/main/java/com/yuanchu/mom/controller/ReportController.java
@@ -16,7 +16,7 @@
@RestController
@AllArgsConstructor
@RequestMapping("/report")
@Api("报表模块")
@Api(tags = "报表模块")
public class ReportController {
    private ReportService reportService;
inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTemplateController.java
@@ -17,7 +17,7 @@
@RequestMapping("/StandardTemplate")
@RestController
@AllArgsConstructor
@Api("原始记录模板")
@Api(tags = "原始记录模板")
public class StandardTemplateController {
    private StandardTemplateService standardTemplateService;
inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTreeController.java
@@ -11,13 +11,19 @@
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;
@@ -103,6 +109,20 @@
        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
@@ -117,4 +137,14 @@
        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));
    }
}
inspect-server/src/main/java/com/yuanchu/mom/controller/WarehouseController.java
@@ -16,7 +16,7 @@
@RequestMapping("/warehouse")
@RestController
@AllArgsConstructor
@Api("样品仓库")
@Api(tags = "样品管理")
public class WarehouseController {
    private WarehouseService warehouseService;
inspect-server/src/main/java/com/yuanchu/mom/dto/UnPassPageDto.java
@@ -12,4 +12,4 @@
@Data
public class UnPassPageDto extends InsUnPass implements Serializable {
}
}
inspect-server/src/main/java/com/yuanchu/mom/mapper/InsUnPassMapper.java
@@ -12,4 +12,4 @@
 */
public interface InsUnPassMapper extends BaseMapper<InsUnPass> {
    IPage<UnPassPageDto> pageInsUnPass(IPage<UnPassPageDto> page, QueryWrapper<UnPassPageDto> ew);
}
}
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java
@@ -1,5 +1,6 @@
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;
@@ -11,6 +12,8 @@
*/
public interface StandardProductListMapper extends BaseMapper<StandardProductList> {
    IPage<StandardProductList> standardProductListIPage(Integer id, String tree, IPage<StandardProductList> iPage, String laboratory, String item, String items);
}
inspect-server/src/main/java/com/yuanchu/mom/pojo/InsUnPass.java
@@ -37,7 +37,7 @@
     * æ£€æµ‹é¡¹
     */
    @ValueTableShow(value = 4, name = "检测项")
    private String inspectionItems;
    private String inspectionItem;
    /**
     * æ£€æµ‹å­é¡¹
     */
inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardProductList.java
@@ -177,4 +177,6 @@
    private String dic;
    private String tree;
    private Integer structureItemParameterId;
}
inspect-server/src/main/java/com/yuanchu/mom/service/InsUnPassService.java
@@ -11,4 +11,4 @@
 */
public interface InsUnPassService {
    Map<String, Object> pageInsUnPass(Page page, UnPassPageDto unPassPageDto);
}
}
inspect-server/src/main/java/com/yuanchu/mom/service/StandardProductListService.java
@@ -1,6 +1,7 @@
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;
@@ -23,4 +24,8 @@
    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);
}
inspect-server/src/main/java/com/yuanchu/mom/service/StandardTreeService.java
@@ -6,6 +6,7 @@
import com.yuanchu.mom.pojo.StandardTree;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
@@ -24,4 +25,6 @@
    List<SampleTypeDto> getStandardTree2();
    int upStandardProducts(Map<String, Object> product);
}
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -594,6 +594,9 @@
            }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);
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java
@@ -171,8 +171,9 @@
            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();
        //手动上传报告地址
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsUnPassServiceImpl.java
@@ -30,7 +30,9 @@
    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;
    }
}
}
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
@@ -2,7 +2,9 @@
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;
@@ -40,6 +42,9 @@
    @Override
    public int upStandardProductList(StandardProductList list) {
        /*if(list.getId()==null || list.getId().equals("")){
        }*/
        return standardProductListMapper.updateById(list);
    }
@@ -52,6 +57,9 @@
    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(), "")) {
@@ -61,7 +69,7 @@
                    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;
@@ -81,7 +89,7 @@
                            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));
@@ -106,14 +114,29 @@
        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));
            }
@@ -125,38 +148,42 @@
        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]);
@@ -174,13 +201,37 @@
        }
        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;
    }
}
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
@@ -19,6 +19,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
 * @author Administrator
@@ -109,6 +110,14 @@
        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;
    }
}
inspect-server/src/main/resources/mapper/InsUnPassMapper.xml
@@ -6,7 +6,7 @@
    <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"/>
@@ -19,7 +19,10 @@
            <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>
inspect-server/src/main/resources/mapper/StandardProductListMapper.xml
@@ -16,10 +16,8 @@
            <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"/>
@@ -31,14 +29,18 @@
            <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>
inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -157,7 +157,8 @@
               0 state,
               #{model} model,
               #{sample} sample,
               #{trees} tree
               #{trees} tree,
               id structure_item_parameter_id
        from structure_item_parameter
        where (
                      sample is NULL
@@ -193,7 +194,8 @@
               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>
@@ -233,7 +235,8 @@
               0 state,
               #{model} model,
               #{sample} sample,
               #{trees} tree
               #{trees} tree,
               id structure_item_parameter_id
        from structure_item_parameter
        where (
                      sample is NULL
inspect-server/src/main/resources/static/report-template.docx
Binary files differ
system-run/src/main/resources/application-dev.yml
@@ -37,9 +37,8 @@
  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:
system-run/src/main/resources/application-prod.yml
@@ -54,26 +54,24 @@
      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
user-server/src/main/java/com/yuanchu/mom/controller/CompaniesController.java
@@ -1,37 +1,48 @@
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));
    }
}
user-server/src/main/java/com/yuanchu/mom/controller/PostController.java
ÎļþÒÑɾ³ý
user-server/src/main/java/com/yuanchu/mom/controller/SimpleController.java
ÎļþÒÑɾ³ý
user-server/src/main/java/com/yuanchu/mom/dto/Custom.java
@@ -24,7 +24,7 @@
    @TableId(type = IdType.AUTO)
    private Integer id;
    @ValueTableShow(2)
    @ValueTableShow(value = 2)
    @ApiModelProperty(value = "客户账号")
    private String account;
user-server/src/main/java/com/yuanchu/mom/dto/PersonDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
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;
}
user-server/src/main/java/com/yuanchu/mom/dto/UserPageDto.java
@@ -12,11 +12,9 @@
@NoArgsConstructor
public class UserPageDto extends User {
    @ValueTableShow(10)
    @ApiModelProperty(value = "创建用户")
    private String createUserName;
    @ValueTableShow(11)
    @ApiModelProperty(value = "更新用户")
    private String updateUserName;
user-server/src/main/java/com/yuanchu/mom/mapper/DepartmentsMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
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> {
}
user-server/src/main/java/com/yuanchu/mom/pojo/AuthApi.java
@@ -2,10 +2,43 @@
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/";
}
user-server/src/main/java/com/yuanchu/mom/pojo/Departments.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,46 @@
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;
}
user-server/src/main/java/com/yuanchu/mom/pojo/Person.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
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;
}
user-server/src/main/java/com/yuanchu/mom/pojo/User.java
@@ -35,7 +35,6 @@
    @ApiModelProperty(value = "姓名")
    private String name;
    @ValueTableShow(2)
    @ApiModelProperty(value = "姓名EN")
    private String nameEn;
@@ -43,11 +42,9 @@
    @ApiModelProperty(value = "状态")
    private Integer state;
    @ValueTableShow(4)
    @ApiModelProperty(value = "年龄")
    private Integer age;
    @ValueTableShow(5)
    @ApiModelProperty(value = "邮箱")
    private String email;
@@ -58,24 +55,20 @@
    @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")
@@ -108,30 +101,7 @@
    /**
     * ç»„织
     */
//    @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;
}
user-server/src/main/java/com/yuanchu/mom/service/UserService.java
@@ -1,10 +1,9 @@
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;
@@ -34,4 +33,6 @@
    int upUserPassword(String oldPassword, String newPassWord);
    int addPersonUser(PersonDto personDto);
}
user-server/src/main/java/com/yuanchu/mom/service/impl/RoleServiceImp.java
@@ -86,4 +86,4 @@
        }
        return 1;
    }
}
}
user-server/src/main/java/com/yuanchu/mom/service/impl/UserServiceImp.java
@@ -3,33 +3,28 @@
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 {
@@ -37,11 +32,13 @@
    @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) {
@@ -114,4 +111,58 @@
        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;
    }
}
user-server/src/main/java/com/yuanchu/mom/util/HeaderToken.java
@@ -2,23 +2,25 @@
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 {
@@ -26,129 +28,83 @@
    @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();
    }
}
user-server/src/main/resources/mapper/DepartmentsMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,4 @@
<?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>