| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import jodd.util.StringUtil; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Resource |
| | | private IDictCompService compService; |
| | | |
| | | |
| | | @GetMapping("/huoqutuantitaocanxiangmu") |
| | | @ApiOperation(value = "签到登记获取团体套餐项目") |
| | | public AjaxResult huoqutuantitaocanxiangmu(@RequestParam String dwId,@RequestParam Long sex) { |
| | | List<TjPackage> list= tjDwGroupingService.huoqutuantitaocanxiangmu(dwId,sex); |
| | | if (null !=list && !list.isEmpty()){ |
| | | for (TjPackage tjPackage : list) { |
| | | List<TjProject> res=new ArrayList<>(); |
| | | LambdaQueryWrapper<TjGroupingPro> wqq=new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjGroupingPro::getGroupingId,tjPackage.getPacId()); |
| | | final List<TjGroupingPro> groupingProList = groupingProService.list(wqq); |
| | | if (null !=groupingProList && !groupingProList.isEmpty()){ |
| | | for (TjGroupingPro pro : groupingProList) { |
| | | final TjProject byId = projectService.getById(pro.getProId()); |
| | | if(null !=byId){ |
| | | res.add(byId); |
| | | } |
| | | } |
| | | tjPackage.setTjProjectList(res); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询体检单位分组列表 |
| | |
| | | @Transactional |
| | | public AjaxResult add(@RequestBody TjDwGrouping tjDwGrouping) { |
| | | if((null==tjDwGrouping.getGroupingName() || "".equals(tjDwGrouping.getGroupingName())) |
| | | || (null==tjDwGrouping.getSex() || "".equals(tjDwGrouping.getSex())) |
| | | || (null==tjDwGrouping.getPacName()||"".equals(tjDwGrouping.getPacName()))){ |
| | | || (null==tjDwGrouping.getSex() || "".equals(tjDwGrouping.getSex()))){ |
| | | return AjaxResult.error("必填项不能为空!"); |
| | | } |
| | | int i = tjDwGroupingService.selectTjDwGroupingBySex(tjDwGrouping.getDwDeptId(), tjDwGrouping.getSex()); |
| | | if(i>0){ |
| | | return AjaxResult.error("该性别分组已存在不可重复创建"); |
| | | |
| | | String id = tjDwGrouping.getId(); |
| | | if(StringUtil.isNotBlank(id)){ |
| | | TjDwGrouping dwGrouping = tjDwGroupingService.getById(tjDwGrouping.getId()); |
| | | if(null !=dwGrouping){ |
| | | if(null !=tjDwGrouping.getMapList() && !tjDwGrouping.getMapList().isEmpty()){ |
| | | tjDwGroupingService.deleteTjDwGroupingById(tjDwGrouping.getId()); |
| | | } |
| | | } |
| | | }else { |
| | | int i = tjDwGroupingService.selectTjDwGroupingBySex(tjDwGrouping.getDwDeptId(), tjDwGrouping.getSex()); |
| | | if(i>0){ |
| | | return AjaxResult.error("该性别分组已存在不可重复创建"); |
| | | } |
| | | int wz = tjDwGroupingService.selectTjDwGroupingBySex(tjDwGrouping.getDwDeptId(),"2"); |
| | | if(wz>0 && (tjDwGrouping.getSex().contains("0") || tjDwGrouping.getSex().contains("1"))){ |
| | | return AjaxResult.error("已存在通用分组不可创建其他分组"); |
| | | } |
| | | int n = tjDwGroupingService.selectTjDwGroupingBySex(tjDwGrouping.getDwDeptId(),"0"); |
| | | int v = tjDwGroupingService.selectTjDwGroupingBySex(tjDwGrouping.getDwDeptId(),"1"); |
| | | if((n>0 || v>0) && tjDwGrouping.getSex().contains("2")){ |
| | | return AjaxResult.error("已存在其他分组不可创建通用分组"); |
| | | } |
| | | } |
| | | tjDwGrouping.setDwDeptName(compService.getById(tjDwGrouping.getDwId()).getCnName()); |
| | | |
| | | if(null ==tjDwGrouping.getPayType()|| tjDwGrouping.getPayType().isEmpty())return AjaxResult.error("请选择结算方式!!!"); |
| | | |
| | | TjDwDept dwDept = dwDeptService.getById(tjDwGrouping.getDwDeptId()); |
| | | if(null !=dwDept){ |
| | | tjDwGrouping.setDwDeptName(dwDept.getDwDeptName()); |
| | | } |
| | | tjDwGrouping.setDwName(compService.getById(tjDwGrouping.getDwId()).getCnName()); |
| | | if(StringUtil.isBlank(tjDwGrouping.getPacName())) tjDwGrouping.setPacName(tjDwGrouping.getGroupingName()); |
| | | if (tjDwGroupingService.saveOrUpdate(tjDwGrouping)) { |
| | | if(null !=tjDwGrouping.getMapList() && tjDwGrouping.getMapList().size()>0){ |
| | | // groupingProService.remove(new LambdaQueryWrapper<TjGroupingPro>().eq(TjGroupingPro::getGroupingId,tjDwGrouping.getId())); |
| | | if(null !=tjDwGrouping.getMapList() && !tjDwGrouping.getMapList().isEmpty()){ |
| | | groupingProService.deletedTjGroupingProByGroupingId(tjDwGrouping.getId()); |
| | | for (Map<String, Object> map : tjDwGrouping.getMapList()) { |
| | | TjGroupingPro groupingPro=new TjGroupingPro(); |
| | | groupingPro.setGroupingId(tjDwGrouping.getId()); |
| | | groupingPro.setProPrice(BigDecimal.valueOf(Long.parseLong(map.get("proPrice").toString()))); |
| | | groupingPro.setProPrice(new BigDecimal(map.get("proPrice").toString())); |
| | | groupingPro.setProId(map.get("proId").toString()); |
| | | groupingPro.setProName(map.get("proName").toString()); |
| | | groupingPro.setProPyName(PinyinUtil.getFirstLetter(map.get("proName").toString(),"")); |
| | | groupingPro.setLimits(tjDwGrouping.getLimits()); |
| | | groupingPro.setYsPrice(BigDecimal.valueOf(Long.parseLong(map.get("proPrice").toString())) |
| | | .multiply(BigDecimal.valueOf(Long.parseLong(tjDwGrouping.getLimits())) |
| | | .divide(BigDecimal.valueOf(10)))); |
| | | groupingPro.setLimits(map.get("limits").toString()); |
| | | // groupingPro.setYsPrice(BigDecimal.valueOf(Long.parseLong(map.get("proPrice").toString())) |
| | | // .multiply(BigDecimal.valueOf(Long.parseLong(tjDwGrouping.getLimits())) |
| | | // .divide(BigDecimal.valueOf(10)))); |
| | | groupingPro.setYsPrice(new BigDecimal(map.get("ysPrice").toString())); |
| | | groupingProService.save(groupingPro); |
| | | } |
| | | } |
| | |
| | | } |
| | | return AjaxResult.error("操作失败!"); |
| | | } |
| | | |
| | | @GetMapping("updateGroupProLimitsByGroupId") |
| | | @ApiOperation(value = "根据分组id修改分组项目表折扣") |
| | | public AjaxResult updateGroupProLimitsByGroupId(@RequestParam @ApiParam(value = "分组id") String groupId, |
| | | @RequestParam @ApiParam(value = "折扣") String limits) { |
| | | boolean a= groupingProService.updateGroupProLimitsByGroupId(groupId,limits); |
| | | if(a){ |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除体检单位分组 |
| | |
| | | public AjaxResult getTjParentProjectList(@RequestParam(required = false) @ApiParam(value = "单项名") String proName) { |
| | | LambdaQueryWrapper<TjProject> wq =new LambdaQueryWrapper<>(); |
| | | wq.eq(TjProject::getProParentId,0); |
| | | if(null !=proName && !proName.equals("")){ |
| | | wq.eq(TjProject::getProStatus,0); |
| | | if(null !=proName && !proName.isEmpty()){ |
| | | wq.like(TjProject::getProName,proName); |
| | | } |
| | | List<TjProject> tjProjectList = projectService.list(wq); |