| | |
| | | package com.kidgrow.oprationcenter.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.common.model.SysDoctor; |
| | | import com.kidgrow.common.model.SysUser; |
| | | import com.kidgrow.common.service.impl.SuperServiceImpl; |
| | | import com.kidgrow.oprationcenter.mapper.DataNeedMapper; |
| | | import com.kidgrow.oprationcenter.model.DataNeed; |
| | | import com.kidgrow.oprationcenter.service.IDataNeedService; |
| | | import com.kidgrow.oprationcenter.vo.DataNeedExcel; |
| | | import com.kidgrow.usercenter.feign.SysDoctorService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cglib.beans.BeanCopier; |
| | | import org.springframework.stereotype.Service; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.kidgrow.common.service.impl.SuperServiceImpl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import com.kidgrow.oprationcenter.model.DataNeed; |
| | | import com.kidgrow.oprationcenter.mapper.DataNeedMapper; |
| | | import com.kidgrow.oprationcenter.service.IDataNeedService; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class DataNeedServiceImpl extends SuperServiceImpl<DataNeedMapper, DataNeed> implements IDataNeedService { |
| | | @Autowired |
| | | private SysDoctorService sysDoctorService; |
| | | /** |
| | | * 列表 |
| | | * @param params |
| | |
| | | |
| | | @Override |
| | | public List<DataNeedExcel> findListExportByParam(Map<String, Object> params) { |
| | | List<DataNeed> dataNeeds = baseMapper.selectByMap(params); |
| | | QueryWrapper queryWrapper=new QueryWrapper(); |
| | | String doctor_name = MapUtils.getString(params, "doctor_name"); |
| | | if(doctor_name!=null){ |
| | | queryWrapper.like("doctor_name","%"+doctor_name+"%"); |
| | | } |
| | | String need_begintime = MapUtils.getString(params, "need_begintime"); |
| | | if(need_begintime!=null){ |
| | | queryWrapper.gt("need_begintime",need_begintime); |
| | | } |
| | | String need_endtime = MapUtils.getString(params, "need_endtime"); |
| | | if(need_endtime!=null){ |
| | | queryWrapper.gt("need_endtime",need_endtime); |
| | | } |
| | | queryWrapper.eq("is_del",0); |
| | | List<DataNeed> dataNeeds = baseMapper.selectList(queryWrapper); |
| | | List<DataNeedExcel> voList=new ArrayList<>(); |
| | | dataNeeds.forEach(e ->{ |
| | | DataNeedExcel vo=new DataNeedExcel(); |
| | |
| | | return ResultBody.ok(); |
| | | } |
| | | } |
| | | @Override |
| | | public ResultBody updateDelete(Long id,SysUser sysUser) { |
| | | if(id==null){ |
| | | return ResultBody.failed("请选择一条数据"); |
| | | }else { |
| | | DataNeed dataNeed = baseMapper.selectById(id); |
| | | if (dataNeed != null) { |
| | | dataNeed.setIsDel(true); |
| | | dataNeed.setUpdateTime(new Date()); |
| | | dataNeed.setUpdateUserId(sysUser.getId()); |
| | | dataNeed.setUpdateUserName(sysUser.getUsername()); |
| | | int u=baseMapper.updateById(dataNeed); |
| | | return ResultBody.ok().data(u>0); |
| | | }else { |
| | | return ResultBody.failed("查找数据失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public ResultBody FindAllByHId(Map<String, Object> map, SysUser sysUser) { |
| | | Map<String,Object> doctoerMap =new HashMap<>(); |
| | | doctoerMap.put("user_id",sysUser.getId()); |
| | | ResultBody listByMap = sysDoctorService.getListByMap(doctoerMap); |
| | | List<SysDoctor> sysDoctors = JSON.parseArray(JSON.toJSONString(listByMap.getData()), SysDoctor.class); |
| | | if (sysDoctors!=null&&sysDoctors.size()>0){ |
| | | Page<DataNeed> page = new Page<>(MapUtils.getInteger(map, "page"), MapUtils.getInteger(map, "limit")); |
| | | // List<DataNeed> dataNeedList=baseMapper.findHList(map); |
| | | List<DataNeed> list = baseMapper.findList(page, map); |
| | | PageResult<DataNeed> build = PageResult.<DataNeed>builder().data(list).code(0).count(page.getTotal()).build(); |
| | | return ResultBody.ok().data(build); |
| | | }else { |
| | | return ResultBody.failed("非管理用户无权查看"); |
| | | } |
| | | } |
| | | } |