Merge remote-tracking branch 'origin/ah-simple' into ah-simple
This commit is contained in:
commit
3958bfad7d
|
|
@ -76,7 +76,7 @@ public class DevInfo extends BaseEntity {
|
|||
private String ratioRange;
|
||||
|
||||
@ApiModelProperty(value = "比率,比如: 80%")
|
||||
private double ratio;
|
||||
private BigDecimal ratio;
|
||||
|
||||
@ApiModelProperty(value = "单位")
|
||||
@NotBlank(message = "单位不能为空")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
package com.bonus.material.device.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 设备信息对象 ma_dev_info
|
||||
*
|
||||
* @author syruan
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class DevInfoDt {
|
||||
|
||||
private static final long serialVersionUID = 429270031714225761L;
|
||||
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "装备名称")
|
||||
@Excel(name = "装备名称")
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty(value = "装备类目")
|
||||
@Excel(name = "装备类目")
|
||||
private String categoryName;
|
||||
|
||||
@ApiModelProperty(value = "装备单位")
|
||||
@Excel(name = "装备单位")
|
||||
private String unitName;
|
||||
|
||||
/** 设备品牌 */
|
||||
@Excel(name = "装备品牌")
|
||||
@ApiModelProperty(value = "设备品牌")
|
||||
private String brand;
|
||||
|
||||
/** 出厂日期 */
|
||||
@Excel(name = "出厂日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "出厂日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date productionDate;
|
||||
|
||||
@ApiModelProperty(value = "联系人")
|
||||
@Excel(name = "联系人")
|
||||
private String person;
|
||||
|
||||
@ApiModelProperty(value = "联系人电话")
|
||||
@Excel(name = "联系人电话")
|
||||
private String personPhone;
|
||||
|
||||
@Excel(name = "上架数量")
|
||||
@ApiModelProperty(value = "设备数量")
|
||||
private Integer deviceCount;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "录入人")
|
||||
@Excel(name = "录入人")
|
||||
private String creatorName;
|
||||
|
||||
@ApiModelProperty(value = "录入时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "录入时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@Excel(name = "所属公司")
|
||||
@ApiModelProperty(value = "所属公司")
|
||||
private String comName;
|
||||
|
||||
}
|
||||
|
|
@ -174,4 +174,11 @@ public class DevInfoVo extends DevInfo {
|
|||
@ApiModelProperty(value = "订单金额")
|
||||
private BigDecimal cost;
|
||||
|
||||
private String devicenewName;
|
||||
|
||||
private String deviceId;
|
||||
|
||||
private String deviceTypeName;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.device.mapper;
|
|||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.biz.domain.TypeInfo;
|
||||
import com.bonus.material.device.domain.MaDevQc;
|
||||
import com.bonus.material.owner.domain.Ownerdomin;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -86,4 +87,6 @@ public interface BmFileInfoMapper {
|
|||
Integer deleteBmFileInfoByFileId(@Param("fileId") Integer fileId, @Param("fileType") Integer fileType);
|
||||
|
||||
List<BmFileInfo> getInfoByMaIdAndTaskId(MaDevQc qc);
|
||||
|
||||
int insertRentInfo(Ownerdomin ownerdomin);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import com.bonus.material.device.domain.dto.InfoMotionDto;
|
|||
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.device.domain.vo.LeaseVo;
|
||||
import com.bonus.material.largeScreen.entity.LeaseInfo;
|
||||
import com.bonus.material.largeScreen.entity.RentInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -262,5 +264,17 @@ public interface DevInfoMapper {
|
|||
List<DevInfoVo> getMaTypeLeasingNumList(DevInfoVo devInfoVo);
|
||||
|
||||
List<DevInfoVo> getDevLeasingNumList(DevInfoVo devInfoVo);
|
||||
|
||||
Integer getRentToalNum();
|
||||
|
||||
List<LeaseInfo> getDevLeaseCount();
|
||||
|
||||
List<RentInfo> getDevRentCount();
|
||||
|
||||
List<DevInfoVo> getMaTypeLeasingDetail(DevInfoVo devInfoVo);
|
||||
|
||||
List<SysDept> getDemandUnit(DevInfoVo devInfoVo);
|
||||
|
||||
int updateTypeLeasePrice(DevInfo devInfo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -424,9 +424,11 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
devInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
|
||||
devInfo.setDeviceCount(devInfo.getDeviceCount());
|
||||
devInfo.setIdentifyCode(devInfo.getTableList().get(i).getIdentifyCode());
|
||||
if (devInfoMapper.insertDevInfo(devInfo) == 0) {
|
||||
int num = devInfoMapper.insertDevInfo(devInfo);
|
||||
if (num == 0) {
|
||||
return AjaxResult.error("设备信息SQL保存失败,请修改后重试");
|
||||
}
|
||||
devInfoMapper.updateTypeLeasePrice(devInfo);
|
||||
code = "";
|
||||
//保存自定义属性值
|
||||
if (!CollectionUtils.isEmpty(devInfo.getDevInfoProperties())) {
|
||||
|
|
@ -608,6 +610,7 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
String identifyCode = tableList.get(0).getIdentifyCode();
|
||||
devInfo.setIdentifyCode(identifyCode);
|
||||
int i = devInfoMapper.updateDevInfo(devInfo);
|
||||
devInfoMapper.updateTypeLeasePrice(devInfo);
|
||||
|
||||
if (i > 0) {
|
||||
BmFileInfo bmFileInfo = new BmFileInfo()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
package com.bonus.material.equipment.controller;
|
||||
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.basic.domain.BmCompanyAddress;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.equipment.domain.DeptConfigTypeSummary;
|
||||
import com.bonus.material.equipment.domain.DeptEquipmentConfig;
|
||||
import com.bonus.material.equipment.domain.EquipmentDetail;
|
||||
import com.bonus.material.equipment.service.IDeptEquipmentConfigService;
|
||||
import com.bonus.material.equipment.service.ISysDeptService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/equipmentConfig")
|
||||
|
||||
public class DeptEquipmentConfigController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IDeptEquipmentConfigService service;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService isyservice;
|
||||
@GetMapping("/{deptId}")
|
||||
public AjaxResult getConfigByDept(@PathVariable Long deptId) {
|
||||
return AjaxResult.success(service.selectByDeptId(deptId));
|
||||
}
|
||||
|
||||
@PostMapping("/saveEquitConfig")
|
||||
public AjaxResult save(@RequestBody DeptEquipmentConfig configList) {
|
||||
int i = service.saveBatch(configList);
|
||||
if (i > 0){
|
||||
return AjaxResult.success("操作成功");
|
||||
}else {
|
||||
return AjaxResult.error("操作失败");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 导出企业信息列表
|
||||
*/
|
||||
@ApiOperation(value = "导出机械化施工装备配置率")
|
||||
@PreventRepeatSubmit
|
||||
@SysLog(title = "机械化施工装备配置率信息", businessType = OperaType.EXPORT, logType = 1,module = "出租方管理->机械化施工装备配置率信息")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, @RequestBody EquipmentDetail equipmentDetail) {
|
||||
try {
|
||||
List<EquipmentDetail> list = isyservice.detailsInfo(equipmentDetail);
|
||||
ExcelUtil<EquipmentDetail> util = new ExcelUtil<EquipmentDetail>(EquipmentDetail.class);
|
||||
util.exportExcel(response, list, "装备详情数据");
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 查询机械化施工装备
|
||||
*
|
||||
* 自有装备数据的数量
|
||||
* @param devInfoVo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getdeviceInfo")
|
||||
public AjaxResult getdeviceInfo( @RequestBody DevInfoVo devInfoVo) {
|
||||
List<DevInfoVo> list = service.selectDevInfoLists(devInfoVo);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
package com.bonus.material.equipment.controller;
|
||||
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.InnerAuth;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
||||
import com.bonus.material.equipment.domain.DeptConfigRateSummary;
|
||||
import com.bonus.material.equipment.domain.DeptConfigTypeSummary;
|
||||
import com.bonus.material.equipment.domain.DeptEquipmentConfig;
|
||||
import com.bonus.material.equipment.domain.EquipmentDetail;
|
||||
import com.bonus.material.equipment.service.ISysDeptService;
|
||||
import com.bonus.system.api.domain.SysDept;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dept")
|
||||
public class SysDeptController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService service;
|
||||
|
||||
/**
|
||||
* 获取部门树列表
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:list"))
|
||||
@GetMapping("/deptTree")
|
||||
public AjaxResult deptTree(SysDept dept) {
|
||||
try {
|
||||
return success(service.selectDeptTreeList(dept));
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@SysLog(title = "装备列表", businessType = OperaType.QUERY, logType = 0, module = "系统管理->装备列表", details = "查询装备列表")
|
||||
public TableDataInfo list(DeptEquipmentConfig user) {
|
||||
try {
|
||||
startPage();
|
||||
List<SysUser> list = service.selectUserList(user);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
@GetMapping("/listRate")
|
||||
@SysLog(title = "装备列表", businessType = OperaType.QUERY, logType = 0, module = "系统管理->装备列表", details = "查询装备列表")
|
||||
public TableDataInfo listRate(DeptConfigRateSummary user) {
|
||||
try {
|
||||
List<DeptConfigRateSummary> list = service.selectDeptConfigRatePivot(user);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/selectConfigList")
|
||||
public AjaxResult selectConfigList(@RequestBody DeptEquipmentConfig user) {
|
||||
return service.selectConfigList(user);
|
||||
}
|
||||
//装备名称下拉框获取
|
||||
@PostMapping("/getTree")
|
||||
public AjaxResult getTree() {
|
||||
return service.getTree();
|
||||
}
|
||||
|
||||
@GetMapping("/listConfigType")
|
||||
@SysLog(title = "装备列表", businessType = OperaType.QUERY, logType = 0, module = "系统管理->装备列表", details = "查询装备列表")
|
||||
public TableDataInfo listConfigType(DeptConfigTypeSummary user) {
|
||||
try {
|
||||
startPage();
|
||||
List<DeptConfigTypeSummary> list = service.selectDeptConfigTypeSummary(user);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
@PostMapping("/detailsInfo")
|
||||
@SysLog(title = "公司装备详情页面", businessType = OperaType.QUERY, logType = 0, module = "系统管理->装备列表", details = "公司装备详情页面")
|
||||
public TableDataInfo detailsInfo(@RequestBody EquipmentDetail equipmentDetail) {
|
||||
try {
|
||||
List<EquipmentDetail> list = service.detailsInfo(equipmentDetail);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.bonus.material.equipment.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ConfigEntity {
|
||||
|
||||
private String basicConfig;
|
||||
|
||||
private String configurationType;
|
||||
|
||||
private String configurationRate;
|
||||
|
||||
private String configurationDescription;
|
||||
|
||||
private Long deptId;
|
||||
|
||||
private String remark;
|
||||
|
||||
private String typeId;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.bonus.material.equipment.domain;
|
||||
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class DeptConfigRateSummary extends BaseEntity {
|
||||
|
||||
/** 部门ID */
|
||||
private Long deptId;
|
||||
|
||||
private String deptName;
|
||||
//公司
|
||||
private String companyName;
|
||||
|
||||
/** 配置类型A的装备配置率累计值 */
|
||||
private BigDecimal valueA;
|
||||
|
||||
/** 配置类型B的装备配置率累计值 */
|
||||
private BigDecimal valueB;
|
||||
|
||||
/** 配置类型C的装备配置率累计值 */
|
||||
private BigDecimal valueC;
|
||||
|
||||
/** 配置类型D的装备配置率累计值 新型装备 */
|
||||
private BigDecimal valueD;
|
||||
private BigDecimal configType;
|
||||
private Long companyId;
|
||||
private BigDecimal configValue;
|
||||
//装备配置率赋值
|
||||
private BigDecimal configRate;
|
||||
private BigDecimal orderCount;
|
||||
private BigDecimal FullScore;
|
||||
|
||||
private String typeId;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.bonus.material.equipment.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class DeptConfigTypeSummary {
|
||||
/** 部门ID */
|
||||
private Long deptId;
|
||||
|
||||
/** 子类型名称(mt1.type_name) */
|
||||
private String typeName;
|
||||
|
||||
/** 父类型名称(mt2.type_name) */
|
||||
private String parentTypeName;
|
||||
|
||||
/** 配置率(已转数值) */
|
||||
private BigDecimal configRate;
|
||||
|
||||
/** 配置说明 */
|
||||
private String configDescription;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.material.equipment.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DeptEquipmentConfig extends BaseEntity {
|
||||
private Long id;
|
||||
private Long deptId;
|
||||
private String typeId;
|
||||
private String equipmentName;
|
||||
private String equipmenttype;
|
||||
private String basicConfig; //基础配置信息
|
||||
private String equipmentId;
|
||||
private List<ConfigEntity> configs;
|
||||
private String configStatus;
|
||||
|
||||
@Excel(name = "配置值")
|
||||
private String configValue;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package com.bonus.material.equipment.domain;
|
||||
|
||||
import com.bonus.system.api.domain.SysDept;
|
||||
import com.bonus.system.api.domain.SysMenu;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Treeselect树结构实体类
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
@Data
|
||||
public class DeptTreeSelect implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
/** 父部门ID */
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private String label;
|
||||
|
||||
private String status;
|
||||
|
||||
private Integer level;
|
||||
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<DeptTreeSelect> children;
|
||||
|
||||
public DeptTreeSelect() {
|
||||
|
||||
}
|
||||
|
||||
public DeptTreeSelect(SysDept dept) {
|
||||
this.id = dept.getDeptId();
|
||||
this.parentId = dept.getParentId();
|
||||
this.status = dept.getStatus();
|
||||
this.label = dept.getDeptName();
|
||||
this.level = dept.getLevel();
|
||||
this.children = dept.getChildren().stream().map(DeptTreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public DeptTreeSelect(SysMenu menu) {
|
||||
this.id = menu.getMenuId();
|
||||
this.label = menu.getMenuName();
|
||||
this.status = menu.getStatus();
|
||||
this.children = menu.getChildren().stream().map(DeptTreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public List<DeptTreeSelect> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<DeptTreeSelect> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.bonus.material.equipment.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 装备配置详情实体类
|
||||
*/
|
||||
@Data
|
||||
public class EquipmentDetail {
|
||||
|
||||
/** 序号 */
|
||||
private Integer index;
|
||||
|
||||
/** 工序 */
|
||||
private String process;
|
||||
|
||||
/** 装备名称 */
|
||||
private String name;
|
||||
|
||||
/** 基本配置标准(台/套) */
|
||||
private String standard;
|
||||
|
||||
/** 装备种类 */
|
||||
private String type;
|
||||
|
||||
/** 配置说明 */
|
||||
private String desc;
|
||||
|
||||
/** 装备配置率赋值 */
|
||||
private String value;
|
||||
|
||||
/** 自有装备数量 */
|
||||
private Integer own;
|
||||
|
||||
/** 租赁装备数量 */
|
||||
private Integer rent;
|
||||
|
||||
/** 装备实际配置率 */
|
||||
private String actual;
|
||||
|
||||
/** 特殊装备配置率 */
|
||||
private String special;
|
||||
|
||||
/** 特殊装备原因 */
|
||||
private String reason;
|
||||
//公司
|
||||
private String companyId;
|
||||
private String configType;
|
||||
/*是否存在新型装备的标识
|
||||
* 是 → status = 1,否 → status = 0
|
||||
*
|
||||
* */
|
||||
private String ifExist;
|
||||
private String orderCount;
|
||||
private String combinedName;
|
||||
private String labelVol;
|
||||
private String typeId;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.bonus.material.equipment.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class NewOwnerdomin {
|
||||
private int companyId; // 公司ID
|
||||
private String maName; // 装备类型ID或名称
|
||||
private String companyName; // 公司名称
|
||||
private Integer maNum; // 数量
|
||||
private String configType;
|
||||
private String typeId;
|
||||
private BigDecimal fullScore;
|
||||
private BigDecimal baseNum;
|
||||
private BigDecimal orderCount;
|
||||
|
||||
public NewOwnerdomin() {
|
||||
// 必须有无参构造函数
|
||||
}
|
||||
// 构造函数(用于复制)
|
||||
public NewOwnerdomin(NewOwnerdomin o) {
|
||||
this.companyId = o.companyId;
|
||||
this.maName = o.maName;
|
||||
this.maNum = o.maNum;
|
||||
this.companyName = o.companyName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.bonus.material.equipment.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class NewmydevInfo {
|
||||
private String companyId;
|
||||
private String typeId;
|
||||
private String typeName;
|
||||
private Integer ownCount;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.bonus.material.equipment.domain;
|
||||
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysDept extends BaseEntity {
|
||||
private Long deptId;
|
||||
private Long parentId;
|
||||
private String ancestors;
|
||||
private String deptName;
|
||||
private Integer orderNum;
|
||||
private String leader;
|
||||
private String phone;
|
||||
private String email;
|
||||
private String status;
|
||||
private Integer isShow;
|
||||
private String delFlag;
|
||||
private String createBy;
|
||||
private String updateBy;
|
||||
private Long menuTemplateId;
|
||||
private Long adminUserId;
|
||||
private String initPassword;
|
||||
private String province;
|
||||
private String city;
|
||||
private String district;
|
||||
private String address;
|
||||
private String deptAbbreviation;
|
||||
private String remark;
|
||||
private String logo;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.material.equipment.mapper;
|
||||
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.equipment.domain.DeptEquipmentConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DeptEquipmentConfigMapper {
|
||||
DeptEquipmentConfig selectConfig(Long deptId, Long typeId);
|
||||
List<DeptEquipmentConfig> selectConfigByDept(Long deptId);
|
||||
int insertOrUpdateBatch( DeptEquipmentConfig deptEquipmentConfig);
|
||||
|
||||
int deleteByDeptIdAndTypeId(DeptEquipmentConfig team);
|
||||
|
||||
List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfoVo);
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.bonus.material.equipment.mapper;
|
||||
|
||||
import com.bonus.material.equipment.domain.ConfigEntity;
|
||||
import com.bonus.material.equipment.domain.DeptEquipmentConfig;
|
||||
import com.bonus.material.equipment.domain.DeptTreeSelect;
|
||||
import com.bonus.material.equipment.domain.SysDept;
|
||||
import com.bonus.material.equipment.domain.*;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysDeptMapper {
|
||||
List<SysDept> selectDeptTree();
|
||||
|
||||
List<com.bonus.system.api.domain.SysDept> selectDeptList(com.bonus.system.api.domain.SysDept dept);
|
||||
|
||||
List<SysUser> selectUserList(DeptEquipmentConfig user);
|
||||
|
||||
|
||||
List<ConfigEntity> selectConfigList(DeptEquipmentConfig user);
|
||||
|
||||
List<DeptConfigRateSummary> selectDeptConfigRatePivot(DeptConfigRateSummary entity);
|
||||
|
||||
List<DeptConfigTypeSummary> selectDeptConfigTypeSummary(DeptConfigTypeSummary entity);
|
||||
|
||||
List<DeptTreeSelect> getTree();
|
||||
|
||||
List<EquipmentDetail> detailsInfo(EquipmentDetail equipmentDetail);
|
||||
|
||||
List<NewmydevInfo> listFromDevInfo(String companyId);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.bonus.material.equipment.service;
|
||||
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.equipment.domain.DeptEquipmentConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IDeptEquipmentConfigService {
|
||||
List<DeptEquipmentConfig> selectByDeptId(Long deptId);
|
||||
int saveBatch( DeptEquipmentConfig configList);
|
||||
|
||||
List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfoVo);
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.material.equipment.service;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.equipment.domain.*;
|
||||
import com.bonus.material.equipment.domain.DeptEquipmentConfig;
|
||||
import com.bonus.material.equipment.domain.DeptTreeSelect;
|
||||
import com.bonus.system.api.domain.SysDept;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ISysDeptService {
|
||||
|
||||
public List<DeptTreeSelect> selectDeptTreeList(SysDept dept);
|
||||
|
||||
List<SysUser> selectUserList(DeptEquipmentConfig user);
|
||||
|
||||
|
||||
AjaxResult selectConfigList(DeptEquipmentConfig user);
|
||||
|
||||
AjaxResult getTree();
|
||||
|
||||
List<DeptConfigRateSummary> selectDeptConfigRatePivot(DeptConfigRateSummary entity);
|
||||
|
||||
List<DeptConfigTypeSummary> selectDeptConfigTypeSummary(DeptConfigTypeSummary entity);
|
||||
|
||||
List<EquipmentDetail> detailsInfo(EquipmentDetail equipmentDetail);
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package com.bonus.material.equipment.service.impl;
|
||||
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.equipment.domain.ConfigEntity;
|
||||
import com.bonus.material.equipment.domain.DeptEquipmentConfig;
|
||||
import com.bonus.material.equipment.mapper.DeptEquipmentConfigMapper;
|
||||
import com.bonus.material.equipment.service.IDeptEquipmentConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class DeptEquipmentConfigServiceImpl implements IDeptEquipmentConfigService {
|
||||
|
||||
@Autowired
|
||||
private DeptEquipmentConfigMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<DeptEquipmentConfig> selectByDeptId(Long deptId) {
|
||||
return mapper.selectConfigByDept(deptId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveBatch(DeptEquipmentConfig configList) {
|
||||
configList.setTypeId(configList.getEquipmentId());
|
||||
configList.setConfigValue(configList.getBasicConfig());
|
||||
DeptEquipmentConfig team = new DeptEquipmentConfig();
|
||||
team.setDeptId(configList.getDeptId());
|
||||
team.setTypeId(configList.getTypeId());
|
||||
mapper.deleteByDeptIdAndTypeId(team);
|
||||
|
||||
List<ConfigEntity> originalConfigs = configList.getConfigs();
|
||||
if (originalConfigs == null || originalConfigs.isEmpty()) {
|
||||
return 1; // 只删除,无新增
|
||||
}
|
||||
// 合并逻辑:以 deptId + typeId + configType 为 key,configValue 累加
|
||||
Map<String, ConfigEntity> mergedMap = new LinkedHashMap<>();
|
||||
for (ConfigEntity item : originalConfigs) {
|
||||
item.setDeptId(configList.getDeptId());
|
||||
item.setTypeId(configList.getTypeId());
|
||||
item.setRemark(configList.getRemark());
|
||||
String key = item.getDeptId() + "_" + item.getTypeId() + "_" + item.getConfigurationType();
|
||||
|
||||
if (mergedMap.containsKey(key)) {
|
||||
ConfigEntity existing = mergedMap.get(key);
|
||||
// configValue 是 String,需转数字再相加
|
||||
try {
|
||||
double newVal = parseDoubleOrZero(item.getBasicConfig());
|
||||
double oldVal = parseDoubleOrZero(existing.getBasicConfig());
|
||||
double newrateVal = parseDoubleOrZero(item.getConfigurationRate());
|
||||
double oldrateVal = parseDoubleOrZero(existing.getConfigurationRate());
|
||||
existing.setBasicConfig(String.valueOf(newVal + oldVal));
|
||||
existing.setConfigurationRate(String.valueOf(newrateVal+oldrateVal));
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
mergedMap.put(key, item);
|
||||
}
|
||||
}
|
||||
|
||||
configList.setConfigs(new ArrayList<>(mergedMap.values()));
|
||||
return mapper.insertOrUpdateBatch(configList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfoVo) {
|
||||
List<DevInfoVo> list = mapper.selectDevInfoLists(devInfoVo);
|
||||
return list;
|
||||
}
|
||||
|
||||
private double parseDoubleOrZero(String value) {
|
||||
if (value == null || value.trim().isEmpty()) {
|
||||
return 0.0;
|
||||
}
|
||||
try {
|
||||
return Double.parseDouble(value.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,470 @@
|
|||
package com.bonus.material.equipment.service.impl;
|
||||
|
||||
|
||||
import com.bonus.common.core.utils.SpringUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.bonus.common.datascope.annotation.DataScope;
|
||||
import com.bonus.common.datascope.utils.CommonDataPermissionInfo;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.equipment.domain.*;
|
||||
import com.bonus.material.equipment.mapper.SysDeptMapper;
|
||||
import com.bonus.material.equipment.service.ISysDeptService;
|
||||
import com.bonus.material.owner.domain.Ownerdomin;
|
||||
import com.bonus.material.owner.mapper.OwnerMapper;
|
||||
import com.bonus.system.api.domain.SysDept;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class SysDeptServiceImpl implements ISysDeptService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SysDeptServiceImpl.class);
|
||||
@Autowired
|
||||
private SysDeptMapper mapper;
|
||||
|
||||
@Resource
|
||||
private OwnerMapper ownerMapper;
|
||||
|
||||
@Override
|
||||
public List<DeptTreeSelect> selectDeptTreeList(SysDept dept) {
|
||||
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
||||
return buildDeptTreeSelect(depts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> selectUserList(DeptEquipmentConfig user) {
|
||||
List<SysUser> sysUsers = mapper.selectUserList(user);
|
||||
return sysUsers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult selectConfigList(DeptEquipmentConfig user) {
|
||||
try {
|
||||
List<ConfigEntity> configEntities = mapper.selectConfigList(user);
|
||||
return ObjectUtils.isNotEmpty(configEntities) ? AjaxResult.success(configEntities) : AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getTree() {
|
||||
try {
|
||||
List<DeptTreeSelect> sysDepts = mapper.getTree();
|
||||
return ObjectUtils.isNotEmpty(sysDepts) ? AjaxResult.success(sysDepts) : AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptConfigRateSummary> selectDeptConfigRatePivot(DeptConfigRateSummary entity) {
|
||||
// 1. 查询配置率项(每条代表一个公司+设备+评分项)
|
||||
List<DeptConfigRateSummary> configList = mapper.selectDeptConfigRatePivot(entity);
|
||||
|
||||
// 2. 查询 ma_own_manage 表中原始设备数据
|
||||
List<Ownerdomin> ownListFromManage = ownerMapper.list(null);
|
||||
|
||||
// 3. 查询 ma_dev_info 表中聚合后的设备数据(包含公司名)
|
||||
List<NewOwnerdomin> ownListFromDevInfo = ownerMapper.listGrouped();
|
||||
|
||||
// 4. 构建设备索引 Map<公司ID_设备名, List<Ownerdomin>>
|
||||
Map<String, List<Ownerdomin>> ownIndex = new HashMap<>();
|
||||
|
||||
/*从自己配置的自有、外租表里面进行遍历 目的是放到对应的键里面去*/
|
||||
for (Ownerdomin device : ownListFromManage) {
|
||||
String key = device.getCompanyId() + "_" + device.getMaNameId();
|
||||
ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(device);
|
||||
}
|
||||
/*去ma_dev_info装置配置表里面获取可有重复装备的数据*/
|
||||
for (NewOwnerdomin dev : ownListFromDevInfo) {
|
||||
String key = dev.getCompanyId() + "_" + dev.getTypeId();
|
||||
List<Ownerdomin> existList = ownIndex.get(key);
|
||||
if (existList != null && !existList.isEmpty()) {
|
||||
for (Ownerdomin device : existList) {
|
||||
// 1. 累加设备数量
|
||||
device.setMaNum(device.getMaNum()+dev.getMaNum());
|
||||
|
||||
// 2. 只有当原类型不是 "1"(即不是“租赁”)时才改成 "2"自有
|
||||
if (!"1".equals(device.getType())) {
|
||||
device.setType("2");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Ownerdomin newDevice = new Ownerdomin();
|
||||
newDevice.setCompanyId((long) dev.getCompanyId());
|
||||
newDevice.setMaName(dev.getMaName());
|
||||
newDevice.setType("2");
|
||||
newDevice.setOrderCount(dev.getOrderCount());
|
||||
newDevice.setMaNum(dev.getMaNum());
|
||||
ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(newDevice);
|
||||
}
|
||||
}
|
||||
|
||||
// 5. 构建公司 → 汇总对象 Map<String, DeptConfigRateSummary>
|
||||
Map<String, DeptConfigRateSummary> companyMap = new LinkedHashMap<>();
|
||||
|
||||
for (DeptConfigRateSummary config : configList) {
|
||||
String company = config.getCompanyName();
|
||||
String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电
|
||||
String maName = config.getDeptName();
|
||||
String typeId = config.getTypeId();
|
||||
BigDecimal orderCount = config.getOrderCount();
|
||||
Long configCompanyId = config.getCompanyId();
|
||||
|
||||
String key = configCompanyId + "_" + typeId;
|
||||
List<Ownerdomin> sameCompanyDevices = ownIndex.getOrDefault(key, Collections.emptyList());
|
||||
BigDecimal score = computeScoreByMaName(orderCount, sameCompanyDevices, config,type);
|
||||
BigDecimal newscore = null;
|
||||
//针对订单数量大于0的进行计算(需要给外租也就是type=1的进行赋值)
|
||||
if (orderCount.compareTo(BigDecimal.ZERO) > 0
|
||||
&& (sameCompanyDevices == null || sameCompanyDevices.isEmpty())) {
|
||||
newscore = computeScoreByOrder(config);
|
||||
}
|
||||
DeptConfigRateSummary dto = companyMap.computeIfAbsent(company, k -> {
|
||||
DeptConfigRateSummary d = new DeptConfigRateSummary();
|
||||
d.setDeptName(config.getDeptName());
|
||||
d.setConfigType(config.getConfigType());
|
||||
d.setCompanyId(configCompanyId);
|
||||
d.setCompanyName(company);
|
||||
d.setValueA(BigDecimal.ZERO);
|
||||
d.setValueB(BigDecimal.ZERO);
|
||||
d.setValueC(BigDecimal.ZERO);
|
||||
return d;
|
||||
});
|
||||
|
||||
switch (type) {
|
||||
case "0":
|
||||
case "3":
|
||||
dto.setValueA(dto.getValueA().add(score));
|
||||
dto.setValueA(
|
||||
(dto.getValueA() == null ? BigDecimal.ZERO : dto.getValueA())
|
||||
.add(newscore == null ? BigDecimal.ZERO : newscore)
|
||||
);
|
||||
|
||||
break;
|
||||
case "1":
|
||||
case "4":
|
||||
dto.setValueB(dto.getValueB().add(score));
|
||||
dto.setValueB(
|
||||
(dto.getValueB() == null ? BigDecimal.ZERO : dto.getValueB())
|
||||
.add(newscore == null ? BigDecimal.ZERO : newscore)
|
||||
);
|
||||
break;
|
||||
case "2":
|
||||
case "5":
|
||||
dto.setValueC(dto.getValueC().add(score));
|
||||
dto.setValueC(
|
||||
(dto.getValueC() == null ? BigDecimal.ZERO : dto.getValueC())
|
||||
.add(newscore == null ? BigDecimal.ZERO : newscore)
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 5.x:补充未出现在 configList 的公司/设备项
|
||||
Set<String> configKeys = configList.stream()
|
||||
.map(c -> c.getCompanyId() + "_" + c.getTypeId())
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
for (Map.Entry<String, List<Ownerdomin>> entry : ownIndex.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (configKeys.contains(key)) continue;
|
||||
|
||||
List<Ownerdomin> devices = entry.getValue();
|
||||
if (devices == null || devices.isEmpty()) continue;
|
||||
|
||||
Ownerdomin first = devices.get(0);
|
||||
Long companyId = first.getCompanyId();
|
||||
String maName = first.getMaName();
|
||||
|
||||
// 从 devInfo 中找公司名称
|
||||
Optional<NewOwnerdomin> matchDev = ownListFromDevInfo.stream()
|
||||
.filter(d -> d.getCompanyId() == companyId.intValue() && d.getMaName().equals(maName))
|
||||
.findFirst();
|
||||
|
||||
String companyName = matchDev.map(NewOwnerdomin::getCompanyName).orElse("未知公司");
|
||||
|
||||
// 获取或创建公司维度的汇总对象 如果这个公司没统计对象,就创建一个
|
||||
DeptConfigRateSummary dto = companyMap.computeIfAbsent(companyName, k -> {
|
||||
DeptConfigRateSummary d = new DeptConfigRateSummary();
|
||||
d.setDeptName(companyName);
|
||||
// d.setConfigType(entry.getValue().get(0).getCompanyId());
|
||||
d.setCompanyId(companyId);
|
||||
d.setCompanyName(companyName);
|
||||
d.setValueA(BigDecimal.ZERO);
|
||||
d.setValueB(BigDecimal.ZERO);
|
||||
d.setValueC(BigDecimal.ZERO);
|
||||
return d;
|
||||
});
|
||||
|
||||
// 汇总订单数量
|
||||
BigDecimal orderCount = devices.stream()
|
||||
.map(d -> Optional.ofNullable(d.getOrderCount()).orElse(BigDecimal.ZERO))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
// 构造“临时配置项”用于计算
|
||||
DeptConfigRateSummary dummyConfig = new DeptConfigRateSummary();
|
||||
// 假设你已经找到了匹配的 NewOwnerdomin 对象 matchDev
|
||||
BigDecimal fullScore = matchDev.map(NewOwnerdomin::getFullScore).orElse(BigDecimal.TEN);
|
||||
BigDecimal baseNum = matchDev.map(NewOwnerdomin::getBaseNum).orElse(BigDecimal.ONE);
|
||||
dummyConfig.setFullScore(fullScore);
|
||||
dummyConfig.setOrderCount(orderCount);
|
||||
dummyConfig.setDeptName(maName);
|
||||
dummyConfig.setCompanyId(companyId);
|
||||
dummyConfig.setCompanyName(companyName);
|
||||
|
||||
// 计算得分
|
||||
BigDecimal score = computeScoreByMaName(orderCount, devices, dummyConfig, "0");
|
||||
|
||||
// 默认计入线路类 valueA
|
||||
dto.setValueA(dto.getValueA().add(score));
|
||||
}
|
||||
|
||||
|
||||
// 6. 返回汇总结果
|
||||
return new ArrayList<>(companyMap.values());
|
||||
|
||||
}
|
||||
|
||||
private BigDecimal computeScoreByOrder(DeptConfigRateSummary config) {
|
||||
|
||||
BigDecimal leaseNum ;
|
||||
BigDecimal orderCount = config.getOrderCount() != null ? config.getOrderCount() : BigDecimal.ZERO; // 订单数量
|
||||
leaseNum =orderCount;
|
||||
// BigDecimal configValue = config.getConfigValue();//自有人员数量
|
||||
BigDecimal configValue = BigDecimal.valueOf(0);
|
||||
BigDecimal baseNum = config.getConfigValue(); // 基本配置数量(F列)
|
||||
BigDecimal configRate = config.getConfigRate(); // 满分值(K列)
|
||||
|
||||
// 权重
|
||||
BigDecimal leaseWeight = new BigDecimal("0.6");
|
||||
BigDecimal orderWeight = new BigDecimal("0.9");
|
||||
|
||||
// 实际值 = 自有 + 租赁×0.6 + 订单×0.9
|
||||
BigDecimal actual = configValue
|
||||
.add(leaseNum.multiply(leaseWeight))
|
||||
.add(orderCount.multiply(orderWeight));
|
||||
|
||||
if (baseNum == null || baseNum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return BigDecimal.ZERO; // 避免除以 0,可按需调整为 configRate
|
||||
}
|
||||
|
||||
// 计算比例
|
||||
BigDecimal ratio = actual.divide(baseNum, 4, RoundingMode.HALF_UP);
|
||||
|
||||
// 最终得分
|
||||
if (ratio.compareTo(BigDecimal.ONE) >= 0) {
|
||||
System.err.println("比例大于1,得分为满分"+config.getDeptName()+" "+config.toString());
|
||||
return configRate; // 满分
|
||||
} else {
|
||||
System.err.println("比例 × 满分"+config.getDeptName()+" "+config.toString());
|
||||
return ratio.multiply(configRate).setScale(2, RoundingMode.HALF_UP); // 比例 × 满分
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal computeScoreByMaName(BigDecimal ordercount,List<Ownerdomin> owns, DeptConfigRateSummary config,String type) {
|
||||
if (config == null || owns == null || owns.isEmpty()) return BigDecimal.ZERO;
|
||||
|
||||
BigDecimal ownedTotal = BigDecimal.ZERO;
|
||||
BigDecimal leasedTotal = BigDecimal.ZERO;
|
||||
boolean limitedType = false; // 是否是 3/4/5 类型
|
||||
for (Ownerdomin own : owns) {
|
||||
BigDecimal num = new BigDecimal(own.getMaNum());
|
||||
|
||||
// 判断是否为限制分数的类型
|
||||
if ("3".equals(own.getType()) || "4".equals(own.getType()) || "5".equals(own.getType())) {
|
||||
limitedType = true;
|
||||
}
|
||||
//如果ordercount大于0,则计算得分leasedTotal+ordercount
|
||||
if (ordercount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
leasedTotal = leasedTotal.add(ordercount);
|
||||
}
|
||||
if ("2".equals(own.getType())) {
|
||||
ownedTotal = ownedTotal.add(num); // 自有
|
||||
} else if ("1".equals(own.getType())) {
|
||||
leasedTotal = leasedTotal.add(num); // 租赁
|
||||
}
|
||||
}
|
||||
|
||||
BigDecimal base = config.getConfigValue(); // 基本配置数量
|
||||
BigDecimal score = config.getConfigRate(); // 满分值
|
||||
|
||||
if (base == null || base.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
|
||||
// 计算比例 = (自有 + 租赁×0.6 + 订单×0.9) / 基本配置标准数量
|
||||
BigDecimal rate = ownedTotal
|
||||
.add(leasedTotal.multiply(new BigDecimal("0.6")))
|
||||
.add(ordercount.multiply(new BigDecimal("0.9")))
|
||||
.divide(base, 4, RoundingMode.HALF_UP);
|
||||
|
||||
// 计算原始得分
|
||||
BigDecimal result = rate.multiply(score).setScale(2, RoundingMode.HALF_UP);
|
||||
|
||||
// 限制得分不超过满分,且如果是 3/4/5 类型,不能超过 20
|
||||
if (rate.compareTo(BigDecimal.ONE) > 0) {
|
||||
result = score.setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
if (limitedType && result.compareTo(new BigDecimal("20")) > 0) {
|
||||
result = new BigDecimal("20.00");
|
||||
}
|
||||
System.out.println("【配置率计算明细】");
|
||||
System.err.println("类型:" + config.getConfigType());
|
||||
System.out.println("设备名:" + config.getDeptName());
|
||||
System.out.println("配置类型:" + config.getConfigType());
|
||||
System.out.println("自有数量合计(ownedTotal):" + ownedTotal);
|
||||
System.out.println("租赁数量合计(leasedTotal):" + leasedTotal);
|
||||
System.out.println("订单数量(ordercount):" + ordercount);
|
||||
System.out.println("基本配置数量(base):" + base);
|
||||
System.out.println("满分值(score):" + score);
|
||||
System.out.println("得分比例(rate):" + rate);
|
||||
System.out.println("是否为限制类型(3/4/5):" + limitedType);
|
||||
System.out.println("最终得分(result):" + result);
|
||||
System.out.println("--------------------------------------------------");
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptConfigTypeSummary> selectDeptConfigTypeSummary(DeptConfigTypeSummary entity) {
|
||||
return mapper.selectDeptConfigTypeSummary(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EquipmentDetail> detailsInfo(EquipmentDetail equipmentDetail) {
|
||||
// 1. 原查询,返回 EquipmentDetail 列表
|
||||
List<EquipmentDetail> equipmentDetails = mapper.detailsInfo(equipmentDetail);
|
||||
|
||||
// 2. 新增查询,返回 NewmydevInfo 列表(ma_dev_info 自有设备数据)
|
||||
List<NewmydevInfo> devInfoList = mapper.listFromDevInfo(equipmentDetail.getCompanyId());
|
||||
|
||||
// 3. 建立原有设备索引,key = companyId + "_" + name
|
||||
Map<String, EquipmentDetail> indexMap = new LinkedHashMap<>();
|
||||
for (EquipmentDetail item : equipmentDetails) {
|
||||
String key = item.getCompanyId() + "_" + item.getTypeId();
|
||||
indexMap.put(key, item);
|
||||
}
|
||||
|
||||
// 4. 遍历 devInfoList,合并到 equipmentDetails
|
||||
for (NewmydevInfo devItem : devInfoList) {
|
||||
String key = devItem.getCompanyId() + "_" + devItem.getTypeId() ;
|
||||
EquipmentDetail existing = indexMap.get(key);
|
||||
|
||||
if (existing != null) {
|
||||
// 已存在,累加自有数量 own
|
||||
if (existing.getOwn() == null) {
|
||||
existing.setOwn(devItem.getOwnCount());
|
||||
} else {
|
||||
existing.setOwn(
|
||||
existing.getOwn() + (devItem.getOwnCount() == null ? 0 : devItem.getOwnCount())
|
||||
);
|
||||
|
||||
}
|
||||
} else {
|
||||
/* // 不存在,新增一条 EquipmentDetail,赋值必要字段
|
||||
EquipmentDetail newItem = new EquipmentDetail();
|
||||
newItem.setCompanyId(devItem.getCompanyId());
|
||||
newItem.setName(devItem.getTypeName());
|
||||
newItem.setOwn(devItem.getOwnCount());
|
||||
// 其他字段可根据业务决定是否赋默认值
|
||||
newItem.setDesc("来自装备配置管理");
|
||||
equipmentDetails.add(newItem);
|
||||
indexMap.put(key, newItem);*/
|
||||
}
|
||||
}
|
||||
|
||||
return equipmentDetails;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
@DataScope(deptAlias = "d")
|
||||
public List<SysDept> selectDeptList(SysDept dept) {
|
||||
try {
|
||||
BaseEntity entity = CommonDataPermissionInfo.backMissionInfo(dept.getParams().get("dataScope").toString());
|
||||
BeanUtils.copyProperties(entity, dept);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (dept.getDeptName() != null) {
|
||||
String str = dept.getDeptName().replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_");
|
||||
dept.setDeptName(str);
|
||||
}
|
||||
dept.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
|
||||
return mapper.selectDeptList(dept);
|
||||
}
|
||||
|
||||
public List<DeptTreeSelect> buildDeptTreeSelect(List<SysDept> depts) {
|
||||
List<SysDept> deptTrees = buildDeptTree(depts);
|
||||
return deptTrees.stream().map(DeptTreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<SysDept> buildDeptTree(List<SysDept> depts) {
|
||||
List<SysDept> returnList = new ArrayList<SysDept>();
|
||||
List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList());
|
||||
for (SysDept dept : depts) {
|
||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||
if (!tempList.contains(dept.getParentId())) {
|
||||
recursionFn(depts, dept);
|
||||
returnList.add(dept);
|
||||
}
|
||||
}
|
||||
if (returnList.isEmpty()) {
|
||||
returnList = depts;
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
private void recursionFn(List<SysDept> list, SysDept t) {
|
||||
// 得到子节点列表
|
||||
List<SysDept> childList = getChildList(list, t);
|
||||
t.setChildren(childList);
|
||||
for (SysDept tChild : childList) {
|
||||
if (hasChild(list, tChild)) {
|
||||
recursionFn(list, tChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<SysDept> getChildList(List<SysDept> list, SysDept t) {
|
||||
List<SysDept> tlist = new ArrayList<SysDept>();
|
||||
Iterator<SysDept> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
SysDept n = (SysDept) it.next();
|
||||
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) {
|
||||
tlist.add(n);
|
||||
}
|
||||
}
|
||||
return tlist;
|
||||
}
|
||||
|
||||
private boolean hasChild(List<SysDept> list, SysDept t) {
|
||||
return getChildList(list, t).size() > 0 ? true : false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
package com.bonus.material.largeScreen.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.bonus.common.biz.domain.SysDept;
|
||||
import com.bonus.common.biz.utils.MathUtil;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.device.domain.DevInfo;
|
||||
import com.bonus.material.device.domain.DevInfoDt;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.device.mapper.DevInfoMapper;
|
||||
import com.bonus.material.device.service.DevInfoService;
|
||||
import com.bonus.material.largeScreen.entity.MaDevRateInfo;
|
||||
import com.bonus.material.largeScreen.entity.MaLeaseAnswerInfo;
|
||||
import com.bonus.material.largeScreen.entity.MaLeaseOnlyInfo;
|
||||
import com.bonus.material.largeScreen.entity.OrderData;
|
||||
import com.bonus.material.largeScreen.entity.*;
|
||||
import com.bonus.material.largeScreen.service.LargeScreenService;
|
||||
import com.bonus.material.lease.domain.MaLeaseInfo;
|
||||
import com.bonus.material.lease.mapper.MaLeaseInfoMapper;
|
||||
|
|
@ -24,11 +24,10 @@ import com.bonus.material.order.service.OrderService;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.Instant;
|
||||
|
|
@ -76,7 +75,7 @@ public class LargeScreenController extends BaseController {
|
|||
try {
|
||||
DevInfo list = largeScreenService.getIdleDevRatio();
|
||||
return AjaxResult.success(list);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("闲置装备分析异常");
|
||||
}
|
||||
}
|
||||
|
|
@ -89,7 +88,9 @@ public class LargeScreenController extends BaseController {
|
|||
list.forEach(item -> {
|
||||
double ratio = total == 0 ? 0 : (double) item.getDeviceCount() / total;
|
||||
double ratioPercent = ratio * 100;
|
||||
item.setRatio(ratioPercent);
|
||||
|
||||
BigDecimal bd = new BigDecimal(ratioPercent).setScale(2, RoundingMode.HALF_UP);
|
||||
item.setRatio(bd);
|
||||
});
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
|
@ -139,13 +140,24 @@ public class LargeScreenController extends BaseController {
|
|||
orderData.setDevLeasingNum(devLeasingNum);
|
||||
Integer repairingDevNum = devInfoMapper.getRepairingDevNum();
|
||||
orderData.setDevRepairingNum(repairingDevNum);
|
||||
Integer rentToalNum = devInfoMapper.getRentToalNum();
|
||||
orderData.setRentToalNum(rentToalNum);
|
||||
DevInfo devInfo = devInfoMapper.getDevUsageRatio();
|
||||
if(devInfo != null){
|
||||
if (devInfo != null) {
|
||||
orderData.setDevUsageRatio(MathUtil.calculatePercentage(devInfo.getTotalLeaseDay(), devInfo.getTotalUpDay() + devInfo.getTotalLeaseDay()));
|
||||
}
|
||||
return AjaxResult.success(orderData);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("公司出租/租赁数")
|
||||
@GetMapping("/devLeaseAndRentCount")
|
||||
public AjaxResult devLeaseAndRentCount() {
|
||||
List<LeaseInfo> leaseInfo = devInfoMapper.getDevLeaseCount();
|
||||
List<RentInfo> rentInfo = devInfoMapper.getDevRentCount();
|
||||
return AjaxResult.success(new LeaseAndRentInfo(leaseInfo, rentInfo));
|
||||
}
|
||||
|
||||
@ApiOperation("装备需求统计")
|
||||
@GetMapping("/demandCount")
|
||||
public AjaxResult demandCount() {
|
||||
|
|
@ -154,10 +166,12 @@ public class LargeScreenController extends BaseController {
|
|||
Integer leaseOrderNum = leaseInfoMapper.getLeaseOrderCount();
|
||||
Integer maTypeCountFromLease = leaseInfoMapper.getMaTypeCountFromLease();
|
||||
String topPopularTypeName = leaseInfoMapper.getTopPopularTypeName();
|
||||
Integer demandUnitNum = leaseInfoMapper.getDemandUnit();
|
||||
orderData.setLeaseNum(leaseNum);
|
||||
orderData.setMaTypeCountFromLease(maTypeCountFromLease);
|
||||
orderData.setLeaseOrderRatio(MathUtil.calculatePercentage(leaseOrderNum, leaseNum));
|
||||
orderData.setTopPopularTypeName(topPopularTypeName);
|
||||
orderData.setDemandUnitNum(demandUnitNum);
|
||||
return AjaxResult.success(orderData);
|
||||
}
|
||||
|
||||
|
|
@ -266,6 +280,20 @@ public class LargeScreenController extends BaseController {
|
|||
List<DevInfoVo> list = devInfoMapper.getMaTypeLeasingNumList(devInfoVo);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
@ApiOperation("装备租赁-累计数二级页面")
|
||||
@GetMapping("/getMaTypeLeasingDetail")
|
||||
public AjaxResult getMaTypeLeasingDetail(DevInfoVo devInfoVo) {
|
||||
startPage();
|
||||
List<DevInfoVo> list = devInfoMapper.getMaTypeLeasingDetail(devInfoVo);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
@ApiOperation("装备需求-需求单位二级页面")
|
||||
@GetMapping("/getDemandUnit")
|
||||
public AjaxResult getDemandUnit(DevInfoVo devInfoVo) {
|
||||
startPage();
|
||||
List<SysDept> list = devInfoMapper.getDemandUnit(devInfoVo);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
@ApiOperation("在租赁装备数二级页面")
|
||||
@GetMapping("/getDevLeasingNum")
|
||||
|
|
@ -309,6 +337,7 @@ public class LargeScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 应答率二级页面
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -339,6 +368,7 @@ public class LargeScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 总应答率二级页面
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -382,6 +412,7 @@ public class LargeScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 判断关键字
|
||||
*
|
||||
* @param item
|
||||
* @param keyWord
|
||||
* @return
|
||||
|
|
@ -393,6 +424,7 @@ public class LargeScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 最需装备二级页面
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -411,6 +443,7 @@ public class LargeScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 需求装备种类
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -457,6 +490,7 @@ public class LargeScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 判断关键字
|
||||
*
|
||||
* @param item
|
||||
* @param keyWord
|
||||
* @return
|
||||
|
|
@ -468,6 +502,7 @@ public class LargeScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 计算租赁天数差
|
||||
*
|
||||
* @param startTime
|
||||
* @param rentEndTime
|
||||
* @return
|
||||
|
|
@ -488,6 +523,7 @@ public class LargeScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 将 java.util.Date 转换为 java.time.LocalDate
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -499,6 +535,7 @@ public class LargeScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 装备利用率
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -533,6 +570,7 @@ public class LargeScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 退租装备
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -543,4 +581,43 @@ public class LargeScreenController extends BaseController {
|
|||
List<MaDevRateInfo> list = leaseInfoMapper.getReturnDev(dto);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 按公司纬度获取设备入驻数
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("按公司纬度获取设备入驻数")
|
||||
@GetMapping("/getDevNumList")
|
||||
public AjaxResult getDevNumList(DevInfo dto) {
|
||||
startPage();
|
||||
List<DevInfo> list = leaseInfoMapper.getDevNumList(dto);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 入驻设备明细
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("入驻设备明细")
|
||||
@GetMapping("/getDevNumDetailsList")
|
||||
public AjaxResult getDevNumDetailsList(DevInfo dto) {
|
||||
startPage();
|
||||
List<DevInfoDt> list = leaseInfoMapper.getDevNumDetailsList(dto);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出入驻设备明细
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("导出入驻设备明细")
|
||||
@PostMapping("/exportDevNumDetailsList")
|
||||
public void exportDevNumDetailsList(HttpServletResponse response, @RequestBody DevInfo dto) {
|
||||
List<DevInfoDt> list = leaseInfoMapper.getDevNumDetailsList(dto);
|
||||
ExcelUtil<DevInfoDt> util = new ExcelUtil<>(DevInfoDt.class);
|
||||
util.exportExcel(response, list, "入驻设备明细数据");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.material.largeScreen.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/7/3 - 14:10
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class LeaseAndRentInfo {
|
||||
private List<LeaseInfo> LeaseInfos;
|
||||
private List<RentInfo> RentInfos;
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.bonus.material.largeScreen.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/7/3 - 14:10
|
||||
* 租赁信息
|
||||
*/
|
||||
@Data
|
||||
public class LeaseInfo {
|
||||
private Integer leaseNum;
|
||||
private String leaseCompanyName;
|
||||
}
|
||||
|
|
@ -67,6 +67,12 @@ public class OrderData {
|
|||
@ApiModelProperty(value = "订单总数")
|
||||
private Integer orderNum;
|
||||
|
||||
@ApiModelProperty(value = "租赁总数")
|
||||
private Integer rentToalNum;
|
||||
|
||||
@ApiModelProperty(value = "需求单位数")
|
||||
private Integer demandUnitNum;
|
||||
|
||||
@ApiModelProperty(value = "装备利用率")
|
||||
private BigDecimal devUsageRatio;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.bonus.material.largeScreen.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/7/3 - 14:10
|
||||
* 出租信息
|
||||
*/
|
||||
@Data
|
||||
public class RentInfo {
|
||||
private Integer rentNum;
|
||||
private String rentCompanyName;
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package com.bonus.material.lease.mapper;
|
||||
|
||||
import com.bonus.material.device.domain.DevInfo;
|
||||
import com.bonus.material.device.domain.DevInfoDt;
|
||||
import com.bonus.material.largeScreen.entity.MaDevRateInfo;
|
||||
import com.bonus.material.largeScreen.entity.MaLeaseAnswerInfo;
|
||||
import com.bonus.material.largeScreen.entity.MaLeaseOnlyInfo;
|
||||
|
|
@ -183,4 +185,20 @@ public interface MaLeaseInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
List<MaDevRateInfo> getReturnDev(MaDevRateInfo dto);
|
||||
|
||||
Integer getDemandUnit();
|
||||
|
||||
/**
|
||||
* 获取设备入驻数
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<DevInfo> getDevNumList(DevInfo dto);
|
||||
|
||||
/**
|
||||
* 入驻设备明细
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<DevInfoDt> getDevNumDetailsList( DevInfo dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
package com.bonus.material.owner.controller;
|
||||
|
||||
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
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.contract.domain.BmContract;
|
||||
import com.bonus.material.device.domain.dto.DevInfoImpDto;
|
||||
import com.bonus.material.owner.domain.Ownerdomin;
|
||||
import com.bonus.material.owner.service.OwnerService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:lizhenhua
|
||||
* @Date:2025/6/26- 9:14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/owner")
|
||||
@Api(value = "自有装备管理", tags = "自有装备管理")
|
||||
public class OwnerController extends BaseController {
|
||||
@Resource
|
||||
private OwnerService ownerService;
|
||||
|
||||
@ApiOperation(value = "自有装备管理列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(Ownerdomin ownerdomin) {
|
||||
startPage();
|
||||
List<Ownerdomin> list = ownerService.list(ownerdomin);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "自有装备管理新增")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody Ownerdomin ownerdomin) throws UnsupportedEncodingException {
|
||||
if(ownerdomin.getMaNameId() != null){
|
||||
ownerdomin.setMaName(ownerdomin.getMaNameId());
|
||||
}
|
||||
Integer i = ownerService.add(ownerdomin);
|
||||
if (i > 0){
|
||||
return AjaxResult.success("新增成功");
|
||||
}else {
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "自有装备管理修改")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody Ownerdomin ownerdomin) throws UnsupportedEncodingException {
|
||||
Integer i = ownerService.edit(ownerdomin);
|
||||
if (i > 0){
|
||||
return AjaxResult.success("修改成功");
|
||||
}else {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
@ApiOperation(value = "自有装备管理删除")
|
||||
@PostMapping("/del")
|
||||
public AjaxResult del(@RequestBody Ownerdomin ownerdomin) {
|
||||
Integer i = ownerService.del(ownerdomin);
|
||||
if (i > 0){
|
||||
return AjaxResult.success("删除成功");
|
||||
}else {
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
@ApiOperation(value = "装备批量录入")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(@RequestParam("file") MultipartFile file,
|
||||
String type) throws Exception {
|
||||
// 1. 空文件判断
|
||||
if (file == null || file.isEmpty()) {
|
||||
return AjaxResult.error("上传的文件不能为空!");
|
||||
}
|
||||
|
||||
// 2. 文件名及格式校验
|
||||
String fileName = file.getOriginalFilename();
|
||||
if (fileName != null) {
|
||||
String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
long fileSize = file.getSize();
|
||||
if (!fileExtension.equalsIgnoreCase("xls") && !fileExtension.equalsIgnoreCase("xlsx")) {
|
||||
return AjaxResult.error("文件后缀名必须为 xls 或 xlsx");
|
||||
} else if (fileSize > 10 * 1024 * 1024) {
|
||||
return AjaxResult.error("文件大小不能超过 10MB");
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 读取文件内容并处理
|
||||
ExcelUtil<Ownerdomin> util = new ExcelUtil<>(Ownerdomin.class);
|
||||
List<Ownerdomin> maPropInfoList = util.importExcel(file.getInputStream());
|
||||
|
||||
if (maPropInfoList == null || maPropInfoList.isEmpty()) {
|
||||
return AjaxResult.error("导入的数据不能为空!");
|
||||
}
|
||||
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
String message = ownerService.importMaProp(maPropInfoList, type, userId);
|
||||
|
||||
return AjaxResult.success(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.bonus.material.owner.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FileInfo {
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
|
||||
@ApiModelProperty(value = "文件 URL")
|
||||
private String fileUrl;
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.bonus.material.owner.domain;
|
||||
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2024/12/13 - 9:17
|
||||
*/
|
||||
@Data
|
||||
public class Ownerdomin {
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "装备分类")
|
||||
private String maType;
|
||||
|
||||
@ApiModelProperty(value = "装备名称")
|
||||
@Excel(name = "装备名称")
|
||||
private String maName;
|
||||
|
||||
@ApiModelProperty(value = "装备规格")
|
||||
@Excel(name = "装备规格")
|
||||
private String maModel;
|
||||
|
||||
@ApiModelProperty(value = "规格id")
|
||||
private Integer modelId;
|
||||
|
||||
@ApiModelProperty(value = "类型(1租赁 2自有)")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "所属公司")
|
||||
private Long companyId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "装备数量")
|
||||
@Excel(name = "装备数量")
|
||||
private Integer maNum;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String creator;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
@ApiModelProperty(value = "装备名称id")
|
||||
private String maNameId;
|
||||
|
||||
private BigDecimal orderCount;
|
||||
|
||||
@ApiModelProperty(value = "文件列表")
|
||||
private List<FileInfo> mainFileList = new ArrayList<>();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.bonus.material.owner.mapper;
|
||||
|
||||
|
||||
import com.bonus.material.equipment.domain.NewOwnerdomin;
|
||||
import com.bonus.material.owner.domain.Ownerdomin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OwnerMapper {
|
||||
|
||||
|
||||
List<Ownerdomin> list(Ownerdomin ownerdomin);
|
||||
|
||||
Integer add(Ownerdomin ownerdomin);
|
||||
|
||||
Integer edit(Ownerdomin ownerdomin);
|
||||
|
||||
Integer del(Ownerdomin ownerdomin);
|
||||
|
||||
List<NewOwnerdomin> listGrouped();
|
||||
|
||||
void deleteFileInfo(Integer id);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.bonus.material.owner.service;
|
||||
|
||||
import com.bonus.material.owner.domain.Ownerdomin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OwnerService {
|
||||
|
||||
List<Ownerdomin> list(Ownerdomin ownerdomin);
|
||||
|
||||
Integer add(Ownerdomin ownerdomin);
|
||||
|
||||
Integer edit(Ownerdomin ownerdomin);
|
||||
|
||||
Integer del(Ownerdomin ownerdomin);
|
||||
|
||||
String importMaProp(List<Ownerdomin> maPropInfoList, String type, Long userId);
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package com.bonus.material.owner.service.impl;
|
||||
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.bean.BeanUtils;
|
||||
import com.bonus.common.core.utils.bean.BeanValidators;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.device.domain.DevInfo;
|
||||
import com.bonus.material.device.domain.dto.DevInfoImpDto;
|
||||
import com.bonus.material.device.mapper.BmFileInfoMapper;
|
||||
import com.bonus.material.owner.domain.FileInfo;
|
||||
import com.bonus.material.owner.domain.Ownerdomin;
|
||||
import com.bonus.material.owner.mapper.OwnerMapper;
|
||||
import com.bonus.material.owner.service.OwnerService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Validator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class OwnerServiceImpl implements OwnerService {
|
||||
|
||||
@Resource
|
||||
private OwnerMapper ownerMapper;
|
||||
|
||||
@Resource
|
||||
private BmFileInfoMapper bmFileInfoMapper;
|
||||
|
||||
@Resource
|
||||
protected Validator validator;
|
||||
|
||||
@Override
|
||||
public List<Ownerdomin> list(Ownerdomin ownerdomin) {
|
||||
ownerdomin.setCreator(SecurityUtils.getLoginUser().getSysUser().getUserId()+"");
|
||||
ownerdomin.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
|
||||
List<Ownerdomin> list = ownerMapper.list(ownerdomin);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer add(Ownerdomin ownerdomin) {
|
||||
ownerdomin.setCreator(SecurityUtils.getLoginUser().getSysUser().getUserId()+"");
|
||||
ownerdomin.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
|
||||
Integer add = ownerMapper.add(ownerdomin);
|
||||
//判断是否存在图片等
|
||||
if (ownerdomin.getMainFileList() != null && ownerdomin.getMainFileList().size() > 0) {
|
||||
bmFileInfoMapper.insertRentInfo(ownerdomin);
|
||||
}
|
||||
return add;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer edit(Ownerdomin ownerdomin) {
|
||||
Integer edit = ownerMapper.edit(ownerdomin);
|
||||
//删除对应保存到表里面的信息
|
||||
ownerMapper.deleteFileInfo(ownerdomin.getId());
|
||||
if (ownerdomin.getMainFileList() != null && ownerdomin.getMainFileList().size() > 0) {
|
||||
BmFileInfo bmFileInfo = new BmFileInfo();
|
||||
bmFileInfo.setTaskId(Long.valueOf(ownerdomin.getId()));
|
||||
bmFileInfo.setFileName(bmFileInfo.getFileName());
|
||||
bmFileInfo.setFileUrl(bmFileInfo.getFileUrl());
|
||||
bmFileInfoMapper.insertRentInfo(ownerdomin);
|
||||
}
|
||||
return edit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer del(Ownerdomin ownerdomin) {
|
||||
return ownerMapper.del(ownerdomin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String importMaProp(List<Ownerdomin> maPropInfoList, String type, Long userId) {
|
||||
if (StringUtils.isNull(maPropInfoList) || maPropInfoList.isEmpty()) {
|
||||
throw new ServiceException("导入的数据不能为空!");
|
||||
}
|
||||
|
||||
// 过滤掉空对象或空行
|
||||
maPropInfoList = maPropInfoList.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(item -> StringUtils.isNotEmpty(item.getMaName())) // 替换为你必须字段
|
||||
.collect(Collectors.toList());
|
||||
|
||||
int failureNum = 0;
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
|
||||
for (Ownerdomin devInfo : maPropInfoList) {
|
||||
try {
|
||||
BeanValidators.validateWithException(validator, devInfo);
|
||||
devInfo.setCreator(userId + "");
|
||||
Ownerdomin ownerdomin = new Ownerdomin();
|
||||
BeanUtils.copyProperties(devInfo, ownerdomin);
|
||||
ownerdomin.setType(type);
|
||||
ownerdomin.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
|
||||
ownerMapper.add(ownerdomin);
|
||||
successMsg.append(" 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = " 导入失败:";
|
||||
failureMsg.append(msg).append(e.getMessage());
|
||||
log.error(msg, e);
|
||||
}
|
||||
}
|
||||
|
||||
return successMsg.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?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">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.material.device.mapper.BmFileInfoMapper">
|
||||
<resultMap type="com.bonus.common.biz.domain.BmFileInfo" id="BmFileInfoResult">
|
||||
<result property="id" column="id" />
|
||||
|
|
@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="fileType != null "> and file_type = #{fileType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectBmFileInfoById" parameterType="Long" resultMap="BmFileInfoResult">
|
||||
<include refid="selectBmFileInfoVo"/>
|
||||
where model_id = #{id}
|
||||
|
|
@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
<select id="getInfoByMaId" resultType="com.bonus.common.biz.domain.BmFileInfo">
|
||||
select
|
||||
id, task_type, task_id, model_id, name as fileName, url as fileUrl, file_type, create_by, create_time
|
||||
id, task_type, task_id, model_id, name as fileName, url as fileUrl, file_type, create_by, create_time
|
||||
from bm_file_info
|
||||
where model_id = #{maId} and file_type = 5 and task_type = 17
|
||||
</select>
|
||||
|
|
@ -67,11 +67,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select
|
||||
id, task_type, task_id, model_id, name fileName, url fileUrl, file_type, create_by, create_time
|
||||
from bm_file_info
|
||||
WHERE
|
||||
WHERE
|
||||
model_id = #{maId}
|
||||
and task_id = #{id}
|
||||
and task_type = 17
|
||||
and file_type = 4
|
||||
and task_id = #{id}
|
||||
and task_type = 17
|
||||
and file_type = 4
|
||||
</select>
|
||||
|
||||
<insert id="insertBmFileInfo" parameterType="com.bonus.common.biz.domain.BmFileInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
|
|
@ -85,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="fileType != null">file_type,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="taskType != null">#{taskType},</if>
|
||||
<if test="taskId != null">#{taskId},</if>
|
||||
|
|
@ -95,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="fileType != null">#{fileType},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
now()
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertBmFileInfos" parameterType="com.bonus.common.biz.domain.BmFileInfo">
|
||||
|
|
@ -114,6 +114,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="insertRentInfo" parameterType="com.bonus.material.owner.domain.Ownerdomin">
|
||||
INSERT INTO bm_rent_info(task_id,name,url,create_time)
|
||||
VALUES
|
||||
<foreach collection="mainFileList" item="item" index="index" separator=",">
|
||||
(
|
||||
#{id},
|
||||
#{item.fileName},
|
||||
#{item.fileUrl},
|
||||
now()
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateBmFileInfo" parameterType="com.bonus.common.biz.domain.BmFileInfo">
|
||||
update bm_file_info
|
||||
|
|
@ -135,7 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</delete>
|
||||
|
||||
<delete id="deleteBmFileInfoByIds" parameterType="String">
|
||||
delete from bm_file_info where id in
|
||||
delete from bm_file_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
|
@ -165,4 +177,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<delete id="deleteBmFileInfoByFileId">
|
||||
delete from bm_file_info where id = #{fileId} and task_type = 17 and file_type = #{fileType}
|
||||
</delete>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -1008,6 +1008,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update ma_dev_info set total_lease_day = IFNULL(total_lease_day, 0) + 1
|
||||
where is_active = '1' and ma_status = '3'
|
||||
</update>
|
||||
<update id="updateTypeLeasePrice">
|
||||
update ma_type set lease_price = #{dayLeasePrice}
|
||||
where type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
<select id="getIdleDevRatio" resultType="com.bonus.material.device.domain.DevInfo">
|
||||
SELECT
|
||||
|
|
@ -1026,14 +1030,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="getLeaseCountByTypeName" resultType="com.bonus.material.device.domain.DevInfo">
|
||||
select mt3.type_name, count(1) as device_count
|
||||
select mt1.type_name, count(1) as device_count
|
||||
from ma_order_details modd
|
||||
LEFT JOIN ma_dev_info mdi on modd.ma_id=mdi.ma_id
|
||||
LEFT JOIN ma_type mt4 on mt4.type_id=mdi.type_id
|
||||
LEFT JOIN ma_type mt3 on mt3.type_id=mt4.parent_id
|
||||
where mt3.type_name is not null
|
||||
LEFT JOIN ma_type mt2 on mt3.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_type mt1 on mt2.parent_id = mt1.type_id
|
||||
where mt1.type_name is not null
|
||||
and modd.order_status != 0 and modd.order_status != 99
|
||||
group by type_name
|
||||
group by mt1.type_name
|
||||
</select>
|
||||
|
||||
<select id="getDeviceShareRanking" resultType="com.bonus.material.device.domain.DevInfo">
|
||||
|
|
@ -1327,4 +1333,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mdi.is_active = '1'
|
||||
AND mdi.ma_status = '3'
|
||||
</select>
|
||||
<select id="getRentToalNum" resultType="java.lang.Integer">
|
||||
select sum(num)
|
||||
from ma_order_details
|
||||
where order_status NOT IN ( 0 , 99 )
|
||||
</select>
|
||||
<select id="getDevLeaseCount" resultType="com.bonus.material.largeScreen.entity.LeaseInfo">
|
||||
SELECT
|
||||
sum(hh.num) leaseNum,
|
||||
sd.dept_name leaseCompanyName
|
||||
FROM
|
||||
ma_order_info moi
|
||||
LEFT JOIN ma_order_details hh ON moi.order_id = hh.order_id
|
||||
LEFT JOIN sys_dept sd on moi.buyer_company = sd.dept_id
|
||||
WHERE hh.order_status NOT IN ( 0, 99 )
|
||||
GROUP BY moi.buyer_company
|
||||
</select>
|
||||
<select id="getDevRentCount" resultType="com.bonus.material.largeScreen.entity.RentInfo">
|
||||
SELECT
|
||||
sum( hh.num ) rentNum,
|
||||
sd.dept_name rentCompanyName
|
||||
FROM
|
||||
ma_order_details hh
|
||||
LEFT JOIN ma_dev_info mdi ON hh.ma_id = mdi.ma_id
|
||||
LEFT JOIN sys_dept sd ON mdi.own_co = sd.dept_id
|
||||
WHERE
|
||||
hh.order_status NOT IN ( 0, 99 )
|
||||
GROUP BY
|
||||
mdi.own_co
|
||||
</select>
|
||||
<select id="getMaTypeLeasingDetail" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
|
||||
SELECT
|
||||
mdi.device_name AS deviceName,
|
||||
mt.type_name AS modelName,
|
||||
mdi.identify_code AS identifyCode,
|
||||
md.order_id AS orderId,
|
||||
sd.dept_name AS comName,
|
||||
mdi.person AS person,
|
||||
sd2.dept_name AS lessee,
|
||||
su.user_name AS lesseePerson,
|
||||
md.rent_begin_time AS startTime,
|
||||
md.rent_end_time AS endTime,
|
||||
md.costs AS cost
|
||||
FROM
|
||||
ma_order_details md
|
||||
LEFT JOIN ma_dev_info mdi ON mdi.ma_id = md.ma_id
|
||||
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.own_co
|
||||
LEFT JOIN ma_order_info moi ON moi.order_id = md.order_id
|
||||
LEFT JOIN sys_dept sd2 ON moi.buyer_company = sd2.dept_id
|
||||
LEFT JOIN sys_user su ON moi.buyer_id = su.user_id
|
||||
WHERE
|
||||
mdi.is_active = '1'
|
||||
</select>
|
||||
<select id="getDemandUnit" resultType="com.bonus.common.biz.domain.SysDept">
|
||||
SELECT DISTINCT
|
||||
sd.dept_name deptName,
|
||||
sd.create_time createTime
|
||||
FROM
|
||||
ma_lease_info mli
|
||||
LEFT JOIN sys_dept sd ON mli.publish_company = sd.dept_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,93 @@
|
|||
<?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.equipment.mapper.DeptEquipmentConfigMapper">
|
||||
<delete id="deleteByDeptIdAndTypeId">
|
||||
DELETE FROM ma_dept_config WHERE dept_id = #{deptId} AND type_id = #{typeId}
|
||||
</delete>
|
||||
|
||||
<select id="selectConfig" resultType="com.bonus.material.equipment.domain.DeptEquipmentConfig">
|
||||
|
||||
</select>
|
||||
<select id="selectConfigByDept" resultType="com.bonus.material.equipment.domain.DeptEquipmentConfig">
|
||||
SELECT * FROM dept_equipment_config WHERE dept_id = #{deptId}
|
||||
</select>
|
||||
<select id="selectDevInfoLists" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
|
||||
SELECT
|
||||
d.ma_id AS maId,
|
||||
d.CODE AS code,
|
||||
d.own_co,
|
||||
CONCAT_WS( '>', mt1.type_name, mt2.type_name, mt3.type_name ) AS deviceTypeName ,
|
||||
d.identify_code AS identifyCode,
|
||||
d.device_name AS deviceName,
|
||||
d.device_weight AS deviceWeight,
|
||||
d.device_count AS deviceCount,
|
||||
d.type_id AS typeId,
|
||||
mt4.type_name AS typeName,
|
||||
mt4.unit_name AS unitName,
|
||||
d.ma_status AS maStatus,
|
||||
d.brand AS brand,
|
||||
d.model_name AS modelName,
|
||||
d.production_date AS productionDate,
|
||||
d.working_hours AS workingHours,
|
||||
d.serial_number AS serialNumber,
|
||||
mt4.lease_price AS dayLeasePrice,
|
||||
d.person AS person,
|
||||
d.person_phone AS personPhone,
|
||||
d.create_time AS createTime,
|
||||
d.update_time AS updateTime,
|
||||
d.own_co AS companyId,
|
||||
sd.dept_name AS companyName,
|
||||
c.operate_address AS operateAddress,
|
||||
mt3.type_id AS thirdId,
|
||||
mt3.type_name AS thirdName,
|
||||
mt2.type_id AS secondId,
|
||||
mt2.type_name AS secondName,
|
||||
mt1.type_id AS firstId,
|
||||
mt1.type_name AS firstName
|
||||
FROM
|
||||
ma_dev_info d
|
||||
LEFT JOIN sys_dept sd ON d.own_co = sd.dept_id
|
||||
LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = d.type_id
|
||||
AND mt4.del_flag = '0'
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt4.parent_id
|
||||
AND mt3.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt3.parent_id
|
||||
AND mt2.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id
|
||||
AND mt1.del_flag = '0'
|
||||
WHERE
|
||||
d.is_active = '1' and mt3.type_id=#{deviceId} AND d.own_co=#{companyName}
|
||||
</select>
|
||||
|
||||
<insert id="insertOrUpdateBatch" parameterType="com.bonus.material.equipment.domain.DeptEquipmentConfig">
|
||||
INSERT INTO ma_dept_config (
|
||||
dept_id,
|
||||
type_id,
|
||||
config_type,
|
||||
config_value,
|
||||
config_rate,
|
||||
config_description,
|
||||
remark
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="configs" item="item" separator=",">
|
||||
(
|
||||
#{deptId},
|
||||
#{typeId},
|
||||
#{item.configurationType},
|
||||
#{item.basicConfig},
|
||||
#{item.configurationRate},
|
||||
#{item.configurationDescription},
|
||||
#{remark}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
config_value = VALUES(config_value),
|
||||
config_rate = VALUES(config_rate),
|
||||
config_description = VALUES(config_description),
|
||||
remark = VALUES(remark),
|
||||
update_time = CURRENT_TIMESTAMP
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,241 @@
|
|||
<?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.equipment.mapper.SysDeptMapper">
|
||||
<sql id="selectDeptVo">
|
||||
select d.dept_id,
|
||||
d.parent_id,
|
||||
d.ancestors,
|
||||
d.dept_name,
|
||||
d.order_num,
|
||||
d.leader,
|
||||
d.phone,
|
||||
d.email,
|
||||
d.status,
|
||||
d.del_flag,
|
||||
d.create_by,
|
||||
d.create_time
|
||||
from sys_dept d
|
||||
</sql>
|
||||
<resultMap type="com.bonus.system.api.domain.SysDept" id="SysDeptResult">
|
||||
<id property="deptId" column="dept_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="ancestors" column="ancestors" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="leader" column="leader" />
|
||||
<result property="phone" column="phone" />
|
||||
<result property="email" column="email" />
|
||||
<result property="status" column="status" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="parentName" column="parent_name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="menuTemplateId" column="menu_template_id" />
|
||||
<result property="province" column="province" />
|
||||
<result property="city" column="city" />
|
||||
<result property="district" column="district" />
|
||||
<result property="address" column="address" />
|
||||
<result property="deptAbbreviation" column="dept_abbreviation" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="logo" column="logo" />
|
||||
<result property="adminUserId" column="admin_user_id" />
|
||||
<result property="initPassword" column="init_password" />
|
||||
</resultMap>
|
||||
<select id="selectDeptTree" resultType="SysDept">
|
||||
SELECT * FROM sys_dept WHERE del_flag = '0' ORDER BY parent_id, order_num
|
||||
</select>
|
||||
<select id="selectDeptList" parameterType="com.bonus.system.api.domain.SysDept" resultMap="SysDeptResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
where d.del_flag = '0'
|
||||
|
||||
<if test="deptName != null and deptName != ''">
|
||||
AND dept_name like concat('%', #{deptName}, '%')
|
||||
</if>
|
||||
|
||||
</select>
|
||||
<select id="selectUserList" resultType="com.bonus.material.equipment.domain.DeptEquipmentConfig">
|
||||
SELECT
|
||||
mt.type_id AS equipmentId,
|
||||
mt2.type_name AS equipmentName,
|
||||
mt.type_name AS equipmenttype,
|
||||
CASE
|
||||
WHEN MAX(mdc.config_value) IS NOT NULL AND MAX(mdc.config_value) != '' THEN '已配置'
|
||||
ELSE '未配置'
|
||||
END AS configStatus
|
||||
FROM ma_type mt
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_dept_config mdc
|
||||
ON mdc.type_id = mt.type_id
|
||||
AND mdc.dept_id = #{deptId}
|
||||
WHERE mt.level = 3
|
||||
<if test="equipmentName != null and equipmentName != ''">
|
||||
AND mt.type_name LIKE CONCAT('%', #{equipmentName}, '%')
|
||||
</if>
|
||||
<if test="equipmenttype != null and equipmenttype != ''">
|
||||
AND mt2.type_name LIKE CONCAT('%', #{equipmenttype}, '%')
|
||||
</if>
|
||||
GROUP BY mt.type_id, mt2.type_name, mt.type_name
|
||||
</select>
|
||||
<select id="selectConfigList" resultType="com.bonus.material.equipment.domain.ConfigEntity">
|
||||
SELECT
|
||||
config_value AS basicConfig,
|
||||
config_type AS configurationType,
|
||||
config_rate AS configurationRate,
|
||||
config_description AS configurationDescription
|
||||
FROM ma_dept_config
|
||||
WHERE dept_id = #{deptId}
|
||||
AND type_id = #{typeId}
|
||||
</select>
|
||||
<select id="getTree" resultType="com.bonus.material.equipment.domain.DeptTreeSelect">
|
||||
SELECT
|
||||
mt.type_id AS id,
|
||||
|
||||
mt.type_name AS name
|
||||
FROM ma_type mt
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_dept_config mdc
|
||||
ON mdc.type_id = mt.type_id
|
||||
|
||||
WHERE mt.level = 3
|
||||
GROUP BY mt.type_id, mt2.type_name, mt.type_name
|
||||
</select>
|
||||
<select id="selectDeptConfigRatePivot"
|
||||
resultType="com.bonus.material.equipment.domain.DeptConfigRateSummary">
|
||||
SELECT
|
||||
my.type_name AS deptName,
|
||||
my.type_id AS typeId,
|
||||
sd.dept_name AS companyName,
|
||||
grouped.dept_id AS companyId,
|
||||
grouped.config_type AS configType,
|
||||
grouped.config_value AS configValue,
|
||||
grouped.config_rate AS configRate,
|
||||
IFNULL(order_stat.order_count, 0) AS orderCount
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
dept_id,
|
||||
type_id,
|
||||
config_type,
|
||||
SUM(config_value) AS config_value,
|
||||
SUM(config_rate) AS config_rate
|
||||
FROM ma_dept_config
|
||||
GROUP BY dept_id, type_id, config_type
|
||||
) grouped
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = grouped.dept_id
|
||||
LEFT JOIN ma_type my ON my.type_id = grouped.type_id
|
||||
|
||||
-- 设备订单数量子查询
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
sd.dept_id AS dept_id,
|
||||
mt2.type_id AS parent_type_id,
|
||||
COUNT(md.ma_id) AS order_count
|
||||
FROM
|
||||
ma_order_details md
|
||||
LEFT JOIN ma_order_info moi ON md.order_id = moi.order_id
|
||||
LEFT JOIN ma_dev_info mdi ON md.ma_id = mdi.ma_id
|
||||
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
LEFT JOIN sys_dept sd ON moi.buyer_company = sd.dept_id
|
||||
GROUP BY sd.dept_id, mt2.type_id
|
||||
) order_stat
|
||||
ON order_stat.dept_id = grouped.dept_id
|
||||
AND order_stat.parent_type_id = grouped.type_id
|
||||
WHERE 1 = 1
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
<select id="selectDeptConfigTypeSummary"
|
||||
resultType="com.bonus.material.equipment.domain.DeptConfigTypeSummary">
|
||||
SELECT mt1.type_name AS typeName,
|
||||
mt2.type_name AS parentTypeName,
|
||||
CAST(mdc.config_rate AS DECIMAL(10, 2)) AS configRate,
|
||||
mdc.config_description AS configDescription
|
||||
FROM ma_dept_config mdc
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = mdc.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
||||
WHERE mdc.dept_id = #{deptId}
|
||||
</select>
|
||||
<select id="detailsInfo" resultType="com.bonus.material.equipment.domain.EquipmentDetail">
|
||||
SELECT
|
||||
d.dept_id AS companyId,
|
||||
d.vol as labelVol,
|
||||
mt3.type_id as typeId,
|
||||
mt3.type_name AS NAME,-- 使用层级表当前类型作为名称
|
||||
d.config_description AS `desc`,
|
||||
d.config_rate AS `value`,
|
||||
d.config_type AS configType,
|
||||
CONCAT_WS( '>', NULLIF( mt1.type_name, '' ), NULLIF( mt2.type_name, '' ), NULLIF( mt3.type_name, '' ) ) AS combinedName,
|
||||
(
|
||||
SELECT
|
||||
COUNT( md.ma_id )
|
||||
FROM
|
||||
ma_order_details md
|
||||
LEFT JOIN ma_order_info moi ON md.order_id = moi.order_id
|
||||
LEFT JOIN ma_dev_info mdi ON md.ma_id = mdi.ma_id
|
||||
LEFT JOIN ma_type mto1 ON mdi.type_id = mto1.type_id
|
||||
LEFT JOIN ma_type mto2 ON mto1.parent_id = mto2.type_id
|
||||
WHERE
|
||||
moi.buyer_company = d.dept_id
|
||||
AND mto2.type_id = d.type_id
|
||||
) AS orderCount,
|
||||
SUM(
|
||||
CAST(
|
||||
d.config_value AS DECIMAL ( 10, 2 ))) AS standard,
|
||||
MAX( own_count ) AS own,
|
||||
MAX( rent_count ) AS rent
|
||||
FROM
|
||||
ma_dept_config d -- 层级关系连接(当前类型 → 父级 → 祖父级)
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = d.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt3.parent_id
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id -- 自有设备统计子查询(完整语句)
|
||||
LEFT JOIN ( SELECT ma_name, SUM( ma_num ) AS own_count FROM ma_own_manage WHERE type = '2' AND is_active = '0' AND company_id = #{companyId} GROUP BY ma_name ) own ON CAST( d.type_id AS CHAR ) = own.ma_name -- 租赁设备统计子查询(完整语句)
|
||||
LEFT JOIN ( SELECT ma_name, SUM( ma_num ) AS rent_count FROM ma_own_manage WHERE type = '1' AND is_active = '0' AND company_id = #{companyId} GROUP BY ma_name ) rent ON CAST( d.type_id AS CHAR ) = rent.ma_name
|
||||
WHERE
|
||||
d.dept_id = #{companyId}
|
||||
<choose>
|
||||
<when test="configType == 0">
|
||||
AND d.config_type IN (0, 3)
|
||||
</when>
|
||||
<when test="configType == 1">
|
||||
AND d.config_type IN (1, 4)
|
||||
</when>
|
||||
<when test="configType == 2">
|
||||
AND d.config_type IN (2, 5)
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="configType != null">
|
||||
AND d.config_type = #{configType}
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
|
||||
GROUP BY
|
||||
d.dept_id,
|
||||
d.config_type,
|
||||
d.type_id
|
||||
</select>
|
||||
<select id="listFromDevInfo" resultType="com.bonus.material.equipment.domain.NewmydevInfo">
|
||||
SELECT
|
||||
md.own_co AS companyId,
|
||||
mt2.type_id AS typeId,
|
||||
mt2.type_name as typeName,
|
||||
SUM( 1 ) AS ownCount
|
||||
FROM
|
||||
ma_dev_info md
|
||||
LEFT JOIN ma_type mt ON mt.type_id = md.type_id
|
||||
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
|
||||
WHERE
|
||||
md.is_active = '1'
|
||||
AND md.own_co = #{companyId}
|
||||
|
||||
GROUP BY
|
||||
mt2.type_id
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -683,4 +683,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ORDER BY
|
||||
md.rent_over_time DESC
|
||||
</select>
|
||||
<select id="getDemandUnit" resultType="java.lang.Integer">
|
||||
SELECT COUNT(DISTINCT publish_company) FROM ma_lease_info
|
||||
</select>
|
||||
|
||||
<select id="getDevNumList" resultType="com.bonus.material.device.domain.DevInfo">
|
||||
SELECT
|
||||
mdi.own_co AS ownCo,
|
||||
sd.dept_name AS comName,
|
||||
count( mdi.device_count ) AS deviceCount
|
||||
FROM
|
||||
ma_dev_info mdi
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.own_co
|
||||
WHERE
|
||||
mdi.is_active = '1'
|
||||
AND mdi.ma_status IN ( 1, 2, 3 )
|
||||
GROUP BY
|
||||
mdi.own_co
|
||||
ORDER BY
|
||||
deviceCount DESC
|
||||
</select>
|
||||
|
||||
<select id="getDevNumDetailsList" resultType="com.bonus.material.device.domain.DevInfoDt">
|
||||
SELECT
|
||||
mdi.device_name AS deviceName,
|
||||
CONCAT( mt1.type_name, '/', mt2.type_name, '/', mt3.type_name ) AS categoryName,
|
||||
mt4.unit_name AS unitName,
|
||||
mdi.brand AS brand,
|
||||
mdi.production_date AS productionDate,
|
||||
mdi.person AS person,
|
||||
mdi.person_phone AS personPhone,
|
||||
mdi.device_count AS deviceCount,
|
||||
su.nick_name AS creatorName,
|
||||
mdi.create_time AS createTime,
|
||||
sd.dept_name AS comName
|
||||
FROM
|
||||
ma_dev_info mdi
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = mdi.type_id
|
||||
AND mt4.del_flag = '0'
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt4.parent_id
|
||||
AND mt3.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt3.parent_id
|
||||
AND mt2.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN sys_user su ON mdi.creator = su.user_id
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.own_co
|
||||
WHERE
|
||||
mdi.is_active = '1'
|
||||
AND mdi.ma_status IN ( 1, 2, 3 )
|
||||
AND mdi.own_co = #{ownCo}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,110 @@
|
|||
<?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.owner.mapper.OwnerMapper">
|
||||
<resultMap id="OwnerDominMap" type="com.bonus.material.owner.domain.Ownerdomin">
|
||||
<id property="id" column="id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="maNameId" column="type_id"/>
|
||||
<result property="companyId" column="company_id"/>
|
||||
<result property="maType" column="ma_type"/>
|
||||
<result property="maName" column="type_name"/>
|
||||
<result property="modelId" column="modelId"/>
|
||||
<result property="maModel" column="ma_model"/>
|
||||
<result property="maNum" column="ma_num"/>
|
||||
|
||||
<!-- 嵌套查询附件 -->
|
||||
<collection property="mainFileList" ofType="com.bonus.common.biz.domain.BmFileInfo"
|
||||
select="selectFilesByTaskId" column="id"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="add" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ma_own_manage(
|
||||
ma_type, ma_name, model_id, ma_model, ma_num,
|
||||
creator, remark,company_id,type)
|
||||
values(#{maType}, #{maName}, #{modelId}, #{maModel}, #{maNum}, #{creator}, #{remark}, #{companyId},#{type})
|
||||
</insert>
|
||||
<update id="edit">
|
||||
update ma_own_manage set
|
||||
ma_type = #{maType},
|
||||
ma_name = #{maNameId},
|
||||
model_id = #{modelId},
|
||||
ma_model = #{maModel},
|
||||
ma_num = #{maNum},
|
||||
creator = #{creator},
|
||||
remark = #{remark}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="del">
|
||||
update ma_own_manage set
|
||||
is_active =1
|
||||
where id = #{id}
|
||||
</update>
|
||||
<delete id="deleteFileInfo">
|
||||
delete FROM
|
||||
bm_rent_info
|
||||
WHERE
|
||||
task_id = #{id}
|
||||
</delete>
|
||||
<select id="selectFilesByTaskId" resultType="com.bonus.common.biz.domain.BmFileInfo">
|
||||
SELECT
|
||||
id,
|
||||
name AS fileName,
|
||||
url AS fileUrl
|
||||
FROM
|
||||
bm_rent_info
|
||||
WHERE
|
||||
task_id = #{id}
|
||||
</select>
|
||||
<select id="list" resultMap="OwnerDominMap">
|
||||
SELECT
|
||||
m.id,
|
||||
m.type,
|
||||
t.type_id ,
|
||||
m.company_id,
|
||||
m.ma_type ,
|
||||
t.type_name ,
|
||||
m.model_id ,
|
||||
m.ma_model ,
|
||||
m.ma_num
|
||||
FROM
|
||||
ma_own_manage m
|
||||
LEFT JOIN
|
||||
ma_type t ON m.ma_name = t.type_id
|
||||
<where>
|
||||
is_active = 0
|
||||
<if test="type!= null and type != ''">
|
||||
and type like concat('%', #{type}, '%')
|
||||
</if>
|
||||
<if test="maModel!= null and maModel != ''">
|
||||
and ma_model like concat('%', #{maModel}, '%')
|
||||
</if>
|
||||
<if test="maName != null and maName != ''">
|
||||
and ma_name like concat('%', #{maName}, '%')
|
||||
</if>
|
||||
<if test="companyId!= null and companyId != ''">
|
||||
and m.company_id = #{companyId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="listGrouped" resultType="com.bonus.material.equipment.domain.NewOwnerdomin">
|
||||
SELECT
|
||||
md.own_co AS companyId,
|
||||
sd.dept_name as companyName,
|
||||
mt2.type_name AS maName,
|
||||
mt2.type_id as typeId,
|
||||
COUNT(*) AS maNum
|
||||
FROM
|
||||
ma_dev_info md
|
||||
LEFT JOIN ma_type mt ON mt.type_id = md.type_id
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = md.own_co
|
||||
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
|
||||
WHERE
|
||||
md.is_active = '1'
|
||||
GROUP BY
|
||||
md.own_co,
|
||||
mt2.type_id
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue