commit for pull

This commit is contained in:
caixiang
2023-02-22 20:48:15 +08:00
parent 4535677c93
commit 4d1a58b8c7
24 changed files with 1179 additions and 3 deletions

View File

@@ -0,0 +1,50 @@
package com.cnbm.packing.service;
import com.cnbm.dynamic.datasource.annotation.DataSource;
import com.cnbm.packing.dto.WoPowerLevelDTO;
import com.cnbm.packing.mapper.CamlineMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/2/15 14:19
*/
@Service
public class DynamicDataSourceService {
@Autowired
CamlineMapper mapper;
@Autowired
WoPowerLevelServiceBiz powerLevelServiceBiz;
@Transactional
@DataSource("slave1")
public void salve1Get(){
WoPowerLevelDTO woPowerLevelDTO = powerLevelServiceBiz.get(Long.valueOf(1));
System.out.println(woPowerLevelDTO.toString());
}
public void getTodayBoxNum(){
Integer todayBoxNum = mapper.getTodayBoxNum();
System.out.println(todayBoxNum);
}
public float getPMPPBySubId(String subId){
return mapper.getPMPPBySubId(subId);
}
@DataSource("slave2")
@Transactional
public void salve3Get(){
float byid = mapper.getByid("LTWeight");
System.out.println(byid);
}
}

View File

@@ -2,6 +2,7 @@ package com.cnbm.packing.service;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService;
import com.cnbm.packing.dto.CompensationPowerXSDTO;
import com.cnbm.packing.dto.WoCompensationPowerDTO;
import com.cnbm.packing.entity.WoCompensationPower;
@@ -16,6 +17,7 @@ import java.util.Map;
*/
public interface WoCompensationPowerServiceBiz extends CrudService<WoCompensationPower, WoCompensationPowerDTO> {
PageData<WoCompensationPowerDTO> page (Map<String, Object> params);
WoCompensationPowerDTO get(Long id);
@@ -27,5 +29,7 @@ public interface WoCompensationPowerServiceBiz extends CrudService<WoCompensatio
void delete(Long[] ids);
List<WoCompensationPowerDTO> list();
float calculCompensationPMPP(float pmpp, Integer lineBody);
}

View File

@@ -27,5 +27,6 @@ public interface WoPowerLevelServiceBiz extends CrudService<WoPowerLevel, WoPowe
void delete(Long[] ids);
List<WoPowerLevelDTO> list();
WoPowerLevel getArgByPMPP(float pmpp, Integer lineBody);
}

View File

@@ -6,11 +6,14 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.packing.dto.CompensationPowerXSDTO;
import com.cnbm.packing.dto.WoCompensationPowerDTO;
import com.cnbm.packing.entity.WoCompensationPower;
import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.mapper.WoCompensationPowerMapper;
import com.cnbm.packing.param.CompensationQueryParam;
import com.cnbm.packing.service.WoCompensationPowerServiceBiz;
import lombok.var;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -86,5 +89,21 @@ public class WoCompensationPowerServiceBizImpl extends CrudServiceImpl<WoCompens
List<WoCompensationPowerDTO> list = mapper.list();
return list;
}
@Override
public float calculCompensationPMPP(float pmpp, Integer lineBody) {
CompensationQueryParam compensationQueryParam = new CompensationQueryParam();
compensationQueryParam.setPmpp(pmpp);
compensationQueryParam.setLineBody(lineBody);
CompensationPowerXSDTO conffBySubIdAndLineBody = mapper.getConffBySubIdAndLineBody(compensationQueryParam);
float res = pmpp*conffBySubIdAndLineBody.getA()+conffBySubIdAndLineBody.getB();
return res;
}
public WoCompensationPowerMapper getMapper() {
return mapper;
}
}

View File

@@ -9,6 +9,7 @@ import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.packing.dto.WoPowerLevelDTO;
import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.mapper.WoPowerLevelMapper;
import com.cnbm.packing.param.CompensationQueryParam;
import com.cnbm.packing.service.WoPowerLevelServiceBiz;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -87,4 +88,11 @@ public class WoPowerLevelServiceBizImpl extends CrudServiceImpl<WoPowerLevelMapp
return list;
}
@Override
public WoPowerLevel getArgByPMPP(float pmpp, Integer lineBody) {
CompensationQueryParam compensationQueryParam = new CompensationQueryParam();
compensationQueryParam.setLineBody(lineBody);
compensationQueryParam.setPmpp(pmpp);
return mapper.getPowerLevelByLineBodyAndPMPP(compensationQueryParam);
}
}