Browse Source

客户相关字段拆分,完整度修改更改。

anderx 7 years ago
parent
commit
b7326ed5ce

+ 6 - 0
src/main/java/com/goafanti/common/dao/OrganizationAnnualReportMapper.java

@@ -95,4 +95,10 @@ public interface OrganizationAnnualReportMapper {
     int updateByPrimaryKey(OrganizationAnnualReport record);
 
 	int checkYear(Integer year);
+
+	int checkAnnual(@Param("id")String id, @Param("year")Integer year);
+
+	int selectOrgAnnualCount(String uid);
+
+	int selectOrgYearProjectCount(String uid);
 }

+ 4 - 0
src/main/java/com/goafanti/common/dao/OrganizationYearProjectMapper.java

@@ -93,4 +93,8 @@ public interface OrganizationYearProjectMapper {
      * @mbg.generated Fri Jul 20 16:32:47 CST 2018
      */
     int updateByPrimaryKey(OrganizationYearProject record);
+
+	int checkYear(Integer year);
+
+	int checkUser(String uid);
 }

+ 3 - 0
src/main/java/com/goafanti/common/mapper/OrganizationAnnualReportMapper.xml

@@ -341,6 +341,9 @@
   <select id="checkYear" parameterType="integer" resultType="integer">
   	select count(*) from organization_annual_report where year = #{year,jdbcType=INTEGER} 
   </select>
+  <select id="checkAnnual"  resultType="integer">
+  	select count(*) from organization_annual_report where id != #{id,jdbcType=VARCHAR} and year = #{year,jdbcType=INTEGER}  
+  </select>
   <select id="selectOrgAnnualList" resultMap="BaseResultMap">
    select 
   <include refid="Base_Column_List" />

+ 4 - 0
src/main/java/com/goafanti/common/mapper/OrganizationYearProjectMapper.xml

@@ -315,4 +315,8 @@
       aid = #{aid,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
+  
+  <select id="checkYear" parameterType="integer" resultType="integer">
+  	select count(*) from organization_annual_report where year = #{year,jdbcType=INTEGER} 
+  </select>
 </mapper>

+ 0 - 4
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -11,16 +11,13 @@ import java.util.Date;
 import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
-
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
-
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.goafanti.admin.service.AdminService;
@@ -33,7 +30,6 @@ import com.goafanti.common.controller.BaseApiController;
 import com.goafanti.common.enums.AttachmentType;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.AftFile;
-import com.goafanti.common.model.OrganizationAnnualReport;
 import com.goafanti.common.model.OrganizationContactBook;
 import com.goafanti.common.model.User;
 import com.goafanti.common.utils.BeanUtilsExt;

+ 5 - 6
src/main/java/com/goafanti/customer/controller/OrganizationAnnualReportController.java

@@ -2,7 +2,6 @@ package com.goafanti.customer.controller;
 
 
 import javax.annotation.Resource;
-
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -17,7 +16,6 @@ import com.goafanti.common.model.OrganizationYearProject;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.customer.service.AdminOrgAnnualReportService;
 import com.goafanti.customer.service.CustomerService;
-import com.goafanti.customer.service.impl.AdminOrgAnnualReportServiceImpl;
 
 @RestController
 @RequestMapping("/open/api/admin/customers")
@@ -97,6 +95,10 @@ public class OrganizationAnnualReportController extends BaseApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份"));
 			return res;
 		}
+		if (adminOrgAnnualReportService.checkAnnual(o)) {
+			res.getError().add(buildError("", "年份已存在", "年份已存在"));
+			return res;
+		}
 		res.setData(adminOrgAnnualReportService.updateOrgAnnual(o));
 		return res;
 	}
@@ -127,10 +129,7 @@ public class OrganizationAnnualReportController extends BaseApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份"));
 			return res;
 		}
-		if (adminOrgAnnualReportService.checkYear(o.getYear())) {
-			res.getError().add(buildError("", "年份已存在", "年份已存在"));
-			return res;
-		}
+		
 		res.setData(adminOrgAnnualReportService.addOrgYearProject(o));
 		return res;
 	}

+ 2 - 0
src/main/java/com/goafanti/customer/service/AdminOrgAnnualReportService.java

@@ -16,6 +16,8 @@ public interface AdminOrgAnnualReportService {
 
 	Pagination<OrganizationAnnualReport> selectListOrgAnnual(OrganizationAnnualReport o, Integer pNo, Integer pSize);
 
+	boolean checkAnnual(OrganizationAnnualReport o);
+	
 	boolean checkYear(Integer year);
 
 	int addOrgYearProject(OrganizationYearProject o);

+ 1 - 0
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -501,6 +501,7 @@ public interface CustomerService {
 	void updatePendingReleaseLock(List<LockingReleaseBo> newList);
 	List<LockingReleaseBo> selectPendinglockUserList();
 	int updateUserLevel(User u);
+	public  Float countIntegrity(CustomerOrganizationDetailBo bo);
 	
 	
 }

+ 22 - 2
src/main/java/com/goafanti/customer/service/impl/AdminOrgAnnualReportServiceImpl.java

@@ -1,24 +1,30 @@
 package com.goafanti.customer.service.impl;
 
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.goafanti.common.dao.OrganizationAnnualReportMapper;
 import com.goafanti.common.dao.OrganizationYearProjectMapper;
+import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.model.OrganizationAnnualReport;
 import com.goafanti.common.model.OrganizationYearProject;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.customer.bo.CustomerOrganizationDetailBo;
 import com.goafanti.customer.service.AdminOrgAnnualReportService;
+import com.goafanti.customer.service.CustomerService;
 @Service
 public class AdminOrgAnnualReportServiceImpl  extends BaseMybatisDao<OrganizationAnnualReportMapper> implements AdminOrgAnnualReportService {
 	@Autowired
 	private OrganizationAnnualReportMapper	organizationAnnualReportMapper;
 	@Autowired
 	private OrganizationYearProjectMapper	organizationYearProjectMapper;
+	@Autowired
+	private UserMapper	userMapper;
+	@Autowired
+	private CustomerService customerService;
 	
 	@Override
 	public int addOrgAnnual(OrganizationAnnualReport o) {
@@ -40,7 +46,10 @@ public class AdminOrgAnnualReportServiceImpl  extends BaseMybatisDao<Organizatio
 
 	@Override
 	public int updateOrgAnnual(OrganizationAnnualReport o) {
+		CustomerOrganizationDetailBo bo=userMapper.findOrganizationCustomerDetail(o.getUid());
+		customerService.countIntegrity(bo);
 		return organizationAnnualReportMapper.updateByPrimaryKey(o);
+		
 	}
 
 	@SuppressWarnings("unchecked")
@@ -57,9 +66,16 @@ public class AdminOrgAnnualReportServiceImpl  extends BaseMybatisDao<Organizatio
 	@Override
 	public boolean checkYear(Integer year) {
 		int i=organizationAnnualReportMapper.checkYear(year);
-		if(i>1)return true;
+		if(i>0)return true;
 		return false;
 	}
+	@Override
+	public boolean checkAnnual(OrganizationAnnualReport o) {
+		int i=organizationAnnualReportMapper.checkAnnual(o.getId(),o.getYear());
+		if(i>0)return true;
+		return false;
+	}
+
 
 	@Override
 	public int addOrgYearProject(OrganizationYearProject o) {
@@ -81,6 +97,8 @@ public class AdminOrgAnnualReportServiceImpl  extends BaseMybatisDao<Organizatio
 
 	@Override
 	public int updateOrgYearProject(OrganizationYearProject o) {
+		CustomerOrganizationDetailBo bo=userMapper.findOrganizationCustomerDetail(o.getUid());
+		customerService.countIntegrity(bo);
 		return organizationYearProjectMapper.updateByPrimaryKey(o);
 	}
 
@@ -96,6 +114,8 @@ public class AdminOrgAnnualReportServiceImpl  extends BaseMybatisDao<Organizatio
 		return list;
 		
 	}
+
+
 	
 
 }

+ 14 - 11
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -1,7 +1,6 @@
 package com.goafanti.customer.service.impl;
 
 import java.lang.reflect.InvocationTargetException;
-import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -11,24 +10,22 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
-
 import javax.annotation.Resource;
-
 import org.apache.commons.beanutils.BeanUtils;
-import org.apache.commons.lang3.time.DateFormatUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.dao.AdminMapper;
 import com.goafanti.common.dao.BusinessGlossoryMapper;
 import com.goafanti.common.dao.BusinessProjectMapper;
+import com.goafanti.common.dao.OrganizationAnnualReportMapper;
 import com.goafanti.common.dao.OrganizationApplicationInfoMapper;
 import com.goafanti.common.dao.OrganizationContactBookMapper;
 import com.goafanti.common.dao.OrganizationIdentityMapper;
+import com.goafanti.common.dao.OrganizationYearProjectMapper;
 import com.goafanti.common.dao.UserBusinessMapper;
 import com.goafanti.common.dao.UserFollowBusinessMapper;
 import com.goafanti.common.dao.UserFollowMapper;
@@ -101,6 +98,10 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 	private AdminMapper	adminMapper;
 	@Resource
 	private OrganizationApplicationInfoMapper	organizationApplicationInfoMapper;
+	@Resource
+	private OrganizationAnnualReportMapper	organizationAnnualReportMapper;
+	@Resource
+	private OrganizationYearProjectMapper	organizationYearProjectMapper;
 	
 	
 	@SuppressWarnings("unchecked")
@@ -360,9 +361,9 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		return 1;
 	}
 
-	private Float countIntegrity(CustomerOrganizationDetailBo bo) {
+	public  Float countIntegrity(CustomerOrganizationDetailBo bo) {
 		//完整资料总数
-		int max=12;
+		int max=10;
 		int number=0;
 		if(bo.getIndustry()!=null)number+=1;
 		if(bo.getLocationProvince()!=null)number+=1;
@@ -370,11 +371,13 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		if(bo.getRegisteredCapital()!=null)number+=1;
 		if(StringUtils.isNotBlank(bo.getCooperationSituation()))number+=1; 
 		if(StringUtils.isNotBlank(bo.getQualification()))number+=1; 
-		if(bo.getAssets()!=null)number+=1;
-		if(bo.getLastYearResearchAmount()!=null)number+=1;
-		if(bo.getYearSalesAmount()!=null)number+=1;
+//		if(bo.getAssets()!=null)number+=1;
+//		if(bo.getLastYearResearchAmount()!=null)number+=1;
+//		if(bo.getYearSalesAmount()!=null)number+=1;
+//		if(StringUtils.isNotBlank(bo.getAccomplishSituation()))number+=1;
+		if (organizationAnnualReportMapper.selectOrgAnnualCount(bo.getUid())>0)number+=1;
+		if (organizationAnnualReportMapper.selectOrgYearProjectCount(bo.getUid())>0)number+=1;
 		if(StringUtils.isNotBlank(bo.getCoreTechnology()))number+=1;
-		if(StringUtils.isNotBlank(bo.getAccomplishSituation()))number+=1;
 		if(bo.getCreditRating()!=null)number+=1;
 		float f= (float)number/max;
 		return f;