Search in sources :

Example 11 with ContactForm

use of com.eservice.api.model.contact_form.ContactForm in project sinsim by WilsonHu.

the class ContactFormController method startSign.

/**
 * 联系单发起审核
 *
 * @param lxdId
 * @return
 */
@PostMapping("/startSign")
@Transactional(rollbackFor = Exception.class)
public Result startSign(@RequestParam Integer lxdId) {
    if (lxdId == null) {
        ResultGenerator.genFailResult("联系单ID为空!");
    } else {
        ContactSign contactSign = contactSignService.getContactSignByLxdId((lxdId));
        if (contactSign == null) {
            return ResultGenerator.genFailResult("根据联系单ID号获取 签核信息失败!");
        } else {
            List<SignContentItem> contactSignContentList = JSON.parseArray(contactSign.getSignContent(), SignContentItem.class);
            String currentStep = "";
            for (SignContentItem item : contactSignContentList) {
                // 签核在初始化,则把当前步骤设为发起部门
                if (item.getResult() == Constant.SIGN_INITIAL && item.getShenHeEnabled()) {
                    currentStep = roleService.findById(item.getRoleId()).getRoleName();
                    break;
                }
            }
            contactSign.setCurrentStep(currentStep);
            logger.info("开始 联系单签核 currentStep " + currentStep);
            // 更新审核数据currentstep
            contactSignService.update(contactSign);
            // 更新联系单状态为 STR_LXD_CHECKING
            ContactForm contactForm = contactFormService.findById(lxdId);
            if (contactForm == null) {
                return ResultGenerator.genFailResult("联系单号ID无效");
            } else {
                contactForm.setStatus(Constant.STR_LXD_CHECKING);
                contactForm.setUpdateDate(new Date());
                logger.info("联系单签核 setStatus " + Constant.STR_LXD_CHECKING);
                contactFormService.update(contactForm);
                commonService.pushLxdMsgToAftersale(contactSign, contactForm, false, Constant.STR_MSG_PUSH_IS_START_TO_SIGN);
            }
        }
    }
    return ResultGenerator.genSuccessResult();
}
Also used : ContactSign(com.eservice.api.model.contact_sign.ContactSign) SignContentItem(com.eservice.api.model.contract_sign.SignContentItem) ContactForm(com.eservice.api.model.contact_form.ContactForm) HSSFRichTextString(org.apache.poi.hssf.usermodel.HSSFRichTextString) Date(java.util.Date) PostMapping(org.springframework.web.bind.annotation.PostMapping) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ContactForm (com.eservice.api.model.contact_form.ContactForm)11 PostMapping (org.springframework.web.bind.annotation.PostMapping)9 ContactSign (com.eservice.api.model.contact_sign.ContactSign)6 HSSFRichTextString (org.apache.poi.hssf.usermodel.HSSFRichTextString)5 Transactional (org.springframework.transaction.annotation.Transactional)5 ChangeItem (com.eservice.api.model.change_item.ChangeItem)4 Date (java.util.Date)4 ContactFormAllInfo (com.eservice.api.model.contact_form.ContactFormAllInfo)3 ContactFulfill (com.eservice.api.model.contact_fulfill.ContactFulfill)3 SignContentItem (com.eservice.api.model.contract_sign.SignContentItem)3 FileNotFoundException (java.io.FileNotFoundException)3 IOException (java.io.IOException)3 File (java.io.File)2 SimpleDateFormat (java.text.SimpleDateFormat)2 MultipartFile (org.springframework.web.multipart.MultipartFile)2 ContactFormDetail (com.eservice.api.model.contact_form.ContactFormDetail)1 MachineOrder (com.eservice.api.model.machine_order.MachineOrder)1 Role (com.eservice.api.model.role.Role)1 User (com.eservice.api.model.user.User)1 UserDetail (com.eservice.api.model.user.UserDetail)1