Commit 08880846 authored by 张森's avatar 张森

Merge remote-tracking branch 'origin/develop_dl' into develop_dl_bugfix

# Conflicts: # amos-boot-system-equip/src/main/resources/application-dev.properties
parents 837c6efc 76c5d1ae
...@@ -35,7 +35,7 @@ public interface EquipFeignClient { ...@@ -35,7 +35,7 @@ public interface EquipFeignClient {
* @return * @return
*/ */
@RequestMapping(value = "/stock-detail/airport/person/bind", method = RequestMethod.POST) @RequestMapping(value = "/stock-detail/airport/person/bind", method = RequestMethod.POST)
ResponseModel<List<Object>> stockBindEquip(@RequestBody List<Long> ids) throws InnerInvokException; ResponseModel<List<Object>> stockBindEquip(@RequestBody List<Map<String, Number>> stocks) throws InnerInvokException;
/** /**
* 人员装备退装 * 人员装备退装
...@@ -43,7 +43,7 @@ public interface EquipFeignClient { ...@@ -43,7 +43,7 @@ public interface EquipFeignClient {
* @return * @return
*/ */
@RequestMapping(value = "/scrap/airport/person", method = RequestMethod.POST) @RequestMapping(value = "/scrap/airport/person", method = RequestMethod.POST)
ResponseModel<Object> scrapEquip(@RequestBody String id) throws InnerInvokException; ResponseModel<Object> scrapEquip(@RequestBody Map<String, Object> map) throws InnerInvokException;
/** /**
* 人员装备回库 * 人员装备回库
......
...@@ -3,6 +3,9 @@ package com.yeejoin.amos.boot.module.common.api.mapper; ...@@ -3,6 +3,9 @@ package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersJacket; import com.yeejoin.amos.boot.module.common.api.entity.FirefightersJacket;
import java.util.List;
import java.util.Map;
/** /**
* 消防人员配装记录 Mapper 接口 * 消防人员配装记录 Mapper 接口
* *
...@@ -11,4 +14,6 @@ import com.yeejoin.amos.boot.module.common.api.entity.FirefightersJacket; ...@@ -11,4 +14,6 @@ import com.yeejoin.amos.boot.module.common.api.entity.FirefightersJacket;
*/ */
public interface FirefightersJacketMapper extends BaseMapper<FirefightersJacket> { public interface FirefightersJacketMapper extends BaseMapper<FirefightersJacket> {
List<Map<String, Object>> getPersonEquipCount();
} }
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.FirefightersJacketMapper"> <mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.FirefightersJacketMapper">
<select id="getPersonEquipCount" resultType="java.util.Map">
SELECT
equipment_type_name AS name,
SUM(amount) AS value,
'个' AS unnit
FROM
jc_firefighters_jacket
WHERE
is_delete = 0
GROUP BY
equipment_type_name
</select>
</mapper> </mapper>
...@@ -1520,7 +1520,7 @@ ...@@ -1520,7 +1520,7 @@
) g ON u.sequence_nbr = g.instance_id ) g ON u.sequence_nbr = g.instance_id
WHERE WHERE
u.biz_org_type = 'person' u.biz_org_type = 'person'
AND g.peopleType IN ('1601', '1602', '1603') AND g.peopleType IN ('1601', '1602', '1603', '1604')
AND u.is_delete = 0 AND u.is_delete = 0
<if test="bizOrgCode != null and bizOrgCode != ''"> <if test="bizOrgCode != null and bizOrgCode != ''">
AND u.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%') AND u.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%')
...@@ -1535,6 +1535,8 @@ ...@@ -1535,6 +1535,8 @@
LEFT JOIN ( SELECT * FROM cb_data_dictionary WHERE type = 'XFGLGW' ) b ON LOCATE( b.CODE, a.fireManagementPost ) != 0 LEFT JOIN ( SELECT * FROM cb_data_dictionary WHERE type = 'XFGLGW' ) b ON LOCATE( b.CODE, a.fireManagementPost ) != 0
WHERE WHERE
a.sequenceNbr IS NOT NULL AND b.`name` IS NOT NULL a.sequenceNbr IS NOT NULL AND b.`name` IS NOT NULL
GROUP BY
sequenceNbr
) a ) a
GROUP BY GROUP BY
postName postName
...@@ -1642,6 +1644,7 @@ ...@@ -1642,6 +1644,7 @@
u.biz_org_type = 'person' u.biz_org_type = 'person'
AND g.peopleType IN ('1601', '1602', '1603') AND g.peopleType IN ('1601', '1602', '1603')
AND u.is_delete = 0 AND u.is_delete = 0
AND cf.biz_org_name is not null
<if test="map.bizOrgCode != null and map.bizOrgCode != ''"> <if test="map.bizOrgCode != null and map.bizOrgCode != ''">
AND u.biz_org_code LIKE CONCAT(#{map.bizOrgCode}, '%') AND u.biz_org_code LIKE CONCAT(#{map.bizOrgCode}, '%')
</if> </if>
......
...@@ -249,4 +249,8 @@ public class Car extends BaseEntity { ...@@ -249,4 +249,8 @@ public class Car extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String equipStatusFilter; private String equipStatusFilter;
@ApiModelProperty(value = "使用方式")
private String useType;
} }
...@@ -13,7 +13,7 @@ public enum EquipTypeEnum { ...@@ -13,7 +13,7 @@ public enum EquipTypeEnum {
/** /**
* 退库,回库 * 退库,回库
*/ */
退装("scrap", "退装"), 报废("scrap", "报废"),
回库("stock", "回库"); 回库("stock", "回库");
private String key; private String key;
......
...@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.EquipmentOnCarDto; ...@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.EquipmentOnCarDto;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 消防人员配装记录 服务类 * 消防人员配装记录 服务类
...@@ -16,6 +17,8 @@ import java.util.List; ...@@ -16,6 +17,8 @@ import java.util.List;
*/ */
public interface IFirefightersJacketService { public interface IFirefightersJacketService {
List<Map<String, Object>> getPersonEquipCount();
ResponseModel<Page<Object>> getAirEquipSpecificPage(EquipSpecificDto equipSpecificDto, int current, int size); ResponseModel<Page<Object>> getAirEquipSpecificPage(EquipSpecificDto equipSpecificDto, int current, int size);
boolean saveOrUpdateBatch(Long firefightersId, List<EquipmentOnCarDto> equipmentOnCarDtos); boolean saveOrUpdateBatch(Long firefightersId, List<EquipmentOnCarDto> equipmentOnCarDtos);
......
...@@ -267,6 +267,9 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -267,6 +267,9 @@ public class EquipmentSpecificController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "列表分页查询", notes = "列表分页查询") @ApiOperation(httpMethod = "POST", value = "列表分页查询", notes = "列表分页查询")
public IPage<EquipmentOnCarVo> onCarVoIPage(@RequestBody EquipmentSpecificDto equipmentSpecificDto) { public IPage<EquipmentOnCarVo> onCarVoIPage(@RequestBody EquipmentSpecificDto equipmentSpecificDto) {
ReginParams ReginParams = getSelectedOrgInfo();
String bizOrgCode= ReginParams.getPersonIdentity().getBizOrgCode();
equipmentSpecificDto.setBizOrgCode(bizOrgCode);
return equipmentSpecificSerivce.onCarVoIPage(equipmentSpecificDto); return equipmentSpecificSerivce.onCarVoIPage(equipmentSpecificDto);
} }
......
...@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* *
...@@ -222,9 +223,9 @@ public class ScrapController extends AbstractBaseController { ...@@ -222,9 +223,9 @@ public class ScrapController extends AbstractBaseController {
@RequestMapping(value = "/airport/person", method = RequestMethod.POST) @RequestMapping(value = "/airport/person", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "机场人员装备退装接口", notes = "人员装备报废", produces = "application/json;charset=UTF-8") @ApiOperation(httpMethod = "POST", value = "机场人员装备退装接口", notes = "人员装备报废", produces = "application/json;charset=UTF-8")
public ResponseModel scrapOnPerson(@RequestBody String id) { public ResponseModel scrapOnPerson(@RequestBody Map<String, Object> map) {
try { try {
iScrapService.scrapOnPerson(Long.valueOf(id)); iScrapService.scrapOnPerson(map, getUserInfo());
} catch (Exception e) { } catch (Exception e) {
return CommonResponseUtil.failure("人员装备报废失败!"); return CommonResponseUtil.failure("人员装备报废失败!");
} }
......
...@@ -215,10 +215,10 @@ public class StockDetailController { ...@@ -215,10 +215,10 @@ public class StockDetailController {
@RequestMapping(value = "/airport/person/bind", method = RequestMethod.POST) @RequestMapping(value = "/airport/person/bind", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "人员装备列装接口", notes = "人员装备列装", produces = "application/json;charset=UTF-8") @ApiOperation(httpMethod = "POST", value = "人员装备列装接口", notes = "人员装备列装", produces = "application/json;charset=UTF-8")
public ResponseModel loadOnPerson(@RequestBody List<String> ids) { public ResponseModel loadOnPerson(@RequestBody List<Map<String, Number>> stocks) {
List<StockDetail> stockDetails = null; List<StockDetail> stockDetails = null;
if (0 < ids.size()) { if (!stocks.isEmpty()) {
stockDetails = iStockDetailService.loadOnPerson(ids); stockDetails = iStockDetailService.loadOnPerson(stocks);
} }
return CommonResponseUtil.success(stockDetails); return CommonResponseUtil.success(stockDetails);
} }
......
...@@ -10,6 +10,7 @@ import com.yeejoin.equipmanage.common.entity.ScrapDetail; ...@@ -10,6 +10,7 @@ import com.yeejoin.equipmanage.common.entity.ScrapDetail;
import com.yeejoin.equipmanage.common.entity.SystemDic; import com.yeejoin.equipmanage.common.entity.SystemDic;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 服务类 * 服务类
...@@ -29,7 +30,7 @@ public interface IScrapService extends IService<Scrap> { ...@@ -29,7 +30,7 @@ public interface IScrapService extends IService<Scrap> {
void scrapOnCar(Long id); void scrapOnCar(Long id);
void scrapOnPerson(Long id); void scrapOnPerson(Map<String, Object> map, AgencyUserModel agencyUserModel);
void delPerson(Long id); void delPerson(Long id);
} }
...@@ -24,7 +24,7 @@ public interface IStockDetailService extends IService<StockDetail> { ...@@ -24,7 +24,7 @@ public interface IStockDetailService extends IService<StockDetail> {
IPage<StockDetail> pagePlaceEquip(Page<StockDetail> pageBean, Long equipmentDetailId, Long warehouseStructureId); IPage<StockDetail> pagePlaceEquip(Page<StockDetail> pageBean, Long equipmentDetailId, Long warehouseStructureId);
List<StockDetail> loadOnPerson(List<String> ids); List<StockDetail> loadOnPerson(List<Map<String, Number>> stocks);
StockDetail unloadPerson(Map<String, Object> map); StockDetail unloadPerson(Map<String, Object> map);
......
...@@ -355,7 +355,16 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -355,7 +355,16 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
.collect(Collectors.groupingBy(EquipmentIndex::getEquipmentId)); .collect(Collectors.groupingBy(EquipmentIndex::getEquipmentId));
Map<Long, Unit> unitMap = iUnitService.list().stream().collect(Collectors.toMap(Unit::getId, t -> t)); Map<Long, Unit> unitMap = iUnitService.list().stream().collect(Collectors.toMap(Unit::getId, t -> t));
Map<Long, EquipmentCategory> categoryMap = equipmentCategoryMapper.selectList(null).stream().collect(Collectors.toMap(EquipmentCategory::getId, t -> t)); Map<Long, EquipmentCategory> categoryMap = equipmentCategoryMapper.selectList(null).stream().collect(Collectors.toMap(EquipmentCategory::getId, t -> t));
for (Equipment equipment : list) { for (int i = 0; i <list.size(); i++) {
Equipment equipment = list.get(i);
EquipmentCategory equipmentCategory = categoryMap.get(equipment.getCategoryId());
String categoryCode = equipment.getCode();
// 移除非消耗性设备
if (Objects.isNull(equipmentCategory) || !Objects.equals(equipmentCategory.getIndustryCode(), "2") || categoryCode.charAt(0) == '2' || categoryCode.charAt(0) == '9') {
list.remove(equipment);
i--;
continue;
}
List<EquipmentIndex> quotaList = equipmentIndexMap.get(equipment.getId().toString()); List<EquipmentIndex> quotaList = equipmentIndexMap.get(equipment.getId().toString());
List<EquProperty> properList = new ArrayList<EquProperty>(); List<EquProperty> properList = new ArrayList<EquProperty>();
if (CollUtil.isNotEmpty(quotaList)) { if (CollUtil.isNotEmpty(quotaList)) {
...@@ -371,7 +380,6 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -371,7 +380,6 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
properList.add(equProperty); properList.add(equProperty);
} }
} }
EquipmentCategory equipmentCategory = categoryMap.get(equipment.getCategoryId());
if (ObjectUtils.isNotEmpty(equipmentCategory)) { if (ObjectUtils.isNotEmpty(equipmentCategory)) {
equipment.setEquipCategoryId(equipmentCategory.getId()); equipment.setEquipCategoryId(equipmentCategory.getId());
equipment.setEquipCategoryCode(equipmentCategory.getCode()); equipment.setEquipCategoryCode(equipmentCategory.getCode());
......
...@@ -1156,17 +1156,20 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1156,17 +1156,20 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List<AlarmDataVO> list = this.baseMapper.getSystemById(id); List<AlarmDataVO> list = this.baseMapper.getSystemById(id);
// 部件总数 // 部件总数
Integer equipmentCount = equipmentSpecificMapper.selectCount( Integer equipmentCount = equipmentSpecificMapper.selectCount(
Wrappers.<EquipmentSpecific>lambdaQuery().eq(EquipmentSpecific::getSystemId, id) Wrappers.<EquipmentSpecific>lambdaQuery()
.eq(EquipmentSpecific::getSystemId, id)
.eq(EquipmentSpecific::getSingle, true)
); );
// 今日报警次数 // 未复归设备
Integer alarmCount = equipmentSpecificAlarmLogMapper.selectCount( List<EquipmentSpecificAlarmLog> equipSpecIds = equipmentSpecificAlarmLogMapper.selectList(
Wrappers.<EquipmentSpecificAlarmLog>lambdaQuery() Wrappers.<EquipmentSpecificAlarmLog>lambdaQuery()
.select(EquipmentSpecificAlarmLog::getEquipmentSpecificId)
.like(EquipmentSpecificAlarmLog::getSystemIds, id) .like(EquipmentSpecificAlarmLog::getSystemIds, id)
.eq(EquipmentSpecificAlarmLog::getStatus, "1") .eq(EquipmentSpecificAlarmLog::getStatus, "1")
.likeRight(EquipmentSpecificAlarmLog::getCreateDate, LocalDate.now().toString())
); );
int count = (int) equipSpecIds.stream().map(EquipmentSpecificAlarmLog::getEquipmentSpecificId).distinct().count();
list.add(new AlarmDataVO("部件总数", equipmentCount + " 个", false)); list.add(new AlarmDataVO("部件总数", equipmentCount + " 个", false));
list.add(new AlarmDataVO("今日报警次数", alarmCount + " 次", false)); list.add(new AlarmDataVO("未复归设备", count + " 个", false));
return list; return list;
} }
......
...@@ -72,6 +72,7 @@ public class ScrapServiceImpl extends ServiceImpl<ScrapMapper, Scrap> implements ...@@ -72,6 +72,7 @@ public class ScrapServiceImpl extends ServiceImpl<ScrapMapper, Scrap> implements
scrap.setBillCode(stockBillService.generateQrCode("BF")); scrap.setBillCode(stockBillService.generateQrCode("BF"));
scrap.setBillType(type); scrap.setBillType(type);
scrap.setStatus(TaskStatusEnum.INPROGRESS.getCode()); scrap.setStatus(TaskStatusEnum.INPROGRESS.getCode());
scrap.setUserId(Long.valueOf(agencyUserModel.getUserId()));
scrap.setCreatorName(agencyUserModel.getRealName()); scrap.setCreatorName(agencyUserModel.getRealName());
scrapService.save(scrap); scrapService.save(scrap);
for (ScrapDetail scrapDetail : list) { for (ScrapDetail scrapDetail : list) {
...@@ -312,15 +313,20 @@ public class ScrapServiceImpl extends ServiceImpl<ScrapMapper, Scrap> implements ...@@ -312,15 +313,20 @@ public class ScrapServiceImpl extends ServiceImpl<ScrapMapper, Scrap> implements
} }
@Override @Override
public void scrapOnPerson(Long id) { @Transactional
// QueryWrapper<StockDetail> queryWrapper = new QueryWrapper<>(); public void scrapOnPerson(Map<String, Object> map, AgencyUserModel agencyUserModel) {
// StockDetail stockDetail = stockDetailService.getOne(queryWrapper.eq("equipment_specific_id", id)); Long id = Long.valueOf(map.get("stockDetailId").toString());
double amount = Double.parseDouble(map.get("amount").toString());
StockDetail stockDetail = stockDetailService.getById(id); StockDetail stockDetail = stockDetailService.getById(id);
if (null == stockDetail) { if (null == stockDetail) {
throw new RuntimeException("id为"+ id + "的StockDetail实体不存在!"); throw new RuntimeException("id为"+ id + "的StockDetail实体不存在!");
} }
stockDetail.setStatus(String.valueOf(EquipStatusEnum.SCRAP.getCode()));
stockDetailService.updateById(stockDetail); stockDetailService.updateById(stockDetail);
// 添加报废流程
ScrapDetail scrapDetail = new ScrapDetail();
scrapDetail.setStockDetailId(stockDetail.getId());
scrapDetail.setAmount(amount);
this.create(Collections.singletonList(scrapDetail), BillContentEnum.ZB.getCode(), agencyUserModel);
} }
@Override @Override
......
...@@ -144,15 +144,20 @@ public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, Stock ...@@ -144,15 +144,20 @@ public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, Stock
} }
@Override @Override
public List<StockDetail> loadOnPerson(List<String> ids) { public List<StockDetail> loadOnPerson(List<Map<String, Number>> stocks) {
List<StockDetail> list = new ArrayList<>(); List<StockDetail> list = new ArrayList<>();
ids.forEach(x -> { stocks.forEach(x -> {
StockDetail stockDetail = this.baseMapper.selectById(Long.valueOf(x)); StockDetail stockDetail = this.baseMapper.selectById(Long.valueOf(x.get("stockDetailId").toString()));
if (null == stockDetail) { if (null == stockDetail) {
throw new RuntimeException("id 为"+ x + "的StockDetail不存在 !"); throw new RuntimeException("id 为"+ x + "的StockDetail不存在 !");
} }
double stockAmount = stockDetail.getAmount() - Double.parseDouble(x.get("amount").toString());
if (stockAmount < 0) {
throw new RuntimeException("库存不足");
} else if (stockAmount == 0) {
stockDetail.setStatus(String.valueOf(EquipStatusEnum.LOAD.getCode())); stockDetail.setStatus(String.valueOf(EquipStatusEnum.LOAD.getCode()));
stockDetail.setAmount(Math.abs(stockDetail.getAmount() - 1.0)); }
stockDetail.setAmount(stockAmount);
this.baseMapper.updateById(stockDetail); this.baseMapper.updateById(stockDetail);
list.add(stockDetail); list.add(stockDetail);
}); });
...@@ -196,12 +201,14 @@ public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, Stock ...@@ -196,12 +201,14 @@ public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, Stock
@Override @Override
public StockDetail unloadPerson(Map<String, Object> map) { public StockDetail unloadPerson(Map<String, Object> map) {
// Long structureId = Long.valueOf(String.valueOf(map.get("warehouseStructureId")));
Long stockDetailId = Long.valueOf(String.valueOf(map.get("stockDetailId"))); Long stockDetailId = Long.valueOf(String.valueOf(map.get("stockDetailId")));
double amount = Double.parseDouble(String.valueOf(map.get("amount")));
if (amount == 0) {
throw new RuntimeException("数量不能为空");
}
StockDetail stockDetail = this.baseMapper.selectById(stockDetailId); StockDetail stockDetail = this.baseMapper.selectById(stockDetailId);
stockDetail.setStatus(String.valueOf(EquipStatusEnum.REPERTORY.getCode()));//陈浩修改,原本退装枚举值所对应的jcs逻辑是回库,现确定为在位状态 stockDetail.setStatus(String.valueOf(EquipStatusEnum.REPERTORY.getCode()));//陈浩修改,原本退装枚举值所对应的jcs逻辑是回库,现确定为在位状态
// stockDetail.setWarehouseStructureId(structureId); stockDetail.setAmount(stockDetail.getAmount() + amount);
stockDetail.setAmount(stockDetail.getAmount() + 1.0);
this.baseMapper.updateById(stockDetail); this.baseMapper.updateById(stockDetail);
return stockDetail; return stockDetail;
} }
......
...@@ -26,10 +26,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -26,10 +26,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -71,8 +68,10 @@ public class WlSpareEquipmentServiceImpl extends ServiceImpl<WlSpareEquipmentMap ...@@ -71,8 +68,10 @@ public class WlSpareEquipmentServiceImpl extends ServiceImpl<WlSpareEquipmentMap
public WlSpareEquipment saveOrUpdateSpareEquipment(WlSpareEquipment wlSpareEquipment, ReginParams reginParams) { public WlSpareEquipment saveOrUpdateSpareEquipment(WlSpareEquipment wlSpareEquipment, ReginParams reginParams) {
wlSpareEquipment.setBizOrgName(reginParams.getPersonIdentity().getCompanyName()); wlSpareEquipment.setBizOrgName(reginParams.getPersonIdentity().getCompanyName());
wlSpareEquipment.setBizOrgCode(reginParams.getPersonIdentity().getCompanyBizOrgCode()); wlSpareEquipment.setBizOrgCode(reginParams.getPersonIdentity().getCompanyBizOrgCode());
if (Objects.nonNull(wlSpareEquipment.getWarehouseStructureId())) {
WarehouseStructure warehouseStructure = warehouseStructureMapper.selectById(wlSpareEquipment.getWarehouseStructureId()); WarehouseStructure warehouseStructure = warehouseStructureMapper.selectById(wlSpareEquipment.getWarehouseStructureId());
wlSpareEquipment.setWarehouseStructureCode(warehouseStructure.getCode()); wlSpareEquipment.setWarehouseStructureCode(warehouseStructure.getCode());
}
if (ObjectUtils.isEmpty(wlSpareEquipment.getId())) { if (ObjectUtils.isEmpty(wlSpareEquipment.getId())) {
wlSpareEquipmentMapper.insert(wlSpareEquipment); wlSpareEquipmentMapper.insert(wlSpareEquipment);
} else { } else {
...@@ -147,7 +146,13 @@ public class WlSpareEquipmentServiceImpl extends ServiceImpl<WlSpareEquipmentMap ...@@ -147,7 +146,13 @@ public class WlSpareEquipmentServiceImpl extends ServiceImpl<WlSpareEquipmentMap
@Override @Override
public Page<WlSpareEquipment> listByPage(WlSpareEquipment dto, Page page, int hierarchy, String codeHead) { public Page<WlSpareEquipment> listByPage(WlSpareEquipment dto, Page page, int hierarchy, String codeHead) {
return wlSpareEquipmentMapper.listByPage(page, dto, hierarchy, codeHead); Page<WlSpareEquipment> wlSpareEquipmentPage = wlSpareEquipmentMapper.listByPage(page, dto, hierarchy, codeHead);
List<WlSpareEquipment> records = wlSpareEquipmentPage.getRecords();
for (WlSpareEquipment record : records) {
record.setImg(getEquipFileList(record.getId(), FileTypeEnum.image.toString()));
}
wlSpareEquipmentPage.setRecords(records);
return wlSpareEquipmentPage;
} }
@Override @Override
...@@ -235,7 +240,6 @@ public class WlSpareEquipmentServiceImpl extends ServiceImpl<WlSpareEquipmentMap ...@@ -235,7 +240,6 @@ public class WlSpareEquipmentServiceImpl extends ServiceImpl<WlSpareEquipmentMap
@Override @Override
public void subtractNum(Long id, Float num) { public void subtractNum(Long id, Float num) {
synchronized (id.toString()) {
WlSpareEquipment wlSpareEquipment = this.getById(id); WlSpareEquipment wlSpareEquipment = this.getById(id);
if (num > wlSpareEquipment.getStockNum()) { if (num > wlSpareEquipment.getStockNum()) {
throw new BadRequest("使用数量大于备品备件库存数量"); throw new BadRequest("使用数量大于备品备件库存数量");
...@@ -243,7 +247,6 @@ public class WlSpareEquipmentServiceImpl extends ServiceImpl<WlSpareEquipmentMap ...@@ -243,7 +247,6 @@ public class WlSpareEquipmentServiceImpl extends ServiceImpl<WlSpareEquipmentMap
wlSpareEquipment.setStockNum(wlSpareEquipment.getStockNum() - num); wlSpareEquipment.setStockNum(wlSpareEquipment.getStockNum() - num);
this.updateById(wlSpareEquipment); this.updateById(wlSpareEquipment);
} }
}
@Override @Override
public List<EquipmentCategory> getEquipmentTypeAndCount(String bizOrgCode) { public List<EquipmentCategory> getEquipmentTypeAndCount(String bizOrgCode) {
......
...@@ -3,9 +3,11 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller; ...@@ -3,9 +3,11 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -174,6 +176,16 @@ public class FirefightersJacketController extends BaseController { ...@@ -174,6 +176,16 @@ public class FirefightersJacketController extends BaseController {
} }
/** /**
* 分页查询设备数量(调用装备接口)
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "人员装备数量")
@RequestMapping(value = "/person-equip-count", method = RequestMethod.GET)
public ResponseModel<List<Map<String, Object>>> getPersonEquipCount() {
return ResponseHelper.buildResponse(iFirefightersJacketService.getPersonEquipCount());
}
/**
* 分页查询设备列表(调用装备接口) * 分页查询设备列表(调用装备接口)
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
......
...@@ -36,6 +36,13 @@ public class FirefightersJacketServiceImpl extends BaseService<FirefightersJacke ...@@ -36,6 +36,13 @@ public class FirefightersJacketServiceImpl extends BaseService<FirefightersJacke
@Autowired @Autowired
private EquipFeignClient equipFeignClient; private EquipFeignClient equipFeignClient;
@Autowired
private FirefightersJacketMapper firefightersJacketMapper;
@Override
public List<Map<String, Object>> getPersonEquipCount() {
return firefightersJacketMapper.getPersonEquipCount();
}
@Override @Override
public ResponseModel<Page<Object>> getAirEquipSpecificPage(EquipSpecificDto equipSpecificDto, int current, int size) { public ResponseModel<Page<Object>> getAirEquipSpecificPage(EquipSpecificDto equipSpecificDto, int current, int size) {
...@@ -47,9 +54,15 @@ public class FirefightersJacketServiceImpl extends BaseService<FirefightersJacke ...@@ -47,9 +54,15 @@ public class FirefightersJacketServiceImpl extends BaseService<FirefightersJacke
@Override @Override
public boolean saveOrUpdateBatch(Long firefightersId, List<EquipmentOnCarDto> equipmentOnCarDtos) { public boolean saveOrUpdateBatch(Long firefightersId, List<EquipmentOnCarDto> equipmentOnCarDtos) {
List<Long> ids = equipmentOnCarDtos.stream().map(EquipmentOnCarDto::getStockDetailId).collect(Collectors.toList()); List<Map<String, Number>> stocks = new ArrayList<>();
List<Object> result = equipFeignClient.stockBindEquip(ids).getResult(); for (EquipmentOnCarDto dto : equipmentOnCarDtos) {
if (result.size() > 0) { stocks.add(new HashMap<String, Number>() {{
this.put("stockDetailId", dto.getStockDetailId());
this.put("amount", dto.getAmount());
}});
}
List<Object> result = equipFeignClient.stockBindEquip(stocks).getResult();
if (!result.isEmpty()) {
List<FirefightersJacket> firefightersJackets = new ArrayList<>(); List<FirefightersJacket> firefightersJackets = new ArrayList<>();
equipmentOnCarDtos.forEach(x -> { equipmentOnCarDtos.forEach(x -> {
FirefightersJacket firefightersJacket = new FirefightersJacket(); FirefightersJacket firefightersJacket = new FirefightersJacket();
...@@ -70,11 +83,13 @@ public class FirefightersJacketServiceImpl extends BaseService<FirefightersJacke ...@@ -70,11 +83,13 @@ public class FirefightersJacketServiceImpl extends BaseService<FirefightersJacke
@Override @Override
public boolean update(String type, FirefightersJacket firefightersJacket) { public boolean update(String type, FirefightersJacket firefightersJacket) {
ResponseModel<Object> objectResponseModel = null; ResponseModel<Object> objectResponseModel = null;
if (EquipTypeEnum.退装.getKey().equals(type)) {
objectResponseModel = equipFeignClient.scrapEquip(String.valueOf(firefightersJacket.getStockDetailId()));
} else if (EquipTypeEnum.回库.getKey().equals(type)) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("firefightersId", firefightersJacket.getFirefightersId());
map.put("stockDetailId", firefightersJacket.getStockDetailId()); map.put("stockDetailId", firefightersJacket.getStockDetailId());
map.put("amount", firefightersJacket.getAmount());
if (EquipTypeEnum.报废.getKey().equals(type)) {
objectResponseModel = equipFeignClient.scrapEquip(map);
} else if (EquipTypeEnum.回库.getKey().equals(type)) {
objectResponseModel = equipFeignClient.stockEquip(map); objectResponseModel = equipFeignClient.stockEquip(map);
} }
if (ValidationUtil.isEmpty(objectResponseModel)){ if (ValidationUtil.isEmpty(objectResponseModel)){
......
...@@ -51,7 +51,14 @@ public class FirestationJacketServiceImpl extends BaseService<FirestationJacketD ...@@ -51,7 +51,14 @@ public class FirestationJacketServiceImpl extends BaseService<FirestationJacketD
@Override @Override
public boolean saveOrUpdateBatch(Long firefightersId, List<EquipmentOnCarDto> equipmentOnCarDtos) { public boolean saveOrUpdateBatch(Long firefightersId, List<EquipmentOnCarDto> equipmentOnCarDtos) {
List<Long> ids = equipmentOnCarDtos.stream().map(EquipmentOnCarDto::getStockDetailId).collect(Collectors.toList()); List<Long> ids = equipmentOnCarDtos.stream().map(EquipmentOnCarDto::getStockDetailId).collect(Collectors.toList());
List<Object> result = equipFeignClient.stockBindEquip(ids).getResult(); List<Map<String, Number>> stocks = new ArrayList<>();
for (EquipmentOnCarDto dto : equipmentOnCarDtos) {
stocks.add(new HashMap<String, Number>() {{
this.put("id", dto.getStockDetailId());
this.put("amount", dto.getAmount());
}});
}
List<Object> result = equipFeignClient.stockBindEquip(stocks).getResult();
if (result.size() > 0) { if (result.size() > 0) {
List<FirestationJacket> firefightersJackets = new ArrayList<>(); List<FirestationJacket> firefightersJackets = new ArrayList<>();
equipmentOnCarDtos.forEach(x -> { equipmentOnCarDtos.forEach(x -> {
...@@ -73,11 +80,13 @@ public class FirestationJacketServiceImpl extends BaseService<FirestationJacketD ...@@ -73,11 +80,13 @@ public class FirestationJacketServiceImpl extends BaseService<FirestationJacketD
@Override @Override
public boolean update(String type, FirestationJacket firestationJacket) { public boolean update(String type, FirestationJacket firestationJacket) {
ResponseModel<Object> objectResponseModel = null; ResponseModel<Object> objectResponseModel = null;
if (EquipTypeEnum.退装.getKey().equals(type)) {
objectResponseModel = equipFeignClient.scrapEquip(String.valueOf(firestationJacket.getStockDetailId()));
} else if (EquipTypeEnum.回库.getKey().equals(type)) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("firefightersId", firestationJacket.getFirefightersId());
map.put("stockDetailId", firestationJacket.getStockDetailId()); map.put("stockDetailId", firestationJacket.getStockDetailId());
map.put("amount", firestationJacket.getAmount());
if (EquipTypeEnum.报废.getKey().equals(type)) {
objectResponseModel = equipFeignClient.scrapEquip(map);
} else if (EquipTypeEnum.回库.getKey().equals(type)) {
objectResponseModel = equipFeignClient.stockEquip(map); objectResponseModel = equipFeignClient.stockEquip(map);
} }
if (ValidationUtil.isEmpty(objectResponseModel)){ if (ValidationUtil.isEmpty(objectResponseModel)){
...@@ -87,6 +96,7 @@ public class FirestationJacketServiceImpl extends BaseService<FirestationJacketD ...@@ -87,6 +96,7 @@ public class FirestationJacketServiceImpl extends BaseService<FirestationJacketD
return true; return true;
} }
@Override @Override
public ResponseModel<Object> getEquipByStockDetailId(Long stockDetailId) { public ResponseModel<Object> getEquipByStockDetailId(Long stockDetailId) {
return equipFeignClient.getAirEquipSpecificDetail(stockDetailId); return equipFeignClient.getAirEquipSpecificDetail(stockDetailId);
......
//package com.yeejoin.amos.knowledgebase.config;
//
//import com.baomidou.mybatisplus.core.toolkit.Sequence;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * @author 杨博超
// * @ClassName Config
// * @Deacription TODO
// **/
//@Configuration
//public class Config {
//
// @Bean
// public Sequence sequence() {
// return new Sequence();
// }
//}
...@@ -1139,15 +1139,39 @@ ...@@ -1139,15 +1139,39 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="168623599">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_car" />
</preConditions>
<comment>新增属性数据</comment>
<sql>
alter table `wl_car` add column `max_speed` double(10,2) DEFAULT NULL COMMENT '速度阈值';
alter table `wl_car` add column `phone` varchar(50) DEFAULT NULL COMMENT '联系电话';
alter table `wl_car` add column `driver` varchar(250) DEFAULT NULL COMMENT '司机';
</sql>
</changeSet>
<changeSet author="keyong" id="168623588"> <changeSet author="keyong" id="168623588">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="wl_equipment_category" /> <tableExists tableName="wl_equipment_category" />
</not>
</preConditions> </preConditions>
<comment>新增属性数据</comment> <comment>新增属性数据</comment>
<sql> <sql>
INSERT INTO `wl_equipment_category`(`id`, `parent_id`, `code`, `name`, `is_consumptive`, `description`, `remark`, `create_date`, `industry_code`, `image`) VALUES (860, '123', '21030000', '消防坦克', 0, NULL, '初始导入', '2024-05-23 15:59:42', '2', NULL); INSERT INTO `wl_equipment_category`(`id`, `parent_id`, `code`, `name`, `is_consumptive`, `description`, `remark`, `create_date`, `industry_code`, `image`) VALUES (860, '123', '21030000', '消防坦克', 0, NULL, '初始导入', '2024-05-23 15:59:42', '2', NULL);
DELETE FROM `wl_equipment_category` WHERE id = 759;
</sql>
</changeSet>
<changeSet author="keyong" id="1694056788">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_car" columnName="use_type"/>
</not>
</preConditions>
<comment>新增字段 type_code</comment>
<sql>
alter table `wl_car` add column `use_type` varchar(20) DEFAULT '自购' COMMENT '使用方式';
UPDATE `wl_car` wc SET wc.use_type = '自购';
</sql> </sql>
</changeSet> </changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -2100,6 +2100,7 @@ ...@@ -2100,6 +2100,7 @@
<select id="getColaCategoryAmountEquList" resultMap="CategoryAmountList"> <select id="getColaCategoryAmountEquList" resultMap="CategoryAmountList">
SELECT SELECT
...@@ -2134,7 +2135,9 @@ ...@@ -2134,7 +2135,9 @@
wled.code as eqtype, wled.code as eqtype,
wles.biz_org_code as bizOrgCode, wles.biz_org_code as bizOrgCode,
wles.biz_org_name as bizOrgName, wles.biz_org_name as bizOrgName,
wles.equip_status as equipStatus wles.equip_status as equipStatus,
wec.industry_code as industryCode,
wle.is_iot as wleIsIot
FROM FROM
(select id,name,qr_code,code ,iot_code ,biz_org_code,team_id ,biz_org_name,create_date ,equipment_detail_id ,system_id,equip_status from wl_equipment_specific) wles (select id,name,qr_code,code ,iot_code ,biz_org_code,team_id ,biz_org_name,create_date ,equipment_detail_id ,system_id,equip_status from wl_equipment_specific) wles
LEFT JOIN (select id,amount,status,equipment_specific_id,warehouse_structure_id from wl_stock_detail ) wlsd on wlsd.equipment_specific_id = wles.id LEFT JOIN (select id,amount,status,equipment_specific_id,warehouse_structure_id from wl_stock_detail ) wlsd on wlsd.equipment_specific_id = wles.id
...@@ -2149,9 +2152,7 @@ ...@@ -2149,9 +2152,7 @@
and LEFT (wle.CODE, #{hierarchy}) = #{codeHead} and LEFT (wle.CODE, #{hierarchy}) = #{codeHead}
<!-- and wec.`code` like concat(#{codeHead}, '%')--> <!-- and wec.`code` like concat(#{codeHead}, '%')-->
</if> </if>
<if test="equipTypeAmountPage.industryCode!=null">
and wec.industry_code = #{equipTypeAmountPage.industryCode}
</if>
<if test="equipTypeAmountPage.teamId!=null"> <if test="equipTypeAmountPage.teamId!=null">
and wles.team_id = #{equipTypeAmountPage.teamId} and wles.team_id = #{equipTypeAmountPage.teamId}
</if> </if>
...@@ -2176,9 +2177,7 @@ ...@@ -2176,9 +2177,7 @@
<if test="equipTypeAmountPage.status == 1"> <if test="equipTypeAmountPage.status == 1">
and wlsd.warehouse_structure_id is null and wlsd.warehouse_structure_id is null
</if> </if>
<if test="equipTypeAmountPage.isIot!=null">
and wle.is_iot=#{equipTypeAmountPage.isIot}
</if>
<if test="equipTypeAmountPage.status == 0"> <if test="equipTypeAmountPage.status == 0">
and wlsd.warehouse_structure_id is not null and wlsd.warehouse_structure_id is not null
</if> </if>
...@@ -2201,9 +2200,18 @@ ...@@ -2201,9 +2200,18 @@
<if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''"> <if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">
AND wles.biz_org_code LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%') AND wles.biz_org_code LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
</if> </if>
group by wles.id
having 1 = 1
<if test="equipTypeAmountPage.industryCode!=null">
AND industryCode = #{equipTypeAmountPage.industryCode}
</if>
<if test="equipTypeAmountPage.isIot!=null">
AND wleIsIot = #{equipTypeAmountPage.isIot}
</if>
order by createDate DESC order by createDate DESC
</select> </select>
<select id="listByBizOrgCode" resultType="java.util.Map"> <select id="listByBizOrgCode" resultType="java.util.Map">
SELECT SELECT
form_group_id typeId, form_group_id typeId,
......
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
</where> </where>
GROUP BY GROUP BY
a.equip_model_id a.equip_model_id
HAVING
sum( a.stock_num ) != 0
</select> </select>
<select id="exportList" resultType="com.yeejoin.equipmanage.common.entity.WlSpareEquipment"> <select id="exportList" resultType="com.yeejoin.equipmanage.common.entity.WlSpareEquipment">
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
, ,
{ {
"code": "scrapPut", "code": "scrapPut",
"emqTopic": "equip/scrap/put", "emqTopic": "equip/scrap/put/zxj",
"akkaTopic": "JKXT2BP-XFYY-Topic" "akkaTopic": "JKXT2BP-XFYY-Topic"
} }
] ]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment