物资装备条件筛选、装备上下架逻辑、草稿状态定义
This commit is contained in:
parent
9409c65920
commit
aa3278f2ca
|
|
@ -59,4 +59,7 @@ public class MaterialConstants {
|
|||
|
||||
public static final String OUTER_PROTOCAL = "2"; //外部单位协议
|
||||
|
||||
/** 文件类型:设备附件 */
|
||||
public static final Integer MATERIAL_FILE_TYPE_CODE = 17;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ public class BmFileInfo extends BaseEntity {
|
|||
/** 文件名称 */
|
||||
@Excel(name = "文件名称")
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String name;
|
||||
private String fileName;
|
||||
|
||||
/** 文件路径 */
|
||||
@Excel(name = "文件路径")
|
||||
@ApiModelProperty(value = "文件路径")
|
||||
private String url;
|
||||
private String fileUrl;
|
||||
|
||||
/** 文件类型, 参考数据字典 bm_file_type */
|
||||
@Excel(name = "文件类型")
|
||||
|
|
|
|||
|
|
@ -9,20 +9,11 @@ import lombok.Getter;
|
|||
@Getter
|
||||
public enum MaStatusEnum {
|
||||
|
||||
/** 待上架 */
|
||||
TO_BE_LISTED (15, "待上架"),
|
||||
/** 待租 */
|
||||
ON_HIRE(16, "待租"),
|
||||
/** 在租 */
|
||||
UNDER_RENT(17, "在租"),
|
||||
/** 下架 */
|
||||
DELIST(18,"下架"),
|
||||
/** 自有 */
|
||||
SELF_OWNED(43,"自有"),
|
||||
/** 待审批 */
|
||||
PENDING_APPROVAL(331,"待审批"),
|
||||
/** 上架驳回 */
|
||||
LISTING_REJECTED(332,"上架驳回");
|
||||
TO_BE_LISTED(0, "草稿"),
|
||||
ON_HIRE(1, "下架"),
|
||||
LISTING(2, "上架"),
|
||||
UNDER_RENT(3,"在租"),
|
||||
OWN(4,"自有");
|
||||
|
||||
private final Integer code;
|
||||
private final String name;
|
||||
|
|
|
|||
|
|
@ -14,10 +14,13 @@ import com.bonus.material.device.domain.vo.DevInfoVo;
|
|||
import com.bonus.material.device.service.DevInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
import static com.bonus.common.core.web.page.TableSupport.PAGE_NUM;
|
||||
|
|
@ -30,6 +33,7 @@ import static com.bonus.common.core.web.page.TableSupport.PAGE_SIZE;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dev")
|
||||
@Validated
|
||||
@Api(value = "设备信息",tags = "设备管理")
|
||||
public class DevInfoController extends BaseController {
|
||||
|
||||
|
|
@ -43,6 +47,7 @@ public class DevInfoController extends BaseController {
|
|||
@ApiOperation(value = "装备列表")
|
||||
@PostMapping("/list")
|
||||
public AjaxResult list(@RequestBody DevInfoVo devInfo) {
|
||||
devInfo.setLevel("4");
|
||||
List<DevInfoVo> list = devInfoService.selectDevInfoList(devInfo);
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
|
||||
|
|
@ -108,7 +113,7 @@ public class DevInfoController extends BaseController {
|
|||
@ApiOperation(value = "上下架(批量)")
|
||||
@PostMapping("updateUpDown")
|
||||
public AjaxResult updateUp(@RequestBody DevInfo devInfo) {
|
||||
return toAjax(devInfoService.updateUpDown(devInfo));
|
||||
return devInfoService.updateUpDown(devInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -117,8 +122,8 @@ public class DevInfoController extends BaseController {
|
|||
// @RequiresPermissions("equip:info:edit")
|
||||
@ApiOperation(value = "修改装备信息")
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody DevInfo devInfo) {
|
||||
return toAjax(devInfoService.updateDevInfo(devInfo));
|
||||
public AjaxResult edit(@RequestBody @NotNull @Valid DevInfo devInfo) {
|
||||
return devInfoService.updateDevInfo(devInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -158,8 +163,17 @@ public class DevInfoController extends BaseController {
|
|||
//@RequiresPermissions("equip:info:add")
|
||||
@ApiOperation(value = "新增装备--含附件上传")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DevInfo devInfo) {
|
||||
return toAjax(devInfoService.insertDevInfo(devInfo));
|
||||
public AjaxResult add(@RequestBody @NotNull @Valid DevInfo devInfo) {
|
||||
return devInfoService.insertDevInfo(devInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备信息录入--保存草稿--不校验必填
|
||||
*/
|
||||
@ApiOperation(value = "设备信息录入--保存草稿--不校验必填")
|
||||
@PostMapping("/insertDraft")
|
||||
public AjaxResult insertDraft(@NotNull @RequestBody DevInfo devInfo) {
|
||||
return devInfoService.insertDraft(devInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
package com.bonus.material.device.domain;
|
||||
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.biz.domain.SysFileInfo;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -21,6 +23,7 @@ import java.util.List;
|
|||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class DevInfo extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 429270031714225761L;
|
||||
|
|
@ -29,27 +32,39 @@ public class DevInfo extends BaseEntity {
|
|||
@Excel(name = "设备id")
|
||||
@ApiModelProperty(value = "设备id")
|
||||
private Long maId;
|
||||
/** 设备id */
|
||||
@ApiModelProperty(value = "设备id")
|
||||
|
||||
/** 设备id数组 */
|
||||
@ApiModelProperty(value = "设备id数组")
|
||||
private List<Long> maIds;
|
||||
|
||||
/** 系统编码 */
|
||||
@Excel(name = "系统编码")
|
||||
@ApiModelProperty(value = "系统编码")
|
||||
/** 设备编码 */
|
||||
@Excel(name = "设备编码")
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
@NotBlank
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "装备名称")
|
||||
@NotBlank
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty(value = "整机装备重量")
|
||||
@NotBlank
|
||||
private String deviceWeight;
|
||||
|
||||
@Excel(name = "设备数量")
|
||||
@ApiModelProperty(value = "设备数量")
|
||||
@NotNull(message = "设备数量不能为空")
|
||||
@Min(value = 1, message = "设备数量不能小于1")
|
||||
private Integer deviceCount;
|
||||
|
||||
@ApiModelProperty(value = "单位")
|
||||
@NotBlank(message = "单位不能为空")
|
||||
private String unitName;
|
||||
|
||||
/** 类型id */
|
||||
@Excel(name = "类型id")
|
||||
@ApiModelProperty(value = "类型id")
|
||||
@NotNull
|
||||
private Long typeId;
|
||||
|
||||
@ApiModelProperty(value = "装备类别")
|
||||
|
|
@ -58,7 +73,7 @@ public class DevInfo extends BaseEntity {
|
|||
/** 设备状态(自有,待上架,上架,在租,下架)考虑数据字典 */
|
||||
@Excel(name = "设备状态(自有,待上架,上架,在租,下架)考虑数据字典")
|
||||
@ApiModelProperty(value = "设备状态(自有,待上架,上架,在租,下架)考虑数据字典")
|
||||
private String maStatus;
|
||||
private Integer maStatus;
|
||||
|
||||
/** 设备状态(自有,待上架,上架,在租,下架)考虑数据字典 */
|
||||
@Excel(name = "设备状态(自有,待上架,上架,在租,下架)考虑数据字典")
|
||||
|
|
@ -90,6 +105,7 @@ public class DevInfo extends BaseEntity {
|
|||
/** 设备品牌 */
|
||||
@Excel(name = "设备品牌")
|
||||
@ApiModelProperty(value = "设备品牌")
|
||||
@NotBlank
|
||||
private String brand;
|
||||
|
||||
/** 设备型号 */
|
||||
|
|
@ -100,6 +116,8 @@ public class DevInfo extends BaseEntity {
|
|||
/** 出厂日期 */
|
||||
@Excel(name = "出厂日期")
|
||||
@ApiModelProperty(value = "出厂日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@NotBlank
|
||||
private String productionDate;
|
||||
|
||||
/** 工作时长 */
|
||||
|
|
@ -120,6 +138,7 @@ public class DevInfo extends BaseEntity {
|
|||
/** 设备天租价 */
|
||||
@Excel(name = "设备天租价")
|
||||
@ApiModelProperty(value = "设备天租价")
|
||||
@NotNull
|
||||
private Float dayLeasePrice;
|
||||
|
||||
/** 设备主照片 */
|
||||
|
|
@ -147,9 +166,8 @@ public class DevInfo extends BaseEntity {
|
|||
@ApiModelProperty(value = "gps编号")
|
||||
private String gpsCode;
|
||||
|
||||
/** 设备所属公司 */
|
||||
@Excel(name = "设备所属公司")
|
||||
@ApiModelProperty(value = "设备所属公司")
|
||||
/** 设备所属公司--废弃不用 */
|
||||
@ApiModelProperty(value = "设备所属公司--废弃")
|
||||
private Long ownCo;
|
||||
|
||||
/** 创建人 */
|
||||
|
|
@ -158,9 +176,12 @@ public class DevInfo extends BaseEntity {
|
|||
private Long creator;
|
||||
|
||||
@ApiModelProperty(value = "联系人")
|
||||
@NotBlank
|
||||
private String person;
|
||||
|
||||
@ApiModelProperty(value = "联系人电话")
|
||||
@NotBlank
|
||||
@Size(min = 11, max = 11, message = "手机号长度不能超过11位")
|
||||
private String personPhone;
|
||||
|
||||
/** 设备规格 */
|
||||
|
|
@ -184,20 +205,20 @@ public class DevInfo extends BaseEntity {
|
|||
private String isActive;
|
||||
|
||||
@ApiModelProperty(value = "主展示图")
|
||||
private List<SysFileInfo> mainFileList = new ArrayList<>();
|
||||
@NotEmpty(message = "主展示图不能为空")
|
||||
private List<BmFileInfo> mainFileList = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty(value = "详情页展示图")
|
||||
private List<SysFileInfo> detailsFileList = new ArrayList<>();
|
||||
@NotEmpty(message = "详情页展示图不能为空")
|
||||
private List<BmFileInfo> detailsFileList = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty(value = "检测证明、检验pdf")
|
||||
private List<SysFileInfo> examinationPdf = new ArrayList<>();
|
||||
@NotEmpty(message = "检测证明、检验pdf不能为空")
|
||||
private List<BmFileInfo> examinationPdf = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty(value = "合格证、保险pdf")
|
||||
private List<SysFileInfo> insurancePdf = new ArrayList<>();
|
||||
|
||||
/**文件附件 后续废弃 用下面的*/
|
||||
@ApiModelProperty(value = "文件附件")
|
||||
private List<SysFileInfo> fileList;
|
||||
@NotEmpty(message = "合格证、保险pdf不能为空")
|
||||
private List<BmFileInfo> insurancePdf = new ArrayList<>();
|
||||
|
||||
/**文件附件*/
|
||||
@ApiModelProperty(value = "文件附件")
|
||||
|
|
@ -207,5 +228,6 @@ public class DevInfo extends BaseEntity {
|
|||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "公司Id")
|
||||
@NotBlank(message = "所属公司不能为空")
|
||||
private String companyId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.bonus.material.device.domain.vo;
|
||||
|
||||
import com.bonus.common.biz.domain.SysFileInfo;
|
||||
import com.bonus.material.device.domain.DevInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
|
@ -9,6 +9,7 @@ import lombok.ToString;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author syruan
|
||||
*/
|
||||
|
|
@ -20,7 +21,6 @@ public class DevInfoVo extends DevInfo {
|
|||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
private long parentId;
|
||||
private Long maId;
|
||||
|
||||
@ApiModelProperty(value = "下单用户id")
|
||||
private Long orderUser;
|
||||
|
|
@ -60,9 +60,6 @@ public class DevInfoVo extends DevInfo {
|
|||
@ApiModelProperty(value = "搜索数量")
|
||||
private Long searchNum;
|
||||
|
||||
@ApiModelProperty(value = "附件集合--只做返回用")
|
||||
private List<SysFileInfo> fileList;
|
||||
|
||||
/**上下架id*/
|
||||
@ApiModelProperty(value = "上下架id")
|
||||
private int upId;
|
||||
|
|
@ -100,9 +97,6 @@ public class DevInfoVo extends DevInfo {
|
|||
@ApiModelProperty(value = "装备分类级别")
|
||||
private String level;
|
||||
|
||||
@ApiModelProperty(value = "装备状态")
|
||||
private String maStatusStr;
|
||||
|
||||
@ApiModelProperty(value = "省份名称")
|
||||
private String provinceStr;
|
||||
|
||||
|
|
@ -112,10 +106,6 @@ public class DevInfoVo extends DevInfo {
|
|||
@ApiModelProperty(value = "区名称")
|
||||
private String areaStr;
|
||||
|
||||
@ApiModelProperty(value = "所属公司id")
|
||||
private String companyId;
|
||||
|
||||
|
||||
/* 装备组别 parent */
|
||||
@ApiModelProperty(value = "装备组别Id")
|
||||
private String groupId;
|
||||
|
|
@ -147,4 +137,12 @@ public class DevInfoVo extends DevInfo {
|
|||
@ApiModelProperty(value = "出租记录信息")
|
||||
private List<LeaseVo> leaseList;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String endTime;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,17 @@ public interface DevInfoMapper {
|
|||
*/
|
||||
DevInfoVo selectDevInfoByMaId(Long maId);
|
||||
|
||||
Integer getMaStatusByMaId(Long maId);
|
||||
|
||||
int getHotSearchCountByMaId(Long maId);
|
||||
|
||||
/**
|
||||
* 判断设备名称是否重复
|
||||
* @param deviceName 物资名称
|
||||
* @return 条数
|
||||
*/
|
||||
int getDeviceNameCount(String deviceName);
|
||||
|
||||
int insertHotSearch(Long maId);
|
||||
|
||||
int updateHotSearchByMaId(Long maId);
|
||||
|
|
@ -60,6 +69,12 @@ public interface DevInfoMapper {
|
|||
*/
|
||||
int insertDevInfo(DevInfo devInfo);
|
||||
|
||||
/**
|
||||
* 保存草稿
|
||||
* @param devInfo 设备信息
|
||||
*/
|
||||
int insertDraft(DevInfo devInfo);
|
||||
|
||||
/**
|
||||
* 修改设备信息
|
||||
*
|
||||
|
|
@ -69,12 +84,13 @@ public interface DevInfoMapper {
|
|||
int updateDevInfo(DevInfo devInfo);
|
||||
|
||||
/**
|
||||
* 删除设备信息
|
||||
* 删除设备信息 -- 逻辑删除 -- 限制状态删除
|
||||
*
|
||||
* @param maId 设备信息主键
|
||||
* @param statusCode 状态码
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteDevInfoByMaId(Long maId);
|
||||
int deleteDevInfoByMaId(@Param("maId") Long maId, @Param("statusCode") Integer statusCode);
|
||||
|
||||
/**
|
||||
* 批量删除设备信息
|
||||
|
|
@ -108,7 +124,7 @@ public interface DevInfoMapper {
|
|||
*/
|
||||
List<BmCompanyInfo> selectCompanyList(BmCompanyInfo obj);
|
||||
|
||||
int updateUpDown(@Param("maIds") List<Long> maIds, @Param("maStatus")String maStatus);
|
||||
int updateUpDown(@Param("maIds") List<Long> maIds, @Param("maStatus") Object maStatus);
|
||||
|
||||
/**
|
||||
* 查询预约车详情
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.device.service;
|
|||
|
||||
|
||||
import com.bonus.common.biz.domain.BmCompanyInfo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.device.domain.DevInfo;
|
||||
import com.bonus.material.device.domain.dto.InfoMotionDto;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
|
|
@ -41,7 +42,7 @@ public interface DevInfoService {
|
|||
* @param devInfo 设备信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateDevInfo(DevInfo devInfo);
|
||||
AjaxResult updateDevInfo(DevInfo devInfo);
|
||||
|
||||
/**
|
||||
* 批量删除设备信息
|
||||
|
|
@ -76,7 +77,12 @@ public interface DevInfoService {
|
|||
* @param devInfo 设备信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertDevInfo(DevInfo devInfo);
|
||||
AjaxResult insertDevInfo(DevInfo devInfo);
|
||||
|
||||
/**
|
||||
* 新增装备 -- 保存草稿 -- 不校验
|
||||
*/
|
||||
AjaxResult insertDraft(DevInfo devInfo);
|
||||
|
||||
Map<String, Integer> sumType();
|
||||
|
||||
|
|
@ -89,5 +95,5 @@ public interface DevInfoService {
|
|||
*/
|
||||
List<BmCompanyInfo> selectCompanyList(BmCompanyInfo obj);
|
||||
|
||||
int updateUpDown(DevInfo devInfo);
|
||||
AjaxResult updateUpDown(DevInfo devInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.bonus.material.device.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.domain.*;
|
||||
import com.bonus.common.biz.enums.MaStatusEnum;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.bean.BeanUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.book.domain.BookCarInfoDto;
|
||||
import com.bonus.material.device.domain.DevInfo;
|
||||
|
|
@ -12,12 +14,12 @@ import com.bonus.material.device.domain.dto.InfoMotionDto;
|
|||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.device.mapper.BmFileInfoMapper;
|
||||
import com.bonus.material.device.mapper.DevInfoMapper;
|
||||
import com.bonus.material.device.mapper.SysFileInfoMapper;
|
||||
import com.bonus.material.device.service.DevInfoService;
|
||||
import com.bonus.system.api.model.LoginUser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
|
@ -26,6 +28,8 @@ import javax.annotation.Resource;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.bonus.common.biz.enums.MaStatusEnum.*;
|
||||
|
||||
/**
|
||||
* 设备信息Service业务层处理
|
||||
*
|
||||
|
|
@ -48,9 +52,6 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
@Resource
|
||||
private DevInfoMapper devInfoMapper;
|
||||
|
||||
@Resource
|
||||
private SysFileInfoMapper sysFileInfoMapper;
|
||||
|
||||
@Resource
|
||||
private BmFileInfoMapper bmFileInfoMapper;
|
||||
|
||||
|
|
@ -67,12 +68,27 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
if (devInfoVo != null) {
|
||||
//更新搜索量
|
||||
updateHotSearch(maId);
|
||||
BmFileInfo bmFileInfo = new BmFileInfo();
|
||||
bmFileInfo.setModelId(devInfoVo.getMaId());
|
||||
bmFileInfo.setTaskType(17);
|
||||
try {
|
||||
updateHotSearch(maId);
|
||||
} catch (Exception e) {
|
||||
System.err.println("更新设备搜索量失败,不影响主业务流程");
|
||||
}
|
||||
BmFileInfo bmFileInfo = new BmFileInfo().setModelId(devInfoVo.getMaId()).setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
|
||||
List<BmFileInfo> fileList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
|
||||
devInfoVo.setBmFileInfoList(fileList);
|
||||
if (!CollectionUtils.isEmpty(fileList)) {
|
||||
fileList.removeIf(Objects::isNull);
|
||||
fileList.forEach(item -> {
|
||||
if (item.getFileType().equals(Long.valueOf(MAIN_IMAGES_DICT_VALUE))) {
|
||||
devInfoVo.getMainFileList().add(item);
|
||||
} else if (item.getFileType().equals(Long.valueOf(DETAILS_IMAGES_DICT_VALUE))) {
|
||||
devInfoVo.getDetailsFileList().add(item);
|
||||
} else if (item.getFileType().equals(Long.valueOf(EXAMINATION_PDF))) {
|
||||
devInfoVo.getExaminationPdf().add(item);
|
||||
} else if (item.getFileType().equals(Long.valueOf(INSURANCE_PDF))) {
|
||||
devInfoVo.getInsurancePdf().add(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
//根据设备id及用户id去预约表中查询是否已经加入预约车
|
||||
BookCarInfoDto bookCarInfoDto = devInfoMapper.getBookCar(maId, userId);
|
||||
if (bookCarInfoDto != null) {
|
||||
|
|
@ -158,7 +174,7 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
bmFileInfo.setFileType(0L);
|
||||
List<BmFileInfo> mainFileInfoList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
|
||||
if (!CollectionUtils.isEmpty(mainFileInfoList)) {
|
||||
devInfoVo.setPicUrl(mainFileInfoList.get(0).getUrl());
|
||||
devInfoVo.setPicUrl(mainFileInfoList.get(0).getFileUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -168,8 +184,8 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
List<SysDic> sysDicList = devInfoMapper.getSysDic();
|
||||
for (DevInfoVo devInfoVo : list) {
|
||||
for (SysDic sysDic : sysDicList) {
|
||||
if (devInfoVo.getMaStatus().equals(String.valueOf(sysDic.getId()))) {
|
||||
devInfoVo.setMaStatusStr(sysDic.getName());
|
||||
if (devInfoVo.getMaStatus().equals(sysDic.getId())) {
|
||||
devInfoVo.setMaStatusName(sysDic.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -197,38 +213,153 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertDevInfo(DevInfo devInfo) {
|
||||
devInfo.setCreateTime(new Date());
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult insertDevInfo(DevInfo devInfo) {
|
||||
if (devInfo == null) {
|
||||
return AjaxResult.error("设备信息不能为空");
|
||||
}
|
||||
try {
|
||||
if (devInfo.getMaId() != null) {
|
||||
// 更新设备信息--原本草稿相关内容删除
|
||||
int deleted = devInfoMapper.deleteDevInfoByMaId(devInfo.getMaId(), MaStatusEnum.UNDER_RENT.getCode());
|
||||
if (deleted == 0) {
|
||||
return AjaxResult.error("传入设备ID,但设备不存在,请刷新后重试");
|
||||
}
|
||||
// 删除原草稿附件
|
||||
BmFileInfo bmFileInfo = new BmFileInfo()
|
||||
.setFileType(Long.valueOf(MaterialConstants.MATERIAL_FILE_TYPE_CODE))
|
||||
.setModelId(devInfo.getMaId());
|
||||
bmFileInfoMapper.deleteBmFileInfoByBizInfo(bmFileInfo);
|
||||
}
|
||||
} catch (DataAccessException e) {
|
||||
System.err.println("数据库操作异常: " + e.getMessage());
|
||||
throw new ServiceException("数据库操作异常: " + e.getMessage());
|
||||
} catch (IllegalArgumentException e) {
|
||||
System.err.println("非法参数异常: {}" + e.getMessage());
|
||||
throw new ServiceException("非法参数异常: " + e.getMessage());
|
||||
}
|
||||
|
||||
int deviceNameCount = devInfoMapper.getDeviceNameCount(devInfo.getDeviceName());
|
||||
if (deviceNameCount > 0) {
|
||||
return AjaxResult.error("设备名称已存在,请修改后重试!");
|
||||
}
|
||||
|
||||
//获取用户信息
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
//保存用户信息
|
||||
devInfo.setCreator(userId);
|
||||
devInfo.setCode(String.valueOf(UUID.randomUUID()));
|
||||
devInfo.setMaStatus("3");
|
||||
devInfoMapper.insertDevInfo(devInfo);
|
||||
devInfo.setCreator(userId).setMaStatus(ON_HIRE.getCode());
|
||||
int saveSuccessNum = devInfoMapper.insertDevInfo(devInfo);
|
||||
if (saveSuccessNum == 0) {
|
||||
return AjaxResult.error("设备信息SQL保存失败,请修改后重试");
|
||||
}
|
||||
//把文件保存到附件中
|
||||
AjaxResult error = uploadFiles(devInfo, userId);
|
||||
if (error != null) {return error;}
|
||||
return AjaxResult.success("保存成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备--草稿状态
|
||||
*
|
||||
* @param devInfo 设备信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult insertDraft(DevInfo devInfo) {
|
||||
//获取用户信息
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
//保存用户信息
|
||||
devInfo.setCreator(userId).setMaStatus(TO_BE_LISTED.getCode());
|
||||
try {
|
||||
if (devInfo.getMaId() != null) {
|
||||
devInfoMapper.deleteDevInfoByMaId(devInfo.getMaId(), MaStatusEnum.UNDER_RENT.getCode());
|
||||
}
|
||||
int insertedDraft = devInfoMapper.insertDraft(devInfo);
|
||||
if (insertedDraft == 0) {
|
||||
return AjaxResult.error("装备草稿保存失败,请修改后重试");
|
||||
}
|
||||
AjaxResult error = uploadFiles(devInfo, userId);
|
||||
if (error != null) return error;
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("装备草稿保存失败,执行异常:" + e.getMessage());
|
||||
}
|
||||
return AjaxResult.success("装备草稿保存成功");
|
||||
}
|
||||
|
||||
private AjaxResult uploadFiles(DevInfo devInfo, Long userId) {
|
||||
if (userId == null) {
|
||||
return AjaxResult.error("用户信息获取失败,请刷新后重试");
|
||||
}
|
||||
if (devInfo.getMaId() == null) {
|
||||
return AjaxResult.error("设备ID为空,请携带设备信息上传附件");
|
||||
}
|
||||
|
||||
//把文件保存到附件中
|
||||
List<BmFileInfo> fileInfoList = devInfo.getBmFileInfoList();
|
||||
List<BmFileInfo> fileInfoList = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(devInfo.getMainFileList())) {
|
||||
devInfo.getMainFileList().removeIf(Objects::isNull);
|
||||
devInfo.getMainFileList().forEach(item -> {
|
||||
item.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
|
||||
item.setFileType(Long.valueOf(MAIN_IMAGES_DICT_VALUE));
|
||||
});
|
||||
fileInfoList.addAll(devInfo.getMainFileList());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(devInfo.getDetailsFileList())) {
|
||||
devInfo.getDetailsFileList().removeIf(Objects::isNull);
|
||||
devInfo.getDetailsFileList().forEach(item -> {
|
||||
item.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
|
||||
item.setFileType(Long.valueOf(DETAILS_IMAGES_DICT_VALUE));
|
||||
});
|
||||
fileInfoList.addAll(devInfo.getDetailsFileList());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(devInfo.getInsurancePdf())) {
|
||||
devInfo.getInsurancePdf().removeIf(Objects::isNull);
|
||||
devInfo.getInsurancePdf().forEach(item -> {
|
||||
item.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
|
||||
item.setFileType(Long.valueOf(INSURANCE_PDF));
|
||||
});
|
||||
fileInfoList.addAll(devInfo.getInsurancePdf());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(devInfo.getExaminationPdf())) {
|
||||
devInfo.getExaminationPdf().removeIf(Objects::isNull);
|
||||
devInfo.getExaminationPdf().forEach(item -> {
|
||||
item.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
|
||||
item.setFileType(Long.valueOf(EXAMINATION_PDF));
|
||||
});
|
||||
fileInfoList.addAll(devInfo.getExaminationPdf());
|
||||
}
|
||||
|
||||
// 上传处理后的附件列表
|
||||
if (CollectionUtil.isNotEmpty(fileInfoList)) {
|
||||
System.out.println("设备附件数量:" + fileInfoList.size());
|
||||
for (BmFileInfo sysFileInfo : fileInfoList) {
|
||||
sysFileInfo.setModelId(devInfo.getMaId());
|
||||
sysFileInfo.setCreateBy(String.valueOf(userId));
|
||||
bmFileInfoMapper.insertBmFileInfo(sysFileInfo);
|
||||
}
|
||||
int fileUploadTotal = bmFileInfoMapper.insertBmFileInfos(fileInfoList);
|
||||
if (fileUploadTotal == 0) {
|
||||
return AjaxResult.error("设备附件保存0条,保存失败,请修改后重试");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改设备信息
|
||||
*
|
||||
* @param devInfo 设备信息
|
||||
*/
|
||||
@Override
|
||||
public int updateDevInfo(DevInfo devInfo) {
|
||||
devInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return devInfoMapper.updateDevInfo(devInfo);
|
||||
public AjaxResult updateDevInfo(DevInfo devInfo) {
|
||||
if (devInfo.getMaId() == null) {
|
||||
return AjaxResult.error("设备ID为空,请携带设备信息修改");
|
||||
}
|
||||
int deviceId = devInfoMapper.getDeviceNameCount(devInfo.getDeviceName());
|
||||
if (deviceId > 0 && deviceId != devInfo.getMaId()) {
|
||||
return AjaxResult.error("设备名称已存在,请修改后重试!");
|
||||
}
|
||||
return devInfoMapper.updateDevInfo(devInfo) > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -250,7 +381,7 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
*/
|
||||
@Override
|
||||
public int deleteDevInfoByMaId(Long maId) {
|
||||
return devInfoMapper.deleteDevInfoByMaId(maId);
|
||||
return devInfoMapper.deleteDevInfoByMaId(maId, MaStatusEnum.UNDER_RENT.getCode());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -277,14 +408,14 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
//获取所有的装备信息
|
||||
List<DevInfoVo> devInfoList = devInfoMapper.selectDevInfoList(devInfoVo);
|
||||
//获取每种状态列表
|
||||
Map<String, List<DevInfo>> groupedByMaStatus = devInfoList.stream()
|
||||
Map<Integer, List<DevInfo>> groupedByMaStatus = devInfoList.stream()
|
||||
.collect(Collectors.groupingBy(DevInfo::getMaStatus));
|
||||
//获取所有的key
|
||||
Set<String> keys = groupedByMaStatus.keySet();
|
||||
Set<Integer> keys = groupedByMaStatus.keySet();
|
||||
//根据key计算每种状态的数量
|
||||
for (String key : keys) {
|
||||
for (Integer key : keys) {
|
||||
List<DevInfo> deviceList = groupedByMaStatus.get(key);
|
||||
sumTypeMap.put(MaStatusEnum.getNameByCode(Integer.parseInt(key)), deviceList.size());
|
||||
sumTypeMap.put(MaStatusEnum.getNameByCode(key), deviceList.size());
|
||||
}
|
||||
return sumTypeMap;
|
||||
}
|
||||
|
|
@ -302,9 +433,6 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
|
||||
/**
|
||||
* 查询公司列表
|
||||
*
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BmCompanyInfo> selectCompanyList(BmCompanyInfo obj) {
|
||||
|
|
@ -312,14 +440,42 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int updateUpDown(DevInfo devInfo) {
|
||||
List<Long> maIds = devInfo.getMaIds();
|
||||
String maStatus = devInfo.getMaStatus();
|
||||
int i = 0;
|
||||
if (CollectionUtil.isNotEmpty(maIds)) {
|
||||
i = devInfoMapper.updateUpDown(maIds, maStatus);
|
||||
public AjaxResult updateUpDown(DevInfo devInfo) {
|
||||
if (devInfo == null || CollectionUtil.isEmpty(devInfo.getMaIds())) {
|
||||
return AjaxResult.warn("请选择设备");
|
||||
}
|
||||
return i;
|
||||
if (devInfo.getMaStatus() == null) {
|
||||
return AjaxResult.warn("请选择设备状态");
|
||||
}
|
||||
devInfo.getMaIds().removeIf(Objects::isNull);
|
||||
List<Long> maIds = devInfo.getMaIds();
|
||||
if (CollectionUtil.isNotEmpty(maIds)) {
|
||||
for (Long maId : maIds) {
|
||||
Integer oldStatus = devInfoMapper.getMaStatusByMaId(maId);
|
||||
Integer newStatus = devInfo.getMaStatus();
|
||||
switch (oldStatus) {
|
||||
case 0:
|
||||
if (newStatus.equals(TO_BE_LISTED.getCode()) || newStatus.equals(ON_HIRE.getCode())) {continue;}
|
||||
return AjaxResult.warn("设备ID:" + maId + "是草稿状态,只能进行保存操作:" + newStatus);
|
||||
case 1:
|
||||
if (newStatus.equals(LISTING.getCode()) || newStatus.equals(ON_HIRE.getCode())) {continue;}
|
||||
return AjaxResult.warn("设备ID:" + maId + "已下架,只能进行上下架操作!");
|
||||
case 2:
|
||||
if (newStatus.equals(ON_HIRE.getCode()) || newStatus.equals(LISTING.getCode())) {continue;}
|
||||
return AjaxResult.warn("设备ID:" + maId + "设备已上架,只能进行上下架操作!!");
|
||||
case 3:
|
||||
return AjaxResult.warn("设备ID:" + maId + "设备已出租,非法状态修改!!");
|
||||
default:
|
||||
return AjaxResult.warn("设备ID:" + maId + "设备状态异常,请修改后重试");
|
||||
}
|
||||
}
|
||||
try {
|
||||
devInfoMapper.updateUpDown(maIds, devInfo.getMaStatus());
|
||||
} catch (DataAccessException e) {
|
||||
throw new ServiceException("批量修改状态时SQL执行异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("操作成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import org.springframework.stereotype.Service;
|
|||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
|
|
|
|||
|
|
@ -24,3 +24,7 @@ spring:
|
|||
jasypt:
|
||||
encryptor:
|
||||
password: Encrypt
|
||||
|
||||
mybatis:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
|
@ -8,15 +8,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="taskType" column="task_type" />
|
||||
<result property="taskId" column="task_id" />
|
||||
<result property="modelId" column="model_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="url" column="url" />
|
||||
<result property="fileName" column="name" />
|
||||
<result property="fileUrl" column="url" />
|
||||
<result property="fileType" column="file_type" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBmFileInfoVo">
|
||||
select id, task_type, task_id, model_id, name, url, file_type, create_by, create_time from bm_file_info
|
||||
select
|
||||
id, task_type, task_id, model_id, name, url, file_type, create_by, create_time
|
||||
from bm_file_info
|
||||
</sql>
|
||||
|
||||
<select id="selectBmFileInfoList" parameterType="com.bonus.common.biz.domain.BmFileInfo" resultMap="BmFileInfoResult">
|
||||
|
|
@ -25,10 +27,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="taskType != null "> and task_type = #{taskType}</if>
|
||||
<if test="taskId != null "> and task_id = #{taskId}</if>
|
||||
<if test="modelId != null "> and model_id = #{modelId}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="url != null and url != ''"> and url = #{url}</if>
|
||||
<if test="fileName != null and name != ''"> and name like concat('%', #{fileName}, '%')</if>
|
||||
<if test="fileUrl != null and url != ''"> and url = #{fileUrl}</if>
|
||||
<if test="fileType != null "> and file_type = #{fileType}</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
@ -36,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectBmFileInfoVo"/>
|
||||
where model_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getTypeInfo" resultType="com.bonus.common.biz.domain.TypeInfo">
|
||||
select type_id from ma_type where type_name = #{deviceName}
|
||||
</select>
|
||||
|
|
@ -46,21 +48,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="taskType != null">task_type,</if>
|
||||
<if test="taskId != null">task_id,</if>
|
||||
<if test="modelId != null">model_id,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="url != null">url,</if>
|
||||
<if test="fileName != null">`name`,</if>
|
||||
<if test="fileUrl != null">url,</if>
|
||||
<if test="fileType != null">file_type,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
create_time
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="taskType != null">#{taskType},</if>
|
||||
<if test="taskId != null">#{taskId},</if>
|
||||
<if test="modelId != null">#{modelId},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="url != null">#{url},</if>
|
||||
<if test="fileName != null">#{name},</if>
|
||||
<if test="fileUrl != null">#{url},</if>
|
||||
<if test="fileType != null">#{fileType},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
now()
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -68,14 +70,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
INSERT INTO bm_file_info(task_type,task_id,model_id,name,url,file_type,create_by,create_time)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(#{item.taskType},
|
||||
(
|
||||
#{item.taskType},
|
||||
#{item.taskId},
|
||||
#{item.modelId},
|
||||
#{item.name},
|
||||
#{item.url},
|
||||
#{item.fileName},
|
||||
#{item.fileUrl},
|
||||
#{item.fileType},
|
||||
#{item.createBy},
|
||||
#{item.createTime})
|
||||
now()
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
|
@ -85,11 +89,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="taskType != null">task_type = #{taskType},</if>
|
||||
<if test="taskId != null">task_id = #{taskId},</if>
|
||||
<if test="modelId != null">model_id = #{modelId},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="url != null">url = #{url},</if>
|
||||
<if test="fileName != null">name = #{name},</if>
|
||||
<if test="fileUrl != null">url = #{url},</if>
|
||||
<if test="fileType != null">file_type = #{fileType},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
update_time = now()
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
@ -108,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<delete id="deleteBmFileInfoByBizInfo" parameterType="com.bonus.common.biz.domain.BmFileInfo">
|
||||
delete from bm_file_info
|
||||
<where>
|
||||
<if test="taskType != null "> and task_type = #{taskType}</if>
|
||||
and task_type = #{taskType}
|
||||
<if test="taskId != null "> and task_id = #{taskId}</if>
|
||||
<if test="modelId != null "> and model_id = #{modelId}</if>
|
||||
<if test="fileType != null "> and file_type = #{fileType}</if>
|
||||
|
|
|
|||
|
|
@ -44,22 +44,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectDevInfoVo">
|
||||
select ma_id, code, type_id, ma_status, lease_scope, location, province_id, city_id, area_id, brand, model_name, production_date, working_hours, serial_number,
|
||||
select ma_id, device_name, device_weight, device_count, code, type_id, ma_status, lease_scope, location, province_id, city_id, area_id, brand, model_name, production_date, working_hours, serial_number,
|
||||
month_lease_price, day_lease_price, pic_url, js_month_price, js_day_price, description, gps_code, own_co, create_time,
|
||||
creator, update_time, person, person_phone, update_by, specification, deposit, is_operator, is_active, update_time, update_by
|
||||
from ma_dev_info
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
<select id="selectDevInfoList" parameterType="com.bonus.material.device.domain.vo.DevInfoVo" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
|
||||
SELECT
|
||||
d.ma_id as maId,
|
||||
d.code as code,
|
||||
d.device_name as deviceName,
|
||||
d.device_weight as deviceWeight,
|
||||
d.device_count as deviceCount,
|
||||
d.type_id as typeId,
|
||||
mt4.type_name as typeName,
|
||||
mt4.unit_name as unitName,
|
||||
d.ma_status as maStatus,
|
||||
d.brand as brand,
|
||||
d.model_name as modelName,
|
||||
|
|
@ -109,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="maStatus != null and maStatus != ''"> and d.ma_status = #{maStatus}</if>
|
||||
<if test="maStatus != null"> and d.ma_status = #{maStatus}</if>
|
||||
<if test="leaseScope != null "> and d.lease_scope = #{leaseScope}</if>
|
||||
<if test="location != null and location != ''"> and d.location = #{location}</if>
|
||||
<if test="provinceId != null and provinceId != ''"> and d.province_id = #{provinceId}</if>
|
||||
|
|
@ -133,9 +133,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
<if test="description != null and description != ''"> and d.description = #{description}</if>
|
||||
<if test="gpsCode != null and gpsCode != ''"> and d.gps_code = #{gpsCode}</if>
|
||||
<if test="companyId != null and companyId != ''"> and d.own_co = #{companyId}</if>
|
||||
<if test="companyId != null "> and d.own_co = #{companyId}</if>
|
||||
<if test="specification != null "> and d.specification = #{specification}</if>
|
||||
<if test="deposit != null "> and d.deposit = #{deposit}</if>
|
||||
<if test="startTime != null and endTime != null">
|
||||
and d.update_time between #{startTime} and #{endTime}
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
locate(#{keyWord},mt1.type_name) > 0
|
||||
|
|
@ -205,8 +208,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
d.code as code,
|
||||
d.device_name as deviceName,
|
||||
d.device_weight as deviceWeight,
|
||||
d.device_count as deviceCount,
|
||||
d.type_id as typeId,
|
||||
mt4.type_name as typeName,
|
||||
mt4.unit_name as unitName,
|
||||
d.ma_status as maStatus,
|
||||
d.brand as brand,
|
||||
d.model_name as modelName,
|
||||
|
|
@ -256,7 +261,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="maId != null and maId != '' ">ma_id,</if>
|
||||
<if test="deviceName != null and deviceName != '' ">device_name,</if>
|
||||
<if test="deviceWeight != null and deviceWeight != '' ">device_weight,</if>
|
||||
<if test="unitName != null and unitName != '' ">unit_name,</if>
|
||||
<if test="deviceCount != null">device_count,</if>
|
||||
<if test="code != null and code != '' ">code,</if>
|
||||
<if test="typeId != null and typeId != ''">type_id,</if>
|
||||
<if test="maStatus != null and maStatus != ''">ma_status,</if>
|
||||
|
|
@ -277,7 +282,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="jsDayPrice != null and jsDayPrice != ''">js_day_price,</if>
|
||||
<if test="description != null and description != ''">`description`,</if>
|
||||
<if test="gpsCode != null and gpsCode != ''">gps_code,</if>
|
||||
<if test="ownCo != null and ownCo != ''">own_co,</if>
|
||||
<if test="companyId != null">own_co,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="person != null and person != ''">person,</if>
|
||||
<if test="personPhone != null and personPhone != ''">person_phone,</if>
|
||||
|
|
@ -296,7 +301,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="maId != null and maId != ''">#{maId},</if>
|
||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||
<if test="deviceWeight != null and deviceWeight != ''">#{deviceWeight},</if>
|
||||
<if test="unitName != null and unitName != ''">#{unitName},</if>
|
||||
<if test="deviceCount != null">#{deviceCount},</if>
|
||||
<if test="code != null and code != ''">#{code},</if>
|
||||
<if test="typeId != null and typeId != ''">#{typeId},</if>
|
||||
<if test="maStatus != null and maStatus != ''">#{maStatus},</if>
|
||||
|
|
@ -317,7 +322,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="jsDayPrice != null and jsDayPrice != ''">#{jsDayPrice},</if>
|
||||
<if test="description != null and description != ''">#{description},</if>
|
||||
<if test="gpsCode != null and gpsCode != ''">#{gpsCode},</if>
|
||||
<if test="ownCo != null and ownCo != ''">#{ownCo},</if>
|
||||
<if test="companyId != null">#{companyId},</if>
|
||||
<if test="person != null and person != ''">#{person},</if>
|
||||
<if test="personPhone != null and personPhone != ''">#{personPhone},</if>
|
||||
now(),
|
||||
|
|
@ -350,10 +355,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<update id="updateDevInfo" parameterType="com.bonus.material.device.domain.DevInfo">
|
||||
update ma_dev_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="code != null">code = #{code},</if>
|
||||
<if test="deviceName != null">device_name = #{deviceName},</if>
|
||||
<if test="code != null and code != '' ">code = #{code},</if>
|
||||
<if test="deviceName != null and deviceName != '' ">device_name = #{deviceName},</if>
|
||||
<if test="deviceWeight != null">device_weight = #{deviceWeight},</if>
|
||||
<if test="unitName != null">unit_name = #{unitName},</if>
|
||||
<if test="deviceCount != null">device_count = #{deviceCount},</if>
|
||||
<if test="typeId != null">type_id = #{typeId},</if>
|
||||
<if test="maStatus != null">ma_status = #{maStatus},</if>
|
||||
<if test="leaseScope != null">lease_scope = #{leaseScope},</if>
|
||||
|
|
@ -373,29 +378,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="jsDayPrice != null">js_day_price = #{jsDayPrice},</if>
|
||||
<if test="description != null">`description` = #{description},</if>
|
||||
<if test="gpsCode != null">gps_code = #{gpsCode},</if>
|
||||
<if test="ownCo != null">own_co = #{ownCo},</if>
|
||||
<if test="companyId != null">own_co = #{companyId},</if>
|
||||
<if test="person != null">person = #{person},</if>
|
||||
<if test="personPhone != null">person_phone = #{personPhone},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="creator != null">creator = #{creator},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="specification != null">specification = #{specification},</if>
|
||||
<if test="deposit != null">deposit = #{deposit},</if>
|
||||
<if test="isOperator != null">is_active = #{isOperator},</if>
|
||||
<if test="isActive != null">is_active = #{isActive},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
update_time = now()
|
||||
</trim>
|
||||
where ma_id = #{maId}
|
||||
</update>
|
||||
|
||||
<update id="deleteDevInfoByMaId" parameterType="Long">
|
||||
update ma_dev_info set is_active='0' where ma_id = #{maId}
|
||||
<update id="deleteDevInfoByMaId" >
|
||||
update ma_dev_info set is_active = '0'
|
||||
where ma_id = #{maId,jdbcType=BIGINT} and is_active = '1' and ma_status != #{statusCode,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<update id="deleteDevInfoByMaIds" parameterType="String">
|
||||
update ma_dev_info set is_active='0' where ma_id in
|
||||
update ma_dev_info set is_active='0' where ma_id in
|
||||
<foreach item="maId" collection="array" open="(" separator="," close=")">
|
||||
#{maId}
|
||||
</foreach>
|
||||
|
|
@ -411,6 +411,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where ma_id = #{maId}
|
||||
</select>
|
||||
|
||||
<select id="getDeviceNameCount" resultType="Integer">
|
||||
select ma_id from ma_dev_info
|
||||
where device_name = #{deviceName,jdbcType=VARCHAR} and is_active = '1'
|
||||
</select>
|
||||
|
||||
<insert id="insertHotSearch">
|
||||
INSERT INTO ma_hot_search (ma_id, search_num)
|
||||
VALUES (#{maId}, 1)
|
||||
|
|
@ -421,6 +426,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
set search_num = search_num + 1
|
||||
where ma_id = #{maId}
|
||||
</update>
|
||||
|
||||
<update id="updateUpDown">
|
||||
<if test="maIds != null and maIds.size() > 0">
|
||||
<choose>
|
||||
|
|
@ -463,6 +469,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="getBaseAddressById" resultType="String">
|
||||
select name from base_address where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectDevInfoLists" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
|
||||
select
|
||||
d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name,t.group_name as type_name,t.p_id as group_id,t.group_id as company_id
|
||||
|
|
@ -509,4 +516,89 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
order_user = #{userId}
|
||||
AND ma_id = #{maId}
|
||||
</select>
|
||||
|
||||
<insert id="insertDraft" parameterType="com.bonus.material.device.domain.DevInfo" useGeneratedKeys="true" keyProperty="maId">
|
||||
insert into ma_dev_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceName != null and deviceName != '' ">device_name,</if>
|
||||
<if test="deviceWeight != null and deviceWeight != '' ">device_weight,</if>
|
||||
<if test="deviceCount != null">device_count,</if>
|
||||
<if test="code != null and code != '' ">code,</if>
|
||||
<if test="typeId != null and typeId != ''">type_id,</if>
|
||||
<if test="maStatus != null">ma_status,</if>
|
||||
<if test="leaseScope != null and leaseScope != ''">lease_scope,</if>
|
||||
<if test="location != null and location != ''" >location,</if>
|
||||
<if test="provinceId != null and provinceId != ''">province_id,</if>
|
||||
<if test="cityId != null and cityId != ''">city_id,</if>
|
||||
<if test="areaId != null and areaId != ''">area_id,</if>
|
||||
<if test="brand != null and brand != ''">brand,</if>
|
||||
<if test="modelName != null and modelName != ''">model_name,</if>
|
||||
<if test="productionDate != null and productionDate != ''">production_date,</if>
|
||||
<if test="workingHours != null and workingHours != ''">working_hours,</if>
|
||||
<if test="serialNumber != null and serialNumber != ''">serial_number,</if>
|
||||
<if test="monthLeasePrice != null and monthLeasePrice != ''">month_lease_price,</if>
|
||||
<if test="dayLeasePrice != null and dayLeasePrice != ''">day_lease_price,</if>
|
||||
<if test="picUrl != null and picUrl != ''">pic_url,</if>
|
||||
<if test="jsMonthPrice != null and jsMonthPrice != ''">js_month_price,</if>
|
||||
<if test="jsDayPrice != null and jsDayPrice != ''">js_day_price,</if>
|
||||
<if test="description != null and description != ''">`description`,</if>
|
||||
<if test="gpsCode != null and gpsCode != ''">gps_code,</if>
|
||||
<if test="companyId != null">own_co,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="person != null and person != ''">person,</if>
|
||||
<if test="personPhone != null and personPhone != ''">person_phone,</if>
|
||||
create_time,
|
||||
<if test="creator != null and creator != ''">creator,</if>
|
||||
update_time,
|
||||
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
||||
<if test="specification != null and specification != ''">specification,</if>
|
||||
<if test="deposit != null and deposit != ''">deposit,</if>
|
||||
<if test="isOperator != null and isOperator != ''">is_operator,</if>
|
||||
is_active,
|
||||
<if test="updateTime != null and updateTime != ''">update_time,</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||
<if test="deviceWeight != null and deviceWeight != ''">#{deviceWeight},</if>
|
||||
<if test="deviceCount != null">#{deviceCount},</if>
|
||||
<if test="code != null and code != ''">#{code},</if>
|
||||
<if test="typeId != null and typeId != ''">#{typeId},</if>
|
||||
<if test="maStatus != null">#{maStatus},</if>
|
||||
<if test="leaseScope != null and leaseScope != ''">#{leaseScope},</if>
|
||||
<if test="location != null and location != ''">#{location},</if>
|
||||
<if test="provinceId != null and provinceId != ''">#{provinceId},</if>
|
||||
<if test="cityId != null and cityId != ''">#{cityId},</if>
|
||||
<if test="areaId != null and areaId != ''">#{areaId},</if>
|
||||
<if test="brand != null and brand != ''">#{brand},</if>
|
||||
<if test="modelName != null and modelName != ''">#{modelName},</if>
|
||||
<if test="productionDate != null and productionDate != ''">#{productionDate},</if>
|
||||
<if test="workingHours != null and workingHours != ''">#{workingHours},</if>
|
||||
<if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if>
|
||||
<if test="monthLeasePrice != null and monthLeasePrice != ''">#{monthLeasePrice},</if>
|
||||
<if test="dayLeasePrice != null and dayLeasePrice != ''">#{dayLeasePrice},</if>
|
||||
<if test="picUrl != null and picUrl != ''">#{picUrl},</if>
|
||||
<if test="jsMonthPrice != null and jsMonthPrice != ''">#{jsMonthPrice},</if>
|
||||
<if test="jsDayPrice != null and jsDayPrice != ''">#{jsDayPrice},</if>
|
||||
<if test="description != null and description != ''">#{description},</if>
|
||||
<if test="gpsCode != null and gpsCode != ''">#{gpsCode},</if>
|
||||
<if test="companyId != null">#{companyId},</if>
|
||||
<if test="person != null and person != ''">#{person},</if>
|
||||
<if test="personPhone != null and personPhone != ''">#{personPhone},</if>
|
||||
now(),
|
||||
<if test="creator != null and creator != ''">#{creator},</if>
|
||||
now(),
|
||||
<if test="updateBy != null and updateBy != ''">#{update_by},</if>
|
||||
<if test="specification != null and specification != ''">#{specification},</if>
|
||||
<if test="deposit != null and deposit != ''">#{deposit},</if>
|
||||
<if test="isOperator != null and isOperator != ''">#{isOperator},</if>
|
||||
1,
|
||||
<if test="updateTime != null and updateTime != ''">#{updateTime},</if>
|
||||
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="getMaStatusByMaId" resultType="java.lang.Integer">
|
||||
select ma_status from ma_dev_info where ma_id = #{maId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="getTypeList" resultType="com.bonus.common.biz.domain.TypeInfo">
|
||||
select type_id as typeId, parent_id as parentId, type_name as typeName, `level` as level, del_flag as delFlag
|
||||
select
|
||||
type_id as typeId, parent_id as parentId, type_name as typeName, `level` as level, del_flag as delFlag, unit_name as unitName
|
||||
from ma_type
|
||||
where del_flag = '0' and level = '1'
|
||||
<if test="typeName != null and typeName != ''">
|
||||
|
|
|
|||
Loading…
Reference in New Issue