Просмотр исходного кода

批量生成图片 批量保存

xiao547607 4 лет назад
Родитель
Сommit
34edb9bf8a

+ 4 - 0
common/src/main/java/com/jpsoft/campus/modules/base/dto/ApplicationMiddleDTO.java

@@ -1,6 +1,7 @@
 package com.jpsoft.campus.modules.base.dto;
 package com.jpsoft.campus.modules.base.dto;
 
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jpsoft.campus.modules.base.entity.ApplicationMiddle;
 import com.jpsoft.campus.modules.base.entity.ApportionDetail;
 import com.jpsoft.campus.modules.base.entity.ApportionDetail;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
@@ -156,4 +157,7 @@ public class ApplicationMiddleDTO implements Serializable {
      */
      */
     @ApiModelProperty(value = "录取编号")
     @ApiModelProperty(value = "录取编号")
     private String offerCode;
     private String offerCode;
+
+    @ApiModelProperty(value = "入学通知书")
+    private String offerImg;
 }
 }

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

@@ -154,4 +154,6 @@ public class ApplicationPrimaryDTO implements Serializable {
      */
      */
     @ApiModelProperty(value = "录取编号")
     @ApiModelProperty(value = "录取编号")
     private String offerCode;
     private String offerCode;
+    @ApiModelProperty(value = "入学通知书")
+    private String offerImg;
 }
 }

+ 3 - 0
common/src/main/java/com/jpsoft/campus/modules/base/entity/ApplicationMiddle.java

@@ -123,4 +123,7 @@ public class ApplicationMiddle {
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
 	@ApiModelProperty(value = "微信消息发送时间")
 	@ApiModelProperty(value = "微信消息发送时间")
 	private Date sendTime;
 	private Date sendTime;
+
+	@ApiModelProperty(value = "入学通知书")
+	private String offerImg;
 }
 }

+ 2 - 1
common/src/main/java/com/jpsoft/campus/modules/base/entity/ApplicationPrimary.java

@@ -120,5 +120,6 @@ public class ApplicationPrimary {
     @ApiModelProperty(value = "微信消息发送时间")
     @ApiModelProperty(value = "微信消息发送时间")
     private Date sendTime;
     private Date sendTime;
 
 
-
+    @ApiModelProperty(value = "入学通知书")
+    private String offerImg;
 }
 }

+ 2 - 0
common/src/main/java/com/jpsoft/campus/modules/base/entity/ApportionDetail.java

@@ -84,4 +84,6 @@ public class ApportionDetail {
 
 
 	@ApiModelProperty(value = "录取学校名称")
 	@ApiModelProperty(value = "录取学校名称")
 	private String schoolName;
 	private String schoolName;
+	@ApiModelProperty(value = "学生名称")
+	private String studentName;
 }
 }

+ 10 - 3
common/src/main/resources/mapper/base/ApplicationMiddle.xml

@@ -26,6 +26,7 @@
         <result property="offerCode" column="offer_code"/>
         <result property="offerCode" column="offer_code"/>
         <result property="isSend" column="is_send"/>
         <result property="isSend" column="is_send"/>
         <result property="sendTime" column="send_time"/>
         <result property="sendTime" column="send_time"/>
+        <result property="offerImg" column="offer_img"/>
     </resultMap>
     </resultMap>
     <insert id="insert" parameterType="com.jpsoft.campus.modules.base.entity.ApplicationMiddle">
     <insert id="insert" parameterType="com.jpsoft.campus.modules.base.entity.ApplicationMiddle">
         <!--
         <!--
@@ -36,7 +37,7 @@
         <![CDATA[
         <![CDATA[
 		insert into base_application_middle
 		insert into base_application_middle
 	    (id_,create_by,create_time,update_by,update_time,del_flag,type_,status_,category_id,now_address,person_id,school_id,student_id,street_id,community_id,choose_reason,hit_,offer_id,
 	    (id_,create_by,create_time,update_by,update_time,del_flag,type_,status_,category_id,now_address,person_id,school_id,student_id,street_id,community_id,choose_reason,hit_,offer_id,
-	    is_send,send_time,offer_code
+	    is_send,send_time,offer_code,offer_img
 	    )
 	    )
 		values
 		values
 		(
 		(
@@ -61,6 +62,7 @@
 			,#{isSend,jdbcType=NUMERIC}
 			,#{isSend,jdbcType=NUMERIC}
 			,#{sendTime,jdbcType=TIMESTAMP}
 			,#{sendTime,jdbcType=TIMESTAMP}
 			,#{offerCode,jdbcType=VARCHAR}
 			,#{offerCode,jdbcType=VARCHAR}
+			,#{offerImg,jdbcType=VARCHAR}
 		)
 		)
 	]]>
 	]]>
     </insert>
     </insert>
@@ -128,7 +130,10 @@
                 send_time=#{sendTime,jdbcType=TIMESTAMP},
                 send_time=#{sendTime,jdbcType=TIMESTAMP},
             </if>
             </if>
             <if test="offerCode!=null">
             <if test="offerCode!=null">
-                offer_code=#{offerCode,jdbcType=TIMESTAMP},
+                offer_code=#{offerCode,jdbcType=VARCHAR},
+            </if>
+            <if test="offerImg!=null">
+                offer_img=#{offerImg,jdbcType=VARCHAR},
             </if>
             </if>
         </set>
         </set>
         where id_=#{id}
         where id_=#{id}
@@ -206,6 +211,7 @@
         <result property="offerId" column="offer_id"/>
         <result property="offerId" column="offer_id"/>
         <result property="offerName" column="offer_name"/>
         <result property="offerName" column="offer_name"/>
         <result property="offerCode" column="offer_code"/>
         <result property="offerCode" column="offer_code"/>
+        <result property="offerImg" column="offer_img"/>
     </resultMap>
     </resultMap>
     <select id="searchDTO" parameterType="hashmap" resultMap="ApplicationMiddleDTOMap">
     <select id="searchDTO" parameterType="hashmap" resultMap="ApplicationMiddleDTOMap">
         <![CDATA[
         <![CDATA[
@@ -220,7 +226,8 @@
 			a.category_id,
 			a.category_id,
 			a.offer_id,
 			a.offer_id,
 			e.name_ as offer_name,
 			e.name_ as offer_name,
-			a.offer_code
+			a.offer_code,
+			a.offer_img
 			FROM base_application_middle a
 			FROM base_application_middle a
 			LEFT JOIN base_student_info b ON a.student_id = b.id_
 			LEFT JOIN base_student_info b ON a.student_id = b.id_
 			LEFT JOIN base_person_student c ON (a.person_id = c.person_id AND a.student_id = c.student_id)
 			LEFT JOIN base_person_student c ON (a.person_id = c.person_id AND a.student_id = c.student_id)

+ 9 - 2
common/src/main/resources/mapper/base/ApplicationPrimary.xml

@@ -25,6 +25,7 @@
         <result property="offerCode" column="offer_code"/>
         <result property="offerCode" column="offer_code"/>
         <result property="isSend" column="is_send"/>
         <result property="isSend" column="is_send"/>
         <result property="sendTime" column="send_time"/>
         <result property="sendTime" column="send_time"/>
+        <result property="offerImg" column="offer_img"/>
     </resultMap>
     </resultMap>
     <insert id="insert" parameterType="com.jpsoft.campus.modules.base.entity.ApplicationPrimary">
     <insert id="insert" parameterType="com.jpsoft.campus.modules.base.entity.ApplicationPrimary">
         <!--
         <!--
@@ -36,7 +37,7 @@
 		insert into base_application_primary
 		insert into base_application_primary
 	    (id_,create_by,create_time,update_by,update_time,del_flag,type_,
 	    (id_,create_by,create_time,update_by,update_time,del_flag,type_,
 	    status_,category_id,now_address,person_id,student_id,street_id,community_id,school_id,hit_,offer_id,
 	    status_,category_id,now_address,person_id,student_id,street_id,community_id,school_id,hit_,offer_id,
-	    is_send,send_time,offer_code
+	    is_send,send_time,offer_code,offer_img
 	    )
 	    )
 		values
 		values
 		(
 		(
@@ -60,6 +61,7 @@
 			,#{isSend,jdbcType=NUMERIC}
 			,#{isSend,jdbcType=NUMERIC}
 			,#{sendTime,jdbcType=TIMESTAMP}
 			,#{sendTime,jdbcType=TIMESTAMP}
 			,#{offerCode,jdbcType=VARCHAR}
 			,#{offerCode,jdbcType=VARCHAR}
+			,#{offerImg,jdbcType=VARCHAR}
 		)
 		)
 	]]>
 	]]>
     </insert>
     </insert>
@@ -126,6 +128,9 @@
             <if test="offerCode!=null">
             <if test="offerCode!=null">
                 offer_code=#{offerCode,jdbcType=TIMESTAMP},
                 offer_code=#{offerCode,jdbcType=TIMESTAMP},
             </if>
             </if>
+            <if test="offerImg!=null">
+                offer_img=#{offerImg,jdbcType=VARCHAR},
+            </if>
         </set>
         </set>
         where id_=#{id}
         where id_=#{id}
     </update>
     </update>
@@ -203,6 +208,7 @@
         <result property="offerId" column="offer_id"/>
         <result property="offerId" column="offer_id"/>
         <result property="offerName" column="offer_name"/>
         <result property="offerName" column="offer_name"/>
         <result property="offerCode" column="offer_code"/>
         <result property="offerCode" column="offer_code"/>
+        <result property="offerImg" column="offer_img"/>
     </resultMap>
     </resultMap>
     <select id="searchDTO" parameterType="hashmap" resultMap="ApplicationPrimaryDTOMap">
     <select id="searchDTO" parameterType="hashmap" resultMap="ApplicationPrimaryDTOMap">
         <![CDATA[
         <![CDATA[
@@ -217,7 +223,8 @@
 			a.category_id,
 			a.category_id,
 			a.offer_id,
 			a.offer_id,
 			e.name_ as offer_name,
 			e.name_ as offer_name,
-			a.offer_code
+			a.offer_code,
+			a.offer_img
 			FROM base_application_primary a
 			FROM base_application_primary a
 			LEFT JOIN base_student_info b ON a.student_id = b.id_
 			LEFT JOIN base_student_info b ON a.student_id = b.id_
 			LEFT JOIN base_person_student c ON (a.person_id = c.person_id AND a.student_id = c.student_id)
 			LEFT JOIN base_person_student c ON (a.person_id = c.person_id AND a.student_id = c.student_id)

+ 12 - 3
common/src/main/resources/mapper/base/ApportionDetail.xml

@@ -16,6 +16,8 @@
 			<result property="createTime" column="create_time" />
 			<result property="createTime" column="create_time" />
 			<result property="updateBy" column="update_by" />
 			<result property="updateBy" column="update_by" />
 			<result property="updateTime" column="update_time" />
 			<result property="updateTime" column="update_time" />
+			<result property="studentName" column="student_name" />
+			<result property="schoolName" column="school_name" />
 			</resultMap>
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.campus.modules.base.entity.ApportionDetail">
 	<insert id="insert" parameterType="com.jpsoft.campus.modules.base.entity.ApportionDetail">
 	<!--
 	<!--
@@ -96,14 +98,21 @@
 	</select>
 	</select>
 	<select id="search" parameterType="hashmap" resultMap="ApportionDetailMap">
 	<select id="search" parameterType="hashmap" resultMap="ApportionDetailMap">
 		<![CDATA[
 		<![CDATA[
-			select * from base_apportion_detail
+				SELECT
+					t1.*,
+					t2.name_ AS student_name,
+					t3.name_ AS school_name
+				FROM
+				base_apportion_detail t1
+				LEFT JOIN base_student_info t2 ON t1.student_id = t2.id_
+				LEFT JOIN base_school_info t3 ON t1.school_id = t3.id_
 		]]>
 		]]>
 		<where>
 		<where>
 			<if test="searchParams.apportionId != null">
 			<if test="searchParams.apportionId != null">
-				and apportion_id = #{searchParams.apportionId}
+				and t1.apportion_id = #{searchParams.apportionId}
 			</if>
 			</if>
 			<if test="searchParams.winner != null">
 			<if test="searchParams.winner != null">
-				and winner_ = #{searchParams.winner}
+				and t1.winner_ = #{searchParams.winner}
 			</if>
 			</if>
 		</where>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">

+ 355 - 6
web/src/main/java/com/jpsoft/campus/modules/base/controller/ApplicationMiddleController.java

@@ -1,5 +1,6 @@
 package com.jpsoft.campus.modules.base.controller;
 package com.jpsoft.campus.modules.base.controller;
 
 
+import cn.hutool.core.date.DateUtil;
 import com.github.pagehelper.Page;
 import com.github.pagehelper.Page;
 import com.jpsoft.campus.config.OSSConfig;
 import com.jpsoft.campus.config.OSSConfig;
 import com.jpsoft.campus.config.WechatConfig;
 import com.jpsoft.campus.config.WechatConfig;
@@ -18,6 +19,8 @@ import com.jpsoft.campus.modules.sys.entity.User;
 import com.jpsoft.campus.modules.sys.service.DataDictionaryService;
 import com.jpsoft.campus.modules.sys.service.DataDictionaryService;
 import com.jpsoft.campus.modules.sys.service.UserRoleService;
 import com.jpsoft.campus.modules.sys.service.UserRoleService;
 import com.jpsoft.campus.modules.sys.service.UserService;
 import com.jpsoft.campus.modules.sys.service.UserService;
+import com.sun.image.codec.jpeg.JPEGCodec;
+import com.sun.image.codec.jpeg.JPEGImageEncoder;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiImplicitParams;
@@ -30,14 +33,18 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.Resource;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.xml.crypto.Data;
 import javax.xml.crypto.Data;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.*;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.*;
+import java.util.List;
 
 
 @RestController
 @RestController
 @RequestMapping("/base/applicationMiddle")
 @RequestMapping("/base/applicationMiddle")
@@ -916,7 +923,14 @@ public class ApplicationMiddleController {
             int affectCount = approvalInfoService.insert(approvalInfo);
             int affectCount = approvalInfoService.insert(approvalInfo);
 
 
             if (affectCount > 0) {
             if (affectCount > 0) {
-                if("50".equals(applicationMiddle.getStatus())) {
+                if("40".equals(applicationMiddle.getStatus())) {
+                    if("D".equals(applicationMiddle.getType()) || "E".equals(applicationMiddle.getType())){
+                        applicationMiddle.setStatus("70");
+                        applicationMiddle.setOfferId(applicationMiddle.getSchoolId());
+                    }else{
+                        applicationMiddle.setStatus("60");
+                    }
+                }else if("50".equals(applicationMiddle.getStatus())) {
                     if("D".equals(applicationMiddle.getType()) || "E".equals(applicationMiddle.getType())){
                     if("D".equals(applicationMiddle.getType()) || "E".equals(applicationMiddle.getType())){
                         applicationMiddle.setStatus("70");
                         applicationMiddle.setStatus("70");
                         applicationMiddle.setOfferId(applicationMiddle.getSchoolId());
                         applicationMiddle.setOfferId(applicationMiddle.getSchoolId());
@@ -1145,7 +1159,7 @@ public class ApplicationMiddleController {
             Page<ApplicationMiddleDTO> page = applicationMiddleService.pageSearchDTO(searchParams,0,100000,true,sortList);
             Page<ApplicationMiddleDTO> page = applicationMiddleService.pageSearchDTO(searchParams,0,100000,true,sortList);
             List<DataDictionary> relationshipList = dataDictionaryService.findByCatalogName("学生关系");
             List<DataDictionary> relationshipList = dataDictionaryService.findByCatalogName("学生关系");
             List<DataDictionary> typeNameList = dataDictionaryService.findByCatalogName("报名类型");
             List<DataDictionary> typeNameList = dataDictionaryService.findByCatalogName("报名类型");
-            List<DataDictionary> statusNameList = dataDictionaryService.findByCatalogName("学招生审核流程");
+            List<DataDictionary> statusNameList = dataDictionaryService.findByCatalogName("学招生审核流程");
             List<DataDictionary> cardTypeList = dataDictionaryService.findByCatalogName("证件类型");
             List<DataDictionary> cardTypeList = dataDictionaryService.findByCatalogName("证件类型");
             for (int i = 0; i < page.size(); i++) {
             for (int i = 0; i < page.size(); i++) {
                 ApplicationMiddleDTO amDTO = page.get(i);
                 ApplicationMiddleDTO amDTO = page.get(i);
@@ -1338,7 +1352,7 @@ public class ApplicationMiddleController {
             ApprovalInfo approvalInfo = new ApprovalInfo();
             ApprovalInfo approvalInfo = new ApprovalInfo();
             approvalInfo.setId(UUID.randomUUID().toString());
             approvalInfo.setId(UUID.randomUUID().toString());
             approvalInfo.setApplicationId(id);
             approvalInfo.setApplicationId(id);
-            approvalInfo.setOperation(dataDictionaryService.findNameByCatalogNameAndValue("学招生审核流程",applicationMiddle.getStatus())+":" + typeValue);
+            approvalInfo.setOperation(dataDictionaryService.findNameByCatalogNameAndValue("学招生审核流程",applicationMiddle.getStatus())+":" + typeValue);
             approvalInfo.setRemark(remark);
             approvalInfo.setRemark(remark);
             approvalInfo.setFileUrl("");
             approvalInfo.setFileUrl("");
             approvalInfo.setDelFlag(false);
             approvalInfo.setDelFlag(false);
@@ -1376,7 +1390,7 @@ public class ApplicationMiddleController {
 
 
                     off.setApplicationId(applicationMiddle.getId());
                     off.setApplicationId(applicationMiddle.getId());
                     off.setStudentId(applicationMiddle.getStudentId());
                     off.setStudentId(applicationMiddle.getStudentId());
-                    off.setEnrollmentType("1");//小
+                    off.setEnrollmentType("2");//中
                     off.setSchoolId(applicationMiddle.getSchoolId());
                     off.setSchoolId(applicationMiddle.getSchoolId());
                     off.setSerialNum(serialNum);
                     off.setSerialNum(serialNum);
 
 
@@ -1387,9 +1401,22 @@ public class ApplicationMiddleController {
                     offerInfoService.insert(off);
                     offerInfoService.insert(off);
 
 
                     applicationMiddle.setOfferCode(code);
                     applicationMiddle.setOfferCode(code);
+
+                    applicationMiddle.setOfferCode(code);
+                    SchoolInfo schoolInfo = schoolInfoService.get(applicationMiddle.getSchoolId());
+                    PersonInfo personInfo = personInfoService.get(applicationMiddle.getPersonId());
+                    StudentInfo studentInfo = studentInfoService.get(applicationMiddle.getStudentId());
+                    String bdUrl = toPressText(code,personInfo.getName(),studentInfo.getName(), schoolInfo.getName());
+                    String uploadUrl = uploadImg(bdUrl);
+                    applicationMiddle.setOfferImg(uploadUrl);
+                    String content =  "尊敬的家长您好,您的报名申请已通过。关注“荆州开发区网上入学”--报名查询,我们将于近期推送电子版入学通知书。";
+                    sendMessage(content,applicationMiddle.getPersonId());
                 }
                 }
                 applicationMiddleService.update(applicationMiddle);
                 applicationMiddleService.update(applicationMiddle);
 
 
+                String uploadPath = Resource.class.getResource("/").getPath() +"uploadImg";
+                delAllFile(uploadPath);
+
                 msgResult.setResult(true);
                 msgResult.setResult(true);
                 msgResult.setData(approvalInfo);
                 msgResult.setData(approvalInfo);
             } else {
             } else {
@@ -1406,4 +1433,326 @@ public class ApplicationMiddleController {
 
 
         return msgResult;
         return msgResult;
     }
     }
+
+    @ApiOperation(value="全部通过")
+    @RequestMapping(value = "allNext",method = RequestMethod.POST)
+    public MessageResult<Map> allNext(
+            String tabStatus,
+            String type,
+            String nameOrIdCard,
+            String status,
+            String cardType,
+            String schoolId,
+            String offerId,
+            @RequestParam(value="nextStatus",defaultValue="") String nextStatus,
+            @RequestParam(value="isSend",defaultValue="") String isSend,
+            @RequestParam(value="categoryId",defaultValue="") String categoryId,
+            @RequestParam(value="startStatus",defaultValue="") String startStatus,
+            @RequestParam(value="endStatus",defaultValue="") String endStatus,
+            @RequestParam(value="delFlag",defaultValue="false") Boolean delFlag,
+            @RequestAttribute String subject){
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+        User user = userService.get(subject);
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("a.create_time","desc"));
+
+        if (StringUtils.isNotEmpty(tabStatus)) {
+            searchParams.put("tabStatus",tabStatus);
+        }
+        if (StringUtils.isNotEmpty(type)) {
+            searchParams.put("type",type);
+        }
+        if (StringUtils.isNotEmpty(status)) {
+            searchParams.put("status",status);
+        }
+        if (StringUtils.isNotEmpty(nameOrIdCard)) {
+            searchParams.put("nameOrIdCard","%" + nameOrIdCard + "%");
+        }
+
+        if (StringUtils.isNotEmpty(cardType)) {
+            searchParams.put("cardType",cardType);
+        }
+
+        searchParams.put("delFlag",delFlag);
+
+        if(StringUtils.isNotEmpty(schoolId)){
+            searchParams.put("code", "%" + schoolId + "%");
+        }else{
+            if (!userService.hasRole(subject,"SYSADMIN")) {
+
+                searchParams.put("code", "%" + user.getSchoolId() + "%");
+            }
+        }
+
+        if(StringUtils.isNotEmpty(isSend)){
+            searchParams.put("isSend", isSend);
+        }
+
+        if(StringUtils.isNotEmpty(offerId)){
+            searchParams.put("offerId", offerId);
+        }
+
+        //查询范围
+        //开始
+        if (StringUtils.isNotEmpty(startStatus)) {
+            searchParams.put("startStatus",startStatus);
+        }
+        //结束
+        if (StringUtils.isNotEmpty(endStatus)) {
+            searchParams.put("endStatus",endStatus);
+        }
+
+        if (StringUtils.isNotEmpty(categoryId)) {
+            searchParams.put("categoryId",categoryId);
+        }
+
+        //根据用户和角色查询
+        int count1 = userRoleService.findCountByAIdAndRName(subject,"SYSADMIN");
+        int count2 = userRoleService.findCountByAIdAndRName(subject,"XFLD");
+        int count3 = userRoleService.findCountByAIdAndRName(subject,"XFGZRY");
+
+        if(count1 > 0){
+            //管理员查全部
+        }else if(count2 > 0){
+            //领导查全部
+        }else if(count3 > 0){
+            //工作人员只能查网上初审10和现场初审20
+            List statusList = new ArrayList();
+            statusList.add("10");
+            statusList.add("20");
+            searchParams.put("orStatus",statusList);
+        }
+
+        Page<ApplicationMiddleDTO> page = applicationMiddleService.pageSearchDTO(searchParams,0,100000,false,sortList);
+        for(ApplicationMiddleDTO applicationMiddleDTO : page.getResult()){
+            ApplicationMiddle applicationMiddle = applicationMiddleService.get(applicationMiddleDTO.getApplicationId());
+            if("40".equals(applicationMiddle.getStatus())) {
+                if("D".equals(applicationMiddle.getType()) || "E".equals(applicationMiddle.getType())){
+                    applicationMiddle.setStatus("70");
+                    applicationMiddle.setOfferId(applicationMiddle.getSchoolId());
+                }else{
+                    applicationMiddle.setStatus(nextStatus);
+                }
+            }else if("50".equals(applicationMiddle.getStatus())) {
+                if("D".equals(applicationMiddle.getType()) || "E".equals(applicationMiddle.getType())){
+                    applicationMiddle.setStatus("70");
+                    applicationMiddle.setOfferId(applicationMiddle.getSchoolId());
+                }else{
+                    applicationMiddle.setStatus(nextStatus);
+                }
+            }else if("70".equals(applicationMiddle.getStatus())){
+                //微信消息推送 发送预录取通知
+                applicationMiddle.setStatus(nextStatus);
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                String backDate = sdf.format(new Date());
+//                SchoolInfo schoolInfo = schoolInfoService.get(applicationPrimary.getSchoolId());
+                String backRemark = "";
+                PersonInfo pi = personInfoService.get(applicationMiddle.getPersonId());
+                String appId = wechatConfig.getAppId();
+                String appSecret = wechatConfig.getAppSecret();
+
+                boolean messageResult = WechatMessageUtil.sendMessageTemplate(
+                        user.getUserName(),"尊敬的家长您好,您的报名申请已通过。关注“荆州开发区网上入学”--报名查询,我们将于近期推送电子版入学通知书。",
+                        backRemark,backDate,pi.getOpenId(),
+                        wechatConfig.getBackNoticeTemplateId(),wechatConfig.getTokenUrl(),appId,appSecret);
+            }else if("80".equals(applicationMiddle.getStatus())){
+                //微信消息推送 发送完成录取通知
+                applicationMiddle.setStatus(nextStatus);
+
+                int serialNum = offerInfoService.findMaxSerialNum(applicationMiddle.getSchoolId(),"1");
+                serialNum = serialNum+1;//最大编号加一
+                Calendar date = Calendar.getInstance();
+                String year = String.valueOf(date.get(Calendar.YEAR));
+                SchoolInfo si = schoolInfoService.get(applicationMiddle.getSchoolId());
+                //开发区+年份+学校编号2位+序号4位
+                String code = "KFQ" + year + si.getSchoolCode() + String.format("%04d", serialNum);
+                //保存录取信息表
+                OfferInfo off = new OfferInfo();
+                off.setId(UUID.randomUUID().toString());
+
+                off.setApplicationId(applicationMiddle.getId());
+                off.setStudentId(applicationMiddle.getStudentId());
+                off.setEnrollmentType("2");//小学
+                off.setSchoolId(applicationMiddle.getSchoolId());
+                off.setSerialNum(serialNum);
+                off.setCode(code);
+                off.setDelFlag(false);
+                off.setCreateBy(subject);
+                off.setCreateTime(new Date());
+                int oicount = offerInfoService.insert(off);
+
+                applicationMiddle.setOfferCode(code);
+
+                if(oicount > 0) {
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                    String backDate = sdf.format(new Date());
+//                SchoolInfo schoolInfo = schoolInfoService.get(applicationPrimary.getSchoolId());
+                    String backRemark = "";
+                    PersonInfo pi = personInfoService.get(applicationMiddle.getPersonId());
+                    String appId = wechatConfig.getAppId();
+                    String appSecret = wechatConfig.getAppSecret();
+
+                    boolean messageResult = WechatMessageUtil.sendMessageTemplate(
+                            user.getUserName(), "尊敬的家长您好,您的报名申请已通过。关注“荆州开发区网上入学”--报名查询,我们将于近期推送电子版入学通知书。",
+                            backRemark, backDate, pi.getOpenId(),
+                            wechatConfig.getBackNoticeTemplateId(), wechatConfig.getTokenUrl(), appId, appSecret);
+                }
+            }else{
+                applicationMiddle.setStatus(nextStatus);
+            }
+
+            applicationMiddle.setUpdateBy(subject);
+            applicationMiddle.setUpdateTime(new Date());
+
+            ApprovalInfo approvalInfo = new ApprovalInfo();
+            approvalInfo.setId(UUID.randomUUID().toString());
+            approvalInfo.setApplicationId(applicationMiddle.getId());
+            approvalInfo.setOperation(dataDictionaryService.findNameByCatalogNameAndValue("中学招生审核流程",applicationMiddle.getStatus())+":通过审核");
+            approvalInfo.setRemark("通过审核");
+            approvalInfo.setFileUrl("");
+            approvalInfo.setDelFlag(false);
+            approvalInfo.setCreateBy(subject);
+            approvalInfo.setCreateTime(new Date());
+
+            int affectCount = approvalInfoService.insert(approvalInfo);
+
+            applicationMiddleService.update(applicationMiddle);
+        }
+
+
+        //完成后删除文件夹
+        String uploadPath = Resource.class.getResource("/").getPath() +"uploadImg";
+        delAllFile(uploadPath);
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+
+    public String toPressText(String offerCode,String personName,String userName,String schoolName){
+        String in = "static/primary_tzs.jpg";
+        String out = "uploadImg/primary_tzs_" + offerCode + ".jpg";
+        String inImg = Resource.class.getResource("/").getPath() + in;
+        String outImg = Resource.class.getResource("/").getPath() + out;
+        try
+        {
+            FileInputStream fis = new FileInputStream(inImg);//创建输入流对象
+            FileOutputStream fos = new FileOutputStream(outImg); //创建输出流对象
+            byte datas[] = new byte[1024*8];//创建搬运工具
+            int len = 0;//创建长度
+            while((len = fis.read(datas))!=-1)//循环读取数据
+            {
+                fos.write(datas,0,len);
+            }
+            fis.close();//释放资源
+            fis.close();//释放资源
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+
+        //加水印
+        pressText(offerCode,outImg,"宋体",0,new Color(0,0,0),40,1000,400);
+        pressText(personName,outImg,"宋体",0,new Color(0,0,0),40,410,600);
+        pressText(userName,outImg,"宋体",0,new Color(0,0,0),40,830,680);
+        pressText("8",outImg,"宋体",0,new Color(0,0,0),40,660,940);
+        pressText("25",outImg,"宋体",0,new Color(0,0,0),40,730,940);
+        pressText("8",outImg,"宋体",0,new Color(0,0,0),40,890,940);
+        pressText("25",outImg,"宋体",0,new Color(0,0,0),40,970,940);
+        pressText(schoolName,outImg,"宋体",0,new Color(0,0,0),40,480,1015);
+        pressText(DateUtil.thisMonth()+"",outImg,"宋体",0,new Color(0,0,0),40,1000,1590);
+        pressText(DateUtil.thisDayOfMonth()+"",outImg,"宋体",0,new Color(0,0,0),40,1060,1590);
+        return outImg;
+    }
+
+    public void pressText(String pressText, String targetImg, String fontName, int fontStyle, Color color, int fontSize, int x, int y){
+        try{
+            File _file = new File(targetImg);
+            Image src = ImageIO.read(_file);
+            int weidth = src.getWidth(null);
+            int height = src.getHeight(null);
+            BufferedImage image = new BufferedImage(weidth,height,BufferedImage.TYPE_INT_RGB);
+            Graphics g = image.createGraphics();
+            g.drawImage(src,0,0,weidth,height,null);
+            g.setColor(color);
+            g.setFont(new Font(fontName,fontStyle,fontSize));
+            g.drawString(pressText,x,y);
+            g.dispose();
+            FileOutputStream out = new FileOutputStream(targetImg);
+            JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
+            encoder.encode(image);
+            out.close();
+        } catch (java.io.IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public String uploadImg(String imgUrl){
+        String returnUrl = "";
+        try {
+            File jpgFile = new File(imgUrl);
+            InputStream input = new FileInputStream(jpgFile);
+            returnUrl = OSSUtil.upload(ossConfig, "/forPerson", jpgFile.getName(), input);
+            if (StringUtils.isNotEmpty(returnUrl)) {
+                jpgFile.delete();
+            }
+            input.close();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+        return returnUrl;
+    }
+
+    public boolean sendMessage(String content,String personId){
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String backDate = sdf.format(new Date());
+//                SchoolInfo schoolInfo = schoolInfoService.get(applicationPrimary.getSchoolId());
+        String backRemark = "";
+        PersonInfo pi = personInfoService.get(personId);
+        String appId = wechatConfig.getAppId();
+        String appSecret = wechatConfig.getAppSecret();
+        boolean messageResult = false;
+//                boolean messageResult = WechatMessageUtil.sendMessageTemplate(
+//                        user.getUserName(),content,
+//                        backRemark,backDate,pi.getOpenId(),
+//                        wechatConfig.getBackNoticeTemplateId(),wechatConfig.getTokenUrl(),appId,appSecret);
+        return messageResult;
+    }
+
+    public static void delAllFile(String path) {
+        File file = new File(path);
+        if (!file.exists()) {
+            return;
+        }
+        if (!file.isDirectory()) {
+            return;
+        }
+        String[] tempList = file.list();
+        if (tempList == null) {
+            return;
+        }
+        File temp;
+        for (String aTempList : tempList) {
+            if (path.endsWith(File.separator)) {
+                temp = new File(path + aTempList);
+            } else {
+                temp = new File(path + File.separator + aTempList);
+            }
+            if (temp.isFile()) {
+                temp.delete();
+            }
+            if (temp.isDirectory()) {
+                delAllFile(path + "/" + aTempList);// 先删除文件夹里面的文件
+            }
+        }
+    }
 }
 }

+ 374 - 12
web/src/main/java/com/jpsoft/campus/modules/base/controller/ApplicationPrimaryController.java

@@ -1,5 +1,6 @@
 package com.jpsoft.campus.modules.base.controller;
 package com.jpsoft.campus.modules.base.controller;
 
 
+import cn.hutool.core.date.DateUtil;
 import com.alipay.api.domain.CompanyInfo;
 import com.alipay.api.domain.CompanyInfo;
 import com.github.pagehelper.Page;
 import com.github.pagehelper.Page;
 import com.jpsoft.campus.config.OSSConfig;
 import com.jpsoft.campus.config.OSSConfig;
@@ -21,6 +22,10 @@ import com.jpsoft.campus.modules.sys.service.DataDictionaryService;
 import com.jpsoft.campus.modules.sys.service.UserRoleService;
 import com.jpsoft.campus.modules.sys.service.UserRoleService;
 import com.jpsoft.campus.modules.sys.service.UserService;
 import com.jpsoft.campus.modules.sys.service.UserService;
 import com.jpsoft.campus.modules.wechat.entity.AccessToken;
 import com.jpsoft.campus.modules.wechat.entity.AccessToken;
+import com.sun.image.codec.jpeg.JPEGCodec;
+import com.sun.image.codec.jpeg.JPEGImageEncoder;
+import com.sun.imageio.plugins.jpeg.JPEGImageReaderResources;
+import io.jsonwebtoken.io.IOException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiImplicitParams;
@@ -34,14 +39,20 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import javax.imageio.ImageIO;
+import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.*;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.*;
+import java.util.List;
 
 
 @RestController
 @RestController
 @RequestMapping("/base/applicationPrimary")
 @RequestMapping("/base/applicationPrimary")
@@ -994,7 +1005,15 @@ public class ApplicationPrimaryController {
 
 
 
 
             if (affectCount > 0) {
             if (affectCount > 0) {
-                if("50".equals(applicationPrimary.getStatus())){
+                if("40".equals(applicationPrimary.getStatus())){
+                    //A类B类直接录取
+                    if("A".equals(applicationPrimary.getType()) || "B".equals(applicationPrimary.getType())){
+                        applicationPrimary.setStatus("70");
+                        applicationPrimary.setOfferId(applicationPrimary.getSchoolId());
+                    }else{
+                        applicationPrimary.setStatus("60");
+                    }
+                }else if("50".equals(applicationPrimary.getStatus())){
                     //A类B类直接录取
                     //A类B类直接录取
                     if("A".equals(applicationPrimary.getType()) || "B".equals(applicationPrimary.getType())){
                     if("A".equals(applicationPrimary.getType()) || "B".equals(applicationPrimary.getType())){
                         applicationPrimary.setStatus("70");
                         applicationPrimary.setStatus("70");
@@ -1537,9 +1556,21 @@ public class ApplicationPrimaryController {
                     offerInfoService.insert(off);
                     offerInfoService.insert(off);
 
 
                     applicationPrimary.setOfferCode(code);
                     applicationPrimary.setOfferCode(code);
+                    SchoolInfo schoolInfo = schoolInfoService.get(applicationPrimary.getSchoolId());
+                    PersonInfo personInfo = personInfoService.get(applicationPrimary.getPersonId());
+                    StudentInfo studentInfo = studentInfoService.get(applicationPrimary.getStudentId());
+                    String bdUrl = toPressText(code,personInfo.getName(),studentInfo.getName(), schoolInfo.getName());
+                    String uploadUrl = uploadImg(bdUrl);
+                    applicationPrimary.setOfferImg(uploadUrl);
+                    String content =  "尊敬的家长您好,您的报名申请已通过。关注“荆州开发区网上入学”--报名查询,我们将于近期推送电子版入学通知书。";
+                    sendMessage(content,applicationPrimary.getPersonId());
                 }
                 }
                 applicationPrimaryService.update(applicationPrimary);
                 applicationPrimaryService.update(applicationPrimary);
 
 
+
+//                String uploadPath = Resource.class.getResource("/").getPath() +"uploadImg";
+//                delAllFile(uploadPath);
+
                 msgResult.setResult(true);
                 msgResult.setResult(true);
                 msgResult.setData(approvalInfo);
                 msgResult.setData(approvalInfo);
             } else {
             } else {
@@ -1557,18 +1588,349 @@ public class ApplicationPrimaryController {
         return msgResult;
         return msgResult;
     }
     }
 
 
+
+    @ApiOperation(value="全部通过")
+    @RequestMapping(value = "allNext",method = RequestMethod.POST)
+    public MessageResult<Map> allNext(
+            String tabStatus,
+            String type,
+            String nameOrIdCard,
+            String status,
+            String cardType,
+            String schoolId,
+            String offerId,
+            @RequestParam(value="nextStatus",defaultValue="") String nextStatus,
+            @RequestParam(value="isSend",defaultValue="") String isSend,
+            @RequestParam(value="categoryId",defaultValue="") String categoryId,
+            @RequestParam(value="startStatus",defaultValue="") String startStatus,
+            @RequestParam(value="endStatus",defaultValue="") String endStatus,
+            @RequestParam(value="delFlag",defaultValue="false") Boolean delFlag,
+            @RequestAttribute String subject){
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+        User user = userService.get(subject);
+
+        try {
+
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("a.create_time", "desc"));
+
+            if (StringUtils.isNotEmpty(tabStatus)) {
+                searchParams.put("tabStatus", tabStatus);
+            }
+            if (StringUtils.isNotEmpty(type)) {
+                searchParams.put("type", type);
+            }
+            if (StringUtils.isNotEmpty(status)) {
+                searchParams.put("status", status);
+            }
+            if (StringUtils.isNotEmpty(nameOrIdCard)) {
+                searchParams.put("nameOrIdCard", "%" + nameOrIdCard + "%");
+            }
+
+            if (StringUtils.isNotEmpty(cardType)) {
+                searchParams.put("cardType", cardType);
+            }
+
+            searchParams.put("delFlag", delFlag);
+
+            if (StringUtils.isNotEmpty(schoolId)) {
+                searchParams.put("code", "%" + schoolId + "%");
+            } else {
+                if (!userService.hasRole(subject, "SYSADMIN")) {
+                    searchParams.put("code", "%" + user.getSchoolId() + "%");
+                }
+            }
+
+            if (StringUtils.isNotEmpty(isSend)) {
+                searchParams.put("isSend", isSend);
+            }
+
+            if (StringUtils.isNotEmpty(offerId)) {
+                searchParams.put("offerId", offerId);
+            }
+
+            //查询范围
+            //开始
+            if (StringUtils.isNotEmpty(startStatus)) {
+                searchParams.put("startStatus", startStatus);
+            }
+            //结束
+            if (StringUtils.isNotEmpty(endStatus)) {
+                searchParams.put("endStatus", endStatus);
+            }
+
+            if (StringUtils.isNotEmpty(categoryId)) {
+                searchParams.put("categoryId", categoryId);
+            }
+
+            //根据用户和角色查询
+            int count1 = userRoleService.findCountByAIdAndRName(subject, "SYSADMIN");
+            int count2 = userRoleService.findCountByAIdAndRName(subject, "XFLD");
+            int count3 = userRoleService.findCountByAIdAndRName(subject, "XFGZRY");
+
+            if (count1 > 0) {
+                //管理员查全部
+            } else if (count2 > 0) {
+                //领导查全部
+            } else if (count3 > 0) {
+                //工作人员只能查网上初审10和现场初审20
+                List statusList = new ArrayList();
+                statusList.add("10");
+                statusList.add("20");
+                searchParams.put("orStatus", statusList);
+            }
+
+            Page<ApplicationPrimaryDTO> page = applicationPrimaryService.pageSearchDTO(searchParams, 0, 100000, false, sortList);
+            for (ApplicationPrimaryDTO applicationPrimaryDTO : page.getResult()) {
+
+                ApplicationPrimary applicationPrimary = applicationPrimaryService.get(applicationPrimaryDTO.getApplicationId());
+
+                if ("40".equals(applicationPrimary.getStatus())) {
+                    //A类B类直接录取
+                    if ("A".equals(applicationPrimary.getType()) || "B".equals(applicationPrimary.getType())) {
+                        applicationPrimary.setStatus("70");
+                        applicationPrimary.setOfferId(applicationPrimary.getSchoolId());
+                    } else {
+                        applicationPrimary.setStatus(nextStatus);
+                    }
+                } else if ("50".equals(applicationPrimary.getStatus())) {
+                    //A类B类直接录取
+                    if ("A".equals(applicationPrimary.getType()) || "B".equals(applicationPrimary.getType())) {
+                        applicationPrimary.setStatus("70");
+                        applicationPrimary.setOfferId(applicationPrimary.getSchoolId());
+                    } else {
+                        applicationPrimary.setStatus(nextStatus);
+                    }
+                } else if ("70".equals(applicationPrimary.getStatus())) {
+                    //微信消息推送 发送预录取通知
+                    applicationPrimary.setStatus(nextStatus);
+
+                    new Thread(() -> {
+                        try {
+                            String content = "尊敬的家长您好,您的报名申请已通过。关注“荆州开发区网上入学”--报名查询,我们将于近期推送电子版入学通知书。";
+                            sendMessage(content, applicationPrimary.getPersonId());
+                        } catch (Exception ex) {
+                            ex.printStackTrace();
+                        }
+                    }).start();
+                } else if ("80".equals(applicationPrimary.getStatus())) {
+                    //微信消息推送 发送完成录取通知
+                    applicationPrimary.setStatus(nextStatus);
+
+                    int serialNum = offerInfoService.findMaxSerialNum(applicationPrimary.getSchoolId(), "1");
+                    serialNum = serialNum + 1;//最大编号加一
+                    Calendar date = Calendar.getInstance();
+                    String year = String.valueOf(date.get(Calendar.YEAR));
+                    SchoolInfo si = schoolInfoService.get(applicationPrimary.getSchoolId());
+                    //开发区+年份+学校编号2位+序号4位
+                    String code = "KFQ" + year + si.getSchoolCode() + String.format("%04d", serialNum);
+                    //保存录取信息表
+                    OfferInfo off = new OfferInfo();
+                    off.setId(UUID.randomUUID().toString());
+
+                    off.setApplicationId(applicationPrimary.getId());
+                    off.setStudentId(applicationPrimary.getStudentId());
+                    off.setEnrollmentType("1");//小学
+                    off.setSchoolId(applicationPrimary.getSchoolId());
+                    off.setSerialNum(serialNum);
+                    off.setCode(code);
+                    off.setDelFlag(false);
+                    off.setCreateBy(subject);
+                    off.setCreateTime(new Date());
+                    int oicount = offerInfoService.insert(off);
+                    applicationPrimary.setOfferCode(code);
+                    if (oicount > 0) {
+                        SchoolInfo schoolInfo = schoolInfoService.get(applicationPrimary.getSchoolId());
+                        PersonInfo personInfo = personInfoService.get(applicationPrimary.getPersonId());
+                        StudentInfo studentInfo = studentInfoService.get(applicationPrimary.getStudentId());
+                        String bdUrl = toPressText(code, personInfo.getName(), studentInfo.getName(), schoolInfo.getName());
+                        String uploadUrl = uploadImg(bdUrl);
+                        applicationPrimary.setOfferImg(uploadUrl);
+//                        new Thread(() -> {
+//                            try {
+//                                String content = "尊敬的家长您好,您的报名申请已通过。关注“荆州开发区网上入学”--报名查询,我们将于近期推送电子版入学通知书。";
+//                                sendMessage(content, applicationPrimary.getPersonId());
+//                            } catch (Exception ex) {
+//                                ex.printStackTrace();
+//                            }
+//                        }).start();
+                    }
+                } else {
+                    applicationPrimary.setStatus(nextStatus);
+                }
+                applicationPrimary.setUpdateBy(subject);
+                applicationPrimary.setUpdateTime(new Date());
+
+                ApprovalInfo approvalInfo = new ApprovalInfo();
+                approvalInfo.setId(UUID.randomUUID().toString());
+                approvalInfo.setApplicationId(applicationPrimary.getId());
+                //approvalInfo.setOperation(dataDictionaryService.findNameByCatalogNameAndValue("小学招生审核流程", applicationPrimary.getStatus()) + ":通过审核");
+                approvalInfo.setRemark("通过审核");
+                approvalInfo.setFileUrl("");
+                approvalInfo.setDelFlag(false);
+                approvalInfo.setCreateBy(subject);
+                approvalInfo.setCreateTime(new Date());
+
+                int affectCount = approvalInfoService.insert(approvalInfo);
+
+                applicationPrimaryService.update(applicationPrimary);
+            }
+
+            //完成后删除文件夹
+//            String uploadPath = Resource.class.getResource("/").getPath() + "uploadImg";
+//            delAllFile(uploadPath);
+
+            msgResult.setResult(true);
+            msgResult.setData(PojoUtils.pageWrapper(page));
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+        return msgResult;
+    }
+
     public static void main(String[] args) {
     public static void main(String[] args) {
         //appId: wx0c81770a72543e27
         //appId: wx0c81770a72543e27
         //  appSecret: ea8c0d18eae536e3ec16333864e71252
         //  appSecret: ea8c0d18eae536e3ec16333864e71252
         //public static boolean sendNoticeMessage(String noticeName, String content, String openId, String noticeDetailId, String noticeTemplateId, String appId, String appSecret) {
         //public static boolean sendNoticeMessage(String noticeName, String content, String openId, String noticeDetailId, String noticeTemplateId, String appId, String appSecret) {
-        WechatMessageUtil.sendMessageTemplate("测试",
-                "测试内容",
-                "备注",
-                "2020-07-12",
-                "ouJckwC1ysrEzgyF14X4pSJAPNFk",
-                "Ya2TByTerPfIxfqMwfFq2G-BMsuyWZOslk-g5cHSWfs",
-                "http://ykt.xiaoxinda.com/weixin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET",
-                "wx0c81770a72543e27",
-                "ea8c0d18eae536e3ec16333864e71252");
+//        WechatMessageUtil.sendMessageTemplate("测试",
+//                "测试内容",
+//                "备注",
+//                "2020-07-12",
+//                "ouJckwC1ysrEzgyF14X4pSJAPNFk",
+//                "Ya2TByTerPfIxfqMwfFq2G-BMsuyWZOslk-g5cHSWfs",
+//                "http://ykt.xiaoxinda.com/weixin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET",
+//                "wx0c81770a72543e27",
+//                "ea8c0d18eae536e3ec16333864e71252");
+
+        //小学http://rccs.oss-cn-hangzhou.aliyuncs.com/upload/service/primary_tzs.jpg
+        //中学http://rccs.oss-cn-hangzhou.aliyuncs.com/upload/service/middle_tzs.jpg
+
+
+//        String uploadPath = Resource.class.getResource("/").getPath() +"uploadImg";
+//        delAllFile(uploadPath);
+
+    }
+
+    public String toPressText(String offerCode,String personName,String userName,String schoolName){
+        String in = "static/primary_tzs.jpg";
+        String out = "uploadImg/primary_tzs_" + offerCode + ".jpg";
+        String inImg = Resource.class.getResource("/").getPath() + in;
+        String outImg = Resource.class.getResource("/").getPath() + out;
+        try
+        {
+            FileInputStream fis = new FileInputStream(inImg);//创建输入流对象
+            FileOutputStream fos = new FileOutputStream(outImg); //创建输出流对象
+            byte datas[] = new byte[1024*8];//创建搬运工具
+            int len = 0;//创建长度
+            while((len = fis.read(datas))!=-1)//循环读取数据
+            {
+                fos.write(datas,0,len);
+            }
+            fis.close();//释放资源
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+
+        //加水印
+        pressText(offerCode,outImg,"宋体",0,new Color(0,0,0),40,1000,400);
+        pressText(personName,outImg,"宋体",0,new Color(0,0,0),40,410,600);
+        pressText(userName,outImg,"宋体",0,new Color(0,0,0),40,830,680);
+        pressText("8",outImg,"宋体",0,new Color(0,0,0),40,660,940);
+        pressText("27",outImg,"宋体",0,new Color(0,0,0),40,730,940);
+        pressText("8",outImg,"宋体",0,new Color(0,0,0),40,890,940);
+        pressText("27",outImg,"宋体",0,new Color(0,0,0),40,970,940);
+        pressText(schoolName,outImg,"宋体",0,new Color(0,0,0),40,480,1015);
+        pressText(DateUtil.thisMonth()+"",outImg,"宋体",0,new Color(0,0,0),40,1000,1590);
+        pressText(DateUtil.thisDayOfMonth()+"",outImg,"宋体",0,new Color(0,0,0),40,1060,1590);
+        return outImg;
+    }
+
+    public void pressText(String pressText, String targetImg, String fontName, int fontStyle, Color color, int fontSize, int x, int y){
+        try{
+            File _file = new File(targetImg);
+            Image src = ImageIO.read(_file);
+            int weidth = src.getWidth(null);
+            int height = src.getHeight(null);
+            BufferedImage image = new BufferedImage(weidth,height,BufferedImage.TYPE_INT_RGB);
+            Graphics g = image.createGraphics();
+            g.drawImage(src,0,0,weidth,height,null);
+            g.setColor(color);
+            g.setFont(new Font(fontName,fontStyle,fontSize));
+            g.drawString(pressText,x,y);
+            g.dispose();
+            FileOutputStream out = new FileOutputStream(targetImg);
+            JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
+            encoder.encode(image);
+            out.close();
+        } catch (java.io.IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public String uploadImg(String imgUrl){
+        String returnUrl = "";
+        try {
+            File jpgFile = new File(imgUrl);
+            InputStream input = new FileInputStream(jpgFile);
+            returnUrl = OSSUtil.upload(ossConfig, "/tzs", jpgFile.getName(), input);
+            input.close();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+        return returnUrl;
+    }
+
+    public boolean sendMessage(String content,String personId){
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String backDate = sdf.format(new Date());
+//                SchoolInfo schoolInfo = schoolInfoService.get(applicationPrimary.getSchoolId());
+        String backRemark = "";
+        PersonInfo pi = personInfoService.get(personId);
+        String appId = wechatConfig.getAppId();
+        String appSecret = wechatConfig.getAppSecret();
+        boolean messageResult = false;
+//                boolean messageResult = WechatMessageUtil.sendMessageTemplate(
+//                        user.getUserName(),content,
+//                        backRemark,backDate,pi.getOpenId(),
+//                        wechatConfig.getBackNoticeTemplateId(),wechatConfig.getTokenUrl(),appId,appSecret);
+        return messageResult;
+    }
+
+    public static void delAllFile(String path) {
+        File file = new File(path);
+        if (!file.exists()) {
+            return;
+        }
+        if (!file.isDirectory()) {
+            return;
+        }
+        String[] tempList = file.list();
+        if (tempList == null) {
+            return;
+        }
+        File temp;
+        for (String aTempList : tempList) {
+            if (path.endsWith(File.separator)) {
+                temp = new File(path + aTempList);
+            } else {
+                temp = new File(path + File.separator + aTempList);
+            }
+            if (temp.isFile()) {
+                temp.delete();
+            }
+            if (temp.isDirectory()) {
+                delAllFile(path + "/" + aTempList);// 先删除文件夹里面的文件
+            }
+        }
     }
     }
 }
 }

+ 6 - 3
web/src/main/java/com/jpsoft/campus/modules/base/controller/ApportionDetailController.java

@@ -202,8 +202,10 @@ public class ApportionDetailController {
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
     public MessageResult<Map> pageList(
     public MessageResult<Map> pageList(
             String id,
             String id,
+            @RequestParam(value="apportionId",defaultValue="") String apportionId,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
+            @RequestParam(value="winner",defaultValue="true") boolean winner,
             @RequestAttribute String subject){
             @RequestAttribute String subject){
 
 
         //当前用户ID
         //当前用户ID
@@ -214,12 +216,13 @@ public class ApportionDetailController {
         Map<String,Object> searchParams = new HashMap<>();
         Map<String,Object> searchParams = new HashMap<>();
 
 
         List<Sort> sortList = new ArrayList<>();
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("id_","asc"));
+        sortList.add(new Sort("t1.create_time","asc"));
 
 
-        if (StringUtils.isNotEmpty(id)) {
-            searchParams.put("id","%" + id + "%");
+        if (StringUtils.isNotEmpty(apportionId)) {
+            searchParams.put("apportionId",apportionId);
         }
         }
 
 
+        searchParams.put("winner",winner);
         Page<ApportionDetail> page = apportionDetailService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
         Page<ApportionDetail> page = apportionDetailService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
 
 
         msgResult.setResult(true);
         msgResult.setResult(true);

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


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


BIN
web/src/main/resources/uploadImg/middle_tzs.jpg