diff --git a/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardconfigcolumn/CardConfigColumnAppController.java b/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardconfigcolumn/CardConfigColumnAppController.java new file mode 100644 index 0000000..b66bd23 --- /dev/null +++ b/src/main/java/cn/com/tenlion/systemcard/controller/app/api/cardconfigcolumn/CardConfigColumnAppController.java @@ -0,0 +1,114 @@ +package cn.com.tenlion.systemcard.controller.app.api.cardconfigcolumn; + +import cn.com.tenlion.configcolumn.pojo.dtos.configcolumn.ConfigColumnDTO; +import cn.com.tenlion.configcolumn.pojo.vos.configcolumn.ConfigColumnVO; +import cn.com.tenlion.configcolumn.service.configcolumn.IConfigColumnService; +import cn.com.tenlion.systemcard.pojo.dtos.cardcharge.CardChargeDTO; +import cn.com.tenlion.systemcard.service.cardcharge.ICardChargeService; +import ink.wgink.annotation.CheckRequestBodyAnnotation; +import ink.wgink.common.base.DefaultBaseController; +import ink.wgink.common.component.SecurityComponent; +import ink.wgink.interfaces.consts.ISystemConstant; +import ink.wgink.pojo.ListPage; +import ink.wgink.pojo.result.ErrorResult; +import ink.wgink.pojo.result.SuccessResult; +import ink.wgink.pojo.result.SuccessResultData; +import ink.wgink.pojo.result.SuccessResultList; +import ink.wgink.util.ReflectUtil; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * @ClassName: CardConfigColumnAppController + * @Description: + * @Author: CodeFactory + * @Date: 2021-06-26 13:49:46 + * @Version: 3.0 + **/ +@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "接口") +@RestController +@RequestMapping(ISystemConstant.APP_PREFIX + "/cardconfigcolumn") +public class CardConfigColumnAppController extends DefaultBaseController { + + @Autowired + private IConfigColumnService configColumnService; + + @Autowired + private ICardChargeService iCardChargeService; + + @Autowired + protected SecurityComponent securityComponent; + + @ApiOperation(value = "首页栏目列表", notes = "首页栏目列表") + @ApiImplicitParams({ + @ApiImplicitParam(name = "token", value = "token", paramType = "header") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listhome") + public List listHome(@RequestHeader("token") String token) throws ReflectUtil.ReflectException { + String userId = securityComponent.getAppTokenUser(token).getId(); + CardChargeDTO cardChargeDTO = iCardChargeService.getLastEngTime(userId, "2"); + Map params = requestParams(); + if(cardChargeDTO == null) { + params.put("configColumnRole", "0"); + }else{ + switch (cardChargeDTO.getCardChargeMode()) { + case "1" : + params.put("configColumnRole", "1"); + break; + case "2" : // 企业普通版 + // 查询公司表 , 判断是否为公司负责人 , 如果只是公司员工则不显示 + params.put("configColumnRole", "2"); + break; + case "3" : + // 查询公司表 , 判断是否为公司负责人 , 如果只是公司员工则不显示 + params.put("configColumnRole", "3"); + break; + case "4" : + params.put("configColumnRole", "0"); + break; + } + } + params.put("configColumnDefault", "1"); + return configColumnService.listApp(token, params); + } + + @ApiOperation(value = "列表", notes = "列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "token", value = "token", paramType = "header") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("list") + public List list(@RequestHeader("token") String token) throws ReflectUtil.ReflectException { + String userId = securityComponent.getAppTokenUser(token).getId(); + CardChargeDTO cardChargeDTO = iCardChargeService.getLastEngTime(userId, "2"); + Map params = requestParams(); + if(cardChargeDTO == null) { + params.put("configColumnRole", "0"); + }else{ + switch (cardChargeDTO.getCardChargeMode()) { + case "1" : + params.put("configColumnRole", "1"); + break; + case "2" : // 企业普通版 + // 查询公司表 , 判断是否为公司负责人 , 如果只是公司员工则不显示 + params.put("configColumnRole", "2"); + break; + case "3" : + // 查询公司表 , 判断是否为公司负责人 , 如果只是公司员工则不显示 + params.put("configColumnRole", "3"); + break; + case "4" : + params.put("configColumnRole", "0"); + break; + } + } + return configColumnService.listApp(token, params); + } + +} \ No newline at end of file