Compare commits

...

2 Commits

Author SHA1 Message Date
liang.chao 4b1645e96e Merge remote-tracking branch 'origin/master' 2024-09-23 16:35:39 +08:00
liang.chao 88f1e9f954 重庆需求变更代码提交 2024-09-23 16:35:29 +08:00
7 changed files with 92 additions and 29 deletions

View File

@ -1,10 +1,13 @@
package com.bonus.sgzb.base.controller; package com.bonus.sgzb.base.controller;
import cn.hutool.core.convert.Convert;
import com.bonus.sgzb.base.api.domain.MaType; import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.base.domain.MaKeeperUser; import com.bonus.sgzb.base.domain.MaKeeperUser;
import com.bonus.sgzb.base.domain.vo.TreeSelect; import com.bonus.sgzb.base.domain.vo.TreeSelect;
import com.bonus.sgzb.base.mapper.MaTypeMapper; import com.bonus.sgzb.base.mapper.MaTypeMapper;
import com.bonus.sgzb.base.service.ITypeService; import com.bonus.sgzb.base.service.ITypeService;
import com.bonus.sgzb.common.core.utils.ListPagingUtil;
import com.bonus.sgzb.common.core.utils.ServletUtils;
import com.bonus.sgzb.common.core.web.controller.BaseController; 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.domain.AjaxResult;
import com.bonus.sgzb.common.log.annotation.Log; import com.bonus.sgzb.common.log.annotation.Log;
@ -15,8 +18,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_NUM;
import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_SIZE;
/** /**
* 工机具类型管理控制层 * 工机具类型管理控制层
*/ */
@ -34,24 +41,25 @@ public class MaTypeController extends BaseController {
/** /**
* 根据类型名称查询类型 * 根据类型名称查询类型
*
* @return 结果 * @return 结果
*/ */
@ApiOperation(value = "根据类型名称查询类型") @ApiOperation(value = "根据类型名称查询类型")
@GetMapping("/getMaTypeList") @GetMapping("/getMaTypeList")
public AjaxResult getMaTypeList(@RequestParam(required = false, defaultValue = "", value = "typeName") String typeName, @RequestParam(required = false, defaultValue = "", value = "parentId") String parentId){ public AjaxResult getMaTypeList(@RequestParam(required = false, defaultValue = "", value = "typeName") String typeName, @RequestParam(required = false, defaultValue = "", value = "parentId") String parentId) {
List<TreeSelect> maTypeList = iTypeService.getMaTypeList(typeName, parentId); List<TreeSelect> maTypeList = iTypeService.getMaTypeList(typeName, parentId);
return AjaxResult.success(maTypeList); return AjaxResult.success(maTypeList);
} }
/** /**
* 工机具类型下拉树 * 工机具类型下拉树
*
* @return 结果 * @return 结果
*/ */
@ApiOperation(value = "工机具类型下拉树") @ApiOperation(value = "工机具类型下拉树")
@GetMapping("/getMaTypeSelect") @GetMapping("/getMaTypeSelect")
public AjaxResult getMaTypeSelect(@RequestParam(required = false, defaultValue = "", value = "typeName") String typeName, @RequestParam(required = false, defaultValue = "", value = "parentId") String parentId){ public AjaxResult getMaTypeSelect(@RequestParam(required = false, defaultValue = "", value = "typeName") String typeName, @RequestParam(required = false, defaultValue = "", value = "parentId") String parentId) {
List<TreeSelect> maTypeList = iTypeService.getMaTypeSelect(typeName, parentId); List<TreeSelect> maTypeList = iTypeService.getMaTypeSelect(typeName, parentId);
return AjaxResult.success(maTypeList); return AjaxResult.success(maTypeList);
} }
@ -65,30 +73,34 @@ public class MaTypeController extends BaseController {
/** /**
* 根据左列表类型id查询右表格 * 根据左列表类型id查询右表格
*
* @param typeId * @param typeId
* @return * @return
*/ */
@ApiOperation(value = "工器具类型") @ApiOperation(value = "工器具类型")
@GetMapping("/equipmentType") @GetMapping("/equipmentType")
public AjaxResult equipmentType(@RequestParam(required = false) Long typeId, public AjaxResult equipmentType(@RequestParam(required = false) Long typeId,
@RequestParam(required = false) String typeName){ @RequestParam(required = false) String typeName) {
List<MaType> listByMaType = iTypeService.getEquipmentType(typeId,typeName); List<MaType> listByMaType = iTypeService.getEquipmentType(typeId, typeName);
return success(listByMaType); return success(listByMaType);
} }
/** /**
* 获取规格层级为3的设备列表 * 获取规格层级为3的设备列表
*
* @return 结果 * @return 结果
*/ */
@ApiOperation(value = "获取规格层级的设备列表") @ApiOperation(value = "获取规格层级的设备列表")
@GetMapping("/selectMaTypeListByLevelIndex") @GetMapping("/selectMaTypeListByLevelIndex")
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){ 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 == null) {
return AjaxResult.error("参数错误,类型不能为空");
}
if (type == 0) { if (type == 0) {
// 查询全部机具类型 // 查询全部机具类型
if (level == 0 || level == 1) { if (level == 0 || level == 1) {
// 查询全部等级一级 // 查询全部等级一级
List<TreeSelect> treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null,null)); List<TreeSelect> treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null, null));
List<TreeSelect> children = treeSelectList.get(0).getChildren(); List<TreeSelect> children = treeSelectList.get(0).getChildren();
TreeSelect zero = new TreeSelect(); TreeSelect zero = new TreeSelect();
zero.setLevel(2); zero.setLevel(2);
@ -100,11 +112,11 @@ public class MaTypeController extends BaseController {
} }
if (level == 2) { if (level == 2) {
// 查询二级 // 查询二级
if (parentId == 0){ if (parentId == 0) {
List<MaType> maTypes = maTypeMapper.selectMaTypeListByLevelNotFour(null, keyword); List<MaType> maTypes = maTypeMapper.selectMaTypeListByLevelNotFour(null, keyword);
return AjaxResult.success(maTypes); return AjaxResult.success(maTypes);
}else { } else {
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(),keyword)); return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(), keyword));
} }
@ -129,12 +141,12 @@ public class MaTypeController extends BaseController {
// 查询施工机具 // 查询施工机具
List<TreeSelect> treeSelectList; List<TreeSelect> treeSelectList;
if (level != 2) { if (level != 2) {
treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null,null)); treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null, null));
// treeSelectList.removeIf(item -> item.getId() == 1L); // treeSelectList.removeIf(item -> item.getId() == 1L);
//List<TreeSelect> treeSelectList1 = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 1L)).collect(Collectors.toList()); //List<TreeSelect> treeSelectList1 = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 1L)).collect(Collectors.toList());
return AjaxResult.success(treeSelectList); return AjaxResult.success(treeSelectList);
} else { } else {
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(),keyword)); return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(), keyword));
// treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString())); // treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString()));
// // 先过滤出施工机具 // // 先过滤出施工机具
// treeSelectList = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 1L)).collect(Collectors.toList()); // treeSelectList = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 1L)).collect(Collectors.toList());
@ -157,11 +169,11 @@ public class MaTypeController extends BaseController {
} }
} }
if (type == 2) { if (type == 2) {
List<TreeSelect> treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null,null)); List<TreeSelect> treeSelectList = iTypeService.buildDeptTreeSelect(maTypeMapper.selectMaTypeListByLevelNotFour(null, null));
//treeSelectList = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 2L)).collect(Collectors.toList()); //treeSelectList = treeSelectList.stream().filter(item -> Objects.equals(item.getId(), 2L)).collect(Collectors.toList());
// 查询安全工器具 // 查询安全工器具
if (level == 2) { if (level == 2) {
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(),keyword)); return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(), keyword));
// if (!treeSelectList.isEmpty()) { // if (!treeSelectList.isEmpty()) {
// for (TreeSelect treeSelect : treeSelectList) { // for (TreeSelect treeSelect : treeSelectList) {
// List<TreeSelect> children = treeSelect.getChildren(); // List<TreeSelect> children = treeSelect.getChildren();
@ -178,20 +190,26 @@ public class MaTypeController extends BaseController {
} }
return AjaxResult.success(treeSelectList); return AjaxResult.success(treeSelectList);
} }
return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(null,null)); return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(null, null));
} }
/** /**
* 根据左列表类型id查询右表格 * 根据左列表类型id查询右表格
*
* @param typeId * @param typeId
* @return * @return
*/ */
@ApiOperation(value = "根据左列表类型id查询右表格") @ApiOperation(value = "根据左列表类型id查询右表格")
@GetMapping("/getListByMaType") @GetMapping("/getListByMaType")
public AjaxResult getListByMaType(@RequestParam(required = false) Long typeId, public AjaxResult getListByMaType(Long typeId, @RequestParam(required = false) String typeName, Integer level) {
@RequestParam(required = false) String typeName){ List<Integer> parentIds = iTypeService.selectParentId(typeId, level);
List<MaType> listByMaType = iTypeService.getListByParentId(typeId,typeName); List<MaType> listByMaType = new ArrayList<>();
return success(listByMaType); for (Integer parentId : parentIds) {
listByMaType.addAll(iTypeService.getListByParentId(parentId.longValue(), typeName));
}
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, listByMaType));
} }
/** /**
@ -224,8 +242,7 @@ public class MaTypeController extends BaseController {
*/ */
@ApiOperation(value = "获取机具类型管理ma_type详细信息") @ApiOperation(value = "获取机具类型管理ma_type详细信息")
@GetMapping(value = "/{typeId}") @GetMapping(value = "/{typeId}")
public AjaxResult getInfo(@PathVariable("typeId") Long typeId) public AjaxResult getInfo(@PathVariable("typeId") Long typeId) {
{
return success(iTypeService.selectMaTypeByTypeId(typeId)); return success(iTypeService.selectMaTypeByTypeId(typeId));
} }
@ -235,8 +252,7 @@ public class MaTypeController extends BaseController {
@ApiOperation(value = "新增机具类型管理ma_type") @ApiOperation(value = "新增机具类型管理ma_type")
@Log(title = "机具类型管理ma_type", businessType = BusinessType.INSERT) @Log(title = "机具类型管理ma_type", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody MaType maType) public AjaxResult add(@RequestBody MaType maType) {
{
int result = iTypeService.insertMaType(maType); int result = iTypeService.insertMaType(maType);
if (result > 0) { if (result > 0) {
return success(toAjax(iTypeService.insertMaType(maType))); return success(toAjax(iTypeService.insertMaType(maType)));
@ -251,8 +267,7 @@ public class MaTypeController extends BaseController {
@ApiOperation(value = "修改机具类型管理ma_type") @ApiOperation(value = "修改机具类型管理ma_type")
@Log(title = "机具类型管理ma_type", businessType = BusinessType.UPDATE) @Log(title = "机具类型管理ma_type", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody MaType maType) public AjaxResult edit(@RequestBody MaType maType) {
{
return toAjax(iTypeService.updateMaType(maType)); return toAjax(iTypeService.updateMaType(maType));
} }

View File

@ -89,4 +89,5 @@ public interface MaTypeMapper {
List<MaTypeKeeper> selectMaTypeByUserId(Long userId); List<MaTypeKeeper> selectMaTypeByUserId(Long userId);
List<Integer> selectParentId( @Param("typeId")Long typeId, @Param("level")Integer level);
} }

View File

@ -67,6 +67,7 @@ public interface ITypeService {
public List<TreeSelect> buildDeptTreeSelect(List<MaType> maTypeList); public List<TreeSelect> buildDeptTreeSelect(List<MaType> maTypeList);
List<MaType> getListByParentId(Long typeId, String typeName); List<MaType> getListByParentId(Long typeId, String typeName);
List<Integer> selectParentId(Long typeId, Integer level);
List<MaType> getEquipmentType(Long typeId, String typeName); List<MaType> getEquipmentType(Long typeId, String typeName);

View File

@ -58,7 +58,12 @@ public class MaTypeServiceImpl implements ITypeService {
return 0; return 0;
} }
MaType maType1 = maTypeMapper.selectMaTypeByTypeId(parentId); MaType maType1 = maTypeMapper.selectMaTypeByTypeId(parentId);
String level = maType1.getLevel(); String level;
if (maType1 == null) {
level = "0";
} else {
level = maType1.getLevel();
}
maType.setLevel(String.valueOf(Integer.parseInt(level) + 1)); maType.setLevel(String.valueOf(Integer.parseInt(level) + 1));
maType.setCreateTime(DateUtils.getNowDate()); maType.setCreateTime(DateUtils.getNowDate());
System.out.println(maType); System.out.println(maType);
@ -328,6 +333,11 @@ public class MaTypeServiceImpl implements ITypeService {
return maTypeMapper.getListByParentId(typeId, typeName); return maTypeMapper.getListByParentId(typeId, typeName);
} }
@Override
public List<Integer> selectParentId(Long typeId, Integer level) {
return maTypeMapper.selectParentId(typeId,level);
}
/** /**
* 查询工器具类型四级组织树 * 查询工器具类型四级组织树
* *

View File

@ -120,6 +120,17 @@ public class PurchaseCheckInfo extends BaseEntity
@ApiModelProperty(value="结束时间") @ApiModelProperty(value="结束时间")
private String endTime; private String endTime;
public String getPurchaseNumber() {
return purchaseNumber;
}
public void setPurchaseNumber(String purchaseNumber) {
this.purchaseNumber = purchaseNumber;
}
@ApiModelProperty(value="线下采购单编号")
private String purchaseNumber;
public String getKeyWord() { public String getKeyWord() {
return keyWord; return keyWord;
} }

View File

@ -426,6 +426,28 @@
select * from ma_type_keeper where user_id = #{userId} select * from ma_type_keeper where user_id = #{userId}
</select> </select>
<select id="selectParentId" resultType="java.lang.Integer">
SELECT DISTINCT
mt2.type_id
FROM
ma_type mt
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
WHERE 1=1
<if test="level == 1">
and mt4.type_id = #{typeId}
</if>
<if test="level == 2">
and mt3.type_id = #{typeId}
</if>
<if test="level == 3">
and mt2.type_id = #{typeId}
</if>
<if test="level == 0">
and mt.level = 4
</if>
</select>
<update id="updateTypeNum"> <update id="updateTypeNum">
update ma_type set num = IFNULL( num, 0 ) + 1 where type_id = #{typeId} update ma_type set num = IFNULL( num, 0 ) + 1 where type_id = #{typeId}

View File

@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPurchaseCheckInfoList" parameterType="com.bonus.sgzb.material.domain.PurchaseCheckInfo" resultMap="PurchaseCheckInfoResult"> <select id="selectPurchaseCheckInfoList" parameterType="com.bonus.sgzb.material.domain.PurchaseCheckInfo" resultMap="PurchaseCheckInfoResult">
select pci.id,pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by, pci.create_time, select pci.id,pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by, pci.create_time,
pci.update_by, pci.update_by,pci.purchase_number,
pci.update_time, pci.remark, pci.company_id ,dict.id purchasingId,dict.name pci.update_time, pci.remark, pci.company_id ,dict.id purchasingId,dict.name
purchasingStatus,tk.code,su.nick_name purchasingStatus,tk.code,su.nick_name
purchaserName,tk.task_status taskStatus purchaserName,tk.task_status taskStatus
@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPurchaseCheckInfoByTaskId" parameterType="Long" resultMap="PurchaseCheckInfoResult"> <select id="selectPurchaseCheckInfoByTaskId" parameterType="Long" resultMap="PurchaseCheckInfoResult">
select pci.id,pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by, pci.create_time, select pci.id,pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by, pci.create_time,
pci.update_by, pci.update_time, pci.remark, pci.company_id, tk.code pci.update_by, pci.update_time, pci.remark, pci.company_id, tk.code,pci.purchase_number
from purchase_check_info pci from purchase_check_info pci
left join tm_task tk on pci.task_id = tk.task_id left join tm_task tk on pci.task_id = tk.task_id
where pci.task_id = #{taskId} where pci.task_id = #{taskId}
@ -79,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="companyId != null">company_id,</if> <if test="companyId != null">company_id,</if>
<if test="purchaseNumber != null">purchase_number,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskId != null">#{taskId},</if> <if test="taskId != null">#{taskId},</if>
@ -91,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="companyId != null">#{companyId},</if> <if test="companyId != null">#{companyId},</if>
<if test="purchaseNumber != null">#{purchaseNumber},</if>
</trim> </trim>
</insert> </insert>
@ -106,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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="companyId != null">company_id = #{companyId},</if> <if test="companyId != null">company_id = #{companyId},</if>
<if test="purchaseNumber != null and purchaseNumber != ''" >purchase_number = #{purchaseNumber},</if>
</trim> </trim>
where task_id = #{taskId} where task_id = #{taskId}
</update> </update>