Commit 350c58e5 authored by chenzhao's avatar chenzhao

存量合同2.0开发 接口补充

parent dcb75a28
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.hygf.api.entity.HistoryPeasantHousehold;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
import com.yeejoin.amos.component.robot.BadRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -183,7 +184,7 @@ public class HistoryPeasantHouseholdController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "存量合同电站下载", notes = "存量合同电站下载")
@GetMapping(value = "/export")
public void downTemplate(HttpServletResponse response,@RequestParam(value = "ids") List<String> ids) {
public void downTemplate(HttpServletResponse response,@RequestParam(value = "ids",required = false) List<String> ids) {
historyPeasantHouseholdServiceImpl.exportData(response,ids);
}
......
......@@ -88,8 +88,13 @@ public class HistoryPeasantHouseholdServiceImpl extends BaseService<HistoryPeasa
public void exportData(HttpServletResponse response, List<String> ids ){
LambdaQueryWrapper<HistoryPeasantHousehold> wrapper = new LambdaQueryWrapper<>();
wrapper.in(BaseEntity::getSequenceNbr,ids);
List<HistoryPeasantHousehold> list = this.getBaseMapper().selectBatchIds(ids);
List<HistoryPeasantHousehold> list = new ArrayList<>();
if (CollectionUtil.isNotEmpty(ids)){
wrapper.in(BaseEntity::getSequenceNbr,ids);
list = this.getBaseMapper().selectBatchIds(ids);
}else {
list = this.getBaseMapper().selectList(wrapper);
}
if (CollectionUtil.isNotEmpty(list)){
ExcelUtil.createTemplate(response,"存量合同电站","存量合同电站",list,HistoryPeasantHouseholdDto.class,null,false);
......@@ -97,6 +102,14 @@ public class HistoryPeasantHouseholdServiceImpl extends BaseService<HistoryPeasa
}
public HistoryPeasantHouseholdDto updateStation(HistoryPeasantHouseholdDto model){
LambdaQueryWrapper<HistoryPeasantHousehold> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(HistoryPeasantHousehold::getPeasantHouseholdNo,model.getPeasantHouseholdNo());
wrapper.ne(BaseEntity::getSequenceNbr,model.getSequenceNbr());
List<HistoryPeasantHousehold> list = this.getBaseMapper().selectList(wrapper);
if (CollectionUtil.isNotEmpty(list)){
throw new BadRequest("农户编号重复");
}
if (model.getStatus().equals("已提交")){
FinancingInfoHistory financingInfoHistory = new FinancingInfoHistory();
financingInfoHistory.setPeasantHouseholdId(model.getSequenceNbr());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment