Browse Source

[fix]

基础资料 出差单
修改出差单实体类,修改各出差时间为String类型;
新增出差单人事录入出行费用、人事核准、作废和恢复controller接口;
新增出差单mapper作废理由字段,修改相应方法;
dev
王晓迪 1 month ago
parent
commit
4861591848
  1. 74
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseEvectionFormController.java
  2. 26
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/BaseEvectionForm.java
  3. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/service/IBaseEvectionFormService.java
  4. 48
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseEvectionFormServiceImpl.java
  5. 10
      ruoyi-admin/src/main/resources/mapper/system/BaseEvectionFormMapper.xml

74
ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseEvectionFormController.java

@ -3,9 +3,11 @@ package com.ruoyi.system.controller;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.system.domain.Vo.BaseEvectionFormVo; import com.ruoyi.system.domain.Vo.BaseEvectionFormVo;
import com.ruoyi.system.domain.Vo.BaseExpenseAccountVo; import com.ruoyi.system.domain.Vo.BaseExpenseAccountVo;
import com.ruoyi.system.domain.Vo.OutsourceOrderVO;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import org.activiti.engine.RuntimeService; import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
@ -148,9 +150,18 @@ public class BaseEvectionFormController extends BaseController
String instanceId = baseEvectionFormVo.getInstanceId(); String instanceId = baseEvectionFormVo.getInstanceId();
String instanceType = baseEvectionFormVo.getInstanceType(); String instanceType = baseEvectionFormVo.getInstanceType();
// 判断任务节点
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
String verifyName = task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1);
boolean approvedFlag = processService.complete(taskId, instanceId, baseEvectionFormVo.getApplyTitle(), boolean approvedFlag = processService.complete(taskId, instanceId, baseEvectionFormVo.getApplyTitle(),
baseEvectionFormVo.getEvectionCode(), baseEvectionFormVo.getEvectionCode(),
"evection", new HashMap<String, Object>(), request); "evection", new HashMap<String, Object>(), request);
if(verifyName.equals("ModifyApply")){
//驳回调整,设置为待审核
baseEvectionFormVo.setAuditStatus("0");
baseEvectionFormVo.setApplyTime(DateUtils.getNowDate());
}
if(!approvedFlag){ if(!approvedFlag){
// 审核状态-审核拒绝 // 审核状态-审核拒绝
baseEvectionFormVo.setAuditStatus("2"); baseEvectionFormVo.setAuditStatus("2");
@ -195,6 +206,50 @@ public class BaseEvectionFormController extends BaseController
mmap.put("baseEvectionForm", baseEvectionForm); mmap.put("baseEvectionForm", baseEvectionForm);
return prefix + "/edit"; return prefix + "/edit";
} }
/**
* 人事录入出差单费用等
*/
@GetMapping("/hrRecord/{evectionId}")
public String hrRecord(@PathVariable("evectionId") Long evectionId, ModelMap mmap)
{
BaseEvectionForm baseEvectionForm = baseEvectionFormService.selectBaseEvectionFormById(evectionId);
mmap.put("baseEvectionForm", baseEvectionForm);
return prefix + "/hrRecord";
}
//人事录入出行费用
@RequiresPermissions("system:baseEvectionForm:hrRecord")
@PostMapping("/hrRecord")
@ResponseBody
public AjaxResult hrRecordSave(BaseEvectionForm baseEvectionForm)
{
baseEvectionForm.setPersonnelAdministration("1");//已录入
baseEvectionFormService.updateBaseEvectionForm(baseEvectionForm);
return AjaxResult.success();
}
/**
* 人事核准
*/
@GetMapping("/hrApprove/{evectionId}")
public String hrApprove(@PathVariable("evectionId") Long evectionId, ModelMap mmap)
{
BaseEvectionForm baseEvectionForm = baseEvectionFormService.selectBaseEvectionFormById(evectionId);
mmap.put("baseEvectionForm", baseEvectionForm);
return prefix + "/hrApprove";
}
//人事录入出行费用
@RequiresPermissions("system:baseEvectionForm:hrApprove")
@PostMapping("/hrApprove")
@ResponseBody
public AjaxResult hrApproveSave(BaseEvectionForm baseEvectionForm)
{
baseEvectionForm.setPersonnelAdministration("2");//已核准
baseEvectionFormService.updateBaseEvectionForm(baseEvectionForm);
return AjaxResult.success();
}
@GetMapping("/detail/{id}") @GetMapping("/detail/{id}")
public String detail(@PathVariable("id") Long id, ModelMap mmap) public String detail(@PathVariable("id") Long id, ModelMap mmap)
{ {
@ -226,17 +281,26 @@ public class BaseEvectionFormController extends BaseController
return toAjax(baseEvectionFormService.deleteBaseEvectionFormByIds(ids)); return toAjax(baseEvectionFormService.deleteBaseEvectionFormByIds(ids));
} }
/**
* 加载作废出差单信息弹窗
*/
@GetMapping("/cancel/{id}")
public String cancel(@PathVariable("id") Long id, ModelMap mmap) {
BaseEvectionForm baseEvectionForm = baseEvectionFormService.selectBaseEvectionFormById(id);
mmap.put("baseEvectionForm", baseEvectionForm);
return prefix + "/cancel";
}
/** /**
* 作废出差单 * 作废出差单
*/ */
@RequiresPermissions("system:baseEvectionForm:cancel") @RequiresPermissions("system:baseEvectionForm:cancel")
@Log(title = "出差单", businessType = BusinessType.CANCEL) @Log(title = "出差单", businessType = BusinessType.CANCEL)
@GetMapping( "/cancel/{id}") @PostMapping( "/cancel")
@ResponseBody @ResponseBody
public AjaxResult cancel(@PathVariable("id") Long id){ public AjaxResult cancel(BaseEvectionForm baseEvectionForm){
return toAjax(baseEvectionFormService.cancelBaseEvectionFormById(id)); return toAjax(baseEvectionFormService.cancelBaseEvectionFormByObject(baseEvectionForm));
} }
/** /**
* 恢复出差单 * 恢复出差单
*/ */
@ -253,6 +317,6 @@ public class BaseEvectionFormController extends BaseController
@ResponseBody @ResponseBody
public AjaxResult getId() public AjaxResult getId()
{ {
return AjaxResult.success(baseEvectionFormService.getId()); return AjaxResult.success(baseEvectionFormService.getId());
} }
} }

26
ruoyi-admin/src/main/java/com/ruoyi/system/domain/BaseEvectionForm.java

@ -1,5 +1,6 @@
package com.ruoyi.system.domain; package com.ruoyi.system.domain;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -67,11 +68,12 @@ public class BaseEvectionForm extends BaseEntity
/** 出差时间 */ /** 出差时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "UTC")
@Excel(name = "预计出差开始时间") @Excel(name = "预计出差开始时间")
private Date evectionBeginTime; private String evectionBeginTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "预计出差结束时间") @Excel(name = "预计出差结束时间")
private Date evectionEndTime; private String evectionEndTime;
/** 派工单号 */ /** 派工单号 */
@Excel(name = "派工单号") @Excel(name = "派工单号")
@ -104,11 +106,11 @@ public class BaseEvectionForm extends BaseEntity
/** 实际出差时间 */ /** 实际出差时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "实际出差时间") @Excel(name = "实际出差时间")
private Date realityEvenctionBeginTime; private String realityEvenctionBeginTime;
/** 实际出差时间 */ /** 实际出差时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "实际出差时间") @Excel(name = "实际出差时间")
private Date realityEvenctionEndTime; private String realityEvenctionEndTime;
/** 申请人 */ /** 申请人 */
@Excel(name = "申请人") @Excel(name = "申请人")
@ -303,19 +305,19 @@ public class BaseEvectionForm extends BaseEntity
return evectionCauses; return evectionCauses;
} }
public Date getEvectionBeginTime() { public String getEvectionBeginTime() {
return evectionBeginTime; return evectionBeginTime;
} }
public void setEvectionBeginTime(Date evectionBeginTime) { public void setEvectionBeginTime(String evectionBeginTime) {
this.evectionBeginTime = evectionBeginTime; this.evectionBeginTime = evectionBeginTime;
} }
public Date getEvectionEndTime() { public String getEvectionEndTime() {
return evectionEndTime; return evectionEndTime;
} }
public void setEvectionEndTime(Date evectionEndTime) { public void setEvectionEndTime(String evectionEndTime) {
this.evectionEndTime = evectionEndTime; this.evectionEndTime = evectionEndTime;
} }
@ -383,19 +385,19 @@ public class BaseEvectionForm extends BaseEntity
return otherExpensesBudget; return otherExpensesBudget;
} }
public Date getRealityEvenctionBeginTime() { public String getRealityEvenctionBeginTime() {
return realityEvenctionBeginTime; return realityEvenctionBeginTime;
} }
public void setRealityEvenctionBeginTime(Date realityEvenctionBeginTime) { public void setRealityEvenctionBeginTime(String realityEvenctionBeginTime) {
this.realityEvenctionBeginTime = realityEvenctionBeginTime; this.realityEvenctionBeginTime = realityEvenctionBeginTime;
} }
public Date getRealityEvenctionEndTime() { public String getRealityEvenctionEndTime() {
return realityEvenctionEndTime; return realityEvenctionEndTime;
} }
public void setRealityEvenctionEndTime(Date realityEvenctionEndTime) { public void setRealityEvenctionEndTime(String realityEvenctionEndTime) {
this.realityEvenctionEndTime = realityEvenctionEndTime; this.realityEvenctionEndTime = realityEvenctionEndTime;
} }

4
ruoyi-admin/src/main/java/com/ruoyi/system/service/IBaseEvectionFormService.java

@ -65,10 +65,10 @@ public interface IBaseEvectionFormService
/** /**
* 作废出差单 * 作废出差单
* @param evectionId 出差单ID * @param baseEvectionForm 出差单
* @return * @return
*/ */
int cancelBaseEvectionFormById(Long evectionId); int cancelBaseEvectionFormByObject(BaseEvectionForm baseEvectionForm);
/** /**
* 恢复出差单 * 恢复出差单

48
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseEvectionFormServiceImpl.java

@ -21,6 +21,7 @@ import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper;
import com.ruoyi.system.domain.BaseExpenseAccount; import com.ruoyi.system.domain.BaseExpenseAccount;
import com.ruoyi.system.domain.Vo.BaseEvectionFormVo; import com.ruoyi.system.domain.Vo.BaseEvectionFormVo;
import com.ruoyi.system.domain.Vo.BaseExpenseAccountVo; import com.ruoyi.system.domain.Vo.BaseExpenseAccountVo;
import com.ruoyi.system.domain.Vo.OutsourceOrderVO;
import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.IBaseExpenseAccountService; import com.ruoyi.system.service.IBaseExpenseAccountService;
import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysRoleService;
@ -220,13 +221,33 @@ public class BaseEvectionFormServiceImpl implements IBaseEvectionFormService
/** /**
* 作废出差单 * 作废出差单
* *
* @param evectionId 出差单ID * @param baseEvectionForm 出差单
* @return 结果 * @return 结果
*/ */
@Override @Override
public int cancelBaseEvectionFormById(Long evectionId) public int cancelBaseEvectionFormByObject(BaseEvectionForm baseEvectionForm)
{ {
return baseEvectionFormMapper.cancelBaseEvectionFormById(evectionId); BaseEvectionForm baseEvectionFormVo = baseEvectionFormMapper.selectBaseEvectionFormById(baseEvectionForm.getEvectionId());
// 审核状态-待审核
baseEvectionFormVo.setAuditStatus("0");
SysUser user = ShiroUtils.getSysUser();
// 启动流程
String applyTitle = user.getUserName()+"发起了出差单作废审批-"+DateUtils.dateTimeNow();
String instanceType = "cancel";
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,baseEvectionFormVo, user);
String processInstanceId = processInstance.getProcessInstanceId();
// 作废实例id
baseEvectionFormVo.setCancelInstanceId(processInstanceId);
// 存在提交完就流程结束的情况
boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId);
if(processIsFinish){
// 审核状态-审核通过
baseEvectionFormVo.setAuditStatus("1");
// 使用状态-已作废
baseEvectionFormVo.setUseStatus("2");
}
baseEvectionFormVo.setCancelRemark(baseEvectionForm.getCancelRemark());
return baseEvectionFormMapper.updateBaseEvectionForm(baseEvectionFormVo);
} }
/** /**
@ -238,7 +259,26 @@ public class BaseEvectionFormServiceImpl implements IBaseEvectionFormService
@Override @Override
public int restoreBaseEvectionFormById(Long evectionId) public int restoreBaseEvectionFormById(Long evectionId)
{ {
return baseEvectionFormMapper.restoreBaseEvectionFormById(evectionId); BaseEvectionForm baseEvectionForm = baseEvectionFormMapper.selectBaseEvectionFormById(evectionId);
// 审核状态-待审核
baseEvectionForm.setAuditStatus("0");
SysUser user = ShiroUtils.getSysUser();
// 启动流程
String applyTitle = user.getUserName()+"发起了出差单恢复审批-"+DateUtils.dateTimeNow();
String instanceType = "restore";
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,baseEvectionForm, user);
String processInstanceId = processInstance.getProcessInstanceId();
// 恢复实例id
baseEvectionForm.setRestoreInstanceId(processInstanceId);
// 存在提交完就流程结束的情况
boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId);
if(processIsFinish){
// 审核状态-审核通过
baseEvectionForm.setAuditStatus("1");
// 使用状态-是
baseEvectionForm.setUseStatus("1");
}
return baseEvectionFormMapper.updateBaseEvectionForm(baseEvectionForm);
} }
@Override @Override
public Object getId() { public Object getId() {

10
ruoyi-admin/src/main/resources/mapper/system/BaseEvectionFormMapper.xml

@ -33,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="cancelRemark" column="cancel_remark" />
<result property="instanceId" column="instance_id" /> <result property="instanceId" column="instance_id" />
<result property="instanceType" column="instance_type" /> <result property="instanceType" column="instance_type" />
<result property="instanceTypeName" column="instance_type_name" /> <result property="instanceTypeName" column="instance_type_name" />
@ -51,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
travel_mode,hotel,transportation_cost_budget,accommodation_budget,other_expenses_budget, travel_mode,hotel,transportation_cost_budget,accommodation_budget,other_expenses_budget,
reality_evenction_begin_time,reality_evenction_end_time,create_by,create_time,update_by, reality_evenction_begin_time,reality_evenction_end_time,create_by,create_time,update_by,
update_time,remark,instance_id,instance_type,submit_instance_id,cancel_instance_id, update_time,remark,instance_id,instance_type,submit_instance_id,cancel_instance_id,
restore_instance_id,apply_title,apply_user,apply_time restore_instance_id,apply_title,apply_user,apply_time,cancel_remark
from base_evection_form from base_evection_form
</sql> </sql>
@ -60,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if> <if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if> <if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if>
<if test="evectionCode != null and evectionCode != ''"> and evection_code = #{evectionCode}</if> <if test="evectionCode != null and evectionCode != ''"> and evection_code like concat('%', #{evectionCode}, '%')</if>
<if test="evectionAddr != null and evectionAddr != ''"> and evection_addr = #{evectionAddr}</if> <if test="evectionAddr != null and evectionAddr != ''"> and evection_addr = #{evectionAddr}</if>
<if test="evectionDetailAddr != null and evectionDetailAddr != ''"> and evection_detail_addr = #{evectionDetailAddr}</if> <if test="evectionDetailAddr != null and evectionDetailAddr != ''"> and evection_detail_addr = #{evectionDetailAddr}</if>
<if test="evectionCauses != null and evectionCauses != ''"> and evection_causes = #{evectionCauses}</if> <if test="evectionCauses != null and evectionCauses != ''"> and evection_causes = #{evectionCauses}</if>
@ -75,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="applyTitle != null and applyTitle != ''"> and apply_title = #{applyTitle}</if> <if test="applyTitle != null and applyTitle != ''"> and apply_title = #{applyTitle}</if>
<if test="applyUser != null and applyUser != ''"> and apply_user = #{applyUser}</if> <if test="applyUser != null and applyUser != ''"> and apply_user = #{applyUser}</if>
<if test="applyTime != null "> and apply_time = #{applyTime}</if> <if test="applyTime != null "> and apply_time = #{applyTime}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if> <if test="params.beginApplyTime != null and params.beginApplyTime != '' and params.endApplyTime != null and params.endApplyTime != ''"> and Date(apply_time) between #{params.beginApplyTime} and #{params.endApplyTime}</if>
</where> </where>
order by audit_status asc, create_time desc order by audit_status asc, create_time desc
</select> </select>
@ -182,12 +183,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="transportationCostBudget != null">transportation_cost_budget = #{transportationCostBudget},</if> <if test="transportationCostBudget != null">transportation_cost_budget = #{transportationCostBudget},</if>
<if test="accommodationBudget != null">accommodation_budget = #{accommodationBudget},</if> <if test="accommodationBudget != null">accommodation_budget = #{accommodationBudget},</if>
<if test="otherExpensesBudget != null">other_expenses_budget = #{otherExpensesBudget},</if> <if test="otherExpensesBudget != null">other_expenses_budget = #{otherExpensesBudget},</if>
<if test="realityEvenctionBeginTime != null">reality_evenction_begin_time = #{realityEvenctionBeginTime},</if>
<if test="realityEvenctionEndTime != null">reality_evenction_end_time = #{realityEvenctionEndTime},</if>
<if test="applyUser != null">apply_user = #{applyUser},</if> <if test="applyUser != null">apply_user = #{applyUser},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="cancelRemark != null">cancel_remark = #{cancelRemark},</if>
<if test="instanceId != null">instance_id = #{instanceId},</if> <if test="instanceId != null">instance_id = #{instanceId},</if>
<if test="instanceType != null">instance_type = #{instanceType},</if> <if test="instanceType != null">instance_type = #{instanceType},</if>
<if test="submitInstanceId != null">submit_instance_id = #{submitInstanceId},</if> <if test="submitInstanceId != null">submit_instance_id = #{submitInstanceId},</if>

Loading…
Cancel
Save