Antiloveg 8 anni fa
parent
commit
4700240f21

+ 6 - 1
src/main/java/com/goafanti/admin/controller/AdminApiController.java

@@ -3064,7 +3064,7 @@ public class AdminApiController extends CertifyApiController {
 			return res;
 		}
 		
-		if (year != oc.getYear()){
+		if (year - oc.getYear() != 0){
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高企ID及年份"));
 			return res;
 		}
@@ -3123,6 +3123,11 @@ public class AdminApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到", "高企认定"));
 			return res;
 		}
+		
+		if (null == cog.getYear()){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到", "年份"));
+			return res;
+		}
 
 		OrgCognizance o = orgCognizanceService.selectByPrimaryKey(cog.getId());
 

+ 39 - 6
src/main/java/com/goafanti/admin/controller/AdminCopyrightApiController.java

@@ -47,6 +47,45 @@ public class AdminCopyrightApiController extends CertifyApiController {
 	@Resource
 	private AdminService			adminService;
 
+	@RequestMapping(value = "/circulation", method = RequestMethod.POST)
+	public Result circulation(@RequestParam(name = "ids[]", required = true) String[] ids, @Valid InputCopyright ic,
+			BindingResult bindingResult, String recordTimeFormattedDate) {
+		Result res = new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					CopyrightFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return res;
+		}
+
+		if (null == ic.getStatus()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到流转状态", "流转状态"));
+			return res;
+		}
+
+		if (StringUtils.isBlank(ic.getPrincipal())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到负责人", "负责人"));
+			return res;
+		}
+
+		if (StringUtils.isBlank(recordTimeFormattedDate)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到记录流转时间", "记录流转时间"));
+			return res;
+		}
+
+		if (CopyrightStatus.DELIVERD.getCode() != ic.getStatus()
+				&& CopyrightStatus.CIRCULATION.getCode() != ic.getStatus()
+				&& CopyrightStatus.SETTLEMENT.getCode() != ic.getStatus()) {
+			res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "仅派单、流转、结款可操作!"));
+			return res;
+		}
+
+		CopyrightLog cl = new CopyrightLog();
+		BeanUtils.copyProperties(ic, cl);
+
+		res.setData(copyrightInfoService.batchCirculation(ids, recordTimeFormattedDate, cl));
+		return res;
+	}
+
 	@RequestMapping(value = "/apply", method = RequestMethod.POST)
 	public Result newApply(@Valid InputCopyright inputInfo, BindingResult bindingResult) {
 		Result res = new Result();
@@ -71,12 +110,6 @@ public class AdminCopyrightApiController extends CertifyApiController {
 		if (TokenManager.getToken() instanceof Admin) {
 			ci.setPrincipal(TokenManager.getAdminId());
 		}
-		/*
-		 * if (StringUtils.isBlank(ci.getPrincipal())) {
-		 * ci.setStatus(CopyrightStatus.CREATE.getCode());
-		 * ci.setPrincipal(TokenManager.getAdminId()); } else {
-		 * ci.setStatus(CopyrightStatus.DELIVERD.getCode()); }
-		 */
 		copyrightInfoService.insert(ci, curUser.getAid());
 		res.setData(ci);
 		return res;

+ 25 - 12
src/main/java/com/goafanti/admin/controller/AdminTechProjectApiController.java

@@ -27,6 +27,7 @@ import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.enums.AttachmentType;
+import com.goafanti.common.enums.PatentInfoFields;
 import com.goafanti.common.enums.TechProjectFields;
 import com.goafanti.common.enums.TechProjectStatus;
 import com.goafanti.common.model.Admin;
@@ -64,6 +65,18 @@ public class AdminTechProjectApiController extends CertifyApiController {
 	@Resource
 	private AdminService			adminService;
 
+	@RequestMapping(value = "/circulation", method = RequestMethod.POST)
+	public Result circulation(@RequestParam(name = "ids[]", required = true) String[] ids, @Valid InputTechProject tp,
+			BindingResult bindingResult, String recordTimeFormattedDate) {
+		Result res = new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					PatentInfoFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return res;
+		}
+		return res;
+	}
+
 	/**
 	 * 咨询师下拉列表
 	 * 
@@ -226,13 +239,13 @@ public class AdminTechProjectApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "找不到申报项目", "科技项目申报"));
 			return res;
 		}
-		
-		if (TechProjectStatus.CALLBACK.getCode() == t.getState()){
+
+		if (TechProjectStatus.CALLBACK.getCode() == t.getState()) {
 			res.getError().add(buildError(ErrorConstants.RECORD_CALLBACK, "当前记录已退单,无法修改!"));
 			return res;
 		}
-		
-		if (TechProjectStatus.SETTLEMENT.getCode() == t.getState()){
+
+		if (TechProjectStatus.SETTLEMENT.getCode() == t.getState()) {
 			res.getError().add(buildError(ErrorConstants.RECORD_SETTLEMENT, "当前记录已结款,无法修改!"));
 			return res;
 		}
@@ -429,7 +442,7 @@ public class AdminTechProjectApiController extends CertifyApiController {
 		if (!checkCertify(res, curUser)) {
 			return res;
 		}
-		
+
 		if (StringUtils.isBlank(id)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到科技申报项目", "科技项目申报ID"));
 			return res;
@@ -440,20 +453,20 @@ public class AdminTechProjectApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "找不到申报项目", "科技项目申报"));
 			return res;
 		}
-		
-		if (TechProjectStatus.CALLBACK.getCode() == t.getState()){
+
+		if (TechProjectStatus.CALLBACK.getCode() == t.getState()) {
 			res.getError().add(buildError(ErrorConstants.RECORD_CALLBACK, "当前记录已退单,无法修改!"));
 			return res;
 		}
-		
-		if (TechProjectStatus.SETTLEMENT.getCode() == t.getState()){
+
+		if (TechProjectStatus.SETTLEMENT.getCode() == t.getState()) {
 			res.getError().add(buildError(ErrorConstants.RECORD_SETTLEMENT, "当前记录已结款,无法修改!"));
 			return res;
 		}
-		
+
 		AttachmentType attachmentType = AttachmentType.getField(sign);
-		
-		if (attachmentType == AttachmentType.TECH_PROJECT){
+
+		if (attachmentType == AttachmentType.TECH_PROJECT) {
 			res.setData(handleFiles(res, "/techProject/", true, req, sign, uid));
 		} else {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));

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

@@ -27,4 +27,6 @@ public interface CopyrightInfoMapper {
 	int findListCount(Map<String, Object> params);
 
 	int deleteByPrimaryKeys(List<String> id);
+
+	List<CopyrightInfo> selectByPrimaryKeys(List<String> asList);
 }

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

@@ -19,4 +19,6 @@ public interface CopyrightLogMapper {
 	int updateByPrimaryKey(CopyrightLog record);
 
 	List<CopyrightLogBO> findByCopyrightId(String id);
+
+	int batchInsert(List<CopyrightLog> log);
 }

+ 11 - 0
src/main/java/com/goafanti/common/mapper/CopyrightInfoMapper.xml

@@ -405,4 +405,15 @@
 	left join admin a on ci.principal = a.id
     where ci.id = #{id,jdbcType=VARCHAR}
   </select>
+  
+  <select id="selectByPrimaryKeys" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+		<include refid="Base_Column_List" /> 
+	from copyright_info where id in 
+		<foreach item="item" index="index" collection="list" open="("
+				separator="," close=")">
+				#{item}
+		</foreach>
+  </select>
+  
 </mapper>

+ 12 - 0
src/main/java/com/goafanti/common/mapper/CopyrightLogMapper.xml

@@ -122,4 +122,16 @@
     where cl.cid = #{id,jdbcType=VARCHAR} 
     order by cl.record_time desc
   </select>
+  
+   <insert id="batchInsert" parameterType="com.goafanti.common.model.CopyrightLog">
+    insert into copyright_log (id, cid, record_time, status, principal, operator, comment)
+    values 
+    <foreach item="item" index="index" collection="list" separator=",">
+      (
+      	#{item.id,jdbcType=VARCHAR}, #{item.cid,jdbcType=VARCHAR}, #{item.recordTime,jdbcType=TIMESTAMP},
+      	#{item.status,jdbcType=INTEGER}, #{item.principal,jdbcType=VARCHAR}, #{item.operator,jdbcType=VARCHAR},
+      	#{item.comment,jdbcType=VARCHAR}
+      )
+    </foreach>
+  </insert>
 </mapper>

+ 2 - 0
src/main/java/com/goafanti/copyright/service/CopyrightInfoService.java

@@ -34,4 +34,6 @@ public interface CopyrightInfoService {
 
 	List<CopyrightLogBO> findLogsByPrimaryKey(String id);
 
+	int batchCirculation(String[] ids, String recordTimeFormattedDate, CopyrightLog cl);
+
 }

+ 1 - 0
src/main/java/com/goafanti/copyright/service/CopyrightLogService.java

@@ -12,4 +12,5 @@ public interface CopyrightLogService {
 
 	CopyrightLog insert(CopyrightLog copyrightLog);
 
+
 }

+ 33 - 0
src/main/java/com/goafanti/copyright/service/impl/CopyrightInfoServiceImpl.java

@@ -1,7 +1,10 @@
 package com.goafanti.copyright.service.impl;
 
 import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Calendar;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -9,6 +12,7 @@ import java.util.UUID;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -219,6 +223,35 @@ public class CopyrightInfoServiceImpl extends BaseMybatisDao<CopyrightInfoMapper
 		copyrightInfoMapper.updateByPrimaryKey(copyrightInfo);
 	}
 
+	@Override
+	public int batchCirculation(String[] ids, String recordTimeFormattedDate, CopyrightLog cl) {
+		Date recordTime = null;
+		try {
+			recordTime = DateUtils.parseDate(recordTimeFormattedDate, AFTConstants.YYYYMMDDHHMMSS);
+		} catch (ParseException e) {
+		}
+		cl.setRecordTime(recordTime);
+		List<CopyrightLog> log = new ArrayList<CopyrightLog>();
+		List<CopyrightInfo> list = copyrightInfoMapper.selectByPrimaryKeys(Arrays.asList(ids));
+		if (null != list && list.size() > 0) {
+			for (CopyrightInfo copyrightInfo : list) {
+				CopyrightLog copyrightLog = new CopyrightLog();
+				BeanUtils.copyProperties(cl, copyrightLog);
+				copyrightLog.getId();
+				copyrightLog.setCid(copyrightInfo.getId());
+				copyrightLog.setOperator(TokenManager.getAdminId());
+				log.add(copyrightLog);
+				if (CopyrightStatus.CIRCULATION.getCode() != copyrightLog.getStatus()) {
+					copyrightInfo.setStatus(copyrightLog.getStatus());
+					copyrightInfoMapper.updateByPrimaryKeySelective(copyrightInfo);
+				}
+				createNotice(copyrightInfo, copyrightLog);
+			}
+			return copyrightLogMapper.batchInsert(log);
+		}
+		return 0;
+	}
+
 	private void createNotice(CopyrightInfo c, CopyrightLog l) {
 		CopyrightInfo info = copyrightInfoMapper.selectByPrimaryKey(c.getId());
 		Notice n = new Notice();

+ 1 - 0
src/main/java/com/goafanti/copyright/service/impl/CopyrightLogServiceImpl.java

@@ -25,4 +25,5 @@ public class CopyrightLogServiceImpl implements CopyrightLogService {
 		return null;
 	}
 
+
 }

+ 1 - 1
src/main/java/com/goafanti/patent/service/impl/PatentInfoServiceImpl.java

@@ -485,7 +485,7 @@ public class PatentInfoServiceImpl extends BaseMybatisDao<PatentInfoMapper> impl
 				}
 				createNotice(patentInfo, patentLog);
 			}
-			patentLogMapper.batchInsert(p);
+			return patentLogMapper.batchInsert(p);
 		}
 		return 0;
 	}