CommandLogImpl.java 2.1 KB
package com.sy.service.impl;

import com.sy.mapper.commandLogMapper;
import com.sy.model.GatherInfo;
import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO;
import com.sy.model.LandBusinessTypeList;
import com.sy.model.commandLog;
import com.sy.service.CommandLogService;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;

import static com.sy.service.impl.ResMessageServiceImpl.toStrArry;

@Service
public class CommandLogImpl implements CommandLogService {

    @Resource
    commandLogMapper mapper;

    @Override
    public int insert(commandLog command) {
        return mapper.insertSelective(command);
    }


    @Override
    public void commandlog(GatherInfo info, boolean check, String reason, LandBusinessTypeList land, List<LAND_BUSINEESTYPE_LIST_INFO> list_infos,
                           Double selfWt,Double inWt,Double goodsWt,Double diffVal
    ){
        String flag="",type="";
        commandLog command=new commandLog();
        command.setId(UUID.randomUUID().toString());
        command.setBarcode(info.getBarcode());
        if(land!=null){
            command.setBusnessType(land.getBusinesstype());
        }
        command.setAreaId(info.getAreaid());
        command.setChnlNo(info.getChnlno());
        if (check){
            flag = "00";
        } else{
            flag = "11";
        }
        if("I".equals(info.getIetype())){
            type="000000200000000000";
        }else{
            type="000000100000000000";
        }
        command.setReasonCode(flag+type);
        command.setReasonText(reason);
        command.setVeName(info.getVename());
        command.setVeWeight(selfWt);
        command.setIeType(info.getIetype());
        command.setExitGrossWeight(info.getGrosswt().doubleValue());
        command.setInGrossWeight(inWt);
        command.setGoodsWeight(goodsWt);
        command.setActualGoodsWeight(diffVal);
        if(list_infos!=null && list_infos.size()>0){
            command.setMasterList(Arrays.toString(toStrArry(list_infos)));
        }
        insert(command);
    }
}