|
@@ -17,6 +17,10 @@ import cn.ezhizao.project.business.technologicalProcessDetailDrawing.domain.BizT
|
|
import cn.ezhizao.project.business.technologicalProcessDetailDrawing.service.IBizTechnologicalProcessDetailDrawingService;
|
|
import cn.ezhizao.project.business.technologicalProcessDetailDrawing.service.IBizTechnologicalProcessDetailDrawingService;
|
|
import cn.ezhizao.project.business.technologicalProcessDetailDrawingRecords.domain.BizTechnologicalProcessDetailDrawingRecords;
|
|
import cn.ezhizao.project.business.technologicalProcessDetailDrawingRecords.domain.BizTechnologicalProcessDetailDrawingRecords;
|
|
import cn.ezhizao.project.business.technologicalProcessDetailDrawingRecords.service.IBizTechnologicalProcessDetailDrawingRecordsService;
|
|
import cn.ezhizao.project.business.technologicalProcessDetailDrawingRecords.service.IBizTechnologicalProcessDetailDrawingRecordsService;
|
|
|
|
+import cn.ezhizao.project.business.technologicalProcessDetailDrawingUser.domain.BizTechnologicalProcessDetailDrawingUser;
|
|
|
|
+import cn.ezhizao.project.business.technologicalProcessDetailDrawingUser.service.IBizTechnologicalProcessDetailDrawingUserService;
|
|
|
|
+import cn.ezhizao.project.system.domain.SysUser;
|
|
|
|
+import cn.ezhizao.project.system.service.ISysUserService;
|
|
import org.apache.pdfbox.exceptions.COSVisitorException;
|
|
import org.apache.pdfbox.exceptions.COSVisitorException;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -30,6 +34,7 @@ import com.itextpdf.text.pdf.PdfContentByte;
|
|
import com.itextpdf.text.pdf.PdfGState;
|
|
import com.itextpdf.text.pdf.PdfGState;
|
|
import com.itextpdf.text.pdf.PdfReader;
|
|
import com.itextpdf.text.pdf.PdfReader;
|
|
import com.itextpdf.text.pdf.PdfStamper;
|
|
import com.itextpdf.text.pdf.PdfStamper;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.FileOutputStream;
|
|
import java.io.FileOutputStream;
|
|
@@ -41,6 +46,7 @@ import java.time.LocalDate;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -62,6 +68,110 @@ public class BizTechnologicalProcessDetailDrawingController extends BaseControll
|
|
private IBizPersonalSealService bizPersonalSealService ;
|
|
private IBizPersonalSealService bizPersonalSealService ;
|
|
@Resource
|
|
@Resource
|
|
private IBizPublicSealService bizPublicSealService;
|
|
private IBizPublicSealService bizPublicSealService;
|
|
|
|
+ @Resource
|
|
|
|
+ private ISysUserService userService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private IBizTechnologicalProcessDetailDrawingUserService bizTechnologicalProcessDetailDrawingUserService;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Log(title = "电子图纸", businessType = BusinessType.EXPORT)
|
|
|
|
+ @PostMapping("/export")
|
|
|
|
+ public void exportDrawing(HttpServletResponse response){
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ BizTechnologicalProcessDetailDrawing item = new BizTechnologicalProcessDetailDrawing();
|
|
|
|
+ List<BizTechnologicalProcessDetailDrawing> list = bizTechnologicalProcessDetailDrawingService.getDrawingList(item);
|
|
|
|
+ for (BizTechnologicalProcessDetailDrawing bizTechnologicalProcessDetailDrawing : list) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ bizTechnologicalProcessDetailDrawing.setCompanyAlias(bizTechnologicalProcessDetailDrawing.getProduct().getCompanyAlias());
|
|
|
|
+ bizTechnologicalProcessDetailDrawing.setSpecification(bizTechnologicalProcessDetailDrawing.getProduct().getSpecification());
|
|
|
|
+ bizTechnologicalProcessDetailDrawing.setDescription(bizTechnologicalProcessDetailDrawing.getProduct().getDescription());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ExcelUtil<BizTechnologicalProcessDetailDrawing> util = new ExcelUtil<BizTechnologicalProcessDetailDrawing>(BizTechnologicalProcessDetailDrawing.class);
|
|
|
|
+ util.exportExcel(response, list, "电子图纸数据");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:workpiece:import')")
|
|
|
|
+ @PostMapping("/importData")
|
|
|
|
+ public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
|
|
|
+ {
|
|
|
|
+ ExcelUtil<BizTechnologicalProcessDetailDrawing> util = new ExcelUtil<>(BizTechnologicalProcessDetailDrawing.class);
|
|
|
|
+ List<BizTechnologicalProcessDetailDrawing> bizTechnologicalProcessDetailDrawings = util.importExcel(file.getInputStream());
|
|
|
|
+
|
|
|
|
+ for(BizTechnologicalProcessDetailDrawing item : bizTechnologicalProcessDetailDrawings){
|
|
|
|
+ SysUser userParam = new SysUser();
|
|
|
|
+ SysUser user = new SysUser();
|
|
|
|
+ userParam.setUserName(item.getProducerCode());
|
|
|
|
+ userParam.setNickName(item.getProducer());
|
|
|
|
+ List<SysUser> userList = userService.getListByUserName(userParam);
|
|
|
|
+ if (userList.isEmpty()){
|
|
|
|
+ return error("未查到人员");
|
|
|
|
+ }else {
|
|
|
|
+ user = userList.get(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BizPersonalSeal person = new BizPersonalSeal();
|
|
|
|
+ person.setUserId(user.getUserId());
|
|
|
|
+ String filePath = RuoYiConfig.getProfile();
|
|
|
|
+ List<BizPersonalSeal> personList = bizPersonalSealService.getList(person);
|
|
|
|
+ // 获取当前日期
|
|
|
|
+ LocalDate currentDate = LocalDate.now();
|
|
|
|
+ // 定义日期格式
|
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
|
|
|
|
+ // 格式化日期
|
|
|
|
+ String formattedDate = currentDate.format(formatter);
|
|
|
|
+ if(personList.isEmpty()){
|
|
|
|
+ return error(user.getUserId() + "该人员没有个人章");
|
|
|
|
+ }
|
|
|
|
+ String personalSeal = personList.get(0).getUrl().substring("/profile".length());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String url = "";
|
|
|
|
+ url = item.getUrl();
|
|
|
|
+ url = url.substring("/profile".length());
|
|
|
|
+ item.setProducerId(user.getUserId());
|
|
|
|
+ item.setProducer(user.getNickName());
|
|
|
|
+ item.setStatus(0);
|
|
|
|
+
|
|
|
|
+ item.setPattern("新产品");
|
|
|
|
+ //上传调整尺寸
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ PdfUtils.reSized(filePath + url,filePath +url.substring(0, url.length()-4) + "制作" + url.substring(url.length()-4),100,"height");
|
|
|
|
+ bizTechnologicalProcessDetailDrawingService.addText(filePath +url.substring(0, url.length()-4) + "制作" + url.substring(url.length()-4),filePath+url.substring(0, url.length()-4) + "制作人" + url.substring(url.length()-4),"制定人:",550,75,12,270);
|
|
|
|
+ bizTechnologicalProcessDetailDrawingService.addText(filePath +url.substring(0, url.length()-4) + "制作人" + url.substring(url.length()-4),filePath+url.substring(0, url.length()-4) + "制作时间" + url.substring(url.length()-4),formattedDate,500,75,12,270);
|
|
|
|
+ bizTechnologicalProcessDetailDrawingService.addImage(filePath+url.substring(0, url.length()-4) + "制作时间" + url.substring(url.length()-4),filePath+url.substring(0, url.length()-4) + "制作完成" + url.substring(url.length()-4),filePath+personalSeal,515,40,30,30,270,1);
|
|
|
|
+ item.setUrl("/profile/"+url.substring(0, url.length()-4) + "制作完成" + url.substring(url.length()-4));
|
|
|
|
+ bizTechnologicalProcessDetailDrawingService.updateById(item);
|
|
|
|
+ //添加用户记录
|
|
|
|
+ BizTechnologicalProcessDetailDrawingUser drawingUser = new BizTechnologicalProcessDetailDrawingUser();
|
|
|
|
+ drawingUser.setDrawingId(item.getId());
|
|
|
|
+ drawingUser.setProcessCode(item.getProcessCode());
|
|
|
|
+ drawingUser.setDrawingName(item.getDrawingName());
|
|
|
|
+ drawingUser.setType(0);
|
|
|
|
+ drawingUser.setUserId(user.getUserId());
|
|
|
|
+ drawingUser.setNickName(user.getNickName());
|
|
|
|
+ drawingUser.setProductId(item.getProductId());
|
|
|
|
+ drawingUser.setProductVersion(item.getProductVersion());
|
|
|
|
+ drawingUser.setRecordTime(new Date());
|
|
|
|
+ bizTechnologicalProcessDetailDrawingUserService.save(drawingUser);
|
|
|
|
+ List<BizTechnologicalProcessDetailDrawing>itemList = new ArrayList<>();
|
|
|
|
+ itemList.add(item);
|
|
|
|
+ //开始正是走审核流程
|
|
|
|
+ bizTechnologicalProcessDetailDrawingService.saveData(itemList,item.getReviewerCode(),item.getReviewer());
|
|
|
|
+ //批准流程
|
|
|
|
+ bizTechnologicalProcessDetailDrawingService.saveData(itemList,item.getIssuerCode(),item.getIssuer());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return success(bizTechnologicalProcessDetailDrawings);
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询电子图纸列表
|
|
* 查询电子图纸列表
|
|
@@ -125,16 +235,16 @@ public class BizTechnologicalProcessDetailDrawingController extends BaseControll
|
|
/**
|
|
/**
|
|
* 导出电子图纸列表
|
|
* 导出电子图纸列表
|
|
*/
|
|
*/
|
|
- @PreAuthorize("@ss.hasPermi('business:drawing:export')")
|
|
|
|
- @Log(title = "电子图纸", businessType = BusinessType.EXPORT)
|
|
|
|
- @PostMapping("/export")
|
|
|
|
- public void export(HttpServletResponse response, BizTechnologicalProcessDetailDrawing bizTechnologicalProcessDetailDrawing) throws NoSuchFieldException, IllegalAccessException
|
|
|
|
- {
|
|
|
|
- setTenantId(bizTechnologicalProcessDetailDrawing);
|
|
|
|
- List<BizTechnologicalProcessDetailDrawing> list = bizTechnologicalProcessDetailDrawingService.getList(bizTechnologicalProcessDetailDrawing);
|
|
|
|
- ExcelUtil<BizTechnologicalProcessDetailDrawing> util = new ExcelUtil<BizTechnologicalProcessDetailDrawing>(BizTechnologicalProcessDetailDrawing.class);
|
|
|
|
- util.exportExcel(response, list, "电子图纸数据");
|
|
|
|
- }
|
|
|
|
|
|
+// @PreAuthorize("@ss.hasPermi('business:drawing:export')")
|
|
|
|
+// @Log(title = "电子图纸", businessType = BusinessType.EXPORT)
|
|
|
|
+// @PostMapping("/export")
|
|
|
|
+// public void export(HttpServletResponse response, BizTechnologicalProcessDetailDrawing bizTechnologicalProcessDetailDrawing) throws NoSuchFieldException, IllegalAccessException
|
|
|
|
+// {
|
|
|
|
+// setTenantId(bizTechnologicalProcessDetailDrawing);
|
|
|
|
+// List<BizTechnologicalProcessDetailDrawing> list = bizTechnologicalProcessDetailDrawingService.getList(bizTechnologicalProcessDetailDrawing);
|
|
|
|
+// ExcelUtil<BizTechnologicalProcessDetailDrawing> util = new ExcelUtil<BizTechnologicalProcessDetailDrawing>(BizTechnologicalProcessDetailDrawing.class);
|
|
|
|
+// util.exportExcel(response, list, "电子图纸数据");
|
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取电子图纸详细信息
|
|
* 获取电子图纸详细信息
|
|
@@ -158,160 +268,20 @@ public class BizTechnologicalProcessDetailDrawingController extends BaseControll
|
|
@PostMapping("/save")
|
|
@PostMapping("/save")
|
|
|
|
|
|
public AjaxResult save(@RequestBody List<BizTechnologicalProcessDetailDrawing> bizTechnologicalProcessDetailDrawing) throws NoSuchFieldException, IllegalAccessException, COSVisitorException, DocumentException, IOException {
|
|
public AjaxResult save(@RequestBody List<BizTechnologicalProcessDetailDrawing> bizTechnologicalProcessDetailDrawing) throws NoSuchFieldException, IllegalAccessException, COSVisitorException, DocumentException, IOException {
|
|
- BizPersonalSeal person = new BizPersonalSeal();
|
|
|
|
- person.setUserId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
|
- String filePath = RuoYiConfig.getProfile();
|
|
|
|
- List<BizPersonalSeal> personList = bizPersonalSealService.getList(person);
|
|
|
|
- // 获取当前日期
|
|
|
|
- LocalDate currentDate = LocalDate.now();
|
|
|
|
- // 定义日期格式
|
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
|
|
|
|
- // 格式化日期
|
|
|
|
- String formattedDate = currentDate.format(formatter);
|
|
|
|
- if(personList.isEmpty()){
|
|
|
|
- return error("请先上传个人章");
|
|
|
|
- }
|
|
|
|
- String personalSeal = personList.get(0).getUrl().substring("/profile".length());
|
|
|
|
- for(BizTechnologicalProcessDetailDrawing item: bizTechnologicalProcessDetailDrawing){
|
|
|
|
- String url = "";
|
|
|
|
- url = item.getUrl();
|
|
|
|
- url = url.substring("/profile".length());
|
|
|
|
- if (item.getStatus() == null){
|
|
|
|
- // 默认情况下执行新增的代码
|
|
|
|
- item.setProducerId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
|
- item.setProducer(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
|
- item.setStatus(0);
|
|
|
|
- item.setPattern("新产品");
|
|
|
|
- //上传调整尺寸
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- PdfUtils.reSized(filePath + url,filePath +url.substring(0, url.length()-4) + "制作" + url.substring(url.length()-4),100,"height");
|
|
|
|
- addText(filePath +url.substring(0, url.length()-4) + "制作" + url.substring(url.length()-4),filePath+url.substring(0, url.length()-4) + "制作人" + url.substring(url.length()-4),"制定人:",550,75,12,270);
|
|
|
|
- addText(filePath +url.substring(0, url.length()-4) + "制作人" + url.substring(url.length()-4),filePath+url.substring(0, url.length()-4) + "制作时间" + url.substring(url.length()-4),formattedDate,500,75,12,270);
|
|
|
|
- addImage(filePath+url.substring(0, url.length()-4) + "制作时间" + url.substring(url.length()-4),filePath+url.substring(0, url.length()-4) + "制作完成" + url.substring(url.length()-4),filePath+personalSeal,515,40,30,30,270,1);
|
|
|
|
- item.setUrl("/profile/"+url.substring(0, url.length()-4) + "制作完成" + url.substring(url.length()-4));
|
|
|
|
- bizTechnologicalProcessDetailDrawingService.save(item);
|
|
|
|
- break;
|
|
|
|
- }else {
|
|
|
|
- switch (item.getStatus()) {
|
|
|
|
- //0:待审核,1待批准
|
|
|
|
- case 0:
|
|
|
|
- item.setReviewerId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
|
- item.setReviewer(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
|
- item.setStatus(1);
|
|
|
|
- addText(filePath+ url,filePath +url.substring(0, url.length()-4) + "审核" + url.substring(url.length()-4),"审核人:",470,75,12,270);
|
|
|
|
- addText(filePath +url.substring(0, url.length()-4) + "审核" + url.substring(url.length()-4),filePath+url.substring(0, url.length()-4) + "审核时间" + url.substring(url.length()-4),formattedDate,420,75,12,270);
|
|
|
|
- addImage(filePath +url.substring(0, url.length()-4) + "审核时间" + url.substring(url.length()-4),filePath +url.substring(0, url.length()-4) + "审核完成" + url.substring(url.length()-4),filePath+personalSeal,435,40,30,30,270,1);
|
|
|
|
- item.setUrl("/profile/"+url.substring(0, url.length()-4) + "审核完成" + url.substring(url.length()-4));
|
|
|
|
- bizTechnologicalProcessDetailDrawingService.updateById(item);
|
|
|
|
- break;
|
|
|
|
- case 1:
|
|
|
|
- issuer(item,personalSeal);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return success();
|
|
|
|
- }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
- * 批准逻辑
|
|
|
|
- * @param item
|
|
|
|
- */
|
|
|
|
- @Transactional
|
|
|
|
- public void issuer (BizTechnologicalProcessDetailDrawing item,String personalSeal) throws DocumentException, IOException {
|
|
|
|
- item.setIssuerId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
|
- item.setIssuer(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
|
- item.setStatus(2);
|
|
|
|
- String url = "";
|
|
|
|
- url = item.getUrl();
|
|
|
|
- url = url.substring("/profile".length());
|
|
|
|
- String filePath = RuoYiConfig.getProfile();
|
|
|
|
- //查询公共章
|
|
|
|
- String reviewer = getPublicSeal("受控");
|
|
|
|
- String D = getPublicSeal("D章");
|
|
|
|
- String heavy = getPublicSeal("重章");
|
|
|
|
- String isu = getPublicSeal("发行章");
|
|
|
|
- String rem = getPublicSeal("废弃章");
|
|
|
|
- // 获取当前日期
|
|
|
|
- LocalDate currentDate = LocalDate.now();
|
|
|
|
- // 定义日期格式
|
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
|
|
|
|
- // 格式化日期
|
|
|
|
- String formattedDate = currentDate.format(formatter);
|
|
|
|
-
|
|
|
|
- //替换图纸将旧图纸废弃
|
|
|
|
- if (item.getParentId()!=0){
|
|
|
|
- BizTechnologicalProcessDetailDrawing byId = bizTechnologicalProcessDetailDrawingService.query().eq("id", item.getParentId()).one();
|
|
|
|
- String urlItem = "";
|
|
|
|
- urlItem = byId.getUrl();
|
|
|
|
- urlItem = urlItem.substring("/profile".length());
|
|
|
|
- byId.setStatus(2);
|
|
|
|
- byId.setAbandoned(1);
|
|
|
|
- byId.setVoided(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
|
- byId.setVoidedId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
|
- byId.setPattern("作废产品");
|
|
|
|
- addImage(filePath+ urlItem,filePath +urlItem.substring(0, urlItem.length()-4) + "zf" + urlItem.substring(urlItem.length()-4),filePath+rem,290,880,40,15,300,0.8F);
|
|
|
|
- addText(filePath +urlItem.substring(0, urlItem.length()-4) + "zf" + urlItem.substring(urlItem.length()-4),filePath +urlItem.substring(0, urlItem.length()-4) + "zfr" + urlItem.substring(urlItem.length()-4),"作废申请人:",310,75,12,270);
|
|
|
|
- addText(filePath +urlItem.substring(0, urlItem.length()-4) + "zfr" + urlItem.substring(urlItem.length()-4),filePath+urlItem.substring(0, urlItem.length()-4) + "zfdate" + urlItem.substring(urlItem.length()-4),formattedDate,500,75,12,270);
|
|
|
|
-
|
|
|
|
- addImage(filePath +urlItem.substring(0, urlItem.length()-4) + "zfdate" + urlItem.substring(urlItem.length()-4),filePath +urlItem.substring(0, urlItem.length()-4) + "zfover" + urlItem.substring(urlItem.length()-4),filePath+personalSeal,275,40,30,30,270,1);
|
|
|
|
- byId.setUrl("/profile/" +urlItem.substring(0, urlItem.length()-4) + "zfover" + urlItem.substring(urlItem.length()-4));
|
|
|
|
- bizTechnologicalProcessDetailDrawingService.updateById(byId);
|
|
|
|
- }
|
|
|
|
- //判断盖章逻辑
|
|
|
|
- if (item.getAbandoned() ==1){
|
|
|
|
- //加盖废弃章,不需要盖其他章
|
|
|
|
- addImage(filePath+ url,filePath +url.substring(0, url.length()-4) + "zf" + url.substring(url.length()-4),filePath+rem,290,880,40,15,300,0.8F);
|
|
|
|
- addText(filePath +url.substring(0, url.length()-4) + "zf" + url.substring(url.length()-4),filePath +url.substring(0, url.length()-4) + "zfr" + url.substring(url.length()-4),"作废批准人:",230,75,12,270);
|
|
|
|
- addText(filePath +url.substring(0, url.length()-4) + "zfr" + url.substring(url.length()-4),filePath+url.substring(0, url.length()-4) + "zfdate" + url.substring(url.length()-4),formattedDate,180,75,12,270);
|
|
|
|
-
|
|
|
|
- addImage(filePath +url.substring(0, url.length()-4) + "zfdate" + url.substring(url.length()-4),filePath +url.substring(0, url.length()-4) + "zfover" + url.substring(url.length()-4),filePath+personalSeal,195,40,30,30,270,1);
|
|
|
|
- item.setUrl("/profile/"+url.substring(0, url.length()-4) + "zfover" + url.substring(url.length()-4));
|
|
|
|
- bizTechnologicalProcessDetailDrawingService.updateById(item);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- //盖批准和审核章还有批准日期
|
|
|
|
- addText(filePath+ url,filePath +url.substring(0, url.length()-4) + "pz" + url.substring(url.length()-4),"批准人:",390,75,12,270);
|
|
|
|
- //批准章
|
|
|
|
- addImage(filePath +url.substring(0, url.length()-4) + "pz" + url.substring(url.length()-4),filePath +url.substring(0, url.length()-4) + "pzz" + url.substring(url.length()-4),filePath+isu,400,860,60,55,300,0.8F);
|
|
|
|
- //批准章上的日期
|
|
|
|
- addText(filePath +url.substring(0, url.length()-4) + "pzz" + url.substring(url.length()-4),filePath +url.substring(0, url.length()-4) + "pzdate" + url.substring(url.length()-4),formattedDate,427,913,8,300);
|
|
|
|
- //个人章
|
|
|
|
- addImage(filePath +url.substring(0, url.length()-4) + "pzdate" + url.substring(url.length()-4),filePath +url.substring(0, url.length()-4) + "pzr" + url.substring(url.length()-4),filePath+personalSeal,355,40,30,30,270,1);
|
|
|
|
- //批准日期
|
|
|
|
- addText(filePath +url.substring(0, url.length()-4) + "pzr" + url.substring(url.length()-4),filePath +url.substring(0, url.length()-4) + "pzrdate" + url.substring(url.length()-4),formattedDate,340,75,12,270);
|
|
|
|
-
|
|
|
|
- //受控章
|
|
|
|
- addImage(filePath +url.substring(0, url.length()-4) + "pzrdate" + url.substring(url.length()-4),filePath +url.substring(0, url.length()-4) + "pzover" + url.substring(url.length()-4),filePath+reviewer,465,870,45,28,300,0.8F);
|
|
|
|
- item.setUrl("/profile/" +url.substring(0, url.length()-4) + "pzover" + url.substring(url.length()-4));
|
|
|
|
- if (item.getIdentification()){
|
|
|
|
- //盖重章
|
|
|
|
- addImage(filePath +url.substring(0, url.length()-4) + "pzover" + url.substring(url.length()-4),filePath +url.substring(0, url.length()-4) + "z" + url.substring(url.length()-4),filePath+heavy,320,870,40,40,300,0.8F);
|
|
|
|
- item.setUrl("/profile" +url.substring(0, url.length()-4) + "z" + url.substring(url.length()-4));
|
|
|
|
- }
|
|
|
|
- if (item.getMarkD() ){
|
|
|
|
- //因为地址不同判断重章有没有盖到
|
|
|
|
- //盖D章
|
|
|
|
- if (!item.getIdentification()){
|
|
|
|
- addImage(filePath +url.substring(0, url.length()-4) + "pzover" + url.substring(url.length()-4),filePath +url.substring(0, url.length()-4) + "dover" + url.substring(url.length()-4),filePath+D,365,870,40,40,300,0.8F);
|
|
|
|
- }else {
|
|
|
|
- addImage(filePath +url.substring(0, url.length()-4) + "z" + url.substring(url.length()-4),filePath +url.substring(0, url.length()-4) + "dover" + url.substring(url.length()-4),filePath+D,365,870,40,40,300,0.8F);
|
|
|
|
- }
|
|
|
|
- item.setUrl("/profile/" +url.substring(0, url.length()-4) + "dover" + url.substring(url.length()-4));
|
|
|
|
|
|
|
|
|
|
+ int i = bizTechnologicalProcessDetailDrawingService.saveData(bizTechnologicalProcessDetailDrawing,SecurityUtils.getLoginUser().getUser().getUserName(),SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
|
+ if (i == 3) {
|
|
|
|
+ return error("请先上传个人章");
|
|
|
|
+ } else if (i ==4) {
|
|
|
|
+ return error("未查询到当前员工");
|
|
|
|
+ } else {
|
|
|
|
+ return success();
|
|
}
|
|
}
|
|
- bizTechnologicalProcessDetailDrawingService.updateById(item);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-/**
|
|
|
|
- * 公共章查村
|
|
|
|
- */
|
|
|
|
-public String getPublicSeal(String code) {
|
|
|
|
- return bizPublicSealService.query().eq("code", code).one().getUrl().substring("/profile".length());
|
|
|
|
-}
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 电子图纸作废
|
|
* 电子图纸作废
|
|
*/
|
|
*/
|
|
@@ -319,53 +289,23 @@ public String getPublicSeal(String code) {
|
|
@PutMapping("/drawingNG")
|
|
@PutMapping("/drawingNG")
|
|
@Transactional
|
|
@Transactional
|
|
public AjaxResult drawingNG(@RequestBody List<BizTechnologicalProcessDetailDrawing> processDetailDrawing) throws NoSuchFieldException, IllegalAccessException, IOException {
|
|
public AjaxResult drawingNG(@RequestBody List<BizTechnologicalProcessDetailDrawing> processDetailDrawing) throws NoSuchFieldException, IllegalAccessException, IOException {
|
|
- for(BizTechnologicalProcessDetailDrawing item: processDetailDrawing){
|
|
|
|
- item.setStatus(3);
|
|
|
|
- item.setNgUser(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
|
- item.setUserNgId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
|
-
|
|
|
|
- bizTechnologicalProcessDetailDrawingService.updateById(item);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return success();
|
|
|
|
|
|
+ return success( bizTechnologicalProcessDetailDrawingService.drawingNG(processDetailDrawing,SecurityUtils.getLoginUser().getUser().getUserName(),SecurityUtils.getLoginUser().getUser().getNickName()));
|
|
}
|
|
}
|
|
|
|
|
|
@Log(title = "电子图纸", businessType = BusinessType.UPDATE)
|
|
@Log(title = "电子图纸", businessType = BusinessType.UPDATE)
|
|
@PutMapping("/drawingRemove")
|
|
@PutMapping("/drawingRemove")
|
|
@Transactional
|
|
@Transactional
|
|
public AjaxResult drawingRemove(@RequestBody List<BizTechnologicalProcessDetailDrawing> processDetailDrawing) throws NoSuchFieldException, IllegalAccessException, IOException, DocumentException {
|
|
public AjaxResult drawingRemove(@RequestBody List<BizTechnologicalProcessDetailDrawing> processDetailDrawing) throws NoSuchFieldException, IllegalAccessException, IOException, DocumentException {
|
|
- BizPersonalSeal person = new BizPersonalSeal();
|
|
|
|
- person.setUserId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
|
- List<BizPersonalSeal> personList = bizPersonalSealService.getList(person);
|
|
|
|
- if(personList.isEmpty()){
|
|
|
|
|
|
+ int i = bizTechnologicalProcessDetailDrawingService.drawingRemove(processDetailDrawing,SecurityUtils.getLoginUser().getUser().getUserName(),SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
|
+ if (i == 3) {
|
|
return error("请先上传个人章");
|
|
return error("请先上传个人章");
|
|
|
|
+ } else if (i ==4) {
|
|
|
|
+ return error("未查询到当前员工");
|
|
|
|
+ } else {
|
|
|
|
+ return success();
|
|
}
|
|
}
|
|
- String personalSeal = personList.get(0).getUrl().substring("/profile".length());
|
|
|
|
- LocalDate currentDate = LocalDate.now();
|
|
|
|
- // 定义日期格式
|
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
|
|
|
|
- // 格式化日期
|
|
|
|
- String formattedDate = currentDate.format(formatter);
|
|
|
|
- for(BizTechnologicalProcessDetailDrawing item: processDetailDrawing){
|
|
|
|
- String url = "";
|
|
|
|
- url = item.getUrl();
|
|
|
|
- url = url.substring("/profile".length());
|
|
|
|
- String filePath = RuoYiConfig.getProfile();
|
|
|
|
- item.setStatus(1);
|
|
|
|
- item.setAbandoned(1);
|
|
|
|
- item.setPattern("作废产品");
|
|
|
|
- item.setVoided(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
|
- item.setVoidedId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
|
-
|
|
|
|
- addText(filePath +url.substring(0, url.length()-4) + url.substring(url.length()-4),filePath +url.substring(0, url.length()-4) + "zfr" + url.substring(url.length()-4),"作废申请人:",310,75,12,270);
|
|
|
|
- addText(filePath +url.substring(0, url.length()-4) + "zfr" + url.substring(url.length()-4),filePath+url.substring(0, url.length()-4) + "zfdate" + url.substring(url.length()-4),formattedDate,260,75,12,270);
|
|
|
|
|
|
|
|
- addImage(filePath +url.substring(0, url.length()-4) + "zfdate" + url.substring(url.length()-4),filePath +url.substring(0, url.length()-4) + "zfover" + url.substring(url.length()-4),filePath+personalSeal,275,40,30,30,270,1);
|
|
|
|
- item.setUrl("/profile/"+url.substring(0, url.length()-4) + "zfover" + url.substring(url.length()-4));
|
|
|
|
- bizTechnologicalProcessDetailDrawingService.updateById(item);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- return success();
|
|
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* 电子图纸替换
|
|
* 电子图纸替换
|
|
@@ -400,46 +340,13 @@ public String getPublicSeal(String code) {
|
|
@PutMapping("/replace")
|
|
@PutMapping("/replace")
|
|
@Transactional
|
|
@Transactional
|
|
public AjaxResult replaceDrawing(@RequestBody BizTechnologicalProcessDetailDrawing processDetailDrawing) throws NoSuchFieldException, IllegalAccessException, COSVisitorException, DocumentException, IOException {
|
|
public AjaxResult replaceDrawing(@RequestBody BizTechnologicalProcessDetailDrawing processDetailDrawing) throws NoSuchFieldException, IllegalAccessException, COSVisitorException, DocumentException, IOException {
|
|
- //根据parentId插叙旧图纸
|
|
|
|
- BizTechnologicalProcessDetailDrawing id = bizTechnologicalProcessDetailDrawingService.query().eq("id", processDetailDrawing.getParentId()).one();
|
|
|
|
-// id.setStatus(1);
|
|
|
|
-// id.setAbandoned(1);
|
|
|
|
-// id.setPattern("作废产品");
|
|
|
|
-// id.setVoided(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
|
-// id.setVoidedId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
|
-// bizTechnologicalProcessDetailDrawingService.updateById(id);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- BizPersonalSeal person = new BizPersonalSeal();
|
|
|
|
- person.setUserId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
|
- String filePath = RuoYiConfig.getProfile();
|
|
|
|
- List<BizPersonalSeal> personList = bizPersonalSealService.getList(person);
|
|
|
|
- if(personList.isEmpty()){
|
|
|
|
|
|
+ int i = bizTechnologicalProcessDetailDrawingService.replaceDrawing(processDetailDrawing);
|
|
|
|
+ if (i == 3 ){
|
|
return error("请先上传个人章");
|
|
return error("请先上传个人章");
|
|
|
|
+ }else {
|
|
|
|
+ return toAjax(i);
|
|
}
|
|
}
|
|
- String personalSeal = personList.get(0).getUrl().substring("/profile".length());
|
|
|
|
- processDetailDrawing.setProducerId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
|
- processDetailDrawing.setProducer(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
|
- String url = "";
|
|
|
|
- url = processDetailDrawing.getUrl();
|
|
|
|
- url = url.substring("/profile".length());
|
|
|
|
-
|
|
|
|
-// processDetailDrawing.setMarkD(id.getMarkD());
|
|
|
|
-// processDetailDrawing.setIdentification(id.getIdentification());
|
|
|
|
- processDetailDrawing.setDrawingName(id.getDrawingName());
|
|
|
|
- processDetailDrawing.setPattern("替换产品");
|
|
|
|
- processDetailDrawing.setProducerId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
|
- processDetailDrawing.setProducer(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
|
- processDetailDrawing.setProductId(id.getProductId());
|
|
|
|
- processDetailDrawing.setProcessCode(id.getProcessCode());
|
|
|
|
- processDetailDrawing.setProductVersion(id.getProductVersion());
|
|
|
|
- PdfUtils.reSized(filePath + url,filePath +url.substring(0, url.length()-4) + "制作" + url.substring(url.length()-4),100,"height");
|
|
|
|
- addText(filePath +url.substring(0, url.length()-4) + "制作" + url.substring(url.length()-4),filePath+url.substring(0, url.length()-4) + "制作人" + url.substring(url.length()-4),"制定人:",550,75,12,270);
|
|
|
|
- addImage(filePath+url.substring(0, url.length()-4) + "制作人" + url.substring(url.length()-4),filePath+url.substring(0, url.length()-4) + "制作完成" + url.substring(url.length()-4),filePath+personalSeal,530,30,45,15,270,1);
|
|
|
|
- processDetailDrawing.setUrl("/profile/"+url.substring(0, url.length()-4) + "制作完成" + url.substring(url.length()-4));
|
|
|
|
|
|
|
|
- return toAjax(bizTechnologicalProcessDetailDrawingService.save(processDetailDrawing));
|
|
|
|
|
|
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -518,26 +425,10 @@ public String getPublicSeal(String code) {
|
|
@Transactional
|
|
@Transactional
|
|
public AjaxResult edit(@RequestBody BizTechnologicalProcessDetailDrawing processDetailDrawing) throws NoSuchFieldException, IllegalAccessException
|
|
public AjaxResult edit(@RequestBody BizTechnologicalProcessDetailDrawing processDetailDrawing) throws NoSuchFieldException, IllegalAccessException
|
|
{
|
|
{
|
|
- BizTechnologicalProcessDetailDrawing bizTechnologicalProcessDetailDrawing = bizTechnologicalProcessDetailDrawingService.query().eq("id", processDetailDrawing.getId()).one();
|
|
|
|
- //进行保存操作记录
|
|
|
|
- BizTechnologicalProcessDetailDrawingRecords drawingRecords = new BizTechnologicalProcessDetailDrawingRecords();
|
|
|
|
- drawingRecords.setTechnologicalProcessDetailDrawingId(bizTechnologicalProcessDetailDrawing.getId());
|
|
|
|
- drawingRecords.setProcessCode(bizTechnologicalProcessDetailDrawing.getProcessCode());
|
|
|
|
- drawingRecords.setProductId(bizTechnologicalProcessDetailDrawing.getProductId());
|
|
|
|
- drawingRecords.setProductVersion(bizTechnologicalProcessDetailDrawing.getProductVersion());
|
|
|
|
- drawingRecords.setUserId(SecurityUtils.getUserId());
|
|
|
|
- drawingRecords.setType("覆盖");
|
|
|
|
- drawingRecords.setDrawingName(bizTechnologicalProcessDetailDrawing.getDrawingName());
|
|
|
|
- bizTechnologicalProcessDetailDrawingRecordsService.save(drawingRecords);
|
|
|
|
- //覆盖操作
|
|
|
|
- BizTechnologicalProcessDetailDrawing item = new BizTechnologicalProcessDetailDrawing();
|
|
|
|
- item.setUrl(processDetailDrawing.getUrl());
|
|
|
|
- item.setTechnologicalProcessDetailId(bizTechnologicalProcessDetailDrawing.getTechnologicalProcessDetailId());
|
|
|
|
- item.setDrawingName(bizTechnologicalProcessDetailDrawing.getDrawingName());
|
|
|
|
- bizTechnologicalProcessDetailDrawingService.removeById(bizTechnologicalProcessDetailDrawing.getId());
|
|
|
|
|
|
|
|
|
|
|
|
- return toAjax(bizTechnologicalProcessDetailDrawingService.save(item));
|
|
|
|
|
|
+
|
|
|
|
+ return toAjax(bizTechnologicalProcessDetailDrawingService.edit(processDetailDrawing));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -623,43 +514,6 @@ public String getPublicSeal(String code) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
|
- * 放置图片
|
|
|
|
- * @param srcPath
|
|
|
|
- * @param resultPath
|
|
|
|
- * @param imgPath
|
|
|
|
- * @param x
|
|
|
|
- * @param y
|
|
|
|
- * @param width
|
|
|
|
- * @param height
|
|
|
|
- * @param rotation
|
|
|
|
- * @throws DocumentException
|
|
|
|
- * @throws IOException
|
|
|
|
- */
|
|
|
|
- public void addImage(String srcPath,String resultPath,String imgPath,Integer x,Integer y,Integer width,Integer height,Integer rotation,float opacity) throws DocumentException, IOException {
|
|
|
|
- ByteArrayOutputStream bos = PdfUtils.addImage(srcPath, imgPath, x, y, width, height,rotation, opacity);
|
|
|
|
- FileOutputStream out = new FileOutputStream(resultPath);
|
|
|
|
- out.write(bos.toByteArray());
|
|
|
|
- out.close();
|
|
|
|
- }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
- * 放置文字
|
|
|
|
- * @param srcPath
|
|
|
|
- * @param resultPath
|
|
|
|
- * @param text
|
|
|
|
- * @param x
|
|
|
|
- * @param y
|
|
|
|
- * @param fontSize
|
|
|
|
- * @param rotation
|
|
|
|
- * @throws DocumentException
|
|
|
|
- * @throws IOException
|
|
|
|
- */
|
|
|
|
- public void addText(String srcPath,String resultPath,String text,Integer x,Integer y,Integer fontSize,Integer rotation) throws DocumentException, IOException {
|
|
|
|
- ByteArrayOutputStream bos = PdfUtils.addText(srcPath, text, fontSize,x, y,rotation);
|
|
|
|
- FileOutputStream out = new FileOutputStream(resultPath);
|
|
|
|
- out.write(bos.toByteArray());
|
|
|
|
- out.close();
|
|
|
|
- }
|
|
|
|
|
|
|
|
}
|
|
}
|