Merge branch 'master' of http://114.132.189.42:9002/r/center-lims-after
已修改53个文件
已删除2个文件
已添加10个文件
| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | 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.UserDto; |
| | | import com.yuanchu.mom.pojo.Department; |
| | | import com.yuanchu.mom.pojo.DepartmentLims; |
| | | import com.yuanchu.mom.service.DepartmentLimsService; |
| | | import com.yuanchu.mom.service.DepartmentService; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * é¨é¨æç» å端æ§å¶å¨ |
| | | * ç»ç»æ¶ææç» å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | |
| | | @RequestMapping("/department") |
| | | public class DepartmentController { |
| | | |
| | | DepartmentService departmentService; |
| | | @ValueClassify("人åæç»") |
| | | @ApiOperation(value = "æ·»å é¨é¨") |
| | | private DepartmentService departmentService; |
| | | |
| | | private DepartmentLimsService departmentLimsService; |
| | | |
| | | @ValueClassify("ç¨æ·ç®¡ç") |
| | | @ApiOperation(value = "æ·»å ç»ç»æ¶æ") |
| | | @PostMapping("/addDepartment") |
| | | public Result addDepartment(@RequestBody Department department) { |
| | | return Result.success(departmentService.addDepartment(department)); |
| | | } |
| | | @ApiOperation(value = "è·åé¨é¨æ ") |
| | | @ApiOperation(value = "è·åç»ç»æ¶ææ ") |
| | | @GetMapping("/selectDepartment") |
| | | @ValueClassify("人åæç»") |
| | | @ValueClassify("ç¨æ·ç®¡ç") |
| | | public Result selectDepartment() { |
| | | return Result.success(departmentService.selectDepartment()); |
| | | } |
| | | @ValueClassify("人åæç»") |
| | | @ApiOperation(value = "å é¤é¨é¨") |
| | | @ValueClassify("ç¨æ·ç®¡ç") |
| | | @ApiOperation(value = "å é¤ç»ç»æ¶æ") |
| | | @PostMapping("/delDepartment") |
| | | public Result delDepartment(Integer id) { |
| | | return Result.success(departmentService.delDepartment(id)); |
| | | } |
| | | @ValueAuth |
| | | @ApiOperation(value = "æ ¹æ®éæ©çæ å±ç¤ºç¸å
³ç人å") |
| | | @PostMapping("/showUserById") |
| | | public Result showUserById(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | UserDto user = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), UserDto.class); |
| | | return Result.success(departmentService.showUserById(page, user)); |
| | | |
| | | @ValueClassify("人åæç»") |
| | | @ApiOperation(value = "è·åç»ç»æ¶ææ ") |
| | | @GetMapping("/selectDepartmentLim") |
| | | public Result selectDepartmentLim() { |
| | | return Result.success(departmentLimsService.selectDepartment()); |
| | | } |
| | | |
| | | @ValueClassify("人åæç»") |
| | | @ApiOperation(value = "æ·»å ç»ç»æ¶æ") |
| | | @PostMapping("/addDepartmentLims") |
| | | public Result addDepartmentLims(@RequestBody DepartmentLims department) { |
| | | return Result.success(departmentLimsService.addDepartment(department)); |
| | | } |
| | | |
| | | @ValueClassify("人åæç»") |
| | | @ApiOperation(value = "å é¤ç»ç»æ¶æ") |
| | | @PostMapping("/delDepartmentLims") |
| | | public Result delDepartmentLims(Integer id) { |
| | | return Result.success(departmentLimsService.delDepartment(id)); |
| | | } |
| | | } |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Map; |
| | | |
| | | @Api("æ åæ¹æ³") |
| | | @Api(tags = "æ åæ¹æ³") |
| | | @RestController |
| | | @RequestMapping("/standardMethod") |
| | | @AllArgsConstructor |
| | |
| | | public Result<?> upStandardMethod(@RequestBody StandardMethod standardMethod) { |
| | | return Result.success(standardMethodService.upStandardMethod(standardMethod)); |
| | | } |
| | | |
| | | @ValueClassify("å®éªå®¤çæ£æµè½åæ¡£æ¡") |
| | | @ApiOperation(value = "导å
¥æ åæç»") |
| | | @PostMapping("/importStandardDetails") |
| | | public Result<?> importStandardDetails(@RequestPart("file") MultipartFile file) throws IOException { |
| | | standardMethodService.inputExcel(file); |
| | | return Result.success(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.yuanchu.mom.dto.DepartmentDto; |
| | | import com.yuanchu.mom.pojo.DepartmentLims; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author z1292 |
| | | * @description é对表ãdepartment_lims(é¨é¨æç»)ãçæ°æ®åºæä½Mapper |
| | | * @createDate 2024-05-22 14:08:17 |
| | | * @Entity com.yuanchu.mom.pojo.DepartmentLims |
| | | */ |
| | | public interface DepartmentLimsMapper extends BaseMapper<DepartmentLims> { |
| | | |
| | | //è·åé¨é¨æ |
| | | List<DepartmentDto> selectDepartment(); |
| | | |
| | | //æ ¹æ®é¨é¨id,æ¥è¯¢ä»çææåç±»id |
| | | List<Integer> selectSonById(Integer id); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | package com.yuanchu.mom.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.yuanchu.mom.dto.DepartmentDto; |
| | | import com.yuanchu.mom.dto.UserDto; |
| | | import com.yuanchu.mom.mybatis_config.MyBaseMapper; |
| | | import com.yuanchu.mom.pojo.Department; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-04-15 04:01:48 |
| | | */ |
| | | public interface DepartmentMapper extends BaseMapper<Department> { |
| | | public interface DepartmentMapper extends MyBaseMapper<Department> { |
| | | |
| | | |
| | | //è·åé¨é¨æ |
| | | List<DepartmentDto> selectDepartment(); |
| | | |
| | | //æ ¹æ®éæ©çæ å±ç¤ºç¸å
³ç人å |
| | | IPage<UserDto> showUserById(@Param("page") IPage<UserDto> page, @Param("ids") List<String> ids, @Param("ew") QueryWrapper<UserDto> ew); |
| | | |
| | | |
| | | //æ ¹æ®é¨é¨id,æ¥è¯¢ä»çææåç±»id |
| | | List<Integer> selectSonById(Integer id); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.mybatis_config.MyBaseMapper; |
| | | import com.yuanchu.mom.pojo.StandardMethod; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.yuanchu.mom.pojo.StructureItemParameter; |
| | | |
| | | /** |
| | | * @author Administrator |
| | |
| | | * @createDate 2024-03-03 19:21:41 |
| | | * @Entity com.yuanchu.mom.pojo.StandardMethod |
| | | */ |
| | | public interface StandardMethodMapper extends BaseMapper<StandardMethod> { |
| | | public interface StandardMethodMapper extends MyBaseMapper<StandardMethod> { |
| | | |
| | | IPage<StandardMethod> selectStandardMethodList(Page page, QueryWrapper<StandardMethod> ew); |
| | | |
| | |
| | | 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; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * é¨é¨æç» |
| | | * @TableName department_lims |
| | | */ |
| | | @TableName(value ="department_lims") |
| | | @Data |
| | | public class DepartmentLims 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; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.mom.dto.DepartmentDto; |
| | | import com.yuanchu.mom.pojo.DepartmentLims; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author z1292 |
| | | * @description é对表ãdepartment_lims(é¨é¨æç»)ãçæ°æ®åºæä½Service |
| | | * @createDate 2024-05-22 14:08:17 |
| | | */ |
| | | public interface DepartmentLimsService extends IService<DepartmentLims> { |
| | | |
| | | //æ·»å é¨é¨ |
| | | int addDepartment(DepartmentLims departmentLims); |
| | | |
| | | //è·åé¨é¨æ |
| | | List<DepartmentDto> selectDepartment(); |
| | | |
| | | //å é¤é¨é¨ |
| | | boolean delDepartment(Integer id); |
| | | |
| | | } |
| | |
| | | package com.yuanchu.mom.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.dto.DepartmentDto; |
| | | import com.yuanchu.mom.dto.UserDto; |
| | | import com.yuanchu.mom.pojo.Department; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.mom.pojo.User; |
| | | import com.yuanchu.mom.dto.DepartmentDto; |
| | | import com.yuanchu.mom.pojo.Department; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | //å é¤é¨é¨ |
| | | boolean delDepartment(Integer id); |
| | | |
| | | //æ ¹æ®éæ©çæ å±ç¤ºç¸å
³ç人å |
| | | Map<String, Object> showUserById(Page page, UserDto user); |
| | | } |
| | |
| | | package com.yuanchu.mom.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.pojo.StandardMethod; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.mom.pojo.StructureItemParameter; |
| | | import com.yuanchu.mom.pojo.StandardMethod; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | int upStandardMethod(StandardMethod standardMethod); |
| | | |
| | | void inputExcel(MultipartFile file) throws IOException; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.dto.DepartmentDto; |
| | | import com.yuanchu.mom.mapper.DepartmentLimsMapper; |
| | | import com.yuanchu.mom.pojo.DepartmentLims; |
| | | import com.yuanchu.mom.service.DepartmentLimsService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author z1292 |
| | | * @description é对表ãdepartment_lims(é¨é¨æç»)ãçæ°æ®åºæä½Serviceå®ç° |
| | | * @createDate 2024-05-22 14:08:17 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class DepartmentLimsServiceImpl extends ServiceImpl<DepartmentLimsMapper, DepartmentLims> |
| | | implements DepartmentLimsService{ |
| | | |
| | | DepartmentLimsMapper departmentMapper; |
| | | |
| | | @Override |
| | | public int addDepartment(DepartmentLims department) { |
| | | departmentMapper.insert(department); |
| | | return department.getId(); |
| | | } |
| | | |
| | | //è·åé¨é¨æ |
| | | @Override |
| | | public List<DepartmentDto> selectDepartment() { |
| | | List<DepartmentDto> departments = departmentMapper.selectDepartment(); |
| | | //è·åç¶èç¹ |
| | | List<DepartmentDto> collect = departments.stream().filter(m -> m.getFatherId() == null).peek( |
| | | (m) -> m.setChildren(getChildren(m, departments)) |
| | | ).collect(Collectors.toList()); |
| | | return collect; |
| | | } |
| | | |
| | | /** |
| | | * é彿¥è¯¢åèç¹ |
| | | * @param root æ ¹èç¹ |
| | | * @param all ææèç¹ |
| | | * @return æ ¹èç¹ä¿¡æ¯ |
| | | */ |
| | | private List<DepartmentDto> getChildren(DepartmentDto root, List<DepartmentDto> all) { |
| | | return all.stream().filter(m -> Objects.equals(m.getFatherId(), root.getId())).peek( |
| | | (m) -> m.setChildren(getChildren(m, all)) |
| | | ).collect(Collectors.toList()); |
| | | } |
| | | |
| | | //å é¤é¨é¨ |
| | | @Override |
| | | public boolean delDepartment(Integer id) { |
| | | //夿æ¯å¦æåç±»,ç´å°æ²¡æä¸ºæ¢ |
| | | List<DepartmentLims> department = getDepartment(id); |
| | | return removeBatchByIds(department); |
| | | } |
| | | |
| | | //夿æ¯å¦æåç±»,ç´å°æ²¡æä¸ºæ¢ |
| | | public List<DepartmentLims> getDepartment(Integer id) { |
| | | List<DepartmentLims> list = new ArrayList<>(); |
| | | DepartmentLims depart = baseMapper.selectById(id); |
| | | list.add(depart); |
| | | List<DepartmentLims> departments = baseMapper.selectList(Wrappers.<DepartmentLims>lambdaQuery().eq(DepartmentLims::getFatherId, id)); |
| | | if (ObjectUtils.isNotEmpty(departments)) { |
| | | list.addAll(departments); |
| | | for (DepartmentLims department : departments) { |
| | | list.addAll(getDepartment(department.getId())); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | 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.PrintChina; |
| | | import com.yuanchu.mom.dto.DepartmentDto; |
| | | import com.yuanchu.mom.dto.UserDto; |
| | | import com.yuanchu.mom.dto.UserPageDto; |
| | | import com.yuanchu.mom.pojo.Department; |
| | | import com.yuanchu.mom.mapper.DepartmentMapper; |
| | | import com.yuanchu.mom.pojo.Device; |
| | | import com.yuanchu.mom.pojo.User; |
| | | import com.yuanchu.mom.service.DepartmentService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.utils.QueryWrappers; |
| | | import com.yuanchu.mom.dto.DepartmentDto; |
| | | import com.yuanchu.mom.mapper.DepartmentMapper; |
| | | import com.yuanchu.mom.pojo.Department; |
| | | import com.yuanchu.mom.service.DepartmentService; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import lombok.var; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.SQLException; |
| | | import java.sql.Wrapper; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements DepartmentService { |
| | | |
| | | DepartmentMapper departmentMapper; |
| | | |
| | | |
| | | |
| | | |
| | | //æ·»å é¨é¨ |
| | |
| | | List<Department> department = getDepartment(id); |
| | | return removeBatchByIds(department); |
| | | } |
| | | |
| | | //æ ¹æ®éæ©çæ å±ç¤ºç¸å
³ç人å |
| | | @Override |
| | | public Map<String, Object> showUserById(Page page, UserDto user) { |
| | | //æ ¹æ®é¨é¨id,æ¥è¯¢ä»çææåç±»id |
| | | List<Integer> list = departmentMapper.selectSonById(Integer.parseInt(user.getDepartId())); |
| | | List<String> ids = list.stream() |
| | | .map(Object::toString) |
| | | //.collect(Collectors.joining(",")); |
| | | .collect(Collectors.toList()); |
| | | log.info(ids+"\n"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(UserDto.class)); |
| | | map.put("body", departmentMapper.showUserById(page, ids, QueryWrappers.queryWrappers(user))); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | //夿æ¯å¦æåç±»,ç´å°æ²¡æä¸ºæ¢ |
| | | public List<Department> getDepartment(Integer id) { |
| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import cn.hutool.poi.excel.ExcelUtil; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.yuanchu.mom.utils.QueryWrappers; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author Administrator |
| | |
| | | |
| | | @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 |
| | |
| | | int i = standardMethodMapper.updateById(standardMethod); |
| | | return i; |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void inputExcel(MultipartFile file) throws IOException { |
| | | // å卿£æµå¯¹è±¡List |
| | | List<Object> structureTestObjectIdList = new ArrayList<>(); |
| | | List<StandardMethod> result = new ArrayList<>(); |
| | | ExcelUtil.readBySax(file.getInputStream(), 0, (i, l, list) -> { |
| | | // å»é¤ç¬¬ä¸è¡è¡¨å¤´ |
| | | if (l == 0) { |
| | | return; |
| | | } |
| | | // åå¨å¯ä¸æ£æµå¯¹è±¡ |
| | | if (!structureTestObjectIdList.contains(list.get(2))) { |
| | | structureTestObjectIdList.add(list.get(2)); |
| | | } |
| | | StandardMethod standardMethod = formatData(list); |
| | | result.add(standardMethod); |
| | | }); |
| | | addStructureTest(structureTestObjectIdList, result); |
| | | } |
| | | |
| | | // æ ¼å¼åæ°æ® |
| | | public StandardMethod formatData(List<Object> list) { |
| | | StandardMethod standardMethod = new StandardMethod(); |
| | | standardMethod.setField(list.get(1).toString()); |
| | | // é æ ¼å¼ |
| | | List<List<Object>> structureTestObjectId = new ArrayList<>(); |
| | | if (ObjectUtils.isEmpty(list.get(3))){ |
| | | structureTestObjectId.add(Arrays.asList(list.get(2))); |
| | | } else { |
| | | structureTestObjectId.add(Arrays.asList(list.get(2), list.get(3))); |
| | | } |
| | | standardMethod.setStructureTestObjectId(JSONUtil.toJsonStr(structureTestObjectId)); |
| | | standardMethod.setCode(list.get(4).toString()); |
| | | standardMethod.setName(list.get(5).toString()); |
| | | standardMethod.setNameEn(list.get(6).toString()); |
| | | if (!Objects.equals(list.get(7), null)) { |
| | | standardMethod.setRemark(list.get(7).toString()); |
| | | } |
| | | standardMethod.setQualificationId(list.get(8).toString()); |
| | | if (ObjectUtils.isNotEmpty(list.get(9))) { |
| | | if (list.get(9).equals("æ¯")) { |
| | | standardMethod.setIsProduct(1); |
| | | } else if (list.get(9).equals("å¦")) { |
| | | standardMethod.setIsProduct(0); |
| | | } |
| | | } |
| | | if (ObjectUtils.isNotEmpty(list.get(10))) { |
| | | if (list.get(10).equals("æ¯")) { |
| | | standardMethod.setIsUse(1); |
| | | } else if (list.get(9).equals("å¦")) { |
| | | standardMethod.setIsUse(0); |
| | | } |
| | | } |
| | | return standardMethod; |
| | | } |
| | | |
| | | // æ°å¢æ°æ® |
| | | public void addStructureTest(List<Object> structureTestObjectIdList, List<StandardMethod> standardMethodList) { |
| | | List<StandardMethod> updateList = new ArrayList<>(); |
| | | List<Integer> deleteListId = new ArrayList<>(); |
| | | List<StandardMethod> addList = new ArrayList<>(); |
| | | if (!structureTestObjectIdList.isEmpty()) { |
| | | // 循ç¯exceléé¢çåç» |
| | | structureTestObjectIdList.forEach(j -> { |
| | | // 以excelä¸çç»åæ¥è¯¢æ°æ®åºä¸çåç» |
| | | List<StandardMethod> standardMethods = baseMapper.selectList(Wrappers.<StandardMethod>lambdaQuery() |
| | | .like(StandardMethod::getStructureTestObjectId, "\"" + j + "\"")); |
| | | // å°ç»æå¾ªç¯å¹é
|
| | | for (int i = 0; i < standardMethods.size(); i++) { |
| | | boolean isExistence = false; |
| | | for (int i1 = 0; i1 < standardMethodList.size(); i1++) { |
| | | // æ´æ° |
| | | if (standardMethods.get(i).getStructureTestObjectId().equals(standardMethodList.get(i1).getStructureTestObjectId()) |
| | | && standardMethods.get(i).getCode().equals(standardMethodList.get(i1).getCode()) |
| | | && standardMethods.get(i).getField().equals(standardMethodList.get(i1).getField())) { |
| | | // ç»excelæ°æ®èµå¼idåæ´æ° |
| | | standardMethodList.get(i1).setId(standardMethods.get(i).getId()); |
| | | // æ´æ° |
| | | updateList.add(standardMethodList.get(i1)); |
| | | isExistence = true; |
| | | break; |
| | | } |
| | | } |
| | | // å é¤ |
| | | if (!isExistence) { |
| | | deleteListId.add(standardMethods.get(i).getId()); |
| | | } |
| | | } |
| | | for (int i = 0; i < standardMethodList.size(); i++) { |
| | | if (standardMethodList.get(i).getStructureTestObjectId().contains("\"" + j + "\"")) { |
| | | boolean isExistence = false; |
| | | for (int i1 = 0; i1 < standardMethods.size(); i1++) { |
| | | if (standardMethods.get(i1).getStructureTestObjectId().equals(standardMethodList.get(i).getStructureTestObjectId()) |
| | | && standardMethods.get(i1).getCode().equals(standardMethodList.get(i).getCode()) |
| | | && standardMethods.get(i1).getField().equals(standardMethodList.get(i).getField())) { |
| | | isExistence = true; |
| | | break; |
| | | } |
| | | } |
| | | // æ°å¢ |
| | | if (!isExistence) { |
| | | addList.add(standardMethodList.get(i)); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | if (!addList.isEmpty()) { |
| | | // æ°å¢ |
| | | baseMapper.insertBatchSomeColumn(addList); |
| | | } |
| | | |
| | | if (!deleteListId.isEmpty()) { |
| | | // å é¤ |
| | | baseMapper.deleteBatchIds(deleteListId); |
| | | } |
| | | |
| | | if (!updateList.isEmpty()) { |
| | | // æ´æ° |
| | | updateList.forEach(i -> { |
| | | baseMapper.updateById(i); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.DepartmentLimsMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.DepartmentLims"> |
| | | <id property="id" column="id" jdbcType="INTEGER"/> |
| | | <result property="name" column="name" jdbcType="VARCHAR"/> |
| | | <result property="fatherId" column="father_id" jdbcType="INTEGER"/> |
| | | <result property="createUser" column="create_user" jdbcType="INTEGER"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="updateUser" column="update_user" jdbcType="INTEGER"/> |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <select id="selectDepartment" resultType="com.yuanchu.mom.dto.DepartmentDto"> |
| | | SELECT id, name, father_id |
| | | FROM department_lims |
| | | </select> |
| | | |
| | | <select id="selectSonById" resultType="java.lang.Integer"> |
| | | SELECT au.id |
| | | FROM (SELECT * FROM department_lims WHERE father_id IS NOT NULL) au, |
| | | (SELECT @father_id := #{id}) pd |
| | | WHERE FIND_IN_SET(father_id, @father_id) > 0 |
| | | AND @father_id := concat(@father_id, ',', id) |
| | | UNION |
| | | SELECT id |
| | | FROM department_lims |
| | | WHERE id = #{id} |
| | | ORDER BY id |
| | | </select> |
| | | </mapper> |
| | |
| | | FROM department |
| | | </select> |
| | | |
| | | <select id="showUserById" resultType="com.yuanchu.mom.dto.UserDto"> |
| | | select * from (select id, name, age, email, phone,depart_id |
| | | from user where state=1 and SUBSTRING_INDEX(depart_id, ',', -1) in |
| | | <foreach collection="ids" item="id" separator="," open="(" close=")"> |
| | | #{id} |
| | | </foreach> ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectSonById" resultType="java.lang.Integer"> |
| | | SELECT au.id |
| | | FROM (SELECT * FROM department WHERE father_id IS NOT NULL) au, |
| | |
| | | <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; |
| | |
| | | @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 |
| | |
| | | @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; |
| | |
| | | return Result.success(standardTemplateService.getStandTempThingById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "ç¼è¾æ¨¡æ¿ç¼å¶") |
| | | @GetMapping("/getEditTemplatePreparation") |
| | | @ValueClassify("æ ååº") |
| | | public Result<?> getEditTemplatePreparation(@RequestParam("id") Integer id) { |
| | | StandardTemplate byId = standardTemplateService.getById(id); |
| | | return Result.success("OK", byId.getThing()); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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 = 9, name = "ç¨æ·å") |
| | | @ValueTableShow(value = 9, name = "æ£éªäºº") |
| | | private String name; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | /** |
| | | * 主é®id |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id; |
| | | @TableId(type = IdType.ASSIGN_ID) |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private Long id; |
| | | |
| | | /** |
| | | * æ£éªé¡¹ |
| | |
| | | private String dic; |
| | | |
| | | private String tree; |
| | | |
| | | private Integer structureItemParameterId; |
| | | } |
| | |
| | | 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); |
| | | |
| | | } |
| | |
| | | delRSet.add(jo1.get("r") + ""); |
| | | } |
| | | } |
| | | } else { |
| | | if ("åæ°".equals(v.get("v"))) delSet.add(jo1.get("c") + ""); |
| | | } |
| | | } |
| | | for (int i = 0; i < temp.size(); i++) { |
| | |
| | | } |
| | | Style style = new Style(); |
| | | style.setFontFamily(v.get("ff") == null ? "微软é
é»" : v.get("ff") + ""); |
| | | // style.setFontSize(v.get("fs")==null?14:Integer.parseInt(v.get("fs")+"")); |
| | | if (!((v.get("fc") + "").indexOf("rgb") > -1)) { |
| | | style.setColor(v.get("fc") == null ? "000000" : (v.get("fc") + "").replace("#", "")); |
| | | } else { |
| | |
| | | } |
| | | textRenderData.setStyle(style); |
| | | text.add(textRenderData); |
| | | if (i == temp.size() - 1) { |
| | | TextRenderData[] text2 = text.toArray(new TextRenderData[0]); |
| | | rowRenderData = Rows.of(text2).rowAtleastHeight(1).center().create(); |
| | | rows.add(rowRenderData); |
| | | text = new ArrayList<>(); |
| | | } |
| | | } |
| | | TextRenderData[] text2 = text.toArray(new TextRenderData[0]); |
| | | rowRenderData = Rows.of(text2).rowAtleastHeight(1).center().create(); |
| | | rows.add(rowRenderData); |
| | | TableRenderData tableRenderData = new TableRenderData(); |
| | | tableRenderData.setRows(rows); |
| | | TableStyle tableStyle = new TableStyle(); |
| | |
| | | }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); |
| | |
| | | import com.yuanchu.mom.dto.SampleOrderDto; |
| | | import com.yuanchu.mom.dto.SampleProductDto; |
| | | import com.yuanchu.mom.dto.SampleProductDto2; |
| | | import com.yuanchu.mom.exception.ErrorException; |
| | | import com.yuanchu.mom.mapper.*; |
| | | import com.yuanchu.mom.pojo.*; |
| | | import com.yuanchu.mom.service.InsOrderService; |
| | |
| | | for (InsProduct insProduct : insProducts) { |
| | | InsOrderState insOrderState = new InsOrderState(); |
| | | insOrderState.setInsOrderId(orderId); |
| | | insOrderState.setLaboratory(insProduct.getSonLaboratory()); |
| | | try { |
| | | insOrderState.setLaboratory(insProduct.getSonLaboratory()); |
| | | }catch (NullPointerException e){ |
| | | throw new ErrorException("该æ£éªåææªç»´æ¤å®éªå®¤çæ£éªé¡¹ç®"); |
| | | } |
| | | insOrderState.setInsState(0); |
| | | insOrderStateMapper.insert(insOrderState); |
| | | } |
| | |
| | | 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(); |
| | | //æå¨ä¸ä¼ æ¥åå°å |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
| | | 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; |
| | |
| | | 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)); |
| | | } |
| | |
| | | list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", trees[3], trees[4], tree)); |
| | | list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", trees[3], trees[4], tree)); |
| | | } |
| | | for (StandardProductList productList : list) { |
| | | productList.setId(IdWorker.getId()); |
| | | } |
| | | List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, id).like(StandardProductList::getTree, tree)); |
| | | 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()); |
| | | } |
| | | if(sp.getTree() != null && !sp.getTree().equals("")){ |
| | | pl.setTree(sp.getTree()); |
| | | } |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | inspection_item from (select *,GROUP_CONCAT(inspection_item |
| | | SEPARATOR ',') inspection_item2 from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | BY b.ins_sample_id) c ON c.ins_sample_id = isa.id |
| | | where (i.state = 1 or i.state = 3 or i.state = 4) |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | |
| | | <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> |
| | |
| | | |
| | | <select id="selectStandardTemplatePageList" resultType="com.yuanchu.mom.pojo.StandardTemplate"> |
| | | select * from ( |
| | | select st.id, st.name, remark, thing, u2.name create_user_name, u3.name update_user_name, st.create_time, st.update_time |
| | | select st.id, st.name, remark, u2.name create_user_name, u3.name update_user_name, st.create_time, st.update_time |
| | | from standard_template st |
| | | left join user u2 on u2.id = st.create_user |
| | | left join user u3 on u3.id = st.update_user |
| | |
| | | 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 |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | |
| | | List<Map<String, Object>> mapYearIPage = baseMapper.performanceShiftYearPage(time, userName, laboratory); |
| | | mapIPage.getRecords().forEach(i -> { |
| | | String[] shiftTimes = i.getShiftTime().split(";"); |
| | | int totalAttendance = 0; |
| | | double totalAttendance = 0; |
| | | List<Map<String, Object>> map = new ArrayList<>(); |
| | | // å岿¥æ |
| | | for (String shiftTime : shiftTimes) { |
| | |
| | | i.getMonthlyAttendance().put(enums.getLabel(), 0); |
| | | } |
| | | if (enums.getValue().equals(shiftTimeAndShift[1])) { |
| | | Integer num = (Integer) i.getMonthlyAttendance().get(enums.getLabel()); |
| | | i.getMonthlyAttendance().put(enums.getLabel(), num += 1); |
| | | BigDecimal bigDecimal = new BigDecimal(i.getMonthlyAttendance().get(enums.getLabel()).toString()); |
| | | i.getMonthlyAttendance().put(enums.getLabel(), bigDecimal.add(new BigDecimal("1"))); |
| | | } |
| | | // åï¼å¦å¤å天ç®ç»æ© |
| | | if (shiftTimeAndShift[1].equals("5") && enums.getValue().equals("0")) { |
| | | BigDecimal bigDecimal = new BigDecimal(i.getMonthlyAttendance().get(enums.getLabel()).toString()); |
| | | i.getMonthlyAttendance().put(enums.getLabel(), bigDecimal.add(new BigDecimal("0.5"))); |
| | | } |
| | | } |
| | | if (shiftTimeAndShift[1].equals("1") || shiftTimeAndShift[1].equals("2") || shiftTimeAndShift[1].equals("0")) { |
| | | // æ©ï¼ä¸ï¼å¤ï¼å·® |
| | | if (shiftTimeAndShift[1].equals("1") || shiftTimeAndShift[1].equals("2") || shiftTimeAndShift[1].equals("0") || shiftTimeAndShift[1].equals("6")) { |
| | | i.getMonthlyAttendance().put("totalAttendance", totalAttendance += 1); |
| | | } |
| | | // å |
| | | if (shiftTimeAndShift[1].equals("5")) { |
| | | i.getMonthlyAttendance().put("totalAttendance", totalAttendance += 0.5); |
| | | } |
| | | hashMap.put("id", shiftTimeAndShift[2]); |
| | | hashMap.put("shift", shiftTimeAndShift[1]); |
| | | hashMap.put("time", shiftTimeAndShift[0]); |
| | | map.add(hashMap); |
| | | } |
| | | int totalYearAttendance = 0; |
| | | double totalYearAttendance = 0; |
| | | Map<String, Object> hashMap = new HashMap<>(); |
| | | for (Map<String, Object> record : mapYearIPage) { |
| | | if (record.get("user_id").toString().equals(i.getUserId())) { |
| | |
| | | hashMap.put(enums.getLabel(), 0); |
| | | } |
| | | if (enums.getValue().equals(record.get("shift"))) { |
| | | Integer num = (Integer) hashMap.get(enums.getLabel()); |
| | | hashMap.put(enums.getLabel(), num += 1); |
| | | BigDecimal num = new BigDecimal(hashMap.get(enums.getLabel()).toString()); |
| | | hashMap.put(enums.getLabel(), num.add(new BigDecimal("1"))); |
| | | } |
| | | // åï¼å¦å¤å天ç®ç»æ© |
| | | if (record.get("shift").equals("5") && enums.getValue().equals("0")) { |
| | | BigDecimal bigDecimal = new BigDecimal(hashMap.get(enums.getLabel()).toString()); |
| | | hashMap.put(enums.getLabel(), bigDecimal.add(new BigDecimal("0.5"))); |
| | | } |
| | | } |
| | | if (record.get("shift").equals("1") || record.get("shift").equals("2") || record.get("shift").equals("0")) { |
| | | if (record.get("shift").equals("1") || record.get("shift").equals("2") || record.get("shift").equals("0") || record.get("shift").equals("6")) { |
| | | hashMap.put("totalAttendance", totalYearAttendance += 1); |
| | | } |
| | | // å |
| | | if (record.get("shift").equals("5")) { |
| | | hashMap.put("totalAttendance", totalYearAttendance += 0.5); |
| | | } |
| | | } |
| | | } |
| | |
| | | for (Map<String, Object> map : mapYearList) { |
| | | Map<String, Object> resultMap = new LinkedHashMap<>(); |
| | | Map<String, Object> hashMapYear = new LinkedHashMap<>(); |
| | | int totalYearAttendance = 0; |
| | | double totalYearAttendance = 0; |
| | | // ä¸å¹´12个æ |
| | | for (int i = 1; i < 13; i++) { |
| | | Map<String, Object> hashMapMonth = new LinkedHashMap<>(); |
| | | int totalMonthAttendance = 0; |
| | | double totalMonthAttendance = 0; |
| | | for (Enums enums : shiftType) { |
| | | if (!hashMapYear.containsKey(enums.getLabel())) { |
| | | hashMapYear.put(enums.getLabel(), 0); |
| | |
| | | int count = countOccurrences(charArray, i + "ï¼" + enums.getValue()); |
| | | hashMapMonth.put(enums.getLabel(), count); |
| | | hashMapYear.put(enums.getLabel(), Integer.parseInt(hashMapYear.get(enums.getLabel()).toString()) + count ); |
| | | if (enums.getValue().equals("0") || enums.getValue().equals("1") || enums.getValue().equals("2")) { |
| | | if (enums.getValue().equals("0") || enums.getValue().equals("1") || enums.getValue().equals("2") || enums.getValue().equals("6")) { |
| | | totalMonthAttendance += count; |
| | | totalYearAttendance += count; |
| | | } |
| | | // åï¼å¦å¤å天ç®ç»æ© |
| | | if (enums.getValue().equals("5")) { |
| | | BigDecimal multiply = new BigDecimal("0.5").multiply(new BigDecimal(count)).setScale(1, BigDecimal.ROUND_CEILING); |
| | | hashMapMonth.put(shiftType.get(0).getLabel(), new BigDecimal(hashMapMonth.get(shiftType.get(0).getLabel()).toString()).add(multiply)); |
| | | hashMapYear.put(shiftType.get(0).getLabel(), new BigDecimal(hashMapYear.get(shiftType.get(0).getLabel()).toString()).add(multiply)); |
| | | totalMonthAttendance += multiply.doubleValue(); |
| | | totalYearAttendance += multiply.doubleValue(); |
| | | } |
| | | } |
| | | // ç©ºæ°æ® |
| | |
| | | Map<String, Object> year = JackSonUtil.unmarshal(JackSonUtil.marshal(list.get(i).get("year")), Map.class); |
| | | excelRowList.add(year.get("totalYearAttendance")); |
| | | enums.forEach(j -> { |
| | | excelRowList.add(year.get(j.getLabel())); |
| | | if (!j.getValue().equals("5")) { |
| | | excelRowList.add(year.get(j.getLabel())); |
| | | } |
| | | }); |
| | | Map<String, Map<String, Object>> month = JackSonUtil.unmarshal(JackSonUtil.marshal(list.get(i).get("month")), Map.class); |
| | | for (int j = 1; j < 13; j++) { |
| | | Object totalMonthAttendance = month.get(j + "").get("totalMonthAttendance"); |
| | | excelRowList.add(totalMonthAttendance); |
| | | for (Enums anEnum : enums) { |
| | | excelRowList.add(month.get(j + "").get(anEnum.getLabel())); |
| | | if (!anEnum.getValue().equals("5")) { |
| | | excelRowList.add(month.get(j + "").get(anEnum.getLabel())); |
| | | } |
| | | } |
| | | } |
| | | data.add(excelRowList); |
| | |
| | | </if> |
| | | </where> |
| | | GROUP BY u.id |
| | | order by s.create_time |
| | | </select> |
| | | |
| | | <select id="performanceShiftYearPage" resultType="map"> |
| | |
| | | </if> |
| | | <if test="laboratory != null and laboratory != ''"> |
| | | </if> |
| | | order by s.create_time |
| | | </select> |
| | | |
| | | <select id="performanceShiftYear" resultType="java.util.Map"> |
| | |
| | | <if test="laboratory != null and laboratory != ''"> |
| | | </if> |
| | | GROUP BY u.id |
| | | order by s.work_time |
| | | order by s.create_time |
| | | </select> |
| | | |
| | | <select id="performanceShiftYearList" resultType="map"> |
| | |
| | | <if test="laboratory != null and laboratory != ''"> |
| | | </if> |
| | | GROUP BY u.id |
| | | order by s.work_time |
| | | order by s.create_time |
| | | </select> |
| | | |
| | | <select id="performanceShiftList" resultMap="performanceShiftPageMap"> |
| | |
| | | </if> |
| | | </where> |
| | | GROUP BY u.id |
| | | order by s.create_time |
| | | </select> |
| | | </mapper> |
| | |
| | | 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; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; |
| | | import com.yuanchu.mom.service.PerformanceShiftService; |
| | | import com.yuanchu.mom.utils.StyleYearUtils; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @SpringBootTest |
| | | class SystemRunApplicationTest { |
| | | |
| | | @Autowired |
| | | private PerformanceShiftService performanceShiftService; |
| | | |
| | | private static String fileName = "D:\\" + System.currentTimeMillis() + ".xlsx"; |
| | | |
| | | @Test |
| | | void contextLoads() throws Exception { |
| | | Map<Object, Object> data = performanceShiftService.exportToYearExcel("2024-05-01 00:00:00", null, null); |
| | | // 设置åå
æ ¼æ ·å¼ |
| | | HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(StyleYearUtils.getHeadStyle(), StyleYearUtils.getContentStyle()); |
| | | EasyExcel.write(fileName) |
| | | .head((List<List<String>>) data.get("header")) |
| | | .registerWriteHandler(horizontalCellStyleStrategy) |
| | | .sheet("æåº¦") |
| | | .doWrite((Collection<?>) data.get("data")); |
| | | // String url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?corpid=wwa423654b975441ac&corpsecret=J3fbMJoTn3LmrWDobvS5JpU8N0TvEbGkVl8OhvIsol0"; |
| | | // String s = HttpUtil.get(url); |
| | | // System.out.println(s); |
| | | // Map<String, Object> unmarshal = JSONObject.parseObject(s, Map.class); |
| | | // String checkInRecords = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckindata?access_token=" + unmarshal.get("access_token"); |
| | | // String body = HttpRequest.post(checkInRecords).execute().body(); |
| | | // System.out.println(body); |
| | | |
| | | } |
| | | } |
| | |
| | | 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)); |
| | | } |
| | | |
| | | } |
| | |
| | | UserPageDto user = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), UserPageDto.class); |
| | | return Result.success(userService.selectUserList(page, user)); |
| | | } |
| | | |
| | | @ValueClassify("äººåæ»è§") |
| | | @ApiOperation(value = "äººåæ»è§") |
| | | @PostMapping("/selectPersonnelOverview") |
| | | public Result selectPersonnelOverview(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | UserPageDto user = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), UserPageDto.class); |
| | | return Result.success(userService.selectPersonnelOverview(page, user)); |
| | | } |
| | | |
| | | @ValueClassify("ç¨æ·ç®¡ç") |
| | | @ApiOperation(value = "ä¿®æ¹ç¨æ·ä¿¡æ¯") |
| | | @PostMapping("/updateUser") |
| | |
| | | public Result<?> upUserPassword(String oldPassword, String newPassWord){ |
| | | return Result.success(userService.upUserPassword(oldPassword, newPassWord)); |
| | | } |
| | | |
| | | @ValueClassify("人åæç»") |
| | | @PostMapping("/upUserDepardLimsId") |
| | | @ApiOperation(value = "ä¿®æ¹äººåæç»æå¨ç»ç»æ¶æ") |
| | | public Result<?> upUserDepardLimsId(String ids, String id){ |
| | | return Result.success(userService.upUserDepardLimsId(ids, id)); |
| | | } |
| | | |
| | | @ValueClassify("人åæç»") |
| | | @PostMapping("/delUserDepardLimsId") |
| | | @ApiOperation(value = "å é¤äººåæç»æå¨ç»ç»æ¶æ") |
| | | public Result<?> delUserDepardLimsId(Integer id){ |
| | | return Result.success(userService.delUserDepardLimsId(id)); |
| | | } |
| | | |
| | | } |
| | |
| | | @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; |
| | | |
| | | @ValueTableShow(1) |
| | | @ValueTableShow(3) |
| | | @ApiModelProperty(value = "è§è²") |
| | | private String roleName; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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> { |
| | | |
| | | } |
| | |
| | | |
| | | IPage<User> selectUserDtoPageList(IPage<UserPageDto> page, QueryWrapper<UserPageDto> ew); |
| | | |
| | | IPage<User> selectPersonnelOverview(IPage<UserPageDto> page, QueryWrapper<UserPageDto> ew); |
| | | |
| | | //è·å设å¤è´è´£äºº |
| | | List<User> getDeviceManager(); |
| | | |
| | |
| | | |
| | | 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; |
| | | } |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ValueTableShow(1) |
| | | @ValueTableShow(2) |
| | | @ApiModelProperty(value = "è´¦å·") |
| | | private String account; |
| | | |
| | | @ApiModelProperty(value = "å¯ç ") |
| | | private String password; |
| | | |
| | | @ValueTableShow(2) |
| | | @ValueTableShow(1) |
| | | @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 = 12,name = "ç¾åç
§çå°å") |
| | | private String signatureUrl; |
| | | |
| | | /** |
| | | * èªèº«ç
§çå°å |
| | | */ |
| | | @ValueTableShow(value = 13,name = "èªèº«ç
§çå°å") |
| | | private String pictureUrl; |
| | | |
| | | /** |
| | | * ç»ç» |
| | | */ |
| | | // @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; |
| | | @ApiModelProperty(value = "LIMSå
³èçé¨é¨id") |
| | | private String departLimsId; |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | String selectNameById(Integer id); |
| | | |
| | | Map<String, Object> selectUserList(IPage<UserPageDto> page, UserPageDto user); |
| | | |
| | | Map<String, Object> selectPersonnelOverview(IPage<UserPageDto> page, UserPageDto user); |
| | | |
| | | int updateUser(User user); |
| | | |
| | |
| | | |
| | | int upUserPassword(String oldPassword, String newPassWord); |
| | | |
| | | int addPersonUser(PersonDto personDto); |
| | | |
| | | int upUserDepardLimsId(String ids, String id); |
| | | |
| | | int delUserDepardLimsId(Integer id); |
| | | |
| | | } |
| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | 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) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> selectPersonnelOverview(IPage<UserPageDto> page, UserPageDto user) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(UserPageDto.class)); |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectUserList"); |
| | | if (map1.get("look") == 1) user.setCreateUser(map1.get("userId")); |
| | | map.put("body", userMapper.selectPersonnelOverview(page, QueryWrappers.queryWrappers(user))); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public int updateUser(User user) { |
| | | user.setDepartId("1,"+user.getDepartId()); |
| | | user.setDepartId("1," + user.getDepartId()); |
| | | return userMapper.updateById(user); |
| | | } |
| | | |
| | | @Override |
| | | public int addUser(User user) { |
| | | user.setDepartId("1,"+user.getDepartId()); |
| | | user.setDepartId("1"); |
| | | return userMapper.insert(user); |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | | @Override |
| | | public int upUserDepardLimsId(String ids, String id) { |
| | | List<Integer> userIds = JSON.parseArray(ids, Integer.class); |
| | | return userMapper.update(null, Wrappers.<User>lambdaUpdate().in(User::getId, userIds).set(User::getDepartLimsId, id).set(User::getUpdateTime, LocalDateTime.now()).set(User::getUpdateUser, getLook.selectPowerByMethodAndUserId(null).get("userId"))); |
| | | } |
| | | |
| | | @Override |
| | | public int delUserDepardLimsId(Integer id) { |
| | | return userMapper.update(null, Wrappers.<User>lambdaUpdate().eq(User::getId, id).set(User::getDepartLimsId, null).set(User::getUpdateTime, LocalDateTime.now()).set(User::getUpdateUser, getLook.selectPowerByMethodAndUserId(null).get("userId"))); |
| | | } |
| | | } |
| | |
| | | |
| | | 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> |
| | |
| | | select u1.id, u1.account, u1.name, u1.state, u1.create_time, u1.update_time, u1.create_user, u1.update_user, |
| | | u1.age, u1.email, u1.phone, u1.department, u1.company, u1.address, u1.is_custom, u1.role_id, u2.name |
| | | create_user_name, u3.name update_user_name, r.name role_name,u1.signature_url,u1.picture_url,u1.depart_id, |
| | | u1.name_en |
| | | u1.name_en,u1.depart_lims_id |
| | | from user u1 |
| | | left join user u2 on u2.id = u1.create_user |
| | | left join user u3 on u3.id = u1.update_user |
| | |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectPersonnelOverview" resultType="com.yuanchu.mom.dto.UserPageDto"> |
| | | select * from ( |
| | | select u1.id, u1.account, u1.name, u1.state, u1.create_time, u1.update_time, u1.create_user, u1.update_user, |
| | | u1.age, u1.email, u1.phone, u1.department, u1.company, u1.address, u1.is_custom, u1.role_id, u2.name |
| | | create_user_name, u3.name update_user_name, r.name role_name,u1.signature_url,u1.picture_url,u1.depart_id, |
| | | u1.name_en |
| | | from user u1 |
| | | left join user u2 on u2.id = u1.create_user |
| | | left join user u3 on u3.id = u1.update_user |
| | | left join role r on u1.role_id = r.id |
| | | where u1.depart_lims_id is not null |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getDeviceManager" resultType="com.yuanchu.mom.dto.UserPageDto"> |
| | | select id, name |
| | | from user |