KdYdCustomerServiceImpl.java 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package com.malk.huagao.service.impl;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4. import com.malk.huagao.entity.KdYdCustomer;
  5. import com.malk.huagao.mapper.KdYdCustomerMapper;
  6. import com.malk.huagao.service.IKdYdCustomerService;
  7. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  8. import com.malk.server.aliwork.YDConf;
  9. import com.malk.server.aliwork.YDParam;
  10. import com.malk.server.dingtalk.DDR_New;
  11. import com.malk.service.aliwork.YDClient;
  12. import com.malk.utils.UtilMap;
  13. import org.slf4j.MDC;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.stereotype.Service;
  16. import java.time.LocalDateTime;
  17. import java.util.Map;
  18. /**
  19. * <p>
  20. * 服务实现类
  21. * </p>
  22. *
  23. * @author LQY
  24. * @since 2025-10-09
  25. */
  26. @Service
  27. public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdYdCustomer> implements IKdYdCustomerService {
  28. @Autowired
  29. private YDClient ydClient;
  30. @Autowired
  31. private KdYdCustomerMapper kdYdCustomerMapper;
  32. @Override
  33. public void insertCustomer(Map map) {
  34. MDC.put("MDC_KEY_PID", "1003");
  35. String formInstId = UtilMap.getString(map, "formInstId");
  36. DDR_New ddrNew = ydClient.queryData(YDParam.builder()
  37. .formInstId(formInstId)
  38. .build(), YDConf.FORM_QUERY.retrieve_id);
  39. Map formData = ddrNew.getFormData();
  40. System.out.println(formData);
  41. String khmc = UtilMap.getString(formData, "textField_lqanqe6j");
  42. String khbm = UtilMap.getString(formData, "textField_meqhqqvg");
  43. String xssx = UtilMap.getString(formData, "selectField_megi74y7");
  44. String khxypj = UtilMap.getString(formData, "selectField_mewirdx4");
  45. String khsx = UtilMap.getString(formData, "selectField_megi74y8");
  46. String jxr = UtilMap.getString(formData, "employeeField_megi74yl").replace("[\"", "").replace("\"]", "").trim();
  47. String khlb = UtilMap.getString(formData, "selectField_lqanqe6l");
  48. String khfz = UtilMap.getString(formData, "selectField_lqanqe6q");
  49. String fptt = UtilMap.getString(formData, "textField_llujklkr");
  50. String nsdjh = UtilMap.getString(formData, "textField_meqhqqvm");
  51. String khyh = UtilMap.getString(formData, "textField_meqhqqvn");
  52. String yhzh = UtilMap.getString(formData, "textField_meqhqqvs");
  53. String kplx = UtilMap.getString(formData, "selectField_lwopqbye");
  54. String kplxdh = UtilMap.getString(formData, "textField_llujklkp");
  55. String kptxdz = UtilMap.getString(formData, "textField_llujklkv");
  56. String uuid = UtilMap.getString(formData, "textField_mgowmnlf");
  57. String tyshxydm = UtilMap.getString(formData, "textField_mfxrrysq");
  58. // String spdzyx = UtilMap.getString(formData, "textField_mg0fq6l4");
  59. String khtjr = UtilMap.getString(formData, "textField_mfdrrg87");
  60. String sktj = UtilMap.getString(formData, "selectField_meqhqqvh");
  61. String xsy = UtilMap.getString(formData, "employeeField_lqanqe6n").replace("[\"", "").replace("\"]", "").trim();
  62. String jsbb = UtilMap.getString(formData, "selectField_mfxrryt0");
  63. String khyxj = UtilMap.getString(formData, "numberField_mfxs7rd3");
  64. String qyxygl = UtilMap.getString(formData, "radioField_mfxs7rd2");
  65. String mrsl = UtilMap.getString(formData, "selectField_mfxrryt3");
  66. String sfl = UtilMap.getString(formData, "selectField_mfxrryt2");
  67. String tjruuid = UtilMap.getString(formData, "textField_mgqbiov3");
  68. KdYdCustomer kdYdCustomer = new KdYdCustomer();
  69. kdYdCustomer.setKhmc(khmc);
  70. kdYdCustomer.setXssx(xssx);
  71. kdYdCustomer.setKhsx(khsx);
  72. kdYdCustomer.setKhlb(khlb);
  73. kdYdCustomer.setKhfz(khfz);
  74. kdYdCustomer.setFptt(fptt);
  75. kdYdCustomer.setNsdjh(nsdjh);
  76. kdYdCustomer.setKhyh(khyh);
  77. kdYdCustomer.setYhzh(yhzh);
  78. kdYdCustomer.setKplx(kplx);
  79. kdYdCustomer.setKplxdh(kplxdh);
  80. kdYdCustomer.setKptxdz(kptxdz);
  81. kdYdCustomer.setTyshxydm(tyshxydm);
  82. kdYdCustomer.setKhtjr(khtjr);
  83. kdYdCustomer.setUuid(uuid);
  84. kdYdCustomer.setSktj(sktj);
  85. kdYdCustomer.setXsy(xsy);
  86. kdYdCustomer.setJsbb(jsbb);
  87. kdYdCustomer.setKhyxj(khyxj);
  88. kdYdCustomer.setQyxygl(qyxygl);
  89. kdYdCustomer.setMrsl(mrsl);
  90. kdYdCustomer.setSfl(sfl);
  91. kdYdCustomer.setKhbm(khbm);
  92. kdYdCustomer.setJxr(jxr);
  93. kdYdCustomer.setKhxypj(khxypj);
  94. kdYdCustomer.setFormInstId(formInstId);
  95. kdYdCustomer.setTjruuid(tjruuid);
  96. boolean save = this.save(kdYdCustomer);
  97. // LambdaQueryWrapper<KdYdCustomer> YdCustomerLambdaQueryWrapper = new LambdaQueryWrapper<>();
  98. // YdCustomerLambdaQueryWrapper.eq(KdYdCustomer::getFormInstId, formInstId);
  99. // KdYdCustomer kdYdCustomer1 = kdYdCustomerMapper.selectOne(YdCustomerLambdaQueryWrapper);
  100. // Long id = kdYdCustomer1.getId();
  101. // ydClient.operateData(
  102. // YDParam.builder()
  103. // .formInstanceId(formInstId)
  104. // .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("textField_mgowmnli", id)))
  105. // .useLatestVersion(true).build(), YDConf.FORM_OPERATION.update);
  106. }
  107. }