Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
wanggeng888 2021-03-15 10:20:30 +08:00
commit a584596699
8 changed files with 85 additions and 15 deletions

View File

@ -1,13 +1,13 @@
package cn.com.tenlion.controller.app.apis.cardtemplateuse; package cn.com.tenlion.controller.app.apis.cardtemplateuse;
import cn.com.tenlion.accesstokenmanager.AccessTokenManager;
import cn.com.tenlion.controller.AbstractController; import cn.com.tenlion.controller.AbstractController;
import cn.com.tenlion.pojo.dtos.cardtemplateuse.CardTemplateUseDTO; import cn.com.tenlion.pojo.dtos.cardtemplateuse.CardTemplateUseDTO;
import cn.com.tenlion.pojo.dtos.carduser.CardUserDTO;
import cn.com.tenlion.pojo.vos.cardtemplateuse.CardTemplateUseVO; import cn.com.tenlion.pojo.vos.cardtemplateuse.CardTemplateUseVO;
import cn.com.tenlion.service.cardtemplateuse.ICardTemplateUseService; import cn.com.tenlion.service.cardtemplateuse.ICardTemplateUseService;
import cn.com.tenlion.util.annotation.AccessRightsCheck;
import cn.com.tenlion.util.check.CheckRequestBodyAnnotation; import cn.com.tenlion.util.check.CheckRequestBodyAnnotation;
import cn.com.tenlion.util.cons.ISystemConstant; import cn.com.tenlion.util.cons.ISystemConstant;
import cn.com.tenlion.util.enumeration.Auth;
import cn.com.tenlion.util.exception.RemoveException; import cn.com.tenlion.util.exception.RemoveException;
import cn.com.tenlion.util.exception.SearchException; import cn.com.tenlion.util.exception.SearchException;
import cn.com.tenlion.util.page.ListPage; import cn.com.tenlion.util.page.ListPage;
@ -44,21 +44,20 @@ public class CardTemplateUseAppController extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("savecardtemplateuse") @PostMapping("savecardtemplateuse")
@CheckRequestBodyAnnotation @CheckRequestBodyAnnotation
@AccessRightsCheck(auth= Auth.NOCHECK,authUrl="",operation="新增模板使用") public SuccessResult saveCardTemplateUse(@RequestHeader("token") String token, @RequestBody CardTemplateUseVO cardTemplateUseVO) throws Exception {
public SuccessResult saveCardTemplateUse(/*@RequestHeader("token") String token, */@RequestBody CardTemplateUseVO cardTemplateUseVO) throws Exception { CardUserDTO tokenManage = AccessTokenManager.getInstance().getKey(token);
//CardUserDTO tokenManage = AccessTokenManager.getInstance().getKey(token); return cardTemplateUseService.saveCardTemplateUseByToken(tokenManage.getCardUserId(), cardTemplateUseVO);
return cardTemplateUseService.saveCardTemplateUseByToken("123456", cardTemplateUseVO);
} }
@ApiOperation(value = "删除模板使用(id列表)", notes = "删除模板使用(id列表)接口") @ApiOperation(value = "删除模板使用(id列表)", notes = "删除模板使用(id列表)接口")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"), //@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3") @ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
}) })
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("removecardtemplateuse/{ids}") @DeleteMapping("removecardtemplateuse/{ids}")
public SuccessResult removeCardTemplateUse(@RequestHeader("token") String token, @PathVariable("ids") String ids) throws RemoveException { public SuccessResult removeCardTemplateUse(@RequestHeader("token") String token, @PathVariable("ids") String ids) throws RemoveException {
return cardTemplateUseService.removeCardTemplateUseByToken(token, ids); return cardTemplateUseService.removeCardTemplateUseByToken("", ids);
} }
@ApiOperation(value = "修改模板使用", notes = "修改模板使用接口") @ApiOperation(value = "修改模板使用", notes = "修改模板使用接口")
@ -70,7 +69,7 @@ public class CardTemplateUseAppController extends AbstractController {
@PutMapping("updatecardtemplateuse/{cardTemplateUseId}") @PutMapping("updatecardtemplateuse/{cardTemplateUseId}")
@CheckRequestBodyAnnotation @CheckRequestBodyAnnotation
public SuccessResult updateCardTemplateUse(@RequestHeader("token") String token, @PathVariable("cardTemplateUseId") String cardTemplateUseId, @RequestBody CardTemplateUseVO cardTemplateUseVO) throws Exception { public SuccessResult updateCardTemplateUse(@RequestHeader("token") String token, @PathVariable("cardTemplateUseId") String cardTemplateUseId, @RequestBody CardTemplateUseVO cardTemplateUseVO) throws Exception {
return cardTemplateUseService.updateCardTemplateUseByToken(token, cardTemplateUseId, cardTemplateUseVO); return cardTemplateUseService.updateCardTemplateUseByToken("", cardTemplateUseId, cardTemplateUseVO);
} }
@ApiOperation(value = "模板使用详情(通过ID)", notes = "模板使用详情(通过ID)接口") @ApiOperation(value = "模板使用详情(通过ID)", notes = "模板使用详情(通过ID)接口")
@ -92,6 +91,11 @@ public class CardTemplateUseAppController extends AbstractController {
@GetMapping("listcardtemplateuse") @GetMapping("listcardtemplateuse")
public List<CardTemplateUseDTO> listCardTemplateUse(@RequestHeader("token") String token) throws SearchException { public List<CardTemplateUseDTO> listCardTemplateUse(@RequestHeader("token") String token) throws SearchException {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
/**
* 显示登陆人使用的模板
*/
CardUserDTO tokenManage = AccessTokenManager.getInstance().getKey(token);
params.put("creator", tokenManage.getCardUserId());
return cardTemplateUseService.listCardTemplateUse(params); return cardTemplateUseService.listCardTemplateUse(params);
} }
@ -108,6 +112,11 @@ public class CardTemplateUseAppController extends AbstractController {
@GetMapping("listpagecardtemplateuse") @GetMapping("listpagecardtemplateuse")
public SuccessResultList<List<CardTemplateUseDTO>> listPageCardTemplateUse(@RequestHeader("token") String token, ListPage page) throws SearchException { public SuccessResultList<List<CardTemplateUseDTO>> listPageCardTemplateUse(@RequestHeader("token") String token, ListPage page) throws SearchException {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
/**
* 显示登陆人使用的模板
*/
CardUserDTO tokenManage = AccessTokenManager.getInstance().getKey(token);
params.put("creator", tokenManage.getCardUserId());
page.setParams(params); page.setParams(params);
return cardTemplateUseService.listPageCardTemplateUse(page); return cardTemplateUseService.listPageCardTemplateUse(page);
} }

View File

@ -81,11 +81,12 @@ public class CardTemplateUseAreaAppController extends AbstractController {
@ApiOperation(value = "模板使用区域数据列表", notes = "模板使用区域数据列表接口") @ApiOperation(value = "模板使用区域数据列表", notes = "模板使用区域数据列表接口")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header") @ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "templateUseId", value = "使用模板ID", paramType = "query", dataType = "String")
}) })
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listcardtemplateusearea") @GetMapping("listcardtemplateusearea/{templateUseId}")
public List<CardTemplateUseAreaDTO> listCardTemplateUseArea(@RequestHeader("token") String token) throws SearchException { public List<CardTemplateUseAreaDTO> listCardTemplateUseArea(@RequestHeader("token") String token, @PathVariable("templateUseId") String templateUseId) throws SearchException {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
return cardTemplateUseAreaService.listCardTemplateUseArea(params); return cardTemplateUseAreaService.listCardTemplateUseArea(params);
} }

View File

@ -1,5 +1,6 @@
package cn.com.tenlion.pojo.dtos.cardtemplateusearea; package cn.com.tenlion.pojo.dtos.cardtemplateusearea;
import cn.com.tenlion.pojo.dtos.cardtemplatearea.CardTemplateAreaDTO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -32,6 +33,16 @@ public class CardTemplateUseAreaDTO {
private String templateAreaFontSize; private String templateAreaFontSize;
@ApiModelProperty(name = "templateAreaFontSizeDictionaryName", value = "区域字体大小/预留功能(数据字典)字典名称") @ApiModelProperty(name = "templateAreaFontSizeDictionaryName", value = "区域字体大小/预留功能(数据字典)字典名称")
private String templateAreaFontSizeDictionaryName; private String templateAreaFontSizeDictionaryName;
@ApiModelProperty(name = "cardTemplateAreaDTO", value = "区域原始数据对象")
private CardTemplateAreaDTO cardTemplateAreaDTO;
public CardTemplateAreaDTO getCardTemplateAreaDTO() {
return cardTemplateAreaDTO;
}
public void setCardTemplateAreaDTO(CardTemplateAreaDTO cardTemplateAreaDTO) {
this.cardTemplateAreaDTO = cardTemplateAreaDTO;
}
public String getCardTemplateUseAreaId() { public String getCardTemplateUseAreaId() {
return cardTemplateUseAreaId == null ? "" : cardTemplateUseAreaId.trim(); return cardTemplateUseAreaId == null ? "" : cardTemplateUseAreaId.trim();

View File

@ -1,10 +1,14 @@
package cn.com.tenlion.pojo.vos.cardtemplateuse; package cn.com.tenlion.pojo.vos.cardtemplateuse;
import cn.com.tenlion.pojo.vos.cardtemplateusearea.CardTemplateUseAreaVO;
import cn.com.tenlion.util.check.CheckEmptyAnnotation; import cn.com.tenlion.util.check.CheckEmptyAnnotation;
import cn.com.tenlion.util.check.CheckNumberAnnotation; import cn.com.tenlion.util.check.CheckNumberAnnotation;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/** /**
* *
* @ClassName: CardTemplateUseVO * @ClassName: CardTemplateUseVO
@ -46,6 +50,19 @@ public class CardTemplateUseVO {
private String templateUseCity; private String templateUseCity;
@ApiModelProperty(name = "templateUseUrl", value = "名片预览网络地址(全路径)") @ApiModelProperty(name = "templateUseUrl", value = "名片预览网络地址(全路径)")
private String templateUseUrl; private String templateUseUrl;
@ApiModelProperty(name = "templateUseUrl", value = "区域数据")
private List<CardTemplateUseAreaVO> useAreaVOList = new ArrayList<CardTemplateUseAreaVO>();
public List<CardTemplateUseAreaVO> getUseAreaVOList() {
if (useAreaVOList == null) {
return new ArrayList<>();
}
return useAreaVOList;
}
public void setUseAreaVOList(List<CardTemplateUseAreaVO> useAreaVOList) {
this.useAreaVOList = useAreaVOList;
}
public String getTemplateId() { public String getTemplateId() {
return templateId == null ? "" : templateId.trim(); return templateId == null ? "" : templateId.trim();

View File

@ -4,9 +4,11 @@ import cn.com.tenlion.dao.cardtemplateuse.ICardTemplateUseDao;
import cn.com.tenlion.pojo.dtos.cardtemplate.CardTemplateDTO; import cn.com.tenlion.pojo.dtos.cardtemplate.CardTemplateDTO;
import cn.com.tenlion.pojo.dtos.cardtemplateuse.CardTemplateUseDTO; import cn.com.tenlion.pojo.dtos.cardtemplateuse.CardTemplateUseDTO;
import cn.com.tenlion.pojo.vos.cardtemplateuse.CardTemplateUseVO; import cn.com.tenlion.pojo.vos.cardtemplateuse.CardTemplateUseVO;
import cn.com.tenlion.pojo.vos.cardtemplateusearea.CardTemplateUseAreaVO;
import cn.com.tenlion.service.AbstractService; import cn.com.tenlion.service.AbstractService;
import cn.com.tenlion.service.cardtemplate.ICardTemplateService; import cn.com.tenlion.service.cardtemplate.ICardTemplateService;
import cn.com.tenlion.service.cardtemplateuse.ICardTemplateUseService; import cn.com.tenlion.service.cardtemplateuse.ICardTemplateUseService;
import cn.com.tenlion.service.cardtemplateusearea.ICardTemplateUseAreaService;
import cn.com.tenlion.util.base.HashMapUtil; import cn.com.tenlion.util.base.HashMapUtil;
import cn.com.tenlion.util.base.QRCodeUtil; import cn.com.tenlion.util.base.QRCodeUtil;
import cn.com.tenlion.util.base.UUIDUtil; import cn.com.tenlion.util.base.UUIDUtil;
@ -40,6 +42,8 @@ public class CardTemplateUseServiceImpl extends AbstractService implements ICard
private ICardTemplateUseDao cardTemplateUseDao; private ICardTemplateUseDao cardTemplateUseDao;
@Autowired @Autowired
private ICardTemplateService cardTemplateService; private ICardTemplateService cardTemplateService;
@Autowired
private ICardTemplateUseAreaService cardTemplateUseAreaService;
@Override @Override
public SuccessResultData<String> saveCardTemplateUseByToken(String userId, CardTemplateUseVO cardTemplateUseVO) throws Exception { public SuccessResultData<String> saveCardTemplateUseByToken(String userId, CardTemplateUseVO cardTemplateUseVO) throws Exception {
@ -55,6 +59,15 @@ public class CardTemplateUseServiceImpl extends AbstractService implements ICard
if(templateDto == null) { if(templateDto == null) {
throw new SaveException("该模板不存在"); throw new SaveException("该模板不存在");
} }
/**
* 保存区域数据
*/
List<CardTemplateUseAreaVO> useAreaVOList = cardTemplateUseVO.getUseAreaVOList();
for (CardTemplateUseAreaVO vo : useAreaVOList) {
vo.setTemplateUseId(cardTemplateUseId);// 使用模板ID
vo.setTemplateId(cardTemplateUseVO.getTemplateId());// 模板ID
cardTemplateUseAreaService.saveCardTemplateUseAreaByToken(userId, vo);
}
/** /**
* 创建名片|海报二维码 , 给二维码是可以扫描后直接进入小程序的名片页面 . * 创建名片|海报二维码 , 给二维码是可以扫描后直接进入小程序的名片页面 .
* 小程序路径 + 名片ID参数. 小程序页面渲染的时候 , 拿着ID查询判断 是否公开,是否需要密码,是否是该允许区域的用户 * 小程序路径 + 名片ID参数. 小程序页面渲染的时候 , 拿着ID查询判断 是否公开,是否需要密码,是否是该允许区域的用户

View File

@ -1,9 +1,11 @@
package cn.com.tenlion.service.cardtemplateusearea.impl; package cn.com.tenlion.service.cardtemplateusearea.impl;
import cn.com.tenlion.dao.cardtemplateusearea.ICardTemplateUseAreaDao; import cn.com.tenlion.dao.cardtemplateusearea.ICardTemplateUseAreaDao;
import cn.com.tenlion.pojo.dtos.cardtemplatearea.CardTemplateAreaDTO;
import cn.com.tenlion.pojo.dtos.cardtemplateusearea.CardTemplateUseAreaDTO; import cn.com.tenlion.pojo.dtos.cardtemplateusearea.CardTemplateUseAreaDTO;
import cn.com.tenlion.pojo.vos.cardtemplateusearea.CardTemplateUseAreaVO; import cn.com.tenlion.pojo.vos.cardtemplateusearea.CardTemplateUseAreaVO;
import cn.com.tenlion.service.AbstractService; import cn.com.tenlion.service.AbstractService;
import cn.com.tenlion.service.cardtemplatearea.ICardTemplateAreaService;
import cn.com.tenlion.service.cardtemplateusearea.ICardTemplateUseAreaService; import cn.com.tenlion.service.cardtemplateusearea.ICardTemplateUseAreaService;
import cn.com.tenlion.util.base.HashMapUtil; import cn.com.tenlion.util.base.HashMapUtil;
import cn.com.tenlion.util.base.UUIDUtil; import cn.com.tenlion.util.base.UUIDUtil;
@ -17,6 +19,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -33,6 +36,8 @@ public class CardTemplateUseAreaServiceImpl extends AbstractService implements I
@Autowired @Autowired
private ICardTemplateUseAreaDao cardTemplateUseAreaDao; private ICardTemplateUseAreaDao cardTemplateUseAreaDao;
@Autowired
private ICardTemplateAreaService iCardTemplateAreaService;
@Override @Override
public SuccessResultData<String> saveCardTemplateUseAreaByToken(String userId, CardTemplateUseAreaVO cardTemplateUseAreaVO) throws Exception { public SuccessResultData<String> saveCardTemplateUseAreaByToken(String userId, CardTemplateUseAreaVO cardTemplateUseAreaVO) throws Exception {
@ -66,12 +71,21 @@ public class CardTemplateUseAreaServiceImpl extends AbstractService implements I
public CardTemplateUseAreaDTO getCardTemplateUseAreaById(String cardTemplateUseAreaId) throws SearchException { public CardTemplateUseAreaDTO getCardTemplateUseAreaById(String cardTemplateUseAreaId) throws SearchException {
Map<String, Object> params = super.getHashMap(1); Map<String, Object> params = super.getHashMap(1);
params.put("cardTemplateUseAreaId", cardTemplateUseAreaId); params.put("cardTemplateUseAreaId", cardTemplateUseAreaId);
return cardTemplateUseAreaDao.getCardTemplateUseArea(params); CardTemplateUseAreaDTO useAreaDTO = cardTemplateUseAreaDao.getCardTemplateUseArea(params);
Map<String, Object> queryParams = super.getHashMap(1);
CardTemplateAreaDTO areaDTO = iCardTemplateAreaService.getCardTemplateAreaById(useAreaDTO.getTemplateAreaId());
useAreaDTO.setCardTemplateAreaDTO(areaDTO);
return useAreaDTO;
} }
@Override @Override
public List<CardTemplateUseAreaDTO> listCardTemplateUseArea(Map<String, Object> params) throws SearchException { public List<CardTemplateUseAreaDTO> listCardTemplateUseArea(Map<String, Object> params) throws SearchException {
return cardTemplateUseAreaDao.listCardTemplateUseArea(params); List<CardTemplateUseAreaDTO> useAreaDTOList = cardTemplateUseAreaDao.listCardTemplateUseArea(params);
for(CardTemplateUseAreaDTO useAreaDTO : useAreaDTOList) {
CardTemplateAreaDTO areaDTO = iCardTemplateAreaService.getCardTemplateAreaById(useAreaDTO.getTemplateAreaId());
useAreaDTO.setCardTemplateAreaDTO(areaDTO);
}
return useAreaDTOList;
} }
@Override @Override

View File

@ -195,7 +195,7 @@
AND AND
dt2.is_delete = 0 dt2.is_delete = 0
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0 AND t1.creator = #{creator}
<if test="keywords != null and keywords != ''"> <if test="keywords != null and keywords != ''">
AND ( AND (
t1.id LIKE CONCAT('%', #{keywords}, '%') t1.id LIKE CONCAT('%', #{keywords}, '%')
@ -219,6 +219,7 @@
#{cardTemplateUseIds[${index}]} #{cardTemplateUseIds[${index}]}
</foreach> </foreach>
</if> </if>
ORDER BY t1.gmt_create
</select> </select>
<!-- 模板使用统计 --> <!-- 模板使用统计 -->

View File

@ -164,6 +164,9 @@
AND AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime} LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if> </if>
<if test="templateUseId != null and templateUseId != ''">
AND t1.template_use_id = #{templateUseId}
</if>
<if test="cardTemplateUseAreaIds != null and cardTemplateUseAreaIds.size > 0"> <if test="cardTemplateUseAreaIds != null and cardTemplateUseAreaIds.size > 0">
AND AND
t1.card_template_use_area_id IN t1.card_template_use_area_id IN
@ -171,6 +174,7 @@
#{cardTemplateUseAreaIds[${index}]} #{cardTemplateUseAreaIds[${index}]}
</foreach> </foreach>
</if> </if>
ORDER BY t1.gmt_create
</select> </select>
<!-- 模板使用区域数据统计 --> <!-- 模板使用区域数据统计 -->