Browse Source

变更会员处理

anderx 10 months ago
parent
commit
ee3153c51b

+ 64 - 4
src/main/java/com/goafanti/order/service/impl/OrderChangeServiceImpl.java

@@ -1,6 +1,7 @@
 package com.goafanti.order.service.impl;
 
 import com.goafanti.admin.service.DepartmentService;
+import com.goafanti.business.bo.BusinessProjectBo;
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.bo.OrderExamineBo;
 import com.goafanti.common.constant.AFTConstants;
@@ -17,10 +18,7 @@ import com.goafanti.core.mybatis.JDBCIdGenerator;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.order.bo.*;
-import com.goafanti.order.enums.OrderChangeProcess;
-import com.goafanti.order.enums.OrderChangeType;
-import com.goafanti.order.enums.OrderNewState;
-import com.goafanti.order.enums.OrderType;
+import com.goafanti.order.enums.*;
 import com.goafanti.order.service.NewOrderDunService;
 import com.goafanti.order.service.OrderChangeService;
 import com.goafanti.order.service.OrderNewService;
@@ -30,6 +28,7 @@ import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -1386,6 +1385,67 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 			public Object addChangeTask(TChangeTask t) {
 				t.setType(1);
 				tChangeTaskMapper.insertSelective(t);
+				//如果是会员添加同性质不同项目
+				BusinessProject bp=businessProjectMapper.selectById(t.getCommodityId());
+				TChangeTask t2=new TChangeTask();
+				BeanUtils.copyProperties(t,t2);
+				if (bp.getProjectType().equals(NewProjectTypeEnum.HT.getCode())){
+					if (t.getHtMember()==1){
+						List<BusinessProjectBo> list = businessProjectMapper.selectByFirstBName("高新会员",1);
+						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);
+								tChangeTaskMapper.insertSelective(t2);;
+							}
+						}
+					}
+					if (t.getAdditionalDeduction()==1){
+						//加计扣除
+						List<BusinessProjectBo> list = businessProjectMapper.selectByFirstBName("加计扣除", 1);
+						for (BusinessProjectBo e : list) {
+								t2.setCommodityId(e.getId());
+								t2.setCommodityName(e.getBname());
+								t2.setCommodityId(e.getId());
+								t2.setCommodityName(e.getBname());
+								t2.setMain(0);
+								t2.setCommodityPrice(new BigDecimal(0));
+								t2.setId(null);
+								tChangeTaskMapper.insertSelective(t2);;
+						}
+					}
+					if (t.getRdAwardsubsidy()==2){
+						List<BusinessProjectBo> list = businessProjectMapper.selectByFirstBName("研发奖励", 1);
+						for (BusinessProjectBo e : list) {
+							t2.setCommodityId(e.getId());
+							t2.setCommodityName(e.getBname());
+							t2.setCommodityId(e.getId());
+							t2.setCommodityName(e.getBname());
+							t2.setMain(0);
+							t2.setCommodityPrice(new BigDecimal(0));
+							t2.setId(null);
+							tChangeTaskMapper.insertSelective(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.setCommodityId(e.getId());
+							t2.setCommodityName(e.getBname());
+							t2.setMain(0);
+							t2.setCommodityPrice(new BigDecimal(0));
+							t2.setId(null);
+							tChangeTaskMapper.insertSelective(t2);;
+						}
+					}
+				}
 				return t;
 			}