Commit 03979a97 authored by yangyang's avatar yangyang

Merge remote-tracking branch 'origin/developer' into developer

parents bba2959b 359e40d0
......@@ -22,4 +22,5 @@ public class PreparationDto {
String deliveryTimeStart;
String deliveryTimeEnd;
String flag ;
String orderStatus;
}
......@@ -29,5 +29,6 @@ public class PreparationPageDto extends Page<PreparationMoney> {
String deliveryTimeStart;
String deliveryTimeEnd;
String flag ;
String orderStatus;
}
......@@ -29,7 +29,7 @@ public interface PreparationMoneyMapper extends BaseMapper<PreparationMoney> {
@UserEmpower(field ={"regional_companies_code"} ,dealerField={"amos_unit_org_code","regional_companies_code"} ,fieldConditions ={"eq","in"} ,relationship="and")
List<PreparationMoney> selectPageList(@Param(value = "dto") PreparationDto preparationDto);
@UserEmpower(field ={"regional_companies_code"} ,dealerField={"amos_unit_org_code","regional_companies_code"} ,fieldConditions ={"eq","in"} ,relationship="and")
@UserEmpower(field ={"regional_companies_code"} ,dealerField={"developer_code","regional_companies_code"} ,fieldConditions ={"eq","in"} ,relationship="and")
List<Map<String,Object>> preparationStation (@Param(value = "preparationMoneyState") String preparationMoneyState,
@Param(value = "ownersName") String ownersName,
@Param(value = "regionalCompaniesSeq") String regionalCompaniesSeq,
......
......@@ -32,7 +32,7 @@ on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nb
FROM hygf_peasant_household
where
hygf_peasant_household.construction_state='备货完成'
and hygf_peasant_household.developer_id like concat('%',#{developerId},'%')
and hygf_peasant_household.developer_code like concat('%',#{unitInfoCode},'%')
and hygf_peasant_household.regional_companies_seq=#{regionalCompaniesSeq}
and hygf_peasant_household.sequence_nbr not in (
select hygf_work_order_power_station.peasant_household_id from hygf_work_order_power_station
......
......@@ -13,7 +13,7 @@ LEFT JOIN hygf_document_station on hygf_document_station.station_id=hygf_peasan
</select>
<select id="selectPageList" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.PreparationMoney">
SELECT hygf_preparation_money.*,IFNULL(order_status,arrival_state) as arrivalState,IFNULL(order_status,delivery_state) as deliveryState,(select instance_id from hygf_preparation_money_auditing where preparation_money_id = hygf_preparation_money.sequence_nbr limit 1 ) as instanceId FROM hygf_preparation_money
SELECT hygf_preparation_money.*,IFNULL(order_status,arrival_state) as orderStatus,IFNULL(order_status,delivery_state) as deliveryState,(select instance_id from hygf_preparation_money_auditing where preparation_money_id = hygf_preparation_money.sequence_nbr limit 1 ) as instanceId FROM hygf_preparation_money
<where>
<if test="dto.consigneeRegion != null and dto.consigneeRegion != ''">
and hygf_preparation_money.consignee_region like concat ('%',#{dto.consigneeRegion},'%')
......@@ -24,8 +24,8 @@ LEFT JOIN hygf_document_station on hygf_document_station.station_id=hygf_peasan
<if test="dto.oddNumbers != null and dto.oddNumbers != ''">
and hygf_preparation_money.odd_numbers like concat ('%',#{dto.oddNumbers},'%')
</if>
<if test="dto.deliveryState != null and dto.deliveryState != ''">
and hygf_preparation_money.delivery_state = #{dto.deliveryState}
<if test="dto.orderStatus != null and dto.orderStatus != ''">
and hygf_preparation_money.order_status = #{dto.orderStatus}
</if>
<if test="dto.amosUnitId != null and dto.amosUnitId != ''">
and hygf_preparation_money.amos_unit_id = #{dto.amosUnitId}
......@@ -37,11 +37,11 @@ LEFT JOIN hygf_document_station on hygf_document_station.station_id=hygf_peasan
and hygf_preparation_money.delivery_time between #{dto.deliveryTimeStart} and #{dto.deliveryTimeEnd}
</if>
</where>
ORDER BY order_time DESC
ORDER BY rec_date DESC
</select>
<select id="preparationStation" resultType="java.util.Map">
select
select b.* from ( select
hygf_peasant_household.peasant_household_no as peasantHouseholdNo,
hygf_peasant_household.owners_name as ownersName,
hygf_peasant_household.regional_companies_name as regionalCompaniesName,
......@@ -54,19 +54,22 @@ LEFT JOIN hygf_document_station on hygf_document_station.station_id=hygf_peasan
concat_ws('/',hygf_peasant_household.project_address_name,hygf_peasant_household.project_address_detail) as address,
hygf_peasant_household.preparation_money_state preparationMoneyState,
hygf_document_station.preparation_money_id as preparationMoneyId,
hygf_preparation_money.delivery_time as deliveryTime,
hygf_preparation_money.arrival_time as arrivalTime,
(select instance_id from hygf_preparation_money_auditing where hygf_document_station.preparation_money_id = hygf_preparation_money_auditing.preparation_money_id limit 1) as instanceId from
hygf_peasant_household
LEFT JOIN hygf_document_station on hygf_peasant_household.sequence_nbr = hygf_document_station.station_id
LEFT JOIN hygf_power_station on hygf_peasant_household.sequence_nbr = hygf_power_station.peasant_household_id
LEFT JOIN hygf_preparation_money on hygf_preparation_money.sequence_nbr = hygf_document_station.preparation_money_id
<where>
<if test=" preparationMoneyState == 0 ">
and hygf_peasant_household.preparation_money_state in ('待发货','待补货','暂存发货')
</if>
<if test="regionalCompaniesSeq!=null and regionalCompaniesSeq !='' ">
and hygf_peasant_household.regional_companies_seq = #{regionalCompaniesSeq}
and hygf_peasant_household.regional_companies_code like concat('%',#{regionalCompaniesSeq},'%')
</if>
<if test="developerId!=null and developerId !=''">
and hygf_peasant_household.developer_id = #{developerId}
and hygf_peasant_household.developer_code like concat('%',#{developerId},'%')
</if>
<if test="state!=null and state !=''">
and hygf_peasant_household.preparation_money_state = #{state}
......@@ -79,6 +82,7 @@ LEFT JOIN hygf_document_station on hygf_document_station.station_id=hygf_peasan
</if>
</where>
GROUP BY hygf_peasant_household.sequence_nbr
order by hygf_peasant_household.sequence_nbr DESC
order by hygf_peasant_household.sequence_nbr DESC ) b
</select>
</mapper>
......@@ -132,7 +132,7 @@ public class PreparationMoneyController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping (value = "/page")
@ApiOperation(httpMethod = "post",value = "发货单分页查询", notes = "发货单分页查询")
@UserLimits
@UserLimits
public ResponseModel<IPage<PreparationMoney>> queryForPage(@RequestBody PreparationPageDto preparationPageDto
) {
......@@ -322,6 +322,7 @@ public class PreparationMoneyController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/preparationStation")
@ApiOperation(httpMethod = "GET",value = "发货电站", notes = "发货电站")
@UserLimits
public ResponseModel<IPage<Map<String,Object>>> preparationStation(
@RequestParam(value = "current") Integer current,
@RequestParam(value = "size") Integer size,
......
......@@ -120,8 +120,8 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
if (dto.getDeliveryTime() != null && !dto.getDeliveryTime().get(0).equals("")) {
// qw.between(dto.getDeliveryTime()!=null, PreparationMoney::getDeliveryTime, dto.getDeliveryTime().get(0), dto.getDeliveryTime().get(1));
dto.setDeliveryTimeStart(dto.getDeliveryTime().get(0));
dto.setDeliveryTimeEnd(dto.getDeliveryTime().get(1));
dto.setDeliveryTimeStart(dto.getDeliveryTime().get(0) + " 00:00:00");
dto.setDeliveryTimeEnd(dto.getDeliveryTime().get(1)+" 23:59:59");
}
// qw.orderBy(Boolean.TRUE, Boolean.FALSE, PreparationMoney::getOrderTime);
PreparationDto preparationDto = new PreparationDto();
......@@ -193,6 +193,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
LambdaQueryWrapper<HygfReplenishment> files = new LambdaQueryWrapper<>();
files.eq(HygfReplenishment::getPreparationMoneyId,sequenceNbr);
files.orderByDesc(BaseEntity::getRecDate);
List<HygfReplenishment> hygfReplenishments1 = hygfReplenishmentMapper.selectList(files);
if (CollectionUtil.isNotEmpty(hygfReplenishments1) && !hygfReplenishments1.isEmpty() ){
......@@ -317,6 +318,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
LambdaQueryWrapper<HygfReplenishment> files = new LambdaQueryWrapper<>();
files.eq(HygfReplenishment::getPreparationMoneyId,sequenceNbr);
files.orderByDesc(BaseEntity::getRecDate);
List<HygfReplenishment> hygfReplenishments = hygfReplenishmentMapper.selectList(files);
if (CollectionUtil.isNotEmpty(hygfReplenishments) && !hygfReplenishments.isEmpty() ){
......@@ -569,6 +571,12 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
}
public PreparationMoney saveOrUpdateObjectNew(PreparationMoney model, AgencyUserModel agencyUserModel, String isSubmit) {
if (null == model.getRegionalCompaniesSeq()){
throw new BadRequest("区域公司不可为空");
}
if (null == model.getAmosUnitId()){
throw new BadRequest("经销商不可为空");
}
if (model.getSequenceNbr() == null) {
//获取经销商单位信息
......@@ -697,20 +705,14 @@ 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();
up.set(PeasantHousehold::getPreparationMoneyState, ArrivalStateeEnum.待收货.getCode());
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.待收货.getCode());
//提交时 赋值发货时间及订单状态
model.setDeliveryTime(new Date());
model.setOrderStatus(DeliveryStateeEnum.待确认.getName());
......@@ -737,9 +739,6 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
hygfPreparationMoneyAuditingDto.setPreparationMoneyId(model.getSequenceNbr());
hygfPreparationMoneyAuditingDto.setPromoter(RequestContext.getExeUserId());
hygfPreparationMoneyAuditingService.createWithModel(hygfPreparationMoneyAuditingDto);
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());
......@@ -935,10 +934,10 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
for (DocumentStation documentStation : idsk) {
idsH.add(documentStation.getStationId());
}
up.in(PeasantHousehold::getSequenceNbr, idsH);
peasantHouseholdMapper.update(null, up);
if (CollectionUtil.isNotEmpty(idsH)){
up.in(PeasantHousehold::getSequenceNbr, idsH);
peasantHouseholdMapper.update(null, up);
}
preparationMoneyMapper.updateById(model);
//执行工作流并保存记录 上传收货走入下一节点 表达式=0
......@@ -968,6 +967,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
up.set(PeasantHousehold::getPreparationMoneyState, ArrivalStateeEnum.备货完成.getName());
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.备货完成.getName());
model.setOrderStatus(DeliveryStateeEnum.已完成.getName());
model.setArrivalTime(new Date());
} else if (kv.getOrDefault("approvalStatus", "").equals("1")) {
up.set(PeasantHousehold::getPreparationMoneyState, ArrivalStateeEnum.待收货.getName());
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.待收货.getName());
......@@ -975,8 +975,11 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
model.setDeliveryState(DeliveryStateeEnum.已发货.getName());
model.setOrderStatus(DeliveryStateeEnum.待确认.getName());
}
up.in(PeasantHousehold::getSequenceNbr, idsH);
peasantHouseholdMapper.update(null, up);
if (CollectionUtil.isNotEmpty(idsH)){
up.in(PeasantHousehold::getSequenceNbr, idsH);
peasantHouseholdMapper.update(null, up);
}
//更新发货单信息
preparationMoneyMapper.updateById(model);
......@@ -1092,6 +1095,12 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
}
public PreparationMoney submitOrder(PreparationMoney model, String instanceId, String isSubmit){
if (null == model.getRegionalCompaniesSeq()){
throw new BadRequest("区域公司不可为空");
}
if (null == model.getAmosUnitId()){
throw new BadRequest("经销商不可为空");
}
if ("1".equals(isSubmit)){
preparationMoneyMapper.updateById(model);
......@@ -1106,6 +1115,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
//isSubmit = 0 表示提交 也对应工作流表达式 可直接使用
model.setOrderStatus(DeliveryStateeEnum.待确认.getCode());
model.setDeliveryTime(new Date());
preparationMoneyMapper.updateById(model);
this.wofkflowExcute(instanceId,isSubmit,"");
......
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