From 0a68d1ae4a7e797342cf039a757fae4fc357faef Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期四, 07 八月 2025 08:46:07 +0800
Subject: [PATCH] zjh202500807
---
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjXdPictureController.java | 265 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 260 insertions(+), 5 deletions(-)
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjXdPictureController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjXdPictureController.java
index 78d6b3e..b8545f3 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjXdPictureController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjXdPictureController.java
@@ -1,24 +1,40 @@
package com.ltkj.web.controller.system;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
+import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ltkj.common.core.domain.entity.SysUser;
import com.ltkj.common.core.redis.RedisCache;
+import com.ltkj.common.utils.SecurityUtils;
+import com.ltkj.common.utils.file.FileUploadUtils;
+import com.ltkj.db.DataSourceContextHolder;
import com.ltkj.framework.config.MatchUtils;
import com.ltkj.hosp.domain.*;
import com.ltkj.hosp.service.*;
+import com.ltkj.hosp.sqlDomain.LtkjExamJcbgd;
+import com.ltkj.hosp.vodomain.CsProVo;
import com.ltkj.system.service.ISysConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
+import jodd.util.StringUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.*;
import com.ltkj.common.annotation.Log;
import com.ltkj.common.core.controller.BaseController;
@@ -36,6 +52,7 @@
@RestController
@RequestMapping("/picture/picture")
@Api(tags = "浣撴蹇冪數鍥剧鐞�")
+@Slf4j
public class TjXdPictureController extends BaseController {
@Resource
private ITjXdPictureService tjXdPictureService;
@@ -51,7 +68,16 @@
private ITjOrderRemarkService remarkService;
@Resource
private ITjProjectService projectService;
-
+ @Resource
+ private TjXdtgmdjgService xdtgmdjgService;
+ @Resource
+ private LtkjExamJcbgdService jcbgdService;
+ @Resource
+ private LtkjExamJcsqdService jcsqdService;
+ @Autowired
+ private TjJcycxmService jcycxmService;
+ @Autowired
+ private SysConfigController configController;
/**
* 鏌ヨ浣撴蹇冪數鍥剧鐞嗗垪琛�
*/
@@ -189,4 +215,233 @@
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(tjXdPictureService.deleteTjXdPictureByIds(ids));
}
+
+
+
+
+ @GetMapping ("/getYxJcList")
+ @ApiOperation (value = "褰卞儚妫�鏌ュ垪琛�(楠ㄥ瘑搴﹀拰蹇冪數鍥�)")//0寰�1宸�
+ @Transactional
+ public AjaxResult getYxJcList(@ApiParam (value = "瀹℃牳鐘舵�� 0寰呭鏍� 1宸插鏍�") @RequestParam Integer checkStatus,
+ @ApiParam (value = "椤电爜鏁�(榛樿1)") @RequestParam (defaultValue = "1") Integer page,
+ @ApiParam (value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam (defaultValue = "10") Integer pageSize,
+ @ApiParam (value = "浣撴鍗曞彿") @RequestParam (required = false) String tjNumber,
+ @ApiParam (value = "鍗曚綅") @RequestParam (required = false) Long compId,
+ @ApiParam (value = "濮撳悕)") @RequestParam (required = false) String name,
+ @ApiParam (value = "濂楅鍚�)") @RequestParam (required = false) String tcm,
+ @ApiParam (value = "寮�濮嬫椂闂�") @RequestParam (required = false) String beginTime,
+ @ApiParam (value = "缁撴潫鏃堕棿") @RequestParam (required = false) String endTime) {
+
+ Long deptId = SecurityUtils.getDeptId();
+ log.info("褰卞儚妫�鏌ュ垪琛�(楠ㄥ瘑搴﹀拰蹇冪數鍥�)鎺ュ彛 褰撳墠鐧诲綍浜虹瀹�"+deptId);
+ String value = String.valueOf(compId);
+ if (tjNumber == null) tjNumber = "";
+ if (compId == null) value = "";
+ if (name == null) name = "";
+ if (beginTime == null) beginTime = "";
+ if (endTime == null) endTime = "";
+ if (tcm == null) tcm = "";
+ return AjaxResult.success(orderService.getYxJcList(checkStatus,tjNumber, page, pageSize, value, beginTime, endTime, name,tcm,deptId.toString()));
+ }
+
+ @GetMapping ("/getYxJcXx")
+ @ApiOperation (value = "褰卞儚妫�鏌ラ瀵嗗害蹇冪數鍥鹃〉闈㈢偣鍑讳綋妫�浜哄憳灞曠ず浣撴椤圭洰鎺ュ彛")
+ public AjaxResult getYxJcXx(@ApiParam (value = "浣撴鍙�") @RequestParam String tjNumber) {
+ Long deptId = SecurityUtils.getDeptId();
+ log.info("褰卞儚妫�鏌ラ瀵嗗害蹇冪數鍥鹃〉闈㈢偣鍑讳綋妫�浜哄憳灞曠ず浣撴椤圭洰鎺ュ彛褰撳墠鐧诲綍浜虹瀹�"+deptId);
+ List<CsProVo> list = remarkService.getYxJcXx(tjNumber,deptId.toString());
+ if(null !=list && !list.isEmpty()){
+ for (CsProVo vo : list) {
+ LambdaQueryWrapper<TjXdtgmdjg> wq=new LambdaQueryWrapper<>();
+ wq.eq(TjXdtgmdjg::getTjh,tjNumber);
+ wq.eq(TjXdtgmdjg::getProId,vo.getProId().toString());
+ TjXdtgmdjg xdtgmdjg = xdtgmdjgService.getOne(wq);
+ if(null !=xdtgmdjg){
+ if(StringUtil.isNotBlank(xdtgmdjg.getUrl())){
+ Path path = Paths.get(xdtgmdjg.getUrl());
+ byte[] data = null;
+ try {
+ data = Files.readAllBytes(path);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ String base64 = Base64.getEncoder().encodeToString(data);
+ if(StringUtil.isNotBlank(base64)) vo.setImageUrl(base64);
+ }
+ }
+ }
+
+ }
+ return AjaxResult.success(list);
+ }
+
+ @GetMapping ("/addYxJcXx")
+ @ApiOperation (value = "鎻愪氦褰卞儚妫�鏌ラ瀵嗗害蹇冪數鍥剧粨鏋滄帴鍙�")
+ @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
+ public AjaxResult addYxJcXx(@ApiParam (value = "浣撴鍙�") @RequestParam String tjNumber,
+ @ApiParam (value = "椤圭洰id") @RequestParam String proId,
+ @ApiParam (value = "妫�鏌ユ墍瑙�") @RequestParam String jcsj,
+ @ApiParam (value = "妫�鏌ョ粨璁�") @RequestParam String jcjl,
+ @ApiParam (value = "鍥剧墖鍦板潃") @RequestParam(required = false) String url) {
+ try {
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ TjOrder order = orderService.getOrderByTjNum(tjNumber);
+ if(null !=order){
+ TjProject project = projectService.getById(proId);
+ if(null !=project){
+ List<TjProject> projects = projectService.getTjProjectListBySoneId(proId);
+ LambdaQueryWrapper<TjOrderDetail>wq1=new LambdaQueryWrapper<>();
+ wq1.eq(TjOrderDetail::getProId,projects.get(0).getProParentId());
+ wq1.eq(TjOrderDetail::getOrderId,order.getOrderId());
+ TjOrderDetail detail = detailService.getOne(wq1);
+ if(null !=detail){
+ detail.setProResult(jcjl+"銆�"+jcsj);
+ detail.setTjStatus(1L);
+ detailService.updateById(detail);
+ LambdaQueryWrapper<TjOrderRemark>wq2=new LambdaQueryWrapper<>();
+ wq2.eq(TjOrderRemark::getProId,proId);
+ wq2.eq(TjOrderRemark::getTjNumber,tjNumber);
+ TjOrderRemark orderRemark = remarkService.getOne(wq2);
+ if(null !=orderRemark){
+ orderRemark.setType(1);
+ remarkService.updateById(orderRemark);
+ xdtgmdjgService.deletedByTJhAndProId(tjNumber, proId);
+ TjXdtgmdjg xdtgmdjg=new TjXdtgmdjg();
+ xdtgmdjg.setTjh(tjNumber);
+ xdtgmdjg.setCardId(order.getCardId());
+ xdtgmdjg.setProId(proId);
+ xdtgmdjg.setProName(project.getProName());
+ xdtgmdjg.setJcsj(jcsj);
+ xdtgmdjg.setJcjl(jcjl);
+ xdtgmdjg.setCreateBy(user.getNickName());
+ xdtgmdjg.setCreateId(user.getUserId().toString());
+ if(StringUtil.isNotBlank(url)) xdtgmdjg.setUrl(url);
+ xdtgmdjgService.save(xdtgmdjg);
+ saveTjXdtgmdjgByJcbgd(xdtgmdjg);
+ }
+ }
+ }
+ return AjaxResult.success();
+ }
+ return AjaxResult.error("鏆傛棤浣撴璁板綍");
+ } catch (Exception e) {
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ log.error("鎻愪氦褰卞儚妫�鏌ラ瀵嗗害蹇冪數鍥剧粨鏋滄帴鍙�"+e.getMessage());
+ throw new RuntimeException("鎻愪氦褰卞儚妫�鏌ラ瀵嗗害蹇冪數鍥剧粨鏋滄帴鍙�");
+ }
+ }
+ @Transactional(propagation = Propagation.REQUIRED) // 鍏变韩浜嬪姟
+ public void saveTjXdtgmdjgByJcbgd(TjXdtgmdjg xdtgmdjg) {
+ try {
+ int length = xdtgmdjg.getProId().length();
+ // 纭繚瀛楃涓查暱搴﹁嚦灏戜负6
+ String last6 = length >= 6 ? xdtgmdjg.getProId().substring(length - 6) : xdtgmdjg.getProId();
+ Date date = new Date();
+ LtkjExamJcbgd jcbgd=new LtkjExamJcbgd();
+ jcsqdService.deletedLtkjJcsqdByTjhandtmh(xdtgmdjg.getCardId(),xdtgmdjg.getTjh()+last6);
+ jcbgdService.deletedLtkjJcbgdByTjhandtmh(xdtgmdjg.getCardId(),xdtgmdjg.getTjh()+last6);
+ jcbgd.setTjh(xdtgmdjg.getCardId());
+ jcbgd.setTmh(xdtgmdjg.getTjh()+last6);
+ jcbgd.setXmdm(xdtgmdjg.getProId());
+ jcbgd.setXmmc(xdtgmdjg.getProName());
+ jcbgd.setBgNr(xdtgmdjg.getJcsj());
+ if(StringUtil.isNotBlank(xdtgmdjg.getUrl())){
+ jcbgd.setBgUrl(xdtgmdjg.getUrl());
+ }else {
+ jcbgd.setBgUrl("");
+ }
+ jcbgd.setShysxm(xdtgmdjg.getCreateBy());
+ jcbgd.setShysdm(xdtgmdjg.getCreateId());
+ jcbgd.setYxzd(xdtgmdjg.getJcjl());
+ jcbgd.setYxbx(xdtgmdjg.getJcjl());
+ jcbgd.setZdsj(DateUtil.format(date,"yyyy-MM-dd"));
+ jcbgd.setJcbw("");
+ jcbgd.setLx("1");
+ jcbgd.setSqsj(DateUtil.format(date,"yyyy-MM-dd"));
+ jcbgd.setCreateTime(date);
+ jcbgdService.save(jcbgd);
+ jcsqdService.saveXdtLtkjExamJcsqd(xdtgmdjg.getCardId(),jcbgd.getTmh());
+
+ LambdaQueryWrapper<TjJcycxm> wq=new LambdaQueryWrapper<>();
+ wq.eq(TjJcycxm::getTjh,xdtgmdjg.getTjh());
+ wq.eq(TjJcycxm::getProId,xdtgmdjg.getProId());
+ jcycxmService.remove(wq);
+ if(StringUtil.isNotBlank(xdtgmdjg.getJcjl())){
+ String regex = configService.selectConfigByKey("jcycxmzz");
+ if(StringUtil.isBlank(regex)) regex= "銆倈锛泑;|,|锛�";
+ String[] split = xdtgmdjg.getJcjl().replaceAll("\n", "").split(regex);
+// String[] split = xdtgmdjg.getJcjl().replaceAll("\n", "").split("銆倈锛泑;|,|锛�");
+ for (String jg : split) {
+ if(StringUtil.isNotBlank(jg)){
+ boolean b = configController.apiJcycpdgjz(jg);
+ if(!b){
+ TjJcycxm jcycxm=new TjJcycxm();
+ jcycxm.setTjh(xdtgmdjg.getTjh());
+ jcycxm.setYqid("");
+ jcycxm.setProId(xdtgmdjg.getProId());
+ jcycxm.setProName(xdtgmdjg.getProName());
+ jcycxm.setCreateTime(new Date());
+ jcycxm.setJcjg(jg);
+ jcycxmService.save(jcycxm);
+ }
+ }
+ /* if(StringUtil.isNotBlank(jg) && !jg.contains("鏈寮傚父")
+ && !jg.contains("鏈鏄庢樉寮傚父") && !jg.contains("鏈鍗犱綅") && !jg.contains("鏈")
+ && !jg.contains("鏈鏄庢樉")&& !jg.contains("姝e父")&& !jg.contains("鍙屼晶妞庨棿瀛旀棤鐙獎")){
+ TjJcycxm jcycxm=new TjJcycxm();
+ jcycxm.setTjh(xdtgmdjg.getTjh());
+ jcycxm.setYqid("");
+ jcycxm.setProId(xdtgmdjg.getProId());
+ jcycxm.setProName(xdtgmdjg.getProName());
+ jcycxm.setCreateTime(new Date());
+ jcycxm.setJcjg(jg);
+ jcycxmService.save(jcycxm);
+ }*/
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ @GetMapping ("/getYxJcXxJg")
+ @ApiOperation (value = "鑾峰彇褰卞儚妫�鏌ラ瀵嗗害蹇冪數鍥剧粨鏋滄帴鍙�")
+ @Transactional
+ public AjaxResult getYxJcXxJg(@ApiParam (value = "浣撴鍙�") @RequestParam String tjNumber,
+ @ApiParam (value = "椤圭洰id") @RequestParam String proId) {
+ TjOrder order = orderService.getOrderByTjNum(tjNumber);
+ if(null !=order){
+ LambdaQueryWrapper<TjXdtgmdjg> wq=new LambdaQueryWrapper<>();
+ wq.eq(TjXdtgmdjg::getTjh,tjNumber);
+ wq.eq(TjXdtgmdjg::getProId,proId);
+ TjXdtgmdjg xdtgmdjg = xdtgmdjgService.getOne(wq);
+ Map<String,Object>map=new HashMap<>();
+ if(null !=xdtgmdjg ){
+ map.put("jcsj",xdtgmdjg.getJcsj());
+ map.put("jcjl",xdtgmdjg.getJcjl());
+ if(StringUtil.isNotBlank(xdtgmdjg.getUrl())){
+ Path path = Paths.get(xdtgmdjg.getUrl());
+ byte[] data = null;
+ try {
+ data = Files.readAllBytes(path);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ String base64 = Base64.getEncoder().encodeToString(data);
+ map.put("tp",base64);
+ }else {
+ map.put("tp",null);
+ }
+ return AjaxResult.success(map);
+ }else {
+ TjProject tjProject = projectService.getById(proId);
+ map.put("jcsj","");
+ map.put("jcjl",tjProject.getProDefault()==null ? "":tjProject.getProDefault());
+ map.put("tp",null);
+ }
+ return AjaxResult.success(map);
+ }
+ return AjaxResult.error("鏆傛棤浣撴璁板綍");
+ }
}
--
Gitblit v1.8.0