bluejay
2025-04-14 db1be72e80a9532ceda5000d79c153eb859caa05
Merge remote-tracking branch 'origin/dev' into dev
已修改8个文件
181 ■■■■■ 文件已修改
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamStatisticsController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamTempController.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsWeldSeamStatisticsMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsWeldSeamServiceImpl.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsWeldSeamStatisticsServiceImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/resources/mapper/core/ApsWeldSeamMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/resources/mapper/core/ApsWeldSeamStatisticsMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamController.java
@@ -164,8 +164,8 @@
     * @Date: 2025/4/9
     */
    @RequiresPermissions("weldSeam:weldSeam:confirmWeldSeam")
    @GetMapping("/confirmWeldSeam")
    public AjaxResult confirmWeldSeam(ApsWeldSeamTemp apsWeldSeamTemp) {
    @PostMapping("/confirmWeldSeam")
    public AjaxResult confirmWeldSeam(@RequestBody  ApsWeldSeamTemp apsWeldSeamTemp) {
        return toAjax(apsWeldSeamService.confirmWeldSeam(apsWeldSeamTemp));
    }
}
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamStatisticsController.java
@@ -42,7 +42,7 @@
    @GetMapping("/list")
    public TableDataInfo list(ApsWeldSeamStatistics apsWeldSeamStatistics)
    {
        startPage();
//        startPage();
        List<ApsWeldSeamStatistics> list = apsWeldSeamStatisticsService.selectApsWeldSeamStatisticsList(apsWeldSeamStatistics);
        return getDataTable(list);
    }
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamTempController.java
@@ -38,7 +38,7 @@
    /**
     * 查询焊缝-临时列表
     */
    @RequiresPermissions("gasPipingTemp:gasPipingTemp:list")
    @RequiresPermissions("weldSeamTemp:weldSeamTemp:list")
    @GetMapping("/list")
    public TableDataInfo list(ApsWeldSeamTemp apsWeldSeamTemp)
    {
@@ -50,7 +50,7 @@
    /**
     * 导出焊缝-临时列表
     */
    @RequiresPermissions("gasPipingTemp:gasPipingTemp:export")
    @RequiresPermissions("weldSeamTemp:weldSeamTemp:export")
    @Log(title = "焊缝-临时", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ApsWeldSeamTemp apsWeldSeamTemp)
@@ -63,7 +63,7 @@
    /**
     * 获取焊缝-临时详细信息
     */
    @RequiresPermissions("gasPipingTemp:gasPipingTemp:query")
    @RequiresPermissions("weldSeamTemp:weldSeamTemp:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
@@ -73,7 +73,7 @@
    /**
     * 新增焊缝-临时
     */
    @RequiresPermissions("gasPipingTemp:gasPipingTemp:add")
    @RequiresPermissions("weldSeamTemp:weldSeamTemp:add")
    @Log(title = "焊缝-临时", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ApsWeldSeamTemp apsWeldSeamTemp)
@@ -84,7 +84,7 @@
    /**
     * 修改焊缝-临时
     */
    @RequiresPermissions("gasPipingTemp:gasPipingTemp:edit")
    @RequiresPermissions("weldSeamTemp:weldSeamTemp:edit")
    @Log(title = "焊缝-临时", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ApsWeldSeamTemp apsWeldSeamTemp)
@@ -95,7 +95,7 @@
    /**
     * 删除焊缝-临时
     */
    @RequiresPermissions("gasPipingTemp:gasPipingTemp:remove")
    @RequiresPermissions("weldSeamTemp:weldSeamTemp:remove")
    @Log(title = "焊缝-临时", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsWeldSeamStatisticsMapper.java
@@ -2,6 +2,7 @@
import java.util.List;
import com.aps.core.domain.ApsWeldSeamStatistics;
import org.apache.ibatis.annotations.Mapper;
/**
 * 焊缝统计Mapper接口
@@ -9,6 +10,7 @@
 * @author wwj
 * @date 2025-04-09
 */
@Mapper
public interface ApsWeldSeamStatisticsMapper 
{
    /**
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsWeldSeamServiceImpl.java
@@ -1,66 +1,66 @@
package com.aps.core.service.impl;
import java.util.List;
import com.aps.common.core.utils.DateUtils;
import com.aps.common.core.utils.StringUtils;
import com.aps.common.core.utils.uuid.IdUtils;
import com.aps.core.domain.*;
import com.aps.core.domain.ApsWeldSeam;
import com.aps.core.domain.ApsWeldSeamStatistics;
import com.aps.core.domain.ApsWeldSeamTemp;
import com.aps.core.mapper.ApsWeldSeamMapper;
import com.aps.core.mapper.ApsWeldSeamStatisticsMapper;
import com.aps.core.mapper.ApsWeldSeamTempMapper;
import com.aps.core.service.IApsWeldSeamService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aps.core.mapper.ApsWeldSeamMapper;
import com.aps.core.service.IApsWeldSeamService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
 * 焊缝Service业务层处理
 *
 *
 * @author wwj
 * @date 2025-04-09
 */
@Service
public class ApsWeldSeamServiceImpl implements IApsWeldSeamService
{
public class ApsWeldSeamServiceImpl implements IApsWeldSeamService {
    @Autowired
    private ApsWeldSeamMapper apsWeldSeamMapper;
    @Autowired
    private ApsWeldSeamTempMapper apsWeldSeamTempMapper;
    @Autowired
    private ApsWeldSeamStatisticsMapper apsWeldSeamStatisticsMapper;
    /**
     * 查询焊缝
     *
     *
     * @param id 焊缝主键
     * @return 焊缝
     */
    @Override
    public ApsWeldSeam selectApsWeldSeamById(String id)
    {
    public ApsWeldSeam selectApsWeldSeamById(String id) {
        return apsWeldSeamMapper.selectApsWeldSeamById(id);
    }
    /**
     * 查询焊缝列表
     *
     *
     * @param apsWeldSeam 焊缝
     * @return 焊缝
     */
    @Override
    public List<ApsWeldSeam> selectApsWeldSeamList(ApsWeldSeam apsWeldSeam)
    {
    public List<ApsWeldSeam> selectApsWeldSeamList(ApsWeldSeam apsWeldSeam) {
        return apsWeldSeamMapper.selectApsWeldSeamList(apsWeldSeam);
    }
    /**
     * 新增焊缝
     *
     *
     * @param apsWeldSeam 焊缝
     * @return 结果
     */
    @Override
    public int insertApsWeldSeam(ApsWeldSeam apsWeldSeam)
    {
    public int insertApsWeldSeam(ApsWeldSeam apsWeldSeam) {
        apsWeldSeam.setId(IdUtils.fastUUID());
        apsWeldSeam.setCreateTime(DateUtils.getNowDate());
        return apsWeldSeamMapper.insertApsWeldSeam(apsWeldSeam);
@@ -68,58 +68,55 @@
    /**
     * 修改焊缝
     *
     *
     * @param apsWeldSeam 焊缝
     * @return 结果
     */
    @Override
    public int updateApsWeldSeam(ApsWeldSeam apsWeldSeam)
    {
    public int updateApsWeldSeam(ApsWeldSeam apsWeldSeam) {
        return apsWeldSeamMapper.updateApsWeldSeam(apsWeldSeam);
    }
    /**
     * 批量删除焊缝
     *
     *
     * @param ids 需要删除的焊缝主键
     * @return 结果
     */
    @Override
    public int deleteApsWeldSeamByIds(String[] ids)
    {
    public int deleteApsWeldSeamByIds(String[] ids) {
        return apsWeldSeamMapper.deleteApsWeldSeamByIds(ids);
    }
    /**
     * 删除焊缝信息
     *
     *
     * @param id 焊缝主键
     * @return 结果
     */
    @Override
    public int deleteApsWeldSeamById(String id)
    {
    public int deleteApsWeldSeamById(String id) {
        return apsWeldSeamMapper.deleteApsWeldSeamById(id);
    }
    @Override
    public int confirmWeldSeam(ApsWeldSeamTemp apsWeldSeamTemp) {
        //查询临时表数据
        List<ApsWeldSeamTemp> apsWeldSeamTemps=apsWeldSeamTempMapper.selectApsWeldSeamTempList(apsWeldSeamTemp);
        int count=0;
        String[] ids=new String[apsWeldSeamTemps.size()];
        for (int i = 0; i <apsWeldSeamTemps.size() ; i++) {
        List<ApsWeldSeamTemp> apsWeldSeamTemps = apsWeldSeamTempMapper.selectApsWeldSeamTempList(apsWeldSeamTemp);
        int count = 0;
        String[] ids = new String[apsWeldSeamTemps.size()];
        for (int i = 0; i < apsWeldSeamTemps.size(); i++) {
            //记录临时表id
            ids[i]=apsWeldSeamTemps.get(i).getId();
            ApsWeldSeam apsWeldSeam=new ApsWeldSeam();
            ids[i] = apsWeldSeamTemps.get(i).getId();
            ApsWeldSeam apsWeldSeam = new ApsWeldSeam();
            BeanUtils.copyProperties(apsWeldSeamTemps.get(i), apsWeldSeam);
            //通过工单号查询是否存在数据
            ApsWeldSeam apsWeldSeam1=apsWeldSeamMapper.selectApsWeldSeamByWorkOrderNo(apsWeldSeam.getWorkOrderNo());
            ApsWeldSeam apsWeldSeam1 = apsWeldSeamMapper.selectApsWeldSeamByWorkOrderNo(apsWeldSeam.getWorkOrderNo());
            //当工单号存在则更新数据否则插入数据
            if(StringUtils.isNotEmpty(apsWeldSeam1.getId())){
            if (StringUtils.isNotEmpty(apsWeldSeam1.getId())) {
                apsWeldSeam.setId(apsWeldSeam1.getId());
                apsWeldSeamMapper.updateApsWeldSeam(apsWeldSeam);
            }else {
            } else {
                //插入正式表,并记录
                apsWeldSeam.setId(IdUtils.fastUUID());
                apsWeldSeamMapper.insertApsWeldSeam(apsWeldSeam);
@@ -127,11 +124,47 @@
            count++;
        }
        //插入数量与临时表查询一直则删除临时表数据
        if (count==apsWeldSeamTemps.size()) {
        if (count == apsWeldSeamTemps.size()) {
            apsWeldSeamTempMapper.deleteApsWeldSeamTempByIds(ids);
        }
        //插入焊缝统计表
        List<ApsWeldSeamStatistics> apsWeldSeamStatistics=apsWeldSeamMapper.weldSeamStat(apsWeldSeamTemps);
        List<ApsWeldSeamStatistics> apsWeldSeamStatistics = apsWeldSeamMapper.weldSeamStat(apsWeldSeamTemps);
        for (int i = 0; i < apsWeldSeamStatistics.size(); i++) {
            List<ApsWeldSeamStatistics> apsWeldSeamStatistics1 = apsWeldSeamStatisticsMapper.selectApsWeldSeamStatisticsList(apsWeldSeamStatistics.get(i));
            if (apsWeldSeamStatistics1.size() > 0) {
                ApsWeldSeamStatistics apsWeldSeamStatistics2 = apsWeldSeamStatistics1.get(0);
                apsWeldSeamStatistics2.setPipingOrderRequirement(apsWeldSeamStatistics.get(i).getPipingOrderRequirement());
                apsWeldSeamStatistics2.setGasOrderRequirement(apsWeldSeamStatistics.get(i).getGasOrderRequirement());
                apsWeldSeamStatistics2.setPipingPredictionRequirement(apsWeldSeamStatistics.get(i).getPipingPredictionRequirement());
                apsWeldSeamStatistics2.setGasPredictionRequirement(apsWeldSeamStatistics.get(i).getGasPredictionRequirement());
                //预留紧急订单产出是否为空
                if (apsWeldSeamStatistics2.getReserveEmergencyOrderOutput() != null) {
                    apsWeldSeamStatistics2.setTotal(apsWeldSeamStatistics2.getPipingOrderRequirement() + apsWeldSeamStatistics2.getPipingPredictionRequirement() + apsWeldSeamStatistics2.getGasOrderRequirement() + apsWeldSeamStatistics2.getGasPredictionRequirement() + apsWeldSeamStatistics2.getReserveEmergencyOrderOutput());
                    //天数不为空计算需求日焊缝
                    if(apsWeldSeamStatistics2.getDays()!=null){
                        // 转换为 double 类型进行除法运算
                        double result = (double) apsWeldSeamStatistics2.getTotal() / apsWeldSeamStatistics2.getDays();
                        // 四舍五入
                        long roundedResult = Math.round(result);
                        apsWeldSeamStatistics2.setRequirementDayWeldSeam(roundedResult);
                        //判断生产日焊缝不为空计算是否满足
                        if(apsWeldSeamStatistics2.getProductionDayWeldSeam()!=null){
                            if(apsWeldSeamStatistics2.getProductionDayWeldSeam()>=apsWeldSeamStatistics2.getRequirementDayWeldSeam()){
                                apsWeldSeamStatistics2.setIsSatisfy("是");
                            }else{
                                apsWeldSeamStatistics2.setIsSatisfy("否");
                            }
                        }
                    }
                }
                apsWeldSeamStatisticsMapper.updateApsWeldSeamStatistics(apsWeldSeamStatistics2);
            }else {
                apsWeldSeamStatistics.get(i).setId(IdUtils.fastUUID());
                apsWeldSeamStatistics.get(i).setCreateTime(DateUtils.getNowDate());
                apsWeldSeamStatisticsMapper.insertApsWeldSeamStatistics(apsWeldSeamStatistics.get(i));
            }
        }
        return 1;
    }
}
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsWeldSeamStatisticsServiceImpl.java
@@ -69,6 +69,26 @@
    public int updateApsWeldSeamStatistics(ApsWeldSeamStatistics apsWeldSeamStatistics)
    {
        apsWeldSeamStatistics.setUpdateTime(DateUtils.getNowDate());
        //预留紧急订单产出是否为空
        if (apsWeldSeamStatistics.getReserveEmergencyOrderOutput() != null) {
            apsWeldSeamStatistics.setTotal(apsWeldSeamStatistics.getPipingOrderRequirement() + apsWeldSeamStatistics.getPipingPredictionRequirement() + apsWeldSeamStatistics.getGasOrderRequirement() + apsWeldSeamStatistics.getGasPredictionRequirement() + apsWeldSeamStatistics.getReserveEmergencyOrderOutput());
            //天数不为空计算需求日焊缝
            if(apsWeldSeamStatistics.getDays()!=null){
                // 转换为 double 类型进行除法运算
                double result = (double) apsWeldSeamStatistics.getTotal() / apsWeldSeamStatistics.getDays();
                // 四舍五入
                long roundedResult = Math.round(result);
                apsWeldSeamStatistics.setRequirementDayWeldSeam(roundedResult);
                //判断生产日焊缝不为空计算是否满足
                if(apsWeldSeamStatistics.getProductionDayWeldSeam()!=null){
                    if(apsWeldSeamStatistics.getProductionDayWeldSeam()>=apsWeldSeamStatistics.getRequirementDayWeldSeam()){
                        apsWeldSeamStatistics.setIsSatisfy("是");
                    }else{
                        apsWeldSeamStatistics.setIsSatisfy("否");
                    }
                }
            }
        }
        return apsWeldSeamStatisticsMapper.updateApsWeldSeamStatistics(apsWeldSeamStatistics);
    }
aps-modules/aps-core/src/main/resources/mapper/core/ApsWeldSeamMapper.xml
@@ -153,7 +153,23 @@
            #{id}
        </foreach>
    </delete>
    <select id="weldSeamStat" >
    <select id="weldSeamStat" parameterType="java.util.List" resultType="com.aps.core.domain.ApsWeldSeamStatistics">
        SELECT produce_year as year,
    produce_month as month,
    production_base as productionBase,
    SUM ( CASE WHEN work_order_type = '0' AND classification = '1' THEN production_quantity ELSE 0 END ) AS pipingOrderRequirement,
    SUM ( CASE WHEN work_order_type = '0' AND classification = '0' THEN production_quantity ELSE 0 END ) AS gasOrderRequirement,
    SUM ( CASE WHEN work_order_type = '1' AND classification = '1' THEN production_quantity ELSE 0 END ) AS pipingPredictionRequirement,
    SUM ( CASE WHEN work_order_type = '1' AND classification = '0' THEN production_quantity ELSE 0 END ) AS gasPredictionRequirement
        FROM
            "aps_weld_seam"
        where 1=1
        <foreach item="item" index="index" collection="list" separator=",">
            or ( produce_year=#{item.produceYear} and produce_month=#{item.produceMonth} and production_base=#{item.productionBase})
        </foreach>
        GROUP BY
            produce_year,
            produce_month,
            production_base
    </select>
</mapper>
aps-modules/aps-core/src/main/resources/mapper/core/ApsWeldSeamStatisticsMapper.xml
@@ -35,17 +35,7 @@
        <where>  
            <if test="params.beginYear != null and params.beginYear != '' and params.endYear != null and params.endYear != ''"> and year between #{params.beginYear} and #{params.endYear}</if>
            <if test="params.beginMonth != null and params.beginMonth != '' and params.endMonth != null and params.endMonth != ''"> and month between #{params.beginMonth} and #{params.endMonth}</if>
            <if test="productionBase != null  and productionBase != ''"> and production_base like concat('%', #{productionBase}, '%')</if>
            <if test="pipingOrderRequirement != null "> and piping_order_requirement = #{pipingOrderRequirement}</if>
            <if test="gasOrderRequirement != null "> and gas_order_requirement = #{gasOrderRequirement}</if>
            <if test="pipingPredictionRequirement != null "> and piping_prediction_requirement = #{pipingPredictionRequirement}</if>
            <if test="gasPredictionRequirement != null "> and gas_prediction_requirement = #{gasPredictionRequirement}</if>
            <if test="reserveEmergencyOrderOutput != null "> and reserve_emergency_order_output = #{reserveEmergencyOrderOutput}</if>
            <if test="total != null "> and total = #{total}</if>
            <if test="days != null "> and days = #{days}</if>
            <if test="requirementDayWeldSeam != null "> and requirement_day_weld_seam = #{requirementDayWeldSeam}</if>
            <if test="productionDayWeldSeam != null "> and production_day_weld_seam = #{productionDayWeldSeam}</if>
            <if test="isSatisfy != null  and isSatisfy != ''"> and is_satisfy = #{isSatisfy}</if>
            <if test="productionBase != null  and productionBase != ''"> and production_base like '%'|| #{productionBase}|| '%'</if>
        </where>
    </select>