Your Name
2023-07-11 d7d9b601b2e4fdb663375993e2cfbdbd363df421
service-user/src/main/java/com/java110/user/cmd/examine/SaveExamineStaffCmd.java
@@ -23,15 +23,19 @@
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.core.smo.IPhotoSMO;
import com.java110.dto.user.UserDto;
import com.java110.intf.user.IExamineStaffIntroductionV1InnerServiceSMO;
import com.java110.intf.user.IExamineStaffProjectV1InnerServiceSMO;
import com.java110.intf.user.IExamineStaffV1InnerServiceSMO;
import com.java110.intf.user.IUserV1InnerServiceSMO;
import com.java110.po.examineStaff.ExamineStaffPo;
import com.java110.po.examineStaffProject.ExamineStaffProjectPo;
import com.java110.po.examine.ExamineStaffPo;
import com.java110.po.examine.ExamineStaffIntroductionPo;
import com.java110.po.examine.ExamineStaffProjectPo;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.utils.util.StringUtil;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.slf4j.Logger;
@@ -65,10 +69,17 @@
    @Autowired
    private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
    @Autowired
    private IExamineStaffIntroductionV1InnerServiceSMO examineStaffIntroductionV1InnerServiceSMOImpl;
    @Autowired
    private IPhotoSMO photoSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "staffId", "请求报文中未包含staffId");
        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
        Assert.hasKeyAndValue(reqJson, "introduction", "请求报文中未包含communityId");
        if (!reqJson.containsKey("projectIds")) {
            throw new CmdException("没包含考核项目");
@@ -104,7 +115,7 @@
        JSONArray projectIds = reqJson.getJSONArray("projectIds");
        ExamineStaffProjectPo tmpExamineStaffProjectPo = null;
        for(int projectIndex = 0;projectIndex < projectIds.size();projectIndex ++){
        for (int projectIndex = 0; projectIndex < projectIds.size(); projectIndex++) {
            tmpExamineStaffProjectPo = new ExamineStaffProjectPo();
            tmpExamineStaffProjectPo.setEsId(examineStaffPo.getEsId());
            tmpExamineStaffProjectPo.setCommunityId(examineStaffPo.getCommunityId());
@@ -113,6 +124,22 @@
            examineStaffProjectV1InnerServiceSMOImpl.saveExamineStaffProject(tmpExamineStaffProjectPo);
        }
        // todo save examine staff introduction
        if (reqJson.containsKey("introduction") && !StringUtil.isEmpty(reqJson.getString("introduction"))) {
            ExamineStaffIntroductionPo examineStaffIntroductionPo = new ExamineStaffIntroductionPo();
            examineStaffIntroductionPo.setEsiId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
            examineStaffIntroductionPo.setStaffId(reqJson.getString("staffId"));
            examineStaffIntroductionPo.setIntroduction(reqJson.getString("introduction"));
            examineStaffIntroductionPo.setCommunityId(reqJson.getString("communityId"));
            examineStaffIntroductionV1InnerServiceSMOImpl.saveExamineStaffIntroduction(examineStaffIntroductionPo);
        }
        // todo save examine staff face image
        photoSMOImpl.savePhoto(reqJson.getString("headerImg"),
                examineStaffPo.getEsId(),
                reqJson.getString("communityId"));
        cmdDataFlowContext.setResponseEntity(ResultVo.success());
    }
}