提交 b81cd0dd authored 作者: 133's avatar 133

[清退 反馈] 修改代码

上级 7ab068f7
{
"code": 403,
"msg": "用户未登陆"
}
GET http://127.0.0.1:8087/printDocuments1
<> 2021-04-27T124856.403.json
###
GET http://127.0.0.1:8087/printDocuments1
<> 2021-03-17T074418.403.json
###
GET http://127.0.0.1:8087/blockcha/sendHash/{code}/{content}
###
GET http://127.0.0.1:8087/blockcha/sendHash/{code}/{content}
###
GET http://127.0.0.1:8087/blockcha/sendHash/{code}/{content}
###
POST http://127.0.0.1:8087/units/save
###
POST http://127.0.0.1:8087/units/save
###
POST http://127.0.0.1:8087/units/save
<> 2020-11-05T102636.403.json
###
...@@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.UUID; import java.util.UUID;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -68,12 +69,13 @@ public class FileController { ...@@ -68,12 +69,13 @@ public class FileController {
@ApiOperation(value = "生成单据 多个单据生成") @ApiOperation(value = "生成单据 多个单据生成")
@PostMapping("/printDocuments/more") @PostMapping("/printDocuments/more")
public ResponseEntity printDocuments(@RequestBody List<Documents> documents){ public ResponseEntity printDocuments(@RequestBody List<Documents> documents){
String[] content=new String[10000]; List<String> list=new ArrayList<>();
documents.forEach( documents.forEach(
documents1 -> ArrayUtil.concat(content,JavaToPdfHtmlFreeMarker.freeMarkerRender(documents1,url+"htmlModel/")) documents1 -> list.addAll(Objects.requireNonNull(JavaToPdfHtmlFreeMarker.freeMarkerRenderList(documents1, url + "htmlModel/")))
); );
log.info("[file] 调用了生成出入单据对接口 documents"); log.info("[file] 调用了生成出入单据对接口 documents");
return ResponseEntity.ok(JavaToPdfHtmlFreeMarker.createPdf(content,url,preview,"documents/")); return ResponseEntity.ok(JavaToPdfHtmlFreeMarker.createPdf(list.toArray(new String[0]),url,preview,"documents/"));
} }
/** /**
...@@ -120,31 +122,36 @@ public class FileController { ...@@ -120,31 +122,36 @@ public class FileController {
public ResponseEntity printDocuments(HttpServletResponse response,HttpServletRequest request) throws IOException, DocumentException { public ResponseEntity printDocuments(HttpServletResponse response,HttpServletRequest request) throws IOException, DocumentException {
int interval = request.getSession().getMaxInactiveInterval(); int interval = request.getSession().getMaxInactiveInterval();
System.out.println("-------"+interval); System.out.println("-------"+interval);
// Documents documents=new Documents(); List<Documents> documentsList=new ArrayList<>();
// documents.setNumber("NO:第221321134号"); Documents documents=new Documents();
// documents.setReceiveUnit("杭州机要"); documents.setNumber("NO:第221321134号");
// documents.setReplyNum("123123123131"); documents.setReceiveUnit("杭州机要");
// documents.setSenderUnit("浙江省"); documents.setReplyNum("123123123131");
// documents.setTitle("密码装备清退单"); documents.setSenderUnit("浙江省");
// List<DocumentDevice> documentDevices=new ArrayList<>(); documents.setTitle("密码装备清退单");
// for (int i=0;i<20;i++){ List<DocumentDevice> documentDevices=new ArrayList<>();
// DocumentDevice documentDevice=new DocumentDevice(); for (int i=0;i<20;i++){
// documentDevice.setCount(i); DocumentDevice documentDevice=new DocumentDevice();
// documentDevice.setModel("MM001"); documentDevice.setCount(i);
// documentDevice.setRemark("备注"); documentDevice.setModel("MM001");
// documentDevice.setApplicationField("省一级"); documentDevice.setRemark("备注");
// documentDevice.setDeviceSerialNumber("asdq1231232"); documentDevice.setApplicationField("省一级");
// documentDevice.setProductionSerialNumber("12312312312"); documentDevice.setDeviceSerialNumber("asdq1231232");
// documentDevice.setParts("密码机"); documentDevice.setProductionSerialNumber("12312312312");
// documentDevice.setCategory("装备"); documentDevice.setParts("密码机");
// documentDevice.setSecurityClassification("机密"); documentDevice.setCategory("装备");
// documentDevices.add(documentDevice); documentDevice.setSecurityClassification("机密");
// } documentDevices.add(documentDevice);
// documents.setDocumentDevices(documentDevices); }
// documents.setDocumentDevices(documentDevices);
// String[] content = JavaToPdfHtmlFreeMarker.freeMarkerRender(documents,url+"htmlModel/"); documentsList.add(documents);
// showPdf(response,JavaToPdfHtmlFreeMarker.createPdf(content,url,preview,"documents/").getFilePath()); List<String> list=new ArrayList<>();
return ResponseEntity.ok("ok"); documentsList.forEach(
documents1 -> list.addAll(Objects.requireNonNull(JavaToPdfHtmlFreeMarker.freeMarkerRenderList(documents1, url + "htmlModel/")))
);
log.info("[file] 调用了生成出入单据对接口 documents");
return ResponseEntity.ok(JavaToPdfHtmlFreeMarker.createPdf(list.toArray(new String[0]),url,preview,"documents/"));
} }
......
...@@ -183,6 +183,42 @@ public class JavaToPdfHtmlFreeMarker { ...@@ -183,6 +183,42 @@ public class JavaToPdfHtmlFreeMarker {
return null; return null;
} }
public static List<String> freeMarkerRenderList(Documents documents,String htmlPath) {
Writer out = new StringWriter();
List<String> listCont=new ArrayList<>();
try {
// 获取模板,并设置编码方式
Template template = freemarkerCfg.getTemplate("bill.html");
template.setEncoding("UTF-8");
List<DocumentDevice> list=documents.getDocumentDevices();
List<List<DocumentDevice>> listList=toList(list);
int count=listList.size();
for (int i=1; i<=3; i++){
Integer page=1;
for (List<DocumentDevice> list1:listList) {
String htmlname=htmlPath+ UUID.randomUUID().toString()+".html";
// 合并数据模型与模板
FileWriter fileWriter = new FileWriter(new File(htmlname));
template.process(toMap(documents,list1,MAP.get(i),page,count),fileWriter);
out.flush();
listCont.add(htmlname);
page++;
}
}
return listCont;
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
return null;
}
private static Map<String,Object> toMap(Documents documents,List<DocumentDevice> list,String test,Integer page,Integer count){ private static Map<String,Object> toMap(Documents documents,List<DocumentDevice> list,String test,Integer page,Integer count){
Map<String,Object> data = new HashMap(); Map<String,Object> data = new HashMap();
......
...@@ -22,6 +22,7 @@ public interface ScrapQueryService { ...@@ -22,6 +22,7 @@ public interface ScrapQueryService {
*/ */
Scrap findTaskId(Integer taskId); Scrap findTaskId(Integer taskId);
TaskBto findApplyIdToScrapTask(Integer applyId); TaskBto findApplyIdToScrapTask(Integer applyId);
} }
...@@ -106,10 +106,10 @@ public class RepelQueryController { ...@@ -106,10 +106,10 @@ public class RepelQueryController {
return ResponseEntity.ok(repelQueryService.retiredList(repelManagementVo)); return ResponseEntity.ok(repelQueryService.retiredList(repelManagementVo));
} }
@GetMapping(value ="/provinceDirectlyUnderDev/{taskId}") @GetMapping(value ="/provinceDirectlyUnderDev/{taskId}/{type}")
@ApiOperation(value = "省直属任务单位列表查询接口", notes = "省直属任务装备查询接口") @ApiOperation(value = "省直属任务单位列表查询接口", notes = "省直属任务装备查询接口")
public ResponseEntity provinceDirectlyUnderDev(@PathVariable Integer taskId){ public ResponseEntity provinceDirectlyUnderDev(@PathVariable Integer taskId, @PathVariable Integer type){
return ResponseEntity.ok(repelQueryService.directlyUnderUnitLeftNavigation(taskId)); return ResponseEntity.ok(repelQueryService.directlyUnderUnitLeftNavigation(taskId,type));
} }
@PostMapping(value ="/repelManagementListDetails") @PostMapping(value ="/repelManagementListDetails")
...@@ -119,10 +119,16 @@ public class RepelQueryController { ...@@ -119,10 +119,16 @@ public class RepelQueryController {
return ResponseEntity.ok(repelQueryService.repelManagementListDetails(deviceIdLIstVo.getIds())); return ResponseEntity.ok(repelQueryService.repelManagementListDetails(deviceIdLIstVo.getIds()));
} }
@GetMapping(value ="/provinceDirectlyUnderSelectedDev/{taskId}/{unitId}") @GetMapping(value ="/provinceDirectlyUnderSelectedDev/{taskId}/{unitId}/{type}")
@ApiOperation(value = "省直属单位 待上传接口装备查询", notes = "省直属单位 待上传接口装备查询") @ApiOperation(value = "省直属单位 待上传接口装备查询", notes = "省直属单位 待上传接口装备查询")
public ResponseEntity provinceDirectlyUnderSelectedDev( @PathVariable Integer taskId, @PathVariable Integer unitId){ public ResponseEntity provinceDirectlyUnderSelectedDev(@PathVariable Integer taskId, @PathVariable Integer unitId, @PathVariable Integer type){
return ResponseEntity.ok(repelQueryService.provinceDirectlyUnderSelectedDev(taskId,unitId)); return ResponseEntity.ok(repelQueryService.provinceDirectlyUnderSelectedDev(taskId,unitId,type));
}
@GetMapping(value ="/findByBillIdDeviceRepelDetail/{repelId}")
@ApiOperation(value = "根据业务id查询清退详情", notes = "根据业务id查询清退详情")
public ResponseEntity findByBillIdDeviceRepelDetail(@PathVariable Integer repelId){
return ResponseEntity.ok(repelQueryService.findByBillIdDeviceRepelDetail(repelId));
} }
@PostMapping(value ="/findRepelListModelNameGroup") @PostMapping(value ="/findRepelListModelNameGroup")
...@@ -163,4 +169,5 @@ public class RepelQueryController { ...@@ -163,4 +169,5 @@ public class RepelQueryController {
} }
} }
...@@ -83,12 +83,12 @@ public interface RepelQueryService { ...@@ -83,12 +83,12 @@ public interface RepelQueryService {
/** /**
* 查询直属单位列表 * 查询直属单位列表
*/ */
List<DirectlyUnderNavigation> directlyUnderUnitLeftNavigation(Integer taskId); List<DirectlyUnderNavigation> directlyUnderUnitLeftNavigation(Integer taskId,Integer type);
/** /**
*省直属任务装备已选择装备列表接口 *省直属任务装备已选择装备列表接口
*/ */
List<DeviceLibrary> provinceDirectlyUnderSelectedDev(Integer taskId,Integer unitId); List<DeviceLibrary> provinceDirectlyUnderSelectedDev(Integer taskId,Integer unitId,Integer type);
/** /**
* 清退管理 列表数据点击查询接口 * 清退管理 列表数据点击查询接口
...@@ -123,4 +123,6 @@ public interface RepelQueryService { ...@@ -123,4 +123,6 @@ public interface RepelQueryService {
*/ */
PagingVo repelDeviceInList(RepelManagementVo repelManagementVo); PagingVo repelDeviceInList(RepelManagementVo repelManagementVo);
DeviceRepelDetail findByBillIdDeviceRepelDetail(Integer repelId);
} }
...@@ -517,8 +517,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -517,8 +517,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
statusEnums.add(StatusEnum.SEND_BACK_1208); statusEnums.add(StatusEnum.SEND_BACK_1208);
statusEnums.add(StatusEnum.SEND_BACK_1219); statusEnums.add(StatusEnum.SEND_BACK_1219);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),statusEnums); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),statusEnums);
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
DeviceRepelDetail orderOutDataRepelDetail =orderOutData.toTrainDetailsVo(); DeviceRepelDetail orderOutDataRepelDetail = orderOutData.toTrainDetailsVo();
orderOutDataRepelDetail.setId(deviceRepelDetail.getId()); orderOutDataRepelDetail.setId(deviceRepelDetail.getId());
orderOutDataRepelDetail.setRepelId(deviceRepelDetail.getRepelId()); orderOutDataRepelDetail.setRepelId(deviceRepelDetail.getRepelId());
orderOutDataRepelDetail.setDeviceIds(deviceRepelDetail.getDeviceIds()); orderOutDataRepelDetail.setDeviceIds(deviceRepelDetail.getDeviceIds());
......
...@@ -324,10 +324,15 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -324,10 +324,15 @@ public class RepelQueryServiceImpl implements RepelQueryService {
@Override @Override
public List<DirectlyUnderNavigation> directlyUnderUnitLeftNavigation(Integer taskId) { public List<DirectlyUnderNavigation> directlyUnderUnitLeftNavigation(Integer taskId,Integer type) {
TaskBto taskBto= taskService.get(taskId);
List<DirectlyUnderNavigation> list=new ArrayList<>(); List<DirectlyUnderNavigation> list=new ArrayList<>();
DeviceRepelDetail deviceRepelDetail=repelDetailService.findDeviceRepelDetailNoDev(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail;
if (type==1){
TaskBto taskBto= taskService.get(taskId);
deviceRepelDetail=repelDetailService.findDeviceRepelDetailNoDev(taskBto.getBillId());
}else {
deviceRepelDetail=repelDetailService.findDeviceRepelDetailNoDev(taskId);
}
DeviceRepel deviceRepel=deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId()); DeviceRepel deviceRepel=deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
unitsService.findAllByIdIn(StringUtils.stringToList(deviceRepel.getTaskScope())).forEach( unitsService.findAllByIdIn(StringUtils.stringToList(deviceRepel.getTaskScope())).forEach(
units -> { units -> {
...@@ -343,10 +348,16 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -343,10 +348,16 @@ public class RepelQueryServiceImpl implements RepelQueryService {
@Override @Override
public List<DeviceLibrary> provinceDirectlyUnderSelectedDev(Integer taskId, Integer unitId) { public List<DeviceLibrary> provinceDirectlyUnderSelectedDev(Integer taskId, Integer unitId,Integer type) {
Units units=unitsService.findById(unitId); Units units=unitsService.findById(unitId);
TaskBto taskBto= taskService.get(taskId);
DeviceRepelDetail deviceRepelDetail= repelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail;
if (type==1){
TaskBto taskBto= taskService.get(taskId);
deviceRepelDetail=repelDetailService.findDeviceRepelDetail(taskBto.getBillId());
}else {
deviceRepelDetail=repelDetailService.findDeviceRepelDetail(taskId);
}
Map<String,List<Integer>> map=JacksonUtil.readValue(deviceRepelDetail.getDirectlyUnderDevices(), new TypeReference<Map<String, List<Integer>>>() {}); Map<String,List<Integer>> map=JacksonUtil.readValue(deviceRepelDetail.getDirectlyUnderDevices(), new TypeReference<Map<String, List<Integer>>>() {});
if (map!=null) { if (map!=null) {
if (map.containsKey(units.getName())) { if (map.containsKey(units.getName())) {
...@@ -356,7 +367,7 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -356,7 +367,7 @@ public class RepelQueryServiceImpl implements RepelQueryService {
return new ArrayList<>(); return new ArrayList<>();
} }
}else { }else {
log.info("直属单位任务{}没有提交的装备,请查看",taskBto.getId()); log.info("直属单位任务{}没有提交的装备,请查看",taskId);
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -467,6 +478,11 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -467,6 +478,11 @@ public class RepelQueryServiceImpl implements RepelQueryService {
.build(); .build();
} }
@Override
public DeviceRepelDetail findByBillIdDeviceRepelDetail(Integer repelId) {
return repelDetailService.findDeviceRepelDetailNoDev(repelId);
}
private Specification<DeviceLibrary> getRepelDeviceSpecificationIn(RepelManagementVo repelManagementVo) { private Specification<DeviceLibrary> getRepelDeviceSpecificationIn(RepelManagementVo repelManagementVo) {
PredicateBuilder<DeviceLibrary> predicateBuilder = getPredicateBuilder(repelManagementVo); PredicateBuilder<DeviceLibrary> predicateBuilder = getPredicateBuilder(repelManagementVo);
//unitId为空,默认查询当前单位 //unitId为空,默认查询当前单位
......
package com.tykj.dev.device.user.subject.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.user.subject.entity.Area;
import com.tykj.dev.device.user.subject.entity.Feedback;
import com.tykj.dev.device.user.subject.service.FeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author zjm
* @version 1.0.0
* @ClassName FeedbackController.java
* @Description TODO
* @createTime 2021年04月27日 10:40:00
*/
@RestController
@AutoDocument
@Api(tags = "意见反馈模块", description = "意见反馈模块")
@RequestMapping("/feedback")
public class FeedbackController {
@Autowired
FeedbackService feedbackService;
@PostMapping("/save")
@ApiOperation(value = "添加区域对象", notes = "成功返回区域对象")
public ResponseEntity saveFeedback(@RequestBody Feedback feedback){
return ResponseEntity.ok( feedbackService.save(feedback));
}
}
package com.tykj.dev.device.user.subject.dao;
import com.tykj.dev.device.user.subject.entity.Feedback;
import com.tykj.dev.device.user.subject.entity.Groups;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface FeedbackDao extends JpaRepository<Feedback, Integer>, JpaSpecificationExecutor<Feedback> {
}
package com.tykj.dev.device.user.subject.entity;
import com.tykj.dev.misc.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import javax.persistence.Entity;
/**
* @author zjm
* @version 1.0.0
* @ClassName Feedback.java
* @Description TODO
* @createTime 2021年04月27日 10:36:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Entity
@ApiModel(value = "建议反馈", description = "地区详细信息")
public class Feedback extends BaseEntity {
@Column(name = "content" ,columnDefinition = "TEXT")
private String content;
}
package com.tykj.dev.device.user.subject.service;
import com.tykj.dev.device.user.subject.entity.Feedback;
public interface FeedbackService extends PublicService<Feedback> {
}
package com.tykj.dev.device.user.subject.service.impl;
import com.tykj.dev.device.user.subject.dao.FeedbackDao;
import com.tykj.dev.device.user.subject.entity.Feedback;
import com.tykj.dev.device.user.subject.service.FeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName FeedbackServiceImpl.java
* @Description TODO
* @createTime 2021年04月27日 10:40:00
*/
@Service
public class FeedbackServiceImpl implements FeedbackService {
@Autowired
FeedbackDao feedbackDao;
@Override
public Feedback save(Feedback feedback) {
return feedbackDao.save(feedback);
}
@Override
public boolean delete(Integer id) {
return false;
}
@Override
public List<Feedback> findAll() {
return null;
}
@Override
public Feedback update(Feedback feedback) {
return null;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论