fix (farm): 微服务API,微信端接口
- 微信端,获取多个服务token,用于切换服务
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.baseinfo;
|
||||
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.baseinfo.vo.*;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.baseinfo.vo.wx.BaseInfoForWxRespVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -108,4 +109,17 @@ public class BaseInfoController {
|
||||
BeanUtils.toBean(list, BaseInfoRespVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* === === 微信端 === ===
|
||||
*/
|
||||
// @GetMapping("/wx/base/list")
|
||||
// @Operation(summary = "微信端-常用地块集合")
|
||||
@GetMapping("/wx/base/list")
|
||||
@Operation(summary = "基地列表(微信端)")
|
||||
public CommonResult<List<BaseInfoForWxRespVO>> getBaseListForWx() {
|
||||
List<BaseInfoForWxRespVO> res = baseInfoService.getBaseListForWx();
|
||||
return success(res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.baseinfo.vo.wx;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description: for微信端
|
||||
* @author: binda
|
||||
* @date: 2025/9/16 18:38
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BaseInfoForWxRespVO {
|
||||
|
||||
private String baseId;
|
||||
private String baseName;
|
||||
private BigDecimal baseArea;
|
||||
private List<PLotInfo> pLotInfos;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class PLotInfo{
|
||||
@Schema(description = "地块ID")
|
||||
private String plotId;
|
||||
@Schema(description = "地块名称")
|
||||
private String plotName;
|
||||
@Schema(description = "地块面积")
|
||||
private BigDecimal plotArea;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseInfoRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseOverviewReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseOverviewRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.baseinfo.vo.*;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.baseinfo.vo.wx.BaseInfoForWxRespVO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
@@ -101,5 +102,9 @@ public interface BaseInfoService {
|
||||
|
||||
CommonResult<List<FarmBaseInfoRespVO>> getBaseInfoList(FarmBaseInfoReqVO req);
|
||||
|
||||
|
||||
/**
|
||||
* 基地列表 - 微信端
|
||||
* @return
|
||||
*/
|
||||
List<BaseInfoForWxRespVO> getBaseListForWx();
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseInfoRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseOverviewReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseOverviewRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.baseinfo.vo.*;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.baseinfo.vo.wx.BaseInfoForWxRespVO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.companyinfo.CompanyInfoDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.gridinfo.GridInfoDO;
|
||||
@@ -377,4 +378,27 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
||||
|
||||
return CommonResult.success(vos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaseInfoForWxRespVO> getBaseListForWx() {
|
||||
long tenantId = getLoginUser().getTenantId();
|
||||
LambdaQueryWrapperX<BaseInfoDO> wrapperX = new LambdaQueryWrapperX<>();
|
||||
wrapperX.eq(BaseInfoDO::getTenantId, tenantId);
|
||||
wrapperX.eq(BaseInfoDO::getDeleted, CommonConstants.NO_CODE);
|
||||
List<BaseInfoDO> list = baseInfoMapper.selectList(wrapperX);
|
||||
|
||||
return list.stream().map(e -> {
|
||||
String baseId = e.getId();
|
||||
List<PlotInfoDO> plotInfos = plotInfoService.getPlotInfos(baseId);
|
||||
List<BaseInfoForWxRespVO.PLotInfo> pLotInfos = plotInfos.stream().map(p -> new BaseInfoForWxRespVO.PLotInfo(p.getId(), p.getPlotName(), p.getPlotArea())).toList();
|
||||
|
||||
BaseInfoForWxRespVO b = new BaseInfoForWxRespVO();
|
||||
b.setBaseId(e.getId());
|
||||
b.setBaseName(e.getName());
|
||||
b.setBaseArea(e.getArea());
|
||||
b.setPLotInfos(pLotInfos);
|
||||
return b;
|
||||
}).toList();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -56,10 +56,15 @@
|
||||
AND production_start_date IS NOT NULL
|
||||
<if test="tenantId != null and tenantId != ''">AND tenant_id = #{tenantId}</if>
|
||||
<if test="baseId != null and baseId != ''">AND base_id = #{baseId}</if>
|
||||
<!-- 添加年份范围筛选 -->
|
||||
<if test="yieldDate != null and yieldDate.size() == 2">
|
||||
AND YEAR(production_start_date) BETWEEN #{yieldDate[0]} AND #{yieldDate[1]}
|
||||
</if>
|
||||
<!-- 年份范围筛选 -->
|
||||
<choose>
|
||||
<when test="yieldDate != null and yieldDate.size() == 2">
|
||||
AND YEAR(production_start_date) BETWEEN #{yieldDate[0]} AND #{yieldDate[1]}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND YEAR(production_start_date) BETWEEN YEAR(DATE_SUB(CURDATE(), INTERVAL 4 YEAR)) AND YEAR(CURDATE())
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
GROUP BY YEAR(production_start_date)
|
||||
ORDER BY date
|
||||
|
||||
Reference in New Issue
Block a user