新增标准成本计算流程任务模块

This commit is contained in:
wangqiong
2024-07-23 17:33:01 +08:00
parent 002eb76d4f
commit 7f8f31100a
31 changed files with 1582 additions and 76 deletions
@@ -2,6 +2,7 @@ package com.zzsmart.qomo.kn.cost.manage;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
@@ -14,11 +15,12 @@ import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
/** /**
* 单体启动类 * 单体启动类
* 报错提醒: 未集成mongo报错,可以打开启动类上面的注释 exclude={MongoAutoConfiguration.class} * 报错提醒: 未集成mongo报错,可以打开启动类上面的注释 exclude={MongoAutoConfiguration.class}
*/ */
@Slf4j @Slf4j
@SpringBootApplication (scanBasePackages ={"org.jeecg", "com.zzsmart.qomo"}) @SpringBootApplication(scanBasePackages = {"org.jeecg", "com.zzsmart.qomo"})
//@MapperScan({"com.zzsmart.qomo.kn.cost.manage.mapper"})
//@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class}) //@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})
@EnableAsync @EnableAsync
public class QomoCostManageApplication extends SpringBootServletInitializer { public class QomoCostManageApplication extends SpringBootServletInitializer {
+1
View File
@@ -56,5 +56,6 @@
<artifactId>easyexcel</artifactId> <artifactId>easyexcel</artifactId>
<version>4.0.1</version> <!-- 请检查并使用最新稳定版本 --> <version>4.0.1</version> <!-- 请检查并使用最新稳定版本 -->
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
@@ -0,0 +1,179 @@
package com.zzsmart.qomo.kn.cost.manage.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostResultValue;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostResultValueService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
/**
* @Description: app_scene_cost_result_value
* @Author: jeecg-boot
* @Date: 2024-07-23
* @Version: V1.0
*/
@Api(tags="app_scene_cost_result_value")
@RestController
@RequestMapping("/com.zzsmart.qomo.kn.cost.manage/appSceneCostResultValue")
@Slf4j
public class AppSceneCostResultValueController extends JeecgController<AppSceneCostResultValue, IAppSceneCostResultValueService> {
@Autowired
private IAppSceneCostResultValueService appSceneCostResultValueService;
/**
* 分页列表查询
*
* @param appSceneCostResultValue
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "app_scene_cost_result_value-分页列表查询")
@ApiOperation(value="app_scene_cost_result_value-分页列表查询", notes="app_scene_cost_result_value-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<AppSceneCostResultValue>> queryPageList(AppSceneCostResultValue appSceneCostResultValue,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<AppSceneCostResultValue> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostResultValue, req.getParameterMap());
Page<AppSceneCostResultValue> page = new Page<AppSceneCostResultValue>(pageNo, pageSize);
IPage<AppSceneCostResultValue> pageList = appSceneCostResultValueService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param appSceneCostResultValue
* @return
*/
@AutoLog(value = "app_scene_cost_result_value-添加")
@ApiOperation(value="app_scene_cost_result_value-添加", notes="app_scene_cost_result_value-添加")
@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_result_value:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody AppSceneCostResultValue appSceneCostResultValue) {
appSceneCostResultValueService.save(appSceneCostResultValue);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param appSceneCostResultValue
* @return
*/
@AutoLog(value = "app_scene_cost_result_value-编辑")
@ApiOperation(value="app_scene_cost_result_value-编辑", notes="app_scene_cost_result_value-编辑")
@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_result_value:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody AppSceneCostResultValue appSceneCostResultValue) {
appSceneCostResultValueService.updateById(appSceneCostResultValue);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "app_scene_cost_result_value-通过id删除")
@ApiOperation(value="app_scene_cost_result_value-通过id删除", notes="app_scene_cost_result_value-通过id删除")
@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_result_value:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
appSceneCostResultValueService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "app_scene_cost_result_value-批量删除")
@ApiOperation(value="app_scene_cost_result_value-批量删除", notes="app_scene_cost_result_value-批量删除")
@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_result_value:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.appSceneCostResultValueService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "app_scene_cost_result_value-通过id查询")
@ApiOperation(value="app_scene_cost_result_value-通过id查询", notes="app_scene_cost_result_value-通过id查询")
@GetMapping(value = "/queryById")
public Result<AppSceneCostResultValue> queryById(@RequestParam(name="id",required=true) String id) {
AppSceneCostResultValue appSceneCostResultValue = appSceneCostResultValueService.getById(id);
if(appSceneCostResultValue==null) {
return Result.error("未找到对应数据");
}
return Result.OK(appSceneCostResultValue);
}
/**
* 导出excel
*
* @param request
* @param appSceneCostResultValue
*/
@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_result_value:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, AppSceneCostResultValue appSceneCostResultValue) {
return super.exportXls(request, appSceneCostResultValue, AppSceneCostResultValue.class, "app_scene_cost_result_value");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_result_value:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, AppSceneCostResultValue.class);
}
}
@@ -0,0 +1,75 @@
package com.zzsmart.qomo.kn.cost.manage.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: app_scene_cost_result_value
* @Author: jeecg-boot
* @Date: 2024-07-23
* @Version: V1.0
*/
@Data
@TableName("app_scene_cost_result_value")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="app_scene_cost_result_value对象", description="app_scene_cost_result_value")
public class AppSceneCostResultValue implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private Integer id;
/**所属最上级物料号*/
@Excel(name = "所属最上级物料号", width = 15)
@ApiModelProperty(value = "所属最上级物料号")
private String belongTopMaterialNo;
/**物料编号*/
@Excel(name = "物料编号", width = 15)
@ApiModelProperty(value = "物料编号")
private String marterialNo;
/**父类物料编号*/
@Excel(name = "父类物料编号", width = 15)
@ApiModelProperty(value = "父类物料编号")
private String parentMarterialNo;
/**任务类型*/
@Excel(name = "任务类型", width = 15)
@ApiModelProperty(value = "任务类型")
private String taskType;
/**任务代码*/
@Excel(name = "任务代码", width = 15)
@ApiModelProperty(value = "任务代码")
private String taskCode;
/**流程id*/
@Excel(name = "流程id", width = 15)
@ApiModelProperty(value = "流程id")
private String flowInstanceId;
/**计算结果值(多个值通过字段拼接)*/
@Excel(name = "计算结果值(多个值通过字段拼接)", width = 15)
@ApiModelProperty(value = "计算结果值(多个值通过字段拼接)")
private String countValue;
/**创建时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**创建人*/
@ApiModelProperty(value = "创建人")
private Integer createBy;
}
@@ -0,0 +1,15 @@
package com.zzsmart.qomo.kn.cost.manage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostResultValue;
/**
* @Description: app_scene_cost_result_value
* @Author: jeecg-boot
* @Date: 2024-07-23
* @Version: V1.0
*/
public interface AppSceneCostResultValueMapper extends BaseMapper<AppSceneCostResultValue> {
}
@@ -1,18 +1,29 @@
package com.zzsmart.qomo.kn.cost.manage.mapper; package com.zzsmart.qomo.kn.cost.manage.mapper;
import com.zzsmart.qomo.kn.cost.manage.entity.CostMaterialBom;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsmart.qomo.kn.cost.manage.entity.CostMaterialBom;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* <p> * <p>
* 物料bom Mapper 接口 * 物料bom Mapper 接口
* </p> * </p>
* *
* @author * @author
* @since 2024-06-21 * @since 2024-06-21
*/ */
@Mapper @Mapper
public interface CostMaterialBomMapper extends BaseMapper<CostMaterialBom> { public interface CostMaterialBomMapper extends BaseMapper<CostMaterialBom> {
/**
* 根据动态SQL语句查询物料BOM表
*
* @param selectCommand
* @return
*/
@Select("${selectCommand}")
List<CostMaterialBom> customSelect(@Param("selectCommand") String selectCommand);
} }
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostResultValueMapper">
</mapper>
@@ -0,0 +1,51 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.laborcost;
import com.zzsmart.qomo.plugin.task.api.model.ResourceInfo;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class LaborCostParameters extends AbstractParameters {
@Override
public boolean checkParameters() {
return true;
}
@Override
public List<ResourceInfo> getResourceFilesList() {
return new ArrayList<>();
}
@Override
public void dealOutParam(String result) {
}
@Override
public String toString() {
return "人工成本任务";
}
}
@@ -0,0 +1,71 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.laborcost;
import com.zzsmart.qomo.kn.cost.manage.mapper.CostMaterialBomMapper;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostResultValueService;
import com.zzsmart.qomo.plugin.task.api.AbstractTask;
import com.zzsmart.qomo.plugin.task.api.TaskCallBack;
import com.zzsmart.qomo.plugin.task.api.TaskException;
import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 人工成本计算任务
*/
public class LaborCostTask extends AbstractTask {
/**
* taskExecutionContext
*/
private TaskExecutionContext taskExecutionContext;
/**
* sql parameters
*/
private LaborCostParameters emptyParameters;
/**
* Abstract Yarn Task
*
* @param taskRequest taskRequest
*/
public LaborCostTask(TaskExecutionContext taskRequest) {
super(taskRequest);
this.taskExecutionContext = taskRequest;
this.emptyParameters = new LaborCostParameters();
}
@Override
public AbstractParameters getParameters() {
return emptyParameters;
}
@Override
public void handle(TaskCallBack taskCallBack) throws TaskException {
log.info("Full EmptyTask parameters: {}", emptyParameters);
//setExitStatusCode(TaskConstants.EXIT_CODE_SUCCESS);
}
@Override
public void cancel() throws TaskException {
}
}
@@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.laborcost;
import com.zzsmart.qomo.common.utils.JSONUtils;
import com.zzsmart.qomo.plugin.task.api.AbstractTask;
import com.zzsmart.qomo.plugin.task.api.TaskChannel;
import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import com.zzsmart.qomo.plugin.task.api.parameters.ParametersNode;
import com.zzsmart.qomo.plugin.task.api.parameters.resource.ResourceParametersHelper;
public class LaborCostTaskChannel implements TaskChannel {
@Override
public void cancelApplication(boolean status) {
}
@Override
public AbstractTask createTask(TaskExecutionContext taskRequest) {
return new LaborCostTask(taskRequest);
}
@Override
public AbstractParameters parseParameters(ParametersNode parametersNode) {
return JSONUtils.parseObject(parametersNode.getTaskParams(), LaborCostParameters.class);
}
@Override
public ResourceParametersHelper getResources(String parameters) {
return JSONUtils.parseObject(parameters, LaborCostParameters.class).getResources();
}
}
@@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.laborcost;
import com.google.auto.service.AutoService;
import com.zzsmart.qomo.plugin.task.api.TaskChannel;
import com.zzsmart.qomo.plugin.task.api.TaskChannelFactory;
import com.zzsmart.qomo.spi.params.base.PluginParams;
import java.util.List;
@AutoService(TaskChannelFactory.class)
public class LaborCostTaskChannelFactory implements TaskChannelFactory {
@Override
public String getName() {
return "LaborCost";
}
@Override
public List<PluginParams> getParams() {
return null;
}
@Override
public TaskChannel create() {
return new LaborCostTaskChannel();
}
}
@@ -0,0 +1,51 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.manufacturingcost;
import com.zzsmart.qomo.plugin.task.api.model.ResourceInfo;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class ManufacturingCostParameters extends AbstractParameters {
@Override
public boolean checkParameters() {
return true;
}
@Override
public List<ResourceInfo> getResourceFilesList() {
return new ArrayList<>();
}
@Override
public void dealOutParam(String result) {
}
@Override
public String toString() {
return "制造费用成本任务";
}
}
@@ -0,0 +1,76 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.manufacturingcost;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostResultValue;
import com.zzsmart.qomo.kn.cost.manage.entity.CostMaterialBom;
import com.zzsmart.qomo.kn.cost.manage.mapper.CostMaterialBomMapper;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostResultValueService;
import com.zzsmart.qomo.plugin.task.api.AbstractTask;
import com.zzsmart.qomo.plugin.task.api.TaskCallBack;
import com.zzsmart.qomo.plugin.task.api.TaskException;
import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.List;
/**
* 制造费用成本任务
*/
public class ManufacturingCostTask extends AbstractTask {
/**
* taskExecutionContext
*/
private TaskExecutionContext taskExecutionContext;
/**
* sql parameters
*/
private ManufacturingCostParameters emptyParameters;
/**
* Abstract Yarn Task
*
* @param taskRequest taskRequest
*/
public ManufacturingCostTask(TaskExecutionContext taskRequest) {
super(taskRequest);
this.taskExecutionContext = taskRequest;
this.emptyParameters = new ManufacturingCostParameters();
}
@Override
public AbstractParameters getParameters() {
return emptyParameters;
}
@Override
public void handle(TaskCallBack taskCallBack) throws TaskException {
log.info("Full EmptyTask parameters: {}", emptyParameters);
//setExitStatusCode(TaskConstants.EXIT_CODE_SUCCESS);
}
@Override
public void cancel() throws TaskException {
}
}
@@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.manufacturingcost;
import com.zzsmart.qomo.common.utils.JSONUtils;
import com.zzsmart.qomo.plugin.task.api.AbstractTask;
import com.zzsmart.qomo.plugin.task.api.TaskChannel;
import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import com.zzsmart.qomo.plugin.task.api.parameters.ParametersNode;
import com.zzsmart.qomo.plugin.task.api.parameters.resource.ResourceParametersHelper;
public class ManufacturingCostTaskChannel implements TaskChannel {
@Override
public void cancelApplication(boolean status) {
}
@Override
public AbstractTask createTask(TaskExecutionContext taskRequest) {
return new ManufacturingCostTask(taskRequest);
}
@Override
public AbstractParameters parseParameters(ParametersNode parametersNode) {
return JSONUtils.parseObject(parametersNode.getTaskParams(), ManufacturingCostParameters.class);
}
@Override
public ResourceParametersHelper getResources(String parameters) {
return JSONUtils.parseObject(parameters, ManufacturingCostParameters.class).getResources();
}
}
@@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.manufacturingcost;
import com.google.auto.service.AutoService;
import com.zzsmart.qomo.plugin.task.api.TaskChannel;
import com.zzsmart.qomo.plugin.task.api.TaskChannelFactory;
import com.zzsmart.qomo.spi.params.base.PluginParams;
import java.util.List;
@AutoService(TaskChannelFactory.class)
public class ManufacturingCostTaskChannelFactory implements TaskChannelFactory {
@Override
public String getName() {
return "ManufacturingCost";
}
@Override
public List<PluginParams> getParams() {
return null;
}
@Override
public TaskChannel create() {
return new ManufacturingCostTaskChannel();
}
}
@@ -0,0 +1,51 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.materialcost;
import com.zzsmart.qomo.plugin.task.api.model.ResourceInfo;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class MaterialCostParameters extends AbstractParameters {
@Override
public boolean checkParameters() {
return true;
}
@Override
public List<ResourceInfo> getResourceFilesList() {
return new ArrayList<>();
}
@Override
public void dealOutParam(String result) {
}
@Override
public String toString() {
return "物料成本任务";
}
}
@@ -0,0 +1,76 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.materialcost;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostResultValue;
import com.zzsmart.qomo.kn.cost.manage.entity.CostMaterialBom;
import com.zzsmart.qomo.kn.cost.manage.mapper.CostMaterialBomMapper;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostResultValueService;
import com.zzsmart.qomo.plugin.task.api.AbstractTask;
import com.zzsmart.qomo.plugin.task.api.TaskCallBack;
import com.zzsmart.qomo.plugin.task.api.TaskException;
import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.List;
/**
* 物料成本计算任务
*/
public class MaterialCostTask extends AbstractTask {
/**
* taskExecutionContext
*/
private TaskExecutionContext taskExecutionContext;
/**
* sql parameters
*/
private MaterialCostParameters emptyParameters;
/**
* Abstract Yarn Task
*
* @param taskRequest taskRequest
*/
public MaterialCostTask(TaskExecutionContext taskRequest) {
super(taskRequest);
this.taskExecutionContext = taskRequest;
this.emptyParameters = new MaterialCostParameters();
}
@Override
public AbstractParameters getParameters() {
return emptyParameters;
}
@Override
public void handle(TaskCallBack taskCallBack) throws TaskException {
log.info("Full EmptyTask parameters: {}", emptyParameters);
//setExitStatusCode(TaskConstants.EXIT_CODE_SUCCESS);
}
@Override
public void cancel() throws TaskException {
}
}
@@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.materialcost;
import com.zzsmart.qomo.common.utils.JSONUtils;
import com.zzsmart.qomo.plugin.task.api.AbstractTask;
import com.zzsmart.qomo.plugin.task.api.TaskChannel;
import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import com.zzsmart.qomo.plugin.task.api.parameters.ParametersNode;
import com.zzsmart.qomo.plugin.task.api.parameters.resource.ResourceParametersHelper;
public class MaterialCostTaskChannel implements TaskChannel {
@Override
public void cancelApplication(boolean status) {
}
@Override
public AbstractTask createTask(TaskExecutionContext taskRequest) {
return new MaterialCostTask(taskRequest);
}
@Override
public AbstractParameters parseParameters(ParametersNode parametersNode) {
return JSONUtils.parseObject(parametersNode.getTaskParams(), MaterialCostParameters.class);
}
@Override
public ResourceParametersHelper getResources(String parameters) {
return JSONUtils.parseObject(parameters, MaterialCostParameters.class).getResources();
}
}
@@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.materialcost;
import com.google.auto.service.AutoService;
import com.zzsmart.qomo.plugin.task.api.TaskChannel;
import com.zzsmart.qomo.plugin.task.api.TaskChannelFactory;
import com.zzsmart.qomo.spi.params.base.PluginParams;
import java.util.List;
@AutoService(TaskChannelFactory.class)
public class MaterialCostTaskChannelFactory implements TaskChannelFactory {
@Override
public String getName() {
return "MaterialCost";
}
@Override
public List<PluginParams> getParams() {
return null;
}
@Override
public TaskChannel create() {
return new MaterialCostTaskChannel();
}
}
@@ -0,0 +1,51 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.materialinput;
import com.zzsmart.qomo.plugin.task.api.model.ResourceInfo;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class MaterialInputParameters extends AbstractParameters {
@Override
public boolean checkParameters() {
return true;
}
@Override
public List<ResourceInfo> getResourceFilesList() {
return new ArrayList<>();
}
@Override
public void dealOutParam(String result) {
}
@Override
public String toString() {
return "物料编号输入任务";
}
}
@@ -0,0 +1,74 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.materialinput;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostResultValue;
import com.zzsmart.qomo.kn.cost.manage.entity.CostMaterialBom;
import com.zzsmart.qomo.kn.cost.manage.mapper.CostMaterialBomMapper;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostResultValueService;
import com.zzsmart.qomo.plugin.task.api.*;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 物料编号输入任务
*/
public class MaterialInputTask extends AbstractTask {
/**
* taskExecutionContext
*/
private TaskExecutionContext taskExecutionContext;
/**
* sql parameters
*/
private MaterialInputParameters emptyParameters;
/**
* Abstract Yarn Task
*
* @param taskRequest taskRequest
*/
public MaterialInputTask(TaskExecutionContext taskRequest) {
super(taskRequest);
this.taskExecutionContext = taskRequest;
this.emptyParameters = new MaterialInputParameters();
}
@Override
public AbstractParameters getParameters() {
return emptyParameters;
}
@Override
public void handle(TaskCallBack taskCallBack) throws TaskException {
log.info("Full EmptyTask parameters: {}", emptyParameters);
//setExitStatusCode(TaskConstants.EXIT_CODE_SUCCESS);
}
@Override
public void cancel() throws TaskException {
}
}
@@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.materialinput;
import com.zzsmart.qomo.common.utils.JSONUtils;
import com.zzsmart.qomo.plugin.task.api.AbstractTask;
import com.zzsmart.qomo.plugin.task.api.TaskChannel;
import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import com.zzsmart.qomo.plugin.task.api.parameters.ParametersNode;
import com.zzsmart.qomo.plugin.task.api.parameters.resource.ResourceParametersHelper;
public class MaterialInputTaskChannel implements TaskChannel {
@Override
public void cancelApplication(boolean status) {
}
@Override
public AbstractTask createTask(TaskExecutionContext taskRequest) {
return new MaterialInputTask(taskRequest);
}
@Override
public AbstractParameters parseParameters(ParametersNode parametersNode) {
return JSONUtils.parseObject(parametersNode.getTaskParams(), MaterialInputParameters.class);
}
@Override
public ResourceParametersHelper getResources(String parameters) {
return JSONUtils.parseObject(parameters, MaterialInputParameters.class).getResources();
}
}
@@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.materialinput;
import com.google.auto.service.AutoService;
import com.zzsmart.qomo.plugin.task.api.TaskChannel;
import com.zzsmart.qomo.plugin.task.api.TaskChannelFactory;
import com.zzsmart.qomo.spi.params.base.PluginParams;
import java.util.List;
@AutoService(TaskChannelFactory.class)
public class MaterialInputTaskChannelFactory implements TaskChannelFactory {
@Override
public String getName() {
return "MaterialInput";
}
@Override
public List<PluginParams> getParams() {
return null;
}
@Override
public TaskChannel create() {
return new MaterialInputTaskChannel();
}
}
@@ -0,0 +1,91 @@
package com.zzsmart.qomo.kn.cost.manage.plugin.materialinput;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostResultValue;
import com.zzsmart.qomo.kn.cost.manage.entity.CostMaterialBom;
import com.zzsmart.qomo.kn.cost.manage.mapper.CostMaterialBomMapper;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostResultValueService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.List;
@Service
@Slf4j
public class StandardCostService {
@Autowired
CostMaterialBomMapper costMaterialBomMapper;
@Autowired
IAppSceneCostResultValueService iAppSceneCostResultValueService;
public static StandardCostService standardCostService;
@PostConstruct
public void init() {
standardCostService = this;
standardCostService.costMaterialBomMapper = this.costMaterialBomMapper;
standardCostService.iAppSceneCostResultValueService = this.iAppSceneCostResultValueService;
}
/**
* 物料编号输入任务
*/
public static void materialInputTask(String materialCode) {
//1.查询出所有满足物料编号的物料(BOM物料)
String sql = "select * from app_scene_cost_material_bom ";
List<CostMaterialBom> list = standardCostService.costMaterialBomMapper.customSelect(sql);
log.info("Full EmptyTask list: {}", list);
//2.把查询的结果存放在临时表里(表命名规则:前缀_流程id_组件code)
AppSceneCostResultValue appSceneCostResultValue = new AppSceneCostResultValue();
appSceneCostResultValue.setInstanceCode("11");
appSceneCostResultValue.setCountValue("11");
appSceneCostResultValue.setCreateTime(new Date());
standardCostService.iAppSceneCostResultValueService.save(appSceneCostResultValue);
}
/**
* 物料成本任务
*/
public static void materialCostTask(String materialCode) {
//1.查询出物料编号对应的下所有的BOM信息
//2.计算出所有的单个物料的物料成本
//2.1查询出物料的单价和采购数量
//2.2计算出物料成本并存储到成本结果数据表中
}
/**
* 人工成本任务
*/
public static void laborCostTask(String materialCode) {
//1.查询出物料编号对应的下所有的BOM信息
//2.计算出所有的单个物料的人工成本
//2.1查询出物料的人员工时和人工费率
//2.2计算出人工成本并存储到成本结果数据表中
}
/**
* 制造费用成本任务
*/
public static void manufacturingCostTask(String materialCode) {
//1.查询出物料编号对应的下所有的BOM信息
//2.根据费用类型进行不同的费用计算
//2.1机器折旧费(机器工时*费率)
//2.2机物料消耗费(辅料工时*费率)
//2.3水电费(燃动力工时*费率)
//2.4其他制费(其他工时*费率)
//2.5物流费((机器折旧+机物料消耗+水电费+其他制费)*10.16%)
}
/**
* 标准成本计算任务
*/
public static void standardCostTask(String materialCode) {
//1.查询出物料编号对应的下所有的BOM信息
//2.计算出所有的单个物料的本阶的标准成本(标准成本=物料成本+人工成本+制造费用)
//3.计算出所有的单个物料的累计标准成本
}
}
@@ -0,0 +1,51 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.standardcost;
import com.zzsmart.qomo.plugin.task.api.model.ResourceInfo;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class StandardCostParameters extends AbstractParameters {
@Override
public boolean checkParameters() {
return true;
}
@Override
public List<ResourceInfo> getResourceFilesList() {
return new ArrayList<>();
}
@Override
public void dealOutParam(String result) {
}
@Override
public String toString() {
return "标准成本计算任务";
}
}
@@ -0,0 +1,72 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.standardcost;
import com.zzsmart.qomo.kn.cost.manage.mapper.CostMaterialBomMapper;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostResultValueService;
import com.zzsmart.qomo.plugin.task.api.AbstractTask;
import com.zzsmart.qomo.plugin.task.api.TaskCallBack;
import com.zzsmart.qomo.plugin.task.api.TaskException;
import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 标准成本计算任务
*/
public class StandardCostTask extends AbstractTask {
/**
* taskExecutionContext
*/
private TaskExecutionContext taskExecutionContext;
/**
* sql parameters
*/
private StandardCostParameters emptyParameters;
/**
* Abstract Yarn Task
*
* @param taskRequest taskRequest
*/
public StandardCostTask(TaskExecutionContext taskRequest) {
super(taskRequest);
this.taskExecutionContext = taskRequest;
this.emptyParameters = new StandardCostParameters();
}
@Override
public AbstractParameters getParameters() {
return emptyParameters;
}
@Override
public void handle(TaskCallBack taskCallBack) throws TaskException {
log.info("Full EmptyTask parameters: {}", emptyParameters);
//setExitStatusCode(TaskConstants.EXIT_CODE_SUCCESS);
}
@Override
public void cancel() throws TaskException {
}
}
@@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.standardcost;
import com.zzsmart.qomo.common.utils.JSONUtils;
import com.zzsmart.qomo.plugin.task.api.AbstractTask;
import com.zzsmart.qomo.plugin.task.api.TaskChannel;
import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
import com.zzsmart.qomo.plugin.task.api.parameters.AbstractParameters;
import com.zzsmart.qomo.plugin.task.api.parameters.ParametersNode;
import com.zzsmart.qomo.plugin.task.api.parameters.resource.ResourceParametersHelper;
public class StandardCostTaskChannel implements TaskChannel {
@Override
public void cancelApplication(boolean status) {
}
@Override
public AbstractTask createTask(TaskExecutionContext taskRequest) {
return new StandardCostTask(taskRequest);
}
@Override
public AbstractParameters parseParameters(ParametersNode parametersNode) {
return JSONUtils.parseObject(parametersNode.getTaskParams(), StandardCostParameters.class);
}
@Override
public ResourceParametersHelper getResources(String parameters) {
return JSONUtils.parseObject(parameters, StandardCostParameters.class).getResources();
}
}
@@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zzsmart.qomo.kn.cost.manage.plugin.standardcost;
import com.google.auto.service.AutoService;
import com.zzsmart.qomo.plugin.task.api.TaskChannel;
import com.zzsmart.qomo.plugin.task.api.TaskChannelFactory;
import com.zzsmart.qomo.spi.params.base.PluginParams;
import java.util.List;
@AutoService(TaskChannelFactory.class)
public class StandardCostTaskChannelFactory implements TaskChannelFactory {
@Override
public String getName() {
return "StandardCost";
}
@Override
public List<PluginParams> getParams() {
return null;
}
@Override
public TaskChannel create() {
return new StandardCostTaskChannel();
}
}
@@ -0,0 +1,14 @@
package com.zzsmart.qomo.kn.cost.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostResultValue;
/**
* @Description: app_scene_cost_result_value
* @Author: jeecg-boot
* @Date: 2024-07-22
* @Version: V1.0
*/
public interface IAppSceneCostResultValueService extends IService<AppSceneCostResultValue> {
}
@@ -0,0 +1,20 @@
package com.zzsmart.qomo.kn.cost.manage.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostResultValue;
import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostResultValueMapper;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostResultValueService;
import org.springframework.stereotype.Service;
/**
* @Description: app_scene_cost_result_value
* @Author: jeecg-boot
* @Date: 2024-07-22
* @Version: V1.0
*/
@Service
public class AppSceneCostResultValueServiceImpl extends ServiceImpl<AppSceneCostResultValueMapper, AppSceneCostResultValue> implements IAppSceneCostResultValueService {
}
@@ -1,78 +1,67 @@
package com.zzsmart.qomo.kn.cost.manage; package com.zzsmart.qomo.kn.cost.manage;
import com.baomidou.mybatisplus.annotation.IdType; //@SpringBootTest
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.config.TemplateType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.Collections;
@SpringBootTest
public class ApplicationTests { public class ApplicationTests {
/** /**
* 根据表名生成相应结构代码 * 根据表名生成相应结构代码
// * @param databaseName 数据库名 // * @param databaseName 数据库名
// * @param tableName 表名 // * @param tableName 表名
*/ */
@Test // @Test
public void Generation(){ // public void Generation(){
FastAutoGenerator.create("jdbc:mysql://121.40.189.20:3306/"+"knne"+"?&useSSL=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai","root","YMzc157#") // FastAutoGenerator.create("jdbc:mysql://121.40.189.20:3306/"+"knne"+"?&useSSL=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai","root","YMzc157#")
.globalConfig(builder -> { // .globalConfig(builder -> {
builder.author(" ") // builder.author(" ")
.fileOverride()//是否覆盖 // .fileOverride()//是否覆盖
//启用swagger // //启用swagger
//.enableSwagger() // //.enableSwagger()
//指定输出目录 // //指定输出目录
.outputDir(System.getProperty("user.dir")+"/src/main/java"); // .outputDir(System.getProperty("user.dir")+"/src/main/java");
})
.packageConfig(builder -> {
builder.entity("entity")//实体类包名
.parent("com.zzsmart.qomo.kn.cost.manage")//父包名。如果为空,将下面子包名必须写全部, 否则就只需写子包名
.controller("controller")//控制层包名
.mapper("mapper")//mapper层包名
//.other("dto")//生成dto目录 可不用
.service("service")//service层包名
.serviceImpl("service.impl")//service实现类包名
//自定义mapper.xml文件输出目录
.pathInfo(Collections.singletonMap(OutputFile.mapperXml,System.getProperty("user.dir")+"/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml"));
})
.strategyConfig(builder -> {
builder.addInclude("app_scene_cost_model")// todo 设置需要生成的表名
//.addTablePrefix("sys_")//设置表前缀过滤
.entityBuilder()
.enableLombok()
.enableChainModel()
.naming(NamingStrategy.underline_to_camel)//数据表映射实体命名策略:默认下划线转驼峰underline_to_camel
.columnNaming(NamingStrategy.underline_to_camel)//表字段映射实体属性命名规则:默认null,不指定按照naming执行
.idType(IdType.AUTO)//添加全局主键类型
.formatFileName("%s")//格式化实体名称,%s取消首字母I,
.enableTableFieldAnnotation()
.enableColumnConstant()
.mapperBuilder()
.enableMapperAnnotation()//开启mapper注解
.enableBaseResultMap()//启用xml文件中的BaseResultMap 生成
.enableBaseColumnList()//启用xml文件中的BaseColumnList
.formatMapperFileName("%sMapper")//格式化Dao类名称
.formatXmlFileName("%sMapper")//格式化xml文件名称
.serviceBuilder()
.formatServiceFileName("%sService")//格式化 service 接口文件名称
.formatServiceImplFileName("%sServiceImpl")//格式化 service 接口文件名称
.controllerBuilder()
.enableRestStyle();
})
// 使用Freemarker引擎模板,默认的是Velocity引擎模板
// .templateConfig(builder -> {
// builder.disable(TemplateType.CONTROLLER)
// .disable(TemplateType.SERVICE)
// .disable(TemplateType.SERVICEIMPL);
// }) // })
.templateEngine(new FreemarkerTemplateEngine()) // .packageConfig(builder -> {
.execute(); // builder.entity("entity")//实体类包名
// .parent("com.zzsmart.qomo.kn.cost.manage")//父包名。如果为空,将下面子包名必须写全部, 否则就只需写子包名
} // .controller("controller")//控制层包名
// .mapper("mapper")//mapper层包名
// //.other("dto")//生成dto目录 可不用
// .service("service")//service层包名
// .serviceImpl("service.impl")//service实现类包名
// //自定义mapper.xml文件输出目录
// .pathInfo(Collections.singletonMap(OutputFile.mapperXml,System.getProperty("user.dir")+"/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml"));
// })
// .strategyConfig(builder -> {
// builder.addInclude("app_scene_cost_model")// todo 设置需要生成的表名
// //.addTablePrefix("sys_")//设置表前缀过滤
// .entityBuilder()
// .enableLombok()
// .enableChainModel()
// .naming(NamingStrategy.underline_to_camel)//数据表映射实体命名策略:默认下划线转驼峰underline_to_camel
// .columnNaming(NamingStrategy.underline_to_camel)//表字段映射实体属性命名规则:默认null,不指定按照naming执行
// .idType(IdType.AUTO)//添加全局主键类型
// .formatFileName("%s")//格式化实体名称,%s取消首字母I,
// .enableTableFieldAnnotation()
// .enableColumnConstant()
// .mapperBuilder()
// .enableMapperAnnotation()//开启mapper注解
// .enableBaseResultMap()//启用xml文件中的BaseResultMap 生成
// .enableBaseColumnList()//启用xml文件中的BaseColumnList
// .formatMapperFileName("%sMapper")//格式化Dao类名称
// .formatXmlFileName("%sMapper")//格式化xml文件名称
// .serviceBuilder()
// .formatServiceFileName("%sService")//格式化 service 接口文件名称
// .formatServiceImplFileName("%sServiceImpl")//格式化 service 接口文件名称
// .controllerBuilder()
// .enableRestStyle();
// })
// // 使用Freemarker引擎模板,默认的是Velocity引擎模板
//// .templateConfig(builder -> {
//// builder.disable(TemplateType.CONTROLLER)
//// .disable(TemplateType.SERVICE)
//// .disable(TemplateType.SERVICEIMPL);
//// })
// .templateEngine(new FreemarkerTemplateEngine())
// .execute();
//
// }
} }