datacopy.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\command;
  4. use think\console\Command;
  5. use think\console\Input;
  6. use think\console\input\Argument;
  7. use think\console\input\Option;
  8. use think\console\Output;
  9. use think\facade\Cache;
  10. use think\facade\Db;
  11. class datacopy extends Command
  12. {
  13. protected function configure()
  14. {
  15. // 指令配置
  16. $this->setName('datacopy')
  17. ->setDescription('the datacopy command');
  18. }
  19. protected function execute(Input $input, Output $output)
  20. {
  21. $redis = Cache::store('redis');
  22. $iscgd = $redis->get("data");
  23. if($iscgd==0){
  24. $redis->set("data",1,10800);
  25. }else{
  26. return;
  27. }
  28. for($i=0;$i<=1000;$i++){
  29. Db::startTrans();
  30. $data = $this->GetData();
  31. if (!empty($data)) {
  32. $result = false;
  33. $obj = json_decode($data['data'], true);
  34. if ($obj['appCode'] == "purchase") {
  35. $obj['StaffSelector1618885082387'] = isset($obj['StaffSelector1618885082387']['name']) ? $obj['StaffSelector1618885082387']['name'] : "";
  36. $obj['StaffSelector1620899427104'] = isset($obj['StaffSelector1620899427104']['name']) ? $obj['StaffSelector1620899427104']['name'] : "";
  37. $list = [
  38. "name" => $obj['name'],
  39. "createdTime" => $obj['createdTime'],
  40. "startTime" => $obj['startTime'],
  41. "finishTime" => $obj['finishTime'],
  42. "ownerName" => $obj['creater'],
  43. "department" => $obj['createdDeptId'],
  44. "sequenceNo" => $obj['sequenceNo'],
  45. "sequenceStatus" => $obj['sequenceStatus'],
  46. "ShortText1618270412964" => $obj['ShortText1618270412964'],
  47. "ShortText1618270466672" => $obj['ShortText1618270466672'],
  48. "number1618272663951" => $obj['number1618272663951'],
  49. "ShortText1618308753677" => $obj['ShortText1618308753677'],
  50. "ShortText1618315935182" => $obj['ShortText1618315935182'],
  51. "Date1618315953443" => $obj['Date1618315953443'],
  52. "Number1618316157066" => $obj['Number1618316157066'],
  53. "Number1618316171848" => $obj['Number1618316171848'],
  54. "ShortText1617866362204" => $obj['ShortText1617866362204'],
  55. "ShortText1617866360004" => $obj['ShortText1617866360004'],
  56. "ShortText1618239976714" => $obj['ShortText1618239976714'],
  57. "ShortText1617866364821" => $obj['ShortText1617866364821'],
  58. "ShortText1618239993162" => $obj['ShortText1618239993162'],
  59. "RelevanceForm1617860945268" => $obj['RelevanceForm1617860945268'],
  60. "ShortText1617861001482" => $obj['ShortText1617861001482'],
  61. "ShortText1617861966146" => $obj['ShortText1617861966146'],
  62. "ShortText1617865626160" => $obj['ShortText1617865626160'],
  63. "ShortText1617865633070" => $obj['ShortText1617865633070'],
  64. "ShortText1617865675342" => $obj['ShortText1617865675342'],
  65. "ShortText1617865678025" => $obj['ShortText1617865678025'],
  66. "ShortText1617865680605" => $obj['ShortText1617865680605'],
  67. "ShortText1617865683042" => $obj['ShortText1617865683042'],
  68. "text1618268357055" => $obj['text1618268357055'],
  69. "ShortText1617865685744" => $obj['ShortText1617865685744'],
  70. "Number1618240480148" => $obj['Number1618240480148'],
  71. "ShortText1618240134229" => $obj['ShortText1618240134229'],
  72. "Number1618240458074" => $obj['Number1618240458074'],
  73. "ShortText1617866158120" => $obj['ShortText1617866158120'],
  74. "Number1618240350696" => $obj['Number1618240350696'],
  75. "number1618240356104" => $obj['number1618240356104'],
  76. "ShortText1617865688485" => $obj['ShortText1617865688485'],
  77. "Number1617865804813" => $obj['Number1617865804813'],
  78. "Number1617865807879" => $obj['Number1617865807879'],
  79. "Number1617865810822" => $obj['Number1617865810822'],
  80. "Number1617865813284" => $obj['Number1617865813284'],
  81. "Number1617865816181" => $obj['Number1617865816181'],
  82. "number1618240204358" => $obj['number1618240204358'],
  83. "number1618240287778" => $obj['number1618240287778'],
  84. "Number1617865818517" => $obj['Number1617865818517'],
  85. "Number1617865824797" => $obj['Number1617865824797'],
  86. "ShortText1617866144054" => $obj['ShortText1617866144054'],
  87. "Number1618240600907" => $obj['Number1618240600907'],
  88. "Number1618240685904" => $obj['Number1618240685904'],
  89. "RelevanceForm1617861284547" => $obj['RelevanceForm1617861284547'],
  90. "ShortText1617861287265" => $obj['ShortText1617861287265'],
  91. "ShortText1617861449444" => $obj['ShortText1617861449444'],
  92. "ShortText1617861455145" => $obj['ShortText1617861455145'],
  93. "Date1617866234869" => $obj['Date1617866234869'],
  94. "Date1618324547052" => $obj['Date1618324547052'],
  95. "Number1618330470625" => $obj['Number1618330470625'],
  96. "Number1618330472961" => $obj['Number1618330472961'],
  97. "Number1618330541286" => $obj['Number1618330541286'],
  98. "Number1618330543270" => $obj['Number1618330543270'],
  99. "ShortText1618465932373" => $obj['ShortText1618465932373'],
  100. "number1618467257146" => $obj['number1618467257146'],
  101. "ShortText1618859161646" => $obj['ShortText1618859161646'],
  102. "Date1618859180209" => $obj['Date1618859180209'],
  103. "StaffSelector1618859194105" => $obj['StaffSelector1618859194105'],
  104. "ShortText1618859321070" => $obj['ShortText1618859321070']=='已发'? 3 :1,
  105. "StaffSelector1618885082387" => $obj['StaffSelector1618885082387'],
  106. "ShortText1618900704399" => $obj['ShortText1618900704399'],
  107. "Date1619009560712" => $obj['Date1619009560712'],
  108. "ShortText1619147112929" => $obj['ShortText1619147112929'],
  109. "ShortText1619164207953" => $obj['ShortText1619164207953'],
  110. "ShortText1619463188366" => $obj['ShortText1619463188366']=="已付"? 3 : 1,
  111. "ShortText1619463208482" => $obj['ShortText1619463208482']=="已回"? 3 : 1,
  112. "Date1619624209148" => $obj['Date1619624209148'],
  113. "ShortText1619624490635" => $obj['ShortText1619624490635'],
  114. "Number1619625470651" => $obj['Number1619625470651'],
  115. "Number1619625483510" => $obj['Number1619625483510'],
  116. "ShortText1619625566608" => $obj['ShortText1619625566608'],
  117. "Number1619632826654" => $obj['Number1619632826654'],
  118. "Number1619632830397" => $obj['Number1619632830397'],
  119. "RelevanceForm1620373842422" => $obj['RelevanceForm1620373842422'],
  120. "ShortText1620399144946" => $obj['ShortText1620399144946'],
  121. "ShortText1620753234895" => $obj['ShortText1620753234895'],
  122. "ShortText1620753237335" => $obj["ShortText1620753237335"],
  123. "StaffSelector1620899427104" => $obj["StaffSelector1620899427104"],
  124. ];
  125. $result = Db::name("cgd_info")->insert($list);
  126. }
  127. if ($obj['appCode'] == "kefuguanlibu") {
  128. $obj['StaffSelector1618445844046'] = isset($obj['StaffSelector1618445844046']['name']) ? $obj['StaffSelector1618445844046']['name'] : "";
  129. $obj['StaffSelector1619488013389'] = isset($obj['StaffSelector1619488013389']['name']) ? $obj['StaffSelector1619488013389']['name'] : "";
  130. $obj['StaffSelector1618445850209'] = isset($obj['StaffSelector1618445850209']['name']) ? $obj['StaffSelector1618445850209']['name'] : "";
  131. $list = [
  132. "name" => $obj['name'],
  133. "createdTime" => $obj['createdTime'],
  134. "startTime" => $obj['startTime'],
  135. "ownerName" => $obj['creater'],
  136. "departmentName" => $obj['createdDeptId'],
  137. "finishTime" => $obj['finishTime'],
  138. "sequenceNo" => $obj['sequenceNo'],
  139. "sequenceStatus" => $obj['sequenceStatus'],
  140. "Date1617081795606" => $obj['Date1617081795606'],
  141. "RelevanceForm1617022738190" => $obj['RelevanceForm1617022738190'],
  142. "ShortText1617081712980" => $obj['ShortText1617081712980'],
  143. "ShortText1617022967356" => $obj['ShortText1617022967356'],
  144. "ShortText1617023369580" => $obj['ShortText1617023369580'],
  145. "ShortText1617111725596" => $obj['ShortText1617111725596'],
  146. "ShortText1617365292699" => $obj['ShortText1617365292699'],
  147. "text1617499162303" => $obj['text1617499162303'],
  148. "ShortText1617365495029" => $obj['ShortText1617365495029'],
  149. "ShortText1617499192065" => $obj['ShortText1617499192065'],
  150. "ShortText1617499210157" => $obj['ShortText1617499210157'],
  151. "text1617365578699" => $obj['text1617365578699'],
  152. "text1617365594353" => $obj['text1617365594353'],
  153. "text1617365597522" => $obj['text1617365597522'],
  154. "text1617365646297" => $obj['text1617365646297'],
  155. "text1617365950353" => $obj['text1617365950353'],
  156. "ShortText1617366563255" => $obj['ShortText1617366563255'],
  157. "number1617366111666" => $obj['number1617366111666'],
  158. "number1617366110639" => $obj['number1617366110639'],
  159. "ShortText1617366186330" => $obj['ShortText1617366186330'],
  160. "ShortText1617367958909" => $obj['ShortText1617367958909'],
  161. "Number1617365688048" => $obj['Number1617365688048'],
  162. "Number1617366579767" => $obj['Number1617366579767'],
  163. "Number1617366626104" => $obj['Number1617366626104'],
  164. "ShortText1617650669915" => $obj['ShortText1617650669915'],
  165. "ShortText1617650701648" => $obj['ShortText1617650701648'],
  166. "ShortText1617670912205" => $obj['ShortText1617670912205'],
  167. "ShortText1617874567622" => $obj['ShortText1617874567622'],
  168. "Number1618248810624" => $obj['Number1618248810624'],
  169. "Number1618248813613" => $obj['Number1618248813613'],
  170. "Number1618249015661" => $obj['Number1618249015661'],
  171. "Number1618249019294" => $obj['Number1618249019294'],
  172. "Number1618249146997" => $obj['Number1618249146997'],
  173. "number1618249149738" => $obj['number1618249149738'],
  174. "Number1618249202608" => $obj['Number1618249202608'],
  175. "Number1618249205231" => $obj['Number1618249205231'],
  176. "number1618249258956" => $obj['number1618249258956'],
  177. "ShortText1618267589049" => $obj['ShortText1618267589049'],
  178. "StaffSelector1618445844046" => $obj['StaffSelector1618445844046'],
  179. "StaffSelector1618445850209" => $obj['StaffSelector1618445850209'],
  180. "ShortText1618446328311" => $obj['ShortText1618446328311'],
  181. "ShortText1618446949933" => $obj['ShortText1618446949933'],
  182. "ShortText1618446973813" => $obj['ShortText1618446973813'],
  183. "LongText1618446982973" => $obj['LongText1618446982973'],
  184. "Date1618447068290" => $obj['Date1618447068290'],
  185. "ShortText1618447165317" => $obj['ShortText1618447165317'],
  186. "ShortText1618559007040" => $obj['ShortText1618559007040'],
  187. "ShortText1618559043560" =>$obj['ShortText1618559043560']=="已回"? 3 : 1,
  188. "ShortText1618559274859" =>$obj['ShortText1618559274859']=="已开"? 3 : 1,
  189. "ShortText1618887148862" => $obj['ShortText1618887148862'],
  190. "ShortText1619146965777" => $obj['ShortText1619146965777'],
  191. "ShortText1619164078168" => $obj['ShortText1619164078168'],
  192. "Date1619401771986" => $obj['Date1619401771986'],
  193. "Date1619402124793" => $obj['Date1619402124793'],
  194. "Number1619403905454" => $obj['Number1619403905454'],
  195. "Number1619403908740" => $obj['Number1619403908740'],
  196. "ShortText1619413388848" => $obj['ShortText1619413388848'],
  197. "ShortText1619413394855" => $obj['ShortText1619413394855'],
  198. "ShortText1619413401534" => $obj['ShortText1619413401534'],
  199. "ShortText1619487657199" => $obj['ShortText1619487657199'],
  200. "StaffSelector1619488013389" => $obj['StaffSelector1619488013389'],
  201. "ShortText1619523689586" => $obj['ShortText1619523689586'],
  202. "ShortText1619523693355" => $obj['ShortText1619523693355'],
  203. "ShortText1619523892833" => $obj['ShortText1619523892833'],
  204. "Date1619542686640" => $obj['Date1619542686640'],
  205. "RelevanceForm1619542896677" => $obj['RelevanceForm1619542896677'],
  206. "ShortText1619542951283" => $obj['ShortText1619542951283'],
  207. "ShortText1619543001392" => $obj['ShortText1619543001392'],
  208. "ShortText1619610909619" => $obj['ShortText1619610909619'],
  209. "Date1619626098213" => $obj['Date1619626098213'],
  210. "ShortText1619626536464" => $obj['ShortText1619626536464'],
  211. "Number1619626656082" => $obj['Number1619626656082'],
  212. "Number1619626666450" => $obj['Number1619626666450'],
  213. "Number1619632062547" => $obj['Number1619632062547'],
  214. "ShortText1619743751825" => $obj['ShortText1619743751825'],
  215. "text1619743754479" => $obj['text1619743754479'],
  216. "text1619743755335" => $obj['text1619743755335'],
  217. "text1619743756377" => $obj['text1619743756377'],
  218. "Date1620370378620" => $obj['Date1620370378620'],
  219. "ShortText1620750298602" => $obj['ShortText1620750298602'],
  220. "ShortText1620750301301" => $obj['ShortText1620750301301'],
  221. "RelevanceForm1620750481892" => $obj['RelevanceForm1620750481892'],
  222. "Number1620751537737" => $obj['Number1620751537737'],
  223. "Date1620751562219" => $obj['Date1620751562219']
  224. ];
  225. $result = Db::name("qrd_info")->insert($list);
  226. }
  227. if ($result) {
  228. $l = Db::table("source_data")->where($data)->save(['status' => 0]);
  229. if ($l) {
  230. Db::commit();
  231. }
  232. }
  233. }
  234. Db::rollback();
  235. }
  236. $redis->set("data",0);
  237. $output->writeln('datacopy');
  238. }
  239. public function GetData(){
  240. $list = Db::table("source_data")->where("status","=",1)->lock(true)->find();
  241. return $list;
  242. }
  243. }