|
|
@ -24,6 +24,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum; |
|
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
@ -64,6 +66,26 @@ public class DeptMaCodeServiceImpl extends BaseServiceImpl<DeptMaCodeDao, DeptMa |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<DeptMaCodeDTO> page(Map<String, Object> params) { |
|
|
|
String leaderFlag = (String) params.get("leaderFlag"); |
|
|
|
if (StringUtils.isNotBlank(leaderFlag) && leaderFlag.equals(YesOrNoEnum.YES.value())) { |
|
|
|
QueryWrapper<DeptMaCodeEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq("LEADER_FLAG", leaderFlag); |
|
|
|
|
|
|
|
IPage<DeptMaCodeEntity> page = baseDao.selectPage( |
|
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
|
wrapper |
|
|
|
); |
|
|
|
|
|
|
|
PageData<DeptMaCodeDTO> pageData = getPageData(page, DeptMaCodeDTO.class); |
|
|
|
List<DeptMaCodeDTO> pageDataList = pageData.getList(); |
|
|
|
for (DeptMaCodeDTO dto : pageDataList) { |
|
|
|
dto.setStreet("全部街道通用"); |
|
|
|
dto.setCommunity("全部社区通用"); |
|
|
|
dto.setGrid("全部网格通用"); |
|
|
|
} |
|
|
|
|
|
|
|
return pageData; |
|
|
|
} |
|
|
|
|
|
|
|
IPage<DeptMaCodeDTO> page = this.getPage(params); |
|
|
|
List<DeptMaCodeDTO> dtoList = this.baseDao.selectListDeptMaCode(params); |
|
|
@ -154,11 +176,38 @@ public class DeptMaCodeServiceImpl extends BaseServiceImpl<DeptMaCodeDao, DeptMa |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result createDeptMaCode(String gridId) { |
|
|
|
DeptMaCodeEntity entity = new DeptMaCodeEntity(); |
|
|
|
entity.setCodeUrl(this.createMaCode(gridId, "pages/index/index")); |
|
|
|
entity.setGridId(Long.parseLong(gridId)); |
|
|
|
entity.setLeaderFlag(YesOrNoEnum.NO.value()); |
|
|
|
this.baseDao.insert(entity); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result createGridLeaderMaCode() { |
|
|
|
DeptMaCodeEntity entity = new DeptMaCodeEntity(); |
|
|
|
entity.setCodeUrl(this.createMaCode("gridLeader", "pages/index/index")); |
|
|
|
entity.setLeaderFlag(YesOrNoEnum.YES.value()); |
|
|
|
this.baseDao.insert(entity); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 创建微信小程序码,并上传到oss |
|
|
|
* |
|
|
|
* @param param 小程序码的参数 |
|
|
|
* @param pageUrl 小程序码的跳转链接 |
|
|
|
* @return java.lang.String 小程序码的下载抵制 |
|
|
|
* @author work@yujt.net.cn |
|
|
|
* @date 2019/10/22 10:14 |
|
|
|
*/ |
|
|
|
private String createMaCode(String param, String pageUrl) { |
|
|
|
File wxaCodeUnlimit; |
|
|
|
try { |
|
|
|
wxaCodeUnlimit = wxMaService.getQrcodeService().createWxaCodeUnlimit(gridId, "pages/index/index"); |
|
|
|
wxaCodeUnlimit = wxMaService.getQrcodeService().createWxaCodeUnlimit(param, pageUrl); |
|
|
|
} catch (WxErrorException e) { |
|
|
|
return new Result().error("请求微信接口失败"); |
|
|
|
throw new RenException("请求微信接口失败"); |
|
|
|
} |
|
|
|
|
|
|
|
UploadToOssDTO dto = new UploadToOssDTO(); |
|
|
@ -167,13 +216,9 @@ public class DeptMaCodeServiceImpl extends BaseServiceImpl<DeptMaCodeDao, DeptMa |
|
|
|
|
|
|
|
Result<String> ossResult = ossFeignClient.uploadFile(dto); |
|
|
|
if (null == ossResult || !ossResult.success() || null == ossResult.getData()) { |
|
|
|
return new Result().error("小程序码上传失败"); |
|
|
|
throw new RenException("小程序码上传失败"); |
|
|
|
} |
|
|
|
DeptMaCodeEntity entity = new DeptMaCodeEntity(); |
|
|
|
entity.setCodeUrl(ossResult.getData()); |
|
|
|
entity.setGridId(Long.parseLong(gridId)); |
|
|
|
this.baseDao.insert(entity); |
|
|
|
return new Result(); |
|
|
|
return ossResult.getData(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|