Просмотр исходного кода

[系统][修改][添加菜单]

release_toaliyun_real
luozukai 6 лет назад
Родитель
Сommit
6a49b0811e
3 измененных файлов: 79 добавлений и 64 удалений
  1. +13
    -5
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java
  2. +1
    -1
      mallinkAdmin/src/main/resources/db/migration/V201907231537__L_ADD_MENU.sql
  3. +65
    -58
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java

+ 13
- 5
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java Просмотреть файл

@@ -84,14 +84,22 @@ public class WxRentContractController extends BaseController {
*/
@GetMapping("buildBillPriceList")
@SystemControllerLog(description = "租赁合同-生成账单列表金额")
public ResultData buildBillPriceList(@ModelAttribute WxRentContract wxRentContract) {
public ResultData buildBillPriceList(@ModelAttribute WxRentContract wxRentContract) throws Exception{
logger.debug("[" + getIpAddr() + "] WxRentContractController::buildBillPriceList");

//todo:test
wxRentContract.setId(312447858201595904l);
List<WxBillRent> previewBillRentList = new ArrayList<>();

wxRentContract.setPreviewBillRentList(previewBillRentList);
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// wxRentContract.setId(312447858201595904l);
// List<WxBillRent> previewBillRentList = new ArrayList<>();
// WxBillRent b = new WxBillRent();
// b.setStarttime(sdf.parse("2019-07-10"));
// b.setEndtime(sdf.parse("2020-08-10"));
// previewBillRentList.add(b);
// b = new WxBillRent();
// b.setStarttime(sdf.parse("2020-08-11"));
// b.setEndtime(sdf.parse("2021-07-30"));
// previewBillRentList.add(b);
// wxRentContract.setPreviewBillRentList(previewBillRentList);

WxRentContract dbRent = wxRentContractMapper.selectByPrimaryKey(wxRentContract.getId());
dbRent.setPreviewBillRentList(wxRentContract.getPreviewBillRentList());


mallinkAdmin/src/main/resources/db/migration/V201907231512__L_ADD_MENU.sql → mallinkAdmin/src/main/resources/db/migration/V201907231537__L_ADD_MENU.sql Просмотреть файл

@@ -1,7 +1,7 @@
INSERT INTO `mall_permission`
(`id`,`name`, `parent_id`,`available`,`permission`,`resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`,`sort`)
VALUES
(592, '短信管理', 50, 'Y', null, 0, null, null, 'dreamSend', 'icon-navicon-yhgl', 0, 592);
(592, '短信管理', 50, 'Y', null, 1, null, null, 'dreamSend', 'icon-navicon-dxgl', 0, 592);

DROP TABLE IF EXISTS `mall_sale_type` ;
CREATE TABLE `mall_sale_type` (

+ 65
- 58
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Просмотреть файл

@@ -1028,6 +1028,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
int index = 0;
for (int i = 0; i < billTimeVoList.size(); i++) {
BillTimeVo billTimeVo = billTimeVoList.get(i);
//计算金额
long needpay = 0;

if(yearList.size() > 1) {
if (endDate!=null && (sd.format(billTimeVo.getStartDate()).equals(sd.format(endDate)) || billTimeVo.getStartDate().after(endDate) || billTimeVo.getEndDate().after(endDate) )) {
@@ -1040,16 +1042,22 @@ public class WxRentContractServiceImpl implements WxRentContractService {
endDate = yearList.get(index+1);//price index 0开始,year.end 从第二年开始
logger.info("==========cross:"+sd.format(endDate));




//如果是计算账单金额&cross 拆分日期进行计算
if(!saveDb) {
logger.info("==========s:"+sd.format(billTimeVo.getStartDate()));
logger.info("==========e:"+sd.format(billTimeVo.getEndDate()));
logger.info("==========:"+sd.format(endDate));
long needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),billTimeVo.getEndDate(),i,billTimeVoList.size());
long needpayAfter = getNeedPayMoney(wxRentContract,priceArrs[index],billTimeVo.getStartDate(),billTimeVo.getEndDate(),i,billTimeVoList.size());
needpay = needpayFront+needpayAfter;
}else{
//计算金额
needpay = getNeedPayMoney(wxRentContract,priceArrs[index],billTimeVo.getStartDate(),billTimeVo.getEndDate(),i,billTimeVoList.size());
}
}
}
}

//获取price 、shopInfo
long price = priceArrs[index];

WxBillRent wxBillRent = new WxBillRent();
wxBillRent.setIsPreview(isPreview);
wxBillRent.setId(idWorker.nextId());
@@ -1059,57 +1067,6 @@ public class WxRentContractServiceImpl implements WxRentContractService {
wxBillRent.setEndtime(billTimeVo.getEndDate());
wxBillRent.setReceiveDate(billTimeVo.getReceiveDate());

long needpay;
//按日
if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){
Double priceD = new Double(price);
double needpayD = WxRentContractServiceImpl.getNeedPay(0,priceD,wxBillRent.getStarttime(),wxBillRent.getEndtime());
needpay = new Double(needpayD).longValue();
}else{
//年 需要除12
Double priceD = new Double(price);
if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){
priceD = new Double(price)/12;
}

SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM");
if(i == billTimeVoList.size()-1){//最后
if(isFirstDay(billTimeVo.getStartDate())){
int months = getMonths(sdM.format(billTimeVo.getStartDate())+"-01",sdM.format(billTimeVo.getEndDate())+"-01");
months++;
needpay = new Double(months * priceD).longValue();
}else {
needpay = new Double(getMonthNeedPay(priceD, billTimeVo.getStartDate(), billTimeVo.getEndDate())).longValue();
}
}else if(i == 0){//第一期
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){
if(isFirstDay(billTimeVo.getStartDate())){
int months = getMonths(sdM.format(billTimeVo.getStartDate())+"-01",sdM.format(billTimeVo.getEndDate())+"-01");
months++;
needpay = new Double(months * priceD).longValue();
}else{
needpay = new Double(getMonthNeedPay(priceD, billTimeVo.getStartDate(), billTimeVo.getEndDate())).longValue();
}
}else{
if(isFirstDay(billTimeVo.getStartDate())){
int months = getMonths(sdM.format(billTimeVo.getStartDate())+"-01",sdM.format(billTimeVo.getEndDate())+"-01");
if(isFirstDay(billTimeVo.getStartDate())){
months++;
}
needpay = new Double(months * priceD).longValue();
}else{
needpay = new Double(getMonthNeedPay(priceD, billTimeVo.getStartDate(), billTimeVo.getEndDate())).longValue();
}
}
}else{//中间
int months = getMonths(sdM.format(billTimeVo.getStartDate())+"-01",sdM.format(billTimeVo.getEndDate())+"-01");
if(isFirstDay(billTimeVo.getStartDate())){
months++;
}
needpay = new Double(months * priceD).longValue();
}
}

wxBillRent.setNeedPay(needpay);
wxBillRent.setOwe(needpay);
wxBillRent.setReceivePay(needpay);
@@ -1142,8 +1099,58 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return resultMap;
}

public long getNeedPay(){
public long getNeedPayMoney(WxRentContract wxRentContract,long price,Date startDate,Date endDate,int i,int billTimeVoListSize){
long needpay;
//按日
if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){
Double priceD = new Double(price);
double needpayD = WxRentContractServiceImpl.getNeedPay(0,priceD,startDate,endDate);
needpay = new Double(needpayD).longValue();
}else{
//年 需要除12
Double priceD = new Double(price);
if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){
priceD = new Double(price)/12;
}

SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM");
if(i == billTimeVoListSize - 1){//最后
if(isFirstDay(startDate)){
int months = getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01");
months++;
needpay = new Double(months * priceD).longValue();
}else {
needpay = new Double(getMonthNeedPay(priceD, startDate, endDate)).longValue();
}
}else if(i == 0){//第一期
if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){
if(isFirstDay(startDate)){
int months = getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01");
months++;
needpay = new Double(months * priceD).longValue();
}else{
needpay = new Double(getMonthNeedPay(priceD, startDate, endDate)).longValue();
}
}else{
if(isFirstDay(startDate)){
int months = getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01");
if(isFirstDay(startDate)){
months++;
}
needpay = new Double(months * priceD).longValue();
}else{
needpay = new Double(getMonthNeedPay(priceD, startDate, endDate)).longValue();
}
}
}else{//中间
int months = getMonths(sdM.format(startDate)+"-01",sdM.format(endDate)+"-01");
if(isFirstDay(startDate)){
months++;
}
needpay = new Double(months * priceD).longValue();
}
}
return needpay;
}

public void setExpiredDay(WxBillRent wxBillRent,int dayType, int receivePeriod){


Загрузка…
Отмена
Сохранить