|
@@ -22,10 +22,6 @@ import com.jpsoft.campus.modules.sys.service.DataDictionaryService;
|
|
|
import com.jpsoft.campus.modules.sys.service.UserRoleService;
|
|
|
import com.jpsoft.campus.modules.sys.service.UserService;
|
|
|
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.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -1503,11 +1499,17 @@ public class ApplicationPrimaryController {
|
|
|
|
|
|
try {
|
|
|
ApplicationPrimary applicationPrimary = applicationPrimaryService.get(id);
|
|
|
+ User user = userService.get(subject);
|
|
|
|
|
|
ApprovalInfo approvalInfo = new ApprovalInfo();
|
|
|
approvalInfo.setId(UUID.randomUUID().toString());
|
|
|
approvalInfo.setApplicationId(id);
|
|
|
- approvalInfo.setOperation(dataDictionaryService.findNameByCatalogNameAndValue("小学招生审核流程",applicationPrimary.getStatus())+":" + typeValue);
|
|
|
+ if("90".equals(status)) {
|
|
|
+ approvalInfo.setOperation(dataDictionaryService.findNameByCatalogNameAndValue("小学招生审核流程",applicationPrimary.getStatus()));
|
|
|
+ }else{
|
|
|
+ approvalInfo.setOperation(dataDictionaryService.findNameByCatalogNameAndValue("小学招生审核流程",applicationPrimary.getStatus())+":" + typeValue);
|
|
|
+ }
|
|
|
+
|
|
|
approvalInfo.setRemark(remark);
|
|
|
approvalInfo.setFileUrl("");
|
|
|
approvalInfo.setDelFlag(false);
|
|
@@ -1549,21 +1551,30 @@ public class ApplicationPrimaryController {
|
|
|
off.setSchoolId(applicationPrimary.getSchoolId());
|
|
|
off.setSerialNum(serialNum);
|
|
|
|
|
|
- off.setCode(code);
|
|
|
- off.setDelFlag(false);
|
|
|
- off.setCreateBy(subject);
|
|
|
- off.setCreateTime(new Date());
|
|
|
- offerInfoService.insert(off);
|
|
|
-
|
|
|
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());
|
|
|
+ if(StringUtils.isNotEmpty(uploadUrl)){
|
|
|
+ applicationPrimary.setOfferImg(uploadUrl);
|
|
|
+ off.setCode(code);
|
|
|
+ off.setDelFlag(false);
|
|
|
+ off.setCreateBy(subject);
|
|
|
+ off.setCreateTime(new Date());
|
|
|
+ offerInfoService.insert(off);
|
|
|
+ new Thread(() -> {
|
|
|
+ try {
|
|
|
+ String content = "尊敬的家长您好,您的报名申请已通过,请前往“荆州开发区网上入学”--报名查询,下载电子版入学通知书。";
|
|
|
+ sendMessage(content, applicationPrimary.getPersonId(),user.getRealName());
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ }).start();
|
|
|
+ }else{
|
|
|
+ applicationPrimary.setStatus("80");
|
|
|
+ }
|
|
|
}
|
|
|
applicationPrimaryService.update(applicationPrimary);
|
|
|
|
|
@@ -1711,14 +1722,14 @@ public class ApplicationPrimaryController {
|
|
|
//微信消息推送 发送预录取通知
|
|
|
applicationPrimary.setStatus(nextStatus);
|
|
|
|
|
|
- new Thread(() -> {
|
|
|
- try {
|
|
|
- String content = "尊敬的家长您好,您的报名申请已通过。关注“荆州开发区网上入学”--报名查询,我们将于近期推送电子版入学通知书。";
|
|
|
- sendMessage(content, applicationPrimary.getPersonId());
|
|
|
- } catch (Exception ex) {
|
|
|
- ex.printStackTrace();
|
|
|
- }
|
|
|
- }).start();
|
|
|
+// new Thread(() -> {
|
|
|
+//// try {
|
|
|
+//// String content = "尊敬的家长您好,您的报名申请已通过。关注“荆州开发区网上入学”--报名查询,我们将于近期推送电子版入学通知书。";
|
|
|
+//// sendMessage(content,applicationPrimary.getPersonId(),user.getRealName());
|
|
|
+//// } catch (Exception ex) {
|
|
|
+//// ex.printStackTrace();
|
|
|
+//// }
|
|
|
+//// }).start();
|
|
|
} else if ("80".equals(applicationPrimary.getStatus())) {
|
|
|
//微信消息推送 发送完成录取通知
|
|
|
applicationPrimary.setStatus(nextStatus);
|
|
@@ -1743,24 +1754,34 @@ public class ApplicationPrimaryController {
|
|
|
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);
|
|
|
+ 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);
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(uploadUrl)){
|
|
|
+ off.setCode(code);
|
|
|
+ off.setDelFlag(false);
|
|
|
+ off.setCreateBy(subject);
|
|
|
+ off.setCreateTime(new Date());
|
|
|
+ offerInfoService.insert(off);
|
|
|
+
|
|
|
applicationPrimary.setOfferImg(uploadUrl);
|
|
|
-// new Thread(() -> {
|
|
|
-// try {
|
|
|
-// String content = "尊敬的家长您好,您的报名申请已通过。关注“荆州开发区网上入学”--报名查询,我们将于近期推送电子版入学通知书。";
|
|
|
-// sendMessage(content, applicationPrimary.getPersonId());
|
|
|
-// } catch (Exception ex) {
|
|
|
-// ex.printStackTrace();
|
|
|
-// }
|
|
|
-// }).start();
|
|
|
+ new Thread(() -> {
|
|
|
+ try {
|
|
|
+ String content = "尊敬的家长您好,您的报名申请已通过,请前往“荆州开发区网上入学”--报名查询,下载电子版入学通知书。";
|
|
|
+ sendMessage(content, applicationPrimary.getPersonId(),user.getRealName());
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ }).start();
|
|
|
+ }else{
|
|
|
+ applicationPrimary.setStatus("80");
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
applicationPrimary.setStatus(nextStatus);
|
|
|
}
|
|
@@ -1770,7 +1791,11 @@ public class ApplicationPrimaryController {
|
|
|
ApprovalInfo approvalInfo = new ApprovalInfo();
|
|
|
approvalInfo.setId(UUID.randomUUID().toString());
|
|
|
approvalInfo.setApplicationId(applicationPrimary.getId());
|
|
|
- //approvalInfo.setOperation(dataDictionaryService.findNameByCatalogNameAndValue("小学招生审核流程", applicationPrimary.getStatus()) + ":通过审核");
|
|
|
+ if("80".equals(status)) {
|
|
|
+ approvalInfo.setOperation(dataDictionaryService.findNameByCatalogNameAndValue("小学招生审核流程",applicationPrimary.getStatus()));
|
|
|
+ }else{
|
|
|
+ approvalInfo.setOperation(dataDictionaryService.findNameByCatalogNameAndValue("小学招生审核流程", applicationPrimary.getStatus()) + ":通过审核");
|
|
|
+ }
|
|
|
approvalInfo.setRemark("通过审核");
|
|
|
approvalInfo.setFileUrl("");
|
|
|
approvalInfo.setDelFlag(false);
|
|
@@ -1796,84 +1821,120 @@ public class ApplicationPrimaryController {
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- //appId: wx0c81770a72543e27
|
|
|
- // appSecret: ea8c0d18eae536e3ec16333864e71252
|
|
|
- //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");
|
|
|
-
|
|
|
- //小学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);
|
|
|
-
|
|
|
+ String in = "static/primary_tzs.jpg";
|
|
|
+ String out = "uploadImg/primary_tzs_" + "11111" + ".jpg";
|
|
|
+ String inImg = Resource.class.getResource("/").getPath() + in;
|
|
|
+ String outImg = Resource.class.getResource("/").getPath() + out;
|
|
|
+ try{
|
|
|
+ BufferedImage im =ImageIO.read(new FileInputStream(inImg));
|
|
|
+ int mothh = DateUtil.thisMonth() +1;
|
|
|
+ Graphics g = im.getGraphics();
|
|
|
+ g.setColor(new Color(0,0,0));
|
|
|
+ //g.setColor(Color.BLUE);
|
|
|
+ Font font = new Font("宋体",Font.PLAIN,40); //设置字体
|
|
|
+ g.setFont(font);
|
|
|
+ g.drawString("5555555",1000,400);
|
|
|
+ g.drawString("舒爸爸",410,600);
|
|
|
+ g.drawString("舒展",830,680);
|
|
|
+ g.drawString("8",660,940);
|
|
|
+ g.drawString("27",730,940);
|
|
|
+ g.drawString("8",890,940);
|
|
|
+ g.drawString("27",970,940);
|
|
|
+ g.drawString("湖北省荆州市沙市区小学",480,1015);
|
|
|
+ g.drawString(mothh+"",1000,1590);
|
|
|
+ g.drawString(DateUtil.thisDayOfMonth()+"",1060,1590);
|
|
|
+ g.dispose();
|
|
|
+ ImageIO.write(im,"jpg",new File(outImg));
|
|
|
+ }catch (IOException e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value="全部通过")
|
|
|
+ @RequestMapping(value = "toPressText",method = RequestMethod.POST)
|
|
|
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)
|
|
|
- {
|
|
|
+
|
|
|
+ try{
|
|
|
+ BufferedImage im =ImageIO.read(new FileInputStream(inImg));
|
|
|
+ int mothh = DateUtil.thisMonth() +1;
|
|
|
+ Graphics g = im.getGraphics();
|
|
|
+ g.setColor(new Color(0,0,0));
|
|
|
+ Font font = new Font("宋体",Font.PLAIN,40); //设置字体
|
|
|
+ g.setFont(font);
|
|
|
+ Random ran = new Random(); // 随机位置
|
|
|
+ g.drawString(offerCode,1000,400);
|
|
|
+ g.drawString(personName,410,600);
|
|
|
+ g.drawString(userName,830,680);
|
|
|
+ g.drawString("8",660,940);
|
|
|
+ g.drawString("27",730,940);
|
|
|
+ g.drawString("8",890,940);
|
|
|
+ g.drawString("27",970,940);
|
|
|
+ g.drawString(schoolName,480,1015);
|
|
|
+ g.drawString(mothh+"",1000,1590);
|
|
|
+ g.drawString(DateUtil.thisDayOfMonth()+"",1060,1590);
|
|
|
+ g.dispose();
|
|
|
+ ImageIO.write(im,"jpg",new File(outImg));
|
|
|
+ }catch (IOException 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){
|
|
|
+ public void pressText(String pressText, String targetImg,String outImg, String fontName, int fontStyle, Color color, 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);
|
|
|
+ BufferedImage im =ImageIO.read(new FileInputStream(outImg));
|
|
|
+ int iw = im.getWidth();
|
|
|
+ int ih = im.getHeight();
|
|
|
+ Graphics g = im.getGraphics();
|
|
|
g.setColor(color);
|
|
|
- g.setFont(new Font(fontName,fontStyle,fontSize));
|
|
|
- g.drawString(pressText,x,y);
|
|
|
+ //g.setColor(Color.BLUE);
|
|
|
+ Font font = new Font("宋体",Font.PLAIN,40); //设置字体
|
|
|
+ g.setFont(font);
|
|
|
+ String str = "12345";
|
|
|
+ //int x = iw/2;
|
|
|
+ //int y = ih/2;
|
|
|
+ Random ran = new Random(); // 随机位置
|
|
|
+ g.drawString(str,x,y);
|
|
|
g.dispose();
|
|
|
- FileOutputStream out = new FileOutputStream(targetImg);
|
|
|
- JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
|
|
|
- encoder.encode(image);
|
|
|
- out.close();
|
|
|
- } catch (java.io.IOException e) {
|
|
|
+ ImageIO.write(im,"jpg",new File(outImg));
|
|
|
+ }catch (IOException e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// 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){
|
|
@@ -1890,7 +1951,7 @@ public class ApplicationPrimaryController {
|
|
|
return returnUrl;
|
|
|
}
|
|
|
|
|
|
- public boolean sendMessage(String content,String personId){
|
|
|
+ public boolean sendMessage(String content,String personId,String adminName){
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
String backDate = sdf.format(new Date());
|
|
|
// SchoolInfo schoolInfo = schoolInfoService.get(applicationPrimary.getSchoolId());
|
|
@@ -1898,11 +1959,10 @@ public class ApplicationPrimaryController {
|
|
|
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);
|
|
|
+ boolean messageResult = WechatMessageUtil.sendMessageTemplate(
|
|
|
+ adminName,content,
|
|
|
+ backRemark,backDate,pi.getOpenId(),
|
|
|
+ wechatConfig.getBackNoticeTemplateId(),wechatConfig.getTokenUrl(),appId,appSecret);
|
|
|
return messageResult;
|
|
|
}
|
|
|
|