Browse Source

项目管理

anderx 8 years ago
parent
commit
584b3af49e

+ 503 - 0
src/main/java/com/goafanti/admin/bo/BusinessProjectBo.java

@@ -0,0 +1,503 @@
+package com.goafanti.admin.bo;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class BusinessProjectBo {
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.id
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String id;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.create_id
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String createId;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.create_time
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private Date createTime;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.update_time
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private Date updateTime;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.delete_sign
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private Integer deleteSign;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.bname
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String bname;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.cid
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String cid;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.price
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private BigDecimal price;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.offset
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private BigDecimal offset;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.activity_price
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private BigDecimal activityPrice;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.activity_flag
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String activityFlag;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.member_price
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private BigDecimal memberPrice;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.introduce
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String introduce;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.status
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String status;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.country
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String country;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.province
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String province;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.city
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String city;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.district
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String district;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.principal_id
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String principalId;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.Value_effect
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String valueEffect;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column business_project.client_size
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	private String clientSize;
+	
+	/**
+	 * 分类名称
+	 */
+	private String cname;
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.id
+	 * @return  the value of business_project.id
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getId() {
+		return id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.id
+	 * @param id  the value for business_project.id
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.create_id
+	 * @return  the value of business_project.create_id
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getCreateId() {
+		return createId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.create_id
+	 * @param createId  the value for business_project.create_id
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setCreateId(String createId) {
+		this.createId = createId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.create_time
+	 * @return  the value of business_project.create_time
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.create_time
+	 * @param createTime  the value for business_project.create_time
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.update_time
+	 * @return  the value of business_project.update_time
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.update_time
+	 * @param updateTime  the value for business_project.update_time
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.delete_sign
+	 * @return  the value of business_project.delete_sign
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public Integer getDeleteSign() {
+		return deleteSign;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.delete_sign
+	 * @param deleteSign  the value for business_project.delete_sign
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setDeleteSign(Integer deleteSign) {
+		this.deleteSign = deleteSign;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.bname
+	 * @return  the value of business_project.bname
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getBname() {
+		return bname;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.bname
+	 * @param bname  the value for business_project.bname
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setBname(String bname) {
+		this.bname = bname;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.cid
+	 * @return  the value of business_project.cid
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getCid() {
+		return cid;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.cid
+	 * @param cid  the value for business_project.cid
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setCid(String cid) {
+		this.cid = cid;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.price
+	 * @return  the value of business_project.price
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public BigDecimal getPrice() {
+		return price;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.price
+	 * @param price  the value for business_project.price
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setPrice(BigDecimal price) {
+		this.price = price;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.offset
+	 * @return  the value of business_project.offset
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public BigDecimal getOffset() {
+		return offset;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.offset
+	 * @param offset  the value for business_project.offset
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setOffset(BigDecimal offset) {
+		this.offset = offset;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.activity_price
+	 * @return  the value of business_project.activity_price
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public BigDecimal getActivityPrice() {
+		return activityPrice;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.activity_price
+	 * @param activityPrice  the value for business_project.activity_price
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setActivityPrice(BigDecimal activityPrice) {
+		this.activityPrice = activityPrice;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.activity_flag
+	 * @return  the value of business_project.activity_flag
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getActivityFlag() {
+		return activityFlag;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.activity_flag
+	 * @param activityFlag  the value for business_project.activity_flag
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setActivityFlag(String activityFlag) {
+		this.activityFlag = activityFlag;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.member_price
+	 * @return  the value of business_project.member_price
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public BigDecimal getMemberPrice() {
+		return memberPrice;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.member_price
+	 * @param memberPrice  the value for business_project.member_price
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setMemberPrice(BigDecimal memberPrice) {
+		this.memberPrice = memberPrice;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.introduce
+	 * @return  the value of business_project.introduce
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getIntroduce() {
+		return introduce;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.introduce
+	 * @param introduce  the value for business_project.introduce
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setIntroduce(String introduce) {
+		this.introduce = introduce;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.status
+	 * @return  the value of business_project.status
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getStatus() {
+		return status;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.status
+	 * @param status  the value for business_project.status
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.country
+	 * @return  the value of business_project.country
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getCountry() {
+		return country;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.country
+	 * @param country  the value for business_project.country
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setCountry(String country) {
+		this.country = country;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.province
+	 * @return  the value of business_project.province
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getProvince() {
+		return province;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.province
+	 * @param province  the value for business_project.province
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setProvince(String province) {
+		this.province = province;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.city
+	 * @return  the value of business_project.city
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getCity() {
+		return city;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.city
+	 * @param city  the value for business_project.city
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setCity(String city) {
+		this.city = city;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.district
+	 * @return  the value of business_project.district
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getDistrict() {
+		return district;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.district
+	 * @param district  the value for business_project.district
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setDistrict(String district) {
+		this.district = district;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.principal_id
+	 * @return  the value of business_project.principal_id
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getPrincipalId() {
+		return principalId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.principal_id
+	 * @param principalId  the value for business_project.principal_id
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setPrincipalId(String principalId) {
+		this.principalId = principalId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.Value_effect
+	 * @return  the value of business_project.Value_effect
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getValueEffect() {
+		return valueEffect;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.Value_effect
+	 * @param valueEffect  the value for business_project.Value_effect
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setValueEffect(String valueEffect) {
+		this.valueEffect = valueEffect;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.client_size
+	 * @return  the value of business_project.client_size
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public String getClientSize() {
+		return clientSize;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column business_project.client_size
+	 * @param clientSize  the value for business_project.client_size
+	 * @mbg.generated  Mon Dec 04 15:29:25 CST 2017
+	 */
+	public void setClientSize(String clientSize) {
+		this.clientSize = clientSize;
+	}
+
+	public String getCname() {
+		return cname;
+	}
+
+	public void setCname(String cname) {
+		this.cname = cname;
+	}
+}

+ 4 - 0
src/main/java/com/goafanti/admin/controller/AdminVarietiesApiController.java

@@ -40,6 +40,10 @@ public class AdminVarietiesApiController extends BaseController{
 			res.getError().add(buildError(ErrorConstants.PARAM_BEING_ERROR, "品类名称已存在", "品类名称"));
 			return res;
 		}
+		if (2<adminVarietiesService.getLayer(superId)) {
+			res.getError().add(buildError( "品类层级不能大于3", "品类层级不能大于3")); 
+			return res;
+		}
 		
 		res.setData(adminVarietiesService.insert(cname,superId));
 		

+ 68 - 17
src/main/java/com/goafanti/admin/controller/BusinessProjectController.java

@@ -25,18 +25,20 @@ public class BusinessProjectController extends CertifyApiController{
 	@Resource
 	BusinessProjectService businessprojectService;
 	
+	
+	
 	/**
 	 * 新增项目
 	 */
 	@RequestMapping(value = "/addProject" , method = RequestMethod.POST)
-	public Result addProject(String bname,String vid,String country,String province,String city,String district) {
+	public Result addProject(String bname,String cid,String country,String province,String city,String district) {
 		Result res=new Result();
 		if (StringUtils.isBlank(bname)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "项目名称名称为空", "项目名称"));
 			return res;
 		}
 		
-		if (StringUtils.isBlank(vid)) {
+		if (StringUtils.isBlank(cid)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "所属品类为空", "所属品类"));
 			return res;
 		}
@@ -44,7 +46,13 @@ public class BusinessProjectController extends CertifyApiController{
 			res.getError().add(buildError(ErrorConstants.PARAM_BEING_ERROR, "项目名称已存在", "项目名称"));
 			return res;
 		}
-		res.setData(businessprojectService.insert(bname, vid, country,province,city,district));
+		if(Integer.valueOf(country)==0){
+			if (StringUtils.isBlank(province)) {
+				res.getError().add(buildError( "至少指定省", "至少指定省"));
+				return res;
+			}
+		}
+		res.setData(businessprojectService.insert(bname, cid, country,province,city,district));
 		return res; 
 	}
 	
@@ -54,18 +62,9 @@ public class BusinessProjectController extends CertifyApiController{
 	@RequestMapping(value = "/listProject" , method = RequestMethod.POST)
 	public Result listProject(String bname,String cid,String country,String province,String city,String district,String activityFlag,String status,Integer pageNo, Integer pageSize ){
 		Result res=new Result();
-		if (StringUtils.isBlank(bname)) {
-			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 (country==AFTConstants.USER_TYPE_PERSONAL) {
 			if (StringUtils.isBlank(province)) {
-				res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "所属品类为空", "所属省份"));
+				res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "所属省份为空", "所属省份"));
 				return res;
 			}
 		}
@@ -93,17 +92,69 @@ public class BusinessProjectController extends CertifyApiController{
 	/**
 	 * 获取项目详情
 	 */
-	/*@RequestMapping(value = "/orgProject", method = RequestMethod.POST)
+	@RequestMapping(value = "/orgProject", method = RequestMethod.GET)
 	public Result orgProject(String id){
-		
-	}*/
+		Result res=new Result();
+		res.setData(businessprojectService.orgProject(id));
+		return res;
+	}
 	/**
 	 * 删除项目
 	 */
 	@RequestMapping(value = "/deleteProject", method = RequestMethod.GET)
-	public Result orgProject(String id){
+	public Result deleteProject(String id){
 		Result res=new Result();
 		res.setData(businessprojectService.deleteProject(id));
 		return res;
 	}
+	
+	/**
+	 * 停用项目
+	 */
+	@RequestMapping(value = "/stopProject", method = RequestMethod.GET)
+	public Result stopProject(String id){
+		Result res=new Result();
+		res.setData(businessprojectService.updateStopProject(id));
+		return res;
+	}
+	/**
+	 * 获取业务品类全路径
+	 */
+	@RequestMapping(value = "/getAllCname", method = RequestMethod.GET)
+	public Result getAllCname(){
+		Result res=new Result();
+		res.setData(businessprojectService.getAllCname());
+		return res;
+	}
+	/**
+	 * 最低折扣增加
+	 */
+	@RequestMapping(value = "/addOffset", method = RequestMethod.GET)
+	public Result addOffset(String id){
+		Result res=new Result();
+		res.setData(businessprojectService.updateAddOffset(id));
+		return res;
+	}
+	/**
+	 * 最低折扣减少
+	 */
+	@RequestMapping(value = "/subtractOffset", method = RequestMethod.GET)
+	public Result subtractOffset(String id){
+		Result res=new Result();
+		res.setData(businessprojectService.updateSubtractOffset(id));
+		return res;
+	}
+	/**
+	 * 编辑规格
+	 */
+	/*@RequestMapping(value = "/orgProjectSize", method = RequestMethod.GET)
+	public Result orgProjectSize(String id){
+		Result res=new Result();
+		res.setData(businessprojectService.orgProjectSize(id));
+		return res;
+	}*/
+	/**
+	 * 编辑规格
+	 */
+	
 }

+ 1 - 0
src/main/java/com/goafanti/admin/service/AdminVarietiesService.java

@@ -26,4 +26,5 @@ public interface AdminVarietiesService {
 	int isBeing(String cname);
 	
 	int getCountSon(String id);
+	int getLayer(String superId);
 }

+ 16 - 2
src/main/java/com/goafanti/admin/service/BusinessProjectService.java

@@ -2,15 +2,29 @@ package com.goafanti.admin.service;
 
 
 
+import java.util.List;
+import java.util.Map;
+
 import com.goafanti.admin.bo.BusinessProjectBo;
+import com.goafanti.admin.bo.ProjectSizeBo;
+import com.goafanti.common.model.ProjectSize;
 import com.goafanti.core.mybatis.page.Pagination;
 
 public interface BusinessProjectService {
-	int insert(String bname,String vid,String country,String province,String city,String district);
+	int insert(String bname,String cid,String country,String province,String city,String district);
 	
-	Pagination<BusinessProjectBo>listProject(String bname,String cid,String country,String province,String city,String district,String activityFlag,
+	Pagination<BusinessProjectBo> listProject(String bname,String cid,String country,String province,String city,String district,String activityFlag,
 										String status,Integer pageNo, Integer pageSize );
 	int getBnamecount(String bname);
 	
 	int deleteProject(String id);
+	
+	int updateStopProject(String id);
+	
+	BusinessProjectBo orgProject(String id);
+	List<Map<String, String>> getAllCname();
+	int updateAddOffset(String id);
+	int updateSubtractOffset(String id);
+	/*ProjectSizeBo orgProjectSize(String id);*/
+	
 }

+ 6 - 1
src/main/java/com/goafanti/admin/service/impl/AdminVarietiesServiceImpl.java

@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
 
 import com.goafanti.admin.bo.BusinessVarietiesBo;
 import com.goafanti.admin.service.AdminVarietiesService;
-import com.goafanti.common.dao.AdminVarietiesMapper;
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.dao.BusinessVarietiesMapper;
 import com.goafanti.common.model.BusinessVarieties;
 import com.goafanti.common.utils.StringUtils;
@@ -65,6 +65,7 @@ public class AdminVarietiesServiceImpl extends BaseMybatisDao<BusinessVarietiesM
 		}
 		System.out.println("cid:"+buv.getCid());
 		buv.setLayer(buv.getCid().length()/2-1);
+		
 		buv.setCreateId("f31c0d1a-05bc-4f5c-b4a8-95f983d24131");//测试
 		if (StringUtils.isNotBlank(TokenManager.getAdminId())) {
 			buv.setCreateId(TokenManager.getAdminId());
@@ -221,6 +222,10 @@ public class AdminVarietiesServiceImpl extends BaseMybatisDao<BusinessVarietiesM
 		
 		return Integer.valueOf(businessVarietiesMapper.getCount(id));
 	}
+	@Override
+	public int getLayer(String superId) {
+		return businessVarietiesMapper.getLayer(superId);
+	}
 	
 	
 }

+ 93 - 5
src/main/java/com/goafanti/admin/service/impl/BusinessProjectServiceImpl.java

@@ -1,21 +1,25 @@
 package com.goafanti.admin.service.impl;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
-
+import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.admin.bo.BusinessProjectBo;
+import com.goafanti.admin.bo.ProjectSizeBo;
 import com.goafanti.admin.service.BusinessProjectService;
 
 import com.goafanti.common.dao.BusinessProjectMapper;
 import com.goafanti.common.dao.BusinessVarietiesMapper;
 import com.goafanti.common.model.BusinessProject;
-
+import com.goafanti.common.model.BusinessVarieties;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -24,19 +28,22 @@ import com.goafanti.core.mybatis.page.Pagination;
 public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMapper> implements BusinessProjectService {
 	@Autowired
 	BusinessProjectMapper businessProjectMapper;
+	@Autowired
+	BusinessVarietiesMapper businessVarietiesMapper;
 	
 	@Override
-	public int insert(String bname, String vid, String country, String province, String city, String district) {
+	public int insert(String bname, String cid, String country, String province, String city, String district) {
 		BusinessProject bp=new BusinessProject();
 		bp.setId(UUID.randomUUID().toString());
 		bp.setBname(bname);
-		bp.setCid(vid);
+		bp.setCid(cid);
 		bp.setCountry(country);
 		if (1!=Integer.valueOf(country)) {
 			bp.setProvince(province);
 			bp.setCity(city);
 			bp.setDistrict(district);
 		}
+		bp.setDeleteSign(0);
 		//bp.setCreateId(TokenManager.getAdminId());
 		bp.setCreateId("f31c0d1a-05bc-4f5c-b4a8-95f983d24131");
 		bp.setCreateTime(new Date());
@@ -105,5 +112,86 @@ public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMa
 		
 		return businessProjectMapper.updateByPrimaryKey(bp);
 	}
-
+	@Override
+	public int updateStopProject(String id) {
+		BusinessProject bp=businessProjectMapper.selectByPrimaryKey(id);
+		if (Integer.valueOf(bp.getStatus())==0) {
+			bp.setStatus("1");
+		}else {
+			bp.setStatus("0");
+		}
+		
+		return businessProjectMapper.updateByPrimaryKey(bp);
+	}
+	@Override
+	public BusinessProjectBo orgProject(String id) {
+		BusinessProject bp=businessProjectMapper.selectByPrimaryKey(id);
+		BusinessProjectBo bpo=new BusinessProjectBo();
+		BeanUtils.copyProperties(bp,bpo);
+		String cname=getAllCname(bpo.getCid());
+		System.out.println(cname);
+		bpo.setCname(cname);
+		return bpo;
+	}
+	@Override
+	public List<Map<String, String>> getAllCname() {
+		List<Map<String, String>> list=new ArrayList<Map<String, String>>();
+		List<String> listcid=businessVarietiesMapper.getListId();
+		for (String s : listcid) {
+			Map<String, String> map=new HashMap<>(); 
+			String cname=getAllCname(s);
+			map.put("id", s);
+			map.put("cname", cname);
+			if (StringUtils.isNotBlank(cname)) {
+				list.add(map);
+			}
+		}
+		return list;
+	}
+	/**
+	 * 递归获取上级来获取全路径
+	 * @param s	ID
+	 * @return  路径
+	 */
+	private String getAllCname(String s) {
+		String cid=businessVarietiesMapper.getThisCid(s);
+		String cname=businessVarietiesMapper.getThisCname(cid);
+		BusinessVarieties bv=businessVarietiesMapper.selectByPrimaryKey(s);
+		String sid=bv.getSuperId();
+		if (cid.length()>4) {
+			String w=getAllCname(sid)+"-"+cname;
+			 return w;
+		}else{
+			return cid.length()>3?cname:"";
+		}
+	}
+	@Override
+	public int updateAddOffset(String id) {
+		BusinessProject bp=businessProjectMapper.selectByPrimaryKey(id);
+		if (null==bp.getOffset()) {
+			bp.setOffset(new BigDecimal(1));	
+		}
+		if (bp.getOffset().compareTo(new BigDecimal(1))==-1) {
+			bp.setOffset(bp.getOffset().add(new BigDecimal(0.01)));
+		}
+		
+		return businessProjectMapper.updateByPrimaryKey(bp);
+	}
+	
+	@Override
+	public int updateSubtractOffset(String id) {
+		BusinessProject bp=businessProjectMapper.selectByPrimaryKey(id);
+		if (null==bp.getOffset()) {
+			bp.setOffset(new BigDecimal(1));	
+		}
+		if (bp.getOffset().compareTo(new BigDecimal(0))==1) {
+			bp.setOffset(bp.getOffset().subtract(new BigDecimal(0.01)));
+		}
+		return businessProjectMapper.updateByPrimaryKey(bp);
+	}
+	
+	/*public ProjectSizeBo orgProjectSize(String id) {
+		
+		return null;
+	}*/
 }

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

@@ -75,4 +75,5 @@ public interface BusinessProjectMapper {
 	int updateByPrimaryKey(BusinessProject record);
 	
 	int getBnamecount(String bname);
+	
 }

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

@@ -105,6 +105,15 @@ public interface BusinessVarietiesMapper {
     
 	String ThanCid(String cid);
 	
-	int getcname(String cname);
+	int getcname(String cname);//获取有多少条
+	
 	List<BusinessVarietiesBo>  selectSuperid(String spuerId);
+	
+	String getThisCid(String id);
+	
+	String getThisCname(String cid);
+	
+	List<String> getListId();
+	
+	int getLayer(String superId);
 }

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

@@ -549,8 +549,8 @@
   		<if test="bname != null">
 		and b.bname = #{bname,jdbcType=VARCHAR}
 		</if>
-		<if test="vid != null">
-		and b.cid = #{vid,jdbcType=VARCHAR}
+		<if test="cid != null">
+		and b.cid = #{cid,jdbcType=VARCHAR}
 		</if>
 		<if test="country != null">
 		and b.country = #{country,jdbcType=INTEGER}
@@ -565,7 +565,7 @@
 		and b.district = #{district,jdbcType=VARCHAR}
 		</if>
 		<if test="activityFlag != null">
-		and b.activityFlag = #{activityFlag,jdbcType=VARCHAR}
+		and b.activity_flag = #{activityFlag,jdbcType=INTEGER}
 		</if>
 		<if test="status != null">
 		and b.status = #{status,jdbcType=VARCHAR}
@@ -583,8 +583,8 @@
   		<if test="bname != null">
 		and b.bname = #{bname,jdbcType=VARCHAR}
 		</if>
-		<if test="vid != null">
-		and b.cid = #{vid,jdbcType=VARCHAR}
+		<if test="cid != null">
+		and b.cid = #{cid,jdbcType=VARCHAR}
 		</if>
 		<if test="country != null">
 		and b.country = #{country,jdbcType=INTEGER}
@@ -599,7 +599,7 @@
 		and b.district = #{district,jdbcType=VARCHAR}
 		</if>
 		<if test="activityFlag != null">
-		and b.activityFlag = #{activityFlag,jdbcType=VARCHAR}
+		and b.activity_flag = #{activityFlag,jdbcType=INTEGER}
 		</if>
 		<if test="status != null">
 		and b.status = #{status,jdbcType=VARCHAR}
@@ -615,4 +615,6 @@
   
   </select>
   
+  
+  
 </mapper>

+ 24 - 0
src/main/java/com/goafanti/common/mapper/BusinessVarietiesMapper.xml

@@ -453,4 +453,28 @@
   		from business_varieties b 
   		where b.super_id= #{superId,jdbcType=VARCHAR}
   	</select>
+  	
+  	<select id="getThisCid" resultType="String">
+  		select b.cid
+  		from business_varieties b
+  		where b.id= #{id,jdbcType=VARCHAR}
+  	</select>
+  	
+  	<select id="getThisCname" resultType="String">
+  		select b.cname
+  		from business_varieties b
+  		where b.cid= #{cid,jdbcType=VARCHAR}
+  	</select>
+  	
+  	<select id="getListId" resultType="String">
+  		select b.id
+  		from business_varieties b
+  		
+  	</select>
+  	
+  	<select id="getLayer" resultType="Integer">
+  		select b.layer
+  		from business_varieties b
+  		where b.id= #{superId,jdbcType=VARCHAR}
+  	</select>
 </mapper>