Commit f462b681 authored by chenzhao's avatar chenzhao

修复补货问题

parent 5123d576
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
......@@ -29,6 +31,6 @@ public class HygfReplenishmentDto extends BaseDto {
private String comment;
@ApiModelProperty(value = "补货文件")
private List<Object> file;
private String file;
}
......@@ -41,6 +41,6 @@ public class HygfReplenishment extends BaseEntity {
* 补货文件
*/
@TableField(value = "file" , typeHandler = FastjsonTypeHandler.class)
private String file;
private List<Object> file;
}
package com.yeejoin.amos.boot.module.hygf.api.mapper;
import com.yeejoin.amos.boot.module.hygf.api.dto.HygfReplenishmentDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.HygfReplenishment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* Mapper 接口
*
......@@ -11,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface HygfReplenishmentMapper extends BaseMapper<HygfReplenishment> {
List<HygfReplenishmentDto> selectData(Long sequenceNbr);
}
package com.yeejoin.amos.boot.module.hygf.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
import org.apache.ibatis.annotations.Param;
......
......@@ -2,4 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.HygfReplenishmentMapper">
<select id="selectData" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.HygfReplenishmentDto">
select * from hygf_replenishment where preparation_money_id = #{sequenceNbr}
</select>
</mapper>
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.PreparationMoneyDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.PreparationPageDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.UserUnitInformationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.DesignInformation;
import com.yeejoin.amos.boot.module.hygf.api.entity.HygfReplenishment;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
......@@ -24,6 +22,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.seata.spring.annotation.GlobalTransactional;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -69,6 +68,7 @@ public class PreparationMoneyController extends BaseController {
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增发货单", notes = "新增发货单")
@GlobalTransactional
@UserLimits
public ResponseModel<PreparationMoney> save( @RequestParam("isSubmit") String isSubmit, @RequestBody PreparationMoney model) {
AgencyUserModel agencyUserModel= getUserInfo();
model = preparationMoneyServiceImpl.saveOrUpdateObjectNew(model,agencyUserModel, isSubmit);
......@@ -278,7 +278,9 @@ public class PreparationMoneyController extends BaseController {
@ApiOperation(httpMethod = "POST",value = "补货申请", notes = "补货申请")
@GlobalTransactional
public ResponseModel replenishmentSubmit( @RequestBody HygfReplenishment hygfReplenishment) {
// HygfReplenishment hygfReplenishment1 = new HygfReplenishment();
// BeanUtils.copyProperties(hygfReplenishment,hygfReplenishment1);
// hygfReplenishment1.setFile(JSON.toJSONString(hygfReplenishment.getFile()));
hygfReplenishmentService.save(hygfReplenishment);
preparationMoneyServiceImpl.replenishmentSubmit(hygfReplenishment.getPreparationMoneyId());
return CommonResponseNewUtil.success();
......
......@@ -190,17 +190,16 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
List<DocumentStation> li = documentStationMapper.selectList(q);
preparationMoney.setPeasantHouseholdId(li);
LambdaQueryWrapper<HygfReplenishment> h = new LambdaQueryWrapper<>();
h.eq(HygfReplenishment::getPreparationMoneyId,sequenceNbr);
List<HygfReplenishment> hygfReplenishments = hygfReplenishmentMapper.selectList(h);
List<HygfReplenishmentDto> hygfReplenishmentDtos = new ArrayList<>();
if (CollectionUtil.isNotEmpty(hygfReplenishments) && !hygfReplenishments.isEmpty() ){
hygfReplenishments.forEach(e->{
HygfReplenishmentDto hygfReplenishmentDto = new HygfReplenishmentDto();
BeanUtils.copyProperties(e,hygfReplenishmentDto);
hygfReplenishmentDto.setFile(JSON.parseArray(e.getFile()));
hygfReplenishmentDtos.add(hygfReplenishmentDto);
List<HygfReplenishment> hygfReplenishments = new ArrayList<>();
List<HygfReplenishmentDto> hygfReplenishmentDtos = hygfReplenishmentMapper.selectData(sequenceNbr);
if (CollectionUtil.isNotEmpty(hygfReplenishmentDtos) && !hygfReplenishmentDtos.isEmpty() ){
hygfReplenishmentDtos.forEach(e->{
HygfReplenishment hygfReplenishment = new HygfReplenishment();
BeanUtils.copyProperties(e,hygfReplenishment);
hygfReplenishment.setFile(JSON.parseArray(e.getFile()));
hygfReplenishments.add(hygfReplenishment);
});
preparationMoney.setFiles(hygfReplenishmentDtos);
......@@ -228,11 +227,11 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
public Map<String, Object> selectOnePreparationMoney(String sequenceNbr) {
Map<String, Object> map = new HashMap<>();
LambdaUpdateWrapper<PreparationMoney> qu = new LambdaUpdateWrapper<>();
LambdaQueryWrapper<PreparationMoney> qu = new LambdaQueryWrapper<>();
qu.eq(PreparationMoney::getSequenceNbr, sequenceNbr);
PreparationMoney preparationMoney = preparationMoneyMapper.selectOne(qu);
LambdaUpdateWrapper<HygfPreparationMoneyAuditing> audit = new LambdaUpdateWrapper<>();
LambdaQueryWrapper<HygfPreparationMoneyAuditing> audit = new LambdaQueryWrapper<>();
audit.eq(HygfPreparationMoneyAuditing::getPreparationMoneyId,sequenceNbr);
List<HygfPreparationMoneyAuditing> hygfPreparationMoneyAuditings = hygfPreparationMoneyAuditingService.getBaseMapper().selectList(audit);
if (CollectionUtil.isNotEmpty(hygfPreparationMoneyAuditings) && hygfPreparationMoneyAuditings.size()>0 ){
......@@ -271,7 +270,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
LambdaUpdateWrapper<DocumentStation> q = new LambdaUpdateWrapper<>();
LambdaQueryWrapper<DocumentStation> q = new LambdaQueryWrapper<>();
q.eq(DocumentStation::getPreparationMoneyId, sequenceNbr);
List<DocumentStation> lih = documentStationMapper.selectList(q);
preparationMoney.setPeasantHouseholdId(lih);
......@@ -321,22 +320,23 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
designInformation.setCable(cable);
Map<String, Object> map2 = Bean.BeantoMap(preparationMoney);
LambdaUpdateWrapper<HygfReplenishment> h = new LambdaUpdateWrapper<>();
h.eq(HygfReplenishment::getPreparationMoneyId,sequenceNbr);
List<HygfReplenishment> hygfReplenishments = hygfReplenishmentMapper.selectList(h);
List<HygfReplenishmentDto> hygfReplenishmentDtos = new ArrayList<>();
if (CollectionUtil.isNotEmpty(hygfReplenishments) && !hygfReplenishments.isEmpty() ){
hygfReplenishments.forEach(e->{
HygfReplenishmentDto hygfReplenishmentDto = new HygfReplenishmentDto();
BeanUtils.copyProperties(e,hygfReplenishmentDto);
hygfReplenishmentDto.setFile(JSON.parseArray(e.getFile()));
hygfReplenishmentDtos.add(hygfReplenishmentDto);
});
map2.put("files",hygfReplenishmentDtos);
List<HygfReplenishment> hygfReplenishments = new ArrayList<>();
List<HygfReplenishmentDto> hygfReplenishmentDtos = hygfReplenishmentMapper.selectData(Long.valueOf(sequenceNbr));
if (CollectionUtil.isNotEmpty(hygfReplenishmentDtos) && !hygfReplenishmentDtos.isEmpty() ) {
hygfReplenishmentDtos.forEach(e -> {
HygfReplenishment hygfReplenishment = new HygfReplenishment();
BeanUtils.copyProperties(e, hygfReplenishment);
hygfReplenishment.setFile(JSON.parseArray(e.getFile()));
hygfReplenishments.add(hygfReplenishment);
});
map2.put("files",hygfReplenishments);
}
map.put("preparationMoney", map2);
map.put("designInformation", designInformation);
Map<String, Object> map1 = new HashMap<>();
......@@ -711,13 +711,20 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
}
List<DocumentStation> ids = model.getPeasantHouseholdId();
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
String cState = "暂存发货";
String pState = "暂存发货";
if (isSubmit.equals("0")) {
if (CollUtil.isEmpty(ids) && ids.isEmpty() ){
throw new BadRequest("提交时选择电站不可为空");
}
// LambdaUpdateWrapper<PeasantHousehold> up1 = new LambdaUpdateWrapper<>();
//更新电站施工状态
up.set(PeasantHousehold::getPreparationMoneyState, DeliveryStateeEnum.已发货.getCode());
up.set(PeasantHousehold::getConstructionState, DeliveryStateeEnum.已发货.getCode());
cState = DeliveryStateeEnum.已发货.getCode();
pState = DeliveryStateeEnum.已发货.getCode();
//提交时 赋值发货时间及订单状态
model.setDeliveryTime(new Date());
model.setOrderStatus(DeliveryStateeEnum.待确认.getName());
......@@ -744,8 +751,12 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
hygfPreparationMoneyAuditingDto.setPreparationMoneyId(model.getSequenceNbr());
hygfPreparationMoneyAuditingDto.setPromoter(RequestContext.getExeUserId());
hygfPreparationMoneyAuditingService.createWithModel(hygfPreparationMoneyAuditingDto);
peasantHouseholdMapper.update(null, up);
List<Long> collect = ids.stream().map(DocumentStation::getStationId).collect(Collectors.toList());
// up1.in(BaseEntity::getSequenceNbr,collect);
// peasantHouseholdMapper.update(null, up1);
}else {
up.set(PeasantHousehold::getPreparationMoneyState, DeliveryStateeEnum.暂存发货.getCode());
up.set(PeasantHousehold::getConstructionState, DeliveryStateeEnum.暂存发货.getCode());
}
preparationMoneyMapper.updateById(model);
......
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