anderx hai 1 ano
pai
achega
abeae86ad0

+ 7 - 1
src/main/java/com/goafanti/common/mapper/PublicReleaseMapper.xml

@@ -377,7 +377,7 @@
         a.assistant_aid assistantAid ,a.assistant_name assistantName,a.public_again publicAgain,a.user_names userNames,
         ea.total_amount expenseAmount ,a.clock_in clockIn,c2.name reviewerName,a.tech_start_process techStartProcess
         from public_release a  left join admin c on a.aid =c.id
-            left join admin c2 on c.reviewer=c2.id
+        left join admin c2 on c.reviewer=c2.id
         left join expense_account ea ON a.id = ea.prid AND ea.status IN (0, 1, 2, 3)
         <if test="type==2">
             left join department d on c.department_id =d.id
@@ -390,6 +390,9 @@
             left join t_order_new ton on a.order_no =ton.order_no
             left join t_order_mid tom on a.order_no=tom.order_no
         </if>
+        <if test="type==6">
+            left join admin_public_reviewer apr on a.aid=apr.aid and apr.reviewer_id= #{aid}
+        </if>
         where 1=1
         <include refid="listPublicReleaseSql"/>
         ORDER BY (case when a.status=1 then 1 when a.status=2 then 2 when a.status=3 then 5
@@ -451,6 +454,9 @@
             and a.tech_start_process=1
             and ton.salesman_id =#{aid}
         </if>
+        <if test="type==6">
+            and a.type=3 and a.assist=2
+        </if>
         <if test="clockIn !=null">
             and a.clock_in =#{clockIn}
         </if>

+ 31 - 19
src/main/java/com/goafanti/common/utils/AsyncUtils.java

@@ -19,10 +19,10 @@ import com.goafanti.order.enums.OrderChangeProcess;
 import com.goafanti.order.enums.OrderChangeType;
 import com.goafanti.order.enums.ProcessStatus;
 import com.goafanti.organization.bo.OrganizationListOut;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import javax.mail.MessagingException;
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
@@ -33,42 +33,44 @@ import java.util.UUID;
 @Component
 @Async
 public class AsyncUtils {
-	@Autowired
+	@Resource
 	private NoticeMapper noticeMapper;
-	@Autowired
+	@Resource
 	private AdminMapper adminMapper;
-	@Autowired
+	@Resource
 	private TOrderNewMapper tOrderNewMapper;
-	@Autowired
+	@Resource
 	private TOrderTaskMapper tOrderTaskMapper;
-	@Autowired
+	@Resource
 	private NewOrderChangeMapper newOrderChangeMapper;
-	@Autowired
+	@Resource
 	private OrderExamineMapper orderExamineMapper;
-	@Autowired
+	@Resource
 	private TaskAttributionLogMapper taskAttributionLogMapper;
-	@Autowired
+	@Resource
 	private TTaskLogMapper tTaskLogMapper;
-	@Autowired
+	@Resource
 	private DepartmentMapper departmentMapper;
-	@Autowired
+	@Resource
 	private OrderChangeLogMapper orderChangeLogMapper;
-	@Autowired
+	@Resource
 	private TOrderMidMapper tOrderMidMapper;
-	@Autowired
+	@Resource
 	private RoleMapper roleMapper;
-	@Autowired
+	@Resource
 	private ExpenseAccountMapper expenseAccountMapper;
-	@Autowired
+	@Resource
 	private TOrderInvoiceMapper tOrderInvoiceMapper;
-	@Autowired
+	@Resource
 	private TTaskMemberMapper tTaskMemberMapper;
-	@Autowired
+	@Resource
 	private TOrderPaymentMapper tOrderPaymentMapper;
-	@Autowired
+	@Resource
 	private AdminUserCountMapper adminUserCountMapper;
-	@Autowired
+	@Resource
 	private FinanceCountMapper financeCountMapper;
+	@Resource
+	private WeChatUtils weChatUtils;
 
 
 
@@ -193,6 +195,10 @@ public class AsyncUtils {
 		addNoticAndEmail(n);
 	}
 
+
+
+
+
 	public void addNoticAndEmail(Notice n) {
 		n.setType(NoticeTypes.getType(n.getNoticeType()));
 		AdminListBo a = adminMapper.getDeptNameByAid(n.getAid());
@@ -825,4 +831,10 @@ public class AsyncUtils {
 			}
 		}
 	}
+
+
+	public void sendWeChat( String publicCarbonCopy,Integer id, String name, String startTime, String endTime, String typeName, String plan) {
+		Admin admin = adminMapper.selectByPrimaryKey(publicCarbonCopy);
+		weChatUtils.addSendCopyNotice(admin.getOpenId(), id, name, startTime, endTime, typeName, plan);
+	}
 }

+ 7 - 1
src/main/java/com/goafanti/common/utils/DateUtils.java

@@ -25,7 +25,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
 	private static String[] parsePatterns = {
 			"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
 			"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
-			"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
+			"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM",
+			"yyyy年MM月dd日", "yyyy年MM月dd日 HH:mm:ss", "yyyy年MM月dd日 HH:mm", "yyyy年MM月",};
 
 	/**
 	 * Determines how two dates compare up to no more than the specified most
@@ -421,6 +422,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
 		return format.format(date);
 	}
 
+	public static String formatDateChineseYYYYMMddHH(Date date) {
+		SimpleDateFormat format = new SimpleDateFormat(parsePatterns[14]);
+		return format.format(date);
+	}
+
 	/**
 	 * 解析日期
 	 * @param source

+ 48 - 1
src/main/java/com/goafanti/common/utils/WeChatUtils.java

@@ -51,6 +51,7 @@ public class WeChatUtils {
 	 * 公出审核结果通知
 	 */
 	private static final String EXPENSE_RELEASE_EXAMINE_RESULT="rRPWzRcGY8BGwlk0xyjwR1RKdv3iRFXaU3bcK1300gw";
+	private static final String PUBLIC_RELEASE_SEND_COPY="UGlNqF1VQsxYh6iVKrDuw_EkhrDNU6TXv4snGw4xze8";
 
 
 	/**
@@ -88,10 +89,56 @@ public class WeChatUtils {
 
 	}
 
+
+	/**
+	 * 推送微信订阅信息,跳转为公出信息
+	 * @param openid 发送对象微信openid
+	 * @param id 公出id
+	 * @param name 发起者名称
+	 * @param startTime 开始时间
+	 * @param endTime 结束时间
+	 * @param typeName 类型名称
+	 * @param plan 抄送说明
+	 */
+	public Integer addSendCopyNotice(String openid ,Integer id,String name, String startTime, String endTime, String typeName, String plan) {
+		Map<String, Object> map=new HashMap<String, Object>();
+		String accessToken=getAccessToken();
+		String url=send_url.replace("ACCESS_TOKEN", accessToken);
+		map.put("access_token", accessToken);
+		map.put("touser", openid);
+		map.put("page", "pages/egressDetails/index?id="+id);
+		map.put("miniprogram_state", wxState);
+		map.put("template_id", PUBLIC_RELEASE_EXAMINE_RESULT);
+		map.put("data",getSendCopyData(name, startTime, endTime, typeName, plan));
+		return SendHttpPost(map, url);
+
+	}
+
+	private Object getSendCopyData(String name, String startTime, String endTime, String typeName, String plan) {
+		Map<String, Object> we=new HashMap<String, Object>();
+		if (plan.length()>20)plan=plan.substring(0,17)+"...";
+		Map<String, Object> v1=new HashMap<String, Object>();
+		v1.put("value",name);
+		we.put("thing1", v1);
+		Map<String, Object> v2=new HashMap<String, Object>();
+		v2.put("value", typeName);
+		we.put("thing2", v2);
+		Map<String, Object> v3=new HashMap<String, Object>();
+		v3.put("value", plan);
+		we.put("thing3", v3);
+		Map<String, Object> v4=new HashMap<String, Object>();
+		v4.put("value", startTime);
+		we.put("time4", v4);
+		Map<String, Object> v5=new HashMap<String, Object>();
+		v5.put("value", endTime);
+		we.put("time5", v5);
+		return we;
+	}
+
 	private Integer SendHttpPost(Map<String, Object> map, String url) {
 		JSONObject res=HttpUtils.httpPost(url, map);
 		if (res.get("errcode")!=null) {
-			LoggerUtils.error(this.getClass(),String.format("errcode={%s}",res.getInteger("errcode").toString()));
+			LoggerUtils.error(this.getClass(),String.format("================errcode={%s}",res));
 			return res.getInteger("errcode");
 		}else {
 			return 1;

+ 3 - 1
src/main/java/com/goafanti/weChat/bo/InputPublicReleaseList.java

@@ -4,7 +4,9 @@ public class InputPublicReleaseList {
 
 	private Integer pageSize;
 	private Integer pageNo;
-//	查看类型 0我的公出 1公出审核 2管理员 3协单(技术财税总监看全部) 4 公出企业负责人审核 5 技术公出审核
+	/**
+	 * 查看类型 0我的公出 1公出审核 2管理员 3协单(技术财税总监看全部) 4 公出企业负责人审核 5 技术公出审核 6=协单审核
+	 */
 	private Integer type;
 	private String clockTime;
 	/**

+ 1 - 1
src/main/java/com/goafanti/weChat/controller/AdminReleaseApiController.java

@@ -142,7 +142,7 @@ public class AdminReleaseApiController extends CertifyApiController{
 	}
 
 	/**
-	 * 外出申请列表.公出列表,我的协单列表
+	 * 外出申请列表.公出列表,我的协单列表,协单审核
 	 */
 	@RequestMapping(value = "/listPublicRelease", method = RequestMethod.GET)
 	public Result listPublicRelease(InputPublicReleaseList in){

+ 14 - 2
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -176,12 +176,24 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		publicReleaseMapper.updateByPrimaryKeySelective(updateName);
 		addpublicLog(in.getId(), PublicReleaseLog.states.fq.getCode(), "发起外出申请");
 		if (StringUtils.isNotEmpty(my.getPublicCarbonCopy())){
+			String startTime = DateUtils.formatDateChineseYYYYMMddHH(in.getReleaseStart());
+			String endTime = DateUtils.formatDateChineseYYYYMMddHH(in.getReleaseEnd());
+			//分类 0业务 1技术 2行政 3 技术协单 4 技术助手
+			String typeName=null;
+			if(in.getType()==0)typeName="业务公出";
+			else if(in.getType()==1)typeName="技术公出";
+			else if(in.getType()==2)typeName="行政公出";
 			String str2=String.format("营销员%s,%s - %s,将公出%s,请知悉!",my.getName(),
-					DateUtils.formatDateYYYYMMddHHmm(in.getReleaseStart()),
-					DateUtils.formatDateYYYYMMddHHmm(in.getReleaseEnd()),
+					startTime,
+					endTime,
 					userNames);
 			asyncUtils.addNoticAndEmail(NoticeStatus.PUBLIC_CARBON_COPY.getCode(),my.getPublicCarbonCopy()
 					,str2);
+			asyncUtils.sendWeChat(my.getPublicCarbonCopy(),in.getId(),
+					my.getName(), startTime,
+					endTime,
+					typeName,
+					in.getPlan());
 		}
         return (Map<String, Object>) addPublicReleaseLog(my, in,userNames,date,users,checkOrderNo);
 	}