Explorar o código

问卷 新闻 消息推送

shuzhan hai 11 meses
pai
achega
bd05e0f195

+ 10 - 0
common/src/main/java/com/jpsoft/campus/modules/base/dto/ApplicationPrimaryDTO.java

@@ -34,6 +34,16 @@ public class ApplicationPrimaryDTO implements Serializable {
     @ApiModelProperty(value = "性别:1男2女")
     private Integer sex;
 
+    public String getSexN(){
+        String sexN = "男";
+        if(sex == 1){
+            sexN = "男";
+        }else{
+            sexN = "女";
+        }
+        return sexN;
+    }
+
     @NotBlank(message = "证件类型不能为空")
     @ApiModelProperty(value = "证件类型")
     private String cardType;

+ 48 - 1
common/src/main/java/com/jpsoft/campus/modules/common/utils/WechatMessageUtil.java

@@ -184,7 +184,54 @@ public class WechatMessageUtil {
         sendData.put("remark", remark);
 
         //w8Zk_VQMFIEVSIBPZid7zSrvHmBdrgnqF76u8PLCZEs cs
-        boolean ret = sendTemplate(sendData,tokenUrl, appId, appSecret, templateId, openId, "");
+        boolean ret = sendTemplate(sendData,tokenUrl, appId, appSecret, templateId, openId, "http://wsbm.xiaoxinda.com/#/resultQuery");
+
+        return ret;
+    }
+
+    /**
+     * 微信发送模版
+     * 跳转新闻
+     * @return
+     */
+    public static boolean sendNewsMessageTemplate(String userName,String content,
+                                               String sendRemark,
+                                               String sendDate,
+                                               String openId, String templateId,String tokenUrl, String appId, String appSecret,String url) {
+        JSONObject sendData = new JSONObject();
+
+        if(com.jpsoft.campus.modules.common.utils.StringUtils.isEmpty(url)){
+            url = "http://wsbm.xiaoxinda.com/#/resultQuery";
+        }
+
+        JSONObject first = new JSONObject();
+        first.put("value", "审核结果通知");
+        first.put("color", "#FF0000");
+
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", userName);
+        keyword1.put("color", "#173177");
+
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", content);
+        keyword2.put("color", "#173177");
+
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", sendDate);
+        keyword3.put("color", "#173177");
+
+        JSONObject remark = new JSONObject();
+        remark.put("value", sendRemark);
+        remark.put("color", "#173177");
+
+        sendData.put("first", first);
+        sendData.put("keyword1", keyword1);
+        sendData.put("keyword2", keyword2);
+        sendData.put("keyword3", keyword3);
+        sendData.put("remark", remark);
+
+        //w8Zk_VQMFIEVSIBPZid7zSrvHmBdrgnqF76u8PLCZEs cs
+        boolean ret = sendTemplate(sendData,tokenUrl, appId, appSecret, templateId, openId, url);
 
         return ret;
     }

+ 1 - 0
common/src/main/java/com/jpsoft/campus/modules/common/utils/WeixinUtil.java

@@ -53,6 +53,7 @@ public class WeixinUtil {
 
 	//通过code换取网页授权access_token
 	public static String accessTokenurl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
+	public static String access_token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
 	public static AccessToken getAccessToken(String appid, String appsecret,String code) throws Exception {
         AccessToken accessToken = null;
         String formatUrl = accessTokenurl.replace("APPID", appid).replace("SECRET",appsecret).replace("CODE", code);

+ 4 - 0
common/src/main/resources/mapper/base/ApplicationPrimary.xml

@@ -176,6 +176,7 @@
         <where>
             and a.del_flag = 0
             <if test="searchParams.type != null">
+
                 and a.type_ like #{searchParams.type}
             </if>
             <if test="searchParams.name != null">
@@ -207,6 +208,9 @@
             <if test="searchParams.hit != null">
                 and a.hit_ = #{searchParams.hit}
             </if>
+            <if test="searchParams.notHit != null">
+                and (a.hit_ = #{searchParams.hit} or a.hit_ is null)
+            </if>
         </where>
         <foreach item="sort" collection="sortList" open="order by" separator=",">
             ${sort.name} ${sort.order}

+ 145 - 31
web/src/main/java/com/jpsoft/campus/modules/base/controller/ApplicationPrimaryController.java

@@ -49,6 +49,7 @@ import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 @RestController
@@ -85,6 +86,8 @@ public class ApplicationPrimaryController {
     private WechatConfig wechatConfig;
     @Autowired
     private ApportionDetailService apportionDetailService;
+    @Autowired
+    private NewsInfoService newsInfoService;
 
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
@@ -1038,9 +1041,17 @@ public class ApplicationPrimaryController {
     public MessageResult<ApprovalInfo> fore(String id,String remark,String fileUrl,@RequestAttribute String subject){
         //当前用户ID
         System.out.println(subject);
+        User user = userService.get(subject);
         MessageResult<ApprovalInfo> msgResult = new MessageResult<>();
 
         try {
+
+            //1分钟限制
+//            boolean repeat = valueOperations.setIfAbsent("out_" + telephone,true,1, TimeUnit.MINUTES);
+//            if(!repeat){
+//                throw new Exception("操作过于频繁!");
+//            }
+
             ApplicationPrimary applicationPrimary = applicationPrimaryService.get(id);
 
             ApprovalInfo approvalInfo = new ApprovalInfo();
@@ -1105,7 +1116,9 @@ public class ApplicationPrimaryController {
                         } else {
                             applicationPrimary.setStatus(String.valueOf(Integer.parseInt(applicationPrimary.getStatus()) + 10));
                         }
-                    } else {
+                    } else if("5".equals(applicationPrimary.getStatus())){
+                        throw new Exception("已退回的无法操作");
+                    }else {
                         applicationPrimary.setStatus(String.valueOf(Integer.parseInt(applicationPrimary.getStatus()) + 10));
                     }
                 }
@@ -1114,11 +1127,42 @@ public class ApplicationPrimaryController {
                 applicationPrimary.setUpdateTime(new Date());
                 applicationPrimaryService.update(applicationPrimary);
 
+
+//                new Thread(() -> {
+//                    try {
+//                        String statusN = "";
+//
+//                        //当前要-10
+//                        if("20".equals(applicationPrimary.getStatus())){
+//                            //20-10 待现场复审 A类7月12-13日 C类14-15日
+//                            if ("A".equals(applicationPrimary.getType()) ) {
+//                                statusN = "初审,请于7月12日,13日携材料到学校复审!";
+//                            }else if("C".equals(applicationPrimary.getType()) ){
+//                                statusN = "初审,请于7月14日,15日携材料到学校复审!";
+//                            }
+//                        }else if("30".equals(applicationPrimary.getStatus())){
+//                            //30-10 待校长复审
+//                            statusN = "现场复审,请等待后续审批!";
+//                        }else if("40".equals(applicationPrimary.getStatus())){
+//                            //待审定
+//                            statusN = "校长复审,请等待后续审批!";
+//                        }else if("50".equals(applicationPrimary.getStatus())){
+//                            //预录取待确认
+//                            statusN = "招生办审定,请等待后续审批!";
+//                        }
+//
+//                        String content = "通过" + statusN;
+//                        sendMessage(content, applicationPrimary.getPersonId(),user.getRealName());
+//                    } catch (Exception ex) {
+//                        ex.printStackTrace();
+//                    }
+//                }).start();
+
                 msgResult.setResult(true);
                 msgResult.setData(approvalInfo);
             } else {
                 msgResult.setResult(false);
-                msgResult.setMessage("数据库添加失败");
+                msgResult.setMessage("操作失败");
             }
         }
         catch(Exception ex){
@@ -1537,8 +1581,8 @@ public class ApplicationPrimaryController {
                 ApplicationPrimary applicationPrimary = applicationPrimaryService.get(id);
                 PersonInfo personInfo = personInfoService.get(applicationPrimary.getPersonId());
                 boolean messageResult = WechatMessageUtil.sendMessageTemplate(
-                            user.getUserName(),message,
-                            "",sendDate,personInfo.getOpenId(),
+                            user.getRealName(),message,
+                        "",sendDate,personInfo.getOpenId(),
                             wechatConfig.getBackNoticeTemplateId(),
                             wechatConfig.getTokenUrl(),
                             appId,appSecret);
@@ -1562,6 +1606,67 @@ public class ApplicationPrimaryController {
         return msgResult;
     }
 
+    @ApiOperation(value="发送新闻微信消息")
+    @RequestMapping(value = "sendNewsWechatMessage",method = RequestMethod.POST)
+    public MessageResult<Integer> sendNewsWechatMessage(
+            String idList,
+            String message,
+            @RequestAttribute String subject){
+        //当前用户ID
+        System.out.println(subject);
+        MessageResult<Integer> msgResult = new MessageResult<>();
+        User user = userService.get(subject);
+        try {
+            String appId = wechatConfig.getAppId();
+            String appSecret = wechatConfig.getAppSecret();
+            String []ids = idList.split(",");
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            String sendDate = sdf.format(new Date());
+            int messageNum = 0;
+
+            NewsInfo news = new NewsInfo();
+            news.setId(UUID.randomUUID().toString());
+            news.setContent(message);
+            news.setDelFlag(false);
+            news.setCreateBy(subject);
+            news.setCreateTime(new Date());
+            news.setStatus("0");
+            news.setSortNo(10000);
+            news.setTitle("公告消息");
+            news.setType("4");
+            news.setLogo("http://admission-46879.oss-cn-hangzhou.aliyuncs.com/upload/school/2022/5/13161428461.jpg");
+            newsInfoService.insert(news);
+            String url = "http://wsbm.xiaoxinda.com/#/news/info?id=" + news.getId();
+
+            for(String id: ids){
+                ApplicationPrimary applicationPrimary = applicationPrimaryService.get(id);
+                PersonInfo personInfo = personInfoService.get(applicationPrimary.getPersonId());
+                boolean messageResult = WechatMessageUtil.sendNewsMessageTemplate(
+                        user.getRealName(),message,
+                        "",sendDate,personInfo.getOpenId(),
+                        wechatConfig.getBackNoticeTemplateId(),
+                        wechatConfig.getTokenUrl(),
+                        appId,appSecret,url);
+                if(messageResult){
+                    applicationPrimary.setIsSend(true);
+                    applicationPrimary.setSendTime(new Date());
+                    applicationPrimaryService.update(applicationPrimary);
+                    messageNum ++ ;
+                }
+            }
+
+            msgResult.setResult(true);
+            msgResult.setData(messageNum);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+        return msgResult;
+    }
+
     @ApiOperation(value="调剂")
     @RequestMapping(value = "tjPrimary",method = RequestMethod.POST)
     public MessageResult<Integer> tjPrimary(
@@ -1668,7 +1773,8 @@ public class ApplicationPrimaryController {
                         offerInfoService.insert(off);
                         new Thread(() -> {
                             try {
-                                String content = "尊敬的家长您好,您的报名申请已通过,请前往“荆州开发区网上入学”--报名查询,下载电子版入学通知书。";
+                                //String content = "您的报名申请已通过,请前往“荆州开发区网上入学”--报名查询,下载电子版入学通知书。";
+                                String content = "学生已经被录取,请前往报名查询,下载电子版入学通知书。";
                                 sendMessage(content, applicationPrimary.getPersonId(),user.getRealName());
                             } catch (Exception ex) {
                                 ex.printStackTrace();
@@ -1897,7 +2003,9 @@ public class ApplicationPrimaryController {
                         applicationPrimary.setOfferImg(uploadUrl);
                         new Thread(() -> {
                             try {
-                                String content = "尊敬的家长您好,您的报名申请已通过,请前往“荆州开发区网上入学”--报名查询,下载电子版入学通知书。";
+                                //String content = "尊敬的家长您好,您的报名申请已通过,请前往“荆州开发区网上入学”--报名查询,下载电子版入学通知书。";
+                                                //报名申请已通过招生办审定,请等待后续审批!
+                                String content = "学生已经被录取,请前往报名查询,下载电子版入学通知书。";
                                 sendMessage(content, applicationPrimary.getPersonId(),user.getRealName());
                             } catch (Exception ex) {
                                 ex.printStackTrace();
@@ -2401,17 +2509,19 @@ public class ApplicationPrimaryController {
             HSSFCell cellTitle5 = rowTitle.createCell(4);
             cellTitle5.setCellValue("学生姓名");
             HSSFCell cellTitle6 = rowTitle.createCell(5);
-            cellTitle6.setCellValue("证件号码");
+            cellTitle6.setCellValue("性别");
             HSSFCell cellTitle7 = rowTitle.createCell(6);
-            cellTitle7.setCellValue("申请时间");
+            cellTitle7.setCellValue("证件号码");
             HSSFCell cellTitle8 = rowTitle.createCell(7);
-            cellTitle8.setCellValue("登记人姓名");
+            cellTitle8.setCellValue("申请时间");
             HSSFCell cellTitle9 = rowTitle.createCell(8);
-            cellTitle9.setCellValue("联系电话");
+            cellTitle9.setCellValue("登记人姓名");
             HSSFCell cellTitle10 = rowTitle.createCell(9);
-            cellTitle10.setCellValue("学生地址");
+            cellTitle10.setCellValue("联系电话");
             HSSFCell cellTitle11 = rowTitle.createCell(10);
-            cellTitle11.setCellValue("插班生报名年级");
+            cellTitle11.setCellValue("学生地址");
+            HSSFCell cellTitle12 = rowTitle.createCell(11);
+            cellTitle12.setCellValue("插班生报名年级");
 
 //            int maxColumn = sheet.getRow(0).getPhysicalNumberOfCells();
 //            for(int i = 1; i < maxColumn; i++) {
@@ -2424,20 +2534,21 @@ public class ApplicationPrimaryController {
             sheet.setColumnWidth(3, 15 * 256);
             sheet.setColumnWidth(4, 15 * 256);
             sheet.setColumnWidth(5, 25 * 256);
-            sheet.setColumnWidth(6, 20 * 256);
-            sheet.setColumnWidth(7, 15 * 256);
-            sheet.setColumnWidth(8, 20 * 256);
-            sheet.setColumnWidth(9, 40 * 256);
-            sheet.setColumnWidth(10, 20 * 256);
+            sheet.setColumnWidth(6, 15 * 256);
+            sheet.setColumnWidth(7, 20 * 256);
+            sheet.setColumnWidth(8, 15 * 256);
+            sheet.setColumnWidth(9, 20 * 256);
+            sheet.setColumnWidth(10, 40 * 256);
+            sheet.setColumnWidth(11, 20 * 256);
 
             Map<String,Object> searchParams = new HashMap<>();
 
             List<Sort> sortList = new ArrayList<>();
             sortList.add(new Sort("a.school_id","asc"));
             sortList.add(new Sort("a.type_","asc"));
-            sortList.add(new Sort("a.category_id","desc"));
+            //sortList.add(new Sort("a.category_id","desc"));
             sortList.add(new Sort("a.offer_code","asc"));
-            sortList.add(new Sort("a.create_time","desc"));
+            //sortList.add(new Sort("a.create_time","desc"));
 
             if (StringUtils.isNotEmpty(tabStatus)) {
                 searchParams.put("tabStatus",tabStatus);
@@ -2543,27 +2654,30 @@ public class ApplicationPrimaryController {
 //                "学生姓名"
                 HSSFCell cellContent5 = rowContent.createCell(4);
                 cellContent5.setCellValue(apDTO.getName());
-//                "证件号码"
+                //                "性别"
                 HSSFCell cellContent6 = rowContent.createCell(5);
-                cellContent6.setCellValue(apDTO.getIdCard());
-//                "申请时间"
+                cellContent6.setCellValue(apDTO.getSexN());
+//                "证件号码"
                 HSSFCell cellContent7 = rowContent.createCell(6);
+                cellContent7.setCellValue(apDTO.getIdCard());
+//                "申请时间"
+                HSSFCell cellContent8 = rowContent.createCell(7);
                 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-                cellContent7.setCellValue(sdf.format(apDTO.getCreateTime()));
+                cellContent8.setCellValue(sdf.format(apDTO.getCreateTime()));
                 //"登记人姓名"
-                HSSFCell cellContent8 = rowContent.createCell(7);
-                cellContent8.setCellValue(apDTO.getPersonName());
-                //联系电话
                 HSSFCell cellContent9 = rowContent.createCell(8);
-                cellContent9.setCellValue(apDTO.getPersonPhone());
-                //"学生地址"
+                cellContent9.setCellValue(apDTO.getPersonName());
+                //联系电话
                 HSSFCell cellContent10 = rowContent.createCell(9);
-                cellContent10.setCellValue(apDTO.getAddress());
+                cellContent10.setCellValue(apDTO.getPersonPhone());
+                //"学生地址"
+                HSSFCell cellContent11 = rowContent.createCell(10);
+                cellContent11.setCellValue(apDTO.getAddress());
 
                 //插班转学录取年级
-                HSSFCell cellContent11 = rowContent.createCell(10);
+                HSSFCell cellContent12 = rowContent.createCell(11);
                 if(apDTO.getSchoolNumber() != null) {
-                    cellContent11.setCellValue(apDTO.getSchoolNumber().getGradeStr());
+                    cellContent12.setCellValue(apDTO.getSchoolNumber().getGradeStr());
                 }
             }
 

+ 1 - 1
web/src/main/java/com/jpsoft/campus/modules/base/controller/ApportionController.java

@@ -316,7 +316,7 @@ public class ApportionController {
             }
 
             //随机
-            searchParams.put("hit","0");
+            searchParams.put("notHit","0");
             searchParams.put("delFlag","0");
             Page<ApplicationPrimary> applicationPrimaryPage = applicationPrimaryService.pageSearch(searchParams,1,100000,false,sortList);
 

+ 0 - 3
web/src/main/resources/application-production.yml

@@ -31,6 +31,3 @@ springfox:
 baidu:
   ak: "ECKKpSyZRaFqtfSEV0TSyPZP"
   sk: "fZSDklYCuAcDryMYGL37ed1I2LmAEDvu"
-
-wechat:
-  tokenUrl: "http://192.168.0.1:8080/weixin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET"

+ 1 - 1
web/src/main/resources/application.yml

@@ -116,7 +116,7 @@ wechat:
 #  appSecret: 43557bd62f77b0c3d6670e991872f0e7
   appId: wx0c81770a72543e27
   appSecret: ea8c0d18eae536e3ec16333864e71252
-  tokenUrl: "http://ykt.xiaoxinda.com/weixin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET"
+  tokenUrl: "https://51team.xiaoxinda.com/weixin-server/token?grant_type=client_credential&appid=APPID&secret=APPSECRET"
   backNoticeTemplateId: "Ya2TByTerPfIxfqMwfFq2G-BMsuyWZOslk-g5cHSWfs"
 oss:
   accessKeyId: "LTAIXIyrXmjgOXQa"

BIN=BIN
web/src/main/resources/static/middle_tzs.jpg


BIN=BIN
web/src/main/resources/static/primary_tzs.jpg