Просмотр исходного кода

公出打卡小程序,修改接口修改

anderx 1 неделя назад
Родитель
Сommit
60b57b7313

+ 21 - 52
src/main/java/com/goafanti/common/mapper/PublicReleaseMapper.xml

@@ -737,15 +737,19 @@
                 and a.type=5
                 and a.assist =1
             </if>
-            <if test="type==10">
-                and a.type=6
-            </if>
+
             and a.public_type in (0,1,2,3)
             <if test="assist ==0">
                 and a.assist in(0,1,4)
             </if>
             <if test="assist == 2">
-                and a.type =3
+                <if test="type==10">
+                    and a.type=6
+                </if>
+                <if test="type==0">
+                    and a.type =3
+                </if>
+
                 and a.assist    in (2,4)
             </if>
             <if test="assist == 3">
@@ -974,15 +978,22 @@
         left join `user` d on a.uid =d.id  left join admin e on d.aid=e.id
         left join user_archives_interview uai on a.id=uai.prdid
         left join public_assist_details pad on b.id=pad.prid
-
         where 1=1
+        <include refid="publicDtails_sql" />
+        order by b.status,b.create_time desc
+        <if test="page_sql!=null">
+            ${page_sql}
+        </if>
+    </select>
+
+    <sql id="publicDtails_sql">
         <if test="publicType != null">
             and b.type= #{publicType}
         </if>
-          <if test="assistType!=null">
+        <if test="assistType!=null">
             and
-            <foreach  collection="assistType" item="type" separator=" or ">
-                 find_in_set(#{type},pad.type) &gt; 0
+            <foreach  collection="assistType" item="type" separator=" or " open="(" close=")">
+                find_in_set(#{type},pad.type) &gt; 0
             </foreach>
         </if>
         <if test="aid != null">
@@ -1018,11 +1029,7 @@
         <if test="contractNo !=null">
             and f.contract_no like CONCAT('%',#{contractNo},'%')
         </if>
-        order by b.status,b.create_time desc
-        <if test="page_sql!=null">
-            ${page_sql}
-        </if>
-    </select>
+    </sql>
 
     <select id="countPublicDtails" resultType="java.lang.Integer">
         select count(*)
@@ -1035,45 +1042,7 @@
             left join public_assist_details pad on b.id=pad.prid
         </if>
         where 1=1
-        <if test="publicType != null">
-            and b.type= #{publicType}
-        </if>
-        <if test="assistType!=null">
-            and pad.type= #{assistType}
-        </if>
-        <if test="aid != null">
-            and b.aid= #{aid}
-        </if>
-        <if test="sid != null">
-            and d.aid= #{sid}
-        </if>
-        <if test="deps !=null">
-            and c.department_id in
-            <foreach close=")" collection="deps" item="dep" open="(" separator=",">
-                #{dep}
-            </foreach>
-        </if>
-        <if test="uid != null">
-            and a.uid = #{uid}
-        </if>
-        <if test="releaseStart != null and releaseEnd != null">
-            and (b.release_start  between #{releaseStart} and #{releaseEnd} or b.release_end  between #{releaseStart} and #{releaseEnd})
-        </if>
-        <if test="createStart != null and createEnd != null">
-            and b.create_time  between #{createStart} and #{createEnd}
-        </if>
-        <if test="status != null">
-            and b.status = #{status}
-        </if>
-        <if test="statusType == 1">
-            and b.status in (1,2)
-        </if>
-        <if test="clockIn !=null">
-            and a.clock_in= #{clockIn}
-        </if>
-        <if test="contractNo !=null">
-            and f.contract_no like CONCAT('%',#{contractNo},'%')
-        </if>
+        <include refid="publicDtails_sql" />
     </select>
 
 

+ 4 - 4
src/main/java/com/goafanti/weChat/controller/AdminReleaseApiController.java

@@ -53,10 +53,6 @@ public class AdminReleaseApiController extends CertifyApiController{
 			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"公出时间"));
 			return res;
 		}
-		if (StringUtils.isBlank(in.getDistrictName())) {
-			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"公出地点"));
-			return res;
-		}
 		try {
 			String format = AFTConstants.YYYYMMDDHHMMSS;
 			if (in.getType()==5){
@@ -70,6 +66,10 @@ public class AdminReleaseApiController extends CertifyApiController{
 		}
 		//新增5和6非公出协单,不用判断公出时间
 		if (in.getType()<4){
+			if (StringUtils.isBlank(in.getDistrictName())) {
+				res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"公出地点"));
+				return res;
+			}
 			int i = publicReleaseService.checkTime(in);
 			if (i==1) {
 				res.getError().add(buildError("发起人公出时段已经被使用!","发起人公出时段已经被使用!"));

+ 28 - 22
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -218,17 +218,6 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		return (Map<String, Object>) addPublicReleaseLog(my, in,userNames,date,users,checkOrderNo);
 	}
 
-	private void addPublicCotentType(Integer id,String type) {
-		String[] split = type.split(",");
-		List<PublicReleaseContentType> list =new ArrayList<>();
-		for (String s : split) {
-			PublicReleaseContentType pct=new PublicReleaseContentType();
-			pct.setPrid(id);
-			pct.setType(s);
-			list.add(pct);
-		}
-			publicReleaseContentTypeMapper.insertBatch(list);
-	}
 
 	private void addPublicAssistType(InputPublicRelease in) {
 		PublicAssistDetails pad=new PublicAssistDetails();
@@ -239,17 +228,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		publicAssistDetailsMapper.insert(pad);
 	}
 
-	private void addPublicReleaseType(Integer id,String type) {
-		String[] split = type.split(",");
-		List<PublicReleaseType> list =new ArrayList<>();
-		for (String s : split) {
-			PublicReleaseType pt=new PublicReleaseType();
-			pt.setPrid(id);
-			pt.setType(s);
-			list.add(pt);
-		}
-		publicReleaseTypeMapper.insertBatch(list);
-	}
+
 
 	private void pushPublicAssistCarbonCopy(InputPublicRelease in, AdminListBo my, String userNames) {
 		String[] split = in.getAssistAid().split(",");
@@ -2010,6 +1989,24 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				StringBuffer str = new StringBuffer("[").append(a.getName()).append("]修改了公出").append("[").append(use.getUserNames()).append("]。");
 				PublicReleaseLog log = new PublicReleaseLog(np.getId(), TokenManager.getAdminId(), PublicReleaseLog.states.xg.getCode(),str.toString(), date);
 				publicReleaseLogMapper.insertSelective(log);
+				if (use.getType()==5){
+					//主非协单内容
+					PublicAssistDetails up = publicAssistDetailsMapper.selectByPrid(use.getId());
+					//子非协单内容如果子不存在则新增,否则修改
+					PublicAssistDetails up2 = publicAssistDetailsMapper.selectByPrid(np.getId());
+					if (up2==null){
+						PublicAssistDetails np2 = new PublicAssistDetails();
+						BeanUtils.copyProperties(up,np2);
+						np2.setPrid(np.getId());
+						np2.setId(null);
+						publicAssistDetailsMapper.insert(np2);
+					}else {
+						PublicAssistDetails np2 = new PublicAssistDetails();
+						BeanUtils.copyProperties(up,np2);
+						np2.setId(up2.getId());
+						publicAssistDetailsMapper.update(np2);
+					}
+				}
 				sendNoticeAndSoucket(out.getAid(),np.getStatus(),str.toString());
 			}
 		}
@@ -2037,6 +2034,15 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				np.setMainId(use.getId());
 				np.setId(null);
 				pushAssist(use, date, a, np, np);
+				if (use.getType()==5){
+					//主非协单内容
+					PublicAssistDetails up = publicAssistDetailsMapper.selectByPrid(use.getId());
+					PublicAssistDetails np2 = new PublicAssistDetails();
+					BeanUtils.copyProperties(up,np2);
+					np2.setPrid(np.getId());
+					np2.setId(null);
+					publicAssistDetailsMapper.insert(np2);
+				}
 				StringBuffer str = new StringBuffer("[").append(a.getName()).append("]邀请你技术协单").append("[").append(use.getUserNames()).append("]。");
 				PublicReleaseLog log = new PublicReleaseLog(np.getId(), TokenManager.getAdminId(), PublicReleaseLog.states.fq.getCode(), str.toString(), date);
 				sendNoticeAndSoucket(s,np.getStatus(),str.toString());