Merge remote-tracking branch 'origin/master'

This commit is contained in:
liang.chao 2024-12-16 13:26:09 +08:00
commit f243e118a6
13 changed files with 538 additions and 5 deletions

View File

@ -239,5 +239,7 @@ public class BmCompanyInfo implements Serializable {
//用户名
private String userName;
//上架数
private Integer maCount;
}

View File

@ -0,0 +1,123 @@
package com.bonus.material.basic.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.bonus.common.log.enums.OperaType;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.material.basic.domain.BmCompanyAddress;
import com.bonus.material.basic.service.IBmCompanyAddressService;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.page.TableDataInfo;
/**
* 企业信息Controller
*
* @author xsheng
* @date 2024-12-16
*/
@Api(tags = "企业信息接口")
@RestController
@RequestMapping("/bm_company_address")
public class BmCompanyAddressController extends BaseController {
@Autowired
private IBmCompanyAddressService bmCompanyAddressService;
/**
* 查询企业信息列表
*/
@ApiOperation(value = "查询企业信息列表")
//@RequiresPermissions("basic:address:list")
@GetMapping("/list")
public TableDataInfo list(BmCompanyAddress bmCompanyAddress) {
startPage();
bmCompanyAddress.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
List<BmCompanyAddress> list = bmCompanyAddressService.selectBmCompanyAddressList(bmCompanyAddress);
return getDataTable(list);
}
/**
* 导出企业信息列表
*/
@ApiOperation(value = "导出企业信息列表")
@PreventRepeatSubmit
//@RequiresPermissions("basic:address:export")
@SysLog(title = "企业信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出企业信息")
@PostMapping("/export")
public void export(HttpServletResponse response, BmCompanyAddress bmCompanyAddress) {
List<BmCompanyAddress> list = bmCompanyAddressService.selectBmCompanyAddressList(bmCompanyAddress);
ExcelUtil<BmCompanyAddress> util = new ExcelUtil<BmCompanyAddress>(BmCompanyAddress.class);
util.exportExcel(response, list, "企业信息数据");
}
/**
* 获取企业信息详细信息
*/
@ApiOperation(value = "获取企业信息详细信息")
//@RequiresPermissions("basic:address:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(bmCompanyAddressService.selectBmCompanyAddressById(id));
}
/**
* 新增企业信息
*/
@ApiOperation(value = "新增企业信息")
@PreventRepeatSubmit
//@RequiresPermissions("basic:address:add")
@SysLog(title = "企业信息", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增企业信息")
@PostMapping
public AjaxResult add(@RequestBody BmCompanyAddress bmCompanyAddress) {
try {
bmCompanyAddress.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
return toAjax(bmCompanyAddressService.insertBmCompanyAddress(bmCompanyAddress));
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}
/**
* 修改企业信息
*/
@ApiOperation(value = "修改企业信息")
//@PreventRepeatSubmit
//@RequiresPermissions("basic:address:edit")
@SysLog(title = "企业信息", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改企业信息")
@PostMapping("/edit")
public AjaxResult edit(@RequestBody BmCompanyAddress bmCompanyAddress) {
try {
bmCompanyAddress.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
return toAjax(bmCompanyAddressService.updateBmCompanyAddress(bmCompanyAddress));
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}
/**
* 删除企业信息
*/
@ApiOperation(value = "删除企业信息")
@PreventRepeatSubmit
//@RequiresPermissions("basic:address:remove")
@SysLog(title = "企业信息", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除企业信息")
@PostMapping("/del/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(bmCompanyAddressService.deleteBmCompanyAddressByIds(ids));
}
}

View File

@ -0,0 +1,66 @@
package com.bonus.material.basic.domain;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
/**
* 企业信息对象 bm_company_address
*
* @author xsheng
* @date 2024-12-16
*/
@Data
@ToString
public class BmCompanyAddress extends BaseEntity {
private static final long serialVersionUID = 1L;
/** id主键 */
private Long id;
/** dept_id */
@Excel(name = "dept_id")
@ApiModelProperty(value = "dept_id")
private Long companyId;
/** 需求所在省code */
@Excel(name = "需求所在省code")
@ApiModelProperty(value = "需求所在省code")
private Long provinceCode;
/** 需求所在省名称 */
@Excel(name = "需求所在省名称")
@ApiModelProperty(value = "需求所在省名称")
private String provinceName;
/** 需求所在市code */
@Excel(name = "需求所在市code")
@ApiModelProperty(value = "需求所在市code")
private Long cityCode;
/** 需求所在市名称 */
@Excel(name = "需求所在市名称")
@ApiModelProperty(value = "需求所在市名称")
private String cityName;
/** 需求所在区code */
@Excel(name = "需求所在区code")
@ApiModelProperty(value = "需求所在区code")
private Long areaCode;
/** 需求所在区名称 */
@Excel(name = "需求所在区名称")
@ApiModelProperty(value = "需求所在区名称")
private String areaName;
/** 企业名称 */
@Excel(name = "企业名称")
@ApiModelProperty(value = "企业名称")
private String address;
}

View File

@ -0,0 +1,60 @@
package com.bonus.material.basic.mapper;
import java.util.List;
import com.bonus.material.basic.domain.BmCompanyAddress;
/**
* 企业信息Mapper接口
*
* @author xsheng
* @date 2024-12-16
*/
public interface BmCompanyAddressMapper {
/**
* 查询企业信息
*
* @param id 企业信息主键
* @return 企业信息
*/
public BmCompanyAddress selectBmCompanyAddressById(Long id);
/**
* 查询企业信息列表
*
* @param bmCompanyAddress 企业信息
* @return 企业信息集合
*/
public List<BmCompanyAddress> selectBmCompanyAddressList(BmCompanyAddress bmCompanyAddress);
/**
* 新增企业信息
*
* @param bmCompanyAddress 企业信息
* @return 结果
*/
public int insertBmCompanyAddress(BmCompanyAddress bmCompanyAddress);
/**
* 修改企业信息
*
* @param bmCompanyAddress 企业信息
* @return 结果
*/
public int updateBmCompanyAddress(BmCompanyAddress bmCompanyAddress);
/**
* 删除企业信息
*
* @param id 企业信息主键
* @return 结果
*/
public int deleteBmCompanyAddressById(Long id);
/**
* 批量删除企业信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBmCompanyAddressByIds(Long[] ids);
}

View File

@ -0,0 +1,60 @@
package com.bonus.material.basic.service;
import java.util.List;
import com.bonus.material.basic.domain.BmCompanyAddress;
/**
* 企业信息Service接口
*
* @author xsheng
* @date 2024-12-16
*/
public interface IBmCompanyAddressService {
/**
* 查询企业信息
*
* @param id 企业信息主键
* @return 企业信息
*/
public BmCompanyAddress selectBmCompanyAddressById(Long id);
/**
* 查询企业信息列表
*
* @param bmCompanyAddress 企业信息
* @return 企业信息集合
*/
public List<BmCompanyAddress> selectBmCompanyAddressList(BmCompanyAddress bmCompanyAddress);
/**
* 新增企业信息
*
* @param bmCompanyAddress 企业信息
* @return 结果
*/
public int insertBmCompanyAddress(BmCompanyAddress bmCompanyAddress);
/**
* 修改企业信息
*
* @param bmCompanyAddress 企业信息
* @return 结果
*/
public int updateBmCompanyAddress(BmCompanyAddress bmCompanyAddress);
/**
* 批量删除企业信息
*
* @param ids 需要删除的企业信息主键集合
* @return 结果
*/
public int deleteBmCompanyAddressByIds(Long[] ids);
/**
* 删除企业信息信息
*
* @param id 企业信息主键
* @return 结果
*/
public int deleteBmCompanyAddressById(Long id);
}

View File

@ -0,0 +1,98 @@
package com.bonus.material.basic.service.impl;
import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.basic.mapper.BmCompanyAddressMapper;
import com.bonus.material.basic.domain.BmCompanyAddress;
import com.bonus.material.basic.service.IBmCompanyAddressService;
/**
* 企业信息Service业务层处理
*
* @author xsheng
* @date 2024-12-16
*/
@Service
public class BmCompanyAddressServiceImpl implements IBmCompanyAddressService {
@Autowired
private BmCompanyAddressMapper bmCompanyAddressMapper;
/**
* 查询企业信息
*
* @param id 企业信息主键
* @return 企业信息
*/
@Override
public BmCompanyAddress selectBmCompanyAddressById(Long id) {
return bmCompanyAddressMapper.selectBmCompanyAddressById(id);
}
/**
* 查询企业信息列表
*
* @param bmCompanyAddress 企业信息
* @return 企业信息
*/
@Override
public List<BmCompanyAddress> selectBmCompanyAddressList(BmCompanyAddress bmCompanyAddress) {
return bmCompanyAddressMapper.selectBmCompanyAddressList(bmCompanyAddress);
}
/**
* 新增企业信息
*
* @param bmCompanyAddress 企业信息
* @return 结果
*/
@Override
public int insertBmCompanyAddress(BmCompanyAddress bmCompanyAddress) {
bmCompanyAddress.setCreateTime(DateUtils.getNowDate());
try {
return bmCompanyAddressMapper.insertBmCompanyAddress(bmCompanyAddress);
} catch (Exception e) {
throw new ServiceException("错误信息描述");
}
}
/**
* 修改企业信息
*
* @param bmCompanyAddress 企业信息
* @return 结果
*/
@Override
public int updateBmCompanyAddress(BmCompanyAddress bmCompanyAddress) {
bmCompanyAddress.setUpdateTime(DateUtils.getNowDate());
try {
return bmCompanyAddressMapper.updateBmCompanyAddress(bmCompanyAddress);
} catch (Exception e) {
throw new ServiceException("错误信息描述");
}
}
/**
* 批量删除企业信息
*
* @param ids 需要删除的企业信息主键
* @return 结果
*/
@Override
public int deleteBmCompanyAddressByIds(Long[] ids) {
return bmCompanyAddressMapper.deleteBmCompanyAddressByIds(ids);
}
/**
* 删除企业信息信息
*
* @param id 企业信息主键
* @return 结果
*/
@Override
public int deleteBmCompanyAddressById(Long id) {
return bmCompanyAddressMapper.deleteBmCompanyAddressById(id);
}
}

View File

@ -47,6 +47,11 @@ public class DevInfo extends BaseEntity {
@ApiModelProperty(value = "设备编码")
private String code;
/** 设备唯一标识符,用户输入,比如车架号 */
@Excel(name = "设备唯一标识符")
@ApiModelProperty(value = "设备唯一标识符")
private String identifyCode;
@ApiModelProperty(value = "装备名称")
@NotBlank
private String deviceName;

View File

@ -142,6 +142,8 @@ public interface DevInfoMapper {
*/
List<BmCompanyInfo> selectCompanyList(BmCompanyInfo obj);
List<BmCompanyInfo> getMaCountByCompany(BmCompanyInfo obj);
int updateUpDown(@Param("maIds") List<Long> maIds, @Param("maStatus") Object maStatus);
/**

View File

@ -625,7 +625,18 @@ public class DevInfoServiceImpl implements DevInfoService {
*/
@Override
public List<BmCompanyInfo> selectCompanyList(BmCompanyInfo obj) {
return devInfoMapper.selectCompanyList(obj);
List<BmCompanyInfo> companyInfos = devInfoMapper.selectCompanyList(obj);
List<BmCompanyInfo> companyMaCountList = devInfoMapper.getMaCountByCompany(obj);
if (!CollectionUtils.isEmpty(companyInfos) && !CollectionUtils.isEmpty(companyMaCountList)) {
for (BmCompanyInfo bmInfo : companyInfos) {
for (BmCompanyInfo maCountList : companyMaCountList) {
if (bmInfo.getCompanyId().equals(maCountList.getCompanyId())) {
bmInfo.setMaCount(maCountList.getMaCount());
}
}
}
}
return companyInfos;
}
/**

View File

@ -51,11 +51,11 @@ public class MaLeaseInfo extends BaseEntity implements Serializable {
private Integer leaseStatus;
@ApiModelProperty(value = "租赁开始时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date leaseStartTime;
@ApiModelProperty(value = "租赁结束时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date leaseEndTime;
/**
@ -75,7 +75,7 @@ public class MaLeaseInfo extends BaseEntity implements Serializable {
/**
* 需求截止日期(年月日)
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/**

View File

@ -10,6 +10,7 @@ import com.bonus.common.biz.enums.LeaseInfoEnum;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.utils.encryption.Sm4Utils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.device.mapper.BmFileInfoMapper;
@ -178,6 +179,7 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
// 2. 查询租赁信息
MaLeaseVo maLeaseVo = leaseInfoMapper.selectByName(maLeaseInfo);
maLeaseVo.setOrderPhone(Sm4Utils.decrypt(maLeaseVo.getOrderPhone()));
List<MaLeaseDetails> leaseDetailsList = leaseInfoMapper.selectDetailsById(maLeaseInfo);
// 3. 处理租赁详情信息
@ -272,6 +274,7 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
//查询列表中数据如果需求截止日期超过当前则修改状态为已过期
for (MaLeaseVo maLeaseVo : list) {
Date endTime = maLeaseVo.getEndTime();
maLeaseVo.setOrderPhone(Sm4Utils.decrypt(maLeaseVo.getOrderPhone()));
if (maLeaseVo.getLeaseStatus().equals(LeaseInfoEnum.LEASE_PENDING_ORDER.getStatus())
&& endTime != null && endTime.before(new Date())) {
//根据id修改状态为已过期

View File

@ -0,0 +1,91 @@
<?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">
<mapper namespace="com.bonus.material.basic.mapper.BmCompanyAddressMapper">
<resultMap type="com.bonus.material.basic.domain.BmCompanyAddress" id="BmCompanyAddressResult">
<result property="id" column="id" />
<result property="companyId" column="company_id" />
<result property="provinceCode" column="province_code" />
<result property="provinceName" column="province_name" />
<result property="cityCode" column="city_code" />
<result property="cityName" column="city_name" />
<result property="areaCode" column="area_code" />
<result property="areaName" column="area_name" />
<result property="address" column="address" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectBmCompanyAddressVo">
select bca.id, bca.company_id, bca.province_code, bca.city_code, bca.area_code, bca.address, bca.create_time, bca.update_time,
b.name as area_name, b1.name as province_name, b2.name as city_name
from bm_company_address bca
LEFT JOIN base_address b ON b.code = bca.area_code
LEFT JOIN base_address b1 on bca.province_code = b1.code
LEFT JOIN base_address b2 on bca.city_code = b2.code
</sql>
<select id="selectBmCompanyAddressList" parameterType="com.bonus.material.basic.domain.BmCompanyAddress" resultMap="BmCompanyAddressResult">
<include refid="selectBmCompanyAddressVo"/>
<where>
<if test="companyId != null "> and bca.company_id = #{companyId}</if>
<if test="provinceCode != null "> and bca.province_code = #{provinceCode}</if>
<if test="cityCode != null "> and bca.city_code = #{cityCode}</if>
<if test="areaCode != null "> and bca.area_code = #{areaCode}</if>
<if test="address != null and address != ''"> and bca.address = #{address}</if>
</where>
</select>
<select id="selectBmCompanyAddressById" parameterType="Long" resultMap="BmCompanyAddressResult">
<include refid="selectBmCompanyAddressVo"/>
where bca.id = #{id}
</select>
<insert id="insertBmCompanyAddress" parameterType="com.bonus.material.basic.domain.BmCompanyAddress" useGeneratedKeys="true" keyProperty="id">
insert into bm_company_address
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyId != null">company_id,</if>
<if test="provinceCode != null">province_code,</if>
<if test="cityCode != null">city_code,</if>
<if test="areaCode != null">area_code,</if>
<if test="address != null">address,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyId != null">#{companyId},</if>
<if test="provinceCode != null">#{provinceCode},</if>
<if test="cityCode != null">#{cityCode},</if>
<if test="areaCode != null">#{areaCode},</if>
<if test="address != null">#{address},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateBmCompanyAddress" parameterType="com.bonus.material.basic.domain.BmCompanyAddress">
update bm_company_address
<trim prefix="SET" suffixOverrides=",">
<if test="companyId != null">company_id = #{companyId},</if>
<if test="provinceCode != null">province_code = #{provinceCode},</if>
<if test="cityCode != null">city_code = #{cityCode},</if>
<if test="areaCode != null">area_code = #{areaCode},</if>
<if test="address != null">address = #{address},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBmCompanyAddressById" parameterType="Long">
delete from bm_company_address where id = #{id}
</delete>
<delete id="deleteBmCompanyAddressByIds" parameterType="String">
delete from bm_company_address where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="com.bonus.material.device.domain.vo.DevInfoVo" id="DevInfoResult">
<result property="maId" column="ma_id" />
<result property="code" column="code" />
<result property="identifyCode" column="identify_code" />
<result property="typeId" column="type_id" />
<result property="maStatus" column="ma_status" />
<result property="leaseScope" column="lease_scope" />
@ -43,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDevInfoVo">
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,
select ma_id, device_name, device_weight, device_count, code, identify_code, type_id, ma_status, lease_scope, location, province_id, city_id, area_id, brand, model_name, production_date, working_hours, serial_number,
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
@ -53,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
d.ma_id as maId,
d.code as code,
d.identify_code as identifyCode,
d.device_name as deviceName,
d.device_weight as deviceWeight,
d.device_count as deviceCount,
@ -170,6 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
d.ma_id as maId,
d.code as code,
d.identify_code as identifyCode,
d.device_name as deviceName,
d.device_count as deviceCount,
d.device_weight as deviceWeight,
@ -215,6 +218,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
d.ma_id as maId,
d.code as code,
identify_code as identifyCode,
d.device_name as deviceName,
d.device_weight as deviceWeight,
d.device_count as deviceCount,
@ -273,6 +277,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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="identifyCode != null and identifyCode != '' ">identify_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>
@ -580,6 +585,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</select>
<select id="getMaCountByCompany" resultType="com.bonus.common.biz.domain.BmCompanyInfo">
select own_co as companyId,count(1) as maCount from ma_dev_info
where ma_status=2
group by own_co
</select>
<select id="getBookCar" resultType="com.bonus.material.book.domain.BookCarInfoDto">
SELECT
ma_id as maId,
@ -600,6 +611,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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="identifyCode != null and identifyCode != '' ">identify_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>