anderx лет назад: 3
Родитель
Сommit
dd00befa5d

+ 1 - 0
src/main/java/com/goafanti/common/dao/TOrderTaskMapper.java

@@ -81,4 +81,5 @@ public interface TOrderTaskMapper {
 
     Integer getSplitCount(Integer tid);
 
+
 }

+ 7 - 1
src/main/java/com/goafanti/common/dao/TaskSoptMapper.java

@@ -2,6 +2,8 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.TaskSopt;
 
+import java.util.List;
+
 public interface TaskSoptMapper {
     int deleteByPrimaryKey(Long id);
 
@@ -14,4 +16,8 @@ public interface TaskSoptMapper {
     int updateByPrimaryKeySelective(TaskSopt record);
 
     int updateByPrimaryKey(TaskSopt record);
-}
+
+    void insertList(List<TaskSopt> list);
+
+    TaskSopt selectByTid(Integer tid);
+}

+ 39 - 8
src/main/java/com/goafanti/common/mapper/TaskSoptMapper.xml

@@ -7,25 +7,27 @@
     <result column="status" jdbcType="INTEGER" property="status" />
     <result column="create_by" jdbcType="VARCHAR" property="createBy" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="tid" jdbcType="INTEGER" property="tid" />
   </resultMap>
   <sql id="Base_Column_List">
-    id, `type`, `status`, create_by, create_time
+    id, `type`, `status`, create_by, create_time, tid
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select 
+    select
     <include refid="Base_Column_List" />
     from task_sopt
     where id = #{id,jdbcType=BIGINT}
   </select>
+
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     delete from task_sopt
     where id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TaskSopt" useGeneratedKeys="true">
-    insert into task_sopt (`type`, `status`, create_by, 
-      create_time)
-    values (#{type,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR}, 
-      #{createTime,jdbcType=TIMESTAMP})
+    insert into task_sopt (`type`, `status`, create_by,
+      create_time, tid)
+    values (#{type,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR},
+      #{createTime,jdbcType=TIMESTAMP}, #{tid,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TaskSopt" useGeneratedKeys="true">
     insert into task_sopt
@@ -42,6 +44,9 @@
       <if test="createTime != null">
         create_time,
       </if>
+      <if test="tid != null">
+        tid,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="type != null">
@@ -56,6 +61,9 @@
       <if test="createTime != null">
         #{createTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="tid != null">
+        #{tid,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TaskSopt">
@@ -73,6 +81,9 @@
       <if test="createTime != null">
         create_time = #{createTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="tid != null">
+        tid = #{tid,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -81,7 +92,27 @@
     set `type` = #{type,jdbcType=INTEGER},
       `status` = #{status,jdbcType=INTEGER},
       create_by = #{createBy,jdbcType=VARCHAR},
-      create_time = #{createTime,jdbcType=TIMESTAMP}
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      tid = #{tid,jdbcType=INTEGER}
     where id = #{id,jdbcType=BIGINT}
   </update>
-</mapper>
+
+  <insert id="insertList">
+    insert into task_sopt (`type`, `status`,tid, create_by,
+    create_time)
+    values (#{type,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR},
+    #{createTime,jdbcType=TIMESTAMP})
+    values
+    <foreach item="item" collection="list" separator="," index="">
+      (#{item.type,jdbcType=INTEGER}, #{item.status,jdbcType=INTEGER},#{tid,jdbcType=INTEGER},
+          #{item.createBy,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP})
+    </foreach>
+  </insert>
+
+  <select id="selectByTid"  parameterType="java.lang.Long" resultMap="BaseResultMap">
+  select
+  <include refid="Base_Column_List" />
+  from task_sopt
+  where tid = #{tid} and status in (0,2)
+  </select>
+</mapper>

+ 13 - 0
src/main/java/com/goafanti/common/model/TaskSopt.java

@@ -30,6 +30,11 @@ public class TaskSopt implements Serializable {
      */
     private Date createTime;
 
+    /**
+     * 任务编号
+     */
+    private Integer tid;
+
     private static final long serialVersionUID = 1L;
 
     public Long getId() {
@@ -71,4 +76,12 @@ public class TaskSopt implements Serializable {
     public void setCreateTime(Date createTime) {
         this.createTime = createTime;
     }
+
+    public Integer getTid() {
+        return tid;
+    }
+
+    public void setTid(Integer tid) {
+        this.tid = tid;
+    }
 }

+ 44 - 0
src/main/java/com/goafanti/order/bo/InputProjectSotp.java

@@ -0,0 +1,44 @@
+package com.goafanti.order.bo;
+
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.utils.Param;
+
+import javax.validation.constraints.NotNull;
+
+public class InputProjectSotp {
+
+    @Param(name="编号")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private String ids;
+    @Param(name="原因")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private String reason;
+    @Param(name="附件")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private String annexUrl;
+
+
+    public String getIds() {
+        return ids;
+    }
+
+    public void setIds(String ids) {
+        this.ids = ids;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public String getAnnexUrl() {
+        return annexUrl;
+    }
+
+    public void setAnnexUrl(String annexUrl) {
+        this.annexUrl = annexUrl;
+    }
+}

+ 16 - 0
src/main/java/com/goafanti/order/controller/OrderProjectApiController.java

@@ -11,11 +11,13 @@ import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
 import com.goafanti.common.model.TOrderTask;
+import com.goafanti.common.utils.ParamUtils;
 import com.goafanti.order.bo.*;
 import com.goafanti.order.service.OrderNewService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -629,4 +631,18 @@ public class OrderProjectApiController extends CertifyApiController {
 		return res.data(orderProjectService.deleteMemberSonProject( id));
 	}
 
+	/**
+	 * 项目暂停
+	 *
+	 */
+	@RequestMapping(value = "/addProjectSotp" ,method = RequestMethod.POST)
+	public Result addProjectSotp(@Validated InputProjectSotp in,BindingResult bindingResult){
+		Result res = new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					ParamUtils.getParamName(in,bindingResult.getFieldError().getField())));
+			return res;
+		}
+		return res.data(orderProjectService.addProjectSotp( in));
+	}
 }

+ 3 - 0
src/main/java/com/goafanti/order/service/OrderProjectService.java

@@ -134,4 +134,7 @@ public interface OrderProjectService {
 	Integer getOrderProcessStatus(String orderNo);
 
     void updateMidServiceProject(String orderNo);
+
+    Object addProjectSotp(InputProjectSotp in);
+
 }

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

@@ -4,12 +4,7 @@ import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
 
 import javax.mail.MessagingException;
 
@@ -51,6 +46,8 @@ import com.goafanti.order.service.OrderProjectService;
 import com.goafanti.organization.bo.OutPaymentNode;
 import com.goafanti.techproject.enums.TaskState;
 
+import static javafx.scene.input.KeyCode.L;
+
 @Service
 public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> implements OrderProjectService {
 	@Autowired
@@ -123,6 +120,9 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 	private OrderExamineMapper orderExamineMapper;
 	@Autowired
 	private NewOrderChangeMapper newOrderChangeMapper;
+	@Autowired
+	private TaskSoptMapper taskSoptMapper;
+
 
 	@Value(value = "${upload.path}")
 	private String 					uploadPath 			= null;
@@ -1457,5 +1457,29 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		}
 	}
 
+	@Override
+	public Object addProjectSotp(InputProjectSotp in) {
+		String[] split = in.getIds().split(",");
+		List<TaskSopt> list =new ArrayList<>();
+		Date date = new Date();
+		String adminId = TokenManager.getAdminId();
+		for (String s : split) {
+			Integer id=Integer.valueOf(s);
+			TaskSopt use = taskSoptMapper.selectByTid(id);
+			if (use!=null){
+				throw new BusinessException(String.format("项目[%s]暂停已存在,请先走完流程"));
+			}
+			TaskSopt taskSopt = new TaskSopt();
+			taskSopt.setTid(Integer.valueOf(s));
+			taskSopt.setStatus(0);
+			taskSopt.setStatus(0);
+			taskSopt.setCreateBy(adminId);
+			taskSopt.setCreateTime(date);
+			list.add(taskSopt);
+		}
+		taskSoptMapper.insertList(list);
+		return 1;
+	}
+
 
 }