提交 5e5efb84 authored 作者: 133's avatar 133

【清退】提交BUG修改代码

上级 4936e1c6
......@@ -3,9 +3,11 @@ package com.tykj.dev.device.library.repository;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import javax.transaction.Transactional;
import java.util.Date;
import java.util.List;
......@@ -64,5 +66,16 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
List<DeviceLibrary> findAllByPackingIdInAndOwnUnitIn(List<Integer> packingIds,List<String> unitNames);
List<DeviceLibrary> findAllByOwnUnitAndLocationUnitAndLifeStatus(String ownUnitName,String locationUnitName,Integer status);
@Transactional
@Modifying
@Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus where o.id in :idList")
int upDateLeftStatus(Integer lifeStatus,@Param("idList") List<Integer> idList);
@Transactional
@Modifying
@Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus ,o.locationUnit = :unitName,o.ownUnit = :unitName where o.id in :idList")
int upDateLeftStatusAndUnitName(Integer lifeStatus,String unitName,@Param("idList") List<Integer> idList);
}
......@@ -68,7 +68,12 @@ public enum DeviceLifeStatus {
/**
* 使用
*/
USE(14, "使用");
USE(14, "使用"),
/**
* 待清退
*/
REPEL(15,"清退");
public Integer id;
......
......@@ -73,12 +73,21 @@ public class RepelQueryController {
return ResponseEntity.ok(repelQueryService.clearedList(unitId));
}
// /**
// * 省直属任务装备查询接口
// */
// @GetMapping(value ="/provinceDirectlyUnderDev/{taskId}")
// @ApiOperation(value = "省直属任务装备查询接口", notes = "省直属任务装备查询接口")
// public ResponseEntity provinceDirectlyUnderDev(@PathVariable Integer taskId){
// return ResponseEntity.ok(repelQueryService.provinceDirectlyUnderDev(taskId));
// }
/**
* 省直属任务装备查询接口
* 省直属任务单位列表查询接口
*/
@GetMapping(value ="/provinceDirectlyUnderDev/{taskId}")
@ApiOperation(value = "省直属任务装备查询接口", notes = "省直属任务装备查询接口")
@ApiOperation(value = "省直属任务单位列表查询接口", notes = "省直属任务装备查询接口")
public ResponseEntity provinceDirectlyUnderDev(@PathVariable Integer taskId){
return ResponseEntity.ok(repelQueryService.provinceDirectlyUnderDev(taskId));
return ResponseEntity.ok(repelQueryService.directlyUnderUnitLeftNavigation(taskId));
}
}
......@@ -64,6 +64,7 @@ public class DeviceRepel extends BaseEntity {
*
*/
@ApiModelProperty(value = "正文")
@Column(columnDefinition = "TEXT")
private String files;
......
......@@ -40,6 +40,12 @@ public class DeviceRepelDetail extends BaseEntity {
@ApiModelProperty(value = "账单id")
private Integer repelId;
/**
* 编号
*/
@ApiModelProperty(value = "单据编号")
private String num;
/**
* 申请文号
*/
......
package com.tykj.dev.device.sendback.entity.vo;
import com.tykj.dev.device.user.base.ret.LeftNavigation;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName DirectlyUnderNavigation.java
* @Description TODO
* @createTime 2021年01月18日 10:41:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("直属单位列表")
public class DirectlyUnderNavigation {
/**
* id
*/
private Integer id;
/**
* 名称
*/
private String name;
/**
* 定位id
*/
private String location;
}
......@@ -5,7 +5,9 @@ import com.tykj.dev.device.sendback.entity.domain.DeviceRepel;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
import com.tykj.dev.device.sendback.entity.domain.RepelTaskStatistical;
import com.tykj.dev.device.sendback.entity.vo.DeviceChooseRepel;
import com.tykj.dev.device.sendback.entity.vo.DirectlyUnderNavigation;
import com.tykj.dev.device.sendback.entity.vo.RepelStatisticsVo;
import com.tykj.dev.device.user.base.ret.LeftNavigation;
import java.util.List;
......@@ -53,7 +55,13 @@ public interface RepelQueryService {
List<DeviceLibrary> clearedList(Integer unitId);
/**
*
*省直属任务装备查询接口
*/
List<DeviceLibrary> provinceDirectlyUnderDev(Integer taskId);
/**
* 查询直属单位列表
*/
List<DirectlyUnderNavigation> directlyUnderUnitLeftNavigation(Integer taskId);
}
......@@ -35,6 +35,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
......@@ -115,16 +117,15 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepel.getTaskScopes().forEach(
unisId->{
Units units1= unitsService.findById(unisId);
Area area1=areaService.findByid(units1.getAreaId());
if ("2".equals(unitsService.findById(unisId).getCode())) {
if (deviceLibraryDao.existsAllByPackingIdInAndOwnUnitIn(deviceRepel.getFieldingIds(), unitsService.findBySubordinateUnitName(unisId))){
directlUnderUnit.set(true);
}
}else {
deviceRepelDetail.setSendUnit(units1.getName());
if (units1.getType()==2) {
directlUnderUnit.set(deviceLibraryDao.existsAllByPackingIdInAndOwnUnitIn(deviceRepel.getFieldingIds(),unitsService.findBySubordinateUnitName(units1.getUnitId())));
}else if (units1.getType()==1){
log.info("asdasdas{}",units1.getName());
Area area1=areaService.findByid(units1.getAreaId());
deviceRepelDetail.setSendUnit(units1.getName());
deviceRepelDetail.setSendUnitId(units1.getUnitId());
deviceRepelDetail.setId(null);
if (deviceLibraryDao.existsAllByPackingIdInAndOwnUnitIn(deviceRepel.getFieldingIds(), unitsService.findBySubordinateUnitName(unisId))){
if (deviceLibraryDao.existsAllByPackingIdInAndOwnUnitIn(deviceRepel.getFieldingIds(), unitsService.findBySubordinateUnitName(units1.getUnitId()))){
TaskBto taskBto1= cityRepelTask(unisId,deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(),deviceRepel.getTitle(),taskBto.getId());
list.add(new RepelTaskStatistical(deviceRepel1.getId(),taskBto.getId(),taskBto1.getId(),0,area1.getName(),model,""));
}
......@@ -136,8 +137,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setSendUnit(units.getName());
deviceRepelDetail.setId(null);
if (directlUnderUnit.get()){
TaskBto taskBto1 = directlyUnderTask(units.getUnitId(),deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), taskBto.getId());
list.add(new RepelTaskStatistical(deviceRepel1.getId(),taskBto.getId(),taskBto1.getId(),0,"省直属",model,""));
TaskBto taskBto2 = directlyUnderTask(units.getUnitId(),deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), taskBto.getId());
list.add(new RepelTaskStatistical(deviceRepel1.getId(),taskBto.getId(),taskBto2.getId(),0,"省直属",model,""));
}
deviceRepelDetail.setId(null);
List<String> strings=new ArrayList<>();
......@@ -294,11 +295,13 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
// List<ModelCount> modelCountList= JacksonUtil.readValue(a, new TypeReference<List<ModelCount>>() {});
// log.info("---{}",modelCountList.size());
// boolean flag= repelTaskStatisticalService.findAllRepelTaskStatistical(589,286).stream().allMatch(e->e.getTaskStatus()!=1);
}
@Override
public void submitChooseDevice(Integer taskId, ResolveConfirm resolveConfirm) {
long stime=System.currentTimeMillis();
log.info("提交装备接口开始{}",taskId);
Map<String,Integer> map=new HashMap<>();
StringBuffer ids=new StringBuffer();
TaskBto taskBto= taskService.get(taskId);
......@@ -317,11 +320,13 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceLibrary -> {
map.put(deviceLibrary.getModel(), map.get(deviceLibrary.getModel()) + 1);
ids.append(",").append(deviceLibrary.getId());
deviceLibrary.setLifeStatus(12);
// deviceLibrary.setLifeStatus(12);
}
);
deviceLibraryDao.saveAll(deviceLibraries);
log.info("存储设备开始");
long time1=System.currentTimeMillis();
deviceLibraryDao.upDateLeftStatus(2,resolveConfirm.getDevIds());
log.info("存储结束{}",System.currentTimeMillis()-time1);
for (String key:map.keySet()){
ModelCount modelCount = new ModelCount();
modelCount.setCount(map.get(key));
......@@ -336,6 +341,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setDeviceIds(ids.toString());
deviceRepelDetail.setSubmitDescription(resolveConfirm.getDes());
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
log.info("提交装备接口结束{}",System.currentTimeMillis()-stime);
}
@Override
......@@ -379,6 +385,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
orderOutDataRepelDetail.setDeviceIds(deviceRepelDetail.getDeviceIds());
orderOutDataRepelDetail.setLeftSignatureId(UUID.randomUUID().toString());
orderOutDataRepelDetail.setRightSignatureId(UUID.randomUUID().toString());
orderOutDataRepelDetail.setNum("NO:第"+ LocalDateTime.now().getYear()+"QT"+deviceRepelDetail.getId());
deviceRepelDetailService.saveDeviceRepelDetail(orderOutDataRepelDetail);
taskBto.setOwnUnit(orderOutData.getReceiveUnitId());
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1209,0);
......@@ -400,20 +407,24 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
if (unitsService.findById(deviceRepelDetail.getReceiveUnitId()).getLevel()==2){
inStock=2;
}else {
inStock=12;
inStock=15;
}
List<DeviceLibrary> libraries= findInvoleDevice(deviceRepelDetail.getDeviceIds());
libraries.forEach(
deviceLibrary -> {
deviceLibrary.setLocationUnit(deviceRepelDetail.getReceiveUnit());
deviceLibrary.setOwnUnit(deviceRepelDetail.getReceiveUnit());
deviceLibrary.setLifeStatus(inStock);
// deviceLibrary.setLocationUnit(deviceRepelDetail.getReceiveUnit());
// deviceLibrary.setOwnUnit(deviceRepelDetail.getReceiveUnit());
// deviceLibrary.setLifeStatus(inStock);
list.add(new RepelDeviceUnit(deviceLibrary.getId(),deviceRepelDetail.getSendUnitId()));
}
);
deviceLibraryDao.saveAll(libraries);
repelDeviceUnitService.saveAllRepelDeviceUnit(list);
log.info("更新数据装备以及所属单位-{}",libraries.size());
long time=System.currentTimeMillis();
deviceLibraryDao.upDateLeftStatusAndUnitName(inStock,deviceRepelDetail.getReceiveUnit(),StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
log.info("更新数据装备以及所属单位{}",System.currentTimeMillis()-time);
repelDeviceUnitService.saveAllRepelDeviceUnit(list);
RepelTaskStatistical repelTaskStatistical= repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(),deviceRepelDetail.getRepelId());
repelTaskStatistical.setTaskStatus(1);
repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical);
......@@ -440,15 +451,19 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceLibrary -> {
Units units1= unitsService.findbyName(deviceLibrary.getOwnUnit());
list.add(new RepelDeviceUnit(deviceLibrary.getId(),units1.getUnitId()));
deviceLibrary.setLocationUnit(units.getName());
deviceLibrary.setOwnUnit(units.getName());
deviceLibrary.setLifeStatus(12);
// deviceLibrary.setLocationUnit(units.getName());
// deviceLibrary.setOwnUnit(units.getName());
// deviceLibrary.setLifeStatus(15);
ids.append(",").append(deviceLibrary.getId());
}
);
log.info("更新数据装备以及所属单位-{}",libraries.size());
long time=System.currentTimeMillis();
deviceLibraryDao.upDateLeftStatusAndUnitName(15,units.getName(),StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
log.info("更新数据装备以及所属单位{}",System.currentTimeMillis()-time);
deviceRepelDetail.setDeviceIds(ids.toString());
deviceLibraryDao.saveAll(libraries);
// deviceLibraryDao.saveAll(libraries);
repelDeviceUnitService.saveAllRepelDeviceUnit(list);
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
isEnd(taskBto,deviceRepelDetail.getRepelId());
......@@ -496,14 +511,18 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
List<DeviceLibrary> libraries= findInvoleDevice(deviceRepelDetail.getDeviceIds());
libraries.forEach(
deviceLibrary -> {
deviceLibrary.setLocationUnit(deviceRepelDetail.getReceiveUnit());
deviceLibrary.setOwnUnit(deviceRepelDetail.getReceiveUnit());
deviceLibrary.setLifeStatus(2);
// deviceLibrary.setLocationUnit(deviceRepelDetail.getReceiveUnit());
// deviceLibrary.setOwnUnit(deviceRepelDetail.getReceiveUnit());
// deviceLibrary.setLifeStatus(2);
list.add(new RepelDeviceUnit(deviceLibrary.getId(),deviceRepelDetail.getSendUnitId()));
}
);
log.info("更新数据装备以及所属单位-{}",libraries.size());
long time=System.currentTimeMillis();
deviceLibraryDao.upDateLeftStatusAndUnitName(2,deviceRepelDetail.getReceiveUnit(),StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
log.info("更新数据装备以及所属单位{}",System.currentTimeMillis()-time);
deviceLibraryDao.saveAll(libraries);
// deviceLibraryDao.saveAll(libraries);
repelDeviceUnitService.saveAllRepelDeviceUnit(list);
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
}
......
......@@ -7,6 +7,7 @@ import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
import com.tykj.dev.device.sendback.entity.domain.RepelDeviceUnit;
import com.tykj.dev.device.sendback.entity.domain.RepelTaskStatistical;
import com.tykj.dev.device.sendback.entity.vo.DeviceChooseRepel;
import com.tykj.dev.device.sendback.entity.vo.DirectlyUnderNavigation;
import com.tykj.dev.device.sendback.entity.vo.RepelStatisticsVo;
import com.tykj.dev.device.sendback.service.*;
import com.tykj.dev.device.sendback.util.StringUtils;
......@@ -22,6 +23,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
/**
......@@ -115,6 +117,22 @@ public class RepelQueryServiceImpl implements RepelQueryService {
}
@Override
public List<DirectlyUnderNavigation> directlyUnderUnitLeftNavigation(Integer taskId) {
TaskBto taskBto= taskService.get(taskId);
List<DirectlyUnderNavigation> list=new ArrayList<>();
DeviceRepelDetail deviceRepelDetail=repelDetailService.findDeviceRepelDetailNoDev(taskBto.getBillId());
DeviceRepel deviceRepel=deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
unitsService.findAllByIdIn(StringUtils.stringToList(deviceRepel.getTaskScope())).forEach(
units -> {
if (units.getType()==2){
list.add(new DirectlyUnderNavigation(units.getUnitId(),units.getName(), UUID.randomUUID().toString()));
}
}
);
return list;
}
private List<DeviceLibrary> findInvoleDevice(String involeDevice){
if (involeDevice!=null && !involeDevice.equals("")&& !involeDevice.equals(",")) {
List<String> idStringList = Arrays.asList(involeDevice.split(","));
......
package com.tykj.dev.device.sendback.service;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Service;
/**
* @author zjm
* @version 1.0.0
* @ClassName sendDevice.java
* @Description TODO
* @createTime 2021年01月18日 09:36:00
*/
@Service
@Slf4j
public class sendDevice implements CommandLineRunner {
@Autowired
DeviceLibraryDao deviceLibraryDao;
@Override
public void run(String... args) throws Exception {
log.info("开始模拟数据");
// DeviceLibrary deviceLibrary= deviceLibraryDao.findById(4).get();
// for (int i=0;i<100;i++){
// deviceLibrary.setId(null);
// deviceLibraryDao.save(deviceLibrary);
// }
log.info("模拟数据结束");
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论