wanghui пре 8 година
родитељ
комит
0e598f69f5

+ 6 - 9
src/main/java/com/goafanti/achievement/service/impl/AchievementServiceImpl.java

@@ -96,7 +96,7 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 			Integer boutique, Integer hot) {
 		Map<String, Object> params = disposeParams(username, ownerName, ownerId, auditStatus, serialNumber, name, keyword, category, status,
 				releaseDateStartDate, releaseDateEndDate, releaseStatus, UserType.ORGANIZATION.getCode(),
-				boutique, hot,TokenManager.getAdminId());
+				boutique, hot);
 		if (pNo == null || pNo < 0) {
 			pNo = 1;
 		}
@@ -121,7 +121,7 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 			Integer boutique, Integer hot) {
 		Map<String, Object> params = disposeParams(unitName, ownerName, ownerId, auditStatus, serialNumber, name, keyword, category, status,
 				releaseDateStartDate, releaseDateEndDate, releaseStatus, UserType.ORGANIZATION.getCode(),
-				boutique, hot,TokenManager.getAdminId());
+				boutique, hot);
 		if (pNo == null || pNo < 0) {
 			pNo = 1;
 		}
@@ -129,9 +129,6 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 		if (pSize == null || pSize < 0 || pSize > 10) {
 			pSize = 10;
 		}
-		if (!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.AUDITORADMIN)) {
-			params.put("adminId", TokenManager.getAdminId());
-		}
 		
 		return (Pagination<AchievementListBo>) findPage("findOrgOwnerAchievementListByPage",
 				"findOrgOwnerAchievementCount",params,pNo, pSize);
@@ -215,14 +212,14 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 		}
 		return (Pagination<AchievementListBo>) findPage("findAchievementListByPage", "findAchievementCount",
 				disposeParams(null, null, TokenManager.getUserId(), auditStatus, serialNumber, name, keyword, category,
-						status, releaseDateStartDate, releaseDateEndDate, releaseStatus, null, null, null,TokenManager.getAdminId()),
+						status, releaseDateStartDate, releaseDateEndDate, releaseStatus, null, null, null),
 				pNo, pSize);
 	}
 
 	private Map<String, Object> disposeParams(String username, String ownerName, String ownerId, Integer auditStatus,
 			Integer serialNumber, String name, String keyword, Integer category, Integer status,
 			String releaseDateStartDate, String releaseDateEndDate, Integer releaseStatus, Integer type,
-			Integer boutique, Integer hot,String techBrokerId) {
+			Integer boutique, Integer hot) {
 		Map<String, Object> params = new HashMap<>();
 
 		Date rStart = null;
@@ -299,10 +296,10 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 		if (null != hot) {
 			params.put("hot", hot);
 		}
-		if (TokenManager.hasRole(AFTConstants.TECHBROKER)) {
+		if (!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.AUDITORADMIN)) {
 			params.put("techBrokerId", TokenManager.getAdminId());
 		}
-
+		
 		return params;
 	}
 

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

@@ -8,6 +8,7 @@ import java.util.TreeMap;
 
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.admin.bo.AdminDetail;

+ 4 - 0
src/main/java/com/goafanti/common/constant/ErrorConstants.java

@@ -107,4 +107,8 @@ public class ErrorConstants {
 	public static final String MARKET_BOOTH_MAX						= "MARKET_BOOTH_MAX";	
 	
 	public static final String CUSTOMER_ALREADY_EXIST				= "CUSTOMER_ALREADY_EXIST";
+	
+	public static final String BUSINESS_ALREADY_EXIST				= "BUSINESS_ALREADY_EXIST";
+	
+	public static final String AT_LEAST_A_BUSINESS					= "AT_LEAST_A_BUSINESS";
 }

+ 1 - 9
src/main/java/com/goafanti/common/controller/PortalController.java

@@ -316,7 +316,7 @@ public class PortalController extends BaseController {
 			if (StringUtils.isNotBlank(achievementdetail.getFieldBS())) {
 				b = Boolean.TRUE;
 			}
-
+			
 			field += (a ? achievementdetail.getFieldAS() : "") + (a && b ? DELIMITER : "")
 					+ (b ? achievementdetail.getFieldBS() : "");
 			achievementdetail.setField(field);
@@ -324,7 +324,6 @@ public class PortalController extends BaseController {
 			if (StringUtils.isNotBlank(technicalPictureUrl)) {
 				achievementdetail.setPictureList(Arrays.asList(technicalPictureUrl.trim().split(",|,")));
 			}
-
 			Integer transfermode = achievementdetail.getTransferMode();
 			if (null != transfermode) {
 				if (AchievementTransferMode.FULLTRANSFER.getCode().equals(transfermode)) {
@@ -361,7 +360,6 @@ public class PortalController extends BaseController {
 					achievementdetail.setTechnicalPictureUrl(picurl[0]);
 				}
 			}
-
 			String location = "";
 			String province = achievementdetail.getProvince();
 			String city = achievementdetail.getCity();
@@ -381,7 +379,6 @@ public class PortalController extends BaseController {
 			achievementdetail.setLocation(location);
 
 		}
-
 		// 查询精品成果
 		List<AchievementListBo> boutiqueachievement = achievementService.getAchievement(1);
 		List<AchievementListBo> reboutiqueachievement = new ArrayList<AchievementListBo>();
@@ -406,7 +403,6 @@ public class PortalController extends BaseController {
 			}
 		}
 		;
-
 		// 判断登录没登录. 登录了.查找用户喜欢的. 没登录就随机查四个.
 		boolean isLogin = TokenManager.isLogin();
 		List<AchievementListBo> achievementlist = achievementService.getAchievement(0);// 查询所有专利
@@ -435,7 +431,6 @@ public class PortalController extends BaseController {
 				reachievementlist.set(i, customerlikelist.get(i));
 			}
 		}
-
 		/*----------------------------------------------------------*/
 
 		for (int i = 0; i < reachievementlist.size(); i++) {
@@ -483,7 +478,6 @@ public class PortalController extends BaseController {
 					reachievementlist.get(i).setOwnerTypeS("组织所有");
 				}
 			}
-
 			Integer transfermode = reachievementlist.get(i).getTransferMode();
 			if (null != transfermode) {
 				if (AchievementTransferMode.FULLTRANSFER.getCode().equals(transfermode)) {
@@ -497,7 +491,6 @@ public class PortalController extends BaseController {
 							.setTransferModeS(AchievementTransferMode.EXCLUSIVETECHNOLOGYSHARES.getDesc());
 				}
 			}
-
 			Integer maturity = reachievementlist.get(i).getMaturity();
 			if (null != maturity) {
 				if (AchievementMaturity.RESEARCH.getCode().equals(maturity)) {
@@ -513,7 +506,6 @@ public class PortalController extends BaseController {
 				}
 			}
 			;
-
 			String pic = reachievementlist.get(i).getTechnicalpictureurl();// 在存在多张图片的情况下,暂时先取第一张
 			if (null != pic) {
 				boolean hascomma = pic.contains(",");

+ 5 - 21
src/main/java/com/goafanti/common/mapper/AchievementMapper.xml

@@ -864,19 +864,11 @@
 		left join marketing_management mm on a.id = mm.product_id 
 	</if>
   	where a.deleted_sign = 0 and a.owner_type = 1
-  	<if test="adminId != null">
-		and (u.mid = #{adminId,jdbcType=VARCHAR}
-	</if>
-	<if test="adminId != null">
-		or  a.salesman_id = #{adminId,jdbcType=VARCHAR}
-	</if>
-	<if test="adminId != null">
-		or  a.tech_broker_id = #{adminId,jdbcType=VARCHAR}
-		)
+  	<if test="techBrokerId != null">
+		a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
 	</if>
   	<if test="ownerName != null">
-  		and  a.owner_name like CONCAT('%',#{ownerName,jdbcType=VARCHAR},'%')
-  		and  (a.owner_id is null or a.owner_id = '')
+  		and  a.owner_name like CONCAT('%',#{ownerName,jdbcType=VARCHAR},'%') 	
   	</if>
   	<if test="unitName != null">
   		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
@@ -945,19 +937,11 @@
 		left join marketing_management mm on a.id = mm.product_id 
 	</if>
   	where a.deleted_sign = 0 and a.owner_type = 1
-  	<if test="adminId != null">
-		and (u.mid = #{adminId,jdbcType=VARCHAR}
-	</if>
-	<if test="adminId != null">
-		or  a.salesman_id = #{adminId,jdbcType=VARCHAR}
-	</if>
-	<if test="adminId != null">
-		or  a.tech_broker_id = #{adminId,jdbcType=VARCHAR}
-		)
+  	<if test="techBrokerId != null">
+		a.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
 	</if>
   	<if test="ownerName != null">
   		and  a.owner_name like CONCAT('%',#{ownerName,jdbcType=VARCHAR},'%')
-  		and  (a.owner_id is null or a.owner_id = '')
   	</if>
   	<if test="unitName != null">
   		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')

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

@@ -314,7 +314,7 @@
 			a.create_time as followTime,
 			a.contact_type as contactType,
 			a.result, 
-			b.identify_name as identityName,
+			b.identify_name as identifyName,
 			c.name as contacts,
 			c.mobile as contactMobile,
 			d.name as adminName

+ 9 - 8
src/main/java/com/goafanti/common/utils/ExcelUtils.java

@@ -18,13 +18,14 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import com.goafanti.customer.bo.CustomerExcelBo;
 
 public class ExcelUtils {
-	private Set repeatRows = new TreeSet<Integer>(); //数据重复的
-	private Set vacantRows = new TreeSet<Integer>(); //数据不完整的
+	private Set<Integer> repeatRows = new TreeSet<Integer>(); //数据重复的
+	private Set<Integer> vacantRows = new TreeSet<Integer>(); //数据不完整的
 	DecimalFormat df = new DecimalFormat("0");  
+	@SuppressWarnings({ "unused", "resource" })
 	public  List<CustomerExcelBo> parseExcel(String excelPath) throws IOException{
 		InputStream excelFile = new FileInputStream(new File(excelPath));
 		XSSFWorkbook wb = new XSSFWorkbook(excelFile);	
-		List result = new ArrayList<CustomerExcelBo>();
+		List<CustomerExcelBo> result = new ArrayList<CustomerExcelBo>();
 		XSSFSheet sheet = wb.getSheetAt(0);
 		Iterator<Row> rowIterator = sheet.iterator();
 		Row currentRow = rowIterator.next(); //表头
@@ -41,7 +42,7 @@ public class ExcelUtils {
 		return result;
 	}
 	
-	@SuppressWarnings("unchecked")
+	@SuppressWarnings("unused")
 	private String checkCustomerType(String customerType,int rowNumber){
 		if(StringUtils.isEmpty(customerType)) {
 			vacantRows.add(rowNumber);
@@ -53,7 +54,7 @@ public class ExcelUtils {
 		vacantRows.add(rowNumber);
 		return "";
 	}
-	@SuppressWarnings("unchecked")
+	@SuppressWarnings("unused")
 	private String checkFollowSituation(String followSituation,int rowNumber){
 		if(StringUtils.isEmpty(followSituation)){
 			vacantRows.add(rowNumber);
@@ -71,7 +72,7 @@ public class ExcelUtils {
 		vacantRows.add(rowNumber);
 		return "";
 	}
-	@SuppressWarnings("unchecked")
+	@SuppressWarnings("unused")
 	private String checkCustomerStatus(String customerStatus,int rowNumber){
 		if(StringUtils.isEmpty(customerStatus)) {
 			vacantRows.add(rowNumber);
@@ -92,7 +93,7 @@ public class ExcelUtils {
 
 		return flag;
 	}
-	@SuppressWarnings("unchecked")
+	@SuppressWarnings("unused")
 	private String checkCompanyIntention(String companyIntention,int rowNumber){
 		if(StringUtils.isEmpty(companyIntention)){
 			vacantRows.add(rowNumber);
@@ -114,7 +115,7 @@ public class ExcelUtils {
 		return "";
 	}
 	
-	@SuppressWarnings("unchecked")
+	@SuppressWarnings("unused")
 	private String checkOther(String cellValue,int rowNumber){
 		if(StringUtils.isEmpty(cellValue)){
 			vacantRows.add(rowNumber);

+ 5 - 5
src/main/java/com/goafanti/customer/bo/FollowBusinessBo.java

@@ -15,7 +15,7 @@ public class FollowBusinessBo {
 	/** 客户ID **/
 	private String uid;
 	/** 客户名 **/
-	private String identityName;
+	private String identifyName;
 	/** 当前联系人姓名 **/
 	private String contacts;
 	/** 当前联系电话 **/
@@ -45,11 +45,11 @@ public class FollowBusinessBo {
 	public void setUid(String uid) {
 		this.uid = uid;
 	}
-	public String getIdentityName() {
-		return identityName;
+	public String getIdentifyName() {
+		return identifyName;
 	}
-	public void setIdentityName(String identityName) {
-		this.identityName = identityName;
+	public void setIdentifyName(String identifyName) {
+		this.identifyName = identifyName;
 	}
 	public String getContacts() {
 		return contacts;

+ 3 - 3
src/main/java/com/goafanti/customer/controller/CustomerApiController.java

@@ -101,9 +101,9 @@ public class CustomerApiController extends BaseController{
 	 * @throws Exception 
 	 * @throws NumberFormatException **/
 	@RequestMapping(value = "/addCustomer", method = RequestMethod.POST)
-	public Result addCustomer(String name,String contacts,String contactMobile,String type) throws Exception{
+	public Result addCustomer(String name,String contacts,String contactMobile,String type,String societyTag) throws Exception{
 		Result res = new Result();
-		customerService.addCustomer(name, contacts, contactMobile, Integer.parseInt(type));
+		customerService.addCustomer(name, contacts, contactMobile, Integer.parseInt(type),societyTag);
 		return res;
 	}
 	
@@ -188,7 +188,7 @@ public class CustomerApiController extends BaseController{
 		FollowBusinessBo fbb = new FollowBusinessBo();
 		SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
 		fbb.setFollowTime(format.format(new Date()));
-		fbb.setIdentityName(user.getIdentifyName());
+		fbb.setIdentifyName(user.getIdentifyName());
 		fbb.setUid(uid);
 		fbb.setUserBusinessList(businessService.findBusinessByUAid(uid, TokenManager.getAdminId()));
 		res.setData(fbb);

+ 2 - 1
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -93,9 +93,10 @@ public interface CustomerService {
 	 * @param contacts 联系人
 	 * @param contactMobile 联系电话
 	 * @param type 客户类型
+	 * @param societyTag 社会属性
 	 * @return
 	 */
-	int addCustomer(String name,String contacts,String contactMobile,Integer type)  throws BusinessException;
+	int addCustomer(String name,String contacts,String contactMobile,Integer type,String societyTag)  throws BusinessException;
 	
 	
 	/**

+ 7 - 5
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -174,7 +174,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 
 	@Override
 	@Transactional
-	public int addCustomer(String name, String contacts, String contactMobile, Integer type)  throws BusinessException{
+	public int addCustomer(String name, String contacts, String contactMobile, Integer type,String societyTag)  throws BusinessException{
 		User user = new User();
 		Date now = new Date();
 		String uid = UUID.randomUUID().toString();
@@ -191,10 +191,12 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		user.setType(type);
 		user.setCurrentMemberStatus(0);
 		user.setLvl(1);
+		user.setSocietyTag(societyTag);
 		user.setCreateTime(now);
 		user.setUpdateTime(now);
 		user.setMobile(contactMobile);
 		user.setPassword(AFTConstants.INITIALPASSWORD);
+		user.setIsMember(0);
 		passwordUtil.encryptPassword(user);
 		if(type == 0){
 			UserIdentity ui = new UserIdentity();
@@ -209,7 +211,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 			ui.setAuditStatus(0);
 			userIdentityMapper.insert(ui);
 		}else if(type == 1){
-			if(userMapper.judgeCustomerByName(name)>1) throw new BusinessException(new Error(ErrorConstants.PARAM_ERROR, name , "客户已存在"));
+			if(userMapper.judgeCustomerByName(name)>0) throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_EXIST, name,""));
 			// 创建企业认证信息
 			OrganizationIdentity oi = new OrganizationIdentity();
 			oi.setUnitName(name);
@@ -299,7 +301,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 	@Override
 	@Transactional
 	public int addFollow(FollowBusinessBo fbb) throws BusinessException{
-		if(fbb.getUserBusinessList().size()<1) throw new BusinessException(new Error(ErrorConstants.PARAM_ERROR, "", "至少需要填写一个跟进业务"));
+		if(fbb.getUserBusinessList().size()<1) throw new BusinessException(new Error("","","至少需要填写一个跟进业务"));
 		//更新跟进记录表
 		SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
 		UserFollow userFollow = new UserFollow();
@@ -353,7 +355,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 				//检测是否可以创建业务	
 				if(userBusinessMapper.judgeBusiness(fbb.getUid(), ub.getBusinessGlossoryId(), "")>0){
 					String businessName = businessGlossoryMapper.selectByPrimaryKey(ub.getBusinessGlossoryId()).getName();
-					throw new BusinessException(new Error(ErrorConstants.PARAM_ERROR, businessName, "已经被跟进"));
+					throw new BusinessException(new Error(ErrorConstants.BUSINESS_ALREADY_EXIST,businessName,""));
 				}
 				String ubId = UUID.randomUUID().toString();
 				//更新业务表
@@ -419,7 +421,7 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 				//检测是否可以创建业务	
 				if(userBusinessMapper.judgeBusiness(fbb.getUid(), ub.getBusinessGlossoryId(), "")>0){
 					String businessName = businessGlossoryMapper.selectByPrimaryKey(ub.getBusinessGlossoryId()).getName();
-					throw new BusinessException(new Error(ErrorConstants.PARAM_ERROR, businessName, "已经被跟进"));
+					throw new BusinessException(new Error(ErrorConstants.BUSINESS_ALREADY_EXIST,businessName,""));
 				}
 				String ubId = UUID.randomUUID().toString();		
 				UserBusiness userBusiness = new UserBusiness();

+ 5 - 1
src/main/resources/props/error.properties

@@ -95,4 +95,8 @@ MOBILE_SAME_ERROR=\u65B0\u624B\u673A\u53F7\u5FC5\u987B\u548C\u539F\u624B\u673A\u
 
 MARKET_BOOTH_MAX = \u8425\u9500\u6D3B\u52A8\u5C55\u4F4D\u5DF2\u6EE1{0}\u4E2A
 
-CUSTOMER_ALREADY_EXIST = \u5BA2\u6237\u5DF2\u5B58\u5728
+CUSTOMER_ALREADY_EXIST = \u5BA2\u6237\u5DF2\u5B58\u5728
+
+BUSINESS_ALREADY_EXIST = \u9879\u76EE\u5DF2\u5B58\u5728
+
+AT_LEAST_A_BUSINESS = \u81F3\u5C11\u9700\u8981\u586B\u5199\u4E00\u9879\u4E1A\u52A1

+ 1 - 1
src/main/resources/spring/spring-mybatis.xml

@@ -86,7 +86,7 @@
 			<tx:method name="*"  read-only="true" />
 		</tx:attributes>
 	</tx:advice>
- 	
+		
 	<aop:config proxy-target-class="true">
 		<aop:pointcut id="myPointcut" expression="execution(* com.goafanti.*.service..*.*(..))" />
 		<aop:advisor advice-ref="txAdvice" pointcut-ref="myPointcut" />

+ 2 - 1
src/main/webapp/WEB-INF/views/common.html

@@ -387,7 +387,8 @@
 				name : /*[[${adminData.name}]]*/'',
 				email : /*[[${adminData.email}]]*/'',
 				createTime : /*[[${adminData.createTime}]]*/'',
-				uid : /*[[${adminData.id}]]*/''
+				uid : /*[[${adminData.id}]]*/'',
+				isSuperAdmin : /*[[${shiro.hasRole('999999')}]]*/false
 			}
 			window.showUserManage = /*[[${shiro.hasRole('999999') || shiro.isPermitted('admin/userManage')}]]*/false;
 			window.showServices = /*[[${shiro.hasRole('999999') || shiro.isPermitted('admin/services')}]]*/false;