From 6b9acef655348cf1c7af196bb9bcd01671aab96f Mon Sep 17 00:00:00 2001 From: cuibaocheng Date: Fri, 17 Sep 2021 17:16:47 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BC=98=E5=8C=96=E4=BA=86=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2SQL=202.=20=E6=8E=A7=E5=88=B6=E5=8F=B0=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E6=94=AF=E6=8C=81=E9=80=89=E6=8B=A9=E4=BA=BA=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cardconsole/CardConsoleController.java} | 6 +- .../CardTemplateScansAppController.java | 6 +- ...r.java => CardConsoleRouteController.java} | 8 ++- .../systemcard/filter/CardAppException.java | 5 +- .../systemcard/filter/CardAppFilter.java | 5 ++ .../impl/CardTemplateScansServiceImpl.java | 49 +++++++++++---- .../impl/CardTemplateUseServiceImpl.java | 6 +- .../card-template-scans-mapper.xml | 8 +-- .../assets/bigdata/js/safety/js/context.js | 6 +- .../assets/js/vendor/safety/js/context.js | 2 +- .../assets/layuiadmin/modules/dialog.js | 1 + .../resources/templates/account/list.html | 2 +- .../templates/cardconsole/console.html | 60 +++++++++++++++++-- 13 files changed, 130 insertions(+), 34 deletions(-) rename src/main/java/cn/com/tenlion/systemcard/controller/{app/api/cardconsole/CardConsoleAppController.java => api/cardconsole/CardConsoleController.java} (90%) rename src/main/java/cn/com/tenlion/systemcard/controller/route/cardconsole/{CardConsoleController.java => CardConsoleRouteController.java} (83%) diff --git a/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardconsole/CardConsoleAppController.java b/src/main/java/cn/com/tenlion/systemcard/controller/api/cardconsole/CardConsoleController.java similarity index 90% rename from src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardconsole/CardConsoleAppController.java rename to src/main/java/cn/com/tenlion/systemcard/controller/api/cardconsole/CardConsoleController.java index 61ba3ec..bcb3361 100644 --- a/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardconsole/CardConsoleAppController.java +++ b/src/main/java/cn/com/tenlion/systemcard/controller/api/cardconsole/CardConsoleController.java @@ -1,4 +1,4 @@ -package cn.com.tenlion.systemcard.controller.app.api.cardconsole; +package cn.com.tenlion.systemcard.controller.api.cardconsole; import cn.com.tenlion.configcolumn.pojo.dtos.configcolumngroup.ConfigColumnGroupDTO; import cn.com.tenlion.projectconfig.util.ProjectConfigUtil; @@ -29,8 +29,8 @@ import java.util.Map; **/ @Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "接口") @RestController -@RequestMapping(ISystemConstant.APP_PREFIX + "/cardconsole") -public class CardConsoleAppController extends DefaultBaseController { +@RequestMapping(ISystemConstant.API_PREFIX + "/cardconsole") +public class CardConsoleController extends DefaultBaseController { @Autowired private IMiniappUserService iMiniappUserService; diff --git a/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardtemplatescans/CardTemplateScansAppController.java b/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardtemplatescans/CardTemplateScansAppController.java index 28eb6e1..c510424 100644 --- a/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardtemplatescans/CardTemplateScansAppController.java +++ b/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardtemplatescans/CardTemplateScansAppController.java @@ -1,6 +1,7 @@ package cn.com.tenlion.systemcard.controller.app.api.cardtemplatescans; import cn.com.tenlion.systemcard.pojo.vos.cardtemplatescans.CardTemplateScansSaveVO; +import cn.com.tenlion.systemcard.socket.CardLogSocket; import ink.wgink.annotation.CheckRequestBodyAnnotation; import ink.wgink.common.base.DefaultBaseController; import ink.wgink.common.component.SecurityComponent; @@ -110,8 +111,11 @@ public class CardTemplateScansAppController extends DefaultBaseController { params.put("cardTemplateUseUserId", userId); } page.setParams(params); - return cardTemplateScansService.listPage(page); + SuccessResultList> list = cardTemplateScansService.listPage(page); + return list; } + @Autowired + CardLogSocket cardLogSocket; } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemcard/controller/route/cardconsole/CardConsoleController.java b/src/main/java/cn/com/tenlion/systemcard/controller/route/cardconsole/CardConsoleRouteController.java similarity index 83% rename from src/main/java/cn/com/tenlion/systemcard/controller/route/cardconsole/CardConsoleController.java rename to src/main/java/cn/com/tenlion/systemcard/controller/route/cardconsole/CardConsoleRouteController.java index cdcb1c8..e959a4c 100644 --- a/src/main/java/cn/com/tenlion/systemcard/controller/route/cardconsole/CardConsoleController.java +++ b/src/main/java/cn/com/tenlion/systemcard/controller/route/cardconsole/CardConsoleRouteController.java @@ -21,7 +21,7 @@ import org.springframework.web.servlet.ModelAndView; @Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "CBC日志控制台") @RestController @RequestMapping(ISystemConstant.ROUTE_PREFIX + "/cardconsole") -public class CardConsoleController extends DefaultBaseController { +public class CardConsoleRouteController extends DefaultBaseController { @Autowired private ServerProperties systemProperties; @@ -33,4 +33,10 @@ public class CardConsoleController extends DefaultBaseController { return mv; } + @GetMapping("appuser") + public ModelAndView appUser() { + ModelAndView mv = new ModelAndView("cardconsole/select-department-appuser"); + return mv; + } + } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/systemcard/filter/CardAppException.java b/src/main/java/cn/com/tenlion/systemcard/filter/CardAppException.java index bbecf76..1d896dc 100644 --- a/src/main/java/cn/com/tenlion/systemcard/filter/CardAppException.java +++ b/src/main/java/cn/com/tenlion/systemcard/filter/CardAppException.java @@ -1,5 +1,6 @@ package cn.com.tenlion.systemcard.filter; +import cn.com.tenlion.projectconfig.util.ProjectConfigUtil; import cn.com.tenlion.systemcard.socket.CardLogSocket; import ink.wgink.common.component.SecurityComponent; import ink.wgink.pojo.app.AppTokenUser; @@ -33,7 +34,9 @@ public class CardAppException { @ExceptionHandler(Exception.class) public ModelAndView customException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Exception e) { - System.out.println(e.getMessage()); + if (!ProjectConfigUtil.getSwitch("consoleDebugSwitch")) { + return null; + } e.printStackTrace(); HttpServletRequest httpRequest = (HttpServletRequest) httpServletRequest; String token = httpRequest.getHeader("token"); diff --git a/src/main/java/cn/com/tenlion/systemcard/filter/CardAppFilter.java b/src/main/java/cn/com/tenlion/systemcard/filter/CardAppFilter.java index 7e3bd34..f801820 100644 --- a/src/main/java/cn/com/tenlion/systemcard/filter/CardAppFilter.java +++ b/src/main/java/cn/com/tenlion/systemcard/filter/CardAppFilter.java @@ -1,5 +1,6 @@ package cn.com.tenlion.systemcard.filter; +import cn.com.tenlion.projectconfig.util.ProjectConfigUtil; import cn.com.tenlion.systemcard.socket.CardLogSocket; import ink.wgink.common.base.DefaultBaseController; import ink.wgink.common.component.SecurityComponent; @@ -38,6 +39,10 @@ public class CardAppFilter extends DefaultBaseController implements Filter { @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { + if (!ProjectConfigUtil.getSwitch("consoleDebugSwitch")) { + filterChain.doFilter(servletRequest, servletResponse); + return; + } HttpServletRequest httpRequest = (HttpServletRequest) servletRequest; String token = httpRequest.getHeader("token"); String url = httpRequest.getRequestURI(); diff --git a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplatescans/impl/CardTemplateScansServiceImpl.java b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplatescans/impl/CardTemplateScansServiceImpl.java index 43dddb8..a73337c 100644 --- a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplatescans/impl/CardTemplateScansServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplatescans/impl/CardTemplateScansServiceImpl.java @@ -1,8 +1,10 @@ package cn.com.tenlion.systemcard.service.cardtemplatescans.impl; +import cn.com.tenlion.systemcard.pojo.dtos.cardtemplate.CardTemplateDTO; import cn.com.tenlion.systemcard.pojo.dtos.cardtemplateuse.CardTemplateUseDTO; import cn.com.tenlion.systemcard.pojo.vos.cardtemplatescans.CardTemplateScansSaveVO; import cn.com.tenlion.systemcard.service.cardtemplateuse.ICardTemplateUseService; +import cn.com.tenlion.systemcard.socket.CardLogSocket; import ink.wgink.common.base.DefaultBaseService; import ink.wgink.exceptions.SaveException; import ink.wgink.module.wechat.pojo.pos.miniapp.MiniappUserPO; @@ -226,6 +228,7 @@ public class CardTemplateScansServiceImpl extends DefaultBaseService implements return list; } + @Override public List listBO(Map params) { return cardTemplateScansDao.listBO(params); @@ -240,23 +243,49 @@ public class CardTemplateScansServiceImpl extends DefaultBaseService implements public SuccessResultList> listPage(ListPage page) { PageHelper.startPage(page.getPage(), page.getRows()); List cardTemplateScansDTOs = list(page.getParams()); - // 加载系统默认名片在最上面 - if(1 == page.getPage() && page.getParams().get("homePage") != null && 1 == Integer.valueOf(page.getParams().get("homePage").toString())) { + // 为了让系统默认名片在最上面 , 把本页的系统默认名片先删除掉 + Iterator scansDTOIterator = cardTemplateScansDTOs.iterator(); + while(scansDTOIterator.hasNext()) { + CardTemplateScansDTO cardTemplateScansDTO = scansDTOIterator.next(); + CardTemplateUseDTO useDTO = iCardTemplateUseService.get(cardTemplateScansDTO.getCardTemplateUseId()); + if("1".equals(useDTO.getCardTemplateUseSystem())) { + scansDTOIterator.remove(); + } + } + // 把系统默认名片放到第一页 + if(1 == page.getPage()) { CardTemplateUseDTO cardTemplateUseDTO = iCardTemplateUseService.getSystemCard(); - List cardTemplateScansDTOList = new ArrayList(); if(cardTemplateUseDTO != null) { CardTemplateScansDTO scansDTO = new CardTemplateScansDTO(); scansDTO.setCardTemplateUseId(cardTemplateUseDTO.getCardTemplateUseId()); scansDTO.setCardTemplateUseDTO(cardTemplateUseDTO); - cardTemplateScansDTOList.add(scansDTO); + cardTemplateScansDTOs.add(0, scansDTO); } - cardTemplateScansDTOList.addAll(cardTemplateScansDTOs); - PageInfo pageInfo = new PageInfo<>(cardTemplateScansDTOList); - return new SuccessResultList<>(cardTemplateScansDTOList, pageInfo.getPageNum(), pageInfo.getTotal()); - }else { - PageInfo pageInfo = new PageInfo<>(cardTemplateScansDTOs); - return new SuccessResultList<>(cardTemplateScansDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); } + PageInfo pageInfo = new PageInfo<>(cardTemplateScansDTOs); + return new SuccessResultList<>(cardTemplateScansDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); + // 加载系统默认名片在最上面 +// if(1 == page.getPage() && page.getParams().get("homePage") != null && 1 == Integer.valueOf(page.getParams().get("homePage").toString())) { +// +// /** +// * 如果有系统默认名片. 删除掉, +// */ +// +// CardTemplateUseDTO cardTemplateUseDTO = iCardTemplateUseService.getSystemCard(); +// List cardTemplateScansDTOList = new ArrayList(); +// if(cardTemplateUseDTO != null) { +// CardTemplateScansDTO scansDTO = new CardTemplateScansDTO(); +// scansDTO.setCardTemplateUseId(cardTemplateUseDTO.getCardTemplateUseId()); +// scansDTO.setCardTemplateUseDTO(cardTemplateUseDTO); +// cardTemplateScansDTOList.add(scansDTO); +// } +// cardTemplateScansDTOList.addAll(cardTemplateScansDTOs); +// PageInfo pageInfo = new PageInfo<>(cardTemplateScansDTOList); +// return new SuccessResultList<>(cardTemplateScansDTOList, pageInfo.getPageNum(), pageInfo.getTotal()); +// }else { +// PageInfo pageInfo = new PageInfo<>(cardTemplateScansDTOs); +// return new SuccessResultList<>(cardTemplateScansDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); +// } } @Override diff --git a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplateuse/impl/CardTemplateUseServiceImpl.java b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplateuse/impl/CardTemplateUseServiceImpl.java index d9f6028..285e7d3 100644 --- a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplateuse/impl/CardTemplateUseServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplateuse/impl/CardTemplateUseServiceImpl.java @@ -338,7 +338,7 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC buildingPicturesMap.put(buildingDTO.getTemplateAreaSource(), userPO.getAvatarUrl()); // 海报小程序二维码 }else if("currentUserPosterQRCode".equals(buildingDTO.getTemplateAreaSource())) { - buildingPicturesMap.put(buildingDTO.getTemplateAreaSource(), "appid=" + WeiXinUtils.getAppKey() + "&secret=" + WeiXinUtils.getAppSecret() + "&path=pages/index/index&cardTemplateUseId=" + cardTemplateUseId); + buildingPicturesMap.put(buildingDTO.getTemplateAreaSource(), "appid=" + WeiXinUtils.getAppKey() + "&secret=" + WeiXinUtils.getAppSecret() + "&path=pages/index/index&cardTemplateUseId=" + cardTemplateUseId + "&userId=" + "e022768c-14f4-4dde-847f-b51587be9d36" ); // 名片小程序二维码 }else if("currentUserQRCode".equals(buildingDTO.getTemplateAreaSource())) { buildingPicturesMap.put(buildingDTO.getTemplateAreaSource(), "appid=" + WeiXinUtils.getAppKey() + "&secret=" + WeiXinUtils.getAppSecret() + "&path=pages/index/index&cardTemplateDispatchId=" + cardTemplateUseId); @@ -402,7 +402,7 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC String cardTemplateDispatchId = iCardTemplateDispatchService.saveReturnId(token, cardTemplateDispatchSaveVO); if("2".equals(cardTemplateAppDTO.getTemplateMode())) { // 生成海报二维码 - BufferedImage weiXinImage = WeiXinBarCodeUtils.getBarCodeImage(appKey, appSecret, "pages/index/index?cardTemplateUseId=" + cardTemplateUseId, 200); + BufferedImage weiXinImage = WeiXinBarCodeUtils.getBarCodeImage(appKey, appSecret, "pages/index/index?cardTemplateUseId=" + cardTemplateUseId + "&userId=" + getUserId(token) , 200); String fileId = iPicturesTemplateBuildingService.saveBufferImageToFile(weiXinImage); vo.setCardTemplateUseBarcode(fileId); }else{ @@ -567,7 +567,7 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC buildingPicturesMap.put(useAreaDTO.getTemplateAreaSource(), userPO.getAvatarUrl()); // 海报小程序二维码 }else if("currentUserPosterQRCode".equals(useAreaDTO.getTemplateAreaSource())) { - buildingPicturesMap.put(useAreaDTO.getTemplateAreaSource(), "appid=" + WeiXinUtils.getAppKey() + "&secret=" + WeiXinUtils.getAppSecret() + "&path=pages/index/index&cardTemplateUseId=" + cardTemplateUseId); + buildingPicturesMap.put(useAreaDTO.getTemplateAreaSource(), "appid=" + WeiXinUtils.getAppKey() + "&secret=" + WeiXinUtils.getAppSecret() + "&path=pages/index/index&cardTemplateUseId=" + cardTemplateUseId + "&userId=" + getUserId(token) ); // 名片小程序二维码 }else if("currentUserQRCode".equals(useAreaDTO.getTemplateAreaSource())) { buildingPicturesMap.put(useAreaDTO.getTemplateAreaSource(), "appid=" + WeiXinUtils.getAppKey() + "&secret=" + WeiXinUtils.getAppSecret() + "&path=pages/index/index&cardTemplateDispatchId=" + cardTemplateUseId); diff --git a/src/main/resources/mybatis/mapper/cardtemplatescans/card-template-scans-mapper.xml b/src/main/resources/mybatis/mapper/cardtemplatescans/card-template-scans-mapper.xml index 7813c42..35e9cf5 100644 --- a/src/main/resources/mybatis/mapper/cardtemplatescans/card-template-scans-mapper.xml +++ b/src/main/resources/mybatis/mapper/cardtemplatescans/card-template-scans-mapper.xml @@ -220,10 +220,10 @@ t1.is_delete FROM e_card_template_scans t1 - LEFT JOIN +/* LEFT JOIN e_card_template_use t2 ON - t1.card_template_use_id = t2.card_template_use_id + t1.card_template_use_id = t2.card_template_use_id*/ WHERE t1.is_delete = 0 @@ -236,9 +236,9 @@ AND t1.card_template_use_id = #{cardTemplateUseId} - + ORDER BY t1.gmt_create DESC diff --git a/src/main/resources/static/assets/bigdata/js/safety/js/context.js b/src/main/resources/static/assets/bigdata/js/safety/js/context.js index fb46ee4..6ac8bfc 100644 --- a/src/main/resources/static/assets/bigdata/js/safety/js/context.js +++ b/src/main/resources/static/assets/bigdata/js/safety/js/context.js @@ -71,9 +71,9 @@ var context = context || (function () { } if (typeof data[i].action !== 'undefined') { var actiond = new Date(), - actionID = 'event-' + actiond.getTime() * Math.floor(Math.random()*100000), - eventAction = data[i].action; - $sub.find('a').attr('id', actionID); + actionID = 'event-' + actiond.getTime() * Math.floor(Math.random()*100000), + eventAction = data[i].action; + $sub.find('a').attr('id', data[i].id ? data[i].id : actionID); $('#' + actionID).addClass('context-event'); $(document).on('click', '#' + actionID, eventAction); } diff --git a/src/main/resources/static/assets/js/vendor/safety/js/context.js b/src/main/resources/static/assets/js/vendor/safety/js/context.js index fb46ee4..884bffc 100644 --- a/src/main/resources/static/assets/js/vendor/safety/js/context.js +++ b/src/main/resources/static/assets/js/vendor/safety/js/context.js @@ -73,7 +73,7 @@ var context = context || (function () { var actiond = new Date(), actionID = 'event-' + actiond.getTime() * Math.floor(Math.random()*100000), eventAction = data[i].action; - $sub.find('a').attr('id', actionID); + $sub.find('a').attr('id', data[i].id ? data[i].id : actionID); $('#' + actionID).addClass('context-event'); $(document).on('click', '#' + actionID, eventAction); } diff --git a/src/main/resources/static/assets/layuiadmin/modules/dialog.js b/src/main/resources/static/assets/layuiadmin/modules/dialog.js index f4370e6..52fcfe0 100644 --- a/src/main/resources/static/assets/layuiadmin/modules/dialog.js +++ b/src/main/resources/static/assets/layuiadmin/modules/dialog.js @@ -70,6 +70,7 @@ layui.define(function(exports) { cancel: function (index) { self.closeBox(); }, + success: opt.onSuccess, end: opt.onClose }); this.dialogArray.push(index); diff --git a/src/main/resources/templates/account/list.html b/src/main/resources/templates/account/list.html index 0441330..c505c00 100644 --- a/src/main/resources/templates/account/list.html +++ b/src/main/resources/templates/account/list.html @@ -22,7 +22,7 @@
- +
diff --git a/src/main/resources/templates/cardconsole/console.html b/src/main/resources/templates/cardconsole/console.html index 80cfe3a..1bb3826 100644 --- a/src/main/resources/templates/cardconsole/console.html +++ b/src/main/resources/templates/cardconsole/console.html @@ -10,6 +10,12 @@ + + + + + + +