Commit b3866f6a by zhaopanyu
parents a81275cd 9326d4a1
......@@ -9,6 +9,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -197,19 +198,196 @@ public class SchoolScAwardsController extends BaseController
/** 批量导出附件图片 */
@GetMapping("/pldcfjtp")
@RequestMapping("/pldcfjtp")
public void pldcfjtp(SchoolScAwardsVo schoolScAwardsVo, HttpServletResponse response)
{
schoolScAwardsVo.setAuditState("0");
startPage();
// startPage();
List<SchoolScAwardsVo> list = schoolScAwardsService.selectSchoolScAwardsList(schoolScAwardsVo);
List<SchoolAccessory> dcfjs = new ArrayList<>();//导出附件列表
for (SchoolScAwardsVo entity : list) {
List<SchoolAccessory> fjs = entity.getSchoolAccessoryList();
if (schoolScAwardsVo.getId() != null) {
if (!schoolScAwardsVo.getId().equals(entity.getId())) {//传入条件包括id 则只导出一个
continue;
}
}
if (fjs == null) {
continue;
}
for (SchoolAccessory fj : fjs) {
SchoolAccessory dc = new SchoolAccessory();
dc.setAccessoryName(entity.getCompetitionName() + "_" + entity.getAwardsName()
+ "_" + fj.getId() + "_" + fj.getAccessoryName());
dc.setAccessoryUrl(fj.getAccessoryUrl());
dcfjs.add(dc);
}
}
String fileName = "学校获奖附件" + ".zip";
response.setContentType("application/zip");
response.setHeader("content-disposition", "attachment;filename=" + fileName);
ZipOutputStream zos = null;
BufferedInputStream bis = null;
try{
zos = new ZipOutputStream(response.getOutputStream());
byte[] buf = new byte[8192];
int len;
for (int i = 0; i < dcfjs.size(); i++) {
SchoolAccessory dcfj = dcfjs.get(i);
String oripath = dcfj.getAccessoryUrl();
oripath = oripath.replaceFirst("/profile", RuoYiConfig.getProfile());
String dcfjurl = oripath;
String dcfjname = dcfj.getAccessoryName();
File file = new File(dcfjurl);
if (!file.isFile()) {
continue;
}
ZipEntry ze = new ZipEntry(dcfjname);
zos.putNextEntry(ze);
bis = new BufferedInputStream(new FileInputStream(file));
while ((len = bis.read(buf)) > 0) {
zos.write(buf, 0, len);
}
zos.closeEntry();
}
zos.closeEntry();
} catch (Exception ex){
ex.printStackTrace();
} finally {
if(bis != null){
try{
bis.close();
}catch(Exception e){
e.printStackTrace();
}
}
if(zos != null){
try{
zos.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
}
/** 批量导出附件图片 个人 */
@RequestMapping("/pldcfjtpGr")
public void pldcfjtpGr(SchoolScAwardsVo schoolScAwardsVo, HttpServletResponse response)
{
List<SchoolScAwardsVo> list = new ArrayList<>();
SysUser user = SecurityUtils.getLoginUser().getUser();
//管理员查询全部
if (user.isAdmin()) {
// startPage();
list = schoolScAwardsService.selectSchoolScAwardsList(schoolScAwardsVo);
// return getDataTable(list);
} else {
//用户查看个人列表
schoolScAwardsVo.setApplyId(user.getUserId());
// startPage();
list = schoolScAwardsService.selectSchoolScAwardsList(schoolScAwardsVo);
}
List<SchoolAccessory> dcfjs = new ArrayList<>();//导出附件列表
for (SchoolScAwardsVo entity : list) {
List<SchoolAccessory> fjs = entity.getSchoolAccessoryList();
if (schoolScAwardsVo.getId() != null) {
if (!schoolScAwardsVo.getId().equals(entity.getId())) {//传入条件包括id 则只导出一个
continue;
}
}
if (fjs == null) {
continue;
}
for (SchoolAccessory fj : fjs) {
SchoolAccessory dc = new SchoolAccessory();
dc.setAccessoryName(entity.getCompetitionName() + "_" + entity.getAwardsName()
+ "_" + fj.getId() + "_" + fj.getAccessoryName());
dc.setAccessoryUrl(fj.getAccessoryUrl());
dcfjs.add(dc);
}
}
String fileName = "学校获奖附件" + ".zip";
response.setContentType("application/zip");
response.setHeader("content-disposition", "attachment;filename=" + fileName);
ZipOutputStream zos = null;
BufferedInputStream bis = null;
try{
zos = new ZipOutputStream(response.getOutputStream());
byte[] buf = new byte[8192];
int len;
for (int i = 0; i < dcfjs.size(); i++) {
SchoolAccessory dcfj = dcfjs.get(i);
String oripath = dcfj.getAccessoryUrl();
oripath = oripath.replaceFirst("/profile", RuoYiConfig.getProfile());
String dcfjurl = oripath;
String dcfjname = dcfj.getAccessoryName();
File file = new File(dcfjurl);
if (!file.isFile()) {
continue;
}
ZipEntry ze = new ZipEntry(dcfjname);
zos.putNextEntry(ze);
bis = new BufferedInputStream(new FileInputStream(file));
while ((len = bis.read(buf)) > 0) {
zos.write(buf, 0, len);
}
zos.closeEntry();
}
zos.closeEntry();
} catch (Exception ex){
ex.printStackTrace();
} finally {
if(bis != null){
try{
bis.close();
}catch(Exception e){
e.printStackTrace();
}
}
if(zos != null){
try{
zos.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
}
/** 批量导出附件图片 通过 */
@RequestMapping("/pldcfjtpTg")
public void pldcfjtpTg(SchoolScAwardsVo schoolScAwardsVo, HttpServletResponse response)
{
schoolScAwardsVo.setAuditState("2");
// startPage();
List<SchoolScAwardsVo> list = schoolScAwardsService.selectSchoolScAwardsListTg(schoolScAwardsVo);
List<SchoolAccessory> dcfjs = new ArrayList<>();//导出附件列表
for (SchoolScAwardsVo entity : list) {
List<SchoolAccessory> fjs = entity.getSchoolAccessoryList();
if (schoolScAwardsVo.getId() != null) {
if (!schoolScAwardsVo.getId().equals(entity.getId())) {//传入条件包括id 则只导出一个
continue;
}
}
if (fjs == null) {
continue;
}
for (SchoolAccessory fj : fjs) {
SchoolAccessory dc = new SchoolAccessory();
dc.setAccessoryName(entity.getCompetitionName() + entity.getAwardsName() + fj.getId());
dc.setAccessoryName(entity.getCompetitionName() + "_" + entity.getAwardsName()
+ "_" + fj.getId() + "_" + fj.getAccessoryName());
dc.setAccessoryUrl(fj.getAccessoryUrl());
dcfjs.add(dc);
}
}
......@@ -226,7 +404,9 @@ public class SchoolScAwardsController extends BaseController
int len;
for (int i = 0; i < dcfjs.size(); i++) {
SchoolAccessory dcfj = dcfjs.get(i);
String dcfjurl = dcfj.getAccessoryUrl();
String oripath = dcfj.getAccessoryUrl();
oripath = oripath.replaceFirst("/profile", RuoYiConfig.getProfile());
String dcfjurl = oripath;
String dcfjname = dcfj.getAccessoryName();
File file = new File(dcfjurl);
......
......@@ -77,6 +77,10 @@ public class SchoolAclassTeacherAssessment extends BaseEntity
@Excel(name = "考核结果")
private String assessmentResults;
/** 家长满意度评价 */
@Excel(name = "家长满意度评价")
private String jzmydpj;
/** 备注*/
@Excel(name = "备注")
private String remark;
......@@ -86,4 +90,5 @@ public class SchoolAclassTeacherAssessment extends BaseEntity
private String delFlag;
}
......@@ -68,6 +68,10 @@ public class SchoolAclassTeacherAssessmentExport extends BaseEntity
@Excel(name = "考核结果",dictType = "assessment_results")
private String assessmentResults;
/** 家长满意度评价 */
@Excel(name = "家长满意度评价")
private String jzmydpj;
/** 备注*/
@Excel(name = "备注")
private String remark;
......
......@@ -88,4 +88,7 @@ public class SchoolAclassTeacherAssessmentReq extends BaseEntity
private String delFlag;
/** 家长满意度评价 */
private String jzmydpj;
}
......@@ -63,20 +63,22 @@ public class CirculationServiceImpl extends ServiceImpl<CirculationMapper, Schoo
*/
@Override
public List<SchoolCirculationVo> selectSchoolCirculationVoList(SchoolCirculationVo schoolCirculationVo) {
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
SysUser user = SecurityUtils.getLoginUser().getUser();
for (SysRole role : roles) {
if (role.getRoleKey().equals("admin")){
return circulationMapper.selectSchoolCirculationVoList(schoolCirculationVo);
}else if (role.getRoleKey().equals("productCategoryAdmin")){
schoolCirculationVo.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
return circulationMapper.selectSchoolCirculationVoListGr(schoolCirculationVo);
}
}
if (user.isAdmin()){
return circulationMapper.selectSchoolCirculationVoList(schoolCirculationVo);
}
return new ArrayList<>();
return circulationMapper.selectSchoolCirculationVoList(schoolCirculationVo);
// List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
// SysUser user = SecurityUtils.getLoginUser().getUser();
// for (SysRole role : roles) {
// if (role.getRoleKey().equals("admin")){
// return circulationMapper.selectSchoolCirculationVoList(schoolCirculationVo);
// }else if (role.getRoleKey().equals("productCategoryAdmin")){
// schoolCirculationVo.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
// return circulationMapper.selectSchoolCirculationVoListGr(schoolCirculationVo);
// }
// }
// if (user.isAdmin()){
// return circulationMapper.selectSchoolCirculationVoList(schoolCirculationVo);
// }
// return new ArrayList<>();
}
public List<SchoolCirculationVo> selectVxSchoolCirculationVoList(
SchoolReceiveQuery schoolReceiveQuery) {
......
......@@ -48,20 +48,22 @@ public class EquipmentLedgerServiceImpl extends ServiceImpl<EquipmentLedgerMappe
*/
@Override
public List<SchoolEquipmentLedger> selectSchoolEquipmentLedgerList(SchoolEquipmentLedgerVo schoolEquipmentLedgerVo) {
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
SysUser user = SecurityUtils.getLoginUser().getUser();
for (SysRole role : roles) {
if (role.getRoleKey().equals("admin")){
return equipmentLedgerMapper.selectSchoolEquipmentLedgerList(schoolEquipmentLedgerVo);
}else if (role.getRoleKey().equals("productCategoryAdmin")){
schoolEquipmentLedgerVo.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
return equipmentLedgerMapper.selectSchoolEquipmentLedgerListGr(schoolEquipmentLedgerVo);
}
}
if (user.isAdmin()){
return equipmentLedgerMapper.selectSchoolEquipmentLedgerList(schoolEquipmentLedgerVo);
}
return new ArrayList<>();
return equipmentLedgerMapper.selectSchoolEquipmentLedgerList(schoolEquipmentLedgerVo);
// List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
// SysUser user = SecurityUtils.getLoginUser().getUser();
// for (SysRole role : roles) {
// if (role.getRoleKey().equals("admin")){
// return equipmentLedgerMapper.selectSchoolEquipmentLedgerList(schoolEquipmentLedgerVo);
// }else if (role.getRoleKey().equals("productCategoryAdmin")){
// schoolEquipmentLedgerVo.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
// return equipmentLedgerMapper.selectSchoolEquipmentLedgerListGr(schoolEquipmentLedgerVo);
// }
// }
// if (user.isAdmin()){
// return equipmentLedgerMapper.selectSchoolEquipmentLedgerList(schoolEquipmentLedgerVo);
// }
// return new ArrayList<>();
}
/**
......
package yangtz.cs.liu.campus.service.impl.schoolEquipment;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.core.utils.HttpClientUtil;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
......@@ -8,12 +10,15 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.system.mapper.SysUserMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import yangtz.cs.liu.campus.domain.schoolEquipment.SchoolEquipmentLedger;
import yangtz.cs.liu.campus.domain.schoolEquipment.SchoolEquipmentRepair;
import yangtz.cs.liu.campus.mapper.schoolEquipment.EquipmentLedgerMapper;
import yangtz.cs.liu.campus.mapper.schoolEquipment.EquipmentRepairMapper;
import yangtz.cs.liu.campus.service.schoolEquipment.IEquipmentRepairService;
import yangtz.cs.liu.campus.vo.schoolEquipment.SchoolEquipmentRepairVo;
......@@ -32,6 +37,9 @@ public class EquipmentRepairServiceImpl extends ServiceImpl<EquipmentRepairMappe
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private EquipmentLedgerMapper equipmentLedgerMapper;
/**
* 查看设备报修列表
* @param schoolEquipmentRepairVo
......@@ -39,20 +47,21 @@ public class EquipmentRepairServiceImpl extends ServiceImpl<EquipmentRepairMappe
*/
@Override
public List<SchoolEquipmentRepairVo> selectSchoolEquipmentRepairVoList(SchoolEquipmentRepairVo schoolEquipmentRepairVo) {
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
SysUser user = SecurityUtils.getLoginUser().getUser();
for (SysRole role : roles) {
if (role.getRoleKey().equals("admin")){
return equipmentRepairMapper.selectSchoolEquipmentRepairVoList(schoolEquipmentRepairVo);
}else if (role.getRoleKey().equals("productCategoryAdmin")){
schoolEquipmentRepairVo.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
return equipmentRepairMapper.selectSchoolEquipmentRepairVoListGr(schoolEquipmentRepairVo);
}
}
if (user.isAdmin()){
return equipmentRepairMapper.selectSchoolEquipmentRepairVoList(schoolEquipmentRepairVo);
}
return new ArrayList<>();
return equipmentRepairMapper.selectSchoolEquipmentRepairVoList(schoolEquipmentRepairVo);
// List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
// SysUser user = SecurityUtils.getLoginUser().getUser();
// for (SysRole role : roles) {
// if (role.getRoleKey().equals("admin")){
// return equipmentRepairMapper.selectSchoolEquipmentRepairVoList(schoolEquipmentRepairVo);
// }else if (role.getRoleKey().equals("productCategoryAdmin")){
// schoolEquipmentRepairVo.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
// return equipmentRepairMapper.selectSchoolEquipmentRepairVoListGr(schoolEquipmentRepairVo);
// }
// }
// if (user.isAdmin()){
// return equipmentRepairMapper.selectSchoolEquipmentRepairVoList(schoolEquipmentRepairVo);
// }
// return new ArrayList<>();
}
/**
......@@ -184,5 +193,38 @@ public class EquipmentRepairServiceImpl extends ServiceImpl<EquipmentRepairMappe
public List<SchoolEquipmentRepairVo> getMaintenanceUserList(SchoolReceiveQuery schoolReceiveQuery) {
return equipmentRepairMapper.getMaintenanceUserList(schoolReceiveQuery);
}
String url ="https://oapi.dingtalk.com/robot/send?access_token=06ac9f1927d64a8058d6df0ae21a4a2c6c6414c8567fb3fe89bbd3ec12fe0e3f";
//发送订单机器人
@Override
public void sendDDJqr(SchoolEquipmentRepair schoolEquipmentRepair) {
//根据设备id获取设备信息
SchoolEquipmentLedger schoolEquipmentLedger = equipmentLedgerMapper.selectById(schoolEquipmentRepair.getEquipmentId());
StringBuffer sb = new StringBuffer();
sb.append("[智慧校园]消息通知:");
sb.append("\n");
sb.append("报修人:");
sb.append(schoolEquipmentRepair.getReportRepair());
sb.append("\n");
sb.append("设备名称:");
sb.append(schoolEquipmentLedger.getEquipmentName());
sb.append("\n");
sb.append("保修地点");
sb.append(schoolEquipmentRepair.getPlace());
sb.append("\n");
sb.append("问题:");
sb.append(schoolEquipmentRepair.getProblem());
//构造text语句
JSONObject text = new JSONObject();
text.put("content",sb.toString());
JSONObject at = new JSONObject();
at.put("atMobiles", new String[]{"13800000000"});
at.put("isAtAll", false);
//构造发送语句
JSONObject json = new JSONObject();
json.put("msgtype", "text");
json.put("text", text);
json.put("at", at);
HttpUtils.sendJsonPost(url, json);
}
}
......@@ -28,20 +28,22 @@ public class InStockServiceImpl extends ServiceImpl<InStockMapper, SchoolInStock
*/
@Override
public List<SchoolInStockVo> selectSchoolInStockVoList(SchoolInStockVo schoolInStockVo) {
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
SysUser user = SecurityUtils.getLoginUser().getUser();
for (SysRole role : roles) {
if (role.getRoleKey().equals("admin")){
return inStockMapper.selectSchoolInStockVoList(schoolInStockVo);
}else if (role.getRoleKey().equals("productCategoryAdmin")){
schoolInStockVo.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
return inStockMapper.selectSchoolInStockVoListGr(schoolInStockVo);
}
}
if (user.isAdmin()){
return inStockMapper.selectSchoolInStockVoList(schoolInStockVo);
}
return new ArrayList<>();
return inStockMapper.selectSchoolInStockVoList(schoolInStockVo);
// List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
// SysUser user = SecurityUtils.getLoginUser().getUser();
// for (SysRole role : roles) {
// if (role.getRoleKey().equals("admin")){
// return inStockMapper.selectSchoolInStockVoList(schoolInStockVo);
// }else if (role.getRoleKey().equals("productCategoryAdmin")){
// schoolInStockVo.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
// return inStockMapper.selectSchoolInStockVoListGr(schoolInStockVo);
// }
// }
// if (user.isAdmin()){
// return inStockMapper.selectSchoolInStockVoList(schoolInStockVo);
// }
// return new ArrayList<>();
}
/**
......
......@@ -28,20 +28,22 @@ public class OutStockServiceImpl extends ServiceImpl<OutStockMapper, SchoolOutSt
*/
@Override
public List<SchoolOutStockVo> selectSchoolOutStockVoList(SchoolOutStockVo schoolOutStockVo) {
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
SysUser user = SecurityUtils.getLoginUser().getUser();
for (SysRole role : roles) {
if (role.getRoleKey().equals("admin")){
return outStockMapper.selectSchoolOutStockVoList(schoolOutStockVo);
}else if (role.getRoleKey().equals("productCategoryAdmin")){
schoolOutStockVo.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
return outStockMapper.selectSchoolOutStockVoListGr(schoolOutStockVo);
}
}
if (user.isAdmin()){
return outStockMapper.selectSchoolOutStockVoList(schoolOutStockVo);
}
return new ArrayList<>();
return outStockMapper.selectSchoolOutStockVoList(schoolOutStockVo);
// List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
// SysUser user = SecurityUtils.getLoginUser().getUser();
// for (SysRole role : roles) {
// if (role.getRoleKey().equals("admin")){
// return outStockMapper.selectSchoolOutStockVoList(schoolOutStockVo);
// }else if (role.getRoleKey().equals("productCategoryAdmin")){
// schoolOutStockVo.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
// return outStockMapper.selectSchoolOutStockVoListGr(schoolOutStockVo);
// }
// }
// if (user.isAdmin()){
// return outStockMapper.selectSchoolOutStockVoList(schoolOutStockVo);
// }
// return new ArrayList<>();
}
/**
......
......@@ -37,20 +37,22 @@ public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryMappe
*/
@Override
public List<SchoolProductCategory> selectSchoolProductCateGory(SchoolProductCategory schoolProductCategory) {
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
SysUser user = SecurityUtils.getLoginUser().getUser();
for (SysRole role : roles) {
if (role.getRoleKey().equals("admin")){
return productCategoryMapper.selectSchoolProductCateGory(schoolProductCategory);
}else if (role.getRoleKey().equals("productCategoryAdmin")){
schoolProductCategory.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
return productCategoryMapper.selectSchoolProductCateGoryGr(schoolProductCategory);
}
}
if (user.isAdmin()){
return productCategoryMapper.selectSchoolProductCateGory(schoolProductCategory);
}
return new ArrayList<>();
return productCategoryMapper.selectSchoolProductCateGory(schoolProductCategory);
// List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
// SysUser user = SecurityUtils.getLoginUser().getUser();
// for (SysRole role : roles) {
// if (role.getRoleKey().equals("admin")){
// return productCategoryMapper.selectSchoolProductCateGory(schoolProductCategory);
// }else if (role.getRoleKey().equals("productCategoryAdmin")){
// schoolProductCategory.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
// return productCategoryMapper.selectSchoolProductCateGoryGr(schoolProductCategory);
// }
// }
// if (user.isAdmin()){
// return productCategoryMapper.selectSchoolProductCateGory(schoolProductCategory);
// }
// return new ArrayList<>();
}
/**
......@@ -222,20 +224,22 @@ public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryMappe
@Override
// @DataScope(userAlias = "u")
public List<Map<String, String>> getEquipmentType(SchoolProductCategory schoolProductCategory) {
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
SysUser user = SecurityUtils.getLoginUser().getUser();
for (SysRole role : roles) {
if (role.getRoleKey().equals("admin")){
return productCategoryMapper.getEquipmentType(schoolProductCategory);
}else if (role.getRoleKey().equals("productCategoryAdmin")){
schoolProductCategory.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
return productCategoryMapper.getEquipmentTypeGr(schoolProductCategory);
}
}
if (user.isAdmin()){
return productCategoryMapper.getEquipmentType(schoolProductCategory);
}
return new ArrayList<>();
return productCategoryMapper.getEquipmentType(schoolProductCategory);
// List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
// SysUser user = SecurityUtils.getLoginUser().getUser();
// for (SysRole role : roles) {
// if (role.getRoleKey().equals("admin")){
// return productCategoryMapper.getEquipmentType(schoolProductCategory);
// }else if (role.getRoleKey().equals("productCategoryAdmin")){
// schoolProductCategory.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
// return productCategoryMapper.getEquipmentTypeGr(schoolProductCategory);
// }
// }
// if (user.isAdmin()){
// return productCategoryMapper.getEquipmentType(schoolProductCategory);
// }
// return new ArrayList<>();
}
/**
......@@ -268,31 +272,35 @@ public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryMappe
*/
@Override
public SchoolProductCategory getEquipmentByCode(String code) {
// List<SchoolProductCategory> list = new ArrayList<>();
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
SysUser user = SecurityUtils.getLoginUser().getUser();
if (user.isAdmin()){
// list.clear();
LambdaQueryWrapper<SchoolProductCategory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolProductCategory::getClassificationCode,code);
return productCategoryMapper.selectOne(wrapper);
}
for (SysRole role : roles) {
if (role.getRoleKey().equals("admin")){
// list.clear();
LambdaQueryWrapper<SchoolProductCategory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolProductCategory::getClassificationCode,code);
LambdaQueryWrapper<SchoolProductCategory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolProductCategory::getClassificationCode,code);
// list.add(productCategoryMapper.selectOne(wrapper));
return productCategoryMapper.selectOne(wrapper);
// break;
}else if (role.getRoleKey().equals("productCategoryAdmin")){
// list.clear();
LambdaQueryWrapper<SchoolProductCategory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolProductCategory::getClassificationCode,code)
.eq(SchoolProductCategory::getAdminId,SecurityUtils.getLoginUser().getUser().getUserId());
return productCategoryMapper.selectOne(wrapper);
}
}
throw new ServiceException("该设备不再您管辖范围内");
return productCategoryMapper.selectOne(wrapper);
// List<SchoolProductCategory> list = new ArrayList<>();
// List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
// SysUser user = SecurityUtils.getLoginUser().getUser();
// if (user.isAdmin()){
//// list.clear();
// LambdaQueryWrapper<SchoolProductCategory> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(SchoolProductCategory::getClassificationCode,code);
// return productCategoryMapper.selectOne(wrapper);
// }
// for (SysRole role : roles) {
// if (role.getRoleKey().equals("admin")){
//// list.clear();
// LambdaQueryWrapper<SchoolProductCategory> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(SchoolProductCategory::getClassificationCode,code);
//// list.add(productCategoryMapper.selectOne(wrapper));
// return productCategoryMapper.selectOne(wrapper);
//// break;
// }else if (role.getRoleKey().equals("productCategoryAdmin")){
//// list.clear();
// LambdaQueryWrapper<SchoolProductCategory> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(SchoolProductCategory::getClassificationCode,code)
// .eq(SchoolProductCategory::getAdminId,SecurityUtils.getLoginUser().getUser().getUserId());
// return productCategoryMapper.selectOne(wrapper);
// }
// }
// throw new ServiceException("该设备不再您管辖范围内");
}
}
......@@ -39,20 +39,22 @@ public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, SchoolReceive
*/
@Override
public List<SchoolReceiveVo> selectSchoolReceiveVoList(SchoolReceiveVo schoolReceiveVo) {
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
SysUser user = SecurityUtils.getLoginUser().getUser();
for (SysRole role : roles) {
if (role.getRoleKey().equals("admin")){
return receiveMapper.selectSchoolReceiveVoList(schoolReceiveVo);
}else if (role.getRoleKey().equals("productCategoryAdmin")){
schoolReceiveVo.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
return receiveMapper.selectSchoolReceiveVoListGr(schoolReceiveVo);
}
}
if (user.isAdmin()){
return receiveMapper.selectSchoolReceiveVoList(schoolReceiveVo);
}
return new ArrayList<>();
return receiveMapper.selectSchoolReceiveVoList(schoolReceiveVo);
// List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
// SysUser user = SecurityUtils.getLoginUser().getUser();
// for (SysRole role : roles) {
// if (role.getRoleKey().equals("admin")){
// return receiveMapper.selectSchoolReceiveVoList(schoolReceiveVo);
// }else if (role.getRoleKey().equals("productCategoryAdmin")){
// schoolReceiveVo.setAdminId(SecurityUtils.getLoginUser().getUser().getUserId());
// return receiveMapper.selectSchoolReceiveVoListGr(schoolReceiveVo);
// }
// }
// if (user.isAdmin()){
// return receiveMapper.selectSchoolReceiveVoList(schoolReceiveVo);
// }
// return new ArrayList<>();
}
/**
......
......@@ -68,5 +68,8 @@ public interface IEquipmentRepairService extends IService<SchoolEquipmentRepair>
public List<SchoolEquipmentRepairVo> getMaintenanceUserList(SchoolReceiveQuery schoolReceiveQuery);
//发送机器人保修信息
public void sendDDJqr( SchoolEquipmentRepair schoolEquipmentRepair);
}
......@@ -152,24 +152,26 @@ public class EquipmentLeaseController {
*/
@GetMapping("/getMaintenanceList")
private AjaxResult getMaintenanceList(SchoolReceiveQuery schoolReceiveQuery){
Boolean flag= false;
//1.管理员可以查看所有维修列表
SysUser sysUser = iSysUserService.selectUserById(schoolReceiveQuery.getReportRepairid());
List<SysRole> roles = sysUser.getRoles();
for(SysRole data :roles){
if (data.getRoleKey().contains("productCategoryAdmin")){
flag=true;
break;
}
};
if (false){
List<SchoolEquipmentRepairVo> getlist = iEquipmentRepairService.getAdminList(schoolReceiveQuery);
return AjaxResult.success(getlist);
}else {
List<SchoolEquipmentRepairVo> maintenanceList = iEquipmentRepairService
.getMaintenanceList(schoolReceiveQuery);
return AjaxResult.success(maintenanceList);
}
List<SchoolEquipmentRepairVo> getlist = iEquipmentRepairService.getAdminList(schoolReceiveQuery);
return AjaxResult.success(getlist);
// Boolean flag= false;
// //1.管理员可以查看所有维修列表
// SysUser sysUser = iSysUserService.selectUserById(schoolReceiveQuery.getReportRepairid());
// List<SysRole> roles = sysUser.getRoles();
// for(SysRole data :roles){
// if (data.getRoleKey().contains("productCategoryAdmin")){
// flag=true;
// break;
// }
// };
// if (false){
// List<SchoolEquipmentRepairVo> getlist = iEquipmentRepairService.getAdminList(schoolReceiveQuery);
// return AjaxResult.success(getlist);
// }else {
// List<SchoolEquipmentRepairVo> maintenanceList = iEquipmentRepairService
// .getMaintenanceList(schoolReceiveQuery);
// return AjaxResult.success(maintenanceList);
// }
}
/**
......@@ -177,6 +179,7 @@ public class EquipmentLeaseController {
*/
@PostMapping("/addMaintenance")
private AjaxResult addMaintenance(@RequestBody SchoolEquipmentRepair schoolEquipmentRepair){
iEquipmentRepairService.sendDDJqr(schoolEquipmentRepair);
boolean save = iEquipmentRepairService.save(schoolEquipmentRepair);
return AjaxResult.success(save);
}
......@@ -316,4 +319,8 @@ public class EquipmentLeaseController {
return AjaxResult.success(iEquipmentRepairService.getRepair());
}
}
......@@ -160,8 +160,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT er.id,er.equipment_id,el.encode,el.equipment_name,el.model,el.date_of_production,er.place,el.place,el.classification_code,
er.report_repair_time,er.report_repair_id,er.report_repair,er.problem,er.repair_id,er.repair_name,er.repair_phone,
er.repair_time,er.repair_state,er.dispose_state,er.evaluate,er.remark FROM school_equipment_repair er LEFT JOIN
school_equipment_ledger el on er.equipment_id = el.id LEFT JOIN school_product_category pc
on pc.classification_code = el.classification_code WHERE pc.admin_id=#{reportRepairid} AND er.del_flag=0
school_equipment_ledger el on er.equipment_id = el.id where er.del_flag=0
<if test="equipmentName != null and equipmentName != ''">and el.equipment_name like concat('%', #{equipmentName}, '%')</if>
ORDER BY er.report_repair_time DESC
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment