Browse Source

公出详情查看权限设置

anderx 2 years ago
parent
commit
684bf20595

+ 2 - 0
src/main/java/com/goafanti/common/dao/PublicExamineMapper.java

@@ -18,4 +18,6 @@ public interface PublicExamineMapper {
     int updateByPrimaryKey(PublicExamine record);
 
     List<PublicExamine> selectByPrid(Integer id);
+
+    void updatePrid(PublicExamine pe);
 }

+ 5 - 0
src/main/java/com/goafanti/common/mapper/PublicExamineMapper.xml

@@ -85,6 +85,11 @@
       create_time = #{createTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=INTEGER}
   </update>
+  <update id="updatePrid">
+    update public_examine
+    set  `status` = #{status,jdbcType=INTEGER}
+    where prid = #{prid,jdbcType=INTEGER} and aid = #{aid,jdbcType=VARCHAR}
+  </update>
 
 
   <select id="selectByPrid" parameterType="java.lang.Integer" resultMap="BaseResultMap">

+ 20 - 0
src/main/java/com/goafanti/weChat/bo/OutPublicRelease.java

@@ -1,5 +1,6 @@
 package com.goafanti.weChat.bo;
 
+import com.goafanti.common.model.PublicExamine;
 import com.goafanti.common.model.PublicRelease;
 
 import java.util.Date;
@@ -20,6 +21,8 @@ public class OutPublicRelease extends PublicRelease {
 	private String suprId;
 	/** 审核权限*/
 	private Integer permission;
+	/** 自己是否审核 */
+	private Integer myExamine;
 
 	private String reviewer;
 
@@ -36,6 +39,23 @@ public class OutPublicRelease extends PublicRelease {
 	private String assistAidName;
 	private String uids;
 	private List<OutPublicReleaseDetails> prdList;
+	private List<PublicExamine> peList;
+
+	public List<PublicExamine> getPeList() {
+		return peList;
+	}
+
+	public void setPeList(List<PublicExamine> peList) {
+		this.peList = peList;
+	}
+
+	public Integer getMyExamine() {
+		return myExamine;
+	}
+
+	public void setMyExamine(Integer myExamine) {
+		this.myExamine = myExamine;
+	}
 
 	public List<OutPublicReleaseDetails> getPrdList() {
 		return prdList;

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

@@ -179,7 +179,7 @@ public class AdminReleaseApiController extends CertifyApiController{
 	}
 
 	/**
-	 * 公出审核、外出审核 上级
+	 * 公出审核、外出审核 营销
 	 * @return
 	 */
 	@RequestMapping(value = "/MarketersExamine", method = RequestMethod.POST)

+ 35 - 7
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -139,12 +139,15 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		return map;
 	}
 
-
-
 	private void addPublicExamine(Integer id, String aid) {
+		Admin admin = adminMapper.selectByPrimaryKey(aid);
+		addPublicExamine(id,admin);
+	}
+
+	private void addPublicExamine(Integer id, Admin a) {
 		PublicExamine pe=new PublicExamine();
 		pe.setPrid(id);
-		pe.setAid(aid);
+		pe.setAid(a.getAid());
 		pe.setStatus(0);
 		publicExamineMapper.insertSelective(pe);
 	}
@@ -181,10 +184,10 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 					str2=str2.append(my.getName()).append("(需审核),准备公出您的企业");
 					str2=str2.append("[").append(u.getNickname()).append("]!!!。");
 					sendEmailAndNoticeAndSoucket(u.getAid(),3,str2.toString());
+					Admin admin = adminMapper.selectByPrimaryKey(u.getAid());
 					//不是自己的企业则需要审核并设置非自己客户待审核
-					addPublicExamine(in.getId(), u.getAid());
+					addPublicExamine(in.getId(), admin);
 					if(in.getPublicType()==null|| in.getPublicType()==0) in.setPublicType(1);
-					Admin admin = adminMapper.selectByPrimaryKey(u.getAid());
 					pushNoticeAndSoucketAndEmail(my, in, date, admin, str, map);
 					status.set(0);
 				}
@@ -493,7 +496,25 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			a=adminMapper.selectByPrimaryKey(a.getReviewer());
 			if (status==2){//审核通过
 				str=str.append("同意,");
-
+				List<PublicExamine> publicExamines = publicExamineMapper.selectByPrid(use.getId());
+				int x=0;
+				for (PublicExamine pe : publicExamines) {
+					if (pe.getAid().equals(aid)){
+						pe.setStatus(1);
+						PublicExamine newp=new PublicExamine();
+						newp.setId(pe.getId());
+						newp.setStatus(1);
+						publicExamineMapper.updateByPrimaryKey(newp);
+						x++;
+					}else {
+						if (pe.getStatus()==1){
+							x++;
+						}
+					}
+				}
+				if (x==publicExamines.size()){
+					p.setPublicType(2);
+				}
 				addpublicLog(id, status, remarks);
 			}else if (status==0){//审核驳回
 				str=str.append("驳回,");
@@ -798,6 +819,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		//如果不是本人和审核人员则不返回信息
 		OutPublicRelease out=publicReleaseMapper.selectDtails(id);
 		List<PublicExamine> ps = publicExamineMapper.selectByPrid(out.getId());
+		out.setPeList(ps);
 		if(out!=null){
 			boolean flag=false;
 			//自己、审核人员与部门负责人可以查看
@@ -812,6 +834,8 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			if (!ps.isEmpty()){
 				for (PublicExamine p : ps) {
 					if (p.getAid().equals(aid)){
+						if (p.getStatus()==1)out.setMyExamine(1);
+						else out.setMyExamine(0);
 						flag=false;
 						break;
 					}
@@ -822,7 +846,11 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				return out;
 			}else {
 				if (out.getPublicType()==1){
-					out.setPermission(1);
+					if (aid.equals(out.getAid())){
+						out.setPermission(0);
+					}else {
+						out.setPermission(1);
+					}
 				}else {
 					if(aid.equals(out.getAid())) {
 						out.setPermission(0);