|
@@ -0,0 +1,115 @@
|
|
|
+package com.usky.fire.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.usky.common.core.bean.CommonPage;
|
|
|
+import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
+import com.usky.fire.domain.DemPoliceInfo;
|
|
|
+import com.usky.fire.domain.DemPoliceRecord;
|
|
|
+import com.usky.fire.mapper.DemPoliceRecordMapper;
|
|
|
+import com.usky.fire.service.DemPoliceInfoService;
|
|
|
+import com.usky.fire.service.DemPoliceRecordService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 处警记录 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author JCB
|
|
|
+ * @since 2022-10-24
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class DemPoliceRecordServiceImpl extends AbstractCrudService<DemPoliceRecordMapper, DemPoliceRecord> implements DemPoliceRecordService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DemPoliceInfoService demPoliceInfoService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CommonPage<Object> policeRecordList(String caseCode, String branch, Integer id, Integer pageNum, Integer pageSize) {
|
|
|
+ List<Object> list = new ArrayList<>();
|
|
|
+ IPage<DemPoliceRecord> page = new Page<>(pageNum, pageSize);
|
|
|
+ LambdaQueryWrapper<DemPoliceRecord> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(DemPoliceRecord::getDeleteFlag, "0")
|
|
|
+ .orderByDesc(DemPoliceRecord::getId);
|
|
|
+ page = this.page(page, queryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
|
|
+ List<String> policeIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < page.getRecords().size(); i++) {
|
|
|
+ policeIdList.add(page.getRecords().get(i).getCaseInfoId());
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(policeIdList)) {
|
|
|
+ LambdaQueryWrapper<DemPoliceInfo> queryWrapper1 = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper1.select()
|
|
|
+ .in(DemPoliceInfo::getPoliceId, policeIdList)
|
|
|
+ .like(StringUtils.isNotBlank(branch), DemPoliceInfo::getBranch, branch)
|
|
|
+ .like(StringUtils.isNotBlank(caseCode), DemPoliceInfo::getCaseCode, caseCode);
|
|
|
+ List<DemPoliceInfo> list1 = demPoliceInfoService.list(queryWrapper1);
|
|
|
+ for (int i = 0; i < page.getRecords().size(); i++) {
|
|
|
+ for (int j = 0; j < list1.size(); j++) {
|
|
|
+ if (page.getRecords().get(i).getCaseInfoId().equals(list1.get(j).getPoliceId())) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("id", page.getRecords().get(i).getId());
|
|
|
+ map.put("handleStartTime", page.getRecords().get(i).getHandleStartTime());
|
|
|
+ map.put("handleEndTime", page.getRecords().get(i).getHandleEndTime());
|
|
|
+ map.put("id1", list1.get(j).getId());
|
|
|
+ map.put("caseCode", list1.get(j).getCaseCode());
|
|
|
+ map.put("branch", list1.get(j).getBranch());
|
|
|
+ map.put("timeSlot", list1.get(j).getTimeSlot());
|
|
|
+ map.put("area", list1.get(j).getArea());
|
|
|
+ map.put("caseType", list1.get(j).getCaseType());
|
|
|
+ map.put("filingDate", list1.get(j).getFilingDate());
|
|
|
+ map.put("filingTime", list1.get(j).getFilingTime());
|
|
|
+ map.put("handleObject", list1.get(j).getHandleObject());
|
|
|
+ map.put("caseStatus", list1.get(j).getCaseStatus());
|
|
|
+ map.put("caseNature", list1.get(j).getCaseNature());
|
|
|
+ map.put("dispatchVehicle", list1.get(j).getDispatchVehicle());
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new CommonPage<>(list, page.getTotal(), pageSize, pageNum);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void updatePoliceRecord(DemPoliceRecord demPoliceRecord){
|
|
|
+ this.updateById(demPoliceRecord);
|
|
|
+ DemPoliceInfo demPoliceInfo = new DemPoliceInfo();
|
|
|
+ demPoliceInfo.setId(demPoliceRecord.getId1());
|
|
|
+ demPoliceInfo.setCaseCode(demPoliceRecord.getCaseCode());
|
|
|
+ demPoliceInfo.setBranch(demPoliceRecord.getBranch());
|
|
|
+ demPoliceInfo.setTimeSlot(demPoliceRecord.getTimeSlot());
|
|
|
+ demPoliceInfo.setArea(demPoliceRecord.getArea());
|
|
|
+ demPoliceInfo.setCaseType(demPoliceRecord.getCaseType());
|
|
|
+ demPoliceInfo.setFilingDate(demPoliceRecord.getFilingDate());
|
|
|
+ demPoliceInfo.setFilingTime(demPoliceRecord.getFilingTime());
|
|
|
+ demPoliceInfo.setHandleObject(demPoliceRecord.getHandleObject());
|
|
|
+ demPoliceInfo.setCaseStatus(demPoliceRecord.getCaseStatus());
|
|
|
+ demPoliceInfo.setCaseNature(demPoliceRecord.getCaseNature());
|
|
|
+ demPoliceInfo.setDispatchVehicle(demPoliceRecord.getDispatchVehicle());
|
|
|
+ demPoliceInfoService.updateById(demPoliceInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void delPoliceRecord(Integer id){
|
|
|
+ DemPoliceRecord demPoliceRecord = new DemPoliceRecord();
|
|
|
+ demPoliceRecord.setId(id);
|
|
|
+ demPoliceRecord.setDeleteFlag("1");
|
|
|
+ this.updateById(demPoliceRecord);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|