基础管理,物资管理bug修改

This commit is contained in:
bonus 2024-12-04 18:06:31 +08:00
parent 3fd77df402
commit 97823f80a8
15 changed files with 228 additions and 93 deletions

View File

@ -78,9 +78,9 @@ public class BmUnitPersonController extends BaseController
@PreventRepeatSubmit
@RequiresPermissions("basic:person:remove")
@SysLog(title = "往来单位管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->解绑往来单位人员")
@DeleteMapping("/{unitId}")
public AjaxResult unbind(@PathVariable Long unitId)
@PostMapping("/unbind")
public AjaxResult unbind(@RequestBody BmUnitPerson bmUnitPerson)
{
return bmUnitPersonService.deleteBmUnitPersonByID(unitId);
return bmUnitPersonService.deleteBmUnitPersonByID(bmUnitPerson);
}
}

View File

@ -25,10 +25,10 @@ public interface BmUnitPersonMapper
/**
* 删除往来单位管理
*
* @param unitId 往来单位管理主键
* @param bmUnitPerson 往来单位管理主键
* @return 结果
*/
public int deleteBmUnitPersonByID(Long unitId);
public int deleteBmUnitPersonByID(BmUnitPerson bmUnitPerson);
/**
* 查询往来单位管理列表

View File

@ -26,10 +26,10 @@ public interface IBmUnitPersonService
/**
* 删除往来单位管理信息
*
* @param unitId 往来单位管理主键
* @param bmUnitPerson 往来单位管理主键
* @return 结果
*/
public AjaxResult deleteBmUnitPersonByID(Long unitId);
public AjaxResult deleteBmUnitPersonByID(BmUnitPerson bmUnitPerson);
/**
* 查询绑定的往来单位列表

View File

@ -73,9 +73,9 @@ public class BmUnitPersonServiceImpl implements IBmUnitPersonService
* @return 结果
*/
@Override
public AjaxResult deleteBmUnitPersonByID(Long unitId)
public AjaxResult deleteBmUnitPersonByID(BmUnitPerson bmUnitPerson)
{
int result = bmUnitPersonMapper.deleteBmUnitPersonByID(unitId);
int result = bmUnitPersonMapper.deleteBmUnitPersonByID(bmUnitPerson);
if (result > 0) {
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
}
@ -89,6 +89,7 @@ public class BmUnitPersonServiceImpl implements IBmUnitPersonService
*/
@Override
public List<BmUnit> selectBmUnitList(BmUnitPerson bmUnitPerson) {
Long paramId = bmUnitPerson.getUserId();
List<BmUnit> bmUnitList = bmUnitPersonMapper.selectBmUnitList(bmUnitPerson);
Long[] array = bmUnitList.stream()
// 提取 createBy 字段
@ -110,12 +111,19 @@ public class BmUnitPersonServiceImpl implements IBmUnitPersonService
if (CollectionUtils.isNotEmpty(bmUnitList)) {
bmUnitList.forEach(item -> {
Long userId = item.getUserId();
if (userId != null) {
if (paramId != null && userId !=null) {
if( userId.equals(paramId)){
String nickName = nickNameMap.get(paramId);
item.setUserName(nickName != null ? nickName : " ");
}
}else{
String nickName = nickNameMap.get(userId);
item.setUserName(nickName != null ? nickName : " ");
}
if (item.getUnitId() != null) {
//根据单位id去人员绑定中查询是否绑定赋值绑定状态
if(userId !=null){
item.setIsBind(bmUnitMapper.countBmUnitPersonByUnitId(item.getUnitId()) > 0 ? 1 : 0);
}
extracted(item);
@ -135,7 +143,7 @@ public class BmUnitPersonServiceImpl implements IBmUnitPersonService
*/
private void extracted(BmUnit unit) {
Map<String, String> labelMap = remoteConfig.getDictValue("bm_unit_type");
if (unit.getUnitId() != null) {
if (unit.getUserId() != null) {
//根据单位id去人员绑定中查询是否绑定赋值绑定状态
unit.setIsBind(bmUnitMapper.countBmUnitPersonByUnitId(unit.getUnitId()) > 0 ? 1 : 0);
}

View File

@ -64,26 +64,20 @@ public class TypeController extends BaseController {
List<Integer> parentIds = typeService.selectParentId(maTypeVo);
List<MaTypeVo> maTypeVos = new ArrayList<>();
ExcelUtil<MaTypeVo> util = new ExcelUtil<>(MaTypeVo.class);
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
for (Integer parentId : parentIds) {
maTypeVos.addAll(typeService.getListByParentId(parentId.longValue(), maTypeVo));
}
if (BooleanUtils.isTrue(maTypeVo.getDisplayBindRelationship())) {
List<MaTypeVo> finalMaTypeVos = typeService.getMyTypeAndBindUsers(maTypeVos);
Long userId = maTypeVo.getNewUserId();
List<MaTypeVo> finalMaTypeVos = typeService.getMyTypeAndBindUsers(maTypeVos,userId);
util.exportExcel(response, finalMaTypeVos, "物资类型管理数据");
} else {
util.exportExcel(response, maTypeVos, "物资类型管理数据");
}
}
// @ApiOperation(value = "查询物资类型管理列表(无分页)")
// @RequiresPermissions("ma:type:list")
// @GetMapping("/listNoPage")
// public AjaxResult listNoPage(MaTypeVo type) {
// List<MaTypeVo> list = typeService.selectTypeListAndParentInfo(type);
// return typeService.getMyTypeAndBindUsers(list);
// }
@ -100,6 +94,7 @@ public class TypeController extends BaseController {
if (CollectionUtils.isEmpty(parentIds)) {
return AjaxResult.success(new ArrayList<>());
}
List<MaTypeVo> maTypeVos = new ArrayList<>();
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
@ -107,7 +102,8 @@ public class TypeController extends BaseController {
maTypeVos.addAll(typeService.getListByParentId(parentId.longValue(), maTypeVo));
}
if (BooleanUtils.isTrue(maTypeVo.getDisplayBindRelationship())) {
List<MaTypeVo> finalMaTypeVos = typeService.getMyTypeAndBindUsers(maTypeVos);
Long userId = maTypeVo.getUserId();
List<MaTypeVo> finalMaTypeVos = typeService.getMyTypeAndBindUsers(maTypeVos,userId);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, finalMaTypeVos));
} else {
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, maTypeVos));

View File

@ -72,17 +72,6 @@ public class TypeKeeperController extends BaseController {
return success(typeKeeperService.selectTypeKeeperByID(ID));
}
/**
* 新增库管员配置
*/
// @ApiOperation(value = "新增库管员配置")
// @PreventRepeatSubmit
// @RequiresPermissions("ma:keeper:add")
// @SysLog(title = "库管员配置", businessType = OperaType.INSERT, module = "物资管理->新增库管员配置")
// @PostMapping
// public AjaxResult add(@RequestBody TypeKeeper typeKeeper) {
// return toAjax(typeKeeperService.insertTypeKeeper(typeKeeper));
// }
/**
* 新增库管员配置
@ -138,7 +127,7 @@ public class TypeKeeperController extends BaseController {
@PreventRepeatSubmit
@RequiresPermissions("ma:keeper:remove")
@SysLog(title = "库管员配置", businessType = OperaType.DELETE, logType = 1,module = "物资管理->删除单个库管员配置")
@DeleteMapping
@PostMapping("/unbind")
public AjaxResult remove(@RequestBody List<TypeKeeper> typeKeepers)
{
return toAjax(typeKeeperService.deleteTypeKeeperByUserIdAndTypeId(typeKeepers));

View File

@ -123,7 +123,7 @@ public class TypeRepairController extends BaseController
@PreventRepeatSubmit
@RequiresPermissions("ma:repair:remove")
@SysLog(title = "维修班机具配置", businessType = OperaType.DELETE, module = "仓储管理->删除单个维修班机具配置")
@DeleteMapping
@PostMapping("/unbind")
public AjaxResult remove(@RequestBody List<TypeRepair> typeRepairs)
{
return toAjax(typeRepairService.deleteTypeRepairByUserIdAndTypeId(typeRepairs));

View File

@ -39,11 +39,26 @@ public class Type extends BaseEntity {
@Excel(name = "库管员昵称")
private String keeperNickName;
/** 库管员昵称 */
@ApiModelProperty(value = "库管员昵称id")
@Excel(name = "库管员昵称id")
private String keeperId;
/** 左侧树用户id */
@Excel(name = "库管员昵称id")
@ApiModelProperty(value = "左侧树用户id")
private List<String> keeperArr;
/** 维修员昵称 */
@ApiModelProperty(value = "维修员昵称")
@Excel(name = "维修员昵称")
private String repairNickName;
/** 维修员昵称 */
@ApiModelProperty(value = "维修员昵称id")
@Excel(name = "维修员昵称id")
private String repairerId;
private List<String> repairerArr;
/** 仓库名称 */
@ApiModelProperty(value = "物资仓库名称")
@Excel(name = "物资仓库名称", sort = 6)
@ -170,6 +185,13 @@ public class Type extends BaseEntity {
@ApiModelProperty(value = "厂家规格型号")
private String facModel;
/** 左侧树用户id */
@Excel(name = "左侧树用户id")
@ApiModelProperty(value = "左侧树用户id")
private Long userId;
/** 推送智慧工程定义的门类分类机具编码 */
@Excel(name = "推送智慧工程定义的门类分类机具编码")
@ApiModelProperty(value = "推送智慧工程定义的门类分类机具编码")

View File

@ -150,4 +150,12 @@ public interface TypeMapper {
int getCountOfCodeMachine(@Param("record") LeaseOutDetails record);
int getMachineByCt(LeaseOutDetails record);
int deleteTypeKeeperByTypeId(Type type);
int insertTypeKeeper(Type keeper);
int deleteTypeRepairerByTypeId(Type type);
int insertTypeRepairer(Type repairer);
}

View File

@ -103,5 +103,5 @@ public interface ITypeService {
// AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto);
List<MaTypeVo> getMyTypeAndBindUsers(List<MaTypeVo> list);
List<MaTypeVo> getMyTypeAndBindUsers(List<MaTypeVo> list,Long userId);
}

View File

@ -21,6 +21,7 @@ import com.bonus.material.ma.domain.vo.MaTypeSelectVo;
import com.bonus.material.warehouse.domain.WhHouseSet;
import com.bonus.material.warehouse.service.IWhHouseSetService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.ma.mapper.TypeMapper;
import com.bonus.material.ma.domain.Type;
@ -52,6 +53,7 @@ public class TypeServiceImpl implements ITypeService {
@Resource
private IWhHouseSetService houseSetService;
/**
* 查询物资类型 -- 根据id
*
@ -306,6 +308,30 @@ public class TypeServiceImpl implements ITypeService {
whHouseSet.setTypeId(newTypeId);
houseSetService.insertWhHouseSet(whHouseSet);
}
//维护库管信息
List<String> keeperArr = type.getKeeperArr();
if (keeperArr != null && keeperArr.size()>0){
for(int i=0 ; i<keeperArr.size();i++){
Type keeper = new Type();
keeper.setKeeperId(keeperArr.get(i));
keeper.setTypeId(type.getTypeId());
typeMapper.insertTypeKeeper(keeper);
}
}
//维护维修员信息
List<String> repairerArr = type.getRepairerArr();
if (repairerArr != null && repairerArr.size()>0){
for(int i=0 ; i<repairerArr.size();i++){
Type repairer = new Type();
repairer.setRepairerId(repairerArr.get(i));
repairer.setTypeId(type.getTypeId());
typeMapper.insertTypeRepairer(repairer);
}
}
return count;
}
@ -322,6 +348,32 @@ public class TypeServiceImpl implements ITypeService {
if (maType != null && !maType.getTypeId().equals(type.getTypeId())) {
throw new RuntimeException("同级下类型名称存在重复!");
}
//维护库管信息
List<String> keeperArr = type.getKeeperArr();
if (keeperArr != null && keeperArr.size()>0){
typeMapper.deleteTypeKeeperByTypeId(type);
for(int i=0 ; i<keeperArr.size();i++){
Type keeper = new Type();
keeper.setKeeperId(keeperArr.get(i));
keeper.setTypeId(type.getTypeId());
typeMapper.insertTypeKeeper(keeper);
}
}
//维护维修员信息
List<String> repairerArr = type.getRepairerArr();
if (repairerArr != null && repairerArr.size()>0){
typeMapper.deleteTypeRepairerByTypeId(type);
for(int i=0 ; i<repairerArr.size();i++){
Type repairer = new Type();
repairer.setRepairerId(repairerArr.get(i));
repairer.setTypeId(type.getTypeId());
typeMapper.insertTypeRepairer(repairer);
}
}
type.setUpdateTime(DateUtils.getNowDate());
type.setUpdateBy(SecurityUtils.getUserId().toString());
return typeMapper.updateType(type);
@ -589,24 +641,46 @@ public class TypeServiceImpl implements ITypeService {
// }
@Override
public List<MaTypeVo> getMyTypeAndBindUsers(List<MaTypeVo> list) {
public List<MaTypeVo> getMyTypeAndBindUsers(List<MaTypeVo> list,Long userId) {
List<TypeRepair> typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair());
List<TypeKeeper> typeKeeperList = typeKeeperService.selectTypeKeeperListAndUserName(new TypeKeeper());
for (MaTypeVo maTypeVo : list) {
if (CollectionUtils.isNotEmpty(typeRepairList)) {
for (TypeRepair typeRepair : typeRepairList) {
if (Objects.nonNull(typeRepair.getTypeId()) && typeRepair.getTypeId().equals(maTypeVo.getTypeId())) {
maTypeVo.setRepairUserId(typeRepair.getUserId());
maTypeVo.setRepairUserName(typeRepair.getUserName());
break;
if(userId !=null){
Long repairerId = typeRepair.getUserId();
if (repairerId.equals(userId)){
maTypeVo.setRepairUserId(typeRepair.getUserId());
maTypeVo.setRepairUserName(typeRepair.getUserName());
}
}else{
maTypeVo.setRepairUserId(typeRepair.getUserId());
maTypeVo.setRepairUserName(typeRepair.getUserName());
}
}
}
}
if (CollectionUtils.isNotEmpty(typeKeeperList)) {
for (TypeKeeper typeKeeper : typeKeeperList) {
if (Objects.nonNull(typeKeeper.getTypeId()) && typeKeeper.getTypeId().equals(maTypeVo.getTypeId())) {
maTypeVo.setKeeperUserId(typeKeeper.getUserId());
maTypeVo.setKeeperUserName(typeKeeper.getUserName());
if(userId !=null){
Long keeperId = typeKeeper.getUserId();
if (keeperId.equals(userId)){
maTypeVo.setKeeperUserId(typeKeeper.getUserId());
maTypeVo.setKeeperUserName(typeKeeper.getUserName());
}
}else{
maTypeVo.setKeeperUserId(typeKeeper.getUserId());
maTypeVo.setKeeperUserName(typeKeeper.getUserName());
}
}
}
}

View File

@ -42,10 +42,10 @@ public class PurchaseCheckInfo extends BaseEntity {
private String code;
/** 采购日期 */
// @Excel(name = "采购日期", sort = 1)
// @ApiModelProperty(value = "采购日期")
// @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
// private Date purchaseTime;
@Excel(name = "采购日期", sort = 1)
@ApiModelProperty(value = "采购日期")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date purchaseTime;
/** 到货日期 */
@ApiModelProperty(value = "到货日期")

View File

@ -14,6 +14,7 @@ public class PurchaseVerifyVo {
@ApiModelProperty(value = "验收是否通过")
private Boolean verifyPass;
/** 验收结论 */
//@Excel(name = "验收结论")
@ApiModelProperty(value = "验收结论")

View File

@ -20,8 +20,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<delete id="deleteBmUnitPersonByID" parameterType="Long">
delete from bm_unit_person where unit_id = #{unitId}
<delete id="deleteBmUnitPersonByID" parameterType="com.bonus.material.basic.domain.BmUnit">
delete from bm_unit_person where unit_id = #{unitId} AND user_id = #{userId}
</delete>
<select id="selectBmUnitList" resultType="com.bonus.material.basic.domain.BmUnit">
@ -43,9 +43,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
bm_unit bu
left join bm_unit_person bup ON bu.unit_id = bup.unit_id
<if test="userId != null and userId != ''">
AND bup.user_id = #{userId}
</if>
WHERE
bu.del_flag = 0
<if test="unitName != null and unitName != ''">and bu.unit_name like concat('%', #{unitName}, '%')</if>
<if test="unitName != null and unitName != ''">
and bu.unit_name like concat('%', #{unitName}, '%')
</if>
group by bu.unit_id
</select>
</mapper>

View File

@ -160,14 +160,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t.rent_price,t.buy_price,t.pay_ratio,t.pay_price,t.tax_ratio,t.level,t.rated_load,t.test_load,
t.holding_time,t.warn_num,t.create_by,t.create_time,t.update_by,t.update_time,t.is_plan,
t.is_ancuo,t.remark,t.fac_model,t.intelligent_code,
su.user_name as keeper_nick_name,
su2.user_name as repair_nick_name
GROUP_CONCAT(distinct su.user_name) as keeper_nick_name,
GROUP_CONCAT(distinct su.user_id) as keeperId,
GROUP_CONCAT(distinct su2.user_name) as repair_nick_name,
GROUP_CONCAT(distinct su2.user_id) as repairerId,
hi.house_name
FROM ma_type AS t
left join ma_type_keeper mtk on t.type_id = mtk.type_id
left join ma_type_repair mtr on t.type_id = mtr.type_id
left join sys_user su on mtk.user_id = su.user_id and su.del_flag = 0
left join sys_user su2 on mtr.user_id = su2.user_id and su2.del_flag = 0
left join ma_type mt2 on t.parent_id = mt2.type_id
left join ma_type mt3 on mt2.parent_id = mt3.type_id
left join wh_house_set hs on mt3.parent_id = hs.type_id
left join wh_house_info hi on hs.house_id = hi.house_id
left join ma_type_keeper mtk on t.type_id = mtk.type_id
left join ma_type_repair mtr on t.type_id = mtr.type_id
left join sys_user su on mtk.user_id = su.user_id and su.del_flag = 0
left join sys_user su2 on mtr.user_id = su2.user_id and su2.del_flag = 0
WHERE t.type_id = #{typeId} and t.del_flag = 0
GROUP BY t.type_id
limit 1
</select>
@ -195,6 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
and mt2.type_id is not null
and mhs.house_id = #{houseId} and mhs.del_flag = 0
</where>
</select>
@ -537,6 +547,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
or m3.type_name like concat('%',#{type.keyword},'%')
)
</if>
GROUP BY m.type_id
</select>
<select id="queryByNameAndParentId" resultType="com.bonus.material.ma.domain.Type">
select
@ -715,4 +726,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
WHERE mt.del_flag = '0' and mt.type_id = #{typeId}
</select>
<delete id="deleteTypeKeeperByTypeId">
delete from ma_type_keeper where type_id = #{typeId}
</delete>
<insert id="insertTypeKeeper">
insert into ma_type_keeper(type_id, user_id) values (#{typeId},#{keeperId})
</insert>
<delete id="deleteTypeRepairerByTypeId">
delete from ma_type_repair where type_id = #{typeId}
</delete>
<insert id="insertTypeRepairer">
insert into ma_type_repair(type_id, user_id) values (#{typeId},#{repairerId})
</insert>
</mapper>