Browse Source

service层方法重命名

zou_ht 8 years ago
parent
commit
13beb9a2b0

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

@@ -72,7 +72,7 @@ public interface CustomerOrganizationInfoMapper {
 	/**
 	 * 修改
 	 */
-	int updateCustomerOrganizationByPrimaryKey(String cid);
+	int updateCustomerOrganizationByCid(CustomerOrganizationInfo coi);
 	/**
 	 * 新增
 	 */

+ 18 - 0
src/main/java/com/goafanti/common/mapper/CustomerOrganizationInfoMapper.xml

@@ -330,4 +330,22 @@
       company_industry = #{companyIndustry,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
+  <update id="updateCustomerOrganizationByCid">
+  	 update customer_organization_info
+  	 <set>     
+      <if test="companyName != null">
+        company_name = #{companyName,jdbcType=VARCHAR},
+      </if>
+      <if test="locationProvince != null">
+        location_province = #{locationProvince,jdbcType=CHAR},
+      </if>
+      <if test="adress != null">
+        adress = #{adress,jdbcType=VARCHAR},
+      </if>
+      <if test="companyIndustry != null">
+        company_industry = #{companyIndustry,jdbcType=VARCHAR},
+      </if>
+    </set>    
+    where cid = #{cid,jdbcType=VARCHAR}
+  </update>
 </mapper>

+ 5 - 5
src/main/java/com/goafanti/customer/bo/CustomerIn.java

@@ -47,7 +47,7 @@ public class CustomerIn {
 	/** 跟单人 **/
 	private String adminName;
 	/** 跟单人 **/
-	private String beforeadminName;
+	private String beforeAdminName;
 	
 	/** 跟单人ID **/
 	private String aid;
@@ -202,12 +202,12 @@ public class CustomerIn {
 		this.tag = tag;
 	}
 
-	public String getBeforeadminName() {
-		return beforeadminName;
+	public String getBeforeAdminName() {
+		return beforeAdminName;
 	}
 
-	public void setBeforeadminName(String beforeadminName) {
-		this.beforeadminName = beforeadminName;
+	public void setBeforeAdminName(String beforeadminName) {
+		this.beforeAdminName = beforeadminName;
 	}
 	
 	

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

@@ -201,10 +201,11 @@ public class AdminCustomerApiController extends BaseController {
 		BeanUtils.copyProperties(c, cusIn);
 		c.setShareType(Integer.parseInt(cusIn.getShareTyp()));
 		c.setCustomerType(Integer.parseInt(cusIn.getCustomerTyp()));
+		coi.setCid(cusIn.getId());
 		//更新主表
-		customerService.setCustomer(c);
+		customerService.updateCustomer(c);
 		//更新公司表
-		customerOrganizationService.updCustomerOrganizationInfo(coi);
+		customerOrganizationService.updateCustomerOrganizationInfo(coi);
 		//插入日志表
 		customerService.saveCustomerLogo(cusIn, AFTConstants.CUSTOMER_MODIFY,cusIn.getId());
 	    return res;
@@ -222,7 +223,7 @@ public class AdminCustomerApiController extends BaseController {
 		Customer c =new Customer();
 		BeanUtils.copyProperties(c, cusIn);
 		//更新主表
-		customerService.setCustomer(c);
+		customerService.updateCustomer(c);
 		//插入日志表
 		customerService.saveCustomerLogo(cusIn, AFTConstants.CUSTOMER_TRANSFER,cusIn.getId());
 	    return res;

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

@@ -15,5 +15,5 @@ public interface CustomerOrganizationService {
 	 * @param coi
 	 * @return
 	 */
-	int updCustomerOrganizationInfo(CustomerOrganizationInfo coi);
+	int updateCustomerOrganizationInfo(CustomerOrganizationInfo coi);
 }

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

@@ -63,7 +63,7 @@ public interface CustomerService {
 	 * @param 修改客户信息
 	 * @param id
 	 */
-	public int setCustomer(Customer c);
+	public int updateCustomer(Customer c);
 	
 	
 	

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

@@ -23,8 +23,8 @@ public class CustomerOrganizationServiceImp extends BaseMybatisDao<CustomerOrgan
 	 * @return
 	 */
 	@Override
-	public int updCustomerOrganizationInfo(CustomerOrganizationInfo coi) {
-		return customerOrganizationInfoMapper.updateByPrimaryKeySelective(coi);
+	public int updateCustomerOrganizationInfo(CustomerOrganizationInfo coi) {
+		return customerOrganizationInfoMapper.updateCustomerOrganizationByCid(coi);
 	}
 
 

+ 4 - 7
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -182,7 +182,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 			log.setAfterAdminName(adminMapper.selectByPrimaryKey(TokenManager.getUserId()).getName());
 			log.setOperatorType(AFTConstants.CUSTOMER_CREATE);
 		}else if(operatorType.equals(AFTConstants.CUSTOMER_MODIFY)){ //修改用户
-			log.setBeforeAdminName(cus.getAdminName());//修改前操作人
+			log.setBeforeAdminName(cus.getBeforeAdminName());//修改前操作人
 			log.setBeforeCustomerIntention(getCompanyIntention(cus.getBeforeCompanyIntention())); //修改前跟进意向
 			log.setBeforeCustomerStatus(CustomerStatusFiled.getField(Integer.parseInt(cus.getBeforeCustomerStatus())).getDesc()); //修改前跟进状态
 			log.setBeforeFollowSituation(CustomerFollowFiled.getField(Integer.parseInt(cus.getBeforeFollowSituation())).getDesc());//修改前跟进进度
@@ -198,14 +198,11 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 			log.setBeforeFollowSituation(CustomerFollowFiled.getField(Integer.parseInt(cus.getBeforeFollowSituation())).getDesc());//跟进进度
 			log.setOperatorType(AFTConstants.CUSTOMER_DELETE);
 		}else if(operatorType.equals(AFTConstants.CUSTOMER_TRANSFER)){ //转交客户
-			log.setBeforeAdminName(cus.getBeforeadminName());//转交前的人
+			log.setBeforeAdminName(cus.getBeforeAdminName());//转交前的人
 			log.setAfterAdminName(cus.getAdminName());//转交后的人
 			log.setBeforeCustomerIntention(getCompanyIntention(cus.getBeforeCompanyIntention())); //修改前跟进意向
 			log.setBeforeCustomerStatus(CustomerStatusFiled.getField(Integer.parseInt(cus.getBeforeCustomerStatus())).getDesc()); //修改前跟进状态
 			log.setBeforeFollowSituation(CustomerFollowFiled.getField(Integer.parseInt(cus.getBeforeFollowSituation())).getDesc());//修改前跟进进度
-			log.setAfterCustomerIntention(getCompanyIntention(cus.getBeforeCompanyIntention())); //修改前跟进意向
-			log.setAfterCustomerStatus(CustomerStatusFiled.getField(Integer.parseInt(cus.getBeforeCustomerStatus())).getDesc()); //修改前跟进状态
-			log.setAfterFollowSituation(CustomerFollowFiled.getField(Integer.parseInt(cus.getBeforeFollowSituation())).getDesc());//修改前跟进进度
 			log.setOperatorType(AFTConstants.CUSTOMER_TRANSFER);
 		}
 		CustomerLogMapper.insert(log);
@@ -229,8 +226,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 	 * @return
 	 */
 	@Override
-	public int setCustomer(Customer c) {
-		 return customerMapper.updCustomerByPrimaryKey(c);
+	public int updateCustomer(Customer c) {
+		 return customerMapper.updateByPrimaryKeySelective(c);
 	}
 	
 	

+ 1 - 1
src/main/resources/spring/spring-mybatis.xml

@@ -83,7 +83,7 @@
 			<tx:method name="del*" rollback-for="Exception" />
 			<tx:method name="init*" rollback-for="Exception" />
 			<tx:method name="bind*" rollback-for="Exception" />
-			<!-- <tx:method name="*"  read-only="true" /> -->
+			<tx:method name="*"  read-only="true" />
 		</tx:attributes>
 	</tx:advice>