Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	zlpt-modules/zlpt-company/src/main/java/com/bonus/zlpt/company/controller/BmCompanyInfoController.java
#	zlpt-modules/zlpt-equip/src/main/java/com/bonus/zlpt/equip/service/impl/UpOffServiceImpl.java
This commit is contained in:
nmy 2023-12-09 22:48:51 +08:00
commit bf0becc786
21 changed files with 404 additions and 148 deletions

View File

@ -20,7 +20,7 @@ public interface RemoteDevInfoService
* @param maId
* @return
*/
@GetMapping(value = "/dev/{maId}")
@GetMapping(value = "/dev/getInfo/{maId}")
public AjaxResult getInfo(@PathVariable("maId") Long maId);
/**

View File

@ -38,18 +38,12 @@ public class DevInfoVo extends DevInfo {
private String[] pictures;
@ApiModelProperty(value = "关键词")
private String keyWord;
/* 是否审核通过, ma_up_off:status, 1=通过, 2驳回 */
@ApiModelProperty(value = "是否审核通过")
private String isAudit;
@ApiModelProperty(value = "搜索数量")
private Long searchNum;
@ApiModelProperty(value = "检验pdf")
private String examinationPdf;
@ApiModelProperty(value = "保险pdf")
private String insurancePdf;
/** 1上架2下架*/
@ApiModelProperty(value = "上下架类别")
private String type;
/**上下架id*/
@ApiModelProperty(value = "上下架id")
private int upId;
@ -79,4 +73,10 @@ public class DevInfoVo extends DevInfo {
private String cityStr;
@ApiModelProperty(value = "区名称")
private String areaStr;
@ApiModelProperty(value = "装备类别Id")
private String companyId;
/* 装备组别 parent */
@ApiModelProperty(value = "装备组别Id")
private String groupId;
private Long userId;
}

View File

@ -2,8 +2,8 @@ package com.bonus.zlpt.equip.api.enums;
public enum MaStatusEnum {
/** 待上架审批 */
PENDING_APPROVAL(15, "待上架审批"),
/** 待上架 */
TO_BE_LISTED (15, "待上架"),
/** 待租 */
ON_HIRE(16, "待租"),
/** 在租 */
@ -11,7 +11,11 @@ public enum MaStatusEnum {
/** 下架 */
DELIST(18,"下架"),
/** 自有 */
SELF_OWNED(43,"自有");
SELF_OWNED(43,"自有"),
/** 待审批 */
PENDING_APPROVAL(331,"待审批"),
/** 上架驳回 */
LISTING_REJECTED(332,"上架驳回");

View File

@ -25,7 +25,7 @@ public class BaseEntity implements Serializable
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
private String createTime;
/** 更新者 */
private String updateBy;
@ -61,12 +61,12 @@ public class BaseEntity implements Serializable
this.createBy = createBy;
}
public Date getCreateTime()
public String getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
public void setCreateTime(String createTime)
{
this.createTime = createTime;
}

View File

@ -82,6 +82,18 @@
<groupId>com.bonus.zlpt</groupId>
<artifactId>zlpt-common-security</artifactId>
</dependency>
<dependency>
<groupId>com.bonus.zlpt</groupId>
<artifactId>zlpt-api-equip</artifactId>
<version>3.6.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.bonus.zlpt</groupId>
<artifactId>zlpt-api-company</artifactId>
<version>3.6.3</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@ -1,14 +1,14 @@
package com.bonus.zlpt.bigscreen.service.impl;
import com.bonus.zlpt.bigscreen.domain.vo.CoTypeVo;
import com.bonus.zlpt.bigscreen.domain.vo.ColtdTypeVo;
import com.bonus.zlpt.bigscreen.domain.vo.LatVo;
import com.bonus.zlpt.bigscreen.domain.vo.LonVo;
import com.bonus.zlpt.bigscreen.domain.vo.*;
import com.bonus.zlpt.bigscreen.mapper.BmCompanyInfoMapper;
import com.bonus.zlpt.bigscreen.service.BmCompanyInfoService;
import com.bonus.zlpt.company.api.enums.CompanyTypeEnum;
import com.bonus.zlpt.equip.api.enums.MaStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
@ -30,7 +30,13 @@ public class BmCompanyInfoServiceImpl implements BmCompanyInfoService {
*/
@Override
public List<CoTypeVo> selectTypeList() {
return bmCompanyInfoMapper.selectTypeList();
List<CoTypeVo> list = bmCompanyInfoMapper.selectTypeList();
ArrayList<CoTypeVo> typeVos = new ArrayList<>();
for (CoTypeVo coTypeVo : list) {
coTypeVo.setCoType(CompanyTypeEnum.getNameByCode(Integer.parseInt(coTypeVo.getCoType())));
typeVos.add(coTypeVo);
}
return typeVos;
}
/**
@ -39,7 +45,14 @@ public class BmCompanyInfoServiceImpl implements BmCompanyInfoService {
*/
@Override
public List<ColtdTypeVo> selectColtdList() {
return bmCompanyInfoMapper.selectColtdList();
List<ColtdTypeVo> list = bmCompanyInfoMapper.selectColtdList();
ArrayList<ColtdTypeVo> coltdTypeVos = new ArrayList<>();
for (ColtdTypeVo coltdTypeVo : list) {
coltdTypeVo.setMaStatus(MaStatusEnum.getNameByCode(Integer.parseInt(coltdTypeVo.getMaStatus())));
coltdTypeVo.setCompanyType(CompanyTypeEnum.getNameByCode(Integer.parseInt(coltdTypeVo.getCompanyType())));
coltdTypeVos.add(coltdTypeVo);
}
return coltdTypeVos;
}
/**

View File

@ -3,9 +3,11 @@ package com.bonus.zlpt.bigscreen.service.impl;
import com.bonus.zlpt.bigscreen.domain.vo.CompanyInfoVo;
import com.bonus.zlpt.bigscreen.mapper.BmMachinistInfoMapper;
import com.bonus.zlpt.bigscreen.service.BmMachinistInfoService;
import com.bonus.zlpt.company.api.enums.CompanyLtdEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -27,7 +29,12 @@ public class BmMachinistInfoServiceImpl implements BmMachinistInfoService {
*/
@Override
public List<CompanyInfoVo> selectMachinistInfoList() {
return infoMapper.selectMachinistInfoList();
List<CompanyInfoVo> list = infoMapper.selectMachinistInfoList();
ArrayList<CompanyInfoVo> companyInfoVos = new ArrayList<>();
for (CompanyInfoVo companyInfoVo : list) {
companyInfoVo.setOwnCo(CompanyLtdEnum.getNameByCode(Integer.parseInt(companyInfoVo.getOwnCo())));
}
return companyInfoVos;
}
}

View File

@ -6,9 +6,12 @@ import com.bonus.zlpt.bigscreen.domain.vo.MaIdVo;
import com.bonus.zlpt.bigscreen.domain.vo.TypeVo;
import com.bonus.zlpt.bigscreen.mapper.MaDevInfoMapper;
import com.bonus.zlpt.bigscreen.service.MaDevInfoService;
import com.bonus.zlpt.company.api.enums.CompanyLtdEnum;
import com.bonus.zlpt.equip.api.enums.MaStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
@ -29,7 +32,13 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
*/
@Override
public List<CoTypeVo> selectMaDevInfoList() {
return maDevInfoMapper.selectMaDevInfoList();
List<CoTypeVo> typeVos = maDevInfoMapper.selectMaDevInfoList();
List<CoTypeVo> coTypeVos = new ArrayList<>();
for (CoTypeVo typeVo : typeVos) {
typeVo.setCoType(CompanyLtdEnum.getNameByCode(Integer.parseInt(typeVo.getCoType())));
coTypeVos.add(typeVo);
}
return coTypeVos;
}
/**
@ -58,7 +67,13 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
*/
@Override
public List<TypeVo> selectTypeList() {
return maDevInfoMapper.selectTypeList();
List<TypeVo> list = maDevInfoMapper.selectTypeList();
ArrayList<TypeVo> typeVos = new ArrayList<>();
for (TypeVo typeVo : list) {
typeVo.setMaStatus(MaStatusEnum.getNameByCode(Integer.parseInt(typeVo.getMaStatus())));
typeVos.add(typeVo);
}
return typeVos;
}
/**
@ -68,7 +83,13 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
*/
@Override
public List<TypeVo> selectMaTypeList() {
return maDevInfoMapper.selectMaTypeList();
List<TypeVo> list = maDevInfoMapper.selectMaTypeList();
ArrayList<TypeVo> typeVos = new ArrayList<>();
for (TypeVo typeVo : list) {
typeVo.setMaStatus(MaStatusEnum.getNameByCode(Integer.parseInt(typeVo.getMaStatus())));
typeVos.add(typeVo);
}
return typeVos;
}
/**
@ -87,7 +108,9 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
*/
@Override
public MaIdVo selectListById(String maId) {
return maDevInfoMapper.selectListById(maId);
MaIdVo maIdVo = maDevInfoMapper.selectListById(maId);
maIdVo.setMaStatus(MaStatusEnum.getNameByCode(Integer.parseInt(maIdVo.getMaStatus())));
return maIdVo;
}
}

View File

@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTypeList" resultType="com.bonus.zlpt.bigscreen.domain.vo.CoTypeVo">
SELECT company_type as coType, COUNT(*) AS count
FROM bm_company_info
WHERE company_type IN ('社会企业', '南网集团企业', '南网控股企业')
WHERE company_type IN ('2', '3', '4')
GROUP BY company_type
</select>
@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
JOIN bm_company_info c ON m.own_co = c.company_id
JOIN gps_real_info g ON m.gps_code = g.gps_code
WHERE
m.ma_status IN ('在租', '自有', '待租') and m.is_active = '1'
m.ma_status IN ('16', '17', '43') and m.is_active = '1'
GROUP BY
c.company_ltd, m.ma_status, g.lon, g.lat,maId

View File

@ -9,7 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT bc.company_ltd AS coType, COUNT(*) AS Count
FROM ma_dev_info md
JOIN bm_company_info bc ON md.own_co = bc.company_id
WHERE md.ma_status = '自有' and md.is_active = '1'
WHERE md.ma_status = '43' and md.is_active = '1'
GROUP BY bc.company_ltd
</select>
@ -19,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT mti.type_name as ownCo, COUNT(*) as count
FROM ma_type_info mti
INNER JOIN ma_dev_info mdi ON mti.type_id = mdi.type_id
WHERE mdi.ma_status = '在租' and mdi.is_active = '1'
WHERE mdi.ma_status = '17' and mdi.is_active = '1'
GROUP BY mti.type_name
ORDER BY count DESC
</select>
@ -32,14 +32,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTypeList" resultType="com.bonus.zlpt.bigscreen.domain.vo.TypeVo">
SELECT ma_status as maStatus, COUNT(*) AS count
FROM ma_dev_info
WHERE ma_status IN ('自有', '待租') and is_active = '1'
WHERE ma_status IN ('43', '16') and is_active = '1'
GROUP BY ma_status
</select>
<select id="selectMaTypeList" resultType="com.bonus.zlpt.bigscreen.domain.vo.TypeVo">
SELECT ma_status as maStatus, COUNT(*) AS count
FROM ma_dev_info
WHERE ma_status IN ('在租', '待租') and is_active = '1'
WHERE ma_status IN ('16', '17') and is_active = '1'
GROUP BY ma_status
</select>

View File

@ -38,10 +38,10 @@ public class BmCompanyInfoServiceImpl implements BmCompanyInfoService {
@Resource
private BmCompanyInfoDao bmCompanyInfoMapper;
@Autowired
@Resource
private BmCoBankMapper bmCoBankMapper;
@Autowired
@Resource
private RemoteUserService remoteUserService;

View File

@ -248,7 +248,7 @@
#{idNationUrl,jdbcType=VARCHAR},
</if>
<if test="authEmail != null and authEmail != ''">
#{auth_email,jdbcType=VARCHAR},
#{authEmail,jdbcType=VARCHAR},
</if>
<if test="createTime != null and createTime != ''">
#{createTime,jdbcType=VARCHAR},

View File

@ -47,6 +47,15 @@ public class DevInfoController extends BaseController
return getDataTable(list);
}
@ApiOperation(value = "收藏装备列表")
@PostMapping("/userCollectList")
public TableDataInfo userCollectList(@RequestBody DevInfoVo devInfo)
{
startPage(devInfo.getPageNum(), devInfo.getPageSize());
List<DevInfoVo> list = devInfoService.selectUserCollectList(devInfo);
return getDataTable(list);
}
// @RequiresPermissions("equip:info:list")
@ApiOperation(value = "装备推荐列表")
@GetMapping("/hotList")
@ -143,4 +152,18 @@ public class DevInfoController extends BaseController
Map<String, Integer> sumType =devInfoService.sumType();
return success(sumType);
}
/**
* 查询商品列表
*/
//@RequiresPermissions("equip:info:list")
@ApiOperation(value = "查询商品列表")
@PostMapping("/devList")
public TableDataInfo devList(@RequestBody DevInfoVo devInfo)
{
startPage(devInfo.getPageNum(), devInfo.getPageSize());
List<DevInfoVo> list = devInfoService.selectDevInfoLists(devInfo);
return getDataTable(list);
}
}

View File

@ -3,6 +3,7 @@ package com.bonus.zlpt.equip.mapper;
import java.util.List;
import com.bonus.zlpt.common.core.domain.system.SysFile;
import com.bonus.zlpt.equip.api.domain.DevInfo;
import com.bonus.zlpt.equip.api.domain.UserCollect;
import com.bonus.zlpt.equip.api.domain.dto.InforMationDto;
import com.bonus.zlpt.equip.api.domain.vo.DevInfoVo;
import com.bonus.zlpt.system.api.domain.BaseAddress;
@ -24,6 +25,8 @@ public interface DevInfoMapper
*/
public DevInfoVo selectDevInfoByMaId(Long maId);
public int updateHotSearchByMaId(Long maId);
/**
* 查询设备图片集
*
@ -42,6 +45,9 @@ public interface DevInfoMapper
*/
public List<DevInfoVo> selectDevInfoList(DevInfo devInfo);
// public List<DevInfoVo> selectDevInfoList4Collect(DevInfo devInfo);
public List<UserCollect> selectUserCollectByUserId(Long userId);
public List<DevInfoVo> selectDevInfoHotList(DevInfo devInfo);
/**
@ -90,4 +96,7 @@ public interface DevInfoMapper
public List<BaseAddress> getBaseAddress();
public String getBaseAddressById(Integer id);
List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfo);
}

View File

@ -31,6 +31,8 @@ public interface IDevInfoService
*/
public List<DevInfoVo> selectDevInfoList(DevInfoVo devInfo);
List<DevInfoVo> selectUserCollectList(DevInfoVo devInfo);
public List<DevInfoVo> selectDevInfoHotList(DevInfoVo devInfo);
/**
@ -74,4 +76,6 @@ public interface IDevInfoService
public Map<String, Integer> sumType();
List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfo);
}

View File

@ -2,8 +2,11 @@ package com.bonus.zlpt.equip.service.impl;
import java.util.*;
import java.util.stream.Collectors;
import com.bonus.zlpt.common.security.utils.SecurityUtils;
import com.bonus.zlpt.equip.api.domain.DevInfo;
import com.bonus.zlpt.equip.api.domain.SysFileInfo;
import com.bonus.zlpt.equip.api.domain.UserCollect;
import com.bonus.zlpt.equip.api.domain.dto.InforMationDto;
import com.bonus.zlpt.equip.api.domain.vo.DevInfoVo;
import com.bonus.zlpt.common.core.domain.system.SysFile;
@ -11,6 +14,7 @@ import com.bonus.zlpt.common.core.utils.DateUtils;
import com.bonus.zlpt.equip.api.enums.MaStatusEnum;
import com.bonus.zlpt.system.api.domain.BaseAddress;
import com.bonus.zlpt.system.api.domain.SysDic;
import com.bonus.zlpt.system.api.model.LoginUser;
import org.springframework.beans.BeanUtils;
import com.bonus.zlpt.equip.mapper.SysFileInfoMapper;
import org.springframework.stereotype.Service;
@ -51,6 +55,8 @@ public class DevInfoServiceImpl implements IDevInfoService
public DevInfoVo selectDevInfoByMaId(Long maId)
{
DevInfoVo devInfoVo = devInfoMapper.selectDevInfoByMaId(maId);
//更新搜索量
devInfoMapper.updateHotSearchByMaId(maId);
try {
List<SysFile> files = devInfoMapper.getFilesByMaId(maId);
if (!CollectionUtils.isEmpty(files) && files.get(0) != null) {
@ -112,6 +118,47 @@ public class DevInfoServiceImpl implements IDevInfoService
return list;
}
/**
* 查询设备收藏列表
*
* @param devInfo 设备信息
* @return 设备信息
*/
@Override
public List<DevInfoVo> selectUserCollectList(DevInfoVo devInfo)
{
List<DevInfoVo> result = new ArrayList<>();
//simple way
result = devInfoMapper.selectDevInfoList(devInfo);
LoginUser user = SecurityUtils.getLoginUser();
if (Objects.nonNull(user)) {
List<UserCollect> userCollectList = devInfoMapper.selectUserCollectByUserId(user.getUserid());
result = filterUserCollect(result, userCollectList);
}
//complex sql, it works
// LoginUser user = SecurityUtils.getLoginUser();
// if (Objects.nonNull(user)) {
// devInfo.setUserId(user.getUserid());
// result = devInfoMapper.selectDevInfoList4Collect(devInfo);
// }
fillInMaStatusStr(result);
fillInCityStr(result);
return result;
}
private List<DevInfoVo> filterUserCollect(List<DevInfoVo> list, List<UserCollect> userCollectList) {
List<DevInfoVo> result = new ArrayList<>();
for (DevInfoVo devInfoVo : list) {
for (UserCollect userCollect : userCollectList) {
if (devInfoVo.getMaId().longValue() == userCollect.getMaId().longValue()) {
result.add(devInfoVo);
}
}
}
return result;
}
@Override
public List<DevInfoVo> selectDevInfoHotList(DevInfoVo devInfo)
{
@ -158,15 +205,24 @@ public class DevInfoServiceImpl implements IDevInfoService
@Override
public int insertDevInfo(DevInfo devInfo)
{
devInfo.setCreateTime(DateUtils.getNowDate());
devInfo.setCreateTime(DateUtils.getDate());
//获取用户信息
Long userId = SecurityUtils.getUserId();
//保存用户信息
devInfo.setCreator(userId);
devInfo.setCode(String.valueOf(UUID.randomUUID()));
devInfoMapper.insertDevInfo(devInfo);
//把文件保存到附件中
List<SysFileInfo> fileInfoList = devInfo.getFileList();
if (fileInfoList.size()>0){
for (SysFileInfo sysFileInfo: fileInfoList) {
sysFileInfo.setModelId(Math.toIntExact(devInfo.getMaId()));
sysFileInfo.setCreator(String.valueOf(userId));
sysFileInfoMapper.insertFileInfo(sysFileInfo);
}
}
return devInfoMapper.insertDevInfo(devInfo);
return 1;
}
/**
@ -242,4 +298,16 @@ public class DevInfoServiceImpl implements IDevInfoService
}
return sumTypeMap;
}
@Override
public List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfo) {
List<DevInfoVo> list = devInfoMapper.selectDevInfoLists(devInfo);
//获取设备的附件
for (DevInfoVo devInfoVo: list) {
List<SysFileInfo> fileInfoList = sysFileInfoMapper.selectByMaId(devInfoVo.getMaId());
devInfoVo.setFileList(fileInfoList);
}
return list;
}
}

View File

@ -56,7 +56,7 @@ public class TypeInfoRecordServiceImpl implements ITypeInfoRecordService
@Override
public int insertTypeInfoRecord(TypeInfoRecord typeInfoRecord)
{
typeInfoRecord.setCreateTime(DateUtils.getNowDate());
typeInfoRecord.setCreateTime(DateUtils.getDate());
return typeInfoRecordMapper.insertTypeInfoRecord(typeInfoRecord);
}

View File

@ -65,7 +65,7 @@ public class TypeInfoServiceImpl implements ITypeInfoService
@Override
public int insertTypeInfo(TypeInfo typeInfo)
{
typeInfo.setCreateTime(DateUtils.getNowDate());
typeInfo.setCreateTime(DateUtils.getDate());
return typeInfoMapper.insertTypeInfo(typeInfo);
}

View File

@ -5,11 +5,14 @@ import java.util.stream.Collectors;
import com.bonus.zlpt.common.security.utils.SecurityUtils;
import com.bonus.zlpt.equip.api.domain.DevInfo;
import com.bonus.zlpt.equip.api.domain.SysFileInfo;
import com.bonus.zlpt.equip.api.domain.TypeInfo;
import com.bonus.zlpt.equip.api.domain.UpOff;
import com.bonus.zlpt.equip.api.domain.dto.UpOffDto;
import com.bonus.zlpt.common.core.enums.FileDictEnum;
import com.bonus.zlpt.equip.api.enums.MaStatusEnum;
import com.bonus.zlpt.equip.mapper.DevInfoMapper;
import com.bonus.zlpt.equip.api.enums.leaseScopeEnums;
import com.bonus.zlpt.equip.mapper.SysFileInfoMapper;
import com.bonus.zlpt.equip.mapper.TypeInfoMapper;
@ -40,6 +43,9 @@ public class UpOffServiceImpl implements IUpOffService
@Resource
private SysFileInfoMapper sysFileInfoMapper;
@Resource
private DevInfoMapper devInfoMapper;
/**
* 查询设备上下架管理
@ -86,7 +92,13 @@ public class UpOffServiceImpl implements IUpOffService
for (int i = 0; i < upOffList.size(); i++) {
UpOff UpOff = upOffList.get(i);
UpOff.setApplyUser(name);
//新增一条上架数据
upOffMapper.insertUpOff(UpOff);
DevInfo devInfo = new DevInfo();
devInfo.setMaId(UpOff.getMaId());
devInfo.setMaStatus(String.valueOf(MaStatusEnum.PENDING_APPROVAL.getCode()));
//修改此时商品的状态
devInfoMapper.updateDevInfo(devInfo);
}
return 1;
}

View File

@ -48,18 +48,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectDevInfoList" parameterType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo">
select d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name,u.type as type
select d.*,mt1.type_name as device_name, mt2.type_name as group_name, mt3.type_name as type_name,c.company_name
from ma_dev_info d
left join (select t.*, p.type_name as parent_name
from ma_type_info t
left join ma_type_info p on t.parent_id=p.type_id) t on d.type_id = t.type_id
left join ma_type_info mt1 on d.type_id = mt1.type_id
left join ma_type_info mt2 on mt1.parent_id = mt2.type_id
left join ma_type_info mt3 on mt2.parent_id = mt3.type_id
left join bm_company_info c on d.own_co = c.company_id
left join ma_up_off u on d.ma_id = u.ma_id
-- select d.*,t.type_name,c.company_name ,u.type, u.id as up_id
-- from ma_dev_info d
-- left join ma_type_info t on d.type_id = t.type_id
-- left join bm_company_info c on d.own_co = c.company_id
-- left join ma_up_off u on d.ma_id = u.ma_id
<where>
<if test="maId != null "> and d.ma_id = #{maId}</if>
<if test="code != null and code != ''"> and d.code = #{code}</if>
@ -104,7 +98,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isActive != null and isActive != ''"> and d.is_active = #{isActive}</if>
<if test="keyWord != null and keyWord != ''">
and (
locate(#{keyWord},t.type_name) > 0
locate(#{keyWord},mt1.type_name) > 0
or locate(#{keyWord},mt2.type_name) > 0
or locate(#{keyWord},mt3.type_name) > 0
or locate(#{keyWord},c.company_name) > 0
or locate(#{keyWord},d.ma_id) > 0
or locate(#{keyWord},d.model_name) > 0
@ -131,6 +127,92 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</select>
<!-- <select id="selectDevInfoList4Collect" parameterType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo">-->
<!-- select d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name,u.type as type-->
<!-- from ma_dev_info d-->
<!-- left join (select t.*, p.type_name as parent_name-->
<!-- from ma_type_info t-->
<!-- left join ma_type_info p on t.parent_id=p.type_id) t on d.type_id = t.type_id-->
<!-- left join bm_company_info c on d.own_co = c.company_id-->
<!-- left join ma_up_off u on d.ma_id = u.ma_id-->
<!-- left join ma_user_collect col on d.ma_id = col.ma_id-->
<!-- &#45;&#45; select d.*,t.type_name,c.company_name ,u.type, u.id as up_id-->
<!-- &#45;&#45; from ma_dev_info d-->
<!-- &#45;&#45; left join ma_type_info t on d.type_id = t.type_id-->
<!-- &#45;&#45; left join bm_company_info c on d.own_co = c.company_id-->
<!-- &#45;&#45; left join ma_up_off u on d.ma_id = u.ma_id-->
<!-- <where>-->
<!-- <if test="maId != null "> and d.ma_id = #{maId}</if>-->
<!-- <if test="code != null and code != ''"> and d.code = #{code}</if>-->
<!-- <if test="typeId != null">-->
<!-- <if test="level != null and level == 2">-->
<!-- and t.parent_id = #{typeId}-->
<!-- </if>-->
<!-- <if test="level != null and level == 3">-->
<!-- and d.type_id = #{typeId}-->
<!-- </if>-->
<!-- </if>-->
<!-- <if test="maStatus != null and maStatus != ''"> 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>-->
<!-- <if test="cityId != null and cityId != ''"> and d.city_id = #{cityId}</if>-->
<!-- <if test="areaId != null and areaId != ''"> and d.area_id = #{areaId}</if>-->
<!-- <if test="brand != null and brand != ''"> and d.brand = #{brand}</if>-->
<!-- <if test="modelName != null and modelName != ''"> and d.model_name like concat('%', #{modelName}, '%')</if>-->
<!-- <if test="ageMin != null and ageMin != '' and ageMax != null and ageMax != ''">-->
<!-- and DATEDIFF(DATE_FORMAT(now(), '%Y-%m-%d'), d.production_date) &gt;= #{ageMin} * 365-->
<!-- and DATEDIFF(DATE_FORMAT(now(), '%Y-%m-%d'), d.production_date) &lt;= #{ageMax} * 365-->
<!-- </if>-->
<!-- <if test="workingHoursMin != null and workingHoursMin != '' and workingHoursMax != null and workingHoursMax != ''">-->
<!-- and d.working_hours &gt;= #{workingHoursMin} and d.working_hours &lt;= #{workingHoursMax}-->
<!-- </if>-->
<!-- <if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if>-->
<!-- <if test="monthLeasePriceMin != null and monthLeasePriceMax != null">-->
<!-- and d.month_lease_price &gt;= #{monthLeasePriceMin} and d.month_lease_price &lt;= #{monthLeasePriceMax}-->
<!-- </if>-->
<!-- <if test="dayLeasePrice != null and dayLeasePrice != ''"> and d.day_lease_price = #{dayLeasePrice}</if>-->
<!-- <if test="picUrl != null and picUrl != ''"> and d.pic_url = #{picUrl}</if>-->
<!-- <if test="jsMonthPrice != null and jsMonthPrice != ''"> and d.js_month_price = #{jsMonthPrice}</if>-->
<!-- <if test="jsDayPrice != null and jsDayPrice != ''"> and d.js_day_price = #{jsDayPrice}</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="ownCo != null "> and d.own_co = #{ownCo}</if>-->
<!-- <if test="creator != null "> and d.creator = #{creator}</if>-->
<!-- <if test="updateBy != null "> and d.update_by = #{updateBy}</if>-->
<!-- <if test="specification != null "> and d.specification = #{specification}</if>-->
<!-- <if test="deposit != null "> and d.deposit = #{deposit}</if>-->
<!-- <if test="isActive != null and isActive != ''"> and d.is_active = #{isActive}</if>-->
<!-- <if test="keyWord != null and keyWord != ''">-->
<!-- and (-->
<!-- locate(#{keyWord},t.type_name) > 0-->
<!-- or locate(#{keyWord},c.company_name) > 0-->
<!-- or locate(#{keyWord},d.ma_id) > 0-->
<!-- or locate(#{keyWord},d.model_name) > 0-->
<!-- or locate(#{keyWord},d.specification) > 0-->
<!-- or locate(#{keyWord},d.serial_number) > 0-->
<!-- or locate(#{keyWord},d.description) > 0-->
<!-- )-->
<!-- </if>-->
<!-- and d.is_active='1' and col.user_id = #{userId}-->
<!-- </where>-->
<!-- order by-->
<!-- d.is_active-->
<!-- <if test="monthLeasePriceOrderBy != null and monthLeasePriceOrderBy == 'ASC'">-->
<!-- ,d.month_lease_price-->
<!-- </if>-->
<!-- <if test="monthLeasePriceOrderBy != null and monthLeasePriceOrderBy == 'DESC'">-->
<!-- ,d.month_lease_price DESC-->
<!-- </if>-->
<!-- <if test="updateTimeOrderBy != null and updateTimeOrderBy == 'ASC'">-->
<!-- ,d.update_time-->
<!-- </if>-->
<!-- <if test="updateTimeOrderBy != null and updateTimeOrderBy == 'DESC'">-->
<!-- ,d.update_time DESC-->
<!-- </if>-->
<!-- </select>-->
<select id="selectDevInfoHotList" parameterType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo">
select d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name,search_num
from ma_dev_info d
@ -146,47 +228,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by h.search_num
</select>
<!-- <select id="selectDevInfoHotList" parameterType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo">-->
<!-- select d.*,c.company_name,search_num,t.type_name-->
<!-- from ma_dev_info d-->
<!-- left join bm_company_info c on d.own_co = c.company_id-->
<!-- left join ma_hot_search h on d.ma_id = h.ma_id-->
<!-- left join ma_type_info t on d.type_id = t.type_id-->
<!-- order by h.search_num-->
<!-- </select>-->
<select id="selectDevInfoByMaId" parameterType="Long" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo">
select d.*,c.company_name,c.create_time as company_create_time,c.logo_url as company_logo_url,
c.auth_phone,ty.type_name as device_name,
ty.parent_name as group_name,ty.grandpa_name as type_name,
col.id as collect_id, up.status as is_audit,h.search_num
c.auth_phone, mt1.type_name as device_name,
mt2.type_name as group_name, mt3.type_name as type_name,
col.id as collect_id, h.search_num
from ma_dev_info d
left join bm_company_info c on d.own_co = c.company_id
left join ma_user_collect col on d.ma_id = col.ma_id
left join ma_up_off up on d.ma_id = up.ma_id
left join ma_hot_search h on d.ma_id = h.ma_id
left join ma_type_info t on d.type_id = t.type_id
left join (
select tt.*, pp.type_name as grandpa_name from
(select t.*, p.type_name as parent_name,p.type_id as p_type_id, p.parent_id as p_parent_id
from ma_type_info t
left join ma_type_info p on t.parent_id=p.type_id) tt
left join ma_type_info pp on tt.p_parent_id = pp.type_id
) ty on d.type_id=ty.type_id
left join ma_type_info mt1 on d.type_id = mt1.type_id
left join ma_type_info mt2 on mt1.parent_id = mt2.type_id
left join ma_type_info mt3 on mt2.parent_id = mt3.type_id
where d.ma_id = #{maId} and d.is_active='1'
</select>
<!-- <select id="selectDevInfoByMaId" parameterType="Long" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo">-->
<!-- select d.*,c.company_name,c.create_time as company_create_time,c.logo_url as company_logo_url,-->
<!-- c.auth_phone,t.type_name,-->
<!-- col.id as collect_id, up.status as is_audit,h.search_num-->
<!-- from ma_dev_info d-->
<!-- left join bm_company_info c on d.own_co = c.company_id-->
<!-- left join ma_user_collect col on d.ma_id = col.ma_id-->
<!-- left join ma_up_off up on d.ma_id = up.ma_id-->
<!-- left join ma_hot_search h on d.ma_id = h.ma_id-->
<!-- left join ma_type_info t on d.type_id = t.type_id-->
<!-- where d.ma_id = #{maId}-->
<!-- </select>-->
<select id="getFilesByMaId" parameterType="Long" resultType="com.bonus.zlpt.common.core.domain.system.SysFile">
SELECT s.dic_id, s.file_name as name,s.file_url as url
@ -202,75 +259,75 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY d.own_co
</select>
<insert id="insertDevInfo" parameterType="com.bonus.zlpt.equip.api.domain.DevInfo">
<insert id="insertDevInfo" parameterType="com.bonus.zlpt.equip.api.domain.DevInfo" useGeneratedKeys="true" keyProperty="maId">
insert into ma_dev_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="maId != null">ma_id,</if>
<if test="code != null">code,</if>
<if test="typeId != null">type_id,</if>
<if test="maStatus != null">ma_status,</if>
<if test="leaseScope != null">lease_scope,</if>
<if test="location != null">location,</if>
<if test="provinceId != null">provinceId,</if>
<if test="cityId != null">cityId,</if>
<if test="areaId != null">areaId,</if>
<if test="brand != null">brand,</if>
<if test="modelName != null">model_name,</if>
<if test="productionDate != null">production_date,</if>
<if test="workingHours != null">working_hours,</if>
<if test="serialNumber != null">serial_number,</if>
<if test="monthLeasePrice != null">month_lease_price,</if>
<if test="dayLeasePrice != null">day_lease_price,</if>
<if test="picUrl != null">pic_url,</if>
<if test="jsMonthPrice != null">js_month_price,</if>
<if test="jsDayPrice != null">js_day_price,</if>
<if test="description != null">description,</if>
<if test="gpsCode != null">gps_code,</if>
<if test="ownCo != null">own_co,</if>
<if test="createTime != null">create_time,</if>
<if test="creator != null">creator,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="specification != null">specification,</if>
<if test="deposit != null">deposit,</if>
<if test="isOperator != null">is_operator,</if>
<if test="isActive != null">is_active,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="maId != null and maId != '' ">ma_id,</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>
<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="ownCo != null and ownCo != ''">own_co,</if>
<if test="createTime != null and createTime != ''">create_time,</if>
<if test="creator != null and creator != ''">creator,</if>
<if test="updateTime != null and updateTime != ''">update_time,</if>
<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>
<if test="isActive != null and isActive != ''">is_active,</if>
<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="maId != null">#{maId},</if>
<if test="code != null">#{code},</if>
<if test="typeId != null">#{typeId},</if>
<if test="maStatus != null">#{maStatus},</if>
<if test="leaseScope != null">#{leaseScope},</if>
<if test="location != null">#{location},</if>
<if test="provinceId != null">#{provinceId},</if>
<if test="cityId != null">#{cityId},</if>
<if test="areaId != null">#{areaId},</if>
<if test="brand != null">#{brand},</if>
<if test="modelName != null">#{modelName},</if>
<if test="productionDate != null">#{productionDate},</if>
<if test="workingHours != null">#{workingHours},</if>
<if test="serialNumber != null">#{serialNumber},</if>
<if test="monthLeasePrice != null">#{monthLeasePrice},</if>
<if test="dayLeasePrice != null">#{dayLeasePrice},</if>
<if test="picUrl != null">#{picUrl},</if>
<if test="jsMonthPrice != null">#{jsMonthPrice},</if>
<if test="jsDayPrice != null">#{jsDayPrice},</if>
<if test="description != null">#{description},</if>
<if test="gpsCode != null">#{gpsCode},</if>
<if test="ownCo != null">#{ownCo},</if>
<if test="createTime != null">#{createTime},</if>
<if test="creator != null">#{creator},</if>
<if test="updateTime != null">#{update_time},</if>
<if test="updateBy != null">#{update_by},</if>
<if test="specification != null">#{specification},</if>
<if test="deposit != null">#{deposit},</if>
<if test="isOperator != null">#{isOperator},</if>
<if test="isActive != null">#{isActive},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="maId != null and maId != ''">#{maId},</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>
<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="ownCo != null and ownCo != ''">#{ownCo},</if>
<if test="createTime != null and createTime != ''">#{createTime},</if>
<if test="creator != null and creator != ''">#{creator},</if>
<if test="updateTime != null and updateTime != ''">#{update_time},</if>
<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>
<if test="isActive != null and isActive != ''">#{isActive},</if>
<if test="updateTime != null and updateTime != ''">#{updateTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
</trim>
</insert>
@ -346,6 +403,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectUserCollectByUserId" parameterType="Long" resultType="com.bonus.zlpt.equip.api.domain.UserCollect">
select id, user_id, ma_id, time from ma_user_collect
where user_id = #{userId}
</select>
<update id="updateHotSearchByMaId" parameterType="Long">
update ma_hot_search
set search_num = search_num + 1
where ma_id = #{maId}
</update>
<select id="getSysDic" resultType="com.bonus.zlpt.system.api.domain.SysDic">
select
id,p_id,code,`name`,description,`value`,sort,`level`,status,create_time,creator
@ -366,4 +434,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getBaseAddressById" resultType="String">
select name from base_address where status = 1 and id = #{id}
</select>
<select id="selectDevInfoLists" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo">
select d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name,u.type as type,t.group_name as type_name,t.p_id as group_id,t.group_id as company_id
from ma_dev_info d
left join (select t.*, p.type_name as parent_name, p.type_id as p_id,mt.type_name as group_name, mt.type_id as group_id
from ma_type_info t
left join ma_type_info p on t.parent_id=p.type_id
left join ma_type_info mt on p.parent_id = mt.type_id
) t on d.type_id = t.type_id
left join bm_company_info c on d.own_co = c.company_id
left join ma_up_off u on d.ma_id = u.ma_id ORDER BY d.create_time desc
</select>
</mapper>

View File

@ -14,6 +14,8 @@ import com.bonus.zlpt.order.mapper.OrderInfoMapper;
import com.bonus.zlpt.common.core.domain.order.OrderInfo;
import com.bonus.zlpt.order.service.IOrderInfoService;
import javax.annotation.Resource;
/**
* 订单信息Service业务层处理
*
@ -24,9 +26,9 @@ import com.bonus.zlpt.order.service.IOrderInfoService;
public class OrderInfoServiceImpl implements IOrderInfoService
{
private final Integer ORDER_ATTACHMENT_DIC_ID = 21;
@Autowired
@Resource
private OrderInfoMapper orderInfoMapper;
@Autowired
@Resource
OrderDetailsMapper orderDetailsMapper;
/**
@ -62,8 +64,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
@Override
public int insertOrderInfo(OrderInfoVo orderInfo)
{
LoginUser user = SecurityUtils.getLoginUser();
orderInfo.setOrderUser(user.getUserid());
orderInfo.setOrderUser(SecurityUtils.getUserId());
orderInfoMapper.insertOrderInfo(orderInfo);
Long orderId = orderInfoMapper.selectLastInsertId();
orderInfo.setOrderId(orderId);