From 1490df4f27fb6c42dbc4fad21c6f55f794eb1542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=8A?= <23> Date: Sun, 16 Aug 2026 10:59:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application-tenant/tenant-admin/pom.xml | 13 +- .../tenant/controller/DocxTemplateController.java | 141 ----------- .../upms/controller/DocxTemplateController.java | 260 +++++++++++++++++++++ .../upms/controller/LoginController.java | 46 ++++ .../upms/service/SupersetSsoService.java | 121 ++++++++++ .../src/main/resources/application-config.yml | 5 + common/common-association/pom.xml | 9 +- .../association/controller/HomeController.java | 2 +- .../plugin/active/ActivityInfoDetailsPlugin.java | 35 ++- .../active/ActivityInvitationSavePlugin.java | 48 ++++ .../member/MembershipApplyListFilterPlugin.java | 153 +++++++++++- .../member/MembershipBenefitsUpdatePlugin.java | 48 ++++ .../plugin/member/MembershipFeePayPlugin.java | 5 + .../plugin/member/MembershipPayPopupPlugin.java | 4 - .../plugin/member/MembershipSavePlugin.java | 9 +- .../member/UnitNameChangeFormInitPlugin.java | 4 + .../plugin/member/UnitNameChangePopupPlugin.java | 128 ---------- common/common-qy/pom.xml | 5 +- 18 files changed, 738 insertions(+), 298 deletions(-) delete mode 100644 application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/tenant/controller/DocxTemplateController.java create mode 100644 application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/controller/DocxTemplateController.java create mode 100644 application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/service/SupersetSsoService.java create mode 100644 common/common-association/src/main/java/apelet/association/plugin/active/ActivityInvitationSavePlugin.java create mode 100644 common/common-association/src/main/java/apelet/association/plugin/member/MembershipBenefitsUpdatePlugin.java diff --git a/application-tenant/tenant-admin/pom.xml b/application-tenant/tenant-admin/pom.xml index 9c94759..867b72e 100644 --- a/application-tenant/tenant-admin/pom.xml +++ b/application-tenant/tenant-admin/pom.xml @@ -141,7 +141,7 @@ apelet common-flow-online - 1.0.0 + 1.0.2 apelet @@ -174,6 +174,17 @@ 1.0.0 + + org.docx4j + docx4j-JAXB-ReferenceImpl + 8.3.9 + + + org.docx4j + docx4j-export-fo + 8.3.9 + + diff --git a/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/tenant/controller/DocxTemplateController.java b/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/tenant/controller/DocxTemplateController.java deleted file mode 100644 index 1c3af35..0000000 --- a/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/tenant/controller/DocxTemplateController.java +++ /dev/null @@ -1,141 +0,0 @@ - -package apelet.tenantadmin.tenant.controller; - -import apelet.common.core.annotation.MyRequestBody; -import apelet.common.core.exception.MyRuntimeException; -import apelet.common.core.object.ObjectValue; -import apelet.common.generator.utils.OrmGenDataSourceUtil; -import cn.hutool.core.io.IoUtil; -import org.apache.poi.xwpf.usermodel.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.io.ClassPathResource; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import java.io.*; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -@RestController -@RequestMapping("/api/template") -public class DocxTemplateController { - - - @Autowired - private OrmGenDataSourceUtil ormGenDataSourceUtil; - - private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("\\$\\{(.+?)\\}"); - - /** - * 替换字符串中 ${key},JDK8兼容 - */ - private String replaceContent(String text, Map dataMap) { - if (text == null) return ""; - Matcher matcher = PLACEHOLDER_PATTERN.matcher(text); - StringBuffer sb = new StringBuffer(); - while (matcher.find()) { - String key = matcher.group(1).trim(); - Object val = dataMap.get(key); - String realVal = val == null ? "" : val.toString(); - matcher.appendReplacement(sb, Matcher.quoteReplacement(realVal)); - } - matcher.appendTail(sb); - return sb.toString(); - } - - @GetMapping("/downloadDocx") - public void downloadDocx(@RequestParam("id") String quotationId, HttpServletResponse response) { - XWPFDocument document = null; - InputStream templateIs = null; - OutputStream out = null; - try { - // 1. 查数据 - ObjectValue objectValue = ormGenDataSourceUtil.queryOne("quotation", quotationId); - Map hashMap = new HashMap<>(); - hashMap.put("name", objectValue.getString("name")); - hashMap.put("number", objectValue.getString("number")); - hashMap.put("create_time", objectValue.getString("create_time")); - hashMap.put("qty", objectValue.getObjectValue("qty")); - ObjectValue managerperson = objectValue.getObjectValue("managerperson"); - if(managerperson != null){ - managerperson = ormGenDataSourceUtil.queryOne(managerperson.getTableName(), managerperson.getString("id")); - hashMap.put("managerperson",1); - } - // 2. 读模板 - File file = new File("D:\\work\\xykj-project\\xhgl\\zz-resource\\quotation_template.docx"); - templateIs = new FileInputStream(file); - document = new XWPFDocument(templateIs); - // 3. 替换占位符 - replaceParagraph(document, hashMap); - replaceTable(document, hashMap); - // 4. 设置响应头 —— 关键! - response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); - response.setCharacterEncoding("UTF-8"); - String fileName = URLEncoder.encode("报价单.docx", StandardCharsets.UTF_8.name()) - .replaceAll("\\+", "%20"); - // 兼容各浏览器的文件名写法 - response.setHeader("Content-Disposition", - "attachment; filename=\"" + fileName + "\"; filename*=UTF-8''" + fileName); - response.setHeader("Pragma", "no-cache"); - response.setHeader("Cache-Control", "no-cache"); - response.setDateHeader("Expires", 0); - // 5. 写出 - out = response.getOutputStream(); - document.write(out); - out.flush(); - } catch (Exception e) { - e.printStackTrace(); - throw new MyRuntimeException("导出失败: " + e.getMessage()); - } finally { - IoUtil.close(document); - IoUtil.close(templateIs); - IoUtil.close(out); - } - } - - - - - private void replaceParagraph(XWPFDocument document, Map dataMap) { - for (XWPFParagraph paragraph : document.getParagraphs()) { - String text = paragraph.getText(); - Matcher matcher = PLACEHOLDER_PATTERN.matcher(text); - if (!matcher.find()) { - continue; - } - //清空原有run - for (XWPFRun run : paragraph.getRuns()) { - run.setText("", 0); - } - String newText = replaceContent(text, dataMap); - paragraph.createRun().setText(newText); - } - } - - private void replaceTable(XWPFDocument document, Map dataMap) { - for (XWPFTable table : document.getTables()) { - for (XWPFTableRow row : table.getRows()) { - for (XWPFTableCell cell : row.getTableCells()) { - for (XWPFParagraph paragraph : cell.getParagraphs()) { - String text = paragraph.getText(); - Matcher matcher = PLACEHOLDER_PATTERN.matcher(text); - if (!matcher.find()) { - continue; - } - for (XWPFRun run : paragraph.getRuns()) { - run.setText("", 0); - } - String newText = replaceContent(text, dataMap); - paragraph.createRun().setText(newText); - } - } - } - } - } - - -} diff --git a/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/controller/DocxTemplateController.java b/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/controller/DocxTemplateController.java new file mode 100644 index 0000000..e9659fe --- /dev/null +++ b/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/controller/DocxTemplateController.java @@ -0,0 +1,260 @@ +package apelet.tenantadmin.upms.controller; + +import apelet.common.core.exception.MyRuntimeException; +import apelet.common.core.object.ObjectValue; +import apelet.common.core.object.TokenData; +import apelet.common.generator.utils.OrmGenDataSourceUtil; +import apelet.common.online.service.OnlineDictService; +import cn.hutool.core.io.IoUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.apache.poi.xwpf.usermodel.*; +import org.docx4j.Docx4J; +import org.docx4j.openpackaging.packages.WordprocessingMLPackage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +@RestController +@RequestMapping("/api/template") +public class DocxTemplateController { + + @Autowired + private OrmGenDataSourceUtil ormGenDataSourceUtil; + @Autowired + private OnlineDictService onlineDictService; + + private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("#\\{(.+?)\\}"); + + private String replaceContent(String text, Map dataMap) { + if (text == null) return ""; + Matcher matcher = PLACEHOLDER_PATTERN.matcher(text); + StringBuffer sb = new StringBuffer(); + while (matcher.find()) { + String key = matcher.group(1).trim(); + if ("personimage".equals(key)) { + matcher.appendReplacement(sb, Matcher.quoteReplacement(matcher.group(0))); + continue; + } + Object val = dataMap.get(key); + String realVal = val == null ? "" : val.toString(); + matcher.appendReplacement(sb, Matcher.quoteReplacement(realVal)); + } + matcher.appendTail(sb); + return sb.toString(); + } + + + @GetMapping("/downloadDocx") + public void downloadDocx(@RequestParam("id") String quotationId, @RequestParam("userId") String userId, HttpServletResponse response) { + XWPFDocument document = null; + InputStream templateIs = null; + OutputStream out = null; + ByteArrayOutputStream pdfOut = null; + try { + // 1. 查数据 + ObjectValue objectValue = ormGenDataSourceUtil.queryOne("quotation", quotationId); + ObjectValue user = ormGenDataSourceUtil.queryOne("xy_sys_user", userId); + Map dictMap = onlineDictService.getDictMap(2052225870772310016L); + Map hashMap = new HashMap<>(); + hashMap.put("name", objectValue.getString("name")); + hashMap.put("type", dictMap.get(String.valueOf(objectValue.get("type", "")))); + hashMap.put("number", objectValue.getString("number")); + hashMap.put("create_time", objectValue.getString("create_time")); + hashMap.put("qty", objectValue.getString("qty")); + + String signatureImage = user.getString("signature_image"); + String imageUrl = getUrl(signatureImage); + byte[] imageBytes = null; + if (StringUtils.isNotEmpty(imageUrl)) { + imageBytes = downloadImage(imageUrl); + } + ObjectValue managerperson = objectValue.getObjectValue("managerperson"); + if (managerperson != null) { + managerperson = ormGenDataSourceUtil.queryOne(managerperson.getTableName(), managerperson.getString("id")); + hashMap.put("managerperson", managerperson.getString("show_name")); + } + // 2. 读模板 + String savePath = System.getProperty("user.dir") + "\\zz-resource\\"; + File file = new File(savePath + "quotation_template.docx"); + templateIs = Files.newInputStream(file.toPath()); + document = new XWPFDocument(templateIs); + // 3. 替换文本占位符 + replaceParagraph(document, hashMap); + replaceTable(document, hashMap); + // 4. 替换图片占位符 + replaceImageInParagraphs(document, "personimage", imageBytes, 100, 100); + replaceImageInTables(document, "personimage", imageBytes, 100, 100); + // 5. 将填充后的 DOCX 转为 PDF(使用 docx4j) + ByteArrayOutputStream docxOut = new ByteArrayOutputStream(); + document.write(docxOut); + byte[] docxBytes = docxOut.toByteArray(); + docxOut.close(); + + WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new ByteArrayInputStream(docxBytes)); + pdfOut = new ByteArrayOutputStream(); + Docx4J.toPDF(wordMLPackage, pdfOut); + byte[] pdfBytes = pdfOut.toByteArray(); + + // 6. 设置响应头 + response.setContentType("application/pdf"); + response.setCharacterEncoding("UTF-8"); + String fileName = URLEncoder.encode("报价单.pdf", StandardCharsets.UTF_8.name()) + .replaceAll("\\+", "%20"); + response.setHeader("Content-Disposition", + "attachment; filename=\"" + fileName + "\"; filename*=UTF-8''" + fileName); + response.setHeader("Pragma", "no-cache"); + response.setHeader("Cache-Control", "no-cache"); + response.setDateHeader("Expires", 0); + // 7. 写出 PDF + out = response.getOutputStream(); + out.write(pdfBytes); + out.flush(); + } catch (Exception e) { + e.printStackTrace(); + throw new MyRuntimeException("导出失败: " + e.getMessage()); + } finally { + IoUtil.close(pdfOut); + IoUtil.close(document); + IoUtil.close(templateIs); + IoUtil.close(out); + } + } + + + String getUrl(String signatureImage) { + if (StringUtils.isEmpty(signatureImage)) { + return ""; + } + JSONArray jsonArray = JSON.parseArray(signatureImage); + if (jsonArray.isEmpty()) { + return ""; + } + JSONObject jsonObject = jsonArray.getJSONObject(0); + String baseUrl = jsonObject.getString("baseUrl"); + String uploadPath = jsonObject.getString("uploadPath"); + String filename = jsonObject.getString("filename"); + + return baseUrl + "/" + uploadPath + "/" + filename; + } + + private void replaceParagraph(XWPFDocument document, Map dataMap) { + for (XWPFParagraph paragraph : document.getParagraphs()) { + String text = paragraph.getText(); + Matcher matcher = PLACEHOLDER_PATTERN.matcher(text); + if (!matcher.find()) { + continue; + } + for (XWPFRun run : paragraph.getRuns()) { + run.setText("", 0); + } + String newText = replaceContent(text, dataMap); + paragraph.createRun().setText(newText); + } + } + + private void replaceTable(XWPFDocument document, Map dataMap) { + for (XWPFTable table : document.getTables()) { + for (XWPFTableRow row : table.getRows()) { + for (XWPFTableCell cell : row.getTableCells()) { + for (XWPFParagraph paragraph : cell.getParagraphs()) { + String text = paragraph.getText(); + Matcher matcher = PLACEHOLDER_PATTERN.matcher(text); + if (!matcher.find()) { + continue; + } + for (XWPFRun run : paragraph.getRuns()) { + run.setText("", 0); + } + String newText = replaceContent(text, dataMap); + paragraph.createRun().setText(newText); + } + } + } + } + } + + private byte[] downloadImage(String imageUrl) throws IOException { + URL url = new URL(imageUrl); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("GET"); + conn.setConnectTimeout(5000); + conn.setReadTimeout(10000); + InputStream is = conn.getInputStream(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + byte[] buffer = new byte[4096]; + int len; + while ((len = is.read(buffer)) != -1) { + baos.write(buffer, 0, len); + } + IoUtil.close(is); + return baos.toByteArray(); + } + + + + private void replaceImageInParagraphs(XWPFDocument document, String placeholderKey, byte[] imageBytes, int width, int height) throws IOException, InvalidFormatException { + String placeholder = "#{" + placeholderKey + "}"; + for (XWPFParagraph paragraph : document.getParagraphs()) { + String text = paragraph.getText(); + if (text != null && text.contains(placeholder)) { + List runs = paragraph.getRuns(); + for (int i = runs.size() - 1; i >= 0; i--) { + XWPFRun run = runs.get(i); + String runText = run.getText(0); + if (runText != null && runText.contains(placeholder)) { + run.setText("", 0); + if (imageBytes != null) { + run.addPicture(new ByteArrayInputStream(imageBytes), XWPFDocument.PICTURE_TYPE_PNG, placeholderKey + ".png", + width * 9525, height * 9525); + } + } + } + } + } + } + + private void replaceImageInTables(XWPFDocument document, String placeholderKey, byte[] imageBytes, int width, int height) throws IOException, InvalidFormatException { + String placeholder = "#{" + placeholderKey + "}"; + for (XWPFTable table : document.getTables()) { + for (XWPFTableRow row : table.getRows()) { + for (XWPFTableCell cell : row.getTableCells()) { + for (XWPFParagraph paragraph : cell.getParagraphs()) { + String text = paragraph.getText(); + if (text != null && text.contains(placeholder)) { + List runs = paragraph.getRuns(); + for (int i = runs.size() - 1; i >= 0; i--) { + XWPFRun run = runs.get(i); + String runText = run.getText(0); + if (runText != null && runText.contains(placeholder)) { + run.setText("", 0); + if (imageBytes != null) { + run.addPicture(new ByteArrayInputStream(imageBytes), XWPFDocument.PICTURE_TYPE_PNG, placeholderKey + ".png", + width * 9525, height * 9525); + } + } + } + } + } + } + } + } + } + +} \ No newline at end of file diff --git a/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/controller/LoginController.java b/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/controller/LoginController.java index 7387b36..c38e7ee 100644 --- a/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/controller/LoginController.java +++ b/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/controller/LoginController.java @@ -126,6 +126,10 @@ public class LoginController { private UpDownloaderFactory upDownloaderFactory; @Autowired private DataFilterProperties dataFilterProperties; + + @Autowired + private SupersetSsoService supersetSsoService; + @Value("${hubCloud.secret}") private String HubCloudSecret; @Value("${dingTalk.secret}") @@ -196,6 +200,48 @@ public class LoginController { return ResponseResult.success(myPageData); } + + + + @GetMapping("/getSupersetDashboardUrl") + public ResponseResult getSupersetDashboardUrl( + @RequestParam(name = "dashboardId") String dashboardId) { + try { + String accessToken = supersetSsoService.getAccessToken(); + JSONObject result = new JSONObject(); + result.put("accessToken", accessToken); + result.put("dashboardUrl", supersetSsoService.buildDashboardUrl(dashboardId)); + return ResponseResult.success(result); + } catch (Exception e) { + log.error("获取Superset仪表盘地址失败", e); + return ResponseResult.error("500", "获取Superset仪表盘地址失败: " + e.getMessage()); + } + } + + @GetMapping("/getSupersetGuestToken") + public ResponseResult getSupersetGuestToken( + @RequestParam(name = "dashboardId") String dashboardId, + @RequestParam(name = "username", required = false) String username, + @RequestParam(name = "firstName", required = false, defaultValue = "Guest") String firstName, + @RequestParam(name = "lastName", required = false, defaultValue = "User") String lastName) { + try { + TokenData tokenData = TokenData.takeFromRequest(); + if (StrUtil.isBlank(username)) { + username = tokenData != null ? tokenData.getLoginName() : "guest_user"; + } + String guestToken = supersetSsoService.getGuestToken( + dashboardId, username, firstName, lastName, null); + JSONObject result = new JSONObject(); + result.put("guestToken", guestToken); + result.put("embeddedUrl", supersetSsoService.buildEmbeddedDashboardUrl(dashboardId, guestToken)); + return ResponseResult.success(result); + } catch (Exception e) { + log.error("获取Superset Guest Token失败", e); + return ResponseResult.error("500", "获取Superset Guest Token失败: " + e.getMessage()); + } + } + + private BillData convertOvToBillData(ObjectValue objectValue) { BillData billData = new BillData(); diff --git a/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/service/SupersetSsoService.java b/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/service/SupersetSsoService.java new file mode 100644 index 0000000..b8a9e82 --- /dev/null +++ b/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/service/SupersetSsoService.java @@ -0,0 +1,121 @@ +package apelet.tenantadmin.upms.service; + +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; +import org.redisson.api.RBucket; +import org.redisson.api.RedissonClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +@Slf4j +@Service +public class SupersetSsoService { + + @Value("${superset.baseUrl}") + private String supersetBaseUrl; + + @Value("${superset.username}") + private String supersetUsername; + + @Value("${superset.password}") + private String supersetPassword; + + @Autowired + private RedissonClient redissonClient; + + private static final String SUPERSET_TOKEN_CACHE_KEY = "superset:access_token"; + private static final int TOKEN_CACHE_SECONDS = 3500; + + public String getAccessToken() { + RBucket cached = redissonClient.getBucket(SUPERSET_TOKEN_CACHE_KEY); + if (cached.isExists()) { + return cached.get(); + } + String url = supersetBaseUrl + "/api/v1/security/login"; + JSONObject payload = new JSONObject(); + payload.put("username", supersetUsername); + payload.put("password", supersetPassword); + payload.put("provider", "db"); + payload.put("refresh", true); + + HttpResponse response = HttpRequest.post(url) + .header("Content-Type", "application/json") + .body(payload.toJSONString()) + .timeout(10000) + .execute(); + + if (!response.isOk()) { + log.error("Superset login failed, status={}, body={}", response.getStatus(), response.body()); + throw new RuntimeException("Superset认证失败: " + response.body()); + } + + JSONObject result = JSON.parseObject(response.body()); + String accessToken = result.getString("access_token"); + + cached.set(accessToken, TOKEN_CACHE_SECONDS, TimeUnit.SECONDS); + log.info("Superset access token refreshed successfully."); + return accessToken; + } + + public String getGuestToken(String dashboardId, String username, String firstName, String lastName, + List> rlsRules) { + String accessToken = getAccessToken(); + + String url = supersetBaseUrl + "/api/v1/security/guest_token/"; + + JSONObject user = new JSONObject(); + user.put("username", username); + user.put("first_name", firstName); + user.put("last_name", lastName); + + List> resources = new ArrayList<>(); + Map resource = new HashMap<>(); + resource.put("type", "dashboard"); + resource.put("id", dashboardId); + resources.add(resource); + + JSONObject payload = new JSONObject(); + payload.put("user", user); + payload.put("resources", resources); + if (rlsRules != null && !rlsRules.isEmpty()) { + payload.put("rls", rlsRules); + } else { + payload.put("rls", new ArrayList<>()); + } + + HttpResponse response = HttpRequest.post(url) + .header("Content-Type", "application/json") + .header("Authorization", "Bearer " + accessToken) + .body(payload.toJSONString()) + .timeout(10000) + .execute(); + + if (!response.isOk()) { + log.error("Superset get guest token failed, status={}, body={}", response.getStatus(), response.body()); + redissonClient.getBucket(SUPERSET_TOKEN_CACHE_KEY).delete(); + throw new RuntimeException("获取Superset Guest Token失败: " + response.body()); + } + + JSONObject result = JSON.parseObject(response.body()); + return result.getString("token"); + } + + public String buildDashboardUrl(String dashboardId) { + String accessToken = getAccessToken(); + return supersetBaseUrl + "superset/dashboard/" + dashboardId + "/?token=" + accessToken; + } + + public String buildEmbeddedDashboardUrl(String dashboardId, String guestToken) { + return supersetBaseUrl + "superset/embed/dashboard/" + dashboardId + "/?guest_token=" + guestToken; + } +} \ No newline at end of file diff --git a/application-tenant/tenant-admin/src/main/resources/application-config.yml b/application-tenant/tenant-admin/src/main/resources/application-config.yml index b51ea11..3cd7ae6 100644 --- a/application-tenant/tenant-admin/src/main/resources/application-config.yml +++ b/application-tenant/tenant-admin/src/main/resources/application-config.yml @@ -159,3 +159,8 @@ common-redis: poolSize: 20 # 连接池中最小空闲数量。 minIdle: 5 + +superset: + baseUrl: http://192.168.100.24:8088/ + username: admin + password: admin \ No newline at end of file diff --git a/common/common-association/pom.xml b/common/common-association/pom.xml index e97366e..9e7b096 100644 --- a/common/common-association/pom.xml +++ b/common/common-association/pom.xml @@ -42,7 +42,7 @@ apelet common-generator - 1.0.2 + 1.0.3 apelet @@ -69,8 +69,11 @@ javase 3.5.1 - - + + com.deepoove + poi-tl + 1.12.2 + diff --git a/common/common-association/src/main/java/apelet/association/controller/HomeController.java b/common/common-association/src/main/java/apelet/association/controller/HomeController.java index 370cee8..f74b5f7 100644 --- a/common/common-association/src/main/java/apelet/association/controller/HomeController.java +++ b/common/common-association/src/main/java/apelet/association/controller/HomeController.java @@ -67,7 +67,7 @@ public class HomeController { // 入会申请 Filter filter = new Filter(); - filter.add(new FilterItem("billstatus", FilterItem.not_equals, "C")); + filter.add(new FilterItem("billstatus", FilterItem.equals, "B")); ObjectCollection membershipApply = ormGenDataSourceUtil.query("membership_apply", filter, new Selector()); map.put("MembershipApplication", membershipApply.size()); diff --git a/common/common-association/src/main/java/apelet/association/plugin/active/ActivityInfoDetailsPlugin.java b/common/common-association/src/main/java/apelet/association/plugin/active/ActivityInfoDetailsPlugin.java index 018c538..5867c00 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/active/ActivityInfoDetailsPlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/active/ActivityInfoDetailsPlugin.java @@ -69,35 +69,58 @@ public class ActivityInfoDetailsPlugin extends ListPlugin { if (!collect.isEmpty()) { ObjectValue memberInvitation = collect.get(0); ObjectValue membershipApplyId = memberInvitation.getObjectValue("membership_apply_id"); - if (membershipApplyId == null) { + if (membershipApplyId == null || !membershipApplyId.containsKey("id")) { return; } ObjectValue membershipApply = ormGenDataSourceUtil.queryOne(membershipApplyId.getTableName(), membershipApplyId.getString("id")); + if (membershipApply == null) { + return; + } ObjectCollection applyEntry = membershipApply.getObjectCollection("membership_apply_entry"); - if (applyEntry == null) { + if (applyEntry == null || applyEntry.isEmpty()) { return; } ObjectValue entryObject = applyEntry.getObject(0); + if (entryObject == null) { + return; + } this.setWidgetAttributeByEntry("table1786587576012", "unit_name", AttributeEnum.VALUE_CHANGE, membershipApply.getString("unit_name"), objectValue.getString("rowkeysubset")); this.setWidgetAttributeByEntry("table1786587576012", "person", AttributeEnum.VALUE_CHANGE, entryObject.getString("contact_name"), objectValue.getString("rowkeysubset")); this.setWidgetAttributeByEntry("table1786587576012", "phone", AttributeEnum.VALUE_CHANGE, entryObject.getString("contact_phone"), objectValue.getString("rowkeysubset")); } } //专家邀请 - if(widgetVariableName.equals("table1786587648327")){ + if (widgetVariableName.equals("table1786587648327")) { ObjectCollection expertInvitations = objectValue.getObjectCollection("expert_invitation"); List collect = expertInvitations.stream().filter(f -> f.getString("rowkey").equals(objectValue.getString("rowkeysubset"))).collect(Collectors.toList()); if (!collect.isEmpty()) { ObjectValue expertInvitation = collect.get(0); ObjectValue expert = expertInvitation.getObjectValue("expert_id"); + if (expert == null || !expert.containsKey("id")) { + return; + } expert = ormGenDataSourceUtil.queryOne(expert.getTableName(), expert.getString("id")); this.setWidgetAttributeByEntry("table1786587648327", "person", AttributeEnum.VALUE_CHANGE, expert.getString("name"), objectValue.getString("rowkeysubset")); this.setWidgetAttributeByEntry("table1786587648327", "phone", AttributeEnum.VALUE_CHANGE, expert.getString("phone"), objectValue.getString("rowkeysubset")); } } //访客邀请 - if(widgetVariableName.equals("table1786587726532")){ - + if (widgetVariableName.equals("table1786587726532")) { + ObjectCollection visitorInvitations = objectValue.getObjectCollection("visitor_invitation"); + List collect = visitorInvitations.stream().filter(f -> f.getString("rowkey").equals(objectValue.getString("rowkeysubset"))).collect(Collectors.toList()); + if (!collect.isEmpty()) { + ObjectValue visitorInvitation = collect.get(0); + ObjectValue number = visitorInvitation.getObjectValue("number"); + if (number == null || !number.containsKey("id")) { + return; + } + ObjectValue visitorHistory = ormGenDataSourceUtil.queryOne(number.getTableName(), number.getString("id")); + if (visitorHistory == null) { + return; + } + this.setWidgetAttributeByEntry("table1786587726532", "person", AttributeEnum.VALUE_CHANGE, visitorHistory.getString("name"), objectValue.getString("rowkeysubset")); + this.setWidgetAttributeByEntry("table1786587726532", "phone", AttributeEnum.VALUE_CHANGE, visitorHistory.getString("phone"), objectValue.getString("rowkeysubset")); + } } } @@ -120,7 +143,7 @@ public class ActivityInfoDetailsPlugin extends ListPlugin { // 生成 报名二维码 long id = objectValue.getLong("id"); - String url = "http://192.168.100.42:8099" + "/#/?" + + String url = "http://58.48.135.5:8069" + "/#/?" + "loginName=" + "admin" + "&password=" + "123456" + "&entryId=" + "2087710350152568832" + diff --git a/common/common-association/src/main/java/apelet/association/plugin/active/ActivityInvitationSavePlugin.java b/common/common-association/src/main/java/apelet/association/plugin/active/ActivityInvitationSavePlugin.java new file mode 100644 index 0000000..17dab6d --- /dev/null +++ b/common/common-association/src/main/java/apelet/association/plugin/active/ActivityInvitationSavePlugin.java @@ -0,0 +1,48 @@ +package apelet.association.plugin.active; + +import apelet.common.core.object.ObjectCollection; +import apelet.common.core.object.ObjectValue; +import apelet.common.core.util.ApplicationContextHolder; +import apelet.common.generator.utils.OrmGenDataSourceUtil; +import apelet.common.online.plugin.EndOperationTransactionArgs; +import apelet.common.online.plugin.OperationServicePlugIn; +import apelet.common.orm.impl.Filter; +import apelet.common.orm.impl.FilterItem; +import apelet.common.orm.impl.Selector; + +public class ActivityInvitationSavePlugin extends OperationServicePlugIn { + + private OrmGenDataSourceUtil ormGenDataSourceUtil; + + public ActivityInvitationSavePlugin() { + ormGenDataSourceUtil = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); + } + + @Override + public void endOperationTransaction(EndOperationTransactionArgs e) { + ObjectValue objectValue = e.getModel(); + ObjectCollection collection = objectValue.getObjectCollection("visitor_invitation"); + if(collection == null){ + return; + } + Filter filter = new Filter(); + filter.add(new FilterItem("parent_id", FilterItem.equals, objectValue.get("id"))); + ObjectCollection visitorInvitationHis = ormGenDataSourceUtil.query("visitor_invitation_his", filter, new Selector()); + + for (ObjectValue value : collection) { + long count = visitorInvitationHis.stream().filter(f -> f.get("name").equals(value.get("name")) && + f.get("unit_name").equals(value.get("unit_name"))).count(); + if(count == 0){ + continue; + } + ObjectValue invitationHis = new ObjectValue("visitor_invitation_his"); + invitationHis.setValues(value.getValues()); + invitationHis.remove("id"); + try { + ormGenDataSourceUtil.addNew(invitationHis.getTableName(), invitationHis); + } catch (Exception ex) { + + } + } + } +} diff --git a/common/common-association/src/main/java/apelet/association/plugin/member/MembershipApplyListFilterPlugin.java b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipApplyListFilterPlugin.java index e45add3..d3b9077 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/member/MembershipApplyListFilterPlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipApplyListFilterPlugin.java @@ -1,9 +1,22 @@ package apelet.association.plugin.member; +import apelet.common.core.exception.MyRuntimeException; +import apelet.common.core.object.ObjectValue; +import apelet.common.core.util.ApplicationContextHolder; +import apelet.common.generator.utils.OrmGenDataSourceUtil; import apelet.common.online.abstractplugin.ListPlugin; +import apelet.common.online.dto.OnlineEventPluginExecuteDto; +import apelet.common.online.model.ShowParameter; +import apelet.common.online.model.constant.AttributeEnum; +import apelet.common.online.model.constant.ShowTypeEnum; +import apelet.common.online.model.constant.ViewStatus; import apelet.common.orm.impl.Filter; import apelet.common.orm.impl.FilterItem; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * @ClassName: MembershipApplyListFilterPlugin * @Author: huangdehua @@ -12,20 +25,148 @@ import apelet.common.orm.impl.FilterItem; * 在列表加载前添加过滤条件,只显示最新单据(is_history=0) */ public class MembershipApplyListFilterPlugin extends ListPlugin { + /** - * 是否历史字段 + * 目标表单ID - membership_apply 表单在平台中的表单ID */ - private static final String FIELD_IS_HISTORY = "history"; - + private static final String TARGET_FORM_ID = "2048951917157027840"; + /** + * 传递到弹窗的参数key - 单据ID + */ + private static final String PARAM_BILL_ID = "sourceBillId"; /** - * 非历史记录 + * 传递到弹窗的参数key - 单据编号 */ - private static final String IS_HISTORY_NO = "1"; + private static final String PARAM_BILL_NUMBER = "sourceBillNumber"; + private final OrmGenDataSourceUtil ormGenDataSourceUtil; + + public MembershipApplyListFilterPlugin() { + ormGenDataSourceUtil = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); + } @Override protected Filter getFilter() { Filter filter = new Filter(); - filter.add(new FilterItem(FIELD_IS_HISTORY, "!=", IS_HISTORY_NO)); + filter.add(new FilterItem("deleted_flag", FilterItem.equals, "1")); + filter.add(new FilterItem("history", "!=", 1)); return filter; } + + + @Override + protected void afterLoadData(List> dataList) { + super.afterLoadData(dataList); + } + + @Override + public void afterLoadFormData(String widgetVariableName, ObjectValue objectValue) { + super.afterLoadFormData(widgetVariableName, objectValue); + + } + + @Override + public void beforeLoadTableData(String widgetVariableName, ObjectValue objectValue) { + OnlineEventPluginExecuteDto dto = getDto(); + List> jumpParams = getDto().getJumpParams(); + if (jumpParams == null || jumpParams.isEmpty()) { + return; + } + for (Map jumpParam : jumpParams) { + jumpParam.forEach( (k,v)->{ + if(k.equals("billstatus")){ + this.setWidgetAttribute("billstatus", AttributeEnum.VALUE_CHANGE, v); + } + if(k.equals("overdue")){ + this.setWidgetAttribute("overdue", AttributeEnum.VALUE_CHANGE, v); + } + }); + } + } + + @Override + public void formCreated(String widgetVariableName, ObjectValue objectValue) { + super.formCreated(widgetVariableName, objectValue); + + + + } + + /** + * 按钮点击事件(列表按钮) + * 点击"变更"按钮时,通过 getSelectData 获取列表中选中行的单据数据, + * 以弹窗方式打开入会申请表单,并将选中行数据带入 + * + * @param buttonKey 按钮标识 + * @param objectValue 列表按钮事件数据对象(非表单数据) + */ + @Override + public void buttonTriggered(String buttonKey, ObjectValue objectValue) { + OnlineEventPluginExecuteDto dto = getDto(); + + if ("新建".equals(buttonKey)) { + return; + } + + List rowDatas = dto.getModel().getRowDatas(); + if (rowDatas == null || rowDatas.size() != 1) { + showWarningMessage("请先在列表中选中一条单据"); + this.cancelOperate(); + return; + } + Map data = rowDatas.get(0); + if ("变更".equals(buttonKey)) { + + // 调用 showForm 打开入会申请表单(新建空表单,不加载任何已有记录) + ShowParameter showParameter = new ShowParameter(); + showParameter.setFormId(TARGET_FORM_ID); + showParameter.setHowType(ShowTypeEnum.OPEN_ONLINE_MODAL); + showParameter.setStatus(ViewStatus.EDIT); + showParameter.setPkId(null); // 明确指定为空,表示新建表单而非打开已有单据 + // 设置自定义参数,用于在目标表单中获取源单据数据 + Map customParam = new HashMap<>(); + customParam.put(PARAM_BILL_ID, data.get("id")); + customParam.put(PARAM_BILL_NUMBER, data.get("number")); + showParameter.setCustomParam(customParam); + super.showForm(showParameter); + } + if ("退会".equals(buttonKey)) { + this.showConfirm("withdrawal", "确定是否退出协会?"); + this.cancelOperate(); + } + if ("查看历史".equals(buttonKey)) { + ShowParameter showParameter = new ShowParameter(); + showParameter.setFormId("2071862530363363328"); + showParameter.setHowType(ShowTypeEnum.OPEN_ONLINE_MODAL); + showParameter.setStatus(ViewStatus.VIEW); + + // 设置自定义参数 + Map customParam = new HashMap<>(); + customParam.put("id", data.get("id")); + showParameter.setCustomParam(customParam); + + super.showForm(showParameter); + } + } + + + @Override + public void confirmCallBack(String widgetVariableName, ObjectValue objectValue) { + if (widgetVariableName.equals("withdrawal")) {//confirmid + Map clickResult = (Map) this.getDto().getEventObject(); + if ((Integer) clickResult.get("result") == 1) {//confirm + Map data = getDto().getModel().getRowDatas().get(0); + Object id = data.get("id"); + Filter filter = new Filter(); + filter.add(new FilterItem("id", FilterItem.equals, id)); + try { + ormGenDataSourceUtil.delete("membership_apply", filter); + } catch (Exception e) { + throw new MyRuntimeException(e.getMessage()); + } + } else {//取消 + this.cancelOperate();//取消操作 + } + } + + } } \ No newline at end of file diff --git a/common/common-association/src/main/java/apelet/association/plugin/member/MembershipBenefitsUpdatePlugin.java b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipBenefitsUpdatePlugin.java new file mode 100644 index 0000000..cee3123 --- /dev/null +++ b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipBenefitsUpdatePlugin.java @@ -0,0 +1,48 @@ +package apelet.association.plugin.member; + +import apelet.common.core.exception.MyRuntimeException; +import apelet.common.core.object.ObjectCollection; +import apelet.common.core.object.ObjectValue; +import apelet.common.core.util.ApplicationContextHolder; +import apelet.common.generator.utils.OrmGenDataSourceUtil; +import apelet.common.online.abstractplugin.ExecutePluginParent; +import apelet.common.online.abstractplugin.ListPlugin; +import apelet.common.online.dto.OnlineEventPluginExecuteDto; +import apelet.common.online.model.constant.AttributeEnum; +import apelet.common.orm.impl.Filter; +import apelet.common.orm.impl.FilterItem; +import apelet.common.orm.impl.Selector; + +import java.sql.Date; +import java.util.Map; +import java.util.Optional; + + +public class MembershipBenefitsUpdatePlugin extends ListPlugin { + + private OrmGenDataSourceUtil ormGenDataSourceUtil; + + public MembershipBenefitsUpdatePlugin() { + ormGenDataSourceUtil = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); + } + + @Override + public void formCreated(String widgetVariableName, ObjectValue objectValue) { + ObjectValue value = ormGenDataSourceUtil.queryOne(objectValue.getTableName(), objectValue.getString("id")); + ObjectCollection collection = value.getObjectCollection("equity_services"); + ObjectCollection equityServices = objectValue.getObjectCollection("equity_services"); + for (ObjectValue equityService : equityServices) { + Optional first = collection.stream().filter(f -> f.getString("id").equals(equityService.getString("id"))).findFirst(); + ObjectValue value1 = first.get(); + this.setWidgetAttributeByEntry("table1782205467614", "member", + AttributeEnum.VALUE_CHANGE, value1.getInt("member"), equityService.getString("rowkey")); + this.setWidgetAttributeByEntry("table1782205467614", "director", + AttributeEnum.VALUE_CHANGE, value1.getInt("director"), equityService.getString("rowkey")); + this.setWidgetAttributeByEntry("table1782205467614", "executive_director", + AttributeEnum.VALUE_CHANGE, value1.getInt("executive_director"), equityService.getString("rowkey")); + this.setWidgetAttributeByEntry("table1782205467614", "vice_president", + AttributeEnum.VALUE_CHANGE, value1.getInt("vice_president"), equityService.getString("rowkey")); + } + } +} + diff --git a/common/common-association/src/main/java/apelet/association/plugin/member/MembershipFeePayPlugin.java b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipFeePayPlugin.java index 1982e84..9ea2d4a 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/member/MembershipFeePayPlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipFeePayPlugin.java @@ -39,6 +39,11 @@ public class MembershipFeePayPlugin extends ExecutePluginParent { this.setWidgetAttribute("membershipDate", AttributeEnum.VALUE_CHANGE, eventParams.get("create_time")); this.setWidgetAttribute("membershipType", AttributeEnum.VALUE_CHANGE, eventParams.get("membership_type")); + + if (eventParams.get("membership_type").equals("E") ) { + this.setWidgetAttribute("bankReceiptV", AttributeEnum.SHOW, false); + } + } } diff --git a/common/common-association/src/main/java/apelet/association/plugin/member/MembershipPayPopupPlugin.java b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipPayPopupPlugin.java index 60091c8..baba92c 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/member/MembershipPayPopupPlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipPayPopupPlugin.java @@ -43,11 +43,7 @@ public class MembershipPayPopupPlugin extends ExecutePluginParent { customParam.putAll(objectValue.getValues()); showParameter.setCustomParam(customParam); super.showForm(showParameter); - - } - - } } diff --git a/common/common-association/src/main/java/apelet/association/plugin/member/MembershipSavePlugin.java b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipSavePlugin.java index b36b002..301664a 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/member/MembershipSavePlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipSavePlugin.java @@ -64,6 +64,7 @@ public class MembershipSavePlugin extends ExecutePluginParent { DB_FIELD_WIDGET_MAPPING.put("company_address", "companyAddress"); DB_FIELD_WIDGET_MAPPING.put("version_number", "versionNumber"); DB_FIELD_WIDGET_MAPPING.put("change_reason", "changeReason"); + DB_FIELD_WIDGET_MAPPING.put("billstatus", "billstatus"); } /** 保存时需要跳过的非主表字段(objectValue 中的控件 key) */ @@ -137,18 +138,14 @@ public class MembershipSavePlugin extends ExecutePluginParent { private void saveAsNew(ObjectValue objectValue) throws Exception { // 取唯一键单位名称(兼容 unit_name / unitName 两种控件 key) String unitName = getUnitName(objectValue); - // 新增验重:unit_name 已存在则拒绝新增 ObjectValue existBill = findExistBillByUnitName(unitName); if (existBill != null) { throw new MyRuntimeException("单位【" + unitName + "】已存在,请勿重复新增"); } - - // 自动生成单据号(S + yyyyMMdd + 4 位流水号) String number = generateNumber(); - // 组装数据库记录并新增 - ObjectValue newBill = buildNewBill(objectValue, number); - ormGenDataSourceUtil().addNew(TABLE_NAME, newBill); + objectValue.put("number", number); + ormGenDataSourceUtil().addNew(TABLE_NAME, objectValue); } /** diff --git a/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangeFormInitPlugin.java b/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangeFormInitPlugin.java index e0b1fbd..48be527 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangeFormInitPlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangeFormInitPlugin.java @@ -95,6 +95,10 @@ public class UnitNameChangeFormInitPlugin extends ExecutePluginParent { public void formCreated(String widgetVariableName, ObjectValue objectValue) { super.formCreated(widgetVariableName, objectValue); + if(objectValue.getString("id") == null){ + this.setWidgetAttribute("billstatus",AttributeEnum.VALUE_CHANGE, "A"); + } + // 获取源单据ID String sourceBillId = getSourceBillId(objectValue); String sourceBillNumber = getSourceBillNumber(objectValue); diff --git a/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangePopupPlugin.java b/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangePopupPlugin.java index 61d1290..19c0c85 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangePopupPlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangePopupPlugin.java @@ -25,132 +25,4 @@ import java.util.Map; */ public class UnitNameChangePopupPlugin extends ListPlugin { - /** - * 目标表单ID - membership_apply 表单在平台中的表单ID - */ - private static final String TARGET_FORM_ID = "2048951917157027840"; - /** - * 传递到弹窗的参数key - 单据ID - */ - private static final String PARAM_BILL_ID = "sourceBillId"; - /** - * 传递到弹窗的参数key - 单据编号 - */ - private static final String PARAM_BILL_NUMBER = "sourceBillNumber"; - private final OrmGenDataSourceUtil ormGenDataSourceUtil; - - public UnitNameChangePopupPlugin() { - ormGenDataSourceUtil = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); - } - - @Override - protected Filter getFilter() { - Filter filter = new Filter(); - filter.add(new FilterItem("deleted_flag", FilterItem.equals, "1")); - return filter; - } - - - @Override - protected void afterLoadData(List> dataList) { - super.afterLoadData(dataList); - } - - @Override - public void afterLoadFormData(String widgetVariableName, ObjectValue objectValue) { - super.afterLoadFormData(widgetVariableName, objectValue); - - } - - @Override - public void beforeLoadTableData(String widgetVariableName, ObjectValue objectValue) { - OnlineEventPluginExecuteDto dto = getDto(); - super.beforeLoadTableData(widgetVariableName, objectValue); - - } - - @Override - public void formCreated(String widgetVariableName, ObjectValue objectValue) { - super.formCreated(widgetVariableName, objectValue); - - } - - /** - * 按钮点击事件(列表按钮) - * 点击"变更"按钮时,通过 getSelectData 获取列表中选中行的单据数据, - * 以弹窗方式打开入会申请表单,并将选中行数据带入 - * - * @param buttonKey 按钮标识 - * @param objectValue 列表按钮事件数据对象(非表单数据) - */ - @Override - public void buttonTriggered(String buttonKey, ObjectValue objectValue) { - OnlineEventPluginExecuteDto dto = getDto(); - - if("新建".equals(buttonKey)) { - return; - } - - List rowDatas = dto.getModel().getRowDatas(); - if (rowDatas == null || rowDatas.size() != 1) { - showWarningMessage("请先在列表中选中一条单据"); - this.cancelOperate(); - return; - } - Map data = rowDatas.get(0); - if ("变更".equals(buttonKey)) { - - // 调用 showForm 打开入会申请表单(新建空表单,不加载任何已有记录) - ShowParameter showParameter = new ShowParameter(); - showParameter.setFormId(TARGET_FORM_ID); - showParameter.setHowType(ShowTypeEnum.OPEN_ONLINE_MODAL); - showParameter.setStatus(ViewStatus.EDIT); - showParameter.setPkId(null); // 明确指定为空,表示新建表单而非打开已有单据 - // 设置自定义参数,用于在目标表单中获取源单据数据 - Map customParam = new HashMap<>(); - customParam.put(PARAM_BILL_ID, data.get("id")); - customParam.put(PARAM_BILL_NUMBER, data.get("number")); - showParameter.setCustomParam(customParam); - super.showForm(showParameter); - } - if ("退会".equals(buttonKey)) { - this.showConfirm("withdrawal", "确定是否退出协会?"); - this.cancelOperate(); - } - if("查看历史".equals(buttonKey)){ - ShowParameter showParameter = new ShowParameter(); - showParameter.setFormId("2071862530363363328"); - showParameter.setHowType(ShowTypeEnum.OPEN_ONLINE_MODAL); - showParameter.setStatus(ViewStatus.VIEW); - - // 设置自定义参数 - Map customParam = new HashMap<>(); - customParam.put("id", data.get("id")); - showParameter.setCustomParam(customParam); - - super.showForm(showParameter); - } - } - - - @Override - public void confirmCallBack(String widgetVariableName, ObjectValue objectValue) { - if (widgetVariableName.equals("withdrawal")) {//confirmid - Map clickResult = (Map) this.getDto().getEventObject(); - if ((Integer) clickResult.get("result") == 1) {//confirm - Map data = getDto().getModel().getRowDatas().get(0); - Object id = data.get("id"); - Filter filter = new Filter(); - filter.add(new FilterItem("id", FilterItem.equals, id)); - try { - ormGenDataSourceUtil.delete("membership_apply", filter); - } catch (Exception e) { - throw new MyRuntimeException(e.getMessage()); - } - } else {//取消 - this.cancelOperate();//取消操作 - } - } - - } } diff --git a/common/common-qy/pom.xml b/common/common-qy/pom.xml index 6871b25..829f1ad 100644 --- a/common/common-qy/pom.xml +++ b/common/common-qy/pom.xml @@ -23,14 +23,15 @@ swagger-annotations 2.2.28 + apelet - common-generator + common-orm 1.0.2 apelet - common-orm + common-generator 1.0.2 From 4cf5d44757217262f0ac3571174b1eb42c5338d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=8A?= <23> Date: Sun, 16 Aug 2026 18:05:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../upms/controller/DocxTemplateController.java | 105 +++++++++++++++++++-- .../AssociationActivitiesController.java | 59 ++++++------ .../plugin/active/ActivityInfoDetailsPlugin.java | 12 +-- .../plugin/active/ActivitySignConfigPlugin.java | 15 ++- zz-resource/quotation_template.docx | Bin 0 -> 12112 bytes 5 files changed, 145 insertions(+), 46 deletions(-) create mode 100644 zz-resource/quotation_template.docx diff --git a/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/controller/DocxTemplateController.java b/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/controller/DocxTemplateController.java index e9659fe..26cd9d5 100644 --- a/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/controller/DocxTemplateController.java +++ b/application-tenant/tenant-admin/src/main/java/apelet/tenantadmin/upms/controller/DocxTemplateController.java @@ -1,11 +1,17 @@ package apelet.tenantadmin.upms.controller; import apelet.common.core.exception.MyRuntimeException; +import apelet.common.core.object.ObjectCollection; import apelet.common.core.object.ObjectValue; -import apelet.common.core.object.TokenData; +import apelet.common.core.object.ResponseResult; import apelet.common.generator.utils.OrmGenDataSourceUtil; import apelet.common.online.service.OnlineDictService; +import apelet.common.orm.impl.Filter; +import apelet.common.orm.impl.Selector; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.IoUtil; +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -14,9 +20,12 @@ import org.apache.commons.lang3.StringUtils; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.xwpf.usermodel.*; import org.docx4j.Docx4J; +import org.docx4j.fonts.IdentityPlusMapper; +import org.docx4j.fonts.PhysicalFonts; import org.docx4j.openpackaging.packages.WordprocessingMLPackage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.*; @@ -25,11 +34,10 @@ import java.net.URL; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; @RestController @RequestMapping("/api/template") @@ -76,7 +84,7 @@ public class DocxTemplateController { hashMap.put("name", objectValue.getString("name")); hashMap.put("type", dictMap.get(String.valueOf(objectValue.get("type", "")))); hashMap.put("number", objectValue.getString("number")); - hashMap.put("create_time", objectValue.getString("create_time")); + hashMap.put("create_time", objectValue.getString("create_time").substring(0, 10)); hashMap.put("qty", objectValue.getString("qty")); String signatureImage = user.getString("signature_image"); @@ -108,6 +116,8 @@ public class DocxTemplateController { docxOut.close(); WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new ByteArrayInputStream(docxBytes)); + PhysicalFonts.discoverPhysicalFonts(); + wordMLPackage.setFontMapper(new IdentityPlusMapper()); pdfOut = new ByteArrayOutputStream(); Docx4J.toPDF(wordMLPackage, pdfOut); byte[] pdfBytes = pdfOut.toByteArray(); @@ -208,7 +218,6 @@ public class DocxTemplateController { } - private void replaceImageInParagraphs(XWPFDocument document, String placeholderKey, byte[] imageBytes, int width, int height) throws IOException, InvalidFormatException { String placeholder = "#{" + placeholderKey + "}"; for (XWPFParagraph paragraph : document.getParagraphs()) { @@ -257,4 +266,88 @@ public class DocxTemplateController { } } + + private static final Map HEADER_MAP = new LinkedHashMap<>(); + + static { + HEADER_MAP.put("名称", "name"); + HEADER_MAP.put("性别", "gender"); + HEADER_MAP.put("手机号码", "phone"); + HEADER_MAP.put("出生年月", "birth_date"); + HEADER_MAP.put("学历", "education"); + HEADER_MAP.put("民族", "nation"); + HEADER_MAP.put("政治面貌", "political_status"); + HEADER_MAP.put("身份证号码", "id_card"); + HEADER_MAP.put("毕业院校", "graduate_school"); + HEADER_MAP.put("所属专业", "major"); + HEADER_MAP.put("常住地", "permanent_address"); + } + + @PostMapping("/expertImport") + public ResponseResult expertImport(@RequestParam("file") MultipartFile file) { + List> dataList = new ArrayList<>(); + try (InputStream is = file.getInputStream()) { + ExcelReader reader = ExcelUtil.getReader(is); + // 第一行作为表头,key 为表头名称,自动兼容 xls/xlsx + List> rawList = reader.readAll(); + //学历 + Map educationDictMap = onlineDictService.getDictMap(2054094099727781888L); + educationDictMap = educationDictMap.entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey)); + //政治面貌 + Map politicalDictMap = onlineDictService.getDictMap(2054098587905691648L); + politicalDictMap = politicalDictMap.entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey)); + for (Map row : rawList) { + Map dataMap = new LinkedHashMap<>(); + + for (Map.Entry entry : row.entrySet()) { + String header = entry.getKey() == null ? "" : entry.getKey().trim(); + // 中文表头转英文,映射中没有的表头保留原值 + String key = HEADER_MAP.getOrDefault(header, header); + Object value = entry.getValue(); + dataMap.put(key, value); + if (key.equals("gender")) { + dataMap.put("gender", value.equals("男") ? "1" : "0"); + } + if (key.equals("education")) { + dataMap.put("education", educationDictMap.get(value.toString())); + } + if (key.equals("political_status")) { + dataMap.put("political_status", politicalDictMap.get(value.toString())); + } + if ("birth_date".equals(key)) { + if (value instanceof Date) { + value = DateUtil.formatDateTime((Date) value); + } else if (value instanceof String && StringUtils.isNotBlank((String) value)) { + value = DateUtil.formatDateTime(DateUtil.parse((String) value)); + } + dataMap.put(key, value); + } + } + dataMap.put("billstatus", "A"); + dataMap.put("apply_time", DateUtil.formatDateTime(new Date())); + dataList.add(dataMap); + } + ObjectCollection expertManage = ormGenDataSourceUtil.query("expert_manage", new Filter(), new Selector()); + dataList.forEach(dataMap -> { + long count = expertManage.stream().filter(f -> f.get("id_card").equals(dataMap.get("id_card"))).count(); + if (count > 0) { + return; + } + ObjectValue value = new ObjectValue("expert_manage"); + value.setValues(dataMap); + try { + ormGenDataSourceUtil.addNew("expert_manage", value); + } catch (Exception e) { + e.printStackTrace(); + } + }); + + } catch (IOException e) { + throw new MyRuntimeException("文件解析失败: " + e.getMessage()); + } + return ResponseResult.success("导入成功"); + } + } \ No newline at end of file diff --git a/common/common-association/src/main/java/apelet/association/controller/AssociationActivitiesController.java b/common/common-association/src/main/java/apelet/association/controller/AssociationActivitiesController.java index 91060c2..1c8918a 100644 --- a/common/common-association/src/main/java/apelet/association/controller/AssociationActivitiesController.java +++ b/common/common-association/src/main/java/apelet/association/controller/AssociationActivitiesController.java @@ -54,50 +54,51 @@ public class AssociationActivitiesController { } Integer type = jsonObject.getInteger("type"); - Filter filter = new Filter(); - filter.add(new FilterItem("unit_name", FilterItem.equals, signInUnit)); - ObjectCollection collection = ormGenDataSourceUtil.query("membership_apply", filter, new Selector()); - - if (collection == null || collection.isEmpty()) { - return ResponseResult.error("500", "签到单位不存在, 请检查签到单位!!!"); - } - - ObjectCollection managerCollection = ormGenDataSourceUtil.query("membership_manager", new Filter(), new Selector()); - List> managerList = DataTransformationUtil.objectCollectionToList(managerCollection); - Map> mapMap = managerList.stream().collect(Collectors.toMap(map -> String.valueOf(map.get("id")), map -> map, (oldValue, newValue) -> oldValue)); - - ObjectValue member = null; - for (int i = 0; i < collection.size(); i++) { - ObjectValue object = collection.getObject(i); - ObjectValue manger = object.getObjectValue("membership_manger_id"); - Map map = mapMap.get(manger != null && manger.get("id") != null ? manger.get("id") : ""); - Object phone = map.get("phone"); - if (ObjectUtil.equal(phone, phoneNumber)) { - member = object; - } - } - if (member == null) { - return ResponseResult.error("500", signInUnit + " 签到单位下签到人不存在!!!"); - } +// Filter filter = new Filter(); +// filter.add(new FilterItem("unit_name", FilterItem.equals, signInUnit)); +// ObjectCollection collection = ormGenDataSourceUtil.query("membership_apply", filter, new Selector()); +// +// if (collection == null || collection.isEmpty()) { +// return ResponseResult.error("500", "签到单位不存在, 请检查签到单位!!!"); +// } +// +// ObjectCollection managerCollection = ormGenDataSourceUtil.query("membership_manager", new Filter(), new Selector()); +// List> managerList = DataTransformationUtil.objectCollectionToList(managerCollection); +// Map> mapMap = managerList.stream().collect(Collectors.toMap(map -> String.valueOf(map.get("id")), map -> map, (oldValue, newValue) -> oldValue)); +// +// ObjectValue member = null; +// for (int i = 0; i < collection.size(); i++) { +// ObjectValue object = collection.getObject(i); +// ObjectValue manger = object.getObjectValue("membership_manger_id"); +// Map map = mapMap.get(manger != null && manger.get("id") != null ? manger.get("id") : ""); +// Object phone = map.get("phone"); +// if (ObjectUtil.equal(phone, phoneNumber)) { +// member = object; +// } +// } +// if (member == null) { +// return ResponseResult.error("500", signInUnit + " 签到单位下签到人不存在!!!"); +// } if (type == 1) { //签到 ObjectValue value = new ObjectValue("check_in_out"); value.put("name", signInPerson); value.put("phone", phoneNumber); - value.put("membership_id", member); +// value.put("membership_id", member); value.put("create_time", new Date()); value.put("create_time", new Date()); value.put("parent_id", activityId); value.put("check_in", 1); ormGenDataSourceUtil.addNew(value.getTableName(), value); } + if (type == 2) { //签退 - filter = new Filter(); - filter.add(new FilterItem("membership_id", FilterItem.equals, member.get("id"))); + Filter filter = new Filter(); +// filter.add(new FilterItem("membership_id", FilterItem.equals, member.get("id"))); filter.add(new FilterItem("parent_id", FilterItem.equals, activityId)); filter.add(new FilterItem("check_in", FilterItem.equals, 1)); - collection = ormGenDataSourceUtil.query("check_in_out", filter, new Selector()); + ObjectCollection collection = ormGenDataSourceUtil.query("check_in_out", filter, new Selector()); if (collection != null && !collection.isEmpty()) { ObjectValue object = collection.getObject(0); object.put("check_out", 1); diff --git a/common/common-association/src/main/java/apelet/association/plugin/active/ActivityInfoDetailsPlugin.java b/common/common-association/src/main/java/apelet/association/plugin/active/ActivityInfoDetailsPlugin.java index 5867c00..26aaca6 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/active/ActivityInfoDetailsPlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/active/ActivityInfoDetailsPlugin.java @@ -130,10 +130,10 @@ public class ActivityInfoDetailsPlugin extends ListPlugin { // 生成报名二维码 if (widgetVariableName.equals("button1786587153460")) { String registrationQr = objectValue.getString("registration_qr"); - if (StringUtils.isNotEmpty(registrationQr)) { - this.showErrorMessage("当前已存在报名二维码, 请勿重复生成!!!"); - return; - } +// if (StringUtils.isNotEmpty(registrationQr)) { +// this.showErrorMessage("当前已存在报名二维码, 请勿重复生成!!!"); +// return; +// } OnlineEventPluginExecuteDto dto = getDto(); String savePath = System.getProperty("user.dir") + "\\zz-resource\\qrcode"; File QRFile = null; @@ -146,9 +146,9 @@ public class ActivityInfoDetailsPlugin extends ListPlugin { String url = "http://58.48.135.5:8069" + "/#/?" + "loginName=" + "admin" + "&password=" + "123456" + - "&entryId=" + "2087710350152568832" + + "&entryId=" + "2087413611113746432" + "&bindType=" + "1" + - "&onlineFormId=" + "2048951917157027840" + + "&onlineFormId=" + "2087385700075835392" + "&activeId=" + id; byte[] checkInQr = qrCodeUtil.generateQrCode(url, 350, 350); diff --git a/common/common-association/src/main/java/apelet/association/plugin/active/ActivitySignConfigPlugin.java b/common/common-association/src/main/java/apelet/association/plugin/active/ActivitySignConfigPlugin.java index 4c40e69..cf9cd36 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/active/ActivitySignConfigPlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/active/ActivitySignConfigPlugin.java @@ -27,6 +27,8 @@ import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.Map; /** @@ -113,20 +115,23 @@ public class ActivitySignConfigPlugin extends ListPlugin { File checkOutFile = null; File checkInFile = null; try { - Object activityId = objectValue.get("id"); - Object activityName = objectValue.get("name"); + Map parentParams = getDto().getParentParams(); + Object activityId = parentParams.get("id"); + ObjectValue value = ormGenDataSourceUtil.queryOne("association_activity", activityId); + String name = value.getString("name"); OnlineDatasource onlineDatasource = onlineDatasourceService.getById(model.getDatasourceId()); OnlineTable table = onlineTableService.getOnlineTableFromCache(onlineDatasource.getMasterTableId()); - - String checkIn = url + "/#/pages/login/routerHdView?activityId=" + activityId + "&activityName=" + activityName + "&type=" + 1; + // 中文活动名称做 URL 编码,保证扫码 URL 为纯 ASCII;前端 decodeURIComponent 后仍是原中文 + String encodedName = URLEncoder.encode(name, StandardCharsets.UTF_8.name()); + String checkIn = url + "/#/pages/login/routerHdView?activityId=" + activityId + "&activityName=" + encodedName + "&type=1"; byte[] checkInQr = qrCodeUtil.generateQrCode(checkIn, 350, 350); checkInFile = MyFileUtil.writeToFile(checkInQr, savePath, "qrcode-" + System.currentTimeMillis() + ".png"); MultipartFile checkInMultipart = MyFileUtil.readFileAsMultipartFile(checkInFile, "image/png"); UploadResponseInfo checkInUpload = myFileUtil.uploadMyFile(table, "sign_in_code", true, checkInMultipart); this.setWidgetAttribute("signInCode", AttributeEnum.VALUE_CHANGE, checkInUpload); - String checkOut = url + "#/pages/login/routerHdView?activityId=" + activityId + "&activityName=" + activityName + "&type=" + 2; + String checkOut = url + "/#/pages/login/routerHdView?activityId=" + activityId + "&activityName=" + encodedName + "&type=2"; byte[] checkOutQr = qrCodeUtil.generateQrCode(checkOut, 300, 300); checkOutFile = MyFileUtil.writeToFile(checkOutQr, savePath, "qrcode-" + System.currentTimeMillis() + ".png"); MultipartFile checkOutMultipart = MyFileUtil.readFileAsMultipartFile(checkOutFile, "image/png"); diff --git a/zz-resource/quotation_template.docx b/zz-resource/quotation_template.docx new file mode 100644 index 0000000000000000000000000000000000000000..07147ad5d30a3d0b665ea4cb17cde4c1bfb76dfd GIT binary patch literal 12112 zcmb7q1yo$iwr%6??(PJKCb%cKyK5kLC_gUb9x!T)Wqb?-e@twR6+pIj4$KO#W|*%RVE;60 z?H4xz0|1=C0RYs$n;F{KF}Ye>r7KO!b+KT20WU}r+iXvuMLCkt2`^3J1L;2J9Wa&J zTYjlWeemFA<<|FV*-N{*KF;WRuCdI;(4whJ?bVdpf=!sHQwh<0Rx69OAbdNnI;ve} zhn+du>)`AGVOfHt#XKqADbl35>}pF4YoF5@)xt4APwQdLdkRqtlXK@mXZN+YN_0n3 z?jUfz@SUo0dUA=Or@bfl!%OO{*7d`(hZ7eWO8`9YH0bkj{^#j}x?7@X1_VoQp?)^f zB(VC$*(fZ`0aO3#jYI?z?A~fCa1-AR&0;%lPY*o*lpUC1*(+IORF%c6`dFfB#l|1- z1{AIlrte2?Tb*FHllE5xm%n_yt{#8MeW8LmsGkB7bc??L-B?H7Di|2bFhJd9JJ##k z=FFWLIcsJF<3#T&^AMk?ElksPcreC!g7m4k6cuSAN(V5s;(L?j=thU3qO&mq&49E~ zYL5;bQDlf;+HQy20soAMYS5mK%xgq+UL%6`_lOwVf=qvfBr>*2uA2ol*oAVH>@s6s zQrf(XG6CQO4i`p_`o&a#DRjQdN^~&>D^oUSli|Z*rVZFxt}bDEFtC!W({=UxXvj}>E_;Q z@fOncB~}Qt5x9k1ZdP-}zV+c?D8=(JVfY3|Mwhs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.../AssociationActivitiesController.java | 48 ++++++------------- .../plugin/clueManage/ClueManageFormPlugin.java | 54 ++++++++++++++++++++++ .../plugin/member/MembershipSavePlugin.java | 3 +- 3 files changed, 70 insertions(+), 35 deletions(-) diff --git a/common/common-association/src/main/java/apelet/association/controller/AssociationActivitiesController.java b/common/common-association/src/main/java/apelet/association/controller/AssociationActivitiesController.java index 1c8918a..d3e9f38 100644 --- a/common/common-association/src/main/java/apelet/association/controller/AssociationActivitiesController.java +++ b/common/common-association/src/main/java/apelet/association/controller/AssociationActivitiesController.java @@ -1,6 +1,7 @@ package apelet.association.controller; import apelet.association.utils.DataTransformationUtil; +import apelet.common.core.annotation.NoAuthInterface; import apelet.common.core.object.ObjectCollection; import apelet.common.core.object.ObjectValue; import apelet.common.core.object.ResponseResult; @@ -8,16 +9,14 @@ import apelet.common.generator.utils.OrmGenDataSourceUtil; import apelet.common.orm.impl.Filter; import apelet.common.orm.impl.FilterItem; import apelet.common.orm.impl.Selector; -import cn.hutool.core.util.ObjectUtil; + import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; + @RestController @RequestMapping("/tenantadmin/activity") @@ -52,33 +51,14 @@ public class AssociationActivitiesController { if (StringUtils.isEmpty(signInUnit)) { return ResponseResult.error("500", "签到单位为空!!!"); } + + System.out.println("333333333333333333333333333333333333333333333333"); Integer type = jsonObject.getInteger("type"); -// Filter filter = new Filter(); -// filter.add(new FilterItem("unit_name", FilterItem.equals, signInUnit)); -// ObjectCollection collection = ormGenDataSourceUtil.query("membership_apply", filter, new Selector()); -// -// if (collection == null || collection.isEmpty()) { -// return ResponseResult.error("500", "签到单位不存在, 请检查签到单位!!!"); -// } -// -// ObjectCollection managerCollection = ormGenDataSourceUtil.query("membership_manager", new Filter(), new Selector()); -// List> managerList = DataTransformationUtil.objectCollectionToList(managerCollection); -// Map> mapMap = managerList.stream().collect(Collectors.toMap(map -> String.valueOf(map.get("id")), map -> map, (oldValue, newValue) -> oldValue)); -// -// ObjectValue member = null; -// for (int i = 0; i < collection.size(); i++) { -// ObjectValue object = collection.getObject(i); -// ObjectValue manger = object.getObjectValue("membership_manger_id"); -// Map map = mapMap.get(manger != null && manger.get("id") != null ? manger.get("id") : ""); -// Object phone = map.get("phone"); -// if (ObjectUtil.equal(phone, phoneNumber)) { -// member = object; -// } -// } -// if (member == null) { -// return ResponseResult.error("500", signInUnit + " 签到单位下签到人不存在!!!"); -// } + Filter filter = new Filter(); + filter.add(new FilterItem("unit_name", FilterItem.equals, signInUnit)); + ObjectCollection collection = ormGenDataSourceUtil.query("membership_apply", filter, new Selector()); + if (type == 1) { //签到 ObjectValue value = new ObjectValue("check_in_out"); @@ -86,7 +66,6 @@ public class AssociationActivitiesController { value.put("phone", phoneNumber); // value.put("membership_id", member); value.put("create_time", new Date()); - value.put("create_time", new Date()); value.put("parent_id", activityId); value.put("check_in", 1); ormGenDataSourceUtil.addNew(value.getTableName(), value); @@ -94,15 +73,16 @@ public class AssociationActivitiesController { if (type == 2) { //签退 - Filter filter = new Filter(); -// filter.add(new FilterItem("membership_id", FilterItem.equals, member.get("id"))); + filter = new Filter(); + filter.add(new FilterItem("name", FilterItem.equals, signInPerson)); + filter.add(new FilterItem("phone", FilterItem.equals, phoneNumber)); filter.add(new FilterItem("parent_id", FilterItem.equals, activityId)); filter.add(new FilterItem("check_in", FilterItem.equals, 1)); - ObjectCollection collection = ormGenDataSourceUtil.query("check_in_out", filter, new Selector()); + collection = ormGenDataSourceUtil.query("check_in_out", filter, new Selector()); if (collection != null && !collection.isEmpty()) { ObjectValue object = collection.getObject(0); object.put("check_out", 1); - ormGenDataSourceUtil.update("check_in_out", object, new Selector()); + ormGenDataSourceUtil.update("check_in_out", object, null); } } return ResponseResult.success("签到成功!!!"); diff --git a/common/common-association/src/main/java/apelet/association/plugin/clueManage/ClueManageFormPlugin.java b/common/common-association/src/main/java/apelet/association/plugin/clueManage/ClueManageFormPlugin.java index 4c64b60..7603645 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/clueManage/ClueManageFormPlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/clueManage/ClueManageFormPlugin.java @@ -3,6 +3,11 @@ package apelet.association.plugin.clueManage; import apelet.common.core.object.ObjectValue; import apelet.common.online.abstractplugin.ExecutePluginParent; import apelet.common.online.model.constant.AttributeEnum; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +import java.util.Arrays; +import java.util.List; public class ClueManageFormPlugin extends ExecutePluginParent { @@ -10,6 +15,46 @@ public class ClueManageFormPlugin extends ExecutePluginParent { @Override public void formCreated(String widgetVariableName, ObjectValue objectValue) { + + if(objectValue.getString("id") != null){ + String billstatus = objectValue.getString("billstatus"); + if("A".equals(billstatus)){ + List list = Arrays.asList( + createButtonConfig("保存", true), + createButtonConfig("放弃线索申请", false), + createButtonConfig("审核", false), + createButtonConfig("激活", true), + createButtonConfig("撤销", false), + createButtonConfig("反审核", false) + ); + this.setWidgetAttribute("", AttributeEnum.BTN_HIDDEN, list); + } + if("B".equals(billstatus)){ + + List list = Arrays.asList( + createButtonConfig("保存", false), + createButtonConfig("放弃线索申请", false), + createButtonConfig("审核", false), + createButtonConfig("激活", false), + createButtonConfig("撤销", true), + createButtonConfig("反审核", false) + ); + this.setWidgetAttribute("", AttributeEnum.BTN_HIDDEN, list); + } + + if("C".equals(billstatus)){ + + List list = Arrays.asList( + createButtonConfig("保存", false), + createButtonConfig("放弃线索申请", true), + createButtonConfig("审核", false), + createButtonConfig("激活", false), + createButtonConfig("撤销", true), + createButtonConfig("反审核", false) + ); + this.setWidgetAttribute("", AttributeEnum.BTN_HIDDEN, list); + } + } super.formCreated(widgetVariableName, objectValue); if (objectValue.get("clue_type") == null) { this.setWidgetAttribute("clueType", AttributeEnum.VALUE_CHANGE, "0"); @@ -19,4 +64,13 @@ public class ClueManageFormPlugin extends ExecutePluginParent { } } + + private JSONObject createButtonConfig(String name, boolean isHidden) { + JSONObject btn = new JSONObject(); + btn.put("name", name); + btn.put("isHidden", !isHidden); + return btn; + } + + } diff --git a/common/common-association/src/main/java/apelet/association/plugin/member/MembershipSavePlugin.java b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipSavePlugin.java index 301664a..f9e16ef 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/member/MembershipSavePlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipSavePlugin.java @@ -141,7 +141,8 @@ public class MembershipSavePlugin extends ExecutePluginParent { // 新增验重:unit_name 已存在则拒绝新增 ObjectValue existBill = findExistBillByUnitName(unitName); if (existBill != null) { - throw new MyRuntimeException("单位【" + unitName + "】已存在,请勿重复新增"); + this.showErrorMessage("单位【" + unitName + "】已存在,请勿重复新增"); + return; } String number = generateNumber(); objectValue.put("number", number);