package com.malk.huagao.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.malk.huagao.entity.KdYdCustomer; import com.malk.huagao.mapper.KdYdCustomerMapper; import com.malk.huagao.service.IKdYdCustomerService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.malk.server.aliwork.YDConf; import com.malk.server.aliwork.YDParam; import com.malk.server.dingtalk.DDR_New; import com.malk.service.aliwork.YDClient; import com.malk.utils.UtilMap; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.util.Map; /** *

* 服务实现类 *

* * @author LQY * @since 2025-10-09 */ @Service public class KdYdCustomerServiceImpl extends ServiceImpl implements IKdYdCustomerService { @Autowired private YDClient ydClient; @Autowired private KdYdCustomerMapper kdYdCustomerMapper; @Override public void insertCustomer(Map map) { MDC.put("MDC_KEY_PID", "1003"); String formInstId = UtilMap.getString(map, "formInstId"); DDR_New ddrNew = ydClient.queryData(YDParam.builder() .formInstId(formInstId) .build(), YDConf.FORM_QUERY.retrieve_id); Map formData = ddrNew.getFormData(); System.out.println(formData); String khmc = UtilMap.getString(formData, "textField_lqanqe6j"); String khbm = UtilMap.getString(formData, "textField_meqhqqvg"); String xssx = UtilMap.getString(formData, "selectField_megi74y7"); String khxypj = UtilMap.getString(formData, "selectField_mewirdx4"); String khsx = UtilMap.getString(formData, "selectField_megi74y8"); String jxr = UtilMap.getString(formData, "employeeField_megi74yl").replace("[\"", "").replace("\"]", "").trim(); String khlb = UtilMap.getString(formData, "selectField_lqanqe6l"); String khfz = UtilMap.getString(formData, "selectField_lqanqe6q"); String fptt = UtilMap.getString(formData, "textField_llujklkr"); String nsdjh = UtilMap.getString(formData, "textField_meqhqqvm"); String khyh = UtilMap.getString(formData, "textField_meqhqqvn"); String yhzh = UtilMap.getString(formData, "textField_meqhqqvs"); String kplx = UtilMap.getString(formData, "selectField_lwopqbye"); String kplxdh = UtilMap.getString(formData, "textField_llujklkp"); String kptxdz = UtilMap.getString(formData, "textField_llujklkv"); String uuid = UtilMap.getString(formData, "textField_mgowmnlf"); String tyshxydm = UtilMap.getString(formData, "textField_mfxrrysq"); // String spdzyx = UtilMap.getString(formData, "textField_mg0fq6l4"); String khtjr = UtilMap.getString(formData, "textField_mfdrrg87"); String sktj = UtilMap.getString(formData, "selectField_meqhqqvh"); String xsy = UtilMap.getString(formData, "employeeField_lqanqe6n").replace("[\"", "").replace("\"]", "").trim(); String jsbb = UtilMap.getString(formData, "selectField_mfxrryt0"); String khyxj = UtilMap.getString(formData, "numberField_mfxs7rd3"); String qyxygl = UtilMap.getString(formData, "radioField_mfxs7rd2"); String mrsl = UtilMap.getString(formData, "selectField_mfxrryt3"); String sfl = UtilMap.getString(formData, "selectField_mfxrryt2"); String tjruuid = UtilMap.getString(formData, "textField_mgqbiov3"); KdYdCustomer kdYdCustomer = new KdYdCustomer(); kdYdCustomer.setKhmc(khmc); kdYdCustomer.setXssx(xssx); kdYdCustomer.setKhsx(khsx); kdYdCustomer.setKhlb(khlb); kdYdCustomer.setKhfz(khfz); kdYdCustomer.setFptt(fptt); kdYdCustomer.setNsdjh(nsdjh); kdYdCustomer.setKhyh(khyh); kdYdCustomer.setYhzh(yhzh); kdYdCustomer.setKplx(kplx); kdYdCustomer.setKplxdh(kplxdh); kdYdCustomer.setKptxdz(kptxdz); kdYdCustomer.setTyshxydm(tyshxydm); kdYdCustomer.setKhtjr(khtjr); kdYdCustomer.setUuid(uuid); kdYdCustomer.setSktj(sktj); kdYdCustomer.setXsy(xsy); kdYdCustomer.setJsbb(jsbb); kdYdCustomer.setKhyxj(khyxj); kdYdCustomer.setQyxygl(qyxygl); kdYdCustomer.setMrsl(mrsl); kdYdCustomer.setSfl(sfl); kdYdCustomer.setKhbm(khbm); kdYdCustomer.setJxr(jxr); kdYdCustomer.setKhxypj(khxypj); kdYdCustomer.setFormInstId(formInstId); kdYdCustomer.setTjruuid(tjruuid); boolean save = this.save(kdYdCustomer); // LambdaQueryWrapper YdCustomerLambdaQueryWrapper = new LambdaQueryWrapper<>(); // YdCustomerLambdaQueryWrapper.eq(KdYdCustomer::getFormInstId, formInstId); // KdYdCustomer kdYdCustomer1 = kdYdCustomerMapper.selectOne(YdCustomerLambdaQueryWrapper); // Long id = kdYdCustomer1.getId(); // ydClient.operateData( // YDParam.builder() // .formInstanceId(formInstId) // .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("textField_mgowmnli", id))) // .useLatestVersion(true).build(), YDConf.FORM_OPERATION.update); } }