Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

jz.kai 1 gadu atpakaļ
vecāks
revīzija
cceb03f646

+ 14 - 0
common/src/main/java/com/jpsoft/employment/modules/base/entity/VolunteerSignRecord.java

@@ -4,6 +4,8 @@ import java.io.Serializable;
 import java.util.Date;
 import java.text.SimpleDateFormat;
 import java.math.BigDecimal;
+
+import org.springframework.data.annotation.Transient;
 import org.springframework.format.annotation.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
@@ -49,5 +51,17 @@ public class VolunteerSignRecord {
 	
 			@ApiModelProperty(value = "是否删除")
 	private Boolean delFlag;
+
+	@ApiModelProperty(value = "状态(1:进行中,2:完成,3:取消)")
+	private String status;
+
+	@ApiModelProperty(value = "完成时间")
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	private Date completionTime;
+
+	@Transient
+	@ApiModelProperty(value = "状态(1:进行中,2:完成,3:取消)翻译")
+	private String statusN;
 	
 		}

+ 14 - 1
common/src/main/resources/mapper/base/VolunteerSignRecord.xml

@@ -14,6 +14,8 @@
 			<result property="updateBy" column="update_by" />
 			<result property="updateTime" column="update_time" />
 			<result property="delFlag" column="del_flag" />
+			<result property="status" column="status_" />
+			<result property="completionTime" column="completion_time" />
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.employment.modules.base.entity.VolunteerSignRecord">
 	<!--
@@ -23,7 +25,7 @@
 	-->
 	<![CDATA[
 		insert into base_volunteer_sign_record
-	    (id_,name_,phone_,bak_,volunteer_tasks_id,create_by,create_time,update_by,update_time,del_flag)
+	    (id_,name_,phone_,bak_,volunteer_tasks_id,create_by,create_time,update_by,update_time,del_flag,status_,completion_time)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -36,6 +38,8 @@
 ,#{updateBy,jdbcType=VARCHAR}
 ,#{updateTime,jdbcType= TIMESTAMP }
 ,#{delFlag,jdbcType= NUMERIC }
+,#{status,jdbcType=VARCHAR}
+,#{completionTime,jdbcType= TIMESTAMP }
 		)
 	]]>
 	</insert>
@@ -72,6 +76,15 @@
 				<if test="delFlag!=null">
 		del_flag=#{delFlag,jdbcType= NUMERIC },
 		</if>
+			<if test="status!=null">
+				status_=#{status,jdbcType=VARCHAR},
+			</if>
+			<if test="completionTime!=null">
+				completion_time=#{completionTime,jdbcType= TIMESTAMP },
+			</if>
+			<if test="completionTime==null">
+				completion_time = null,
+			</if>
 		</set>
 	where id_=#{id}
 	</update>

+ 49 - 0
web/src/main/java/com/jpsoft/employment/modules/base/controller/VolunteerSignRecordController.java

@@ -6,6 +6,7 @@ import com.jpsoft.employment.modules.common.utils.PojoUtils;
 import com.jpsoft.employment.modules.common.dto.Sort;
 import com.jpsoft.employment.modules.base.entity.VolunteerSignRecord;
 import com.jpsoft.employment.modules.base.service.VolunteerSignRecordService;
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.mapping.ResultMap;
@@ -25,6 +26,9 @@ public class VolunteerSignRecordController {
 
     @Autowired
     private VolunteerSignRecordService volunteerSignRecordService;
+
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
 	
 	
 	@ApiOperation(value="创建空记录")
@@ -219,10 +223,55 @@ public class VolunteerSignRecordController {
 
         Page<VolunteerSignRecord> page = volunteerSignRecordService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
 
+        for (VolunteerSignRecord volunteerSignRecord:page) {
+            String statusN = dataDictionaryService.findNameByCatalogNameAndValue("参与项目状态",volunteerSignRecord.getStatus());
+            if(StringUtils.isNotEmpty(statusN)){
+                volunteerSignRecord.setStatusN(statusN);
+            }
+
+        }
 
         msgResult.setResult(true);
         msgResult.setData(PojoUtils.pageWrapper(page));
 
         return msgResult;
     }
+
+
+    @ApiOperation(value="更改状态")
+    @PostMapping("changeStatus")
+    public MessageResult<VolunteerSignRecord> changeStatus(String id,String status,@RequestAttribute String subject){
+        MessageResult<VolunteerSignRecord> msgResult = new MessageResult<>();
+
+        try {
+            Date now = new Date();
+            VolunteerSignRecord volunteerSignRecord = volunteerSignRecordService.get(id);
+            volunteerSignRecord.setStatus(status);
+            if(status.equals("2")){
+                volunteerSignRecord.setCompletionTime(now);
+            }
+            else{
+                volunteerSignRecord.setCompletionTime(null);
+            }
+            volunteerSignRecord.setUpdateBy(subject);
+            volunteerSignRecord.setUpdateTime(new Date());
+
+            int affectCount = volunteerSignRecordService.update(volunteerSignRecord);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库修改失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }