获取领料申请-详情列表

This commit is contained in:
sliang 2023-12-22 14:48:58 +08:00
parent 7f1e051e42
commit 6d642b7edf
7 changed files with 128 additions and 24 deletions

View File

@ -105,6 +105,12 @@ public class LeaseApplyDetails implements Serializable {
@ApiModelProperty(value = "备注")
private String remark;
/**
* 计量单位
*/
@ApiModelProperty(value = "计量单位")
private String unitName;
/**
* 设备所属类型
*/

View File

@ -176,6 +176,9 @@ public class TmTask implements Serializable {
@ApiModelProperty(value="任务状态")
private String taskName;
@ApiModelProperty(value="审批状态id")
private String examineStatusId;
@ApiModelProperty(value="审批状态")
private String examineStatus;

View File

@ -10,6 +10,7 @@ import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import org.springframework.web.bind.annotation.*;
@ -288,4 +289,14 @@ public class TmTaskController extends BaseController {
return tmTaskService.selectByPrimaryKey(Long.valueOf(id));
}
@Log(title = "获取领料申请-详情列表", businessType = BusinessType.QUERY)
@GetMapping("/getLeaseListAll")
public TableDataInfo getLeaseListAll(@RequestParam(value ="taskId", required = false, defaultValue = "") String taskId){
TmTask task = new TmTask();
task.setTaskId(Long.parseLong(taskId));
List<TmTask> leaseAuditList = tmTaskService.getLeaseListAll(task);
return getDataTable(leaseAuditList);
}
}

View File

@ -39,10 +39,6 @@ public interface TmTaskMapper {
/** 更新leaseApplyDetails审批信息 */
int updateLeaseApplyDetailsAuditInfo(@Param("record") LeaseApplyDetails record);
int deleteTaskByPrimaryKey(String taskId);
int deleteTaskInfoByTaskId(String taskId);
int insert(TmTask record);
int insertOrUpdate(TmTask record);
@ -71,4 +67,15 @@ public interface TmTaskMapper {
int selectTaskNumByMonth(@Param("date") Date date, @Param("taskType") Integer taskType);
int insertAgreement(TmTask record);
int deleteTaskByPrimaryKey(String taskId);
int deleteTaskInfoByTaskId(String taskId);
int selectNumByMonth(Date nowDate);
TmTask getLeaseListTmTask(TmTask task);
LeaseApplyInfo getLeaseListByLeaseInfo(TmTask task);
}

View File

@ -48,4 +48,6 @@ public interface TmTaskService{
int selectTaskNumByMonth(@Param("date") Date date, @Param("taskType") Integer taskType);
int insertAgreement(TmTask record);
List<TmTask> getLeaseListAll(TmTask task);
}

View File

@ -7,11 +7,14 @@ import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.StringHelper;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
@ -103,22 +106,38 @@ public class TmTaskServiceImpl implements TmTaskService{
@Override
public String genderLeaseCode() {
Random random = new Random();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate);
String result = format.replace("-", "");
int num = tmTaskMapper.selectNumByMonth(nowDate) ;
num= num+ 1;
String code="";
if (num>9 && num<100){
code = "L" + result + "-00" + num;
}else if (num>99 && num<1000){
code = "L" + result + "-0" + num;
}else {
code = "L" + result + "-000" + num;
}
return code;
/*Random random = new Random();
// 先生成随机4位字符后期根据数据库当月最大CODE值+1
int number = random.nextInt(9999);
// 将随机整激格式化4位字符串不足4位在前面补
return "L" + DateUtils.getDate() + "-" + String.format("%04d", number);
return "L" + DateUtils.getDate() + "-" + String.format("%04d", number);*/
}
@Override
public AjaxResult deleteByPrimaryKey(String taskId) {
boolean taskFlag = tmTaskMapper.deleteTaskByPrimaryKey(taskId) > 0;
boolean infoFlag = tmTaskMapper.deleteTaskInfoByTaskId(taskId) > 0;
if (taskFlag && infoFlag) {
int i = tmTaskMapper.deleteTaskByPrimaryKey(taskId);
int j = tmTaskMapper.deleteTaskInfoByTaskId(taskId);
if(i==1 && j==1){
return AjaxResult.success("删除成功");
} else if (taskFlag || infoFlag) {
}else if(i<1 || j<1){
return AjaxResult.error("删除失败,任务表或信息表未删除!");
} else {
}else {
return AjaxResult.error("删除失败请检查任务ID是否正确!!");
}
}
@ -183,4 +202,19 @@ public class TmTaskServiceImpl implements TmTaskService{
return tmTaskMapper.insertAgreement(record);
}
@Override
public List<TmTask> getLeaseListAll(TmTask task) {
List<TmTask> tmTaskList = new ArrayList<>();
TmTask tmTask = tmTaskMapper.getLeaseListTmTask(task);
if(tmTask != null){
LeaseApplyInfo leaseApplyInfo = tmTaskMapper.getLeaseListByLeaseInfo(task);
tmTask.setLeaseApplyInfo(leaseApplyInfo);
if(leaseApplyInfo !=null){
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetails(leaseApplyInfo);
tmTask.setLeaseApplyDetails(leaseApplyDetails);
}
}
tmTaskList.add(tmTask);
return tmTaskList;
}
}

View File

@ -21,6 +21,17 @@
remark, company_id
</sql>
<update id="deleteTaskByPrimaryKey">
update tm_task set `status` = '0'
where task_id = #{taskId}
</update>
<update id="deleteTaskInfoByTaskId">
update lease_apply_info set `status` = '0'
where task_id = #{taskId}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
@ -32,16 +43,6 @@
select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') and task_type = #{taskType}
</select>
<update id="deleteTaskByPrimaryKey" parameterType="java.lang.Long">
update tm_task set `status` = '0'
where task_id = #{taskId,jdbcType=BIGINT}
</update>
<update id="deleteTaskInfoByTaskId" parameterType="java.lang.Long">
update lease_apply_info set `status` = '0'
where task_id = #{taskId}
</update>
<insert id="insert" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.base.api.domain.TmTask" useGeneratedKeys="true">
insert into tm_task (task_type, task_status, code, create_by, create_time, update_by, update_time, remark, company_id)
values (#{taskType,jdbcType=INTEGER}, #{taskStatus,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
@ -442,11 +443,14 @@
<select id="getAuditListByLeaseTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
SELECT
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName, bpi.pro_name as proName,
bui.unit_name as unitName, lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,d.`name` as taskName,
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
bpi.pro_id as proId,bpi.pro_name as proName,
bui.unit_id as unitId,bui.unit_name as unitName,
lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,d.`name` as taskName,
case when d.id = '30' then lai.company_audit_remark
when d.id = '31' then lai.dept_audit_remark
when d.id = '32' then lai.direct_audit_remark end examineStatus ,
d.id as examineStatusId,
bai.agreement_code as agreementCode,
tt.create_time as createTimes, tt.update_time as updateTimes
FROM
@ -494,7 +498,7 @@
<select id="getLeaseApplyDetails" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyDetails">
SELECT
lad.*, mt.type_name AS typeModelName, mt1.type_name AS typeName
lad.*, mt.type_name AS typeModelName, mt1.type_name AS typeName,mt.unit_name as unitName
FROM
lease_apply_details lad
LEFT JOIN ma_type mt ON lad.type_id = mt.type_id
@ -503,6 +507,43 @@
lad.parennt_id = #{record.id} AND lad.company_id = #{record.companyId}
</select>
<select id="selectNumByMonth" resultType="java.lang.Integer">
select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') AND task_type='29'
</select>
<select id="getLeaseListTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
SELECT
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
bpi.pro_id as proId, bpi.pro_id as projectId,bpi.pro_name as proName,
bui.unit_id as unitId,bui.unit_name as unitName,
tt.create_by as applyFor,d.`name` as taskName,
d.id as examineStatusId,
bai.agreement_code as agreementCode,
tt.create_time as createTimes, tt.update_time as updateTimes,
bai.agreement_id as agreementId
FROM
tm_task tt
LEFT JOIN sys_user su ON tt.create_by = su.user_name
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
LEFT JOIN bm_project_info bpi ON bpi.pro_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN sys_dic d ON d.id = tt.task_status
WHERE tt.task_id = #{taskId}
</select>
<select id="getLeaseListByLeaseInfo" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyInfo">
SELECT
lai.*
FROM
lease_apply_info lai
WHERE
lai.task_id = #{taskId}
</select>
<update id="updateTmTaskAuditStatus">
UPDATE tm_task SET task_status = #{record.taskStatus} WHERE task_id = #{record.taskId}
</update>