Browse Source

Merge branch 'test' of git@git.coding.net:aft/AFT.git into test

wanghui 8 years ago
parent
commit
82a4685254

+ 5 - 1
src/main/java/com/goafanti/admin/controller/BusinessProjectController.java

@@ -145,7 +145,7 @@ public class BusinessProjectController extends CertifyApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "所属品类为空", "所属品类"));
 			return res;
 		}
-		if (businessprojectService.getBnamecount(s.getBname())>1) {
+		if (businessprojectService.judgeBeing(s)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_BEING_ERROR, "项目名称已存在", "项目名称"));
 			return res;
 		}
@@ -168,6 +168,10 @@ public class BusinessProjectController extends CertifyApiController{
 				res.getError().add(buildError(ErrorConstants.PARAM_BEING_ERROR, "规格名称已存在", "规格名称"));
 				return res;
 			}
+		if (businessprojectService.judgeStatus(ps)) {
+			res.getError().add(buildError( "项目已停用", "项目已停用"));
+			return res;
+		}
 		
 		res.setData(businessprojectService.addProjectSize(ps));
 		return res;

+ 3 - 0
src/main/java/com/goafanti/admin/service/BusinessProjectService.java

@@ -44,4 +44,7 @@ public interface BusinessProjectService {
 
 	boolean WhetherRepeat(ProjectSize ps);
 	
+	boolean judgeStatus(ProjectSize ps);
+	
+	boolean judgeBeing(BusinessProject s);
 }

+ 4 - 11
src/main/java/com/goafanti/admin/service/impl/AdminVarietiesServiceImpl.java

@@ -34,25 +34,18 @@ public class AdminVarietiesServiceImpl extends BaseMybatisDao<BusinessVarietiesM
 		buv.setDeleteSign(0);
 		String str=businessVarietiesMapper.getCid(superId);
 		int i=Integer.valueOf(businessVarietiesMapper.getCount(superId));
-		if (3>=str.length()) {
-			 if(Integer.valueOf(i)<10){
-				buv.setCid("BZ0"+i);
-			}else {
-				buv.setCid("BZ"+i);
-			}
-		}else {
-			int w=i+1;
-			if(Integer.valueOf(i)<10){
+		int w=i+1;
+			if(w<10){
 				buv.setCid(str+"0"+w);
 			}else {
 				buv.setCid(str+w);
-			}
+			
 		}
 		
 		//判断是否数据库这个ID已经存在
 		String n=businessVarietiesMapper.ThanCid(buv.getCid());
 		while(StringUtils.isNotBlank(n)) {
-			String s1=buv.getCid().substring(0, buv.getCid().length()-3);
+			String s1=buv.getCid().substring(0, buv.getCid().length()-2);
 			String s2=buv.getCid().substring(buv.getCid().length()-2, buv.getCid().length());
 			int i1=Integer.valueOf(s2)+1;
 			if(i1<10){

+ 34 - 12
src/main/java/com/goafanti/admin/service/impl/BusinessProjectServiceImpl.java

@@ -52,7 +52,7 @@ public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMa
 		if (StringUtils.isNotBlank(TokenManager.getAdminId())) {
 			bp.setCreateId(TokenManager.getAdminId());
 		}
-		//bp.setCreateId("f31c0d1a-05bc-4f5c-b4a8-95f983d24131");
+		bp.setCreateId("f31c0d1a-05bc-4f5c-b4a8-95f983d24131");
 		bp.setCreateTime(new Date());
 		bp.setStatus("0");
 
@@ -245,12 +245,10 @@ public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMa
 		if (StringUtils.isNotBlank(s.getClientSize())) {
 			bp.setClientSize(s.getClientSize());
 		}
-		if (StringUtils.isNotBlank(s.getMinLogo())) {
-			bp.setMinLogo(s.getMinLogo());
-		}
-		if (StringUtils.isNotBlank(s.getMaxLogo())) {
-			bp.setMaxLogo(s.getMaxLogo());
-		}
+		
+		bp.setMinLogo(s.getMinLogo());
+		bp.setMaxLogo(s.getMaxLogo());
+		
 		if (null!=(s.getStatus())) {
 			bp.setStatus(s.getStatus());
 		}
@@ -259,8 +257,10 @@ public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMa
 	@Override
 	public int addProjectSize(ProjectSize ps) {
 		ps.setId(UUID.randomUUID().toString());
-		//bp.setCreateId(TokenManager.getAdminId());
-		ps.setCreateId("f31c0d1a-05bc-4f5c-b4a8-95f983d24131");
+		if (StringUtils.isNotBlank(TokenManager.getAdminId())) {
+		ps.setCreateId(TokenManager.getAdminId());
+		}
+		//ps.setCreateId("f31c0d1a-05bc-4f5c-b4a8-95f983d24131");
 		ps.setCreateTime(new Date());
 		ps.setStatus(0);
 		return projectSizeMapper.insert(ps);
@@ -340,14 +340,36 @@ public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMa
 	@Override
 	public boolean WhetherRepeat(ProjectSize ps) {
 		List<ProjectSizeBo> list=projectSizeMapper.getgetPnamecount(ps.getPname());
-		if (null!=list&&list.isEmpty()) {
-		if (list.size()>1&&list.get(0).getPid().equals(ps.getPid())) {
+		
+		if (list.size()>0&&!(list.get(0).getPid().equals(ps.getPid()))) {
 			System.out.println("true");
 			return true;
+		
 		}
-		}
+		
 		return false;
 	}
+	@Override
+	public boolean judgeStatus(ProjectSize ps) {
+		 BusinessProject bp=businessProjectMapper.selectByPrimaryKey(ps.getPid());
+		if (Integer.valueOf(bp.getStatus())==1) {
+			return true;
+		}else {
+			return false;
+		}
+		
+	}
+	@Override
+	public boolean judgeBeing(BusinessProject s) {
+		BusinessProject bp=businessProjectMapper.selectByPrimaryKey(s.getId());
+		BusinessProject bp1=businessProjectMapper.selectByPrimaryBname(s.getBname());
+		if (bp.getId().equals(bp1.getId())) {
+			return false;
+		}else {
+			return true;
+		}
+		
+	}
 	
 	
 }

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

@@ -77,4 +77,6 @@ public interface BusinessProjectMapper {
 	int getBnamecount(String bname);
 	
 	String getCreateName(String id);
+	
+	BusinessProject selectByPrimaryBname(String bname);
 }

+ 8 - 0
src/main/java/com/goafanti/common/mapper/BusinessProjectMapper.xml

@@ -673,4 +673,12 @@
     where p.pid = #{pid,jdbcType=VARCHAR}
   </select>
   
+  <select id="selectByPrimaryBname" parameterType="java.lang.String" resultMap="BaseResultMap">
+    
+    select 
+    <include refid="Base_Column_List" />
+    from business_project
+    where bname = #{bname,jdbcType=VARCHAR}
+  </select>
+  
 </mapper>

+ 2 - 1
src/main/java/com/goafanti/common/mapper/BusinessVarietiesMapper.xml

@@ -367,7 +367,8 @@
   
   <select id="getCount" resultType="string">
   	select count(1) from business_varieties
-  	where super_id=#{superId,jdbcType=VARCHAR} 
+  	where delete_sign=0
+  	and super_id=#{superId,jdbcType=VARCHAR} 
   	</select>
   	
   	<select id="getCid" resultType="string">

+ 2 - 1
src/main/java/com/goafanti/common/model/BusinessProject.java

@@ -335,7 +335,8 @@ public class BusinessProject {
 	 * @param activityPrice  the value for business_project.activity_price
 	 * @mbg.generated  Tue Dec 12 11:46:55 CST 2017
 	 */
-	public void setActivityPrice(BigDecimal activityPrice) {
+	public void setActivityPrice(BigDecimal
+			activityPrice) {
 		this.activityPrice = activityPrice;
 	}