|
|
|
|
@ -18,16 +18,14 @@ import com.biutag.supervision.mapper.SamplingMapper;
|
|
|
|
|
import com.biutag.supervision.mapper.SamplingPoliceMapper; |
|
|
|
|
import com.biutag.supervision.mapper.SupTaskTestingAlcoholSamplingMapper; |
|
|
|
|
import com.biutag.supervision.pojo.dto.SamplingPoliceDto; |
|
|
|
|
import com.biutag.supervision.pojo.entity.Confinement; |
|
|
|
|
import com.biutag.supervision.pojo.entity.Sampling; |
|
|
|
|
import com.biutag.supervision.pojo.entity.SamplingPolice; |
|
|
|
|
import com.biutag.supervision.pojo.entity.SupTaskTestingAlcoholSampling; |
|
|
|
|
import com.biutag.supervision.pojo.entity.*; |
|
|
|
|
import com.biutag.supervision.pojo.model.UserAuth; |
|
|
|
|
import com.biutag.supervision.pojo.param.SamplingQueryParam; |
|
|
|
|
import com.biutag.supervision.pojo.vo.DataPetitionComplaintExportGabxfVo; |
|
|
|
|
import com.biutag.supervision.pojo.vo.PoliceVo; |
|
|
|
|
import com.biutag.supervision.pojo.vo.SamplingVo; |
|
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
|
import lombok.Data; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
@ -37,7 +35,10 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.time.LocalTime; |
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
|
|
|
|
|
|
@ -51,6 +52,8 @@ public class SamplingService extends ServiceImpl<SamplingMapper, Sampling> {
|
|
|
|
|
private final SupDepartService departService; |
|
|
|
|
|
|
|
|
|
private final SupTaskTestingAlcoholSamplingMapper samplingMapper; |
|
|
|
|
|
|
|
|
|
private final SupRotaService rotaService; |
|
|
|
|
//添加或者修改
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public boolean addOrUpdata(SamplingVo vo){ |
|
|
|
|
@ -121,7 +124,8 @@ public class SamplingService extends ServiceImpl<SamplingMapper, Sampling> {
|
|
|
|
|
.eq(StrUtil.isNotBlank(queryParam.getGender()),"gender",queryParam.getGender()) |
|
|
|
|
.like(StrUtil.isNotEmpty(queryParam.getPersonnelType()),"personnel_type", queryParam.getPersonnelType()) |
|
|
|
|
.eq(StrUtil.isNotBlank(queryParam.getDrinkAlcohol()),"drink_alcohol",queryParam.getDrinkAlcohol()) |
|
|
|
|
.eq(StrUtil.isNotBlank(queryParam.getBeDuty()),"be_duty",queryParam.getBeDuty()); |
|
|
|
|
.eq(StrUtil.isNotBlank(queryParam.getBeDuty()),"be_duty",queryParam.getBeDuty()) |
|
|
|
|
.orderByDesc("crt_time"); |
|
|
|
|
//抽检领导次数
|
|
|
|
|
if(queryParam.getLeadersNumber() != 0 ){ |
|
|
|
|
queryWrapper.eq("leaders_number",queryParam.getLeadersNumber()); |
|
|
|
|
@ -193,7 +197,7 @@ public class SamplingService extends ServiceImpl<SamplingMapper, Sampling> {
|
|
|
|
|
public List<PoliceVo> getSamplingPolice(SamplingVo samplingVo){ |
|
|
|
|
List<PoliceVo> list =new ArrayList<>(); |
|
|
|
|
List<String> orgIds = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
//抽检单位
|
|
|
|
|
if(CollectionUtil.isNotEmpty(samplingVo.getSamplingObjectList()) && CollectionUtil.isEmpty(samplingVo.getOrgIds())){ |
|
|
|
|
samplingVo.getSamplingObjectList().forEach(s->{ |
|
|
|
|
orgIds.add(s.getDeptId()); |
|
|
|
|
@ -201,13 +205,30 @@ public class SamplingService extends ServiceImpl<SamplingMapper, Sampling> {
|
|
|
|
|
}); |
|
|
|
|
samplingVo.setOrgIds(orgIds); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 抽检对象
|
|
|
|
|
//todo 缺少“是否值班人员”判断
|
|
|
|
|
//抽检对象
|
|
|
|
|
List<String> policeCode = new ArrayList<>(); |
|
|
|
|
if("2".equals(samplingVo.getDrinkAlcohol())){ |
|
|
|
|
// // 获取当前的本地时间
|
|
|
|
|
// LocalTime currentTime = LocalTime.now();
|
|
|
|
|
// // 定义时间格式化为字符串的格式
|
|
|
|
|
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
// // 将本地时间格式化为字符串
|
|
|
|
|
// String dateTime = currentTime.format(formatter);
|
|
|
|
|
// //获取值班人员
|
|
|
|
|
// List<SupRota> supRota = rotaService.list(new LambdaQueryWrapper<SupRota>()
|
|
|
|
|
// .in(SupRota::getDeptCode,samplingVo.getOrgIds())
|
|
|
|
|
// .ge(SupRota::getStartTime, dateTime)
|
|
|
|
|
// .le(SupRota::getEndTime, dateTime));
|
|
|
|
|
// if(CollectionUtil.isNotEmpty(supRota)){
|
|
|
|
|
// policeCode = supRota.stream().map(SupRota::getPoliceCode).toList();
|
|
|
|
|
// samplingVo.setPoliceCodes(policeCode);
|
|
|
|
|
// }
|
|
|
|
|
samplingVo.setDrinkAlcohol(null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
//普通警员的抽检人数
|
|
|
|
|
List<PoliceVo> policeVos = baseMapper.selectPoliceData(samplingVo); |
|
|
|
|
//辅警数 = (抽检人数 ) * 辅警比例
|
|
|
|
|
@ -218,7 +239,7 @@ public class SamplingService extends ServiceImpl<SamplingMapper, Sampling> {
|
|
|
|
|
List<PoliceVo> leadPoliceVos = baseMapper.selectPoliceDataLead(samplingVo); |
|
|
|
|
//时间范围内的抽检次数
|
|
|
|
|
|
|
|
|
|
if( samplingVo.getSamplingNumber() > 0 ){ |
|
|
|
|
if(samplingVo.getSamplingNumber() > 0 ){ |
|
|
|
|
policeVos = policeVos.stream().filter(s->s.getCjnum() == samplingVo.getSamplingNumber()).toList(); |
|
|
|
|
leadPoliceVos=leadPoliceVos.stream().filter(s->s.getCjnum()== samplingVo.getSamplingNumber()).toList(); |
|
|
|
|
} |
|
|
|
|
|