<NME> RepairFinishListener.java
<BEF> package com.java110.api.listener.ownerRepair;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.api.bmo.ownerRepair.IOwnerRepairBMO;
import com.java110.api.listener.AbstractServiceApiPlusListener;
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.DataFlowContext;
import com.java110.core.event.service.api.ServiceDataFlowEvent;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.dto.fee.FeeAttrDto;
import com.java110.dto.fee.FeeConfigDto;
import com.java110.dto.fee.FeeDto;
import com.java110.dto.file.FileDto;
import com.java110.dto.file.FileRelDto;
import com.java110.dto.owner.OwnerDto;
import com.java110.dto.owner.OwnerRoomRelDto;
import com.java110.dto.repair.RepairDto;
import com.java110.dto.repair.RepairUserDto;
import com.java110.dto.userStorehouse.UserStorehouseDto;
import com.java110.intf.common.IFileInnerServiceSMO;
import com.java110.intf.community.IRepairInnerServiceSMO;
import com.java110.intf.community.IRepairUserInnerServiceSMO;
import com.java110.intf.community.IResourceStoreServiceSMO;
import com.java110.intf.fee.IFeeConfigInnerServiceSMO;
import com.java110.intf.store.IUserStorehouseInnerServiceSMO;
import com.java110.intf.user.IOwnerInnerServiceSMO;
import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO;
import com.java110.po.fee.FeeAttrPo;
import com.java110.po.fee.PayFeePo;
import com.java110.po.file.FileRelPo;
import com.java110.po.owner.RepairPoolPo;
import com.java110.po.owner.RepairUserPo;
import com.java110.po.purchase.ResourceStorePo;
import com.java110.po.resourceStoreUseRecord.ResourceStoreUseRecordPo;
import com.java110.po.userStorehouse.UserStorehousePo;
import com.java110.utils.constant.BusinessTypeConstant;
import com.java110.utils.constant.FeeTypeConstant;
import com.java110.utils.constant.ServiceCodeRepairDispatchStepConstant;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.utils.util.DateUtil;
import com.java110.utils.util.StringUtil;
import com.java110.vo.ResultVo;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import com.java110.core.log.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * 完成报修
 * add by wuxw 2019-06-30
 */
@Java110Listener("repairFinishListener")
public class RepairFinishListener extends AbstractServiceApiPlusListener {

    private static Logger logger = LoggerFactory.getLogger(RepairFinishListener.class);

    @Autowired
    private IOwnerRepairBMO ownerRepairBMOImpl;

    @Autowired
    private IRepairUserInnerServiceSMO repairUserInnerServiceSMOImpl;

    @Autowired
    private IRepairInnerServiceSMO repairInnerServiceSMOImpl;

    @Autowired
    private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl;

    @Autowired
    private IFileInnerServiceSMO fileInnerServiceSMOImpl;

    @Autowired
    private IOwnerRoomRelInnerServiceSMO ownerRoomRelInnerServiceSMO;

    @Autowired
    private IOwnerInnerServiceSMO ownerInnerServiceSMO;

    @Autowired
    private IResourceStoreServiceSMO resourceStoreServiceSMO;

    @Autowired
    private IUserStorehouseInnerServiceSMO userStorehouseInnerServiceSMO;

    @Override
    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "repairId", "未包含报修单信息");
        Assert.hasKeyAndValue(reqJson, "context", "未包含派单内容");
        Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区信息");
//        Assert.hasKeyAndValue(reqJson, "amount", "未包含金额");
        Assert.hasKeyAndValue(reqJson, "feeFlag", "未包含费用标识");
    }

    @Override
    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
        String userId = reqJson.getString("userId");
        String userName = reqJson.getString("userName");
        String publicArea = reqJson.getString("publicArea");
        //获取报修渠道
        String repairChannel = reqJson.getString("repairChannel");
        //获取维修类型
        String maintenanceType = reqJson.getString("maintenanceType");
        //获取商品集合
        String choosedGoodsList = reqJson.getString("choosedGoodsList");
        //判断当前用户是否有需要处理的订单
        RepairUserDto repairUserDto = new RepairUserDto();
        repairUserDto.setRepairId(reqJson.getString("repairId"));
        repairUserDto.setCommunityId(reqJson.getString("communityId"));
        repairUserDto.setState(RepairUserDto.STATE_DOING);
        repairUserDto.setStaffId(userId);
        List<RepairUserDto> repairUserDtos = repairUserInnerServiceSMOImpl.queryRepairUsers(repairUserDto);
        if (repairUserDtos == null || repairUserDtos.size() != 1) {
            ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "当前用户没有需要处理订单！");
            context.setResponseEntity(responseEntity);
            return;
        }
        JSONArray json = JSONArray.parseArray(choosedGoodsList);
        String repairMaterial = "";
        //费用明细(单价 * 数量 = 总价)
        String repairFee = "";
        if (json.size() > 0) {
            Object[] objects = json.toArray();
            //数据前期校验
            for (int i = 0; i < objects.length; i++) {
            for (int i = 0; i < objects.length; i++) {
                Object object = objects[i];
                JSONObject paramIn = JSONObject.parseObject(String.valueOf(object));
                String isCustom = paramIn.getString("isCustom");//是否自定义
                String resId = paramIn.getString("resId");//获取商品资源id
                String useNumber = paramIn.getString("useNumber");//获取商品数量
                String outLowPrice = "0";//最低价
                String outHighPrice = "0"; //最高价
                List<ResourceStorePo> resourceStorePoList = new ArrayList<>();
                List<UserStorehouseDto> userStorehouseDtoList = new ArrayList<>();

                if (!StringUtil.isEmpty(resId)) {
                    //查询库存并校验库存
                    ResourceStorePo resourceStorePo = new ResourceStorePo();
                    resourceStorePo.setResId(resId);
                    resourceStorePoList = resourceStoreServiceSMO.getResourceStores(resourceStorePo);//查询物品资源信息
                    Assert.listOnlyOne(resourceStorePoList, "查询不到物品信息或查询到多个物品信息！");
                    outLowPrice = resourceStorePoList.get(0).getOutLowPrice(); //最低价
                    outHighPrice = resourceStorePoList.get(0).getOutHighPrice();//最高价
                }
                if (!StringUtil.isEmpty(useNumber) && !"0".equals(useNumber)
                        && (!StringUtil.isEmpty(isCustom) && isCustom.equals("false"))) {
                    String nowStock = "0";
                    //（从我的物料中获取商品库存）
                    UserStorehouseDto userStorehouseDto = new UserStorehouseDto();
                    userStorehouseDto.setResId(resId);
                    userStorehouseDto.setUserId(userId);
                    //查询个人物品信息
                    userStorehouseDtoList = userStorehouseInnerServiceSMO.queryUserStorehouses(userStorehouseDto);
                    if (userStorehouseDtoList == null || userStorehouseDtoList.size() < 1) {
                        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "维修物料" + userStorehouseDtoList.get(0).getResName() + "库存不足，请您先申领物品！");
                        context.setResponseEntity(responseEntity);
                        return;
                    }
                    if (userStorehouseDtoList.size() == 1) {
                        //获取最小计量总数
                        nowStock = userStorehouseDtoList.get(0).getMiniStock();
                    }
                    if (Double.parseDouble(nowStock) < Double.parseDouble(useNumber)) {
                        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "维修物料" + userStorehouseDtoList.get(0).getResName() + "库存不足，请您先申领物品！");
                        context.setResponseEntity(responseEntity);
                        return;
                    }
                }
                if (maintenanceType.equals("1001") && (!StringUtil.isEmpty(isCustom) && isCustom.equals("false"))) {
                    Double price = Double.parseDouble(paramIn.getString("price")); //获取价格
                    Double outLowPrices = Double.parseDouble(outLowPrice);//最低价
                    Double outHighPrices = Double.parseDouble(outHighPrice);//最高价
                    //物品价格应该在最低价和最高价之间
                    if (price < outLowPrices || price > outHighPrices) {
                        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "输入的维修物料" + userStorehouseDtoList.get(0).getResName() + "单价不正确，请重新输入！");
                        context.setResponseEntity(responseEntity);
                        return;
                    }
                }
            }
            //数据操作入库以及更新数据库
            for (int i = 0; i < objects.length; i++) {
                Object object = objects[i];
                JSONObject paramIn = JSONObject.parseObject(String.valueOf(object));
                String isCustom = paramIn.getString("isCustom");//是否自定义
                //获取商品资源id
                String resId = paramIn.getString("resId");
                //获取商品数量
                String useNumber = paramIn.getString("useNumber");
                //总价
                String totalPrice = "";
                //用料
                String repairMaterials = "";
                //单价
                Double unitPrice = 0.0;
                //数量
                Double useNumber_s = 0.0;
                //费用明细
                String repair = "";
                DecimalFormat df = new DecimalFormat("0.00");
                List<ResourceStorePo> resourceStorePoList = new ArrayList<>();
                List<UserStorehouseDto> userStorehouseDtoList = new ArrayList<>();
                if (!StringUtil.isEmpty(paramIn.getString("price")) && !StringUtil.isEmpty(useNumber)) {
                    //支付费用 数量乘以单价
                    unitPrice = Double.parseDouble(paramIn.getString("price"));
                    //物品数量
                    useNumber_s = Double.parseDouble(useNumber);
                    //计算金额
                    totalPrice = df.format(unitPrice * useNumber_s);
                    //费用明细
                    repair = df.format(unitPrice) + " * " + useNumber_s + " = " + totalPrice;
                }
                if (!StringUtil.isEmpty(resId)) {
                    ResourceStorePo resourceStorePo = new ResourceStorePo();
                    resourceStorePo.setResId(resId);
                    //查询物品资源信息
                    resourceStorePoList = resourceStoreServiceSMO.getResourceStores(resourceStorePo);
                    Assert.listOnlyOne(resourceStorePoList, "查询不到物品信息或查询到多个物品信息！");
                    //用料
                    repairMaterials = resourceStorePoList.get(0).getResName() + "*" + useNumber;
                } else {
                    //用料
                    repairMaterials = paramIn.getString("customGoodsName") + "*" + useNumber;
                }
                if (!StringUtil.isEmpty(useNumber) && !"0".equals(useNumber)
                        && (!StringUtil.isEmpty(isCustom) && isCustom.equals("false"))) {
                    String nowStock = "0";
                    //（从我的物料中获取商品库存）
                    UserStorehouseDto userStorehouseDto = new UserStorehouseDto();
                    userStorehouseDto.setResId(resId);
                    userStorehouseDto.setUserId(userId);
                    //查询个人物品信息
                    userStorehouseDtoList = userStorehouseInnerServiceSMO.queryUserStorehouses(userStorehouseDto);
                    Assert.listOnlyOne(userStorehouseDtoList, "查询不到个人物品信息或查询到多条信息！");
                    if (userStorehouseDtoList.size() == 1) {
                        //最小计量总数
                        nowStock = userStorehouseDtoList.get(0).getMiniStock();
                    }
                    //库存减少
                    UserStorehousePo userStorehousePo = new UserStorehousePo();
                    //计算个人物品剩余最小计量总数
                    BigDecimal num1 = new BigDecimal(Double.parseDouble(nowStock));
                    BigDecimal num2 = new BigDecimal(Double.parseDouble(useNumber));
                    BigDecimal surplusStock = num1.subtract(num2);
                    //最小计量单位数量
                    double miniUnitStock = Double.parseDouble(userStorehouseDtoList.get(0).getMiniUnitStock());
                    //获取物品单位
                    if (StringUtil.isEmpty(userStorehouseDtoList.get(0).getUnitCode())) {
                        throw new IllegalArgumentException("物品单位不能为空！");
                    }
                    String unitCode = userStorehouseDtoList.get(0).getUnitCode();
                    //获取物品最小计量单位
                    if (StringUtil.isEmpty(userStorehouseDtoList.get(0).getMiniUnitCode())) {
                        throw new IllegalArgumentException("物品最小计量单位不能为空！");
                    }
                    String miniUnitCode = userStorehouseDtoList.get(0).getMiniUnitCode();
                    if (unitCode.equals(miniUnitCode)) { //如果最小计量单位与物品单位相同，就不向上取整
                        BigDecimal num3 = new BigDecimal(miniUnitStock);
                        double newStock = surplusStock.divide(num3, 2, BigDecimal.ROUND_HALF_UP).doubleValue();
                        int remainingInventory = new Double(newStock).intValue();
                        userStorehousePo.setStock(String.valueOf(remainingInventory));
                    } else { //如果不相同就向上取整
                        BigDecimal num3 = new BigDecimal(miniUnitStock);
                        double newStock = surplusStock.divide(num3, 2, BigDecimal.ROUND_HALF_UP).doubleValue();
                        double ceil = Math.ceil(newStock);
                        int remainingInventory = new Double(ceil).intValue();
                        userStorehousePo.setStock(String.valueOf(remainingInventory));
                    }
                    if (useNumber.contains(".") || nowStock.contains(".")) { //如果传过来的使用数量为小数，或原有库存数量有小数，就保留小数
                        userStorehousePo.setMiniStock(String.valueOf(surplusStock.doubleValue()));
                    } else { //如果传来的使用数量为整数，且原有库存数量为整数，就取整
                        userStorehousePo.setMiniStock(String.valueOf(surplusStock.intValue()));
                    }
                    userStorehousePo.setUsId(userStorehouseDtoList.get(0).getUsId());
                    userStorehousePo.setResId(resId);
                    userStorehousePo.setUserId(userId);
                    //更新库存
                    super.update(context, userStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_USER_STOREHOUSE);
                }
                //往物品使用记录表插入数据
                ResourceStoreUseRecordPo resourceStoreUseRecordPo = new ResourceStoreUseRecordPo();
                resourceStoreUseRecordPo.setRsurId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_rsurId));
                resourceStoreUseRecordPo.setRepairId(reqJson.getString("repairId"));
                resourceStoreUseRecordPo.setResourceStoreName(paramIn.getString("resName"));
                if (!StringUtil.isEmpty(isCustom) && isCustom.equals("true")) {
                    resId = "666666";
                    resourceStoreUseRecordPo.setResourceStoreName(paramIn.getString("customGoodsName"));
                }
                resourceStoreUseRecordPo.setResId(resId);
                resourceStoreUseRecordPo.setCommunityId(reqJson.getString("communityId"));
                resourceStoreUseRecordPo.setStoreId(reqJson.getString("storeId"));
                resourceStoreUseRecordPo.setCreateUserId(reqJson.getString("userId"));
                resourceStoreUseRecordPo.setCreateUserName(reqJson.getString("userName"));
                resourceStoreUseRecordPo.setRemark(reqJson.getString("context"));
                resourceStoreUseRecordPo.setQuantity(useNumber);
                resourceStoreUseRecordPo.setState("2002"); //1001 报废回收   2002 工单损耗   3003 公用损耗
                //有偿服务
                if (maintenanceType.equals("1001")) {
                    resourceStoreUseRecordPo.setUnitPrice(paramIn.getString("price"));
                    super.insert(context, resourceStoreUseRecordPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_RESOURCE_STORE_USE_RECORD);
                } else if (maintenanceType.equals("1003")) {  //需要用料
                    super.insert(context, resourceStoreUseRecordPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_RESOURCE_STORE_USE_RECORD);
                }
                if (!StringUtil.isEmpty(repairMaterials)) {
                    repairMaterial += repairMaterials + "；";
                }
                if (!StringUtil.isEmpty(repair)) {
                    repairFee += repair + "；";
                }
            }
        }
        // 1.0 关闭自己订单
        RepairUserPo repairUserPo = new RepairUserPo();
        repairUserPo.setRuId(repairUserDtos.get(0).getRuId());
        repairUserPo.setEndTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
        repairUserPo.setState(RepairUserDto.STATE_CLOSE);
        repairUserPo.setContext(reqJson.getString("context"));
        repairUserPo.setCommunityId(reqJson.getString("communityId"));
        super.update(context, repairUserPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_REPAIR_USER);
        if ((!StringUtil.isEmpty(repairChannel) && "Z".equals(repairChannel))
                || (!StringUtil.isEmpty(maintenanceType) && "1001".equals(maintenanceType))) {  //如果是业主报修或者是有偿的就生成一条新状态，否则不变
            //2.0 给开始节点派支付单
            repairUserDto = new RepairUserDto();
            repairUserDto.setRepairId(reqJson.getString("repairId"));
            repairUserDto.setCommunityId(reqJson.getString("communityId"));
            repairUserDto.setRepairEvent(RepairUserDto.REPAIR_EVENT_START_USER);
            repairUserDtos = repairUserInnerServiceSMOImpl.queryRepairUsers(repairUserDto);
            if (repairUserDtos.size() != 1) {
                ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "数据错误 该订单没有发起人！");
                context.setResponseEntity(responseEntity);
                return;
            }
            repairUserPo = new RepairUserPo();
            repairUserPo.setRuId("-1");
            repairUserPo.setStartTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
            if ("1001".equals(maintenanceType)) { //如果是有偿的就走下面(业主报修有偿或者电话申请有偿或者员工报修有偿)
                repairUserPo.setState(RepairUserDto.STATE_PAY_FEE);
                repairUserPo.setContext("待支付" + reqJson.getString("totalPrice") + "元");
            } else {
                repairUserPo.setState(RepairUserDto.STATE_EVALUATE);
                repairUserPo.setContext("待评价");
            }
            repairUserPo.setRepairId(reqJson.getString("repairId"));
            if ("Z".equals(repairChannel)) {  //如果是业主端报修的走下面的方法
                repairUserPo.setStaffId(repairUserDtos.get(0).getStaffId());
                repairUserPo.setStaffName(repairUserDtos.get(0).getStaffName());
            } else { //如果不是业主报修，并且有偿
                RepairDto repairDto = new RepairDto();
                repairDto.setRepairId(reqJson.getString("repairId"));
                List<RepairDto> repairDtos = repairInnerServiceSMOImpl.queryRepairs(repairDto);
                if (repairDtos.size() != 1) {
                    ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "数据错误，该用户没有报修单！");
                    context.setResponseEntity(responseEntity);
                    return;
                }
                //此时的报修对象ID即房屋ID
                String roomId = repairDtos.get(0).getRepairObjId();
                OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
                ownerRoomRelDto.setRoomId(roomId);
                //查询房屋业主关系表
                List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMO.queryOwnerRoomRels(ownerRoomRelDto);
                if (ownerRoomRelDtos.size() != 1) {
                    ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "信息错误，未找到房屋的业主！");
                    context.setResponseEntity(responseEntity);
                    return;
                }
                //获取业主id
                String ownerId = ownerRoomRelDtos.get(0).getOwnerId();
                OwnerDto ownerDto = new OwnerDto();
                ownerDto.setOwnerId(ownerId);
                //根据业主id查询业主信息
                List<OwnerDto> ownerDtos = ownerInnerServiceSMO.queryOwners(ownerDto);
                if (ownerDtos.size() != 1) {
                    ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "未查询到业主信息！");
                    context.setResponseEntity(responseEntity);
                    return;
                }
                //获取业主姓名
                String ownerName = ownerDtos.get(0).getName();
                repairUserPo.setStaffId(ownerId);
                repairUserPo.setStaffName(ownerName);
            }
            repairUserPo.setPreStaffId(userId);
            repairUserPo.setPreStaffName(userName);
            repairUserPo.setPreRuId(repairUserDtos.get(0).getRuId());
            repairUserPo.setRepairEvent(RepairUserDto.REPAIR_EVENT_PAY_USER);
            repairUserPo.setCommunityId(reqJson.getString("communityId"));
            super.insert(context, repairUserPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_REPAIR_USER);
        }
        //维修前图片处理
        if (reqJson.containsKey("beforeRepairPhotos") && !StringUtils.isEmpty(reqJson.getString("beforeRepairPhotos"))) {
            JSONArray beforeRepairPhotos = reqJson.getJSONArray("beforeRepairPhotos");
            for (int _photoIndex = 0; _photoIndex < beforeRepairPhotos.size(); _photoIndex++) {
                FileDto fileDto = new FileDto();
                fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id));
                fileDto.setFileName(fileDto.getFileId());
                fileDto.setContext(beforeRepairPhotos.getJSONObject(_photoIndex).getString("photo"));
                fileDto.setSuffix("jpeg");
                fileDto.setCommunityId(reqJson.getString("communityId"));
                String fileName = fileInnerServiceSMOImpl.saveFile(fileDto);
                reqJson.put("ownerPhotoId", fileDto.getFileId());
                reqJson.put("fileSaveName", fileName);
                JSONObject businessUnit = new JSONObject();
                businessUnit.put("fileRelId", "-" + (_photoIndex + 1));
                businessUnit.put("relTypeCd", FileRelDto.BEFORE_REPAIR_PHOTOS);
                businessUnit.put("saveWay", "ftp");
                businessUnit.put("objId", reqJson.getString("repairId"));
                businessUnit.put("fileRealName", fileName);
                businessUnit.put("fileSaveName", fileName);
                FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class);
                super.insert(context, fileRelPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FILE_REL);
            }
        }
        //维修后图片处理
        if (reqJson.containsKey("afterRepairPhotos") && !StringUtils.isEmpty(reqJson.getString("afterRepairPhotos"))) {
            JSONArray afterRepairPhotos = reqJson.getJSONArray("afterRepairPhotos");
            for (int _photoIndex = 0; _photoIndex < afterRepairPhotos.size(); _photoIndex++) {
                FileDto fileDto = new FileDto();
                fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id));
                fileDto.setFileName(fileDto.getFileId());
                fileDto.setContext(afterRepairPhotos.getJSONObject(_photoIndex).getString("photo"));
                fileDto.setSuffix("jpeg");
                fileDto.setCommunityId(reqJson.getString("communityId"));
                String fileName = fileInnerServiceSMOImpl.saveFile(fileDto);
                reqJson.put("ownerFinishPhotoId", fileDto.getFileId());
                reqJson.put("fileFinishSaveName", fileName);
                JSONObject businessUnit = new JSONObject();
                businessUnit.put("fileRelId", "-" + (_photoIndex + 1));
                businessUnit.put("relTypeCd", FileRelDto.AFTER_REPAIR_PHOTOS);
                businessUnit.put("saveWay", "ftp");
                businessUnit.put("objId", reqJson.getString("repairId"));
                businessUnit.put("fileRealName", fileName);
                businessUnit.put("fileSaveName", fileName);
                FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class);
                super.insert(context, fileRelPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FILE_REL);
            }
        }
        if ("F".equals(publicArea) && "1002".equals(reqJson.getString("maintenanceType"))) { //如果不是公共区域且是无偿的走下面
            //改变r_repair_pool表maintenance_type维修类型
            RepairPoolPo repairPoolPo = new RepairPoolPo();
            repairPoolPo.setRepairId(reqJson.getString("repairId"));
            repairPoolPo.setMaintenanceType(reqJson.getString("maintenanceType"));
            super.update(context, repairPoolPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_REPAIR);
            if (repairChannel.equals("T") || repairChannel.equals("D")) { //如果是电话报修和员工代客报修结单后状态变为待回访
                ownerRepairBMOImpl.modifyBusinessRepairDispatch(reqJson, context, RepairDto.STATE_RETURN_VISIT);
            } else if (repairChannel.equals("Z")) { //如果是业主自主报修结单后状态变为待评价
                ownerRepairBMOImpl.modifyBusinessRepairDispatch(reqJson, context, RepairDto.STATE_APPRAISE);
            }
        } else if ("F".equals(publicArea) && "1001".equals(reqJson.getString("maintenanceType"))) { //如果不是公共区域且是有偿的走下面
            //3.0 生成支付费用
            //查询默认费用项
            FeeConfigDto feeConfigDto = new FeeConfigDto();
            feeConfigDto.setCommunityId(reqJson.getString("communityId"));
            feeConfigDto.setFeeTypeCd(FeeTypeConstant.FEE_TYPE_REPAIR);
            feeConfigDto.setIsDefault(FeeConfigDto.DEFAULT_FEE_CONFIG);
            List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
            if (feeConfigDtos.size() != 1) {
                ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "默认维修费用有多条或不存在！");
                context.setResponseEntity(responseEntity);
                return;
            }
            PayFeePo feePo = new PayFeePo();
            feePo.setAmount(String.valueOf(reqJson.getString("")));
            feePo.setCommunityId(reqJson.getString("communityId"));
            feePo.setConfigId(feeConfigDtos.get(0).getConfigId());
            feePo.setEndTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
            feePo.setFeeFlag(feeConfigDtos.get(0).getFeeFlag());
            feePo.setFeeId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_feeId));
            feePo.setFeeTypeCd(FeeTypeConstant.FEE_TYPE_REPAIR);
            feePo.setIncomeObjId(reqJson.getString("storeId"));
            feePo.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_ROOM);
            feePo.setAmount(reqJson.getString("totalPrice"));
            feePo.setBatchId("-1");
            RepairDto repairDto = new RepairDto();
            repairDto.setCommunityId(reqJson.getString("communityId"));
            repairDto.setRepairId(reqJson.getString("repairId"));
            List<RepairDto> repairDtos = repairInnerServiceSMOImpl.queryRepairs(repairDto);
            if (repairDtos.size() != 1) {
                ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "维修单有多条或不存在！");
                context.setResponseEntity(responseEntity);
                return;
            }
            feePo.setPayerObjId(repairDtos.get(0).getRepairObjId());
            feePo.setStartTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
            feePo.setState(FeeDto.STATE_DOING);
            feePo.setUserId(userId);
            super.insert(context, feePo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_INFO);
            FeeAttrPo feeAttrPo = new FeeAttrPo();
            feeAttrPo.setAttrId("-1");
            feeAttrPo.setFeeId(feePo.getFeeId());
            feeAttrPo.setSpecCd(FeeAttrDto.SPEC_CD_REPAIR);
            feeAttrPo.setCommunityId(reqJson.getString("communityId"));
            feeAttrPo.setValue(reqJson.getString("repairId"));
            super.insert(context, feeAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_INFO);
            //改变r_repair_pool表maintenance_type维修类型
            RepairPoolPo repairPoolPo = new RepairPoolPo();
            repairPoolPo.setRepairId(reqJson.getString("repairId"));
            //维修类型
            repairPoolPo.setMaintenanceType(reqJson.getString("maintenanceType"));
            //用料
            repairPoolPo.setRepairMaterials(repairMaterial.substring(0, repairMaterial.length() - 1));
            //费用明细
            repairPoolPo.setRepairFee(repairFee.substring(0, repairFee.length() - 1));
            //支付方式
            repairPoolPo.setPayType(reqJson.getString("payType"));
            super.update(context, repairPoolPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_REPAIR);
            ownerRepairBMOImpl.modifyBusinessRepairDispatch(reqJson, context, RepairDto.STATE_PAY);
        } else if ("T".equals(publicArea)) {  //公共区域走这里
            //公共区域用料时修改维修类型和用料
            if ("1003".equals(maintenanceType)) {
                //改变r_repair_pool表maintenance_type维修类型
                RepairPoolPo repairPoolPo = new RepairPoolPo();
                repairPoolPo.setRepairId(reqJson.getString("repairId"));
                //维修类型
                repairPoolPo.setMaintenanceType(reqJson.getString("maintenanceType"));
                //用料
                repairPoolPo.setRepairMaterials(repairMaterial.substring(0, repairMaterial.length() - 1));
                super.update(context, repairPoolPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_REPAIR);
            }
            if ("T".equals(repairChannel) || "D".equals(repairChannel)) { //如果是电话报修和员工代客报修结单后状态变为待回访
                ownerRepairBMOImpl.modifyBusinessRepairDispatch(reqJson, context, RepairDto.STATE_RETURN_VISIT);
            } else if ("Z".equals(repairChannel)) { //如果是业主自主报修结单后状态变为待评价
                ownerRepairBMOImpl.modifyBusinessRepairDispatch(reqJson, context, RepairDto.STATE_APPRAISE);
            }
        }
        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_OK, ResultVo.MSG_OK);
        context.setResponseEntity(responseEntity);
    }

    @Override
    public String getServiceCode() {
        return ServiceCodeRepairDispatchStepConstant.BINDING_REPAIR_FINISH;
    }

    @Override
    public HttpMethod getHttpMethod() {
        return HttpMethod.POST;
    }

    @Override
    public int getOrder() {
        return DEFAULT_ORDER;
    }

    public IRepairInnerServiceSMO getRepairInnerServiceSMOImpl() {
        return repairInnerServiceSMOImpl;
    }

    public void setRepairInnerServiceSMOImpl(IRepairInnerServiceSMO repairInnerServiceSMOImpl) {
        this.repairInnerServiceSMOImpl = repairInnerServiceSMOImpl;
    }
}

<MSG> 优化采购管理细节问题

<DFF> @@ -126,7 +126,7 @@ public class RepairFinishListener extends AbstractServiceApiPlusListener {
         String repairMaterial = "";
         //费用明细(单价 * 数量 = 总价)
         String repairFee = "";
-        if (json.size() > 0) {
+        if (json.size() > 0 && (maintenanceType.equals("1001") || maintenanceType.equals("1003") )) {
             Object[] objects = json.toArray();
             //数据前期校验
             for (int i = 0; i < objects.length; i++) {

{'commit': 'diff --git a/java110-bean/src/main/java/com/java110/dto/purchaseApply/PurchaseApplyDetailDto.java b/java110-bean/src/main/java/com/java110/dto/purchaseApply/PurchaseApplyDetailDto.java\nindex 5d8377e42..535390e6f 100755\n--- a/java110-bean/src/main/java/com/java110/dto/purchaseApply/PurchaseApplyDetailDto.java\n+++ b/java110-bean/src/main/java/com/java110/dto/purchaseApply/PurchaseApplyDetailDto.java\n@@ -21,6 +21,7 @@ public class PurchaseApplyDetailDto {\n     private String specName;\n     private String standardPrice;\n     private String originalStock;\n+    private String supplierName;\n \n     public String getApplyOrderId() {\n         return applyOrderId;\n@@ -157,6 +158,14 @@ public class PurchaseApplyDetailDto {\n     public void setOriginalStock(String originalStock) {\n         this.originalStock = originalStock;\n     }\n+\n+    public String getSupplierName() {\n+        return supplierName;\n+    }\n+\n+    public void setSupplierName(String supplierName) {\n+        this.supplierName = supplierName;\n+    }\n }\n \n \ndiff --git a/java110-bean/src/main/java/com/java110/dto/purchaseApply/PurchaseApplyDto.java b/java110-bean/src/main/java/com/java110/dto/purchaseApply/PurchaseApplyDto.java\nindex c7dd326a4..555d29539 100755\n--- a/java110-bean/src/main/java/com/java110/dto/purchaseApply/PurchaseApplyDto.java\n+++ b/java110-bean/src/main/java/com/java110/dto/purchaseApply/PurchaseApplyDto.java\n@@ -55,6 +55,7 @@ public class PurchaseApplyDto extends PageDto implements Serializable {\n     private String createUserId;\n     private String createUserName;\n     private String price;\n+    private String supplierName;\n \n     public String getResOrderType() {\n         return resOrderType;\n@@ -281,4 +282,12 @@ public class PurchaseApplyDto extends PageDto implements Serializable {\n     public void setPrice(String price) {\n         this.price = price;\n     }\n+\n+    public String getSupplierName() {\n+        return supplierName;\n+    }\n+\n+    public void setSupplierName(String supplierName) {\n+        this.supplierName = supplierName;\n+    }\n }\ndiff --git a/java110-bean/src/main/java/com/java110/vo/api/purchaseApply/PurchaseApplyDetailVo.java b/java110-bean/src/main/java/com/java110/vo/api/purchaseApply/PurchaseApplyDetailVo.java\nindex d1f7ea816..ccc90ec86 100755\n--- a/java110-bean/src/main/java/com/java110/vo/api/purchaseApply/PurchaseApplyDetailVo.java\n+++ b/java110-bean/src/main/java/com/java110/vo/api/purchaseApply/PurchaseApplyDetailVo.java\n@@ -26,6 +26,7 @@ public class PurchaseApplyDetailVo {\n     private String specName;\n     private String standardPrice;\n     private String originalStock;\n+    private String supplierName;\n \n \n     public String getApplyOrderId() {\n@@ -203,6 +204,14 @@ public class PurchaseApplyDetailVo {\n     public void setOriginalStock(String originalStock) {\n         this.originalStock = originalStock;\n     }\n+\n+    public String getSupplierName() {\n+        return supplierName;\n+    }\n+\n+    public void setSupplierName(String supplierName) {\n+        this.supplierName = supplierName;\n+    }\n }\n \n \ndiff --git a/java110-db/src/main/resources/mapper/store/PurchaseApplyDetailServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/store/PurchaseApplyDetailServiceDaoImplMapper.xml\nindex c03e0f311..2a281edcd 100755\n--- a/java110-db/src/main/resources/mapper/store/PurchaseApplyDetailServiceDaoImplMapper.xml\n+++ b/java110-db/src/main/resources/mapper/store/PurchaseApplyDetailServiceDaoImplMapper.xml\n@@ -189,6 +189,9 @@\n             <if test="newBId != null and newBId != \'\'">\n                 t.b_id = #{newBId},\n             </if>\n+            <if test="rsId != null and rsId != \'\'">\n+                t.rs_id = #{rsId},\n+            </if>\n             <if test="resId !=null and resId != \'\'">\n                 t.res_id= #{resId},\n             </if>\ndiff --git a/java110-db/src/main/resources/mapper/store/PurchaseApplyServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/store/PurchaseApplyServiceDaoImplMapper.xml\nindex c4bac2155..fdd1ebd25 100755\n--- a/java110-db/src/main/resources/mapper/store/PurchaseApplyServiceDaoImplMapper.xml\n+++ b/java110-db/src/main/resources/mapper/store/PurchaseApplyServiceDaoImplMapper.xml\n@@ -308,7 +308,7 @@\n         p.apply_order_id applyOrderId,\n         p.res_id resId,p.quantity,p.remark,p.purchase_quantity purchaseQuantity,p.purchase_remark purchaseRemark,p.price purchasePrice,p.original_stock originalStock,\n         r.res_name resName,r.res_code resCode,\n-        r.price,r.price standardPrice,r.stock,rst.name rstName,rss.spec_name specName\n+        r.price,r.price standardPrice,r.stock,rst.name rstName,rss.spec_name specName,rs.supplier_name supplierName\n         from\n         purchase_apply_detail p inner join resource_store r on p.res_id = r.res_id and r.status_cd = \'0\'\n         LEFT JOIN resource_supplier rs on p.rs_id=rs.rs_id\ndiff --git a/service-api/src/main/java/com/java110/api/listener/ownerRepair/RepairFinishListener.java b/service-api/src/main/java/com/java110/api/listener/ownerRepair/RepairFinishListener.java\nindex acd1b93b1..90d9977c6 100755\n--- a/service-api/src/main/java/com/java110/api/listener/ownerRepair/RepairFinishListener.java\n+++ b/service-api/src/main/java/com/java110/api/listener/ownerRepair/RepairFinishListener.java\n@@ -126,7 +126,7 @@ public class RepairFinishListener extends AbstractServiceApiPlusListener {\n         String repairMaterial = "";\n         //费用明细(单价 * 数量 = 总价)\n         String repairFee = "";\n-        if (json.size() > 0) {\n+        if (json.size() > 0 && (maintenanceType.equals("1001") || maintenanceType.equals("1003") )) {\n             Object[] objects = json.toArray();\n             //数据前期校验\n             for (int i = 0; i < objects.length; i++) {\n', 'commit_subject': '优化采购管理细节问题', 'repo_name': 'java110/MicroCommunity', 'committer': {'name': 'xiaogang', 'email': '55e2d69286b0a03313ffdd7cbf8adfe92c6f1203@qq.com', 'time_sec': '1622080391', 'tz_offset': '480', 'date': {'seconds': '1622080391'}}, 'commit_tree': '8783e6b158d3eb2f85a11c36bf47e0e19b01944b', 'commit_message': '优化采购管理细节问题\n', 'language_name': 'Java', 'license': 'apache-2.0', 'hunks': '@@ -126,7 +126,7 @@ public class RepairFinishListener extends AbstractServiceApiPlusListener {\n         String repairMaterial = "";\n         //费用明细(单价 * 数量 = 总价)\n         String repairFee = "";\n-        if (json.size() > 0) {\n+        if (json.size() > 0 && (maintenanceType.equals("1001") || maintenanceType.equals("1003") )) {\n             Object[] objects = json.toArray();\n             //数据前期校验\n             for (int i = 0; i < objects.length; i++) {\n', 'addition_count': 1, 'deletion_count': 1, 'src_file': 'a/service-api/src/main/java/com/java110/api/listener/ownerRepair/RepairFinishListener.java', 'tgt_file': 'b/service-api/src/main/java/com/java110/api/listener/ownerRepair/RepairFinishListener.java', 'file_extension': '.java', 'before_file': 'package com.java110.api.listener.ownerRepair;\n\nimport com.alibaba.fastjson.JSONArray;\nimport com.alibaba.fastjson.JSONObject;\nimport com.java110.api.bmo.ownerRepair.IOwnerRepairBMO;\nimport com.java110.api.listener.AbstractServiceApiPlusListener;\nimport com.java110.core.annotation.Java110Listener;\nimport com.java110.core.context.DataFlowContext;\nimport com.java110.core.event.service.api.ServiceDataFlowEvent;\nimport com.java110.core.factory.GenerateCodeFactory;\nimport com.java110.dto.fee.FeeAttrDto;\nimport com.java110.dto.fee.FeeConfigDto;\nimport com.java110.dto.fee.FeeDto;\nimport com.java110.dto.file.FileDto;\nimport com.java110.dto.file.FileRelDto;\nimport com.java110.dto.owner.OwnerDto;\nimport com.java110.dto.owner.OwnerRoomRelDto;\nimport com.java110.dto.repair.RepairDto;\nimport com.java110.dto.repair.RepairUserDto;\nimport com.java110.dto.userStorehouse.UserStorehouseDto;\nimport com.java110.intf.common.IFileInnerServiceSMO;\nimport com.java110.intf.community.IRepairInnerServiceSMO;\nimport com.java110.intf.community.IRepairUserInnerServiceSMO;\nimport com.java110.intf.community.IResourceStoreServiceSMO;\nimport com.java110.intf.fee.IFeeConfigInnerServiceSMO;\nimport com.java110.intf.store.IUserStorehouseInnerServiceSMO;\nimport com.java110.intf.user.IOwnerInnerServiceSMO;\nimport com.java110.intf.user.IOwnerRoomRelInnerServiceSMO;\nimport com.java110.po.fee.FeeAttrPo;\nimport com.java110.po.fee.PayFeePo;\nimport com.java110.po.file.FileRelPo;\nimport com.java110.po.owner.RepairPoolPo;\nimport com.java110.po.owner.RepairUserPo;\nimport com.java110.po.purchase.ResourceStorePo;\nimport com.java110.po.resourceStoreUseRecord.ResourceStoreUseRecordPo;\nimport com.java110.po.userStorehouse.UserStorehousePo;\nimport com.java110.utils.constant.BusinessTypeConstant;\nimport com.java110.utils.constant.FeeTypeConstant;\nimport com.java110.utils.constant.ServiceCodeRepairDispatchStepConstant;\nimport com.java110.utils.util.Assert;\nimport com.java110.utils.util.BeanConvertUtil;\nimport com.java110.utils.util.DateUtil;\nimport com.java110.utils.util.StringUtil;\nimport com.java110.vo.ResultVo;\nimport org.apache.commons.lang3.StringUtils;\nimport org.slf4j.Logger;\nimport com.java110.core.log.LoggerFactory;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.http.HttpMethod;\nimport org.springframework.http.ResponseEntity;\n\nimport java.math.BigDecimal;\nimport java.text.DecimalFormat;\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * 完成报修\n * add by wuxw 2019-06-30\n */\n@Java110Listener("repairFinishListener")\npublic class RepairFinishListener extends AbstractServiceApiPlusListener {\n\n    private static Logger logger = LoggerFactory.getLogger(RepairFinishListener.class);\n\n    @Autowired\n    private IOwnerRepairBMO ownerRepairBMOImpl;\n\n    @Autowired\n    private IRepairUserInnerServiceSMO repairUserInnerServiceSMOImpl;\n\n    @Autowired\n    private IRepairInnerServiceSMO repairInnerServiceSMOImpl;\n\n    @Autowired\n    private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl;\n\n    @Autowired\n    private IFileInnerServiceSMO fileInnerServiceSMOImpl;\n\n    @Autowired\n    private IOwnerRoomRelInnerServiceSMO ownerRoomRelInnerServiceSMO;\n\n    @Autowired\n    private IOwnerInnerServiceSMO ownerInnerServiceSMO;\n\n    @Autowired\n    private IResourceStoreServiceSMO resourceStoreServiceSMO;\n\n    @Autowired\n    private IUserStorehouseInnerServiceSMO userStorehouseInnerServiceSMO;\n\n    @Override\n    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {\n        Assert.hasKeyAndValue(reqJson, "repairId", "未包含报修单信息");\n        Assert.hasKeyAndValue(reqJson, "context", "未包含派单内容");\n        Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区信息");\n//        Assert.hasKeyAndValue(reqJson, "amount", "未包含金额");\n        Assert.hasKeyAndValue(reqJson, "feeFlag", "未包含费用标识");\n    }\n\n    @Override\n    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {\n        String userId = reqJson.getString("userId");\n        String userName = reqJson.getString("userName");\n        String publicArea = reqJson.getString("publicArea");\n        //获取报修渠道\n        String repairChannel = reqJson.getString("repairChannel");\n        //获取维修类型\n        String maintenanceType = reqJson.getString("maintenanceType");\n        //获取商品集合\n        String choosedGoodsList = reqJson.getString("choosedGoodsList");\n        //判断当前用户是否有需要处理的订单\n        RepairUserDto repairUserDto = new RepairUserDto();\n        repairUserDto.setRepairId(reqJson.getString("repairId"));\n        repairUserDto.setCommunityId(reqJson.getString("communityId"));\n        repairUserDto.setState(RepairUserDto.STATE_DOING);\n        repairUserDto.setStaffId(userId);\n        List<RepairUserDto> repairUserDtos = repairUserInnerServiceSMOImpl.queryRepairUsers(repairUserDto);\n        if (repairUserDtos == null || repairUserDtos.size() != 1) {\n            ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "当前用户没有需要处理订单！");\n            context.setResponseEntity(responseEntity);\n            return;\n        }\n        JSONArray json = JSONArray.parseArray(choosedGoodsList);\n        String repairMaterial = "";\n        //费用明细(单价 * 数量 = 总价)\n        String repairFee = "";\n        if (json.size() > 0) {\n            Object[] objects = json.toArray();\n            //数据前期校验\n            for (int i = 0; i < objects.length; i++) {\n            for (int i = 0; i < objects.length; i++) {\n                Object object = objects[i];\n                JSONObject paramIn = JSONObject.parseObject(String.valueOf(object));\n                String isCustom = paramIn.getString("isCustom");//是否自定义\n                String resId = paramIn.getString("resId");//获取商品资源id\n                String useNumber = paramIn.getString("useNumber");//获取商品数量\n                String outLowPrice = "0";//最低价\n                String outHighPrice = "0"; //最高价\n                List<ResourceStorePo> resourceStorePoList = new ArrayList<>();\n                List<UserStorehouseDto> userStorehouseDtoList = new ArrayList<>();\n\n                if (!StringUtil.isEmpty(resId)) {\n                    //查询库存并校验库存\n                    ResourceStorePo resourceStorePo = new ResourceStorePo();\n                    resourceStorePo.setResId(resId);\n                    resourceStorePoList = resourceStoreServiceSMO.getResourceStores(resourceStorePo);//查询物品资源信息\n                    Assert.listOnlyOne(resourceStorePoList, "查询不到物品信息或查询到多个物品信息！");\n                    outLowPrice = resourceStorePoList.get(0).getOutLowPrice(); //最低价\n                    outHighPrice = resourceStorePoList.get(0).getOutHighPrice();//最高价\n                }\n                if (!StringUtil.isEmpty(useNumber) && !"0".equals(useNumber)\n                        && (!StringUtil.isEmpty(isCustom) && isCustom.equals("false"))) {\n                    String nowStock = "0";\n                    //（从我的物料中获取商品库存）\n                    UserStorehouseDto userStorehouseDto = new UserStorehouseDto();\n                    userStorehouseDto.setResId(resId);\n                    userStorehouseDto.setUserId(userId);\n                    //查询个人物品信息\n                    userStorehouseDtoList = userStorehouseInnerServiceSMO.queryUserStorehouses(userStorehouseDto);\n                    if (userStorehouseDtoList == null || userStorehouseDtoList.size() < 1) {\n                        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "维修物料" + userStorehouseDtoList.get(0).getResName() + "库存不足，请您先申领物品！");\n                        context.setResponseEntity(responseEntity);\n                        return;\n                    }\n                    if (userStorehouseDtoList.size() == 1) {\n                        //获取最小计量总数\n                        nowStock = userStorehouseDtoList.get(0).getMiniStock();\n                    }\n                    if (Double.parseDouble(nowStock) < Double.parseDouble(useNumber)) {\n                        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "维修物料" + userStorehouseDtoList.get(0).getResName() + "库存不足，请您先申领物品！");\n                        context.setResponseEntity(responseEntity);\n                        return;\n                    }\n                }\n                if (maintenanceType.equals("1001") && (!StringUtil.isEmpty(isCustom) && isCustom.equals("false"))) {\n                    Double price = Double.parseDouble(paramIn.getString("price")); //获取价格\n                    Double outLowPrices = Double.parseDouble(outLowPrice);//最低价\n                    Double outHighPrices = Double.parseDouble(outHighPrice);//最高价\n                    //物品价格应该在最低价和最高价之间\n                    if (price < outLowPrices || price > outHighPrices) {\n                        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "输入的维修物料" + userStorehouseDtoList.get(0).getResName() + "单价不正确，请重新输入！");\n                        context.setResponseEntity(responseEntity);\n                        return;\n                    }\n                }\n            }\n            //数据操作入库以及更新数据库\n            for (int i = 0; i < objects.length; i++) {\n                Object object = objects[i];\n                JSONObject paramIn = JSONObject.parseObject(String.valueOf(object));\n                String isCustom = paramIn.getString("isCustom");//是否自定义\n                //获取商品资源id\n                String resId = paramIn.getString("resId");\n                //获取商品数量\n                String useNumber = paramIn.getString("useNumber");\n                //总价\n                String totalPrice = "";\n                //用料\n                String repairMaterials = "";\n                //单价\n                Double unitPrice = 0.0;\n                //数量\n                Double useNumber_s = 0.0;\n                //费用明细\n                String repair = "";\n                DecimalFormat df = new DecimalFormat("0.00");\n                List<ResourceStorePo> resourceStorePoList = new ArrayList<>();\n                List<UserStorehouseDto> userStorehouseDtoList = new ArrayList<>();\n                if (!StringUtil.isEmpty(paramIn.getString("price")) && !StringUtil.isEmpty(useNumber)) {\n                    //支付费用 数量乘以单价\n                    unitPrice = Double.parseDouble(paramIn.getString("price"));\n                    //物品数量\n                    useNumber_s = Double.parseDouble(useNumber);\n                    //计算金额\n                    totalPrice = df.format(unitPrice * useNumber_s);\n                    //费用明细\n                    repair = df.format(unitPrice) + " * " + useNumber_s + " = " + totalPrice;\n                }\n                if (!StringUtil.isEmpty(resId)) {\n                    ResourceStorePo resourceStorePo = new ResourceStorePo();\n                    resourceStorePo.setResId(resId);\n                    //查询物品资源信息\n                    resourceStorePoList = resourceStoreServiceSMO.getResourceStores(resourceStorePo);\n                    Assert.listOnlyOne(resourceStorePoList, "查询不到物品信息或查询到多个物品信息！");\n                    //用料\n                    repairMaterials = resourceStorePoList.get(0).getResName() + "*" + useNumber;\n                } else {\n                    //用料\n                    repairMaterials = paramIn.getString("customGoodsName") + "*" + useNumber;\n                }\n                if (!StringUtil.isEmpty(useNumber) && !"0".equals(useNumber)\n                        && (!StringUtil.isEmpty(isCustom) && isCustom.equals("false"))) {\n                    String nowStock = "0";\n                    //（从我的物料中获取商品库存）\n                    UserStorehouseDto userStorehouseDto = new UserStorehouseDto();\n                    userStorehouseDto.setResId(resId);\n                    userStorehouseDto.setUserId(userId);\n                    //查询个人物品信息\n                    userStorehouseDtoList = userStorehouseInnerServiceSMO.queryUserStorehouses(userStorehouseDto);\n                    Assert.listOnlyOne(userStorehouseDtoList, "查询不到个人物品信息或查询到多条信息！");\n                    if (userStorehouseDtoList.size() == 1) {\n                        //最小计量总数\n                        nowStock = userStorehouseDtoList.get(0).getMiniStock();\n                    }\n                    //库存减少\n                    UserStorehousePo userStorehousePo = new UserStorehousePo();\n                    //计算个人物品剩余最小计量总数\n                    BigDecimal num1 = new BigDecimal(Double.parseDouble(nowStock));\n                    BigDecimal num2 = new BigDecimal(Double.parseDouble(useNumber));\n                    BigDecimal surplusStock = num1.subtract(num2);\n                    //最小计量单位数量\n                    double miniUnitStock = Double.parseDouble(userStorehouseDtoList.get(0).getMiniUnitStock());\n                    //获取物品单位\n                    if (StringUtil.isEmpty(userStorehouseDtoList.get(0).getUnitCode())) {\n                        throw new IllegalArgumentException("物品单位不能为空！");\n                    }\n                    String unitCode = userStorehouseDtoList.get(0).getUnitCode();\n                    //获取物品最小计量单位\n                    if (StringUtil.isEmpty(userStorehouseDtoList.get(0).getMiniUnitCode())) {\n                        throw new IllegalArgumentException("物品最小计量单位不能为空！");\n                    }\n                    String miniUnitCode = userStorehouseDtoList.get(0).getMiniUnitCode();\n                    if (unitCode.equals(miniUnitCode)) { //如果最小计量单位与物品单位相同，就不向上取整\n                        BigDecimal num3 = new BigDecimal(miniUnitStock);\n                        double newStock = surplusStock.divide(num3, 2, BigDecimal.ROUND_HALF_UP).doubleValue();\n                        int remainingInventory = new Double(newStock).intValue();\n                        userStorehousePo.setStock(String.valueOf(remainingInventory));\n                    } else { //如果不相同就向上取整\n                        BigDecimal num3 = new BigDecimal(miniUnitStock);\n                        double newStock = surplusStock.divide(num3, 2, BigDecimal.ROUND_HALF_UP).doubleValue();\n                        double ceil = Math.ceil(newStock);\n                        int remainingInventory = new Double(ceil).intValue();\n                        userStorehousePo.setStock(String.valueOf(remainingInventory));\n                    }\n                    if (useNumber.contains(".") || nowStock.contains(".")) { //如果传过来的使用数量为小数，或原有库存数量有小数，就保留小数\n                        userStorehousePo.setMiniStock(String.valueOf(surplusStock.doubleValue()));\n                    } else { //如果传来的使用数量为整数，且原有库存数量为整数，就取整\n                        userStorehousePo.setMiniStock(String.valueOf(surplusStock.intValue()));\n                    }\n                    userStorehousePo.setUsId(userStorehouseDtoList.get(0).getUsId());\n                    userStorehousePo.setResId(resId);\n                    userStorehousePo.setUserId(userId);\n                    //更新库存\n                    super.update(context, userStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_USER_STOREHOUSE);\n                }\n                //往物品使用记录表插入数据\n                ResourceStoreUseRecordPo resourceStoreUseRecordPo = new ResourceStoreUseRecordPo();\n                resourceStoreUseRecordPo.setRsurId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_rsurId));\n                resourceStoreUseRecordPo.setRepairId(reqJson.getString("repairId"));\n                resourceStoreUseRecordPo.setResourceStoreName(paramIn.getString("resName"));\n                if (!StringUtil.isEmpty(isCustom) && isCustom.equals("true")) {\n                    resId = "666666";\n                    resourceStoreUseRecordPo.setResourceStoreName(paramIn.getString("customGoodsName"));\n                }\n                resourceStoreUseRecordPo.setResId(resId);\n                resourceStoreUseRecordPo.setCommunityId(reqJson.getString("communityId"));\n                resourceStoreUseRecordPo.setStoreId(reqJson.getString("storeId"));\n                resourceStoreUseRecordPo.setCreateUserId(reqJson.getString("userId"));\n                resourceStoreUseRecordPo.setCreateUserName(reqJson.getString("userName"));\n                resourceStoreUseRecordPo.setRemark(reqJson.getString("context"));\n                resourceStoreUseRecordPo.setQuantity(useNumber);\n                resourceStoreUseRecordPo.setState("2002"); //1001 报废回收   2002 工单损耗   3003 公用损耗\n                //有偿服务\n                if (maintenanceType.equals("1001")) {\n                    resourceStoreUseRecordPo.setUnitPrice(paramIn.getString("price"));\n                    super.insert(context, resourceStoreUseRecordPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_RESOURCE_STORE_USE_RECORD);\n                } else if (maintenanceType.equals("1003")) {  //需要用料\n                    super.insert(context, resourceStoreUseRecordPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_RESOURCE_STORE_USE_RECORD);\n                }\n                if (!StringUtil.isEmpty(repairMaterials)) {\n                    repairMaterial += repairMaterials + "；";\n                }\n                if (!StringUtil.isEmpty(repair)) {\n                    repairFee += repair + "；";\n                }\n            }\n        }\n        // 1.0 关闭自己订单\n        RepairUserPo repairUserPo = new RepairUserPo();\n        repairUserPo.setRuId(repairUserDtos.get(0).getRuId());\n        repairUserPo.setEndTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));\n        repairUserPo.setState(RepairUserDto.STATE_CLOSE);\n        repairUserPo.setContext(reqJson.getString("context"));\n        repairUserPo.setCommunityId(reqJson.getString("communityId"));\n        super.update(context, repairUserPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_REPAIR_USER);\n        if ((!StringUtil.isEmpty(repairChannel) && "Z".equals(repairChannel))\n                || (!StringUtil.isEmpty(maintenanceType) && "1001".equals(maintenanceType))) {  //如果是业主报修或者是有偿的就生成一条新状态，否则不变\n            //2.0 给开始节点派支付单\n            repairUserDto = new RepairUserDto();\n            repairUserDto.setRepairId(reqJson.getString("repairId"));\n            repairUserDto.setCommunityId(reqJson.getString("communityId"));\n            repairUserDto.setRepairEvent(RepairUserDto.REPAIR_EVENT_START_USER);\n            repairUserDtos = repairUserInnerServiceSMOImpl.queryRepairUsers(repairUserDto);\n            if (repairUserDtos.size() != 1) {\n                ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "数据错误 该订单没有发起人！");\n                context.setResponseEntity(responseEntity);\n                return;\n            }\n            repairUserPo = new RepairUserPo();\n            repairUserPo.setRuId("-1");\n            repairUserPo.setStartTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));\n            if ("1001".equals(maintenanceType)) { //如果是有偿的就走下面(业主报修有偿或者电话申请有偿或者员工报修有偿)\n                repairUserPo.setState(RepairUserDto.STATE_PAY_FEE);\n                repairUserPo.setContext("待支付" + reqJson.getString("totalPrice") + "元");\n            } else {\n                repairUserPo.setState(RepairUserDto.STATE_EVALUATE);\n                repairUserPo.setContext("待评价");\n            }\n            repairUserPo.setRepairId(reqJson.getString("repairId"));\n            if ("Z".equals(repairChannel)) {  //如果是业主端报修的走下面的方法\n                repairUserPo.setStaffId(repairUserDtos.get(0).getStaffId());\n                repairUserPo.setStaffName(repairUserDtos.get(0).getStaffName());\n            } else { //如果不是业主报修，并且有偿\n                RepairDto repairDto = new RepairDto();\n                repairDto.setRepairId(reqJson.getString("repairId"));\n                List<RepairDto> repairDtos = repairInnerServiceSMOImpl.queryRepairs(repairDto);\n                if (repairDtos.size() != 1) {\n                    ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "数据错误，该用户没有报修单！");\n                    context.setResponseEntity(responseEntity);\n                    return;\n                }\n                //此时的报修对象ID即房屋ID\n                String roomId = repairDtos.get(0).getRepairObjId();\n                OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();\n                ownerRoomRelDto.setRoomId(roomId);\n                //查询房屋业主关系表\n                List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMO.queryOwnerRoomRels(ownerRoomRelDto);\n                if (ownerRoomRelDtos.size() != 1) {\n                    ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "信息错误，未找到房屋的业主！");\n                    context.setResponseEntity(responseEntity);\n                    return;\n                }\n                //获取业主id\n                String ownerId = ownerRoomRelDtos.get(0).getOwnerId();\n                OwnerDto ownerDto = new OwnerDto();\n                ownerDto.setOwnerId(ownerId);\n                //根据业主id查询业主信息\n                List<OwnerDto> ownerDtos = ownerInnerServiceSMO.queryOwners(ownerDto);\n                if (ownerDtos.size() != 1) {\n                    ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "未查询到业主信息！");\n                    context.setResponseEntity(responseEntity);\n                    return;\n                }\n                //获取业主姓名\n                String ownerName = ownerDtos.get(0).getName();\n                repairUserPo.setStaffId(ownerId);\n                repairUserPo.setStaffName(ownerName);\n            }\n            repairUserPo.setPreStaffId(userId);\n            repairUserPo.setPreStaffName(userName);\n            repairUserPo.setPreRuId(repairUserDtos.get(0).getRuId());\n            repairUserPo.setRepairEvent(RepairUserDto.REPAIR_EVENT_PAY_USER);\n            repairUserPo.setCommunityId(reqJson.getString("communityId"));\n            super.insert(context, repairUserPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_REPAIR_USER);\n        }\n        //维修前图片处理\n        if (reqJson.containsKey("beforeRepairPhotos") && !StringUtils.isEmpty(reqJson.getString("beforeRepairPhotos"))) {\n            JSONArray beforeRepairPhotos = reqJson.getJSONArray("beforeRepairPhotos");\n            for (int _photoIndex = 0; _photoIndex < beforeRepairPhotos.size(); _photoIndex++) {\n                FileDto fileDto = new FileDto();\n                fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id));\n                fileDto.setFileName(fileDto.getFileId());\n                fileDto.setContext(beforeRepairPhotos.getJSONObject(_photoIndex).getString("photo"));\n                fileDto.setSuffix("jpeg");\n                fileDto.setCommunityId(reqJson.getString("communityId"));\n                String fileName = fileInnerServiceSMOImpl.saveFile(fileDto);\n                reqJson.put("ownerPhotoId", fileDto.getFileId());\n                reqJson.put("fileSaveName", fileName);\n                JSONObject businessUnit = new JSONObject();\n                businessUnit.put("fileRelId", "-" + (_photoIndex + 1));\n                businessUnit.put("relTypeCd", FileRelDto.BEFORE_REPAIR_PHOTOS);\n                businessUnit.put("saveWay", "ftp");\n                businessUnit.put("objId", reqJson.getString("repairId"));\n                businessUnit.put("fileRealName", fileName);\n                businessUnit.put("fileSaveName", fileName);\n                FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class);\n                super.insert(context, fileRelPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FILE_REL);\n            }\n        }\n        //维修后图片处理\n        if (reqJson.containsKey("afterRepairPhotos") && !StringUtils.isEmpty(reqJson.getString("afterRepairPhotos"))) {\n            JSONArray afterRepairPhotos = reqJson.getJSONArray("afterRepairPhotos");\n            for (int _photoIndex = 0; _photoIndex < afterRepairPhotos.size(); _photoIndex++) {\n                FileDto fileDto = new FileDto();\n                fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id));\n                fileDto.setFileName(fileDto.getFileId());\n                fileDto.setContext(afterRepairPhotos.getJSONObject(_photoIndex).getString("photo"));\n                fileDto.setSuffix("jpeg");\n                fileDto.setCommunityId(reqJson.getString("communityId"));\n                String fileName = fileInnerServiceSMOImpl.saveFile(fileDto);\n                reqJson.put("ownerFinishPhotoId", fileDto.getFileId());\n                reqJson.put("fileFinishSaveName", fileName);\n                JSONObject businessUnit = new JSONObject();\n                businessUnit.put("fileRelId", "-" + (_photoIndex + 1));\n                businessUnit.put("relTypeCd", FileRelDto.AFTER_REPAIR_PHOTOS);\n                businessUnit.put("saveWay", "ftp");\n                businessUnit.put("objId", reqJson.getString("repairId"));\n                businessUnit.put("fileRealName", fileName);\n                businessUnit.put("fileSaveName", fileName);\n                FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class);\n                super.insert(context, fileRelPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FILE_REL);\n            }\n        }\n        if ("F".equals(publicArea) && "1002".equals(reqJson.getString("maintenanceType"))) { //如果不是公共区域且是无偿的走下面\n            //改变r_repair_pool表maintenance_type维修类型\n            RepairPoolPo repairPoolPo = new RepairPoolPo();\n            repairPoolPo.setRepairId(reqJson.getString("repairId"));\n            repairPoolPo.setMaintenanceType(reqJson.getString("maintenanceType"));\n            super.update(context, repairPoolPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_REPAIR);\n            if (repairChannel.equals("T") || repairChannel.equals("D")) { //如果是电话报修和员工代客报修结单后状态变为待回访\n                ownerRepairBMOImpl.modifyBusinessRepairDispatch(reqJson, context, RepairDto.STATE_RETURN_VISIT);\n            } else if (repairChannel.equals("Z")) { //如果是业主自主报修结单后状态变为待评价\n                ownerRepairBMOImpl.modifyBusinessRepairDispatch(reqJson, context, RepairDto.STATE_APPRAISE);\n            }\n        } else if ("F".equals(publicArea) && "1001".equals(reqJson.getString("maintenanceType"))) { //如果不是公共区域且是有偿的走下面\n            //3.0 生成支付费用\n            //查询默认费用项\n            FeeConfigDto feeConfigDto = new FeeConfigDto();\n            feeConfigDto.setCommunityId(reqJson.getString("communityId"));\n            feeConfigDto.setFeeTypeCd(FeeTypeConstant.FEE_TYPE_REPAIR);\n            feeConfigDto.setIsDefault(FeeConfigDto.DEFAULT_FEE_CONFIG);\n            List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);\n            if (feeConfigDtos.size() != 1) {\n                ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "默认维修费用有多条或不存在！");\n                context.setResponseEntity(responseEntity);\n                return;\n            }\n            PayFeePo feePo = new PayFeePo();\n            feePo.setAmount(String.valueOf(reqJson.getString("")));\n            feePo.setCommunityId(reqJson.getString("communityId"));\n            feePo.setConfigId(feeConfigDtos.get(0).getConfigId());\n            feePo.setEndTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));\n            feePo.setFeeFlag(feeConfigDtos.get(0).getFeeFlag());\n            feePo.setFeeId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_feeId));\n            feePo.setFeeTypeCd(FeeTypeConstant.FEE_TYPE_REPAIR);\n            feePo.setIncomeObjId(reqJson.getString("storeId"));\n            feePo.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_ROOM);\n            feePo.setAmount(reqJson.getString("totalPrice"));\n            feePo.setBatchId("-1");\n            RepairDto repairDto = new RepairDto();\n            repairDto.setCommunityId(reqJson.getString("communityId"));\n            repairDto.setRepairId(reqJson.getString("repairId"));\n            List<RepairDto> repairDtos = repairInnerServiceSMOImpl.queryRepairs(repairDto);\n            if (repairDtos.size() != 1) {\n                ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "维修单有多条或不存在！");\n                context.setResponseEntity(responseEntity);\n                return;\n            }\n            feePo.setPayerObjId(repairDtos.get(0).getRepairObjId());\n            feePo.setStartTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));\n            feePo.setState(FeeDto.STATE_DOING);\n            feePo.setUserId(userId);\n            super.insert(context, feePo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_INFO);\n            FeeAttrPo feeAttrPo = new FeeAttrPo();\n            feeAttrPo.setAttrId("-1");\n            feeAttrPo.setFeeId(feePo.getFeeId());\n            feeAttrPo.setSpecCd(FeeAttrDto.SPEC_CD_REPAIR);\n            feeAttrPo.setCommunityId(reqJson.getString("communityId"));\n            feeAttrPo.setValue(reqJson.getString("repairId"));\n            super.insert(context, feeAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_INFO);\n            //改变r_repair_pool表maintenance_type维修类型\n            RepairPoolPo repairPoolPo = new RepairPoolPo();\n            repairPoolPo.setRepairId(reqJson.getString("repairId"));\n            //维修类型\n            repairPoolPo.setMaintenanceType(reqJson.getString("maintenanceType"));\n            //用料\n            repairPoolPo.setRepairMaterials(repairMaterial.substring(0, repairMaterial.length() - 1));\n            //费用明细\n            repairPoolPo.setRepairFee(repairFee.substring(0, repairFee.length() - 1));\n            //支付方式\n            repairPoolPo.setPayType(reqJson.getString("payType"));\n            super.update(context, repairPoolPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_REPAIR);\n            ownerRepairBMOImpl.modifyBusinessRepairDispatch(reqJson, context, RepairDto.STATE_PAY);\n        } else if ("T".equals(publicArea)) {  //公共区域走这里\n            //公共区域用料时修改维修类型和用料\n            if ("1003".equals(maintenanceType)) {\n                //改变r_repair_pool表maintenance_type维修类型\n                RepairPoolPo repairPoolPo = new RepairPoolPo();\n                repairPoolPo.setRepairId(reqJson.getString("repairId"));\n                //维修类型\n                repairPoolPo.setMaintenanceType(reqJson.getString("maintenanceType"));\n                //用料\n                repairPoolPo.setRepairMaterials(repairMaterial.substring(0, repairMaterial.length() - 1));\n                super.update(context, repairPoolPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_REPAIR);\n            }\n            if ("T".equals(repairChannel) || "D".equals(repairChannel)) { //如果是电话报修和员工代客报修结单后状态变为待回访\n                ownerRepairBMOImpl.modifyBusinessRepairDispatch(reqJson, context, RepairDto.STATE_RETURN_VISIT);\n            } else if ("Z".equals(repairChannel)) { //如果是业主自主报修结单后状态变为待评价\n                ownerRepairBMOImpl.modifyBusinessRepairDispatch(reqJson, context, RepairDto.STATE_APPRAISE);\n            }\n        }\n        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_OK, ResultVo.MSG_OK);\n        context.setResponseEntity(responseEntity);\n    }\n\n    @Override\n    public String getServiceCode() {\n        return ServiceCodeRepairDispatchStepConstant.BINDING_REPAIR_FINISH;\n    }\n\n    @Override\n    public HttpMethod getHttpMethod() {\n        return HttpMethod.POST;\n    }\n\n    @Override\n    public int getOrder() {\n        return DEFAULT_ORDER;\n    }\n\n    public IRepairInnerServiceSMO getRepairInnerServiceSMOImpl() {\n        return repairInnerServiceSMOImpl;\n    }\n\n    public void setRepairInnerServiceSMOImpl(IRepairInnerServiceSMO repairInnerServiceSMOImpl) {\n        this.repairInnerServiceSMOImpl = repairInnerServiceSMOImpl;\n    }\n}\n', 'message': '优化采购管理细节问题\n', 'author_name': 'xiaogang', 'lang': 'java'}