|
|
@ -5,6 +5,8 @@ import com.yxt.anrui.portal.api.sysorganization.*; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgVo; |
|
|
|
import com.yxt.anrui.portal.biz.sysstaffinfo.SysStaffinfoService; |
|
|
|
import com.yxt.anrui.portal.biz.sysstafforg.SysStaffOrgService; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.utils.QRCodeUtil; |
|
|
|
import com.yxt.common.base.utils.StringUtils; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
@ -15,11 +17,14 @@ import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import static cn.hutool.poi.excel.sax.AttributeName.s; |
|
|
|
|
|
|
|
/** |
|
|
|
* Project: anrui_portal(门户建设) <br/> |
|
|
|
* File: SysOrganizationFeignFallback.java <br/> |
|
|
@ -44,6 +49,8 @@ public class SysOrganizationRest implements SysOrganizationFeign { |
|
|
|
private SysStaffOrgService sysStaffOrgService; |
|
|
|
@Autowired |
|
|
|
private SysStaffinfoService sysStaffinfoService; |
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultBean<PagerVo<SysOrganizationVo>> listPage(@RequestBody PagerQuery<SysOrganizationQuery> pq) { |
|
|
@ -226,4 +233,33 @@ public class SysOrganizationRest implements SysOrganizationFeign { |
|
|
|
return rb.success().setData(sysOrgListVo); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultBean<QrCodeVo> getQrCode(String sid) { |
|
|
|
SysOrganization sysOrganization = sysOrganizationService.fetchBySid(sid); |
|
|
|
if (sysOrganization == null) { |
|
|
|
return new ResultBean<QrCodeVo>().fail().setMsg("部门不存在"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(sysOrganization.getQrText())) { |
|
|
|
File file = new File(fileUploadComponent.getUploadPath() + "qrCode"); |
|
|
|
QRCodeUtil.createCodeToFile(sysOrganization.getSid() + "#" + sysOrganization.getId() + "#" + "q", file, sysOrganization.getName() + sysOrganization.getId() + ".png"); |
|
|
|
//将该二维码地址放进部门表中的二维码图片地址中
|
|
|
|
String path = fileUploadComponent.getUrlPrefix() + "qrCode/" + sysOrganization.getName() + sysOrganization.getId() + ".png"; |
|
|
|
sysOrganizationService.updateQrCodePath(sid, path); |
|
|
|
} |
|
|
|
QrCodeVo qrCodeVo = sysOrganizationService.getQrCodeVo(sid); |
|
|
|
String orgSidPath = sysOrganization.getOrgSidPath(); |
|
|
|
String[] split = orgSidPath.split("/"); |
|
|
|
for (String s : split) { |
|
|
|
SysOrganization sysOrganization1 = sysOrganizationService.fetchBySid(s); |
|
|
|
Integer isDept = sysOrganization1.getIsDept(); |
|
|
|
String psid = sysOrganization1.getPsid(); |
|
|
|
if (isDept != null){ |
|
|
|
if (isDept == 0 && !psid.equals(0)) { |
|
|
|
qrCodeVo.setOrganizationName(sysOrganization1.getName()); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultBean<QrCodeVo>().success().setData(qrCodeVo); |
|
|
|
} |
|
|
|
} |
|
|
|