Merge remote-tracking branch 'origin/ah-simple' into ah-simple

This commit is contained in:
jiang 2025-10-14 17:23:22 +08:00
commit f7150d486d
12 changed files with 182 additions and 106 deletions

View File

@ -27,8 +27,8 @@ public enum MaStatusEnum {
/** /**
* 根据code获取name * 根据code获取name
* @param code * @param code 枚举编码
* @return * @return 枚举值
*/ */
public static String getNameByCode(int code) { public static String getNameByCode(int code) {
MaStatusEnum[] maStatusEnums = values(); MaStatusEnum[] maStatusEnums = values();

View File

@ -19,16 +19,17 @@ import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
* @Authorliang.chao * @author liang.chao
* @Date2024/12/18 - 11:14
* 综合查询 * 综合查询
*/ */
@Api(tags = "综合查询") @Api(tags = "综合查询")
@RestController @RestController
@RequestMapping("/comprehensive") @RequestMapping("/comprehensive")
public class ComprehensiveController extends BaseController { public class ComprehensiveController extends BaseController {
@Resource @Resource
private DevInfoService devInfoService; private DevInfoService devInfoService;
@Resource @Resource
private OrderService orderService; private OrderService orderService;
@ -43,9 +44,6 @@ public class ComprehensiveController extends BaseController {
/** /**
* 在租装备信息查询 * 在租装备信息查询
*
* @param devInfo
* @return
*/ */
@ApiOperation(value = "综合查询-在租装备信息查询") @ApiOperation(value = "综合查询-在租装备信息查询")
@GetMapping("/getLeaseDevList") @GetMapping("/getLeaseDevList")
@ -74,10 +72,15 @@ public class ComprehensiveController extends BaseController {
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
} }
@ApiOperation(value = "订单确认") @ApiOperation(value = "订单确认--同意")
@PostMapping("/orderConfirm/{orderId}") @PostMapping("/orderConfirm/{orderId}")
public AjaxResult orderConfirm(@PathVariable String orderId) { public AjaxResult orderConfirm(@PathVariable String orderId) {
return orderService.orderConfirm(orderId); return orderService.orderConfirm(orderId);
} }
@ApiOperation(value = "订单确认--驳回")
@PostMapping("/orderReject/{orderId}")
public AjaxResult orderReject(@PathVariable String orderId) {
return orderService.orderReject(orderId);
}
} }

View File

@ -12,28 +12,24 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.List; import java.util.List;
/** /**
* 设备台账-总览表 * 设备台账-总览表
* *
* @author xxxxx * @author bonus
*/ */
@RestController @RestController
@RequestMapping("/device") @RequestMapping("/device")
public class MaDevInfoController extends BaseController { public class MaDevInfoController extends BaseController {
/**
* 服务对象 @Resource
*/
@Autowired
private MaDevInfoService service; private MaDevInfoService service;
/** /**
* cha * 设备台账
*
* @param o
* @return
*/ */
@ApiOperation(value = "设备台账") @ApiOperation(value = "设备台账")
@GetMapping("/list") @GetMapping("/list")
@ -48,34 +44,24 @@ public class MaDevInfoController extends BaseController {
} }
} }
@ApiOperation(value = "设备台账-上下架") @ApiOperation(value = "设备台账-上下架")
@PostMapping("/updateDeviceStatus") @PostMapping("/updateDeviceStatus")
public AjaxResult updateDeviceStatus(@RequestBody DevMergeVo o) { public AjaxResult updateDeviceStatus(@RequestBody DevMergeVo o) {
try { try {
Integer i = service.updateDeviceStatus(o); Integer i = service.updateDeviceStatus(o);
if (i > 0) { return i > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
return AjaxResult.success("修改成功");
} else {
return AjaxResult.error("修改失败");
}
} catch (Exception e) { } catch (Exception e) {
logger.error("报错啦", e); logger.error("报错啦", e);
return AjaxResult.error("调用异常,请联系管理员"); return AjaxResult.error("调用异常,请联系管理员");
} }
} }
@ApiOperation(value = "设备台账-修改") @ApiOperation(value = "设备台账-修改")
@PostMapping("/updateDeviceApi") @PostMapping("/updateDeviceApi")
public AjaxResult updateDeviceApi(@RequestBody MaDevInfo o) { public AjaxResult updateDeviceApi(@RequestBody MaDevInfo o) {
try { try {
Integer i = service.updateDeviceApi(o); Integer i = service.updateDeviceApi(o);
if (i > 0) { return i > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
return AjaxResult.success("修改成功");
} else {
return AjaxResult.error("修改失败");
}
} catch (Exception e) { } catch (Exception e) {
logger.error("报错啦", e); logger.error("报错啦", e);
return AjaxResult.error("调用异常,请联系管理员"); return AjaxResult.error("调用异常,请联系管理员");
@ -93,18 +79,13 @@ public class MaDevInfoController extends BaseController {
public AjaxResult delDevice(@PathVariable("ids") String[] ids) { public AjaxResult delDevice(@PathVariable("ids") String[] ids) {
try { try {
Integer i = service.delDevice(ids); Integer i = service.delDevice(ids);
if (i > 0) { return i > 0 ? AjaxResult.success("修改成功"): AjaxResult.error("修改失败");
return AjaxResult.success("修改成功");
} else {
return AjaxResult.error("修改失败");
}
} catch (Exception e) { } catch (Exception e) {
logger.error("报错啦", e); logger.error("报错啦", e);
return AjaxResult.error("调用异常,请联系管理员"); return AjaxResult.error("调用异常,请联系管理员");
} }
} }
@ApiOperation(value = "设备类型树") @ApiOperation(value = "设备类型树")
@PostMapping("/deviceTree") @PostMapping("/deviceTree")
public AjaxResult deviceTree(String id) { public AjaxResult deviceTree(String id) {

View File

@ -29,6 +29,7 @@ public interface BmFileInfoMapper {
* @return 附件集合 * @return 附件集合
*/ */
List<BmFileInfo> selectBmFileInfoList(BmFileInfo bmFileInfo); List<BmFileInfo> selectBmFileInfoList(BmFileInfo bmFileInfo);
List<BmFileInfo> selectBmFileInfo(BmFileInfo bmFileInfo); List<BmFileInfo> selectBmFileInfo(BmFileInfo bmFileInfo);
/** /**

View File

@ -94,8 +94,6 @@ public interface DevInfoService {
/** /**
* 查询企业列表 * 查询企业列表
* @param obj
* @return
*/ */
List<BmCompanyInfo> selectCompanyList(BmCompanyInfo obj); List<BmCompanyInfo> selectCompanyList(BmCompanyInfo obj);
@ -113,28 +111,21 @@ public interface DevInfoService {
/** /**
* 在租装备信息查询 * 在租装备信息查询
* @param devInfo
* @return
*/ */
List<DevInfoVo> getLeaseDevList(DevInfoVo devInfo); List<DevInfoVo> getLeaseDevList(DevInfoVo devInfo);
/** /**
* 设备批量导入模版下载 * 设备批量导入模版下载
* @param resp
*/ */
void downLoadDev(HttpServletResponse resp); void downLoadDev(HttpServletResponse resp);
/** /**
* 设备信息导入 * 设备信息导入
* @param file
* @return
*/ */
AjaxResult importTbPeople(MultipartFile file); AjaxResult importTbPeople(MultipartFile file);
/** /**
* 设备信息审核列表 * 设备信息审核列表
* @param devInfo
* @return
*/ */
List<DevInfoVo> selectCheckDevInfoList(DevInfoVo devInfo); List<DevInfoVo> selectCheckDevInfoList(DevInfoVo devInfo);

View File

@ -1,21 +1,17 @@
package com.bonus.material.device.service.impl; package com.bonus.material.device.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.PhoneUtil; import cn.hutool.core.util.PhoneUtil;
import com.alibaba.druid.sql.visitor.functions.If;
import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.constant.MaterialConstants;
import com.bonus.common.biz.domain.*; import com.bonus.common.biz.domain.*;
import com.bonus.common.biz.enums.HttpCodeEnum; import com.bonus.common.biz.enums.HttpCodeEnum;
import com.bonus.common.biz.enums.MaStatusEnum; import com.bonus.common.biz.enums.MaStatusEnum;
import com.bonus.common.biz.exception.BusinessException; import com.bonus.material.utils.CacheHelper;
import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.utils.bean.BeanUtils; import com.bonus.common.core.utils.bean.BeanUtils;
import com.bonus.common.core.utils.bean.BeanValidators; import com.bonus.common.core.utils.bean.BeanValidators;
import com.bonus.common.core.utils.encryption.Sm4Utils;
import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils; import com.bonus.common.security.utils.SecurityUtils;
@ -40,6 +36,8 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -49,11 +47,11 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Validator; import javax.validation.Validator;
import javax.validation.constraints.NotEmpty;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder; import java.time.format.DateTimeFormatterBuilder;
@ -100,6 +98,9 @@ public class DevInfoServiceImpl implements DevInfoService {
@Resource @Resource
private MaDevQcMapper maDevQcMapper; private MaDevQcMapper maDevQcMapper;
@Autowired
private CacheHelper cacheHelper;
/** /**
* 查询设备信息 * 查询设备信息
* *
@ -253,10 +254,28 @@ public class DevInfoServiceImpl implements DevInfoService {
@Override @Override
public List<DevInfoVo> selectDevInfoList(DevInfoVo devInfo) { public List<DevInfoVo> selectDevInfoList(DevInfoVo devInfo) {
List<DevInfoVo> voList = devInfoMapper.selectDevInfoList(devInfo); List<DevInfoVo> voList = devInfoMapper.selectDevInfoList(devInfo);
extractedFile(voList); // 增加缓存处理
cacheHelper.putList("devListCache",
"user:" + SecurityUtils.getLoginUser().getSysUser().getUserId(), voList, Duration.ofMinutes(5L));
return voList; return voList;
} }
@Override
public Map<String, Long> getCompanyCount(DevInfoVo devInfo) {
// 先从缓存获取
List<DevInfoVo> voList = cacheHelper.getList("devListCache", "user:" + SecurityUtils.getLoginUser().getSysUser().getUserId(), DevInfoVo.class);
if (CollectionUtils.isEmpty(voList)) {
System.out.println("缓存无此数据!");
// 缓存内没有此数据再执行Mapper查询
voList = devInfoMapper.selectDevInfoList(devInfo);
} else {
System.out.println("缓存已生效!");
}
Map<String, Long> map = voList.stream().collect(Collectors.groupingBy(DevInfoVo::getCompanyId, Collectors.counting()));
return map;
}
@Override @Override
public List<DevInfoVo> selectZoneDevInfoList(DevInfoVo devInfo) { public List<DevInfoVo> selectZoneDevInfoList(DevInfoVo devInfo) {
if (Objects.isNull(devInfo)) { if (Objects.isNull(devInfo)) {
@ -270,12 +289,6 @@ public class DevInfoServiceImpl implements DevInfoService {
return voList; return voList;
} }
@Override
public Map<String, Long> getCompanyCount(DevInfoVo devInfo) {
List<DevInfoVo> voList = devInfoMapper.selectDevInfoList(devInfo);
Map<String, Long> map = voList.stream().collect(Collectors.groupingBy(DevInfoVo::getCompanyId, Collectors.counting()));
return map;
}
/** /**
* 查询设备收藏列表 * 查询设备收藏列表

View File

@ -1,6 +1,5 @@
package com.bonus.material.order.mapper; package com.bonus.material.order.mapper;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.comprehensive.entity.RentDetailDto; import com.bonus.material.comprehensive.entity.RentDetailDto;
import com.bonus.material.device.domain.DevInfo; import com.bonus.material.device.domain.DevInfo;
import com.bonus.material.device.domain.vo.DevInfoVo; import com.bonus.material.device.domain.vo.DevInfoVo;
@ -68,5 +67,13 @@ public interface OrderMapper {
List<OrderData> getBuyerAndSellerCouples(); List<OrderData> getBuyerAndSellerCouples();
/**
* 订单确认
*/
Integer orderConfirm(String orderId); Integer orderConfirm(String orderId);
/**
* 订单驳回
*/
int orderReject(String orderId);
} }

View File

@ -41,10 +41,10 @@ public interface OrderService {
/** /**
* 获取单个订单取件码 * 获取单个订单取件码
* @param dto
* @return
*/ */
int getOrderCode(OrderDetailDto dto); int getOrderCode(OrderDetailDto dto);
AjaxResult orderConfirm(String orderId); AjaxResult orderConfirm(String orderId);
AjaxResult orderReject(String orderId);
} }

View File

@ -223,7 +223,7 @@ public class OrderServiceImpl implements OrderService {
orderInfoDto.setReceivingUser(list.get(0).getReceivingUser()); orderInfoDto.setReceivingUser(list.get(0).getReceivingUser());
orderInfoDto.setReceivingTime(list.get(0).getReceivingTime()); orderInfoDto.setReceivingTime(list.get(0).getReceivingTime());
for (OrderDetailDto orderDetailDto : list) { for (OrderDetailDto orderDetailDto : list) {
orderDetailDto.setTotalCost(orderDetailDto.getCosts()); // orderDetailDto.setTotalCost(orderDetailDto.getCosts());
// 出库时间设置为租赁开始时间 // 出库时间设置为租赁开始时间
if (StringUtils.isNotBlank(orderDetailDto.getPreOutboundTime())) { if (StringUtils.isNotBlank(orderDetailDto.getPreOutboundTime())) {
// 租赁天数为租期结束时间减去出库时间,计算天数差 // 租赁天数为租期结束时间减去出库时间,计算天数差
@ -231,9 +231,9 @@ public class OrderServiceImpl implements OrderService {
Date dateStr2 = orderDetailDto.getRentEndTime(); Date dateStr2 = orderDetailDto.getRentEndTime();
long daysDifference = calculateDaysDifference(dateStr1, dateStr2); long daysDifference = calculateDaysDifference(dateStr1, dateStr2);
// 计算累计租金 // 计算累计租金
BigDecimal totalCost = orderDetailDto.getDayLeasePrice().multiply(new BigDecimal(daysDifference)); // BigDecimal totalCost = orderDetailDto.getDayLeasePrice().multiply(new BigDecimal(daysDifference));
orderDetailDto.setDays(String.valueOf(daysDifference)); orderDetailDto.setDays(String.valueOf(daysDifference));
orderDetailDto.setTotalCost(totalCost); // orderDetailDto.setTotalCost(totalCost);
} }
} }
orderInfoDto.setDetailsList(list); orderInfoDto.setDetailsList(list);
@ -272,7 +272,7 @@ public class OrderServiceImpl implements OrderService {
@Override @Override
public List<OrderInfoDto> getOrderStatusCount(OrderDetailDto dto) throws Exception { public List<OrderInfoDto> getOrderStatusCount(OrderDetailDto dto) throws Exception {
//true:出租方 false:承租方 // true:出租方 false:承租方
if (dto.isFlag()) { if (dto.isFlag()) {
dto.setSellerCompany(Optional.ofNullable(SecurityUtils.getLoginUser().getSysUser().getCompanyId()).orElse(SecurityUtils.getLoginUser().getSysUser().getDeptId()).intValue()); dto.setSellerCompany(Optional.ofNullable(SecurityUtils.getLoginUser().getSysUser().getCompanyId()).orElse(SecurityUtils.getLoginUser().getSysUser().getDeptId()).intValue());
} else { } else {
@ -378,7 +378,8 @@ public class OrderServiceImpl implements OrderService {
tmTask.setTaskStatus(minOrderStatus.getAsInt()); tmTask.setTaskStatus(minOrderStatus.getAsInt());
tmTask.setCode(dtos.get(0).getOrderCode()); tmTask.setCode(dtos.get(0).getOrderCode());
if (orderInfoDto.getOrderStatus().equals(OrderStatusEnum.ORDER_PENDING_SHIPMENT.getStatus().toString()) || if (orderInfoDto.getOrderStatus().equals(OrderStatusEnum.ORDER_PENDING_SHIPMENT.getStatus().toString()) ||
orderInfoDto.getOrderStatus().equals(OrderStatusEnum.ORDER_TERMINATED.getStatus().toString())) { orderInfoDto.getOrderStatus().equals(OrderStatusEnum.ORDER_TERMINATED.getStatus().toString()))
{
tmTask.setNoticeCompanyId(tmTask.getBuyerCompanyId()); tmTask.setNoticeCompanyId(tmTask.getBuyerCompanyId());
} else if (orderInfoDto.getOrderStatus().equals(OrderStatusEnum.ORDER_RECEIVE.getStatus().toString()) || } else if (orderInfoDto.getOrderStatus().equals(OrderStatusEnum.ORDER_RECEIVE.getStatus().toString()) ||
@ -531,8 +532,6 @@ public class OrderServiceImpl implements OrderService {
OrderDetailDto orderDetailDto = orderMapper.selectOrderDetailsById(id); OrderDetailDto orderDetailDto = orderMapper.selectOrderDetailsById(id);
list.add(orderDetailDto); list.add(orderDetailDto);
} }
BigDecimal totalRentalPrice = BigDecimal.ZERO;
BigDecimal totalReliefPrice = BigDecimal.ZERO;
dto.setDetailsList(list); dto.setDetailsList(list);
Optional<OrderDetailDto> minOrderStatus = list.stream().min(Comparator.comparingInt(p -> Integer.parseInt(p.getOrderStatus()))); Optional<OrderDetailDto> minOrderStatus = list.stream().min(Comparator.comparingInt(p -> Integer.parseInt(p.getOrderStatus())));
minOrderStatus.ifPresent(orderDetailDto -> dto.setOrderStatus(orderDetailDto.getOrderStatus())); minOrderStatus.ifPresent(orderDetailDto -> dto.setOrderStatus(orderDetailDto.getOrderStatus()));
@ -587,4 +586,17 @@ public class OrderServiceImpl implements OrderService {
return AjaxResult.error("操作成功"); return AjaxResult.error("操作成功");
} }
} }
/**
* 订单驳回
*/
@Override
public AjaxResult orderReject(String orderId) {
try {
int dbCount = orderMapper.orderReject(orderId);
return dbCount > 0 ? AjaxResult.success("操作成功") : AjaxResult.error("操作失败");
} catch (Exception e) {
return AjaxResult.error("操作成功");
}
}
} }

View File

@ -0,0 +1,60 @@
package com.bonus.material.utils;
import cn.hutool.json.JSONUtil;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.Duration;
import java.util.Collections;
import java.util.List;
@Component
public class CacheHelper {
@Resource
private RedisTemplate<String, Object> redisTemplate;
public <T> void putList(String cacheName, String key, List<T> data, Duration ttl) {
String fullKey = cacheName + "::" + key;
redisTemplate.opsForValue().set(fullKey, JSONUtil.toJsonStr(data), ttl);
}
public <T> List<T> getList(String cacheName, String key, Class<T> clazz) {
String fullKey = cacheName + "::" + key;
Object value = redisTemplate.opsForValue().get(fullKey);
if (value == null) return Collections.emptyList();
// 保证无论是字符串还是对象都能转回来
String json = (value instanceof String) ? (String) value : JSONUtil.toJsonStr(value);
return JSONUtil.toList(json, clazz);
}
/**
* 获取单对象
*/
public <T> T getBean(String cacheName, String key, Class<T> clazz) {
String fullKey = cacheName + "::" + key;
Object value = redisTemplate.opsForValue().get(fullKey);
if (value == null) {
return null;
}
String json = (value instanceof String) ? (String) value : JSONUtil.toJsonStr(value);
return JSONUtil.toBean(json, clazz);
}
/**
* 写入缓存
*/
public void put(String cacheName, String key, Object data, Duration ttl) {
String fullKey = cacheName + "::" + key;
redisTemplate.opsForValue().set(fullKey, JSONUtil.toJsonStr(data), ttl);
}
/**
* 删除缓存
*/
public void del(String cacheName, String key) {
redisTemplate.delete(cacheName + "::" + key);
}
}

View File

@ -50,41 +50,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDevInfoList" parameterType="com.bonus.material.device.domain.vo.DevInfoVo" resultType="com.bonus.material.device.domain.vo.DevInfoVo"> <select id="selectDevInfoList" parameterType="com.bonus.material.device.domain.vo.DevInfoVo" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
SELECT SELECT
mtv.proType, ifnull(mdf.file_url, bfi.url) as picUrl,
mtv.mainGx, mtv.proType,
mtv.childGx, mtv.mainGx,
mtv.devCategory, mtv.childGx,
mtv.devSubcategory, mtv.devCategory,
mtv.devName, mtv.devSubcategory,
d.ma_id as maId, mtv.devName,
d.code as `code`, d.ma_id as maId,
d.identify_code as identifyCode, d.code as `code`,
d.device_name as deviceName, d.identify_code as identifyCode,
d.device_count as deviceCount, d.device_name as deviceName,
d.type_id as typeId, d.device_count as deviceCount,
d.ma_status as maStatus, d.type_id as typeId,
d.brand as brand, d.ma_status as maStatus,
d.production_date as productionDate, d.brand as brand,
d.working_hours as workingHours, d.production_date as productionDate,
d.person as person, d.working_hours as workingHours,
d.person_phone as personPhone, d.person as person,
d.create_time as createTime, d.person_phone as personPhone,
d.update_time as updateTime, d.create_time as createTime,
d.on_company as companyId, d.update_time as updateTime,
sd.dept_name as companyName, d.on_company as companyId,
c.operate_address as operateAddress sd.dept_name as companyName,
c.operate_address as operateAddress
FROM FROM
ma_dev_info d ma_dev_info d
LEFT JOIN sys_dept sd ON d.on_company = sd.dept_id LEFT JOIN sys_dept sd ON d.on_company = sd.dept_id
LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id
LEFT JOIN ma_type_view mtv ON mtv.typeId = d.type_id LEFT JOIN ma_type_view mtv ON mtv.typeId = d.type_id
LEFT JOIN bm_file_info bfi on d.ma_id = bfi.model_id and bfi.file_type = '0' and bfi.task_type = '17'
LEFT JOIN ma_dev_file mdf on d.ma_id = mdf.ma_id and mdf.file_type = '1' and mdf.is_active = '1'
<where> <where>
<if test="maId != null "> and d.ma_id = #{maId}</if> <if test="maId != null "> and d.ma_id = #{maId}</if>
<if test="code != null and code != ''"> and d.code = #{code}</if> <if test="code != null and code != ''"> and d.code = #{code}</if>
<if test="deviceName != null and deviceName != ''"> <if test="deviceName != null and deviceName != ''">
and d.device_name like concat('%',#{deviceName},'%') and d.device_name like concat('%',#{deviceName},'%')
</if> </if>
<if test="maStatus != null"> and d.ma_status = #{maStatus}</if> <if test="maStatus != null"> and (d.ma_status = 1 or d.ma_status = 2 or d.ma_status = 3)</if>
<if test="leaseScope != null "> and d.lease_scope = #{leaseScope}</if> <if test="leaseScope != null "> and d.lease_scope = #{leaseScope}</if>
<if test="location != null and location != ''"> and d.location = #{location}</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="provinceId != null and provinceId != ''"> and d.province_id = #{provinceId}</if>
@ -109,12 +112,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="startTime != null and endTime != null"> <if test="startTime != null and endTime != null">
and d.update_time between #{startTime} and #{endTime} and d.update_time between #{startTime} and #{endTime}
</if> </if>
<if test="isZone != null">
and d.is_zone = 1
</if>
<if test="zoneId != null">
and d.zone_id = #{zoneId}
</if>
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
and ( and (
locate(#{keyWord},mtv.mainGx) > 0 locate(#{keyWord},mtv.mainGx) > 0

View File

@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
values values
(#{code}, now(), #{cost}, #{buyerId}, #{address}, #{creater}, now(), #{buyerCompany}) (#{code}, now(), #{cost}, #{buyerId}, #{address}, #{creater}, now(), #{buyerCompany})
</insert> </insert>
<insert id="insertOrderDetail"> <insert id="insertOrderDetail">
INSERT INTO `ma_order_details` ( INSERT INTO `ma_order_details` (
`order_id`, `order_id`,
@ -33,23 +34,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
now(), now(),
#{updateTime}) #{updateTime})
</insert> </insert>
<update id="updateDeviceStatus"> <update id="updateDeviceStatus">
update ma_dev_info set ma_status = #{maStatus} where ma_id = #{maId} and is_active = 1 update ma_dev_info set ma_status = #{maStatus} where ma_id = #{maId} and is_active = 1
</update> </update>
<update id="updateMaStatus"> <update id="updateMaStatus">
update book_car_detail set order_status = 1 where id = #{id} update book_car_detail set order_status = 1 where id = #{id}
</update> </update>
<update id="updateOrderStatus"> <update id="updateOrderStatus">
update ma_order_details set order_status = #{orderStatus} update ma_order_details set order_status = #{orderStatus}
<if test="orderStatus == 2"> <if test="orderStatus == 2">
,receiving_user = #{userName} ,receiving_user = #{userName}
,receiving_time = now() ,receiving_time = now()
</if> </if>
<if test="orderStatus == 3"> <if test="orderStatus == 3">
,pre_outbound_user = #{userName} ,pre_outbound_user = #{userName}
,pre_outbound_time = now() ,pre_outbound_time = now()
</if> </if>
<if test="orderStatus == 4"> <if test="orderStatus == 4">
,pre_outbound_user = #{userName} ,pre_outbound_user = #{userName}
@ -84,9 +86,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</if> </if>
</update> </update>
<update id="updateDevCount"> <update id="updateDevCount">
update ma_dev_info set device_count = device_count - #{num} where ma_id = #{maId} and is_active = 1 update ma_dev_info set device_count = device_count - #{num} where ma_id = #{maId} and is_active = 1
</update> </update>
<update id="updateAddDevCount"> <update id="updateAddDevCount">
update ma_dev_info set device_count = device_count + #{num} where ma_id = #{maId} and is_active = 1 update ma_dev_info set device_count = device_count + #{num} where ma_id = #{maId} and is_active = 1
</update> </update>
@ -122,17 +126,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_time = now() update_time = now()
WHERE order_id = #{orderId} and ma_id = #{maId} WHERE order_id = #{orderId} and ma_id = #{maId}
</update> </update>
<update id="orderConfirm"> <update id="orderConfirm">
UPDATE UPDATE ma_order_details set order_status = '2', update_time = now() WHERE order_id = #{orderId}
ma_order_details </update>
set order_status = '2',
update_time = now() <update id="orderReject" >
WHERE order_id = #{orderId} UPDATE ma_order_details set order_status = '3', update_time = now() WHERE order_id = #{orderId}
</update> </update>
<select id="getdeviceCount" resultType="com.bonus.material.device.domain.DevInfo"> <select id="getdeviceCount" resultType="com.bonus.material.device.domain.DevInfo">
select device_count,device_name from ma_dev_info where ma_id = #{maId} and is_active = 1 select device_count,device_name from ma_dev_info where ma_id = #{maId} and is_active = 1
</select> </select>
<select id="getOrderDetails" resultType="com.bonus.material.order.domain.OrderInfoDto"> <select id="getOrderDetails" resultType="com.bonus.material.order.domain.OrderInfoDto">
SELECT SELECT
moi.code AS code, moi.code AS code,
@ -147,7 +153,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
su2.nick_name as sellerName, su2.nick_name as sellerName,
moi.address, moi.address,
moi.order_id, moi.order_id,
sum(hh.costs) cost,
dept.dept_name as companyName dept.dept_name as companyName
FROM FROM
ma_order_details hh ma_order_details hh
@ -277,6 +282,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE WHERE
mt.del_flag = '0' and moi.order_id = #{orderId} limit 1 mt.del_flag = '0' and moi.order_id = #{orderId} limit 1
</select> </select>
<select id="selectOrderDetailsByOrderId" resultType="com.bonus.material.order.domain.OrderDetailDto"> <select id="selectOrderDetailsByOrderId" resultType="com.bonus.material.order.domain.OrderDetailDto">
SELECT SELECT
mdi.ma_id as maId, mdi.ma_id as maId,
@ -319,6 +325,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
moi.order_id = #{orderId} and bfi.task_type = 17 and bfi.file_type = 0 moi.order_id = #{orderId} and bfi.task_type = 17 and bfi.file_type = 0
GROUP BY hh.ma_id GROUP BY hh.ma_id
</select> </select>
<select id="getOrderDetailsByOrderId" resultType="com.bonus.material.order.domain.OrderDetailDto"> <select id="getOrderDetailsByOrderId" resultType="com.bonus.material.order.domain.OrderDetailDto">
SELECT SELECT
su1.phonenumber as buyerPhoneNumber, su1.phonenumber as buyerPhoneNumber,
@ -401,6 +408,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.del_flag = '0' mt.del_flag = '0'
AND hh.order_id = #{orderId} AND hh.order_id = #{orderId}
</select> </select>
<select id="getRentDetails" resultType="com.bonus.material.comprehensive.entity.RentDetailDto"> <select id="getRentDetails" resultType="com.bonus.material.comprehensive.entity.RentDetailDto">
SELECT SELECT
moi.`code` as orderCode, moi.`code` as orderCode,
@ -435,6 +443,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY ORDER BY
moi.order_time DESC moi.order_time DESC
</select> </select>
<select id="getOrderData" resultType="com.bonus.material.largeScreen.entity.OrderData"> <select id="getOrderData" resultType="com.bonus.material.largeScreen.entity.OrderData">
SELECT SELECT
count( moi.order_id ) AS orderNum, count( moi.order_id ) AS orderNum,
@ -442,6 +451,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM FROM
ma_order_info moi ma_order_info moi
</select> </select>
<select id="getCompanysCost" resultType="com.bonus.material.largeScreen.entity.OrderData"> <select id="getCompanysCost" resultType="com.bonus.material.largeScreen.entity.OrderData">
SELECT SELECT
mdi.on_company, mdi.on_company,
@ -456,6 +466,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY GROUP BY
mdi.on_company mdi.on_company
</select> </select>
<select id="getTodayOrderCount" resultType="com.bonus.material.largeScreen.entity.OrderDto"> <select id="getTodayOrderCount" resultType="com.bonus.material.largeScreen.entity.OrderDto">
SELECT SELECT
count( moi.order_id ) orderNum, count( moi.order_id ) orderNum,