APP领料代码提交

This commit is contained in:
1539530615@qq.com 2024-01-05 10:09:07 +08:00
parent 152226b4e9
commit c319fc413a
13 changed files with 249 additions and 17 deletions

View File

@ -0,0 +1,44 @@
package com.bonus.sgzb.app.controller;
import com.bonus.sgzb.app.domain.LeaseUserBook;
import com.bonus.sgzb.app.service.LeaseUserBookService;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
/**
* @author c liu
* @date 2024/1/4
*/
@RestController
@RequestMapping("/leaseUserBook")
public class LeaseUserBookController extends BaseController {
@Autowired
private LeaseUserBookService service;
@GetMapping
public AjaxResult getLeaseUserBook(){
Long userId = SecurityUtils.getUserId();
return AjaxResult.success(service.getLeaseUserBook(userId));
}
@PostMapping
public AjaxResult add(@RequestBody LeaseUserBook bean){
return toAjax(service.add(bean));
}
@PostMapping("/update")
public AjaxResult update(@RequestBody LeaseUserBook bean){
return toAjax(service.update(bean));
}
@DeleteMapping
public AjaxResult batchDel(@RequestBody ArrayList<Integer> ids){
return toAjax(service.batchDel(ids));
}
}

View File

@ -3,6 +3,7 @@ package com.bonus.sgzb.app.controller;
import cn.hutool.core.collection.CollUtil;
import com.bonus.sgzb.app.service.LeaseApplyDetailsService;
import com.bonus.sgzb.app.service.LeaseApplyInfoService;
import com.bonus.sgzb.app.service.LeaseUserBookService;
import com.bonus.sgzb.app.service.TmTaskService;
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
@ -14,9 +15,12 @@ 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.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@ -41,6 +45,9 @@ public class TmTaskController extends BaseController {
@Resource
private LeaseApplyDetailsService leaseApplyDetailsService; // 领料申请明细表Service
@Autowired
private LeaseUserBookService leaseUserBookService;
/**
* 领料审核分公司分管机具分公司统一接口
@ -85,6 +92,7 @@ public class TmTaskController extends BaseController {
*/
@Log(title = "往来单位提交领料申请", businessType = BusinessType.INSERT)
@PostMapping("submitLeaseApply")
@Transactional
public AjaxResult submitLeaseApply(@RequestBody TmTask task) {
if (StringUtils.isNull(task)) {
return AjaxResult.error("参数错误");
@ -132,14 +140,17 @@ public class TmTaskController extends BaseController {
if (addLeaseTaskResult) {
// 领料任务编号
Integer leaseTaskId = leaseApplyInfo.getId();
ArrayList<Integer> ids = new ArrayList();
if (StringUtils.isNotNull(leaseTaskId)) {
for (LeaseApplyDetails leaseApplyDetails : leaseApplyDetailsList) {
leaseApplyDetails.setParenntId(leaseTaskId); // 设置领料任务ID
ids.add(leaseApplyDetails.getId());
}
// 插入领料任务明细
boolean addLeaseTaskDetailsResult = leaseApplyDetailsService.batchInsert(leaseApplyDetailsList) > 0;
if (addLeaseTaskDetailsResult) {
System.out.println("领料任务创建成功");
leaseUserBookService.batchDel(ids);
} else {
System.out.println("领料任务创建成功,但领料任务明细插入失败");
}

View File

@ -0,0 +1,42 @@
package com.bonus.sgzb.app.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author c liu
* @date 2024/1/4
*/
@Data
@ApiModel(value="预约车")
public class LeaseUserBook {
/**
* id
*/
@ApiModelProperty(value = "id")
private Long id;
/**
* 用户ID
*/
@ApiModelProperty(value = "用户ID")
private Long userId;
/**
* 机具规格ID
*/
@ApiModelProperty(value = "机具规格ID")
private Long typeId;
/**
* 预约数量
*/
@ApiModelProperty(value = "预约数量")
private int bookNum;
private Long companyId;
private String parentName;
private String typeName;
/** 图片路径 */
@ApiModelProperty(value = "图片路径")
private String photoUrl = "https://zlpt-1259760603.cos.ap-nanjing.myqcloud.com/zhcc/405D4B1F-0942-424e-B45A-C66FDDA74EEA.png";
}

View File

@ -0,0 +1,24 @@
package com.bonus.sgzb.app.mapper;
import com.bonus.sgzb.app.domain.LeaseUserBook;
import com.bonus.sgzb.base.api.domain.MaType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
import java.util.List;
/**
* @author c liu
* @date 2024/1/4
*/
@Mapper
public interface LeaseUserBookMapper {
List<LeaseUserBook> getLeaseUserBook(Long userId);
int add(LeaseUserBook bean);
int batchDel(@Param("ids") ArrayList<Integer> ids);
int update(LeaseUserBook bean);
}

View File

@ -0,0 +1,18 @@
package com.bonus.sgzb.app.service;
import com.bonus.sgzb.app.domain.LeaseUserBook;
import com.bonus.sgzb.base.api.domain.MaType;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
import java.util.List;
public interface LeaseUserBookService {
List<LeaseUserBook> getLeaseUserBook(Long userId);
int add(LeaseUserBook bean);
int batchDel(ArrayList<Integer> ids);
int update(LeaseUserBook bean);
}

View File

@ -0,0 +1,42 @@
package com.bonus.sgzb.app.service.impl;
import com.bonus.sgzb.app.domain.LeaseUserBook;
import com.bonus.sgzb.app.mapper.LeaseApplyInfoMapper;
import com.bonus.sgzb.app.mapper.LeaseUserBookMapper;
import com.bonus.sgzb.app.service.LeaseUserBookService;
import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
public class LeaseUserBookServiceImpl implements LeaseUserBookService {
@Autowired
private LeaseUserBookMapper mapper;
@Override
public List<LeaseUserBook> getLeaseUserBook(Long userId) {
return mapper.getLeaseUserBook(userId);
}
@Override
public int add(LeaseUserBook bean) {
Long userId = SecurityUtils.getUserId();
bean.setUserId(userId);
return mapper.add(bean);
}
@Override
public int batchDel(ArrayList<Integer> ids) {
return mapper.batchDel(ids);
}
@Override
public int update(LeaseUserBook bean) {
return mapper.update(bean);
}
}

View File

@ -10,6 +10,7 @@ import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
@ -75,6 +76,7 @@ public class TmTaskServiceImpl implements TmTaskService{
* @param record 审核数据及信息
*/
@Override
@Transactional
public int updateLeaseTaskAuditInfo(TmTask record) {
int result = 0;
if (StringUtils.isNotNull(record)) {
@ -84,7 +86,7 @@ public class TmTaskServiceImpl implements TmTaskService{
if (CollUtil.isNotEmpty(record.getLeaseApplyInfoList())) {
for (LeaseApplyInfo leaseApplyInfo : record.getLeaseApplyInfoList()) {
if (leaseApplyInfo != null) {
leaseApplyInfo.setExamineStatusId(record.getExamineStatusId());
//leaseApplyInfo.setExamineStatusId(record.getExamineStatusId());
result += tmTaskMapper.updateLeaseApplyInfoAuditInfo(leaseApplyInfo);
// 再审核领料任务详情表
if (CollUtil.isNotEmpty(leaseApplyInfo.getLeaseApplyDetails())) {

View File

@ -84,18 +84,18 @@ public class MaTypeController extends BaseController {
*/
@ApiOperation(value = "获取规格层级的设备列表")
@GetMapping("/selectMaTypeListByLevelIndex")
public AjaxResult selectMaTypeListByLevelIndex(@RequestParam(value = "level", required = false) Integer level, @RequestParam(value = "type") Integer type, @RequestParam(value = "parentId", required = false) Integer parentId){
public AjaxResult selectMaTypeListByLevelIndex(@RequestParam(value = "level", required = false) Integer level, @RequestParam(value = "type") Integer type, @RequestParam(value = "parentId", required = false) Integer parentId, @RequestParam(value = "keyword", required = false) String keyword){
if (type == null) { return AjaxResult.error("参数错误,类型不能为空"); }
if (type == 0) {
// 查询全部机具类型
if (level == 0 || level == 1) {
// 查询全部等级一级
List<TreeSelect> treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null));
List<TreeSelect> treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null,null));
return AjaxResult.success(treeSelectList);
}
if (level == 2) {
// 查询二级
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString()));
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(),keyword));
// List<TreeSelect> treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString()));
//
@ -118,10 +118,12 @@ public class MaTypeController extends BaseController {
// 查询施工机具
List<TreeSelect> treeSelectList;
if (level != 2) {
treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null));
return AjaxResult.success(treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 1L)).collect(Collectors.toList()));
treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null,null));
// treeSelectList.removeIf(item -> item.getId() == 1L);
List<TreeSelect> treeSelectList1 = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 1L)).collect(Collectors.toList());
return AjaxResult.success(treeSelectList);
} else {
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString()));
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(),keyword));
// treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString()));
// // 先过滤出施工机具
// treeSelectList = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 1L)).collect(Collectors.toList());
@ -144,11 +146,11 @@ public class MaTypeController extends BaseController {
}
}
if (type == 2) {
List<TreeSelect> treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null));
treeSelectList = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 2L)).collect(Collectors.toList());
List<TreeSelect> treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null,null));
//treeSelectList = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 2L)).collect(Collectors.toList());
// 查询安全工器具
if (level == 2) {
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString()));
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(),keyword));
// if (!treeSelectList.isEmpty()) {
// for (TreeSelect treeSelect : treeSelectList) {
// List<TreeSelect> children = treeSelect.getChildren();
@ -165,7 +167,7 @@ public class MaTypeController extends BaseController {
}
return AjaxResult.success(treeSelectList);
}
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(null));
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(null,null));
}
/**

View File

@ -72,7 +72,7 @@ public interface MaTypeMapper {
List<MaType> selectMaTypeTreeByLevel(String id);
List<MaType> selectMaTypeListByLevelNotFour(String parentId);
List<MaType> selectMaTypeListByLevelNotFour(@Param("parentId") String parentId,@Param("keyword")String keyword);
List<MaType> getMaTypeSelect(String parentId);

View File

@ -4,9 +4,9 @@
<select id="getDayLeaseNum" resultType="java.lang.Integer">
select COALESCE(SUM(pre_num), 0)
select COALESCE(SUM(audit_num), 0)
from lease_apply_details
WHERE create_time &gt;= #{startTime} AND create_time &lt;= #{endTime};
WHERE create_time &gt;= #{startTime} AND create_time &lt;= #{endTime} AND status in ('1','2')
</select>
<select id="getDayBackNum" resultType="java.lang.Integer">
select COALESCE(sum(pre_num), 0)
@ -25,8 +25,8 @@
</select>
<select id="getLeaseNum" resultType="java.lang.Integer">
select count(1)
from lease_apply_details
where status = '0'
from tm_task
where task_type = '29' and task_status in ('30','31','32') and status = '1'
</select>
<select id="getBackNum" resultType="java.lang.Integer">
select count(1)

View File

@ -0,0 +1,36 @@
<?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.bonus.sgzb.app.mapper.LeaseUserBookMapper">
<insert id="add">
insert into lease_user_book (user_id,type_id,book_num,book_time,company_id)
values (#{userId},#{typeId},#{bookNum},now(),#{companyId});
</insert>
<update id="update">
update lease_user_book
set book_num = #{bookNum}
where id = #{id}
</update>
<delete id="batchDel">
delete
from lease_user_book
where id in
<foreach close=")" collection="ids" item="id" open="(" separator=", ">
#{id}
</foreach>
</delete>
<select id="getLeaseUserBook" resultType="com.bonus.sgzb.app.domain.LeaseUserBook">
select lub.id,
lub.user_id as userId,
lub.type_id as typeId,
mt2.type_name as parentName,
mt.type_name as typeName,
lub.book_num as bookNum,
lub.company_id as companyId
from lease_user_book lub
left join ma_type mt on lub.type_id = mt.type_id
left join ma_type mt2 on mt.parent_id = mt2.type_id
where lub.user_id = #{userId}
</select>
</mapper>

View File

@ -600,6 +600,14 @@
direct_audit_time = now(),
direct_audit_remark = #{record.companyAuditRemark},
</if>
<if test="record.examineStatusId == 33 and record.examineStatusId == '33'">
update_by = #{record.companyAuditBy},
update_time = now(),
</if>
<if test="record.examineStatusId == 34 and record.examineStatusId == '34'">
update_by = #{record.companyAuditBy},
update_time = now(),
</if>
</trim>
WHERE
task_id = #{record.taskId}

View File

@ -365,9 +365,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from ma_type m
<where>
m.level != 4
<if test="_parameter!= null and _parameter != ''">
<if test="parentId!= null and parentId != ''">
and m.parent_id = #{parentId}
</if>
<if test="keyword!= null and keyword != ''">
and locate(#{keyword}, m.type_name) > 0
</if>
</where>
</select>