提交 a380226e authored 作者: zhoushaopan's avatar zhoushaopan

提交合并全部代码

上级 76e9b193
......@@ -24,6 +24,7 @@ import com.tykj.dev.device.user.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.DeviceLifeStatus;
import com.tykj.dev.misc.base.ResultObj;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.*;
......@@ -32,6 +33,7 @@ import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
......@@ -171,6 +173,7 @@ public class BackController {
//改变装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(3);
// deviceLibraryEntity.setLifeStatus(6);
deviceLibraryEntity.setManageStatus(0);
deviceLibraryService.update(deviceLibraryEntity);
//存装备日志
......@@ -196,7 +199,10 @@ public class BackController {
MessageBto messageBto = new MessageBto(saveEntity.getId(),saveEntity.getBusinessType(),"对" + userPublicService.getAreaNameByUnitName(allotBackBill.getReceiveUnit()) + "发起退回",idList,1);
messageService.add(messageBto);
log.info("[退回模块]:" + allotBackBill.getSendUnit() + "对" + allotBackBill.getReceiveUnit() + "发起退回");
//添加taskId
allotBackBill1.setTaskId(saveEntity.getId());
myWebSocket.sendMessage1();
return ResponseEntity.ok(new ResultObj(allotBackBill1, "发起成功"));
}
......@@ -383,6 +389,7 @@ public class BackController {
//判断业务状态是否被操作
List<StatusEnum> statusEnums = new ArrayList<>();
statusEnums.add(StatusEnum.WAIT_UPLOAD_BACK_FILE_2);
statusEnums.add(StatusEnum.ALLOT_BACKING);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),statusEnums);
//获取账单
AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto.getBillId());
......@@ -612,7 +619,7 @@ public class BackController {
return ResponseEntity.ok(allotBillEntity);
}
@ApiOperation(value = "退回撤回", notes = "根据任务id撤回配发")
@ApiOperation(value = "退回撤回", notes = "根据任务id撤回退回")
@GetMapping("/revokeTask/taskId")
public ResponseEntity revokeTask(Integer taskId){
......@@ -625,34 +632,51 @@ public class BackController {
Integer billId = taskBto.getBillId();
String title = taskBto.getTitle();
// AllotBill allotBill = allotBillService.getOne(billId);
AllotBackBill allotBackBill = allotBackBillService.getOne(billId);
if (allotBackBill.getBackCheckDetail()!=null){
Integer currentUserId = userUtils.getCurrentUserId();
List<Integer> idList = userPublicService.findOtherUser(currentUserId);
//找到收件方的阅知
MessageBto messageBto1 = messageService.findByTaskId(parentTaskId).parse2Bto();
//纵向配发阅知要发给收件单位的人
idList.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBackBill.getReceiveUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
//给同单位专管员和收件单位专管员推阅知
messageBto1.setContent(title.substring(0,4)+"撤回"+title.substring(4));
MessageBto messageBto = new MessageBto(-1, parentTask.getBusinessType(), messageBto1.getContent(), idList, 1);
BeanUtils.copyProperties(messageBto1,messageBto);
messageBto.setTaskId(-1);
messageService.add(messageBto);
myWebSocket.sendMessage1();
//将任务都完结
taskService.moveToRevoke(taskBto);
taskService.moveToRevoke(parentTask);
if (allotBackBill.getBackCheckDetail() != null) {
List<Integer> ids = StringSplitUtil.split(allotBackBill.getBackCheckDetail());
List<DeviceLibrary> deviceLibraryList = new ArrayList<>();
for (Integer id : ids) {
//通过id装备
//所有的装备
List<DeviceLibrary> deviceLibraryList;
//所有的装备日志
List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
ids.forEach(id -> {
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(id);
// deviceLibrary.setOwnUnit(allotBackBill.getSendUnit());
// deviceLibrary.setLocationUnit(allotBackBill.getSendUnit());
deviceLibrary.setLifeStatus(2);
deviceLibraryService.update(deviceLibrary);
deviceLibraryList.add(deviceLibrary);
}
allotBackBill.setDeviceLibraries(deviceLibraryList);
}
//添加装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + deviceLibrary.getName() + "配发撤回", null, null, null);
deviceLogDtos.add(deviceLogDto);
});
// List<DeviceLibrary> deviceLibraryList = deviceLibraryService.getListByBillId(billId);
//
// for (DeviceLibrary deviceLibrary : deviceLibraryList) {
// deviceLibrary.setLifeStatus(2);
// deviceLibraryService.update(deviceLibrary);
// }
//将任务都完结
taskService.moveToArchive(taskBto);
//设置装备为在库
deviceLibraryService.updateLifeStatus2(2,ids);
deviceLibraryList = deviceLibraryService.findByIds(ids);
//添加日志
deviceLogService.addAllLog(deviceLogDtos);
taskService.moveToArchive(parentTask);
return ResponseEntity.ok(title + "的任务撤回成功");
allotBackBill.setDeviceLibraries(deviceLibraryList);
allotBackBillService.deleteByAllotBackId(allotBackBill.getId());
}
return ResponseEntity.ok(messageBto);
}
}
......@@ -24,4 +24,9 @@ public interface AllotBackBillService {
AllotBackBill getOne(Integer id);
Page<AllotBackBill> getPage(AllotBillSelectVo allotBillSelectVo, Pageable pageable);
/**
* 根据id删除 zsp
*/
void deleteByAllotBackId(Integer id);
}
......@@ -120,6 +120,11 @@ public class AllotBackBillServiceImpl implements AllotBackBillService {
return page;
}
@Override
public void deleteByAllotBackId(Integer id) {
allotBackBillDao.deleteById(id);
}
/**
* @param allotBillSelectVo 查询vo
* 查询统一筛选器
......
......@@ -105,7 +105,7 @@ public class AllotBillSaveVo {
@ApiModelProperty(value = "单据保存vo")
private List<ScriptSaveVo> scriptSaveVos;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "配用范围")
private Integer matchingRange;
/**
......
......@@ -78,7 +78,7 @@ public enum LogType {
REPAIR_SEND_3(32,REPAIR.id, REPAIR_SEND_CONFIRM.id, ARCHIVE.id, "维修出库审核失败"),
REPAIR_SEND_4(33,REPAIR.id, WAIT_RECEIVE.id, END.id, "接收维修装备并发起入库"),
REPAIR_SEND_4(33,REPAIR.id, WAIT_RECEIVE.id, END.id, "上传相关单据,任务结束"),//
REPAIR_SEND_5(34,REPAIR.id, WAIT_RECEIVE.id, WAIT_UPLOAD_FILE.id, "接收维修装备并发起入库(缺少单据)"),
......@@ -91,7 +91,7 @@ public enum LogType {
REPAIR_BACK_2(38,REPAIR_BACK.id, WAIT_BACK_RECEIVE.id, WAIT_UPLOAD_BACK_FILE.id, "维修退回装备接收并发起入库(缺失单据)"),
REPAIR_BACK_3(39,REPAIR_BACK.id, WAIT_UPLOAD_BACK_FILE.id, END.id, "上传领取单据"),
REPAIR_BACK_3(39,REPAIR_BACK.id, WAIT_UPLOAD_BACK_FILE.id, END.id, "上传相关单据,任务完成"),
REPAIR_BACK_4(40,REPAIR_BACK.id, WAIT_BACK_RECEIVE.id, END.id, "维修退回装备接收并发起入库"),
......@@ -153,7 +153,7 @@ public enum LogType {
ALLOT_BACK_1(57, ALLOT_BACK.id, ORIGIN_STATUS.id, ALLOT_BACKING.id, "发起装备退回"),
ALLOT_BACK_2(58,ALLOT_BACK.id, ALLOT_BACKING.id, END.id, "接收退回装备并上传退回签收单"),
ALLOT_BACK_2(58,ALLOT_BACK.id, ALLOT_BACKING.id, END.id, "接收退回装备并上传相关单据"),
ALLOT_BACK_3(59,ALLOT_BACK.id, WAIT_UPLOAD_ALLOT_BACK_FILE.id, END.id, "上传退回签收单"),
......@@ -238,7 +238,7 @@ public enum LogType {
SCRAP_3(100103,SCRAP.id, ORIGIN_STATUS.id, SCRAP_2223.id, "发起了报废任务的草稿"),
SCRAP_4(100104,SCRAP.id, SCRAP_2223.id, SCRAP_2222.id, "报废草稿任务,发布生成"),
SCRAP_5(100105,SCRAP.id, SCRAP_2222.id, END.id, "上传报废单据,任务结束"),
SCRAP_6(100106,SCRAP.id, ORIGIN_STATUS.id, SCRAP_2224.id, "发起报废任务等待待用签章审核"),
SCRAP_6(100106,SCRAP.id, ORIGIN_STATUS.id, SCRAP_2224.id, "发起报废任务,等待待用签章审核"),
SCRAP_7(100107,SCRAP.id, SCRAP_2224.id, SCRAP_2223.id, "调用电子签章审核,拒绝"),
SCRAP_8(100108,SCRAP.id, SCRAP_2224.id, SCRAP_2225.id, "调用电子签章审核,通过"),
SCRAP_9(100109,SCRAP.id, SCRAP_2225.id, END.id, "上传报废单据,任务结束"),
......@@ -284,7 +284,7 @@ public enum LogType {
REPAIR_SEND_12(97, REPAIR.id, WAIT_UPLOAD_SEND_FILE.id, ARCHIVE.id, "取消上传送修单"),
ALLOT_BACK_6(98, ALLOT_BACK.id, WAIT_UPLOAD_BACK_FILE_2.id, ARCHIVE.id, "取消上传退回单"),
ALLOT_12(99, ALLOT.id, ALLOTING.id, WAIT_UPLOAD_ALLOT_RECEIVE_FILE.id, "接收配发装备(缺失单据)"),
ALLOT_13(101, ALLOT.id, WAIT_UPLOAD_ALLOT_RECEIVE_FILE.id, END.id, "上传相关单据任务完结"),
ALLOT_13(101, ALLOT.id, WAIT_UPLOAD_ALLOT_RECEIVE_FILE.id, END.id, "上传相关单据,任务完结"),
ALLOT_14(102,ALLOT.id, WAIT_UPLOAD_ALLOT_RECEIVE_FILE.id, ARCHIVE.id, "取消上传配发单"),
ALLOT_BACK_7(103, ALLOT_BACK.id, WAIT_UPLOAD_ALLOT_BACK_FILE.id, ARCHIVE.id, "取消上传退回单"),
REPAIR_SEND_13(104, REPAIR.id, WAIT_UPLOAD_FILE.id, ARCHIVE.id, "取消上传送修单"),
......@@ -305,17 +305,17 @@ public enum LogType {
ALLOT_BACK_14(119,ALLOT_BACK.id, BACK_WAIT_SIGN.id, WAIT_UPLOAD_ALLOT_BACK_FILE.id, "盖电子签章并入库"),
ALLOT_20(120,ALLOT.id, WAIT_SIGN.id, END.id, "盖电子签章并入库"),
ALLOT_21(121,ALLOT.id, WAIT_SIGN.id, WAIT_UPLOAD_ALLOT_RECEIVE_FILE.id, "盖电子签章并入库"),
ALLOT_20(120,ALLOT.id, WAIT_SIGN.id, END.id, "上传相关单据,任务结束"),
ALLOT_21(121,ALLOT.id, WAIT_SIGN.id, WAIT_UPLOAD_ALLOT_RECEIVE_FILE.id, "盖电子签章"),//
ALLOT_22(122,ALLOT.id, SIGN_WAIT_CONFIRM.id, ALLOTING.id, "拒绝电子签章申请"),
ALLOT_BACK_15(123,ALLOT_BACK.id, BACK_SIGN_WAIT_CONFIRM.id, ALLOT_BACKING.id, "拒绝电子签章申请"),
REPAIR_SEND_14(124, REPAIR.id, ORIGIN_STATUS.id, REPAIR_SEND_SIGN_WAIT_CONFIRM.id, "申请电子签章"),
REPAIR_SEND_15(125,REPAIR.id, REPAIR_SEND_DRAFT.id, REPAIR_SEND_SIGN_WAIT_CONFIRM.id, "申请电子签章"),
REPAIR_SEND_16(126,REPAIR.id, REPAIR_SEND_SIGN_WAIT_CONFIRM.id, REPAIR_SEND_DRAFT.id, "拒绝电子签章申请"),
REPAIR_SEND_17(127,REPAIR.id, REPAIR_SEND_SIGN_WAIT_CONFIRM.id, REPAIR_SEND_WAIT_SIGN.id, "同意电子签章申请"),
REPAIR_SEND_18(128,REPAIR.id, REPAIR_SEND_WAIT_SIGN.id, WAIT_RECEIVE.id, "盖电子签章并出库"),
REPAIR_SEND_18(128,REPAIR.id, REPAIR_SEND_WAIT_SIGN.id, WAIT_RECEIVE.id, "盖电子签章并出库"),///???
// REPAIR_SEND_19(129,REPAIR.id, REPAIR_SEND_WAIT_SIGN.id, END.id, "盖电子签章并入库"),
REPAIR_SEND_19(129,REPAIR.id, REPAIR_SEND_WAIT_SIGN.id, END.id, "盖电子签章并出库"),
REPAIR_SEND_19(129,REPAIR.id, REPAIR_SEND_WAIT_SIGN.id, END.id, "上传相关单据,业务办结"),
REPAIR_SEND_20(130,REPAIR.id, REPAIR_SEND_WAIT_SIGN.id, WAIT_UPLOAD_FILE.id, "盖电子签章并入库"),
REPAIR_SEND_21(131,REPAIR.id, REPAIR_SEND_SIGN_WAIT_CONFIRM.id, WAIT_RECEIVE.id, "拒绝电子签章申请"),
......@@ -350,7 +350,15 @@ public enum LogType {
ALLOT_29(158,ALLOT.id,WAIT_UPLOAD_ALLOT_FILE.id,REVOKEALLOTTASK.id,"该业务已经被撤回"),
REPAIR_SEND_24(159,REPAIR.id, WAIT_RECEIVE.id, REPAIR_SEND_SIGN_WAIT_CONFIRM.id, "申请电子签章审核"),
REPAIR_SEND_25(160,REPAIR.id, ORIGIN_STATUS.id, REPAIR_SEND_DRAFT.id, "等待出库"),
REPAIR_BACK_30(161,REPAIR_BACK.id, REPAIR_BACK_SIGN_WAIT_CONFIRM.id, REPAIR_BACK_DRAFT.id, "拒绝签章"),;
REPAIR_BACK_30(161,REPAIR_BACK.id, REPAIR_BACK_SIGN_WAIT_CONFIRM.id, REPAIR_BACK_DRAFT.id, "拒绝签章"),
ALLOT_BACK_16(162,ALLOT_BACK.id, WAIT_UPLOAD_BACK_FILE_2.id, REVOKEALLOTTASK.id, "该业务已经(%sendUnit)被撤回"),
ALLOT_BACK_18(163,ALLOT_BACK.id, ALLOT_BACKING.id, REVOKEALLOTTASK.id, "该业务已经(%sendUnit)被撤回"),
// REPAIR_BACK_29(164,REPAIR_BACK.id, REPAIR_BACK_WAIT_SIGN.id, END.id, "上传相关单据,任务结束"),
REPAIR_BACK_31(165,REPAIR_BACK.id, REPAIR_BACK_WAIT_SIGN.id, END.id, "上传相关单据,任务结束"),
ALLOT_BACK_19(166,ALLOT_BACK.id, ORIGIN_STATUS.id, WAIT_UPLOAD_BACK_FILE_2.id, "待上传回执单"),
ALLOT_BACK_20(167,ALLOT_BACK.id, ALLOT_BACKING.id, BACK_SIGN_WAIT_CONFIRM.id, "申请签章待审核"),
REPAIR_BACK_32(168,REPAIR_BACK.id, REPAIR_BACK_SIGN_WAIT_CONFIRM.id, WAIT_BACK_RECEIVE.id, "等待接收维修退回装备"),
;
public Integer id;
......
......@@ -755,6 +755,8 @@ public class DeviceCheckController {
@ApiOperation(value = "发起检查", notes = "手动发起核查,需要指定参数")
@PostMapping("/startExam")
public ResponseEntity<ResultObj> startExam(@RequestBody CheckExamVo ceVo) {
//设置为
ceVo.setEndTime(ceVo.getEndTime().plusDays(1));
//初始化数据结构
List<Integer> detailIds = new ArrayList<>();
Integer startUnitId = ceVo.getUnitId();
......@@ -1126,7 +1128,7 @@ public class DeviceCheckController {
* @param id 自查的detail id
* @return
*/
@ApiOperation(value = "检查回退")
@ApiOperation(value = " ")
@PutMapping("/exam/rollback/{id}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity examRollback(@PathVariable Integer id) {
......
......@@ -22,7 +22,7 @@ public class CheckExamVo {
private String title;
@ApiModelProperty(name = "截止时间", example = "2021-01-12")
private LocalDate endTime;
private LocalDate endTime ;
@ApiModelProperty(name = "发起单位的id号")
private Integer unitId;
......
......@@ -391,16 +391,25 @@ public class JavaToPdfHtmlFreeMarker {
List<String> list =new ArrayList<>();
int stringLen=String_length(str);
int count=(stringLen%len >0) ? stringLen/len +1 : stringLen/len;
if (stringLen>len){
boolean falg=true;
int i=0;
while (falg){
if ((i+1)*len>stringLen) {
list.add(subString(str,i*len+1,stringLen,"GBK"));
falg=false;
// boolean falg=true;
// int i=0;
// while (falg){
// if ((i+1)*len>stringLen) {
// list.add(subString(str,i*len+1,stringLen,"GBK"));
// falg=false;
// }else {
// list.add(subString(str,i*len+1,(i+1)*len,"GBK")+"<br/>");
// i++;
// }
// }
for (int i=1;i<=count;i++){
if (i*len<stringLen){
list.add(subString(str,(i-1)*len,i*len,"GBK")+"<br/>");
}else {
list.add(subString(str,i*len+1,(i+1)*len,"GBK")+"<br/>");
i++;
list.add(subString(str,(i-1)*len,stringLen,"GBK")+"<br/>");
}
}
return list;
......@@ -418,8 +427,8 @@ public class JavaToPdfHtmlFreeMarker {
int currentLength = 0;
for( char c : text.toCharArray() )
{
currentLength += String.valueOf(c).getBytes(encode).length;
if( currentLength >= start && currentLength <= end )
currentLength += String_length(String.valueOf(c));
if( currentLength > start && currentLength <= end )
{
sb.append(c);
}else {
......@@ -771,7 +780,7 @@ public class JavaToPdfHtmlFreeMarker {
int i = 0;
for (int j = 0; j < checkList.size(); j++) {
Check check = checkList.get(j);
List<String> stringList = check.getStrings();
List<String> stringList = check.getStrings().stream().sorted(Comparator.comparing(String::toString)).collect(Collectors.toList());
int max = toMaxList(check.getStrings()) + 1;
if (i + max == 24) {
......@@ -1572,15 +1581,16 @@ public class JavaToPdfHtmlFreeMarker {
public static List<List<Revenue>> toRevenueList2(List<Revenue> deviceList) throws UnsupportedEncodingException {
List<List<Revenue>> lists=new ArrayList<>();
List<Revenue> revenues=new ArrayList<>();
deviceList=deviceList.stream().sorted(Comparator.comparing(Revenue::getModel)).collect(Collectors.toList());
Integer code=0;
int i=0;
for (int j=0;j< deviceList.size();j++){
Revenue revenue=deviceList.get(j);
int max= toRevenueMax(revenue);
if (i+max==18){
revenue.setModel(String.join("",toListString(revenue.getModel(),20)));
revenue.setModel(String.join("",toListString(revenue.getModel(),17)));
revenue.setDes(String.join("",toListString(revenue.getDes(),10)));
revenue.setPart(String.join("",toListString(revenue.getPart(),20)));
revenue.setPart(String.join("",toListString(revenue.getPart(),17)));
revenue.setOneCount(max);
code++;
revenue.setCode(code);
......@@ -1591,8 +1601,8 @@ public class JavaToPdfHtmlFreeMarker {
}else if (i+max>18){
//当前页面少了多少行
int differ=18-i;
List<String> modelList= toListString(revenue.getModel(),20);
List<String> pasList=toListString(revenue.getPart(),20);
List<String> modelList= toListString(revenue.getModel(),17);
List<String> pasList=toListString(revenue.getPart(),17);
List<String> desList=toListString(revenue.getDes(),10);
Revenue revenue1=new Revenue();
if (modelList.size()>differ){
......@@ -1602,7 +1612,6 @@ public class JavaToPdfHtmlFreeMarker {
if (pasList.size()>differ){
revenue.setPart(String.join("",pasList.subList(0,differ)));
revenue1.setPart(String.join("",pasList.subList(differ,pasList.size())));
}
if (desList.size()>differ){
revenue.setDes(String.join("",desList.subList(0,differ)));
......@@ -1621,9 +1630,9 @@ public class JavaToPdfHtmlFreeMarker {
i=max-differ;
}else {
code++;
revenue.setModel(String.join("",toListString(revenue.getModel(),20)));
revenue.setModel(String.join("",toListString(revenue.getModel(),17)));
revenue.setDes(String.join("",toListString(revenue.getDes(),10)));
revenue.setPart(String.join("",toListString(revenue.getPart(),20)));
revenue.setPart(String.join("",toListString(revenue.getPart(),17)));
revenue.setCode(code);
revenue.setOneCount(max);
revenues.add(revenue);
......@@ -1669,8 +1678,8 @@ public class JavaToPdfHtmlFreeMarker {
int partsCount=String_length(revenue.getPart());
int modelCount=String_length(revenue.getModel());
int desCount=String_length(revenue.getDes());
int parts = (partsCount%20>0) ? partsCount/20 + 1 : partsCount/20;
int model=(modelCount%20>0) ? modelCount/20 + 1 : modelCount/20;
int parts = (partsCount%17>0) ? partsCount/17 + 1 : partsCount/17;
int model=(modelCount%17>0) ? modelCount/17 + 1 : modelCount/17;
int des=(desCount%10>0) ? desCount/10 + 1 : desCount/10;
int max=parts;
......
......@@ -3,8 +3,10 @@ package com.tykj.dev.device.finalcheck.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.finalcheck.entity.domain.FinalDetail;
import com.tykj.dev.device.finalcheck.entity.dto.TimeParam;
import com.tykj.dev.device.finalcheck.entity.vo.FinalDetailVo;
import com.tykj.dev.device.finalcheck.entity.vo.FinalRemakeVo;
import com.tykj.dev.device.finalcheck.entity.vo.FinalReportSelectVo;
import com.tykj.dev.device.finalcheck.entity.vo.FinalReportVo;
import com.tykj.dev.device.finalcheck.service.FinalCheckService;
......@@ -142,4 +144,11 @@ public class FinalCheckController {
.body(outByteStream.toByteArray());
}
@PostMapping("/reports/addRemake")
@ApiOperation(value = "根据备注添加")
public ResponseEntity addRemake(@RequestBody FinalRemakeVo finalRemakeVo) {
FinalDetail finalDetail = fcService.addRemake(finalRemakeVo);
return ResponseEntity.ok(finalDetail);
}
}
......@@ -45,6 +45,16 @@ public class FinalDetail extends BaseEntity {
private Integer reportId;
//退役
// private Integer retire;
//丢失
private Integer loss;
//备注
private String remake;
private Integer destory;
public FinalDetailVo toVo() {
return MapperUtils.map(this, FinalDetailVo.class);
}
......
......@@ -56,5 +56,13 @@ public class FinalDetailVo {
@ApiModelProperty("报废")
private Integer scrapped = 0;
@ApiModelProperty("销毁")
private Integer destory = 0;
@ApiModelProperty("丢失")
private Integer loss = 0;
@ApiModelProperty("备注")
private String remake = "";
}
package com.tykj.dev.device.finalcheck.entity.vo;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* finalDetailVo.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2020/9/24 at 5:41 下午
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "决算报告备注")
public class FinalRemakeVo {
@ApiModelProperty("主键")
private Integer id;
@ApiModelProperty("备注")
private String remake;
}
package com.tykj.dev.device.finalcheck.service;
import com.tykj.dev.device.finalcheck.entity.domain.FinalDetail;
import com.tykj.dev.device.finalcheck.entity.vo.FinalRemakeVo;
import com.tykj.dev.device.finalcheck.entity.vo.FinalReportSelectVo;
import com.tykj.dev.device.finalcheck.entity.vo.FinalReportVo;
import org.springframework.data.domain.Page;
......@@ -37,4 +39,9 @@ public interface FinalCheckService {
*/
FinalReportVo findReportById(Integer id);
/**
* 根据id和remake进行插入
*/
FinalDetail addRemake(FinalRemakeVo finalRemakeVo);
}
......@@ -9,6 +9,7 @@ import com.tykj.dev.device.destroy.repository.DeviceDestroyBillDao;
import com.tykj.dev.device.finalcheck.entity.domain.FinalDetail;
import com.tykj.dev.device.finalcheck.entity.domain.FinalReport;
import com.tykj.dev.device.finalcheck.entity.vo.FinalDetailVo;
import com.tykj.dev.device.finalcheck.entity.vo.FinalRemakeVo;
import com.tykj.dev.device.finalcheck.entity.vo.FinalReportSelectVo;
import com.tykj.dev.device.finalcheck.entity.vo.FinalReportVo;
import com.tykj.dev.device.finalcheck.repisotry.FinalDetailDao;
......@@ -104,12 +105,14 @@ public class FinalCheckServiceImpl implements FinalCheckService {
FinalReport report = new FinalReport(name, unitName, startTime, endTime, LocalDateTime.now(), operatorName);
report = reportDao.save(report);
// 查询这段时间内该单位下的所有装备 并且计数
long l = System.currentTimeMillis();
// List<DeviceLibrary> devices = deviceDao.findAllByUnitBetweenTime(unitName, localDateToDate(startTime), localDateToDate(endTime));
List<DeviceLibrary> devices = deviceDao.findAll();
System.out.println(System.currentTimeMillis()-l);
//
PredicateBuilder<DeviceLibrary> builder = Specifications.and();
builder.eq("ownUnit",unitName);
List<DeviceLibrary> devices = deviceDao.findAll(builder.build());
// PredicateBuilder<DeviceLibrary> builder = Specifications.and();
// builder.eq("ownUnit",unitName);
// List<DeviceLibrary> devices = deviceDao.findAll(builder.build());
// 纵向-查 横向-0 委托-0 合计-合计 代管0 收到 发出 报废0
Map<String, List<DeviceLibrary>> map = devices.stream()
.collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()));
......@@ -155,15 +158,17 @@ public class FinalCheckServiceImpl implements FinalCheckService {
Map<String, DeviceStatistics> retireMap = dataService.getDecommissioningStatistics(localDateToDate(startTime), localDateToDate(endTime))
.stream()
.collect(toMap(deviceStatistics -> deviceStatistics.getModel()+"Ǵ"+deviceStatistics.getName(), Function.identity()));
//丢失
Map<String, DeviceStatistics> lossMap = dataService.getLossStatistics(localDateToDate(startTime), localDateToDate(endTime))
.stream()
.collect(toMap(deviceStatistics -> deviceStatistics.getModel() + "G" + deviceStatistics.getName(), Function.identity()));
for (Map.Entry<String, List<DeviceLibrary>> entry : map.entrySet()) {
String key = entry.getKey();
List<DeviceLibrary> v = entry.getValue();
//纵向
List<DeviceLibrary> vList = v.stream().filter(deviceLibrary -> deviceLibrary.getMatchingRange() == 1).collect(Collectors.toList());
List<DeviceLibrary> vList = v.stream().filter(deviceLibrary -> deviceLibrary.getMatchingRange() == 1 ).collect(Collectors.toList());
//横向
List<DeviceLibrary> hList = v.stream().filter(deviceLibrary -> deviceLibrary.getMatchingRange() == 2 || deviceLibrary.getMatchingRange() == 3).collect(Collectors.toList());
//其他
List<DeviceLibrary> otherList = v.stream().filter(deviceLibrary -> deviceLibrary.getMatchingRange() == 4).collect(Collectors.toList());
......@@ -175,10 +180,11 @@ public class FinalCheckServiceImpl implements FinalCheckService {
Integer retire = retireMap.get(key) == null ? 0 : retireMap.get(key).getNum();
Integer scrap = scrapMap.get(key) == null ? 0 : scrapMap.get(key).getNum();
Integer destroy = destroyMap.get(key) == null ? 0 : destroyMap.get(key).getNum();
Integer loss = lossMap.get(key) == null ? 0 : destroyMap.get(key).getNum();
// detailList.add(new FinalDetail(v.get(0).getModel(), v.get(0).getName(), v.size(), 0, 0, 0, v.size(),
// 0, received, sending, 0, report.getId()));
detailList.add(new FinalDetail(v.get(0).getModel(), v.get(0).getName(), vList.size(), hList.size(), 0, otherList.size(), v.size(),
0, storage+repairBack, sending, retire+scrap+destroy, report.getId()));
0, storage+repairBack, sending, scrap,report.getId(),loss ,"",destroy));
}
detailList = detailDao.saveAll(detailList);
......@@ -232,7 +238,22 @@ public class FinalCheckServiceImpl implements FinalCheckService {
List<FinalDetail> detailList = detailDao.findByReportId(report.getId())
.orElse(Collections.emptyList());
//按照名称排序
List<FinalDetail> finalDetails = detailList.stream().sorted(Comparator.comparing(FinalDetail::getModel)).collect(Collectors.toList());
return report.toVo(finalDetails);
}
return report.toVo(detailList);
@Override
public FinalDetail addRemake(FinalRemakeVo finalRemakeVo) {
//查询
FinalDetail finalDetail = null;
Optional<FinalDetail> byId = detailDao.findById(finalRemakeVo.getId());
if (byId.isPresent()){
finalDetail = byId.get();
finalDetail.setRemake(finalRemakeVo.getRemake());
}
//更新
FinalDetail save = detailDao.save(finalDetail);
return save;
}
}
......@@ -5,6 +5,7 @@ import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.device.library.subject.vo.DeviceStatisticsVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import java.util.List;
import java.util.Map;
......@@ -45,8 +46,12 @@ public interface DeviceLibraryService {
* @param deviceLibrarySelectVo 装备查询vo
* @param pageable 获取装备统计分页
*/
List<DeviceStatisticsVo> getDeviceStatisticsPage(DeviceLibrarySelectVo deviceLibrarySelectVo, Pageable pageable);
List<DeviceStatisticsVo> getDeviceStatisticsPage(DeviceLibrarySelectVo deviceLibrarySelectVo, Pageable pageable, Sort sort);
// /**
// * @param deviceLibrarySelectVo 装备查询vo
// * @param pageable 获取装备统计分页
// */
// List<DeviceStatisticsVo> getDeviceStatisticsPageAndSort(DeviceLibrarySelectVo deviceLibrarySelectVo, Pageable pageable);
/**
* 获取所有存在的装备名称
*/
......
......@@ -21,6 +21,7 @@ import com.tykj.dev.misc.utils.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
......@@ -185,7 +186,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
}
@Override
public List<DeviceStatisticsVo> getDeviceStatisticsPage(DeviceLibrarySelectVo deviceLibrarySelectVo, Pageable pageable) {
public List<DeviceStatisticsVo> getDeviceStatisticsPage(DeviceLibrarySelectVo deviceLibrarySelectVo, Pageable pageable, Sort sort) {
//获取存在的所有装备型号
// List<String> list = new ArrayList<>();
// if (deviceLibrarySelectVo.getModel() != null) {
......
package com.tykj.dev.misc.base;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 描述:Jpa排序类
......@@ -10,6 +12,8 @@ import lombok.Data;
* @data 2020/5/13
**/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CustomOrder {
private String coulmn;
......
......@@ -152,7 +152,7 @@ public enum StatusEnum {
/**
* 配发任务撤回
*/
REVOKEALLOTTASK(20000, "配发任务撤回"),
REVOKEALLOTTASK(20000, "任务撤回"),
/**
* 列装待审核
......
package com.tykj.dev.misc.utils;
import org.springframework.stereotype.Component;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author zjm
......@@ -12,14 +15,16 @@ import java.util.Set;
* @Description TODO
* @createTime 2021年07月14日 13:45:00
*/
@Component
public class DeviceModelSort {
public static Map<String,Integer> mapModelSort;
public static Set<String> modelToSort(Set<String> modelList){
modelList.stream().sorted(Comparator.comparing(DeviceModelSort::toSort));
return modelList;
public static List<String> modelToSort(List<String> modelList){
List<String> collect = modelList.stream().sorted(Comparator.comparing(DeviceModelSort::toSort)).collect(Collectors.toList());
return collect;
}
/**
* 获取型号对应的排序号
* @param model 型号
......
......@@ -5,10 +5,7 @@ import org.springframework.http.ResponseEntity;
import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
......@@ -294,9 +291,13 @@ public class DeviceSeqUtil {
if(strings.length==2){
//左区间字符串
String s1 = strings[0];
if (s1.equals("0")){
s1 = s1+"0";
}
//右区间字符串
String s2 = strings[1];
if (s1.length()!=s2.length()){
// stringList.add(String.join("-", Arrays.asList(strings)));
return stringList;
}
else {
......
......@@ -38,6 +38,7 @@ import java.util.*;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.toMap;
@RestController
@Api(tags = "列装管理模块", description = "列装管理接口")
......@@ -155,6 +156,8 @@ public class PackingController {
messageBto.setRecord(packingLibrary1.getId().toString());
messageService.add(messageBto);
packingLibraryService.setOrder(packingLibraryService.getInsertList(new SelectPack()));
//更新型号和排序号的对应map
packingLibraryService.getSortMap();
return ResponseEntity.ok(packingLibraryService.getOne(packingLibrary1.getId()));
}
......@@ -283,11 +286,13 @@ public class PackingController {
Map<String,Object> map = new HashMap<>();
map.put("pages",packingLibraries);
List<String> models = new ArrayList<>();
for (PackingLibrary p : resultList){
if (p.getIsRoot()==1){
models.add(p.getModel());
}
}
// for (PackingLibrary p : resultList){
// if (p.getIsRoot()==1){
// models.add(p.getModel());
// }
// }
models.addAll(resultList.stream().filter(packingLibrary -> packingLibrary.getIsRoot() == 1).map(PackingLibrary::getModel).collect(Collectors.toList()));
//去重
models = models.stream().distinct().collect(Collectors.toList());
map.put("models",models);
......@@ -462,6 +467,7 @@ public class PackingController {
if (packingLibraryDao.findByShowOrderAndModelNot(i,model)!=null){
PackingLibrary packingLibrary1 = packingLibraryDao.findByShowOrderAndModelNot(i,model);
packingLibrary1.setShowOrder(i+1);
// packingLibrary1.setShowOrder(packingModelEdit.getShowOrder());
packingLibraries.add(packingLibrary1);
model=packingLibrary1.getModel();
}
......@@ -504,6 +510,8 @@ public class PackingController {
else {
throw new ApiException("传入的列装id不是型号");
}
//更新缓存
packingLibraryService.getSortMap();
return ResponseEntity.ok(ResponseEntity.ok(packingModelEdit));
}
......@@ -666,4 +674,5 @@ public class PackingController {
PackingLibrary::addChildNode
));
}
}
......@@ -204,5 +204,8 @@ public interface PackingLibraryService{
*/
Boolean addAllotPacking(PackingLibrary packingLibraryEntity);
/**
* 查询所有的列装model的排序
*/
void getSortMap();
}
......@@ -202,6 +202,7 @@ public class PackingLibrary {
*/
@Transient
private Integer corresponding;
@ApiModelProperty(value = "经办人省A岗")
@Transient
private String userA;
......
......@@ -19,6 +19,7 @@ public class PackingSortService implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
//取到所有的列装model的顺序 放进缓存中 也就是DeviceModelSort.mapModelSort
packingLibraryService.getSortMap();
log.info("初始化更新型号和排序号的对应map");
}
......
package com.tykj.dev.device.retired.controller;
import com.tykj.dev.config.service.SystemConfigService;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService;
......@@ -87,6 +88,9 @@ public class DeviceRetiredController {
@Autowired
private MessageService messageService;
@Autowired
private SystemConfigService systemConfigService;
public DeviceRetiredController(DeviceRetiredBillService deviceRetiredBillService, TaskService taskService, PackingLibraryService packingLibraryService, DeviceLibraryService deviceLibraryService, DeviceLogService deviceLogService, TaskLogService taskLogService) {
this.deviceRetiredBillService = deviceRetiredBillService;
this.taskService = taskService;
......@@ -108,6 +112,8 @@ public class DeviceRetiredController {
//循环获取列装主体的数量,并生成VO
for(PackingLibrary packingLibrary : list) {
DeviceRetiredResultVo deviceRetiredResultVo = calcDeviceRetiredResultVo(packingLibrary);
//新增名称
// systemConfigService.findByEnglishNameAndValue(packingLibrary.get,packingLibrary.getMatchingRange())
deviceRetiredResultVos.add(deviceRetiredResultVo);
}
List<DeviceRetiredResultVo> deviceRetiredResultVos2 = canRetired(deviceRetiredResultVos);
......
......@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;
......@@ -46,6 +47,9 @@ public class DeviceRetiredResultVo {
private Integer isPart;
@ApiModelProperty(value = "配用范围")
private String matchingRangeName;
@ApiModelProperty(value = "数量", example = "1")
private List<DeviceRetiredResultVo> childs = new ArrayList<>();
......
......@@ -106,6 +106,7 @@ public class SelfCheckSchedulerTask {
calendar.setTime(new Date());
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH)+1;
title.append("系统发起定时"+units.getName());
title.append(year).append("年");
title.append(month).append("月自查任务");
int type;
......@@ -148,7 +149,8 @@ public class SelfCheckSchedulerTask {
//发起待自查任务
List<Integer> userIds = new ArrayList<>();
userIds.add(0);
TaskBto taskBto = new TaskBto(StatusEnum.WAIT_SELF_CHECK.id,"自查业务",null,".",selfCheckBill1.getId(),4,units.getUnitId(),0,null,userIds);
// selfCheckBill.setTitle("系统发起"+units.getName()+"自查任务");
TaskBto taskBto = new TaskBto(StatusEnum.WAIT_SELF_CHECK.id,title.toString(),null,".",selfCheckBill1.getId(),4,units.getUnitId(),0,null,userIds);
taskService.start(taskBto);
});
}
......
......@@ -283,7 +283,6 @@ public class SelfCheckController {
return ResponseEntity.ok(taskBto1.getId());
}
@ApiOperation(value = "发起自查业务", notes = "可以通过这个接口发起自查业务")
@PostMapping(value = "/addBill")
@Transactional(rollbackFor = Exception.class)
......@@ -563,4 +562,23 @@ public class SelfCheckController {
list.add(taskBto.toVo());
return ResultUtil.success(list);
}
@ApiOperation(value = "是否保存自查任务", notes = "可以通过这个接口查询是否保存自查任务")
@PostMapping(value = "/isSaveSelfTask")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity isSaveSelfTask(@RequestBody SaveSelfTaskVo saveSelfTaskVo){
//保存自查任务
if (saveSelfTaskVo.getIsSave() == 0){
return this.selectDetail( taskService.get(saveSelfTaskVo.getTaskId()).getBillId());
}else {
//删除task
TaskBto taskBto = taskService.get(saveSelfTaskVo.getTaskId());
//将任务进封存
taskService.moveToArchive(taskBto);
//将DeviceUseReport删除
selfExaminationBillService.delete(taskBto.getBillId());
return ResponseEntity.ok("不保存");
}
}
}
......@@ -24,7 +24,7 @@ import java.util.List;
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update self_examination_bill set delete_tag = 1 where id = ?")
@SQLDelete(sql = "update self_check_bill set delete_tag = 1 where id = ?")
@Where(clause = "delete_tag = 0")
@ApiModel("自查账单")
public class SelfCheckBill {
......
package com.tykj.dev.device.selfcheck.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* DATE:2021-7-14
* Author:zsp
*/
@Data
@ApiModel("是否保存自查任务")
public class SaveSelfTaskVo {
@ApiModelProperty(value = "是否保存",notes = "0 是保存,1是不保存")
private Integer isSave;
@ApiModelProperty("任务id")
private Integer taskId;
}
......@@ -13,6 +13,7 @@ import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.DeviceModelSort;
import com.tykj.dev.misc.utils.PageUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.statistical.cache.StatisticalCache;
......@@ -27,10 +28,7 @@ import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.groupingBy;
......@@ -226,9 +224,14 @@ public class StatisticalController {
Map<String,Object> map = new HashMap<>();
// Map<Integer,String> lifeStatusMap = configCache.getLifeStatusMap();
// Set<Integer> status = deviceLibraryEntities.stream().map(DeviceLibrary::getLifeStatus).collect(Collectors.toSet());
List<String> collect = deviceLibraryEntities.stream().map(DeviceLibrary::getModel).distinct().collect(Collectors.toList());
List<String> modelToSort = DeviceModelSort.modelToSort(collect);
map.put("pages",deviceLibraries);
map.put("models",deviceLibraryEntities.stream().map(DeviceLibrary::getModel).collect(Collectors.toSet()));
map.put("names",deviceLibraryEntities.stream().map(DeviceLibrary::getName).collect(Collectors.toSet()));
map.put("models",modelToSort);
//排序加上去重
List<String> names = deviceLibraryEntities.stream().map(DeviceLibrary::getName).distinct()
.sorted(Comparator.comparing(String::toString)).collect(Collectors.toList());
map.put("names",names);
// map.put("ownUnits",deviceLibraryEntities.stream().map(DeviceLibrary::getOwnUnit).collect(Collectors.toSet()));
// map.put("locationUnits",deviceLibraryEntities.stream().map(DeviceLibrary::getLocationUnit).collect(Collectors.toSet()));
// map.put("lifeStatus",status.stream().map(integer -> new LifeStatusVo(integer,lifeStatusMap.get(integer))).collect(Collectors.toList()));
......
......@@ -175,19 +175,26 @@ public class StorageBillController {
@ApiOperation(value = "选择入库型号数量", notes = "可以通过这个接口选择入库型号数量")
@PostMapping(value = "/addStorageDetail")
public ResponseEntity addStorageDetail(@RequestBody List<StorageBillDetailVo> list) {
//存放所有的列装
List<PackingLibrary> libraryEntities = new ArrayList<>();
Map<Integer, List<PackingLibrary>> map = new HashMap<>();
//所有的序列号
List<String> seqs = new ArrayList<>();
for (StorageBillDetailVo s : list) {
if (s.getStorageCount()>0) {
//序列号区间
List<String> strings = DeviceSeqUtil.createDeviceSeqs(s.getSeqInterval(), s.getStorageCount());
//生产号区间
List<String> strings3 = DeviceSeqUtil.createDeviceSeqs(s.getProdInterval(), s.getStorageCount());
List<List<String>> sons = new ArrayList<>();
List<List<String>> sons2 = new ArrayList<>();
List<List<String>> sons3 = new ArrayList<>();
List<List<String>> sons4 = new ArrayList<>();
int count = 1;
//入库的数量
Integer deviceNum = s.getStorageCount();
while (deviceNum >= count) {
PackingLibrary packingLibraryEntity = new PackingLibrary();
BeanUtils.copyProperties(packingLibraryService.getOne(s.getPackingId()), packingLibraryEntity);
......@@ -386,7 +393,7 @@ public class StorageBillController {
if (storageBillSaveVo.getTaskId()==null) {
storageBillEntity = storageBillService.addEntity(storageBillSaveVo.toDo());
//2.发起入库任务
TaskBto taskBto = new TaskBto(StatusEnum.END.id, "入库了"+storageBillSaveVo.getStorageBillDetails().stream().map(storageBillDetail -> storageBillDetail.getModel()).collect(Collectors.toList())+"型号"+"入库业务", null, ".", storageBillEntity.getId(), 2, userUtils.getCurrentUnitId(), 0, null, userIds);
TaskBto taskBto = new TaskBto(StatusEnum.END.id, "入库型号为"+storageBillSaveVo.getStorageBillDetails().stream().map(StorageBillDetail::getModel).collect(Collectors.toList())+"入库业务", null, ".", storageBillEntity.getId(), 2, userUtils.getCurrentUnitId(), 0, null, userIds);
taskEntity1 = taskService.start(taskBto);
}
else {
......
......@@ -407,7 +407,8 @@ public class TaskServiceImpl implements TaskService {
List<Task> tasks = taskDao.findAllByBillIdAndBusinessType(billId, businessType);
tasks = tasks.stream().filter(task -> task.getParentTaskId() == null).collect(Collectors.toList());
if (tasks.size()==0){
throw new ApiException(String.format("要查询的数据不存在,查询的billId为 %d,businessType为 %d", billId, businessType));
return new TaskBto();
// throw new ApiException(String.format("要查询的数据不存在,查询的billId为 %d,businessType为 %d", billId, businessType));
}else {
return tasks.get(0).parse2Bto();
}
......@@ -518,6 +519,7 @@ public class TaskServiceImpl implements TaskService {
businesses.add(BusinessEnum.REPAIR_BACK.id);
businesses.add(BusinessEnum.REPAIR.id);
businesses.add(BusinessEnum.ALLOT_BACK.id);
businesses.addAll(Arrays.asList(BusinessEnum.TRAIN_SIGN_UP.id,BusinessEnum.TRAIN_STUDY.id));
//业务管理中的待办和跟踪
if (num == 2 || num == 3) {
//查询出符合筛选条件的所有task
......@@ -614,7 +616,10 @@ public class TaskServiceImpl implements TaskService {
.collect(Collectors.toList());
}
taskUserVos = taskUserVos.stream()
.filter(taskUserVo -> !businesses.contains(taskUserVo.getBusinessType()) || (taskUserVo.getParentTaskId() == null || taskUserVo.getParentTaskId() == 0)).collect(Collectors.toList());
.filter(taskUserVo -> !businesses.contains(taskUserVo.getBusinessType()) || (taskUserVo.getParentTaskId() == null || taskUserVo.getParentTaskId() == 0))
.filter(taskUserVo -> !taskUserVo.getBillStatus().equals(StatusEnum.REVOKEALLOTTASK.id))
.collect(Collectors.toList());
//如果存在集合中
// if (businesses.contains(taskUserVo.getBusinessType())){
// if (taskUserVo.getParentTaskId() != null && taskUserVo.getParentTaskId() !=0 ){
......@@ -1137,8 +1142,12 @@ public class TaskServiceImpl implements TaskService {
List<Integer> bussinessType = taskSelectVo.getBusinessType();
Integer unitId = userUtils.getCurrentUnitId();
//筛选出未完结和未封存业务,映射成bto
// List<TaskBto> taskBtos = taskDao.findAll().stream()
// .filter(task -> (!task.getBillStatus().equals(StatusEnum.END.id)) && (!task.getBillStatus().equals(StatusEnum.ARCHIVE.id)))
// .map(Task::parse2Bto)
// .collect(Collectors.toList());
List<TaskBto> taskBtos = taskDao.findAll().stream()
.filter(task -> (!task.getBillStatus().equals(StatusEnum.END.id)) && (!task.getBillStatus().equals(StatusEnum.ARCHIVE.id)))
.filter(task -> (!task.getBillStatus().equals(StatusEnum.END.id)) && (!task.getBillStatus().equals(StatusEnum.ARCHIVE.id)) && (!task.getBillStatus().equals(StatusEnum.REVOKEALLOTTASK.id)))
.map(Task::parse2Bto)
.collect(Collectors.toList());
//查询待办
......@@ -1181,7 +1190,8 @@ public class TaskServiceImpl implements TaskService {
//查询跟踪
if (taskSelectVo.getSelectNum() == 3) {
//所有涉及人员所在单位包含当前用户所在单位且指针对应UserId不是当前用户
List<Integer> status = Arrays.asList(201,333,810,322,722,788,1250,2223,8110,888,140,130,141,111,1002,150);
// List<Integer> status = Arrays.asList(201,333,810,322,722,788,1250,2223,8110,888,140,130,141,111,1002,150);
List<Integer> status = Arrays.asList(201,333,810,322,722,788,1250,2223,8110,888,140,130,141,111,1002,150,101);
List<TaskBto> taskBtoList = taskBtos.stream()
.filter(taskBto -> {
// boolean unitExists = getUnitsByUsers(taskBto.getInvolveUserIdList()).contains(unitId);
......
......@@ -285,7 +285,7 @@
margin-left: 50px;
}
table.altrowstable2 {
table.altrowstable2 {
width: 100%;
font-size: 16px;
color: #000;
......@@ -303,7 +303,7 @@
font-size: 15px;
background-color: #fff;
border:1px solid #bebebe;
padding-top: 0;
padding-top: 0;
}
table.altrowstable2 td {
......@@ -368,10 +368,10 @@
line-height:24px;
font-size: 15px;
background-color: #ebebeb;
marign-top:none;
border:1px solid #bebebe;
padding-top: 0;
padding-bottom: 0;
marign-top:none;
border:1px solid #bebebe;
padding-top: 0;
padding-bottom: 0;
}
table.altrowstable td {
......
......@@ -150,7 +150,7 @@
}
.returnTablePrint .tableList {
height:508px;
height:500px;
border-bottom: none;
overflow: hidden;
}
......
......@@ -81,14 +81,14 @@ public class DeviceUseReportController {
deviceUseReportDetailVo.setDestoryNum(list.get(4));
deviceUseReportDetailVo.setSendAllotNum(list.get(5));
deviceUseReportDetailVo.setReceiveAllotNum(list.get(6));
deviceUseReportDetailVo.setSensAllotBackNum(list.get(7));
deviceUseReportDetailVo.setSendAllotBackNum(list.get(7));
deviceUseReportDetailVo.setReceiveAllotBackNum(list.get(8));
deviceUseReportDetailVo.setSendBackNum(list.get(9));
deviceUseReportDetailVo.setScrapStatisticsNum(list.get(10));
deviceUseReportDetailVo.setPackingNum(list.get(11));
deviceUseReportDetailVo.setRetiredNum(list.get(12));
deviceUseReportDetailVo.setDecommissioningStatisticsNum(list.get(13));
deviceUseReportDetailVo.setToRepairBackNum(14);
deviceUseReportDetailVo.setToRepairBackNum(list.get(14));
deviceUseReportDetailVo.setToRepairNum(list.get(15));
}
return ResultUtil.success(deviceUseReportDetailVo);
......
......@@ -117,6 +117,20 @@ public interface DeviceUseReportService {
*/
int getScrapStatisticsCount(Date startDate, Date endDate);
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return 丢失数量
*/
int getLossStatisticsCount(Date startDate, Date endDate);
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return 这一段时间省退役的统计
*/
List<DeviceStatistics> getLossStatistics(Date startDate, Date endDate);
/**
* @param startDate 开始时间
* @param endDate 结束时间
......@@ -126,4 +140,5 @@ public interface DeviceUseReportService {
void delete(Integer id);
}
......@@ -34,7 +34,7 @@ public class DeviceUseReportDetailVo {
@ApiModelProperty(value = "接收配发数量", example = "10")
private Integer receiveAllotNum;
@ApiModelProperty(value = "发起退回数量", example = "10")
private Integer sensAllotBackNum;
private Integer sendAllotBackNum;
@ApiModelProperty(value = "接收退回", example = "10")
private Integer receiveAllotBackNum;
@ApiModelProperty(value = "清退数量", example = "10")
......
package com.tykj.dev.device.zxing;
\ No newline at end of file
......@@ -15,6 +15,13 @@ import java.util.Base64;
* Author:zsp
*/
public class Base64Util {
/**
* 转换成base64
* @param imgFile
* @return
*/
public static String getImageStr(String imgFile) {
InputStream inputStream = null;
byte[] data = null;
......@@ -31,6 +38,11 @@ public class Base64Util {
return encoder.encodeToString(data);
}
/**
* 转换成字节数组
* @param path
* @return
*/
public static byte[] getFileBytes(String path) {
ArrayList bytesList = new ArrayList();
byte[] bytes = new byte[1];
......@@ -58,6 +70,11 @@ public class Base64Util {
return bytes;
}
/**
* 将字节转换成图片
* @param data
* @param path
*/
public static void byte2image(byte[] data, String path) {
if (data.length < 3 || path.equals("")) {
return;
......
package com.tykj.dev.device.zxing.util;
import javax.imageio.ImageIO;
import javax.imageio.ImageReadParam;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Date;
import java.util.Iterator;
/**
* DATE:2021-7-20
* Author:zsp
*/
public class ImageCut {
/**
* 源图片路径名称如:c:\1.jpg
*/
// private String srcpath = "e:/poool.jpg";
private String srcpath = "C:\\Users\\lenovo\\Desktop\\1.png";
/**
* 剪切图片存放路径名称.如:c:\2.jpg
*/
// private String subpath = "e:/pool_end";
private String subpath = "C:\\Users\\lenovo\\Desktop\\20.png";
/**
* jpg图片格式
*/
private static final String IMAGE_FORM_OF_JPG = "jpg";
/**
* png图片格式
*/
private static final String IMAGE_FORM_OF_PNG = "png";
/**
* 剪切点x坐标
*/
private int x;
/**
* 剪切点y坐标
*/
private int y;
/**
* 剪切点宽度
*/
private int width;
/**
* 剪切点高度
*/
private int height;
public ImageCut() {
}
public ImageCut(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
// public static void main(String[] args) throws Exception {
// ImageCut imageCut = new ImageCut(300, 130, 550, 550);
// imageCut.cut(imageCut.getSrcpath(), imageCut.getSubpath());
// System.out.println("可截取");
// }
/**
* 返回包含所有当前已注册 ImageReader 的 Iterator,这些 ImageReader 声称能够解码指定格式。
* 参数:formatName - 包含非正式格式名称 .(例如 "jpeg" 或 "tiff")等 。
*
* @param postFix
* 文件的后缀名
* @return
*/
public Iterator<ImageReader> getImageReadersByFormatName(String postFix) {
switch (postFix) {
case IMAGE_FORM_OF_JPG:
return ImageIO.getImageReadersByFormatName(IMAGE_FORM_OF_JPG);
case IMAGE_FORM_OF_PNG:
return ImageIO.getImageReadersByFormatName(IMAGE_FORM_OF_PNG);
default:
return ImageIO.getImageReadersByFormatName(IMAGE_FORM_OF_JPG);
}
}
/**
* 对图片裁剪,并把裁剪完蛋新图片保存 。
* @param srcpath 源图片路径
* @param subpath 剪切图片存放路径
* @throws IOException
*/
public void cut(String srcpath, String subpath) throws IOException {
FileInputStream is = null;
ImageInputStream iis = null;
try {
// 读取图片文件
is = new FileInputStream(srcpath);
// 获取文件的后缀名
String postFix = getPostfix(srcpath);
System.out.println("图片格式为:" + postFix);
/*
* 返回包含所有当前已注册 ImageReader 的 Iterator,这些 ImageReader 声称能够解码指定格式。
* 参数:formatName - 包含非正式格式名称 .(例如 "jpeg" 或 "tiff")等 。
*/
Iterator<ImageReader> it = getImageReadersByFormatName(postFix);
ImageReader reader = it.next();
// 获取图片流
iis = ImageIO.createImageInputStream(is);
/*
* <p>iis:读取源.true:只向前搜索 </p>.将它标记为 ‘只向前搜索'。
* 此设置意味着包含在输入源中的图像将只按顺序读取,可能允许 reader 避免缓存包含与以前已经读取的图像关联的数据的那些输入部分。
*/
reader.setInput(iis, true);
/*
* <p>描述如何对流进行解码的类<p>.用于指定如何在输入时从 Java Image I/O
* 框架的上下文中的流转换一幅图像或一组图像。用于特定图像格式的插件 将从其 ImageReader 实现的
* getDefaultReadParam 方法中返回 ImageReadParam 的实例。
*/
ImageReadParam param = reader.getDefaultReadParam();
/*
* 图片裁剪区域。Rectangle 指定了坐标空间中的一个区域,通过 Rectangle 对象
* 的左上顶点的坐标(x,y)、宽度和高度可以定义这个区域。
*/
Rectangle rect = new Rectangle(x, y, width, height);
// 提供一个 BufferedImage,将其用作解码像素数据的目标。
param.setSourceRegion(rect);
/*
* 使用所提供的 ImageReadParam 读取通过索引 imageIndex 指定的对象,并将 它作为一个完整的
* BufferedImage 返回。
*/
BufferedImage bi = reader.read(0, param);
// 保存新图片
ImageIO.write(bi, postFix, new File(subpath + "_" + new Date().getTime() + "." + postFix));
} finally {
if (is != null)
is.close();
if (iis != null)
iis.close();
}
}
/**
* 获取inputFilePath的后缀名,如:"e:/test.pptx"的后缀名为:"pptx"<br>
*
* @param inputFilePath
* @return
*/
public String getPostfix(String inputFilePath) {
return inputFilePath.substring(inputFilePath.lastIndexOf(".") + 1);
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public String getSrcpath() {
return srcpath;
}
public void setSrcpath(String srcpath) {
this.srcpath = srcpath;
}
public String getSubpath() {
return subpath;
}
public void setSubpath(String subpath) {
this.subpath = subpath;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
}
......@@ -6,7 +6,9 @@ import com.google.zxing.common.HybridBinarizer;
import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.zxing.vo.ZxingTaskVo;
import com.tykj.dev.misc.utils.SpringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import sun.misc.BASE64Decoder;
import javax.imageio.ImageIO;
......@@ -19,18 +21,19 @@ import java.util.HashMap;
import java.util.Map;
/**
* DATE:2021-7-20
* Author:zsp
* 解析二维码
**/
*/
@Component
public class QRCodeUtils {
@Autowired
private TaskDao taskDao;
/**
* 解析二维码解析,此方法是解析Base64格式二维码图片
* baseStr:base64字符串,data:image/png;base64开头的
*/
public ZxingTaskVo deEncodeByBase64(String baseStr) {
String content = null;
// String content = null;
BufferedImage image;
BASE64Decoder decoder = new BASE64Decoder();
byte[] b=null;
......@@ -47,6 +50,9 @@ public class QRCodeUtils {
Map<DecodeHintType, Object> hints = new HashMap<DecodeHintType, Object>();
hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
Result result = new MultiFormatReader().decode(binaryBitmap, hints);//解码
System.out.println("result:"+result.getText());
//获取taskDao
TaskDao taskDao = SpringUtils.getBean("taskDao");
//返回taskId
ZxingTaskVo zxingTaskVo = null;
if (result.getText() != null){
......
......@@ -5,12 +5,14 @@ import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.pdf417.PDF417Writer;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.zxing.vo.ZxingTaskVo;
import com.tykj.dev.misc.utils.SpringUtils;
import javassist.NotFoundException;
import org.apache.tomcat.util.http.fileupload.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -26,6 +28,7 @@ import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URLEncoder;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.HashMap;
......@@ -47,12 +50,15 @@ public class ZXingUtil {
/** 二维码高度 */
private static Integer height = 50;
@Autowired
private TaskDao taskDao;
private static final int BLACK = 0xff000000;
private static final int WHITE = 0xFFFFFFFF;
// @Autowired
// private TaskDao taskDao;
/**
* 解析二维码
*
* @param filePath 文件
* @param filePath 文件路径
* @return 二维码内容
* @throws IOException
* @throws NotFoundException
......@@ -69,6 +75,7 @@ public class ZXingUtil {
// return result.getText();
// }
public ZxingTaskVo decode(String filePath) throws IOException, com.google.zxing.NotFoundException {
// String s = PDFUtils.pdfToImagePath(filePath);
BufferedImage bufferedImage = ImageIO.read(new FileInputStream(filePath));
LuminanceSource source = new BufferedImageLuminanceSource(bufferedImage);
Binarizer binarizer = new HybridBinarizer(source);
......@@ -76,14 +83,19 @@ public class ZXingUtil {
HashMap<DecodeHintType, Object> decodeHints = new HashMap<DecodeHintType, Object>();
decodeHints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
Result result = new MultiFormatReader().decode(bitmap, decodeHints);
//获取taskDao
TaskDao taskDao = SpringUtils.getBean("taskDao");
ZxingTaskVo zxingTaskVo = null;
if (result.getText() != null){
Task task = taskDao.findByParentTaskId(Integer.valueOf(result.getText()));
Task task = taskDao.findByParentTaskId(Integer.parseInt(result.getText()));
zxingTaskVo = new ZxingTaskVo(task.getParentTaskId(), task.getId());
return zxingTaskVo;
}else {
return null;
}
return zxingTaskVo;
}
/**
* 生成二维码
*
......@@ -95,10 +107,10 @@ public class ZXingUtil {
public static String encode(Integer taskId) throws WriterException, IOException {
Map<EncodeHintType, Object> encodeHints = new HashMap<EncodeHintType, Object>();
encodeHints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
encodeHints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);
// encodeHints.put(EncodeHintType.MARGIN, 0);
encodeHints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
encodeHints.put(EncodeHintType.MARGIN, 0);
BitMatrix bitMatrix = new MultiFormatWriter().encode(String.valueOf(taskId),
// encodeHints.put(EncodeHintType.PDF417_COMPACT,)
BitMatrix bitMatrix = new MultiFormatWriter().encode(taskId+"",
BarcodeFormat.QR_CODE, width, height, encodeHints);
String filepath = ResourceUtils.getURL("classpath:").getPath() + UUID.randomUUID() + ".png";
Path path = FileSystems.getDefault().getPath(filepath);
......@@ -134,4 +146,7 @@ public class ZXingUtil {
return encoder.encode(data);// 返回Base64编码过的字节数组字符串
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论