Merge remote-tracking branch 'origin/master'

This commit is contained in:
sxu 2024-12-19 17:29:06 +08:00
commit 6c45388aa0
13 changed files with 315 additions and 9 deletions

View File

@ -6,6 +6,7 @@ import com.bonus.material.comprehensive.entity.RentDetailDto;
import com.bonus.material.device.domain.DevInfo;
import com.bonus.material.device.domain.vo.DevInfoVo;
import com.bonus.material.device.service.DevInfoService;
import com.bonus.material.order.domain.OrderInfoDto;
import com.bonus.material.order.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -44,4 +45,11 @@ public class ComprehensiveController extends BaseController {
List<RentDetailDto> list = orderService.getRentDetails(devInfo);
return AjaxResult.success(getDataTable(list));
}
@ApiOperation(value = "综合查询-订单信息查询")
@GetMapping("/orderDetails")
public AjaxResult getOrderDetails(OrderInfoDto orderInfoDto) {
startPage();
List<OrderInfoDto> list = orderService.getOrderInfos(orderInfoDto);
return AjaxResult.success(getDataTable(list));
}
}

View File

@ -58,7 +58,6 @@ public class BmContractServiceImpl implements BmContractService {
bmFileInfo.setTaskType(MaterialConstants.APPENDICES_OF_CONTRACT);
// 合同照片附件
bmFileInfo.setFileType(0L);
bmFileInfo.setFileName(URLEncoder.encode(bmFileInfo.getFileName(), StandardCharsets.UTF_8.toString()));
bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
}
@ -82,7 +81,6 @@ public class BmContractServiceImpl implements BmContractService {
bmFileInfo.setTaskType(MaterialConstants.APPENDICES_OF_CONTRACT);
// 合同照片附件
bmFileInfo.setFileType(0L);
bmFileInfo.setFileName(URLEncoder.encode(bmFileInfo.getFileName(), StandardCharsets.UTF_8.toString()));
bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
}

View File

@ -218,13 +218,17 @@ public class OrderController extends BaseController {
Date date = inputFormat.parse(dateStr);
String formattedDate = outputFormat.format(date);
//订单日期
replacements.put("${orderTime}", formattedDate);
replacements.put("${createTime}", formattedDate);
//装备所属公司
replacements.put("${czcompanyName}", orderInfoDto.getCzcompanyName());
replacements.put("${sellerCompanyName}", orderInfoDto.getCzcompanyName());
//承租方所属公司
replacements.put("${companyName}", orderInfoDto.getCompanyName());
replacements.put("${buyerCompanyName}", orderInfoDto.getCompanyName());
//订单金额
replacements.put("${cost}", orderInfoDto.getCost().toString());
//出租方电话
replacements.put("${sellerCompanyPhone}", orderInfoDto.getPersonPhone());
//承租方电话
replacements.put("${buyerCompanyPhone}", orderInfoDto.getPhoneNumber());
//订单详情
StringBuilder orderDetail = new StringBuilder();
for (OrderDetailDto orderDetailDto : orderDetailsByOrderId) {
@ -284,12 +288,18 @@ public class OrderController extends BaseController {
SimpleDateFormat inputFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Map<String, String> replacements = new HashMap<>();
//订单日期
replacements.put("${createTime}", DateUtils.getDate());
//装备所属公司
replacements.put("${czcompanyName}", orderInfoDto.getCzcompanyName());
replacements.put("${sellerCompanyName}", orderInfoDto.getCzcompanyName());
//承租方所属公司
replacements.put("${companyName}", orderInfoDto.getCompanyName());
replacements.put("${buyerCompanyName}", orderInfoDto.getCompanyName());
//订单金额
replacements.put("${cost}", orderInfoDto.getCost().toString());
//出租方电话
replacements.put("${sellerCompanyPhone}", orderInfoDto.getPersonPhone());
//承租方电话
replacements.put("${buyerCompanyPhone}", SecurityUtils.getLoginUser().getSysUser().getPhonenumber());
//订单详情
StringBuilder orderDetail = new StringBuilder();
List<OrderDetailDto> detailsList = orderInfoDto.getDetailsList();

View File

@ -26,4 +26,6 @@ public interface OrderService {
OrderInfoDto getAgreementByOrderId(String orderId);
List<RentDetailDto> getRentDetails(DevInfoVo devInfo);
List<OrderInfoDto> getOrderInfos(OrderInfoDto orderInfoDto);
}

View File

@ -235,4 +235,83 @@ public class OrderServiceImpl implements OrderService {
public List<RentDetailDto> getRentDetails(DevInfoVo devInfo) {
return orderMapper.getRentDetails(devInfo);
}
@Override
public List<OrderInfoDto> getOrderInfos(OrderInfoDto devInfo) {
List<OrderInfoDto> orderInfoDtos = orderMapper.getOrderDetails(devInfo);
for (OrderInfoDto dto : orderInfoDtos) {
dto.setPhoneNumber(Sm4Utils.decrypt(dto.getPhoneNumber()));
List<OrderDetailDto> list = new ArrayList();
String ids = dto.getIds();
for (String id : ids.split(",")) {
OrderDetailDto orderDetailDto = orderMapper.selectOrderDetailsById(id);
list.add(orderDetailDto);
}
BigDecimal totalRentalPrice = BigDecimal.ZERO;
BigDecimal totalReliefPrice = BigDecimal.ZERO;
for (OrderDetailDto detailDto : list) {
if (Objects.nonNull(detailDto) && String.valueOf(OrderStatusEnum.ORDER_FINISHED.getStatus()).equals(detailDto.getOrderStatus())) {
detailDto.setDays(detailDto.getDateDays() == null ? detailDto.getDays() : String.valueOf(detailDto.getDateDays()));
if (detailDto.getChangeCost() != null) {
totalRentalPrice = totalRentalPrice.add(detailDto.getChangeCost());
} else {
if (detailDto.getDateDays() != null && detailDto.getDateDays() > 0
&& detailDto.getDayLeasePrice() != null) {
BigDecimal newTotalPrice = detailDto.getDayLeasePrice().multiply(new BigDecimal(detailDto.getDateDays()))
.setScale(2, RoundingMode.HALF_UP);
totalRentalPrice = totalRentalPrice.add(newTotalPrice);
detailDto.setCosts(newTotalPrice);
}
}
if (detailDto.getReliefChangeCost() != null) {
totalReliefPrice.add(detailDto.getReliefChangeCost());
} else if (detailDto.getReliefCost() != null) {
totalReliefPrice.add(detailDto.getReliefCost());
}
}
}
dto.setTotalRentalPrice(totalRentalPrice);
dto.setDetailsList(list);
Optional<OrderDetailDto> minOrderStatus = list.stream()
.min((p1, p2) -> Integer.compare(Integer.parseInt(p1.getOrderStatus()), Integer.parseInt(p2.getOrderStatus())));
if (minOrderStatus.isPresent()) {
dto.setOrderStatus(minOrderStatus.get().getOrderStatus());
}
//根据订单id去lease_repair_record表中查询是否已填写退租检修信息
int count = leaseRepairRecordMapper.selectLeaseContent(String.valueOf(dto.getOrderId()));
if (count > 0) {
dto.setIsLeaseContent(1);
} else {
dto.setIsLeaseContent(0);
}
dto.setPartBacked(list.stream().anyMatch(o -> OrderStatusEnum.ORDER_UNDER_LEASE.getStatus().toString().equals(o.getOrderStatus())));
//TODO计算总费用
LeaseRepair leaseRepair = new LeaseRepair();
leaseRepair.setOrderId(String.valueOf(dto.getOrderId()));
List<LeaseRepairRecord> leaseRepairRecords = leaseRepairRecordMapper.getLeaseRepairRecordList(leaseRepair);
BigDecimal totalRepairScrapLossPrice = BigDecimal.ZERO;
if (!CollectionUtils.isEmpty(leaseRepairRecords)) {
for (LeaseRepairRecord leaseRepairRecord : leaseRepairRecords) {
if (leaseRepairRecord.getRepairChangePrice() != null) {
totalRepairScrapLossPrice = totalRepairScrapLossPrice.add(leaseRepairRecord.getRepairChangePrice());
} else if (leaseRepairRecord.getRepairPrice() != null) {
totalRepairScrapLossPrice = totalRepairScrapLossPrice.add(leaseRepairRecord.getRepairPrice());
}
if (leaseRepairRecord.getScrapChangePrice() != null) {
totalRepairScrapLossPrice = totalRepairScrapLossPrice.add(leaseRepairRecord.getScrapChangePrice());
} else if (leaseRepairRecord.getScrapPrice() != null) {
totalRepairScrapLossPrice = totalRepairScrapLossPrice.add(leaseRepairRecord.getScrapPrice());
}
if (leaseRepairRecord.getLossChangePrice() != null) {
totalRepairScrapLossPrice = totalRepairScrapLossPrice.add(leaseRepairRecord.getLossChangePrice());
} else if (leaseRepairRecord.getLossPrice() != null) {
totalRepairScrapLossPrice = totalRepairScrapLossPrice.add(leaseRepairRecord.getLossPrice());
}
}
dto.setTotalRepairScrapLossPrice(totalRepairScrapLossPrice);
}
dto.setTotalRealPrice(BigDecimal.ZERO.add(totalRentalPrice).add(totalRepairScrapLossPrice).subtract(totalReliefPrice));
}
return orderInfoDtos;
}
}

View File

@ -0,0 +1,43 @@
package com.bonus.material.user.controller;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.user.entity.UserDto;
import com.bonus.material.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @Authorliang.chao
* @Date2024/12/19 - 14:38
*/
@RestController
@Api(value = "个人管理", tags = {"个人管理"})
@RequestMapping("/userManage")
public class UserController extends BaseController {
@Resource
private UserService userService;
@ApiOperation(value = "个人信息")
@GetMapping("/userInfo")
public AjaxResult getUserInfo() {
return AjaxResult.success(userService.getUserById(SecurityUtils.getLoginUser().getUserid()));
}
@ApiOperation(value = "修改个人信息")
@PostMapping("/editUser")
public AjaxResult editUser(@RequestBody UserDto userDto) {
Integer i = userService.editUser(userDto);
if (i > 0){
return success("修改成功");
}else {
return error("修改失败");
}
}
}

View File

@ -0,0 +1,90 @@
package com.bonus.material.user.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @Authorliang.chao
* @Date2024/12/19 - 14:43
*/
@Data
public class UserDto {
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "部门ID")
private Long deptId;
@ApiModelProperty(value = "用户账号")
private String userName;
@ApiModelProperty(value = "用户昵称")
private String nickName;
@ApiModelProperty(value = "用户类型00系统用户")
private String userType;
@ApiModelProperty(value = "用户邮箱")
private String email;
@ApiModelProperty(value = "手机号码")
private String phonenumber;
@ApiModelProperty(value = "用户性别0男 1女 2未知")
private String sex;
@ApiModelProperty(value = "头像地址")
private String avatar;
@ApiModelProperty(value = "密码")
private String password;
@ApiModelProperty(value = "帐号状态0正常 1停用")
private String status;
@ApiModelProperty(value = "删除标志0代表存在 2代表删除")
private String delFlag;
@ApiModelProperty(value = "最后登录IP")
private String loginIp;
@ApiModelProperty(value = "最后登录时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date loginDate;
@ApiModelProperty(value = "创建者")
private String createBy;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime;
@ApiModelProperty(value = "更新者")
private String updateBy;
@ApiModelProperty(value = "更新时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date updateTime;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "登录类型")
private String loginType;
@ApiModelProperty(value = "审批状态0未审批1已审批")
private String approvalStatus;
@ApiModelProperty(value = "长期和临时用户标识0临时用户1长期用户")
private String isPermanent;
@ApiModelProperty(value = "是否内置用户0内置用户1非内置用户")
private String isBuiltIn;
}

View File

@ -0,0 +1,13 @@
package com.bonus.material.user.mapper;
import com.bonus.material.user.entity.UserDto;
/**
* @Authorliang.chao
* @Date2024/12/19 - 14:52
*/
public interface UserMapper {
UserDto getUserById(Long userId);
Integer editUser(UserDto userDto);
}

View File

@ -0,0 +1,14 @@
package com.bonus.material.user.service;
import com.bonus.material.user.entity.UserDto;
/**
* @Authorliang.chao
* @Date2024/12/19 - 14:50
*/
public interface UserService {
UserDto getUserById(Long userId);
Integer editUser(UserDto userDto);
}

View File

@ -0,0 +1,30 @@
package com.bonus.material.user.service.impl;
import com.bonus.common.core.utils.encryption.Sm4Utils;
import com.bonus.material.user.entity.UserDto;
import com.bonus.material.user.mapper.UserMapper;
import com.bonus.material.user.service.UserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @Authorliang.chao
* @Date2024/12/19 - 14:51
*/
@Service
public class UserServiceImpl implements UserService {
@Resource
private UserMapper userMapper;
@Override
public UserDto getUserById(Long userId) {
UserDto user = userMapper.getUserById(userId);
user.setPassword(Sm4Utils.decrypt(user.getPassword()));
return user;
}
@Override
public Integer editUser(UserDto userDto) {
return userMapper.editUser(userDto);
}
}

View File

@ -469,6 +469,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getLeaseRepairRecordList" resultType="com.bonus.material.lease.domain.LeaseRepairRecord">
SELECT
lr.ma_id as maId,
m1.code,
m1.device_name as deviceName,
mt.type_name as typeName,
lr.repair_num as repairNum,

View File

@ -155,10 +155,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
OR (hh.rent_begin_time &lt; #{startTime} AND hh.rent_end_time > #{endTime}))
</if>
<if test="czcompanyName != null and czcompanyName != ''">
AND c.company_name like concat('%',#{czcompanyName},'%')
AND up.dept_name like concat('%',#{czcompanyName},'%')
</if>
<if test="companyName != null and companyName != ''">
AND dept.companyName like concat('%',#{companyName},'%')
AND dept.dept_name like concat('%',#{companyName},'%')
</if>
<if test="lowerBound != null and lowerBound != '' and upperBound != null and upperBound != ''">
AND mt.lease_price BETWEEN #{lowerBound} AND #{upperBound}

View File

@ -0,0 +1,18 @@
<?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.user.mapper.UserMapper">
<update id="editUser">
update sys_user
<trim prefix="SET" suffixOverrides=",">
<if test="phoneNumber != null and phoneNumber != ''">phonenumber = #{phoneNumber},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
</trim>
where user_id = #{userId}
</update>
<select id="getUserById" resultType="com.bonus.material.user.entity.UserDto">
select * from sys_user where user_id = #{userId}
</select>
</mapper>