功能完善

This commit is contained in:
bns_han 2024-01-16 17:09:48 +08:00
parent 25477c1289
commit 8dc5fc562c
13 changed files with 105 additions and 42 deletions

View File

@ -89,24 +89,13 @@ public class MaPropInfoController extends BaseController {
@Log(title = "参数管理", businessType = BusinessType.INSERT) @Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping("/save") @PostMapping("/save")
public AjaxResult save(@Validated @RequestBody MaPropSet maPropSet){ public AjaxResult save(@Validated @RequestBody MaPropSet maPropSet){
/* if (!maPropInfoService.checkPropIdUnique(maPropSet)) { // Long fieldValue =maPropSet.getTypeId();
return error("资产名称'" + maPropSet.getTypeId() + "'失败,资产名称已存在"); // Long fieldValues =maPropSet.getPropId();
}*/ // if (maPropSet.getPropName() != null){
Long fieldValue =maPropSet.getTypeId(); // return toAjax(maPropInfoService.updateMaPropSet(maPropSet));
Long fieldValues =maPropSet.getPropId(); // }
if (maPropSet.getPropName() != null){ // return toAjax(maPropInfoService.insertMaPropSet(maPropSet));
return toAjax(maPropInfoService.updateMaPropSet(maPropSet)); return toAjax(maPropInfoService.save(maPropSet));
}
/*List<MaPropSet> ben= maPropInfoService.checkPropIdUnique(maPropSet);
for (MaPropSet s:ben) {
if(s.)
Long fieldValue =s.getId();
if(fieldValue !=null ){
}
}*/
return toAjax(maPropInfoService.insertMaPropSet(maPropSet));
} }
/** /**

View File

@ -36,12 +36,12 @@ public class MaPropSetController extends BaseController
* 删除资产属性配置ma_prop_set * 删除资产属性配置ma_prop_set
*/ */
@Log(title = "资产属性配置ma_prop_set", businessType = BusinessType.DELETE) @Log(title = "资产属性配置ma_prop_set", businessType = BusinessType.DELETE)
@DeleteMapping("/{propIds}") @DeleteMapping("/{typeIds}")
public AjaxResult remove(@PathVariable Long propIds) public AjaxResult remove(@PathVariable String typeIds)
{ {
AjaxResult b = null; AjaxResult b = null;
try{ try{
b = toAjax(maPropInfoService.deleteMaPropSetByPropIds(propIds)); b = toAjax(maPropInfoService.deleteMaPropSetByPropIds(typeIds));
}catch (Exception e){ }catch (Exception e){
logger.error(e.toString(),e); logger.error(e.toString(),e);
} }

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.base.domain; package com.bonus.sgzb.base.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
@ -18,6 +19,10 @@ public class MaPropSet {
* 类型ID * 类型ID
*/ */
private long typeId; private long typeId;
@ApiModelProperty(value = "类型ids")
private String typeIds;
/** /**
* 帐号状态0正常 1停用 * 帐号状态0正常 1停用
*/ */

View File

@ -78,5 +78,9 @@ public interface MaPropInfoMapper {
* @return 结果 * @return 结果
*/ */
public int deleteMaPropSetByPropIds(Long propIds); public int deleteMaPropSetByPropIds(Long propIds);
int deleteByIdsAll(String[] typeIds);
int add(List<MaPropSet> list);
} }

View File

@ -90,9 +90,11 @@ public interface IMaPropInfoService {
/** /**
* 批量删除资产属性配置ma_prop_set * 批量删除资产属性配置ma_prop_set
* *
* @param propIds 需要删除的资产属性配置ma_prop_set主键集合 * @param typeIds 需要删除的资产属性配置ma_prop_set主键集合
* @return 结果 * @return 结果
*/ */
public int deleteMaPropSetByPropIds(Long propIds); public int deleteMaPropSetByPropIds(String typeIds);
int save(MaPropSet maPropSet);
} }

View File

@ -3,17 +3,21 @@ package com.bonus.sgzb.base.service.impl;
import com.bonus.sgzb.base.api.domain.MaType; import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.base.domain.MaPropInfo; import com.bonus.sgzb.base.domain.MaPropInfo;
import com.bonus.sgzb.base.domain.MaPropSet; import com.bonus.sgzb.base.domain.MaPropSet;
import com.bonus.sgzb.base.domain.WarehouseKeeper;
import com.bonus.sgzb.base.mapper.MaPropInfoMapper; import com.bonus.sgzb.base.mapper.MaPropInfoMapper;
import com.bonus.sgzb.base.service.IMaPropInfoService; import com.bonus.sgzb.base.service.IMaPropInfoService;
import com.bonus.sgzb.common.core.constant.UserConstants; import com.bonus.sgzb.common.core.constant.UserConstants;
import com.bonus.sgzb.common.core.exception.ServiceException; import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.utils.StringHelper;
import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.utils.bean.BeanValidators; import com.bonus.sgzb.common.core.utils.bean.BeanValidators;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.validation.Validator; import javax.validation.Validator;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -34,7 +38,7 @@ public class MaPropInfoServiceImpl implements IMaPropInfoService {
/** /**
* 查询资产属性列表 * 查询资产属性列表
* @param propName * @param maPropInfo
* @return * @return
*/ */
@Override @Override
@ -200,15 +204,45 @@ public class MaPropInfoServiceImpl implements IMaPropInfoService {
/** /**
* 批量删除资产属性配置ma_prop_set * 批量删除资产属性配置ma_prop_set
* *
* @param propIds 需要删除的资产属性配置ma_prop_set主键 * @param typeIds 需要删除的资产属性配置ma_prop_set主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteMaPropSetByPropIds(Long propIds) public int deleteMaPropSetByPropIds(String typeIds)
{ {
if(StringHelper.isNotEmpty(typeIds)){
String[] splitTypeIds = typeIds.split("@");
//删除
return maPropInfoMapper.deleteByIdsAll(splitTypeIds);
}else {
return 0;
}
}
int deleteMaPropSetByPropIds = maPropInfoMapper.deleteMaPropSetByPropIds(propIds); @Override
return deleteMaPropSetByPropIds; public int save(MaPropSet bean) {
List<MaPropSet> list=new ArrayList<>();
String typeIds=bean.getTypeIds();
if(StringHelper.isNotEmpty(typeIds)){
String[] splitTypeIds = typeIds.split("@");
//先删除在去添加
maPropInfoMapper.deleteByIdsAll(splitTypeIds);
for (String typeId : splitTypeIds) {
MaPropSet beans = new MaPropSet();
beans.setTypeIds(typeId);
beans.setPropId(bean.getPropId());
beans.setCompanyId(bean.getCompanyId());
beans.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
list.add(beans);
}
}
int i =0;
if(list.size()>0){
i= maPropInfoMapper.add(list);
}else{
}
return i;
} }
} }

View File

@ -65,13 +65,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from ma_prop_info from ma_prop_info
</sql> </sql>
<select id="selectMaType" resultMap="MaTypeResult" parameterType="com.bonus.sgzb.base.api.domain.MaType"> <select id="selectMaType" resultMap="MaTypeResult" parameterType="com.bonus.sgzb.base.api.domain.MaType">
select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.unit_name, m.manage_type, SELECT
m.lease_price, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load, m.type_id,
m.holding_time, m.warn_num, m.del_flag, m.create_by, m.create_time, m.type_name,
m.remark, m.company_id ,e.prop_name,l.id m.unit_name,
from ma_type m m.lease_price,
left join ma_prop_set l on m.type_id = l.type_id m.rent_price,
left join ma_prop_info e on e.prop_id = l.prop_id m.buy_price,
m.pay_price,
m.remark,
e.prop_name,
us.user_name as keeperUserName,
mtf.file_name photoName,
mtf.file_url photoUrl,
mtf2.file_name documentName,
mtf2.file_url documentUrl
FROM
ma_type m
LEFT JOIN ma_prop_set l ON m.type_id = l.type_id
LEFT JOIN ma_prop_info e ON e.prop_id = l.prop_id
LEFT JOIN ma_type_keeper mtk on mtk.type_id=m.type_id
LEFT JOIN sys_user us on us.user_id=mtk.user_id
LEFT JOIN ( SELECT * FROM ma_type_file WHERE file_type = '1' ) mtf ON m.type_id = mtf.type_id
LEFT JOIN ( SELECT * FROM ma_type_file WHERE file_type = '2' ) mtf2 ON m.type_id = mtf2.type_id
<where> <where>
level = 4 and m.status = '0' level = 4 and m.status = '0'
<if test="typeName != null and typeName !=''"> <if test="typeName != null and typeName !=''">
@ -148,6 +164,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sysdate() sysdate()
) )
</insert> </insert>
<insert id="add">
insert into ma_prop_set(type_id, prop_id,company_id,create_by,create_time) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.typeIds},#{item.propId},#{item.companyId},#{item.createBy},NOW())
</foreach>
</insert>
<update id="updateMaProp"> <update id="updateMaProp">
update ma_prop_info update ma_prop_info
@ -171,6 +193,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteMaPropSetByPropIds"> <delete id="deleteMaPropSetByPropIds">
delete from ma_prop_set where type_id =#{typeId} delete from ma_prop_set where type_id =#{typeId}
</delete> </delete>
<delete id="deleteByIdsAll">
delete from ma_prop_set where type_id in
<foreach item="typeIds" collection="array" open="(" separator="," close=")">
#{typeIds}
</foreach>
</delete>
<select id="selectMaPropSet" resultType="com.bonus.sgzb.base.domain.MaPropInfo" resultMap="MaPropInfoResult"> <select id="selectMaPropSet" resultType="com.bonus.sgzb.base.domain.MaPropInfo" resultMap="MaPropInfoResult">
select a.prop_id, a.prop_name, a.code, a.status, a.dept_id, a.del_flag, a.create_by, select a.prop_id, a.prop_name, a.code, a.status, a.dept_id, a.del_flag, a.create_by,
a.create_time, a.remark, a.company_id ,b.dept_name a.create_time, a.remark, a.company_id ,b.dept_name

View File

@ -125,7 +125,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService
task.setCode(purchaseCodeRule()); task.setCode(purchaseCodeRule());
task.setCreateTime(DateUtils.getNowDate()); task.setCreateTime(DateUtils.getNowDate());
task.setCompanyId(purchaseCheckInfo.getCompanyId()); task.setCompanyId(purchaseCheckInfo.getCompanyId());
task.setCreateBy(SecurityUtils.getUsername()); task.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
// 创建任务信息 // 创建任务信息
taskMapper.insertTmTask(task); taskMapper.insertTmTask(task);
purchaseCheckInfo.setTaskId(task.getTaskId()); purchaseCheckInfo.setTaskId(task.getTaskId());

View File

@ -96,8 +96,8 @@ public class SelectController {
@ApiOperation(value = "配件所属上级树") @ApiOperation(value = "配件所属上级树")
@PostMapping("getAccessoryTree") @PostMapping("getAccessoryTree")
public AjaxResult getAccessoryTree(@RequestBody SelectDto dto){ public AjaxResult getAccessoryTree(){
return service.getAccessoryTree(dto); return service.getAccessoryTree();
} }
@ApiOperation(value = "配件所属上级树") @ApiOperation(value = "配件所属上级树")

View File

@ -129,7 +129,7 @@ public interface SelectMapper {
* @author cwchen * @author cwchen
* @date 2023/12/20 20:26 * @date 2023/12/20 20:26
*/ */
List<TreeNode> getAccessoryTree(SelectDto dto); List<TreeNode> getAccessoryTree();
/** /**
* @param dto * @param dto

View File

@ -124,7 +124,7 @@ public interface SelectService {
* @author cwchen * @author cwchen
* @date 2023/12/20 20:25 * @date 2023/12/20 20:25
*/ */
AjaxResult getAccessoryTree(SelectDto dto); AjaxResult getAccessoryTree();
/** /**
* @param dto * @param dto

View File

@ -175,11 +175,11 @@ public class SelectServiceImpl implements SelectService {
} }
@Override @Override
public AjaxResult getAccessoryTree(SelectDto dto) { public AjaxResult getAccessoryTree() {
List<TreeNode> groupList = new ArrayList<>(); List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>(); List<TreeNode> list = new ArrayList<>();
try { try {
list = mapper.getAccessoryTree(dto); list = mapper.getAccessoryTree();
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数 // 创建树形结构数据集合作为参数
TreeBuild treeBuild = new TreeBuild(list); TreeBuild treeBuild = new TreeBuild(list);

View File

@ -141,6 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT pa_id AS id, SELECT pa_id AS id,
pa_name AS label, pa_name AS label,
parent_id AS parentId, parent_id AS parentId,
unit_id as unitName,
level level
FROM ma_part_type FROM ma_part_type
WHERE del_flag = '0' WHERE del_flag = '0'