| | |
| | | package com.xzx.gc.user.controller; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.xzx.gc.common.Result; |
| | | import com.xzx.gc.common.constant.CommonEnum; |
| | | import com.xzx.gc.common.constant.Constants; |
| | | import com.xzx.gc.common.dto.log.OperationAppLog; |
| | | import com.xzx.gc.common.request.BaseController; |
| | | import com.xzx.gc.entity.JhyInfo; |
| | | import com.xzx.gc.entity.RedPaperRule; |
| | | import com.xzx.gc.model.JsonResult; |
| | | import com.xzx.gc.user.dto.ExamineJwyDto; |
| | | import com.xzx.gc.user.dto.UpdateSettingDto; |
| | | import com.xzx.gc.user.dto.ViewSettingDto; |
| | | import com.xzx.gc.user.service.FxSysService; |
| | | import com.xzx.gc.user.mapper.RedPaperRuleMapper; |
| | | import com.xzx.gc.user.service.DistribService; |
| | | import com.xzx.gc.user.vo.ViewSettingVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | @RestController |
| | | @Api(tags = {"分銷系統管理"}) |
| | | public class AdminDistribController extends BaseController { |
| | | |
| | | @Autowired |
| | | private FxSysService fxSysService; |
| | | @Resource |
| | | private DistribService distribService; |
| | | |
| | | @Resource |
| | | private RedPaperRuleMapper redPaperRuleMapper; |
| | | |
| | | /** |
| | | * 查看分銷系統设置详情 |
| | |
| | | @ApiResponses({@ApiResponse( code = 200, message = "success", response = ViewSettingVo.class)}) |
| | | @ApiOperation(value="分銷系統管理-查看分銷系統设置详情", notes="test: 仅0有正确返回") |
| | | public JsonResult<ViewSettingVo> viewSetting(@RequestBody ViewSettingDto viewSettingDto) { |
| | | Long id = viewSettingDto.getId(); |
| | | ViewSettingVo viewSettingVo = fxSysService.viewSetting(id); |
| | | ViewSettingVo viewSettingVo = distribService.viewSetting("分销规则"); |
| | | return JsonResult.success(viewSettingVo); |
| | | } |
| | | |
| | | /** |
| | | * 更新分銷系統设置 |
| | | */ |
| | | @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/jhy/updateSetting.json") |
| | | @ApiOperation(value="分銷系統管理--更新分銷系統设置", notes="test: 仅0有正确返回") |
| | | public JsonResult updateSetting(@RequestBody UpdateSettingDto model, HttpServletRequest request) { |
| | | |
| | | RedPaperRule redPaperRule = redPaperRuleMapper.selectByRuleName("分销规则"); |
| | | if(ObjectUtil.isEmpty(redPaperRule)){ |
| | | distribService.addSetting(model); |
| | | OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request)) |
| | | .methodName(Constants.USER_MODUL_NAME).operateAction("分銷系統管理--新增分銷系統设置").build(); |
| | | mqUtil.sendApp(build); |
| | | }else{ |
| | | Integer id = model.getId(); |
| | | if(redPaperRule.getId() != id){ |
| | | return JsonResult.failMessage("规则不存在!"); |
| | | } |
| | | distribService.updateSetting(model); |
| | | OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request)) |
| | | .methodName(Constants.USER_MODUL_NAME).operateAction("分銷系統管理--更新分銷系統设置-" + model.getId()).build(); |
| | | mqUtil.sendApp(build); |
| | | } |
| | | return JsonResult.success("操作成功!"); |
| | | } |
| | | |
| | | |
| | | |
| | | } |