소스 검색

合并冲突

Michael 8 년 전
부모
커밋
a415ad7011

+ 0 - 1
src/main/java/com/goafanti/business/bo/BusinessBo.java

@@ -1,5 +1,4 @@
 package com.goafanti.business.bo;
-
 import java.util.Date;
 
 public class BusinessBo {

+ 16 - 2
src/main/java/com/goafanti/business/bo/BusinessProjectBo.java

@@ -1,6 +1,5 @@
 package com.goafanti.business.bo;
 
-
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -134,7 +133,10 @@ public class BusinessProjectBo {
 	 * 创建人名称
 	 */
 	private String createName;
-	
+	/**
+	 * 是否精品
+	 */
+	private Integer boutique;
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.max_logo
 	 * @return  the value of business_project.max_logo
@@ -596,5 +598,17 @@ public class BusinessProjectBo {
 				+ principalId + ", valueEffect=" + valueEffect + ", clientSize=" + clientSize + ", cname=" + cname
 				+ ", createName=" + createName + "]";
 	}
+
+
+
+	public Integer getBoutique() {
+		return boutique;
+	}
+
+
+
+	public void setBoutique(Integer boutique) {
+		this.boutique = boutique;
+	}
 	
 }

+ 0 - 1
src/main/java/com/goafanti/business/bo/BusinessVarietiesBo.java

@@ -1,6 +1,5 @@
 package com.goafanti.business.bo;
 
-
 import java.util.Date;
 
 import org.apache.commons.lang3.time.DateFormatUtils;

+ 0 - 1
src/main/java/com/goafanti/business/bo/ProjectSizeBo.java

@@ -1,6 +1,5 @@
 package com.goafanti.business.bo;
 
-
 import java.math.BigDecimal;
 import java.util.Date;
 

+ 23 - 20
src/main/java/com/goafanti/business/controller/AdminBusinessProjectController.java

@@ -1,6 +1,5 @@
 package com.goafanti.business.controller;
 
-
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
@@ -24,24 +23,28 @@ import com.goafanti.common.utils.StringUtils;
 public class AdminBusinessProjectController extends CertifyApiController{
 	
 	@Resource
-	BusinessProjectService businessProjectService;
+	BusinessProjectService businessprojectService;
 	
 	/**
 	 * 新增项目
 	 */
 	@RequestMapping(value = "/addProject" , method = RequestMethod.POST)
-	public Result addProject(String bname,String cid,String country,String province,String city,String district) {
+	public Result addProject(String bname,String cid,String country,String province,String city,String district,String boutique) {
 		Result res=new Result();
 		if (StringUtils.isBlank(bname)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "项目名称名称为空", "项目名称"));
 			return res;
 		}
+		if (StringUtils.isBlank(boutique)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "是否精品为空", "是否精品"));
+			return res;
+		}
 		
 		if (StringUtils.isBlank(cid)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "所属品类为空", "所属品类"));
 			return res;
 		}
-		if (businessProjectService.getBnamecount(bname)>0) {
+		if (businessprojectService.getBnamecount(bname)>0) {
 			res.getError().add(buildError(ErrorConstants.PARAM_BEING_ERROR, "项目名称已存在", "项目名称"));
 			return res;
 		}
@@ -51,7 +54,7 @@ public class AdminBusinessProjectController extends CertifyApiController{
 				return res;
 			}
 		}
-		res.setData(businessProjectService.insert(bname, cid, country,province,city,district));
+		res.setData(businessprojectService.insert(bname, cid, country,province,city,district,boutique));
 		return res; 
 	}
 	
@@ -68,7 +71,7 @@ public class AdminBusinessProjectController extends CertifyApiController{
 			}
 		}
 		
-		 res.setData(businessProjectService.listProject( bname, cid, country,province, city, district ,activityFlag, status, pageNo,pageSize ));
+		 res.setData(businessprojectService.listProject( bname, cid, country,province, city, district ,activityFlag, status, pageNo,pageSize ));
 		return res;
 	}
 	/**
@@ -94,7 +97,7 @@ public class AdminBusinessProjectController extends CertifyApiController{
 	@RequestMapping(value = "/orgProject", method = RequestMethod.GET)
 	public Result orgProject(String id){
 		Result res=new Result();
-		res.setData(businessProjectService.orgProjects(id));
+		res.setData(businessprojectService.orgProjects(id));
 		return res;
 	}
 	/**
@@ -103,7 +106,7 @@ public class AdminBusinessProjectController extends CertifyApiController{
 	@RequestMapping(value = "/deleteProject", method = RequestMethod.GET)
 	public Result deleteProject(String id){
 		Result res=new Result();
-		res.setData(businessProjectService.deleteProject(id));
+		res.setData(businessprojectService.deleteProject(id));
 		return res;
 	}
 	
@@ -113,7 +116,7 @@ public class AdminBusinessProjectController extends CertifyApiController{
 	@RequestMapping(value = "/stopProject", method = RequestMethod.GET)
 	public Result stopProject(String id){
 		Result res=new Result();
-		res.setData(businessProjectService.updateStopProject(id));
+		res.setData(businessprojectService.updateStopProject(id));
 		return res;
 	}
 	/**
@@ -122,7 +125,7 @@ public class AdminBusinessProjectController extends CertifyApiController{
 	@RequestMapping(value = "/getAllCname", method = RequestMethod.GET)
 	public Result getAllCname(Integer flag){
 		Result res=new Result();
-		res.setData(businessProjectService.getAllCnames(flag));
+		res.setData(businessprojectService.getAllCnames(flag));
 		return res;
 	}
 	
@@ -141,7 +144,7 @@ public class AdminBusinessProjectController extends CertifyApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "所属品类为空", "所属品类"));
 			return res;
 		}
-		if (businessProjectService.judgeBeing(s)) {
+		if (businessprojectService.judgeBeing(s)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_BEING_ERROR, "项目名称已存在", "项目名称"));
 			return res;
 		}
@@ -151,7 +154,7 @@ public class AdminBusinessProjectController extends CertifyApiController{
 				return res;
 			}
 		}
-		res.setData(businessProjectService.updateProject(s));
+		res.setData(businessprojectService.updateProject(s));
 		return res;
 	}
 	/**
@@ -160,16 +163,16 @@ public class AdminBusinessProjectController extends CertifyApiController{
 	@RequestMapping(value = "/addProjectSize", method = RequestMethod.POST)
 	public Result addProjectSize(ProjectSize ps){
 		Result res=new Result();
-		if (businessProjectService.WhetherRepeat(ps)) {
+		if (businessprojectService.WhetherRepeat(ps)) {
 				res.getError().add(buildError(ErrorConstants.PARAM_BEING_ERROR, "规格名称已存在", "规格名称"));
 				return res;
 			}
-		if (businessProjectService.judgeStatus(ps)) {
+		if (businessprojectService.judgeStatus(ps)) {
 			res.getError().add(buildError( "项目已停用", "项目已停用"));
 			return res;
 		}
 		
-		res.setData(businessProjectService.addProjectSize(ps));
+		res.setData(businessprojectService.addProjectSize(ps));
 		return res;
 	}
 	
@@ -179,7 +182,7 @@ public class AdminBusinessProjectController extends CertifyApiController{
 	@RequestMapping(value = "/orgProjectSize", method = RequestMethod.POST)
 	public Result orgProjectSize(ProjectSize ps){
 		Result res=new Result();
-		res.setData(businessProjectService.updateOrgProjectSize(ps));
+		res.setData(businessprojectService.updateOrgProjectSize(ps));
 		return res;
 	}
 	/**
@@ -192,7 +195,7 @@ public class AdminBusinessProjectController extends CertifyApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "项目名称名称为空", "项目"));
 			return res;
 		}
-		res.setData(businessProjectService.listProjectSize(pid,pNo, Psize));
+		res.setData(businessprojectService.listProjectSize(pid,pNo, Psize));
 		return res;
 	}
 	
@@ -202,7 +205,7 @@ public class AdminBusinessProjectController extends CertifyApiController{
 	@RequestMapping(value = "/getProjectSize", method = RequestMethod.GET)
 	public Result getProjectSize(String  id){
 		Result res=new Result();
-		res.setData(businessProjectService.getProjectSize(id));
+		res.setData(businessprojectService.getProjectSize(id));
 		return res;
 	}
 	/**
@@ -211,7 +214,7 @@ public class AdminBusinessProjectController extends CertifyApiController{
 	@RequestMapping(value = "/deleteProjectSize", method = RequestMethod.GET)
 	public Result deleteProjectSize(String  id){
 		Result res=new Result();
-		res.setData(businessProjectService.deleteProjectSize(id));
+		res.setData(businessprojectService.deleteProjectSize(id));
 		return res;
 	}
 	/**
@@ -220,7 +223,7 @@ public class AdminBusinessProjectController extends CertifyApiController{
 	@RequestMapping(value = "/stopProjectSize", method = RequestMethod.GET)
 	public Result stopProjectSize(String  id){
 		Result res=new Result();
-		res.setData(businessProjectService.updateSotpProjectSize(id));
+		res.setData(businessprojectService.updateSotpProjectSize(id));
 		return res;
 	}
 }

+ 17 - 4
src/main/java/com/goafanti/business/controller/AdminVarietiesApiController.java

@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.goafanti.business.service.BusinessProjectService;
 import com.goafanti.business.service.BusinessVarietiesService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
@@ -15,10 +16,12 @@ import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.enums.AttachmentType;
 import com.goafanti.common.utils.StringUtils;
 @RestController
-@RequestMapping("api/admin/Varieties")
+@RequestMapping("/api/admin/Varieties")
 public class AdminVarietiesApiController extends CertifyApiController{
 	@Resource
 	private BusinessVarietiesService businessVarietiesService;
+	@Resource
+	BusinessProjectService businessprojectService;
 	
 	/**
 	 * 新增品类
@@ -42,9 +45,11 @@ public class AdminVarietiesApiController extends CertifyApiController{
 			res.getError().add(buildError( "品类层级不能大于3", "品类层级不能大于3")); 
 			return res;
 		}
-		
+		if (businessVarietiesService.getCountSon(superId)>99) {
+			res.getError().add(buildError( "品类下级最多存在99个", "品类下级最多存在99个")); 
+			return res;
+		}
 		res.setData(businessVarietiesService.insert(cname,superId));
-		
 		return res;
 		
 	}
@@ -101,6 +106,10 @@ public class AdminVarietiesApiController extends CertifyApiController{
 			res.getError().add(buildError( "品类层级不能超过三级", "品类层级不能超过三级"));
 			return res;
 		}
+		if (businessVarietiesService.getCountSon(superId)>99) {
+			res.getError().add(buildError( "品类下级最多存在99个", "品类下级最多存在99个")); 
+			return res;
+		}
 		res.setData(businessVarietiesService.updateVarietoes(id, cname, superId, status, varietiesLogo));
 		return res; 
 	}
@@ -111,7 +120,11 @@ public class AdminVarietiesApiController extends CertifyApiController{
 	public Result deleteState(String id){
 		Result res=new Result();
 		if (businessVarietiesService.getCountSon(id)>0) {
-			res.getError().add(buildError("品类下存在子品类", "品类存在子品类"));
+			res.getError().add(buildError("品类下存在子品类", "品类存在子品类不允许删除"));
+			return res;
+		}
+		if (businessprojectService.checkProject(id)) {
+			res.getError().add(buildError("品类下存在项目", "品类存在项目不允许删除"));
 			return res;
 		}
 		res.setData(businessVarietiesService.deleteState(id));

+ 2 - 5
src/main/java/com/goafanti/business/service/BusinessProjectService.java

@@ -1,7 +1,6 @@
 package com.goafanti.business.service;
 
 
-
 import java.util.List;
 import java.util.Map;
 
@@ -9,12 +8,11 @@ import com.goafanti.app.bo.ProjectBo;
 import com.goafanti.business.bo.BusinessProjectBo;
 import com.goafanti.business.bo.ProjectSizeBo;
 import com.goafanti.common.model.BusinessProject;
-import com.goafanti.common.model.BusinessVarieties;
 import com.goafanti.common.model.ProjectSize;
 import com.goafanti.core.mybatis.page.Pagination;
 
 public interface BusinessProjectService {
-	int insert(String bname,String cid,String country,String province,String city,String district);
+	int insert(String bname,String cid,String country,String province,String city,String district,String boutique);
 	
 	Pagination<BusinessProjectBo> listProject(String bname,String cid,String country,String province,String city,String district,String activityFlag,
 										String status,Integer pageNo, Integer pageSize );
@@ -24,14 +22,12 @@ public interface BusinessProjectService {
 	
 	int updateStopProject(String id);
 	
-	
 	List<Object> orgProject(String id);
 	
 	BusinessProjectBo orgProjects(String id);
 	
 	List<Map<String, String>> getAllCnames(Integer flag);
 	
-	
 	int updateProject(BusinessProject s);
 	
 	int addProjectSize(ProjectSize ps);
@@ -56,5 +52,6 @@ public interface BusinessProjectService {
 
 	Pagination<ProjectBo> recommendProjectList(Integer pNo, Integer pSize);
 
+	boolean checkProject(String id);
 	
 }

+ 1 - 2
src/main/java/com/goafanti/business/service/BusinessVarietiesService.java

@@ -32,6 +32,5 @@ public interface BusinessVarietiesService {
 	boolean ifLayer(String superId,String id);
 
 	List<VarietiesBo> getVarieties();
-
-	
 }
+

+ 11 - 4
src/main/java/com/goafanti/business/service/impl/BusinessProjectServiceImpl.java

@@ -1,6 +1,5 @@
 package com.goafanti.business.service.impl;
 
-
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -41,7 +40,7 @@ public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMa
 	ProjectInterestMapper projectInterestMapper;
 	
 	@Override
-	public int insert(String bname, String cid, String country, String province, String city, String district) {
+	public int insert(String bname, String cid, String country, String province, String city, String district,String boutique) {
 		BusinessProject bp=new BusinessProject();
 		bp.setId(UUID.randomUUID().toString());
 		bp.setBname(bname);
@@ -59,7 +58,7 @@ public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMa
 		}
 		bp.setCreateTime(new Date());
 		bp.setStatus("0");
-
+		bp.setBoutique(Integer.valueOf(boutique));
 		return businessProjectMapper.insert(bp);
 	}
 	@SuppressWarnings("unchecked")
@@ -253,6 +252,7 @@ public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMa
 		bp.setClientSize(s.getClientSize());
 		bp.setMinLogo(s.getMinLogo());
 		bp.setMaxLogo(s.getMaxLogo());
+		bp.setBoutique(s.getBoutique());
 		if (null!=(s.getStatus())) {
 			bp.setStatus(s.getStatus());
 		}
@@ -410,6 +410,13 @@ public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMa
 		}
 		return p;
 	}
-	
+	@Override
+	public boolean checkProject(String id) {
+		if (businessProjectMapper.checkProject(id)>0) {
+			return true;
+		}
+		return false;
+	}
 	
 }
+

+ 30 - 26
src/main/java/com/goafanti/business/service/impl/BusinessVarietiesServiceImpl.java

@@ -33,14 +33,20 @@ public class BusinessVarietiesServiceImpl extends BaseMybatisDao<BusinessVarieti
 		buv.setCname(cname);
 		buv.setSuperId(superId);
 		buv.setDeleteSign(0);
-		String str=businessVarietiesMapper.getCid(superId);
-		int i=Integer.valueOf(businessVarietiesMapper.getCount(superId));
-		int w=i+1;
-			if(w<10){
-				buv.setCid(str+"0"+w);
-			}else {
-				buv.setCid(str+w);
-			
+		String str=businessVarietiesMapper.getCidMax(superId);
+		String scid=businessVarietiesMapper.getCid(superId);
+		if (null==str) {
+			buv.setCid(scid+"01");	
+		}else {
+			int i=Integer.valueOf(str.substring(str.length()-2, str.length()));
+			 i=(i%99)+1;
+				String s;
+				if (i<10) {
+					s=str.substring(0,str.length()-2)+"0"+i;
+				}else {
+					s=str.substring(0,str.length()-2)+i;
+				}
+				buv.setCid(s);
 		}
 		
 		//判断是否数据库这个ID已经存在
@@ -123,23 +129,21 @@ public class BusinessVarietiesServiceImpl extends BaseMybatisDao<BusinessVarieti
 		BusinessVarieties bs=new BusinessVarieties();
 		bs=businessVarietiesMapper.selectByPrimaryKey(id);
 		bs.setCname(cname);
-		String str=businessVarietiesMapper.getCid(superId);
-		int i=Integer.valueOf(businessVarietiesMapper.getCount(superId));
-			if (3>=str.length()) {
-				if(Integer.valueOf(i)<9){
-					
-					bs.setCid("BZ0"+i);
-				}else {
-					bs.setCid("BZ"+i);
-				}
-			}else {
-				int w=i+1;
-				if(Integer.valueOf(i)<9){
-					bs.setCid(str+"0"+w);
+		String str=businessVarietiesMapper.getCidMax(superId);
+		String scid=businessVarietiesMapper.getCid(superId);
+		if (null==str) {
+			bs.setCid(scid+"01");	
+		}else {
+			int i=Integer.valueOf(str.substring(str.length()-2, str.length()));
+			 i=(i%99)+1;
+				String s;
+				if (i<10) {
+					s=str.substring(0,str.length()-2)+"0"+i;
 				}else {
-					bs.setCid(str+w);
+					s=str.substring(0,str.length()-2)+i;
 				}
-			}
+				bs.setCid(s);
+		}
 			//判断是否数据库这个ID已经存在
 			checkCid(bs);
 		//将子品类名称编号做修改
@@ -151,6 +155,7 @@ public class BusinessVarietiesServiceImpl extends BaseMybatisDao<BusinessVarieti
 			BusinessVarieties bvs=businessVarietiesMapper.selectByPrimaryKey(n);
 			String s2=bvs.getCid().substring(w.length()-2, w.length());
 			bvs.setCid(c1+s2);
+			bvs.setLayer(bvs.getCid().length()/2-1);
 			checkCid(bvs);
 			businessVarietiesMapper.updateByPrimaryKey(bvs);
 		}
@@ -158,7 +163,6 @@ public class BusinessVarietiesServiceImpl extends BaseMybatisDao<BusinessVarieti
 		bs.setLayer(bs.getCid().length()/2-1);
 		bs.setUpdateTime(new Date());
 		bs.setStatus(status);
-		System.out.println("---------------------------"+varietiesLogo);
 		bs.setVarietiesLogo(varietiesLogo);
 		return businessVarietiesMapper.updateByPrimaryKey(bs);
 	}
@@ -237,6 +241,6 @@ public class BusinessVarietiesServiceImpl extends BaseMybatisDao<BusinessVarieti
 		return businessVarietiesMapper.getVarieties();
 	}
 	
-	
-	
 }
+
+

+ 3 - 8
src/test/java/com/goafanti/test/TestValueEvaluation.java

@@ -1,9 +1,5 @@
 package com.goafanti.test;
 
-import java.text.DateFormat;
-import java.util.HashMap;
-import java.util.Map;
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -13,8 +9,7 @@ import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.transaction.annotation.Transactional;
 
-import com.goafanti.admin.service.AdminVarietiesService;
-
+import com.goafanti.business.service.BusinessVarietiesService;
 import com.goafanti.common.model.ValueEvaluation;
 import com.goafanti.evaluation.service.ValueEvaluationService;
 
@@ -26,7 +21,7 @@ public class TestValueEvaluation extends AbstractJUnit4SpringContextTests {
 	ValueEvaluationService valueEvaluationService;
 	
 	@Autowired
-	AdminVarietiesService adminVarietiesService;
+	BusinessVarietiesService businessVarietiesService;
 
 	@Test
 	public void testValueInsert() {
@@ -39,7 +34,7 @@ public class TestValueEvaluation extends AbstractJUnit4SpringContextTests {
 	}
 	@Test
 	public void testInset() {
-		adminVarietiesService.insert("测试","00");
+		businessVarietiesService.insert("测试","00");
 	}
 	
 }