Browse Source

新增项目类型修改
新增高新会员修改
新增简单会员修改
新增单边会员修改

anderx 10 months ago
parent
commit
00920d5794

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

@@ -105,6 +105,7 @@ public interface BusinessProjectMapper {
 
     List<BusinessProjectBo> selectBusinessProjectByName(@Param("businessName")String businessName, @Param("cname")String cname);
 
+    List<BusinessProjectBo> selectByFirstBName(@Param("businessName") String businessName, @Param("type") Integer type);
 
     List<BusinessCategory> selectBusinessProjectCatalog();
 
@@ -114,5 +115,6 @@ public interface BusinessProjectMapper {
      */
     List<Map> selectProjectAndTypeAll();
 
+
 }
 

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

@@ -707,6 +707,16 @@ project_type = values(project_type)
         select bc.id,  group_concat(distinct bp.`type`)groupCount  from business_category bc
                                                                             left join business_project bp on bc.id =bp.cid group by bc.id
     </select>
+    <select id="selectByFirstBName"  resultType="com.goafanti.business.bo.BusinessProjectBo">
+        select  a.id,a.bname,ifnull(a.price,0) as price,ifnull(a.first_payment,0) as firstPayment,
+        a.type ,a.patent_transfer patentTransfer,b.cname,b.sort CSort,a.project_type projectType
+        from business_project a  left join business_category b on a.cid=b.id
+        where a.delete_sign=0 and a.status=0
+        <if test="type !=null">
+            and a.project_type = #{type}
+        </if>
+        and a.bname like concat(#{businessName},'%')
+    </select>
 
 </mapper>
 

+ 67 - 0
src/main/java/com/goafanti/order/enums/NewProjectTypeEnum.java

@@ -0,0 +1,67 @@
+package com.goafanti.order.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Administrator
+ *
+ */
+public enum NewProjectTypeEnum {
+//	项目类型 0=其他,1=高新会员,2=简单会员,3=单边会员
+	/** 未达立项条件 **/
+	OTHEN(0,"其他"),
+	/** 等待立项 **/
+	HT(1,"高新会员 "),
+	/** 已立项 **/
+	SIMPLE(2,"简单会员"),
+	/** 已结项 **/
+	UNILATERAL(3,"单边会员"),
+	/** 无效 **/
+	INVALID(10, "INVALID");
+
+	private NewProjectTypeEnum(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	private static Map<Integer, NewProjectTypeEnum> status = new HashMap<Integer, NewProjectTypeEnum>();
+
+	public static String getValueByCode(Integer code){
+        for(NewProjectTypeEnum projectType: NewProjectTypeEnum.values()){
+            if(code.equals(projectType.getCode())){
+                return projectType.getDesc();
+            }
+        }
+        return  null;
+    }
+
+	static {
+		for (NewProjectTypeEnum value : NewProjectTypeEnum.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+	public static NewProjectTypeEnum getStatus(Integer code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return INVALID;
+	}
+	public static boolean containsType(Integer code) {
+		return status.containsKey(code);
+	}
+	private Integer	code;
+	private String	desc;
+	public Integer getCode() {
+		return code;
+	}
+	public void setCode(Integer code) {
+		this.code = code;
+	}
+	public String getDesc() {
+		return desc;
+	}
+	public void setDesc(String desc) {
+		this.desc = desc;
+	}
+}

+ 32 - 26
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -242,33 +242,28 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		addTaskMid(t);
 		//如果是会员添加同性质不同项目
 		BusinessProject bp=businessProjectMapper.selectById(t.getCommodityId());
-		if (bp.getType()==ProjectType.HY.getCode()){
-			InputAddTask t2=new InputAddTask();
-			BeanUtils.copyProperties(t,t2);
-			if (t.getMemberType()==1){
+		InputAddTask t2=new InputAddTask();
+		BeanUtils.copyProperties(t,t2);
+		if (bp.getProjectType().equals(NewProjectTypeEnum.HT.getCode())){
+			if (t.getHtMember()==1){
 				//会员项目替换
-				if (t.getCommodityName().contains("财税")){
-					String t2Name=t.getCommodityName().replaceAll("财税","技术");
-					BusinessProject bp2=businessProjectMapper.selectByPrimaryBname(t2Name);
-					if (bp2==null)return t;
-					t2.setCommodityId(bp2.getId());
-					t2.setCommodityName(bp2.getBname());
-				}else if (t.getCommodityName().contains("技术")){
-					String t2Name=t.getCommodityName().replaceAll("技术","财税");
-					BusinessProject bp2=businessProjectMapper.selectByPrimaryBname(t2Name);
-					if (bp2==null)return t;
-					t2.setCommodityId(bp2.getId());
-					t2.setCommodityName(bp2.getBname());
+				List<BusinessProjectBo> additionalDeductionList = businessProjectMapper.selectByFirstBName("高新会员",1);
+				for (BusinessProjectBo e : additionalDeductionList) {
+					if(!e.getId().equals(t.getCommodityId())){
+						t2.setCommodityId(e.getId());
+						t2.setCommodityName(e.getBname());
+						t2.setMain(0);
+						t2.setCommodityPrice(new BigDecimal(0));
+						t2.setId(null);
+						addTTaskMember(t2);
+						addTaskMid(t2);
+					}
+
 				}
-				t2.setMain(0);
-				t2.setCommodityPrice(new BigDecimal(0));
-				t2.setId(null);
-				addTTaskMember(t2);
-				addTaskMid(t2);
 			}
 			if(t.getAdditionalDeduction()==1){
 				//加计扣除
-				List<BusinessProjectBo> additionalDeductionList = businessProjectMapper.selectBusinessProjectByName("加计扣除", null);
+				List<BusinessProjectBo> additionalDeductionList = businessProjectMapper.selectByFirstBName("加计扣除", 1);
 				for (BusinessProjectBo e : additionalDeductionList) {
 					t2.setCommodityId(e.getId());
 					t2.setCommodityName(e.getBname());
@@ -279,10 +274,9 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 					addTaskMid(t2);
 				}
 			}
-
 			if(t.getRdAwardsubsidy()==1){
 				//研发奖补
-				List<BusinessProjectBo> list = businessProjectMapper.selectBusinessProjectByName("研发奖补", null);
+				List<BusinessProjectBo> list = businessProjectMapper.selectByFirstBName("研发奖补", 1);
 				for (BusinessProjectBo e : list) {
 					t2.setCommodityId(e.getId());
 					t2.setCommodityName(e.getBname());
@@ -293,8 +287,20 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 					addTaskMid(t2);
 				}
 			}
-
-
+		}
+		if (bp.getProjectType().equals(NewProjectTypeEnum.SIMPLE.getCode())){
+			List<BusinessProjectBo> list = businessProjectMapper.selectByFirstBName("简单会员", 2);
+			for (BusinessProjectBo e : list) {
+				if(!e.getId().equals(t.getCommodityId())){
+					t2.setCommodityId(e.getId());
+					t2.setCommodityName(e.getBname());
+					t2.setMain(0);
+					t2.setCommodityPrice(new BigDecimal(0));
+					t2.setId(null);
+					addTTaskMember(t2);
+					addTaskMid(t2);
+				}
+			}
 		}
 		return t;
 	}