소스 검색

非公出协单开发

anderx 3 일 전
부모
커밋
09d6639f18

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

@@ -52,7 +52,7 @@ public class BaseController {
 	private RedisUtil redisUtil;
 
 	protected Error buildError(String key) {
-		return buildError(key, null);
+		return buildError(key, key);
 	}
 
 	protected Error buildError(String key, String message) {

+ 85 - 0
src/main/java/com/goafanti/common/dao/PublicAssistDetailsMapper.java

@@ -0,0 +1,85 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.PublicAssistDetails;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.data.domain.Pageable;
+
+import java.util.List;
+
+/**
+ * 公出协单详情表(PublicAssistDetails)表数据库访问层
+ *
+ * @author makejava
+ * @since 2026-01-16 14:04:42
+ */
+public interface PublicAssistDetailsMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    PublicAssistDetails selectById(Integer id);
+
+
+    /**
+     * 查询指定行数据
+     *
+     * @param publicAssistDetails 查询条件
+     * @param pageable            分页对象
+     * @return 对象列表
+     */
+    List<PublicAssistDetails> findPublicAssistDetailsList(PublicAssistDetails publicAssistDetails);
+
+    /**
+     * 统计总行数
+     *
+     * @param publicAssistDetails 查询条件
+     * @return 总行数
+     */
+    int findPublicAssistDetailsCount(PublicAssistDetails publicAssistDetails);
+
+    /**
+     * 新增数据
+     *
+     * @param publicAssistDetails 实例对象
+     * @return 影响行数
+     */
+    int insert(PublicAssistDetails publicAssistDetails);
+
+    /**
+     * 批量新增数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<PublicAssistDetails> 实例对象列表
+     * @return 影响行数
+     */
+    int insertBatch(@Param("entities") List<PublicAssistDetails> entities);
+
+    /**
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<PublicAssistDetails> 实例对象列表
+     * @return 影响行数
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+     */
+    int insertOrUpdateBatch(@Param("entities") List<PublicAssistDetails> entities);
+
+    /**
+     * 修改数据
+     *
+     * @param publicAssistDetails 实例对象
+     * @return 影响行数
+     */
+    int update(PublicAssistDetails publicAssistDetails);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 影响行数
+     */
+    int deleteById(Integer id);
+
+}
+

+ 131 - 0
src/main/java/com/goafanti/common/mapper/PublicAssistDetailsMapper.xml

@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.goafanti.common.dao.PublicAssistDetailsMapper">
+
+    <resultMap type="com.goafanti.common.model.PublicAssistDetails" id="PublicAssistDetailsMap">
+        <result property="id" column="id" jdbcType="INTEGER"/>
+        <result property="prid" column="prid" jdbcType="INTEGER"/>
+        <result property="type" column="type" jdbcType="INTEGER"/>
+        <result property="contentType" column="content_type" jdbcType="INTEGER"/>
+        <result property="content" column="content" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="PublicAssistDetailsAllSql">
+        id, prid, type, content_type, content
+    </sql>
+
+    <!--查询单个-->
+    <select id="selectById" resultMap="PublicAssistDetailsMap">
+        select
+        <include refid="PublicAssistDetailsAllSql"/>
+        from public_assist_details
+        where id = #{id}
+    </select>
+
+    <!--新增所有列-->
+    <insert id="insert" keyProperty="id" useGeneratedKeys="true">
+        insert into public_assist_details(prid, type, content_type, content)
+        values (#{prid}, #{type}, #{contentType}, #{content})
+    </insert>
+
+    <insert id="insertBatch">
+        insert into public_assist_details(prid, type, content_type, content)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.prid}, #{entity.type}, #{entity.contentType}, #{entity.content})
+        </foreach>
+    </insert>
+
+    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
+        insert into public_assist_details(prid, type, content_type, content)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.prid}, #{entity.type}, #{entity.contentType}, #{entity.content})
+        </foreach>
+        on duplicate key update
+        prid = values(prid),
+        type = values(type),
+        content_type = values(content_type),
+        content = values(content)
+    </insert>
+
+    <!--通过主键修改数据-->
+    <update id="update">
+        update public_assist_details
+        <set>
+            <if test="prid != null">
+                prid = #{prid},
+            </if>
+            <if test="type != null">
+                type = #{type},
+            </if>
+            <if test="contentType != null">
+                content_type = #{contentType},
+            </if>
+            <if test="content != null and content != ''">
+                content = #{content},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <!--查询指定行数据-->
+    <select id="findPublicAssistDetailsList" resultMap="PublicAssistDetailsMap">
+        select
+        <include refid="PublicAssistDetailsAllSql"/>
+
+        from public_assist_details
+        <where>
+            <if test="id != null">
+                and id = #{id}
+            </if>
+            <if test="prid != null">
+                and prid = #{prid}
+            </if>
+            <if test="type != null">
+                and type = #{type}
+            </if>
+            <if test="contentType != null">
+                and content_type = #{contentType}
+            </if>
+            <if test="content != null and content != ''">
+                and content = #{content}
+            </if>
+        </where>
+        <if test="page_sql != null">
+            ${page_sql}
+        </if>
+    </select>
+
+    <!--统计总行数-->
+    <select id="findPublicAssistDetailsCount" resultType="java.lang.Integer">
+        select count(1)
+        from public_assist_details
+        <where>
+            <if test="id != null">
+                and id = #{id}
+            </if>
+            <if test="prid != null">
+                and prid = #{prid}
+            </if>
+            <if test="type != null">
+                and type = #{type}
+            </if>
+            <if test="contentType != null">
+                and content_type = #{contentType}
+            </if>
+            <if test="content != null and content != ''">
+                and content = #{content}
+            </if>
+        </where>
+    </select>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete
+        from public_assist_details
+        where id = #{id}
+    </delete>
+
+</mapper>
+

+ 75 - 0
src/main/java/com/goafanti/common/model/PublicAssistDetails.java

@@ -0,0 +1,75 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+
+
+/**
+ * 公出协单详情表(PublicAssistDetails)实体类
+ *
+ * @author makejava
+ * @since 2026-01-16 14:04:42
+ */
+public class PublicAssistDetails implements Serializable {
+    private static final long serialVersionUID = -18990904381372183L;
+
+    private Integer id;
+    /**
+     * 公出详情编号
+     */
+    private Integer prid;
+    /**
+     * 分类 0=其他,1=高企认定,2=会员服务,3=科技项目,4=研动力系统,5=知识产权,6=军工,7=涉密,8=技术合同登记,9=第三方认证项目
+     */
+    private Integer type;
+    /**
+     * 内容 0=其他,1=会议,2=写方案,3=接待
+     */
+    private Integer contentType;
+    /**
+     * 内容说明
+     */
+    private String content;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getPrid() {
+        return prid;
+    }
+
+    public void setPrid(Integer prid) {
+        this.prid = prid;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Integer getContentType() {
+        return contentType;
+    }
+
+    public void setContentType(Integer contentType) {
+        this.contentType = contentType;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+}
+

+ 28 - 0
src/main/java/com/goafanti/weChat/bo/InputPublicRelease.java

@@ -67,6 +67,34 @@ public class InputPublicRelease extends PublicRelease {
 
 	private String uais;
 
+	private Integer assistType;
+	private Integer assistContentType;
+	private String assistContent;
+
+	public Integer getAssistType() {
+		return assistType;
+	}
+
+	public void setAssistType(Integer assistType) {
+		this.assistType = assistType;
+	}
+
+	public Integer getAssistContentType() {
+		return assistContentType;
+	}
+
+	public void setAssistContentType(Integer assistContentType) {
+		this.assistContentType = assistContentType;
+	}
+
+	public String getAssistContent() {
+		return assistContent;
+	}
+
+	public void setAssistContent(String assistContent) {
+		this.assistContent = assistContent;
+	}
+
 	public String getUais() {
 		return uais;
 	}

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

@@ -54,14 +54,25 @@ public class AdminReleaseApiController extends CertifyApiController{
 			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"公出地点"));
 			return res;
 		}
-		int i = publicReleaseService.checkTime(in);
-		if (i==1) {
-			res.getError().add(buildError("发起人公出时段已经被使用!","发起人公出时段已经被使用!"));
-			return res;
-		}
-		if (i==2) {
-			res.getError().add(buildError("协单人公出时段已经被使用!","协单人公出时段已经被使用!"));
-			return res;
+		//新增5和6非公出协单,不用判断公出时间
+		if (in.getType()<4){
+			int i = publicReleaseService.checkTime(in);
+			if (i==1) {
+				res.getError().add(buildError("发起人公出时段已经被使用!","发起人公出时段已经被使用!"));
+				return res;
+			}
+			if (i==2) {
+				res.getError().add(buildError("协单人公出时段已经被使用!","协单人公出时段已经被使用!"));
+				return res;
+			}
+		}else{
+			if (in.getAssistType()==null){
+				res.getError().add(buildError("请选择协单类型!"));
+				return res;
+			}
+			if (in.getAssistContentType()==null){
+				res.getError().add(buildError("请选择协单内容"));
+			}
 		}
 		if(in.getAssist()==null)in.setAssist(0);
 		if (in.getAssist()==1&&in.getAssistAid()==null) {

+ 13 - 1
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -105,6 +105,9 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	@Autowired
 	private UserInterviewProjectMapper userInterviewProjectMapper;
 
+	@Autowired
+	private PublicAssistDetailsMapper publicAssistDetailsMapper;
+
 	@Override
 	@Transactional
 	public Map<String, Object> addPublicRelease(InputPublicRelease in) {
@@ -138,6 +141,15 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		}
 		in.setProcessStatus(1);
 		publicReleaseMapper.insertSelective(in);
+		//如果是非公出协单添加协单信息
+		if (in.getType()==5){
+			PublicAssistDetails pad=new PublicAssistDetails();
+			pad.setPrid(in.getId());
+			pad.setType(in.getAssistType());
+			pad.setContentType(in.getAssistContentType());
+			pad.setContent(in.getAssistContent());
+			publicAssistDetailsMapper.insert(pad);
+		}
 		if (in.getType()==1&&in.getOrderNo()!=null){
 			TOrderNew tOrderNew = tOrderNewMapper.queryById(in.getOrderNo());
 			orderNewService.pushOrderPublicReleaseCount(tOrderNew);
@@ -228,7 +240,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	}
 
 	private void addPRD(InputPublicRelease in, List<User> users, StringBuilder str, List<PublicReleaseDetails> prdList) {
-
+		List<PublicAssistDetails> listAd=new ArrayList<>();
 		if (in.getUids()!=null){
 			List<String> split = Arrays.asList(in.getUids().split(","));
 			int userCount=split.size();