anderx 4 lat temu
rodzic
commit
a20917a674

+ 2 - 2
src/main/java/com/goafanti/admin/controller/AdminReleaseApiController.java

@@ -110,7 +110,7 @@ public class AdminReleaseApiController extends CertifyApiController{
 	 * @return
 	 * @return
 	 */
 	 */
 	@RequestMapping(value = "/examinePublicRelease", method = RequestMethod.POST)
 	@RequestMapping(value = "/examinePublicRelease", method = RequestMethod.POST)
-	public Result examinePublicRelease(Integer id ,Integer status,String remarks){
+	public Result examinePublicRelease(Integer id ,Integer status,String remarks,Double duration){
 		Result res =new Result();
 		Result res =new Result();
 		if (id==null) {
 		if (id==null) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"公出编号"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"公出编号"));
@@ -120,7 +120,7 @@ public class AdminReleaseApiController extends CertifyApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"审核状态"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"审核状态"));
 			return res;
 			return res;
 		}
 		}
-		res.setData(publicReleaseService.pushExaminePublicRelease( id , status, remarks));
+		res.setData(publicReleaseService.pushExaminePublicRelease( id , status, remarks,duration));
 		return res;
 		return res;
 	}
 	}
 	
 	

+ 2 - 1
src/main/java/com/goafanti/admin/service/PublicReleaseService.java

@@ -16,7 +16,7 @@ public interface PublicReleaseService {
 	Object listPublicRelease(InputPublicReleaseList in);
 	Object listPublicRelease(InputPublicReleaseList in);
 
 
 
 
-	int pushExaminePublicRelease(Integer id, Integer status, String remarks);
+	int pushExaminePublicRelease(Integer id, Integer status, String remarks, Double duration);
 
 
 
 
 	List<outPublicReleaseLog> listPublicReleaseLog(Integer id);
 	List<outPublicReleaseLog> listPublicReleaseLog(Integer id);
@@ -32,4 +32,5 @@ public interface PublicReleaseService {
 	Object publicReleaseListDtails(InputPublicDtails in);
 	Object publicReleaseListDtails(InputPublicDtails in);
 
 
 
 
+
 }
 }

+ 6 - 12
src/main/java/com/goafanti/admin/service/impl/PublicReleaseServiceImpl.java

@@ -26,6 +26,7 @@ import com.goafanti.common.dao.AdminMapper;
 import com.goafanti.common.dao.PublicReleaseLogMapper;
 import com.goafanti.common.dao.PublicReleaseLogMapper;
 import com.goafanti.common.dao.PublicReleaseMapper;
 import com.goafanti.common.dao.PublicReleaseMapper;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.PublicRelease;
 import com.goafanti.common.model.PublicRelease;
 import com.goafanti.common.model.PublicReleaseLog;
 import com.goafanti.common.model.PublicReleaseLog;
 import com.goafanti.common.utils.AsyncUtils;
 import com.goafanti.common.utils.AsyncUtils;
@@ -62,10 +63,11 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			throw new BusinessException("转换异常");
 			throw new BusinessException("转换异常");
 		}
 		}
 		publicReleaseMapper.insertSelectiveGetId(in);
 		publicReleaseMapper.insertSelectiveGetId(in);
-		String openid=adminMapper.selectByOpeid(TokenManager.getAdminId());
+		Admin a=adminMapper.selectByPrimaryKey(TokenManager.getAdminId());
+		String openid=a.getOpenId();
 		openid="ogXpy5RoYqThnr-a8_2e0W7dZuF0";
 		openid="ogXpy5RoYqThnr-a8_2e0W7dZuF0";
 		if (openid!=null) {
 		if (openid!=null) {
-			asyncUtils.addWechatNotice(openid, 0);
+			asyncUtils.addWechatNotice(openid, 0,date,a.getName());
 			return 1;
 			return 1;
 		}else {
 		}else {
 			//成功但是对方收不到消息
 			//成功但是对方收不到消息
@@ -100,27 +102,19 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	}
 	}
 
 
 	@Override
 	@Override
-	public int pushExaminePublicRelease(Integer id, Integer status, String remarks) {
+	public int pushExaminePublicRelease(Integer id, Integer status, String remarks,Double duration) {
 		PublicRelease p=new PublicRelease();
 		PublicRelease p=new PublicRelease();
 		p.setId(id);
 		p.setId(id);
 		p.setStatus(status);
 		p.setStatus(status);
 		if (status==2) {
 		if (status==2) {
 			PublicRelease use=publicReleaseMapper.selectByPrimaryKey(id);
 			PublicRelease use=publicReleaseMapper.selectByPrimaryKey(id);
-			p.setDuration(getduration(use));
+			p.setDuration(duration);
 		}
 		}
 		publicReleaseMapper.updateByPrimaryKeySelective(p);
 		publicReleaseMapper.updateByPrimaryKeySelective(p);
 		PublicReleaseLog log=new PublicReleaseLog(id,TokenManager.getAdminId(),status,remarks,new Date());
 		PublicReleaseLog log=new PublicReleaseLog(id,TokenManager.getAdminId(),status,remarks,new Date());
 		publicReleaseLogMapper.insertSelective(log);
 		publicReleaseLogMapper.insertSelective(log);
 		return 1;
 		return 1;
 	}
 	}
-
-	private Double getduration(PublicRelease in) {
-		Calendar start=Calendar.getInstance();
-		Calendar end=Calendar.getInstance();
-		
-		 Integer i=(int) (in.getReleaseEnd().getTime()-in.getReleaseStart().getTime())/(1000*60*30);
-		return i*0.5;
-	}
 	
 	
 	@Override
 	@Override
 	public List<outPublicReleaseLog> listPublicReleaseLog(Integer id) {
 	public List<outPublicReleaseLog> listPublicReleaseLog(Integer id) {

+ 1 - 1
src/main/java/com/goafanti/common/constant/AFTConstants.java

@@ -2,7 +2,7 @@ package com.goafanti.common.constant;
 
 
 public class AFTConstants {
 public class AFTConstants {
 	public static final String	YYYYMMDDHHMMSS						= "yyyy-MM-dd HH:mm:ss";
 	public static final String	YYYYMMDDHHMMSS						= "yyyy-MM-dd HH:mm:ss";
-
+	public static final String	YMDHMS_CHINESE						= "yyyy年MM月dd日 HH:mm:ss";
 	public static final String	YYYYMMDD							= "yyyy-MM-dd";
 	public static final String	YYYYMMDD							= "yyyy-MM-dd";
 
 
 	public static final String	YYYY								= "yyyy";
 	public static final String	YYYY								= "yyyy";

+ 2 - 1
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -26,6 +26,7 @@
     <result column="open_id" jdbcType="VARCHAR" property="openId" />
     <result column="open_id" jdbcType="VARCHAR" property="openId" />
     <result column="head_portrait_url" jdbcType="VARCHAR" property="headPortraitUrl" />
     <result column="head_portrait_url" jdbcType="VARCHAR" property="headPortraitUrl" />
     <result column="contact_mobile" jdbcType="VARCHAR" property="contactMobile" />
     <result column="contact_mobile" jdbcType="VARCHAR" property="contactMobile" />
+    <result column="open_id" jdbcType="VARCHAR" property="openId" />
     <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime" />
     <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime" />
   </resultMap>
   </resultMap>
   <sql id="Example_Where_Clause">
   <sql id="Example_Where_Clause">
@@ -104,7 +105,7 @@
     -->
     -->
     id, mobile, name, password, email, create_time, number, province, position, superior_id, 
     id, mobile, name, password, email, create_time, number, province, position, superior_id, 
     city, department_id, status, user_no, duty, district, head_portrait_url, contact_mobile, 
     city, department_id, status, user_no, duty, district, head_portrait_url, contact_mobile, 
-    last_login_time
+    last_login_time,open_id
   </sql>
   </sql>
   <select id="selectByExample" parameterType="com.goafanti.common.model.AdminExample" resultMap="BaseResultMap">
   <select id="selectByExample" parameterType="com.goafanti.common.model.AdminExample" resultMap="BaseResultMap">
     <!--
     <!--

+ 4 - 4
src/main/java/com/goafanti/common/mapper/ThirdPartyCompanyMapper.xml

@@ -545,10 +545,10 @@
 		left join t_order_mid d on b.order_no=d.order_no left join t_task_mid f on a.tid=f.tid
 		left join t_order_mid d on b.order_no=d.order_no left join t_task_mid f on a.tid=f.tid
 		where 1=1
 		where 1=1
 		<if test="lvl==0">
 		<if test="lvl==0">
-		and c.finance_id= #{aid}
+		and d.finance_id= #{aid}
 		</if>
 		</if>
 		<if test="lvl==1">
 		<if test="lvl==1">
-		and c.finance_id in (select id from admin where superior_id= #{aid} )
+		and d.finance_id in (select id from admin where superior_id= #{aid} )
 		</if>
 		</if>
 		<if test="lvl==3">
 		<if test="lvl==3">
 		and b.task_receiver= #{aid}
 		and b.task_receiver= #{aid}
@@ -592,10 +592,10 @@
 		left join t_order_mid d on b.order_no=d.order_no 
 		left join t_order_mid d on b.order_no=d.order_no 
 		where 1=1
 		where 1=1
 		<if test="lvl==0">
 		<if test="lvl==0">
-		and c.finance_id= #{aid}
+		and d.finance_id= #{aid}
 		</if>
 		</if>
 		<if test="lvl==1">
 		<if test="lvl==1">
-		and c.finance_id in (select id from admin where superior_id= #{aid} )
+		and d.finance_id in (select id from admin where superior_id= #{aid} )
 		</if>
 		</if>
 		<if test="lvl==3">
 		<if test="lvl==3">
 		and b.task_receiver= #{aid}
 		and b.task_receiver= #{aid}

+ 24 - 11
src/main/java/com/goafanti/common/utils/AsyncUtils.java

@@ -1,6 +1,7 @@
 package com.goafanti.common.utils;
 package com.goafanti.common.utils;
 
 
 import java.io.UnsupportedEncodingException;
 import java.io.UnsupportedEncodingException;
+import java.net.URL;
 import java.util.Date;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
@@ -15,6 +16,7 @@ import org.springframework.stereotype.Component;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.bo.EmailBo;
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.NoticeMapper;
 import com.goafanti.common.dao.NoticeMapper;
 import com.goafanti.common.enums.NoticeTypes;
 import com.goafanti.common.enums.NoticeTypes;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.error.BusinessException;
@@ -30,10 +32,11 @@ public class AsyncUtils {
 	private String appId;
 	private String appId;
 	@Value(value = "${wx.appSecret}")
 	@Value(value = "${wx.appSecret}")
 	private String appSecret;
 	private String appSecret;
-	
-	private static final String sptz="Z630pmux5w-2ryn1MK3x6jZwZbxLV0_jdhOni6Wa_Yg";
-	private static final String jgtz="SLb0P5wDArFZU05iMrrnNEsXZ7H2wArqdY8__4M1NUU";
-	private static final String send_url="https://api.weixin.qq.com/cgi-bin/message/subscribe/send";
+	//待审核通知
+	private static final String sptz="j7WH3EwQnxGxwuV2HwmJhryxySPE8vOiV5cVOpp-42I";
+	//审核结通知
+	private static final String jgtz="pWia-KJPFwDM8ReDu_BOa2_42G7W2hXB16sUDbSxpcM";
+	private static  String send_url="https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=ACCESS_TOKEN";
 
 
 	
 	
 	public void patentSend(EmailBo bo) throws UnsupportedEncodingException, MessagingException {
 	public void patentSend(EmailBo bo) throws UnsupportedEncodingException, MessagingException {
@@ -64,33 +67,43 @@ public class AsyncUtils {
 	 * 
 	 * 
 	 * @param openid
 	 * @param openid
 	 * @param type 0申请 1通过 2驳回
 	 * @param type 0申请 1通过 2驳回
+	 * @param string 
+	 * @param date 
 	 */
 	 */
-	public void addWechatNotice(String openid ,Integer type) {
+	public void addWechatNotice(String openid ,Integer type, Date date, String aname) {
 		Map<String, Object> map=new HashMap<String, Object>();
 		Map<String, Object> map=new HashMap<String, Object>();
 		String accessToken=getAccessToken();
 		String accessToken=getAccessToken();
+		String url=send_url.replace("ACCESS_TOKEN", accessToken);
+		System.out.println(url);
 		map.put("access_token", accessToken);
 		map.put("access_token", accessToken);
 		map.put("touser", openid);
 		map.put("touser", openid);
 		Map<String, Object> we=new HashMap<String, Object>();
 		Map<String, Object> we=new HashMap<String, Object>();
 		if (type==0) {
 		if (type==0) {
 			map.put("template_id", sptz);
 			map.put("template_id", sptz);
 			Map<String, Object> v1=new HashMap<String, Object>();
 			Map<String, Object> v1=new HashMap<String, Object>();
-			v1.put("value","2019年10月1日");
+			String str=DateUtils.formatDate(date, AFTConstants.YMDHMS_CHINESE);
+			v1.put("value",str);
 			we.put("date2", v1);
 			we.put("date2", v1);
 			Map<String, Object> v2=new HashMap<String, Object>();
 			Map<String, Object> v2=new HashMap<String, Object>();
-			v2.put("value", "测试人");
+			v2.put("value", aname);
 			we.put("name5", v2);
 			we.put("name5", v2);
 			Map<String, Object> v3=new HashMap<String, Object>();
 			Map<String, Object> v3=new HashMap<String, Object>();
 			v3.put("value", "我是一个备注");
 			v3.put("value", "我是一个备注");
 			we.put("thing8", v3);
 			we.put("thing8", v3);
-		}else {
+		}else if (type==1){
+			map.put("template_id", jgtz);
+			we.put("thing17", new HashMap<>().put("value", "通过"));
+			we.put("thing25", new HashMap<>().put("value", "您申请的外出已通过!"));
+		}else if (type==2){
 			map.put("template_id", jgtz);
 			map.put("template_id", jgtz);
 			we.put("thing17", new HashMap<>().put("value", "通过"));
 			we.put("thing17", new HashMap<>().put("value", "通过"));
-			we.put("thing25", new HashMap<>().put("value", "我是一个备注"));
+			we.put("thing25", new HashMap<>().put("value", "您申请的外出已驳回!"));
 		}
 		}
 		map.put("data", we);
 		map.put("data", we);
 		System.out.println(JSONObject.toJSON(map));
 		System.out.println(JSONObject.toJSON(map));
-		JSONObject json=HttpUtils.httpPost(send_url, map);
+		JSONObject json=HttpUtils.httpPost(url, map);
 		System.out.println(JSONObject.toJSONString(json));
 		System.out.println(JSONObject.toJSONString(json));
+		
 	}
 	}
 	
 	
 
 
@@ -112,7 +125,7 @@ public class AsyncUtils {
 				if (errcode!=null) {
 				if (errcode!=null) {
 					throw new  BusinessException("获取AccessToken失败!");
 					throw new  BusinessException("获取AccessToken失败!");
 				}else {
 				}else {
-					LoggerUtils.debug(AsyncUtils.class,"获取AccessToken成功"+js.getString("access_token"));
+					LoggerUtils.debug(AsyncUtils.class,"获取AccessToken成功,accesstoken="+js.getString("access_token"));
 				}
 				}
 				access_token = js.getString("access_token");
 				access_token = js.getString("access_token");
 				expires_in = js.getString("expires_in");
 				expires_in = js.getString("expires_in");

+ 1 - 1
src/main/resources/props/config_local.properties

@@ -68,7 +68,7 @@ avatar.upload.host=//sb.jishutao.com/upload
 #avatar.host=//172.16.0.253
 #avatar.host=//172.16.0.253
 
 
 wx.appId=wxff2f5720ed7d7f63
 wx.appId=wxff2f5720ed7d7f63
-wx.appSecret=9c9912bdd381f2a412a23dd560c2f77e
+wx.appSecret=081744369d42405be58fe37f892631f7