Merge remote-tracking branch 'origin/master'

This commit is contained in:
jjLv 2024-11-11 15:36:30 +08:00
commit d351f39a50
14 changed files with 1663 additions and 5 deletions

View File

@ -0,0 +1,555 @@
package com.bonus.common.biz.constant;
/**
* 全局常量
* @author bns_han
*/
public class GlobalConstants {
/**
* 字符 A
*/
public static final char CHAR_A = 'A';
/**
* 字符 B
*/
public static final char CHAR_B = 'B';
/**
* 字符 C
*/
public static final char CHAR_C = 'C';
/**
* 字符 D
*/
public static final char CHAR_D = 'D';
/**
* 字符 E
*/
public static final char CHAR_E = 'E';
/**
* 字符 F
*/
public static final char CHAR_F = 'F';
/**
* 字符 G
*/
public static final char CHAR_G = 'G';
/**
* 字符 H
*/
public static final char CHAR_H = 'H';
/**
* 字符 I
*/
public static final char CHAR_I = 'I';
/**
* 字符 J
*/
public static final char CHAR_J = 'J';
/**
* 字符 K
*/
public static final char CHAR_K = 'K';
/**
* 字符 L
*/
public static final char CHAR_L = 'L';
/**
* 字符 M
*/
public static final char CHAR_M = 'M';
/**
* 字符 N
*/
public static final char CHAR_N = 'N';
/**
* 字符 O
*/
public static final char CHAR_O = 'O';
/**
* 字符 P
*/
public static final char CHAR_P = 'P';
/**
* 字符 Q
*/
public static final char CHAR_Q = 'Q';
/**
* 字符 R
*/
public static final char CHAR_R = 'R';
/**
* 字符 S
*/
public static final char CHAR_S = 'S';
/**
* 字符 T
*/
public static final char CHAR_T = 'T';
/**
* 字符 U
*/
public static final char CHAR_U = 'U';
/**
* 字符 V
*/
public static final char CHAR_V = 'V';
/**
* 字符 W
*/
public static final char CHAR_W = 'W';
/**
* 字符 X
*/
public static final char CHAR_X = 'X';
/**
* 字符 Y
*/
public static final char CHAR_Y = 'Y';
/**
* 字符 Z
*/
public static final char CHAR_Z = 'Z';
/**
* 字符 a
*/
public static final char CHAR_SMALL_A = 'a';
/**
* 字符 b
*/
public static final char CHAR_SMALL_B = 'b';
/**
* 字符 c
*/
public static final char CHAR_SMALL_C = 'c';
/**
* 字符 d
*/
public static final char CHAR_SMALL_D = 'd';
/**
* 字符 e
*/
public static final char CHAR_SMALL_E = 'e';
/**
* 字符 f
*/
public static final char CHAR_SMALL_F = 'f';
/**
* 字符 g
*/
public static final char CHAR_SMALL_G = 'g';
/**
* 字符 h
*/
public static final char CHAR_SMALL_H = 'h';
/**
* 字符 i
*/
public static final char CHAR_SMALL_I = 'i';
/**
* 字符 j
*/
public static final char CHAR_SMALL_J = 'j';
/**
* 字符 k
*/
public static final char CHAR_SMALL_K = 'k';
/**
* 字符 l
*/
public static final char CHAR_SMALL_L = 'l';
/**
* 字符 m
*/
public static final char CHAR_SMALL_M = 'm';
/**
* 字符 n
*/
public static final char CHAR_SMALL_N = 'n';
/**
* 字符 o
*/
public static final char CHAR_SMALL_O = 'o';
/**
* 字符 p
*/
public static final char CHAR_SMALL_P = 'p';
/**
* 字符 q
*/
public static final char CHAR_SMALL_Q = 'q';
/**
* 字符 r
*/
public static final char CHAR_SMALL_R = 'r';
/**
* 字符 s
*/
public static final char CHAR_SMALL_S = 's';
/**
* 字符 t
*/
public static final char CHAR_SMALL_T = 't';
/**
* 字符 u
*/
public static final char CHAR_SMALL_U = 'u';
/**
* 字符 v
*/
public static final char CHAR_SMALL_V = 'v';
/**
* 字符 w
*/
public static final char CHAR_SMALL_W = 'w';
/**
* 字符 x
*/
public static final char CHAR_SMALL_X = 'x';
/**
* 字符 y
*/
public static final char CHAR_SMALL_Y = 'y';
/**
* 字符 z
*/
public static final char CHAR_SMALL_Z = 'z';
/**
* 字符 0
*/
public static final char CHAR_0 = '0';
/**
* 字符 9
*/
public static final char CHAR_9 = '9';
/**
* 整数 2
*/
public static final int INT_2 = 2;
/**
* 整数 3
*/
public static final int INT_3 = 3;
/**
* 整数 4
*/
public static final int INT_4 = 4;
/**
* 整数 5
*/
public static final int INT_5 = 5;
/**
* 整数 6
*/
public static final int INT_6 = 6;
/**
* 整数 7
*/
public static final int INT_7 = 7;
/**
* 整数 8
*/
public static final int INT_8 = 8;
/**
* 整数 9
*/
public static final int INT_9 = 9;
/**
* 整数 10
*/
public static final int INT_10 = 10;
/**
* 整数 11
*/
public static final int INT_11 = 11;
/**
* 整数 12
*/
public static final int INT_12 = 12;
/**
* 整数 13
*/
public static final int INT_13 = 13;
/**
* 整数 15
*/
public static final int INT_15 = 15;
/**
* 整数 16
*/
public static final int INT_16 = 16;
/**
* 整数 25
*/
public static final int INT_25 = 25;
/**
* 整数 26
*/
public static final int INT_26 = 26;
/**
* 整数 41
*/
public static final int INT_41 = 41;
/**
* 整数 51
*/
public static final int INT_51 = 51;
/**
* 整数 52
*/
public static final int INT_52 = 52;
/**
* 整数 55
*/
public static final int INT_55 = 55;
/**
* 整数 56
*/
public static final int INT_56 = 56;
/**
* 整数 57
*/
public static final int INT_57 = 57;
/**
* 整数 61
*/
public static final int INT_61 = 61;
/**
* 整数 62
*/
public static final int INT_62 = 62;
/**
* 整数 63
*/
public static final int INT_63 = 63;
/**
* 整数 64
*/
public static final int INT_64 = 64;
/**
* 整数 66
*/
public static final int INT_66 = 66;
/**
* 整数 70
*/
public static final int INT_70 = 70;
/**
* 整数 71
*/
public static final int INT_71 = 71;
/**
* 整数 72
*/
public static final int INT_72 = 72;
/**
* 整数 73
*/
public static final int INT_73 = 73;
/**
* 整数 74
*/
public static final int INT_74 = 74;
/**
* 整数 77
*/
public static final int INT_77 = 77;
/**
* 整数 78
*/
public static final int INT_78 = 78;
/**
* 整数 80
*/
public static final int INT_80 = 80;
/**
* 整数 81
*/
public static final int INT_81 = 81;
/**
* 整数 82
*/
public static final int INT_82 = 82;
/**
* 整数 91
*/
public static final int INT_91 = 91;
/**
* 整数 97
*/
public static final int INT_97 = 97;
/**
* 整数 98
*/
public static final int INT_98 = 98;
/**
* 整数 99
*/
public static final int INT_99 = 99;
/**
* 整数 100
*/
public static final int INT_100 = 100;
/**
* 整数 1000
*/
public static final int INT_1000 = 1000;
/**
* 整数 255
*/
public static final int INT_255 = 255;
/**
* 整数 0x3
*/
public static final int INT_0X3 = 0x3;
/**
* 整数 0xf
*/
public static final int INT_0XF = 0xf;
/**
* 字符串 1
*/
public static final String STRING_1 = "1";
/**
* 字符串 2
*/
public static final String STRING_2 = "2";
/**
* 字符串 3
*/
public static final String STRING_3 = "3";
/**
* 字符串 4
*/
public static final String STRING_4 = "4";
/**
* 字符串 5
*/
public static final String STRING_5 = "5";
/**
* 字符串 []
*/
public static final String STRING = "[]";
/**
* 字符串 JPG
*/
public static final String STRING_JPG = "JPG";
/**
* 字符串 PNG
*/
public static final String STRING_PNG = "PNG";
/**
* 字符串
*/
public static final String STRING_注 = "注:";
/**
* 字符串 .
*/
public static final String STRING_DROP = ".";
/**
* 字符串 ..
*/
public static final String STRING_DROP_DROP = "..";
/**
* 字符串 MSIE
*/
public static final String STRING_MSIE = "MSIE";
/**
* 字符串 Firefox
*/
public static final String STRING_FIREFOX = "Firefox";
/**
* 字符串 Chrome
*/
public static final String STRING_CHROME = "Chrome";
/**
* 字符串 #//
*/
public static final String STRING_HASH_HASH = "#//";
/**
* 字符串 unknown
*/
public static final String STRING_UNKNOWN = "unknown";
/**
* 字符串 ,
*/
public static final String STRING_COMMA = ",";
/**
* 字符串 *
*/
public static final String STRING_ASTERISK = "*";
/**
* 字符串 ascending
*/
public static final String STRING_ASCENDING = "ascending";
/**
* 字符串 descending
*/
public static final String STRING_DESCENDING = "descending";
/**
* 字符串 application/json
*/
public static final String STRING_APPLICATION_JSON = "application/json";
/**
* 字符串 XMLHttpRequest
*/
public static final String STRING_XML_HTTP_REQUEST = "XMLHttpRequest";
/**
* 字符串 .json
*/
public static final String STRING_JSON = ".json";
/**
* 字符串 .xml
*/
public static final String STRING_XML = ".xml";
/**
* 字符串 _
*/
public static final String STRING_UNDERLINE = "_";
/**
* 字符串 win
*/
public static final String STRING_WIN = "win";
/**
* 字符串 ok
*/
public static final String STRING_OK = "ok";
/**
* 字符串 true
*/
public static final String STRING_TRUE = "true";
/**
* 字符串 sys.account.registerUser
*/
public static final String STRING_SYS_ACCOUNT_REGISTER_USER = "sys.account.registerUser";
/**
* Long 4294967295L
*/
public static final Long LONG_4294967295 = 4294967295L;
/**
* Long 255L
*/
public static final Long LONG_255 = 255L;
/**
* Long 16777215L
*/
public static final Long LONG_16777215 = 16777215L;
/**
* Long 65535L
*/
public static final Long LONG_65535 = 65535L;
public static final int NUM_9 = 9;
public static final int NUM_100 = 100;
public static final int NUM_99 = 99;
public static final int NUM_1000 = 1000;
}

View File

@ -87,7 +87,11 @@ public class BmAgreementInfoController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody BmAgreementInfo bmAgreementInfo)
{
return toAjax(bmAgreementInfoService.insertBmAgreementInfo(bmAgreementInfo));
try {
return bmAgreementInfoService.insertBmAgreementInfo(bmAgreementInfo);
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}
/**

View File

@ -1,5 +1,6 @@
package com.bonus.material.basic.mapper;
import java.util.Date;
import java.util.List;
import com.bonus.material.basic.domain.BmAgreementInfo;
@ -58,4 +59,6 @@ public interface BmAgreementInfoMapper
* @return 结果
*/
public int deleteBmAgreementInfoByAgreementIds(Long[] agreementIds);
public int selectNumByMonth(Date nowDate);
}

View File

@ -1,6 +1,8 @@
package com.bonus.material.basic.service;
import java.util.List;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.basic.domain.BmAgreementInfo;
/**
@ -33,7 +35,7 @@ public interface IBmAgreementInfoService
* @param bmAgreementInfo 协议管理
* @return 结果
*/
public int insertBmAgreementInfo(BmAgreementInfo bmAgreementInfo);
public AjaxResult insertBmAgreementInfo(BmAgreementInfo bmAgreementInfo);
/**
* 修改协议管理

View File

@ -1,12 +1,20 @@
package com.bonus.material.basic.service.impl;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import com.bonus.common.biz.constant.GlobalConstants;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
import com.bonus.material.basic.domain.BmAgreementInfo;
import com.bonus.material.basic.service.IBmAgreementInfoService;
import org.springframework.util.CollectionUtils;
/**
* 协议管理Service业务层处理
@ -51,10 +59,38 @@ public class BmAgreementInfoServiceImpl implements IBmAgreementInfoService
* @return 结果
*/
@Override
public int insertBmAgreementInfo(BmAgreementInfo bmAgreementInfo)
public AjaxResult insertBmAgreementInfo(BmAgreementInfo bmAgreementInfo)
{
bmAgreementInfo.setCreateTime(DateUtils.getNowDate());
return bmAgreementInfoMapper.insertBmAgreementInfo(bmAgreementInfo);
List<BmAgreementInfo> list = bmAgreementInfoMapper.selectBmAgreementInfoList(bmAgreementInfo);
if (!CollectionUtils.isEmpty(list) && list.size() > 0) {
return AjaxResult.error("已存在重复数据");
}
try {
bmAgreementInfo.setCreateTime(DateUtils.getNowDate());
bmAgreementInfo.setCreateBy(SecurityUtils.getUsername());
bmAgreementInfo.setAgreementCode(getAgreementCode());
return AjaxResult.success(bmAgreementInfoMapper.insertBmAgreementInfo(bmAgreementInfo));
} catch (Exception e) {
throw new ServiceException("错误信息描述");
}
}
private String getAgreementCode() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate);
String result = format.replace("-", "");
int num = bmAgreementInfoMapper.selectNumByMonth(nowDate);
num = num + 1;
String code = "";
if (num > GlobalConstants.NUM_9 && num < GlobalConstants.NUM_100) {
code = "XY" + result + "-00" + num;
} else if (num > GlobalConstants.NUM_99 && num < GlobalConstants.NUM_1000) {
code = "XY" + result + "-0" + num;
} else {
code = "XY" + result + "-000" + num;
}
return code;
}
/**

View File

@ -0,0 +1,127 @@
package com.bonus.material.common.controller;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.common.domain.dto.SelectDto;
import com.bonus.material.common.service.SelectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @author 10488
* 统一下拉选
*/
@Api(tags = "统一下拉选接口")
@RestController
@RequestMapping("/select/")
public class SelectController {
@Resource(name = "SelectService")
private SelectService service;
@ApiOperation(value = "往来单位下拉选")
@PostMapping("getUnitCbx")
public AjaxResult getUnitData(@RequestBody SelectDto dto) {
return service.getUnitData(dto);
}
@ApiOperation(value = "工程下拉选")
@PostMapping("getSectionEngineeringCbx")
public AjaxResult getProData(@RequestBody SelectDto dto) {
return service.getProData(dto);
}
@ApiOperation(value = "机具类型下拉选")
@PostMapping("getMaTypeData")
public AjaxResult getMaTypeData(@RequestBody SelectDto dto){
return service.getMaTypeData(dto);
}
@ApiOperation(value = "数据字典下拉选")
@PostMapping("getDictByPidCbx")
public AjaxResult getDictByPidCbx(@RequestBody SelectDto dto){
return service.getDictByPidCbx(dto);
}
@ApiOperation(value = "单位树/归属部门/所属上级")
@PostMapping("getDeptTree")
public AjaxResult getDeptTree(@RequestBody SelectDto dto){
return service.getDeptTree(dto);
}
@ApiOperation(value = "岗位下拉选")
@PostMapping("getPostCbx")
public AjaxResult getPostCbx(@RequestBody SelectDto dto){
return service.getPostCbx(dto);
}
@ApiOperation(value = "角色下拉选")
@PostMapping("getRoleCbx")
public AjaxResult getRoleCbx(@RequestBody SelectDto dto){
return service.getRoleCbx(dto);
}
@ApiOperation(value = "单位类型下拉选")
@PostMapping("getUnitTypeCbx")
public AjaxResult getUnitTypeCbx(@RequestBody SelectDto dto){
return service.getUnitTypeCbx(dto);
}
@ApiOperation(value = "设备类型树")
@PostMapping("getDeviceTypeTree")
public AjaxResult getDeviceTypeTree(@RequestBody SelectDto dto){
return service.getDeviceTypeTree(dto);
}
@ApiOperation(value = "资产属性")
@PostMapping("getAssetAttributesCbx")
public AjaxResult getAssetAttributesCbx(@RequestBody SelectDto dto){
return service.getAssetAttributesCbx(dto);
}
@ApiOperation(value = "机具厂家")
@PostMapping("getDeviceFactoryCbx")
public AjaxResult getDeviceFactoryCbx(@RequestBody SelectDto dto){
return service.getDeviceFactoryCbx(dto);
}
@ApiOperation(value = "工程项目")
@PostMapping("getProCbx")
public AjaxResult getProCbx(@RequestBody SelectDto dto){
return service.getProCbx(dto);
}
@ApiOperation(value = "配件所属上级树")
@PostMapping("getAccessoryTree")
public AjaxResult getAccessoryTree(){
return service.getAccessoryTree();
}
@ApiOperation(value = "配件所属上级树")
@PostMapping("getPartTree")
public AjaxResult getPartTree(@RequestBody SelectDto dto){
return service.getPartTree(dto);
}
@ApiOperation(value = "货架")
@PostMapping("getGoodsShelvesCbx")
public AjaxResult getGoodsShelvesCbx(@RequestBody SelectDto dto){
return service.getGoodsShelvesCbx(dto);
}
@ApiOperation(value = "用户/维修员/库管员/采购员")
@PostMapping("getUserByRoleIdCbx")
public AjaxResult getUserByRoleIdCbx(@RequestBody SelectDto dto){
return service.getUserByRoleIdCbx(dto);
}
@ApiOperation(value = "往来单位id和标段工程id获取协议信息")
@PostMapping("getAgreementInfoById")
public AjaxResult getAgreementInfoById(@RequestBody SelectDto dto){
return service.getAgreementInfoById(dto);
}
}

View File

@ -0,0 +1,32 @@
package com.bonus.material.common.domain.dto;
import lombok.Data;
/**
* @author 10488
*/
@Data
public class SelectDto {
/** 参数id*/
private String id;
/** 2.物品种类 3.设备类型 4.规格型号*/
private String type;
/** 字典表 父类值*/
private String parentValue;
/** 层级*/
private String level;
/** 角色权限字符串*/
private String roleKey;
/** 往来单位id*/
private int unitId;
/** 标段工程id*/
private int projectId;
}

View File

@ -0,0 +1,20 @@
package com.bonus.material.common.domain.vo;
import lombok.Data;
/**
* @author 10488
* 协议信息
*/
@Data
public class AgreementVo {
/** 协议ID*/
private Integer agreementId;
/** 协议编号*/
private String agreementCode;
/** 是否结算*/
private String isSlt;
}

View File

@ -0,0 +1,16 @@
package com.bonus.material.common.domain.vo;
import lombok.Data;
/**
* @author 10488
*/
@Data
public class SelectVo {
/** id*/
private long id;
/** 名称*/
private String name;
}

View File

@ -0,0 +1,192 @@
package com.bonus.material.common.mapper;
import com.bonus.common.biz.domain.TreeNode;
import com.bonus.material.common.domain.dto.SelectDto;
import com.bonus.material.common.domain.vo.AgreementVo;
import com.bonus.material.common.domain.vo.SelectVo;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author 10488
* 统一下拉选
*/
@Repository("SelectMapper")
public interface SelectMapper {
/**
* 往来单位下拉选
* @param dto
* @return List<SelectVo>
* @description 往来单位
* @author cwchen
* @date 2023/12/20 14:23
*/
List<SelectVo> getUnitData(SelectDto dto);
/**
* 工程下拉选
* @param dto
* @return List<SelectVo>
* @description 工程
* @author cwchen
* @date 2023/12/20 15:05
*/
List<SelectVo> getProData(SelectDto dto);
/**
* 机具类型下拉选
* @param dto
* @return List<SelectVo>
* @description 机具类型
* @author cwchen
* @date 2023/12/20 16:02
*/
List<SelectVo> getMaTypeData(SelectDto dto);
/**
* 数据字典下拉选
* @param dto
* @return List<SelectVo>
* @description 数据字典下拉选
* @author cwchen
* @date 2023/12/20 16:23
*/
List<SelectVo> getDictByPidCbx(SelectDto dto);
/**
* 单位树/归属部门/所属上级
* @param dto
* @return List<TreeVo>
* @description 单位树/归属部门/所属上级
* @author cwchen
* @date 2023/12/20 17:10
*/
List<TreeNode> getDeptTree(SelectDto dto);
/**
* 岗位下拉选
* @param dto
* @return List<SelectVo>
* @description 岗位下拉选
* @author cwchen
* @date 2023/12/20 17:50
*/
List<SelectVo> getPostCbx(SelectDto dto);
/**
* 角色下拉选
* @param dto
* @return List<SelectVo>
* @description 角色下拉选
* @author cwchen
* @date 2023/12/20 17:56
*/
List<SelectVo> getRoleCbx(SelectDto dto);
/**
* 单位类型下拉选
* @param dto
* @return List<SelectVo>
* @description 单位类型下拉选
* @author cwchen
* @date 2023/12/20 18:01
*/
List<SelectVo> getUnitTypeCbx(SelectDto dto);
/**
* 设备类型树
* @param dto
* @return List<TreeNode>
* @description 设备类型树
* @author cwchen
* @date 2023/12/20 18:15
*/
List<TreeNode> getDeviceTypeTree(SelectDto dto);
/**
* 资产属性
* @param dto
* @return List<SelectVo>
* @description 资产属性
* @author cwchen
* @date 2023/12/20 19:48
*/
List<SelectVo> getAssetAttributesCbx(SelectDto dto);
/**
* 机具厂家
* @param dto
* @return List<SelectVo>
* @description 机具厂家
* @author cwchen
* @date 2023/12/20 19:57
*/
List<SelectVo> getDeviceFactoryCbx(SelectDto dto);
/**
* 工程项目
* @param dto
* @return List<SelectVo>
* @description 工程项目
* @author cwchen
* @date 2023/12/20 20:01
*/
List<SelectVo> getProCbx(SelectDto dto);
/**
* 配件所属上级树
* @param
* @return List<TreeNode>
* @description 配件所属上级树
* @author cwchen
* @date 2023/12/20 20:26
*/
List<TreeNode> getAccessoryTree();
/**
* 货架
* @param dto
* @return List<TreeNode>
* @description 货架
* @author cwchen
* @date 2023/12/20 20:36
*/
List<TreeNode> getGoodsShelvesCbx(SelectDto dto);
/**
* 用户/维修员/库管员/采购员-下拉选
* @param dto
* @return List<SelectVo>
* @description 用户/维修员/库管员/采购员-下拉选
* @author cwchen
* @date 2023/12/20 20:54
*/
List<SelectVo> getUserByRoleIdCbxSelect(SelectDto dto);
/**
* 用户/维修员/库管员/采购员-
* @param dto
* @return List<TreeNode>
* @description 用户/维修员/库管员/采购员-
* @author cwchen
* @date 2023/12/20 21:02
*/
List<TreeNode> getUserByRoleIdCbxTree(SelectDto dto);
/**
* 往来单位id和标段工程id获取协议信息
* @param dto
* @return AgreementVo
* @description 往来单位id和标段工程id获取协议信息
* @author cwchen
* @date 2023/12/21 10:53
*/
List<AgreementVo> getAgreementInfoById(SelectDto dto);
/**
* 配件所属上级树
* @param dto
* @return List<TreeNode>
*/
List<TreeNode> getPartTree(SelectDto dto);
}

View File

@ -0,0 +1,178 @@
package com.bonus.material.common.service;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.common.domain.dto.SelectDto;
/**
* @author 10488
* 统一下拉选
*/
public interface SelectService {
/**
* 往来单位
* @param dto
* @return AjaxResult
* @description 往来单位
* @author cwchen
* @date 2023/12/20 14:20
*/
AjaxResult getUnitData(SelectDto dto);
/**
* 工程
* @param dto
* @return AjaxResult
* @description 工程
* @author cwchen
* @date 2023/12/20 15:04
*/
AjaxResult getProData(SelectDto dto);
/**
* 机具类型
* @param dto
* @return AjaxResult
* @description 机具类型
* @author cwchen
* @date 2023/12/20 16:02
*/
AjaxResult getMaTypeData(SelectDto dto);
/**
* 数据字典下拉选
* @param dto
* @return AjaxResult
* @description 数据字典下拉选
* @author cwchen
* @date 2023/12/20 16:22
*/
AjaxResult getDictByPidCbx(SelectDto dto);
/**
* 单位树/归属部门/所属上级
* @param dto
* @return AjaxResult
* @description 单位树/归属部门/所属上级
* @author cwchen
* @date 2023/12/20 16:36
*/
AjaxResult getDeptTree(SelectDto dto);
/**
* 岗位下拉树
* @param dto
* @return AjaxResult
* @description 岗位下拉树
* @author cwchen
* @date 2023/12/20 17:45
*/
AjaxResult getPostCbx(SelectDto dto);
/**
* 角色下拉选
* @param dto
* @return AjaxResult
* @description 角色下拉选
* @author cwchen
* @date 2023/12/20 17:56
*/
AjaxResult getRoleCbx(SelectDto dto);
/**
* 单位类型下拉选
* @param dto
* @return AjaxResult
* @description 单位类型下拉选
* @author cwchen
* @date 2023/12/20 18:00
*/
AjaxResult getUnitTypeCbx(SelectDto dto);
/**
* 设备类型树
* @param dto
* @return AjaxResult
* @description 设备类型树
* @author cwchen
* @date 2023/12/20 18:14
*/
AjaxResult getDeviceTypeTree(SelectDto dto);
/**
* 资产属性
* @param dto
* @return AjaxResult
* @description 资产属性
* @author cwchen
* @date 2023/12/20 19:47
*/
AjaxResult getAssetAttributesCbx(SelectDto dto);
/**
* 机具厂家
* @param dto
* @return AjaxResult
* @description 机具厂家
* @author cwchen
* @date 2023/12/20 19:56
*/
AjaxResult getDeviceFactoryCbx(SelectDto dto);
/**
* 工程项目
* @param dto
* @return AjaxResult
* @description 工程项目
* @author cwchen
* @date 2023/12/20 20:01
*/
AjaxResult getProCbx(SelectDto dto);
/**
* 配件所属上级树
* @param
* @return AjaxResult
* @description 配件所属上级树
* @author cwchen
* @date 2023/12/20 20:25
*/
AjaxResult getAccessoryTree();
/**
* 货架
* @param dto
* @return AjaxResult
* @description 货架
* @author cwchen
* @date 2023/12/20 20:36
*/
AjaxResult getGoodsShelvesCbx(SelectDto dto);
/**
* 用户/维修员/库管员/采购员
* @param dto
* @return AjaxResult
* @description 用户/维修员/库管员/采购员
* @author cwchen
* @date 2023/12/20 20:48
*/
AjaxResult getUserByRoleIdCbx(SelectDto dto);
/**
* 往来单位id和标段工程id获取协议信息
* @param dto
* @return AjaxResult
* @description 往来单位id和标段工程id获取协议信息
* @author cwchen
* @date 2023/12/21 10:47
*/
AjaxResult getAgreementInfoById(SelectDto dto);
/**
* 配件所属上级树
* @param dto
* @return AjaxResult
*/
AjaxResult getPartTree(SelectDto dto);
}

View File

@ -0,0 +1,274 @@
package com.bonus.material.common.service.impl;
import com.bonus.common.biz.constant.GlobalConstants;
import com.bonus.common.biz.domain.TreeBuild;
import com.bonus.common.biz.domain.TreeNode;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.common.domain.dto.SelectDto;
import com.bonus.material.common.domain.vo.AgreementVo;
import com.bonus.material.common.domain.vo.SelectVo;
import com.bonus.material.common.mapper.SelectMapper;
import com.bonus.material.common.service.SelectService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @author 10488
* 统一下拉选
*/
@Service("SelectService")
@Slf4j
public class SelectServiceImpl implements SelectService {
@Resource(name = "SelectMapper")
private SelectMapper mapper;
@Override
public AjaxResult getUnitData(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try {
list = mapper.getUnitData(dto);
} catch (Exception e) {
log.error("往来单位-查询失败", e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getProData(SelectDto dto) {
try {
List<SelectVo> list = mapper.getProData(dto);
list.removeIf(item -> item == null);
return AjaxResult.success(list);
} catch (Exception e) {
log.error("工程-查询失败", e);
}
return AjaxResult.success();
}
@Override
public AjaxResult getMaTypeData(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try {
list = mapper.getMaTypeData(dto);
} catch (Exception e) {
log.error("机具类型-查询失败", e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getDictByPidCbx(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try {
list = mapper.getDictByPidCbx(dto);
} catch (Exception e) {
log.error("数据字典-查询失败", e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getDeptTree(SelectDto dto) {
List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>();
try {
list = mapper.getDeptTree(dto);
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TreeBuild treeBuild = new TreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
} catch (Exception e) {
log.error("单位树/归属部门/所属上级-查询失败", e);
}
return AjaxResult.success(groupList);
}
@Override
public AjaxResult getPostCbx(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try {
list = mapper.getPostCbx(dto);
} catch (Exception e) {
log.error("岗位下拉选-查询失败", e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getRoleCbx(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try {
list = mapper.getRoleCbx(dto);
} catch (Exception e) {
log.error("角色下拉选-查询失败", e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getUnitTypeCbx(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try {
list = mapper.getUnitTypeCbx(dto);
} catch (Exception e) {
log.error("单位类型下拉选-查询失败", e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getDeviceTypeTree(SelectDto dto) {
List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>();
try {
list = mapper.getDeviceTypeTree(dto);
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TreeBuild treeBuild = new TreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
} catch (Exception e) {
log.error("单位树/归属部门/所属上级-查询失败", e);
}
return AjaxResult.success(groupList);
}
@Override
public AjaxResult getAssetAttributesCbx(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try {
list = mapper.getAssetAttributesCbx(dto);
} catch (Exception e) {
log.error("资产属性-查询失败", e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getDeviceFactoryCbx(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try {
list = mapper.getDeviceFactoryCbx(dto);
} catch (Exception e) {
log.error("机具厂家-查询失败", e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getProCbx(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try {
list = mapper.getProCbx(dto);
} catch (Exception e) {
log.error("工程项目-查询失败", e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getAccessoryTree() {
List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>();
try {
list = mapper.getAccessoryTree();
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TreeBuild treeBuild = new TreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
} catch (Exception e) {
log.error("配件所属上级树-查询失败", e);
}
return AjaxResult.success(groupList);
}
@Override
public AjaxResult getPartTree(SelectDto dto) {
List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>();
try {
list = mapper.getPartTree(dto);
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TreeBuild treeBuild = new TreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
} catch (Exception e) {
log.error("配件所属上级树-查询失败", e);
}
return AjaxResult.success(groupList);
}
@Override
public AjaxResult getGoodsShelvesCbx(SelectDto dto) {
List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>();
try {
list = mapper.getGoodsShelvesCbx(dto);
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TreeBuild treeBuild = new TreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
} catch (Exception e) {
log.error("货架-查询失败", e);
}
return AjaxResult.success(groupList);
}
@Override
public AjaxResult getUserByRoleIdCbx(SelectDto dto) {
try {
if (Objects.equals(GlobalConstants.STRING_1, dto.getType())) {
// 用户/维修员/库管员/采购员-下拉选
List<SelectVo> list = new ArrayList<>();
list = mapper.getUserByRoleIdCbxSelect(dto);
return AjaxResult.success(list);
} else if (Objects.equals(GlobalConstants.STRING_2, dto.getType())) {
List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>();
// 用户/维修员/库管员/采购员-
list = mapper.getUserByRoleIdCbxTree(dto);
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TreeBuild treeBuild = new TreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
return AjaxResult.success(groupList);
}
} catch (Exception e) {
log.error("用户/维修员/库管员/采购员-查询失败", e);
}
return AjaxResult.success(null);
}
@Override
public AjaxResult getAgreementInfoById(SelectDto dto) {
AgreementVo vo = new AgreementVo();
try {
List<AgreementVo> list = mapper.getAgreementInfoById(dto);
if (CollectionUtils.isNotEmpty(list)) {
vo = list.get(0);
}
} catch (Exception e) {
log.error("往来单位id和标段工程id获取协议信息", e);
}
return AjaxResult.success(vo);
}
}

View File

@ -142,4 +142,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{agreementId}
</foreach>
</delete>
<select id="selectNumByMonth" resultType="java.lang.Integer">
select count(*) from bm_agreement_info where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m')
</select>
</mapper>

View File

@ -0,0 +1,215 @@
<?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.common.mapper.SelectMapper">
<!--往来单位-->
<select id="getUnitData" resultType="com.bonus.material.common.domain.vo.SelectVo">
/*根据标段工程id关联协议查询往来单位*/
<if test="id != null and id != ''">
SELECT DISTINCT bui.unit_id AS id,
bui.unit_name AS `name`
FROM bm_project_lot bpl
LEFT JOIN bm_agreement_info bai ON bpl.lot_id = bai.project_id AND bai.`status` = '1'
LEFT JOIN bm_unit_info bui ON bai.unit_id = bui.unit_id AND bui.del_flag = '0'
WHERE bpl.lot_id = #{id} AND bpl.del_flag = '0'
</if>
<if test="id == null or id == ''">
SELECT unit_id AS id,
unit_name AS `name`
FROM bm_unit_info
WHERE del_flag = '0'
</if>
</select>
<!--标段工程-->
<select id="getProData" resultType="com.bonus.material.common.domain.vo.SelectVo">
/*根据往来单位id关联协议查询工程*/
<if test="id != null and id != ''">
SELECT DISTINCT bpl.lot_id AS id,
bpl.lot_name AS `name`
FROM bm_unit_info bui
LEFT JOIN bm_agreement_info bai ON bui.unit_id = bai.unit_id AND bai.`status` = '1'
LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id AND bpl.del_flag = '0'
WHERE bui.unit_id = #{id} AND bui.del_flag = '0'
</if>
<if test="id == null or id == ''">
SELECT lot_id AS id,
lot_name AS `name`
FROM bm_project_lot
WHERE del_flag = '0'
</if>
</select>
<!--机具类型-->
<select id="getMaTypeData" resultType="com.bonus.material.common.domain.vo.SelectVo">
SELECT type_id AS id,
type_name AS `name`
FROM ma_type
WHERE `level` = #{type} AND del_flag = '0'
</select>
<!--数据字典下拉选-->
<select id="getDictByPidCbx" resultType="com.bonus.material.common.domain.vo.SelectVo">
SELECT sd2.id,sd2.`name`
FROM sys_dic sd
LEFT JOIN sys_dic sd2 ON sd.id = sd2.p_id
WHERE sd.`value` = #{parentValue} AND sd.p_id = 0
</select>
<!--单位树/归属部门/所属上级-->
<select id="getDeptTree" resultType="com.bonus.common.biz.domain.TreeNode">
SELECT dept_id AS id,
parent_id AS parentId,
dept_name AS label
FROM sys_dept
WHERE del_flag = '0'
ORDER BY order_num
</select>
<!--岗位下拉选-->
<select id="getPostCbx" resultType="com.bonus.material.common.domain.vo.SelectVo">
SELECT post_id AS id,
post_name AS `name`
FROM sys_post
WHERE status = '0'
ORDER BY post_sort
</select>
<!--角色下拉选-->
<select id="getRoleCbx" resultType="com.bonus.material.common.domain.vo.SelectVo">
SELECT role_id AS id,
role_name AS `name`
FROM sys_role
WHERE status = '0'
ORDER BY role_sort
</select>
<!--单位类型下拉选-->
<select id="getUnitTypeCbx" resultType="com.bonus.material.common.domain.vo.SelectVo">
SELECT sd2.id,sd2.`name`
FROM sys_dic sd
LEFT JOIN sys_dic sd2 ON sd.id = sd2.p_id
WHERE sd.`value` = #{parentValue} AND sd.p_id = 0
</select>
<!--设备类型树-->
<select id="getDeviceTypeTree" resultType="com.bonus.common.biz.domain.TreeNode">
SELECT mt.type_id AS id,
mt.type_name AS label,
mt.parent_id AS parentId,
mt.unit_name AS unitName,
CASE mt.manage_type
WHEN 0 THEN
IFNULL(subquery0.num, 0)
ELSE
IFNULL(mt.storage_num, 0)
END as num,
mt.model_code AS modelCode,
mt.manage_type AS manageType
FROM ma_type mt
left join (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
count(mm.ma_id) num
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE mm.ma_code is not null and mm.ma_status in (15)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
WHERE mt.del_flag = '0'
<if test="level!=null and level!=''">
<if test="level == 2">
AND mt.level IN ('1','2')
</if>
<if test="level == 3">
AND mt.level IN ('1','2','3')
</if>
<if test="level == 4">
AND mt.level IN ('1','2','3','4')
</if>
</if>
</select>
<!--资产属性-->
<select id="getAssetAttributesCbx" resultType="com.bonus.material.common.domain.vo.SelectVo">
SELECT prop_id AS id,
prop_name AS `name`
FROM ma_prop_info
WHERE del_flag = '0'
ORDER BY create_time
</select>
<!--机具厂家-->
<select id="getDeviceFactoryCbx" resultType="com.bonus.material.common.domain.vo.SelectVo">
SELECT supplier_id AS id,
supplier AS `name`
FROM ma_supplier_info
WHERE del_flag = '0'
ORDER BY create_time
</select>
<!--工程项目-->
<select id="getProCbx" resultType="com.bonus.material.common.domain.vo.SelectVo">
SELECT pro_id AS id,
pro_name AS `name`
FROM bm_project_info
WHERE del_flag = '0' AND status = '0'
ORDER BY create_time
</select>
<!--配件所属上级树-->
<select id="getAccessoryTree" resultType="com.bonus.common.biz.domain.TreeNode">
SELECT pa_id AS id,
pa_name AS label,
parent_id AS parentId,
unit_id as unitName,
level
FROM ma_part_type
WHERE del_flag = '0'
ORDER BY create_time
</select>
<select id="getPartTree" resultType="com.bonus.common.biz.domain.TreeNode">
SELECT pa_id AS id,
pa_name AS label,
parent_id AS parentId,
level
FROM ma_part_type
WHERE del_flag = '0' and level != '3'
ORDER BY create_time
</select>
<!--货架-->
<select id="getGoodsShelvesCbx" resultType="com.bonus.common.biz.domain.TreeNode">
SELECT house_id AS id,
house_name AS label,
parent_id AS parentId
FROM ma_house_info
WHERE del_flag = '0' AND status = '0'
</select>
<!--用户/维修员/库管员/采购员-下拉选-->
<select id="getUserByRoleIdCbxSelect" resultType="com.bonus.material.common.domain.vo.SelectVo">
SELECT su.user_id AS id,
su.nick_name AS `name`
FROM sys_role sr
LEFT JOIN sys_user_role sur ON sr.role_id = sur.role_id
LEFT JOIN sys_user su ON sur.user_id = su.user_id AND su.del_flag = '0'
WHERE sr.role_key = #{roleKey} AND sr.del_flag = '0'
</select>
<!--用户/维修员/库管员/采购员--->
<select id="getUserByRoleIdCbxTree" resultType="com.bonus.common.biz.domain.TreeNode">
SELECT dept_id AS id,
parent_id AS parentId,
dept_name AS label
FROM sys_dept
WHERE del_flag = '0'
UNION ALL
SELECT su.user_id AS id,
su.dept_id AS parentId,
su.nick_name AS label
FROM sys_role sr
LEFT JOIN sys_user_role sur ON sr.role_id = sur.role_id
LEFT JOIN sys_user su ON sur.user_id = su.user_id AND su.del_flag = '0'
WHERE sr.role_key = #{roleKey} AND sr.del_flag = '0'
</select>
<!--往来单位id和标段工程id获取协议信息-->
<select id="getAgreementInfoById" resultType="com.bonus.material.common.domain.vo.AgreementVo">
SELECT agreement_id AS agreementId,
agreement_code AS agreementCode,
is_slt AS isSlt
FROM bm_agreement_info
WHERE unit_id = #{unitId} AND project_id = #{projectId} AND status = '1'
</select>
</mapper>