Browse Source

公出修改

anderx 1 year ago
parent
commit
b77ecdf64a

+ 5 - 0
src/main/java/com/goafanti/business/bo/InputRestrictProject.java

@@ -106,4 +106,9 @@ public class InputRestrictProject extends RestrictProject {
         setPid(pid);
         setUid(uid);
     }
+
+    public InputRestrictProject(String uid, String aid) {
+        setAid(aid);
+        setUid(uid);
+    }
 }

+ 1 - 1
src/main/java/com/goafanti/business/service/impl/RestrictProjectServiceImpl.java

@@ -49,7 +49,7 @@ public class RestrictProjectServiceImpl extends BaseMybatisDao<RestrictProjectMa
         in.setAid(aid);
         in.setType(1);
         in.setLockTime(new Date());
-        RestrictProject use = restrictProjectMapper.selectByPid(in);
+        RestrictProject use = restrictProjectMapper.selectByParam(in);
         if (use != null && use.getType() != 0){
             throw new BusinessException("该项目已存在");
         }

+ 3 - 0
src/main/java/com/goafanti/common/constant/AFTConstants.java

@@ -3,6 +3,9 @@ package com.goafanti.common.constant;
 public class AFTConstants {
 	public static final String	YYYYMMDDHHMMSS						= "yyyy-MM-dd HH:mm:ss";
 	public static final String	YYYYMMDDHHMM						= "yyyy-MM-dd HH:mm";
+
+
+	public static final String	MMDDHHMM						= "MM月dd日 HH:mm";
 	public static final String	YMDHMS_CHINESE						= "yyyy年MM月dd日 HH:mm:ss";
 	public static final String	YYYYMMDD							= "yyyy-MM-dd";
 	public static final String	YYYYMM								= "yyyy-MM";

+ 8 - 1
src/main/java/com/goafanti/common/dao/RestrictProjectMapper.java

@@ -27,8 +27,15 @@ public interface RestrictProjectMapper {
 
     int updateByPrimaryKey(RestrictProject record);
 
-    RestrictProject selectByPid(InputRestrictProject in);
+    RestrictProject selectByParam(InputRestrictProject in);
 
+    List<RestrictProject> selectListByParam(InputRestrictProject in);
+
+    /**
+     * 所有限定项目及签单情况
+     * @param in
+     * @return
+     */
     List<OutRestrictProject> selectByUidAndAid(InputRestrictProject in);
 
     List<OutRestrictProject> selectByUid(String id);

+ 14 - 3
src/main/java/com/goafanti/common/mapper/RestrictProjectMapper.xml

@@ -114,13 +114,13 @@
     </update>
 
 
-    <select id="selectByPid" resultMap="BaseResultMap">
+    <select id="selectByParam" resultMap="BaseResultMap">
         select
         <include refid="Base_Column_List" />
         from restrict_project
-        where  pid = #{pid,jdbcType=VARCHAR}
+        where aid = #{aid,jdbcType=VARCHAR}
         and uid =#{uid,jdbcType=VARCHAR}
-        and aid = #{aid,jdbcType=VARCHAR}
+        and  pid = #{pid,jdbcType=VARCHAR}
     </select>
     <select id="selectByUidAndAid" resultType="com.goafanti.business.bo.OutRestrictProject">
         select a.id pid ,b.id,a.bname projectName,b.type,b.lock_time lockTime,b.release_time releaseTime ,
@@ -178,6 +178,17 @@
                  left join user c on b.uid=c.id left join admin d on b.aid=d.id
         where  b.aid= #{aid,jdbcType=VARCHAR}
     </select>
+    <select id="selectListByParam" resultType="com.goafanti.common.model.RestrictProject">
+        select
+        <include refid="Base_Column_List" />
+        from restrict_project
+        where  type >0
+        and aid = #{aid,jdbcType=VARCHAR}
+        and uid =#{uid,jdbcType=VARCHAR}
+          <if test="pid !=null">
+              and  pid = #{pid,jdbcType=VARCHAR}
+          </if>
+    </select>
 
     <update id="updateRelease">
         update restrict_project set release_time = now(),type=0

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

@@ -235,7 +235,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		if(t.getCommodityPrice()!=null) {
 			order.setTotalAmount(order.getTotalAmount());
 		}
-		RestrictProject outRestrictProjects = restrictProjectMapper.selectByPid(new InputRestrictProject(order.getBuyerId(), TokenManager.getAdminId(), t.getCommodityId()));
+		RestrictProject outRestrictProjects = restrictProjectMapper.selectByParam(new InputRestrictProject(order.getBuyerId(), TokenManager.getAdminId(), t.getCommodityId()));
 		if (outRestrictProjects==null||outRestrictProjects.getType()==0){
 			throw new BusinessException("该项目已为公共限定项目,请先领取");
 		}else  if (!outRestrictProjects.getAid().equals(TokenManager.getAdminId())){

+ 1 - 1
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -172,7 +172,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 			//处理客户已派项目
 			projectDistributionPushUserMid(tn);
 			//处理限定项目状态
-			RestrictProject use = restrictProjectMapper.selectByPid(new InputRestrictProject(tn.getBuyerId(), tn.getSalesmanId(), t.getCommodityId()));
+			RestrictProject use = restrictProjectMapper.selectByParam(new InputRestrictProject(tn.getBuyerId(), tn.getSalesmanId(), t.getCommodityId()));
 			if (use!=null){
 				RestrictProject newRP=new RestrictProject();
 				newRP.setId(use.getId());

+ 26 - 17
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -4,6 +4,7 @@ import cn.jiguang.common.utils.StringUtils;
 import com.alibaba.fastjson.JSONArray;
 import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.admin.service.DepartmentService;
+import com.goafanti.business.bo.InputRestrictProject;
 import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
@@ -71,6 +72,9 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	@Autowired
 	private TOrderPublicReleaseCountMapper tOrderPublicReleaseCountMapper;
 
+	@Autowired
+	private RestrictProjectMapper restrictProjectMapper;
+
 	@Override
 	@Transactional
 	public Map<String, Object> addPublicRelease(InputPublicRelease in) {
@@ -217,27 +221,30 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			//默认上级审核
 			AtomicReference<Integer> status= new AtomicReference<>(1);
 			String formatDate = DateUtils.formatDate(in.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS);
-			//不是业务员
+			//业务公出
 			if (in.getType()==0){
+				//不是业务员
 				if (my.getPublicPurview()==0){
                     for (User u : users) {
+						//不是自己的客户
                         if (!u.getAid().equals(my.getId())) {
-                            StringBuffer str2 = new StringBuffer();
-                            str2 = str2.append(my.getName()).append("(需审核),准备公出您的企业");
-                            str2 = str2.append("[").append(u.getNickname()).append("]!!!。");
-                            sendEmailAndNoticeAndSoucket(u.getAid(), 3, str2.toString());
-                            Admin admin = adminMapper.selectByPrimaryKey(u.getAid());
-                            if (in.getType() == 0) {
-                                //不是自己的企业则需要审核并设置非自己客户待审核
-                                //新增限定项目逻辑,如果是我的限定项目,则可以公出,不是则需要审核
-								int countRestrictProject = userMapper.getCountRestrictProject(u.getId(), my.getId());
-								if (countRestrictProject==0){
-									addPublicExamine(in.getId(), admin);
-									if (in.getPublicType() == null || in.getPublicType() == 0) in.setPublicType(1);
-								}
-                            }
-                            pushNoticeAndSoucketAndEmail(my, in, date, admin, str, map);
-                            status.set(0);
+							List<RestrictProject> list = restrictProjectMapper.selectListByParam(new InputRestrictProject(u.getId(), my.getId()));
+							StringBuffer str2 = new StringBuffer();
+							if (!list.isEmpty()){
+								String start = DateUtils.formatDate(in.getReleaseStart(), AFTConstants.MMDDHHMM);
+								String end = DateUtils.formatDate(in.getReleaseEnd(), AFTConstants.MMDDHHMM);
+								str2 = str2.append("限定项目所属人营销员").append(my.getName()).append("于")
+										.append(start).append("至").append(end).append("公出你的企业[").append(u.getNickname()).append("]请悉知!");
+							}else {
+								str2 = str2.append(my.getName()).append("(需审核),准备公出您的企业")
+								.append("[").append(u.getNickname()).append("]。");
+								Admin admin = adminMapper.selectByPrimaryKey(u.getAid());
+								addPublicExamine(in.getId(), admin);
+								pushNoticeAndSoucketAndEmail(my, in, date, admin, str, map);
+								if (in.getPublicType() == null || in.getPublicType() == 0) in.setPublicType(1);
+							}
+							sendEmailAndNoticeAndSoucket(u.getAid(), 3, str2.toString());
+							status.set(0);
                         }
                     }
                 }else {
@@ -411,6 +418,8 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				List<String> split = Arrays.asList(in.getUids().split(","));
 				List<OutPublicReleaseDetails> prList = publicReleaseDetailsMapper.selectByPrid(in.getId());
 				uses=pushPublicReleaseDetails(split,prList,use,in);
+
+
 			}
 			in.setStatus(1);
 			log.setStatus(PublicReleaseLog.states.xg.getCode());