Browse Source

客户资料报表开发

anderx 7 years ago
parent
commit
55d09311af

+ 17 - 5
src/main/java/com/goafanti/common/mapper/UserMapper.xml

@@ -41,6 +41,7 @@
     <result column="username" jdbcType="VARCHAR" property="username" />
     <result column="authentication" jdbcType="INTEGER" property="authentication" />
     <result column="level" jdbcType="INTEGER" property="level" />
+    <result column="integrity" jdbcType="FLOAT" property="integrity" />  
   </resultMap>
   <sql id="Example_Where_Clause">
     <!--
@@ -120,7 +121,7 @@
     source, update_time, company_logo_url, head_portrait_url, society_tag, introduction, 
     value_added_tag, organization_id, identify_name, background_url, audit_opinion, audit_status, 
     share_type, aid, transfer_time, information_maintainer, core_technology, accomplish_situation, 
-    intellectual_property, credit_rating, username, authentication, level
+    intellectual_property, credit_rating, username, authentication, level,integrity
   </sql>
   <select id="selectByExample" parameterType="com.goafanti.common.model.UserExample" resultMap="BaseResultMap">
     <!--
@@ -189,7 +190,7 @@
       transfer_time, information_maintainer, 
       core_technology, accomplish_situation, intellectual_property, 
       credit_rating, username, authentication, 
-      level)
+      level,integrity)
     values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, 
       #{nickname,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
       #{number,jdbcType=BIGINT}, #{lvl,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{mid,jdbcType=VARCHAR}, 
@@ -201,7 +202,7 @@
       #{transferTime,jdbcType=TIMESTAMP}, #{informationMaintainer,jdbcType=VARCHAR}, 
       #{coreTechnology,jdbcType=VARCHAR}, #{accomplishSituation,jdbcType=VARCHAR}, #{intellectualProperty,jdbcType=VARCHAR}, 
       #{creditRating,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{authentication,jdbcType=INTEGER}, 
-      #{level,jdbcType=INTEGER})
+      #{level,jdbcType=INTEGER},#{integrity,jdbcType=FLOAT})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.User">
     <!--
@@ -313,6 +314,9 @@
       <if test="level != null">
         level,
       </if>
+      <if test="integrity != null">
+        integrity,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -417,6 +421,9 @@
       <if test="level != null">
         #{level,jdbcType=INTEGER},
       </if>
+      <if test="integrity != null">
+        #{integrity,jdbcType=FLOAT}
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.goafanti.common.model.UserExample" resultType="java.lang.Long">
@@ -585,7 +592,8 @@
       credit_rating = #{record.creditRating,jdbcType=INTEGER},
       username = #{record.username,jdbcType=VARCHAR},
       authentication = #{record.authentication,jdbcType=INTEGER},
-      level = #{record.level,jdbcType=INTEGER}
+      level = #{record.level,jdbcType=INTEGER},
+      integrity = #{integrity ,jdbcType=FLOAT}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -697,6 +705,9 @@
       <if test="level != null">
         level = #{level,jdbcType=INTEGER},
       </if>
+      <if test="integrity != null">
+      integrity = #{integrity ,jdbcType=FLOAT}
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -739,7 +750,8 @@
       credit_rating = #{creditRating,jdbcType=INTEGER},
       username = #{username,jdbcType=VARCHAR},
       authentication = #{authentication,jdbcType=INTEGER},
-      level = #{level,jdbcType=INTEGER}
+      level = #{level,jdbcType=INTEGER},
+      integrity = #{integrity ,jdbcType=FLOAT}
     where id = #{id,jdbcType=VARCHAR}
   </update>
  

+ 8 - 0
src/main/java/com/goafanti/common/model/User.java

@@ -180,6 +180,8 @@ public class  User implements AftUser{
 	 * @return  the value of user.id
 	 * @mbg.generated  Tue Jun 26 10:23:14 CST 2018
 	 */
+	private Float integrity;
+	
 	public String getId() {
 		return id;
 	}
@@ -726,4 +728,10 @@ public class  User implements AftUser{
 		public static long getSerialversionuid() {
 		return serialVersionUID;
 	}
+		public Float getIntegrity() {
+			return integrity;
+		}
+		public void setIntegrity(Float integrity) {
+			this.integrity = integrity;
+		}
 }

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

@@ -50,7 +50,7 @@ import com.goafanti.customer.bo.UserDetailBo;
 import com.goafanti.customer.service.CustomerService;
 
 @RestController
-@RequestMapping("/open/api/admin/customer")
+@RequestMapping("/api/admin/customer")
 public class AdminCustomerApiController extends BaseApiController{
 	@Resource
 	private CustomerService customerService;

+ 26 - 0
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -239,6 +239,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		user.setStatus(AFTConstants.USER_STATUS_NORMAL);
 		user.setShareType(AFTConstants.NO);
 		user.setAid(TokenManager.getAdminId());
+//		user.setAid("1");
 		user.setType(type);
 		user.setLvl(UserLevel.CERTIFIED.getCode());
 		user.setSocietyTag(societyTag);
@@ -248,6 +249,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		user.setMobile(contactMobile);
 		user.setPassword(AFTConstants.INITIALPASSWORD);
 		user.setInformationMaintainer(TokenManager.getAdminId());
+//		user.setInformationMaintainer("1");
 		passwordUtil.encryptPassword(user);
 		if(type == UserType.PERSONAL.getCode()){
 			if(userMapper.checkUser("", "", contactMobile, type,null,null).size()>0) throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_EXIST, name,""));
@@ -287,6 +289,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		//新增企业联系人
 		OrganizationContactBook cob = new OrganizationContactBook();
 		cob.setAid(TokenManager.getAdminId());
+//		cob.setAid("1");
 		cob.setId(UUID.randomUUID().toString());
 		cob.setUid(uid);
 		cob.setName(contacts);
@@ -295,6 +298,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		organizationContactBookMapper.insert(cob);
 		//新增锁定数据
 		addUserLock(uid, TokenManager.getAdminId(), now);
+//		addUserLock(uid, "1", now);
 		return 1;
 	}
 
@@ -326,6 +330,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 			user.setAccomplishSituation(bo.getAccomplishSituation());
 			user.setIntellectualProperty(bo.getIntellectualProperty());
 			user.setCreditRating(bo.getCreditRating());
+			user.setIntegrity(countIntegrity(bo));
 		} catch (IllegalAccessException |InvocationTargetException e) {
 			e.printStackTrace();
 		} 
@@ -334,6 +339,27 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		return 1;
 	}
 
+	private Float countIntegrity(CustomerOrganizationDetailBo bo) {
+		//完整资料总数
+		int max=13;
+		int number=0;
+		if(bo.getIndustry()!=null)number+=1;
+		if(bo.getLocationProvince()!=null)number+=1;
+		if(StringUtils.isNotBlank(bo.getBusinessScope()))number+=1;
+		if(bo.getRegisteredCapital()!=null)number+=1;
+		if(bo.getLocationProvince()!=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(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;
+	}
+
 	@Override
 	public int updatePersonalCustomer(CustomerPersonalDetailBo bo) {
 		UserIdentity ui = new UserIdentity();