瀏覽代碼

技术协单驳回相关修改

anderx 3 年之前
父節點
當前提交
c005d4770b

+ 1 - 3
src/main/java/com/goafanti/common/dao/PublicReleaseMapper.java

@@ -13,9 +13,7 @@ public interface PublicReleaseMapper {
     int deleteByPrimaryKey(Integer id);
 
     int insert(PublicRelease record);
-    /** 需要获取id
-     *  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicRelease" useGeneratedKeys="true">
-     */
+
     int insertSelective(PublicRelease record);
 
     PublicRelease selectByPrimaryKey(Integer id);

+ 14 - 3
src/main/java/com/goafanti/common/mapper/PublicReleaseMapper.xml

@@ -40,13 +40,14 @@
     <result column="main_id" jdbcType="INTEGER" property="mainId" />
     <result column="main_name" jdbcType="VARCHAR" property="mainName" />
     <result column="clock_in_remarks" jdbcType="VARCHAR" property="clockInRemarks" />
+    <result column="reject_name" jdbcType="VARCHAR" property="rejectName" />
   </resultMap>
   <sql id="Base_Column_List">
     id, `uid`, aid, release_start, release_end, remarks, annex_url, user_name, longitude,
     latitude, `status`, create_time, clock_in, clock_in_time, photo_url, pid, pname,
     ufid, duration, valid_date, new_user, sign_sum, main_status, supplement, audit_info,
     `plan`, expected_effect, next_plan, `type`, order_no, update_time, update_status,
-    assist, assist_aid, assist_aid_name, main_id, main_name, clock_in_remarks
+    assist, assist_aid, assist_aid_name, main_id, main_name, clock_in_remarks, reject_name
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -205,6 +206,9 @@
       <if test="clockInRemarks != null">
         clock_in_remarks,
       </if>
+      <if test="rejectName != null">
+        reject_name,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -321,6 +325,9 @@
       <if test="clockInRemarks != null">
         #{clockInRemarks,jdbcType=VARCHAR},
       </if>
+      <if test="rejectName != null">
+        #{rejectName,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicRelease">
@@ -437,6 +444,9 @@
       <if test="clockInRemarks != null">
         clock_in_remarks = #{clockInRemarks,jdbcType=VARCHAR},
       </if>
+      <if test="rejectName != null">
+        reject_name = #{rejectName,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -478,7 +488,8 @@
       assist_aid_name = #{assistAidName,jdbcType=VARCHAR},
       main_id = #{mainId,jdbcType=INTEGER},
       main_name = #{mainName,jdbcType=VARCHAR},
-      clock_in_remarks = #{clockInRemarks,jdbcType=VARCHAR}
+      clock_in_remarks = #{clockInRemarks,jdbcType=VARCHAR},
+      reject_name = #{rejectName,jdbcType=VARCHAR}
     where id = #{id,jdbcType=INTEGER}
   </update>
 
@@ -494,7 +505,7 @@
   select  a.id,b.nickname ,c.name  aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.user_name userName,a.aid,
   date_format(a.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,a.status,
   a.latitude ,a.longitude ,a.clock_in clockIn,date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_status updateStatus,
-a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,a.type,a.main_name mainName
+a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,a.type,a.main_name mainName,a.reject_name rejectName
   from public_release a left join `user` b on a.uid =b.id left join admin c on a.aid =c.id
   <if test="type==2">
     left join department d on c.department_id =d.id

+ 13 - 0
src/main/java/com/goafanti/common/model/PublicRelease.java

@@ -195,6 +195,11 @@ public class PublicRelease implements Serializable {
      */
     private String clockInRemarks;
 
+    /**
+     * 驳回人员
+     */
+    private String rejectName;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -500,4 +505,12 @@ public class PublicRelease implements Serializable {
     public void setClockInRemarks(String clockInRemarks) {
         this.clockInRemarks = clockInRemarks;
     }
+
+    public String getRejectName() {
+        return rejectName;
+    }
+
+    public void setRejectName(String rejectName) {
+        this.rejectName = rejectName;
+    }
 }

+ 9 - 0
src/main/java/com/goafanti/weChat/bo/OutPublicReleaseList.java

@@ -21,6 +21,15 @@ public class OutPublicReleaseList {
 	private String 	assistAid;
 	private String 	assistAidName;
 	private String	mainName;
+	private String rejectName;
+
+	public String getRejectName() {
+		return rejectName;
+	}
+
+	public void setRejectName(String rejectName) {
+		this.rejectName = rejectName;
+	}
 
 	public String getMainName() {
 		return mainName;

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

@@ -132,7 +132,7 @@ public class AdminReleaseApiController extends CertifyApiController{
 	 * @return
 	 */
 	@RequestMapping(value = "/examinePublicRelease", method = RequestMethod.POST)
-	public Result examinePublicRelease(Integer id ,Integer status,String remarks,Double duration){
+	public Result examinePublicRelease(Integer id ,Integer status,String remarks){
 		Result res =new Result();
 		if (id==null) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"公出编号"));
@@ -146,10 +146,32 @@ public class AdminReleaseApiController extends CertifyApiController{
 			res.getError().add(buildError("备注长度不能超过20个字符。"));
 			return res;
 		}
-		res.setData(publicReleaseService.pushExaminePublicRelease( id , status, remarks,duration));
+		res.setData(publicReleaseService.pushExaminePublicRelease( id , status, remarks));
 		return res;
 	}
 
+
+	/**
+	 * 咨询驳回
+	 * @return
+	 */
+	@RequestMapping(value = "/techReject", method = RequestMethod.POST)
+	public Result techReject(Integer id ,String remarks){
+		Result res =new Result();
+		if (id==null) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"公出编号"));
+			return res;
+		}
+		if (remarks.length()>20) {
+			res.getError().add(buildError("备注长度不能超过20个字符。"));
+			return res;
+		}
+		res.setData(publicReleaseService.pushTechReject( id , remarks));
+		return res;
+	}
+
+
+
 	/**
 	 * 外出审核日志列表
 	 * @return

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

@@ -19,7 +19,7 @@ public interface PublicReleaseService {
 	Object listPublicRelease(InputPublicReleaseList in);
 
 
-	int pushExaminePublicRelease(Integer id, Integer status, String remarks, Double duration);
+	int pushExaminePublicRelease(Integer id, Integer status, String remarks);
 
 
 	List<outPublicReleaseLog> listPublicReleaseLog(Integer id,String ufid);
@@ -50,5 +50,5 @@ public interface PublicReleaseService {
 
     Object getMyNewPublic();
 
-
+	int pushTechReject(Integer id, String remarks);
 }

+ 75 - 9
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -104,8 +104,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	 */
 	private Map<String, Object> addPublicReleaseLog(AdminListBo my,PublicRelease in,Integer logStatus,String nickname,Date date ) {
 		Admin a=adminMapper.selectByPrimaryKey(my.getReviewer());
-		PublicReleaseLog log=new PublicReleaseLog(in.getId(),TokenManager.getAdminId(),logStatus,"发起外出申请",new Date());
-		publicReleaseLogMapper.insertSelective(log);
+		addpublicLog(in.getId(), logStatus, "发起外出申请");
 		String openid=a.getOpenId();
 		String str="["+my.getName()+"]发起["+nickname+"]的外出申请,请及时审核。";
 		sendNoticeAndSoucket(a.getId(),NoticeStatus.PUBLIC_RELEASE_START.getCode(),str);
@@ -149,6 +148,12 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		asyncUtils.addNotice(n);
 	}
 
+	/**
+	 *
+	 * @param my 发送人
+	 * @param a 接受者
+	 * @param type 类型
+	 */
 	private void sendEmail(AdminListBo my, Admin a,Integer type) {
 		String title="外出申请提醒";
 		if (type==0) title="外出申请驳回提醒";
@@ -195,8 +200,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			log.setStatus(PublicReleaseLog.states.cx.getCode());
 			List<PublicRelease> list = publicReleaseMapper.selectByMainId(in.getId());
 			for (PublicRelease out : list) {
-				PublicReleaseLog log2 = new PublicReleaseLog(out.getId(), TokenManager.getAdminId(), PublicReleaseLog.states.sc.getCode(), "修改撤销协单", new Date());
-				publicReleaseLogMapper.insertSelective(log2);
+				addpublicLog(out.getId(), PublicReleaseLog.states.sc.getCode(), "修改撤销协单");
 			}
 
 		}
@@ -229,7 +233,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	}
 
 	@Override
-	public int pushExaminePublicRelease(Integer id, Integer status, String remarks,Double duration) {
+	public int pushExaminePublicRelease(Integer id, Integer status, String remarks) {
 		PublicRelease p=new PublicRelease();
 		Date date =new Date();
 		String aid=TokenManager.getAdminId();
@@ -237,7 +241,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		p.setStatus(status);
 		PublicRelease use=publicReleaseMapper.selectByPrimaryKey(id);
 		if (use.getStatus()!=1) {
-			throw new BusinessException("只能修改发起的状态");
+			throw new BusinessException("只能修改发起的状态公出");
 		}
 		StringBuffer str=new StringBuffer();
 		Admin ad=adminMapper.selectByPrimaryKey(aid);
@@ -257,8 +261,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		str=str.append(remarks);
 		p.setAuditInfo(str.toString());
 		publicReleaseMapper.updateByPrimaryKeySelective(p);
-		PublicReleaseLog log=new PublicReleaseLog(id,TokenManager.getAdminId(),status,remarks,new Date());
-		publicReleaseLogMapper.insertSelective(log);
+		addpublicLog(id, status, remarks);
 		AdminListBo my = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
 		Admin a=adminMapper.selectByPrimaryKey(use.getAid());
 		Integer type=0;
@@ -266,7 +269,12 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		User u=userMapper.selectByPrimaryKey(use.getUid());
 		if (status==0) {
 			type=NoticeStatus.PUBLIC_RELEASE_NO.getCode();
-			content="["+u.getNickname()+"]公司的外出申请,未通过审核!";
+
+			if (use.getAssist()==2){
+				content="["+u.getNickname()+"]公司的外出申请,技术协单被["+ad.getName()+"]拒绝!";
+			}else {
+				content="["+u.getNickname()+"]公司的外出申请,未通过公出审核!";
+			}
 		}else if(status==2) {
 			type=NoticeStatus.PUBLIC_RELEASE_YES.getCode();
 			content="["+u.getNickname()+"]公司的外出申请,已通过审核!";
@@ -286,6 +294,62 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			return 1;
 	}
 
+	private void addpublicLog(Integer id, Integer status, String remarks) {
+		PublicReleaseLog log = new PublicReleaseLog(id, TokenManager.getAdminId(), status, remarks, new Date());
+		publicReleaseLogMapper.insertSelective(log);
+	}
+
+	@Override
+	public int pushTechReject(Integer id,  String remarks) {
+		PublicRelease use=publicReleaseMapper.selectByPrimaryKey(id);
+		PublicRelease mainPublic= publicReleaseMapper.selectByPrimaryKey(use.getMainId());
+		Admin ad=adminMapper.selectByPrimaryKey(TokenManager.getAdminId());
+		StringBuffer str=new StringBuffer();
+		str=str.append("(").append(ad.getName()).append(")");
+		if (use.getAssist()!=2){
+			throw  new BusinessException("只有技术公出能发起技术驳回");
+		}
+		str=str.append("拒绝技术协单,").append(remarks);
+		PublicRelease newMain=new PublicRelease();
+		newMain.setId(mainPublic.getId());
+		newMain.setStatus(0);
+		newMain.setRejectName(ad.getName());
+		newMain.setAuditInfo(str.toString());
+		publicReleaseMapper.updateByPrimaryKeySelective(newMain);
+		PublicRelease up=new PublicRelease();
+		up.setId(id);
+		up.setAuditInfo(str.toString());
+		up.setStatus(3);
+		publicReleaseMapper.updateByPrimaryKeySelective(up);
+		return addPublicLogPlus(mainPublic.getId(), mainPublic.getAid(), str.toString(), 0);
+	}
+
+	/**
+	 * 新增日志、站内信、微信提醒
+	 * @param id 日志公出编号
+	 * @param aid 接受者
+	 * @param remarks 日志内容
+	 * @param status 0驳回
+	 * @return
+	 */
+	private Integer addPublicLogPlus(Integer id,String aid, String remarks,  Integer status) {
+		addpublicLog(id, status, remarks);
+		Integer noticeType=0;
+		if (status ==0)noticeType=NoticeStatus.PUBLIC_RELEASE_NO.getCode();
+		sendNoticeAndSoucket(aid,noticeType, remarks);
+		AdminListBo my = adminMapper.getDeptNameByAid(aid);
+		Admin a = adminMapper.selectByPrimaryKey(TokenManager.getAdminId());
+		if (my.getOpenId()!=null) {
+			if (remarks.length()>19) {
+				remarks=remarks.substring(0, 15)+"...";
+			}
+			return weChatUtils.addNotice(my.getOpenId(),status,id,new Date(),my.getName(), remarks);
+		}else {
+			sendEmail( my,  a, status);
+			return 1;
+		}
+	}
+
 	private void pushPublicReleaseAssist(PublicRelease use,Integer status,Date date) {
 		Integer useId=use.getId();
 		if (use.getAssistAid()!=null){
@@ -567,6 +631,8 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	}
 
 
+
+
 	/**
 	 *
 	 * @param type 查看类型 0我的公出 1公出审核 2管理员 3协单(技术财税总监看全部)

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

@@ -1,12 +1,12 @@
 dev.name=local
 jdbc.driverClassName=com.mysql.jdbc.Driver
-#jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 #jdbc.url=jdbc\:mysql://localhost:3306/aft20220318?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-#jdbc.username=root
-#jdbc.password=123456
-jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 jdbc.username=root
-jdbc.password=aftdev
+jdbc.password=123456
+#jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+#jdbc.username=root
+#jdbc.password=aftdev
 jdbc.validationQuery=SELECT 'x'
 jdbc.initialSize=3
 jdbc.maxActive=20