Commit 8c977963 by 闫恒

Merge branch 'feature/sales_management' into 'develop'

[修改] 演示bug修改,增加日志记录

See merge request kunlun/xyst_dinas/xyst_dinas_backend!84
parents 6763dde5 563bec86
package com.xyst.dinas.sales.internal.service;
import com.beecode.amino.core.Amino;
import com.beecode.bap.attachment.common.Page;
import com.beecode.bap.log.LogConstants;
import com.beecode.bap.log.service.LogService;
import com.beecode.bcp.type.KClass;
import com.beecode.bcp.type.KObject;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.beecode.inz.common.exception.BusinessException;
......@@ -10,6 +14,7 @@ import com.xyst.dinas.contract.internal.dao.ContractDao;
import com.xyst.dinas.contract.service.ContractService;
import com.xyst.dinas.project.dao.ProjectFiledDao;
import com.xyst.dinas.project.dao.PurchaseSandCompanyDao;
import com.xyst.dinas.sales.constant.ShipQuantityConstant;
import com.xyst.dinas.sales.dao.ShipQuantityDao;
import com.xyst.dinas.sales.enumeration.VehicleAmountPartyErrorCodeEnum;
import com.xyst.dinas.sales.service.ShipQuantityService;
......@@ -47,6 +52,9 @@ public class ShipQuantityServiceImpl implements ShipQuantityService {
@Autowired
private ShipInfoDao shipInfoDao;
@Autowired
private LogService logService;
/**
* @Author yanHeng
* @Date 2022/4/6 11:36
......@@ -70,6 +78,14 @@ public class ShipQuantityServiceImpl implements ShipQuantityService {
kObject.set("dinasType", dinasTypeDao.load(dinasTypeId));
UUID uuid = shipQuantityDao.create(kObject);
//记录操作日志
KObject log = Amino.getApplicationContext()
.getBean(LogConstants.LOG_ENTIY_NAME, KClass.class).newInstance();
log.set("module", ShipQuantityConstant.ENTITY);
log.set("businessObjectId", uuid);
log.set("logContent", "新增了这条运船量方数据");
logService.addLog(log);
//扣减预付款余额 ,取得总价 进行扣减
//查询合同余额,如果预付款小于总价,不允许交易
BigDecimal amount ;
......@@ -123,6 +139,14 @@ public class ShipQuantityServiceImpl implements ShipQuantityService {
}else{
shipQuantityDao.deleteById(id);
}
//记录操作日志
KObject log = Amino.getApplicationContext()
.getBean(LogConstants.LOG_ENTIY_NAME, KClass.class).newInstance();
log.set("module", ShipQuantityConstant.ENTITY);
log.set("businessObjectId", id);
log.set("logContent", "删除了这条运船量方数据");
logService.addLog(log);
return ResponseObj.success("删除成功");
}
}
package com.xyst.dinas.sales.internal.service;
import com.beecode.amino.core.Amino;
import com.beecode.bap.attachment.common.Page;
import com.beecode.bap.log.LogConstants;
import com.beecode.bap.log.service.LogService;
import com.beecode.bcp.type.KClass;
import com.beecode.bcp.type.KObject;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.beecode.inz.common.exception.BusinessException;
......@@ -10,6 +14,7 @@ import com.xyst.dinas.contract.internal.dao.ContractDao;
import com.xyst.dinas.contract.service.ContractService;
import com.xyst.dinas.project.dao.ProjectFiledDao;
import com.xyst.dinas.project.dao.PurchaseSandCompanyDao;
import com.xyst.dinas.sales.constant.VehicleAmountPartyConstant;
import com.xyst.dinas.sales.dao.VehicleAmountPartyDao;
import com.xyst.dinas.sales.enumeration.VehicleAmountPartyErrorCodeEnum;
import com.xyst.dinas.sales.service.VehicleAmountPartyService;
......@@ -47,6 +52,9 @@ public class VehicleAmountPartyServiceImpl implements VehicleAmountPartyService
@Autowired
ContractService contractService;
@Autowired
private LogService logService;
/**
* @Author yanHeng
* @Date 2022/4/6 11:36
......@@ -73,6 +81,14 @@ public class VehicleAmountPartyServiceImpl implements VehicleAmountPartyService
kObject.set("dinasType", dinasTypeDao.load(dinasTypeId));
UUID uuid = vehicleAmountPartyDao.create(kObject);
//记录操作日志
KObject log = Amino.getApplicationContext()
.getBean(LogConstants.LOG_ENTIY_NAME, KClass.class).newInstance();
log.set("module", VehicleAmountPartyConstant.ENTITY);
log.set("businessObjectId", uuid);
log.set("logContent", "新增了这条车辆量方数据");
logService.addLog(log);
//扣减预付款余额 ,取得总价 进行扣减
//查询合同余额,如果预付款小于总价,不允许交易
BigDecimal amount ;
......@@ -90,6 +106,7 @@ public class VehicleAmountPartyServiceImpl implements VehicleAmountPartyService
throw new BusinessException("预付款余额扣减失败",VehicleAmountPartyErrorCodeEnum.VEHICLE_AMOUNT_PARTY_ADVANCE_BALANCE);
}
return uuid;
}
......@@ -126,6 +143,14 @@ public class VehicleAmountPartyServiceImpl implements VehicleAmountPartyService
}else{
vehicleAmountPartyDao.deleteById(id);
}
//记录操作日志
KObject log = Amino.getApplicationContext()
.getBean(LogConstants.LOG_ENTIY_NAME, KClass.class).newInstance();
log.set("module", VehicleAmountPartyConstant.ENTITY);
log.set("businessObjectId", id);
log.set("logContent", "删除了这条车辆量方数据");
logService.addLog(log);
return ResponseObj.success("删除成功");
}
}
......@@ -2,6 +2,8 @@ package com.xyst.dinas.sales.web;
import com.beecode.amino.core.Amino;
import com.beecode.bap.attachment.common.Page;
import com.beecode.bap.log.LogConstants;
import com.beecode.bap.log.service.LogService;
import com.beecode.bcp.type.KClass;
import com.beecode.bcp.type.KObject;
import com.beecode.bcp.type.json.JSONObjectUtils;
......@@ -28,7 +30,8 @@ public class ShipQuantityController {
@Autowired
private ShipQuantityService shipQuantity;
@Autowired
private LogService logService;
/**
* 新建运船量方
*
......@@ -148,10 +151,25 @@ public class ShipQuantityController {
if(id == null){
return ResponseObj.error(400,"'id' must be not null!");
}
return shipQuantity.deleteById(id);
}
@PostMapping("/addLog")
public ResponseObj addLog(@RequestParam("id") UUID id,
@RequestParam("module") String module,
@RequestParam("logContent") String logContent) {
//记录操作日志
KObject log = Amino.getApplicationContext()
.getBean(LogConstants.LOG_ENTIY_NAME, KClass.class).newInstance();
log.set("module", module);
log.set("businessObjectId", id);
log.set("logContent", logContent);
logService.addLog(log);
return ResponseObj.success("保存成功", id);
}
@GetMapping("/test")
public ResponseObj init(@RequestParam("id") String id) {
System.out.println("testok");
......
......@@ -3,7 +3,7 @@
<type>bcp.authz.Privilege</type>
<package>com.xyst.dinas.sales.auth</package>
<name>ShipQuantityPrice</name>
<title>折方单价配置</title>
<title>船运单价配置</title>
<tags></tags>
<description></description>
</header>
......
......@@ -3,7 +3,7 @@
<specification>1.0</specification>
<id>22357852-7323-4b8f-abca-e0638ea0f8fa</id>
<name>com.xyst.dinas.sales.auth.ShipQuantityPrice</name>
<title>折方单价配置</title>
<title>船运单价配置</title>
<define>bcp.authz.privilege</define>
<define-version>1.0.0</define-version>
<content>
......
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