Explorar el Código

修改专利调整

anderx hace 4 años
padre
commit
964358f216

+ 3 - 6
src/main/java/com/goafanti/common/bo/EmailBo.java

@@ -345,14 +345,14 @@ public class EmailBo {
 				"		            \r\n" + 
 				"		        <table width=\"800\" border=\"0\" align=\"left\" cellpadding=\"0\" cellspacing=\"0\" style=\" border:1px solid #edecec; border-top:none; padding:0 20px;font-size:14px;color:#333333;\">\r\n" + 
 				"	               		<tbody><tr>\r\n" + 
-				"                <td width=\"760\" height=\"56\" border=\"0\" align=\"left\" colspan=\"2\" style=\" font-size:16px;vertical-align:bottom;\">尊敬的客户 " + userName + ":</td>\r\n" + 
+				"                <td width=\"760\" height=\"56\" border=\"0\" align=\"left\" colspan=\"2\" style=\" font-size:16px;vertical-align:bottom;\">尊敬的客户 [" + userName + "]:</td>\r\n" + 
 				"              </tr>\r\n" + 
 				"               <tr>\r\n" + 
 				"                <td width=\"760\" height=\"30\" border=\"0\" align=\"left\" colspan=\"2\" style=\"text-indent: 2em\">您好!</td>\r\n" + 
 				"              </tr>\r\n" + 
 				"                      <tr>\r\n" + 
 				"                <td width=\"40\" height=\"32\" border=\"0\" align=\"left\" valign=\"middle\" style=\" width:40px; text-align:left;vertical-align:middle; line-height:32px; float:left;\">&nbsp;</td>\r\n" + 
-				"                <td width=\"720\" height=\"32\" border=\"0\" align=\"left\" style=\" width:720px; text-align:left;vertical-align:middle;line-height:32px;\"><span style=\"font-weight: 900\">科德集团</span>【" + adminName + "】向您发起了专利缴费提醒!<span style=\"color: red\">如已缴费,请您忽略此短信!</span></td>\r\n" + 
+				"                <td width=\"720\" height=\"32\" border=\"0\" align=\"left\" style=\" width:720px; text-align:left;vertical-align:middle;line-height:32px;\"><span style=\"font-weight: 900\">科德集团</span>【" + adminName + "】向您发起了专利缴费提醒!<span style=\"color: red\">如已缴费,请您忽略此邮件!</span></td>\r\n" + 
 				"              </tr>\r\n" + 
 				"              <tr>\r\n" + 
 				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\"><span style=\"font-weight: 900\">专利信息</span></td>\r\n" + 
@@ -360,10 +360,7 @@ public class EmailBo {
 				"              \r\n" + 
 				"              <tr>\r\n" + 
 				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\">专利名称:" + patentName + "</td>\r\n" + 
-				"              </tr>\r\n" + 
-				"              <tr>\r\n" + 
-				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\">客户名称:" + userName + "</td>\r\n" + 
-				"              </tr>\r\n" + 
+				"              </tr>\r\n" +
 				"               <tr>\r\n" + 
 				"                <td width=\"720\" height=\"24\" colspan=\"2\" style=\"padding-left:40px;\">专利编号:" + patentNo + "</td>\r\n" + 
 				"              </tr>\r\n" + 

+ 2 - 1
src/main/java/com/goafanti/common/dao/PatentNewMapper.java

@@ -67,6 +67,7 @@ public interface PatentNewMapper {
 
 	String selectUserNameByTid(Integer tid);
 
-	void updateBatchStatusByid(@Param("list")List<String> list, @Param("status")Integer status);
+	void updateBatchByid(@Param("list")List<String> list, @Param("status")Integer status, @Param("aid")String aid);
+
 
 }

+ 11 - 2
src/main/java/com/goafanti/common/mapper/PatentNewMapper.xml

@@ -607,9 +607,18 @@
 			#{item}
 		</foreach>
 	</update>
-	<update id="updateBatchStatusByid">
+	<update id="updateBatchByid">
 		update patent_new
-		set status= #{status}
+		
+		<set>
+			<if test="status != null">
+				status= #{status},
+			</if>
+			<if test="aid != null">
+				aid= #{aid},
+			</if>
+			
+		</set>
 		where id in
 		<foreach item="item" collection="list" open="(" separator=","
 			close=")">

+ 3 - 3
src/main/java/com/goafanti/patent/controller/AdminPatentNewApiController.java

@@ -186,11 +186,11 @@ public class AdminPatentNewApiController extends CertifyApiController {
     /**
      * 批量操作
      * @param ids
-     * @param type 0 标记已通知 1批量发邮件
+     * @param type 0 标记已通知 1批量发邮件 2转给营销员
      * @return
      */
     @RequestMapping(value = "/updateBatch",method = RequestMethod.POST)
-    public Result updateBatch(String ids,Integer type) {
+    public Result updateBatch(String ids,Integer type,String aid) {
     	Result res =new Result();
     	if (ids==null) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"编号"));
@@ -200,7 +200,7 @@ public class AdminPatentNewApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"操作类型"));
 			return res;
 		}
-    	res.data(patentNewService.updateBatch(ids, type));
+    	res.data(patentNewService.updateBatch(ids, type,aid));
     	return res;
     }
     

+ 2 - 2
src/main/java/com/goafanti/patent/service/PatentNewService.java

@@ -13,7 +13,7 @@ public interface PatentNewService {
 
 	int addPatenNew(PatentNew p);
 
-	int updatePatenNew(PatentNew p);
+	int updatePatenNew(PatentNewBo p);
 
 	Pagination<PatentNewBo> selectPatentNew(PatentNewBo p,Integer pageSize, Integer pageNo);
 	
@@ -38,7 +38,7 @@ public interface PatentNewService {
 	Object pushPatentPaymentDetails(Integer id);
 
 	  
-	Object updateBatch(String ids, Integer type);
+	Object updateBatch(String ids, Integer type,String aid);
 
 	void updateBatchStatusByid(List<String> l2, Integer status);
 

+ 51 - 6
src/main/java/com/goafanti/patent/service/impl/PatentNewServiceImpl.java

@@ -32,6 +32,7 @@ import com.goafanti.common.dao.PatentYearPaymentMapper;
 import com.goafanti.common.dao.TOrderTaskMapper;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.Admin;
+import com.goafanti.common.model.PatentLog;
 import com.goafanti.common.model.PatentNew;
 import com.goafanti.common.model.PatentNewLog;
 import com.goafanti.common.model.PatentPaymentDetails;
@@ -77,10 +78,25 @@ public class PatentNewServiceImpl  extends BaseMybatisDao<PatentNewMapper> imple
 	}
 
 	@Override
-	public int updatePatenNew(PatentNew p) {
+	public int updatePatenNew(PatentNewBo p) {
+		PatentNewLog pl = new PatentNewLog();
+		pl.setId(p.getId());
+		Admin a = adminMapper.selectByPrimaryKey(TokenManager.getAdminId());
+		pl.setContent(a.getName() + "修改了专利内容。");
+		if (p.getApplyDates()!=null) {
+			PatentNew pn=patentNewMapper.selectByPrimaryKey(p.getId());
+			String date=DateUtils.formatDate(pn.getApplyDate(), AFTConstants.YYYYMMDD);
+			if (date.equals(p.getApplyDates())) {
+				p.setYears(getyear(p));
+				p.setType(pn.getType());
+				p.setTid(pn.getTid());
+				sumYears(p);
+			}
+		}
+		patentNewLogMapper.insertSelective(pl);
 		return patentNewMapper.updateByPrimaryKeySelective(p);
 	}
-
+	
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<PatentNewBo> selectPatentNew(PatentNewBo p,Integer pageSize, Integer pageNo) {
@@ -372,12 +388,13 @@ public class PatentNewServiceImpl  extends BaseMybatisDao<PatentNewMapper> imple
 		return list;
 	}
 
-	/** @param type 0 标记已通知 1批量发邮件
+	/** @param type 0 标记已通知 1批量发邮件 2转给营销员
 	   */
 	@Override
-	public Object updateBatch(String ids, Integer type) {
+	public Object updateBatch(String ids, Integer type,String aid) {
 		String [] s=ids.split(",");
 		List<String> ls=Arrays.asList(s);
+		addPatentNewLog(type, ls,aid);
 		if(type==1) {
 			List<EmailBo>list =new ArrayList<EmailBo>();
 			List<PatentNew> lp=patentNewMapper.selectByids(ls);
@@ -392,13 +409,41 @@ public class PatentNewServiceImpl  extends BaseMybatisDao<PatentNewMapper> imple
 			}
 			asyncUtils.sendList(list);
 		}
-		patentNewMapper.updateBatch(ls);
+		if (type==0||type==1) {
+			patentNewMapper.updateBatch(ls);
+		}else if(type==2) {
+			patentNewMapper.updateBatchByid(ls, null, aid);
+		}
 		return 1;
 	}
 
+	/**
+	 * 批量添加专利日志
+	 * @param type
+	 * @param ls
+	 */
+	private void addPatentNewLog(Integer type, List<String> ls,String aid) {
+		List<PatentNewLog> log=new ArrayList<PatentNewLog>();
+		Date date=new Date();
+		Admin a=adminMapper.selectByPrimaryKey(TokenManager.getAdminId());
+		Admin s=adminMapper.selectByPrimaryKey(aid);
+		for (String str : ls) {
+			PatentNewLog pl=new PatentNewLog();
+			pl.setPid(Integer.valueOf(str));
+			pl.setCreateTime(date);
+			String content="[%s]批量将专利%s";
+			if(type==0)str=String.format(content,a.getName(),"标记已通知。");
+			else if(type==1)str=String.format(content,a.getName(),"发送邮件。");
+			else if(type==2)str=String.format(content,a.getName(),"转交给["+s.getName()+"]。");
+			pl.setContent(str);
+			log.add(pl);
+		}
+		patentNewLogMapper.insertLogBatch(log);
+	}
+
 	@Override
 	public void updateBatchStatusByid(List<String> l2, Integer status) {
-		patentNewMapper.updateBatchStatusByid(l2,status);
+		patentNewMapper.updateBatchByid(l2,status,null);
 		
 	}
 }