@ -10,6 +10,7 @@ import com.lzbi.code.service.DcBaseCoderuleDefineService;
import com.lzbi.common.annotation.Log ;
import com.lzbi.common.core.controller.BaseController ;
import com.lzbi.common.core.domain.AjaxResult ;
import com.lzbi.common.core.domain.entity.SysDept ;
import com.lzbi.common.core.domain.model.LoginUser ;
import com.lzbi.common.core.page.TableDataInfo ;
import com.lzbi.common.enums.BusinessType ;
@ -22,6 +23,7 @@ import com.lzbi.draft.domain.DcBusiParamBillMaster;
import com.lzbi.draft.domain.DcBusiParamBillSub ;
import com.lzbi.draft.service.DcBusiBillModelMasterService ;
import com.lzbi.draft.service.DcBusiParamBillMasterService ;
import com.lzbi.system.service.ISysDeptService ;
import io.swagger.annotations.ApiImplicitParam ;
import io.swagger.annotations.ApiImplicitParams ;
import io.swagger.annotations.ApiOperation ;
@ -53,6 +55,8 @@ public class DcBusiParamCollectBill extends BaseController
private DcBaseCoderuleDefineService dcBaseCoderuleDefineService ;
@Autowired
private CodeNoGenerater codeNoGenerater ;
@Autowired
private ISysDeptService sysDeptService ;
/ * *
* 查询参数采集 ( 录入 )
* 根据
@ -87,6 +91,13 @@ public class DcBusiParamCollectBill extends BaseController
List < DcBusiBillModelMaster > list = dcBusiBillModelMasterService . selectDcBusiBillModelMasterList ( dcBusiBillModelMaster ) ;
return getDataTable ( list ) ;
}
@GetMapping ( "/userModelById/{mid}" )
public AjaxResult getUserModelById ( @PathVariable Long mid )
{
DcBusiBillModelMaster dcBusiBillModelMaster = dcBusiBillModelMasterService . selectDcBusiBillModelMasterById ( mid ) ;
return AjaxResult . success ( dcBusiBillModelMaster ) ;
}
/ * *
* 根据根据公司查询模版 , 现根据角色ID进行过滤
* 根据
@ -130,27 +141,33 @@ public class DcBusiParamCollectBill extends BaseController
dcBusiBillModelMaster . setBillModelPoint ( dcBusiParamBillMaster . getCountTimes ( ) ) ;
dcBusiBillModelMaster . setRoleId ( loginUser . getUser ( ) . getRoleId ( ) ) ;
dcBusiBillModelMaster . setDeptId ( loginUser . getDeptId ( ) ) ;
dcBusiBillModelMaster . setCompanyId ( dcBusiParamBillMaster . getCompanyId ( ) ) ;
dcBusiBillModelMaster . setCompanyName ( dcBusiParamBillMaster . getCompanyName ( ) ) ;
dcBusiBillModelMaster . setOrgId ( dcBusiParamBillMaster . getOragnizeId ( ) ) ;
dcBusiBillModelMaster . setOrgName ( dcBusiBillModelMaster . getOrgName ( ) ) ;
long deptId = dcBusiParamBillMaster . getCompanyId ( ) ;
SysDept sysDept = Optional . ofNullable ( sysDeptService . selectDeptById ( deptId ) ) . orElse ( new SysDept ( ) ) ;
dcBusiBillModelMaster . setCompanyId ( deptId ) ;
dcBusiBillModelMaster . setCompanyName ( sysDept . getDeptName ( ) ) ;
deptId = dcBusiParamBillMaster . getOragnizeId ( ) ;
dcBusiBillModelMaster . setOrgId ( deptId ) ;
sysDept = Optional . ofNullable ( sysDeptService . selectDeptById ( deptId ) ) . orElse ( new SysDept ( ) ) ;
dcBusiBillModelMaster . setOrgName ( sysDept . getDeptName ( ) ) ;
dcBusiBillModelMaster . setDataState ( "0" ) ;
dcBusiBillModelMaster . setUseState ( "1" ) ;
dcBusiBillModelMaster . setFieldCode ( dcBusiParamBillMaster . getFieldCode ( ) ) ;
dcBusiBillModelMaster . setFieldName ( dcBusiParamBillMaster . getFieldName ( ) ) ;
dcBusiBillModelMaster . setBillModelNo ( billModelNo ) ;
dcBusiBillModelMaster . setBillModelName ( dcBusiParamBillMaster . getBillName ( ) ) ;
dcBusiBillModelMaster . setBillModelName ( dcBusiParamBillMaster . getBii lMode lName ( ) ) ;
List < DcBusiBillModelSub > dcBusiBillModelSubList = new ArrayList < > ( ) ;
List < DcBusiParamBillSub > dcBusiParamBillSubList = dcBusiParamBillMaster . getDcBusiParamBillSubList ( ) ;
dcBusiParamBillSubList . forEach ( item - > {
JSONArray jsonArray = Optional . ofNullable ( JSONArray . from ( dcBusiParamBillMaster . getSubDatas ( ) ) ) . orElse ( new JSONArray ( ) ) ;
jsonArray . forEach ( item - > {
JSONObject jsb = JSONObject . from ( item ) ;
DcBusiBillModelSub modelSub = new DcBusiBillModelSub ( ) ;
modelSub . setBillModelNo ( billModelNo ) ;
modelSub . setAssetCode ( item . getAssetCode ( ) ) ;
modelSub . setAssetName ( item . getAssetName ( ) ) ;
modelSub . setAssetCode ( jsb . getString ( "assetCode" ) ) ;
modelSub . setAssetName ( jsb . getString ( "assetName" ) ) ;
//modelSub.setAssetId(item.get);
modelSub . setAssetUnitCode ( item . getParamCode ( ) ) ;
modelSub . setAssetUnitName ( item . getParamName ( ) ) ;
modelSub . setAssetUnitCode ( jsb . getString ( "paramCode" ) ) ;
modelSub . setAssetUnitName ( jsb . getString ( "paramName" ) ) ;
modelSub . setAssetUnitType ( "P" ) ;
modelSub . setAUnit ( jsb . getString ( "paramUint" ) ) ;
dcBusiBillModelSubList . add ( modelSub ) ;
} ) ;
dcBusiBillModelMaster . setDcBusiBillModelSubList ( dcBusiBillModelSubList ) ;
@ -211,7 +228,8 @@ public class DcBusiParamCollectBill extends BaseController
return AjaxResult . success ( dcBusiParamBillMasterService . insertDcBusiParamBillMasterDao ( dcBusiParamBillMaster ) ) ;
}
private String getBillModelNo ( ) {
DcBusiCoderuleConfigDao ruleIdByBusicode = dcBaseCoderuleDefineService . getRuleIdByBusicode ( "BILL_MODEL_NO" ) ;
DcBusiCoderuleConfigDao ruleIdByBusicode = Optional . ofNullable ( dcBaseCoderuleDefineService . getRuleIdByBusicode ( "BILL_MODEL_NO" ) ) . orElse ( new DcBusiCoderuleConfigDao ( ) ) ;
DcBaseCoderuleDefineDao ruleDao = dcBaseCoderuleDefineService . selectDcBaseCoderuleDefineDaoById ( ruleIdByBusicode . getRuleId ( ) ) ;
return codeNoGenerater . getCode ( ruleDao ) ;
}